From 6ac08c3bee4ca8cac8a2be589a0fd63dc95e3bb9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 29 May 2017 10:32:17 +0200 Subject: [PATCH 1/4] Fix : Product supplier price is related to supplier's currency --- htdocs/fourn/class/fournisseur.commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 245947932a3..df48e35c01d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1408,7 +1408,8 @@ class CommandeFournisseur extends CommonOrder $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', $this->fk_soc); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc if ($result > 0) { - $pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice + $pu = 0; // Unit price supplier price set by get_buyprice + $pu_ht_devise = $prod->fourn_pu; // With multicurrency, supplier price is related to its currency, $pu will be calculated (= $pu_ht_devise if exchange rate is 1) $ref_supplier = $prod->ref_supplier; // Ref supplier price set by get_buyprice } if ($result == 0) // If result == 0, we failed to found the supplier reference price From f876833b9a8eed8bbd1cb2789a91ca83a1df7882 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 18 Jul 2017 10:31:35 +0200 Subject: [PATCH 2/4] Fix : search on rowid don't work with pgsql and natural search --- htdocs/adherents/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 4eda43dcca5..1334bc2ba7e 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -83,7 +83,6 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'd.rowid'=>'Ref', 'd.login'=>'Login', 'd.lastname'=>'Lastname', 'd.firstname'=>'Firstname', From 123c9d2315466292bad0761d3437d95d7ec06276 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 3 Oct 2017 18:12:17 +0200 Subject: [PATCH 3/4] Better fix only if bdd is pgsql --- htdocs/adherents/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 1334bc2ba7e..e439cfadc31 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -83,6 +83,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search // List of fields to search into when doing a "search in all" $fieldstosearchall = array( + 'd.rowid'=>'Ref', 'd.login'=>'Login', 'd.lastname'=>'Lastname', 'd.firstname'=>'Firstname', @@ -95,6 +96,7 @@ $fieldstosearchall = array( 'd.note_public'=>'NotePublic', 'd.note_private'=>'NotePrivate', ); +if($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']); $arrayfields=array( 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), From 56acb2c08cff743396009702877c8454b1d462f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Oct 2017 10:38:58 +0200 Subject: [PATCH 4/4] Fix: with 5.0 and 6.0, supplier prices are always in main currency. The currency is not yet available in supplier prices. Field to define the currency of supplier prices were added in database but not yet used by screen/code. --- htdocs/fourn/class/fournisseur.commande.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ab02abb4733..822ff7a7b5c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1408,8 +1408,7 @@ class CommandeFournisseur extends CommonOrder $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', $this->fk_soc); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc if ($result > 0) { - $pu = 0; // Unit price supplier price set by get_buyprice - $pu_ht_devise = $prod->fourn_pu; // With multicurrency, supplier price is related to its currency, $pu will be calculated (= $pu_ht_devise if exchange rate is 1) + $pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice $ref_supplier = $prod->ref_supplier; // Ref supplier price set by get_buyprice } if ($result == 0) // If result == 0, we failed to found the supplier reference price