diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index b86b674e9ad..6def1e0c35e 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); } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7663a05812f..bedf489467e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -426,6 +426,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); @@ -647,6 +648,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 8231cc3b763..d2f1c21654e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1282,6 +1282,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); @@ -2870,6 +2871,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/card.php b/htdocs/compta/facture/card.php index 1056ef97640..67de173dff7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -408,7 +408,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++; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1d4dd3a45a9..3a0a75043f2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2606,6 +2606,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); @@ -2829,6 +2830,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/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c1602066ee6..0cce4c21920 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2630,7 +2630,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; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 284342b22b5..1dc68b34bc2 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1437,6 +1437,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); @@ -2391,6 +2392,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);