From 2b9350cd098a4259ae4b30c04fead80a547f1731 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 7 Sep 2022 20:51:13 +0200 Subject: [PATCH 01/11] Update productcustomerprice.class.php fetchAll --- htdocs/product/class/productcustomerprice.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index ed003d85667..ff000462567 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -356,7 +356,7 @@ class Productcustomerprice extends CommonObject * @param array $filter Filter for select * @return int <0 if KO, >0 if OK */ - public function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array()) + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array()) { // phpcs:enable global $langs; @@ -421,7 +421,7 @@ class Productcustomerprice extends CommonObject $sql .= $this->db->plimit($limit + 1, $offset); } - dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); + dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $this->lines = array(); @@ -832,7 +832,7 @@ class Productcustomerprice extends CommonObject 't.fk_product' => $this->fk_product, 't.fk_soc' => $obj->rowid ); - $result = $prodsocprice->fetch_all('', '', 0, 0, $filter); + $result = $prodsocprice->fetchAll('', '', 0, 0, $filter); if ($result < 0) { $error++; $this->error = $prodsocprice->error; From e96eee56b0e3cc2c50408072fd7c1c4d4d496acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 10 Sep 2022 13:55:40 +0200 Subject: [PATCH 02/11] sample deprecated function --- htdocs/commande/card.php | 2 +- htdocs/core/class/commonobject.class.php | 2 -- .../class/productcustomerprice.class.php | 22 ++++++++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d6a4aead2ec..adc4b5b04aa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -789,7 +789,7 @@ if (empty($reshook)) { $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result >= 0) { if (count($prodcustprice->lines) > 0) { $pu_ht = price($prodcustprice->lines[0]->price); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8be014b8959..05a828417b8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1534,7 +1534,6 @@ abstract class CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return array with list of possible values for type of contacts * @@ -1548,7 +1547,6 @@ abstract class CommonObject */ public function listeTypeContacts($source = 'internal', $option = 0, $activeonly = 0, $code = '', $element = '', $excludeelement = '') { - // phpcs:enable global $langs, $conf; $langs->loadLangs(array('bills', 'contracts', 'interventions', 'orders', 'projects', 'propal', 'ticket', 'agenda')); diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index ff000462567..197816f48ca 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -354,11 +354,31 @@ class Productcustomerprice extends CommonObject * @param int $limit page * @param int $offset offset * @param array $filter Filter for select + * @deprecated since dolibarr v17 use fetchAll * @return int <0 if KO, >0 if OK */ + public function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array()) + { + // phpcs:enable + + dol_syslog(get_class($this)."::fetch_all is deprecated, use fetchAll instead", LOG_NOTICE); + + return $this->fetchAll($sortorder, $sortfield, $limit, $offset, $filter); + } + + /** + * Load all customer prices in memory from database + * + * @param string $sortorder order + * @param string $sortfield field + * @param int $limit page + * @param int $offset offset + * @param array $filter Filter for select + * @return int <0 if KO, >0 if OK + * @since dolibarr v17 + */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array()) { - // phpcs:enable global $langs; if (empty($sortfield)) { From 705b436494fcd84f5ee3480fbeee6d0a17b76a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 10 Sep 2022 14:03:47 +0200 Subject: [PATCH 03/11] replace other deprecated --- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/contrat/card.php | 2 +- htdocs/core/lib/pdf.lib.php | 2 +- htdocs/cron/class/cronjob.class.php | 2 +- htdocs/product/ajax/products.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/class/api_products.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/price.php | 4 ++-- htdocs/resource/class/dolresource.class.php | 2 +- htdocs/resource/list.php | 2 +- htdocs/societe/price.php | 4 ++-- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c4f620f6686..7b491e71a23 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1027,7 +1027,7 @@ if (empty($reshook)) { $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { // If there is some prices specific to the customer if (count($prodcustprice->lines) > 0) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 4c4a0a6c19a..8101177f412 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1412,7 +1412,7 @@ class Propal extends CommonObject } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $prodcustprice = new Productcustomerprice($this->db); $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { // If there is some prices specific to the customer if (count($prodcustprice->lines) > 0) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9cbe8b5c686..6dbc879d4e3 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -498,7 +498,7 @@ if (empty($reshook)) { $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { if (count($prodcustprice->lines) > 0) { $pu_ht = price($prodcustprice->lines[0]->price); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3b0c2250c49..016d9ea99e3 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1567,7 +1567,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $productCustomerPriceStatic = new Productcustomerprice($db); $filter = array('fk_product' => $idprod, 'fk_soc' => $object->socid); - $nbCustomerPrices = $productCustomerPriceStatic->fetch_all('', '', 1, 0, $filter); + $nbCustomerPrices = $productCustomerPriceStatic->fetchAll('', '', 1, 0, $filter); if ($nbCustomerPrices > 0) { $productCustomerPrice = $productCustomerPriceStatic->lines[0]; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 033e6512bd8..7fb3539eb91 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -576,7 +576,7 @@ class Cronjob extends CommonObject $sql .= " WHERE ".implode(' AND ', $sqlwhere); } - dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); + dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 0e606932ce2..e2768ba8ccb 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -190,7 +190,7 @@ if ($action == 'fetch' && !empty($id)) { $filter = array('t.fk_product' => $object->id, 't.fk_soc' => $socid); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { if (count($prodcustprice->lines) > 0) { $found = true; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 17387e3948d..7d542316ccc 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1035,7 +1035,7 @@ if (empty($reshook)) { $filter = array('t.fk_product' => $object->id, 't.fk_soc' => $soc->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { if (count($prodcustprice->lines) > 0) { $pu_ht = price($prodcustprice->lines [0]->price); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1c17deae602..91a55b4ca30 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -670,7 +670,7 @@ class Products extends DolibarrApi if ($thirdparty_id) { $filter['t.fk_soc'] .= $thirdparty_id; } - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); } if (empty($prodcustprice->lines)) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 360709dc5a0..925ac9dbbce 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1850,7 +1850,7 @@ class Product extends CommonObject $filter = array('t.fk_product' => $this->id, 't.fk_soc' => $thirdparty_buyer->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); if ($result) { if (count($prodcustprice->lines) > 0) { $pu_ht = price($prodcustprice->lines[0]->price); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 341b8a56e62..19d2f388ce6 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2213,10 +2213,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $prodcustprice->fetch_all($sortorder, $sortfield, 0, 0, $filter); + $nbtotalofrecords = $prodcustprice->fetchAll($sortorder, $sortfield, 0, 0, $filter); } - $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); + $result = $prodcustprice->fetchAll($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 46371fead0f..3e1a2615cd9 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -527,7 +527,7 @@ class Dolresource extends CommonObject if ($limit) { $sql .= $this->db->plimit($limit, $offset); } - dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG); + dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $this->lines = array(); $resql = $this->db->query($sql); diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 1ef64555133..d67f55f51f2 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -168,7 +168,7 @@ if ($search_type != '') { } // Including the previous script generate the correct SQL filter for all the extrafields -// we are playing with the behaviour of the Dolresource::fetch_all() by generating a fake +// we are playing with the behaviour of the Dolresource::fetchAll() by generating a fake // extrafields filter key to make it works $filter['ef.resource'] = $sql; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index a9f17f4b50a..12d7a7d62fb 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -532,10 +532,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); + $nbtotalofrecords = $prodcustprice->fetchAll('', '', 0, 0, $filter); } - $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); + $result = $prodcustprice->fetchAll($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } From edef39bed984a9c01848593e3a5e0d03dffff9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 14 Sep 2022 09:01:56 +0200 Subject: [PATCH 04/11] strftime is deprecated in php8.1 --- .../prelevement/class/bonprelevement.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index d87317e2420..9a1789dd49b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -419,8 +419,8 @@ class BonPrelevement extends CommonObject } else { $paiement = new Paiement($this->db); } - $paiement->datepaye = $date; - $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice + $paiement->datepaye = $date; + $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice if ($this->type == 'bank-transfer') { $paiement->paiementid = 2; @@ -766,8 +766,8 @@ class BonPrelevement extends CommonObject $datetimeprev = $executiondate; } - $month = strftime("%m", $datetimeprev); - $year = strftime("%Y", $datetimeprev); + $month = date("%m", $datetimeprev); + $year = date("%Y", $datetimeprev); $this->invoice_in_error = array(); $this->thirdparty_in_error = array(); @@ -1746,8 +1746,8 @@ class BonPrelevement extends CommonObject // Date d'echeance C1 fputs($this->file, " "); - fputs($this->file, strftime("%d%m", $this->date_echeance)); - fputs($this->file, substr(strftime("%y", $this->date_echeance), 1)); + fputs($this->file, date("%d%m", $this->date_echeance)); + fputs($this->file, substr(date("%y", $this->date_echeance), 1)); // Raison Sociale Destinataire C2 @@ -1972,8 +1972,8 @@ class BonPrelevement extends CommonObject // Date d'echeance C1 fputs($this->file, " "); - fputs($this->file, strftime("%d%m", $this->date_echeance)); - fputs($this->file, substr(strftime("%y", $this->date_echeance), 1)); + fputs($this->file, date("%d%m", $this->date_echeance)); + fputs($this->file, substr(date("%y", $this->date_echeance), 1)); // Raison Sociale C2 From 9f7c17333b62af9e07360472b59591716e0686ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 08:44:15 +0200 Subject: [PATCH 05/11] Update bonprelevement.class.php --- .../prelevement/class/bonprelevement.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 9a1789dd49b..464051926f2 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -22,9 +22,9 @@ */ /** - * \file htdocs/compta/prelevement/class/bonprelevement.class.php - * \ingroup prelevement - * \brief File of withdrawal receipts class + * \file htdocs/compta/prelevement/class/bonprelevement.class.php + * \ingroup prelevement + * \brief File of withdrawal receipts class */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; @@ -760,14 +760,14 @@ class BonPrelevement extends CommonObject $error = 0; - $datetimeprev = time(); + $datetimeprev = dol_now('gmt'); //Choice the date of the execution direct debit if (!empty($executiondate)) { $datetimeprev = $executiondate; } - $month = date("%m", $datetimeprev); - $year = date("%Y", $datetimeprev); + $month = dol_print_date("%m", $datetimeprev, 'gmt'); + $year = dol_print_date("%Y", $datetimeprev, 'gmt'); $this->invoice_in_error = array(); $this->thirdparty_in_error = array(); From 744d1b0218f3fc318f51d4bdfaba0644fb67a619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 21:52:39 +0200 Subject: [PATCH 06/11] Update bonprelevement.class.php --- htdocs/compta/prelevement/class/bonprelevement.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 464051926f2..a0beccfaff1 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1746,8 +1746,8 @@ class BonPrelevement extends CommonObject // Date d'echeance C1 fputs($this->file, " "); - fputs($this->file, date("%d%m", $this->date_echeance)); - fputs($this->file, substr(date("%y", $this->date_echeance), 1)); + fputs($this->file, dol_print_date("%d%m", $this->date_echeance, 'gmt')); + fputs($this->file, substr(dol_print_date("%y", $this->date_echeance, 'gmt'), 1)); // Raison Sociale Destinataire C2 @@ -1972,8 +1972,8 @@ class BonPrelevement extends CommonObject // Date d'echeance C1 fputs($this->file, " "); - fputs($this->file, date("%d%m", $this->date_echeance)); - fputs($this->file, substr(date("%y", $this->date_echeance), 1)); + fputs($this->file, dol_print_date("%d%m", $this->date_echeance, 'gmt')); + fputs($this->file, substr(dol_print_date("%y", $this->date_echeance, 'gmt'), 1)); // Raison Sociale C2 From 50c60c8f344d646cfa46d93a807781ee3ec86551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Sep 2022 11:46:07 +0200 Subject: [PATCH 07/11] Update bonprelevement.class.php --- htdocs/compta/prelevement/class/bonprelevement.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index a0beccfaff1..c177baeead9 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -766,8 +766,8 @@ class BonPrelevement extends CommonObject $datetimeprev = $executiondate; } - $month = dol_print_date("%m", $datetimeprev, 'gmt'); - $year = dol_print_date("%Y", $datetimeprev, 'gmt'); + $month = dol_print_date($datetimeprev, "%m", 'gmt'); + $year = dol_print_date($datetimeprev, "%Y", 'gmt'); $this->invoice_in_error = array(); $this->thirdparty_in_error = array(); From 61844cd50fac4645cc1fb88e9b28d131f631af34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 26 Sep 2022 11:48:29 +0200 Subject: [PATCH 08/11] Update bonprelevement.class.php --- htdocs/compta/prelevement/class/bonprelevement.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index c177baeead9..ccf522c73c1 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1746,8 +1746,8 @@ class BonPrelevement extends CommonObject // Date d'echeance C1 fputs($this->file, " "); - fputs($this->file, dol_print_date("%d%m", $this->date_echeance, 'gmt')); - fputs($this->file, substr(dol_print_date("%y", $this->date_echeance, 'gmt'), 1)); + fputs($this->file, dol_print_date($this->date_echeance, "%d%m", 'gmt')); + fputs($this->file, substr(dol_print_date($this->date_echeance, "%y", 'gmt'), 1)); // Raison Sociale Destinataire C2 @@ -1972,8 +1972,8 @@ class BonPrelevement extends CommonObject // Date d'echeance C1 fputs($this->file, " "); - fputs($this->file, dol_print_date("%d%m", $this->date_echeance, 'gmt')); - fputs($this->file, substr(dol_print_date("%y", $this->date_echeance, 'gmt'), 1)); + fputs($this->file, dol_print_date($this->date_echeance, "%d%m", 'gmt')); + fputs($this->file, substr(dol_print_date($this->date_echeance, "%y", 'gmt'), 1)); // Raison Sociale C2 From bab387a82f3af188003fdc79cde9b83f4e6ec22b Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Mon, 26 Sep 2022 11:51:04 +0200 Subject: [PATCH 09/11] Stock at date estimated value calculation The calculation was done in the sql request (pmp * reel or pmp * stock depending if a warehouse has been selectionned). But the real stock at date is calculated below this request (from l. 509 to l. 534). The estimated value displayed (l. 567) is not correct anymore and should use the calculated stock instead. --- htdocs/product/stock/stockatdate.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index d88355c6912..760fc338e21 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -243,7 +243,7 @@ $num = 0; $title = $langs->trans('StockAtDate'); -$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,'; +$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,'; $sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, '; if ($fk_warehouse > 0) { @@ -565,12 +565,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // PMP value print ''; - if (price2num($objp->estimatedvalue, 'MT')) { - print ''.price(price2num($objp->estimatedvalue, 'MT'), 1).''; + if ($stock * price2num($objp->pmp, 'MT')) { + print ''.price($stock * price2num($objp->pmp, 'MT'), 1).''; } else { print ''; } - $totalbuyingprice += $objp->estimatedvalue; + $totalbuyingprice += $stock * $objp->pmp; print ''; // Selling value From 71a0900ed55090ab04504770919bbce22c92a7db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 28 Sep 2022 20:26:41 +0200 Subject: [PATCH 10/11] add changelog --- ChangeLog | 59 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1030fa18de..464e26bdfbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ For users: --------------- NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6 +All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead ... @@ -80,7 +81,7 @@ NEW: Create contract from invoice NEW: Database: Can store the session into database (instead of beeing managed by PHP) NEW: Database: Some core tables are created only at module activation NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks) -NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit. +NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit. NEW: Dictionaries - add possibility to manage countries in EEC NEW: Dictionaries - Availibility dictionnary has a new column unit and number NEW: Display errors in a message box after generating documents @@ -184,9 +185,9 @@ NEW: Can update rank of invoice, proposal and order lines with API update NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice NEW: Add option MAIN_API_DEBUG to save API logs into a file -Hooks: +Hooks: NEW: Hook getNomUrl available everywhere in tooltip of ref links -NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook +NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook NEW: Add hook before the public ticket list NEW: Add hook for Notif NEW: Add hook for more buttons @@ -218,12 +219,12 @@ NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: -* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and +* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and enable the module project if it is not visible). * The default value for MAIN_SECURITY_CSRF_WITH_TOKEN has been set to 2. It means any POST and any GET request that contains the "action" or "massaction" with a value of a sensitive action must also a valid token parameter (With previous value 1, only POST was concerned). Note: With value 3, any URL with parameter "action" or "massaction" need the token, whatever is the value of the action. -* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true. +* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true. * The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead. * All triggers with a name XXX_UPDATE have been renamed with name XXX_MODIFY for code consistency purpose. * Rename build_path_from_id_categ() into buildPathFromId() and set method to private. @@ -439,7 +440,7 @@ For users: NEW: Online proposal signature NEW: Can define some max limit on expense report (per period, per type or expense, ...) -NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid) +NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid) NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation. NEW: Add option to disable globaly some notifications emails. NEW: #18401 Add __NEWREF__ subtitute to get new object reference. @@ -488,7 +489,7 @@ NEW: can enable/disable external calendar by default NEW: Can hide sender name on PDF documents NEW: Can select lot from a combo list of existing batch numbers (in MRP consumtion) NEW: Can set the default BOM on a product -NEW: Can set/unset the usual working day of the week (friday, saturday, sunday) +NEW: Can set/unset the usual working day of the week (friday, saturday, sunday) NEW: Can show progression of task into combo list of tasks NEW: can upload the odt file for the product doc template NEW: Contract - Add From/to input on search date @@ -552,7 +553,7 @@ For developers: API: NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method. -NEW: add API /approve and /makeOrder for purchase orders +NEW: add API /approve and /makeOrder for purchase orders NEW: API for knowledgemanagement NEW: API get list of legal form of business NEW: API list of staff units @@ -589,21 +590,21 @@ NEW: Experimental feature to manage user sessions in database WARNING: - + Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: -* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field +* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field into forms will be broken. The security token field is expected since Dolibarr v9 but a lot of external modules did not implement it). * Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. * Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. -* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). +* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). * The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines. * Method getDictvalue has been renamed into getDictionaryValue to match camel case rule. -* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in - method executeCLI() available into core/class/utils.class.php +* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in + method executeCLI() available into core/class/utils.class.php * Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php * ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed * ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required -* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject', +* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject', you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype @@ -892,10 +893,10 @@ For users: ---------- NEW: Module Recruitment to follow application to job positions is now stable. NEW: Feature to make Stock Inventories -NEW: Several security issues after a second private bug hunting campaign. +NEW: Several security issues after a second private bug hunting campaign. NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better) NEW: All main menu entries are using the picto of the module -NEW: Add a copy to clipboard button on some fields +NEW: Add a copy to clipboard button on some fields NEW: Add an example of scheduled job to send email reminder for unpaid invoices NEW: Add some color and picto for the direction of movement NEW: add the column "Channel" into the list of orders @@ -966,7 +967,7 @@ NEW: can show the leave dates/holidays on the agenda view NEW: Support color for types of event Bank -NEW: Bank Entries : display user linked to a salary or a taxes +NEW: Bank Entries : display user linked to a salary or a taxes NEW: Add bulk actions for Bank Transfer ECM/GED @@ -989,7 +990,7 @@ NEW: option to automatically create a login/user when a new subscription of a me NEW: option to select membership type on the online payment page for membership subscription or renewal Products -NEW: Add price min and price min including tax into product export +NEW: Add price min and price min including tax into product export NEW: Add a ref in product customer price NEW: customer ref for product customer prices NEW: Set status of all variants when changing status of parent @@ -1042,8 +1043,8 @@ NEW: add option in Workflow module to set a shipment as closed for Admins -NEW: Add a security center page with all information and advices related to the security of your instance -NEW: Add a performance center page with all information and advices related to the performance of your instance +NEW: Add a security center page with all information and advices related to the security of your instance +NEW: Add a performance center page with all information and advices related to the performance of your instance Modules NEW: Module Recruitment is now stable @@ -1089,7 +1090,7 @@ NEW: API get the list of product ids only NEW: add link to OpenAPI specifications XML file in REST API module setup: swagger.json file can be included into external tools like redoc NEW: add native compression in REST APIs NEW: Product Variants API, add variant stock to response by parameter -NEW: Product API route added to get product stock and product with or without variants #13739 #17390 +NEW: Product API route added to get product stock and product with or without variants #13739 #17390 Hooks NEW: hook printFieldListTitle for cabyprodserv.php @@ -1114,8 +1115,8 @@ Following changes may create regressions for some external modules, but were nec * Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__) * Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries. * v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8. -* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in - method executeCLI() available into core/class/utils.class.php +* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in + method executeCLI() available into core/class/utils.class.php ***** ChangeLog for 13.0.5 compared to 13.0.4 ***** @@ -1342,7 +1343,7 @@ NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credi NEW: Module Intracomm report NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable. NEW: Module Recruitment to manage Job position and applications. -NEW: Several security issues after a private bug bounty campaign. +NEW: Several security issues after a private bug bounty campaign. NEW: Accountancy - add chart of sub accounts NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules NEW: Accountancy balance - add a menu entry to show subtotal by group @@ -1478,7 +1479,7 @@ NEW: show user on external calender events (when found) NEW: subject title with company name instead of application title in ticket message NEW: Support for Samba4 AD NEW: TakePOS appearance tab with more visual parameters -NEW: TakePOS add alert before changing thirdparty +NEW: TakePOS add alert before changing thirdparty NEW: TakePOS add third order printer NEW: TakePOS can change thirdparty with barcode scan NEW: TakePOS can create a thirdparty customer from TakePOS frontend @@ -1489,9 +1490,9 @@ NEW: TakePOS display resiliate status for members NEW: TakePOS Gift Receipt NEW: TakePOS multicurrency compatibility NEW: TakePOS multicurrency total -NEW: TakePOS print payment method and change +NEW: TakePOS print payment method and change NEW: TakePOS restrict thirdparty to customer -NEW: TakePOS show available stock +NEW: TakePOS show available stock NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725 NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late @@ -1504,8 +1505,8 @@ NEW: VAT report - Invert constant to show by default zero VAT in reports NEW: website page fields selection NEW: website - global header of a website can also have dynamic content NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user -NEW: add clone button on miscellaneous payment -NEW: add option to put the product label in bold in the PDF templates if configured #15065 +NEW: add clone button on miscellaneous payment +NEW: add option to put the product label in bold in the PDF templates if configured #15065 NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF." From c2a98f9957ce756c8a98c3022c4f41fa34c1cab8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Oct 2022 12:10:50 +0200 Subject: [PATCH 11/11] Update stockatdate.php --- htdocs/product/stock/stockatdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 760fc338e21..69893559dfa 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -565,8 +565,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // PMP value print ''; - if ($stock * price2num($objp->pmp, 'MT')) { - print ''.price($stock * price2num($objp->pmp, 'MT'), 1).''; + if (price2num($stock * $objp->pmp, 'MT')) { + print ''.price(price2num($stock * $objp->pmp, 'MT'), 1).''; } else { print ''; }