From bcd99c1365f6fff93a6c573d9aac96c8673390bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 28 Mar 2024 09:19:46 +0100 Subject: [PATCH 001/118] NEW: consider document lines in element properties --- htdocs/core/lib/functions.lib.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3ff1c19a100..fa47bcc3e8b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12149,6 +12149,17 @@ function getElementProperties($elementType) $subelement = $regs[2]; } + // Object lines will use parent classpath and module ref + if (substr($element_type, -3) == 'det') { + $module = preg_replace('/det$/', '', $element); + $subelement = preg_replace('/det$/', '', $subelement); + $classpath = $module.'/class'; + $classfile = $module; + $classname = preg_replace('/det$/', 'Line', $element); + if (in_array($module, array('expedition', 'propale', 'facture', 'contrat', 'fichinter', 'commandefournisseur'))) { + $classname = preg_replace('/det$/', 'Ligne', $element); + } + } // For compatibility and to work with non standard path if ($elementType == "action") { $classpath = 'comm/action/class'; From 2ab704d630040aad60470405bb39d8624151f966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 28 Mar 2024 10:36:49 +0100 Subject: [PATCH 002/118] whoops --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fa47bcc3e8b..d395acd38e2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12150,7 +12150,7 @@ function getElementProperties($elementType) } // Object lines will use parent classpath and module ref - if (substr($element_type, -3) == 'det') { + if (substr($elementType, -3) == 'det') { $module = preg_replace('/det$/', '', $element); $subelement = preg_replace('/det$/', '', $subelement); $classpath = $module.'/class'; From e3073490cd539b6102862dc044ac7661bb6091e7 Mon Sep 17 00:00:00 2001 From: jyhere Date: Fri, 29 Mar 2024 11:53:31 +0100 Subject: [PATCH 003/118] FIX: supplier proposaldet ref_fourn size supplier_proposaldet ref_fourn size should match product_fournisseur_price ref_fourn size (128) --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index a99b9731232..ef6cfc14731 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -288,3 +288,5 @@ ALTER TABLE llx_expeditiondet ADD COLUMN element_type varchar(50) DEFAULT 'order ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commande fk_element integer; ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commandefourndet fk_elementdet integer; + +ALTER TABLE llx_supplier_proposaldet MODIFY ref_fourn VARCHAR(128) NULL; From 10d1f6169c0565d175b4ab9cdacbb24306b959e7 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:27:37 +0200 Subject: [PATCH 004/118] Qual translation --- 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 90077daa51b..a9d4bde40ae 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -89,7 +89,7 @@ NotAvailableWhenAjaxDisabled=Not available when Ajax disabled AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party TimesheetPreventAfterFollowingMonths=Prevent recording time spent after the following number of months PROJECT_DISPLAY_LINKED_BY_CONTACT=Display project linked by a common contact -PROJECT_DISPLAY_LINKED_BY_CONTACT_help=That option add a new list on Project tab with all projects linked to that thirdparty via a contact relationship +PROJECT_DISPLAY_LINKED_BY_CONTACT_help=This option adds a new list on Project tab with all projects linked to thirdparty via a contact relationship JavascriptDisabled=JavaScript disabled UsePreviewTabs=Use preview tabs ShowPreview=Show preview From 582b791693070c06345e5bd4ad471498435e941c Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:40:31 +0200 Subject: [PATCH 005/118] Qual translation --- htdocs/langs/en_US/cashdesk.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index ff42af8c3fb..3baf275ab15 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -106,7 +106,7 @@ ControlCashOpening=Open the "Control cash box" popup when opening the POS CloseCashFence=Close cash box control CashReport=Cash report MainPrinterToUse=Main printer to use -MainPrinterToUseMore=empty means the browser printer system +MainPrinterToUseMore=leave empty to use the browser printer system OrderPrinterToUse=Order printer to use MainTemplateToUse=Main template to use MainTemplateToUseMore=when not using browser printing system From 18eba7197380ef6532c47f15d70dbc39425b49d0 Mon Sep 17 00:00:00 2001 From: jyhere Date: Fri, 29 Mar 2024 13:19:32 +0100 Subject: [PATCH 006/118] FIX: supplier proposaldet ref_fourn size on create table too --- htdocs/install/mysql/tables/llx_supplier_proposaldet.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql b/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql index bbf3decd7fa..2e61c58cc18 100644 --- a/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql +++ b/htdocs/install/mysql/tables/llx_supplier_proposaldet.sql @@ -47,7 +47,7 @@ CREATE TABLE llx_supplier_proposaldet ( fk_product_fournisseur_price integer DEFAULT NULL, special_code integer DEFAULT 0, rang integer DEFAULT 0, - ref_fourn varchar(30) DEFAULT NULL, + ref_fourn varchar(128) DEFAULT NULL, fk_multicurrency integer, multicurrency_code varchar(3), multicurrency_subprice double(24,8) DEFAULT 0, From 7689f345a0ee6b7661e70b8f9a4201dc2ff2df56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Mar 2024 13:24:38 +0100 Subject: [PATCH 007/118] fix test --- htdocs/projet/tasks/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 723a31e9122..95de13155a8 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -426,7 +426,7 @@ if ($id > 0 || !empty($ref)) { print ''; $thirdpartyofproject = $projectstatic->getListContactId('thirdparty'); - $selectedCompany = GETPOSISSET("newcompany") ? GETPOST("newcompany") : $projectstatic->socid; + $selectedCompany = GETPOSTISSET("newcompany") ? GETPOST("newcompany") : $projectstatic->socid; $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, '&withproject='.$withproject); print ''; From fa65546800ba13f04354ddfc247381690a88396d Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 29 Mar 2024 08:04:02 -0500 Subject: [PATCH 008/118] Enable user establishment --- htdocs/user/class/user.class.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 95f404bd701..ab8cf4b6ae0 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -11,10 +11,11 @@ * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2018 charlene Benke - * Copyright (C) 2018-2021 Nicolas ZABOURI - * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2019 Abbes Bahfir - * Copyright (C) 2024 MDW + * Copyright (C) 2018-2021 Nicolas ZABOURI + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019 Abbes Bahfir + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Lenin Rivas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -379,6 +380,16 @@ class User extends CommonObject */ public $fk_warehouse; + /** + *@var int id of establishment + */ + public $fk_establishment; + + /** + *@var string label of establishment + */ + public $label_establishment; + /** * @var int egroupware id */ @@ -485,10 +496,12 @@ class User extends CommonObject $sql .= " u.national_registration_number,"; $sql .= " u.ref_employee,"; $sql .= " c.code as country_code, c.label as country,"; - $sql .= " d.code_departement as state_code, d.nom as state"; + $sql .= " d.code_departement as state_code, d.nom as state,"; + $sql .= " s.label as label_establishment, u.fk_establishment"; $sql .= " FROM ".$this->db->prefix()."user as u"; $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as c ON u.fk_country = c.rowid"; $sql .= " LEFT JOIN ".$this->db->prefix()."c_departements as d ON u.fk_state = d.rowid"; + $sql .= " LEFT JOIN ".$this->db->prefix()."establishment as s ON u.fk_establishment = s.rowid"; if ($entity < 0) { if ((!isModEnabled('multicompany') || !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (!empty($user->entity))) { @@ -627,6 +640,8 @@ class User extends CommonObject $this->default_range = $obj->default_range; $this->default_c_exp_tax_cat = $obj->default_c_exp_tax_cat; $this->fk_warehouse = $obj->fk_warehouse; + $this->fk_establishment = $obj->fk_establishment; + $this->label_establishment = $obj->label_establishment; // Protection when module multicompany was set, admin was set to first entity and then, the module was disabled, // in such case, this admin user must be admin for ALL entities. @@ -2003,6 +2018,7 @@ class User extends CommonObject $this->birth = empty($this->birth) ? '' : $this->birth; $this->fk_warehouse = (int) $this->fk_warehouse; + $this->fk_establishment = (int) $this->fk_establishment; $this->setUpperOrLowerCase(); @@ -2117,6 +2133,7 @@ class User extends CommonObject $sql .= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); $sql .= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); $sql .= ", fk_warehouse = ".($this->fk_warehouse > 0 ? $this->fk_warehouse : "null"); + $sql .= ", fk_establishment = ".($this->fk_establishment > 0 ? $this->fk_establishment : "null"); $sql .= ", lang = ".($this->lang ? "'".$this->db->escape($this->lang)."'" : "null"); $sql .= " WHERE rowid = ".((int) $this->id); From 68babcbc4649b91ed4ab39f3b1228fd54217f171 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2024 14:52:27 +0100 Subject: [PATCH 009/118] NEW Add sql stddev_pop db function. --- htdocs/core/db/Database.interface.php | 8 ++++++++ htdocs/core/db/DoliDB.class.php | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 1c9c7a5a05f..9a796160292 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -36,6 +36,14 @@ interface Database */ public function ifsql($test, $resok, $resko); + /** + * Return SQL string to aggregate using the Standard Deviation of population + * + * @param string $nameoffield Name of field + * @return string SQL string + */ + public function stddevPop($nameoffield); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return datas as an array diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 19bb694558b..01237c5c676 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -105,6 +105,17 @@ abstract class DoliDB implements Database return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)'; } + /** + * Return SQL string to aggregate using the Standard Deviation of population + * + * @param string $nameoffield Name of field + * @return string SQL string + */ + public function stddevPop($nameoffield) + { + return 'STDDEV_POP('.$nameoffield.')'; + } + /** * Return SQL string to force an index * From 67b12fc438117eca365ab1ae0d4d0bf166599c6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2024 17:08:31 +0100 Subject: [PATCH 010/118] FIX bad search on _ char in like when Debugbar is on --- htdocs/debugbar/class/TraceableDB.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 013a31b66ac..4ddcf1eb22e 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -293,7 +293,7 @@ class TraceableDB extends DoliDB */ public function escapeforlike($stringtoencode) { - return str_replace(array('_', '\\', '%'), array('\_', '\\\\', '\%'), (string) $stringtoencode); + return $this->db->escapeforlike($stringtoencode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From c87f24e3f493b111bf0312fbbd3cc1da8925804a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2024 17:09:36 +0100 Subject: [PATCH 011/118] Fix mysqli --- htdocs/core/db/mysqli.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 485477d052d..c98732c2d06 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -518,6 +518,7 @@ class DoliDBMysqli extends DoliDB */ public function escapeforlike($stringtoencode) { + // We must first replace the \ char into \\, then we can replace _ and % into \_ and \% return str_replace(array('\\', '_', '%'), array('\\\\', '\_', '\%'), (string) $stringtoencode); } From 1e3edf151024915fbd2d2abf5c39884f9ef265b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2024 17:08:31 +0100 Subject: [PATCH 012/118] FIX bad search on _ char in like when Debugbar is on --- htdocs/debugbar/class/TraceableDB.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 9b40abdb668..6cae03edf9c 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -292,7 +292,7 @@ class TraceableDB extends DoliDB */ public function escapeforlike($stringtoencode) { - return str_replace(array('_', '\\', '%'), array('\_', '\\\\', '\%'), (string) $stringtoencode); + return $this->db->escapeforlike($stringtoencode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From f6f5d346b71ea1577df1c21a6c67e97264039a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 29 Mar 2024 17:59:35 +0100 Subject: [PATCH 013/118] fix phpstan phpdoc --- htdocs/core/class/discount.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index d51210bff34..29e663f4e27 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -303,7 +303,7 @@ class DiscountAbsolute extends CommonObject * Delete object in database. If fk_facture_source is defined, we delete all family with same fk_facture_source. If not, only with id is removed * * @param User $user Object of user asking to delete - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-2,1> Return integer <0 if KO, >0 if OK */ public function delete($user) { @@ -427,7 +427,7 @@ class DiscountAbsolute extends CommonObject * * @param int $rowidline Invoice line id (To use discount into invoice lines) * @param int $rowidinvoice Invoice id (To use discount as a credit note to reduce payment of invoice) - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-3,1> Return integer <0 if KO, >0 if OK */ public function link_to_invoice($rowidline, $rowidinvoice) { @@ -483,7 +483,7 @@ class DiscountAbsolute extends CommonObject * Link the discount to a particular invoice line or a particular invoice. * Do not call this if discount is linked to a reconcialiated invoice * - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-3,1> Return integer <0 if KO, >0 if OK */ public function unlink_invoice() { From 32cb705419fbd48f196780ede02e51ad65ee50a1 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 17:50:04 +0100 Subject: [PATCH 014/118] Fix phpdoc int return ranges --- htdocs/core/class/discount.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index d51210bff34..29e663f4e27 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -303,7 +303,7 @@ class DiscountAbsolute extends CommonObject * Delete object in database. If fk_facture_source is defined, we delete all family with same fk_facture_source. If not, only with id is removed * * @param User $user Object of user asking to delete - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-2,1> Return integer <0 if KO, >0 if OK */ public function delete($user) { @@ -427,7 +427,7 @@ class DiscountAbsolute extends CommonObject * * @param int $rowidline Invoice line id (To use discount into invoice lines) * @param int $rowidinvoice Invoice id (To use discount as a credit note to reduce payment of invoice) - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-3,1> Return integer <0 if KO, >0 if OK */ public function link_to_invoice($rowidline, $rowidinvoice) { @@ -483,7 +483,7 @@ class DiscountAbsolute extends CommonObject * Link the discount to a particular invoice line or a particular invoice. * Do not call this if discount is linked to a reconcialiated invoice * - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-3,1> Return integer <0 if KO, >0 if OK */ public function unlink_invoice() { From 0ccdbfe147a385b356a16afda1fb0b9d04579a34 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 18:07:20 +0100 Subject: [PATCH 015/118] Correct/improve phpdoc typing --- htdocs/variants/class/ProductCombination.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 11c9f1db2e5..63fc85ce623 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -663,8 +663,8 @@ class ProductCombination /** * Retrieves all unique attributes for a parent product * - * @param int $productid Product rowid - * @return ProductAttribute[] Array of attributes + * @param int $productid Product rowid + * @return ProductAttributeValue[] Array of attributes */ public function getUniqueAttributesAndValuesByFkProductParent($productid) { @@ -696,6 +696,7 @@ class ProductCombination $attrval = new ProductAttributeValue($this->db); foreach ($res = $attrval->fetchAllByProductAttribute($attr->id, true) as $val) { + '@phan-var-force ProductAttributeValue $val'; $tmp->values[] = $val; } @@ -720,7 +721,7 @@ class ProductCombination * @param User $user Object user * @param Product $product Parent product * @param array> $combinations Attribute and value combinations. - * @param array $variations Price and weight variations + * @param array> $variations Price and weight variations * @param bool|array $price_var_percent Is the price variation a relative variation? * @param bool|float $forced_pricevar If the price variation is forced * @param bool|float $forced_weightvar If the weight variation is forced @@ -813,7 +814,6 @@ class ProductCombination return -1; } } - if ($forced_weightvar === false) { $weight_impact += (float) price2num($variations[$currcombattr][$currcombval]['weight']); } From 9e892f43672d2c5e3044f1c53939f371a24f8f6d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 18:20:51 +0100 Subject: [PATCH 016/118] Improve dol_clone typing by using phpdoc template --- htdocs/core/lib/functions.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1204e52d5a8..d71455a8044 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1370,9 +1370,11 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) * With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object. * With native = 2: Property that are reference are different memory area in the new object (full isolation clone). Only scalar and array values are cloned. This means method are not availables and $this->db of new object is not valid. * - * @param object $object Object to clone + * @template T of object + * + * @param T $object Object to clone * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method keeping only scalar and array properties (recommended) - * @return object Clone object + * @return T Clone object * @see https://php.net/manual/language.oop5.cloning.php */ function dol_clone($object, $native = 0) From df0e663c1305e673bb408ca777c1e9cc54c02d5a Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 18:23:08 +0100 Subject: [PATCH 017/118] Improve fetAllByProductAttribute phpdoc return type --- htdocs/variants/class/ProductAttributeValue.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index aac6c880ad5..d75ba4a8ebb 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -262,8 +262,8 @@ class ProductAttributeValue extends CommonObjectLine * * @param int $prodattr_id Product attribute id * @param bool $only_used Fetch only used attribute values - * @param int $returnonlydata 0: return object, 1: return only data - * @return ProductAttributeValue[] Array of object + * @param int<0,1> $returnonlydata 0: return object, 1: return only data + * @return ProductAttributeValue[]|stdClass[] Array of object */ public function fetchAllByProductAttribute($prodattr_id, $only_used = false, $returnonlydata = 0) { From 04c3e80fc5ca6cff223861e3721a49f001e5a3e0 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 18:23:58 +0100 Subject: [PATCH 018/118] Fix typing --- htdocs/asset/class/asset.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/core/class/comment.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/resource/class/dolresource.class.php | 2 +- htdocs/societe/class/societe.class.php | 12 ++++++------ htdocs/ticket/class/ticket.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 4c016282171..51b28f18427 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -158,7 +158,7 @@ class Asset extends CommonObject public $status; /** - * @var Asset object oldcopy + * @var static object oldcopy */ public $oldcopy; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 499ab5088af..8e875f598ac 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -130,7 +130,7 @@ class Propal extends CommonObject public $ref_customer; /** - * @var Propal oldcopy with propal properties + * @var static oldcopy with propal properties */ public $oldcopy; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 710cf3edaab..9f3f554e229 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -221,7 +221,7 @@ class Facture extends CommonInvoice public $tab_next_situation_invoice = array(); /** - * @var Facture object oldcopy + * @var static object oldcopy */ public $oldcopy; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ac7c96194cb..833919df82d 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -337,7 +337,7 @@ class Contact extends CommonObject /** * Old copy - * @var Contact + * @var static */ public $oldcopy; // To contains a clone of this when we need to save old properties of object diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index f60f5c44183..9ffa0d60a1e 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -77,7 +77,7 @@ class Comment extends CommonObject public $comments = array(); /** - * @var Comment Object oldcopy + * @var static Object oldcopy */ public $oldcopy; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index cd24b0197a7..641ba49ed29 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -72,7 +72,7 @@ class Product extends CommonObject public $fk_element = 'fk_product'; /** - * @var Product + * @var static */ public $oldcopy; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index a1ab7ab07f7..36b6dfd78d0 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -128,7 +128,7 @@ class Dolresource extends CommonObject public $cache_code_type_resource; /** - * @var Dolresource Clone of object before changing it + * @var static Clone of object before changing it */ public $oldcopy; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4723d7085bd..aecf5211359 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -145,7 +145,7 @@ class Societe extends CommonObject public $restrictiononfksoc = 1; /** - * @var Societe To store a cloned copy of object before to edit it and keep track of old properties + * @var static To store a cloned copy of object before to edit it and keep track of old properties */ public $oldcopy; @@ -2498,11 +2498,11 @@ class Societe extends CommonObject /** * Returns amount of included taxes of the current discounts/credits available from the company * - * @param ?User $user Filter on a user author of discounts - * @param string $filter Other filter - * @param integer $maxvalue Filter on max value for discount - * @param int $discount_type 0 => customer discount, 1 => supplier discount - * @return int Return integer <0 if KO, Credit note amount otherwise + * @param ?User $user Filter on a user author of discounts + * @param string $filter Other filter + * @param int $maxvalue Filter on max value for discount + * @param int<0,1> $discount_type 0 => customer discount, 1 => supplier discount + * @return float|int<-1,-1> Return integer <0 if KO, Credit note amount otherwise */ public function getAvailableDiscounts($user = null, $filter = '', $maxvalue = 0, $discount_type = 0) { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 70aba99dcea..6f01756cb16 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -269,7 +269,7 @@ class Ticket extends CommonObject public $ip; /** - * @var Ticket $oldcopy State of this ticket as it was stored before an update operation (for triggers) + * @var static $oldcopy State of this ticket as it was stored before an update operation (for triggers) */ public $oldcopy; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ab8cf4b6ae0..58b7ff20d31 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -84,7 +84,7 @@ class User extends CommonObject public $id = 0; /** - * @var User old copy of User + * @var static old copy of User */ public $oldcopy; From b871aa98e84d73d42dc3d9c760c045b38cd66511 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 18:34:21 +0100 Subject: [PATCH 019/118] Reset Product->id to 0, not to null --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 478f9641615..a9a7923b3c2 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -923,7 +923,7 @@ if (empty($reshook)) { // We use native clone to keep this->db valid and allow to use later all the methods of object. $clone = dol_clone($object, 1); - $clone->id = null; + $clone->id = 0; $clone->ref = GETPOST('clone_ref', 'alphanohtml'); $clone->status = 0; $clone->status_buy = 0; From 1560ba2603d5f599db5f0be8fe569562a686c888 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 18:47:36 +0100 Subject: [PATCH 020/118] Fix use $rssparser, not undefined $rss --- htdocs/admin/external_rss.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 5d3228ae23a..5781b810489 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -280,7 +281,7 @@ if ($resql) { print ''; print "".$langs->trans("Status").""; print ""; - if ($result > 0 && empty($rss->error)) { + if ($result > 0 && empty($rssparser->error)) { print ''.$langs->trans("Online").''; } else { print ''.$langs->trans("Offline"); From cb7e8f08d15cfd072e36936433a18671b79f486d Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 19:51:11 +0100 Subject: [PATCH 021/118] Fix typo $obp -> $objp # Fix typo $obp -> $objp Fix typo resulting in null var --- htdocs/ticket/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 14e0ab382d8..76d3b9e9dce 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -405,7 +406,7 @@ if ($user->hasRight('ticket', 'read')) { // Category print ''; - if (!empty($obp->category_code)) { + if (!empty($objp->category_code)) { $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$objp->category_code, 'c_ticket_category', 'code', 'label', $objp->category_code); print ''.$s.''; } From 535d9de357a0693edae40bce924b29e5214c4c13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Mar 2024 20:58:48 +0100 Subject: [PATCH 022/118] Translation --- dev/translation/dynamic_translation_keys.lst | 1 + htdocs/langs/en_US/website.lang | 5 +++-- htdocs/langs/fr_FR/website.lang | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dev/translation/dynamic_translation_keys.lst b/dev/translation/dynamic_translation_keys.lst index 41220044fe9..b66526bd241 100644 --- a/dev/translation/dynamic_translation_keys.lst +++ b/dev/translation/dynamic_translation_keys.lst @@ -437,6 +437,7 @@ CardContent CardProduct0 CardProduct1 Cards +Cart CashAccounts CashDeskBankCB CashDeskBankCash diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index a1543ba61f5..5676ed45400 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -162,7 +162,7 @@ AssignedContacts=Assigned contacts WebsiteTypeLabel=Type of Web site WebsiteTypeDolibarrWebsite=Web site (Module WebSites CMS) WebsiteTypeDolibarrPortal=Native and ready to use web portal (Module Web Portal) -WebPortalURL=Web portal URL +WebPortalURL=Web portal URL NewWebsiteAccount=New accounts for websites ModuleWebPortalName=Web portal ModuleWebPortalDesc=A ready to use native web portal for customers, suppliers, partners or members @@ -235,4 +235,5 @@ WebPortalPartnership=Partnership WebPortalPropal=Proposal WebPortalGroupMenuAdmin=Administration WebPortalGroupMenuTechnical=System -PreviewPageContent=Page content +PreviewPageContent=Page content +Cart=Cart diff --git a/htdocs/langs/fr_FR/website.lang b/htdocs/langs/fr_FR/website.lang index 5dc984ebce6..6771817e37e 100644 --- a/htdocs/langs/fr_FR/website.lang +++ b/htdocs/langs/fr_FR/website.lang @@ -235,3 +235,4 @@ WebPortalPartnership=Partenariat WebPortalPropal=Proposition WebPortalGroupMenuAdmin=Administration WebPortalGroupMenuTechnical=Système +Cart=Panier From b7f420d5bd6e0e74e77a4c5ca84e874aa24e2b35 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 29 Mar 2024 20:25:28 +0100 Subject: [PATCH 023/118] Fix phan notices by adding phan typing --- htdocs/theme/eldy/global.inc.php | 74 +++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 10 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 0d2f314b5a3..5042a1afccf 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2,6 +2,7 @@ /* /* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +28,59 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { $leftmenuwidth = 210; +' +@phan-var-force string $badgeDanger +@phan-var-force string $badgeWarning +@phan-var-force string $borderwidth +@phan-var-force string $colorbackbody +@phan-var-force string $colorbackhmenu1 +@phan-var-force string $colorbacklinebreak +@phan-var-force string $colorbacklineimpair1 +@phan-var-force string $colorbacklineimpair2 +@phan-var-force string $colorbacklinepair1 +@phan-var-force string $colorbacklinepair2 +@phan-var-force string $colorbacklinepairchecked +@phan-var-force string $colorbacklinepairhover +@phan-var-force string $colorbacktabactive +@phan-var-force string $colorbacktabcard1 +@phan-var-force string $colorbacktitle1 +@phan-var-force string $colorbackvmenu1 +@phan-var-force string $colorblind_deuteranopes_textSuccess +@phan-var-force string $colorblind_deuteranopes_textWarning +@phan-var-force string $colorshadowtitle +@phan-var-force string $colortext +@phan-var-force string $colortextbackhmenu +@phan-var-force string $colortextbacktab +@phan-var-force string $colortextbackvmenu +@phan-var-force string $colortextlink +@phan-var-force string $colortexttitle +@phan-var-force string $colortexttitlelink +@phan-var-force string $colortexttitlenotab +@phan-var-force string $colortexttitlenotab2 +@phan-var-force string $colortopbordertitle1 +@phan-var-force int<0,1> $disableimages +@phan-var-force int<0,1> $dol_optimize_smallscreen +@phan-var-force string $fontlist +@phan-var-force string $fontsize +@phan-var-force int $heightmenu +@phan-var-force string $heightrow +@phan-var-force string $img_button +@phan-var-force string $left +@phan-var-force string $maxwidthloginblock +@phan-var-force int $minwidthtmenu +@phan-var-force int $nbtopmenuentries +@phan-var-force int $nbtopmenuentriesreal +@phan-var-force string $path +@phan-var-force string $right +@phan-var-force string $textDanger +@phan-var-force string $textSuccess +@phan-var-force string $textWarning +@phan-var-force string $toolTipBgColor +@phan-var-force string $toolTipFontColor +@phan-var-force int<0,1> $useboldtitle +@phan-var-force int $userborderontable +'; + ?> /*