From f53e3e9cce0710a4893123168fddb9b291ddf201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 09:42:44 +0200 Subject: [PATCH 01/17] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1e58f11aeb0..7404f2595e2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -129,22 +129,32 @@ class Facture extends CommonInvoice /** * @var int Date expected for delivery * @deprecated + * @see delivery_date */ - public $date_livraison; // deprecated; Use delivery_date instead. + public $date_livraison; + /** + * @var int Date expected for delivery + */ public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) + /** + * @var string customer ref + * @deprecated + * @see ref_customer + */ + public $ref_client; + /** * @var string customer ref */ - public $ref_client; // deprecated; use ref_customer instead public $ref_customer; /** * @var int Ref Int * @deprecated */ - public $ref_int; // deprecated + public $ref_int; //Check constants for types public $type = self::TYPE_STANDARD; From a0579d115d72df4947fa7744e9030a78473c6a75 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Sep 2022 11:02:00 +0200 Subject: [PATCH 02/17] add element_element rowid --- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 516e4eddf51..3738ddfa867 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -63,8 +63,25 @@ foreach ($TMoChilds as $key => $objectlink) { echo '-'; echo ''.$objectlink->getLibStatut(3).''; echo ''; - // For now, shipments must stay linked to order, so link is not deletable - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + + // we want to make the link via element_element for delete action + $sql = ' Select rowid from ' . MAIN_DB_PREFIX . 'element_element'; + $sql .= ' WHERE fk_source = '. $object->id . ' and fk_target = ' . $key; + + $resql = $db->query($sql); + $k = 0; + if ($resql){ + $obj = $db->fetch_object($resql); + if ($obj->rowid && $obj->rowid > 0 ) $k = $obj->rowid; + } + + echo '' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . ''; + echo ''; + echo "\n"; +} + +echo "\n"; + echo ''; echo "\n"; } From 78adf501b396cb89ca0dce30772708841799a87a Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Sep 2022 11:08:46 +0200 Subject: [PATCH 03/17] stickler --- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 3738ddfa867..9f07a9048c2 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -70,11 +70,10 @@ foreach ($TMoChilds as $key => $objectlink) { $resql = $db->query($sql); $k = 0; - if ($resql){ + if ($resql) { $obj = $db->fetch_object($resql); if ($obj->rowid && $obj->rowid > 0 ) $k = $obj->rowid; } - echo '' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . ''; echo ''; echo "\n"; From 70a1815b9c1090d94bf45b108a64f2f36194a5b5 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Sep 2022 14:12:55 +0200 Subject: [PATCH 04/17] remove code --- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 9f07a9048c2..7a9d4a2dd73 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -79,10 +79,4 @@ foreach ($TMoChilds as $key => $objectlink) { echo "\n"; } -echo "\n"; - - echo ''; - echo "\n"; -} - echo "\n"; From 8f29d5c0eb10d928d3b3dd28422d4b03c634f5af Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Sep 2022 15:58:41 +0200 Subject: [PATCH 05/17] add cast and quoted --- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 7a9d4a2dd73..31a0af8a10c 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -66,7 +66,7 @@ foreach ($TMoChilds as $key => $objectlink) { // we want to make the link via element_element for delete action $sql = ' Select rowid from ' . MAIN_DB_PREFIX . 'element_element'; - $sql .= ' WHERE fk_source = '. $object->id . ' and fk_target = ' . $key; + $sql .= ' WHERE fk_source = '. (int) $object->id . ' and fk_target = "' . $key .'"'; $resql = $db->query($sql); $k = 0; From 64c92cc66dcc4c1c39c7bff86c9dbd4f74eb5476 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 21 Sep 2022 16:11:18 +0200 Subject: [PATCH 06/17] add escape --- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 31a0af8a10c..9374fc2e4d0 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -65,8 +65,8 @@ foreach ($TMoChilds as $key => $objectlink) { echo ''; // we want to make the link via element_element for delete action - $sql = ' Select rowid from ' . MAIN_DB_PREFIX . 'element_element'; - $sql .= ' WHERE fk_source = '. (int) $object->id . ' and fk_target = "' . $key .'"'; + $sql = " Select rowid from " . MAIN_DB_PREFIX . "element_element"; + $sql .= " WHERE fk_source = ". (int) $object->id . " and fk_target = '" . dol_escape_htmltag($key) ."'"; $resql = $db->query($sql); $k = 0; From fdef117f63267403953d0fb23fdedb8ba6982146 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 21 Sep 2022 18:11:00 +0200 Subject: [PATCH 07/17] FIX - php V8 propal index last draft --- htdocs/comm/propal/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 9f020bc1613..5bfed3ff1c9 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -78,7 +78,7 @@ if ($tmp) { */ if (!empty($conf->propal->enabled)) { $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc"; - $sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta"; + $sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.code_fournisseur, s.email, s.entity, s.code_compta"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (empty($user->rights->societe->client->voir) && !$socid) { From 4900ceec78679c07df4ef19ad4fff9b55924d080 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 22 Sep 2022 08:38:28 +0200 Subject: [PATCH 08/17] fix issue #22356 --- htdocs/mrp/mo_list.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 12d2320742d..dfbe224e733 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -251,6 +251,13 @@ foreach ($search as $key => $val) { $sql .= natural_search('moparent.ref', $search[$key], 0); continue; } + + if ($key == 'status') { + $sql .= natural_search('t.status', $search[$key], 0); + continue; + } + + $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { From eab8ef79064d0380072a76e1c21d51de5dac6c0c Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 22 Sep 2022 09:25:09 +0200 Subject: [PATCH 09/17] FIX - CronJob sendBackup --- htdocs/core/modules/modCron.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 290eea449f5..d6bea3ff089 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -100,7 +100,7 @@ class modCron extends DolibarrModules $this->cronjobs = array( 0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'tempfilesold+logfiles', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true), 1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>'in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'), - 2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendDumpDatabase', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'), + 2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendBackup', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'), // 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); From d4db4480d708bb1697dab8539aa0590735a0b07c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 11:15:15 +0200 Subject: [PATCH 10/17] FIX Warning php8 --- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 4 ++-- .../mailings/thirdparties_services_expired.modules.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 14bb45f0687..c70416fec6e 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -71,9 +71,9 @@ foreach ($linkedObjectBlock as $key => $objectlink) { print ''.$objectlink->ref_client.''; print ''.dol_print_date($objectlink->date, 'day').''; print ''; - if ($user->rights->facture->lire) { + if (!empty($objectlink) && $objectlink->element == 'facture' && $user->hasRight('facture', 'lire')) { $sign = 1; - if ($object->type == Facture::TYPE_CREDIT_NOTE) { + if ($objectlink->type == Facture::TYPE_CREDIT_NOTE) { $sign = -1; } if ($objectlink->statut != 3) { diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index b5dec9cbbe0..979782e61a5 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -217,7 +217,7 @@ class mailing_thirdparties_services_expired extends MailingTargets { global $langs; - $s .= ''; if (count($this->arrayofproducts)) { $s .= ''; } else { @@ -228,6 +228,7 @@ class mailing_thirdparties_services_expired extends MailingTargets } $s .= ''; $s .= ajax_combobox("filter_services_expired"); + return $s; } From c5c85fad9d80bcc9881c6f4e52ce2d7dcb8ecb01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2022 11:18:10 +0200 Subject: [PATCH 11/17] Fix warning --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1b9b64ffb0f..04f1c6239be 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7988,7 +7988,7 @@ abstract class CommonObject switch ($mode) { case "view": - $value = $this->array_options["options_".$key.$keysuffix]; // Value may be clean or formated later + $value = ((!empty($this->array_options) && array_key_exists("options_".$key.$keysuffix, $this->array_options)) ? $this->array_options["options_".$key.$keysuffix] : null); // Value may be cleaned or formated later break; case "create": case "edit": From d2cd06cb8d21e38e7b08662fb2afefc8673cb8eb Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 22 Sep 2022 23:27:13 +0200 Subject: [PATCH 12/17] remove ntoe update --- htdocs/don/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 960ff7e7b2d..377352b81b5 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -181,8 +181,6 @@ if (empty($reshook)) { $object->date = $donation_date; $object->public = $public_donation; $object->fk_project = (int) GETPOST("fk_project", 'int'); - $object->note_private = (string) GETPOST("note_private", 'restricthtml'); - $object->note_public = (string) GETPOST("note_public", 'restricthtml'); $object->modepaymentid = (int) GETPOST('modepayment', 'int'); // Fill array 'array_options' with data from add form From 3fdd34400ff56e922ef729135a917b9b38ad3f95 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 23 Sep 2022 05:12:21 +0200 Subject: [PATCH 13/17] FIX #22265 Accountancy - Account number expected in place of a rowid on export --- htdocs/core/modules/modAccounting.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index e0bf3a9bbc5..d294a470041 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -258,14 +258,16 @@ class modAccounting extends DolibarrModules $this->export_label[$r] = 'Chartofaccounts'; $this->export_icon[$r] = 'accounting'; $this->export_permission[$r] = array(array("accounting", "chartofaccount")); - $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); - $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); - $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa.accountparent'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); + $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); + $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"List:accounting_account:account_number", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); + $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa2.account_number'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa'; $this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_system as ac'; - $this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') '; + $this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_account as aa2'; + $this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').')'; + $this->export_sql_end[$r] .= ' AND aa2.rowid = aa.account_parent AND aa2.active = 1 AND ac.pcg_version = aa2.fk_pcg_version AND aa2.entity IN ('.getEntity('accounting').')'; // Imports From 724490b94de89a00620e73205bbc2b6453efa924 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 23 Sep 2022 09:56:54 +0200 Subject: [PATCH 14/17] FIX wrong result check when update expensereport line --- htdocs/expensereport/class/expensereport.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index ca8f1698767..e0799a46f73 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2069,6 +2069,7 @@ class ExpenseReport extends CommonObject if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_REFUSED) { $this->db->begin(); + $error = 0; $type = 0; // TODO What if type is service ? // We don't know seller and buyer for expense reports @@ -2152,10 +2153,13 @@ class ExpenseReport extends CommonObject $this->applyOffset(); $this->checkRules(); - $error = 0; - $result = $this->line->update($user); - if ($result > 0 && !$notrigger) { + $result = $this->line->update($user); + if ($result < 0) { + $error++; + } + + if (!$error && !$notrigger) { // Call triggers $result = $this->call_trigger('EXPENSE_REPORT_DET_MODIFY', $user); if ($result < 0) { @@ -2164,7 +2168,7 @@ class ExpenseReport extends CommonObject // End call triggers } - if ($result > 0 && $error == 0) { + if (!$error) { $this->db->commit(); return 1; } else { From 4f6cf3f0673614cec3bb31a5123716d870d85261 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 23 Sep 2022 11:46:55 +0200 Subject: [PATCH 15/17] FIX missing check if category module is enabled --- htdocs/adherents/list.php | 2 +- htdocs/comm/action/list.php | 2 +- htdocs/compta/bank/list.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- htdocs/product/list.php | 2 ++ htdocs/product/stock/list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/user/list.php | 2 +- 11 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 30412f2b9ae..5620d56f60f 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -611,7 +611,7 @@ if ($user->rights->adherent->creer) { if ($user->rights->adherent->supprimer) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if ($user->rights->societe->creer) { +if (isModEnabled('category') && $user->rights->adherent->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if ($user->rights->adherent->creer && $user->rights->user->user->creer) { diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dd877e903e4..b5ec104d02f 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -398,7 +398,7 @@ $arrayofmassactions = array( if ($user->rights->agenda->allactions->delete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if ($user->rights->agenda->myactions->create) { +if (isModEnabled('category') && $user->rights->agenda->myactions->create) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) { diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 362ca3d488f..5c1472bc6fb 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -303,7 +303,7 @@ $arrayofmassactions = array( if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if ($user->rights->banque->modifier) { +if (isModEnabled('category') && $user->rights->banque->modifier) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index d41b6829bb2..1a2dac09da3 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -691,7 +691,7 @@ $arrayofmassactions = array( if ($user->rights->societe->supprimer) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if ($user->rights->societe->creer) { +if (isModEnabled('category') && $user->rights->societe->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) { diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 678bf219bef..656b5b263aa 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -40,7 +40,7 @@ if ($massaction == 'predelete') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); } -if ($massaction == 'preaffecttag') { +if ($massaction == 'preaffecttag' && isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categ = new Categorie($db); $categ_types = array(); diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 18ec0d67738..f9d9c47f103 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -427,7 +427,7 @@ if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if ($user->rights->knowledgemanagement->knowledgerecord->write) { +if (isModEnabled('category') && $user->rights->knowledgemanagement->knowledgerecord->write) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1464456cd6d..642e22d8b02 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -738,6 +738,8 @@ if ($resql) { if ($user->rights->{$rightskey}->creer) { $arrayofmassactions['switchonsalestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnSaleStatus"); $arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus"); + } + if (isModEnabled('category') && $user->rights->{$rightskey}->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_extrafields'))) { diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 4271ac5d8c2..687577af52e 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -382,7 +382,7 @@ $arrayofmassactions = array( if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) { $arrayofmassactions = array(); } -if ($user->rights->stock->creer) { +if (isModEnabled('category') && $user->rights->stock->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'label', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index a729112353f..8fa6c0ec2e5 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -764,7 +764,7 @@ if ($user->rights->projet->creer) { if ($user->rights->projet->supprimer) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if ($user->rights->projet->creer) { +if (isModEnabled('category') && $user->rights->projet->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 18999ed9a1f..1222e9f7ffc 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -873,7 +873,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->rights->societe->creer) { +if (isModEnabled('category') && $user->rights->societe->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } if ($user->rights->societe->creer) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 53eed056695..8642c569752 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -585,7 +585,7 @@ if ($permissiontoadd) { if ($permissiontoadd) { $arrayofmassactions['reactivate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Reactivate"); } -if ($permissiontoadd) { +if (isModEnabled('category') && $permissiontoadd) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } //if ($permissiontodelete) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); From 87b74b3de75c4dd93dfb4ef69a7f9f67dbabcc51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 17:12:26 +0200 Subject: [PATCH 16/17] FIX #22360 --- htdocs/categories/class/categorie.class.php | 27 +++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 8d26b5583d4..27a301776b8 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -636,23 +636,30 @@ class Categorie extends CommonObject } $arraydelete = array( - 'categorie_product' => 'fk_categorie', - 'categorie_fournisseur' => 'fk_categorie', - 'categorie_societe' => 'fk_categorie', - 'categorie_member' => 'fk_categorie', - 'categorie_contact' => 'fk_categorie', - 'categorie_user' => 'fk_categorie', - 'categorie_project' => 'fk_categorie', 'categorie_account' => 'fk_categorie', - 'categorie_website_page' => 'fk_categorie', - 'categorie_warehouse' => 'fk_categorie', 'categorie_actioncomm' => 'fk_categorie', - 'categorie_ticket' => 'fk_categorie', + 'categorie_contact' => 'fk_categorie', + 'categorie_fournisseur' => 'fk_categorie', + 'categorie_knowledgemanagement' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('knowledgemanagement')), + 'categorie_member' => 'fk_categorie', + 'categorie_user' => 'fk_categorie', + 'categorie_product' => 'fk_categorie', + 'categorie_project' => 'fk_categorie', + 'categorie_societe' => 'fk_categorie', + 'categorie_ticket' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('ticket')), + 'categorie_warehouse' => 'fk_categorie', + 'categorie_website_page' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('website')), 'bank_class' => 'fk_categ', 'categorie_lang' => 'fk_category', 'categorie' => 'rowid', ); foreach ($arraydelete as $key => $value) { + if (is_array($value)) { + if (empty($value['enabled'])) { + continue; + } + $value = $value['field']; + } $sql = "DELETE FROM ".MAIN_DB_PREFIX.$key; $sql .= " WHERE ".$value." = ".((int) $this->id); if (!$this->db->query($sql)) { From 194d7a2110cdd8324e368bec2840fe7d45780a35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 17:26:28 +0200 Subject: [PATCH 17/17] Update modAccounting.class.php --- htdocs/core/modules/modAccounting.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index d294a470041..6d1c6b1d876 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -259,7 +259,7 @@ class modAccounting extends DolibarrModules $this->export_icon[$r] = 'accounting'; $this->export_permission[$r] = array(array("accounting", "chartofaccount")); $this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status'); - $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"List:accounting_account:account_number", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); + $this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status'); $this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa2.account_number'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting"); $this->export_sql_start[$r] = 'SELECT DISTINCT ';