From 74404749c673138a72029d8d0f40eaf70a252cc2 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 28 Feb 2014 16:00:57 +0100
Subject: [PATCH] Fix: [ bug #1254 ] Error when using "Enter" on qty input box
 of a

---
 htdocs/fourn/commande/fiche.php | 8 ++++++--
 htdocs/fourn/facture/fiche.php  | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index cdb8b4f93a6..add5090e081 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -186,7 +186,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
     $error = 0;
 
 	// Set if we used free entry or predefined product
-	if (GETPOST('addline_libre'))
+	if (GETPOST('addline_libre')
+			|| (GETPOST('dp_desc') && ! GETPOST('addline_libre') && ! GETPOST('idprod', 'int')>0)	// we push enter onto qty field
+			)
 	{
 		$predef='';
 		$idprod=0;
@@ -194,7 +196,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
 		$price_ht = GETPOST('price_ht');
 		$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
 	}
-	if (GETPOST('addline_predefined'))
+	if (GETPOST('addline_predefined')
+			|| (! GETPOST('dp_desc') && ! GETPOST('addline_predefined') && GETPOST('idprod', 'int')>0)	// we push enter onto qty field
+			)			
 	{
 		$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
 		$idprod=GETPOST('idprod', 'int');
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index cf47afcf10c..fd4a988cedf 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -532,7 +532,9 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
 	$error=0;
 
 	// Set if we used free entry or predefined product
-	if (GETPOST('addline_libre'))
+	if (GETPOST('addline_libre')
+			|| (GETPOST('dp_desc') && ! GETPOST('addline_libre') && ! GETPOST('idprod', 'int')>0)	// we push enter onto qty field
+			)
 	{
 		$predef='';
 		$idprod=0;
@@ -540,7 +542,9 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
 		$price_ht = GETPOST('price_ht');
 		$tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
 	}
-	if (GETPOST('addline_predefined'))
+	if (GETPOST('addline_predefined')
+			|| (! GETPOST('dp_desc') && ! GETPOST('addline_predefined') && GETPOST('idprod', 'int')>0)	// we push enter onto qty field
+			)			
 	{
 		$predef=(($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
 		$idprod=GETPOST('idprod', 'int');
-- 
GitLab