From 4ec80b5136861cf3ee59e2284360bd5a172c58eb Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 27 Oct 2018 10:53:01 +0200 Subject: [PATCH 1/6] Fix invoice supplier clone was not getting all lines parameters #9800 --- htdocs/fourn/class/fournisseur.facture.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 7f5496094f7..69e7aa3fa71 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -376,7 +376,14 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i]->fk_product, 'HT', (! empty($this->lines[$i]->info_bits)?$this->lines[$i]->info_bits:''), - $this->lines[$i]->product_type + $this->lines[$i]->product_type, + $this->lines[$i]->remise_percent, + false, + $this->lines[$i]->date_start, + $this->lines[$i]->date_end, + $this->lines[$i]->array_options, + $this->lines[$i]->fk_unit, + $this->lines[$i]->pu_ht_devise ); } else From b68b8fe412350af48ce507ceb1fba526bc1843fd Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 28 Oct 2018 11:02:18 +0100 Subject: [PATCH 2/6] Fix changing currency in a doc was recalculating amounts in company currency #9801 --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d4102873dae..88386521079 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1778,7 +1778,7 @@ abstract class CommonObject $this->multicurrency_code = $code; list($fk_multicurrency, $rate) = MultiCurrency::getIdAndTxFromCode($this->db, $code); - if ($rate) $this->setMulticurrencyRate($rate); + if ($rate) $this->setMulticurrencyRate($rate,2); return 1; } From ca47d1b8b1e7f23cfa05f9e73ea46d4ea16c691c Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 30 Oct 2018 10:26:59 +0100 Subject: [PATCH 3/6] Fix clone fourn order and invoice lines special code --- htdocs/fourn/class/fournisseur.commande.class.php | 3 +++ htdocs/fourn/class/fournisseur.facture.class.php | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index dfceb8d4e73..ff3d109613f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1236,6 +1236,9 @@ class CommandeFournisseur extends CommonOrder // insert products details into database for ($i=0;$i<$num;$i++) { + + $this->special_code = $this->lines[$i]->special_code; // TODO : remove this in 9.0 and add special_code param to addline() + $result = $this->addline( // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $this->lines[$i]->desc, $this->lines[$i]->subprice, diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 7f5496094f7..0aca70fbba6 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -357,8 +357,8 @@ class FactureFournisseur extends CommonInvoice dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects"); foreach ($this->lines as $i => $val) { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; - $sql .= ' VALUES ('.$this->id.')'; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)'; + $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')'; $resql_insert=$this->db->query($sql); if ($resql_insert) @@ -398,8 +398,8 @@ class FactureFournisseur extends CommonInvoice //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. if (! is_object($line)) $line = (object) $line; - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; - $sql .= ' VALUES ('.$this->id.')'; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)'; + $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')'; $resql_insert=$this->db->query($sql); if ($resql_insert) From 1e819ca7c14a4ef4375cd879e9b9ba13d86f669b Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 30 Oct 2018 10:46:33 +0100 Subject: [PATCH 4/6] FIX special code on create supplier invoice from supplier order --- htdocs/fourn/facture/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 36785a154dc..2b581e43be9 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -896,6 +896,9 @@ if (empty($reshook)) if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // FIXME Missing special_code into addline and updateline methods + $object->special_code = $lines[$i]->special_code; + // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. $result = $object->addline( $desc, From 2b526f74693b38db7f0a1e2abceb1fea1daedb15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Oct 2018 15:28:11 +0100 Subject: [PATCH 5/6] Fix phpcs --- htdocs/adherents/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 2aceb437d23..c29743b60c4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -634,7 +634,7 @@ if (empty($reshook)) $msg = $arraydefaultmessage->content; } - if (empty($labeltouse) || (int)$labeltouse === -1) { + if (empty($labeltouse) || (int) $labeltouse === -1) { //fallback on the old configuration. setEventMessages('WarningMandatorySetupNotComplete', [], 'errors'); $error++; @@ -715,7 +715,7 @@ if (empty($reshook)) $msg = $arraydefaultmessage->content; } - if (empty($labeltouse) || (int)$labeltouse === -1) { + if (empty($labeltouse) || (int) $labeltouse === -1) { //fallback on the old configuration. setEventMessages('WarningMandatorySetupNotComplete', [], 'errors'); $error++; From b9078c6d582a08e750458df269ee8bc89717187b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Oct 2018 15:30:04 +0100 Subject: [PATCH 6/6] Fix phpcs --- htdocs/core/modules/modSyslog.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index ba08d54c888..b9db018a1c3 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -82,7 +82,20 @@ class modSyslog extends DolibarrModules // Cronjobs $this->cronjobs = array( - 0=>array('label'=>'CompressSyslogs', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'compressSyslogs', 'parameters'=>'', 'comment'=>'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', 'frequency'=>1, 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>true), + 0=>array( + 'label'=>'CompressSyslogs', + 'jobtype'=>'method', + 'class'=>'core/class/utils.class.php', + 'objectname'=>'Utils', + 'method'=>'compressSyslogs', + 'parameters'=>'', + 'comment'=>'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', + 'frequency'=>1, + 'unitfrequency'=> 3600 * 24, + 'priority'=>50, + 'status'=>0, + 'test'=>true + ) ); } }