From 77e793267116a7cf6a4df703b9c1db5f621aec68 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 5 Jun 2018 11:33:58 +0200 Subject: [PATCH 1/4] FIX : sometimes amounts are identical but php find them different. --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 06330de7682..993194e0f91 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -406,7 +406,7 @@ if (empty($reshook)) //var_dump($object->getRemainToPay(0)); //var_dump($discount->amount_ttc);exit; - if ($discount->amount_ttc > $object->getRemainToPay(0)) + if (price2num($discount->amount_ttc) > price2num($object->getRemainToPay(0))) { // TODO Split the discount in 2 automatically $error++; From 45ecb0258b23dafa400fb33e4e6d0a9c2b0ffd90 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 5 Jun 2018 12:41:38 +0200 Subject: [PATCH 2/4] FIX : entity test must be on product_fourn_price table and not product table --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2c5e41ce75a..634071791e3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2581,7 +2581,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; - $sql.= " WHERE p.entity IN (".getEntity('productprice').")"; + $sql.= " WHERE pfp.entity IN (".getEntity('productprice').")"; $sql.= " AND p.tobuy = 1"; $sql.= " AND s.fournisseur = 1"; $sql.= " AND p.rowid = ".$productid; From baf9d4a806702dd3cdf040319ad7e60551790741 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 8 Jun 2018 17:11:59 +0200 Subject: [PATCH 3/4] FIX : If we enable 3 steps for supplier order approbation, we must not delete all fourn rights def. --- htdocs/admin/supplier_order.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 6b99bb1c39c..5848c0533b0 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -179,24 +179,30 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER') // TODO We add/delete permission here until permission can have a condition on a global var include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; $newmodule=new modFournisseur($db); - // clear default rights array - $newmodule->rights=array(); - // add new right - $r=0; - $newmodule->rights[$r][0] = 1190; - $newmodule->rights[$r][1] = $langs->trans("Permission1190"); - $newmodule->rights[$r][2] = 'w'; - $newmodule->rights[$r][3] = 0; - $newmodule->rights[$r][4] = 'commande'; - $newmodule->rights[$r][5] = 'approve2'; - + if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) { + // clear default rights array + $newmodule->rights=array(); + // add new right + $r=0; + $newmodule->rights[$r][0] = 1190; + $newmodule->rights[$r][1] = $langs->trans("Permission1190"); + $newmodule->rights[$r][2] = 'w'; + $newmodule->rights[$r][3] = 0; + $newmodule->rights[$r][4] = 'commande'; + $newmodule->rights[$r][5] = 'approve2'; + + // Insert $newmodule->insert_permissions(1); } else { + // Remove all rights with Permission1190 $newmodule->delete_permissions(); + + // Add all right without Permission1190 + $newmodule->insert_permissions(1); } } From d42f00bca961a0f0d70f9b3acc703fbd2890c346 Mon Sep 17 00:00:00 2001 From: altatof Date: Wed, 13 Jun 2018 16:35:52 +0200 Subject: [PATCH 4/4] FIX : pu_ht_devise was not converted to numeric so decimals were lost when clculating total_ht_devise --- htdocs/comm/propal/class/propal.class.php | 2 ++ htdocs/commande/class/commande.class.php | 2 ++ htdocs/compta/facture/class/facture.class.php | 2 ++ htdocs/fourn/class/fournisseur.commande.class.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ffeda27da42..ca5935af0a8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -417,6 +417,7 @@ class Propal extends CommonObject $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); + $pu_ht_devise=price2num($pu_ht_devise); $pu_ttc=price2num($pu_ttc); $txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' $txlocaltax1=price2num($txlocaltax1); @@ -638,6 +639,7 @@ class Propal extends CommonObject $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu = price2num($pu); + $pu_ht_devise=price2num($pu_ht_devise); $txtva = price2num($txtva); $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 429566e054d..d2f915406f8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1269,6 +1269,7 @@ class Commande extends CommonOrder $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); + $pu_ht_devise=price2num($pu_ht_devise); $pu_ttc=price2num($pu_ttc); $pa_ht=price2num($pa_ht); $txtva = price2num($txtva); @@ -2815,6 +2816,7 @@ class Commande extends CommonOrder $qty=price2num($qty); $pu = price2num($pu); $pa_ht=price2num($pa_ht); + $pu_ht_devise=price2num($pu_ht_devise); $txtva=price2num($txtva); $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5c0fc379584..3de5ae96458 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2512,6 +2512,7 @@ class Facture extends CommonInvoice $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); + $pu_ht_devise=price2num($pu_ht_devise); $pu_ttc=price2num($pu_ttc); $pa_ht=price2num($pa_ht); $txtva=price2num($txtva); @@ -2735,6 +2736,7 @@ class Facture extends CommonInvoice $remise_percent = price2num($remise_percent); $qty = price2num($qty); $pu = price2num($pu); + $pu_ht_devise = price2num($pu_ht_devise); $pa_ht = price2num($pa_ht); $txtva = price2num($txtva); $txlocaltax1 = price2num($txlocaltax1); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f00392f1377..d07c3347146 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1388,6 +1388,7 @@ class CommandeFournisseur extends CommonOrder $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); + $pu_ht_devise=price2num($pu_ht_devise); $pu_ttc=price2num($pu_ttc); $txtva = price2num($txtva); $txlocaltax1 = price2num($txlocaltax1); @@ -2336,6 +2337,7 @@ class CommandeFournisseur extends CommonOrder $qty=price2num($qty); if (! $qty) $qty=1; $pu = price2num($pu); + $pu_ht_devise=price2num($pu_ht_devise); $txtva=price2num($txtva); $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2);