From 9d4007eace679315c8efd2387b931637aeaa8472 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Dec 2022 13:56:31 +0100 Subject: [PATCH 01/31] Fix phpcs --- htdocs/intracommreport/list.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index db93d14b4c7..c107ba9e492 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -209,8 +209,8 @@ $formother = new FormOther($db); $title = $langs->trans('IntracommReportList'.$type); -$sqlfields = 'i.rowid, i.type_declaration, i.type_export, i.periods, i.mode, i.entity'; -$sql = 'SELECT '.$sqlfields; +$sql = 'SELECT i.rowid, i.type_declaration, i.type_export, i.periods, i.mode, i.entity'; + /* // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -220,7 +220,12 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sql .= $hookmanager->resPrint; + +$sqlfields = $sql; + $sql .= ' FROM '.MAIN_DB_PREFIX.'intracommreport as i'; // if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."intracommreport_extrafields as ef on (i.rowid = ef.fk_object)"; $sql .= ' WHERE i.entity IN ('.getEntity('intracommreport').')'; From 61ee3a9942838eb2aa63047dfc160c64dc4e4e68 Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Sun, 11 Dec 2022 16:32:48 +0100 Subject: [PATCH 02/31] Fix #23179 Fix sql updating query for private and public note. --- htdocs/product/class/product.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bebe5d5a98d..73c1ec92732 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -985,7 +985,8 @@ class Product extends CommonObject $this->ref = dol_string_nospecial(trim($this->ref)); $this->label = trim($this->label); $this->description = trim($this->description); - $this->note = (isset($this->note) ? trim($this->note) : null); + $this->note_private = (isset($this->note_private) ? trim($this->note_private) : null); + $this->note_public = (isset($this->note_public) ? trim($this->note_public) : null); $this->net_measure = price2num($this->net_measure); $this->net_measure_units = trim($this->net_measure_units); $this->weight = price2num($this->weight); @@ -1180,7 +1181,8 @@ class Product extends CommonObject $sql .= ", fk_state = ".($this->state_id > 0 ? (int) $this->state_id : 'null'); $sql .= ", lifetime = ".($this->lifetime > 0 ? (int) $this->lifetime : 'null'); $sql .= ", qc_frequency = ".($this->qc_frequency > 0 ? (int) $this->qc_frequency : 'null'); - $sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null'); + $sql .= ", note = ".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'null'); + $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; From 7399734981ea706ef43c23767c2c51ebaa593773 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Dec 2022 09:22:31 +0100 Subject: [PATCH 03/31] Trans --- 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 0debee1d72d..c7f88185f74 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2344,4 +2344,4 @@ DesktopsAndSmartphones=Desktops et smartphones AllowOnlineSign=Allow online signing AllowExternalDownload=Allow external download (without login, using a shared link) DeadlineDayVATSubmission=Deadline day for vat submission on the next month -MaxNumberOfAttachementOnForms=Max number of joinded files in form +MaxNumberOfAttachementOnForms=Max number of joinded files in a form From 7a6e63befd095bd66ffc02fab550122b96de02b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Dec 2022 09:25:52 +0100 Subject: [PATCH 04/31] Trans --- 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 c7f88185f74..9ef1a1dbb38 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1387,7 +1387,7 @@ GetBarCode=Get barcode NumberingModules=Numbering models DocumentModules=Document models ##### Module password generation -PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: %s characters containing shared numbers and characters in lowercase. +PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: %s characters containing shared numbers and characters. PasswordGenerationNone=Do not suggest a generated password. Password must be typed in manually. PasswordGenerationPerso=Return a password according to your personally defined configuration. SetupPerso=According to your configuration From 8a8519e5209d825b908c0a4ef706341c0bf2b6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9=20GDSOFT?= Date: Mon, 12 Dec 2022 10:26:51 +0100 Subject: [PATCH 05/31] Ordering hooks by context --- htdocs/core/class/hookmanager.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 5e24ee03fa4..d71b1600296 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -131,8 +131,10 @@ class HookManager dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG); } - if (!empty($this->hooks[$context])) { - ksort($this->hooks[$context], SORT_NATURAL); + foreach ($arraycontext as $context) { + if (!empty($this->hooks[$context])) { + ksort($this->hooks[$context], SORT_NATURAL); + } } return 1; From 10964e0212a152a4f7d8c4b44af63cebe0c0fce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 12:53:50 +0100 Subject: [PATCH 06/31] doc --- htdocs/reception/class/reception.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index bda9821f993..af5c0980961 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Quentin Vial-Gouteyron + * Copyright (C) 2022 Frédéric France * * 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 @@ -115,6 +116,9 @@ class Reception extends CommonObject public $meths; public $listmeths; // List of carriers + /** + * @var CommandeFournisseurDispatch[] + */ public $lines = array(); From 6e0b38c4e3cc84a1b056fa22e9c4430821876868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 14:53:49 +0100 Subject: [PATCH 07/31] doc --- htdocs/core/modules/product_batch/mod_lot_advanced.php | 2 +- htdocs/core/modules/product_batch/mod_lot_free.php | 2 +- htdocs/core/modules/product_batch/mod_lot_standard.php | 2 +- htdocs/core/modules/product_batch/mod_sn_advanced.php | 2 +- htdocs/core/modules/product_batch/mod_sn_free.php | 2 +- htdocs/core/modules/product_batch/mod_sn_standard.php | 2 +- .../core/modules/product_batch/modules_product_batch.class.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 0e108b6b021..4342dedc2e9 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -132,7 +132,7 @@ class mod_lot_advanced extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index d6b24945ab0..7edba167768 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -94,7 +94,7 @@ class mod_lot_free extends ModeleNumRefBatch * Return an example of result returned by getNextValue * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Return next value */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index fc8d1389a00..ef3918fd167 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -112,7 +112,7 @@ class mod_lot_standard extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index f8d61c43c61..3012ea37b30 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -132,7 +132,7 @@ class mod_sn_advanced extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/mod_sn_free.php b/htdocs/core/modules/product_batch/mod_sn_free.php index f6b2417d34b..8ada51fb93b 100644 --- a/htdocs/core/modules/product_batch/mod_sn_free.php +++ b/htdocs/core/modules/product_batch/mod_sn_free.php @@ -93,7 +93,7 @@ class mod_sn_free extends ModeleNumRefBatch * Return an example of result returned by getNextValue * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Return next value */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index d6c109cff81..ccd49d03b8f 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -112,7 +112,7 @@ class mod_sn_standard extends ModeleNumRefBatch * Return next free value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Value if KO, <0 if KO */ public function getNextValue($objsoc, $object) diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index 42d4d052bfe..ea64bd98609 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -125,7 +125,7 @@ abstract class ModeleNumRefBatch * Returns next assigned value * * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for + * @param Productlot $object Object we need next value for * @return string Valeur */ public function getNextValue($objsoc, $object) From 8d2f6376084956dabc48249b94950dd084e8ce46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 14:57:22 +0100 Subject: [PATCH 08/31] doc --- htdocs/product/stock/class/productlot.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 7009d0d55fc..6fe855543c9 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -110,10 +110,13 @@ class Productlot extends CommonObject public $entity; /** - * @var int ID + * @var int Product ID */ public $fk_product; + /** + * @var string batch ref + */ public $batch; public $eatby = ''; public $sellby = ''; @@ -126,15 +129,18 @@ class Productlot extends CommonObject public $tms = ''; /** - * @var int ID + * @var int user ID */ public $fk_user_creat; /** - * @var int ID + * @var int user ID */ public $fk_user_modif; + /** + * @var string import key + */ public $import_key; @@ -241,9 +247,6 @@ class Productlot extends CommonObject } if (!$error && !$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. - // Call triggers $result = $this->call_trigger('PRODUCTLOT_CREATE', $user); if ($result < 0) { From 80d5d05cba4c29db6a2f34abc38378b2dfec4e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:04:58 +0100 Subject: [PATCH 09/31] doc --- .../core/modules/product_batch/mod_lot_free.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/product_batch/mod_lot_free.php b/htdocs/core/modules/product_batch/mod_lot_free.php index 7edba167768..8d14a25374f 100644 --- a/htdocs/core/modules/product_batch/mod_lot_free.php +++ b/htdocs/core/modules/product_batch/mod_lot_free.php @@ -1,6 +1,7 @@ * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2022 Frédéric France * * 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 @@ -26,16 +27,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product_batch/modules_product_batch.class.php'; /** - * \class mod_codeproduct_leopard - * \brief Classe permettant la gestion leopard des codes produits + * \class mod_lot_free + * \brief Class allowing lot_free management of batch numbers */ class mod_lot_free extends ModeleNumRefBatch { /* - * Attention ce module est utilise par defaut si aucun module n'a - * ete definit dans la configuration + * Please note this module is used by default if no module has been defined in the configuration * - * Le fonctionnement de celui-ci doit donc rester le plus ouvert possible + * Its operation must therefore remain as open as possible */ @@ -44,7 +44,10 @@ class mod_lot_free extends ModeleNumRefBatch */ public $name = 'lot_free'; - public $code_modifiable; // Code modifiable + /** + * @var string Code modifiable + */ + public $code_modifiable; public $code_modifiable_invalide; // Code modifiable si il est invalide @@ -99,7 +102,6 @@ class mod_lot_free extends ModeleNumRefBatch */ public function getNextValue($objsoc, $object) { - global $langs; return ''; } } From 22bf6cc5a6d74caf2f482a028da7306d7f73c7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:07:52 +0100 Subject: [PATCH 10/31] doc --- htdocs/core/modules/product/mod_codeproduct_elephant.php | 2 +- htdocs/core/modules/product/mod_codeproduct_leopard.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index b2164e80175..c883de79c5e 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -139,7 +139,7 @@ class mod_codeproduct_elephant extends ModeleProductCode * Return an example of result returned by getNextValue * * @param Translate $langs Object langs - * @param product $objproduct Object product + * @param Product $objproduct Object product * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return string example */ diff --git a/htdocs/core/modules/product/mod_codeproduct_leopard.php b/htdocs/core/modules/product/mod_codeproduct_leopard.php index f7578d696f6..5819821f814 100644 --- a/htdocs/core/modules/product/mod_codeproduct_leopard.php +++ b/htdocs/core/modules/product/mod_codeproduct_leopard.php @@ -33,10 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php' class mod_codeproduct_leopard extends ModeleProductCode { /* - * Attention ce module est utilise par defaut si aucun module n'a - * ete definit dans la configuration + * Please note this module is used by default if no module has been defined in the configuration * - * Le fonctionnement de celui-ci doit donc rester le plus ouvert possible + * Its operation must therefore remain as open as possible */ /** @@ -100,7 +99,7 @@ class mod_codeproduct_leopard extends ModeleProductCode /** * Return an example of result returned by getNextValue * - * @param product $objproduct Object product + * @param Product $objproduct Object product * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @return string Return next value */ From d5fbab8688a3bbe9b0d36568e30fe118bccef730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:19:08 +0100 Subject: [PATCH 11/31] advanced --- .../core/modules/product_batch/mod_lot_advanced.php | 11 ++++++++++- .../core/modules/product_batch/mod_sn_advanced.php | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 4342dedc2e9..d6128573f97 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -143,6 +143,15 @@ class mod_lot_advanced extends ModeleNumRefBatch // We get cursor rule $mask = getDolGlobalString('LOT_ADVANCED_MASK'); + $filter = ''; + if (getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && !empty($object->fk_product)) { + $product = new Product($db); + $res = $product->fetch($object->fk_product); + if ($res > 0 && !empty($product->batch_mask)) { + $mask = $product->batch_mask; + $filter = ''; + } + } if (!$mask) { $this->error = 'NotConfigured'; @@ -151,7 +160,7 @@ class mod_lot_advanced extends ModeleNumRefBatch $date = dol_now(); - $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', '', null, $date); + $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', $filter, null, $date); return $numFinal; } diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index 3012ea37b30..6c796f06c3b 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -144,6 +144,16 @@ class mod_sn_advanced extends ModeleNumRefBatch // We get cursor rule $mask = getDolGlobalString('SN_ADVANCED_MASK'); + $filter = ''; + if (getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS') && !empty($object->fk_product)) { + $product = new Product($db); + $res = $product->fetch($object->fk_product); + if ($res > 0 && !empty($product->batch_mask)) { + $mask = $product->batch_mask; + $filter = ''; + } + } + if (!$mask) { $this->error = 'NotConfigured'; return 0; @@ -151,7 +161,7 @@ class mod_sn_advanced extends ModeleNumRefBatch $date = dol_now(); - $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', '', null, $date); + $numFinal = get_next_value($db, $mask, 'product_lot', 'batch', $filter, null, $date); return $numFinal; } From 6ff2c87fe392c0f1b17d521b8becee93acd898cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 15:48:11 +0100 Subject: [PATCH 12/31] trans --- htdocs/langs/en_US/agenda.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 4eca4b1734a..2016172c381 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -68,6 +68,7 @@ ShipmentBackToDraftInDolibarr=Shipment %s go back to draft status ShipmentDeletedInDolibarr=Shipment %s deleted ShipmentCanceledInDolibarr=Shipment %s canceled ReceptionValidatedInDolibarr=Reception %s validated +ReceptionDeletedInDolibarr=Reception %s deleted ReceptionClassifyClosedInDolibarr=Reception %s classified closed OrderCreatedInDolibarr=Order %s created OrderValidatedInDolibarr=Order %s validated @@ -177,4 +178,4 @@ AddReminder=Create an automatic reminder notification for this event ErrorReminderActionCommCreation=Error creating the reminder notification for this event BrowserPush=Browser Popup Notification ActiveByDefault=Enabled by default -Until=until \ No newline at end of file +Until=until From 26605c79b2ffd45b9182b5069758976bb2ee880f Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 12 Dec 2022 20:25:23 +0100 Subject: [PATCH 13/31] Update ChangeLog --- ChangeLog | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef931857be0..1697b668934 100644 --- a/ChangeLog +++ b/ChangeLog @@ -49,7 +49,6 @@ NEW: Add employment anniversary in birthday box NEW: Add extrafield type "IP" to store IP addresses NEW: Add fail2ban rules examples to limit access to /public pages NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial -NEW: Add free membership amounts at the membership type level NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers) NEW: Add IMAP port setting on email collector module NEW: Adding JAPAN Chart-of-Account and regions/departments @@ -67,7 +66,6 @@ NEW: Add option --force on CLI cron_run_jobs.php NEW: Add option "Show price on the generated documents for receptions" NEW: Add performance index (name for company and contact) and llx_bank_url(url_id) NEW: Add picto property on sub-module for password generation -NEW: Add price to product box in TakePOS NEW: add redirect on action confirm addconsumedline and addproduceline NEW: Add a new advanced permission "read price" NEW: Add substitution key __SENDEREMAIL_SIGNATURE__ @@ -89,18 +87,11 @@ NEW: Can set a commercial discount by entering amount including VAT NEW: Can set a monthly frequency (or multiple) in cron tasks. NEW: Can set start and end dates and comment on button "Activate all services" NEW: can sort and preselected best supplier price -NEW: Website Can delete a whole website if disabled -NEW: Website Can remove a website template -NEW: Website can set header "Strict-Transport-Security" in web sites. -NEW: Website Can switch status of website and page from the website toolbar -NEW: Website Templates of websites are now directories and not zip into core repo -NEW: Website Add 4 other templates in website module NEW: Can use products categories to make inventory NEW: Change filter type on tickets list into a multiselect combo NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line NEW: constant PROPAL_NEW_AS_SIGNED NEW: show date delivery planned on orders linked to company and product -NEW: default_lang for members NEW: Default template of contract is not mandatory NEW: Default values in extrafields are not more limited to 255 char. NEW: display currency in takepos menu @@ -108,11 +99,21 @@ NEW: Enable online signature for interventions NEW: Encrypt all sensitive constants in llx_const NEW: extrafield price with currency NEW: filter on reception dates (from / to) in cheque paiement card -NEW: TakePOS Header Scroll in TakePOS -NEW: TakePOS Add setup parameters, can setup terminal name -NEW: TakePOS support of Stripe Terminal with Takepos -NEW: TakePOS Receipt preview in TakePOS setup -NEW: TakePOS different product list on smartphone +NEW: Members: default_lang for members +NEW: Members: Table of membership types +NEW: Members: add free membership amounts at the membership type level +NEW: TakePOS: Header Scroll in TakePOS +NEW: TakePOS: add price to product box in TakePOS +NEW: TakePOS: add setup parameters, can setup terminal name +NEW: TakePOS: support of Stripe Terminal with TakePOS +NEW: TakePOS: Receipt preview in TakePOS setup +NEW: TakePOS: different product list on smartphone +NEW: Website: can delete a whole website if disabled +NEW: Website: can remove a website template +NEW: Website: can set header "Strict-Transport-Security" in web sites. +NEW: Website: can switch status of website and page from the website toolbar +NEW: Website: Templates of websites are now directories and not zip into core repo +NEW: Website: add 4 other templates in website module NEW: If we select another view list mode, we keep it NEW: Init module bookcal NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db @@ -121,7 +122,7 @@ NEW: invoice export : add accounting affectation NEW: label on products categories filter NEW: The link "add to bookmark" is always on top in the bookmark popup NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter -NEW: Make module WebservicesClient deprecated. Use module WebHook instead +NEW: Make module WebservicesClient deprecated. Use module WebHook instead. NEW: manage no email with thirdparties (better for GDPR) NEW: Manage Position (Rank) on Contract Lines NEW: Manage VAT on all lines on purchases cycle @@ -159,7 +160,6 @@ NEW: SMTP using oauth2 authentication NEW: can substitue project title in mail template NEW: Supplier order list - Add column private and public note NEW: Support IP type in extrafields -NEW: Table of membership types NEW: The purge of files can purge only if older than a number of seconds NEW: Update ActionComm type_code on email message ticket NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration From 22768b333cabce2c1ecaf1e6f38fae461c02579e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 12 Dec 2022 21:17:11 +0100 Subject: [PATCH 14/31] Update export.class.php --- htdocs/exports/class/export.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index cf0383dd08c..4b8be1dc74d 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -175,21 +175,21 @@ class Export $this->array_export_perms[$i] = $bool; // Icon $this->array_export_icon[$i] = (isset($module->export_icon[$r]) ? $module->export_icon[$r] : $module->picto); - // Code du dataset export + // Code of the export dataset / Code du dataset export $this->array_export_code[$i] = $module->export_code[$r]; // Define a key for sort $this->array_export_code_for_sort[$i] = $module->module_position.'_'.$module->export_code[$r]; // Add a key into the module - // Libelle du dataset export + // Export Dataset Label / Libelle du dataset export $this->array_export_label[$i] = $module->getExportDatasetLabel($r); - // Tableau des champ a exporter (cle=champ, valeur=libelle) + // Table of fields to export / Tableau des champ a exporter (cle=champ, valeur=libelle) $this->array_export_fields[$i] = $module->export_fields_array[$r]; - // Tableau des champs a filtrer (cle=champ, valeur1=type de donnees) on verifie que le module a des filtres + // Table of fields to be filtered / Tableau des champs a filtrer (cle=champ, valeur1=type de donnees) on verifie que le module a des filtres $this->array_export_TypeFields[$i] = (isset($module->export_TypeFields_array[$r]) ? $module->export_TypeFields_array[$r] : ''); - // Tableau des entites a exporter (cle=champ, valeur=entite) + // Table of entities for export / Tableau des entites a exporter (cle=champ, valeur=entite) $this->array_export_entities[$i] = $module->export_entities_array[$r]; // Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records) $this->array_export_dependencies[$i] = (!empty($module->export_dependencies_array[$r]) ? $module->export_dependencies_array[$r] : ''); - // Tableau des operations speciales sur champ + // Table of special field operations / Tableau des operations speciales sur champ $this->array_export_special[$i] = (!empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : ''); // Array of examples $this->array_export_examplevalues[$i] = (!empty($module->export_examplevalues_array[$r]) ? $module->export_examplevalues_array[$r] : null); @@ -461,9 +461,9 @@ class Export } break; case 'List': - // 0 : Type du champ - // 1 : Nom de la table - // 2 : Nom du champ contenant le libelle + // 0 : Type of the field / Type du champ + // 1 : Name of the table / Nom de la table + // 2 : Name of the field containing the label / Nom du champ contenant le libelle // 3 : Name of field with key (if it is not "rowid"). Used this field as key for combo list. // 4 : Name of element for getEntity(). From 0ef3801eba69718a0df107ae93198f40dac9c3e6 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Tue, 13 Dec 2022 11:57:34 +0200 Subject: [PATCH 15/31] FIX|Fix [#23202] Fix for V17 Parent company field missing when editing third party --- htdocs/societe/card.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5d72fed725f..e18f6987a33 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1986,6 +1986,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->town = GETPOST('town', 'alphanohtml'); $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; $object->state_id = GETPOST('state_id', 'int'); + $object->parent = GETPOST('parent_company_id', 'int'); $object->socialnetworks = array(); if (isModEnabled('socialnetworks')) { @@ -2614,6 +2615,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + // Parent company + if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { + print ''; + print ''.$langs->trans('ParentCompany').''; + print ''; + print img_picto('', 'company', 'class="paddingrightonly"'); + print $form->select_company(GETPOST('parent_company_id') ? GETPOST('parent_company_id') : $object->parent, 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + print ''; + } + // Webservices url/key if (!empty($conf->syncsupplierwebservices->enabled)) { print ''.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).''; From fcfe6c5ceb83e2fa511dedd5a5232685d8ffec28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Dec 2022 13:27:23 +0100 Subject: [PATCH 16/31] css --- htdocs/accountancy/bookkeeping/listbyaccount.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 6 ++++++ htdocs/theme/md/style.css.php | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 06a84af4a97..642573ed8c6 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -844,7 +844,7 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); } if (!empty($arrayfields['t.piece_num']['checked'])) { - print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp '); } if (!empty($arrayfields['t.code_journal']['checked'])) { print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); @@ -1024,7 +1024,7 @@ while ($i < min($num, $limit)) { $accountingjournal = new AccountingJournal($db); $result = $accountingjournal->fetch('', $line->code_journal); $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); - print ''.$journaltoshow.''; + print ''.$journaltoshow.''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 193bc2c6e1e..3f4efb7411b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1323,6 +1323,12 @@ select.flat.selectlimit { text-overflow: ellipsis; white-space: nowrap; } +.tdoverflowmax80imp { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 80px !important; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} .tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 100px; overflow: hidden; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 08c6cfa8959..05d11777884 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1442,6 +1442,12 @@ select.flat.selectlimit { text-overflow: ellipsis; white-space: nowrap; } +.tdoverflowmax80imp { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 80px !important; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} .tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 100px; overflow: hidden; From 8104ee5f8abfe176d3e814f8d17d127c26ff608e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Dec 2022 13:42:07 +0100 Subject: [PATCH 17/31] Log --- htdocs/accountancy/bookkeeping/card.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 44225dfca6b..4620bf37e4e 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -617,6 +617,7 @@ if ($action == 'create') { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { + // List of movements print load_fiche_titre($langs->trans("ListeMvts"), '', ''); print '
'; @@ -664,14 +665,14 @@ if ($action == 'create') { } foreach ($object->linesmvt as $line) { - print ''; + print ''; $total_debit += $line->debit; $total_credit += $line->credit; if ($action == 'update' && $line->id == $id) { print ''; print ''; - print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, ''); + print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); print ''; print ''; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: @@ -697,7 +698,7 @@ if ($action == 'create') { if ($action == "" || $action == 'add') { print ''; print ''; - print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); + print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); print ''; print ''; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: @@ -714,7 +715,7 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; + print ''; } } else { print ''; @@ -732,8 +733,8 @@ if ($action == 'create') { } print ''; print ''.$line->label_operation.''; - print ''.price($line->debit).''; - print ''.price($line->credit).''; + print ''.($line->debit != 0 ? price($line->debit) : '').''; + print ''.($line->credit != 0 ? price($line->credit) : '').''; print ''; if (empty($line->date_export) && empty($line->date_validation)) { From 505813ad0f546b87bda67189fea96f21ddcca373 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Dec 2022 13:51:55 +0100 Subject: [PATCH 18/31] Fix do not show 0 debit/credit --- htdocs/accountancy/bookkeeping/listbyaccount.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 642573ed8c6..9d0974be1a6 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -1120,7 +1120,7 @@ while ($i < min($num, $limit)) { // Amount debit if (!empty($arrayfields['t.debit']['checked'])) { - print ''.($line->debit ? price($line->debit) : '').''; + print ''.($line->debit != 0 ? price($line->debit) : '').''; if (!$i) { $totalarray['nbfield']++; } @@ -1132,7 +1132,7 @@ while ($i < min($num, $limit)) { // Amount credit if (!empty($arrayfields['t.credit']['checked'])) { - print ''.($line->credit ? price($line->credit) : '').''; + print ''.($line->credit != 0 ? price($line->credit) : '').''; if (!$i) { $totalarray['nbfield']++; } From 623150b1e167feb386b25d740f0a5596ca3602cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Dec 2022 15:52:07 +0100 Subject: [PATCH 19/31] Doc --- htdocs/core/lib/security.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3ec94953284..deff1af567c 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -201,7 +201,7 @@ function dolDecrypt($chain, $key = '') * @param string $chain String to hash * @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4': for OpenLdap, '5':sha256, '6':password_hash). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. * @return string Hash of string - * @see getRandomPassword() + * @see getRandomPassword(), dol_verifyHash() */ function dol_hash($chain, $type = '0') { @@ -249,6 +249,7 @@ function dol_hash($chain, $type = '0') * @param string $hash hash to compare * @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4': for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. * @return bool True if the computed hash is the same as the given one + * @see dol_hash() */ function dol_verifyHash($chain, $hash, $type = '0') { From 8767382d9686a3088c196555e23a6bf52eb28b90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2022 13:18:17 +0100 Subject: [PATCH 20/31] NEW Can search on KM module from quick search --- htdocs/core/ajax/selectsearchbox.php | 5 ++++- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index f2e44577260..4d5efd17d61 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -156,8 +156,11 @@ if (isModEnabled('contrat') && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DIS if (isModEnabled('ficheinter') && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->hasRight('ficheinter', 'lire')) { $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); } +if (isModEnabled('knowledgemanagement') && empty($conf->global->MAIN_SEARCHFORM_KNOWLEDGEMANAGEMENT_DISABLED) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { + $arrayresult['searchintoknowledgemanagement'] = array('position'=>145, 'img'=>'object_knowledgemanagement', 'label'=>$langs->trans("SearchIntoKM", $search_boxvalue), 'text'=>img_picto('', 'object_knowledgemanagement', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoKM", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); +} if (isModEnabled('ticket') && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->hasRight('ticket', 'read')) { - $arrayresult['searchintotickets'] = array('position'=>145, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintotickets'] = array('position'=>146, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); } // HR diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index fee18df2478..69e7e40c16b 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -103,7 +103,7 @@ class KnowledgeRecord extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", "csslist"=>"nowraponall", "showoncombobox"=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'tdcss'=>'titlefieldcreate nowraponall', "csslist"=>"tdoverflowmax100"), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>2,), @@ -115,7 +115,7 @@ class KnowledgeRecord extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'isModEnabled("ticket")', 'position'=>520, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'), - 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), + 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>3, 'searchall'=>1, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Obsolete'),), ); public $rowid; From ccbe64b2e603788d9df0f008e1c201b7ce242a8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2022 13:20:18 +0100 Subject: [PATCH 21/31] Trans --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 87b4f8f3036..64aa86149f0 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1056,6 +1056,7 @@ SearchIntoContracts=Contracts SearchIntoCustomerShipments=Customer shipments SearchIntoExpenseReports=Expense reports SearchIntoLeaves=Leave +SearchIntoKM=Knowledge base SearchIntoTickets=Tickets SearchIntoCustomerPayments=Customer payments SearchIntoVendorPayments=Vendor payments From 1033991486a43bda029873b46a187189a5b0f38e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2022 13:27:26 +0100 Subject: [PATCH 22/31] Clean: sall/search_all become search_all for all quick searches. --- htdocs/core/ajax/selectsearchbox.php | 40 +++++++++++++-------------- htdocs/core/class/html.form.class.php | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 4d5efd17d61..38c363654d3 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -68,22 +68,22 @@ $arrayresult = array(); // Define $searchform if (isModEnabled('adherent') && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->hasRight('adherent', 'lire')) { - $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('societe') && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice'))) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->hasRight('societe', 'lire')) { - $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('societe') && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->hasRight('societe', 'lire')) { - $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEnabled('service') && $user->hasRight('service', 'read'))) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { - $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); // search on lot/serial numbers if (isModEnabled('productbatch')) { - $arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } } @@ -98,26 +98,26 @@ if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLE } if (isModEnabled('propal') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->hasRight('propal', 'lire')) { - $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('commande') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->hasRight('commande', 'lire')) { - $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('expedition') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->hasRight('expedition', 'lire')) { - $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->hasRight('facture', 'lire')) { - $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('supplier_proposal') && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->hasRight('supplier_proposal', 'lire')) { - $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) { $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) { - $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } // Customer payments @@ -127,7 +127,7 @@ if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INV 'img'=>'object_payment', 'label'=>$langs->trans("SearchIntoCustomerPayments", $search_boxvalue), 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue), - 'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + 'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // Vendor payments @@ -137,7 +137,7 @@ if (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERM 'img'=>'object_payment', 'label'=>$langs->trans("SearchIntoVendorPayments", $search_boxvalue), 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue), - 'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + 'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // Miscellaneous payments @@ -147,31 +147,31 @@ if (isModEnabled('banque') && empty($conf->global->MAIN_SEARCHFORM_MISC_PAYMENTS 'img'=>'object_payment', 'label'=>$langs->trans("SearchIntoMiscPayments", $search_boxvalue), 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMiscPayments", $search_boxvalue), - 'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + 'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('contrat') && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->hasRight('contrat', 'lire')) { - $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('ficheinter') && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->hasRight('ficheinter', 'lire')) { - $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('knowledgemanagement') && empty($conf->global->MAIN_SEARCHFORM_KNOWLEDGEMANAGEMENT_DISABLED) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { $arrayresult['searchintoknowledgemanagement'] = array('position'=>145, 'img'=>'object_knowledgemanagement', 'label'=>$langs->trans("SearchIntoKM", $search_boxvalue), 'text'=>img_picto('', 'object_knowledgemanagement', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoKM", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('ticket') && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->hasRight('ticket', 'read')) { - $arrayresult['searchintotickets'] = array('position'=>146, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintotickets'] = array('position'=>146, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // HR if (isModEnabled('user') && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->hasRight('user', 'user', 'lire')) { - $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('expensereport') && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->hasRight('expensereport', 'lire')) { - $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } if (isModEnabled('holiday') && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->hasRight('holiday', 'read')) { - $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : '')); + $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&search_all='.urlencode($search_boxvalue) : '')); } // Execute hook addSearchEntry diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index df190abc43e..da6339bdaec 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8309,7 +8309,7 @@ class Form var separ = urlBase.indexOf("?") >= 0 ? "&" : "?"; /* console.log("params.term="+params.term); */ /* console.log("params.term encoded="+encodeURIComponent(params.term)); */ - saveRemoteData[data.id].url = urlBase + separ + "sall=" + encodeURIComponent(params.term.replace(/\"/g, ""));'; + saveRemoteData[data.id].url = urlBase + separ + "search_all=" + encodeURIComponent(params.term.replace(/\"/g, ""));'; } if (!$disableFiltering) { From 6159e67dc644bc2a164189becfc0af6d4c070c21 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:53:14 +0200 Subject: [PATCH 23/31] Update functions2.lib.php --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index ee631c7bdb8..ea6ab728371 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1043,7 +1043,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $regType = array(); if (preg_match('/\{(t+)\}/i', $mask, $regType)) { $masktype = $regType[1]; - $masktype_value = substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask) + $masktype_value = dol_substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask) $masktype_value = str_pad($masktype_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask } else { $masktype = ''; From 341bc115eef45077953d119b259afadc37447976 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 14 Dec 2022 15:43:34 +0100 Subject: [PATCH 24/31] NEW accountancy bank journal when deposits are just payments is enabled --- htdocs/accountancy/journal/bankjournal.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 5fb201ebfdc..92fdfea2f49 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Open-DSI * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2021 Frédéric France @@ -1415,9 +1415,15 @@ function getSourceDocRef($val, $typerecord) $sqlmid = ''; if ($typerecord == 'payment') { - $sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref'; - $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; - $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]); + $sqlmid .= "SELECT payfac.fk_facture as id, f.ref as ref"; + $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; + if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { + $sqlmid .= " INNER JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture"; + $sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = sre.fk_facture"; + } else { + $sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture"; + } + $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); $ref = $langs->transnoentitiesnoconv("Invoice"); } elseif ($typerecord == 'payment_supplier') { $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; From b0e4b4b18e23a04f2806c8b626905f95360096f3 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 14 Dec 2022 17:30:42 +0100 Subject: [PATCH 25/31] FIX sql when discount is applied --- htdocs/accountancy/journal/bankjournal.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 92fdfea2f49..e63101594cb 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1415,15 +1415,19 @@ function getSourceDocRef($val, $typerecord) $sqlmid = ''; if ($typerecord == 'payment') { - $sqlmid .= "SELECT payfac.fk_facture as id, f.ref as ref"; - $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { - $sqlmid .= " INNER JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture"; - $sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = sre.fk_facture"; + $sqlmid = "SELECT payfac.fk_facture as id, ".$db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref')." as ref"; + $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; + $sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture"; + $sqlmid .= " LEFT JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture"; + $sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f1 ON f1.rowid = sre.fk_facture"; + $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); } else { + $sqlmid = "SELECT payfac.fk_facture as id, f.ref as ref"; + $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; $sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture"; + $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); } - $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); $ref = $langs->transnoentitiesnoconv("Invoice"); } elseif ($typerecord == 'payment_supplier') { $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; From 51ac803aee203d8f535e876e5903503f4bd2f264 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut <1256948+FlorentPoinsaut@users.noreply.github.com> Date: Wed, 14 Dec 2022 18:06:12 +0100 Subject: [PATCH 26/31] FIX #23227 Don't retrieve the last insert id during a tag link import --- htdocs/core/modules/import/import_csv.modules.php | 4 +++- htdocs/core/modules/import/import_xlsx.modules.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 22c12024c2b..e1699660acc 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -994,7 +994,9 @@ class ImportCsv extends ModeleImports if ($sql) { $resql = $this->db->query($sql); if ($resql) { - $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). + if (!$is_table_category_link) { + $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). + } $insertdone = true; } else { //print 'E'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 35adc4476a0..0e63ea77075 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -1041,7 +1041,9 @@ class ImportXlsx extends ModeleImports if ($sql) { $resql = $this->db->query($sql); if ($resql) { - $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). + if (!$is_table_category_link) { + $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). + } $insertdone = true; } else { //print 'E'; From 1102dc272e09884bbed92f7d061a8a3a2fbb8da3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Dec 2022 22:04:09 +0100 Subject: [PATCH 27/31] Debug log inalterable to allow tracking of stock movement --- htdocs/blockedlog/class/blockedlog.class.php | 63 ++++++++++++++----- ..._modBlockedlog_ActionsBlockedLog.class.php | 15 +++-- .../stock/class/mouvementstock.class.php | 7 +++ .../product/stock/tpl/stockcorrection.tpl.php | 2 +- 4 files changed, 65 insertions(+), 22 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 15af4a532fa..70ba9a2b531 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -204,6 +204,7 @@ class BlockedLog } // Add more action to track from a conf variable + // For example: STOCK_MOVEMENT,... if (!empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED)) { $tmparrayofmoresupportedevents = explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED); foreach ($tmparrayofmoresupportedevents as $val) { @@ -305,6 +306,15 @@ class BlockedLog } else { $this->error++; } + } elseif ($this->element === 'stockmouvement') { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + + $object = new MouvementStock($this->db); + if ($object->fetch($this->fk_object) > 0) { + return $object->getNomUrl(1); + } else { + $this->error++; + } } elseif ($this->action == 'MODULE_SET') { return ''.$langs->trans("BlockedLogEnabled").''; } elseif ($this->action == 'MODULE_RESET') { @@ -378,9 +388,14 @@ class BlockedLog $this->date_object = $object->dateh; } elseif ($object->element == 'cashcontrol') { $this->date_object = $object->date_creation; - } else { + } elseif (property_exists($object, 'date')) { + // Generic case $this->date_object = $object->date; + } elseif (property_exists($object, 'datem')) { + // Generic case (second chance, for example for stock movement) + $this->date_object = $object->datem; } + // ref $this->ref_object = ((!empty($object->newref)) ? $object->newref : $object->ref); // newref is set when validating a draft, ref is set in other cases // type of object @@ -395,11 +410,18 @@ class BlockedLog $arrayoffieldstoexclude = array( 'table_element', 'fields', 'ref_previous', 'ref_next', 'origin', 'origin_id', 'oldcopy', 'picto', 'error', 'errors', 'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id', 'table_element_line', 'ismultientitymanaged', 'isextrafieldmanaged', + 'array_languages', + 'childtables', + 'contact_ids', + 'context', + 'labelStatus', + 'labelStatusShort', 'linkedObjectsIds', 'linkedObjects', 'fk_delivery_address', - 'context', - 'projet' // There is already ->fk_project + 'projet', // There is already ->fk_project + 'restrictiononfksoc', + 'specimen', ); // Add more fields to exclude depending on object type if ($this->element == 'cashcontrol') { @@ -428,7 +450,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->thirdparty->{$key} = $value; + $this->object_data->thirdparty->$key = $value; } } } @@ -448,7 +470,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->mycompany->{$key} = $value; + $this->object_data->mycompany->$key = $value; } } } @@ -486,12 +508,12 @@ class BlockedLog } if (!is_object($valueline) && !is_null($valueline) && $valueline !== '') { - $this->object_data->invoiceline[$lineid]->{$keyline} = $valueline; + $this->object_data->invoiceline[$lineid]->$keyline = $valueline; } } } } elseif (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; } } @@ -509,7 +531,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; } } @@ -601,7 +623,7 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $paymentpart->thirdparty->{$key} = $value; + $paymentpart->thirdparty->$key = $value; } } } @@ -625,11 +647,11 @@ class BlockedLog } if (!is_object($value) && !is_null($value) && $value !== '') { if ($this->element == 'payment_donation') { - $paymentpart->donation->{$key} = $value; + $paymentpart->donation->$key = $value; } elseif ($this->element == 'payment_various') { - $paymentpart->various->{$key} = $value; + $paymentpart->various->$key = $value; } else { - $paymentpart->invoice->{$key} = $value; + $paymentpart->invoice->$key = $value; } } } @@ -664,21 +686,30 @@ class BlockedLog continue; // Discard if not into a dedicated list } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; } } if (!empty($object->newref)) { $this->object_data->ref = $object->newref; } - } else // Generic case - { + } elseif ($this->element == 'stockmouvement') { foreach ($object as $key => $value) { if (in_array($key, $arrayoffieldstoexclude)) { continue; // Discard some properties } if (!is_object($value) && !is_null($value) && $value !== '') { - $this->object_data->{$key} = $value; + $this->object_data->$key = $value; + } + } + } else { + // Generic case + foreach ($object as $key => $value) { + if (in_array($key, $arrayoffieldstoexclude)) { + continue; // Discard some properties + } + if (!is_object($value) && !is_null($value) && $value !== '') { + $this->object_data->$key = $value; } } diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 275fc954ece..502fe33e980 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -64,9 +64,12 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers } // Test if event/record is qualified - $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol'); - if (!in_array($object->element, $listofqualifiedelement)) { - return 1; + if (empty($conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED) || !in_array($action, explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED))) { + // If custom actions are not set or if action not into custom actions, we can exclude action if object->elementis not valid + $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol'); + if (!in_array($object->element, $listofqualifiedelement)) { + return 1; + } } dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id); @@ -100,7 +103,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers $amounts = (double) $object->amount; } elseif ($action == 'CASHCONTROL_VALIDATE') { $amounts = (double) $object->cash + (double) $object->cheque + (double) $object->card; - } else { + } elseif (property_exists($object, 'total_ttc')) { $amounts = (double) $object->total_ttc; } } @@ -132,7 +135,9 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers return 0; // not implemented action log } - $result = $b->setObjectData($object, $action, $amounts, $user); // Set field date_object, ref_object, fk_object, element, object_data + // Set field date_object, ref_object, fk_object, element, object_data + $result = $b->setObjectData($object, $action, $amounts, $user); + //var_dump($b); exit; if ($result < 0) { $this->error = $b->error; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 282f09e276e..ac5d612394b 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -1094,6 +1094,13 @@ class MouvementStock extends CommonObject $label .= '
'; $label .= ''.$langs->trans('Label').': '.$this->label; $label .= '
'.$langs->trans('Qty').': '.($this->qty > 0 ? '+' : '').$this->qty; + if ($this->batch) { + $label .= '
'.$langs->trans('Batch').': '.$this->batch; + } + /* TODO Get also warehouse label in a property instead of id + if ($this->warehouse_id > 0) { + $label .= '
'.$langs->trans('Warehouse').': '.$this->warehouse_id; + }*/ $label .= '
'; // Link to page of warehouse tab diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 69ae5eda5e0..793c0dcd1e4 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -122,7 +122,7 @@ if ($object->element == 'stock') { print ''.$langs->trans("NumberOfUnit").''; print ''; if ($object->element == 'product' || $object->element == 'stock') { - print ''; print ''; print ''; print ''; From 4863b0ff4e4c1d3c5c7ce7b42ad001750ed87c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 15 Dec 2022 09:22:36 +0100 Subject: [PATCH 28/31] FIX : duplicate tabs on external module with 5 params --- htdocs/core/lib/functions.lib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d71c61909c1..c7172a9267f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -19,6 +19,7 @@ * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022 Ferran Marcet + * Copyright (C) 2022 Charlene Benke * * 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 @@ -9385,6 +9386,17 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, continue; } if ($values[3]) { + if ($filterorigmodule) { // If a filter of module origin has been requested + if (strpos($values[3], '@')) { // This is an external module + if ($filterorigmodule != 'external') { + continue; + } + } else { // This looks a core module + if ($filterorigmodule != 'core') { + continue; + } + } + } $langs->load($values[3]); } if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) { From 27cb4b4d86d72f24ec022ac3142181c19f14483f Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 15 Dec 2022 14:46:29 +0100 Subject: [PATCH 29/31] Fix: php 8.1 warnings --- htdocs/comm/index.php | 10 +++---- htdocs/commande/card.php | 2 +- htdocs/commande/list.php | 40 +++++++++++++-------------- htdocs/compta/facture/list.php | 20 +++++++------- htdocs/compta/index.php | 4 +-- htdocs/core/ajax/ajaxdirpreview.php | 12 ++++---- htdocs/core/boxes/box_activity.php | 8 +++--- htdocs/core/class/html.form.class.php | 4 +-- htdocs/core/tpl/filemanager.tpl.php | 8 +++--- htdocs/ecm/dir_card.php | 12 ++++---- htdocs/ecm/index_medias.php | 2 ++ htdocs/societe/index.php | 2 +- htdocs/societe/list.php | 6 ++-- htdocs/variants/combinations.php | 6 ++-- 14 files changed, 69 insertions(+), 67 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 2560e3bef05..67af97cfe12 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -134,7 +134,7 @@ if ($tmp) { * Draft customer proposals */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -232,7 +232,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) { * Draft supplier proposals */ -if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) { +if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "lire")) { $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -427,7 +427,7 @@ if (isModEnabled('commande') && $user->rights->commande->lire) { * Draft purchase orders */ -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) { +if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) { $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -819,7 +819,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM /* * Latest contracts */ -if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT +if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT $staticcontrat = new Contrat($db); $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; @@ -897,7 +897,7 @@ if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A RE /* * Opened (validated) proposals */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { $sql = "SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 786fb1a2ad2..383cf7581e9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1868,7 +1868,7 @@ if ($action == 'create' && $usercancreate) { // Incoterms if (isModEnabled('incoterm')) { print ''; - print ''; + print ''; print ''; $incoterm_id = GETPOST('incoterm_id'); $incoterm_location = GETPOST('location_incoterms'); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4257d1414b1..e6338903f43 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -201,10 +201,10 @@ $arrayfields = array( 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), - 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), - 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), - 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), - 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), + 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)), + 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)), + 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), + 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), @@ -298,19 +298,19 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Commande'; $objectlabel = 'Orders'; - $permissiontoread = $user->rights->commande->lire; - $permissiontoadd = $user->rights->commande->creer; - $permissiontodelete = $user->rights->commande->supprimer; + $permissiontoread = $user->hasRight("commande", "lire"); + $permissiontoadd = $user->hasRight("commande", "creer"); + $permissiontodelete = $user->hasRight("commande", "supprimer"); if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $permissiontovalidate = $user->rights->commande->order_advance->validate; - $permissiontoclose = $user->rights->commande->order_advance->close; - $permissiontocancel = $user->rights->commande->order_advance->annuler; - $permissiontosendbymail = $user->rights->commande->order_advance->send; + $permissiontovalidate = $user->hasRight("commande", "order_advance", "validate"); + $permissiontoclose = $user->hasRight("commande", "order_advance", "close"); + $permissiontocancel = $user->hasRight("commande", "order_advance", "annuler"); + $permissiontosendbymail = $user->hasRight("commande", "order_advance", "send"); } else { - $permissiontovalidate = $user->rights->commande->creer; - $permissiontoclose = $user->rights->commande->creer; - $permissiontocancel = $user->rights->commande->creer; - $permissiontosendbymail = $user->rights->commande->creer; + $permissiontovalidate = $user->hasRight("commande", "creer"); + $permissiontoclose = $user->hasRight("commande", "creer"); + $permissiontocancel = $user->hasRight("commande", "creer"); + $permissiontosendbymail = $user->hasRight("commande", "creer"); } $uploaddir = $conf->commande->multidir_output[$conf->entity]; $triggersendname = 'ORDER_SENTBYMAIL'; @@ -1287,7 +1287,7 @@ if ($resql) { if ($permissiontocancel) { $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); } - if (isModEnabled('facture') && $user->rights->facture->creer) { + if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); } if ($permissiontoclose) { @@ -1394,7 +1394,7 @@ if ($resql) { $moreforfilter = ''; // If the user can view prospects? sales other than his own - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $langs->load("commercial"); $moreforfilter .= '
'; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); @@ -1402,7 +1402,7 @@ if ($resql) { $moreforfilter .= '
'; } // If the user can view other users - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); @@ -1410,7 +1410,7 @@ if ($resql) { } // If the user can view other products/services than his own - if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { + if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('IncludingProductWithTag'); @@ -1419,7 +1419,7 @@ if ($resql) { $moreforfilter .= '
'; } // If Categories are enabled & user has rights to see - if (isModEnabled('categorie') && $user->rights->categorie->lire) { + if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 348897369ee..698f131aa09 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -376,9 +376,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', if (empty($reshook)) { $objectclass = 'Facture'; $objectlabel = 'Invoices'; - $permissiontoread = $user->rights->facture->lire; - $permissiontoadd = $user->rights->facture->creer; - $permissiontodelete = $user->rights->facture->supprimer; + $permissiontoread = $user->hasRight("facture", "lire"); + $permissiontoadd = $user->hasRight("facture", "creer"); + $permissiontodelete = $user->hasRight("facture", "supprimer"); $uploaddir = $conf->facture->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -1185,7 +1185,7 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->facture->creer); + $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer")); } $i = 0; @@ -1237,7 +1237,7 @@ if ($resql) { // If the user can view prospects other than his' $moreforfilter = ''; - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $langs->load("commercial"); $moreforfilter .= '
'; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); @@ -1245,14 +1245,14 @@ if ($resql) { $moreforfilter .= '
'; } // If the user can view prospects other than his' - if ($user->rights->user->user->lire) { + if ($user->hasRight("user", "user", "lire")) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); $moreforfilter .= '
'; } // Filter on product tags - if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { + if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('IncludingProductWithTag'); @@ -1260,7 +1260,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth250', 1); $moreforfilter .= '
'; } - if (isModEnabled('categorie') && $user->rights->categorie->lire) { + if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); @@ -2574,8 +2574,8 @@ if ($resql) { $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->facture->lire; - $delallowed = $user->rights->facture->creer; + $genallowed = $user->hasRight("facture", "lire"); + $delallowed = $user->hasRight("facture", "creer"); $title = ''; print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index c22b1925dbb..f25ae7ca600 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -281,7 +281,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) { // Last modified supplier invoices -if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) { +if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire")) || (isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) { $langs->load("boxes"); $facstatic = new FactureFournisseur($db); @@ -590,7 +590,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) { /* * Customers orders to be billed */ -if (isModEnabled('facture') && isModEnabled('commande') && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { +if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("commande", "lire") && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { $commandestatic = new Commande($db); $langs->load("orders"); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index e4bf213c4eb..76531832776 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -362,31 +362,31 @@ if ($type == 'directory') { if ($module == 'medias') { $useinecm = 6; $modulepart = 'medias'; - $perm = ($user->rights->website->write || $user->rights->emailing->creer); + $perm = ($user->hasRight("website", "write") || $user->hasRight("emailing", "creer")); $title = 'none'; } elseif ($module == 'ecm') { // DMS/ECM -> manual structure - if ($user->rights->ecm->read) { + if ($user->hasRight("ecm", "read")) { // Buttons: Preview $useinecm = 2; } - if ($user->rights->ecm->upload) { + if ($user->hasRight("ecm", "upload")) { // Buttons: Preview + Delete $useinecm = 4; } - if ($user->rights->ecm->setup) { + if ($user->hasRight("ecm", "setup")) { // Buttons: Preview + Delete + Edit $useinecm = 5; } - $perm = $user->rights->ecm->upload; + $perm = $user->hasRight("ecm", "upload"); $modulepart = 'ecm'; $title = ''; // Use default } else { $useinecm = 5; $modulepart = 'ecm'; - $perm = $user->rights->ecm->upload; + $perm = $user->hasRight("ecm", "upload"); $title = ''; // Use default } diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 56fa8172bcb..4829b32a72a 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes $totalnb = 0; $line = 0; $cachetime = 3600; - $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache'; + $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache'; $now = dol_now(); $nbofperiod = 3; @@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes // list the summary of the propals - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic = new Propal($this->db); @@ -189,7 +189,7 @@ class box_activity extends ModeleBoxes } // list the summary of the orders - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight("commande", "lire")) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic = new Commande($this->db); @@ -278,7 +278,7 @@ class box_activity extends ModeleBoxes // list the summary of the bills - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight("facture", "lire")) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic = new Facture($this->db); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index da6339bdaec..b79df73140d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5047,9 +5047,9 @@ class Form $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); if ($input['type'] == 'text') { - $more .= '
'.$input['label'].'
'."\n"; + $more .= '
'.$input['label'].'
'."\n"; } elseif ($input['type'] == 'password') { - $more .= '
'.$input['label'].'
'."\n"; + $more .= '
'.$input['label'].'
'."\n"; } elseif ($input['type'] == 'textarea') { /*$more .= '
'.$input['label'].'
'; $more .= '