From e403a3a896e3d0cd4f475586d524435bf3c8e5fd Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 14 Sep 2022 09:40:46 +0200 Subject: [PATCH 1/9] FIX : input hidden with fk_product of line on mo production can be usefull --- htdocs/mrp/mo_production.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index d92c595c6ec..bc83b841f09 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1008,6 +1008,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $disable = 'disabled'; } + // input hidden with fk_product of line + print ''; + // Qty print ''; From 4d8c41a37127d35f364396a9a29e744592edd7aa Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 15 Sep 2022 06:33:19 +0200 Subject: [PATCH 2/9] Fix PHP8 Warning --- htdocs/accountancy/class/bookkeeping.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0b2a060d7a2..ebd7df6bbc8 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -169,6 +169,16 @@ class BookKeeping extends CommonObject */ public $piece_num; + /** + * @var integer|string date of movement validated & lock + */ + public $date_validation; + + /** + * @var integer|string date of movement who are noticed like exported + */ + public $date_export; + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -788,8 +798,7 @@ class BookKeeping extends CommonObject $this->piece_num = $obj->piece_num; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_export = $this->db->jdate($obj->date_export); - $this->date_validation = $this->db->jdate($obj->date_validated); - $this->date_validation = $this->db->jdate($obj->date_validation); + $this->date_validation = isset($obj->date_validated) ? $this->db->jdate($obj->date_validated) : ''; } $this->db->free($resql); From 7236c94640169d93652c0fd3a2e8ce23427d2d6a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 15 Sep 2022 06:33:32 +0200 Subject: [PATCH 3/9] Fix PHP8 Warning --- htdocs/accountancy/journal/purchasesjournal.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 70741aca5d1..f2d7721ca90 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -294,9 +294,7 @@ if ($action == 'writebookkeeping') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - $companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; - $companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; @@ -626,9 +624,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! foreach ($tabfac as $key => $val) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - $companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; - $companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; @@ -757,7 +753,7 @@ if (empty($action) || $action == 'view') { $periodlink = ''; $exportlink = ''; $builddate = dol_now(); - $description .= $langs->trans("DescJournalOnlyBindedVisible").'
'; + $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= $langs->trans("DepositsAreNotIncluded"); } else { @@ -837,9 +833,7 @@ if (empty($action) || $action == 'view') { foreach ($tabfac as $key => $val) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - $companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; - $companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; From 498ded7712cf132d49d849a9ad4a94896184631d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 15 Sep 2022 06:33:38 +0200 Subject: [PATCH 4/9] Fix PHP8 Warning --- htdocs/accountancy/journal/sellsjournal.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 107dda05f4a..b86f138d232 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -310,9 +310,7 @@ if ($action == 'writebookkeeping') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->code_compta = $tabcompany[$key]['code_compta']; - $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_client = $tabcompany[$key]['code_client']; - $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->client = 3; $invoicestatic->id = $key; @@ -600,9 +598,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->code_compta = $tabcompany[$key]['code_compta']; - $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_client = $tabcompany[$key]['code_client']; - $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->client = 3; $invoicestatic->id = $key; @@ -790,9 +786,7 @@ if (empty($action) || $action == 'view') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->code_compta = $tabcompany[$key]['code_compta']; - $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_client = $tabcompany[$key]['code_client']; - $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->client = 3; $invoicestatic->id = $key; From e129daef07842ce6aa0ec6f5b094400eb17809ee Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 15 Sep 2022 06:33:43 +0200 Subject: [PATCH 5/9] Fix PHP8 Warning --- htdocs/core/lib/accounting.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 21afb5f3490..4dbdd9f5be8 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -274,6 +274,9 @@ function getDefaultDatesForTransfer() { global $db, $conf; + $pastmonth = 0; + $pastmonthyear = 0; + // Period by default on transfer (0: previous month | 1: current month | 2: fiscal year) $periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER); if ($periodbydefaultontransfer == 2) { From 1a76b26731b1f5c63cdf1c71ca62d1e880be257a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 15 Sep 2022 15:14:36 +0200 Subject: [PATCH 6/9] Fix php 8 error --- 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 ed43f5f8f5e..9a1b9b539ab 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4812,7 +4812,7 @@ class Product extends CommonObject $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql.= " ORDER BY pa.rang"; - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.$parents, LOG_DEBUG); + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.implode(',',$parents), LOG_DEBUG); if ($level == 1) { $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly From 982a5742055bbe939a63805746cefc826b129377 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 15 Sep 2022 13:15:44 +0000 Subject: [PATCH 7/9] Fixing style errors. --- 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 9a1b9b539ab..5fb9ba38588 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4812,7 +4812,7 @@ class Product extends CommonObject $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql.= " ORDER BY pa.rang"; - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.implode(',',$parents), LOG_DEBUG); + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.implode(',', $parents), LOG_DEBUG); if ($level == 1) { $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly From 6a1596247748f994c0c1dddd9710bad2a034011e Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 15 Sep 2022 16:02:49 +0200 Subject: [PATCH 8/9] CalculateCosts function : add hook --- htdocs/bom/class/bom.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 539046c593b..512044fedb2 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1028,10 +1028,20 @@ class BOM extends CommonObject */ public function calculateCosts() { + global $hookmanager; + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $this->unit_cost = 0; $this->total_cost = 0; + $parameters=array(); + $reshook = $hookmanager->executeHooks('calculateCostsBom', $parameters, $this); // Note that $action and $object may have been modified by hook + + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + if (is_array($this->lines) && count($this->lines)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $productFournisseur = new ProductFournisseur($this->db); @@ -1078,6 +1088,9 @@ class BOM extends CommonObject $this->unit_cost = price2num($this->total_cost * $this->qty, 'MU'); } } + + + } /** From 2c017d4f78c952aa82e1c1427dd30d1481881748 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 15 Sep 2022 16:04:32 +0200 Subject: [PATCH 9/9] Clean --- htdocs/bom/class/bom.class.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 512044fedb2..0e57bebd922 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1088,9 +1088,6 @@ class BOM extends CommonObject $this->unit_cost = price2num($this->total_cost * $this->qty, 'MU'); } } - - - } /**