From 77e793267116a7cf6a4df703b9c1db5f621aec68 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 5 Jun 2018 11:33:58 +0200 Subject: [PATCH 01/11] 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 02/11] 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 8031ef49f28ffd3fd5055d539bc2031ecce71d04 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 5 Jun 2018 20:38:55 +0200 Subject: [PATCH 03/11] fix error return --- htdocs/fourn/commande/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8ea1f249b7e..41b7afb1579 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -969,6 +969,7 @@ if (empty($reshook)) if ($result < 0) { + setEventMessages(null,$object->errors,'errors'); $error++; } From d69fae72c783238abccaa7d7f300c8c5c3f0732e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Thu, 7 Jun 2018 15:17:22 +0200 Subject: [PATCH 04/11] FIX: intervention: extrafield regression in commit b5f37301a5a10933b34390766ef003f9a5473ed3 --- htdocs/fichinter/class/fichinter.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 73e71b46398..a393f9cb2bc 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1395,11 +1395,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) { @@ -1470,7 +1470,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) { From 7ce2ebf1a9f1eaaf0022b144e4d9548c10bd967c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 7 Jun 2018 16:25:47 +0200 Subject: [PATCH 05/11] Fix: wrong var name --- htdocs/compta/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5a6c0594cd0..4a58a921389 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -457,7 +457,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))."'"; From baf9d4a806702dd3cdf040319ad7e60551790741 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 8 Jun 2018 17:11:59 +0200 Subject: [PATCH 06/11] 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 31eeaf9914cdebce021f4c6ddc2746e4ebe0aa12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Jun 2018 13:46:42 +0200 Subject: [PATCH 07/11] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9f8d8a129ce..4fa8438eb42 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -449,7 +449,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 car 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) From fcbf50467e1a307bb420756533bcf6125bf96031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Tue, 12 Jun 2018 09:52:55 +0200 Subject: [PATCH 08/11] Update user.class.php --- htdocs/user/class/user.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0f2de0aea1e..220892e74b2 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -134,6 +134,12 @@ class User extends CommonObject public $default_c_exp_tax_cat; public $default_range; + + public $fields=array( + 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'), + 'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + ); /** * Constructor de la classe From a86c90fed1586471f788b4bb22b43c1d650ff73f Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 12 Jun 2018 16:38:42 +0200 Subject: [PATCH 09/11] Fix Wrong error for duplicate ref if barcode enabled but not set. --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e989b0eb206..e293ba94bbe 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1000,7 +1000,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(); From d42f00bca961a0f0d70f9b3acc703fbd2890c346 Mon Sep 17 00:00:00 2001 From: altatof Date: Wed, 13 Jun 2018 16:35:52 +0200 Subject: [PATCH 10/11] 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); From fdc90da408b8a8c25105052f57a800c1b194b084 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jun 2018 20:02:38 +0200 Subject: [PATCH 11/11] Update card.php --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 41b7afb1579..efa8be0f951 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -969,7 +969,7 @@ if (empty($reshook)) if ($result < 0) { - setEventMessages(null,$object->errors,'errors'); + setEventMessages($object->error,$object->errors,'errors'); $error++; }