From a75bc08d946ba41977fe95393c156bddcbc6067d Mon Sep 17 00:00:00 2001 From: gdesnoues Date: Tue, 12 Mar 2024 14:08:29 +0100 Subject: [PATCH 01/78] show image in a line description of a proposal PDF #28670 When you set FCKEDITOR_ENABLE_DETAILS_FULL to 1 you can add pictures in description proposal with the WYSIWYG bar. Add preg_replace() to show this pictures in the PDF --- htdocs/core/lib/pdf.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 7d342e152a3..ed3f5f8ef05 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1443,6 +1443,7 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos } if (empty($reshook)) { $labelproductservice = pdf_getlinedesc($object, $i, $outputlangs, $hideref, $hidedesc, $issupplierline); + $labelproductservice = preg_replace('/(]*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)/', '\1file:/'.DOL_DATA_ROOT.'/medias/\2\3', $labelproductservice, -1, $nbrep); //var_dump($labelproductservice);exit; From 738c6eeeb7fac1a752b3a0c004a374160db11d87 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:17 +0100 Subject: [PATCH 02/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/agenda_other.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 772bc0efa6a..dcc7cdec446 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Charlie Benke * Copyright (C) 2017 Open-DSI + * 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 @@ -89,7 +90,7 @@ if ($action == 'set') { dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); $defaultValues = new DefaultValues($db); - $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); + $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity)); if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } elseif (count($result) > 0) { @@ -123,18 +124,16 @@ if ($action == 'set') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $commande); @@ -334,7 +333,7 @@ $htmltext = $langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoe print ''.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).''."\n"; print ' '."\n"; print ''."\n"; -$tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); +$tmplist = array('' => ' ', 'show_list' => $langs->trans("ViewList"), 'show_month' => $langs->trans("ViewCal"), 'show_week' => $langs->trans("ViewWeek"), 'show_day' => $langs->trans("ViewDay"), 'show_peruser' => $langs->trans("ViewPerUser")); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW')); print ''."\n"; @@ -369,7 +368,7 @@ print ' '."\n"; print ''."\n"; $defval = 'na'; $defaultValues = new DefaultValues($db); -$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete', 't.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); +$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity)); if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } elseif (count($result) > 0) { From cccee21d5136488cad3e66a78eb6d66f257d67e9 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:19 +0100 Subject: [PATCH 03/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/agenda_reminder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index fa4dd0df9a1..cdc6a2b8647 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.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 @@ -86,18 +87,16 @@ if ($action == 'set') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $commande); From 7f798effcec95a000627d1821f434b7a39e86472 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:22 +0100 Subject: [PATCH 04/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/bank.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index f8ca472744f..865b54f5878 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -3,6 +3,7 @@ * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2015 Jean-François 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 @@ -131,18 +132,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 547b5214596a83e9dd2a7c570869be6229a3335c Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:25 +0100 Subject: [PATCH 05/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/bom.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 319e5b71789..ebfa4e6772a 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.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 @@ -76,18 +77,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From c764c0fd595a2275358fbbd7147d2a3b7e5cf140 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:28 +0100 Subject: [PATCH 06/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/commande.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 62d11335384..af9db12a62b 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -10,6 +10,7 @@ * Copyright (C) 2011-2016 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 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 @@ -86,18 +87,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 9fe6fd76949973fca7eff29c37a1a334b1db670a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:31 +0100 Subject: [PATCH 07/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/contract.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index e30a2b8d0c5..89e09907a6e 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -1,6 +1,7 @@ * Copyright (C) 2011-2018 Philippe Grand + * 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 @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 7d16c805b83aed1061d845d36b36411403f70a3f Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:33 +0100 Subject: [PATCH 08/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/delivery.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 123126c693e..2c66f284c7d 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -8,6 +8,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand * 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 @@ -131,18 +132,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 73b8dfd77a30fb4a61a9c5df5ffc2422b4747c0d Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:36 +0100 Subject: [PATCH 09/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/eventorganization.php | 47 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 7016986b0bd..983a93a9c02 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.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 @@ -47,20 +48,20 @@ $scandir = GETPOST('scan_dir', 'alpha'); $type = 'myobject'; $arrayofparameters = array( - 'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1), - 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), - 'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), - 'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), - 'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), + 'EVENTORGANIZATION_TASK_LABEL' => array('type' => 'textarea','enabled' => 1), + 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1), + 'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1), + 'EVENTORGANIZATION_FILTERATTENDEES_CAT' => array('type' => 'category:'.Categorie::TYPE_CUSTOMER, 'enabled' => 1), + 'EVENTORGANIZATION_FILTERATTENDEES_TYPE' => array('type' => 'thirdparty_type:', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), + 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT' => array('type' => 'emailtemplate:conferenceorbooth', 'enabled' => 1), //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), - 'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1), - 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1), - 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), + 'SERVICE_BOOTH_LOCATION' => array('type' => 'product', 'enabled' => 1), + 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION' => array('type' => 'product', 'enabled' => 1), + 'EVENTORGANIZATION_SECUREKEY' => array('type' => 'securekey', 'enabled' => 1), ); $error = 0; @@ -80,7 +81,7 @@ if (empty($user->admin)) { */ if ($cancel) { - $action =''; + $action = ''; } include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; @@ -111,18 +112,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/eventorganization/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -218,7 +217,7 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { + if ($val['enabled'] == 1) { $setupnotempty++; print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); @@ -230,7 +229,7 @@ if ($action == 'edit') { print '\n"; - } elseif ($val['type']== 'html') { + } elseif ($val['type'] == 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); $doleditor->Create(); @@ -300,7 +299,7 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { + if ($val['enabled'] == 1) { $setupnotempty++; print ''; print ''; @@ -311,7 +310,7 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print dol_nl2br(getDolGlobalString($constname)); - } elseif ($val['type']== 'html') { + } elseif ($val['type'] == 'html') { print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); @@ -348,13 +347,13 @@ if ($action == 'edit') { print '
    ' . implode(' ', $toprint) . '
'; } } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if (getDolGlobalString($constname)==2) { + if (getDolGlobalString($constname) == 2) { print $langs->trans("Prospect"); - } elseif (getDolGlobalString($constname)==3) { + } elseif (getDolGlobalString($constname) == 3) { print $langs->trans("ProspectCustomer"); - } elseif (getDolGlobalString($constname)==1) { + } elseif (getDolGlobalString($constname) == 1) { print $langs->trans("Customer"); - } elseif (getDolGlobalString($constname)==0) { + } elseif (getDolGlobalString($constname) == 0) { print $langs->trans("NorProspectNorCustomer"); } } elseif ($val['type'] == 'product') { From 88632afe5efc5659557cb23716f8ba69e7d1b5a1 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:39 +0100 Subject: [PATCH 10/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/expedition.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index d054f3bfa5e..082d2a39741 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * 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,18 +103,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 732056902ed551383daa23e4ca67b2430a3b98f4 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:42 +0100 Subject: [PATCH 11/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/expensereport.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 64cba2b7c6f..d0fa6cfd98b 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -7,6 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2022 Philippe Grand + * 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,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 07d3e4cfe1ac2161243cd5e749a07756d01c6795 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:45 +0100 Subject: [PATCH 12/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/fichinter.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index aba9db7f9fd..250d4d9e2cd 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -7,6 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * 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 @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 3291ec5afbc815017709cfdb96f3318c00aaea56 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:47 +0100 Subject: [PATCH 13/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/holiday.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 34153e22866..1a8a343ea69 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -3,6 +3,7 @@ * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2018 Charlene Benke * Copyright (C) 2018 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 @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From a333aaf50a62399309a73cc1043149587444b826 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:50 +0100 Subject: [PATCH 14/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/hrm.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index eef0a7a34a8..df883799b2b 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -4,6 +4,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 @@ -116,18 +117,16 @@ if ($action == 'update') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 5d3f6187bd97a8276eba3ad79bc0ee52b1e48cbc Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:53 +0100 Subject: [PATCH 15/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/invoice.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index 26678685f53..a2f0282ba9f 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -7,6 +7,7 @@ * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2022 Anthony Berton + * 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 @@ -99,18 +100,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -628,10 +627,10 @@ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf print "\n"; $listtype = array( - Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), - Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), - Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), - Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), + Facture::TYPE_STANDARD => $langs->trans("InvoiceStandard"), + Facture::TYPE_REPLACEMENT => $langs->trans("InvoiceReplacement"), + Facture::TYPE_CREDIT_NOTE => $langs->trans("InvoiceAvoir"), + Facture::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"), ); if (getDolGlobalInt('INVOICE_USE_SITUATION')) { $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); From 8afd985b6df5111d6fda4cdde88b5b5e681eb488 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:56 +0100 Subject: [PATCH 16/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/knowledgemanagement.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index b8445a0fb9a..1f79f506c89 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -1,6 +1,7 @@ * 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 @@ -94,18 +95,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From f8e8a0cad40fe0f380448aca44cf5a20b87f306e Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:15:59 +0100 Subject: [PATCH 17/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/mrp.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 5c2de506880..f616df182c4 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.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 @@ -77,18 +78,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 06071c6a91188d07608444f48a6b30d843c3e84f Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:01 +0100 Subject: [PATCH 18/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/propal.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 6913857a69f..401db58d473 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 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 @@ -82,18 +83,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/propale/doc/pdf_".$modele.".modules.php"); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 02fe181cb9ae9d0e86d0ac79f11337d8ab58462f Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:04 +0100 Subject: [PATCH 19/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/reception_setup.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 3b5ee37b77c..b5f8e336b20 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.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 @@ -105,18 +106,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/reception/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From dc0ac0f6019486ff37fb65f7b77e63ea1fbc09f0 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:07 +0100 Subject: [PATCH 20/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/stock.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 7572ccd69ef..86f485c11a4 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -5,6 +5,7 @@ * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Florian Henry + * 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,18 +110,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/stock/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 97ec41cf4d758d9e0d5ff355215fcd064ddcf590 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:10 +0100 Subject: [PATCH 21/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/stocktransfer.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index b7e027db2b2..dee8ebc3b14 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * 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 @@ -91,18 +92,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/stocktransfer/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From ee18ef221cda0fc132ba8bbadfd35d73e52c554d Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:13 +0100 Subject: [PATCH 22/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/supplier_invoice.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 52b1342f88e..38db853af92 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * 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,18 +103,16 @@ if ($action == 'specimen') { // For invoices // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $facture); From b5f0b6ae17f26b40bc6269f4bd086ef83dc26f43 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:15 +0100 Subject: [PATCH 23/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/supplier_order.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 849a6dff7f3..ecfc2a68b93 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2004 Sebastien Di Cintio @@ -92,18 +93,16 @@ if ($action == 'specimen') { // For orders // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db, $commande); From a015fa1c76b1a581d70a2fbaae273f2b6b5a6686 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:18 +0100 Subject: [PATCH 24/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/supplier_payment.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index c8ac3fa4423..e420a914155 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015 Juanjo Menent * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2020 Maxime DEMAREST + * 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,18 +104,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 05408a189370ef2f49d7bbc4193f51271142ccc6 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:21 +0100 Subject: [PATCH 25/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/supplier_proposal.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 09728fbe93e..94197b4bdad 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -8,6 +8,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015 Jean-François 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 @@ -81,18 +82,16 @@ if ($action == 'specimen') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/supplier_proposal/doc/pdf_".$modele.".modules.php"); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From bcd692ef6aa533d42a10ab3aba2f683018242f5b Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:24 +0100 Subject: [PATCH 26/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/webhook.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 7755856f8a0..4758220503d 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.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 @@ -99,18 +100,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/webhook/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 4e1d81984dcd67c85da9873e16d90bb0a008d249 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:27 +0100 Subject: [PATCH 27/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/admin/workstation.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 67c2bb9869a..78084737c6e 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -1,6 +1,7 @@ * 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 @@ -84,18 +85,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 9dbf0742f13c51240002370d3031fafe56a3aaa3 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:29 +0100 Subject: [PATCH 28/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/ai/admin/setup.php | 47 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index 73e4765d7a4..9459b501b84 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Alice Adminson + * 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 @@ -75,7 +76,7 @@ foreach ($arrayofia as $ia) { $item->cssClass = 'minwidth500'; } -$setupnotempty =+ count($formSetup->items); +$setupnotempty = + count($formSetup->items); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); @@ -113,18 +114,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/ai/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); @@ -193,45 +192,45 @@ $action = 'edit'; * View */ - $form = new Form($db); +$form = new Form($db); - $help_url = ''; - $title = "AiSetup"; +$help_url = ''; +$title = "AiSetup"; - llxHeader('', $langs->trans($title), $help_url); +llxHeader('', $langs->trans($title), $help_url); - // Subheader - $linkback = ''.$langs->trans("BackToModuleList").''; +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; - print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); +print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); - // Configuration header - $head = aiAdminPrepareHead(); - print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip"); +// Configuration header +$head = aiAdminPrepareHead(); +print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip"); - // Setup page goes here - //echo ''.$langs->trans("AiSetupPage").'

'; +// Setup page goes here +//echo ''.$langs->trans("AiSetupPage").'

'; if ($action == 'edit') { - print $formSetup->generateOutput(true); - print '
'; + print $formSetup->generateOutput(true); + print '
'; } elseif (!empty($formSetup->items)) { print $formSetup->generateOutput(); print '
'; print ''.$langs->trans("Modify").''; print '
'; } else { - print '
'.$langs->trans("NothingToSetup"); + print '
'.$langs->trans("NothingToSetup"); } if (empty($setupnotempty)) { - print '
'.$langs->trans("NothingToSetup"); + print '
'.$langs->trans("NothingToSetup"); } - // Page end - print dol_get_fiche_end(); +// Page end +print dol_get_fiche_end(); - llxFooter(); - $db->close(); +llxFooter(); +$db->close(); From b79e5638a990eaaeb6233d8b0bf3d2c402e71675 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:31 +0100 Subject: [PATCH 29/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/asset/admin/setup.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 72e6cac37ea..40e37464e90 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 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 @@ -96,18 +97,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/asset/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 0a90a2eeaf1ac0a6bbb81cf4ae572af18e746b34 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:33 +0100 Subject: [PATCH 30/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/bookcal/admin/setup.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 7117deee8e1..1b445686550 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Alice Adminson + * 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 @@ $item->helpText = $langs->transnoentities('AnHelpMessage');*/ //$item->fieldOutputOverride = false; // set this var to override field output -$setupnotempty =+ count($formSetup->items); +$setupnotempty = + count($formSetup->items); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); @@ -145,18 +146,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/bookcal/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 69e335a13b667f29d71eca81f4cb11fa68593319 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:35 +0100 Subject: [PATCH 31/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/core/ajax/onlineSign.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 996f7be806d..de58f75c303 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -1,4 +1,6 @@ + */ /* * 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 @@ -580,18 +582,15 @@ if ($action == "importSignature") { $classname = 'pdf_' . $last_modelpdf; break; } - if ($filefound) { - break; - } } - if (!$filefound) { + if ($filefound === '') { $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; dol_syslog($response, LOG_ERR); $error++; } - if (!$error) { + if (!$error && $classname !== '') { // If PDF template class was found require_once $file; From bba0d4661e4de281090ea3cab13727a931224533 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:37 +0100 Subject: [PATCH 32/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4c9edcc8868..796f0e04b02 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5705,7 +5705,7 @@ abstract class CommonObject } } - if (!$filefound) { + if ($filefound === '' || $classname === '') { $this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele; $this->errors[] = $this->error; dol_syslog($this->error, LOG_ERR); From 7825954f2ab1d9f7efd24d3f085d41901320e36f Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:39 +0100 Subject: [PATCH 33/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/core/modules/fichinter/modules_fichinter.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 2abbbe07264..dc50dcb1804 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2019 Philippe Grand + * 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 @@ -108,7 +109,6 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); @@ -120,18 +120,17 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, // Get the location of the module and verify it exists $file = dol_buildpath($reldir."core/modules/fichinter/doc/".$file, 0); if (file_exists($file)) { - $filefound = 1; $classname = $prefix.'_'.$modele; break; } } - if ($filefound) { + if ($classname !== '') { break; } } // Charge le modele - if ($filefound) { + if ($classname !== '') { require_once $file; $obj = new $classname($db); From a59fd68987edde62c75f2533f86c91d31a53296c Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:41 +0100 Subject: [PATCH 34/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/core/modules/member/modules_cards.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index 912c540f220..853601860a8 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * 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 @@ -115,7 +116,6 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); @@ -127,19 +127,18 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o // We check that file of doc generaotr exists $file = dol_buildpath($reldir."core/modules/member/doc/".$file, 0); if (file_exists($file)) { - $filefound = 1; $classname = $prefix.'_'.$template; break; } } - if ($filefound) { + if ($classname !== '') { break; } } // Charge le modele - if ($filefound) { + if ($classname !== '') { require_once $file; $obj = new $classname($db); From 3d47d9b8946bdd3ce9d89b1b5f76c478a01448f6 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:43 +0100 Subject: [PATCH 35/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/core/modules/printsheet/modules_labels.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index 7e319e71112..47c35ceb597 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * 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 @@ -117,7 +118,6 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); @@ -129,18 +129,17 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp // Determine the model path and validate that it exists $file = dol_buildpath($reldir."core/modules/printsheet/doc/".$file, 0); if (file_exists($file)) { - $filefound = 1; $classname = $prefix.'_'.$template; break; } } - if ($filefound) { + if ($classname !== '') { break; } } // Load the model - if ($filefound) { + if ($classname !== '') { require_once $file; $obj = new $classname($db); From d5ffddbd8691c1011e7197b92f221664b600a9b7 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:46 +0100 Subject: [PATCH 36/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/don/admin/donation.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 5a09ccd8f6b..3a0854cb103 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -5,6 +5,7 @@ * Copyright (C) 2015-2020 Alexandre Spangaro * Copyright (C) 2015 Benoit Bruchard * Copyright (C) 2019 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 @@ -62,7 +63,7 @@ if ($action == 'specimen') { // Search template files $dir = DOL_DOCUMENT_ROOT."/core/modules/dons/"; $file = $modele.".modules.php"; - if (file_exists($dir.$file)) { + if ($modele !== '' && file_exists($dir.$file)) { $classname = $modele; require_once $dir.$file; From 5a92724251dbef59b6a92dfa8155ded984bf9955 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:49 +0100 Subject: [PATCH 37/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/emailcollector/class/emailcollector.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 7fdbfc5cca5..518529630fb 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2934,19 +2934,17 @@ class EmailCollector extends CommonObject // Search template files $file = ''; $classname = ''; - $filefound = 0; $reldir = ''; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0); if (file_exists($file)) { - $filefound = 1; $classname = $modele; break; } } - if ($filefound) { + if ($classname !== '') { if ($savesocid > 0) { if ($savesocid != $projecttocreate->socid) { $errorforactions++; From b7f49773548a5d7cca29814bafc02d566851dc4d Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:52 +0100 Subject: [PATCH 38/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/product/admin/product.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 8704a530387..a565fb86518 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -9,6 +9,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2016 Charlie Benke * Copyright (C) 2016 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 @@ -168,18 +169,16 @@ if ($action == 'specimen') { // For products // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 9eb5b199bd69a83575d53c1ed0ffd31ce100166b Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:54 +0100 Subject: [PATCH 39/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/product/admin/product_lot.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index edc9ad53fd2..77dff433356 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.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 @@ -115,18 +116,16 @@ if ($action == 'updateMaskLot') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir . "core/modules/product_batch/doc/pdf_" . $modele . ".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_" . $modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 7f4e3da7faa67edf6a03898280d457deb9a9c9b2 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:56 +0100 Subject: [PATCH 40/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/projet/admin/project.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index 625b0bd76f7..184f8ac6104 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Marcos García * 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 @@ -101,18 +102,16 @@ if ($action == 'updateMaskTask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/project/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 7efbf4808e35faa8684644685b2963df196775d0 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:16:58 +0100 Subject: [PATCH 41/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/recruitment/admin/setup.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index daf74ba39d7..296c20bffb5 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.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 @@ -120,18 +121,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/recruitment/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 6cd54fd28130604734e67df80551669825fe6123 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:17:00 +0100 Subject: [PATCH 42/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/recruitment/admin/setup_candidatures.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index 37c641c8b29..c8324656aa3 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.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 @@ -91,18 +92,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_".$modele; break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 46c508b3570540367e1205d4c316bbcaebab8d83 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 16:17:02 +0100 Subject: [PATCH 43/78] Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname # Qual: Fix PhanTypeExpectedObjectOrClassName by testing on classname PhanTypeExpectedObjectOrClassName should be fixed by testing that the classname is not empty. --- htdocs/webportal/admin/setup.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/webportal/admin/setup.php b/htdocs/webportal/admin/setup.php index 48a3f73e2a4..7680e08cd9a 100644 --- a/htdocs/webportal/admin/setup.php +++ b/htdocs/webportal/admin/setup.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 @@ -146,18 +147,16 @@ if ($action == 'updateMask') { // Search template files $file = ''; $classname = ''; - $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir . "core/modules/webportal/doc/pdf_" . $modele . "_" . strtolower($tmpobjectkey) . ".modules.php", 0); if (file_exists($file)) { - $filefound = 1; $classname = "pdf_" . $modele . "_" . strtolower($tmpobjectkey); break; } } - if ($filefound) { + if ($classname !== '') { require_once $file; $module = new $classname($db); From 29b8d0db84156391261c6bea2a8a0b45735fbdf1 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 19:05:15 +0100 Subject: [PATCH 44/78] Fix: Duplicate test on "shipping", replaced duplicate with delivery_note # Fix: Duplicate test on "shipping", replaced duplicate with delivery_note The second test on "shipping" was without effect but as the module was set to "expedition_bon", I modified the test to delivery_note and put it closer to the test on "shipping" --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 546ab720452..5729ea05203 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12169,16 +12169,16 @@ function getElementProperties($elementType) $classname = 'Expedition'; $module = 'expedition'; $table_element = 'expedition'; + } elseif ($elementType == 'delivery_note') { + $classpath = 'expedition/class'; + $subelement = 'expedition'; + $module = 'expedition_bon'; } elseif ($elementType == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; $module = 'supplier_proposal'; $element = 'supplierproposal'; $classfile = 'supplier_proposal'; $subelement = 'supplierproposal'; - } elseif ($elementType == 'shipping') { - $classpath = 'expedition/class'; - $subelement = 'expedition'; - $module = 'expedition_bon'; } elseif ($elementType == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; From 8bd965fb8032aa1241d06c276d8197bf79ed6b48 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 19:09:06 +0100 Subject: [PATCH 45/78] Fix duplicate if condition # Fix duplicate if condition Removed the duplicate which had a different action but it was not effective in the code so it was removed (it looks like a leftover). --- htdocs/core/modules/societe/modules_societe.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 1408c2cdf99..dff42b63e86 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-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 @@ -136,8 +137,6 @@ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator $s = ''; if ($type == -1) { $s .= $langs->trans("Name").': '.$this->getNom($langs).'
'; - } elseif ($type == -1) { - $s .= $langs->trans("Version").': '.$this->getVersion().'
'; } elseif ($type == 0) { $s .= $langs->trans("CustomerCodeDesc").'
'; } elseif ($type == 1) { From 1f31d29a7731bc16e0b3074b465d816812d2431a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 19:09:53 +0100 Subject: [PATCH 46/78] Fix duplicate if condition with same effect --- htdocs/core/lib/files.lib.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 8623989482c..aeceaa2f1be 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3289,10 +3289,6 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->adherent->dir_output.'/'.$original_file; - } elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { - // Wrapping for Scanner - $accessallowed = 1; - $original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; // If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser // If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp // If modulepart=module_user Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser From 6a64b3a50f8742ea81bdf833817962573c2a572a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 19:10:50 +0100 Subject: [PATCH 47/78] Fix duplicate if condition with same effect --- htdocs/compta/facture/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index cfa495f3922..13995e6cc0b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -16,6 +16,7 @@ * Copyright (C) 2019-2021 Alexandre Spangaro * Copyright (C) 2023 Nick Fragoulis * 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 @@ -273,8 +274,6 @@ foreach ($object->fields as $key => $val) { $newkey = $key; } elseif (array_key_exists('f.'.$key, $arrayfields)) { $newkey = 'f.'.$key; - } elseif (array_key_exists('f.'.$key, $arrayfields)) { - $newkey = 'f.'.$key; } elseif (array_key_exists('s.'.$key, $arrayfields)) { $newkey = 's.'.$key; } From 7e52b2f632c41ae94060690cbd87a9adff32fa0a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 19:13:40 +0100 Subject: [PATCH 48/78] Fix duplicate if condition with same effect --- htdocs/core/class/commonobject.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4c9edcc8868..0ae97db829e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1659,8 +1659,6 @@ abstract class CommonObject $modulename = 'agenda'; } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { $modulename = 'fournisseur'; - } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { - $modulename = 'fournisseur'; } if (!empty($conf->{$modulename}->enabled)) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); From 8f7fb3fac901c24d407dc440e8bfa502250633ef Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 19:16:44 +0100 Subject: [PATCH 49/78] Qual: No more exception for PhanPluginDuplicateIfCondition --- dev/tools/phan/baseline.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 1fd31534dad..68fc0c015e7 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -15,7 +15,6 @@ return [ // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences // PhanTypeInvalidUnaryOperandNumeric : 8 occurrences - // PhanPluginDuplicateIfCondition : 6 occurrences // PhanRedefineFunctionInternal : 6 occurrences // PhanPluginUnsafeEval : 5 occurrences // PhanParamSuspiciousOrder : 4 occurrences @@ -51,7 +50,6 @@ return [ 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/facture/list.php' => ['PhanPluginDuplicateIfCondition'], 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], @@ -62,7 +60,7 @@ return [ 'htdocs/compta/tva/document.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/class/commonobject.class.php' => ['PhanPluginDuplicateIfCondition', 'PhanPluginSuspiciousParamPosition'], + 'htdocs/core/class/commonobject.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnsafeEval'], 'htdocs/core/class/html.form.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/class/html.formmail.class.php' => ['PhanNoopArray'], @@ -72,8 +70,8 @@ return [ 'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginDuplicateIfCondition'], - 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginDuplicateIfCondition', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'], + 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp'], + 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'], 'htdocs/core/lib/price.lib.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/lib/usergroups.lib.php' => ['PhanNoopArrayAccess'], 'htdocs/core/menus/standard/auguria_menu.php' => ['PhanParamSuspiciousOrder'], @@ -84,7 +82,6 @@ return [ 'htdocs/core/modules/member/doc/pdf_standard.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/modules/societe/modules_societe.class.php' => ['PhanPluginDuplicateIfCondition'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], From 21e0bb4a7656def5fd95f709528d618843fa5ff5 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 20:00:58 +0100 Subject: [PATCH 50/78] Fix duplicate if condition (remove 2nd case with less effect --- htdocs/core/lib/files.lib.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index aeceaa2f1be..8b64dadea63 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3167,12 +3167,6 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->expedition->dir_output."/".(strpos($original_file, 'receipt/') === 0 ? '' : 'receipt/').$original_file; - } elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { - // Wrapping pour les actions - if ($fuser->hasRight('agenda', 'myactions', $read) || preg_match('/^specimen/i', $original_file)) { - $accessallowed = 1; - } - $original_file = $conf->agenda->dir_output.'/'.$original_file; } elseif ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { // Wrapping pour les actions if ($fuser->hasRight('agenda', 'allactions', $read) || preg_match('/^specimen/i', $original_file)) { From 03798025b90afc1579390adc8af9bc0697ea4fa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 20:44:02 +0100 Subject: [PATCH 51/78] FIX #28787 --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 331b2627316..15e1758fa1a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -137,7 +137,7 @@ class FormMail extends Form public $witherrorsto; /** - * @var int 0=No attaches files, 1=Show attached files, 2=Can add new attached files + * @var int|string 0=No attaches files, 1=Show attached files, 2=Can add new attached files, 'text'=Show attached files and the text */ public $withfile; From 98f80f2e00f7e5f9481203b7d7ed6405e07b1250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 20:56:16 +0100 Subject: [PATCH 52/78] fix phpstan is incompatible with --- htdocs/holiday/class/holiday.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 85c6925c306..9511ebd660b 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1464,10 +1464,10 @@ class Holiday extends CommonObject /** * Returns the label of a status * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @param integer $startdate Date holiday should start - * @return string Label + * @param int $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int|string $startdate Date holiday should start + * @return string Label */ public function LibStatut($status, $mode = 0, $startdate = '') { @@ -1520,7 +1520,7 @@ class Holiday extends CommonObject * @param string $morecss More CSS on select component * @return string Show select of status */ - public function selectStatutCP($selected = '', $htmlname = 'select_statut', $morecss = 'minwidth125') + public function selectStatutCP($selected = 0, $htmlname = 'select_statut', $morecss = 'minwidth125') { global $langs; @@ -1541,7 +1541,7 @@ class Holiday extends CommonObject } } - $out .= ''."\n"; + $out .= "\n"; $showempty = 0; $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($showempty < 0 ? (string) $showempty : '-1'), $morecss); @@ -1623,7 +1623,7 @@ class Holiday extends CommonObject * @param int $fk_type Type of vacation * @return int 0=Nothing done, 1=OK, -1=KO */ - public function updateSoldeCP($userID = '', $nbHoliday = '', $fk_type = '') + public function updateSoldeCP($userID = 0, $nbHoliday = 0, $fk_type = 0) { global $user, $langs; @@ -1741,7 +1741,7 @@ class Holiday extends CommonObject * @param int $userid Id user * @return void */ - public function createCPusers($single = false, $userid = '') + public function createCPusers($single = false, $userid = 0) { // do we have to add balance for all users ? if (!$single) { From 691e82593c85bfb8de824f6255b337396f0a8f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 21:04:20 +0100 Subject: [PATCH 53/78] fix phpstan is incompatible with --- htdocs/holiday/class/holiday.class.php | 56 +++++++++++++++++--------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9511ebd660b..69623e47103 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -71,17 +71,36 @@ class Holiday extends CommonObject */ public $description; - public $date_debut = ''; // Date start in PHP server TZ - public $date_fin = ''; // Date end in PHP server TZ - public $date_debut_gmt = ''; // Date start in GMT - public $date_fin_gmt = ''; // Date end in GMT - public $halfday = ''; // 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning + /** + * @var int|string Date start in PHP server TZ + */ + public $date_debut = ''; /** - * @var int + * @var int|string Date end in PHP server TZ + */ + public $date_fin = ''; + + /** + * @var int|string Date start in GMT + */ + public $date_debut_gmt = ''; + + /** + * @var int|string Date end in GMT + */ + public $date_fin_gmt = ''; + + /** + * @var int|string 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning + */ + public $halfday = ''; + + /** + * @var int Status 1=draft, 2=validated, 3=approved, 4 canceled, 5 refused * @deprecated */ - public $statut = 0; // 1=draft, 2=validated, 3=approved + public $statut = 0; /** * @var int ID of user that must approve. Real user for approval is fk_user_valid (old version) or fk_user_approve (new versions) @@ -133,7 +152,9 @@ class Holiday extends CommonObject */ public $fk_user_create; - + /** + * @var string Detail of refuse + */ public $detail_refuse = ''; /** @@ -760,8 +781,8 @@ class Holiday extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET"; $sql .= " fk_user_valid = ".((int) $user->id).","; $sql .= " date_valid = '".$this->db->idate(dol_now())."',"; - if (!empty($this->statut) && is_numeric($this->statut)) { - $sql .= " statut = ".((int) $this->statut).","; + if (!empty($this->status) && is_numeric($this->status)) { + $sql .= " statut = ".((int) $this->status).","; } else { $this->error = 'Property status must be a numeric value'; $error++; @@ -888,8 +909,8 @@ class Holiday extends CommonObject $error++; } $sql .= " halfday = ".((int) $this->halfday).","; - if (!empty($this->statut) && is_numeric($this->statut)) { - $sql .= " statut = ".((int) $this->statut).","; + if (!empty($this->status) && is_numeric($this->status)) { + $sql .= " statut = ".((int) $this->status).","; } else { $error++; } @@ -993,7 +1014,7 @@ class Holiday extends CommonObject $checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type); - if ($checkBalance > 0 && $this->statut != self::STATUS_DRAFT) { + if ($checkBalance > 0 && $this->status != self::STATUS_DRAFT) { $balance = $this->getCPforUser($this->fk_user, $this->fk_type); if ($balance < 0) { @@ -1018,8 +1039,8 @@ class Holiday extends CommonObject $error++; } $sql .= " halfday = ".$this->halfday.","; - if (!empty($this->statut) && is_numeric($this->statut)) { - $sql .= " statut = ".$this->statut.","; + if (!empty($this->status) && is_numeric($this->status)) { + $sql .= " statut = ".$this->status.","; } else { $error++; } @@ -1338,7 +1359,7 @@ class Holiday extends CommonObject $datas = array(); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Holiday").''; - if (isset($this->statut)) { + if (isset($this->status)) { $datas['picto'] .= ' '.$this->getLibStatut(5); } $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; @@ -1457,7 +1478,7 @@ class Holiday extends CommonObject */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->statut, $mode, $this->date_debut); + return $this->LibStatut($this->status, $mode, $this->date_debut); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2363,7 +2384,6 @@ class Holiday extends CommonObject $this->fk_validator = $user->id; $this->halfday = 0; $this->fk_type = 1; - $this->statut = Holiday::STATUS_VALIDATED; $this->status = Holiday::STATUS_VALIDATED; return 1; From bf954e9cd7dacf9ee77f9d1abbd705665804f990 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 21:04:20 +0100 Subject: [PATCH 54/78] Fix for compatibility --- htdocs/core/lib/functions.lib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 546ab720452..326f5e9236a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -261,6 +261,16 @@ function isModEnabled($module) $arrayconv['supplier_order'] = 'fournisseur'; $arrayconv['supplier_invoice'] = 'fournisseur'; } + // Special case. + // @TODO Replace isModEnabled('delivery_note') with + // isModEnabled('shipping') && getDolGlobalString('MAIN_SUBMODULE_EXPEDITION') + if ($module == 'delivery_note') { + if (!getDolGlobalString('MAIN_SUBMODULE_EXPEDITION')) { + return false; + } else { + $module = 'shipping'; + } + } $module_alt = $module; if (!empty($arrayconv[$module])) { From 9807ed32e8a6ef87c9b57a6207e69c961d86619e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 21:09:23 +0100 Subject: [PATCH 55/78] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5729ea05203..d157c6b62e2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12170,19 +12170,19 @@ function getElementProperties($elementType) $module = 'expedition'; $table_element = 'expedition'; } elseif ($elementType == 'delivery_note') { - $classpath = 'expedition/class'; - $subelement = 'expedition'; - $module = 'expedition_bon'; + $classpath = 'delivery/class'; + $subelement = 'delivery'; + $module = 'expedition'; + } elseif ($elementType == 'delivery') { + $classpath = 'delivery/class'; + $subelement = 'delivery'; + $module = 'expedition'; } elseif ($elementType == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; $module = 'supplier_proposal'; $element = 'supplierproposal'; $classfile = 'supplier_proposal'; $subelement = 'supplierproposal'; - } elseif ($elementType == 'delivery') { - $classpath = 'delivery/class'; - $subelement = 'delivery'; - $module = 'expedition'; } elseif ($elementType == 'contract') { $classpath = 'contrat/class'; $module = 'contrat'; From a548d453b4b70af06706c3df4d6cd1f9c7cea6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 21:15:01 +0100 Subject: [PATCH 56/78] clean deprecated --- htdocs/holiday/card.php | 62 +++++++++++++++---------------- htdocs/holiday/card_group.php | 16 ++++---- htdocs/holiday/define_holiday.php | 3 +- htdocs/holiday/document.php | 10 ++--- htdocs/holiday/list.php | 8 ++-- htdocs/holiday/month_report.php | 4 +- htdocs/holiday/view_log.php | 9 +++-- 7 files changed, 57 insertions(+), 55 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 93d6cbe538a..48b96e4dd39 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2014-2017 Ferran Marcet - * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020-2021 Udo Tamm * Copyright (C) 2022 Anthony Berton * @@ -108,7 +108,7 @@ $candelete = 0; if ($user->hasRight('holiday', 'delete')) { $candelete = 1; } -if ($object->statut == Holiday::STATUS_DRAFT && $user->hasRight('holiday', 'write') && in_array($object->fk_user, $childids)) { +if ($object->status == Holiday::STATUS_DRAFT && $user->hasRight('holiday', 'write') && in_array($object->fk_user, $childids)) { $candelete = 1; } @@ -116,7 +116,7 @@ if ($object->statut == Holiday::STATUS_DRAFT && $user->hasRight('holiday', 'writ if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->statut); +$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->status); /* @@ -357,7 +357,7 @@ if (empty($reshook)) { $object->fetch($id); // If under validation - if ($object->statut == Holiday::STATUS_DRAFT) { + if ($object->status == Holiday::STATUS_DRAFT) { // If this is the requester or has read/write rights if ($cancreate) { $approverid = GETPOSTINT('valideur'); @@ -440,7 +440,7 @@ if (empty($reshook)) { $object->fetch($id); // If this is a rough draft, approved, canceled or refused - if ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED) { + if ($object->status == Holiday::STATUS_DRAFT || $object->status == Holiday::STATUS_CANCELED || $object->status == Holiday::STATUS_REFUSED) { $result = $object->delete($user); } else { $error++; @@ -462,10 +462,10 @@ if (empty($reshook)) { $object->fetch($id); // If draft and owner of leave - if ($object->statut == Holiday::STATUS_DRAFT && $cancreate) { + if ($object->status == Holiday::STATUS_DRAFT && $cancreate) { $object->oldcopy = dol_clone($object, 2); - $object->statut = Holiday::STATUS_VALIDATED; + $object->status = Holiday::STATUS_VALIDATED; $verif = $object->validate($user); @@ -598,7 +598,7 @@ if (empty($reshook)) { $object->fetch($id); // If status is waiting approval and approver is also user - if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { + if ($object->status == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { $object->oldcopy = dol_clone($object, 2); $object->date_approval = dol_now(); @@ -703,7 +703,7 @@ if (empty($reshook)) { $object->fetch($id); // If status pending validation and validator = user - if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { + if ($object->status == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { $object->date_refuse = dol_now(); $object->fk_user_refuse = $user->id; $object->statut = Holiday::STATUS_REFUSED; @@ -794,7 +794,7 @@ if (empty($reshook)) { $object->fetch($id); - $oldstatus = $object->statut; + $oldstatus = $object->status; $object->statut = Holiday::STATUS_DRAFT; $object->status = Holiday::STATUS_DRAFT; @@ -821,11 +821,11 @@ if (empty($reshook)) { $object->fetch($id); // If status pending validation and validator = validator or user, or rights to do for others - if (($object->statut == Holiday::STATUS_VALIDATED || $object->statut == Holiday::STATUS_APPROVED) && + if (($object->status == Holiday::STATUS_VALIDATED || $object->status == Holiday::STATUS_APPROVED) && (!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) { $db->begin(); - $oldstatus = $object->statut; + $oldstatus = $object->status; $object->date_cancel = dol_now(); $object->fk_user_cancel = $user->id; $object->statut = Holiday::STATUS_CANCELED; @@ -1253,8 +1253,8 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { if ($canread) { $head = holiday_prepare_head($object); - if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { - if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) { + if (($action == 'edit' && $object->status == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { + if ($action == 'edit' && $object->status == Holiday::STATUS_DRAFT) { $edit = true; } @@ -1364,7 +1364,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''; print ''; - if ($object->statut == Holiday::STATUS_REFUSED) { + if ($object->status == Holiday::STATUS_REFUSED) { print ''; print ''.$langs->trans('DetailRefusCP').''; print ''.$object->detail_refuse.''; @@ -1414,14 +1414,14 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { if (!$edit && $action != 'editvalidator') { print ''; print ''; - if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) { + if ($object->status == Holiday::STATUS_APPROVED || $object->status == Holiday::STATUS_CANCELED) { print $langs->trans('ApprovedBy'); } else { print $langs->trans('ReviewedByCP'); } print ''; print ''; - if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) { + if ($object->status == Holiday::STATUS_APPROVED || $object->status == Holiday::STATUS_CANCELED) { if ($object->fk_user_approve > 0) { $approverdone = new User($db); $approverdone->fetch($object->fk_user_approve); @@ -1431,7 +1431,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print $approverexpected->getNomUrl(-1); } $include_users = $object->fetch_users_approver_holiday(); - if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) { + if (is_array($include_users) && in_array($user->id, $include_users) && $object->status == Holiday::STATUS_VALIDATED) { print ''.img_edit($langs->trans("Edit")).''; } print ''; @@ -1463,19 +1463,19 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''.$langs->trans('DateCreation').''; print ''.dol_print_date($object->date_create, 'dayhour', 'tzuser').''; print ''; - if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) { + if ($object->status == Holiday::STATUS_APPROVED || $object->status == Holiday::STATUS_CANCELED) { print ''; print ''.$langs->trans('DateValidCP').''; print ''.dol_print_date($object->date_approval, 'dayhour', 'tzuser').''; // warning: date_valid is approval date on holiday module print ''; } - if ($object->statut == Holiday::STATUS_CANCELED) { + if ($object->status == Holiday::STATUS_CANCELED) { print ''; print ''.$langs->trans('DateCancelCP').''; print ''.dol_print_date($object->date_cancel, 'dayhour', 'tzuser').''; print ''; } - if ($object->statut == Holiday::STATUS_REFUSED) { + if ($object->status == Holiday::STATUS_REFUSED) { print ''; print ''.$langs->trans('DateRefusCP').''; print ''.dol_print_date($object->date_refuse, 'dayhour', 'tzuser').''; @@ -1500,7 +1500,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } // Si envoi en validation - if ($action == 'sendToValidate' && $object->statut == Holiday::STATUS_DRAFT) { + if ($action == 'sendToValidate' && $object->status == Holiday::STATUS_DRAFT) { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleToValidCP"), $langs->trans("ConfirmToValidCP"), "confirm_send", '', 1, 1); } @@ -1525,9 +1525,9 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleSetToDraft"), $langs->trans("ConfirmSetToDraft"), "confirm_draft", '', 1, 1); } - if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { - if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) { - if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { + if (($action == 'edit' && $object->status == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { + if ($action == 'edit' && $object->status == Holiday::STATUS_DRAFT) { + if ($cancreate && $object->status == Holiday::STATUS_DRAFT) { print $form->buttonsSaveCancel(); } } @@ -1540,15 +1540,15 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print '
'; - if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { + if ($cancreate && $object->status == Holiday::STATUS_DRAFT) { print ''.$langs->trans("EditCP").''; } - if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { // If draft + if ($cancreate && $object->status == Holiday::STATUS_DRAFT) { // If draft print ''.$langs->trans("Validate").''; } - if ($object->statut == Holiday::STATUS_VALIDATED) { // If validated + if ($object->status == Holiday::STATUS_VALIDATED) { // If validated // Button Approve / Refuse if ($user->id == $object->fk_validator) { print ''.$langs->trans("Approve").''; @@ -1567,7 +1567,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } } } - if ($object->statut == Holiday::STATUS_APPROVED) { // If validated and approved + if ($object->status == Holiday::STATUS_APPROVED) { // If validated and approved if ($user->id == $object->fk_validator || $user->id == $object->fk_user_approve || $cancreate || $cancreateall) { if (($object->date_fin > dol_now()) || !empty($user->admin) || $user->id == $object->fk_user_approve) { print ''.$langs->trans("ActionCancelCP").''; @@ -1583,10 +1583,10 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } } - if (($cancreate || $cancreateall) && $object->statut == Holiday::STATUS_CANCELED) { + if (($cancreate || $cancreateall) && $object->status == Holiday::STATUS_CANCELED) { print ''.$langs->trans("SetToDraft").''; } - if ($candelete && ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED)) { // If draft or canceled or refused + if ($candelete && ($object->status == Holiday::STATUS_DRAFT || $object->status == Holiday::STATUS_CANCELED || $object->status == Holiday::STATUS_REFUSED)) { // If draft or canceled or refused print ''.$langs->trans("DeleteCP").''; } diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index 129353718b9..3d01863ed95 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2014-2017 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020-2021 Udo Tamm * Copyright (C) 2022 Anthony Berton * Copyright (C) 2024 MDW @@ -50,10 +50,10 @@ $confirm = GETPOST('confirm', 'alpha'); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $fuserid = (GETPOSTINT('fuserid') ? GETPOSTINT('fuserid') : $user->id); -$users = (GETPOST('users', 'array') ? GETPOST('users', 'array') : array($user->id)); +$users = (GETPOST('users', 'array') ? GETPOST('users', 'array') : array($user->id)); $groups = GETPOST('groups', 'array'); $socid = GETPOSTINT('socid'); -$autoValidation = GETPOSTINT('autoValidation'); +$autoValidation = GETPOSTINT('autoValidation'); $AutoSendMail = GETPOSTINT('AutoSendMail'); // Load translation files required by the page $langs->loadLangs(array("other", "holiday", "mails", "trips")); @@ -109,7 +109,7 @@ $candelete = 0; if ($user->hasRight('holiday', 'delete')) { $candelete = 1; } -if ($object->statut == Holiday::STATUS_DRAFT && $user->hasRight('holiday', 'write') && in_array($object->fk_user, $childids)) { +if ($object->status == Holiday::STATUS_DRAFT && $user->hasRight('holiday', 'write') && in_array($object->fk_user, $childids)) { $candelete = 1; } @@ -117,7 +117,7 @@ if ($object->statut == Holiday::STATUS_DRAFT && $user->hasRight('holiday', 'writ if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->statut); +$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->status); /* @@ -325,7 +325,7 @@ if (empty($reshook)) { $htemp = new Holiday($db); $htemp->fetch($result); - $htemp->statut = Holiday::STATUS_VALIDATED; + $htemp->status = Holiday::STATUS_VALIDATED; $resultValidated = $htemp->update($approverid); if ($resultValidated < 0) { @@ -685,10 +685,10 @@ function sendMail($id, $cancreate, $now, $autoValidation) if ($result) { // If draft and owner of leave - if ($object->statut == Holiday::STATUS_VALIDATED && $cancreate) { + if ($object->status == Holiday::STATUS_VALIDATED && $cancreate) { $object->oldcopy = dol_clone($object, 2); - //if ($autoValidation) $object->statut = Holiday::STATUS_VALIDATED; + //if ($autoValidation) $object->status = Holiday::STATUS_VALIDATED; $verif = $object->validate($user); diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 9bcd2ea51c4..4b8c0974eef 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -3,6 +3,7 @@ * Copyright (C) 2011 Dimitri Mouillard * Copyright (C) 2013 Marcos García * Copyright (C) 2016 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -431,7 +432,7 @@ if (count($typeleaves) == 0) { $userstatic->firstname = $users['firstname']; $userstatic->gender = $users['gender']; $userstatic->photo = $users['photo']; - $userstatic->statut = $users['status']; + $userstatic->status = $users['status']; $userstatic->employee = $users['employee']; $userstatic->fk_user = $users['fk_user']; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 94c60cf964e..2722521ca0f 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -212,7 +212,7 @@ if ($object->id) { print ''.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).''; print ''; - if ($object->statut == 5) { + if ($object->status == Holiday::STATUS_REFUSED) { print ''; print ''.$langs->trans('DetailRefusCP').''; print ''.$object->detail_refuse.''; @@ -258,19 +258,19 @@ if ($object->id) { print ''.$langs->trans('DateCreation').''; print ''.dol_print_date($object->date_create,'dayhour').''; print ''; - if ($object->statut == 3) { + if ($object->status == 3) { print ''; print ''.$langs->trans('DateValidCP').''; print ''.dol_print_date($object->date_valid,'dayhour').''; print ''; } - if ($object->statut == 4) { + if ($object->status == 4) { print ''; print ''.$langs->trans('DateCancelCP').''; print ''.dol_print_date($object->date_cancel,'dayhour').''; print ''; } - if ($object->statut == 5) { + if ($object->status == 5) { print ''; print ''.$langs->trans('DateRefusCP').''; print ''.dol_print_date($object->date_refuse,'dayhour').''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 42c2d0808f6..a4eaae03a85 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2020 Laurent Destailleur * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2019-2023 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -842,7 +842,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) // Leave request $holidaystatic->id = $obj->rowid; $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); - $holidaystatic->statut = $obj->status; + $holidaystatic->status = $obj->status; $holidaystatic->date_debut = $db->jdate($obj->date_debut); $holidaystatic->date_fin = $db->jdate($obj->date_fin); @@ -853,7 +853,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) $userstatic->admin = $obj->user_admin; $userstatic->email = $obj->user_email; $userstatic->login = $obj->user_login; - $userstatic->statut = $obj->user_status; + $userstatic->status = $obj->user_status; $userstatic->photo = $obj->user_photo; // Validator @@ -863,7 +863,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) $approbatorstatic->admin = $obj->validator_admin; $approbatorstatic->email = $obj->validator_email; $approbatorstatic->login = $obj->validator_login; - $approbatorstatic->statut = $obj->validator_status; + $approbatorstatic->status = $obj->validator_status; $approbatorstatic->photo = $obj->validator_photo; $date = $obj->date_create; diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 6f10f9c9ce9..75831e91497 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -1,7 +1,7 @@ * Copyright (C) 2011 François Legastelois - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify @@ -399,7 +399,7 @@ if ($num == 0) { // Leave request $holidaystatic->id = $obj->rowid; $holidaystatic->ref = $obj->ref; - $holidaystatic->statut = $obj->status; + $holidaystatic->status = $obj->status; $holidaystatic->status = $obj->status; $holidaystatic->fk_user = $obj->fk_user; $holidaystatic->fk_type = $obj->fk_type; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 0820c283618..ac042253777 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2011 Dimitri Mouillard * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -464,12 +465,12 @@ while ($i < min($num, $limit)) { $holidaylogstatic->id = $obj['rowid']; $holidaylogstatic->date = $obj['date_action']; - $holidaylogstatic->validator = $obj['fk_user_action']; - $holidaylogstatic->employee = $obj['fk_user_update']; - $holidaylogstatic->description = $obj['type_action']; + $holidaylogstatic->validator = $obj['fk_user_action']; + $holidaylogstatic->employee = $obj['fk_user_update']; + $holidaylogstatic->description = $obj['type_action']; $holidaylogstatic->type = $obj['fk_type']; $holidaylogstatic->balance_previous = $obj['prev_solde']; - $holidaylogstatic->balance_new = $obj['new_solde']; + $holidaylogstatic->balance_new = $obj['new_solde']; print ''; From 8068d07c83620ab4bacc17a49ff2033db526c30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 21:21:29 +0100 Subject: [PATCH 57/78] fix warning --- htdocs/holiday/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 48b96e4dd39..895d96d6966 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1290,8 +1290,12 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''.$langs->trans("Type").''; print ''; $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']); - print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow; + 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']); + } + print $labeltoshow; print ''; print ''; From d5c5982b20347f8f7382aaf6adb9e0259077b79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 21:24:28 +0100 Subject: [PATCH 58/78] fix warnings --- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/holiday/document.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 69623e47103..c12032028e6 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2345,7 +2345,7 @@ class Holiday extends CommonObject $this->date_approval = $this->db->jdate($obj->datea); $this->user_creation_id = $obj->fk_user_creation; - $this->user_validation_id = $obj->fk_user_valid; + $this->user_validation_id = $obj->fk_user_validation; $this->user_modification_id = $obj->fk_user_modification; if ($obj->status == Holiday::STATUS_APPROVED || $obj->status == Holiday::STATUS_CANCELED) { diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 2722521ca0f..43fe279c57d 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -167,8 +167,12 @@ if ($object->id) { print ''.$langs->trans("Type").''; print ''; $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']); - print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow; + 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']); + } + print $labeltoshow; print ''; print ''; From 4bc9f52957236bf6509d28c55a8800f50f2b8b1c Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:23:37 +0100 Subject: [PATCH 59/78] Fix PhanPluginMixedKeyNoKey - real missing key/value mapping --- htdocs/core/class/fiscalyear.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index c1592b01db3..4b6f6f60939 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014-2020 Alexandre Spangaro * Copyright (C) 2020 OScss-Shop * Copyright (C) 2023-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 @@ -331,7 +332,7 @@ class Fiscalyear extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, - 'option', $option, + 'option' => $option, 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; From 2f5a227f8c7774a22b6f0a9e51d3fb80379e53d8 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:31:51 +0100 Subject: [PATCH 60/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- 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 1f954f6a9ad..479887a5724 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2018 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 @@ -745,7 +746,7 @@ class AccountingAccount extends CommonObject $hookmanager->initHooks(array('accountancyBindingCalculation')); // Execute hook accountancyBindingCalculation - $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount' => $accountingAccount, $type); + $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount' => $accountingAccount, 0 => $type); $reshook = $hookmanager->executeHooks('accountancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { From 7eb27d189153d41d3dabb863b6d4accd182789ff Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:31:53 +0100 Subject: [PATCH 61/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/comm/mailing/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 147415be9fa..559530a6873 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1151,8 +1151,8 @@ if ($action == 'create') { // Create an array for form $formquestion = array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0) + 0 => array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1), + 1 => array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0) ); // Incomplete payment. On demande si motif = escompte ou autre print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240); From ce626d72ede921616f8e9d70f6d77810faa89554 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:31:59 +0100 Subject: [PATCH 62/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/comm/remx.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index f1584aa8b30..1ed17699c6d 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2008 Raphael Bertrand (Resultic) * 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 @@ -560,8 +561,8 @@ if ($socid > 0) { $amount2 = ($showconfirminfo['amount_ttc'] - $amount1); $formquestion = array( 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), - array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), - array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') + 0 => array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), + 1 => array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') ); $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, '', 0); @@ -707,8 +708,8 @@ if ($socid > 0) { $amount2 = ($showconfirminfo['amount_ttc'] - $amount1); $formquestion = array( 'text' => $langs->trans('TypeAmountOfEachNewDiscount'), - array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), - array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') + 0 => array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'), + 1 => array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') ); $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); From d8c7aad698b11d2518b987ebda2617fc3ab54535 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:02 +0100 Subject: [PATCH 63/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/compta/facture/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ecb64ab4396..f01432b7c25 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -17,6 +17,7 @@ * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis + * 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 @@ -1662,7 +1663,7 @@ if (empty($reshook)) { null, 0, '', - (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)?0:1) + (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA) ? 0 : 1) ); } @@ -4459,7 +4460,7 @@ if ($action == 'create') { } // Create a form table - $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); + $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), 0 => array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), 1 => array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); // Incomplete payment. We ask if reason = discount or other $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 380, 600); } @@ -4491,7 +4492,7 @@ if ($action == 'create') { $arrayreasons[$close[2]['code']] = $close[2]['reason']; // Create a form table - $formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); + $formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"), 0 => array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), 1 => array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('CancelBill'), $langs->trans('ConfirmCancelBill', $object->ref), 'confirm_canceled', $formquestion, "yes", 1, 270); } From 43ba3df82e58e8b4ccc216797d5be8d98a4d67dd Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:05 +0100 Subject: [PATCH 64/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/contrat/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 98c46cc9f47..ff741101419 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2023 Charlene Benke * Copyright (C) 2023 Nick Fragoulis + * 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 @@ -1351,8 +1352,8 @@ if ($action == 'create') { } elseif ($action == 'activate') { $formquestion = array( array('type' => 'date', 'name' => 'd_start', 'label' => $langs->trans("DateServiceActivate"), 'value' => dol_now()), - array('type' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ '', ''), - array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300', 'moreattr' => 'autofocus') + array('type' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ 0 => '', 1 => ''), + array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', 0 => '', 1 => '', 'class' => 'minwidth300', 'moreattr' => 'autofocus') ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", $formquestion, 'yes', 1, 280); } elseif ($action == 'clone') { @@ -1890,7 +1891,7 @@ if ($action == 'create') { // Cree un tableau formulaire $formquestion = array( 'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"), - array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid)); + 0 => array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid)); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOSTINT('rowid'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion); print '
'; From 06868badf8439f6eee39c18c39135be4cb70c0cd Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:08 +0100 Subject: [PATCH 65/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/expensereport/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 8c1cf0cae44..83e2df9364c 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1667,7 +1667,7 @@ if ($action == 'create') { } $formquestion = array( 'text' => '', - array('type' => 'other', 'name' => 'fk_user_author', 'label' => $langs->trans("SelectTargetUser"), 'value' => $form->select_dolusers((GETPOSTINT('fk_user_author') > 0 ? GETPOSTINT('fk_user_author') : $user->id), 'fk_user_author', 0, null, 0, $criteriaforfilter, '', '0', 0, 0, '', 0, '', 'maxwidth150')) + 0 => array('type' => 'other', 'name' => 'fk_user_author', 'label' => $langs->trans("SelectTargetUser"), 'value' => $form->select_dolusers((GETPOSTINT('fk_user_author') > 0 ? GETPOSTINT('fk_user_author') : $user->id), 'fk_user_author', 0, null, 0, $criteriaforfilter, '', '0', 0, 0, '', 0, '', 'maxwidth150')) ); // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneExpenseReport', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); @@ -1694,7 +1694,7 @@ if ($action == 'create') { } if ($action == 'cancel') { - $array_input = array('text' => $langs->trans("ConfirmCancelTrip"), array('type' => "text", 'label' => ''.$langs->trans("Comment").'', 'name' => "detail_cancel", 'value' => "")); + $array_input = array('text' => $langs->trans("ConfirmCancelTrip"), 0 => array('type' => "text", 'label' => ''.$langs->trans("Comment").'', 'name' => "detail_cancel", 'value' => "")); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Cancel"), "", "confirm_cancel", $array_input, "", 1); } @@ -1703,7 +1703,7 @@ if ($action == 'create') { } if ($action == 'refuse') { // Deny - $array_input = array('text' => $langs->trans("ConfirmRefuseTrip"), array('type' => "text", 'label' => $langs->trans("Comment"), 'name' => "detail_refuse", 'value' => "")); + $array_input = array('text' => $langs->trans("ConfirmRefuseTrip"), 0 => array('type' => "text", 'label' => $langs->trans("Comment"), 'name' => "detail_refuse", 'value' => "")); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Deny"), '', "confirm_refuse", $array_input, "yes", 1); } From b1b6ce6dc00d1dc5af6ea5609261d72936c1309a Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:11 +0100 Subject: [PATCH 66/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/fourn/facture/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 064dca1f9cf..97f21ccb533 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -13,6 +13,7 @@ * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis + * 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 @@ -3094,7 +3095,7 @@ if ($action == 'create') { } // Create a form table - $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); + $formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), 0 => array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), 1 => array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); // Incomplete payment. We ask if the reason is discount or other $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 310); } @@ -3115,7 +3116,7 @@ if ($action == 'create') { $arrayreasons[$close[2]['code']] = $close[2]['reason']; // Create a form table - $formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); + $formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"), 0 => array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), 1 => array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300')); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('CancelBill'), $langs->trans('ConfirmCancelBill', $object->ref), 'confirm_canceled', $formquestion, "yes", 1, 280); } From 28e866c22c608dd11c8b26de033d14caa2d687ca Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:13 +0100 Subject: [PATCH 67/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/product/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b848078cc20..d18442094ca 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -20,6 +20,7 @@ * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2022 Vincent de Grandpré + * 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 @@ -2884,9 +2885,9 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->d // Define confirmation messages $formquestionclone = array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'text', 'name' => 'clone_ref', 'label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'morecss' => 'width150'), - array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContentProduct"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), + 0 => array('type' => 'text', 'name' => 'clone_ref', 'label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'morecss' => 'width150'), + 1 => array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContentProduct"), 'value' => 1), + 2 => array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), ); if (getDolGlobalString('PRODUIT_MULTIPRICES')) { $formquestionclone[] = array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("CustomerPrices").')', 'value' => 0); From 0a65a582fc9ffc0e5b74b7e5c827dcb9547113af Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:15 +0100 Subject: [PATCH 68/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- .../stocktransfer/stocktransfer_card.php | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index da94893f777..7521fb2ef3b 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -1,6 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- + * 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 @@ -537,29 +538,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } elseif ($action == 'destock') { // Destock confirmation // Create an array for form $formquestion = array( 'text' => '', - array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestock', $object->ref), 'size'=>40), - array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25) + 0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestock', $object->ref), 'size' => 40), + 1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25) ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProduct'), '', 'confirm_destock', $formquestion, 'yes', 1); } elseif ($action == 'destockcancel') { // Destock confirmation cancel // Create an array for form $formquestion = array( 'text' => '', - array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestockCancel', $object->ref), 'size'=>40), - array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25) + 0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestockCancel', $object->ref), 'size' => 40), + 1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25) ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProductCancel'), '', 'confirm_destockcancel', $formquestion, 'yes', 1); } elseif ($action == 'addstock') { // Addstock confirmation // Create an array for form $formquestion = array( 'text' => '', - array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").' :', 'value' => $langs->trans('ConfirmAddStock', $object->ref), 'size'=>40), - array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25) + 0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").' :', 'value' => $langs->trans('ConfirmAddStock', $object->ref), 'size' => 40), + 1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25) ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AddStockAllProduct'), '', 'confirm_addstock', $formquestion, 'yes', 1); } elseif ($action == 'addstockcancel') { // Addstock confirmation cancel // Create an array for form $formquestion = array( 'text' => '', - array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").' :', 'value' => $langs->trans('ConfirmAddStockCancel', $object->ref), 'size'=>40), - array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25) + 0 => array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").' :', 'value' => $langs->trans('ConfirmAddStockCancel', $object->ref), 'size' => 40), + 1 => array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size' => 25) ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AddStockAllProductCancel'), '', 'confirm_addstockcancel', $formquestion, 'yes', 1); } @@ -582,7 +583,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'valid' && $permissiontoadd) { - $nextref=$object->getNextNumRef(); + $nextref = $object->getNextNumRef(); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $langs->transnoentities('ConfirmValidateStockTransfer', $nextref), 'confirm_validate', $formquestion, 0, 2); } @@ -646,8 +647,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //unset($object->fields['fk_project']); // Hide field already shown in banner //unset($object->fields['fk_soc']); // Hide field already shown in banner - $object->fields['fk_soc']['visible']=0; // Already available in banner - $object->fields['fk_project']['visible']=0; // Already available in banner + $object->fields['fk_soc']['visible'] = 0; // Already available in banner + $object->fields['fk_project']['visible'] = 0; // Already available in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Incoterms @@ -763,7 +764,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $param = ''; - $conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE=true; // Full display needed to see all column title details + $conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE = true; // Full display needed to see all column title details print ''; print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); @@ -927,7 +928,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formproduct->loadWarehouses(); // Pour charger la totalité des entrepôts // On stock ceux qui ne doivent pas être proposés dans la liste - $TExcludedWarehouseSource=array(); + $TExcludedWarehouseSource = array(); if (!empty($object->fk_warehouse_source)) { $source_ent = new Entrepot($db); $source_ent->fetch($object->fk_warehouse_source); @@ -939,7 +940,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // On stock ceux qui ne doivent pas être proposés dans la liste - $TExcludedWarehouseDestination=array(); + $TExcludedWarehouseDestination = array(); if (!empty($object->fk_warehouse_destination)) { $dest_ent = new Entrepot($db); $dest_ent->fetch($object->fk_warehouse_destination); @@ -951,14 +952,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses - $formproduct->cache_warehouses=array(); + $formproduct->cache_warehouses = array(); // In warehouse print ''; print $formproduct->selectWarehouses(empty($fk_warehouse_source) ? $object->fk_warehouse_source : $fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); print ''; // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses - $formproduct->cache_warehouses=array(); + $formproduct->cache_warehouses = array(); // Out warehouse print ''; print $formproduct->selectWarehouses(empty($fk_warehouse_destination) ? $object->fk_warehouse_destination : $fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination); From 5be91bbfa4439b7c1fcdbb3e9715f15c5b0499e2 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:19 +0100 Subject: [PATCH 69/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/projet/card.php | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 84cd7ade199..6925294ec2d 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2023 Charlene Benke * Copyright (C) 2023 Christian Foellmann + * 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 @@ -38,9 +39,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page -$langsLoad=array('projects', 'companies'); +$langsLoad = array('projects', 'companies'); if (isModEnabled('eventorganization')) { - $langsLoad[]='eventorganization'; + $langsLoad[] = 'eventorganization'; } $langs->loadLangs($langsLoad); @@ -116,7 +117,7 @@ $permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include * Actions */ -$parameters = array('id'=>$socid, 'objcanvas'=>$objcanvas); +$parameters = array('id' => $socid, 'objcanvas' => $objcanvas); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -977,13 +978,13 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { if ($action == 'clone') { $formquestion = array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOSTINT('socid') > 0 ? GETPOSTINT('socid') : $object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200 maxwidth250')), - array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true), - array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_project_files', 'label' => $langs->trans("CloneProjectFiles"), 'value' => false), - array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false) + 0 => array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOSTINT('socid') > 0 ? GETPOSTINT('socid') : $object->socid, 'socid', '', "None", 0, 0, null, 0, 'minwidth200 maxwidth250')), + 1 => array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true), + 2 => array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true), + 3 => array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true), + 4 => array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true), + 5 => array('type' => 'checkbox', 'name' => 'clone_project_files', 'label' => $langs->trans("CloneProjectFiles"), 'value' => false), + 6 => array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false) ); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ToClone"), $langs->trans("ConfirmCloneProject"), "confirm_clone", $formquestion, '', 1, 400, 590); @@ -1644,16 +1645,16 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Buttons Create if (!getDolGlobalString('PROJECT_HIDE_CREATE_OBJECT_BUTTON')) { $arrayforbutaction = array( - 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("order"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 30 => array('lang'=>'bills', 'enabled'=>isModEnabled("invoice"), 'perm'=>$user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 40 => array('lang'=>'supplier_proposal', 'enabled'=>isModEnabled("supplier_proposal"), 'perm'=>$user->hasRight('supplier_proposal', 'creer'), 'label' => 'AddSupplierProposal', 'url'=>'/supplier_proposal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 50 => array('lang'=>'suppliers', 'enabled'=>isModEnabled("supplier_order"), 'perm'=>$user->hasRight('fournisseur', 'commande', 'creer'), 'label' => 'AddSupplierOrder', 'url'=>'/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 60 => array('lang'=>'suppliers', 'enabled'=>isModEnabled("supplier_invoice"), 'perm'=>$user->hasRight('fournisseur', 'facture', 'creer'), 'label' => 'AddSupplierInvoice', 'url'=>'/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 70 => array('lang'=>'interventions', 'enabled'=>isModEnabled("intervention"), 'perm'=>$user->hasRight('fichinter', 'creer'), 'label' => 'AddIntervention', 'url'=>'/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 80 => array('lang'=>'contracts', 'enabled'=>isModEnabled("contract"), 'perm'=>$user->hasRight('contrat', 'creer'), 'label' => 'AddContract', 'url'=>'/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 90 => array('lang'=>'trips', 'enabled'=>isModEnabled("expensereport"), 'perm'=>$user->hasRight('expensereport', 'creer'), 'label' => 'AddTrip', 'url'=>'/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 100 => array('lang'=>'donations', 'enabled'=>isModEnabled("don"), 'perm'=>$user->hasRight('don', 'creer'), 'label' => 'AddDonation', 'url'=>'/don/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 10 => array('lang' => 'propal', 'enabled' => isModEnabled("propal"), 'perm' => $user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url' => '/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 20 => array('lang' => 'orders', 'enabled' => isModEnabled("order"), 'perm' => $user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url' => '/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 30 => array('lang' => 'bills', 'enabled' => isModEnabled("invoice"), 'perm' => $user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url' => '/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 40 => array('lang' => 'supplier_proposal', 'enabled' => isModEnabled("supplier_proposal"), 'perm' => $user->hasRight('supplier_proposal', 'creer'), 'label' => 'AddSupplierProposal', 'url' => '/supplier_proposal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 50 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_order"), 'perm' => $user->hasRight('fournisseur', 'commande', 'creer'), 'label' => 'AddSupplierOrder', 'url' => '/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 60 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_invoice"), 'perm' => $user->hasRight('fournisseur', 'facture', 'creer'), 'label' => 'AddSupplierInvoice', 'url' => '/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 70 => array('lang' => 'interventions', 'enabled' => isModEnabled("intervention"), 'perm' => $user->hasRight('fichinter', 'creer'), 'label' => 'AddIntervention', 'url' => '/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 80 => array('lang' => 'contracts', 'enabled' => isModEnabled("contract"), 'perm' => $user->hasRight('contrat', 'creer'), 'label' => 'AddContract', 'url' => '/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 90 => array('lang' => 'trips', 'enabled' => isModEnabled("expensereport"), 'perm' => $user->hasRight('expensereport', 'creer'), 'label' => 'AddTrip', 'url' => '/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 100 => array('lang' => 'donations', 'enabled' => isModEnabled("don"), 'perm' => $user->hasRight('don', 'creer'), 'label' => 'AddDonation', 'url' => '/don/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), ); $params = array('backtopage' => $_SERVER["PHP_SELF"].'?id='.$object->id); From 3c67a1288ae17af4ed26a73edfd80926929e80cf Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:22 +0100 Subject: [PATCH 70/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/projet/tasks/task.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 39a8f5dd7db..0179c320106 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2018 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 @@ -58,7 +59,7 @@ $projectstatic = new Project($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -267,7 +268,7 @@ if ($id > 0 || !empty($ref)) { // Title $morehtmlref .= $projectstatic->title; // Thirdparty - if (!empty($projectstatic->thirdparty->id) &&$projectstatic->thirdparty->id > 0) { + if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { $morehtmlref .= '
'.$projectstatic->thirdparty->getNomUrl(1, 'project'); } $morehtmlref .= '
'; @@ -417,11 +418,11 @@ if ($id > 0 || !empty($ref)) { $formquestion = array( 'text' => $langs->trans("ConfirmClone"), //array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_change_dt', 'label' => $langs->trans("CloneChanges"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_affectation', 'label' => $langs->trans("CloneAffectation"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_prog', 'label' => $langs->trans("CloneProgression"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_time', 'label' => $langs->trans("CloneTimes"), 'value' => true), - array('type' => 'checkbox', 'name' => 'clone_file', 'label' => $langs->trans("CloneFile"), 'value' => true), + 0 => array('type' => 'checkbox', 'name' => 'clone_change_dt', 'label' => $langs->trans("CloneChanges"), 'value' => true), + 1 => array('type' => 'checkbox', 'name' => 'clone_affectation', 'label' => $langs->trans("CloneAffectation"), 'value' => true), + 2 => array('type' => 'checkbox', 'name' => 'clone_prog', 'label' => $langs->trans("CloneProgression"), 'value' => true), + 3 => array('type' => 'checkbox', 'name' => 'clone_time', 'label' => $langs->trans("CloneTimes"), 'value' => true), + 4 => array('type' => 'checkbox', 'name' => 'clone_file', 'label' => $langs->trans("CloneFile"), 'value' => true), ); @@ -638,7 +639,7 @@ if ($id > 0 || !empty($ref)) { // Other attributes $cols = 3; - $parameters = array('socid'=>$socid); + $parameters = array('socid' => $socid); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print ''; From bb6eee4cf7e2b317f676d1b2fa382286d4e280c4 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:32:24 +0100 Subject: [PATCH 71/78] Fix PhanPluginMixedKeyNoKey by using explicit keys --- htdocs/stripe/class/stripe.class.php | 51 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 70ed30c225f..ca71a510a1b 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.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 @@ -206,10 +207,10 @@ class Stripe extends CommonObject try { if (empty($key)) { // If the Stripe connect account not set, we use common API usage //$customer = \Stripe\Customer::retrieve("$tiers"); - $customer = \Stripe\Customer::retrieve(array('id'=>"$tiers", 'expand[]'=>'sources')); + $customer = \Stripe\Customer::retrieve(array('id' => "$tiers", 'expand[]' => 'sources')); } else { //$customer = \Stripe\Customer::retrieve("$tiers", array("stripe_account" => $key)); - $customer = \Stripe\Customer::retrieve(array('id'=>"$tiers", 'expand[]'=>'sources'), array("stripe_account" => $key)); + $customer = \Stripe\Customer::retrieve(array('id' => "$tiers", 'expand[]' => 'sources'), array("stripe_account" => $key)); } } catch (Exception $e) { // For example, we may have error: 'No such customer: cus_XXXXX; a similar object exists in live mode, but a test mode key was used to make this request.' @@ -221,7 +222,7 @@ class Stripe extends CommonObject $dataforcustomer = array( "email" => $object->email, "description" => $object->name, - "metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress) + "metadata" => array('dol_id' => $object->id, 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress) ); $vatcleaned = $object->tva_intra ? $object->tva_intra : null; @@ -256,7 +257,7 @@ class Stripe extends CommonObject $isineec = isInEEC($object); if ($object->country_code && $isineec) { //$taxids = $customer->allTaxIds($customer->id); - $customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned)); + $customer->createTaxId($customer->id, array('type' => 'eu_vat', 'value' => $vatcleaned)); } } } @@ -444,7 +445,7 @@ class Stripe extends CommonObject if (empty($paymentintent)) { // Try to create intent. See https://stripe.com/docs/api/payment_intents/create $ipaddress = getUserRemoteIP(); - $metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress); + $metadata = array('dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress); if (is_object($object)) { $metadata['dol_type'] = $object->element; $metadata['dol_id'] = $object->id; @@ -681,7 +682,7 @@ class Stripe extends CommonObject if (empty($setupintent)) { $ipaddress = getUserRemoteIP(); - $metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress); + $metadata = array('dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress); if (is_object($object)) { $metadata['dol_type'] = $object->element; $metadata['dol_id'] = $object->id; @@ -877,19 +878,19 @@ class Stripe extends CommonObject $dataforcard = array( "source" => array( - 'object'=>'card', - 'exp_month'=>$exp_date_month, - 'exp_year'=>$exp_date_year, - 'number'=>$number, - 'cvc'=>$cvc, - 'name'=>$cardholdername + 'object' => 'card', + 'exp_month' => $exp_date_month, + 'exp_year' => $exp_date_year, + 'number' => $number, + 'cvc' => $cvc, + 'name' => $cardholdername ), "metadata" => array( - 'dol_type'=>$object->element, - 'dol_id'=>$object->id, - 'dol_version'=>DOL_VERSION, - 'dol_entity'=>$conf->entity, - 'ipaddress'=>$ipaddress + 'dol_type' => $object->element, + 'dol_id' => $object->id, + 'dol_version' => DOL_VERSION, + 'dol_entity' => $conf->entity, + 'ipaddress' => $ipaddress ) ); @@ -1022,7 +1023,7 @@ class Stripe extends CommonObject } elseif ($createifnotlinkedtostripe) { $iban = $obj->iban; $ipaddress = getUserRemoteIP(); - $metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress); + $metadata = array('dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress); if (is_object($object)) { $metadata['dol_type'] = $object->element; $metadata['dol_id'] = $object->id; @@ -1032,7 +1033,7 @@ class Stripe extends CommonObject $description = 'SEPA for IBAN '.$iban; $dataforcard = array( - 'type'=>'sepa_debit', + 'type' => 'sepa_debit', "sepa_debit" => array('iban' => $iban), 'billing_details' => array( 'name' => $soc->name, @@ -1042,19 +1043,19 @@ class Stripe extends CommonObject ); // Complete owner name if (!empty($soc->town)) { - $dataforcard['billing_details']['address']['city']=$soc->town; + $dataforcard['billing_details']['address']['city'] = $soc->town; } if (!empty($soc->country_code)) { - $dataforcard['billing_details']['address']['country']=$soc->country_code; + $dataforcard['billing_details']['address']['country'] = $soc->country_code; } if (!empty($soc->address)) { - $dataforcard['billing_details']['address']['line1']=$soc->address; + $dataforcard['billing_details']['address']['line1'] = $soc->address; } if (!empty($soc->zip)) { - $dataforcard['billing_details']['address']['postal_code']=$soc->zip; + $dataforcard['billing_details']['address']['postal_code'] = $soc->zip; } if (!empty($soc->state)) { - $dataforcard['billing_details']['address']['state']=$soc->state; + $dataforcard['billing_details']['address']['state'] = $soc->state; } //$a = \Stripe\Stripe::getApiKey(); @@ -1084,7 +1085,7 @@ class Stripe extends CommonObject } else { // link customer and src //$cs = $this->getSetupIntent($description, $soc, $cu, '', $status); - $dataforintent = array(['description'=> $description, 'payment_method_types' => ['sepa_debit'], 'customer' => $cu->id, 'payment_method' => $sepa->id], 'metadata'=>$metadata); + $dataforintent = array(0 => ['description' => $description, 'payment_method_types' => ['sepa_debit'], 'customer' => $cu->id, 'payment_method' => $sepa->id], 'metadata' => $metadata); $cs = $s->setupIntents->create($dataforintent); //$cs = $s->setupIntents->update($cs->id, ['payment_method' => $sepa->id]); From 4df31b56646d0c8aeeb586e78728aef92c0e0515 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 12 Mar 2024 21:33:23 +0100 Subject: [PATCH 72/78] Qual: Enable PhanPluginMixedKeyNoKey, all cases 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 5b058d1b438..53dd0aa447b 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -570,7 +570,7 @@ return [ // 'PhanTypeMismatchDeclaredReturnNullable', // 'PhanUndeclaredThis', - 'PhanPluginMixedKeyNoKey', + // 'PhanPluginMixedKeyNoKey', 'PhanPluginDuplicateConditionalNullCoalescing', // Suggests to optimize to ?? //'PhanUnreferencedClosure', // False positives seen with closures in arrays, TODO: move closure checks closer to what is done by unused variable plugin //'PhanPluginNoCommentOnProtectedMethod', From c9ed43c9e543f73e937de015a1ef568633158900 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 21:40:59 +0100 Subject: [PATCH 73/78] CSS --- htdocs/expedition/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 92154e65c1d..a71b364cdac 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -657,7 +657,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire') && ($user-> include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('IncludingProductWithTag'); - $moreforfilter .= img_picto($tmptitle, 'category'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); //$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); //$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, $search_product_category, 'search_product_category', 1, $tmptitle); @@ -668,7 +668,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); - $moreforfilter .= img_picto($tmptitle, 'category'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle); $moreforfilter .= '
'; } From 51ff132107527459b6a3936fae2f2981ad56ea48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 21:44:49 +0100 Subject: [PATCH 74/78] fix phpdoc --- .../class/expensereport.class.php | 77 ++++++++++++++----- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index a62d4dc04f2..54c4a8b469a 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -6,6 +6,7 @@ * Copyright (c) 2018-2024 Frédéric France * Copyright (C) 2016-2020 Ferran Marcet * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,8 +73,14 @@ class ExpenseReport extends CommonObject */ public $line; + /** + * @var int|string + */ public $date_debut; + /** + * @var int|string + */ public $date_fin; /** @@ -86,6 +93,9 @@ class ExpenseReport extends CommonObject */ public $fk_user; + /** + * @var int ID + */ public $user_approve_id; /** @@ -107,6 +117,8 @@ class ExpenseReport extends CommonObject public $modepaymentid; public $paid; + // Paiement + public $user_paid_infos; public $user_author_infos; public $user_validator_infos; @@ -116,6 +128,9 @@ class ExpenseReport extends CommonObject // ACTIONS // Create + /** + * @var int|string + */ public $date_create; /** @@ -129,16 +144,41 @@ class ExpenseReport extends CommonObject public $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. // Update + /** + * @var int|string + */ public $date_modif; + + /** + * @var int ID + */ public $fk_user_modif; // Refus + /** + * @var int|string + */ public $date_refuse; + + /** + * @var string + */ public $detail_refuse; + + /** + * @var int ID + */ public $fk_user_refuse; // Annulation + /** + * @var int|string + */ public $date_cancel; + + /** + * @var string + */ public $detail_cancel; /** @@ -169,37 +209,36 @@ class ExpenseReport extends CommonObject * @var int ID of User making validation */ public $fk_user_valid; + + /** + * @var int ID + */ public $user_valid_infos; // Approve + /** + * @var int|string + */ public $date_approve; - public $fk_user_approve; // User that has approved - // Paiement - public $user_paid_infos; + /** + * @var int ID User that has approved + */ + public $fk_user_approve; public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) + /** + * @var array + */ public $labelStatus = array(); + + /** + * @var array + */ public $labelStatusShort = array(); - // Multicurrency - /** - * @var int Currency ID - */ - public $fk_multicurrency; - - /** - * @var string multicurrency code - */ - public $multicurrency_code; - public $multicurrency_tx; - public $multicurrency_total_ht; - public $multicurrency_total_tva; - public $multicurrency_total_ttc; - - /** * Draft status */ From 8ff2a41af5e430ef1e5c4169cd1986c48bc3f452 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 21:46:59 +0100 Subject: [PATCH 75/78] Trans --- htdocs/langs/en_US/deliveries.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang index b8ae6dca02a..5eac14c4958 100644 --- a/htdocs/langs/en_US/deliveries.lang +++ b/htdocs/langs/en_US/deliveries.lang @@ -1,7 +1,7 @@ # Dolibarr language file - Source file is en_US - deliveries Delivery=Delivery DeliveryRef=Ref Delivery -DeliveryCard=Stock receipt +DeliveryCard=Delivery receipt DeliveryOrder=Delivery receipt DeliveryDate=Delivery date CreateDeliveryOrder=Generate delivery receipt From c6654fcd70f9cd0fda007b24344e71d6f267f10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Mar 2024 21:55:40 +0100 Subject: [PATCH 76/78] fix phpdoc --- .../class/expensereportstats.class.php | 26 +++++++++++++++++-- .../class/paymentexpensereport.class.php | 7 +++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index ddec220d12f..5f1c0858959 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (c) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,13 +36,34 @@ class ExpenseReportStats extends Stats */ public $table_element; + /** + * @var int ID + */ public $socid; + + /** + * @var int ID + */ public $userid; + /** + * @var string + */ public $from; + + /** + * @var string + */ public $field; + + /** + * @var string + */ public $where; + /** + * @var string + */ private $datetouse = 'date_valid'; @@ -120,7 +142,7 @@ class ExpenseReportStats extends Stats $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getNbByMonth($year, $sql, $format); - //var_dump($res);print '
'; + return $res; } @@ -142,7 +164,7 @@ class ExpenseReportStats extends Stats $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getAmountByMonth($year, $sql, $format); - //var_dump($res);print '
'; + return $res; } diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 09ea23d79c1..f480854dad8 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -56,7 +56,14 @@ class PaymentExpenseReport extends CommonObject */ public $fk_expensereport; + /** + * @var int|string + */ public $datec = ''; + + /** + * @var int|string + */ public $datep = ''; public $amount; // Total amount of payment public $amounts = array(); // Array of amounts From 54556b37fd317d056de498191fa9573b44e6e33b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 21:59:29 +0100 Subject: [PATCH 77/78] Clean code --- htdocs/core/lib/sendings.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index eecef7aaaec..7c108f74eca 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -58,10 +58,10 @@ function shipping_prepare_head($object) // delivery link $object->fetchObjectLinked($object->id, $object->element); if (isset($object->linkedObjectsIds['delivery']) && is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) { // If there is a delivery - // Take first one element of array + // Take first element of array $tmp = reset($object->linkedObjectsIds['delivery']); - $head[$h][0] = DOL_URL_ROOT."/delivery/card.php?id=".$tmp; + $head[$h][0] = DOL_URL_ROOT."/delivery/card.php?id=".((int) $tmp); $head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][2] = 'delivery'; $h++; @@ -75,7 +75,7 @@ function shipping_prepare_head($object) $objectsrc->fetch($object->origin_id); } $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external')); - $head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".((int) $object->id); $head[$h][1] = $langs->trans("ContactsAddresses"); if ($nbContact > 0) { $head[$h][1] .= ''.$nbContact.''; From 24bf23e68bf66bdffc041f3972798d99663ca01c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Mar 2024 22:06:03 +0100 Subject: [PATCH 78/78] Use ->statut instead of status --- htdocs/expedition/card.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 05b60d4d159..9ef21f4823f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1803,7 +1803,7 @@ if ($action == 'create') { // Confirm deletion if ($action == 'delete') { $formquestion = array(); - if ($object->statut == Expedition::STATUS_CLOSED && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { + if ($object->status == Expedition::STATUS_CLOSED && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { $formquestion = array( array( 'label' => $langs->trans('ShipmentIncrementStockOnDelete'), @@ -2184,7 +2184,7 @@ if ($action == 'create') { $editColspan--; } print ''; - if ($object->statut <= 1) { + if ($object->status <= 1) { print $langs->trans("QtyToShip").' - '; } else { print $langs->trans("QtyShipped").' - '; @@ -2197,7 +2197,7 @@ if ($action == 'create') { } print ''; } else { - if ($object->statut <= 1) { + if ($object->status <= 1) { print ''.$langs->trans("QtyToShip").''; } else { print ''.$langs->trans("QtyShipped").''; @@ -2213,7 +2213,7 @@ if ($action == 'create') { print ''.$langs->trans("CalculatedWeight").''; print ''.$langs->trans("CalculatedVolume").''; //print ''.$langs->trans("Size").''; - if ($object->statut == 0) { + if ($object->status == 0) { print ''; print ''; } @@ -2574,7 +2574,7 @@ if ($action == 'create') { print '
'; print '
'; print ''; - } elseif ($object->statut == Expedition::STATUS_DRAFT) { + } elseif ($object->status == Expedition::STATUS_DRAFT) { // edit-delete buttons print ''; print 'id.'">'.img_edit().''; @@ -2647,7 +2647,7 @@ if ($action == 'create') { $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook if (empty($reshook)) { - if ($object->statut == Expedition::STATUS_DRAFT && $num_prod > 0) { + if ($object->status == Expedition::STATUS_DRAFT && $num_prod > 0) { if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('expedition', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('expedition', 'shipping_advance', 'validate'))) { print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&token='.newToken().'&id='.$object->id, ''); @@ -2657,12 +2657,12 @@ if ($action == 'create') { } // 0=draft, 1=validated/delivered, 2=closed/delivered - if ($object->statut == Expedition::STATUS_VALIDATED && !getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT')) { + if ($object->status == Expedition::STATUS_VALIDATED && !getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT')) { if ($user->hasRight('expedition', 'creer')) { print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?action=setdraft&token='.newToken().'&id='.$object->id, ''); } } - if ($object->statut == Expedition::STATUS_CLOSED) { + if ($object->status == Expedition::STATUS_CLOSED) { if ($user->hasRight('expedition', 'creer')) { print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } @@ -2670,7 +2670,7 @@ if ($action == 'create') { // Send if (empty($user->socid)) { - if ($object->statut > 0) { + if ($object->status > 0) { if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('expedition', 'shipping_advance', 'send')) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); } else { @@ -2680,7 +2680,7 @@ if ($action == 'create') { } // Create bill - if (isModEnabled('invoice') && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED)) { + if (isModEnabled('invoice') && ($object->status == Expedition::STATUS_VALIDATED || $object->status == Expedition::STATUS_CLOSED)) { if ($user->hasRight('facture', 'creer')) { if (getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT') !== '0') { print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, ''); @@ -2690,13 +2690,13 @@ if ($action == 'create') { // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); - if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->hasRight('expedition', 'delivery', 'creer') && empty($object->linkedObjectsIds['delivery'])) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && ($object->status == Expedition::STATUS_VALIDATED || $object->status == Expedition::STATUS_CLOSED) && $user->hasRight('expedition', 'delivery', 'creer') && empty($object->linkedObjectsIds['delivery'])) { print dolGetButtonAction('', $langs->trans('CreateDeliveryOrder'), 'default', $_SERVER["PHP_SELF"].'?action=create_delivery&token='.newToken().'&id='.$object->id, ''); } // Set Billed and Closed - if ($object->statut == Expedition::STATUS_VALIDATED) { - if ($user->hasRight('expedition', 'creer') && $object->statut > 0) { + if ($object->status == Expedition::STATUS_VALIDATED) { + if ($user->hasRight('expedition', 'creer') && $object->status > 0) { if (!$object->billed && getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT') !== '0') { print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifybilled&token='.newToken().'&id='.$object->id, ''); } @@ -2705,7 +2705,7 @@ if ($action == 'create') { } // Cancel - if ($object->statut == Expedition::STATUS_VALIDATED) { + if ($object->status == Expedition::STATUS_VALIDATED) { if ($user->hasRight('expedition', 'creer')) { print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', ''); }