diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index e3493f432c2..695d25a963c 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -178,24 +178,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 f324161a4e7..1f6c27a1c05 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -414,6 +414,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); @@ -635,6 +636,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 bd8a7aad29f..ccdc03da9ab 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1278,6 +1278,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); @@ -2844,6 +2845,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 2334ed36aab..6f66352fe75 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -409,7 +409,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 7dfe8283d29..b7d86cf630a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2608,6 +2608,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); @@ -2832,6 +2833,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/compta/facture/list.php b/htdocs/compta/facture/list.php index e572b2ffdbe..9d3e87f2d3c 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -463,7 +463,7 @@ else if ($search_year > 0) { $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } -if ($month_lim > 0) +if ($search_month_lim > 0) { if ($search_year_lim > 0 && empty($search_day_lim)) $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($search_year_lim,$search_month_lim,false))."' AND '".$db->idate(dol_get_last_day($search_year_lim,$search_month_lim,false))."'"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 71bd7ff58bd..231b1461cc8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2651,7 +2651,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/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d72c9173e64..60369f1acb7 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1397,11 +1397,11 @@ class FichinterLigne extends CommonObjectLine $resql=$this->db->query($sql); if ($resql) { - $this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet'); + $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet'); + $this->rowid=$this->id; if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $this->id=$this->id; $result=$this->insertExtraFields(); if ($result < 0) { @@ -1472,7 +1472,6 @@ class FichinterLigne extends CommonObjectLine if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $this->id=$this->id; $result=$this->insertExtraFields(); if ($result < 0) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b55d0823863..b1a82c6c97b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1458,6 +1458,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); @@ -2419,6 +2420,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); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b80c202403d..29a9d21cc54 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -964,6 +964,7 @@ if (empty($reshook)) if ($result < 0) { $error++; + setEventMessages($object->error,$object->errors,'errors'); } } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index bbbac0e204d..0dce9acffb4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -454,7 +454,7 @@ ModuleCompanyCodeDigitaria=Accounting code depends on third party code. The code Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).
Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... WarningPHPMail=WARNING: It is often better to setup outgoing emails to use the email server of your provider instead of the default setup. Some email providers (like Yahoo) does not allow you to send an email from another server than their own server. Your current setup use the server of the application to send email and not the server of your email provider, so some recipients (the one compatible with the restrictive DMARC protocol), will ask your email provider if they can accept your email and some email providers (like Yahoo) may respond "no" because the server is not a server of them, so few of your sent Emails may not be accepted (be carefull also to your email provider sending quota).
If your Email provider (like Yahoo) has this restriction, you must change Email setup to choose the other method "SMTP server" and enter the SMTP server and credentials provided by your Email provider (ask your EMail provider to get SMTP credentials for your account). -WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of your ERP CRM application: %s. +WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: %s. ClickToShowDescription=Click to show description DependsOn=This module need the module(s) RequiredBy=This module is required by module(s) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d1d5bc39cb9..ae2d3a4e8b1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -987,7 +987,7 @@ class Product extends CommonObject if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - if (empty($conf->barcode->enabled)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref); + if (empty($conf->barcode->enabled) || empty($this->barcode)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref); else $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists",$this->barcode); $this->errors[]=$this->error; $this->db->rollback();