From 0229cd3c6587720f210faa5ecacc07c597170cd6 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 1 Feb 2020 08:18:48 +0100 Subject: [PATCH 1/7] FIX: FEC export have specific name --- htdocs/accountancy/tpl/export_journal.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 97f0da548ca..d2961670923 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -35,7 +35,7 @@ $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); header('Content-Type: text/csv'); -if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger +if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "1000" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger { // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle if (empty($search_date_end)) From 1dab308e4a50261e5c83f52a0f55b00c6a1efcac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2020 03:55:37 +0100 Subject: [PATCH 2/7] FIX #12932 --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index c4c0aed1756..e0a1fd35092 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -508,7 +508,7 @@ class CMailFile $res = false; - if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) + if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); From 7c35e9aaa862f7b8b50c2f22aa0af2e830c8a9ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2020 03:55:37 +0100 Subject: [PATCH 3/7] FIX #12932 --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 4d796bbcd07..402b19701d7 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -485,7 +485,7 @@ class CMailFile $res=false; - if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) + if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); From e5808e3335591c32ec87628a3f9b6b65b30698fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2020 04:48:17 +0100 Subject: [PATCH 4/7] FIX #12995 --- htdocs/bom/bom_card.php | 8 ++++++++ htdocs/core/class/commonobject.class.php | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 87396dccb30..3f1be6c7e4c 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -155,6 +155,8 @@ if (empty($reshook)) if (!$error) { + $lastposition = 0; + $bomline = new BOMLine($db); $bomline->fk_bom = $id; $bomline->fk_product = $idprod; @@ -163,6 +165,12 @@ if (empty($reshook)) $bomline->disable_stock_change = (int) $disable_stock_change; $bomline->efficiency = $efficiency; + // Rang to use + $rangmax = $object->line_max(0); + $ranktouse = $rangmax + 1; + + $bomline->position = ($ranktouse + 1); + $result = $bomline->create($user); if ($result <= 0) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 14433ff79db..dd2973cb1fb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2744,10 +2744,13 @@ abstract class CommonObject public function line_max($fk_parent_line = 0) { // phpcs:enable + $positionfield = 'rang'; + if ($this->table_element = 'bom') $positionfield = 'position'; + // Search the last rang with fk_parent_line if ($fk_parent_line) { - $sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql .= ' WHERE '.$this->fk_element.' = '.$this->id; $sql .= ' AND fk_parent_line = '.$fk_parent_line; @@ -2769,7 +2772,7 @@ abstract class CommonObject // If not, search the last rang of element else { - $sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql .= ' WHERE '.$this->fk_element.' = '.$this->id; dol_syslog(get_class($this)."::line_max", LOG_DEBUG); From d8ed62ea330edc42990e4e76c2ee668017f62d5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2020 06:28:51 +0100 Subject: [PATCH 5/7] Fix line_max for BOM --- 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 dd2973cb1fb..750fbc59135 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2745,7 +2745,7 @@ abstract class CommonObject { // phpcs:enable $positionfield = 'rang'; - if ($this->table_element = 'bom') $positionfield = 'position'; + if ($this->table_element == 'bom') $positionfield = 'position'; // Search the last rang with fk_parent_line if ($fk_parent_line) From 87f84e5b17cdac337aeedb9c2b1ad525aea154de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2020 06:28:04 +0100 Subject: [PATCH 6/7] FIX #12973 --- dev/dolibarr_changes.txt | 43 +++++++++++++++++++++- htdocs/includes/tecnickcom/tcpdf/tcpdf.php | 6 ++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 51eeef8af31..107f561eca6 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -63,10 +63,49 @@ with if (isset($this->imagekeys)) { foreach($this->imagekeys as $file) { -// unlink($file); + // DOL CHANGE If we keep this, source image files are physically destroyed + // unlink($file); } } +* Replace in tcpdf.php + + $preserve = array( + 'file_id', + 'internal_encoding', + 'state', + 'bufferlen', + 'buffer', + 'cached_files', + +with + + $preserve = array( + 'file_id', + 'internal_encoding', + 'state', + 'bufferlen', + 'buffer', + 'cached_files', + // @CHANGE DOL + 'imagekeys', + +* Replace in tcpdf.php + + if (!@TCPDF_STATIC::file_exists($file)) { + return false; + } + +with + + if (!@TCPDF_STATIC::file_exists($file)) { + // DOL CHANGE If we keep this, the image is not visible on pages after the first one. + //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); + //return false; + } + + + * In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace if (strpos($filename, '://') === false) { @@ -102,7 +141,7 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php + protected $default_monospaced_font = 'freemono'; - + TCPDI: ------ diff --git a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php index aa66879f7a1..dd20e957d5b 100644 --- a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php +++ b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php @@ -6878,7 +6878,9 @@ class TCPDF { } // check if file exist and it is valid if (!@TCPDF_STATIC::file_exists($file)) { - return false; + // DOL CHANGE If we keep this, the image is not visible on pages after the first one. + //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); + //return false; } if (($imsize = @getimagesize($file)) === FALSE) { if (in_array($file, $this->imagekeys)) { @@ -7810,6 +7812,8 @@ class TCPDF { 'bufferlen', 'buffer', 'cached_files', +// @CHANGE DOL +// 'imagekeys', 'sign', 'signature_data', 'signature_max_length', From 2813c9d4b4a663265b5c45a858bc3265b8bc5b6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Feb 2020 06:31:40 +0100 Subject: [PATCH 7/7] FIX #12973 --- htdocs/includes/tecnickcom/tcpdf/tcpdf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php index 24ef434ab8a..f5a6b9aa931 100644 --- a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php +++ b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php @@ -6846,7 +6846,7 @@ class TCPDF { } // check if file exist and it is valid if (!@TCPDF_STATIC::file_exists($file)) { - return false; + //return false; } if (($imsize = @getimagesize($file)) === FALSE) { if (in_array($file, $this->imagekeys)) {