From c5659b5fbd3df4ab8fde1379678c5ba4a9805508 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:04:53 +0100 Subject: [PATCH 001/130] Fix PhanPluginDuplicateExpressionAssignmentOperation $this to obj --- htdocs/compta/sociales/class/chargesociales.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index e81d5b80e5d..b08bcacfc9a 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -192,7 +193,7 @@ class ChargeSociales extends CommonObject $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->period); $this->period = $this->db->jdate($obj->period); - $this->import_key = $this->import_key; + $this->import_key = $obj->import_key; $this->db->free($resql); @@ -653,7 +654,7 @@ class ChargeSociales extends CommonObject $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; From 0afe2fa14585ec65664d98b438a0280de7bfa26c Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:21:52 +0100 Subject: [PATCH 002/130] Fix PhanPluginDuplicateExpressionAssignmentOperation (Simplification) --- htdocs/adherents/tpl/linkedobjectblock.tpl.php | 3 ++- htdocs/admin/modules.php | 17 +++++++++-------- htdocs/admin/system/filecheck.php | 7 ++++--- htdocs/admin/system/phpinfo.php | 17 +++++++++-------- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index d4efa349202..5582c60e30f 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2011 Regis Houssin * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2014 Marcos García + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +41,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''.dol_print_date($objectlink->dateh, 'day').''; echo ''; if ($user->hasRight('adherent', 'lire')) { - $total = $total + $objectlink->amount; + $total += $objectlink->amount; echo price($objectlink->amount); } echo ''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index ece8c531fc9..893523f22da 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2021-2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1253,36 +1254,36 @@ if ($mode == 'deploy') { $maxphp = @ini_get('upload_max_filesize'); // In unknown if (preg_match('/k$/i', $maxphp)) { $maxphp = preg_replace('/k$/i', '', $maxphp); - $maxphp = $maxphp * 1; + $maxphp *= 1; } if (preg_match('/m$/i', $maxphp)) { $maxphp = preg_replace('/m$/i', '', $maxphp); - $maxphp = $maxphp * 1024; + $maxphp *= 1024; } if (preg_match('/g$/i', $maxphp)) { $maxphp = preg_replace('/g$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024; + $maxphp *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp)) { $maxphp = preg_replace('/t$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024 * 1024; + $maxphp *= 1024 * 1024 * 1024; } $maxphp2 = @ini_get('post_max_size'); // In unknown if (preg_match('/k$/i', $maxphp2)) { $maxphp2 = preg_replace('/k$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1; + $maxphp2 *= 1; } if (preg_match('/m$/i', $maxphp2)) { $maxphp2 = preg_replace('/m$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024; + $maxphp2 *= 1024; } if (preg_match('/g$/i', $maxphp2)) { $maxphp2 = preg_replace('/g$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024; + $maxphp2 *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp2)) { $maxphp2 = preg_replace('/t$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; + $maxphp2 *= 1024 * 1024 * 1024; } // Now $max and $maxphp and $maxphp2 are in Kb $maxmin = $max; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 57b9ea2c7d8..f54720e03df 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2015-2019 Frederic France * Copyright (C) 2017 Nicolas ZABOURI + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,7 +84,7 @@ $xmlshortfile = dol_sanitizeFileName(GETPOST('xmlshortfile', 'alpha') ? GETPOST( $xmlfile = DOL_DOCUMENT_ROOT.'/install/'.$xmlshortfile; if (!preg_match('/\.zip$/i', $xmlfile) && dol_is_file($xmlfile.'.zip')) { - $xmlfile = $xmlfile.'.zip'; + $xmlfile .= '.zip'; } // Remote file to compare to @@ -183,7 +184,7 @@ if (GETPOST('target') == 'remote') { libxml_disable_entity_loader(true); } - $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); + $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET); } else { $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; setEventMessages($errormsg, null, 'errors'); @@ -259,7 +260,7 @@ if (empty($error) && !empty($xml)) { $tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']); if (!in_array($tmprelativefilename, $file_list['insignature'])) { $md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file - $file_list['added'][] = array('filename'=>$tmprelativefilename, 'md5'=>$md5newfile); + $file_list['added'][] = array('filename' => $tmprelativefilename, 'md5' => $md5newfile); } } diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 36c64a826a6..3c410fbe0d4 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,36 +54,36 @@ if (isset($title)) { $maxphp = @ini_get('upload_max_filesize'); // In unknown if (preg_match('/k$/i', $maxphp)) { $maxphp = preg_replace('/k$/i', '', $maxphp); - $maxphp = $maxphp * 1; + $maxphp *= 1; } if (preg_match('/m$/i', $maxphp)) { $maxphp = preg_replace('/m$/i', '', $maxphp); - $maxphp = $maxphp * 1024; + $maxphp *= 1024; } if (preg_match('/g$/i', $maxphp)) { $maxphp = preg_replace('/g$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024; + $maxphp *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp)) { $maxphp = preg_replace('/t$/i', '', $maxphp); - $maxphp = $maxphp * 1024 * 1024 * 1024; + $maxphp *= 1024 * 1024 * 1024; } $maxphp2 = @ini_get('post_max_size'); // In unknown if (preg_match('/k$/i', $maxphp2)) { $maxphp2 = preg_replace('/k$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1; + $maxphp2 *= 1; } if (preg_match('/m$/i', $maxphp2)) { $maxphp2 = preg_replace('/m$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024; + $maxphp2 *= 1024; } if (preg_match('/g$/i', $maxphp2)) { $maxphp2 = preg_replace('/g$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024; + $maxphp2 *= 1024 * 1024; } if (preg_match('/t$/i', $maxphp2)) { $maxphp2 = preg_replace('/t$/i', '', $maxphp2); - $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; + $maxphp2 *= 1024 * 1024 * 1024; } if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) { $langs->load("errors"); From 0f76544e0fd6228a69922c2f3a99e1d7482cf41b Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:12 +0100 Subject: [PATCH 003/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/compta/bank/various_payment/card.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index ae720d63423..90817a5848d 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Laurent Destailleur * Copyright (C) 2023 Joachim Kueter + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -286,9 +287,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { if (GETPOSTISSET("clone_sens")) { $object->sens = GETPOSTINT("clone_sens"); - } else { - $object->sens = $object->sens; - } + } // else { $object->sens = $object->sens; } if (GETPOSTISSET("clone_amount")) { $object->amount = GETPOSTFLOAT("clone_amount"); From 944ba8a4c02336dbdbf15116106593cb46230bf3 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:14 +0100 Subject: [PATCH 004/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f01432b7c25..30b7d6e655a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1274,7 +1274,7 @@ if (empty($reshook)) { $line->fk_parent_line = $fk_parent_line; $line->subprice = -$line->subprice; // invert price for object - $line->pa_ht = $line->pa_ht; // we chose to have buy/cost price always positive, so no revert of sign here + // $line->pa_ht = $line->pa_ht; // we chose to have buy/cost price always positive, so no revert of sign here $line->total_ht = -$line->total_ht; $line->total_tva = -$line->total_tva; $line->total_ttc = -$line->total_ttc; From d66937c65ba951dff6e032f35c8e132c2ee245d5 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:17 +0100 Subject: [PATCH 005/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/contrat/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index ff741101419..4d411b5a2b9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -764,7 +764,7 @@ if (empty($reshook)) { $fk_unit = GETPOST('unit', 'alpha'); // update price_ht with discount - // TODO Use object->updateline instead objedtline->update + // TODO Use object->updateline instead objectline->update $price_ht = price2num(GETPOST('elprice'), 'MU'); $remise_percent = price2num(GETPOST('elremise_percent'), '', 2); @@ -789,7 +789,7 @@ if (empty($reshook)) { $objectline->user_closing_id = $user->id; //$objectline->fk_fournprice = $fk_fournprice; $objectline->pa_ht = $pa_ht; - $objectline->rang = $objectline->rang; + // $objectline->rang = $objectline->rang; if ($fk_unit > 0) { $objectline->fk_unit = GETPOST('unit'); From d199883ec1610b9642e66387d2425ab5e5621b0a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:20 +0100 Subject: [PATCH 006/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/contrat/class/contrat.class.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 99662fd0273..bc9964d2d33 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3467,19 +3467,6 @@ class ContratLigne extends CommonObjectLine if (empty($this->remise_percent)) { $this->remise_percent = 0; } - // For backward compatibility - if (empty($this->date_start)) { - $this->date_start = $this->date_start; - } - if (empty($this->date_start_real)) { - $this->date_start_real = $this->date_start_real; - } - if (empty($this->date_end)) { - $this->date_end = $this->date_end; - } - if (empty($this->date_end_real)) { - $this->date_end_real = $this->date_end_real; - } // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva From e670fcc32ea4b5574045c371c1638fe2bea848ea Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:22 +0100 Subject: [PATCH 007/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9a8e1ea8a0f..04777bd7b7b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017 Nicolas ZABOURI * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2022 Antonin MARCHAL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1310,7 +1311,6 @@ class ExtraFields } else { $labeltoshow = $obj->{$InfoFieldList[1]}; } - $labeltoshow = $labeltoshow; if ($value == $obj->rowid) { if (!$notrans) { From 6319b5bff1eb9af594271e24bdd0acbf3477fe08 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:24 +0100 Subject: [PATCH 008/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d759ceef970..dad0a0a68d4 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2023 William Mead * Copyright (C) 2023 Christian Foellmann * Copyright (C) 2024 William Mead + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,7 +173,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array($object->id => $object->id); - $object->socid = $object->socid; + // $object->socid = $object->socid; } elseif ($action == 'CONTACT_MODIFY') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -189,7 +190,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = array($object->id => $object->id); - $object->socid = $object->socid; + // $object->socid = $object->socid; } elseif ($action == 'CONTRACT_VALIDATE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "contracts")); From 60ba5d0b823de381e98f421636a3156d3b10d1bf Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:26 +0100 Subject: [PATCH 009/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/salaries/document.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index 89f6ee1b1f9..297da859f33 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -8,6 +8,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015-2023 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -238,7 +239,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'salaries'; - $permissiontoadd = $permissiontoadd; + // $permissiontoadd = $permissiontoadd; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { From 71e6cbf5344f2efe6dd6b50aa726a30cba1b9c03 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:29 +0100 Subject: [PATCH 010/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/societe/class/api_thirdparties.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 612c9c7852c..0d501e63cdc 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2019 Cedric Ancelin * Copyright (C) 2020-2024 Frédéric France * Copyright (C) 2023 Alexandre Janniaux + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1306,7 +1307,7 @@ class Thirdparties extends DolibarrApi $this->company->setDocModel(DolibarrApiAccess::$user, $model); $this->company->fk_bank = $this->company->fk_account; - $this->company->fk_account = $this->company->fk_account; + // $this->company->fk_account = $this->company->fk_account; $outputlangs = $langs; $newlang = ''; From 8422a355678340f9586f6f397a5a56c4f89ae74a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:24:31 +0100 Subject: [PATCH 011/130] Fix PhanPluginDuplicateExpressionAssignment (NOOP assignment) --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3172aedb7f9..a1d1f03cb54 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -447,7 +447,7 @@ if (empty($reshook)) { $line->fk_parent_line = $fk_parent_line; $line->subprice = -$line->subprice; // invert price for object - $line->pa_ht = $line->pa_ht; // we chose to have the buy/cost price always positive, so no inversion of the sign here + // $line->pa_ht = $line->pa_ht; // we chose to have the buy/cost price always positive, so no inversion of the sign here $line->total_ht = -$line->total_ht; $line->total_tva = -$line->total_tva; $line->total_ttc = -$line->total_ttc; From 6170ebe82e612d0107287491b984d50eca2dd11d Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 22:27:58 +0100 Subject: [PATCH 012/130] Qual: Enable PhanPluginDuplicateExpressionAssignment, all fixed --- dev/tools/phan/config.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 53dd0aa447b..24a3daa363d 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -410,8 +410,7 @@ return [ 'PhanDeprecatedProperty', 'PhanDeprecatedFunction', //'PhanCompatibleNegativeStringOffset', - // Dolibarr has quite a few strange noop assignments like $abc=$abc; - 'PhanPluginDuplicateExpressionAssignment', + // 'PhanPluginDuplicateExpressionAssignment', // Nulls are likely mostly false positives 'PhanPluginConstantVariableNull', 'PhanTypeObjectUnsetDeclaredProperty', @@ -601,7 +600,7 @@ return [ 'PhanUndeclaredClassMethod', 'PhanUndeclaredMethod', 'PhanTypeMismatchArgumentProbablyReal', - 'PhanPluginDuplicateExpressionAssignmentOperation', + 'PhanPluginDuplicateExpressionAssignmentOperation', // Suggestions for optimisation 'PhanTypeMismatchPropertyDefault', // 'PhanPluginAlwaysReturnMethod', // 'PhanPluginMissingReturnMethod', From ea4054b42e5599dcdcd498a516a573427abe9b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 22:48:12 +0100 Subject: [PATCH 013/130] fix warnings --- htdocs/holiday/card.php | 7 +++++-- htdocs/holiday/class/holiday.class.php | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 895d96d6966..bf2ff8f4fe4 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -524,8 +524,11 @@ if (empty($reshook)) { } $typeleaves = $object->getTypes(1, -1); - $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); - + if (empty($typeleaves[$object->fk_type])) { + $labeltoshow = $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type); + } else { + $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']); + } if ($object->halfday == 2) { $starthalfdaykey = "Afternoon"; $endhalfdaykey = "Morning"; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c12032028e6..985bb575f0c 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1366,8 +1366,12 @@ class Holiday extends CommonObject // show type for this record only in ajax to not overload lists if (!$nofetch && !empty($this->fk_type)) { $typeleaves = $this->getTypes(1, -1); - $labeltoshow = (($typeleaves[$this->fk_type]['code'] && $langs->trans($typeleaves[$this->fk_type]['code']) != $typeleaves[$this->fk_type]['code']) ? $langs->trans($typeleaves[$this->fk_type]['code']) : $typeleaves[$this->fk_type]['label']); - $datas['type'] = '
'.$langs->trans("Type") . ': ' . (empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $this->fk_type) : $labeltoshow); + if (empty($typeleaves[$this->fk_type])) { + $labeltoshow = $langs->trans("TypeWasDisabledOrRemoved", $this->fk_type); + } else { + $labeltoshow = (($typeleaves[$this->fk_type]['code'] && $langs->trans($typeleaves[$this->fk_type]['code']) != $typeleaves[$this->fk_type]['code']) ? $langs->trans($typeleaves[$this->fk_type]['code']) : $typeleaves[$this->fk_type]['label']); + } + $datas['type'] = '
'.$langs->trans("Type") . ': ' . $labeltoshow; } if (isset($this->halfday) && !empty($this->date_debut) && !empty($this->date_fin)) { $listhalfday = array( From 717c47abd3e33a4d154cde120ea7de8ede59259a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:28:49 +0100 Subject: [PATCH 014/130] Fix PhanPluginRedundantAssignment --- .../accountancy/class/accountancyexport.class.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index a240dca3387..09586c12637 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -14,6 +14,7 @@ * Copyright (C) 2020 Guillaume Alexandre * Copyright (C) 2022 Joachim Kueter * Copyright (C) 2022 Progiseize + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -277,7 +278,7 @@ class AccountancyExport 'ACCOUNTING_EXPORT_FORMAT' => 'csv', ), ), - 'cr'=> array( + 'cr' => array( '1' => $langs->trans("Unix"), '2' => $langs->trans("Windows") ), @@ -302,8 +303,6 @@ class AccountancyExport */ public function getMimeType($formatexportset) { - $mime = 'text/csv'; - switch ($formatexportset) { case self::$EXPORT_TYPE_FEC: $mime = 'text/tab-separated-values'; @@ -346,7 +345,7 @@ class AccountancyExport $exportFile = null; $exportFileName = ''; $exportFilePath = ''; - $exportFileFullName =''; + $exportFileFullName = ''; $downloadFileMimeType = ''; $downloadFileFullName = ''; $downloadFilePath = ''; @@ -1000,7 +999,7 @@ class AccountancyExport $invoice = new FactureFournisseur($this->db); $invoice->fetch($line->fk_doc); $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; - $objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } $arrayofinclusion = array(); // If it is a supplier invoice, we want to use last uploaded file @@ -1466,7 +1465,7 @@ class AccountancyExport $objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output; } elseif ($line->doc_type == 'supplier_invoice') { $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; - $objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } $arrayofinclusion = array(); // If it is a supplier invoice, we want to use last uploaded file @@ -1678,7 +1677,7 @@ class AccountancyExport $objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output; } elseif ($line->doc_type == 'supplier_invoice') { $objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output; - $objectDirPath.= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); + $objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/'); } $arrayofinclusion = array(); // If it is a supplier invoice, we want to use last uploaded file @@ -1789,7 +1788,7 @@ class AccountancyExport && $objectLines[$aIndex + 1]->piece_num == $line->piece_num && $aIndex - 1 < $aSize && $objectLines[$aIndex - 1]->piece_num == $line->piece_num - ) { + ) { $sammelBuchung = true; } From 42dafc78ed1336abcd4cd5f38e2f4e5791ebc5ce Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:28:51 +0100 Subject: [PATCH 015/130] Fix PhanPluginRedundantAssignment --- htdocs/accountancy/class/accountingaccount.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 479887a5724..0a8e5a40845 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -770,11 +770,11 @@ class AccountingAccount extends CommonObject if ($factureDet->product_type == 1) { if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) $code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'); + // @phan-suppress-next-line PhanPluginRedundantAssignment $suggestedaccountingaccountbydefaultfor = ''; } else { if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT $code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'); - $suggestedaccountingaccountbydefaultfor = 'eecwithvat'; } elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number $code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'); $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber'; @@ -789,6 +789,7 @@ class AccountingAccount extends CommonObject } elseif ($factureDet->product_type == 0) { if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) $code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'); + // @phan-suppress-next-line PhanPluginRedundantAssignment $suggestedaccountingaccountbydefaultfor = ''; } else { if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT From fc3cdf51bae051cb356120bf73aa7af4c754bf3a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:28:53 +0100 Subject: [PATCH 016/130] Fix PhanPluginRedundantAssignment --- htdocs/adherents/class/api_members.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 889f1212547..941a685d326 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2017 Regis Houssin * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2020 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -535,8 +536,6 @@ class Members extends DolibarrApi */ public function getSubscriptions($id) { - $obj_ret = array(); - if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) { throw new RestException(403); } From 22bd4d8774549e4d17b3941c204aad1be520a882 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:28:56 +0100 Subject: [PATCH 017/130] Fix PhanPluginRedundantAssignment --- htdocs/blockedlog/class/blockedlog.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 2166a0eb8cd..64f69ea390d 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -352,6 +352,7 @@ class BlockedLog global $langs, $cachedUser; if (empty($cachedUser)) { + // @phan-suppress-next-line PhanPluginRedundantAssignment $cachedUser = array(); } From 5ab895f31cebd2c450f68c274d7bdd26cfe502da Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:28:58 +0100 Subject: [PATCH 018/130] Fix PhanPluginRedundantAssignment --- htdocs/categories/class/categorie.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 62bbc69953d..f65789c855c 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1009,7 +1010,7 @@ class Categorie extends CommonObject $nbtotalofrecords = $this->db->num_rows($result); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; - $offset = 0; + $offset = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } } From 3c24140ccfd88066ee26d0c845efabcf25b1d465 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:00 +0100 Subject: [PATCH 019/130] Fix PhanPluginRedundantAssignment --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 62b813d8eb1..704f14baeb8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1578,7 +1578,7 @@ class ActionComm extends CommonObject $statusType = 'status9'; if ($percent == -1 && !$hidenastatus) { - $statusType = 'status9'; + $statusType = 'status9'; // @phan-suppress-current-line PhanPluginRedundantAssignment } if ($percent == 0) { $statusType = 'status1'; From fb2aadf006fa2edd02ac7f7860feab101167b821 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:03 +0100 Subject: [PATCH 020/130] Fix PhanPluginRedundantAssignment --- htdocs/comm/propal/class/propal.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 41fd6253113..51cb5484af0 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -673,7 +673,6 @@ class Propal extends CommonObject // Clean vat code $reg = array(); $vat_src_code = ''; - $reg = array(); if (preg_match('/\((.*)\)/', $txtva, $reg)) { $vat_src_code = $reg[1]; $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. From ca8ccd84f0553063c1166b17b532ff01d200b218 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:05 +0100 Subject: [PATCH 021/130] Fix PhanPluginRedundantAssignment --- htdocs/compta/facture/class/facture-rec.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 447d0d9f5da..e48c0d52c5e 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1590,7 +1590,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1609,7 +1609,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1628,7 +1628,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1650,7 +1650,7 @@ class FactureRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } From 9ee7611a081422bea428f39a3dcff9bcbac50c20 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:07 +0100 Subject: [PATCH 022/130] Fix PhanPluginRedundantAssignment --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 20483623722..8aee3548b16 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -524,8 +524,8 @@ class Facture extends CommonInvoice // Define some dates $originaldatewhen = $_facrec->date_when; - $nextdatewhen = null; - $previousdaynextdatewhen = null; + $nextdatewhen = null; // @phan-suppress-current-line PhanPluginRedundantAssignment + $previousdaynextdatewhen = null; // @phan-suppress-current-line PhanPluginRedundantAssignment if ($originaldatewhen) { $nextdatewhen = dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency); $previousdaynextdatewhen = dol_time_plus_duree($nextdatewhen, -1, 'd'); From c7bd8b57ccefaf1ebb19e97256d309f8c98f5934 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:10 +0100 Subject: [PATCH 023/130] Fix PhanPluginRedundantAssignment --- htdocs/compta/prelevement/class/bonprelevement.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 7e149cc435c..0194541b801 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -316,7 +316,7 @@ class BonPrelevement extends CommonObject if ($resql) { $num = $this->db->num_rows($resql); } else { - $result = -1; + $result = -1; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { /* @@ -1649,7 +1649,7 @@ class BonPrelevement extends CommonObject dol_syslog("adnotiff: ".$sql); if ($this->db->query($sql)) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } else { $result = -1; dol_syslog(get_class($this)."::addNotification Error $result"); From d68f196ccfe11b98fc0ec935f67f6f1b2e1e8156 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:12 +0100 Subject: [PATCH 024/130] Fix PhanPluginRedundantAssignment --- htdocs/core/boxes/box_members_subscriptions_by_year.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 09df79556bb..ddb3b12185b 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2021 Frederic France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -110,7 +111,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes } - $line = 0; + $line = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->info_box_contents[$line][] = array( 'td' => 'class=""', 'text' => $langs->trans("Year"), From d33e0a69ca8db2cc7e04f66668d7381ffda28375 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:15 +0100 Subject: [PATCH 025/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 2bd85fa349e..c3cfdf85fca 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1119,7 +1119,7 @@ class CMailFile $result = $this->smtps->getErrors(); // applicative error code (not SMTP error code) if (empty($this->error) && empty($result)) { dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG); - $res = true; + $res = true; // @phan-suppress-current-line PhanPluginRedundantAssignment } else { if (empty($this->error)) { $this->error = $result; From 509357d6322e16a8e602df6f10cee761dd655bca Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:17 +0100 Subject: [PATCH 026/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/CSMSFile.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 65c23b44c50..4e34d9a284f 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -207,7 +208,7 @@ class CSMSFile // Send sms method not correctly defined // -------------------------------------- $this->error = 'Bad value for MAIN_SMS_SENDMODE constant'; - $res = false; + $res = false; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { $this->error = 'No sms sent. Feature is disabled by option MAIN_DISABLE_ALL_SMS'; From c76c08e9f02bd0e4205f8005ff5751e565cfbfd0 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:19 +0100 Subject: [PATCH 027/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/commoninvoice.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index a32425ceef4..fcdc114110e 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -269,7 +270,7 @@ abstract class CommonInvoice extends CommonObject if ($multicurrency < 0) { $this->sumpayed = $obj->amount; $this->sumpayed_multicurrency = $obj->multicurrency_amount; - return array('alreadypaid'=>(float) $obj->amount, 'alreadypaid_multicurrency'=>(float) $obj->multicurrency_amount); + return array('alreadypaid' => (float) $obj->amount, 'alreadypaid_multicurrency' => (float) $obj->multicurrency_amount); } elseif ($multicurrency) { $this->sumpayed_multicurrency = $obj->multicurrency_amount; return (float) $obj->multicurrency_amount; @@ -477,7 +478,7 @@ abstract class CommonInvoice extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $tmp = array('amount'=>$obj->amount, 'type'=>$obj->code, 'date'=>$obj->datep, 'num'=>$obj->num, 'ref'=>$obj->ref); + $tmp = array('amount' => $obj->amount, 'type' => $obj->code, 'date' => $obj->datep, 'num' => $obj->num, 'ref' => $obj->ref); if (!empty($field3)) { $tmp['ref_ext'] = $obj->ref_ext; } @@ -511,9 +512,9 @@ abstract class CommonInvoice extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); if ($multicurrency) { - $retarray[] = array('amount'=>$obj->multicurrency_amount, 'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'0', 'ref'=>$obj->ref); + $retarray[] = array('amount' => $obj->multicurrency_amount, 'type' => $obj->type, 'date' => $obj->date, 'num' => '0', 'ref' => $obj->ref); } else { - $retarray[] = array('amount'=>$obj->amount, 'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'', 'ref'=>$obj->ref); + $retarray[] = array('amount' => $obj->amount, 'type' => $obj->type, 'date' => $obj->date, 'num' => '', 'ref' => $obj->ref); } $i++; } @@ -1312,9 +1313,9 @@ abstract class CommonInvoice extends CommonObject if ($foundalternativestripeaccount) { if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - $customer = \Stripe\Customer::retrieve(array('id'=>"$foundalternativestripeaccount", 'expand[]'=>'sources')); + $customer = \Stripe\Customer::retrieve(array('id' => "$foundalternativestripeaccount", 'expand[]' => 'sources')); } else { - $customer = \Stripe\Customer::retrieve(array('id'=>"$foundalternativestripeaccount", 'expand[]'=>'sources'), array("stripe_account" => $stripeacc)); + $customer = \Stripe\Customer::retrieve(array('id' => "$foundalternativestripeaccount", 'expand[]' => 'sources'), array("stripe_account" => $stripeacc)); } } else { $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0); @@ -1500,7 +1501,7 @@ abstract class CommonInvoice extends CommonObject $description = 'Failed to find or use your payment mode (no payment mode for this customer id)'; $stripefailurecode = 'BADPAYMENTMODE'; $stripefailuremessage = 'Failed to find or use your payment mode (no payment mode for this customer id)'; - $postactionmessages = []; + $postactionmessages = []; // @phan-suppress-current-line PhanPluginRedundantAssignment $object = $this; From 5668974d461811a55ca5c57f86613409b0992101 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:21 +0100 Subject: [PATCH 028/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/commonobject.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d7c2f99e635..19ae71b14e2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7368,7 +7368,7 @@ abstract class CommonObject } $out = ' '; } elseif ($type == 'select') { // combo list - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); @@ -7400,7 +7400,7 @@ abstract class CommonObject $out .= $tmpselect; $out .= ''; } elseif ($type == 'sellist') { - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); @@ -7594,7 +7594,7 @@ abstract class CommonObject $value_arr = explode(',', $value); $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, $morecss, 0, '100%'); } elseif ($type == 'radio') { - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment foreach ($param['options'] as $keyopt => $valopt) { $out .= ' '; From 81fde8ffc377dd3dd1c44ecde8ff514cee724a92 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:23 +0100 Subject: [PATCH 029/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/commonobjectline.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 1a0f1f15ed0..92a84376184 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -167,8 +168,6 @@ abstract class CommonObjectLine extends CommonObject $langs->load('products'); - $label_type = 'label'; - $label_type = 'label'; if ($type == 'short') { $label_type = 'short_label'; From 0302e4f2b5839b514a7a93b088edc18e976cc910 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:25 +0100 Subject: [PATCH 030/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/dolgraph.class.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index d1743b8c733..215d9a9e0e0 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1,6 +1,7 @@ * Copyright (c) 2004-2015 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1288,7 +1289,6 @@ class DolGraph $this->stringtoshow .= '], datasets: ['; $i = 0; - $i = 0; while ($i < $nblot) { // Loop on each series $color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ')'; @@ -1310,11 +1310,7 @@ class DolGraph $type = 'bar'; $xaxis = ''; - if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') { - $type = 'bar'; - } if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'horizontalbars') { - $type = 'bar'; $xaxis = "indexAxis: 'y', "; } if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) { @@ -1348,7 +1344,7 @@ class DolGraph $this->stringtoshow .= 'tooltip: { mode: \'nearest\', callbacks: {'; if (is_array($this->tooltipsTitles)) { - $this->stringtoshow .=' + $this->stringtoshow .= ' title: function(tooltipItem, data) { var tooltipsTitle ='.json_encode($this->tooltipsTitles).' return tooltipsTitle[tooltipItem[0].datasetIndex]; @@ -1360,7 +1356,7 @@ class DolGraph return tooltipslabels[tooltipItem.datasetIndex] }'; } - $this->stringtoshow .='}},'; + $this->stringtoshow .= '}},'; } $this->stringtoshow .= "}, \n"; @@ -1388,7 +1384,7 @@ class DolGraph $this->stringtoshow .= 'tooltips: { mode: \'nearest\', callbacks: {'; if (is_array($this->tooltipsTitles)) { - $this->stringtoshow .=' + $this->stringtoshow .= ' title: function(tooltipItem, data) { var tooltipsTitle ='.json_encode($this->tooltipsTitles).' return tooltipsTitle[tooltipItem[0].datasetIndex]; @@ -1400,7 +1396,7 @@ class DolGraph return tooltipslabels[tooltipItem.datasetIndex] }'; } - $this->stringtoshow .='}},'; + $this->stringtoshow .= '}},'; } $this->stringtoshow .= '};'; $this->stringtoshow .= ' From 271525deaa2d99035a217c901a3bf375c699d900 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:27 +0100 Subject: [PATCH 031/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/extrafields.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9a8e1ea8a0f..55fe49953f2 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017 Nicolas ZABOURI * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2022 Antonin MARCHAL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1147,7 +1148,7 @@ class ExtraFields } $out = ' '; } elseif ($type == 'select') { - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment if ($mode) { $options = array(); foreach ($param['options'] as $okey => $val) { @@ -1202,7 +1203,7 @@ class ExtraFields $out .= ''; } } elseif ($type == 'sellist') { - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); @@ -1366,7 +1367,7 @@ class ExtraFields } $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, '', 0, '100%'); } elseif ($type == 'radio') { - $out = ''; + $out = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment foreach ($param['options'] as $keyopt => $val) { $out .= ' Date: Wed, 13 Mar 2024 00:29:29 +0100 Subject: [PATCH 032/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/html.form.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a7905a1b346..4a3f654a83e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2813,7 +2813,7 @@ class Form $sql .= " FROM ".$this->db->prefix()."product as p"; // Add from (left join) from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -2883,7 +2883,7 @@ class Form $sql .= " AND p.fk_product_type = 0"; } // Add where from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('selectProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Add criteria on ref/label @@ -7843,7 +7843,6 @@ class Form if (!empty($conf->use_javascript_ajax) && getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) { $placeholder = ''; - $urloption = ''; if ($selected && empty($selected_input_value)) { require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; @@ -9492,7 +9491,7 @@ class Form '; } else { - $linktoelem = ''; + $linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } if (!empty($conf->use_javascript_ajax)) { From c3647c3af69b17183c7af26ced7df8d14ae49e92 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:31 +0100 Subject: [PATCH 033/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/html.formfile.class.php | 53 ++++++++++++----------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5c527e016c2..8d8133fabdb 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2016-2017 Ferran Marcet * Copyright (C) 2019-2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -260,7 +261,7 @@ class FormFile $out .= "\n\n"; } - $parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm, 'options'=>$options); + $parameters = array('socid' => (isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id' => (isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url' => $url, 'perm' => $perm, 'options' => $options); $res = $hookmanager->executeHooks('formattachOptions', $parameters, $object); if (empty($res)) { $out = '
'.$out.'
'; @@ -349,23 +350,23 @@ class FormFile $reshook = 0; if (is_object($hookmanager)) { $parameters = array( - 'modulepart'=>&$modulepart, - 'modulesubdir'=>&$modulesubdir, - 'filedir'=>&$filedir, - 'urlsource'=>&$urlsource, - 'genallowed'=>&$genallowed, - 'delallowed'=>&$delallowed, - 'modelselected'=>&$modelselected, - 'allowgenifempty'=>&$allowgenifempty, - 'forcenomultilang'=>&$forcenomultilang, - 'noform'=>&$noform, - 'param'=>&$param, - 'title'=>&$title, - 'buttonlabel'=>&$buttonlabel, - 'codelang'=>&$codelang, - 'morepicto'=>&$morepicto, - 'hideifempty'=>&$hideifempty, - 'removeaction'=>&$removeaction + 'modulepart' => &$modulepart, + 'modulesubdir' => &$modulesubdir, + 'filedir' => &$filedir, + 'urlsource' => &$urlsource, + 'genallowed' => &$genallowed, + 'delallowed' => &$delallowed, + 'modelselected' => &$modelselected, + 'allowgenifempty' => &$allowgenifempty, + 'forcenomultilang' => &$forcenomultilang, + 'noform' => &$noform, + 'param' => &$param, + 'title' => &$title, + 'buttonlabel' => &$buttonlabel, + 'codelang' => &$codelang, + 'morepicto' => &$morepicto, + 'hideifempty' => &$hideifempty, + 'removeaction' => &$removeaction ); $reshook = $hookmanager->executeHooks('showDocuments', $parameters, $object); // Note that parameters may have been updated by hook // May report error @@ -593,7 +594,7 @@ class FormFile } else { include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; //$modellist = ModeleExports::liste_modeles($this->db); // liste_modeles() does not exists. We are using listOfAvailableExportFormat() method instead that return a different array format. - $modellist = array(); + $modellist = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment } } elseif ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') { if (is_array($genallowed)) { @@ -713,7 +714,7 @@ class FormFile $out .= ''; $addcolumforpicto = ($delallowed || $printer || $morepicto); $colspan = (4 + ($addcolumforpicto ? 1 : 0)); - $colspanmore = 0; + $colspanmore = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $out .= ''; @@ -816,7 +817,7 @@ class FormFile $out .= ''; // Execute hooks - $parameters = array('colspan'=>($colspan + $colspanmore), 'socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'modulepart'=>$modulepart); + $parameters = array('colspan' => ($colspan + $colspanmore), 'socid' => (isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id' => (isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'modulepart' => $modulepart); if (is_object($hookmanager)) { $reshook = $hookmanager->executeHooks('formBuilddocOptions', $parameters, $GLOBALS['object']); $out .= $hookmanager->resPrint; @@ -967,7 +968,7 @@ class FormFile $addcolumforpicto = ($delallowed || $printer || $morepicto); $colspan = (4 + ($addcolumforpicto ? 1 : 0)); $colspanmore = 0; - $parameters = array('colspan'=>($colspan + $colspanmore), 'socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'modulepart'=>$modulepart, 'relativepath'=>$relativepath); + $parameters = array('colspan' => ($colspan + $colspanmore), 'socid' => (isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id' => (isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'modulepart' => $modulepart, 'relativepath' => $relativepath); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); if (empty($res)) { $out .= $hookmanager->resPrint; // Complete line @@ -1056,7 +1057,7 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $out = ''; - $this->infofiles = array('nboffiles'=>0, 'extensions'=>array(), 'files'=>array()); + $this->infofiles = array('nboffiles' => 0, 'extensions' => array(), 'files' => array()); $entity = 1; // Without multicompany @@ -1230,7 +1231,7 @@ class FormFile $hookmanager->initHooks(array('formfile')); $parameters = array( 'filearray' => $filearray, - 'modulepart'=> $modulepart, + 'modulepart' => $modulepart, 'param' => $param, 'forcedownload' => $forcedownload, 'relativepath' => $relativepath, // relative filename to module dir @@ -1775,7 +1776,7 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; $object_instance = new Mo($this->db); } else { - $parameters = array('modulepart'=>$modulepart); + $parameters = array('modulepart' => $modulepart); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) { if (array_key_exists('classpath', $hookmanager->resArray) && !empty($hookmanager->resArray['classpath'])) { @@ -1859,7 +1860,7 @@ class FormFile preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); } else { - $parameters = array('modulepart'=>$modulepart, 'fileinfo'=>$file); + $parameters = array('modulepart' => $modulepart, 'fileinfo' => $file); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) { if (array_key_exists('ref', $hookmanager->resArray) && !empty($hookmanager->resArray['ref'])) { From 60359aa4184165505c8541c2022527751bd8e7db Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:33 +0100 Subject: [PATCH 034/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/html.formmail.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 15e1758fa1a..be4e7a242e2 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Anthony Berton + * Copyright (C) 2024 MDW * * * This program is free software; you can redistribute it and/or modify @@ -350,7 +351,7 @@ class FormMail extends Form if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) { $listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]); } - return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes); + return array('paths' => $listofpaths, 'names' => $listofnames, 'mimes' => $listofmimes); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -407,8 +408,8 @@ class FormMail extends Form $parameters = array( 'addfileaction' => $addfileaction, - 'removefileaction'=> $removefileaction, - 'trackid'=> $this->trackid + 'removefileaction' => $removefileaction, + 'trackid' => $this->trackid ); $reshook = $hookmanager->executeHooks('getFormMail', $parameters, $this); @@ -599,7 +600,7 @@ class FormMail extends Form && !preg_match('/user_aliases/', $this->fromtype) && !preg_match('/global_aliases/', $this->fromtype) && !preg_match('/senderprofile/', $this->fromtype) - ) { + ) { // Use this->fromname and this->frommail or error if not defined $out .= $this->fromname; if ($this->frommail) { @@ -910,7 +911,6 @@ class FormMail extends Form } // Complete substitution array with the url to make online payment - $paymenturl = ''; $validpaymentmethod = array(); if (empty($this->substit['__REF__'])) { $paymenturl = ''; @@ -1187,7 +1187,7 @@ class FormMail extends Form $tmparray[$key]['label'] = $label; $tmparray[$key]['label'] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]['label']); // multiselect array convert html entities into options tags, even if we don't want this, so we encode them a second time - $tmparray[$key]['label'] = dol_htmlentities($tmparray[$key]['label'], ENT_QUOTES|ENT_SUBSTITUTE, 'UTF-8', true); + $tmparray[$key]['label'] = dol_htmlentities($tmparray[$key]['label'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', true); $tmparray[$key]['labelhtml'] = $label; $tmparray[$key]['labelhtml'] = str_replace(array('<', '<', '>', '>'), array('__LTCHAR__', '__LTCHAR__', '__GTCHAR__', '__GTCHAR__'), $tmparray[$key]['labelhtml']); @@ -1240,7 +1240,7 @@ class FormMail extends Form $tmparray[$key]['label'] = $label; $tmparray[$key]['label'] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]['label']); // multiselect array convert html entities into options tags, even if we don't want this, so we encode them a second time - $tmparray[$key]['label'] = dol_htmlentities($tmparray[$key]['label'], ENT_QUOTES|ENT_SUBSTITUTE, 'UTF-8', true); + $tmparray[$key]['label'] = dol_htmlentities($tmparray[$key]['label'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', true); $tmparray[$key]['labelhtml'] = $label; $tmparray[$key]['labelhtml'] = str_replace(array('<', '<', '>', '>'), array('__LTCHAR__', '__LTCHAR__', '__GTCHAR__', '__GTCHAR__'), $tmparray[$key]['labelhtml']); @@ -1289,7 +1289,7 @@ class FormMail extends Form $tmparray[$key]['label'] = $label; $tmparray[$key]['label'] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]['label']); // multiselect array convert html entities into options tags, even if we don't want this, so we encode them a second time - $tmparray[$key]['label'] = dol_htmlentities($tmparray[$key]['label'], ENT_QUOTES|ENT_SUBSTITUTE, 'UTF-8', true); + $tmparray[$key]['label'] = dol_htmlentities($tmparray[$key]['label'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', true); $tmparray[$key]['labelhtml'] = $label; $tmparray[$key]['labelhtml'] = str_replace(array('<', '<', '>', '>'), array('__LTCHAR__', '__LTCHAR__', '__GTCHAR__', '__GTCHAR__'), $tmparray[$key]['labelhtml']); @@ -1873,7 +1873,7 @@ class FormMail extends Form $tmparray = array(); if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines') { - $parameters = array('mode'=>$mode); + $parameters = array('mode' => $mode); $tmparray = getCommonSubstitutionArray($langs, 2, null, $object); // Note: On email templated edition, this is null because it is related to all type of objects complete_substitutions_array($tmparray, $langs, null, $parameters); @@ -1886,7 +1886,7 @@ class FormMail extends Form } if ($mode == 'emailing') { - $parameters = array('mode'=>$mode); + $parameters = array('mode' => $mode); $tmparray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount'), $object); // Note: On email templated edition, this is null because it is related to all type of objects complete_substitutions_array($tmparray, $langs, null, $parameters); From a1f332586cb6fa6a352c796d060c2ba57306aedf Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:35 +0100 Subject: [PATCH 035/130] Fix PhanPluginRedundantAssignment --- htdocs/core/class/utils.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index c8409cbe9ae..810ee8f24fc 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Regis Houssin * Copyright (C) 2022 Anthony Berton * Copyright (C) 2023-2024 William Mead + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -277,12 +278,10 @@ class Utils $ext = 'sql'; if (in_array($type, array('mysql', 'mysqli'))) { $prefix = 'mysqldump'; - $ext = 'sql'; } //if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } if (in_array($type, array('pgsql'))) { $prefix = 'pg_dump'; - $ext = 'sql'; } $file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall", 'tzuser').'.'.$ext; } @@ -466,7 +465,7 @@ class Utils $langs->load("errors"); dol_syslog("Datadump retval after exec=".$retval, LOG_ERR); $errormsg = 'Error '.$retval; - $ok = 0; + $ok = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } else { $i = 0; if (!empty($output_arr)) { From 600cdb5e65294b93ac77d8f6fa3c4ed412f7067b Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:37 +0100 Subject: [PATCH 036/130] Fix PhanPluginRedundantAssignment --- htdocs/core/filemanagerdol/connectors/php/connector.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php index 02bf537b9cf..656ca060471 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php @@ -2,6 +2,7 @@ /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2010 Frederico Caldeira Knabben + * Copyright (C) 2024 MDW * * == BEGIN LICENSE == * @@ -265,7 +266,7 @@ function CreateFolder($resourceType, $currentFolder) switch ($sErrorMsg) { case '': - $sErrorNumber = '0'; + $sErrorNumber = '0'; // @phan-suppress-current-line PhanPluginRedundantAssignment break; case 'Invalid argument': case 'No such file or directory': From 5c09a7df85a89a43bb47284307040991e26e76ae Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:40 +0100 Subject: [PATCH 037/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/admin.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 270742a3c97..fde50455f74 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2023 Eric Seigne + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -543,7 +544,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler if ($error == 0) { $ok = 1; } else { - $ok = 0; + $ok = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } return $ok; @@ -1115,7 +1116,7 @@ function activateModule($value, $withdeps = 1, $noconfverification = 0) return $ret; } - $ret = array('nbmodules'=>0, 'errors'=>array(), 'nbperms'=>0); + $ret = array('nbmodules' => 0, 'errors' => array(), 'nbperms' => 0); $modName = $value; $modFile = $modName.".class.php"; @@ -1725,7 +1726,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu $obj = $db->fetch_object($result); // Take first result of select if (empty($obj)) { // If not yet into table - $obj = (object) array('rowid'=>'', 'name'=>$const, 'value'=>'', 'type'=>$type, 'note'=>''); + $obj = (object) array('rowid' => '', 'name' => $const, 'value' => '', 'type' => $type, 'note' => ''); } if (empty($strictw3c)) { From 323c66216a541b0f625148b626bdf80f15fcb79e Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:42 +0100 Subject: [PATCH 038/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/company.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a4cd09de402..2384751a523 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2017 Rui Strecht * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -73,7 +74,7 @@ function societe_prepare_head(Societe $object) $sql .= " WHERE p.fk_soc = ".((int) $object->id); $sql .= " AND p.entity IN (".getEntity($object->element).")"; // Add where from hooks - $parameters = array('contacttab' => true); + $parameters = array('contacttab' => true); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $resql = $db->query($sql); From 73b7cf9338d53b86c408c493ffdfa762f192e098 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:44 +0100 Subject: [PATCH 039/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/expedition.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/expedition.lib.php b/htdocs/core/lib/expedition.lib.php index 7f89ca4e51a..e765a0f030d 100644 --- a/htdocs/core/lib/expedition.lib.php +++ b/htdocs/core/lib/expedition.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Claudio Aschieri + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +43,6 @@ function expedition_prepare_head(Expedition $object) $h = 0; $head = array(); - $h = 0; $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php"; $head[$h][1] = $langs->trans("Setup"); From e073692e4dbee578736edd9e489946beb328791d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:46 +0100 Subject: [PATCH 040/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/expensereport.lib.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index 18fcf4d49a7..592cfb4a638 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -132,13 +133,11 @@ function expensereport_admin_prepare_head() { global $langs, $conf, $user, $db; - $h = 0; - $head = array(); - $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label('expensereport'); $h = 0; + $head = array(); $head[$h][0] = DOL_URL_ROOT."/admin/expensereport.php"; $head[$h][1] = $langs->trans("ExpenseReports"); From 439979a43908cb7708e75b139e71b5a05db04d26 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:48 +0100 Subject: [PATCH 041/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/fichinter.lib.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 2045003d1c0..90fe590aff4 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2016 Gilles Poirier * Copyright (C) 2018 charlene Benke + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -122,7 +123,7 @@ function fichinter_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/fichinter/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans('Events'); - if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; @@ -177,8 +178,6 @@ function fichinter_admin_prepare_head() $h = 0; $head = array(); - $h = 0; - $head[$h][0] = DOL_URL_ROOT."/admin/fichinter.php"; $head[$h][1] = $langs->trans("Interventions"); $head[$h][2] = 'ficheinter'; From bbe0368bbd91f9392f29481a425a7f48bf53f054 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:50 +0100 Subject: [PATCH 042/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/files.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 8b64dadea63..d19e28faa01 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1104,7 +1104,7 @@ function dol_move($srcfile, $destfile, $newmask = '0', $overwriteifexists = 1, $ } if ($resultecm > 0) { - $result = true; + $result = true; // @phan-suppress-current-line PhanPluginRedundantAssignment } else { $result = false; } @@ -1180,7 +1180,7 @@ function dol_move_dir($srcdir, $destdir, $overwriteifexists = 1, $indexdatabase } } } - $result = true; + $result = true; // @phan-suppress-current-line PhanPluginRedundantAssignment } } } @@ -2518,9 +2518,9 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = try { if ($mode == 'gz') { - $foundhandler = 0; + $foundhandler = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif ($mode == 'bz') { - $foundhandler = 0; + $foundhandler = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif ($mode == 'zip') { /*if (defined('ODTPHP_PATHTOPCLZIP')) { @@ -2736,7 +2736,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->mycompany->dir_output.'/'.$original_file; } elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { // Wrapping for users photos (user photos are allowed to any connected users) - $accessallowed = 0; + $accessallowed = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment if (preg_match('/^\d+\/photos\//', $original_file)) { $accessallowed = 1; } @@ -2772,7 +2772,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->mycompany->dir_output.'/logos/'.$original_file; } elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { // Wrapping for members photos - $accessallowed = 0; + $accessallowed = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment if (preg_match('/^\d+\/photos\//', $original_file)) { $accessallowed = 1; } From a57d0915a2286dbe42e53ce43c3f2759d813b610 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:52 +0100 Subject: [PATCH 043/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/functions.lib.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e6edeabe7ac..d3d2b8d2633 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2975,10 +2975,12 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = if ($tzoutput == 'tzserver') { $to_gmt = false; $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' + // @phan-suppress-next-line PhanPluginRedundantAssignment $offsettz = 0; // Timezone offset with server timezone (because to_gmt is false), so 0 + // @phan-suppress-next-line PhanPluginRedundantAssignment $offsetdst = 0; // Dst offset with server timezone (because to_gmt is false), so 0 } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { - $to_gmt = true; + $to_gmt = true; // @phan-suppress-current-line PhanPluginRedundantAssignment $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' if (class_exists('DateTimeZone')) { @@ -4025,7 +4027,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli } elseif ($withpicto == 'mobile') { $picto = 'phoning_mobile'; } else { - $picto = ''; + $picto = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } } if ($adddivfloat == 1) { @@ -8714,7 +8716,6 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } // Complete substitution array with the url to make online payment - $paymenturl = ''; if (empty($substitutionarray['__REF__'])) { $paymenturl = ''; } else { @@ -11203,12 +11204,12 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) $famime = 'file-alt'; } elseif (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) { $mime = 'text/xml'; - $imgmime = 'other.png'; + $imgmime = 'other.png'; // @phan-suppress-current-line PhanPluginRedundantAssignment $srclang = 'xml'; $famime = 'file-alt'; } elseif (preg_match('/\.xaml$/i', $tmpfile)) { $mime = 'text/xml'; - $imgmime = 'other.png'; + $imgmime = 'other.png'; // @phan-suppress-current-line PhanPluginRedundantAssignment $srclang = 'xaml'; $famime = 'file-alt'; } elseif (preg_match('/\.bas$/i', $tmpfile)) { // Languages @@ -11372,16 +11373,16 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) $famime = 'file-image'; } elseif (preg_match('/\.vcs$/i', $tmpfile)) { // Calendar $mime = 'text/calendar'; - $imgmime = 'other.png'; + $imgmime = 'other.png'; // @phan-suppress-current-line PhanPluginRedundantAssignment $famime = 'file-alt'; } elseif (preg_match('/\.ics$/i', $tmpfile)) { $mime = 'text/calendar'; - $imgmime = 'other.png'; + $imgmime = 'other.png'; // @phan-suppress-current-line PhanPluginRedundantAssignment $famime = 'file-alt'; } elseif (preg_match('/\.torrent$/i', $tmpfile)) { // Other $mime = 'application/x-bittorrent'; - $imgmime = 'other.png'; - $famime = 'file-o'; + $imgmime = 'other.png'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $famime = 'file-o'; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i', $tmpfile)) { // Audio $mime = 'audio'; $imgmime = 'audio.png'; @@ -11421,12 +11422,12 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) $famime = 'file-archive'; } elseif (preg_match('/\.(exe|com)$/i', $tmpfile)) { // Exe $mime = 'application/octet-stream'; - $imgmime = 'other.png'; - $famime = 'file-o'; + $imgmime = 'other.png'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $famime = 'file-o'; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (preg_match('/\.(dll|lib|o|so|a)$/i', $tmpfile)) { // Lib $mime = 'library'; $imgmime = 'library.png'; - $famime = 'file-o'; + $famime = 'file-o'; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (preg_match('/\.err$/i', $tmpfile)) { // phpcs:ignore $mime = 'error'; $imgmime = 'error.png'; @@ -11678,7 +11679,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $return = !empty($html) ? $html : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort); } elseif (getDolGlobalString('MAIN_STATUS_USES_IMAGES')) { // Use status with images (for backward compatibility) - $return = ''; + $return = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment $htmlLabel = (in_array($displayMode, array(1, 2, 5)) ? '' : '').(!empty($html) ? $html : $statusLabel).(in_array($displayMode, array(1, 2, 5)) ? '' : ''); $htmlLabelShort = (in_array($displayMode, array(1, 2, 5)) ? '' : '').(!empty($html) ? $html : (!empty($statusLabelShort) ? $statusLabelShort : $statusLabel)).(in_array($displayMode, array(1, 2, 5)) ? '' : ''); @@ -13043,7 +13044,7 @@ function getTimelineIcon($actionstatic, &$histo, $key) } elseif ($actionstatic->code == 'AC_TICKET_MODIFY') { $iconClass = 'fa fa-pencilxxx'; } elseif (preg_match('/^TICKET_MSG/', $actionstatic->code)) { - $iconClass = 'fa fa-comments'; + $iconClass = 'fa fa-comments'; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) { $iconClass = 'fa fa-mask'; } elseif (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { From c05221c87913260c386f6e8810b338ea58c9273b Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:54 +0100 Subject: [PATCH 044/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/invoice.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 809188c8975..1efc998a384 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2017 Charlie Benke * Copyright (C) 2017 ATM-CONSULTING + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -530,7 +531,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) } // Add Group from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters); $sql .= $hookmanager->resPrint; From e50f2028e47947805bd2423350f03c27470813f8 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:56 +0100 Subject: [PATCH 045/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/invoice2.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index 2ed6bf435f8..13fefc8ee54 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -296,7 +297,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte } else { dol_syslog("No invoices found for criteria"); } - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { dol_print_error($db); From 452b2600be2a5fc58fb5ede5af922d351882088a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:29:58 +0100 Subject: [PATCH 046/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/json.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 12b0ab69220..5a55202c5dc 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -283,7 +283,7 @@ function dol_json_decode($json, $assoc = false) // @phan-suppress-next-line PhanPluginUnsafeEval eval('$array = '.$out.';'); } catch (Exception $e) { - $array = array(); + $array = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment } } From 4f86b65f78fde6fcde4c99f7af788e79753d5900 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:00 +0100 Subject: [PATCH 047/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/project.lib.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f2cc29f4b74..ab142a50675 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -5,6 +5,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Charlene Benke * Copyright (C) 2023 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -239,10 +240,10 @@ function project_prepare_head(Project $project, $moreparam = '') $nbConfOrBooth = $dataretrieved; } else { require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; - $conforbooth=new ConferenceOrBooth($db); + $conforbooth = new ConferenceOrBooth($db); $result = $conforbooth->fetchAll('', '', 0, 0, '(t.fk_project:=:'.((int) $project->id).")"); //, - if (!is_array($result) && $result<0) { + if (!is_array($result) && $result < 0) { setEventMessages($conforbooth->error, $conforbooth->errors, 'errors'); } else { $nbConfOrBooth = count($result); @@ -255,10 +256,10 @@ function project_prepare_head(Project $project, $moreparam = '') $nbAttendees = $dataretrieved; } else { require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; - $conforboothattendee=new ConferenceOrBoothAttendee($db); + $conforboothattendee = new ConferenceOrBoothAttendee($db); $result = $conforboothattendee->fetchAll('', '', 0, 0, '(t.fk_project:=:'.((int) $project->id).')'); - if (!is_array($result) && $result<0) { + if (!is_array($result) && $result < 0) { setEventMessages($conforboothattendee->error, $conforboothattendee->errors, 'errors'); } else { $nbAttendees = count($result); @@ -485,8 +486,6 @@ function project_timesheet_prepare_head($mode, $fuser = null) $h = 0; $head = array(); - $h = 0; - $param = ''; $param .= ($mode ? '&mode='.$mode : ''); if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) { @@ -938,7 +937,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $obj = $lines[$i]->obj; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$lines[$i]); + $parameters = array('arrayfields' => $arrayfields, 'obj' => $lines[$i]); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1353,7 +1352,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec //} //else //{ - //$level--; + //$level--; //} } From 2fc8cc7bb9a34104acd15074c4bec2985c0f4a68 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:02 +0100 Subject: [PATCH 048/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/usergroups.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 87e6e367cb3..dfc50a0692f 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -5,6 +5,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2021-2023 Anthony Berton * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,7 +147,7 @@ function user_prepare_head(User $object) || (isModEnabled('hrm') && $user->hasRight('hrm', 'employee', 'read')) || (isModEnabled('expensereport') && $user->hasRight('expensereport', 'lire') && ($user->id == $object->id || $user->hasRight('expensereport', 'readall'))) || (isModEnabled('holiday') && $user->hasRight('holiday', 'read') && ($user->id == $object->id || $user->hasRight('holiday', 'readall'))) - ) { + ) { // Bank $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; $head[$h][1] = $langs->trans("HRAndBank"); @@ -188,7 +189,7 @@ function user_prepare_head(User $object) $head[$h][0] = DOL_URL_ROOT.'/user/agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); - if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { $nbEvent = 0; // Enable caching of thirdparty count actioncomm require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; @@ -491,7 +492,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) $colorbacklinepair2 = ''; $colortextlink = ''; $colorbacklinepairhover = ''; - $colorbacklinepairhover = ''; $colorbacklinepairchecked = ''; $butactionbg = ''; $textbutaction = ''; From 8f15e595b110aac07ecfc5d3855e4f6760de6fa6 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:04 +0100 Subject: [PATCH 049/130] Fix PhanPluginRedundantAssignment --- htdocs/core/lib/website.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index d90df0b530e..f7700e18b09 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -602,7 +603,7 @@ function includeContainer($containerref) $fullpathfile = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/website/'.$websitekey.'/'.$containerref; if (empty($includehtmlcontentopened)) { - $includehtmlcontentopened = 0; + $includehtmlcontentopened = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } $includehtmlcontentopened++; if ($includehtmlcontentopened > $MAXLEVEL) { From 84131ca971d8ae07fcbae310390979d8c2937f70 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:06 +0100 Subject: [PATCH 050/130] Fix PhanPluginRedundantAssignment --- htdocs/core/menus/standard/empty.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 34fb9aa1cb8..3d624a5c9a3 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -138,7 +138,6 @@ class MenuManager } } - $showmode = 1; if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { print_start_menu_entry_empty('', 'class="tmenuend"', $showmode); } From b2528e2727437946c6fb263bcc17ba2f50f42485 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:08 +0100 Subject: [PATCH 051/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/barcode/mod_barcode_product_standard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 31859eb4ead..cb5b273577b 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -243,7 +243,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode $code = strtoupper(trim($code)); if (empty($code) && $this->code_null && !getDolGlobalString('BARCODE_STANDARD_PRODUCT_MASK')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('BARCODE_STANDARD_PRODUCT_MASK'))) { $result = -2; } else { @@ -252,7 +252,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode if ($is_dispo != 0) { $result = -3; } else { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { if (dol_strlen($code) == 0) { From 5c57a24fbc47f16c655716faf23793307a90d1b5 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:11 +0100 Subject: [PATCH 052/130] Fix PhanPluginRedundantAssignment --- .../barcode/mod_barcode_thirdparty_standard.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index 0113e7dfb39..b7d7a1ca8ff 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2022 Faustin Boitel * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -200,19 +201,19 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode $numFinal = get_next_value($db, $mask, 'societe', $field, $where, '', $now); //Begin barcode with key: for barcode with key (EAN13...) calculate and substitute the last character (* or ?) used in the mask by the key - if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) { // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...) + if ((substr($numFinal, -1) == '*') or (substr($numFinal, -1) == '?')) { // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...) $literaltype = ''; $literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type switch ($literaltype) { case 'EAN13': //EAN13 rowid = 2 - if (strlen($numFinal)==13) {// be sure that the mask length is correct for EAN13 + if (strlen($numFinal) == 13) {// be sure that the mask length is correct for EAN13 $ean = substr($numFinal, 0, 12); //take first 12 digits - $eansum = barcode_gen_ean_sum($ean); + $eansum = barcode_gen_ean_sum($ean); $ean .= $eansum; //substitute the las character by the key $numFinal = $ean; } break; - // Other barcode cases with key could be written here + // Other barcode cases with key could be written here default: break; } @@ -245,7 +246,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode $code = strtoupper(trim($code)); if (empty($code) && $this->code_null && !getDolGlobalString('BARCODE_STANDARD_THIRDPARTY_MASK')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('BARCODE_STANDARD_THIRDPARTY_MASK'))) { $result = -2; } else { @@ -254,7 +255,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode if ($is_dispo != 0) { $result = -3; } else { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { if (dol_strlen($code) == 0) { From 9c48c816e3624f930c6ef37f3fd9f7c1f1dc0994 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:14 +0100 Subject: [PATCH 053/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/contract/mod_contract_olive.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/mod_contract_olive.php b/htdocs/core/modules/contract/mod_contract_olive.php index 2fd4d27f6fe..a080266d59f 100644 --- a/htdocs/core/modules/contract/mod_contract_olive.php +++ b/htdocs/core/modules/contract/mod_contract_olive.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2009 Laurent Destailleur * Copyright (C) 2014 Floran Henry * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; */ class mod_contract_olive extends ModelNumRefContracts { - // variables inherited from ModelNumRefContracts class public $name = 'Olive'; public $version = 'dolibarr'; @@ -108,7 +108,7 @@ class mod_contract_olive extends ModelNumRefContracts $code = strtoupper(trim($code)); if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_CONTRACT_CODE_ALWAYS_REQUIRED'))) { $result = -2; } From b1b49b48c431ec6ddcf5b5f7a0f16ea19ea08b1a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:16 +0100 Subject: [PATCH 054/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/delivery/doc/pdf_storm.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 1332f698bfc..144ed4d8ae9 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2011-2021 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2020 John BOTELLA + * Copyright (C) 2024 MDW * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -820,7 +821,7 @@ class pdf_storm extends ModelePDFDeliveryOrder if ($this->page_largeur < 210) { $widthrecbox = 84; // To work with US executive format } - $posy = 42; + $posy = 42; // @phan-suppress-current-line PhanPluginRedundantAssignment $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { $posx = $this->marge_gauche; From edaad7eb62fcc449ea0bc6704fda031e31db0ab9 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:18 +0100 Subject: [PATCH 055/130] Fix PhanPluginRedundantAssignment --- .../modules/delivery/doc/pdf_typhon.modules.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index a851802251f..fd6c949ab05 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Chiptronik * Copyright (C) 2011-2021 Philippe Grand * Copyright (C) 2015 Marcos García + * Copyright (C) 2024 MDW * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -186,7 +187,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -426,10 +427,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Add line if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { $pdf->setPage($pageposafter); - $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80))); + $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); - $pdf->SetLineStyle(array('dash'=>0)); + $pdf->SetLineStyle(array('dash' => 0)); } $nexY += 2; // Add space between lines @@ -562,7 +563,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); global $action; $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -572,7 +573,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder dolChmod($file); - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // No error } else { @@ -828,7 +829,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder if ($this->page_largeur < 210) { $widthrecbox = 84; // To work with US executive format } - $posy = 42; + $posy = 42; // @phan-suppress-current-line PhanPluginRedundantAssignment $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { $posx = $this->marge_gauche; From 1efcfabc8aa72d36e2bb085e57ce48dc9fbae288 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:20 +0100 Subject: [PATCH 056/130] Fix PhanPluginRedundantAssignment --- .../core/modules/expensereport/doc/pdf_standard.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 692a1c24301..2cc35d093ee 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2019 Markus Welters * Copyright (C) 2019 Rafael Ingenleuf * Copyright (C) 2020 Marc Guenneugues + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -305,7 +306,7 @@ class pdf_standard extends ModeleExpenseReport $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); - $tab_top = 95; + $tab_top = 95; // @phan-suppress-current-line PhanPluginRedundantAssignment $pdf->SetFont('', '', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxpiece - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); @@ -794,7 +795,7 @@ class pdf_standard extends ModeleExpenseReport } // Show recipient - $posy = 50; + $posy = 50; // @phan-suppress-current-line PhanPluginRedundantAssignment $posx = 100; if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { $posx = $this->marge_gauche; From 01d59c10c9d1e996d24fb847999ab65ffb195678 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:23 +0100 Subject: [PATCH 057/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/hrm/doc/pdf_standard.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/hrm/doc/pdf_standard.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php index b2bc3a79b7a..35877acb40a 100644 --- a/htdocs/core/modules/hrm/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2019 Markus Welters * Copyright (C) 2019 Rafael Ingenleuf * Copyright (C) 2020 Marc Guenneugues + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -248,7 +249,7 @@ class pdf_standard extends ModelePDFEvaluation // Show notes if (!empty($object->note_public)) { - $tab_top = 65; + $tab_top = 65; // @phan-suppress-current-line PhanPluginRedundantAssignment $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell(190, 4, $outputlangs->transnoentities("Notes") . ":", 0, 'L', 0, '', 12, $tab_top); From 31ea26e14eefdb9913f67d74ee621e4b6211a4dd Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:25 +0100 Subject: [PATCH 058/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modAgenda.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 895e7e2329e..2a1411806e9 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2013 Cedric Gross * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2017 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -578,9 +579,9 @@ class modAgenda extends DolibarrModules ); // Import Event Extra Fields - $keyforselect = 'actioncomm'; - $keyforelement = 'action'; - $keyforaliasextra = 'extra'; + $keyforselect = 'actioncomm'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforelement = 'action'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; } } From 2eeb847528aa227e6737253450a5571bc4299033 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:28 +0100 Subject: [PATCH 059/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modAi.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modAi.class.php b/htdocs/core/modules/modAi.class.php index 21249db69e9..3194a93ed5a 100644 --- a/htdocs/core/modules/modAi.class.php +++ b/htdocs/core/modules/modAi.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -263,7 +264,7 @@ class modAi extends DolibarrModules // Main menu entries to add $this->menu = array(); - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here entries to declare new menus /* BEGIN MODULEBUILDER TOPMENU */ /* END MODULEBUILDER TOPMENU */ @@ -306,7 +307,7 @@ class modAi extends DolibarrModules /* END MODULEBUILDER EXPORT AVAILABILITIES */ // Imports profiles provided by this module - $r = 1; + $r = 1; // @phan-suppress-current-line PhanPluginRedundantAssignment /* BEGIN MODULEBUILDER IMPORT AVAILABILITIES */ /* $langs->load("agenda"); @@ -375,7 +376,7 @@ class modAi extends DolibarrModules // Document templates $moduledir = dol_sanitizeFileName('ai'); $myTmpObjects = array(); - $myTmpObjects['Availabilities'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); + $myTmpObjects['Availabilities'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); // foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // if ($myTmpObjectKey == 'Availabilities') { From 2260027770f6fe957bc469d1b8eaf54d755392cf Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:30 +0100 Subject: [PATCH 060/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modBom.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 2832ec9da99..8639b022aa6 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Maxime Kohlhaas * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -123,9 +124,9 @@ class modBom extends DolibarrModules // 1=>array('BILLOFMATERIALS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); $this->const = array( - 1=>array('BOM_ADDON_PDF', 'chaine', 'generic_bom_odt', 'Name of PDF model of BOM', 0), - 2=>array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0), - 3=>array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0) + 1 => array('BOM_ADDON_PDF', 'chaine', 'generic_bom_odt', 'Name of PDF model of BOM', 0), + 2 => array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0), + 3 => array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0) ); // Some keys to add into the overwriting translation tables @@ -176,7 +177,7 @@ class modBom extends DolibarrModules // Boxes/Widgets // Add here list of php file(s) stored in bom/core/boxes that contains class to show a widget. $this->boxes = array( - 0=>array('file' => 'box_boms.php', 'note' => '', 'enabledbydefaulton' => 'Home') + 0 => array('file' => 'box_boms.php', 'note' => '', 'enabledbydefaulton' => 'Home') ); @@ -281,7 +282,7 @@ class modBom extends DolibarrModules $keyforelement = 'bom'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; $keyforclass = 'BOMLine'; - $keyforclassfile = '/bom/class/bom.class.php'; + $keyforclassfile = '/bom/class/bom.class.php'; // @phan-suppress-current-line PhanPluginRedundantAssignment $keyforelement = 'bomline'; $keyforalias = 'tl'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; @@ -294,7 +295,7 @@ class modBom extends DolibarrModules $keyforaliasextra = 'extraline'; $keyforelement = 'bomline'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_dependencies_array[$r] = array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + $this->export_dependencies_array[$r] = array('bomline' => 'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'bom_bom as t'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bom_extrafields as extra on (t.rowid = extra.fk_object)'; @@ -485,6 +486,7 @@ class modBom extends DolibarrModules } } + // @phan-suppress-next-line PhanPluginRedundantAssignment $sql = array( //"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'bom' AND entity = ".((int) $conf->entity), //"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'bom', ".((int) $conf->entity).")" From 6ad3828b4406f7336e4b535b01d139555a945a3d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:33 +0100 Subject: [PATCH 061/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modBookCal.class.php | 132 ++++++++++++----------- 1 file changed, 67 insertions(+), 65 deletions(-) diff --git a/htdocs/core/modules/modBookCal.class.php b/htdocs/core/modules/modBookCal.class.php index 6ae92d3142a..a778ac8ffc7 100644 --- a/htdocs/core/modules/modBookCal.class.php +++ b/htdocs/core/modules/modBookCal.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -316,59 +317,59 @@ class modBookCal extends DolibarrModules /* BEGIN MODULEBUILDER LEFTMENU CALENDAR */ $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=agenda', - 'type'=>'left', - 'titre'=> 'MenuBookcalIndex', + 'fk_menu' => 'fk_mainmenu=agenda', + 'type' => 'left', + 'titre' => 'MenuBookcalIndex', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em92"'), - 'mainmenu'=>'agenda', - 'leftmenu'=> 'bookcal', - 'url'=> '/bookcal/bookcalindex.php', - 'langs'=> 'bookcal', - 'position'=> 1100+$r, - 'enabled'=> '1', - 'perms'=> '$user->rights->bookcal->calendar->read', - 'user'=> 0 + 'mainmenu' => 'agenda', + 'leftmenu' => 'bookcal', + 'url' => '/bookcal/bookcalindex.php', + 'langs' => 'bookcal', + 'position' => 1100 + $r, + 'enabled' => '1', + 'perms' => '$user->rights->bookcal->calendar->read', + 'user' => 0 ); - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal', + 'fk_menu' => 'fk_mainmenu=agenda,fk_leftmenu=bookcal', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'Calendar', - 'mainmenu'=>'agenda', - 'leftmenu'=>'bookcal_calendar_list', - 'url'=>'/bookcal/calendar_list.php', + 'type' => 'left', + 'titre' => 'Calendar', + 'mainmenu' => 'agenda', + 'leftmenu' => 'bookcal_calendar_list', + 'url' => '/bookcal/calendar_list.php', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'bookcal', - 'position'=>1100+$r, + 'langs' => 'bookcal', + 'position' => 1100 + $r, // Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->bookcal->enabled', + 'enabled' => '$conf->bookcal->enabled', // Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->bookcal->calendar->read', - 'target'=>'', + 'perms' => '$user->rights->bookcal->calendar->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2, + 'user' => 2, ); - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_calendar_list', + 'fk_menu' => 'fk_mainmenu=agenda,fk_leftmenu=bookcal_calendar_list', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'NewCalendar', - 'mainmenu'=>'agenda', - 'leftmenu'=>'bookcal_new', - 'url'=>'/bookcal/calendar_card.php?action=create', + 'type' => 'left', + 'titre' => 'NewCalendar', + 'mainmenu' => 'agenda', + 'leftmenu' => 'bookcal_new', + 'url' => '/bookcal/calendar_card.php?action=create', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'bookcal', - 'position'=>1100+$r, + 'langs' => 'bookcal', + 'position' => 1100 + $r, // Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->bookcal->enabled', + 'enabled' => '$conf->bookcal->enabled', // Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->bookcal->calendar->read', - 'target'=>'', + 'perms' => '$user->rights->bookcal->calendar->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2 + 'user' => 2 ); /* END MODULEBUILDER LEFTMENU CALENDAR */ @@ -418,45 +419,45 @@ class modBookCal extends DolibarrModules ); */ - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal', + 'fk_menu' => 'fk_mainmenu=agenda,fk_leftmenu=bookcal', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'Availabilities', - 'mainmenu'=>'agenda', - 'leftmenu'=>'bookcal_availabilities', - 'url'=>'/bookcal/availabilities_list.php', + 'type' => 'left', + 'titre' => 'Availabilities', + 'mainmenu' => 'agenda', + 'leftmenu' => 'bookcal_availabilities', + 'url' => '/bookcal/availabilities_list.php', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'bookcal', - 'position'=>1200+$r, + 'langs' => 'bookcal', + 'position' => 1200 + $r, // Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->bookcal->enabled', + 'enabled' => '$conf->bookcal->enabled', // Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->bookcal->availabilities->read', - 'target'=>'', + 'perms' => '$user->rights->bookcal->availabilities->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2, + 'user' => 2, ); - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=bookcal_availabilities', + 'fk_menu' => 'fk_mainmenu=agenda,fk_leftmenu=bookcal_availabilities', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'NewAvailabilities', - 'mainmenu'=>'agenda', - 'leftmenu'=>'bookcal_availabilities', - 'url'=>'/bookcal/availabilities_card.php?action=create', + 'type' => 'left', + 'titre' => 'NewAvailabilities', + 'mainmenu' => 'agenda', + 'leftmenu' => 'bookcal_availabilities', + 'url' => '/bookcal/availabilities_card.php?action=create', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'bookcal', - 'position'=>1200+$r, + 'langs' => 'bookcal', + 'position' => 1200 + $r, // Define condition to show or hide menu entry. Use '$conf->bookcal->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->bookcal->enabled', + 'enabled' => '$conf->bookcal->enabled', // Use 'perms'=>'$user->rights->bookcal->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->bookcal->availabilities->read', - 'target'=>'', + 'perms' => '$user->rights->bookcal->availabilities->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2 + 'user' => 2 ); /* END MODULEBUILDER LEFTMENU AVAILABILITIES */ @@ -492,7 +493,8 @@ class modBookCal extends DolibarrModules /* END MODULEBUILDER EXPORT AVAILABILITIES */ // Imports profiles provided by this module - $r = 1; + + $r = 1; // @phan-suppress-current-line PhanPluginRedundantAssignment /* BEGIN MODULEBUILDER IMPORT AVAILABILITIES */ /* $langs->load("agenda"); @@ -561,7 +563,7 @@ class modBookCal extends DolibarrModules // Document templates $moduledir = dol_sanitizeFileName('bookcal'); $myTmpObjects = array(); - $myTmpObjects['Availabilities'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); + $myTmpObjects['Availabilities'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'Availabilities') { From 1656601c48246f412950d8c3c3b0bb04fd414c04 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:36 +0100 Subject: [PATCH 062/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modCategorie.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 0ead1e5e844..c046b25e2a2 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2014 Laurent Destailleur * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2020 Stéphane Lesage + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -234,7 +235,7 @@ class modCategorie extends DolibarrModules $keyforselect = 'societe'; $keyforelement = 'company'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -280,9 +281,9 @@ class modCategorie extends DolibarrModules 't.libelle' => 'company', 'pl.code' => 'company', 'st.code' => 'company' ); // We define here only fields that use another picto - $keyforselect = 'societe'; - $keyforelement = 'company'; - $keyforaliasextra = 'extra'; + $keyforselect = 'societe'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforelement = 'company'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -311,7 +312,7 @@ class modCategorie extends DolibarrModules $keyforselect = 'adherent'; $keyforelement = 'member'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -366,7 +367,7 @@ class modCategorie extends DolibarrModules $keyforselect = 'socpeople'; $keyforelement = 'contact'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -396,7 +397,7 @@ class modCategorie extends DolibarrModules $keyforselect = 'projet'; $keyforelement = 'project'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -422,7 +423,7 @@ class modCategorie extends DolibarrModules $keyforselect = 'user'; $keyforelement = 'user'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; From fa1009f68e61ecfdd7b2e439174b59447dc2a336 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:39 +0100 Subject: [PATCH 063/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modCollab.class.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php index abf1949a174..eca7e3eb615 100644 --- a/htdocs/core/modules/modCollab.class.php +++ b/htdocs/core/modules/modCollab.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,20 +108,20 @@ class modCollab extends DolibarrModules $r++;*/ // Main menu entries - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->menu[$r] = array( - 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'top', // This is a Left menu entry - 'titre'=>'Collab', + 'fk_menu' => '0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'top', // This is a Left menu entry + 'titre' => 'Collab', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em092"'), - 'mainmenu'=>'collab', - 'url'=>'/collab/index.php', - 'langs'=>'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100, - 'enabled'=>'$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2 // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => 'collab', + 'url' => '/collab/index.php', + 'langs' => 'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 100, + 'enabled' => '$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules + 'target' => '', + 'user' => 2 // 0=Menu for internal users, 1=external users, 2=both ); $r++; } From 2a4218ec09ec6275477b4462bcf785f58d0cab25 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:42 +0100 Subject: [PATCH 064/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modCommande.class.php | 67 ++++++++++++----------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 005ae6490be..e9bc3e8b3c0 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2020 Ahmad Jamaly Rabub + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -106,8 +107,8 @@ class modCommande extends DolibarrModules // Boxes $this->boxes = array( - 0=>array('file'=>'box_commandes.php', 'enabledbydefaulton'=>'Home'), - 2=>array('file'=>'box_graph_orders_permonth.php', 'enabledbydefaulton'=>'Home') + 0 => array('file' => 'box_commandes.php', 'enabledbydefaulton' => 'Home'), + 2 => array('file' => 'box_graph_orders_permonth.php', 'enabledbydefaulton' => 'Home') ); // Permissions @@ -200,15 +201,15 @@ class modCommande extends DolibarrModules $this->export_label[$r] = 'CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("commande", "commande", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country', - 'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", - 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate", - 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.total_ht'=>"TotalHT", - 'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'sm.code'=>'SendingMethod', - 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', - 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', - 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", - 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' + 's.rowid' => "IdCompany", 's.nom' => 'CompanyName', 'ps.nom' => 'ParentCompany', 's.code_client' => 'CustomerCode', 's.address' => 'Address', 's.zip' => 'Zip', 's.town' => 'Town', 'd.nom' => 'State', 'co.label' => 'Country', + 'co.code' => "CountryCode", 's.phone' => 'Phone', 's.siren' => 'ProfId1', 's.siret' => 'ProfId2', 's.ape' => 'ProfId3', 's.idprof4' => 'ProfId4', 'c.rowid' => "Id", + 'c.ref' => "Ref", 'c.ref_client' => "RefCustomer", 'c.fk_soc' => "IdCompany", 'c.date_creation' => "DateCreation", 'c.date_commande' => "OrderDate", + 'c.date_livraison' => "DateDeliveryPlanned", 'c.amount_ht' => "Amount", 'c.total_ht' => "TotalHT", + 'c.total_ttc' => "TotalTTC", 'c.facture' => "Billed", 'c.fk_statut' => 'Status', 'c.note_public' => "Note", 'sm.code' => 'SendingMethod', + 'c.fk_user_author' => 'CreatedById', 'uc.login' => 'CreatedByLogin', 'c.fk_user_valid' => 'ValidatedById', 'uv.login' => 'ValidatedByLogin', + 'pj.ref' => 'ProjectRef', 'cd.rowid' => 'LineId', 'cd.description' => "LineDescription", 'cd.product_type' => 'TypeOfLineServiceOrProduct', + 'cd.tva_tx' => "LineVATRate", 'cd.qty' => "LineQty", 'cd.total_ht' => "LineTotalHT", 'cd.total_tva' => "LineTotalVAT", 'cd.total_ttc' => "LineTotalTTC", + 'p.rowid' => 'ProductId', 'p.ref' => 'ProductRef', 'p.label' => 'ProductLabel' ); if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['c.multicurrency_code'] = 'Currency'; @@ -233,24 +234,24 @@ class modCommande extends DolibarrModules // 'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text' //); $this->export_TypeFields_array[$r] = array( - 's.nom'=>'Text', 'ps.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', - 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date", - 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'sm.code'=>"Text", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric", - 'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'pj.ref'=>'Text', - 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric", - 'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text', - 'c.entity'=>'List:entity:label:rowid', + 's.nom' => 'Text', 'ps.nom' => 'Text', 's.code_client' => 'Text', 's.address' => 'Text', 's.zip' => 'Text', 's.town' => 'Text', 'co.label' => 'List:c_country:label:label', 'co.code' => 'Text', 's.phone' => 'Text', + 's.siren' => 'Text', 's.siret' => 'Text', 's.ape' => 'Text', 's.idprof4' => 'Text', 'c.ref' => "Text", 'c.ref_client' => "Text", 'c.date_creation' => "Date", + 'c.date_commande' => "Date", 'c.date_livraison' => "Date", 'sm.code' => "Text", 'c.amount_ht' => "Numeric", 'c.total_ht' => "Numeric", + 'c.total_ttc' => "Numeric", 'c.facture' => "Boolean", 'c.fk_statut' => 'Status', 'c.note_public' => "Text", 'pj.ref' => 'Text', + 'cd.description' => "Text", 'cd.product_type' => 'Boolean', 'cd.tva_tx' => "Numeric", 'cd.qty' => "Numeric", 'cd.total_ht' => "Numeric", 'cd.total_tva' => "Numeric", + 'cd.total_ttc' => "Numeric", 'p.rowid' => 'List:product:ref::product', 'p.ref' => 'Text', 'p.label' => 'Text', 'd.nom' => 'Text', + 'c.entity' => 'List:entity:label:rowid', ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', - 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order", - 'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order", - 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order", - 'c.date_livraison'=>"order", 'sm.code'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line", - 'cd.product_type'=>'order_line', 'cd.tva_tx'=>"order_line", 'cd.qty'=>"order_line", 'cd.total_ht'=>"order_line", 'cd.total_tva'=>"order_line", - 'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' + 's.rowid' => "company", 's.nom' => 'company', 'ps.nom' => 'company', 's.code_client' => 'company', 's.address' => 'company', 's.zip' => 'company', 's.town' => 'company', 'd.nom' => 'company', 'co.label' => 'company', + 'co.code' => 'company', 's.phone' => 'company', 's.siren' => 'company', 's.ape' => 'company', 's.idprof4' => 'company', 's.siret' => 'company', 'c.rowid' => "order", + 'c.ref' => "order", 'c.ref_client' => "order", 'c.fk_soc' => "order", 'c.date_creation' => "order", 'c.date_commande' => "order", 'c.amount_ht' => "order", + 'c.total_ht' => "order", 'c.total_ttc' => "order", 'c.facture' => "order", 'c.fk_statut' => "order", 'c.note' => "order", + 'c.date_livraison' => "order", 'sm.code' => "order", 'pj.ref' => 'project', 'cd.rowid' => 'order_line', 'cd.description' => "order_line", + 'cd.product_type' => 'order_line', 'cd.tva_tx' => "order_line", 'cd.qty' => "order_line", 'cd.total_ht' => "order_line", 'cd.total_tva' => "order_line", + 'cd.total_ttc' => "order_line", 'p.rowid' => 'product', 'p.ref' => 'product', 'p.label' => 'product' ); - $this->export_dependencies_array[$r] = array('order_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r] = array('order_line' => 'cd.rowid', 'product' => 'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect = 'commande'; $keyforelement = 'order'; $keyforaliasextra = 'extra'; @@ -349,11 +350,11 @@ class modCommande extends DolibarrModules $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref'); $this->import_convertvalue_array[$r] = array( 'c.ref' => array( - 'rule'=>'getrefifauto', - 'class'=>(!getDolGlobalString('COMMANDE_ADDON') ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON), - 'path'=>"/core/modules/commande/".(!getDolGlobalString('COMMANDE_ADDON') ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON).'.php', - 'classobject'=>'Commande', - 'pathobject'=>'/commande/class/commande.class.php', + 'rule' => 'getrefifauto', + 'class' => (!getDolGlobalString('COMMANDE_ADDON') ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON), + 'path' => "/core/modules/commande/".(!getDolGlobalString('COMMANDE_ADDON') ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON).'.php', + 'classobject' => 'Commande', + 'pathobject' => '/commande/class/commande.class.php', ), 'c.fk_soc' => array( 'rule' => 'fetchidfromref', @@ -413,10 +414,10 @@ class modCommande extends DolibarrModules $this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; } - $import_extrafield_sample = array(); + $import_extrafield_sample = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $keyforselect = 'commandedet'; $keyforelement = 'orderline'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php'; $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commandedet']; From d2f09f0b64b1f86ce911ede1e5c99ad3fe74d0a8 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:45 +0100 Subject: [PATCH 065/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modECM.class.php | 117 ++++++++++++++------------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 7aefd2d0028..018ec643045 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ class modECM extends DolibarrModules // Boxes $this->boxes = array(); // List of boxes - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here list of php file(s) stored in core/boxes that contains class to show a box. // Example: @@ -119,82 +120,82 @@ class modECM extends DolibarrModules // Top menu $this->menu[$r] = array( - 'fk_menu'=>0, - 'type'=>'top', - 'titre'=>'MenuECM', + 'fk_menu' => 0, + 'type' => 'top', + 'titre' => 'MenuECM', 'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth"'), - 'mainmenu'=>'ecm', - 'url'=>'/ecm/index.php', - 'langs'=>'ecm', - 'position'=>82, - 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup', - 'enabled'=>'isModEnabled("ecm")', - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => 'ecm', + 'url' => '/ecm/index.php', + 'langs' => 'ecm', + 'position' => 82, + 'perms' => '$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup', + 'enabled' => 'isModEnabled("ecm")', + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $r++; // Left menu linked to top menu $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=ecm', - 'type'=>'left', - 'titre'=>'ECMArea', + 'fk_menu' => 'fk_mainmenu=ecm', + 'type' => 'left', + 'titre' => 'ECMArea', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'ecm', - 'leftmenu'=>'ecm', - 'url'=>'/ecm/index.php?mainmenu=ecm&leftmenu=ecm', - 'langs'=>'ecm', - 'position'=>101, - 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', - 'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload', - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => 'ecm', + 'leftmenu' => 'ecm', + 'url' => '/ecm/index.php?mainmenu=ecm&leftmenu=ecm', + 'langs' => 'ecm', + 'position' => 101, + 'perms' => '$user->rights->ecm->read || $user->rights->ecm->upload', + 'enabled' => '$user->rights->ecm->read || $user->rights->ecm->upload', + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $r++; $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm', - 'type'=>'left', - 'titre'=>'ECMSectionsManual', - 'mainmenu'=>'ecm', - 'leftmenu'=>'ecm_manual', - 'url'=>'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', - 'langs'=>'ecm', - 'position'=>102, - 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', - 'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload', - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm', + 'type' => 'left', + 'titre' => 'ECMSectionsManual', + 'mainmenu' => 'ecm', + 'leftmenu' => 'ecm_manual', + 'url' => '/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', + 'langs' => 'ecm', + 'position' => 102, + 'perms' => '$user->rights->ecm->read || $user->rights->ecm->upload', + 'enabled' => '$user->rights->ecm->read || $user->rights->ecm->upload', + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $r++; $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm', - 'type'=>'left', - 'titre'=>'ECMSectionsAuto', - 'mainmenu'=>'ecm', - 'url'=>'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', - 'langs'=>'ecm', - 'position'=>103, - 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', - 'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")', - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm', + 'type' => 'left', + 'titre' => 'ECMSectionsAuto', + 'mainmenu' => 'ecm', + 'url' => '/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', + 'langs' => 'ecm', + 'position' => 103, + 'perms' => '$user->rights->ecm->read || $user->rights->ecm->upload', + 'enabled' => '($user->rights->ecm->read || $user->rights->ecm->upload) && !getDolGlobalInt("ECM_AUTO_TREE_HIDEN")', + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $r++; $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm', - 'type'=>'left', - 'titre'=>'ECMSectionsMedias', - 'mainmenu'=>'ecm', - 'url'=>'/ecm/index_medias.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', - 'langs'=>'ecm', - 'position'=>104, - 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', - 'enabled'=>'($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("MAIN_FEATURES_LEVEL") == 2', - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu=ecm,fk_leftmenu=ecm', + 'type' => 'left', + 'titre' => 'ECMSectionsMedias', + 'mainmenu' => 'ecm', + 'url' => '/ecm/index_medias.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', + 'langs' => 'ecm', + 'position' => 104, + 'perms' => '$user->rights->ecm->read || $user->rights->ecm->upload', + 'enabled' => '($user->rights->ecm->read || $user->rights->ecm->upload) && getDolGlobalInt("MAIN_FEATURES_LEVEL") == 2', + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $r++; } From 269bc05efd6804af0956573640a180de613926bf Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:48 +0100 Subject: [PATCH 066/130] Fix PhanPluginRedundantAssignment --- .../modules/modEventOrganization.class.php | 167 +++++++++--------- 1 file changed, 84 insertions(+), 83 deletions(-) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 0f709e1ccad..45a595da727 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -228,83 +229,83 @@ class modEventOrganization extends DolibarrModules /* BEGIN MODULEBUILDER TOPMENU */ /* END MODULEBUILDER TOPMENU */ /* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/ - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'EventOrganizationMenuLeft', + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'EventOrganizationMenuLeft', 'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'project', - 'leftmenu'=>'eventorganization', - 'url'=>'', - 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => 'project', + 'leftmenu' => 'eventorganization', + 'url' => '', + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'List', - 'url'=>'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents', - 'langs'=>'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'List', + 'url' => '/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents', + 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'New', - 'url'=>'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0', - 'langs'=>'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'New', + 'url' => '/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0', + 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'ConferenceOrBooth', + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'ConferenceOrBooth', 'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'project', - 'leftmenu'=>'eventorganizationconforbooth', - 'url'=>'', - 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => 'project', + 'leftmenu' => 'eventorganizationconforbooth', + 'url' => '', + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'List', - 'url'=>'/eventorganization/conferenceorbooth_list.php?mainmenu=project', - 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'List', + 'url' => '/eventorganization/conferenceorbooth_list.php?mainmenu=project', + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'New', - 'url'=>'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create', - 'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'New', + 'url' => '/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create', + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */ @@ -313,13 +314,13 @@ class modEventOrganization extends DolibarrModules /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */ $langs->load("eventorganization"); - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]=$this->picto; + $this->export_code[$r] = $this->rights_class.'_'.$r; + $this->export_label[$r] = 'ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r] = $this->picto; // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array $keyforclass = 'ConferenceOrBoothAttendee'; - $keyforclassfile='/eventorganization/class/conferenceorboothattendee.class.php'; - $keyforelement='conferenceorboothattendee'; + $keyforclassfile = '/eventorganization/class/conferenceorboothattendee.class.php'; + $keyforelement = 'conferenceorboothattendee'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; $this->export_entities_array[$r]['t.fk_invoice'] = 'invoice'; unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after @@ -337,18 +338,18 @@ class modEventOrganization extends DolibarrModules $this->export_TypeFields_array[$r]['t.fk_soc'] = 'Numeric'; //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; //unset($this->export_fields_array[$r]['t.fieldtoremove']); - $keyforselect='conferenceorboothattendee'; - $keyforaliasextra='extra'; - $keyforelement='conferenceorboothattendee'; + $keyforselect = 'conferenceorboothattendee'; + $keyforaliasextra = 'extra'; + $keyforelement = 'conferenceorboothattendee'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; //$this->export_dependencies_array[$r] = array('aaaline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) //$this->export_special_array[$r] = array('t.field'=>'...'); //$this->export_examplevalues_array[$r] = array('t.field'=>'Example'); //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp'); - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee as t, '.MAIN_DB_PREFIX.'projet as p'; - $this->export_sql_end[$r] .=' WHERE t.fk_project = p.rowid'; - $this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('conferenceorboothattendee').')'; + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee as t, '.MAIN_DB_PREFIX.'projet as p'; + $this->export_sql_end[$r] .= ' WHERE t.fk_project = p.rowid'; + $this->export_sql_end[$r] .= ' AND p.entity IN ('.getEntity('conferenceorboothattendee').')'; $r++; /* END MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */ @@ -446,7 +447,7 @@ class modEventOrganization extends DolibarrModules // Document templates $moduledir = 'eventorganization'; $myTmpObjects = array(); - $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); + $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'ConferenceOrBooth') { From a84d0ea87c8b8e0783456dee0274ae959755595a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:51 +0100 Subject: [PATCH 067/130] Fix PhanPluginRedundantAssignment --- .../core/modules/modExpenseReport.class.php | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 525760c6ac3..cd8cc5a0a21 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2011 Dimitri Mouillard * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2023 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +73,7 @@ class modExpenseReport extends DolibarrModules // Constants $this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities') - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->const[$r][0] = "EXPENSEREPORT_ADDON_PDF"; $this->const[$r][1] = "chaine"; @@ -182,41 +183,41 @@ class modExpenseReport extends DolibarrModules $this->export_icon[$r] = 'trip'; $this->export_permission[$r] = array(array("expensereport", "export")); $this->export_fields_array[$r] = array( - 'd.rowid'=>"TripId", 'd.ref'=>'Ref', 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.date_create'=>'DateCreation', 'd.date_approve'=>'DateApprove', - 'd.total_ht'=>"TotalHT", 'd.total_tva'=>'TotalVAT', 'd.total_ttc'=>'TotalTTC', - 'd.fk_statut'=>'Status', 'd.paid'=>'Paid', - 'd.note_private'=>'NotePrivate', 'd.note_public'=>'NotePublic', 'd.detail_cancel'=>'MOTIF_CANCEL', 'd.detail_refuse'=>'MOTIF_REFUS', - 'ed.rowid'=>'LineId', 'tf.code'=>'Type', 'ed.date'=>'Date', 'ed.tva_tx'=>'VATRate', - 'ed.qty'=>"Quantity", 'ed.value_unit'=>"UnitPriceHT", - 'ed.total_ht'=>'TotalHT', 'ed.total_tva'=>'TotalVAT', 'ed.total_ttc'=>'TotalTTC', 'ed.comments'=>'Comment', 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', - 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", + 'd.rowid' => "TripId", 'd.ref' => 'Ref', 'd.date_debut' => 'DateStart', 'd.date_fin' => 'DateEnd', 'd.date_create' => 'DateCreation', 'd.date_approve' => 'DateApprove', + 'd.total_ht' => "TotalHT", 'd.total_tva' => 'TotalVAT', 'd.total_ttc' => 'TotalTTC', + 'd.fk_statut' => 'Status', 'd.paid' => 'Paid', + 'd.note_private' => 'NotePrivate', 'd.note_public' => 'NotePublic', 'd.detail_cancel' => 'MOTIF_CANCEL', 'd.detail_refuse' => 'MOTIF_REFUS', + 'ed.rowid' => 'LineId', 'tf.code' => 'Type', 'ed.date' => 'Date', 'ed.tva_tx' => 'VATRate', + 'ed.qty' => "Quantity", 'ed.value_unit' => "UnitPriceHT", + 'ed.total_ht' => 'TotalHT', 'ed.total_tva' => 'TotalVAT', 'ed.total_ttc' => 'TotalTTC', 'ed.comments' => 'Comment', 'p.rowid' => 'ProjectId', 'p.ref' => 'Ref', + 'u.lastname' => 'Lastname', 'u.firstname' => 'Firstname', 'u.login' => "Login", 'user_rib.iban_prefix' => 'IBAN', 'user_rib.bic' => 'BIC', 'user_rib.code_banque' => 'BankCode', 'user_rib.bank' => 'BankName', 'user_rib.proprio' => 'BankAccountOwner', 'user_rib.owner_address' => 'BankAccountOwnerAddress' ); $this->export_TypeFields_array[$r] = array( - 'd.rowid'=>'Numeric', 'd.ref'=>'Text', 'd.date_debut'=>'Date', 'd.date_fin'=>'Date', 'd.date_create'=>'Date', 'd.date_approve'=>'Date', - 'd.total_ht'=>"Numeric", 'd.total_tva'=>'Numeric', 'd.total_ttc'=>'Numeric', - 'd.fk_statut'=>"Numeric", 'd.paid'=>'Numeric', - 'd.note_private'=>'Text', 'd.note_public'=>'Text', 'd.detail_cancel'=>'Text', 'd.detail_refuse'=>'Text', - 'ed.rowid'=>'Numeric', 'tf.code'=>'Code', 'ed.date'=>'Date', 'ed.tva_tx'=>'Numeric', - 'ed.qty'=>'Numeric', 'ed.value_unit'=>'Numeric', - 'ed.total_ht'=>'Numeric', 'ed.total_tva'=>'Numeric', 'ed.total_ttc'=>'Numeric', 'ed.comments'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', - 'u.lastname'=>'Text', 'u.firstname'=>'Text', 'u.login'=>"Text", + 'd.rowid' => 'Numeric', 'd.ref' => 'Text', 'd.date_debut' => 'Date', 'd.date_fin' => 'Date', 'd.date_create' => 'Date', 'd.date_approve' => 'Date', + 'd.total_ht' => "Numeric", 'd.total_tva' => 'Numeric', 'd.total_ttc' => 'Numeric', + 'd.fk_statut' => "Numeric", 'd.paid' => 'Numeric', + 'd.note_private' => 'Text', 'd.note_public' => 'Text', 'd.detail_cancel' => 'Text', 'd.detail_refuse' => 'Text', + 'ed.rowid' => 'Numeric', 'tf.code' => 'Code', 'ed.date' => 'Date', 'ed.tva_tx' => 'Numeric', + 'ed.qty' => 'Numeric', 'ed.value_unit' => 'Numeric', + 'ed.total_ht' => 'Numeric', 'ed.total_tva' => 'Numeric', 'ed.total_ttc' => 'Numeric', 'ed.comments' => 'Text', 'p.rowid' => 'Numeric', 'p.ref' => 'Text', + 'u.lastname' => 'Text', 'u.firstname' => 'Text', 'u.login' => "Text", 'user_rib.iban_prefix' => 'Text', 'user_rib.bic' => 'Text', 'user_rib.code_banque' => 'Text', 'user_rib.bank' => 'Text', 'user_rib.proprio' => 'Text', 'user_rib.owner_address' => 'Text' ); $this->export_entities_array[$r] = array( - 'ed.rowid'=>'expensereport_line', 'ed.date'=>'expensereport_line', - 'ed.qty'=>'expensereport_line', 'ed.value_unit'=>'expensereport_line', - 'ed.tva_tx'=>'expensereport_line', 'ed.total_ht'=>'expensereport_line', 'ed.total_tva'=>'expensereport_line', 'ed.total_ttc'=>'expensereport_line', - 'ed.comments'=>'expensereport_line', 'tf.code'=>'expensereport_line', 'p.project_ref'=>'expensereport_line', 'p.rowid'=>'project', 'p.ref'=>'project', - 'u.lastname'=>'user', 'u.firstname'=>'user', 'u.login'=>'user', + 'ed.rowid' => 'expensereport_line', 'ed.date' => 'expensereport_line', + 'ed.qty' => 'expensereport_line', 'ed.value_unit' => 'expensereport_line', + 'ed.tva_tx' => 'expensereport_line', 'ed.total_ht' => 'expensereport_line', 'ed.total_tva' => 'expensereport_line', 'ed.total_ttc' => 'expensereport_line', + 'ed.comments' => 'expensereport_line', 'tf.code' => 'expensereport_line', 'p.project_ref' => 'expensereport_line', 'p.rowid' => 'project', 'p.ref' => 'project', + 'u.lastname' => 'user', 'u.firstname' => 'user', 'u.login' => 'user', 'user_rib.iban_prefix' => 'user', 'user_rib.bic' => 'user', 'user_rib.code_banque' => 'user', 'user_rib.bank' => 'user', 'user_rib.proprio' => 'user', 'user_rib.owner_address' => 'user' ); //$this->export_alias_array[$r] = array('d.rowid'=>"idtrip", 'd.type'=>"type", 'd.note_private'=>'note_private', 'd.note_public'=>'note_public', 'u.lastname'=>'name', 'u.firstname'=>'firstname', 'u.login'=>'login'); - $this->export_dependencies_array[$r] = array('expensereport_line'=>'ed.rowid', 'type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r] = array('expensereport_line' => 'ed.rowid', 'type_fees' => 'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect = 'expensereport'; $keyforelement = 'expensereport'; From 98862398f11413d52d61f9fa109d7ef769ef0430 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:54 +0100 Subject: [PATCH 068/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modExternalSite.class.php | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/modExternalSite.class.php b/htdocs/core/modules/modExternalSite.class.php index b56f62538b0..382c1a3821f 100644 --- a/htdocs/core/modules/modExternalSite.class.php +++ b/htdocs/core/modules/modExternalSite.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ class modExternalSite extends DolibarrModules // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) // ); - $this->const = array(0=>array('EXTERNALSITE_LABEL', 'chaine', 'ExternalSite', 'To declare label to use into external site menu entry', 0)); + $this->const = array(0 => array('EXTERNALSITE_LABEL', 'chaine', 'ExternalSite', 'To declare label to use into external site menu entry', 0)); // Boxes $this->boxes = array(); // List of boxes @@ -100,21 +101,21 @@ class modExternalSite extends DolibarrModules // Menus //------ - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->menu[$r] = array( - 'fk_menu'=>0, - 'type'=>'top', - 'titre'=>'__[EXTERNALSITE_LABEL]__', + 'fk_menu' => 0, + 'type' => 'top', + 'titre' => '__[EXTERNALSITE_LABEL]__', 'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth em092"'), - 'mainmenu'=>'externalsite', - 'url'=>'/externalsite/frames.php', - 'langs'=>'other', - 'position'=>100, - 'perms'=>'', - 'enabled'=>'$conf->externalsite->enabled', - 'target'=>'', - 'user'=>2 + 'mainmenu' => 'externalsite', + 'url' => '/externalsite/frames.php', + 'langs' => 'other', + 'position' => 100, + 'perms' => '', + 'enabled' => '$conf->externalsite->enabled', + 'target' => '', + 'user' => 2 ); $r++; } From f9250639af47579268349c37c520e92ec88b4ebf Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:30:57 +0100 Subject: [PATCH 069/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modFournisseur.class.php | 213 ++++++++++--------- 1 file changed, 107 insertions(+), 106 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index e850567eb6f..c49e5311e91 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013-2015 Philippe Grand * Copyright (C) 2020 Ahmad Jamaly Rabib + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,32 +132,32 @@ class modFournisseur extends DolibarrModules // Boxes $this->boxes = array( - 0=>array('file'=>'box_graph_invoices_supplier_permonth.php', 'enabledbydefaulton'=>'Home'), - 1=>array('file'=>'box_graph_orders_supplier_permonth.php', 'enabledbydefaulton'=>'Home'), - 2=>array('file'=>'box_fournisseurs.php', 'enabledbydefaulton'=>'Home'), - 3=>array('file'=>'box_factures_fourn_imp.php', 'enabledbydefaulton'=>'Home'), - 4=>array('file'=>'box_factures_fourn.php', 'enabledbydefaulton'=>'Home'), - 5=>array('file'=>'box_supplier_orders.php', 'enabledbydefaulton'=>'Home'), - 6=>array('file'=>'box_supplier_orders_awaiting_reception.php', 'enabledbydefaulton'=>'Home'), + 0 => array('file' => 'box_graph_invoices_supplier_permonth.php', 'enabledbydefaulton' => 'Home'), + 1 => array('file' => 'box_graph_orders_supplier_permonth.php', 'enabledbydefaulton' => 'Home'), + 2 => array('file' => 'box_fournisseurs.php', 'enabledbydefaulton' => 'Home'), + 3 => array('file' => 'box_factures_fourn_imp.php', 'enabledbydefaulton' => 'Home'), + 4 => array('file' => 'box_factures_fourn.php', 'enabledbydefaulton' => 'Home'), + 5 => array('file' => 'box_supplier_orders.php', 'enabledbydefaulton' => 'Home'), + 6 => array('file' => 'box_supplier_orders_awaiting_reception.php', 'enabledbydefaulton' => 'Home'), ); $arraydate = dol_getdate(dol_now()); $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0 => array( - 'label'=>'RecurringSupplierInvoicesJob', - 'jobtype'=>'method', - 'class'=>'fourn/class/fournisseur.facture-rec.class.php', - 'objectname'=>'FactureFournisseurRec', - 'method'=>'createRecurringInvoices', - 'parameters'=>'', - 'comment'=>'Generate recurring supplier invoices', - 'frequency'=>1, - 'unitfrequency'=>3600 * 24, - 'priority'=>51, - 'status'=>1, - 'test'=>'isModEnabled("supplier_invoice")', - 'datestart'=>$datestart + 'label' => 'RecurringSupplierInvoicesJob', + 'jobtype' => 'method', + 'class' => 'fourn/class/fournisseur.facture-rec.class.php', + 'objectname' => 'FactureFournisseurRec', + 'method' => 'createRecurringInvoices', + 'parameters' => '', + 'comment' => 'Generate recurring supplier invoices', + 'frequency' => 1, + 'unitfrequency' => 3600 * 24, + 'priority' => 51, + 'status' => 1, + 'test' => 'isModEnabled("supplier_invoice")', + 'datestart' => $datestart ), 1 => array( 'label' => 'SendEmailsRemindersOnSupplierInvoiceDueDate', @@ -170,8 +171,8 @@ class modFournisseur extends DolibarrModules 'unitfrequency' => 3600 * 24, 'priority' => 50, 'status' => 0, - 'test'=>'isModEnabled("supplier_invoice")', - 'datestart'=>$datestart + 'test' => 'isModEnabled("supplier_invoice")', + 'datestart' => $datestart )); @@ -337,17 +338,17 @@ class modFournisseur extends DolibarrModules $this->export_icon[$r] = 'invoice'; $this->export_permission[$r] = array(array("fournisseur", "facture", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', - 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', - 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', - 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_supplier'=>"RefSupplier", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>'DateMaxPayment', - 'f.fk_cond_reglement'=>'IdPaymentTerm', 'cpt.code'=>'CodePaymentTerm', 'cpt.libelle'=>'LabelPaymentTerm', 'f.fk_mode_reglement'=>'IdPaymentMode', 'cp.code'=>'CodePaymentMode', 'cp.libelle'=>'LabelPaymentMode', - 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.paye'=>"InvoicePaid", 'f.fk_statut'=>'InvoiceStatus', 'f.note_public'=>"InvoiceNote", - 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.remise_percent'=>"Discount", 'fd.total_ht'=>"LineTotalHT", - 'fd.total_ttc'=>"LineTotalTTC", 'fd.tva'=>"LineTotalVAT", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode', - 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.fk_product'=>'ProductId', - 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', $alias_product_perentity.'.accountancy_code_buy'=>'ProductAccountancyBuyCode', 'project.rowid'=>'ProjectId', - 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' + 's.rowid' => "IdCompany", 's.nom' => 'CompanyName', 'ps.nom' => 'ParentCompany', 's.address' => 'Address', 's.zip' => 'Zip', 's.town' => 'Town', 'c.code' => 'CountryCode', 's.phone' => 'Phone', + 's.siren' => 'ProfId1', 's.siret' => 'ProfId2', 's.ape' => 'ProfId3', 's.idprof4' => 'ProfId4', 's.idprof5' => 'ProfId5', 's.idprof6' => 'ProfId6', + 's.code_compta' => 'CustomerAccountancyCode', 's.code_compta_fournisseur' => 'SupplierAccountancyCode', 's.tva_intra' => 'VATIntra', + 'f.rowid' => "InvoiceId", 'f.ref' => "InvoiceRef", 'f.ref_supplier' => "RefSupplier", 'f.datec' => "InvoiceDateCreation", 'f.datef' => "DateInvoice", 'f.date_lim_reglement' => 'DateMaxPayment', + 'f.fk_cond_reglement' => 'IdPaymentTerm', 'cpt.code' => 'CodePaymentTerm', 'cpt.libelle' => 'LabelPaymentTerm', 'f.fk_mode_reglement' => 'IdPaymentMode', 'cp.code' => 'CodePaymentMode', 'cp.libelle' => 'LabelPaymentMode', + 'f.total_ht' => "TotalHT", 'f.total_ttc' => "TotalTTC", 'f.total_tva' => "TotalVAT", 'f.paye' => "InvoicePaid", 'f.fk_statut' => 'InvoiceStatus', 'f.note_public' => "InvoiceNote", + 'fd.rowid' => 'LineId', 'fd.description' => "LineDescription", 'fd.tva_tx' => "LineVATRate", 'fd.qty' => "LineQty", 'fd.remise_percent' => "Discount", 'fd.total_ht' => "LineTotalHT", + 'fd.total_ttc' => "LineTotalTTC", 'fd.tva' => "LineTotalVAT", 'fd.date_start' => "DateStart", 'fd.date_end' => "DateEnd", 'fd.special_code' => 'SpecialCode', + 'fd.product_type' => 'TypeOfLineServiceOrProduct', 'fd.fk_product' => 'ProductId', + 'p.ref' => 'ProductRef', 'p.label' => 'ProductLabel', $alias_product_perentity.'.accountancy_code_buy' => 'ProductAccountancyBuyCode', 'project.rowid' => 'ProjectId', + 'project.ref' => 'ProjectRef', 'project.title' => 'ProjectLabel' ); if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; @@ -363,26 +364,26 @@ class modFournisseur extends DolibarrModules // 'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' //); $this->export_TypeFields_array[$r] = array( - 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', - 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>'Date', - 'f.fk_cond_reglement'=>'Numeric', 'f.fk_mode_reglement'=>'Numeric', - 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.note_public'=>"Text", 'fd.description'=>"Text", 'fd.tva_tx'=>"Text", - 'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.tva'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", 'fd.special_code'=>"Numeric", - 'fd.product_type'=>'Numeric', 'fd.fk_product'=>'List:product:label', $alias_product_perentity . '.accountancy_code_buy'=>'Text', - 'p.ref'=>'Text', 'p.label'=>'Text', 'project.ref'=>'Text', 'project.title'=>'Text' + 's.nom' => 'Text', 'ps.nom' => 'Text', 's.address' => 'Text', 's.zip' => 'Text', 's.town' => 'Text', 'c.code' => 'Text', 's.phone' => 'Text', 's.siren' => 'Text', 's.siret' => 'Text', 's.ape' => 'Text', 's.idprof4' => 'Text', 's.idprof5' => 'Text', 's.idprof6' => 'Text', + 's.code_compta' => 'Text', 's.code_compta_fournisseur' => 'Text', 's.tva_intra' => 'Text', 'f.ref' => "Text", 'f.ref_supplier' => "Text", 'f.datec' => "Date", 'f.datef' => "Date", 'f.date_lim_reglement' => 'Date', + 'f.fk_cond_reglement' => 'Numeric', 'f.fk_mode_reglement' => 'Numeric', + 'f.total_ht' => "Numeric", 'f.total_ttc' => "Numeric", 'f.total_tva' => "Numeric", 'f.paye' => "Boolean", 'f.fk_statut' => 'Status', 'f.note_public' => "Text", 'fd.description' => "Text", 'fd.tva_tx' => "Text", + 'fd.qty' => "Numeric", 'fd.total_ht' => "Numeric", 'fd.total_ttc' => "Numeric", 'fd.tva' => "Numeric", 'fd.date_start' => "Date", 'fd.date_end' => "Date", 'fd.special_code' => "Numeric", + 'fd.product_type' => 'Numeric', 'fd.fk_product' => 'List:product:label', $alias_product_perentity . '.accountancy_code_buy' => 'Text', + 'p.ref' => 'Text', 'p.label' => 'Text', 'project.ref' => 'Text', 'project.title' => 'Text' ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', - 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company', 'f.rowid'=>"invoice", - 'f.ref'=>"invoice", 'f.ref_supplier'=>"invoice", 'f.datec'=>"invoice", 'f.datef'=>"invoice", 'f.date_lim_reglement'=>'invoice', - 'f.fk_cond_reglement'=>'invoice', 'f.fk_mode_reglement'=>'invoice', - 'f.total_ht'=>"invoice", 'f.total_ttc'=>"invoice", 'f.total_tva'=>"invoice", - 'f.paye'=>"invoice", 'f.fk_statut'=>'invoice', 'f.note_public'=>"invoice", 'fd.rowid'=>'invoice_line', 'fd.description'=>"invoice_line", 'fd.tva_tx'=>"invoice_line", 'fd.qty'=>"invoice_line", - 'fd.remise_percent'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>"invoice_line", - 'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', - 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity.'.accountancy_code_buy'=>'product', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project' + 's.rowid' => "company", 's.nom' => 'company', 'ps.nom' => 'company', 's.address' => 'company', 's.zip' => 'company', 's.town' => 'company', 'c.code' => 'company', 's.phone' => 'company', 's.siren' => 'company', 's.siret' => 'company', + 's.ape' => 'company', 's.idprof4' => 'company', 's.idprof5' => 'company', 's.idprof6' => 'company', 's.code_compta' => 'company', 's.code_compta_fournisseur' => 'company', 's.tva_intra' => 'company', 'f.rowid' => "invoice", + 'f.ref' => "invoice", 'f.ref_supplier' => "invoice", 'f.datec' => "invoice", 'f.datef' => "invoice", 'f.date_lim_reglement' => 'invoice', + 'f.fk_cond_reglement' => 'invoice', 'f.fk_mode_reglement' => 'invoice', + 'f.total_ht' => "invoice", 'f.total_ttc' => "invoice", 'f.total_tva' => "invoice", + 'f.paye' => "invoice", 'f.fk_statut' => 'invoice', 'f.note_public' => "invoice", 'fd.rowid' => 'invoice_line', 'fd.description' => "invoice_line", 'fd.tva_tx' => "invoice_line", 'fd.qty' => "invoice_line", + 'fd.remise_percent' => "invoice_line", 'fd.total_ht' => "invoice_line", 'fd.total_ttc' => "invoice_line", 'fd.tva' => "invoice_line", 'fd.date_start' => "invoice_line", 'fd.date_end' => "invoice_line", 'fd.special_code' => "invoice_line", + 'fd.product_type' => 'invoice_line', 'fd.fk_product' => 'product', + 'p.ref' => 'product', 'p.label' => 'product', $alias_product_perentity.'.accountancy_code_buy' => 'product', 'project.rowid' => 'project', 'project.ref' => 'project', 'project.title' => 'project' ); - $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r] = array('invoice_line' => 'fd.rowid', 'product' => 'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $keyforselect = 'facture_fourn'; $keyforelement = 'invoice'; @@ -420,14 +421,14 @@ class modFournisseur extends DolibarrModules $this->export_icon[$r] = 'invoice'; $this->export_permission[$r] = array(array("fournisseur", "facture", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', - 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', - 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', - 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_supplier'=>"RefSupplier", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateMaxPayment", - 'f.fk_cond_reglement'=>'IdPaymentTerm', 'cpt.code'=>'CodePaymentTerm', 'cpt.libelle'=>'LabelPaymentTerm', 'f.fk_mode_reglement'=>'IdPaymentMode', 'cp.code'=>'CodePaymentMode', 'cp.libelle'=>'LabelPaymentMode', - 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.paye'=>"InvoicePaid", - 'f.fk_statut'=>'InvoiceStatus', 'f.note_public'=>"InvoiceNote", 'p.rowid'=>'PaymentId', 'pf.amount'=>'AmountPayment', - 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', 'p.fk_bank'=>'IdTransaction', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' + 's.rowid' => "IdCompany", 's.nom' => 'CompanyName', 's.address' => 'Address', 's.zip' => 'Zip', 's.town' => 'Town', 'c.code' => 'CountryCode', 's.phone' => 'Phone', + 's.siren' => 'ProfId1', 's.siret' => 'ProfId2', 's.ape' => 'ProfId3', 's.idprof4' => 'ProfId4', 's.idprof5' => 'ProfId5', 's.idprof6' => 'ProfId6', + 's.code_compta' => 'CustomerAccountancyCode', 's.code_compta_fournisseur' => 'SupplierAccountancyCode', 's.tva_intra' => 'VATIntra', + 'f.rowid' => "InvoiceId", 'f.ref' => "InvoiceRef", 'f.ref_supplier' => "RefSupplier", 'f.datec' => "InvoiceDateCreation", 'f.datef' => "DateInvoice", 'f.date_lim_reglement' => "DateMaxPayment", + 'f.fk_cond_reglement' => 'IdPaymentTerm', 'cpt.code' => 'CodePaymentTerm', 'cpt.libelle' => 'LabelPaymentTerm', 'f.fk_mode_reglement' => 'IdPaymentMode', 'cp.code' => 'CodePaymentMode', 'cp.libelle' => 'LabelPaymentMode', + 'f.total_ht' => "TotalHT", 'f.total_ttc' => "TotalTTC", 'f.total_tva' => "TotalVAT", 'f.paye' => "InvoicePaid", + 'f.fk_statut' => 'InvoiceStatus', 'f.note_public' => "InvoiceNote", 'p.rowid' => 'PaymentId', 'pf.amount' => 'AmountPayment', + 'p.datep' => 'DatePayment', 'p.num_paiement' => 'PaymentNumber', 'p.fk_bank' => 'IdTransaction', 'project.rowid' => 'ProjectId', 'project.ref' => 'ProjectRef', 'project.title' => 'ProjectLabel' ); if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; @@ -443,22 +444,22 @@ class modFournisseur extends DolibarrModules // 'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric' //); $this->export_TypeFields_array[$r] = array( - 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', - 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text", - 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>'Date', - 'f.fk_cond_reglement'=>'Numeric', 'f.fk_mode_reglement'=>'Numeric', - 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.note_public'=>"Text", 'pf.amount'=>'Numeric', - 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric', 'p.fk_bank'=>'Numeric', 'project.ref'=>'Text', 'project.title'=>'Text' + 's.nom' => 'Text', 's.address' => 'Text', 's.zip' => 'Text', 's.town' => 'Text', 'c.code' => 'Text', 's.phone' => 'Text', 's.siren' => 'Text', 's.siret' => 'Text', 's.ape' => 'Text', + 's.idprof4' => 'Text', 's.code_compta' => 'Text', 's.code_compta_fournisseur' => 'Text', 's.tva_intra' => 'Text', 'f.ref' => "Text", 'f.ref_supplier' => "Text", + 'f.datec' => "Date", 'f.datef' => "Date", 'f.date_lim_reglement' => 'Date', + 'f.fk_cond_reglement' => 'Numeric', 'f.fk_mode_reglement' => 'Numeric', + 'f.total_ht' => "Numeric", 'f.total_ttc' => "Numeric", 'f.total_tva' => "Numeric", 'f.paye' => "Boolean", 'f.fk_statut' => 'Status', 'f.note_public' => "Text", 'pf.amount' => 'Numeric', + 'p.datep' => 'Date', 'p.num_paiement' => 'Numeric', 'p.fk_bank' => 'Numeric', 'project.ref' => 'Text', 'project.title' => 'Text' ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company', - 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', - 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company', - 'f.rowid'=>"invoice", 'f.ref'=>"invoice", 'f.ref_supplier'=>"invoice", 'f.datec'=>"invoice", 'f.datef'=>"invoice", 'f.date_lim_reglement'=>'invoice', - 'f.fk_cond_reglement'=>'invoice', 'f.fk_mode_reglement'=>'invoice', - 'f.total_ht'=>"invoice", 'f.total_ttc'=>"invoice", 'f.total_tva'=>"invoice", 'f.paye'=>"invoice", 'f.fk_statut'=>'invoice', 'f.note_public'=>"invoice", 'p.rowid'=>'payment', 'pf.amount'=>'payment', - 'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'p.fk_bank'=>'account', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project'); - $this->export_dependencies_array[$r] = array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + 's.rowid' => "company", 's.nom' => 'company', 's.address' => 'company', 's.zip' => 'company', 's.town' => 'company', 'c.code' => 'company', 's.phone' => 'company', + 's.siren' => 'company', 's.siret' => 'company', 's.ape' => 'company', 's.idprof4' => 'company', 's.idprof5' => 'company', 's.idprof6' => 'company', + 's.code_compta' => 'company', 's.code_compta_fournisseur' => 'company', 's.tva_intra' => 'company', + 'f.rowid' => "invoice", 'f.ref' => "invoice", 'f.ref_supplier' => "invoice", 'f.datec' => "invoice", 'f.datef' => "invoice", 'f.date_lim_reglement' => 'invoice', + 'f.fk_cond_reglement' => 'invoice', 'f.fk_mode_reglement' => 'invoice', + 'f.total_ht' => "invoice", 'f.total_ttc' => "invoice", 'f.total_tva' => "invoice", 'f.paye' => "invoice", 'f.fk_statut' => 'invoice', 'f.note_public' => "invoice", 'p.rowid' => 'payment', 'pf.amount' => 'payment', + 'p.datep' => 'payment', 'p.num_paiement' => 'payment', 'p.fk_bank' => 'account', 'project.rowid' => 'project', 'project.ref' => 'project', 'project.title' => 'project'); + $this->export_dependencies_array[$r] = array('payment' => 'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $keyforselect = 'facture_fourn'; $keyforelement = 'invoice'; @@ -491,15 +492,15 @@ class modFournisseur extends DolibarrModules $this->export_icon[$r] = 'order'; $this->export_permission[$r] = array(array("fournisseur", "commande", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', - 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', 's.tva_intra'=>'VATIntra', - 'f.rowid'=>"OrderId", 'f.ref'=>"Ref", 'f.ref_supplier'=>"RefSupplier", 'f.date_creation'=>"DateCreation", 'f.date_commande'=>"OrderDate", 'f.date_livraison'=>"DateDeliveryPlanned", - 'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.fk_statut'=>'Status', 'f.date_valid'=>'DateValidation', 'f.date_approve'=>'DateApprove', 'f.date_approve2'=>'DateApprove2', - 'f.note_public'=>"NotePublic", 'f.note_private'=>"NotePrivate", 'uv.login'=>'UserValidation', 'ua1.login'=>'ApprovedBy', 'ua2.login'=>'ApprovedBy2', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", - 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.remise_percent'=>"Discount", 'fd.total_ht'=>"LineTotalHT", 'fd.total_ttc'=>"LineTotalTTC", - 'fd.total_tva'=>"LineTotalVAT", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode', - 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'SupplierRef', 'fd.fk_product'=>'ProductId', - 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' + 's.rowid' => "IdCompany", 's.nom' => 'CompanyName', 'ps.nom' => 'ParentCompany', 's.address' => 'Address', 's.zip' => 'Zip', 's.town' => 'Town', 'c.code' => 'CountryCode', 's.phone' => 'Phone', + 's.siren' => 'ProfId1', 's.siret' => 'ProfId2', 's.ape' => 'ProfId3', 's.idprof4' => 'ProfId4', 's.idprof5' => 'ProfId5', 's.idprof6' => 'ProfId6', 's.tva_intra' => 'VATIntra', + 'f.rowid' => "OrderId", 'f.ref' => "Ref", 'f.ref_supplier' => "RefSupplier", 'f.date_creation' => "DateCreation", 'f.date_commande' => "OrderDate", 'f.date_livraison' => "DateDeliveryPlanned", + 'f.total_ht' => "TotalHT", 'f.total_ttc' => "TotalTTC", 'f.total_tva' => "TotalVAT", 'f.fk_statut' => 'Status', 'f.date_valid' => 'DateValidation', 'f.date_approve' => 'DateApprove', 'f.date_approve2' => 'DateApprove2', + 'f.note_public' => "NotePublic", 'f.note_private' => "NotePrivate", 'uv.login' => 'UserValidation', 'ua1.login' => 'ApprovedBy', 'ua2.login' => 'ApprovedBy2', 'fd.rowid' => 'LineId', 'fd.description' => "LineDescription", + 'fd.tva_tx' => "LineVATRate", 'fd.qty' => "LineQty", 'fd.remise_percent' => "Discount", 'fd.total_ht' => "LineTotalHT", 'fd.total_ttc' => "LineTotalTTC", + 'fd.total_tva' => "LineTotalVAT", 'fd.date_start' => "DateStart", 'fd.date_end' => "DateEnd", 'fd.special_code' => 'SpecialCode', + 'fd.product_type' => 'TypeOfLineServiceOrProduct', 'fd.ref' => 'SupplierRef', 'fd.fk_product' => 'ProductId', + 'p.ref' => 'ProductRef', 'p.label' => 'ProductLabel', 'project.rowid' => 'ProjectId', 'project.ref' => 'ProjectRef', 'project.title' => 'ProjectLabel' ); if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; @@ -513,27 +514,27 @@ class modFournisseur extends DolibarrModules unset($this->export_fields_array['ua2.login']); } $this->export_TypeFields_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.cp'=>'Text', 's.ville'=>'Text', 'c.code'=>'Text', 's.tel'=>'Text', 's.siren'=>'Text', - 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text", - 'f.date_creation'=>"Date", 'f.date_commande'=>"Date", 'f.date_livraison'=>"Date", 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", - 'f.fk_statut'=>'Status', 'f.date_valid'=>'Date', 'f.date_approve'=>'Date', 'f.date_approve2'=>'Date', 'f.note_public'=>"Text", 'f.note_private'=>"Text", 'fd.description'=>"Text", - 'fd.tva_tx'=>"Numeric", 'fd.qty'=>"Numeric", 'fd.remise_percent'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.total_tva'=>"Numeric", - 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", 'fd.special_code'=>"Numeric", - 'fd.product_type'=>'Numeric', 'fd.ref'=>'Text', 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', 'project.ref'=>'Text', 'project.title'=>'Text' + 's.rowid' => "company", 's.nom' => 'Text', 'ps.nom' => 'Text', 's.address' => 'Text', 's.cp' => 'Text', 's.ville' => 'Text', 'c.code' => 'Text', 's.tel' => 'Text', 's.siren' => 'Text', + 's.siret' => 'Text', 's.ape' => 'Text', 's.idprof4' => 'Text', 's.idprof5' => 'Text', 's.idprof6' => 'Text', 's.tva_intra' => 'Text', 'f.ref' => "Text", 'f.ref_supplier' => "Text", + 'f.date_creation' => "Date", 'f.date_commande' => "Date", 'f.date_livraison' => "Date", 'f.total_ht' => "Numeric", 'f.total_ttc' => "Numeric", 'f.total_tva' => "Numeric", + 'f.fk_statut' => 'Status', 'f.date_valid' => 'Date', 'f.date_approve' => 'Date', 'f.date_approve2' => 'Date', 'f.note_public' => "Text", 'f.note_private' => "Text", 'fd.description' => "Text", + 'fd.tva_tx' => "Numeric", 'fd.qty' => "Numeric", 'fd.remise_percent' => "Numeric", 'fd.total_ht' => "Numeric", 'fd.total_ttc' => "Numeric", 'fd.total_tva' => "Numeric", + 'fd.date_start' => "Date", 'fd.date_end' => "Date", 'fd.special_code' => "Numeric", + 'fd.product_type' => 'Numeric', 'fd.ref' => 'Text', 'fd.fk_product' => 'List:product:label', 'p.ref' => 'Text', 'p.label' => 'Text', 'project.ref' => 'Text', 'project.title' => 'Text' ); $this->export_entities_array[$r] = array( - 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', - 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', 's.tva_intra'=>'company', 'uv.login'=>'user', 'ua1.login'=>'user', - 'ua2.login'=>'user', 'fd.rowid'=>'order_line', 'fd.description'=>"order_line", 'fd.tva_tx'=>"order_line", 'fd.qty'=>"order_line", 'fd.remise_percent'=>"order_line", - 'fd.total_ht'=>"order_line", 'fd.total_ttc'=>"order_line", 'fd.total_tva'=>"order_line", 'fd.date_start'=>"order_line", 'fd.date_end'=>"order_line", 'fd.special_code'=>"order_line", - 'fd.product_type'=>'order_line', 'fd.ref'=>'order_line', 'fd.fk_product'=>'product', - 'p.ref'=>'product', 'p.label'=>'product', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project' + 's.rowid' => "company", 's.nom' => 'company', 'ps.nom' => 'company', 's.address' => 'company', 's.zip' => 'company', 's.town' => 'company', 'c.code' => 'company', 's.phone' => 'company', 's.siren' => 'company', + 's.siret' => 'company', 's.ape' => 'company', 's.idprof4' => 'company', 's.idprof5' => 'company', 's.idprof6' => 'company', 's.tva_intra' => 'company', 'uv.login' => 'user', 'ua1.login' => 'user', + 'ua2.login' => 'user', 'fd.rowid' => 'order_line', 'fd.description' => "order_line", 'fd.tva_tx' => "order_line", 'fd.qty' => "order_line", 'fd.remise_percent' => "order_line", + 'fd.total_ht' => "order_line", 'fd.total_ttc' => "order_line", 'fd.total_tva' => "order_line", 'fd.date_start' => "order_line", 'fd.date_end' => "order_line", 'fd.special_code' => "order_line", + 'fd.product_type' => 'order_line', 'fd.ref' => 'order_line', 'fd.fk_product' => 'product', + 'p.ref' => 'product', 'p.label' => 'product', 'project.rowid' => 'project', 'project.ref' => 'project', 'project.title' => 'project' ); - $this->export_dependencies_array[$r] = array('order_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them + $this->export_dependencies_array[$r] = array('order_line' => 'fd.rowid', 'product' => 'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $keyforselect = 'commande_fournisseur'; $keyforelement = 'order'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields object // Add extra fields line @@ -659,11 +660,11 @@ class modFournisseur extends DolibarrModules $this->import_updatekeys_array[$r] = array('f.ref' => 'Ref'); $this->import_convertvalue_array[$r] = array( 'f.ref' => array( - 'rule'=>'getrefifauto', - 'class'=>(!getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER') ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER), - 'path'=>"/core/modules/supplier_invoice/".(!getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER') ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER).'.php', - 'classobject'=>'FactureFournisseur', - 'pathobject'=>'/fourn/class/fournisseur.facture.class.php', + 'rule' => 'getrefifauto', + 'class' => (!getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER') ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER), + 'path' => "/core/modules/supplier_invoice/".(!getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER') ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER).'.php', + 'classobject' => 'FactureFournisseur', + 'pathobject' => '/fourn/class/fournisseur.facture.class.php', ), 'f.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), 'f.fk_account' => array('rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'), @@ -812,11 +813,11 @@ class modFournisseur extends DolibarrModules $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref'); $this->import_convertvalue_array[$r] = array( 'c.ref' => array( - 'rule'=>'getrefifauto', - 'class'=>(!getDolGlobalString('COMMANDE_SUPPLIER_ADDON_NUMBER') ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER), - 'path'=>"/core/modules/supplier_order/".(!getDolGlobalString('COMMANDE_SUPPLIER_ADDON_NUMBER') ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER).'.php', - 'classobject'=>'CommandeFournisseur', - 'pathobject'=>'/fourn/class/fournisseur.commande.class.php', + 'rule' => 'getrefifauto', + 'class' => (!getDolGlobalString('COMMANDE_SUPPLIER_ADDON_NUMBER') ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER), + 'path' => "/core/modules/supplier_order/".(!getDolGlobalString('COMMANDE_SUPPLIER_ADDON_NUMBER') ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER).'.php', + 'classobject' => 'CommandeFournisseur', + 'pathobject' => '/fourn/class/fournisseur.commande.class.php', ), 'c.fk_soc' => array( 'rule' => 'fetchidfromref', From daaf1e46c6fc38e2900bbd9b2a5f25bbba93ff56 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:00 +0100 Subject: [PATCH 070/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modGravatar.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modGravatar.class.php b/htdocs/core/modules/modGravatar.class.php index 4e38b93c4fc..f5992524911 100644 --- a/htdocs/core/modules/modGravatar.class.php +++ b/htdocs/core/modules/modGravatar.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +92,7 @@ class modGravatar extends DolibarrModules // Boxes $this->boxes = array(); // List of boxes - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here list of php file(s) stored in core/boxes that contains class to show a box. // Example: @@ -103,7 +104,7 @@ class modGravatar extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: @@ -117,7 +118,7 @@ class modGravatar extends DolibarrModules // Main menu entries $this->menu = array(); // List of menus to add - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here entries to declare new menus // Example to declare the Top Menu entry: From 75c1556a4f49de9929a5e983bc277ff23bca5227 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:03 +0100 Subject: [PATCH 071/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modHRM.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modHRM.class.php b/htdocs/core/modules/modHRM.class.php index 927325431fd..b2daca3d2f6 100644 --- a/htdocs/core/modules/modHRM.class.php +++ b/htdocs/core/modules/modHRM.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,7 +126,7 @@ class modHRM extends DolibarrModules // Array to add new pages in new tabs $this->tabs = array(); - $this->tabs[] = array('data'=>'user:+skill_tab:Skills:hrm:1:/hrm/skill_tab.php?id=__ID__&objecttype=user'); // To add a new tab identified by code tabname1 + $this->tabs[] = array('data' => 'user:+skill_tab:Skills:hrm:1:/hrm/skill_tab.php?id=__ID__&objecttype=user'); // To add a new tab identified by code tabname1 //$this->tabs[] = array('data'=>'job:+tabname1:Poste:mylangfile@hrm:1:/hrm/poste_list.php?fk_job=__ID__'); // To add a new tab identified by code tabname1 // Example: // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@hrm:$user->rights->hrm->read:/hrm/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 @@ -190,7 +191,7 @@ class modHRM extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Skill / Job / Position $this->rights[$r][0] = 4001; // Permission id (must not be already used) From f929da1d0e25feb271db63db547c6246e76f486f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:06 +0100 Subject: [PATCH 072/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modHoliday.class.php | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 6aadda390dd..a974f86e95a 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Dimitri Mouillard * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,7 +93,7 @@ class modHoliday extends DolibarrModules // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0), // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) ); $this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities') - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->const[$r][0] = "HOLIDAY_ADDON"; $this->const[$r][1] = "chaine"; @@ -155,7 +156,7 @@ class modHoliday extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->rights[$r][0] = 20001; // Permission id (must not be already used) $this->rights[$r][1] = 'Read leave requests (yours and your subordinates)'; // Permission label @@ -221,26 +222,26 @@ class modHoliday extends DolibarrModules $this->export_icon[$r] = 'holiday'; $this->export_permission[$r] = array(array("holiday", "readall")); $this->export_fields_array[$r] = array( - 'd.rowid'=>"LeaveId", 'd.fk_type'=>'TypeOfLeaveId', 't.code'=>'TypeOfLeaveCode', 't.label'=>'TypeOfLeaveLabel', 'd.fk_user'=>'UserID', - 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.halfday'=>'HalfDay', 'none.num_open_days'=>'NbUseDaysCP', - 'd.date_valid'=>'DateApprove', 'd.fk_validator'=>"UserForApprovalID", - 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", - 'ua.lastname'=>"UserForApprovalLastname", 'ua.firstname'=>"UserForApprovalFirstname", - 'ua.login'=>"UserForApprovalLogin", 'd.description'=>'Description', 'd.statut'=>'Status' + 'd.rowid' => "LeaveId", 'd.fk_type' => 'TypeOfLeaveId', 't.code' => 'TypeOfLeaveCode', 't.label' => 'TypeOfLeaveLabel', 'd.fk_user' => 'UserID', + 'd.date_debut' => 'DateStart', 'd.date_fin' => 'DateEnd', 'd.halfday' => 'HalfDay', 'none.num_open_days' => 'NbUseDaysCP', + 'd.date_valid' => 'DateApprove', 'd.fk_validator' => "UserForApprovalID", + 'u.lastname' => 'Lastname', 'u.firstname' => 'Firstname', 'u.login' => "Login", + 'ua.lastname' => "UserForApprovalLastname", 'ua.firstname' => "UserForApprovalFirstname", + 'ua.login' => "UserForApprovalLogin", 'd.description' => 'Description', 'd.statut' => 'Status' ); $this->export_TypeFields_array[$r] = array( - 'd.rowid'=>"Numeric", 't.code'=>'Text', 't.label'=>'Text', 'd.fk_user'=>'Numeric', - 'd.date_debut'=>'Date', 'd.date_fin'=>'Date', 'none.num_open_days'=>'NumericCompute', - 'd.date_valid'=>'Date', 'd.fk_validator'=>"Numeric", - 'u.lastname'=>'Text', 'u.firstname'=>'Text', 'u.login'=>"Text", - 'ua.lastname'=>"Text", 'ua.firstname'=>"Text", - 'ua.login'=>"Text", 'd.description'=>'Text', 'd.statut'=>'Numeric' + 'd.rowid' => "Numeric", 't.code' => 'Text', 't.label' => 'Text', 'd.fk_user' => 'Numeric', + 'd.date_debut' => 'Date', 'd.date_fin' => 'Date', 'none.num_open_days' => 'NumericCompute', + 'd.date_valid' => 'Date', 'd.fk_validator' => "Numeric", + 'u.lastname' => 'Text', 'u.firstname' => 'Text', 'u.login' => "Text", + 'ua.lastname' => "Text", 'ua.firstname' => "Text", + 'ua.login' => "Text", 'd.description' => 'Text', 'd.statut' => 'Numeric' ); $this->export_entities_array[$r] = array( - 'u.lastname'=>'user', 'u.firstname'=>'user', 'u.login'=>'user', 'ua.lastname'=>'user', 'ua.firstname'=>'user', 'ua.login'=>'user' + 'u.lastname' => 'user', 'u.firstname' => 'user', 'u.login' => 'user', 'ua.lastname' => 'user', 'ua.firstname' => 'user', 'ua.login' => 'user' ); //$this->export_alias_array[$r] = array('d.rowid'=>"idholiday"); - $this->export_special_array[$r] = array('none.num_open_days'=>'getNumOpenDays'); + $this->export_special_array[$r] = array('none.num_open_days' => 'getNumOpenDays'); $this->export_dependencies_array[$r] = array(); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect = 'holiday'; From cbc0fd1f5d92f5d55df7a79ab84cef84a0123662 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:09 +0100 Subject: [PATCH 073/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modIncoterm.class.php | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index dccaa02aef4..87d0b6da464 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -84,16 +85,16 @@ class modIncoterm extends DolibarrModules $conf->incoterm->enabled = 0; } $this->dictionaries = array( - 'langs'=>'incoterm', - 'tabname'=>array("c_incoterms"), // List of tables we want to see into dictonnary editor - 'tablib'=>array("Incoterms"), // Label of tables - 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields - 'tabsqlsort'=>array("rowid ASC"), // Sort order - 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary) - 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) - 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) - 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->incoterm->enabled), + 'langs' => 'incoterm', + 'tabname' => array("c_incoterms"), // List of tables we want to see into dictonnary editor + 'tablib' => array("Incoterms"), // Label of tables + 'tabsql' => array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields + 'tabsqlsort' => array("rowid ASC"), // Sort order + 'tabfield' => array("code,libelle"), // List of fields (result of select to show dictionary) + 'tabfieldvalue' => array("code,libelle"), // List of fields (list of fields to edit a record) + 'tabfieldinsert' => array("code,libelle"), // List of fields (list of fields for insert) + 'tabrowid' => array("rowid"), // Name of columns with primary key (try to always name it 'rowid') + 'tabcond' => array($conf->incoterm->enabled), 'tabhelp' => array(array()) ); @@ -102,10 +103,10 @@ class modIncoterm extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Main menu entries $this->menu = array(); // List of menus to add - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } } From a32d69d68d3d65b869f392e3b1a22b5f358162a2 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:12 +0100 Subject: [PATCH 074/130] Fix PhanPluginRedundantAssignment --- .../modules/modKnowledgeManagement.class.php | 83 ++++++++++--------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index cec8cfcc3fd..37784bdeb8d 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2021 Frédéric France * Copyright (C) 2021 SuperAdmin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -280,66 +281,66 @@ class modKnowledgeManagement extends DolibarrModules */ /* END MODULEBUILDER TOPMENU */ - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=ticket', + 'fk_menu' => 'fk_mainmenu=ticket', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'MenuKnowledgeRecord', + 'type' => 'left', + 'titre' => 'MenuKnowledgeRecord', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em092"'), - 'mainmenu'=>'ticket', - 'leftmenu'=>'knowledgemanagement_knowledgerecord', - 'url'=>'/knowledgemanagement/knowledgerecord_list.php', + 'mainmenu' => 'ticket', + 'leftmenu' => 'knowledgemanagement_knowledgerecord', + 'url' => '/knowledgemanagement/knowledgerecord_list.php', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'knowledgemanagement', - 'position'=>101, + 'langs' => 'knowledgemanagement', + 'position' => 101, // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->knowledgemanagement->enabled', + 'enabled' => '$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read', - 'target'=>'', + 'perms' => '$user->rights->knowledgemanagement->knowledgerecord->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2, + 'user' => 2, ); - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord', + 'fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'ListKnowledgeRecord', - 'mainmenu'=>'ticket', - 'leftmenu'=>'knowledgemanagement_list', - 'url'=>'/knowledgemanagement/knowledgerecord_list.php', + 'type' => 'left', + 'titre' => 'ListKnowledgeRecord', + 'mainmenu' => 'ticket', + 'leftmenu' => 'knowledgemanagement_list', + 'url' => '/knowledgemanagement/knowledgerecord_list.php', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'knowledgemanagement', - 'position'=>111, + 'langs' => 'knowledgemanagement', + 'position' => 111, // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->knowledgemanagement->enabled', + 'enabled' => '$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read', - 'target'=>'', + 'perms' => '$user->rights->knowledgemanagement->knowledgerecord->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2, + 'user' => 2, ); - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord', + 'fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'NewKnowledgeRecord', - 'mainmenu'=>'ticket', - 'leftmenu'=>'knowledgemanagement_new', - 'url'=>'/knowledgemanagement/knowledgerecord_card.php?action=create', + 'type' => 'left', + 'titre' => 'NewKnowledgeRecord', + 'mainmenu' => 'ticket', + 'leftmenu' => 'knowledgemanagement_new', + 'url' => '/knowledgemanagement/knowledgerecord_card.php?action=create', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'knowledgemanagement', - 'position'=>110, + 'langs' => 'knowledgemanagement', + 'position' => 110, // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->knowledgemanagement->enabled', + 'enabled' => '$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->hasRight("knowledgemanagement", "knowledgerecord", "write")', - 'target'=>'', + 'perms' => '$user->hasRight("knowledgemanagement", "knowledgerecord", "write")', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2 + 'user' => 2 ); $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord', @@ -389,7 +390,7 @@ class modKnowledgeManagement extends DolibarrModules /* END MODULEBUILDER EXPORT KNOWLEDGERECORD */ // Imports profiles provided by this module - $r = 1; + $r = 1; // @phan-suppress-current-line PhanPluginRedundantAssignment /* BEGIN MODULEBUILDER IMPORT KNOWLEDGERECORD */ /* $langs->load("knowledgemanagement"); @@ -443,7 +444,7 @@ class modKnowledgeManagement extends DolibarrModules // Document templates $moduledir = 'knowledgemanagement'; $myTmpObjects = array(); - $myTmpObjects['KnowledgeRecord'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); + $myTmpObjects['KnowledgeRecord'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'KnowledgeRecord') { From 10f0cc700d2b602d571740cfc398ae8d8d8c73e7 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:15 +0100 Subject: [PATCH 075/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modMargin.class.php | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 3f88584d3bf..f1a324f3114 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Marcos García + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,7 +82,7 @@ class modMargin extends DolibarrModules // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); - $this->const = array(0=>array('MARGIN_TYPE', 'chaine', 'costprice', 'Rule for margin calculation by default', 0, 'current', 0)); // List of particular constants to add when module is enabled + $this->const = array(0 => array('MARGIN_TYPE', 'chaine', 'costprice', 'Rule for margin calculation by default', 0, 'current', 0)); // List of particular constants to add when module is enabled // New pages on tabs $this->tabs = array( @@ -96,27 +97,27 @@ class modMargin extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Main menu entries $this->menu = array(); // List of menus to add - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // left menu entry $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>'Margins', + 'fk_menu' => 'fk_mainmenu=billing', // Put 0 if this is a top menu + 'type' => 'left', // This is a Top menu entry + 'titre' => 'Margins', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'billing', - 'leftmenu'=>'margins', - 'url'=>'/margin/index.php', - 'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>100, - 'enabled'=>'isModEnabled("margin")', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => 'billing', + 'leftmenu' => 'margins', + 'url' => '/margin/index.php', + 'langs' => 'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 100, + 'enabled' => 'isModEnabled("margin")', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $r++; From 859301523c69641f3c4a772af9be007648f6966e Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:18 +0100 Subject: [PATCH 076/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modOauth.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index fcfa34e3fa9..7ffa5157c66 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Frederic France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +103,7 @@ class modOauth extends DolibarrModules // Main menu entries $this->menu = array(); // List of menus to add - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // This is to declare the Top Menu entry: //$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu From c5b2bc126570fa465a6a9c92fd3baa5017b79d1f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:21 +0100 Subject: [PATCH 077/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modOpenSurvey.class.php | 75 +++++++++++---------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 237e5086a30..e9def30529b 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +96,7 @@ class modOpenSurvey extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: @@ -120,51 +121,51 @@ class modOpenSurvey extends DolibarrModules //------- $r = 0; $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', - 'titre'=>'Survey', + 'fk_menu' => 'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', + 'titre' => 'Survey', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'tools', - 'leftmenu'=>'opensurvey', - 'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey', - 'langs'=>'opensurvey', - 'position'=>200, - 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->opensurvey->read', - 'target'=>'', - 'user'=>0, + 'mainmenu' => 'tools', + 'leftmenu' => 'opensurvey', + 'url' => '/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey', + 'langs' => 'opensurvey', + 'position' => 200, + 'enabled' => '$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->rights->opensurvey->read', + 'target' => '', + 'user' => 0, ); $r++; $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', - 'titre'=>'NewSurvey', - 'mainmenu'=>'tools', - 'leftmenu'=>'opensurvey_new', - 'url'=>'/opensurvey/wizard/index.php', - 'langs'=>'opensurvey', - 'position'=>210, - 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->opensurvey->write', - 'target'=>'', - 'user'=>0, + 'fk_menu' => 'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', + 'titre' => 'NewSurvey', + 'mainmenu' => 'tools', + 'leftmenu' => 'opensurvey_new', + 'url' => '/opensurvey/wizard/index.php', + 'langs' => 'opensurvey', + 'position' => 210, + 'enabled' => '$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->rights->opensurvey->write', + 'target' => '', + 'user' => 0, ); $r++; $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', - 'titre'=>'List', - 'mainmenu'=>'tools', - 'leftmenu'=>'opensurvey_list', - 'url'=>'/opensurvey/list.php', - 'langs'=>'opensurvey', - 'position'=>220, - 'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->opensurvey->read', - 'target'=>'', - 'user'=>0, + 'fk_menu' => 'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', + 'titre' => 'List', + 'mainmenu' => 'tools', + 'leftmenu' => 'opensurvey_list', + 'url' => '/opensurvey/list.php', + 'langs' => 'opensurvey', + 'position' => 220, + 'enabled' => '$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->rights->opensurvey->read', + 'target' => '', + 'user' => 0, ); $r++; } From 708ab58b269e24b4d55c347ae873f83f7ef89047 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:24 +0100 Subject: [PATCH 078/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modPartnership.class.php | 157 ++++++++++--------- 1 file changed, 79 insertions(+), 78 deletions(-) diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index be6da6264f2..e03a1a666d3 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2019-2021 Frédéric France * Copyright (C) 2021 Dorian Laurent * Copyright (C) 2021 NextGestion + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -211,28 +212,28 @@ class modPartnership extends DolibarrModules // 'user' to add a tab in user view // Dictionaries - $this->dictionaries=array( - 'langs'=>'partnership', + $this->dictionaries = array( + 'langs' => 'partnership', // List of tables we want to see into dictonnary editor - 'tabname'=>array("c_partnership_type"), + 'tabname' => array("c_partnership_type"), // Label of tables - 'tablib'=>array("PartnershipType"), + 'tablib' => array("PartnershipType"), // Request to select fields - 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.keyword, f.active FROM '.MAIN_DB_PREFIX.'c_partnership_type as f WHERE f.entity = '.((int) $conf->entity)), + 'tabsql' => array('SELECT f.rowid as rowid, f.code, f.label, f.keyword, f.active FROM '.MAIN_DB_PREFIX.'c_partnership_type as f WHERE f.entity = '.((int) $conf->entity)), // Sort order - 'tabsqlsort'=>array("label ASC"), + 'tabsqlsort' => array("label ASC"), // List of fields (result of select to show dictionary) - 'tabfield'=>array("code,label,keyword"), + 'tabfield' => array("code,label,keyword"), // List of fields (list of fields to edit a record) - 'tabfieldvalue'=>array("code,label,keyword"), + 'tabfieldvalue' => array("code,label,keyword"), // List of fields (list of fields for insert) - 'tabfieldinsert'=>array("code,label,keyword"), + 'tabfieldinsert' => array("code,label,keyword"), // Name of columns with primary key (try to always name it 'rowid') - 'tabrowid'=>array("rowid"), + 'tabrowid' => array("rowid"), // Condition to show each dictionary - 'tabcond'=>array($conf->partnership->enabled), + 'tabcond' => array($conf->partnership->enabled), // Help tooltip for each fields of the dictionary - 'tabhelp'=>array(array('keyword'=>$langs->trans('KeywordToCheckInWebsite'))) + 'tabhelp' => array(array('keyword' => $langs->trans('KeywordToCheckInWebsite'))) ); // Boxes/Widgets @@ -249,39 +250,39 @@ class modPartnership extends DolibarrModules // Cronjobs (List of cron jobs entries to add when module is enabled) // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week - $arraydate=dol_getdate(dol_now()); - $datestart=dol_mktime(21, 15, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); + $arraydate = dol_getdate(dol_now()); + $datestart = dol_mktime(21, 15, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0 => array( - 'priority'=>60, - 'label'=>'CancelPartnershipForExpiredMembers', - 'jobtype'=>'method', - 'class'=>'/partnership/class/partnershiputils.class.php', - 'objectname'=>'PartnershipUtils', - 'method'=>'doCancelStatusOfMemberPartnership', - 'parameters'=>'', - 'comment'=>'Cancel status of partnership when subscription is expired + x days.', - 'frequency'=>1, - 'unitfrequency'=>86400, - 'status'=>1, - 'test'=>'isModEnabled("partnership")', - 'datestart'=>$datestart + 'priority' => 60, + 'label' => 'CancelPartnershipForExpiredMembers', + 'jobtype' => 'method', + 'class' => '/partnership/class/partnershiputils.class.php', + 'objectname' => 'PartnershipUtils', + 'method' => 'doCancelStatusOfMemberPartnership', + 'parameters' => '', + 'comment' => 'Cancel status of partnership when subscription is expired + x days.', + 'frequency' => 1, + 'unitfrequency' => 86400, + 'status' => 1, + 'test' => 'isModEnabled("partnership")', + 'datestart' => $datestart ), 1 => array( - 'priority'=>61, - 'label'=>'PartnershipCheckBacklink', - 'jobtype'=>'method', - 'class'=>'/partnership/class/partnershiputils.class.php', - 'objectname'=>'PartnershipUtils', - 'method'=>'doWarningOfPartnershipIfDolibarrBacklinkNotfound', - 'parameters'=>'', - 'comment'=>'Add a warning on partnership record if the backlink keyword is not found on the partner website.', - 'frequency'=>1, - 'unitfrequency'=>86400, - 'status'=>0, - 'test'=>'isModEnabled("partnership")', - 'datestart'=>$datestart + 'priority' => 61, + 'label' => 'PartnershipCheckBacklink', + 'jobtype' => 'method', + 'class' => '/partnership/class/partnershiputils.class.php', + 'objectname' => 'PartnershipUtils', + 'method' => 'doWarningOfPartnershipIfDolibarrBacklinkNotfound', + 'parameters' => '', + 'comment' => 'Add a warning on partnership record if the backlink keyword is not found on the partner website.', + 'frequency' => 1, + 'unitfrequency' => 86400, + 'status' => 0, + 'test' => 'isModEnabled("partnership")', + 'datestart' => $datestart ), ); @@ -330,47 +331,47 @@ class modPartnership extends DolibarrModules // 'user'=>2, // ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu='.$fk_mainmenu, // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Top menu entry - 'titre'=>'Partnership', + 'fk_menu' => 'fk_mainmenu='.$fk_mainmenu, // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Top menu entry + 'titre' => 'Partnership', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>$fk_mainmenu, - 'leftmenu'=>'partnership', - 'url'=>'/partnership/partnership_list.php', - 'langs'=>'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1100 + $r, - 'enabled'=>'$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->partnership->read', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => $fk_mainmenu, + 'leftmenu' => 'partnership', + 'url' => '/partnership/partnership_list.php', + 'langs' => 'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1100 + $r, + 'enabled' => '$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->rights->partnership->read', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu='.$fk_mainmenu.',fk_leftmenu=partnership', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'NewPartnership', - 'mainmenu'=>$fk_mainmenu, - 'leftmenu'=>'partnership_new', - 'url'=>'/partnership/partnership_card.php?action=create', - 'langs'=>'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1100 + $r, - 'enabled'=>'$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->partnership->write', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu='.$fk_mainmenu.',fk_leftmenu=partnership', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'NewPartnership', + 'mainmenu' => $fk_mainmenu, + 'leftmenu' => 'partnership_new', + 'url' => '/partnership/partnership_card.php?action=create', + 'langs' => 'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1100 + $r, + 'enabled' => '$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->partnership->write', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu='.$fk_mainmenu.',fk_leftmenu=partnership', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'ListOfPartnerships', - 'mainmenu'=>$fk_mainmenu, - 'leftmenu'=>'partnership_list', - 'url'=>'/partnership/partnership_list.php', - 'langs'=>'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1100 + $r, - 'enabled'=>'$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->partnership->read', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu='.$fk_mainmenu.',fk_leftmenu=partnership', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'ListOfPartnerships', + 'mainmenu' => $fk_mainmenu, + 'leftmenu' => 'partnership_list', + 'url' => '/partnership/partnership_list.php', + 'langs' => 'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1100 + $r, + 'enabled' => '$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->partnership->read', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); /* END MODULEBUILDER LEFTMENU PARTNERSHIP */ // Exports profiles provided by this module @@ -405,7 +406,7 @@ class modPartnership extends DolibarrModules /* END MODULEBUILDER EXPORT PARTNERSHIP */ // Imports profiles provided by this module - $r = 1; + $r = 1; // @phan-suppress-current-line PhanPluginRedundantAssignment /* BEGIN MODULEBUILDER IMPORT PARTNERSHIP */ /* $langs->load("partnership"); @@ -459,7 +460,7 @@ class modPartnership extends DolibarrModules // Document templates $moduledir = dol_sanitizeFileName('partnership'); $myTmpObjects = array(); - $myTmpObjects['Partnership'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); + $myTmpObjects['Partnership'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'Partnership') { From bde6702b28557f1639c8dd2e35ccd5fb256a474a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:27 +0100 Subject: [PATCH 079/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modPaybox.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modPaybox.class.php b/htdocs/core/modules/modPaybox.class.php index eeb3dc00e6c..263ffdfe490 100644 --- a/htdocs/core/modules/modPaybox.class.php +++ b/htdocs/core/modules/modPaybox.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +101,7 @@ class modPaybox extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: @@ -114,7 +115,7 @@ class modPaybox extends DolibarrModules // Main menu entries $this->menu = array(); // List of menus to add - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here entries to declare new menus // Example to declare the Top Menu entry: From 6d7fe53d17b67569f714c20b500774d41c051e13 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:29 +0100 Subject: [PATCH 080/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modPaymentByBankTransfer.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modPaymentByBankTransfer.class.php b/htdocs/core/modules/modPaymentByBankTransfer.class.php index 1118b81f193..8fbecdc97d8 100644 --- a/htdocs/core/modules/modPaymentByBankTransfer.class.php +++ b/htdocs/core/modules/modPaymentByBankTransfer.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -90,7 +91,7 @@ class modPaymentByBankTransfer extends DolibarrModules // Permissions $this->rights = array(); $this->rights_class = 'paymentbybanktransfer'; - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $r++; $this->rights[$r][0] = 561; $this->rights[$r][1] = 'Read bank transfer payment orders'; From 3a561d2e379f0c8be152e0c9ddaeadeeb3bd9f0f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:32 +0100 Subject: [PATCH 081/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modPaypal.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modPaypal.class.php b/htdocs/core/modules/modPaypal.class.php index 8d2a98c67e7..e284195ebcc 100644 --- a/htdocs/core/modules/modPaypal.class.php +++ b/htdocs/core/modules/modPaypal.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,12 +102,12 @@ class modPaypal extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Main menu entries $this->menu = array(); // List of menus to add - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment /*$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'mainmenu'=>'billing', From d415980074d45094f0a4232ce4125656a9c9a465 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:35 +0100 Subject: [PATCH 082/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modProduct.class.php | 423 ++++++++++++----------- 1 file changed, 212 insertions(+), 211 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 28b5f19174c..836d36f4d4d 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2014 Christophe Battarel * Copyright (C) 2014 Cedric Gross * Copyright (C) 2020-2021 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,9 +104,9 @@ class modProduct extends DolibarrModules // Boxes $this->boxes = array( - 0=>array('file'=>'box_produits.php', 'enabledbydefaulton'=>'Home'), - 1=>array('file'=>'box_produits_alerte_stock.php', 'enabledbydefaulton'=>'Home'), - 2=>array('file'=>'box_graph_product_distribution.php', 'enabledbydefaulton'=>'Home') + 0 => array('file' => 'box_produits.php', 'enabledbydefaulton' => 'Home'), + 1 => array('file' => 'box_produits_alerte_stock.php', 'enabledbydefaulton' => 'Home'), + 2 => array('file' => 'box_graph_product_distribution.php', 'enabledbydefaulton' => 'Home') ); // Permissions @@ -191,115 +192,115 @@ class modProduct extends DolibarrModules $this->export_label[$r] = "Products"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("produit", "export")); $this->export_fields_array[$r] = array( - 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", - 'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy", - 'p.description'=>"Description", 'p.url'=>"PublicUrl", - 'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry', - $alias_product_perentity . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", - $alias_product_perentity . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy'=>"ProductAccountancyBuyCode", - $alias_product_perentity . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode", - 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic', - 'p.weight'=>"Weight", 'p.weight_units'=>"WeightUnits", 'p.length'=>"Length", 'p.length_units'=>"LengthUnits", 'p.width'=>"Width", 'p.width_units'=>"WidthUnits", 'p.height'=>"Height", 'p.height_units'=>"HeightUnits", - 'p.surface'=>"Surface", 'p.surface_units'=>"SurfaceUnits", 'p.volume'=>"Volume", 'p.volume_units'=>"VolumeUnits", - 'p.duration'=>"Duration", + 'p.rowid' => "Id", 'p.ref' => "Ref", 'p.label' => "Label", + 'p.fk_product_type' => 'Type', 'p.tosell' => "OnSell", 'p.tobuy' => "OnBuy", + 'p.description' => "Description", 'p.url' => "PublicUrl", + 'p.customcode' => 'CustomCode', 'p.fk_country' => 'IDCountry', + $alias_product_perentity . '.accountancy_code_sell' => "ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", + $alias_product_perentity . '.accountancy_code_sell_export' => "ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy' => "ProductAccountancyBuyCode", + $alias_product_perentity . '.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode", + 'p.note' => "NotePrivate", 'p.note_public' => 'NotePublic', + 'p.weight' => "Weight", 'p.weight_units' => "WeightUnits", 'p.length' => "Length", 'p.length_units' => "LengthUnits", 'p.width' => "Width", 'p.width_units' => "WidthUnits", 'p.height' => "Height", 'p.height_units' => "HeightUnits", + 'p.surface' => "Surface", 'p.surface_units' => "SurfaceUnits", 'p.volume' => "Volume", 'p.volume_units' => "VolumeUnits", + 'p.duration' => "Duration", 'p.finished' => 'Nature', - 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", - 'p.price_min'=>"MinPriceHT",'p.price_min_ttc'=>"MinPriceTTC", - 'p.tva_tx'=>'VATRate', - 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' + 'p.price_base_type' => "PriceBase", 'p.price' => "UnitPriceHT", 'p.price_ttc' => "UnitPriceTTC", + 'p.price_min' => "MinPriceHT",'p.price_min_ttc' => "MinPriceTTC", + 'p.tva_tx' => 'VATRate', + 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification' ); if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR'; } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price' => 'CostPrice')); } if (isModEnabled('stock')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('e.ref'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', 'p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('e.ref' => 'DefaultWarehouse', 'p.tobatch' => 'ManageLotSerial', 'p.stock' => 'Stock', 'p.seuil_stock_alerte' => 'StockLimit', 'p.desiredstock' => 'DesiredStock', 'p.pmp' => 'PMPValue')); } if (isModEnabled('barcode')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); } $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom' => 'Supplier', 'pf.ref_fourn' => 'SupplierRef', 'pf.quantity' => 'QtyMin', 'pf.remise_percent' => 'DiscountQtyMin', 'pf.unitprice' => 'BuyingPrice', 'pf.delivery_time_days' => 'NbDaysToDelivery')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)' => 'Categories')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang' => 'Language', 'l.label' => 'TranslatedLabel', 'l.description' => 'TranslatedDescription', 'l.note' => 'TranslatedNote')); } if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; } $this->export_TypeFields_array[$r] = array( - 'p.ref'=>"Text", 'p.label'=>"Text", - 'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", - 'p.description'=>"Text", 'p.url'=>"Text", - $alias_product_perentity . '.accountancy_code_sell'=>"Text", $alias_product_perentity . '.accountancy_code_sell_intra'=>"Text", $alias_product_perentity . '.accountancy_code_sell_export'=>"Text", - $alias_product_perentity . '.accountancy_code_buy'=>"Text", $alias_product_perentity . '.accountancy_code_buy_intra'=>"Text", $alias_product_perentity . '.accountancy_code_buy_export'=>"Text", - 'p.note'=>"Text", 'p.note_public'=>"Text", - 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", - 'p.customcode'=>'Text', - 'p.duration'=>"Text", + 'p.ref' => "Text", 'p.label' => "Text", + 'p.fk_product_type' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", + 'p.description' => "Text", 'p.url' => "Text", + $alias_product_perentity . '.accountancy_code_sell' => "Text", $alias_product_perentity . '.accountancy_code_sell_intra' => "Text", $alias_product_perentity . '.accountancy_code_sell_export' => "Text", + $alias_product_perentity . '.accountancy_code_buy' => "Text", $alias_product_perentity . '.accountancy_code_buy_intra' => "Text", $alias_product_perentity . '.accountancy_code_buy_export' => "Text", + 'p.note' => "Text", 'p.note_public' => "Text", + 'p.weight' => "Numeric", 'p.length' => "Numeric", 'p.width' => "Numeric", 'p.height' => "Numeric", 'p.surface' => "Numeric", 'p.volume' => "Numeric", + 'p.customcode' => 'Text', + 'p.duration' => "Text", 'p.finished' => 'Numeric', - 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", - 'p.price_min'=>"Numeric", 'p.price_min_ttc'=>"Numeric", - 'p.tva_tx'=>'Numeric', - 'p.datec'=>'Date', 'p.tms'=>'Date' + 'p.price_base_type' => "Text", 'p.price' => "Numeric", 'p.price_ttc' => "Numeric", + 'p.price_min' => "Numeric", 'p.price_min_ttc' => "Numeric", + 'p.tva_tx' => 'Numeric', + 'p.datec' => 'Date', 'p.tms' => 'Date' ); if (isModEnabled('stock')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref'=>'Text', 'p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref' => 'Text', 'p.tobatch' => 'Numeric', 'p.stock' => 'Numeric', 'p.seuil_stock_alerte' => 'Numeric', 'p.desiredstock' => 'Numeric', 'p.pmp' => 'Numeric', 'p.cost_price' => 'Numeric')); } if (isModEnabled('barcode')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom' => 'Text', 'pf.ref_fourn' => 'Text', 'pf.unitprice' => 'Numeric', 'pf.quantity' => 'Numeric', 'pf.remise_percent' => 'Numeric', 'pf.delivery_time_days' => 'Numeric')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang' => 'Text', 'l.label' => 'Text', 'l.description' => 'Text', 'l.note' => 'Text')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)" => 'Text')); } $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)" => 'category')); } if (isModEnabled('stock')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock' => 'product', 'p.pmp' => 'product')); } if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom' => 'product_supplier_ref', 'pf.ref_fourn' => 'product_supplier_ref', 'pf.unitprice' => 'product_supplier_ref', 'pf.quantity' => 'product_supplier_ref', 'pf.remise_percent' => 'product_supplier_ref', 'pf.delivery_time_days' => 'product_supplier_ref')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang' => 'translation', 'l.label' => 'translation', 'l.description' => 'translation', 'l.note' => 'translation')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_dependencies_array[$r] = array('category'=>'p.rowid'); + $this->export_dependencies_array[$r] = array('category' => 'p.rowid'); } if (isModEnabled('stock')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock' => 'product', 'p.pmp' => 'product')); } if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom' => 'product_supplier_ref', 'pf.ref_fourn' => 'product_supplier_ref', 'pf.unitprice' => 'product_supplier_ref', 'pf.quantity' => 'product_supplier_ref', 'pf.remise_percent' => 'product_supplier_ref', 'pf.delivery_time_days' => 'product_supplier_ref')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang' => 'translation', 'l.label' => 'translation', 'l.description' => 'translation', 'l.note' => 'translation')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_dependencies_array[$r] = array('category'=>'p.rowid'); + $this->export_dependencies_array[$r] = array('category' => 'p.rowid'); } $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; @@ -330,12 +331,12 @@ class modProduct extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("produit", "export")); - $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", - 'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel", - 'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", - 'pr.tva_tx'=>'PriceLevelVATRate', - 'pr.date_price'=>'DateCreation'); + $this->export_fields_array[$r] = array('p.rowid' => "Id", 'p.ref' => "Ref", 'p.label' => "Label", + 'pr.price_base_type' => "PriceBase", 'pr.price_level' => "PriceLevel", + 'pr.price' => "PriceLevelUnitPriceHT", 'pr.price_ttc' => "PriceLevelUnitPriceTTC", + 'pr.price_min' => "MinPriceLevelUnitPriceHT", 'pr.price_min_ttc' => "MinPriceLevelUnitPriceTTC", + 'pr.tva_tx' => 'PriceLevelVATRate', + 'pr.date_price' => 'DateCreation'); if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR'; } @@ -345,13 +346,13 @@ class modProduct extends DolibarrModules // 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean", // 'p.datec'=>'Date','p.tms'=>'Date' //); - $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", 'p.label'=>"Label", - 'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product", - 'pr.price_ttc'=>"product", - 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product", - 'pr.tva_tx'=>'product', - 'pr.recuperableonly'=>'product', - 'pr.date_price'=>"product"); + $this->export_entities_array[$r] = array('p.rowid' => "product", 'p.ref' => "product", 'p.label' => "Label", + 'pr.price_base_type' => "product", 'pr.price_level' => "product", 'pr.price' => "product", + 'pr.price_ttc' => "product", + 'pr.price_min' => "product", 'pr.price_min_ttc' => "product", + 'pr.tva_tx' => 'product', + 'pr.recuperableonly' => 'product', + 'pr.date_price' => "product"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity @@ -366,28 +367,28 @@ class modProduct extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("produit", "export")); - $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", - 's.nom'=>'ThirdParty', - 's.code_client'=>'CodeClient', - 'pr.price_base_type'=>"PriceBase", - 'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC", - 'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC", - 'pr.tva_tx'=>'PriceVATRate', - 'pr.default_vat_code'=>'PriceVATCode', - 'pr.datec'=>'DateCreation'); + $this->export_fields_array[$r] = array('p.rowid' => "Id", 'p.ref' => "Ref", 'p.label' => "Label", + 's.nom' => 'ThirdParty', + 's.code_client' => 'CodeClient', + 'pr.price_base_type' => "PriceBase", + 'pr.price' => "PriceUnitPriceHT", 'pr.price_ttc' => "PriceUnitPriceTTC", + 'pr.price_min' => "MinPriceUnitPriceHT", 'pr.price_min_ttc' => "MinPriceUnitPriceTTC", + 'pr.tva_tx' => 'PriceVATRate', + 'pr.default_vat_code' => 'PriceVATCode', + 'pr.datec' => 'DateCreation'); if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR'; } - $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", 'p.label'=>"Label", - 's.nom'=>'company', - 's.code_client'=>'company', - 'pr.price_base_type'=>"product", 'pr.price'=>"product", - 'pr.price_ttc'=>"product", - 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product", - 'pr.tva_tx'=>'product', - 'pr.default_vat_code'=>'product', - 'pr.recuperableonly'=>'product', - 'pr.datec'=>"product"); + $this->export_entities_array[$r] = array('p.rowid' => "product", 'p.ref' => "product", 'p.label' => "Label", + 's.nom' => 'company', + 's.code_client' => 'company', + 'pr.price_base_type' => "product", 'pr.price' => "product", + 'pr.price_ttc' => "product", + 'pr.price_min' => "product", 'pr.price_min_ttc' => "product", + 'pr.tva_tx' => 'product', + 'pr.default_vat_code' => 'product', + 'pr.recuperableonly' => 'product', + 'pr.datec' => "product"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity @@ -402,66 +403,66 @@ class modProduct extends DolibarrModules $this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("produit", "export")); $this->export_fields_array[$r] = array( - 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl", - $alias_product_perentity . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", - $alias_product_perentity . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy'=>"ProductAccountancyBuyCode", - $alias_product_perentity . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode", - 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic', - 'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode', - 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell", - 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' + 'p.rowid' => "Id", 'p.ref' => "Ref", 'p.label' => "Label", 'p.description' => "Description", 'p.url' => "PublicUrl", + $alias_product_perentity . '.accountancy_code_sell' => "ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", + $alias_product_perentity . '.accountancy_code_sell_export' => "ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy' => "ProductAccountancyBuyCode", + $alias_product_perentity . '.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode", + 'p.note' => "NotePrivate", 'p.note_public' => 'NotePublic', + 'p.weight' => "Weight", 'p.length' => "Length", 'p.surface' => "Surface", 'p.volume' => "Volume", 'p.customcode' => 'CustomCode', + 'p.price_base_type' => "PriceBase", 'p.price' => "UnitPriceHT", 'p.price_ttc' => "UnitPriceTTC", 'p.tva_tx' => 'VATRate', 'p.tosell' => "OnSell", + 'p.tobuy' => "OnBuy", 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification' ); if (isModEnabled('stock')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock' => 'Stock', 'p.seuil_stock_alerte' => 'StockLimit', 'p.desiredstock' => 'DesiredStock', 'p.pmp' => 'PMPValue')); } if (isModEnabled('barcode')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); } - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty' => 'Qty', 'pa.incdec' => 'ComposedProductIncDecStock')); $this->export_TypeFields_array[$r] = array( - 'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text", - $alias_product_perentity . '.accountancy_code_sell'=>"Text", $alias_product_perentity . '.accountancy_code_sell_intra'=>"Text", $alias_product_perentity . '.accountancy_code_sell_export'=>"Text", - $alias_product_perentity . '.accountancy_code_buy'=>"Text", $alias_product_perentity . '.accountancy_code_buy_intra'=>"Text", $alias_product_perentity . '.accountancy_code_buy_export'=>"Text", - 'p.note'=>"Text", 'p.note_public'=>"Text", - 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text', - 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", - 'p.datec'=>'Date', 'p.tms'=>'Date' + 'p.ref' => "Text", 'p.label' => "Text", 'p.description' => "Text", 'p.url' => "Text", + $alias_product_perentity . '.accountancy_code_sell' => "Text", $alias_product_perentity . '.accountancy_code_sell_intra' => "Text", $alias_product_perentity . '.accountancy_code_sell_export' => "Text", + $alias_product_perentity . '.accountancy_code_buy' => "Text", $alias_product_perentity . '.accountancy_code_buy_intra' => "Text", $alias_product_perentity . '.accountancy_code_buy_export' => "Text", + 'p.note' => "Text", 'p.note_public' => "Text", + 'p.weight' => "Numeric", 'p.length' => "Numeric", 'p.surface' => "Numeric", 'p.volume' => "Numeric", 'p.customcode' => 'Text', + 'p.price_base_type' => "Text", 'p.price' => "Numeric", 'p.price_ttc' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", + 'p.datec' => 'Date', 'p.tms' => 'Date' ); if (isModEnabled('stock')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock' => 'Numeric', 'p.seuil_stock_alerte' => 'Numeric', 'p.desiredstock' => 'Numeric', 'p.pmp' => 'Numeric', 'p.cost_price' => 'Numeric')); } if (isModEnabled('barcode')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); } - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty' => 'Numeric')); $this->export_entities_array[$r] = array( - 'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct", - $alias_product_perentity . '.accountancy_code_sell'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_intra'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_export'=>'virtualproduct', - $alias_product_perentity . '.accountancy_code_buy'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_intra'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_export'=>'virtualproduct', - 'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct", - 'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct', - 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct", - 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct" + 'p.rowid' => "virtualproduct", 'p.ref' => "virtualproduct", 'p.label' => "virtualproduct", 'p.description' => "virtualproduct", 'p.url' => "virtualproduct", + $alias_product_perentity . '.accountancy_code_sell' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_intra' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_export' => 'virtualproduct', + $alias_product_perentity . '.accountancy_code_buy' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_intra' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_export' => 'virtualproduct', + 'p.note' => "virtualproduct", 'p.length' => "virtualproduct", + 'p.surface' => "virtualproduct", 'p.volume' => "virtualproduct", 'p.weight' => "virtualproduct", 'p.customcode' => 'virtualproduct', + 'p.price_base_type' => "virtualproduct", 'p.price' => "virtualproduct", 'p.price_ttc' => "virtualproduct", 'p.tva_tx' => "virtualproduct", + 'p.tosell' => "virtualproduct", 'p.tobuy' => "virtualproduct", 'p.datec' => "virtualproduct", 'p.tms' => "virtualproduct" ); if (isModEnabled('stock')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock' => 'virtualproduct', 'p.seuil_stock_alerte' => 'virtualproduct', 'p.desiredstock' => 'virtualproduct', 'p.pmp' => 'virtualproduct')); } if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'virtualproduct')); } - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct')); - $keyforselect = 'product'; - $keyforelement = 'product'; - $keyforaliasextra = 'extra'; + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty' => "subproduct", 'pa.incdec' => 'subproduct')); + $keyforselect = 'product'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforelement = 'product'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description")); - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid' => "Id", 'p2.ref' => "Ref", 'p2.label' => "Label", 'p2.description' => "Description")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid' => "subproduct", 'p2.ref' => "subproduct", 'p2.label' => "subproduct", 'p2.description' => "subproduct")); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2'; $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile $this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils'; @@ -478,8 +479,8 @@ class modProduct extends DolibarrModules $this->import_label[$r] = "Products"; // Translation key $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon - $this->import_tables_array[$r] = array('p'=>MAIN_DB_PREFIX.'product', 'extra'=>MAIN_DB_PREFIX.'product_extrafields'); - $this->import_tables_creator_array[$r] = array('p'=>'fk_user_author'); // Fields to store import user id + $this->import_tables_array[$r] = array('p' => MAIN_DB_PREFIX.'product', 'extra' => MAIN_DB_PREFIX.'product_extrafields'); + $this->import_tables_creator_array[$r] = array('p' => 'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r] = array( 'p.ref' => "Ref*", 'p.label' => "Label*", @@ -578,19 +579,19 @@ class modProduct extends DolibarrModules 'method' => 'fetch', 'dict' => 'DictionaryCountry' ), - 'p.finished'=> array( + 'p.finished' => array( 'rule' => 'fetchidfromcodeorlabel', 'classfile' => '/core/class/cproductnature.class.php', 'class' => 'CProductNature', 'method' => 'fetch', 'dict' => 'DictionaryProductNature' ), - 'p.accountancy_code_sell'=>array('rule'=>'accountingaccount'), - 'p.accountancy_code_sell_intra'=>array('rule'=>'accountingaccount'), - 'p.accountancy_code_sell_export'=>array('rule'=>'accountingaccount'), - 'p.accountancy_code_buy'=>array('rule'=>'accountingaccount'), - 'p.accountancy_code_buy_intra'=>array('rule'=>'accountingaccount'), - 'p.accountancy_code_buy_export'=>array('rule'=>'accountingaccount'), + 'p.accountancy_code_sell' => array('rule' => 'accountingaccount'), + 'p.accountancy_code_sell_intra' => array('rule' => 'accountingaccount'), + 'p.accountancy_code_sell_export' => array('rule' => 'accountingaccount'), + 'p.accountancy_code_buy' => array('rule' => 'accountingaccount'), + 'p.accountancy_code_buy_intra' => array('rule' => 'accountingaccount'), + 'p.accountancy_code_buy_export' => array('rule' => 'accountingaccount'), ); $this->import_regex_array[$r] = array( @@ -605,8 +606,8 @@ class modProduct extends DolibarrModules if (isModEnabled('stock')) {//if Stock module enabled $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( - 'p.fk_default_warehouse'=>'DefaultWarehouse', - 'p.tobatch'=>'ManageLotSerial', + 'p.fk_default_warehouse' => 'DefaultWarehouse', + 'p.tobatch' => 'ManageLotSerial', 'p.seuil_stock_alerte' => 'StockLimit', //lower limit for warning 'p.pmp' => 'PMPValue', //weighted average price 'p.desiredstock' => 'DesiredStock'//desired stock for replenishment feature @@ -622,25 +623,25 @@ class modProduct extends DolibarrModules 'classfile' => '/product/stock/class/entrepot.class.php', 'class' => 'Entrepot', 'method' => 'fetch', - 'element'=> 'Warehouse' + 'element' => 'Warehouse' ) )); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price' => 'CostPrice')); } if (is_object($mysoc) && $usenpr) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.recuperableonly' => 'NPR')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax1_tx' => 'LT1', 'p.localtax1_type' => 'LT1Type')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx' => 'LT2', 'p.localtax2_type' => 'LT2Type')); } if (isModEnabled('barcode')) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode' => 'BarCode')); } if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; @@ -659,7 +660,7 @@ class modProduct extends DolibarrModules } } // End add extra fields - $this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) // field order as per structure of table llx_product $import_sample = array( @@ -705,26 +706,26 @@ class modProduct extends DolibarrModules //clauses copied from import_fields_array if (isModEnabled('stock')) { $import_sample = array_merge($import_sample, array( - 'p.tobatch'=>"0 (don't use) / 1 (use batch) / 2 (use serial number)", + 'p.tobatch' => "0 (don't use) / 1 (use batch) / 2 (use serial number)", 'p.seuil_stock_alerte' => '', 'p.pmp' => '0', 'p.desiredstock' => '' )); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { - $import_sample = array_merge($import_sample, array('p.cost_price'=>'90')); + $import_sample = array_merge($import_sample, array('p.cost_price' => '90')); } if (is_object($mysoc) && $usenpr) { - $import_sample = array_merge($import_sample, array('p.recuperableonly'=>'0')); + $import_sample = array_merge($import_sample, array('p.recuperableonly' => '0')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $import_sample = array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>'')); + $import_sample = array_merge($import_sample, array('p.localtax1_tx' => '', 'p.localtax1_type' => '')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $import_sample = array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>'')); + $import_sample = array_merge($import_sample, array('p.localtax2_tx' => '', 'p.localtax2_type' => '')); } if (isModEnabled('barcode')) { - $import_sample = array_merge($import_sample, array('p.barcode'=>'')); + $import_sample = array_merge($import_sample, array('p.barcode' => '')); } if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $import_sample = array_merge( @@ -745,9 +746,9 @@ class modProduct extends DolibarrModules )); } $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); - $this->import_updatekeys_array[$r] = array('p.ref'=>'Ref'); + $this->import_updatekeys_array[$r] = array('p.ref' => 'Ref'); if (isModEnabled('barcode')) { - $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled + $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode' => 'BarCode')); //only show/allow barcode as update key if Barcode module enabled } if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE')) { @@ -757,24 +758,24 @@ class modProduct extends DolibarrModules $this->import_label[$r] = "ProductStockWarehouse"; // Translation key $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('pwp'=>MAIN_DB_PREFIX.'product_warehouse_properties'); - $this->import_fields_array[$r] = array('pwp.fk_product'=>"Product*", - 'pwp.fk_entrepot'=>"Warehouse*", 'pwp.seuil_stock_alerte'=>"StockLimit", - 'pwp.desiredstock'=>"DesiredStock"); + $this->import_tables_array[$r] = array('pwp' => MAIN_DB_PREFIX.'product_warehouse_properties'); + $this->import_fields_array[$r] = array('pwp.fk_product' => "Product*", + 'pwp.fk_entrepot' => "Warehouse*", 'pwp.seuil_stock_alerte' => "StockLimit", + 'pwp.desiredstock' => "DesiredStock"); $this->import_regex_array[$r] = array( 'pwp.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', 'pwp.fk_entrepot' => 'rowid@'.MAIN_DB_PREFIX.'entrepot', ); $this->import_convertvalue_array[$r] = array( - 'pwp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') - ,'pwp.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'Entrepot') + 'pwp.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') + ,'pwp.fk_entrepot' => array('rule' => 'fetchidfromref', 'classfile' => '/product/stock/class/entrepot.class.php', 'class' => 'Entrepot', 'method' => 'fetch', 'element' => 'Entrepot') ); - $this->import_examplevalues_array[$r] = array('pwp.fk_product'=>"ref:PRODUCT_REF or id:123456", - 'pwp.fk_entrepot'=>"ref:WAREHOUSE_REF or id:123456", - 'pwp.seuil_stock_alerte'=>"100", - 'pwp.desiredstock'=>"110" + $this->import_examplevalues_array[$r] = array('pwp.fk_product' => "ref:PRODUCT_REF or id:123456", + 'pwp.fk_entrepot' => "ref:WAREHOUSE_REF or id:123456", + 'pwp.seuil_stock_alerte' => "100", + 'pwp.desiredstock' => "110" ); - $this->import_updatekeys_array[$r] = array('pwp.fk_product'=>'Product', 'pwp.fk_entrepot'=>'Warehouse'); + $this->import_updatekeys_array[$r] = array('pwp.fk_product' => 'Product', 'pwp.fk_entrepot' => 'Warehouse'); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { @@ -784,10 +785,10 @@ class modProduct extends DolibarrModules $this->import_label[$r] = "SuppliersPricesOfProductsOrServices"; // Translation key $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price', 'extra'=>MAIN_DB_PREFIX.'product_fournisseur_price_extrafields'); - $this->import_tables_creator_array[$r] = array('sp'=>'fk_user'); + $this->import_tables_array[$r] = array('sp' => MAIN_DB_PREFIX.'product_fournisseur_price', 'extra' => MAIN_DB_PREFIX.'product_fournisseur_price_extrafields'); + $this->import_tables_creator_array[$r] = array('sp' => 'fk_user'); $this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields - 'sp.fk_product'=>"ProductOrService*", + 'sp.fk_product' => "ProductOrService*", 'sp.fk_soc' => "Supplier*", 'sp.ref_fourn' => 'SupplierRef*', 'sp.quantity' => "QtyMin*", @@ -798,27 +799,27 @@ class modProduct extends DolibarrModules 'sp.status' => 'Status' ); if (is_object($mysoc) && $usenpr) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.recuperableonly'=>'VATNPR')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.recuperableonly' => 'VATNPR')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax1_tx' => 'LT1', 'sp.localtax1_type' => 'LT1Type')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax2_tx' => 'LT2', 'sp.localtax2_type' => 'LT2Type')); } $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( - 'sp.price'=>"PriceQtyMinHT*", - 'sp.unitprice'=>'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty - 'sp.remise_percent'=>'DiscountQtyMin' + 'sp.price' => "PriceQtyMinHT*", + 'sp.unitprice' => 'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty + 'sp.remise_percent' => 'DiscountQtyMin' )); if (isModEnabled("multicurrency")) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( - 'sp.fk_multicurrency'=>'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line - 'sp.multicurrency_code'=>'CurrencyCode', - 'sp.multicurrency_tx'=>'CurrencyRate', - 'sp.multicurrency_unitprice'=>'CurrencyUnitPrice', - 'sp.multicurrency_price'=>'CurrencyPrice', + 'sp.fk_multicurrency' => 'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line + 'sp.multicurrency_code' => 'CurrencyCode', + 'sp.multicurrency_tx' => 'CurrencyRate', + 'sp.multicurrency_unitprice' => 'CurrencyUnitPrice', + 'sp.multicurrency_price' => 'CurrencyPrice', )); } @@ -839,11 +840,11 @@ class modProduct extends DolibarrModules } } // End add extra fields - $this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product_fournisseur_price'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'product_fournisseur_price'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r] = array( - 'sp.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty'), - 'sp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + 'sp.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), + 'sp.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') ); $this->import_examplevalues_array[$r] = array( @@ -852,22 +853,22 @@ class modProduct extends DolibarrModules 'sp.ref_fourn' => "XYZ-F123456", 'sp.quantity' => "5", 'sp.tva_tx' => '10', - 'sp.price'=>"50", - 'sp.unitprice'=>'50', - 'sp.remise_percent'=>'0', + 'sp.price' => "50", + 'sp.unitprice' => '50', + 'sp.remise_percent' => '0', 'sp.default_vat_code' => '', 'sp.delivery_time_days' => '5', 'sp.supplier_reputation' => 'FAVORITE / NOTTHGOOD / DONOTORDER', 'sp.status' => '1' ); if (is_object($mysoc) && $usenpr) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly'=>'')); + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly' => '')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx' => 'LT1', 'sp.localtax1_type' => 'LT1Type')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx' => 'LT2', 'sp.localtax2_type' => 'LT2Type')); } $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( 'sp.price' => "50.00", @@ -877,21 +878,21 @@ class modProduct extends DolibarrModules )); if (isModEnabled("multicurrency")) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( - 'sp.fk_multicurrency'=>'eg: 2, rowid for code of multicurrency currency', - 'sp.multicurrency_code'=>'GBP', - 'sp.multicurrency_tx'=>'1.12345', - 'sp.multicurrency_unitprice'=>'', + 'sp.fk_multicurrency' => 'eg: 2, rowid for code of multicurrency currency', + 'sp.multicurrency_code' => 'GBP', + 'sp.multicurrency_tx' => '1.12345', + 'sp.multicurrency_unitprice' => '', // TODO Make this field not required and calculate it from price and qty - 'sp.multicurrency_price'=>'' + 'sp.multicurrency_price' => '' )); } if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( - 'sp.packaging'=>'10', + 'sp.packaging' => '10', )); } - $this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier', 'sp.quantity'=>"QtyMin"); + $this->import_updatekeys_array[$r] = array('sp.fk_product' => 'ProductOrService', 'sp.ref_fourn' => 'SupplierRef', 'sp.fk_soc' => 'Supplier', 'sp.quantity' => "QtyMin"); } if (getDolGlobalString('PRODUIT_MULTIPRICES')) { @@ -901,30 +902,30 @@ class modProduct extends DolibarrModules $this->import_label[$r] = "ProductsOrServiceMultiPrice"; // Translation key $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('pr'=>MAIN_DB_PREFIX.'product_price'); - $this->import_tables_creator_array[$r] = array('pr'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r] = array('pr.fk_product'=>"ProductOrService*", - 'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel", - 'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", - 'pr.date_price'=>'DateCreation*'); + $this->import_tables_array[$r] = array('pr' => MAIN_DB_PREFIX.'product_price'); + $this->import_tables_creator_array[$r] = array('pr' => 'fk_user_author'); // Fields to store import user id + $this->import_fields_array[$r] = array('pr.fk_product' => "ProductOrService*", + 'pr.price_base_type' => "PriceBase", 'pr.price_level' => "PriceLevel", + 'pr.price' => "PriceLevelUnitPriceHT", 'pr.price_ttc' => "PriceLevelUnitPriceTTC", + 'pr.price_min' => "MinPriceLevelUnitPriceHT", 'pr.price_min_ttc' => "MinPriceLevelUnitPriceTTC", + 'pr.date_price' => 'DateCreation*'); if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { $this->import_fields_array[$r]['pr.tva_tx'] = 'VATRate'; } if (is_object($mysoc) && $usenpr) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('pr.recuperableonly' => 'NPR')); } - $this->import_regex_array[$r] = array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'pr.recuperableonly'=>'^[0|1]$'); + $this->import_regex_array[$r] = array('pr.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'pr.recuperableonly' => '^[0|1]$'); $this->import_convertvalue_array[$r] = array( - 'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + 'pr.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') ); - $this->import_examplevalues_array[$r] = array('pr.fk_product'=>"ref:PRODUCT_REF or id:123456", - 'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)", 'pr.price_level'=>"1", - 'pr.price'=>"100", 'pr.price_ttc'=>"110", - 'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110", - 'pr.tva_tx'=>'20', - 'pr.recuperableonly'=>'0', - 'pr.date_price'=>'2020-12-31'); + $this->import_examplevalues_array[$r] = array('pr.fk_product' => "ref:PRODUCT_REF or id:123456", + 'pr.price_base_type' => "HT (for excl tax) or TTC (for inc tax)", 'pr.price_level' => "1", + 'pr.price' => "100", 'pr.price_ttc' => "110", + 'pr.price_min' => "100", 'pr.price_min_ttc' => "110", + 'pr.tva_tx' => '20', + 'pr.recuperableonly' => '0', + 'pr.date_price' => '2020-12-31'); } if (getDolGlobalInt('MAIN_MULTILANGS')) { @@ -934,15 +935,15 @@ class modProduct extends DolibarrModules $this->import_label[$r] = "ProductsOrServicesTranslations"; $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('l'=>MAIN_DB_PREFIX.'product_lang'); + $this->import_tables_array[$r] = array('l' => MAIN_DB_PREFIX.'product_lang'); // multiline translation, one line per translation - $this->import_fields_array[$r] = array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription'); + $this->import_fields_array[$r] = array('l.fk_product' => 'ProductOrService*', 'l.lang' => 'Language*', 'l.label' => 'TranslatedLabel', 'l.description' => 'TranslatedDescription'); //$this->import_fields_array[$r]['l.note']='TranslatedNote'; $this->import_convertvalue_array[$r] = array( - 'l.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + 'l.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') ); - $this->import_examplevalues_array[$r] = array('l.fk_product'=>'ref:PRODUCT_REF or id:123456', 'l.lang'=>'en_US', 'l.label'=>'Label in en_US', 'l.description'=>'Desc in en_US'); - $this->import_updatekeys_array[$r] = array('l.fk_product'=>'ProductOrService', 'l.lang'=>'Language'); + $this->import_examplevalues_array[$r] = array('l.fk_product' => 'ref:PRODUCT_REF or id:123456', 'l.lang' => 'en_US', 'l.label' => 'Label in en_US', 'l.description' => 'Desc in en_US'); + $this->import_updatekeys_array[$r] = array('l.fk_product' => 'ProductOrService', 'l.lang' => 'Language'); } } From ec59a692e88cfc009c90be01de2d53bce16c9452 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:38 +0100 Subject: [PATCH 083/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modProductBatch.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 30ab6cefe35..1f8f4436a53 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013-2014 Cedric GROSS + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,7 +119,7 @@ class modProductBatch extends DolibarrModules // Exports - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } /** From eb3fe3c05c3f2ebbec3b08468d4bbf0fa73c74df Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:41 +0100 Subject: [PATCH 084/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modRecruitment.class.php | 125 ++++++++++--------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index c8c5b623845..3731002467c 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2021 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -255,75 +256,75 @@ class modRecruitment extends DolibarrModules /* END MODULEBUILDER TOPMENU */ /* BEGIN MODULEBUILDER LEFTMENU RECRUITMENTJOBPOSITION */ $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=hrm', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Top menu entry - 'titre'=>'Recruitment', + 'fk_menu' => 'fk_mainmenu=hrm', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Top menu entry + 'titre' => 'Recruitment', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'hrm', - 'leftmenu'=>'recruitmentjobposition', - 'url'=>'/recruitment/index.php', - 'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000 + $r, - 'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->hasRight("recruitment", "recruitmentjobposition", "read")', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'mainmenu' => 'hrm', + 'leftmenu' => 'recruitmentjobposition', + 'url' => '/recruitment/index.php', + 'langs' => 'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->hasRight("recruitment", "recruitmentjobposition", "read")', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'NewPositionToBeFilled', - 'mainmenu'=>'hrm', - 'leftmenu'=>'recruitment_recruitmentjobposition_new', - 'url'=>'/recruitment/recruitmentjobposition_card.php?action=create', - 'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000 + $r, - 'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->recruitment->recruitmentjobposition->write', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'NewPositionToBeFilled', + 'mainmenu' => 'hrm', + 'leftmenu' => 'recruitment_recruitmentjobposition_new', + 'url' => '/recruitment/recruitmentjobposition_card.php?action=create', + 'langs' => 'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->recruitment->recruitmentjobposition->write', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'ListOfPositionsToBeFilled', - 'mainmenu'=>'hrm', - 'leftmenu'=>'recruitment_recruitmentjobposition_list', - 'url'=>'/recruitment/recruitmentjobposition_list.php', - 'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000 + $r, - 'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->hasRight("recruitment", "recruitmentjobposition", "read")', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'ListOfPositionsToBeFilled', + 'mainmenu' => 'hrm', + 'leftmenu' => 'recruitment_recruitmentjobposition_list', + 'url' => '/recruitment/recruitmentjobposition_list.php', + 'langs' => 'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->hasRight("recruitment", "recruitmentjobposition", "read")', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'NewCandidature', - 'mainmenu'=>'hrm', - 'leftmenu'=>'recruitment_recruitmentcandidature_new', - 'url'=>'/recruitment/recruitmentcandidature_card.php?action=create', - 'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000 + $r, - 'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->recruitment->recruitmentjobposition->write', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'NewCandidature', + 'mainmenu' => 'hrm', + 'leftmenu' => 'recruitment_recruitmentcandidature_new', + 'url' => '/recruitment/recruitmentcandidature_card.php?action=create', + 'langs' => 'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->recruitment->recruitmentjobposition->write', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'ListOfCandidatures', - 'mainmenu'=>'hrm', - 'leftmenu'=>'recruitment_recruitmentcandidature_list', - 'url'=>'/recruitment/recruitmentcandidature_list.php', - 'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000 + $r, - 'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->hasRight("recruitment", "recruitmentjobposition", "read")', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => 'ListOfCandidatures', + 'mainmenu' => 'hrm', + 'leftmenu' => 'recruitment_recruitmentcandidature_list', + 'url' => '/recruitment/recruitmentcandidature_list.php', + 'langs' => 'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 1000 + $r, + 'enabled' => '$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->hasRight("recruitment", "recruitmentjobposition", "read")', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both ); /* END MODULEBUILDER LEFTMENU RECRUITMENTJOBPOSITION */ @@ -359,7 +360,7 @@ class modRecruitment extends DolibarrModules /* END MODULEBUILDER EXPORT RECRUITMENTJOBPOSITION */ // Imports profiles provided by this module - $r = 1; + $r = 1; // @phan-suppress-current-line PhanPluginRedundantAssignment /* BEGIN MODULEBUILDER IMPORT RECRUITMENTJOBPOSITION */ /* $langs->load("recruitment"); @@ -413,7 +414,7 @@ class modRecruitment extends DolibarrModules // Document template $moduledir = 'recruitment'; $myTmpObjects = array(); - $myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration'=>1, 'includedocgeneration'=>1); + $myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration' => 1, 'includedocgeneration' => 1); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'MyObject') { From 923f403c54dfd1108a25620ea3ac0953415e70c3 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:44 +0100 Subject: [PATCH 085/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modResource.class.php | 95 ++++++++++++----------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 350953ad4c6..8acfb7cfb64 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,7 +147,7 @@ class modResource extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $this->rights[$r][0] = 63001; $this->rights[$r][1] = 'Read resources'; @@ -184,49 +185,49 @@ class modResource extends DolibarrModules // Menus declaration $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=agenda', - 'type'=>'left', - 'titre'=> 'MenuResourceIndex', + 'fk_menu' => 'fk_mainmenu=agenda', + 'type' => 'left', + 'titre' => 'MenuResourceIndex', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em92"'), - 'mainmenu'=>'agenda', - 'leftmenu'=> 'resource', - 'url'=> '/resource/list.php', - 'langs'=> 'resource', - 'position'=> 100, - 'enabled'=> '1', - 'perms'=> '$user->rights->resource->read', - 'user'=> 0 + 'mainmenu' => 'agenda', + 'leftmenu' => 'resource', + 'url' => '/resource/list.php', + 'langs' => 'resource', + 'position' => 100, + 'enabled' => '1', + 'perms' => '$user->rights->resource->read', + 'user' => 0 ); $r++; $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus - 'type'=> 'left', // Toujours un menu gauche - 'titre'=> 'MenuResourceAdd', - 'mainmenu'=> 'agenda', - 'leftmenu'=> 'resource_add', - 'url'=> '/resource/card.php?action=create', - 'langs'=> 'resource', - 'position'=> 101, - 'enabled'=> '1', - 'perms'=> '$user->rights->resource->write', - 'target'=> '', - 'user'=> 0 + 'fk_menu' => 'fk_mainmenu=agenda,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus + 'type' => 'left', // Toujours un menu gauche + 'titre' => 'MenuResourceAdd', + 'mainmenu' => 'agenda', + 'leftmenu' => 'resource_add', + 'url' => '/resource/card.php?action=create', + 'langs' => 'resource', + 'position' => 101, + 'enabled' => '1', + 'perms' => '$user->rights->resource->write', + 'target' => '', + 'user' => 0 ); $this->menu[$r++] = array( - 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus - 'type'=> 'left', // Toujours un menu gauche - 'titre'=> 'List', - 'mainmenu'=> 'agenda', - 'leftmenu'=> 'resource_list', - 'url'=> '/resource/list.php', - 'langs'=> 'resource', - 'position'=> 102, - 'enabled'=> '1', - 'perms'=> '$user->rights->resource->read', - 'target'=> '', - 'user'=> 0 + 'fk_menu' => 'fk_mainmenu=agenda,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus + 'type' => 'left', // Toujours un menu gauche + 'titre' => 'List', + 'mainmenu' => 'agenda', + 'leftmenu' => 'resource_list', + 'url' => '/resource/list.php', + 'langs' => 'resource', + 'position' => 102, + 'enabled' => '1', + 'perms' => '$user->rights->resource->read', + 'target' => '', + 'user' => 0 ); @@ -239,9 +240,9 @@ class modResource extends DolibarrModules $this->export_label[$r] = "ResourceSingular"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("resource", "read")); - $this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.rowid'=>'ResourceTypeID', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceTypeLabel', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification"); - $this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text', 'r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.label'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text'); - $this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.label'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource"); + $this->export_fields_array[$r] = array('r.rowid' => 'IdResource', 'r.ref' => 'ResourceFormLabel_ref', 'c.rowid' => 'ResourceTypeID', 'c.code' => 'ResourceTypeCode', 'c.label' => 'ResourceTypeLabel', 'r.description' => 'ResourceFormLabel_description', 'r.note_private' => "NotePrivate", 'r.note_public' => "NotePublic", 'r.asset_number' => 'AssetNumber', 'r.datec' => "DateCreation", 'r.tms' => "DateLastModification"); + $this->export_TypeFields_array[$r] = array('r.rowid' => 'List:resource:ref', 'r.ref' => 'Text', 'r.asset_number' => 'Text', 'r.description' => 'Text', 'c.code' => 'Text', 'c.label' => 'List:c_type_resource:label', 'r.datec' => 'Date', 'r.tms' => 'Date', 'r.note_private' => 'Text', 'r.note_public' => 'Text'); + $this->export_entities_array[$r] = array('r.rowid' => 'resource', 'r.ref' => 'resource', 'c.code' => 'resource', 'c.label' => 'resource', 'r.description' => 'resource', 'r.note_private' => "resource", 'r.resource' => "resource", 'r.asset_number' => 'resource', 'r.datec' => "resource", 'r.tms' => "resource"); $keyforselect = 'resource'; $keyforelement = 'resource'; @@ -249,7 +250,7 @@ class modResource extends DolibarrModules include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. + $this->export_dependencies_array[$r] = array('resource' => array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.code = r.fk_code_type_resource'; @@ -268,8 +269,8 @@ class modResource extends DolibarrModules $this->import_label[$r] = 'ImportDataset_resource_1'; $this->import_icon[$r] = 'resource'; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('r'=>MAIN_DB_PREFIX.'resource', 'extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r] = array('r.ref'=>"ResourceFormLabel_ref*", 'r.fk_code_type_resource'=>'ResourceTypeCode', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>'DateCreation'); + $this->import_tables_array[$r] = array('r' => MAIN_DB_PREFIX.'resource', 'extra' => MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r] = array('r.ref' => "ResourceFormLabel_ref*", 'r.fk_code_type_resource' => 'ResourceTypeCode', 'r.description' => 'ResourceFormLabel_description', 'r.note_private' => "NotePrivate", 'r.note_public' => "NotePublic", 'r.asset_number' => 'AssetNumber', 'r.datec' => 'DateCreation'); // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'resource' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); @@ -281,14 +282,14 @@ class modResource extends DolibarrModules } } // End add extra fields - $this->import_fieldshidden_array[$r] = array('r.fk_user_author'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'resource'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_fieldshidden_array[$r] = array('r.fk_user_author' => 'user->id', 'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'resource'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r] = array( - 'r.fk_code_type_resource'=>array('rule'=>'fetchidfromcodeorlabel', 'classfile'=>'/core/class/ctyperesource.class.php', 'class'=>'Ctyperesource', 'method'=>'fetch', 'dict'=>'DictionaryResourceType'), + 'r.fk_code_type_resource' => array('rule' => 'fetchidfromcodeorlabel', 'classfile' => '/core/class/ctyperesource.class.php', 'class' => 'Ctyperesource', 'method' => 'fetch', 'dict' => 'DictionaryResourceType'), ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); - $this->import_regex_array[$r] = array('s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); - $this->import_examplevalues_array[$r] = array('r.ref'=>"REF1", 'r.fk_code_type_resource'=>"Code from dictionary resource type", 'r.datec'=>"2017-01-01 or 2017-01-01 12:30:00"); - $this->import_updatekeys_array[$r] = array('r.rf'=>'ResourceFormLabel_ref'); + $this->import_regex_array[$r] = array('s.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); + $this->import_examplevalues_array[$r] = array('r.ref' => "REF1", 'r.fk_code_type_resource' => "Code from dictionary resource type", 'r.datec' => "2017-01-01 or 2017-01-01 12:30:00"); + $this->import_updatekeys_array[$r] = array('r.rf' => 'ResourceFormLabel_ref'); } /** From 5f61e07477b830f24a90d8be5287b781abd002bc Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:47 +0100 Subject: [PATCH 086/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modService.class.php | 377 ++++++++++++----------- 1 file changed, 189 insertions(+), 188 deletions(-) diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index fb07f91ee1c..ced0c7c9919 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020-2021 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,8 +79,8 @@ class modService extends DolibarrModules // Boxes $this->boxes = array( - 0=>array('file'=>'box_services_contracts.php', 'enabledbydefaulton'=>'Home'), - 1=>array('file'=>'box_graph_product_distribution.php', 'enabledbydefaulton'=>'Home') + 0 => array('file' => 'box_services_contracts.php', 'enabledbydefaulton' => 'Home'), + 1 => array('file' => 'box_graph_product_distribution.php', 'enabledbydefaulton' => 'Home') ); // Permissions @@ -157,111 +158,111 @@ class modService extends DolibarrModules $this->export_label[$r] = "Services"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("service", "export")); $this->export_fields_array[$r] = array( - 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", - 'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy", - 'p.description'=>"Description", 'p.url'=>"PublicUrl", - 'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry', - $alias_product_perentity . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", - $alias_product_perentity . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy'=>"ProductAccountancyBuyCode", - $alias_product_perentity . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode", - 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic', - 'p.weight'=>"Weight", 'p.length'=>"Length", 'p.width'=>"Width", 'p.height'=>"Height", 'p.surface'=>"Surface", 'p.volume'=>"Volume", - 'p.duration'=>"Duration", + 'p.rowid' => "Id", 'p.ref' => "Ref", 'p.label' => "Label", + 'p.fk_product_type' => 'Type', 'p.tosell' => "OnSell", 'p.tobuy' => "OnBuy", + 'p.description' => "Description", 'p.url' => "PublicUrl", + 'p.customcode' => 'CustomCode', 'p.fk_country' => 'IDCountry', + $alias_product_perentity . '.accountancy_code_sell' => "ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", + $alias_product_perentity . '.accountancy_code_sell_export' => "ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy' => "ProductAccountancyBuyCode", + $alias_product_perentity . '.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode", + 'p.note' => "NotePrivate", 'p.note_public' => 'NotePublic', + 'p.weight' => "Weight", 'p.length' => "Length", 'p.width' => "Width", 'p.height' => "Height", 'p.surface' => "Surface", 'p.volume' => "Volume", + 'p.duration' => "Duration", 'p.finished' => 'Nature', - 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", - 'p.tva_tx'=>'VATRate', - 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' + 'p.price_base_type' => "PriceBase", 'p.price' => "UnitPriceHT", 'p.price_ttc' => "UnitPriceTTC", + 'p.tva_tx' => 'VATRate', + 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification' ); if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR'; } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price' => 'CostPrice')); } if (isModEnabled('stock')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock' => 'Stock', 'p.seuil_stock_alerte' => 'StockLimit', 'p.desiredstock' => 'DesiredStock', 'p.pmp' => 'PMPValue')); } if (isModEnabled('barcode')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); } $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom' => 'Supplier', 'pf.ref_fourn' => 'SupplierRef', 'pf.quantity' => 'QtyMin', 'pf.remise_percent' => 'DiscountQtyMin', 'pf.unitprice' => 'BuyingPrice', 'pf.delivery_time_days' => 'NbDaysToDelivery')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)' => 'Categories')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang' => 'Language', 'l.label' => 'TranslatedLabel', 'l.description' => 'TranslatedDescription', 'l.note' => 'TranslatedNote')); } if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->export_fields_array[$r]['p.fk_unit'] = 'Unit'; } $this->export_TypeFields_array[$r] = array( - 'p.ref'=>"Text", 'p.label'=>"Text", - 'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", - 'p.description'=>"Text", 'p.url'=>"Text", - $alias_product_perentity . '.accountancy_code_sell'=>"Text", $alias_product_perentity . '.accountancy_code_sell_intra'=>"Text", $alias_product_perentity . '.accountancy_code_sell_export'=>"Text", - $alias_product_perentity . '.accountancy_code_buy'=>"Text", $alias_product_perentity . '.accountancy_code_buy_intra'=>"Text", $alias_product_perentity . '.accountancy_code_buy_export'=>"Text", - 'p.note'=>"Text", 'p.note_public'=>"Text", - 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", - 'p.customcode'=>'Text', - 'p.duration'=>"Text", + 'p.ref' => "Text", 'p.label' => "Text", + 'p.fk_product_type' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", + 'p.description' => "Text", 'p.url' => "Text", + $alias_product_perentity . '.accountancy_code_sell' => "Text", $alias_product_perentity . '.accountancy_code_sell_intra' => "Text", $alias_product_perentity . '.accountancy_code_sell_export' => "Text", + $alias_product_perentity . '.accountancy_code_buy' => "Text", $alias_product_perentity . '.accountancy_code_buy_intra' => "Text", $alias_product_perentity . '.accountancy_code_buy_export' => "Text", + 'p.note' => "Text", 'p.note_public' => "Text", + 'p.weight' => "Numeric", 'p.length' => "Numeric", 'p.width' => "Numeric", 'p.height' => "Numeric", 'p.surface' => "Numeric", 'p.volume' => "Numeric", + 'p.customcode' => 'Text', + 'p.duration' => "Text", 'p.finished' => 'Numeric', - 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', - 'p.datec'=>'Date', 'p.tms'=>'Date' + 'p.price_base_type' => "Text", 'p.price' => "Numeric", 'p.price_ttc' => "Numeric", 'p.tva_tx' => 'Numeric', + 'p.datec' => 'Date', 'p.tms' => 'Date' ); if (isModEnabled('stock')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock' => 'Numeric', 'p.seuil_stock_alerte' => 'Numeric', 'p.desiredstock' => 'Numeric', 'p.pmp' => 'Numeric', 'p.cost_price' => 'Numeric')); } if (isModEnabled('barcode')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom' => 'Text', 'pf.ref_fourn' => 'Text', 'pf.unitprice' => 'Numeric', 'pf.quantity' => 'Numeric', 'pf.remise_percent' => 'Numeric', 'pf.delivery_time_days' => 'Numeric')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang' => 'Text', 'l.label' => 'Text', 'l.description' => 'Text', 'l.note' => 'Text')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)" => 'Text')); } $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)" => 'category')); } if (isModEnabled('stock')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock' => 'product', 'p.pmp' => 'product')); } if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom' => 'product_supplier_ref', 'pf.ref_fourn' => 'product_supplier_ref', 'pf.unitprice' => 'product_supplier_ref', 'pf.quantity' => 'product_supplier_ref', 'pf.remise_percent' => 'product_supplier_ref', 'pf.delivery_time_days' => 'product_supplier_ref')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang' => 'translation', 'l.label' => 'translation', 'l.description' => 'translation', 'l.note' => 'translation')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_dependencies_array[$r] = array('category'=>'p.rowid'); + $this->export_dependencies_array[$r] = array('category' => 'p.rowid'); } if (isModEnabled('stock')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock' => 'product', 'p.pmp' => 'product')); } if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom' => 'product_supplier_ref', 'pf.ref_fourn' => 'product_supplier_ref', 'pf.unitprice' => 'product_supplier_ref', 'pf.quantity' => 'product_supplier_ref', 'pf.remise_percent' => 'product_supplier_ref', 'pf.delivery_time_days' => 'product_supplier_ref')); } if (getDolGlobalInt('MAIN_MULTILANGS')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang' => 'translation', 'l.label' => 'translation', 'l.description' => 'translation', 'l.note' => 'translation')); } if (getDolGlobalString('EXPORTTOOL_CATEGORIES')) { - $this->export_dependencies_array[$r] = array('category'=>'p.rowid'); + $this->export_dependencies_array[$r] = array('category' => 'p.rowid'); } $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; @@ -290,12 +291,12 @@ class modService extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("service", "export")); - $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", - 'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel", - 'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", - 'pr.tva_tx'=>'PriceLevelVATRate', - 'pr.date_price'=>'DateCreation'); + $this->export_fields_array[$r] = array('p.rowid' => "Id", 'p.ref' => "Ref", + 'pr.price_base_type' => "PriceBase", 'pr.price_level' => "PriceLevel", + 'pr.price' => "PriceLevelUnitPriceHT", 'pr.price_ttc' => "PriceLevelUnitPriceTTC", + 'pr.price_min' => "MinPriceLevelUnitPriceHT", 'pr.price_min_ttc' => "MinPriceLevelUnitPriceTTC", + 'pr.tva_tx' => 'PriceLevelVATRate', + 'pr.date_price' => 'DateCreation'); if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR'; } @@ -305,13 +306,13 @@ class modService extends DolibarrModules // 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean", // 'p.datec'=>'Date','p.tms'=>'Date' //); - $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", - 'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product", - 'pr.price_ttc'=>"product", - 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product", - 'pr.tva_tx'=>'product', - 'pr.recuperableonly'=>'product', - 'pr.date_price'=>"product"); + $this->export_entities_array[$r] = array('p.rowid' => "product", 'p.ref' => "product", + 'pr.price_base_type' => "product", 'pr.price_level' => "product", 'pr.price' => "product", + 'pr.price_ttc' => "product", + 'pr.price_min' => "product", 'pr.price_min_ttc' => "product", + 'pr.tva_tx' => 'product', + 'pr.recuperableonly' => 'product', + 'pr.date_price' => "product"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity @@ -324,26 +325,26 @@ class modService extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("service", "export")); - $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", - 's.nom'=>'ThirdParty', - 'pr.price_base_type'=>"PriceBase", - 'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC", - 'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC", - 'pr.tva_tx'=>'PriceVATRate', - 'pr.default_vat_code'=>'PriceVATCode', - 'pr.datec'=>'DateCreation'); + $this->export_fields_array[$r] = array('p.rowid' => "Id", 'p.ref' => "Ref", + 's.nom' => 'ThirdParty', + 'pr.price_base_type' => "PriceBase", + 'pr.price' => "PriceUnitPriceHT", 'pr.price_ttc' => "PriceUnitPriceTTC", + 'pr.price_min' => "MinPriceUnitPriceHT", 'pr.price_min_ttc' => "MinPriceUnitPriceTTC", + 'pr.tva_tx' => 'PriceVATRate', + 'pr.default_vat_code' => 'PriceVATCode', + 'pr.datec' => 'DateCreation'); if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR'; } - $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", - 's.nom'=>'company', - 'pr.price_base_type'=>"product", 'pr.price'=>"product", - 'pr.price_ttc'=>"product", - 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product", - 'pr.tva_tx'=>'product', - 'pr.default_vat_code'=>'product', - 'pr.recuperableonly'=>'product', - 'pr.datec'=>"product"); + $this->export_entities_array[$r] = array('p.rowid' => "product", 'p.ref' => "product", + 's.nom' => 'company', + 'pr.price_base_type' => "product", 'pr.price' => "product", + 'pr.price_ttc' => "product", + 'pr.price_min' => "product", 'pr.price_min_ttc' => "product", + 'pr.tva_tx' => 'product', + 'pr.default_vat_code' => 'product', + 'pr.recuperableonly' => 'product', + 'pr.datec' => "product"); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity @@ -358,60 +359,60 @@ class modService extends DolibarrModules $this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("service", "export")); $this->export_fields_array[$r] = array( - 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl", - $alias_product_perentity . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode", - $alias_product_perentity . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy'=>"ProductAccountancyBuyCode", - $alias_product_perentity . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode", - 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic', - 'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode', - 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell", - 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' + 'p.rowid' => "Id", 'p.ref' => "Ref", 'p.label' => "Label", 'p.description' => "Description", 'p.url' => "PublicUrl", + $alias_product_perentity . '.accountancy_code_sell' => "ProductAccountancySellCode", $alias_product_perentity . '.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode", + $alias_product_perentity . '.accountancy_code_sell_export' => "ProductAccountancySellExportCode", $alias_product_perentity . '.accountancy_code_buy' => "ProductAccountancyBuyCode", + $alias_product_perentity . '.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode", $alias_product_perentity . '.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode", + 'p.note' => "NotePrivate", 'p.note_public' => 'NotePublic', + 'p.weight' => "Weight", 'p.length' => "Length", 'p.surface' => "Surface", 'p.volume' => "Volume", 'p.customcode' => 'CustomCode', + 'p.price_base_type' => "PriceBase", 'p.price' => "UnitPriceHT", 'p.price_ttc' => "UnitPriceTTC", 'p.tva_tx' => 'VATRate', 'p.tosell' => "OnSell", + 'p.tobuy' => "OnBuy", 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification' ); if (isModEnabled('stock')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock' => 'Stock', 'p.seuil_stock_alerte' => 'StockLimit', 'p.desiredstock' => 'DesiredStock', 'p.pmp' => 'PMPValue')); } if (isModEnabled('barcode')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); } - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty' => 'Qty', 'pa.incdec' => 'ComposedProductIncDecStock')); $this->export_TypeFields_array[$r] = array( - 'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text", - $alias_product_perentity . 'p.accountancy_code_sell'=>"Text", $alias_product_perentity . '.accountancy_code_sell_intra'=>"Text", $alias_product_perentity . '.accountancy_code_sell_export'=>"Text", - $alias_product_perentity . 'p.accountancy_code_buy'=>"Text", $alias_product_perentity . '.accountancy_code_buy_intra'=>"Text", $alias_product_perentity . '.accountancy_code_buy_export'=>"Text", - 'p.note'=>"Text", 'p.note_public'=>"Text", - 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text', - 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", - 'p.datec'=>'Date', 'p.tms'=>'Date' + 'p.ref' => "Text", 'p.label' => "Text", 'p.description' => "Text", 'p.url' => "Text", + $alias_product_perentity . 'p.accountancy_code_sell' => "Text", $alias_product_perentity . '.accountancy_code_sell_intra' => "Text", $alias_product_perentity . '.accountancy_code_sell_export' => "Text", + $alias_product_perentity . 'p.accountancy_code_buy' => "Text", $alias_product_perentity . '.accountancy_code_buy_intra' => "Text", $alias_product_perentity . '.accountancy_code_buy_export' => "Text", + 'p.note' => "Text", 'p.note_public' => "Text", + 'p.weight' => "Numeric", 'p.length' => "Numeric", 'p.surface' => "Numeric", 'p.volume' => "Numeric", 'p.customcode' => 'Text', + 'p.price_base_type' => "Text", 'p.price' => "Numeric", 'p.price_ttc' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", + 'p.datec' => 'Date', 'p.tms' => 'Date' ); if (isModEnabled('stock')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock' => 'Numeric', 'p.seuil_stock_alerte' => 'Numeric', 'p.desiredstock' => 'Numeric', 'p.pmp' => 'Numeric', 'p.cost_price' => 'Numeric')); } if (isModEnabled('barcode')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); } - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty' => 'Numeric')); $this->export_entities_array[$r] = array( - 'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct", - $alias_product_perentity . '.accountancy_code_sell'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_intra'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_export'=>'virtualproduct', - $alias_product_perentity . '.accountancy_code_buy'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_intra'=>'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_export'=>'virtualproduct', - 'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct", - 'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct', - 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct", - 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct" + 'p.rowid' => "virtualproduct", 'p.ref' => "virtualproduct", 'p.label' => "virtualproduct", 'p.description' => "virtualproduct", 'p.url' => "virtualproduct", + $alias_product_perentity . '.accountancy_code_sell' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_intra' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_sell_export' => 'virtualproduct', + $alias_product_perentity . '.accountancy_code_buy' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_intra' => 'virtualproduct', $alias_product_perentity . '.accountancy_code_buy_export' => 'virtualproduct', + 'p.note' => "virtualproduct", 'p.length' => "virtualproduct", + 'p.surface' => "virtualproduct", 'p.volume' => "virtualproduct", 'p.weight' => "virtualproduct", 'p.customcode' => 'virtualproduct', + 'p.price_base_type' => "virtualproduct", 'p.price' => "virtualproduct", 'p.price_ttc' => "virtualproduct", 'p.tva_tx' => "virtualproduct", + 'p.tosell' => "virtualproduct", 'p.tobuy' => "virtualproduct", 'p.datec' => "virtualproduct", 'p.tms' => "virtualproduct" ); if (isModEnabled('stock')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock' => 'virtualproduct', 'p.seuil_stock_alerte' => 'virtualproduct', 'p.desiredstock' => 'virtualproduct', 'p.pmp' => 'virtualproduct')); } if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'virtualproduct')); } - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct')); - $keyforselect = 'product'; - $keyforelement = 'product'; - $keyforaliasextra = 'extra'; + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty' => "subproduct", 'pa.incdec' => 'subproduct')); + $keyforselect = 'product'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforelement = 'product'; // @phan-suppress-current-line PhanPluginRedundantAssignment + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description")); - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid' => "Id", 'p2.ref' => "Ref", 'p2.label' => "Label", 'p2.description' => "Description")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid' => "subproduct", 'p2.ref' => "subproduct", 'p2.label' => "subproduct", 'p2.description' => "subproduct")); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { @@ -435,8 +436,8 @@ class modService extends DolibarrModules $this->import_label[$r] = "Products"; // Translation key $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon - $this->import_tables_array[$r] = array('p'=>MAIN_DB_PREFIX.'product', 'extra'=>MAIN_DB_PREFIX.'product_extrafields'); - $this->import_tables_creator_array[$r] = array('p'=>'fk_user_author'); // Fields to store import user id + $this->import_tables_array[$r] = array('p' => MAIN_DB_PREFIX.'product', 'extra' => MAIN_DB_PREFIX.'product_extrafields'); + $this->import_tables_creator_array[$r] = array('p' => 'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r] = array( 'p.ref' => "Ref*", 'p.label' => "Label*", @@ -549,8 +550,8 @@ class modService extends DolibarrModules if (isModEnabled('stock')) {//if Stock module enabled $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( - 'p.fk_default_warehouse'=>'DefaultWarehouse', - 'p.tobatch'=>'ManageLotSerial', + 'p.fk_default_warehouse' => 'DefaultWarehouse', + 'p.tobatch' => 'ManageLotSerial', 'p.seuil_stock_alerte' => 'StockLimit', //lower limit for warning 'p.pmp' => 'PMPValue', //weighted average price 'p.desiredstock' => 'DesiredStock'//desired stock for replenishment feature @@ -566,25 +567,25 @@ class modService extends DolibarrModules 'classfile' => '/product/stock/class/entrepot.class.php', 'class' => 'Entrepot', 'method' => 'fetch', - 'element'=> 'Warehouse' + 'element' => 'Warehouse' ) )); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price' => 'CostPrice')); } if (is_object($mysoc) && $usenpr) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.recuperableonly' => 'NPR')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax1_tx' => 'LT1', 'p.localtax1_type' => 'LT1Type')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx' => 'LT2', 'p.localtax2_type' => 'LT2Type')); } if (isModEnabled('barcode')) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode' => 'BarCode')); } if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->import_fields_array[$r]['p.fk_unit'] = 'Unit'; @@ -602,14 +603,14 @@ class modService extends DolibarrModules } } // End add extra fields - $this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r] = array( - 'p.ref'=>'[^ ]', + 'p.ref' => '[^ ]', 'p.price_base_type' => 'HT|TTC', - 'p.tosell'=>'^[0|1]$', - 'p.tobuy'=>'^[0|1]$', - 'p.fk_product_type'=>'^[0|1]$', - 'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', + 'p.tosell' => '^[0|1]$', + 'p.tobuy' => '^[0|1]$', + 'p.fk_product_type' => '^[0|1]$', + 'p.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'p.recuperableonly' => '^[0|1]$', 'p.finished' => '^[0|1]$' ); @@ -663,19 +664,19 @@ class modService extends DolibarrModules )); } if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { - $import_sample = array_merge($import_sample, array('p.cost_price'=>'90')); + $import_sample = array_merge($import_sample, array('p.cost_price' => '90')); } if (is_object($mysoc) && $usenpr) { - $import_sample = array_merge($import_sample, array('p.recuperableonly'=>'0')); + $import_sample = array_merge($import_sample, array('p.recuperableonly' => '0')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $import_sample = array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>'')); + $import_sample = array_merge($import_sample, array('p.localtax1_tx' => '', 'p.localtax1_type' => '')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $import_sample = array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>'')); + $import_sample = array_merge($import_sample, array('p.localtax2_tx' => '', 'p.localtax2_type' => '')); } if (isModEnabled('barcode')) { - $import_sample = array_merge($import_sample, array('p.barcode'=>'')); + $import_sample = array_merge($import_sample, array('p.barcode' => '')); } if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $import_sample = array_merge( @@ -699,9 +700,9 @@ class modService extends DolibarrModules )); } $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); - $this->import_updatekeys_array[$r] = array('p.ref'=>'Ref'); + $this->import_updatekeys_array[$r] = array('p.ref' => 'Ref'); if (isModEnabled('barcode')) { - $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled + $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode' => 'BarCode')); //only show/allow barcode as update key if Barcode module enabled } if (!isModEnabled("product")) { // We enable next import templates only if module product not already enabled (to avoid duplicate entries) @@ -712,10 +713,10 @@ class modService extends DolibarrModules $this->import_label[$r] = "SuppliersPricesOfProductsOrServices"; // Translation key $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price'); - $this->import_tables_creator_array[$r] = array('sp'=>'fk_user'); + $this->import_tables_array[$r] = array('sp' => MAIN_DB_PREFIX.'product_fournisseur_price'); + $this->import_tables_creator_array[$r] = array('sp' => 'fk_user'); $this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields - 'sp.fk_product'=>"ProductOrService*", + 'sp.fk_product' => "ProductOrService*", 'sp.fk_soc' => "Supplier*", 'sp.ref_fourn' => 'SupplierRef*', 'sp.quantity' => "QtyMin*", @@ -725,33 +726,33 @@ class modService extends DolibarrModules 'sp.supplier_reputation' => 'SupplierReputation' ); if (is_object($mysoc) && $usenpr) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.recuperableonly'=>'VATNPR')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.recuperableonly' => 'VATNPR')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax1_tx' => 'LT1', 'sp.localtax1_type' => 'LT1Type')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax2_tx' => 'LT2', 'sp.localtax2_type' => 'LT2Type')); } $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( - 'sp.price'=>"PriceQtyMinHT*", - 'sp.unitprice'=>'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty - 'sp.remise_percent'=>'DiscountQtyMin' + 'sp.price' => "PriceQtyMinHT*", + 'sp.unitprice' => 'UnitPriceHT*', // TODO Make this field not required and calculate it from price and qty + 'sp.remise_percent' => 'DiscountQtyMin' )); if (isModEnabled("multicurrency")) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( - 'sp.fk_multicurrency'=>'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line - 'sp.multicurrency_code'=>'CurrencyCode', - 'sp.multicurrency_tx'=>'CurrencyRate', - 'sp.multicurrency_unitprice'=>'CurrencyUnitPrice', - 'sp.multicurrency_price'=>'CurrencyPrice', + 'sp.fk_multicurrency' => 'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line + 'sp.multicurrency_code' => 'CurrencyCode', + 'sp.multicurrency_tx' => 'CurrencyRate', + 'sp.multicurrency_unitprice' => 'CurrencyUnitPrice', + 'sp.multicurrency_price' => 'CurrencyPrice', )); } $this->import_convertvalue_array[$r] = array( - 'sp.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty'), - 'sp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + 'sp.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), + 'sp.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') ); $this->import_examplevalues_array[$r] = array( 'sp.fk_product' => "ref:PRODUCT_REF or id:123456", @@ -759,21 +760,21 @@ class modService extends DolibarrModules 'sp.ref_fourn' => "XYZ-F123456", 'sp.quantity' => "5", 'sp.tva_tx' => '10', - 'sp.price'=>"50", - 'sp.unitprice'=>'50', - 'sp.remise_percent'=>'0', + 'sp.price' => "50", + 'sp.unitprice' => '50', + 'sp.remise_percent' => '0', 'sp.default_vat_code' => '', 'sp.delivery_time_days' => '5', 'sp.supplier_reputation' => 'FAVORITE / NOTTHGOOD / DONOTORDER' ); if (is_object($mysoc) && $usenpr) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly'=>'')); + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly' => '')); } if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx' => 'LT1', 'sp.localtax1_type' => 'LT1Type')); } if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx' => 'LT2', 'sp.localtax2_type' => 'LT2Type')); } $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( 'sp.price' => "50.00", @@ -783,21 +784,21 @@ class modService extends DolibarrModules )); if (isModEnabled("multicurrency")) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( - 'sp.fk_multicurrency'=>'eg: 2, rowid for code of multicurrency currency', - 'sp.multicurrency_code'=>'GBP', - 'sp.multicurrency_tx'=>'1.12345', - 'sp.multicurrency_unitprice'=>'', + 'sp.fk_multicurrency' => 'eg: 2, rowid for code of multicurrency currency', + 'sp.multicurrency_code' => 'GBP', + 'sp.multicurrency_tx' => '1.12345', + 'sp.multicurrency_unitprice' => '', // TODO Make this field not required and calculate it from price and qty - 'sp.multicurrency_price'=>'' + 'sp.multicurrency_price' => '' )); } if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( - 'sp.packaging'=>'10', + 'sp.packaging' => '10', )); } - $this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier'); + $this->import_updatekeys_array[$r] = array('sp.fk_product' => 'ProductOrService', 'sp.ref_fourn' => 'SupplierRef', 'sp.fk_soc' => 'Supplier'); } if (getDolGlobalString('PRODUIT_MULTIPRICES')) { @@ -807,30 +808,30 @@ class modService extends DolibarrModules $this->import_label[$r] = "ProductsOrServiceMultiPrice"; // Translation key $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('pr'=>MAIN_DB_PREFIX.'product_price'); - $this->import_tables_creator_array[$r] = array('pr'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r] = array('pr.fk_product'=>"ProductOrService*", - 'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel", - 'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC", - 'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", - 'pr.date_price'=>'DateCreation*'); + $this->import_tables_array[$r] = array('pr' => MAIN_DB_PREFIX.'product_price'); + $this->import_tables_creator_array[$r] = array('pr' => 'fk_user_author'); // Fields to store import user id + $this->import_fields_array[$r] = array('pr.fk_product' => "ProductOrService*", + 'pr.price_base_type' => "PriceBase", 'pr.price_level' => "PriceLevel", + 'pr.price' => "PriceLevelUnitPriceHT", 'pr.price_ttc' => "PriceLevelUnitPriceTTC", + 'pr.price_min' => "MinPriceLevelUnitPriceHT", 'pr.price_min_ttc' => "MinPriceLevelUnitPriceTTC", + 'pr.date_price' => 'DateCreation*'); if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { $this->import_fields_array[$r]['pr.tva_tx'] = 'VATRate'; } if (is_object($mysoc) && $usenpr) { - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR')); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('pr.recuperableonly' => 'NPR')); } - $this->import_regex_array[$r] = array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'pr.recuperableonly'=>'^[0|1]$'); + $this->import_regex_array[$r] = array('pr.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'pr.recuperableonly' => '^[0|1]$'); $this->import_convertvalue_array[$r] = array( - 'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + 'pr.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') ); - $this->import_examplevalues_array[$r] = array('pr.fk_product'=>"ref:SERVICE_REF or id:123456", - 'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)", 'pr.price_level'=>"1", - 'pr.price'=>"100", 'pr.price_ttc'=>"110", - 'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110", - 'pr.tva_tx'=>'20', - 'pr.recuperableonly'=>'0', - 'pr.date_price'=>'2013-04-10'); + $this->import_examplevalues_array[$r] = array('pr.fk_product' => "ref:SERVICE_REF or id:123456", + 'pr.price_base_type' => "HT (for excl tax) or TTC (for inc tax)", 'pr.price_level' => "1", + 'pr.price' => "100", 'pr.price_ttc' => "110", + 'pr.price_min' => "100", 'pr.price_min_ttc' => "110", + 'pr.tva_tx' => '20', + 'pr.recuperableonly' => '0', + 'pr.date_price' => '2013-04-10'); } if (getDolGlobalInt('MAIN_MULTILANGS')) { @@ -840,15 +841,15 @@ class modService extends DolibarrModules $this->import_label[$r] = "ProductsOrServicesTranslations"; $this->import_icon[$r] = $this->picto; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('l'=>MAIN_DB_PREFIX.'product_lang'); + $this->import_tables_array[$r] = array('l' => MAIN_DB_PREFIX.'product_lang'); // multiline translation, one line per translation - $this->import_fields_array[$r] = array('l.fk_product'=>'ProductOrService*', 'l.lang'=>'Language*', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription'); + $this->import_fields_array[$r] = array('l.fk_product' => 'ProductOrService*', 'l.lang' => 'Language*', 'l.label' => 'TranslatedLabel', 'l.description' => 'TranslatedDescription'); //$this->import_fields_array[$r]['l.note']='TranslatedNote'; $this->import_convertvalue_array[$r] = array( - 'l.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') + 'l.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') ); - $this->import_examplevalues_array[$r] = array('l.fk_product'=>'ref:SERVICE_REF or id:123456', 'l.lang'=>'en_US', 'l.label'=>'Label in en_US', 'l.description'=>'Desc in en_US'); - $this->import_updatekeys_array[$r] = array('l.fk_product'=>'ProductOrService', 'l.lang'=>'Language'); + $this->import_examplevalues_array[$r] = array('l.fk_product' => 'ref:SERVICE_REF or id:123456', 'l.lang' => 'en_US', 'l.label' => 'Label in en_US', 'l.description' => 'Desc in en_US'); + $this->import_updatekeys_array[$r] = array('l.fk_product' => 'ProductOrService', 'l.lang' => 'Language'); } } } From 0b8a46faff03ab6012ee7ca1e68901b7ff24c5cf Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:50 +0100 Subject: [PATCH 087/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modSociete.class.php | 165 ++++++++++++----------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 7c1edc59adb..059f011ac28 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2012-2014 Juanjo Menent * Copyright (C) 2022 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -123,11 +124,11 @@ class modSociete extends DolibarrModules // Boxes $this->boxes = array( - 0=>array('file'=>'box_clients.php', 'enabledbydefaulton'=>'Home'), - 1=>array('file'=>'box_prospect.php', 'enabledbydefaulton'=>'Home'), - 2=>array('file'=>'box_contacts.php', 'enabledbydefaulton'=>'Home'), - 3=>array('file'=>'box_activity.php', 'enabledbydefaulton'=>'Home', 'note'=>'(WarningUsingThisBoxSlowDown)'), - 4=>array('file'=>'box_goodcustomers.php', 'enabledbydefaulton'=>'Home', 'note'=>'(WarningUsingThisBoxSlowDown)'), + 0 => array('file' => 'box_clients.php', 'enabledbydefaulton' => 'Home'), + 1 => array('file' => 'box_prospect.php', 'enabledbydefaulton' => 'Home'), + 2 => array('file' => 'box_contacts.php', 'enabledbydefaulton' => 'Home'), + 3 => array('file' => 'box_activity.php', 'enabledbydefaulton' => 'Home', 'note' => '(WarningUsingThisBoxSlowDown)'), + 4 => array('file' => 'box_goodcustomers.php', 'enabledbydefaulton' => 'Home', 'note' => '(WarningUsingThisBoxSlowDown)'), ); // Permissions @@ -272,15 +273,15 @@ class modSociete extends DolibarrModules $this->export_icon[$r] = 'company'; $this->export_permission[$r] = array(array("societe", "export")); $this->export_fields_array[$r] = array( - 's.rowid'=>"Id", 's.nom'=>"Name", 's.name_alias'=>"AliasNameShort", 'ps.nom'=>"ParentCompany", - 's.status'=>"Status", 's.client'=>"Customer", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", - 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode", 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode", - 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'd.nom'=>'State', 'r.nom'=>'Region', 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", - 's.url'=>"Url", 's.email'=>"Email", 's.default_lang'=>"DefaultLang", 's.canvas' => "Canvas", 's.siren'=>"ProfId1", 's.siret'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", - 's.idprof5'=>"ProfId5", 's.idprof6'=>"ProfId6", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", 's.note_private'=>"NotePrivate", 's.note_public'=>"NotePublic", - 't.code'=>"ThirdPartyType", 'ce.code'=>"DictionaryStaff", "cfj.libelle"=>"JuridicalStatus", 's.fk_prospectlevel'=>'ProspectLevel', - 'st.code'=>'ProspectStatus', 'payterm.libelle'=>'PaymentConditions', 'paymode.libelle'=>'PaymentMode', - 's.outstanding_limit'=>'OutstandingBill', 'pbacc.ref'=>'PaymentBankAccount', 'incoterm.code'=>'IncotermLabel' + 's.rowid' => "Id", 's.nom' => "Name", 's.name_alias' => "AliasNameShort", 'ps.nom' => "ParentCompany", + 's.status' => "Status", 's.client' => "Customer", 's.fournisseur' => "Supplier", 's.datec' => "DateCreation", 's.tms' => "DateLastModification", + 's.code_client' => "CustomerCode", 's.code_fournisseur' => "SupplierCode", 's.code_compta' => "AccountancyCode", 's.code_compta_fournisseur' => "SupplierAccountancyCode", + 's.address' => "Address", 's.zip' => "Zip", 's.town' => "Town", 'd.nom' => 'State', 'r.nom' => 'Region', 'c.label' => "Country", 'c.code' => "CountryCode", 's.phone' => "Phone", 's.fax' => "Fax", + 's.url' => "Url", 's.email' => "Email", 's.default_lang' => "DefaultLang", 's.canvas' => "Canvas", 's.siren' => "ProfId1", 's.siret' => "ProfId2", 's.ape' => "ProfId3", 's.idprof4' => "ProfId4", + 's.idprof5' => "ProfId5", 's.idprof6' => "ProfId6", 's.tva_intra' => "VATIntraShort", 's.capital' => "Capital", 's.note_private' => "NotePrivate", 's.note_public' => "NotePublic", + 't.code' => "ThirdPartyType", 'ce.code' => "DictionaryStaff", "cfj.libelle" => "JuridicalStatus", 's.fk_prospectlevel' => 'ProspectLevel', + 'st.code' => 'ProspectStatus', 'payterm.libelle' => 'PaymentConditions', 'paymode.libelle' => 'PaymentMode', + 's.outstanding_limit' => 'OutstandingBill', 'pbacc.ref' => 'PaymentBankAccount', 'incoterm.code' => 'IncotermLabel' ); if (getDolGlobalString('SOCIETE_USEPREFIX')) { $this->export_fields_array[$r]['s.prefix'] = 'Prefix'; @@ -289,49 +290,49 @@ class modSociete extends DolibarrModules $this->export_fields_array[$r]['s.price_level'] = 'PriceLevel'; } if (getDolGlobalString('ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY')) { - $this->export_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); + $this->export_fields_array[$r] += array('s.accountancy_code_sell' => 'ProductAccountancySellCode', 's.accountancy_code_buy' => 'ProductAccountancyBuyCode'); } // Add multicompany field if (getDolGlobalString('MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED')) { $nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1 if (isModEnabled('multicompany') && $nbofallowedentities > 1) { - $this->export_fields_array[$r] += array('s.entity'=>'Entity'); + $this->export_fields_array[$r] += array('s.entity' => 'Entity'); } } $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_fields_array[$r] += array('u.login'=>'SaleRepresentativeLogin', 'u.firstname'=>'SaleRepresentativeFirstname', 'u.lastname'=>'SaleRepresentativeLastname'); + $this->export_fields_array[$r] += array('u.login' => 'SaleRepresentativeLogin', 'u.firstname' => 'SaleRepresentativeFirstname', 'u.lastname' => 'SaleRepresentativeLastname'); $this->export_TypeFields_array[$r] = array( - 's.rowid'=>"Numeric", 's.nom'=>"Text", 's.name_alias'=>"Text", 'ps.nom'=>"Text", - 's.status'=>"Numeric", 's.client'=>"Numeric", 's.fournisseur'=>"Boolean", 's.datec'=>"Date", 's.tms'=>"Date", - 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", 's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text", - 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", - 'd.nom'=>'Text', 'r.nom'=>'Text', 'c.label'=>'List:c_country:label:label', 'c.code'=>'Text', - 's.phone'=>"Text", 's.fax'=>"Text", - 's.url'=>"Text", 's.email'=>"Text", 's.default_lang'=>"Text", 's.canvas' => "Text", - 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", 's.idprof5'=>"Text", 's.idprof6'=>"Text", - 's.tva_intra'=>"Text", 's.capital'=>"Numeric", - 's.note_private'=>"Text", 's.note_public'=>"Text", - 't.code'=>"List:c_typent:libelle:code", - 'ce.code'=>"List:c_effectif:libelle:code", - "cfj.libelle"=>"Text", - 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code', - 'st.code'=>'List:c_stcomm:libelle:code', - 'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text', - 's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text', - 'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text', - 's.entity'=>'List:entity:label:rowid', 's.price_level'=>'Numeric', - 's.accountancy_code_sell'=>'Text', 's.accountancy_code_buy'=>'Text' + 's.rowid' => "Numeric", 's.nom' => "Text", 's.name_alias' => "Text", 'ps.nom' => "Text", + 's.status' => "Numeric", 's.client' => "Numeric", 's.fournisseur' => "Boolean", 's.datec' => "Date", 's.tms' => "Date", + 's.code_client' => "Text", 's.code_fournisseur' => "Text", 's.code_compta' => "Text", 's.code_compta_fournisseur' => "Text", + 's.address' => "Text", 's.zip' => "Text", 's.town' => "Text", + 'd.nom' => 'Text', 'r.nom' => 'Text', 'c.label' => 'List:c_country:label:label', 'c.code' => 'Text', + 's.phone' => "Text", 's.fax' => "Text", + 's.url' => "Text", 's.email' => "Text", 's.default_lang' => "Text", 's.canvas' => "Text", + 's.siret' => "Text", 's.siren' => "Text", 's.ape' => "Text", 's.idprof4' => "Text", 's.idprof5' => "Text", 's.idprof6' => "Text", + 's.tva_intra' => "Text", 's.capital' => "Numeric", + 's.note_private' => "Text", 's.note_public' => "Text", + 't.code' => "List:c_typent:libelle:code", + 'ce.code' => "List:c_effectif:libelle:code", + "cfj.libelle" => "Text", + 's.fk_prospectlevel' => 'List:c_prospectlevel:label:code', + 'st.code' => 'List:c_stcomm:libelle:code', + 'payterm.libelle' => 'Text', 'paymode.libelle' => 'Text', + 's.outstanding_limit' => 'Numeric', 'pbacc.ref' => 'Text', 'incoterm.code' => 'Text', + 'u.login' => 'Text', 'u.firstname' => 'Text', 'u.lastname' => 'Text', + 's.entity' => 'List:entity:label:rowid', 's.price_level' => 'Numeric', + 's.accountancy_code_sell' => 'Text', 's.accountancy_code_buy' => 'Text' ); $this->export_entities_array[$r] = array( // We define here only fields that use another picto - 'u.login'=>'user', - 'u.firstname'=>'user', - 'u.lastname'=>'user'); - $this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)'); + 'u.login' => 'user', + 'u.firstname' => 'user', + 'u.lastname' => 'user'); + $this->export_examplevalues_array[$r] = array('s.client' => '0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur' => '0 (not a supplier) or 1 (supplier)'); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; @@ -365,17 +366,17 @@ class modSociete extends DolibarrModules $this->export_icon[$r] = 'contact'; $this->export_permission[$r] = array(array("societe", "contact", "export")); $this->export_fields_array[$r] = array( - 'c.rowid'=>"IdContact", 'c.civility'=>"CivilityCode", 'c.lastname'=>'Lastname', 'c.firstname'=>'Firstname', 'c.poste'=>'PostOrFunction', - 'c.datec'=>"DateCreation", 'c.tms'=>"DateLastModification", 'c.priv'=>"ContactPrivate", 'c.address'=>"Address", 'c.zip'=>"Zip", 'c.town'=>"Town", - 'd.nom'=>'State', 'r.nom'=>'Region', 'co.label'=>"Country", 'co.code'=>"CountryCode", 'c.phone'=>"Phone", 'c.fax'=>"Fax", 'c.phone_mobile'=>"Mobile", 'c.email'=>"EMail", - 'c.note_private'=>'NotePrivate', 'c.note_public'=>"NotePublic", - 'c.statut'=>"Status", - 's.rowid'=>"IdCompany", 's.nom'=>"CompanyName", 's.status'=>"Status", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode", - 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode", - 's.client'=>'Customer', 's.fournisseur'=>'Supplier', - 's.address'=>'Address', 's.zip'=>"Zip", 's.town'=>"Town", 's.phone'=>'Phone', 's.email'=>"Email", - 's.note_private'=>'NotePrivate', 's.note_public'=>"NotePublic", - 't.code'=>"ThirdPartyType" + 'c.rowid' => "IdContact", 'c.civility' => "CivilityCode", 'c.lastname' => 'Lastname', 'c.firstname' => 'Firstname', 'c.poste' => 'PostOrFunction', + 'c.datec' => "DateCreation", 'c.tms' => "DateLastModification", 'c.priv' => "ContactPrivate", 'c.address' => "Address", 'c.zip' => "Zip", 'c.town' => "Town", + 'd.nom' => 'State', 'r.nom' => 'Region', 'co.label' => "Country", 'co.code' => "CountryCode", 'c.phone' => "Phone", 'c.fax' => "Fax", 'c.phone_mobile' => "Mobile", 'c.email' => "EMail", + 'c.note_private' => 'NotePrivate', 'c.note_public' => "NotePublic", + 'c.statut' => "Status", + 's.rowid' => "IdCompany", 's.nom' => "CompanyName", 's.status' => "Status", 's.code_client' => "CustomerCode", 's.code_fournisseur' => "SupplierCode", + 's.code_compta' => "AccountancyCode", 's.code_compta_fournisseur' => "SupplierAccountancyCode", + 's.client' => 'Customer', 's.fournisseur' => 'Supplier', + 's.address' => 'Address', 's.zip' => "Zip", 's.town' => "Town", 's.phone' => 'Phone', 's.email' => "Email", + 's.note_private' => 'NotePrivate', 's.note_public' => "NotePublic", + 't.code' => "ThirdPartyType" ); // Add multicompany field if (getDolGlobalString('MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED')) { @@ -391,27 +392,27 @@ class modSociete extends DolibarrModules } } } - $this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)'); + $this->export_examplevalues_array[$r] = array('s.client' => '0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur' => '0 (not a supplier) or 1 (supplier)'); $this->export_TypeFields_array[$r] = array( - 'c.civility'=>"List:c_civility:label:code", 'c.lastname'=>'Text', 'c.firstname'=>'Text', 'c.poste'=>'Text', 'c.datec'=>"Date", 'c.priv'=>"Boolean", - 'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'r.nom'=>'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text", - 'c.fax'=>"Text", 'c.email'=>"Text", - 'c.statut'=>"Status", - 's.rowid'=>"Numeric", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", - 's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text", - 's.client'=>"Numeric", 's.fournisseur'=>"Numeric", - 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 's.phone'=>"Text", 's.email'=>"Text", - 't.code'=>"List:c_stcomm:libelle:code", - 'c.entity'=>'List:entity:label:rowid', - 's.entity'=>'List:entity:label:rowid', + 'c.civility' => "List:c_civility:label:code", 'c.lastname' => 'Text', 'c.firstname' => 'Text', 'c.poste' => 'Text', 'c.datec' => "Date", 'c.priv' => "Boolean", + 'c.address' => "Text", 'c.zip' => "Text", 'c.town' => "Text", 'd.nom' => 'Text', 'r.nom' => 'Text', 'co.label' => "List:c_country:label:rowid", 'co.code' => "Text", 'c.phone' => "Text", + 'c.fax' => "Text", 'c.email' => "Text", + 'c.statut' => "Status", + 's.rowid' => "Numeric", 's.nom' => "Text", 's.status' => "Status", 's.code_client' => "Text", 's.code_fournisseur' => "Text", + 's.code_compta' => "Text", 's.code_compta_fournisseur' => "Text", + 's.client' => "Numeric", 's.fournisseur' => "Numeric", + 's.address' => "Text", 's.zip' => "Text", 's.town' => "Text", 's.phone' => "Text", 's.email' => "Text", + 't.code' => "List:c_stcomm:libelle:code", + 'c.entity' => 'List:entity:label:rowid', + 's.entity' => 'List:entity:label:rowid', ); $this->export_entities_array[$r] = array( // We define here only fields that use another picto - 's.rowid'=>"company", 's.nom'=>"company", 's.status'=>'company', 's.code_client'=>"company", 's.code_fournisseur'=>"company", - 's.code_compta'=>"company", 's.code_compta_fournisseur'=>"company", - 's.client'=>"company", 's.fournisseur'=>"company", - 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 's.phone'=>"company", 's.email'=>"company", - 't.code'=>"company", - 's.entity'=>'company', + 's.rowid' => "company", 's.nom' => "company", 's.status' => 'company', 's.code_client' => "company", 's.code_fournisseur' => "company", + 's.code_compta' => "company", 's.code_compta_fournisseur' => "company", + 's.client' => "company", 's.fournisseur' => "company", + 's.address' => "company", 's.zip' => "company", 's.town' => "company", 's.phone' => "company", 's.email' => "company", + 't.code' => "company", + 's.entity' => 'company', ); // We define here only fields that use another picto if (!isModEnabled("supplier_order") && !isModEnabled("supplier_invoice")) { unset($this->export_fields_array[$r]['s.code_fournisseur']); @@ -419,7 +420,7 @@ class modSociete extends DolibarrModules } $keyforselect = 'socpeople'; $keyforelement = 'contact'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $keyforselect = 'societe'; $keyforelement = 'company'; @@ -502,9 +503,9 @@ class modSociete extends DolibarrModules 's.cond_reglement' => "PaymentTermsCustomer", 's.mode_reglement_supplier' => 'PaymentTypeSupplier', 's.cond_reglement_supplier' => "PaymentTermsSupplier", - 's.outstanding_limit'=>'OutstandingBill', - 's.fk_account'=>'PaymentBankAccount', - 's.fk_incoterms'=>'IncotermLabel', + 's.outstanding_limit' => 'OutstandingBill', + 's.fk_account' => 'PaymentBankAccount', + 's.fk_incoterms' => 'IncotermLabel', 's.tva_assuj' => 'VATIsUsed', 's.barcode' => 'BarCode', 's.default_lang' => 'DefaultLanguage', @@ -517,7 +518,7 @@ class modSociete extends DolibarrModules $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel'; } if (getDolGlobalString('ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY')) { - $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); + $this->import_fields_array[$r] += array('s.accountancy_code_sell' => 'ProductAccountancySellCode', 's.accountancy_code_buy' => 'ProductAccountancyBuyCode'); } // Add social networks fields if (isModEnabled('socialnetworks')) { @@ -703,7 +704,7 @@ class modSociete extends DolibarrModules } // Add profids as criteria to search duplicates $langs->load("companies"); - $i=1; + $i = 1; while ($i <= 6) { if ($i == 1) { $this->import_updatekeys_array[$r]['s.siren'] = 'ProfId1'.(empty($mysoc->country_code) ? '' : $mysoc->country_code); @@ -908,15 +909,15 @@ class modSociete extends DolibarrModules $this->import_code[$r] = $this->rights_class.'_'.$r; $this->import_label[$r] = "ImportDataset_company_4"; // Translation key $this->import_icon[$r] = 'company'; - $this->import_entities_array[$r] = array('sr.fk_user'=>'user'); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('sr'=>MAIN_DB_PREFIX.'societe_commerciaux'); - $this->import_fields_array[$r] = array('sr.fk_soc'=>"ThirdPartyName*", 'sr.fk_user'=>"User*"); + $this->import_entities_array[$r] = array('sr.fk_user' => 'user'); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('sr' => MAIN_DB_PREFIX.'societe_commerciaux'); + $this->import_fields_array[$r] = array('sr.fk_soc' => "ThirdPartyName*", 'sr.fk_user' => "User*"); $this->import_convertvalue_array[$r] = array( - 'sr.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty'), - 'sr.fk_user'=>array('rule'=>'fetchidfromref', 'classfile'=>'/user/class/user.class.php', 'class'=>'User', 'method'=>'fetch', 'element'=>'User') + 'sr.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), + 'sr.fk_user' => array('rule' => 'fetchidfromref', 'classfile' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'User') ); - $this->import_examplevalues_array[$r] = array('sr.fk_soc'=>"MyBigCompany", 'sr.fk_user'=>"login"); + $this->import_examplevalues_array[$r] = array('sr.fk_soc' => "MyBigCompany", 'sr.fk_user' => "login"); } From 8032bc3a86a0b779615f100a9671c67c31978f9d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:53 +0100 Subject: [PATCH 088/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modStock.class.php | 209 +++++++++++++------------ 1 file changed, 105 insertions(+), 104 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 19deac068ba..1d465e595c8 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -198,7 +199,7 @@ class modStock extends DolibarrModules // Exports //-------- - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Export warehouses $r++; @@ -207,14 +208,14 @@ class modStock extends DolibarrModules $this->export_icon[$r] = "warehouse"; $this->export_permission[$r] = array(array("stock", "lire")); $this->export_fields_array[$r] = array( - 'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town', - 'd.code_departement'=>'Departement', 'c.code'=>'CountryCode', - 'e.phone'=>'Phone', 'e.fax'=>'Fax', 'e.statut'=>'Status', 'pe.rowid'=>'ParentWarehouse', 'pe.ref'=>'LocationSummary' + 'e.rowid' => 'IdWarehouse', 'e.ref' => 'LocationSummary', 'e.description' => 'DescWareHouse', 'e.lieu' => 'LieuWareHouse', 'e.address' => 'Address', 'e.zip' => 'Zip', 'e.town' => 'Town', + 'd.code_departement' => 'Departement', 'c.code' => 'CountryCode', + 'e.phone' => 'Phone', 'e.fax' => 'Fax', 'e.statut' => 'Status', 'pe.rowid' => 'ParentWarehouse', 'pe.ref' => 'LocationSummary' ); $this->export_TypeFields_array[$r] = array( - 'e.ref'=>'Text', 'e.description'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', - 'd.code_departement'=>'List:c_departements:code_departement:code_departement:', 'c.code'=>'List:c_country:code:code:', - 'e.phone'=>'Text', 'e.fax'=>'Text', 'e.statut'=>'Text', 'pe.rowid'=>'List:entrepot:ref:rowid:stock', 'pe.ref'=>'Text' + 'e.ref' => 'Text', 'e.description' => 'Text', 'e.lieu' => 'Text', 'e.address' => 'Text', 'e.zip' => 'Text', 'e.town' => 'Text', + 'd.code_departement' => 'List:c_departements:code_departement:code_departement:', 'c.code' => 'List:c_country:code:code:', + 'e.phone' => 'Text', 'e.fax' => 'Text', 'e.statut' => 'Text', 'pe.rowid' => 'List:entrepot:ref:rowid:stock', 'pe.ref' => 'Text' ); $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array(); // TODO Not used yet @@ -238,43 +239,43 @@ class modStock extends DolibarrModules $this->export_icon[$r] = "warehouse"; $this->export_permission[$r] = array(array("stock", "lire")); $this->export_fields_array[$r] = array( - 'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town', - 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note", - 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", - 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice', - 'p.seuil_stock_alerte'=>'StockLimit', 'p.barcode'=>'BarCode', 'bt.libelle'=>'BarcodeType', + 'e.rowid' => 'IdWarehouse', 'e.ref' => 'LocationSummary', 'e.description' => 'DescWareHouse', 'e.lieu' => 'LieuWareHouse', 'e.address' => 'Address', 'e.zip' => 'Zip', 'e.town' => 'Town', + 'p.rowid' => "ProductId", 'p.ref' => "Ref", 'p.fk_product_type' => "Type", 'p.label' => "Label", 'p.description' => "Description", 'p.note' => "Note", + 'p.price' => "Price", 'p.tva_tx' => 'VAT', 'p.tosell' => "OnSell", 'p.tobuy' => 'OnBuy', 'p.duration' => "Duration", + 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification', 'p.pmp' => 'PMPValue', 'p.cost_price' => 'CostPrice', + 'p.seuil_stock_alerte' => 'StockLimit', 'p.barcode' => 'BarCode', 'bt.libelle' => 'BarcodeType', ); if (isModEnabled('barcode')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); } $this->export_TypeFields_array[$r] = array( - 'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', - 'p.rowid'=>"Numeric", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text", - 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", - 'p.datec'=>'Date', 'p.tms'=>'Date', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric', - 'ps.reel'=>'Numeric', - 'p.seuil_stock_alerte'=>'Numeric', 'p.barcode'=>'Text', 'bt.libelle'=>'List:c_barcode_type:libelle', + 'e.rowid' => 'List:entrepot:ref::stock', 'e.ref' => 'Text', 'e.lieu' => 'Text', 'e.address' => 'Text', 'e.zip' => 'Text', 'e.town' => 'Text', + 'p.rowid' => "Numeric", 'p.ref' => "Text", 'p.fk_product_type' => "Text", 'p.label' => "Text", 'p.description' => "Text", 'p.note' => "Text", + 'p.price' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", 'p.duration' => "Duree", + 'p.datec' => 'Date', 'p.tms' => 'Date', 'p.pmp' => 'Numeric', 'p.cost_price' => 'Numeric', + 'ps.reel' => 'Numeric', + 'p.seuil_stock_alerte' => 'Numeric', 'p.barcode' => 'Text', 'bt.libelle' => 'List:c_barcode_type:libelle', ); if (isModEnabled('barcode')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); } $this->export_entities_array[$r] = array( - 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product", - 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", - 'p.datec'=>'product', 'p.tms'=>'product', 'p.pmp'=>'product', 'p.cost_price'=>'product', - 'ps.reel'=>'stock', - 'p.seuil_stock_alerte'=>'product', 'p.barcode'=>'product', 'bt.libelle'=>'c_barcode_type', + 'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product", + 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", + 'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product', + 'ps.reel' => 'stock', + 'p.seuil_stock_alerte' => 'product', 'p.barcode' => 'product', 'bt.libelle' => 'c_barcode_type', ); // We define here only fields that use another icon that the one defined into export_icon if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } - $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet - $this->export_dependencies_array[$r] = array('stock'=>array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them. + $this->export_aggregate_array[$r] = array('ps.reel' => 'SUM'); // TODO Not used yet + $this->export_dependencies_array[$r] = array('stock' => array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them. $keyforselect = 'product'; $keyforelement = 'product'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ps.reel'=>'Stock')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ps.reel' => 'Stock')); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; @@ -296,42 +297,42 @@ class modStock extends DolibarrModules $this->export_icon[$r] = "warehouse"; $this->export_permission[$r] = array(array("stock", "lire")); $this->export_fields_array[$r] = array( - 'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town', - 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note", - 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", - 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice', - 'pb.rowid'=>'Id', 'pb.batch'=>'Batch', 'pb.qty'=>'Qty', - 'pl.eatby'=>'EatByDate', 'pl.sellby'=>'SellByDate' + 'e.rowid' => 'IdWarehouse', 'e.ref' => 'LocationSummary', 'e.description' => 'DescWareHouse', 'e.lieu' => 'LieuWareHouse', 'e.address' => 'Address', 'e.zip' => 'Zip', 'e.town' => 'Town', + 'p.rowid' => "ProductId", 'p.ref' => "Ref", 'p.fk_product_type' => "Type", 'p.label' => "Label", 'p.description' => "Description", 'p.note' => "Note", + 'p.price' => "Price", 'p.tva_tx' => 'VAT', 'p.tosell' => "OnSell", 'p.tobuy' => 'OnBuy', 'p.duration' => "Duration", + 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification', 'p.pmp' => 'PMPValue', 'p.cost_price' => 'CostPrice', + 'pb.rowid' => 'Id', 'pb.batch' => 'Batch', 'pb.qty' => 'Qty', + 'pl.eatby' => 'EatByDate', 'pl.sellby' => 'SellByDate' ); if (isModEnabled('barcode')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); } $this->export_TypeFields_array[$r] = array( - 'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.lieu'=>'Text', 'e.description'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', - 'p.rowid'=>"Numeric", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text", - 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", - 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice', - 'pb.batch'=>'Text', 'pb.qty'=>'Numeric', - 'pl.eatby'=>'Date', 'pl.sellby'=>'Date' + 'e.rowid' => 'List:entrepot:ref::stock', 'e.ref' => 'Text', 'e.lieu' => 'Text', 'e.description' => 'Text', 'e.address' => 'Text', 'e.zip' => 'Text', 'e.town' => 'Text', + 'p.rowid' => "Numeric", 'p.ref' => "Text", 'p.fk_product_type' => "Text", 'p.label' => "Text", 'p.description' => "Text", 'p.note' => "Text", + 'p.price' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", 'p.duration' => "Duree", + 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification', 'p.pmp' => 'PMPValue', 'p.cost_price' => 'CostPrice', + 'pb.batch' => 'Text', 'pb.qty' => 'Numeric', + 'pl.eatby' => 'Date', 'pl.sellby' => 'Date' ); if (isModEnabled('barcode')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); } $this->export_entities_array[$r] = array( - 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product", - 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", - 'p.datec'=>'product', 'p.tms'=>'product', 'p.pmp'=>'product', 'p.cost_price'=>'product', - 'pb.rowid'=>'batch', 'pb.batch'=>'batch', 'pb.qty'=>'batch', - 'pl.eatby'=>'batch', 'pl.sellby'=>'batch' + 'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product", + 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", + 'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product', + 'pb.rowid' => 'batch', 'pb.batch' => 'batch', 'pb.qty' => 'batch', + 'pl.eatby' => 'batch', 'pl.sellby' => 'batch' ); // We define here only fields that use another icon that the one defined into export_icon if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } - $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet - $this->export_dependencies_array[$r] = array('stockbatch'=>array('pb.rowid'), 'batch'=>array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. + $this->export_aggregate_array[$r] = array('ps.reel' => 'SUM'); // TODO Not used yet + $this->export_dependencies_array[$r] = array('stockbatch' => array('pb.rowid'), 'batch' => array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $keyforselect = 'product_lot'; $keyforelement = 'batch'; - $keyforaliasextra = 'extra'; + $keyforaliasextra = 'extra'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -352,27 +353,27 @@ class modStock extends DolibarrModules $this->export_icon[$r] = "movement"; $this->export_permission[$r] = array(array("stock", "lire")); $this->export_fields_array[$r] = array( - 'sm.rowid'=>'MovementId', 'sm.value'=>'Qty', 'sm.datem'=>'DateMovement', 'sm.label'=>'MovementLabel', 'sm.inventorycode'=>'InventoryCode', - 'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town', - 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note", - 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' + 'sm.rowid' => 'MovementId', 'sm.value' => 'Qty', 'sm.datem' => 'DateMovement', 'sm.label' => 'MovementLabel', 'sm.inventorycode' => 'InventoryCode', + 'e.rowid' => 'IdWarehouse', 'e.ref' => 'LocationSummary', 'e.description' => 'DescWareHouse', 'e.lieu' => 'LieuWareHouse', 'e.address' => 'Address', 'e.zip' => 'Zip', 'e.town' => 'Town', + 'p.rowid' => "ProductId", 'p.ref' => "Ref", 'p.fk_product_type' => "Type", 'p.label' => "Label", 'p.description' => "Description", 'p.note' => "Note", + 'p.price' => "Price", 'p.tva_tx' => 'VAT', 'p.tosell' => "OnSell", 'p.tobuy' => 'OnBuy', 'p.duration' => "Duration", 'p.datec' => 'DateCreation', 'p.tms' => 'DateModification' ); if (isModEnabled('barcode')) { - $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode' => 'BarCode')); } $this->export_TypeFields_array[$r] = array( - 'sm.rowid'=>'Numeric', 'sm.value'=>'Numeric', 'sm.datem'=>'Date', 'sm.batch'=>'Text', 'sm.label'=>'Text', 'sm.inventorycode'=>'Text', - 'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.description'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', - 'p.rowid'=>"Numeric", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text", - 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", 'p.datec'=>'Date', 'p.tms'=>'Date' + 'sm.rowid' => 'Numeric', 'sm.value' => 'Numeric', 'sm.datem' => 'Date', 'sm.batch' => 'Text', 'sm.label' => 'Text', 'sm.inventorycode' => 'Text', + 'e.rowid' => 'List:entrepot:ref::stock', 'e.ref' => 'Text', 'e.description' => 'Text', 'e.lieu' => 'Text', 'e.address' => 'Text', 'e.zip' => 'Text', 'e.town' => 'Text', + 'p.rowid' => "Numeric", 'p.ref' => "Text", 'p.fk_product_type' => "Text", 'p.label' => "Text", 'p.description' => "Text", 'p.note' => "Text", + 'p.price' => "Numeric", 'p.tva_tx' => 'Numeric', 'p.tosell' => "Boolean", 'p.tobuy' => "Boolean", 'p.duration' => "Duree", 'p.datec' => 'Date', 'p.tms' => 'Date' ); if (isModEnabled('barcode')) { - $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text')); + $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode' => 'Text')); } $this->export_entities_array[$r] = array( - 'e.rowid'=>'warehouse', 'e.ref'=>'warehouse', 'e.description'=>'warehouse', 'e.lieu'=>'warehouse', 'e.address'=>'warehouse', 'e.zip'=>'warehouse', 'e.town'=>'warehouse', - 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product", - 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product' + 'e.rowid' => 'warehouse', 'e.ref' => 'warehouse', 'e.description' => 'warehouse', 'e.lieu' => 'warehouse', 'e.address' => 'warehouse', 'e.zip' => 'warehouse', 'e.town' => 'warehouse', + 'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product", + 'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", 'p.datec' => 'product', 'p.tms' => 'product' ); // We define here only fields that use another icon that the one defined into export_icon if (isModEnabled('productbatch')) { $this->export_fields_array[$r]['sm.batch'] = 'Batch'; @@ -380,10 +381,10 @@ class modStock extends DolibarrModules $this->export_entities_array[$r]['sm.batch'] = 'movement'; } if (isModEnabled('barcode')) { - $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product')); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product')); } - $this->export_aggregate_array[$r] = array('sm.value'=>'SUM'); // TODO Not used yet - $this->export_dependencies_array[$r] = array('movement'=>array('sm.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. + $this->export_aggregate_array[$r] = array('sm.value' => 'SUM'); // TODO Not used yet + $this->export_dependencies_array[$r] = array('movement' => array('sm.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'stock_mouvement as sm, '.MAIN_DB_PREFIX.'entrepot as e'; @@ -401,40 +402,40 @@ class modStock extends DolibarrModules $this->import_label[$r] = "Warehouses"; // Translation key $this->import_icon[$r] = "warehouse"; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('e'=>MAIN_DB_PREFIX.'entrepot'); - $this->import_tables_creator_array[$r] = array('e'=>'fk_user_author'); - $this->import_fields_array[$r] = array('e.ref'=>"LocationSummary*", - 'e.description'=>"DescWareHouse", - 'e.lieu'=>"LieuWareHouse", - 'e.address'=>"Address", - 'e.zip'=>'Zip', - 'e.fk_departement'=>'StateCode', - 'e.fk_pays'=>'CountryCode', - 'e.phone'=>'Phone', - 'e.fax'=>'Fax', - 'e.statut'=>'Status', - 'e.fk_parent'=>'ParentWarehouse' + $this->import_tables_array[$r] = array('e' => MAIN_DB_PREFIX.'entrepot'); + $this->import_tables_creator_array[$r] = array('e' => 'fk_user_author'); + $this->import_fields_array[$r] = array('e.ref' => "LocationSummary*", + 'e.description' => "DescWareHouse", + 'e.lieu' => "LieuWareHouse", + 'e.address' => "Address", + 'e.zip' => 'Zip', + 'e.fk_departement' => 'StateCode', + 'e.fk_pays' => 'CountryCode', + 'e.phone' => 'Phone', + 'e.fax' => 'Fax', + 'e.statut' => 'Status', + 'e.fk_parent' => 'ParentWarehouse' ); $this->import_convertvalue_array[$r] = array( - 'e.fk_departement'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/cstate.class.php', 'class'=>'Cstate', 'method'=>'fetch', 'dict'=>'DictionaryStateCode'), - 'e.fk_pays'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'), - 'e.fk_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'ref') + 'e.fk_departement' => array('rule' => 'fetchidfromcodeid', 'classfile' => '/core/class/cstate.class.php', 'class' => 'Cstate', 'method' => 'fetch', 'dict' => 'DictionaryStateCode'), + 'e.fk_pays' => array('rule' => 'fetchidfromcodeid', 'classfile' => '/core/class/ccountry.class.php', 'class' => 'Ccountry', 'method' => 'fetch', 'dict' => 'DictionaryCountry'), + 'e.fk_parent' => array('rule' => 'fetchidfromref', 'classfile' => '/product/stock/class/entrepot.class.php', 'class' => 'Entrepot', 'method' => 'fetch', 'element' => 'ref') ); - $this->import_regex_array[$r] = array('e.statut'=>'^[0|1]'); - $this->import_examplevalues_array[$r] = array('e.ref'=>"ALM001", - 'e.description'=>"Central Warehouse", - 'e.lieu'=>"Central", - 'e.address'=>"Route 66", - 'e.zip'=>'28080', - 'e.fk_departement'=>'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"', - 'e.fk_pays'=>'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"', - 'e.phone'=>'(+33)(0)123456789', - 'e.fax'=>'(+33)(0)123456790', - 'e.statut'=>'1', - 'e.fk_parent'=>'id or ref of warehouse' + $this->import_regex_array[$r] = array('e.statut' => '^[0|1]'); + $this->import_examplevalues_array[$r] = array('e.ref' => "ALM001", + 'e.description' => "Central Warehouse", + 'e.lieu' => "Central", + 'e.address' => "Route 66", + 'e.zip' => '28080', + 'e.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"', + 'e.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"', + 'e.phone' => '(+33)(0)123456789', + 'e.fax' => '(+33)(0)123456790', + 'e.statut' => '1', + 'e.fk_parent' => 'id or ref of warehouse' ); - $this->import_updatekeys_array[$r] = array('p.ref'=>'Ref'); + $this->import_updatekeys_array[$r] = array('p.ref' => 'Ref'); // Import stocks $r++; @@ -442,17 +443,17 @@ class modStock extends DolibarrModules $this->import_label[$r] = "Stocks"; // Translation key $this->import_icon[$r] = "stock"; $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r] = array('ps'=>MAIN_DB_PREFIX.'product_stock'); - $this->import_fields_array[$r] = array('ps.fk_product'=>"Product*", 'ps.fk_entrepot'=>"Warehouse*", 'ps.reel'=>"Stock*"); + $this->import_tables_array[$r] = array('ps' => MAIN_DB_PREFIX.'product_stock'); + $this->import_fields_array[$r] = array('ps.fk_product' => "Product*", 'ps.fk_entrepot' => "Warehouse*", 'ps.reel' => "Stock*"); $this->import_convertvalue_array[$r] = array( - 'ps.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'product'), - 'ps.fk_entrepot'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/stock/class/entrepot.class.php', 'class'=>'Entrepot', 'method'=>'fetch', 'element'=>'ref') + 'ps.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'product'), + 'ps.fk_entrepot' => array('rule' => 'fetchidfromref', 'classfile' => '/product/stock/class/entrepot.class.php', 'class' => 'Entrepot', 'method' => 'fetch', 'element' => 'ref') ); $this->import_examplevalues_array[$r] = array( - 'ps.fk_product'=>"id or ref of product", 'ps.fk_entrepot'=>"id or ref of warehouse", 'ps.reel'=>"10" + 'ps.fk_product' => "id or ref of product", 'ps.fk_entrepot' => "id or ref of warehouse", 'ps.reel' => "10" ); - $this->import_updatekeys_array[$r] = array('ps.fk_product'=>'Product', 'ps.fk_entrepot'=>"Warehouse"); + $this->import_updatekeys_array[$r] = array('ps.fk_product' => 'Product', 'ps.fk_entrepot' => "Warehouse"); $this->import_run_sql_after_array[$r] = array( // Because we may change data that are denormalized, we must update dernormalized data after. 'UPDATE '.MAIN_DB_PREFIX.'product as p SET p.stock = (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);' ); From 32ee0f042c8fa2e40eb2040f1acd55711ebc21e7 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:56 +0100 Subject: [PATCH 089/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modStockTransfer.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index affb6575dcb..3da4bea5c1a 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2022 Frédéric France * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -109,7 +110,7 @@ class modStockTransfer extends DolibarrModules ), // Set this to 1 if features of module are opened to external users 'moduleforexternal' => 0, - 'contactelement'=>1 + 'contactelement' => 1 ); // Data directories to create when module is enabled. // Example: this->dirs = array("/stocktransfer/temp","/stocktransfer/subdir"); @@ -393,7 +394,7 @@ class modStockTransfer extends DolibarrModules /* END MODULEBUILDER EXPORT STOCKTRANSFER */ // Imports profiles provided by this module - $r = 1; + $r = 1; // @phan-suppress-current-line PhanPluginRedundantAssignment /* BEGIN MODULEBUILDER IMPORT STOCKTRANSFER */ /* $langs->load("stocktransfer@stocktransfer"); @@ -438,21 +439,21 @@ class modStockTransfer extends DolibarrModules // Roles $resql = $this->db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."c_type_contact WHERE code = 'STDEST' AND element = 'stocktransfer' AND source = 'internal'"); $res = $this->db->fetch_object($resql); - $nextid=$this->getNextId(); + $nextid = $this->getNextId(); if (empty($res)) { $this->db->query("INSERT INTO ".MAIN_DB_PREFIX."c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES(".((int) $nextid).", 'stocktransfer', 'internal', 'STRESP', 'Responsible for stock transfers', 1, NULL, 0)"); } $resql = $this->db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."c_type_contact WHERE code = 'STFROM' AND element = 'stocktransfer' AND source = 'external'"); $res = $this->db->fetch_object($resql); - $nextid=$this->getNextId(); + $nextid = $this->getNextId(); if (empty($res)) { $this->db->query("INSERT INTO ".MAIN_DB_PREFIX."c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES(".((int) $nextid).", 'stocktransfer', 'external', 'STFROM', 'Contact sending the stock transfer', 1, NULL, 0)"); } $resql = $this->db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."c_type_contact WHERE code = 'STDEST' AND element = 'stocktransfer' AND source = 'external'"); $res = $this->db->fetch_object($resql); - $nextid=$this->getNextId(); + $nextid = $this->getNextId(); if (empty($res)) { $this->db->query("INSERT INTO ".MAIN_DB_PREFIX."c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES(".((int) $nextid).", 'stocktransfer', 'external', 'STDEST', 'Contact receiving the stock transfer', 1, NULL, 0)"); } From 558871207c69fe993daed5059596dc04f4462961 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:31:59 +0100 Subject: [PATCH 090/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modStripe.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index 2e0d639c856..99e71b5aba5 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Saasprov + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,10 +89,10 @@ class modStripe extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Main menu entries - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment /* $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'mainmenu'=>'billing', @@ -109,12 +110,12 @@ class modStripe extends DolibarrModules $r++;*/ $this->menu[$r] = array( - 'fk_menu'=>'fk_mainmenu=bank', - 'type'=>'left', - 'titre'=>'StripeAccount', + 'fk_menu' => 'fk_mainmenu=bank', + 'type' => 'left', + 'titre' => 'StripeAccount', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'bank', - 'leftmenu'=>'stripe', + 'mainmenu' => 'bank', + 'leftmenu' => 'stripe', 'url' => '', 'langs' => 'stripe', 'position' => 100, From fa62f5d89d3fe2dd2e8e6a468c275ae5cd9d267f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:02 +0100 Subject: [PATCH 091/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modTicket.class.php | 47 +++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 260022ef63a..392378cd5c6 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -160,22 +161,22 @@ class modTicket extends DolibarrModules 'tabrowid' => array("rowid", "rowid", "rowid", "rowid"), 'tabcond' => array(isModEnabled("ticket"), isModEnabled("ticket"), isModEnabled("ticket"), isModEnabled("ticket") && getDolGlobalString('TICKET_ENABLE_RESOLUTION')), 'tabhelp' => array( - array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), - array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")), - array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1"), 'public'=>$langs->trans("Enter0or1").'
'.$langs->trans("TicketGroupIsPublicDesc"), 'fk_parent'=>$langs->trans("IfThisCategoryIsChildOfAnother")), - array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")) + array('code' => $langs->trans("EnterAnyCode"), 'use_default' => $langs->trans("Enter0or1")), + array('code' => $langs->trans("EnterAnyCode"), 'use_default' => $langs->trans("Enter0or1")), + array('code' => $langs->trans("EnterAnyCode"), 'use_default' => $langs->trans("Enter0or1"), 'public' => $langs->trans("Enter0or1").'
'.$langs->trans("TicketGroupIsPublicDesc"), 'fk_parent' => $langs->trans("IfThisCategoryIsChildOfAnother")), + array('code' => $langs->trans("EnterAnyCode"), 'use_default' => $langs->trans("Enter0or1")) ), ); // Boxes // Add here list of php file(s) stored in core/boxes that contains class to show a box. $this->boxes = array( - 0=>array('file'=>'box_last_ticket.php', 'enabledbydefaulton'=>'Home'), - 1=>array('file'=>'box_last_modified_ticket.php', 'enabledbydefaulton'=>'Home'), - 2=>array('file'=>'box_ticket_by_severity.php', 'enabledbydefaulton'=>'ticketindex'), - 3=>array('file'=>'box_graph_nb_ticket_last_x_days.php', 'enabledbydefaulton'=>'ticketindex'), - 4=>array('file'=>'box_graph_nb_tickets_type.php', 'enabledbydefaulton'=>'ticketindex'), - 5=>array('file'=>'box_new_vs_close_ticket.php', 'enabledbydefaulton'=>'ticketindex') + 0 => array('file' => 'box_last_ticket.php', 'enabledbydefaulton' => 'Home'), + 1 => array('file' => 'box_last_modified_ticket.php', 'enabledbydefaulton' => 'Home'), + 2 => array('file' => 'box_ticket_by_severity.php', 'enabledbydefaulton' => 'ticketindex'), + 3 => array('file' => 'box_graph_nb_ticket_last_x_days.php', 'enabledbydefaulton' => 'ticketindex'), + 4 => array('file' => 'box_graph_nb_tickets_type.php', 'enabledbydefaulton' => 'ticketindex'), + 5 => array('file' => 'box_new_vs_close_ticket.php', 'enabledbydefaulton' => 'ticketindex') ); // Boxes list // Permissions @@ -333,23 +334,23 @@ class modTicket extends DolibarrModules // Export list of tickets and attributes $langs->load("ticket"); - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_code[$r] = $this->rights_class.'_'.$r; + $this->export_label[$r] = 'ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("ticket", "export")); - $this->export_icon[$r]='ticket'; + $this->export_icon[$r] = 'ticket'; $keyforclass = 'Ticket'; - $keyforclassfile='/ticket/class/ticket.class.php'; - $keyforelement='ticket'; + $keyforclassfile = '/ticket/class/ticket.class.php'; + $keyforelement = 'ticket'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='ticket'; - $keyforaliasextra='extra'; - $keyforelement='ticket'; + $keyforselect = 'ticket'; + $keyforaliasextra = 'extra'; + $keyforelement = 'ticket'; // @phan-suppress-current-line PhanPluginRedundantAssignment include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t'; + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'ticket as t'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'ticket_extrafields as extra on (t.rowid = extra.fk_object)'; - $this->export_sql_end[$r] .=' WHERE 1 = 1'; - $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('ticket').')'; + $this->export_sql_end[$r] .= ' WHERE 1 = 1'; + $this->export_sql_end[$r] .= ' AND t.entity IN ('.getEntity('ticket').')'; $r++; } @@ -397,7 +398,7 @@ class modTicket extends DolibarrModules // remove old settings "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'TICKET_ADDON_PDF_ODT_PATH' AND type = 'ticket' AND entity = ".((int) $conf->entity), // activate default odt templates - array("sql" =>"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, libelle, entity, description) VALUES('generic_ticket_odt','ticket','ODT templates',".((int) $conf->entity).",'TICKET_ADDON_PDF_ODT_PATH');", "ignoreerror" =>1), + array("sql" => "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, libelle, entity, description) VALUES('generic_ticket_odt','ticket','ODT templates',".((int) $conf->entity).",'TICKET_ADDON_PDF_ODT_PATH');", "ignoreerror" => 1), ); return $this->_init($sql, $options); From 42de0761a2e6d41f39ed41a3152e3b0d5cb17a1d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:05 +0100 Subject: [PATCH 092/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modWebPortal.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modWebPortal.class.php b/htdocs/core/modules/modWebPortal.class.php index 99f31d1907f..355c383c324 100644 --- a/htdocs/core/modules/modWebPortal.class.php +++ b/htdocs/core/modules/modWebPortal.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -278,7 +279,7 @@ class modWebPortal extends DolibarrModules // Main menu entries to add $this->menu = array(); - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Add here entries to declare new menus /* $this->menu[$r++] = array( From b08ea1cffab41842c442326d335a5f36a7cc559a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:08 +0100 Subject: [PATCH 093/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modWorkflow.class.php | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index becde5af45c..08f02c03b6a 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2010 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,18 +84,18 @@ class modWorkflow extends DolibarrModules $this->const = array( //0=>array('WORKFLOW_PROPAL_AUTOCREATE_ORDER', 'chaine', '1', 'WORKFLOW_PROPAL_AUTOCREATE_ORDER', 0, 'current', 0), //0=>array('WORKFLOW_ORDER_AUTOCREATE_INVOICE', 'chaine', '1', 'WORKFLOW_ORDER_AUTOCREATE_INVOICE', 0, 'current', 0), - 0=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), - 1=>array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), - 2=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0), - 3=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0), - 4=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0), - 5=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0), - 6=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0), - 7=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0), - 8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), - 10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0), - 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0), - 12=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '0', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0) + 0 => array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), + 1 => array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), + 2 => array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0), + 3 => array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0), + 4 => array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0), + 5 => array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0), + 6 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0), + 7 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0), + 8 => array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), + 10 => array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0), + 11 => array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0), + 12 => array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '0', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0) ); // Boxes @@ -115,7 +116,7 @@ class modWorkflow extends DolibarrModules // Main menu entries $this->menu = array(); // List of menus to add - $r = 0; + $r = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment /* $this->menu[$r]=array('fk_menu'=>0, 'type'=>'top', From 409f7e0268eda5826ad61d013184c7b6d3cd6bf5 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:10 +0100 Subject: [PATCH 094/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/modWorkstation.class.php | 83 ++++++++++---------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/htdocs/core/modules/modWorkstation.class.php b/htdocs/core/modules/modWorkstation.class.php index 8fa1503a1ae..822f5d4d055 100644 --- a/htdocs/core/modules/modWorkstation.class.php +++ b/htdocs/core/modules/modWorkstation.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2021 Frédéric France * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -241,66 +242,66 @@ class modWorkstation extends DolibarrModules $this->menu = array(); $r = 0; // Add here entries to declare new menus - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=mrp', + 'fk_menu' => 'fk_mainmenu=mrp', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'Workstations', + 'type' => 'left', + 'titre' => 'Workstations', 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'mainmenu'=>'mrp', - 'leftmenu'=>'workstation_workstation', - 'url'=>'', + 'mainmenu' => 'mrp', + 'leftmenu' => 'workstation_workstation', + 'url' => '', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'mrp', - 'position'=>1100+$r, + 'langs' => 'mrp', + 'position' => 1100 + $r, // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->workstation->enabled', + 'enabled' => '$conf->workstation->enabled', // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->workstation->workstation->read', - 'target'=>'', + 'perms' => '$user->rights->workstation->workstation->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2, + 'user' => 2, ); - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation', + 'fk_menu' => 'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'WorkstationCreate', - 'mainmenu'=>'mrp', - 'leftmenu'=>'workstation_workstation_left_create', - 'url'=>'/workstation/workstation_card.php?action=create', + 'type' => 'left', + 'titre' => 'WorkstationCreate', + 'mainmenu' => 'mrp', + 'leftmenu' => 'workstation_workstation_left_create', + 'url' => '/workstation/workstation_card.php?action=create', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'mrp', - 'position'=>1100+$r, + 'langs' => 'mrp', + 'position' => 1100 + $r, // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->workstation->enabled', + 'enabled' => '$conf->workstation->enabled', // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->workstation->workstation->write', - 'target'=>'', + 'perms' => '$user->rights->workstation->workstation->write', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2 + 'user' => 2 ); - $this->menu[$r++]=array( + $this->menu[$r++] = array( // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation', + 'fk_menu' => 'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation', // This is a Left menu entry - 'type'=>'left', - 'titre'=>'List', - 'mainmenu'=>'mrp', - 'leftmenu'=>'workstation_workstation_left_list', - 'url'=>'/workstation/workstation_list.php', + 'type' => 'left', + 'titre' => 'List', + 'mainmenu' => 'mrp', + 'leftmenu' => 'workstation_workstation_left_list', + 'url' => '/workstation/workstation_list.php', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'mrp', - 'position'=>1101+$r, + 'langs' => 'mrp', + 'position' => 1101 + $r, // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'$conf->workstation->enabled', + 'enabled' => '$conf->workstation->enabled', // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->workstation->workstation->read', - 'target'=>'', + 'perms' => '$user->rights->workstation->workstation->read', + 'target' => '', // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2 + 'user' => 2 ); /* END MODULEBUILDER LEFTMENU WORKSTATION */ @@ -336,7 +337,7 @@ class modWorkstation extends DolibarrModules /* END MODULEBUILDER EXPORT WORKSTATION */ // Imports profiles provided by this module - $r = 1; + $r = 1; // @phan-suppress-current-line PhanPluginRedundantAssignment /* BEGIN MODULEBUILDER IMPORT WORKSTATION */ /* $langs->load("workstation@workstation"); @@ -390,7 +391,7 @@ class modWorkstation extends DolibarrModules // Document templates $moduledir = 'workstation'; $myTmpObjects = array(); - $myTmpObjects['Workstation'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); + $myTmpObjects['Workstation'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'Workstation') { From c247c8bca8fc268d1c4eef3c633ca04e3eec58fb Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:13 +0100 Subject: [PATCH 095/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/movement/doc/pdf_standard.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 8b5fd2e39bd..e6d6645d8b2 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -291,7 +292,7 @@ class pdf_standard extends ModelePDFMovement // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= $this->db->order($sortfield, $sortorder); @@ -446,7 +447,6 @@ class pdf_standard extends ModelePDFMovement $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $nblines = $num; for ($i = 0; $i < $nblines; $i++) { $objp = $this->db->fetch_object($resql); From 3da05238906d0c720e4acfbf95f2a139717507a6 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:15 +0100 Subject: [PATCH 096/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/product/mod_codeproduct_elephant.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index d0bc9d30e16..644808826d5 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php' */ class mod_codeproduct_elephant extends ModeleProductCode { - // variables inherited from ModelProductCode class public $name = 'Elephant'; public $version = 'dolibarr'; @@ -256,7 +256,7 @@ class mod_codeproduct_elephant extends ModeleProductCode $code = strtoupper(trim($code)); if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) { $result = -2; } else { From a0bbf04d746c207c5e41315220b8da21a9a0c85d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:17 +0100 Subject: [PATCH 097/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/product/mod_codeproduct_leopard.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/product/mod_codeproduct_leopard.php b/htdocs/core/modules/product/mod_codeproduct_leopard.php index 921f2a2617f..126527a55bf 100644 --- a/htdocs/core/modules/product/mod_codeproduct_leopard.php +++ b/htdocs/core/modules/product/mod_codeproduct_leopard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2006-2009 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,7 +116,7 @@ class mod_codeproduct_leopard extends ModeleProductCode $code = strtoupper(trim($code)); if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) { $result = -2; } From c66c59f1460118299f4a4df95957decdd56b0cc9 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:19 +0100 Subject: [PATCH 098/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/product_batch/mod_lot_advanced.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index c455b639022..9cf186afc11 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019 Frédéric France * Copyright (C) 2021 Christophe Battarel + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,7 +151,7 @@ class mod_lot_advanced extends ModeleNumRefBatch $res = $product->fetch($object->fk_product); if ($res > 0 && !empty($product->batch_mask)) { $mask = $product->batch_mask; - $filter = ''; + $filter = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } } From accbf347d1df882590df59e4d1f50c9d808eb6f0 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:21 +0100 Subject: [PATCH 099/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/product_batch/mod_sn_advanced.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index dd3ec1df88e..f3e2a71398e 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2019 Frédéric France * Copyright (C) 2021 Christophe Battarel + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -151,7 +152,7 @@ class mod_sn_advanced extends ModeleNumRefBatch $res = $product->fetch($object->fk_product); if ($res > 0 && !empty($product->batch_mask)) { $mask = $product->batch_mask; - $filter = ''; + $filter = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } } From ce85da498c01aecb3a0083b604fc85b64af659a7 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:24 +0100 Subject: [PATCH 100/130] Fix PhanPluginRedundantAssignment --- .../task/doc/doc_generic_task_odt.modules.php | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index c070f29ce02..06ef3a02cc7 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -149,18 +149,18 @@ class doc_generic_task_odt extends ModelePDFTask } $resarray = array( - $array_key.'_id'=>$object->id, - $array_key.'_ref'=>$object->ref, - $array_key.'_title'=>$object->title, - $array_key.'_description'=>$object->description, - $array_key.'_date_creation'=>dol_print_date($object->date_c, 'day'), - $array_key.'_date_modification'=>dol_print_date($object->date_m, 'day'), - $array_key.'_date_start'=>dol_print_date($object->date_start, 'day'), - $array_key.'_date_end'=>dol_print_date($object->date_end, 'day'), - $array_key.'_note_private'=>$object->note_private, - $array_key.'_note_public'=>$object->note_public, - $array_key.'_public'=>$object->public, - $array_key.'_statut'=>$object->getLibStatut() + $array_key.'_id' => $object->id, + $array_key.'_ref' => $object->ref, + $array_key.'_title' => $object->title, + $array_key.'_description' => $object->description, + $array_key.'_date_creation' => dol_print_date($object->date_c, 'day'), + $array_key.'_date_modification' => dol_print_date($object->date_m, 'day'), + $array_key.'_date_start' => dol_print_date($object->date_start, 'day'), + $array_key.'_date_end' => dol_print_date($object->date_end, 'day'), + $array_key.'_note_private' => $object->note_private, + $array_key.'_note_public' => $object->note_public, + $array_key.'_public' => $object->public, + $array_key.'_statut' => $object->getLibStatut() ); // Retrieve extrafields @@ -188,23 +188,23 @@ class doc_generic_task_odt extends ModelePDFTask global $extrafields; $resarray = array( - 'task_ref'=>$task->ref, - 'task_fk_project'=>$task->fk_project, - 'task_projectref'=>$task->projectref, - 'task_projectlabel'=>$task->projectlabel, - 'task_label'=>$task->label, - 'task_description'=>$task->description, - 'task_fk_parent'=>$task->fk_task_parent, - 'task_duration'=>$task->duration_effective, - 'task_duration_formated'=>convertSecondToTime($task->duration_effective, 'allhourmin'), - 'task_planned_workload'=>$task->planned_workload, - 'task_planned_workload_formated'=>convertSecondToTime($task->planned_workload, 'allhourmin'), - 'task_progress'=>$task->progress, - 'task_public'=>$task->public, - 'task_date_start'=>dol_print_date($task->date_start, 'day'), - 'task_date_end'=>dol_print_date($task->date_end, 'day'), - 'task_note_private'=>$task->note_private, - 'task_note_public'=>$task->note_public + 'task_ref' => $task->ref, + 'task_fk_project' => $task->fk_project, + 'task_projectref' => $task->projectref, + 'task_projectlabel' => $task->projectlabel, + 'task_label' => $task->label, + 'task_description' => $task->description, + 'task_fk_parent' => $task->fk_task_parent, + 'task_duration' => $task->duration_effective, + 'task_duration_formated' => convertSecondToTime($task->duration_effective, 'allhourmin'), + 'task_planned_workload' => $task->planned_workload, + 'task_planned_workload_formated' => convertSecondToTime($task->planned_workload, 'allhourmin'), + 'task_progress' => $task->progress, + 'task_public' => $task->public, + 'task_date_start' => dol_print_date($task->date_start, 'day'), + 'task_date_end' => dol_print_date($task->date_end, 'day'), + 'task_note_private' => $task->note_private, + 'task_note_public' => $task->note_public ); // Retrieve extrafields @@ -229,14 +229,14 @@ class doc_generic_task_odt extends ModelePDFTask { // phpcs:enable return array( - 'projcontacts_id'=>$contact['id'], - 'projcontacts_rowid'=>$contact['rowid'], - 'projcontacts_role'=>$contact['libelle'], - 'projcontacts_lastname'=>$contact['lastname'], - 'projcontacts_firstname'=>$contact['firstname'], - 'projcontacts_fullcivname'=>$contact['fullname'], - 'projcontacts_socname'=>$contact['socname'], - 'projcontacts_email'=>$contact['email'] + 'projcontacts_id' => $contact['id'], + 'projcontacts_rowid' => $contact['rowid'], + 'projcontacts_role' => $contact['libelle'], + 'projcontacts_lastname' => $contact['lastname'], + 'projcontacts_firstname' => $contact['firstname'], + 'projcontacts_fullcivname' => $contact['fullname'], + 'projcontacts_socname' => $contact['socname'], + 'projcontacts_email' => $contact['email'] ); } @@ -252,9 +252,9 @@ class doc_generic_task_odt extends ModelePDFTask { // phpcs:enable return array( - 'projfile_name'=>$file['name'], - 'projfile_date'=>dol_print_date($file['date'], 'day'), - 'projfile_size'=>$file['size'] + 'projfile_name' => $file['name'], + 'projfile_date' => dol_print_date($file['date'], 'day'), + 'projfile_size' => $file['size'] ); } @@ -270,13 +270,13 @@ class doc_generic_task_odt extends ModelePDFTask { // phpcs:enable return array( - 'projref_type'=>$refdetail['type'], - 'projref_ref'=>$refdetail['ref'], - 'projref_date'=>dol_print_date($refdetail['date'], 'day'), - 'projref_socname'=>$refdetail['socname'], - 'projref_amountht'=>price($refdetail['amountht'], 0, $outputlangs), - 'projref_amountttc'=>price($refdetail['amountttc'], 0, $outputlangs), - 'projref_status'=>$refdetail['status'] + 'projref_type' => $refdetail['type'], + 'projref_ref' => $refdetail['ref'], + 'projref_date' => dol_print_date($refdetail['date'], 'day'), + 'projref_socname' => $refdetail['socname'], + 'projref_amountht' => price($refdetail['amountht'], 0, $outputlangs), + 'projref_amountttc' => price($refdetail['amountttc'], 0, $outputlangs), + 'projref_status' => $refdetail['status'] ); } @@ -318,14 +318,14 @@ class doc_generic_task_odt extends ModelePDFTask global $conf; return array( - 'tasktime_rowid'=>$tasktime['rowid'], - 'tasktime_task_date'=>dol_print_date($tasktime['task_date'], 'day'), - 'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'], 'all'), - 'tasktime_note'=>$tasktime['note'], - 'tasktime_fk_user'=>$tasktime['fk_user'], - 'tasktime_user_name'=>$tasktime['name'], - 'tasktime_user_first'=>$tasktime['firstname'], - 'tasktime_fullcivname'=>$tasktime['fullcivname'] + 'tasktime_rowid' => $tasktime['rowid'], + 'tasktime_task_date' => dol_print_date($tasktime['task_date'], 'day'), + 'tasktime_task_duration' => convertSecondToTime($tasktime['task_duration'], 'all'), + 'tasktime_note' => $tasktime['note'], + 'tasktime_fk_user' => $tasktime['fk_user'], + 'tasktime_user_name' => $tasktime['name'], + 'tasktime_user_first' => $tasktime['firstname'], + 'tasktime_fullcivname' => $tasktime['fullcivname'] ); } @@ -341,9 +341,9 @@ class doc_generic_task_odt extends ModelePDFTask { // phpcs:enable return array( - 'tasksfile_name'=>$file['name'], - 'tasksfile_date'=>dol_print_date($file['date'], 'day'), - 'tasksfile_size'=>$file['size'] + 'tasksfile_name' => $file['name'], + 'tasksfile_date' => dol_print_date($file['date'], 'day'), + 'tasksfile_size' => $file['size'] ); } @@ -538,7 +538,7 @@ class doc_generic_task_odt extends ModelePDFTask // Call the ODTSubstitution hook $tmparray = array(); $action = ''; - $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Open and load template @@ -765,7 +765,7 @@ class doc_generic_task_odt extends ModelePDFTask } // Replace tags of lines for contacts - $sourcearray = array('internal', 'external'); + $sourcearray = array('internal', 'external'); // @phan-suppress-current-line PhanPluginRedundantAssignment $contact_arrray = array(); foreach ($sourcearray as $source) { $contact_temp = $project->liste_contact(-1, $source); @@ -815,7 +815,7 @@ class doc_generic_task_odt extends ModelePDFTask // Call the beforeODTSave hook - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -837,14 +837,14 @@ class doc_generic_task_odt extends ModelePDFTask return -1; } } - $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray); $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks dolChmod($file); $odfHandler = null; // Destroy object - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; // Success } else { From 6629c823e8573c99437fd1d852e429258ae6d55b Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:26 +0100 Subject: [PATCH 101/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/societe/mod_codeclient_elephant.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index c0787d83fe9..f83ec00dc77 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php' */ class mod_codeclient_elephant extends ModeleThirdPartyCode { - // variables inherited from ModeleThirdPartyCode class public $name = 'Elephant'; public $version = 'dolibarr'; @@ -277,7 +277,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $code = strtoupper(trim($code)); if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) { $result = -2; } else { From 259faedafe11d3299ff219902120ede94404c457 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:28 +0100 Subject: [PATCH 102/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/societe/mod_codeclient_leopard.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_leopard.php b/htdocs/core/modules/societe/mod_codeclient_leopard.php index 4d4870a3f35..98343987765 100644 --- a/htdocs/core/modules/societe/mod_codeclient_leopard.php +++ b/htdocs/core/modules/societe/mod_codeclient_leopard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,7 +119,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode $code = trim($code); if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) { $result = -2; } From a35efb0b8b692b59ae217e38833048c07475a3a9 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:30 +0100 Subject: [PATCH 103/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/societe/mod_codeclient_monkey.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index 7c9457bd904..9019ff44d29 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2007 Laurent Destailleur * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php' */ class mod_codeclient_monkey extends ModeleThirdPartyCode { - // variables inherited from ModeleThirdPartyCode class public $name = 'Monkey'; public $version = 'dolibarr'; @@ -164,7 +164,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode $code = strtoupper(trim($code)); if (empty($code) && $this->code_null && !getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED')) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } elseif (empty($code) && (!$this->code_null || getDolGlobalString('MAIN_COMPANY_CODE_ALWAYS_REQUIRED'))) { $result = -2; } else { @@ -173,7 +173,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode if ($is_dispo != 0) { $result = -3; } else { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } } else { if (dol_strlen($code) == 0) { @@ -242,7 +242,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode if (dol_strlen($code) < 11) { $res = -1; } else { - $res = 0; + $res = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } return $res; } From a604e446f1414d97357e13d61bfaef11d9cb5642 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:32 +0100 Subject: [PATCH 104/130] Fix PhanPluginRedundantAssignment --- htdocs/core/modules/stock/doc/pdf_standard.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 09247f96fd3..faada7164ef 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2022 Nicolas Silobre + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -257,7 +258,6 @@ class pdf_standard extends ModelePDFStock $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $nblines = $num; $nexY = $tab_top + $this->tabTitleHeight; From cf778e9da8629455735e31f49e371f1501b39794 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:35 +0100 Subject: [PATCH 105/130] Fix PhanPluginRedundantAssignment --- .../core/triggers/interface_50_modTicket_TicketEmail.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 273b560fa27..3610fdf840a 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014-2016 Jean-François Ferry * 2016 Christophe Battarel * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -265,7 +266,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $error_msg = $langs->trans('Error'). ': '; $error_msg .= $langs->transnoentities('TicketWrongContact'); setEventMessages($error_msg, [], 'errors'); - $ok = 0; + $ok = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment break; } } From af5816f3444b2d8e46b606f05e7aa9d40727a1e9 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:37 +0100 Subject: [PATCH 106/130] Fix PhanPluginRedundantAssignment --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a1be6fa35f8..7f7511db38f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1361,7 +1361,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " WHERE rowid = ".((int) $this->id); if ($this->db->query($sql)) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment if ($error == 0) { // Call trigger @@ -1413,7 +1413,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::cancel", LOG_DEBUG); if ($this->db->query($sql)) { - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_CANCEL', $user); From a997447ce387e939d1ace44968390b480a3f8fe5 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:39 +0100 Subject: [PATCH 107/130] Fix PhanPluginRedundantAssignment --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 39fcd70e101..2ac0eb78ccf 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1575,7 +1575,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1594,7 +1594,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1613,7 +1613,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } @@ -1635,7 +1635,7 @@ class FactureFournisseurRec extends CommonInvoice $statusType = 'status6'; $labelStatus = $langs->transnoentitiesnoconv('Disabled'); } else { - $statusType = 'status0'; + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment $labelStatus = $langs->transnoentitiesnoconv('Draft'); } } From 63b2768229fabb943a90013d1c5e51b7e25308a7 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:41 +0100 Subject: [PATCH 108/130] Fix PhanPluginRedundantAssignment --- htdocs/holiday/class/holiday.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c12032028e6..34ef7b9c9e9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1306,7 +1307,7 @@ class Holiday extends CommonObject } // We found a record, user is on holiday by default, so is not available is true. - $isavailablemorning = true; + $isavailablemorning = true; // @phan-suppress-current-line PhanPluginRedundantAssignment foreach ($arrayofrecord as $record) { if ($timestamp == $record['date_start'] && $record['halfday'] == 2) { continue; @@ -1317,7 +1318,7 @@ class Holiday extends CommonObject $isavailablemorning = false; break; } - $isavailableafternoon = true; + $isavailableafternoon = true; // @phan-suppress-current-line PhanPluginRedundantAssignment foreach ($arrayofrecord as $record) { if ($timestamp == $record['date_end'] && $record['halfday'] == 2) { continue; From 9c6394b996a68700e6dc61baa553cd47f322c0e0 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:43 +0100 Subject: [PATCH 109/130] Fix PhanPluginRedundantAssignment --- htdocs/install/step1.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index ffd1ff7b54e..85e77bbbd79 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015-2016 Raphaël Doursenaud + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -951,67 +952,67 @@ function write_conf_file($conffile) fwrite($fp, "\n"); if (empty($force_dolibarr_lib_FPDF_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_FPDF_PATH = ''; + $force_dolibarr_lib_FPDF_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_FPDF_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_FPDF_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_TCPDF_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_TCPDF_PATH = ''; + $force_dolibarr_lib_TCPDF_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_TCPDF_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_TCPDF_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_FPDI_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_FPDI_PATH = ''; + $force_dolibarr_lib_FPDI_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_FPDI_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_FPDI_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_TCPDI_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_TCPDI_PATH = ''; + $force_dolibarr_lib_TCPDI_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_TCPDI_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_TCPDI_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_GEOIP_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_GEOIP_PATH = ''; + $force_dolibarr_lib_GEOIP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_GEOIP_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_GEOIP_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_NUSOAP_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_NUSOAP_PATH = ''; + $force_dolibarr_lib_NUSOAP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_NUSOAP_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_NUSOAP_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_ODTPHP_PATH)) { fwrite($fp, '//'); - $force_dolibarr_lib_ODTPHP_PATH = ''; + $force_dolibarr_lib_ODTPHP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_ODTPHP_PATH="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_ODTPHP_PATH)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) { fwrite($fp, '//'); - $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = ''; + $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP="'.dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)).'";'); fwrite($fp, "\n"); if (empty($force_dolibarr_js_CKEDITOR)) { fwrite($fp, '//'); - $force_dolibarr_js_CKEDITOR = ''; + $force_dolibarr_js_CKEDITOR = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_js_CKEDITOR=\''.dol_escape_php($force_dolibarr_js_CKEDITOR, 1).'\';'); fwrite($fp, "\n"); if (empty($force_dolibarr_js_JQUERY)) { fwrite($fp, '//'); - $force_dolibarr_js_JQUERY = ''; + $force_dolibarr_js_JQUERY = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_js_JQUERY=\''.dol_escape_php($force_dolibarr_js_JQUERY, 1).'\';'); fwrite($fp, "\n"); if (empty($force_dolibarr_js_JQUERY_UI)) { fwrite($fp, '//'); - $force_dolibarr_js_JQUERY_UI = ''; + $force_dolibarr_js_JQUERY_UI = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_js_JQUERY_UI=\''.dol_escape_php($force_dolibarr_js_JQUERY_UI, 1).'\';'); fwrite($fp, "\n"); @@ -1020,13 +1021,13 @@ function write_conf_file($conffile) fwrite($fp, "\n"); if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) { fwrite($fp, '//'); - $force_dolibarr_font_DOL_DEFAULT_TTF = ''; + $force_dolibarr_font_DOL_DEFAULT_TTF = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\''.dol_escape_php($force_dolibarr_font_DOL_DEFAULT_TTF, 1).'\';'); fwrite($fp, "\n"); if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) { fwrite($fp, '//'); - $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = ''; + $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } fwrite($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.dol_escape_php($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD, 1).'\';'); fwrite($fp, "\n"); From b3efdbbd5f00bbd626635aaa889ffc7f6c27659f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:46 +0100 Subject: [PATCH 110/130] Fix PhanPluginRedundantAssignment --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b334168357a..6fc00d524ac 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3453,7 +3453,7 @@ function main_area($title = '') // Permit to add user company information on each printed document by setting SHOW_SOCINFO_ON_PRINT if (getDolGlobalString('SHOW_SOCINFO_ON_PRINT') && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'aZ09'))) { - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('showSocinfoOnPrint', $parameters); if (empty($reshook)) { print ''."\n"; @@ -3839,7 +3839,7 @@ if (!function_exists("llxFooter")) { } } - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('beforeBodyClose', $parameters); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { print $hookmanager->resPrint; From c90d856d6c0ef10f3c986ed80168989c7dd84da0 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:48 +0100 Subject: [PATCH 111/130] Fix PhanPluginRedundantAssignment --- htdocs/product/class/product.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 96c1ce01069..c124d0b7220 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1170,7 +1170,7 @@ class Product extends CommonObject $result = $this->verify(); // We don't check when update called during a create because verify was already done } else { // we can continue - $result = 0; + $result = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment } if ($result >= 0) { @@ -2335,9 +2335,6 @@ class Product extends CommonObject if (empty($newminprice)) { $newminprice = 0; } - if (empty($newminprice)) { - $newminprice = 0; - } // Check parameters if ($newvat == '') { From 9053c0c7c081785ae6d291e21cb2aef60155715a Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:50 +0100 Subject: [PATCH 112/130] Fix PhanPluginRedundantAssignment --- htdocs/societe/class/societe.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f1a2e943cf7..1d7a78e3a13 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5154,7 +5154,6 @@ class Societe extends CommonObject $this->db->begin(); - $field = 'accountancy_code_sell'; if ($type == 'buy') { $field = 'accountancy_code_buy'; } elseif ($type == 'sell') { From e7d378055f371000864d3c21176f07fa65aca5f8 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:52 +0100 Subject: [PATCH 113/130] Fix PhanPluginRedundantAssignment --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 0769e98d05e..778bd6ef730 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -3082,7 +3082,7 @@ class Ticket extends CommonObject if ($mode == 'opened') { $status = 'openall'; //$delay_warning = $conf->ticket->warning_delay; - $delay_warning = 0; + $delay_warning = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment $label = $langs->trans("MenuListNonClosed"); $labelShort = $langs->trans("MenuListNonClosed"); } From 8c08c6d483943513e2ac407aa8d4345decccd9f2 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:54 +0100 Subject: [PATCH 114/130] Fix PhanPluginRedundantAssignment --- htdocs/user/class/api_users.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index ac40da2c6df..230344118c6 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -446,8 +447,6 @@ class Users extends DolibarrApi throw new RestException(403); } - $obj_ret = array(); - $user = new User($this->db); $result = $user->fetch($id); if (!$result) { From 17a0ee081071cbbc7928ec82aa46cda42bd84d2f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:56 +0100 Subject: [PATCH 115/130] Fix PhanPluginRedundantAssignment --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fd6b5d6dc3a..c68c602bdbb 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3092,7 +3092,7 @@ class User extends CommonObject if ($option == 'xxx') { $linkstart = ''; - $linkend = ''; + $linkend = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment } if ($option == 'nolink') { From a8e678128855cf14f8e9eac310e33ad5b41d0bb1 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:32:58 +0100 Subject: [PATCH 116/130] Fix PhanPluginRedundantAssignment --- htdocs/webportal/class/html.formlistwebportal.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/webportal/class/html.formlistwebportal.class.php b/htdocs/webportal/class/html.formlistwebportal.class.php index 524c4e99548..ac7fc81679b 100644 --- a/htdocs/webportal/class/html.formlistwebportal.class.php +++ b/htdocs/webportal/class/html.formlistwebportal.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2023-2024 Patrice Andreani * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -300,7 +301,7 @@ class FormListWebPortal $sql .= " FROM " . $this->db->prefix() . $object->table_element . " as t"; // Add table from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { @@ -343,7 +344,7 @@ class FormListWebPortal // $sql .= natural_search(array_keys($fieldstosearchall), $search_all); //} // Add where from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -422,7 +423,7 @@ class FormListWebPortal } } // Add $param from hooks - $parameters = array(); + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; From 217dc729671f78abd383b2662aca86e38de5689d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:33:01 +0100 Subject: [PATCH 117/130] Fix PhanPluginRedundantAssignment --- htdocs/webservices/server_category.php | 79 +++++++++++++------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 6e3e66bc205..a062c5c9361 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 JF FERRY + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,11 +78,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); @@ -95,16 +96,16 @@ $server->wsdl->addComplexType( 'all', '', array( - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'id_mere' => array('name'=>'id_mere', 'type'=>'xsd:string'), - 'label' => array('name'=>'label', 'type'=>'xsd:string'), - 'description' => array('name'=>'description', 'type'=>'xsd:string'), - 'socid' => array('name'=>'socid', 'type'=>'xsd:string'), - 'type' => array('name'=>'type', 'type'=>'xsd:string'), - 'visible' => array('name'=>'visible', 'type'=>'xsd:string'), - 'dir'=> array('name'=>'dir', 'type'=>'xsd:string'), - 'photos' => array('name'=>'photos', 'type'=>'tns:PhotosArray'), - 'filles' => array('name'=>'filles', 'type'=>'tns:FillesArray') + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'id_mere' => array('name' => 'id_mere', 'type' => 'xsd:string'), + 'label' => array('name' => 'label', 'type' => 'xsd:string'), + 'description' => array('name' => 'description', 'type' => 'xsd:string'), + 'socid' => array('name' => 'socid', 'type' => 'xsd:string'), + 'type' => array('name' => 'type', 'type' => 'xsd:string'), + 'visible' => array('name' => 'visible', 'type' => 'xsd:string'), + 'dir' => array('name' => 'dir', 'type' => 'xsd:string'), + 'photos' => array('name' => 'photos', 'type' => 'tns:PhotosArray'), + 'filles' => array('name' => 'filles', 'type' => 'tns:FillesArray') ) ); @@ -119,14 +120,14 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:categorie[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:categorie[]') ), 'tns:categorie' ); - /* - * Image of product - */ +/* + * Image of product +*/ $server->wsdl->addComplexType( 'PhotosArray', 'complexType', @@ -143,9 +144,9 @@ $server->wsdl->addComplexType( ) ); - /* - * An image - */ +/* + * An image +*/ $server->wsdl->addComplexType( 'image', 'complexType', @@ -153,10 +154,10 @@ $server->wsdl->addComplexType( 'all', '', array( - 'photo' => array('name'=>'photo', 'type'=>'xsd:string'), - 'photo_vignette' => array('name'=>'photo_vignette', 'type'=>'xsd:string'), - 'imgWidth' => array('name'=>'imgWidth', 'type'=>'xsd:string'), - 'imgHeight' => array('name'=>'imgHeight', 'type'=>'xsd:string') + 'photo' => array('name' => 'photo', 'type' => 'xsd:string'), + 'photo_vignette' => array('name' => 'photo_vignette', 'type' => 'xsd:string'), + 'imgWidth' => array('name' => 'imgWidth', 'type' => 'xsd:string'), + 'imgHeight' => array('name' => 'imgHeight', 'type' => 'xsd:string') ) ); @@ -170,8 +171,8 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); @@ -187,9 +188,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getCategory', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'categorie'=>'tns:categorie'), + array('result' => 'tns:result', 'categorie' => 'tns:categorie'), $ns, $ns.'#getCategory', $styledoc, @@ -232,7 +233,7 @@ function getCategory($authentication, $id) if (!$error) { $fuser->getrights(); - $nbmax = 10; + $nbmax = 10; // @phan-suppress-current-line PhanPluginRedundantAssignment if ($fuser->hasRight('categorie', 'lire')) { $categorie = new Categorie($db); $result = $categorie->fetch($id); @@ -260,13 +261,13 @@ function getCategory($authentication, $id) $pdir = get_exdir($child_cat->id, 2, 0, 0, $categorie, 'category').$child_cat->id."/photos/"; $dir = $dir.'/'.$pdir; $cat['filles'][] = array( - 'id'=>$child_cat->id, + 'id' => $child_cat->id, 'id_mere' => $categorie->id_mere, - 'label'=>$child_cat->label, - 'description'=>$child_cat->description, - 'socid'=>$child_cat->socid, + 'label' => $child_cat->label, + 'description' => $child_cat->description, + 'socid' => $child_cat->socid, //'visible'=>$child_cat->visible, - 'type'=>$child_cat->type, + 'type' => $child_cat->type, 'dir' => $pdir, 'photos' => $child_cat->liste_photos($dir, $nbmax) ); @@ -275,8 +276,8 @@ function getCategory($authentication, $id) // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'categorie'=> $cat + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'categorie' => $cat ); } else { $error++; @@ -291,7 +292,7 @@ function getCategory($authentication, $id) } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; From 2b9a416dfd1145e5c1a03e062f49f2eb344ff56b Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:33:04 +0100 Subject: [PATCH 118/130] Fix PhanPluginRedundantAssignment --- htdocs/webservices/server_user.php | 184 ++++++++++++++--------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 52267436a8d..b0f7f2372fd 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,11 +82,11 @@ $server->wsdl->addComplexType( 'all', '', array( - 'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'), - 'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'), + 'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); @@ -97,8 +98,8 @@ $server->wsdl->addComplexType( 'all', '', array( - 'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'), - 'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'), + 'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'), + 'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'), ) ); @@ -110,34 +111,34 @@ $server->wsdl->addComplexType( 'all', '', array( - 'element' => array('name'=>'element', 'type'=>'xsd:string'), - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'lastname' => array('name'=>'lastname', 'type'=>'xsd:string'), - 'firstname' => array('name'=>'firstname', 'type'=>'xsd:string'), - 'note' => array('name'=>'note', 'type'=>'xsd:string'), - 'email' => array('name'=>'email', 'type'=>'xsd:string'), - 'signature' => array('name'=>'signature', 'type'=>'xsd:string'), - 'office_phone' => array('name'=>'office_phone', 'type'=>'xsd:string'), - 'office_fax' => array('name'=>'office_fax', 'type'=>'xsd:string'), - 'user_mobile' => array('name'=>'user_mobile', 'type'=>'xsd:string'), - 'admin' => array('name'=>'admin', 'type'=>'xsd:string'), - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), - 'pass_indatabase' => array('name'=>'pass_indatabase', 'type'=>'xsd:string'), - 'pass_indatabase_crypted' => array('name'=>'pass_indatabase_crypted', 'type'=>'xsd:string'), - 'datec' => array('name'=>'datec', 'type'=>'xsd:dateTime'), - 'datem' => array('name'=>'datem', 'type'=>'xsd:dateTime'), - 'fk_thirdparty' => array('name'=>'fk_thirdparty', 'type'=>'xsd:string'), - 'fk_contact' => array('name'=>'fk_contact', 'type'=>'xsd:string'), - 'fk_member' => array('name'=>'fk_member', 'type'=>'xsd:string'), - 'datelastlogin' => array('name'=>'datelastlogin', 'type'=>'xsd:dateTime'), - 'datepreviouslogin' => array('name'=>'datepreviouslogin', 'type'=>'xsd:dateTime'), - 'statut' => array('name'=>'statut', 'type'=>'xsd:string'), - 'photo' => array('name'=>'photo', 'type'=>'xsd:string'), - 'lang' => array('name'=>'lang', 'type'=>'xsd:string'), - 'entrepots' => array('name'=>'entrepots', 'type'=>'xsd:string'), + 'element' => array('name' => 'element', 'type' => 'xsd:string'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), + 'note' => array('name' => 'note', 'type' => 'xsd:string'), + 'email' => array('name' => 'email', 'type' => 'xsd:string'), + 'signature' => array('name' => 'signature', 'type' => 'xsd:string'), + 'office_phone' => array('name' => 'office_phone', 'type' => 'xsd:string'), + 'office_fax' => array('name' => 'office_fax', 'type' => 'xsd:string'), + 'user_mobile' => array('name' => 'user_mobile', 'type' => 'xsd:string'), + 'admin' => array('name' => 'admin', 'type' => 'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), + 'pass_indatabase' => array('name' => 'pass_indatabase', 'type' => 'xsd:string'), + 'pass_indatabase_crypted' => array('name' => 'pass_indatabase_crypted', 'type' => 'xsd:string'), + 'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'), + 'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'), + 'fk_thirdparty' => array('name' => 'fk_thirdparty', 'type' => 'xsd:string'), + 'fk_contact' => array('name' => 'fk_contact', 'type' => 'xsd:string'), + 'fk_member' => array('name' => 'fk_member', 'type' => 'xsd:string'), + 'datelastlogin' => array('name' => 'datelastlogin', 'type' => 'xsd:dateTime'), + 'datepreviouslogin' => array('name' => 'datepreviouslogin', 'type' => 'xsd:dateTime'), + 'statut' => array('name' => 'statut', 'type' => 'xsd:string'), + 'photo' => array('name' => 'photo', 'type' => 'xsd:string'), + 'lang' => array('name' => 'lang', 'type' => 'xsd:string'), + 'entrepots' => array('name' => 'entrepots', 'type' => 'xsd:string'), //'rights' => array('name'=>'rights','type'=>'xsd:string'), - 'canvas' => array('name'=>'canvas', 'type'=>'xsd:string') + 'canvas' => array('name' => 'canvas', 'type' => 'xsd:string') ) ); @@ -149,10 +150,10 @@ $server->wsdl->addComplexType( 'all', '', array( - 'name' => array('name'=>'name', 'type'=>'xsd:string'), - 'id' => array('name'=>'id', 'type'=>'xsd:string'), - 'datec' => array('name'=>'datec', 'type'=>'xsd:string'), - 'nb' => array('name'=>'nb', 'type'=>'xsd:string') + 'name' => array('name' => 'name', 'type' => 'xsd:string'), + 'id' => array('name' => 'id', 'type' => 'xsd:string'), + 'datec' => array('name' => 'datec', 'type' => 'xsd:string'), + 'nb' => array('name' => 'nb', 'type' => 'xsd:string') ) ); @@ -164,42 +165,42 @@ $server->wsdl->addComplexType( 'SOAP-ENC:Array', array(), array( - array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:group[]') + array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:group[]') ), 'tns:group' ); $thirdpartywithuser_fields = array( // For thirdparty and contact - 'name' => array('name'=>'name', 'type'=>'xsd:string'), - 'firstname' => array('name'=>'firstname', 'type'=>'xsd:string'), - 'name_thirdparty' => array('name'=>'name_thirdparty', 'type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'), - 'client' => array('name'=>'client', 'type'=>'xsd:string'), - 'fournisseur' => array('name'=>'fournisseur', 'type'=>'xsd:string'), - 'address' => array('name'=>'address', 'type'=>'xsd:string'), - 'zip' => array('name'=>'zip', 'type'=>'xsd:string'), - 'town' => array('name'=>'town', 'type'=>'xsd:string'), - 'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'), - 'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'), - 'phone' => array('name'=>'phone', 'type'=>'xsd:string'), - 'phone_mobile' => array('name'=>'phone_mobile', 'type'=>'xsd:string'), - 'fax' => array('name'=>'fax', 'type'=>'xsd:string'), - 'email' => array('name'=>'email', 'type'=>'xsd:string'), - 'url' => array('name'=>'url', 'type'=>'xsd:string'), - 'profid1' => array('name'=>'profid1', 'type'=>'xsd:string'), - 'profid2' => array('name'=>'profid2', 'type'=>'xsd:string'), - 'profid3' => array('name'=>'profid3', 'type'=>'xsd:string'), - 'profid4' => array('name'=>'profid4', 'type'=>'xsd:string'), - 'profid5' => array('name'=>'profid5', 'type'=>'xsd:string'), - 'profid6' => array('name'=>'profid6', 'type'=>'xsd:string'), - 'capital' => array('name'=>'capital', 'type'=>'xsd:string'), - 'tva_assuj' => array('name'=>'tva_assuj', 'type'=>'xsd:string'), - 'tva_intra' => array('name'=>'tva_intra', 'type'=>'xsd:string'), + 'name' => array('name' => 'name', 'type' => 'xsd:string'), + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), + 'name_thirdparty' => array('name' => 'name_thirdparty', 'type' => 'xsd:string'), + 'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'), + 'client' => array('name' => 'client', 'type' => 'xsd:string'), + 'fournisseur' => array('name' => 'fournisseur', 'type' => 'xsd:string'), + 'address' => array('name' => 'address', 'type' => 'xsd:string'), + 'zip' => array('name' => 'zip', 'type' => 'xsd:string'), + 'town' => array('name' => 'town', 'type' => 'xsd:string'), + 'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'), + 'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'), + 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), + 'phone_mobile' => array('name' => 'phone_mobile', 'type' => 'xsd:string'), + 'fax' => array('name' => 'fax', 'type' => 'xsd:string'), + 'email' => array('name' => 'email', 'type' => 'xsd:string'), + 'url' => array('name' => 'url', 'type' => 'xsd:string'), + 'profid1' => array('name' => 'profid1', 'type' => 'xsd:string'), + 'profid2' => array('name' => 'profid2', 'type' => 'xsd:string'), + 'profid3' => array('name' => 'profid3', 'type' => 'xsd:string'), + 'profid4' => array('name' => 'profid4', 'type' => 'xsd:string'), + 'profid5' => array('name' => 'profid5', 'type' => 'xsd:string'), + 'profid6' => array('name' => 'profid6', 'type' => 'xsd:string'), + 'capital' => array('name' => 'capital', 'type' => 'xsd:string'), + 'tva_assuj' => array('name' => 'tva_assuj', 'type' => 'xsd:string'), + 'tva_intra' => array('name' => 'tva_intra', 'type' => 'xsd:string'), // For user - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'group_id' => array('name'=>'group_id', 'type'=>'xsd:string') + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'group_id' => array('name' => 'group_id', 'type' => 'xsd:string') ); $elementtype = 'socpeople'; @@ -221,7 +222,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie $type = 'xsd:string'; } - $extrafield_array['contact_options_'.$key] = array('name'=>'contact_options_'.$key, 'type'=>$type); + $extrafield_array['contact_options_'.$key] = array('name' => 'contact_options_'.$key, 'type' => $type); } } @@ -247,9 +248,9 @@ $server->wsdl->addComplexType( 'all', '', array( - 'login' => array('name'=>'login', 'type'=>'xsd:string'), - 'password' => array('name'=>'password', 'type'=>'xsd:string'), - 'entity' => array('name'=>'entity', 'type'=>'xsd:string'), + 'login' => array('name' => 'login', 'type' => 'xsd:string'), + 'password' => array('name' => 'password', 'type' => 'xsd:string'), + 'entity' => array('name' => 'entity', 'type' => 'xsd:string'), ) ); @@ -267,9 +268,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped $server->register( 'getUser', // Entry values - array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), + array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values - array('result'=>'tns:result', 'user'=>'tns:user'), + array('result' => 'tns:result', 'user' => 'tns:user'), $ns, $ns.'#getUser', $styledoc, @@ -280,9 +281,9 @@ $server->register( $server->register( 'getListOfGroups', // Entry values - array('authentication'=>'tns:authentication'), + array('authentication' => 'tns:authentication'), // Exit values - array('result'=>'tns:result', 'groups'=>'tns:GroupsArray'), + array('result' => 'tns:result', 'groups' => 'tns:GroupsArray'), $ns, $ns.'#getListOfGroups', $styledoc, @@ -293,9 +294,9 @@ $server->register( $server->register( 'createUserFromThirdparty', // Entry values - array('authentication'=>'tns:authentication', 'thirdpartywithuser'=>'tns:thirdpartywithuser'), + array('authentication' => 'tns:authentication', 'thirdpartywithuser' => 'tns:thirdpartywithuser'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#createUserFromThirdparty', $styledoc, @@ -306,9 +307,9 @@ $server->register( $server->register( 'setUserPassword', // Entry values - array('authentication'=>'tns:authentication', 'shortuser'=>'tns:shortuser'), + array('authentication' => 'tns:authentication', 'shortuser' => 'tns:shortuser'), // Exit values - array('result'=>'tns:result', 'id'=>'xsd:string'), + array('result' => 'tns:result', 'id' => 'xsd:string'), $ns, $ns.'#setUserPassword', $styledoc, @@ -363,8 +364,8 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') if ($result > 0) { // Create $objectresp = array( - 'result'=>array('result_code'=>'OK', 'result_label'=>''), - 'user'=>array( + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'user' => array( 'id' => $user->id, 'lastname' => $user->lastname, 'firstname' => $user->firstname, @@ -406,7 +407,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') } if ($error) { - $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); + $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel)); } return $objectresp; @@ -454,7 +455,7 @@ function getListOfGroups($authentication) $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); - $arraygroups[] = array('id'=>$obj->rowid, 'name'=>$obj->name, 'datec'=>$obj->datec, 'nb'=>$obj->nb); + $arraygroups[] = array('id' => $obj->rowid, 'name' => $obj->name, 'datec' => $obj->datec, 'nb' => $obj->nb); $i++; } } else { @@ -466,13 +467,13 @@ function getListOfGroups($authentication) if ($error) { $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), - 'groups'=>$arraygroups + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel), + 'groups' => $arraygroups ); } else { $objectresp = array( - 'result'=>array('result_code' => 'OK', 'result_label' => ''), - 'groups'=>$arraygroups + 'result' => array('result_code' => 'OK', 'result_label' => ''), + 'groups' => $arraygroups ); } @@ -648,8 +649,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) if (!$error) { $db->commit(); - $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'SUCCESS'), 'id'=>$socid_return); - $error = 0; + $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => 'SUCCESS'), 'id' => $socid_return); } } else { $error++; @@ -672,7 +672,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) if ($error) { $db->rollback(); $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel) + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel) ); } @@ -728,7 +728,7 @@ function setUserPassword($authentication, $shortuser) $errorlabel = 'Error when changing password'; } else { $objectresp = array( - 'result'=>array('result_code' => 'OK', 'result_label' => ''), + 'result' => array('result_code' => 'OK', 'result_label' => ''), ); } } else { @@ -746,7 +746,7 @@ function setUserPassword($authentication, $shortuser) if ($error) { $objectresp = array( - 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel) + 'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel) ); } From fcca1b6987f71f31f9f07a8ad2c647bba1b008ee Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 00:36:32 +0100 Subject: [PATCH 119/130] Qual: Enable PhanPluginRedundantAssignment (all fixed) --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 53dd0aa447b..08c547244ee 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -468,7 +468,7 @@ return [ // 'PhanPluginDescriptionlessCommentOnPublicProperty', 'PhanPluginUnknownFunctionParamType', 'PhanTypeSuspiciousStringExpression', - 'PhanPluginRedundantAssignment', + // 'PhanPluginRedundantAssignment', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidRightOperandOfNumericOp', From d8a785fa2b1369142db9ed5d80238885b721c027 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 02:17:35 +0100 Subject: [PATCH 120/130] FIX get_string_between # FIX get_string_between Noticed that the typing of the arguments was incorrect and then found the implementation suspicious. The implemented test confirmed that it was flawed. Fixed. Apparently this method is used in get_next_value . --- htdocs/core/lib/functions2.lib.php | 21 ++++++++++------ test/phpunit/Functions2LibTest.php | 39 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index f5e95da450c..e2a8569e710 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1431,23 +1431,28 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } /** - * Get string between + * Get string from "$start" up to "$end" + * + * If string is "STARTcontentEND" and $start is "START" and $end is "END", + * then this function returns "content" * * @param string $string String to test - * @param int $start Value for start - * @param int $end Value for end + * @param string $start String Value for start + * @param string $end String Value for end * @return string Return part of string */ function get_string_between($string, $start, $end) { - $string = " ".$string; $ini = strpos($string, $start); - if ($ini == 0) { - return ""; + if ($ini === false) { + return ''; } $ini += strlen($start); - $len = strpos($string, $end, $ini) - $ini; - return substr($string, $ini, $len); + $endpos = strpos($string, $end, $ini); + if ($endpos === false) { + return ''; + } + return substr($string, $ini, $endpos - $ini); } /** diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 1d987d5aac5..081061a08ed 100644 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 Alexandre Janniaux + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -205,4 +206,42 @@ class Functions2LibTest extends CommonClassTest print __METHOD__." for ".$ip." result=".$result."\n"; $this->assertEquals(2, $result, $ip); } + + + /** + * Dataprovider for testGetStringBetween + * + * @return array [ "STARTcontentEND", "START", "END", "content"], + 'start does not match' => [ "ScontentEND", "START", "END", ""], + 'end does not match' => [ "STARTcontentN", "START", "END", ""], + 'no match' => [ "content", "START", "END", ""], + 'end before start' => [ "ENDcontentSTART", "START", "END", ""], + 'end inside start' => [ "BAB", "BA", "AB", ""], + 'multiple matches' => [ "BAcontentABBAdoneAB", "BA", "AB", "content"], + ]; + } + + + /** + * Test get_string_between() + * + * @param string $string String to search in. + * @param string $start String indicating start + * @param string $end String indicating end + * @param string $expected Expected result + * + * @return void + * + * @dataProvider stringBetweenDataProvider + */ + public function testGetStringBetween($string, $start, $end, $expected) + { + $this->assertEquals($expected, get_string_between($string, $start, $end)); + } } From 09a62365eb19691703be28ee516930fb9b23a82d Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 10:08:12 +0100 Subject: [PATCH 121/130] Fix PhanPluginUnknownFunctionParamType # Fix PhanPluginUnknownFunctionParamType PHPdoc for $object was incorrect. Also updated the return type and the parameter typing for $head in complete_head_from_modules --- htdocs/core/lib/functions.lib.php | 4 ++-- .../lib/eventorganization_conferenceorbooth.lib.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e6edeabe7ac..51a6ffc698a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10318,8 +10318,8 @@ function getLanguageCodeFromCountryCode($countrycode) * @param Conf $conf Object conf * @param Translate $langs Object langs * @param object|null $object Object object - * @param array $head Object head - * @param int $h New position to fill + * @param array> $head List of head tabs (updated by this function) + * @param int $h New position to fill (updated by this function) * @param string $type Value for object where objectvalue can be * 'thirdparty' to add a tab in third party view * 'intervention' to add a tab in intervention view diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index b0efb0602c5..f4d88699fe1 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php @@ -1,6 +1,7 @@ + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,7 +115,7 @@ function conferenceorboothPrepareHead($object, $with_project = 0) /** * Prepare array of tabs for ConferenceOrBooth Project tab * - * @param $object Project Project + * @param Project $object Project * @return array */ function conferenceorboothProjectPrepareHead($object) @@ -190,7 +191,7 @@ function conferenceorboothProjectPrepareHead($object) * Prepare array of tabs for ConferenceOrBoothAttendees * * @param ConferenceOrBoothAttendee $object ConferenceOrBoothAttendee - * @return array Array of tabs + * @return array> Array of tabs */ function conferenceorboothAttendeePrepareHead($object) { From 1debf4f538ee85e692a10b02c7c0276221e04ff0 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 10:42:13 +0100 Subject: [PATCH 122/130] # Fix & enable PhanPluginPrintfNotPercent Fix PhanPluginPrintfNotPercent by setting format length to non 0 value. Example of Notification message: 'Format string "%0.10F" contains something that is not a percent sign, it will be treated as a format string '%0.10F' with padding of "0" and alignment of '' but no width. Use %% for a literal percent sign, or '%1$.10F' to be less ambiguous' . --- dev/tools/phan/config.php | 2 +- htdocs/core/lib/functions.lib.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 53dd0aa447b..8070fa48e16 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -587,7 +587,7 @@ return [ 'PhanTypePossiblyInvalidDimOffset', // Also checks optional array keys and requires that they are checked for existence. 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty', - 'PhanPluginPrintfNotPercent', + // 'PhanPluginPrintfNotPercent', // Detects fishy stuff with '%' format and suggests %% 'PhanPossiblyUndeclaredGlobalVariable', // 'PhanPluginPossiblyStaticProtectedMethod', 'PhanTypeMismatchReturn', diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e6edeabe7ac..20d8f7b84f7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6426,7 +6426,7 @@ function price2num($amount, $rounding = '', $option = 0) // So if number was already a good number, it is converted into local Dolibarr setup. if (is_numeric($amount)) { // We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10 - $temps = sprintf("%0.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 + $temps = sprintf("%10.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 $temps = preg_replace('/([\.1-9])0+$/', '\\1', $temps); // temps=0. or 0.00002 or 9999.1 $nbofdec = max(0, dol_strlen($temps) - 2); // -2 to remove "0." $amount = number_format($amount, $nbofdec, $dec, $thousand); @@ -6475,7 +6475,7 @@ function price2num($amount, $rounding = '', $option = 0) // to format defined by LC_NUMERIC after a calculation and we want source format to be defined by Dolibarr setup. if (is_numeric($amount)) { // We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10 - $temps = sprintf("%0.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 + $temps = sprintf("%10.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 $temps = preg_replace('/([\.1-9])0+$/', '\\1', $temps); // temps=0. or 0.00002 or 9999.1 $nbofdec = max(0, dol_strlen($temps) - 2); // -2 to remove "0." $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand From b02014bf4736b841967cdc85904f7edbd7c86d95 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 10:16:41 +0100 Subject: [PATCH 123/130] Fix PhanPluginUnknownFunctionParamType # Fix PhanPluginUnknownFunctionParamType PHPdoc for $object was incorrect. Reviewed some of the other typings as well --- htdocs/hrm/lib/hrm_evaluation.lib.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/hrm/lib/hrm_evaluation.lib.php b/htdocs/hrm/lib/hrm_evaluation.lib.php index d4b99471087..a84aa3b0a3b 100644 --- a/htdocs/hrm/lib/hrm_evaluation.lib.php +++ b/htdocs/hrm/lib/hrm_evaluation.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +29,7 @@ * Prepare array of tabs for Evaluation * * @param Evaluation $object Evaluation - * @return array Array of tabs + * @return array> Array of tabs */ function evaluationPrepareHead($object) { @@ -129,7 +130,7 @@ function GetLegendSkills() } /** - * @param $obj object object need to handle + * @param object $obj Object needed to be represented * @return string */ function getRankOrderResults($obj) @@ -163,8 +164,9 @@ function getRankOrderResults($obj) /** * Grouped rows with same ref in array - * @param array $objects all rows getted by sql - * @return array |int + * + * @param object[] $objects all rows retrieve from sql query + * @return array|int Object by groiup, -1 if error (empty or bad argument) */ function getGroupedEval($objects) { From 73eeb69cc808f164136ee684f1cf0b187cf091ae Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 13 Mar 2024 10:18:22 +0100 Subject: [PATCH 124/130] Qual: Enable PhanPluginUnknownFunctionParamType (all fixed) --- dev/tools/phan/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 53dd0aa447b..e094e4028a4 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -466,7 +466,7 @@ return [ // 'PhanPluginNoCommentOnFunction', 'PhanPluginUnknownArrayFunctionParamType', // 'PhanPluginDescriptionlessCommentOnPublicProperty', - 'PhanPluginUnknownFunctionParamType', + // 'PhanPluginUnknownFunctionParamType', // Finds certain errors in PHPdoc typing 'PhanTypeSuspiciousStringExpression', 'PhanPluginRedundantAssignment', From 930af6b838e4d49ed071f093198c61c3a78da9c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Mar 2024 10:54:20 +0100 Subject: [PATCH 125/130] Doc --- htdocs/core/lib/functions2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index f5e95da450c..c1e5795e802 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -889,7 +889,7 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = ' * Return last or next value for a mask (according to area we should not reset) * * @param DoliDB $db Database handler - * @param string $mask Mask to use + * @param string $mask Mask to use. Must contains {0...0}. Can contains {t..}, {u...}, {user_extra_xxx}, .;. * @param string $table Table containing field with counter * @param string $field Field containing already used values of counter * @param string $where To add a filter on selection (for example to filter on invoice types) @@ -903,7 +903,7 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = ' */ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $date = '', $mode = 'next', $bentityon = true, $objuser = null, $forceentity = null) { - global $conf, $user; + global $user; if (!is_object($objsoc)) { $valueforccc = $objsoc; From c8046e4cdd3b8219df24586604b32a46e65fe404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Mar 2024 11:18:50 +0100 Subject: [PATCH 126/130] fix expensereport setdraft --- htdocs/expensereport/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 83e2df9364c..786f42f362f 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -69,6 +69,7 @@ $comments = GETPOST('comments', 'restricthtml'); $fk_c_type_fees = GETPOSTINT('fk_c_type_fees'); $socid = GETPOSTINT('socid') ? GETPOSTINT('socid') : GETPOSTINT('socid_id'); +/** @var User $user */ $childids = $user->getAllChildIds(1); if (getDolGlobalString('EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH')) { @@ -951,7 +952,7 @@ if (empty($reshook)) { if ($action == "confirm_setdraft" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->hasRight('expensereport', 'creer')) { $object = new ExpenseReport($db); $object->fetch($id); - if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { + if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid || in_array($object->fk_user_author, $childids)) { $result = $object->setStatut(0); if ($result > 0) { @@ -1537,7 +1538,7 @@ if ($action == 'create') { $result = $object->fetch($id, $ref); if ($result > 0) { - if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) { + if (!in_array($object->fk_user_author, $childids)) { if (!$user->hasRight('expensereport', 'readall') && !$user->hasRight('expensereport', 'lire_tous') && (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || !$user->hasRight('expensereport', 'writeall_advance'))) { print load_fiche_titre($langs->trans('TripCard'), '', 'trip'); @@ -2710,7 +2711,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'editline') { * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ if ($user->hasRight('expensereport', 'creer') && $object->status == ExpenseReport::STATUS_DRAFT) { - if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || $user->hasRight('expensereport', 'writeall_advance')) { + if (in_array($object->fk_user_author, $childids) || $user->hasRight('expensereport', 'writeall_advance')) { // Modify print ''; @@ -2751,7 +2752,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'editline') { * Afficher : "Valider" / "Refuser" / "Supprimer" */ if ($object->status == ExpenseReport::STATUS_VALIDATED) { - if (in_array($object->fk_user_author, $user->getAllChildIds(1))) { + if (in_array($object->fk_user_author, $childids)) { // set draft print ''; } From 5bbab794fae171e9ac5b73fe03d5ae30511fa488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Mar 2024 11:20:37 +0100 Subject: [PATCH 127/130] fix expensereport setdraft --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 786f42f362f..d9d609822a8 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2023 Alexandre Spangaro * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify From 3a0bf96e925fc88a80788cfadf80be331cdacc3c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 13 Mar 2024 11:49:03 +0100 Subject: [PATCH 128/130] add password and genericpassword entry types --- htdocs/core/class/html.formsetup.class.php | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index e5199267d31..700a66d422a 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -905,6 +905,10 @@ class FormSetupItem $selected = (empty($this->fieldValue) ? '' : $this->fieldValue); $out.= $this->form->select_comptes($selected, $this->confKey, 0, '', 0, '', 0, '', 1); } + } elseif ($this->type == 'password') { + $out.= $this->generateInputFieldPassword('dolibarr'); + } elseif ($this->type == 'genericpassword') { + $out.= $this->generateInputFieldPassword('generic'); } else { $out.= $this->generateInputFieldText(); } @@ -1028,6 +1032,37 @@ class FormSetupItem } + /** + * generate input field for a password + * + * @param [type] $type 'dolibarr' (dolibarr password rules apply) or 'generic' + * + * @return string + */ + public function generateInputFieldPassword($type = 'generic') + { + global $conf, $langs, $user; + + $min = 8; + $max = 50; + if ($type == 'dolibarr') { + $gen = getDolGlobalString('USER_PASSWORD_GENERATED', 'standard'); + if ($gen == 'none') { + $gen = 'standard'; + } + $nomclass = "modGeneratePass".ucfirst($gen); + $nomfichier = $nomclass.".class.php"; + require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier; + $genhandler = new $nomclass($this->db, $conf, $langs, $user); + $min = $genhandler->length; + $max = $genhandler->length2; + } + $out = ''; + return $out; + } + + + /** * generateInputFieldMultiSelect * @@ -1209,6 +1244,8 @@ class FormSetupItem } elseif ($resbank < 0) { $this->setErrors($bankaccount->errors); } + } elseif ($this->type == 'password' || $this->type == 'genericpassword') { + $out.= str_repeat('*', strlen($this->fieldValue)); } else { $out.= $this->fieldValue; } @@ -1480,4 +1517,28 @@ class FormSetupItem $this->type = 'selectBankAccount'; return $this; } + + /** + * Set type of input as a password with dolibarr password rules apply. + * Hide entry on display. + * + * @return self + */ + public function setAsPassword() + { + $this->type = 'password'; + return $this; + } + + /** + * Set type of input as a generic password without dolibarr password rules (for external passwords for example). + * Hide entry on display. + * + * @return self + */ + public function setAsGenericPassword() + { + $this->type = 'genericpassword'; + return $this; + } } From 3d449b8fce548e77e37d8312af389465ee09f1f5 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 13 Mar 2024 11:54:05 +0100 Subject: [PATCH 129/130] phpdoc missing argument type, thanks to phpstan ! --- htdocs/core/class/html.formsetup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 700a66d422a..999603adf8a 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1035,7 +1035,7 @@ class FormSetupItem /** * generate input field for a password * - * @param [type] $type 'dolibarr' (dolibarr password rules apply) or 'generic' + * @param string $type 'dolibarr' (dolibarr password rules apply) or 'generic' * * @return string */ From b9007acbf18f6272509d35d3c9378142a5f8475e Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 13 Mar 2024 14:03:27 +0100 Subject: [PATCH 130/130] Fixed PHP warnings --- .../comm/action/class/cactioncomm.class.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index bc6f454539a..d308ce7bd1c 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -192,9 +192,21 @@ class CActionComm $nump = $this->db->num_rows($resql); if ($nump) { $idforallfornewmodule = 96; - $TSystem = array(); - $TSystemAuto = array(); - $TModule = array(); + $TSystem = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); + $TSystemAuto = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); + $TModule = array( + 'id' => [], + 'code' => [], + 'all' => [] + ); $i = 0; while ($i < $nump) { $obj = $this->db->fetch_object($resql); @@ -319,8 +331,8 @@ class CActionComm } if ($onlyautoornot > 0 && preg_match('/^module/', $obj->type) && $obj->module) { - $TModule['code'][$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; - $TModule['all'][$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')'; + array_key_exists($obj->code, $TModule['code']) ? ($TModule['code'][$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')') : ($TModule['code'][$obj->code] = ' ('.$langs->trans("Module").': '.$obj->module.')'); + array_key_exists($obj->code, $TModule['all']) ? ($TModule['all'][$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')') : ($TModule['all'][$obj->code]['label'] = ' ('.$langs->trans("Module").': '.$obj->module.')'); } } $i++;