From 884cc5bd554a76a8c65a82c552bf09e803320e9f Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:18:06 +0100 Subject: [PATCH 01/22] Fix: Initilialise $out to fix PhanUndeclaredVariableAssignOp --- htdocs/comm/mailing/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d0efa85599e..9c512bfc047 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1491,6 +1491,7 @@ if ($action == 'create') { print ''; // List of files $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0); + $out = ''; // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript $out .= ''."\n"; From ef6b5940015bd2454e134ef166d6ace95f331e96 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:19:28 +0100 Subject: [PATCH 02/22] Fix: Initilialise $amount_ttc_diff to fix PhanUndeclaredVariableAssignOp --- htdocs/compta/facture/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7296c3dd820..86898548291 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1573,6 +1573,7 @@ if (empty($reshook)) { $TTotalByTva[$line->tva_tx] += $line->total_ttc; } + $amount_ttc_diff = 0.; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef $am = $amount * $coef; From 935f788774e8ae385f063768720773db1669c1b3 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:20:44 +0100 Subject: [PATCH 03/22] Fix: Initilialise $total_ttc to fix PhanUndeclaredVariableAssignOp --- htdocs/compta/paiement_vat.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index af4e1463ae3..ecb946e6686 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -253,6 +253,7 @@ if ($action == 'create') { $total = 0; $totalrecu = 0; + $total_ttc = 0.; while ($i < $num) { $objp = $tva; From 707e0dbd8769047b1becc03a0843d879f03b91aa Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:21:45 +0100 Subject: [PATCH 04/22] Fix: Update initial assing to $sql to fix PhanUndeclaredVariableAssignOp --- htdocs/core/actions_extrafields.inc.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index affca98a90d..61b31bfb5fd 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -172,19 +172,19 @@ if ($action == 'add') { //In sellist we have only one line and it can have come to do SQL expression if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { - $params['options'] = array($parameters=>null); + $params['options'] = array($parameters => null); } } else { // Else it's separated key/value and coma list foreach ($parameters_array as $param_ligne) { - if (strpos($param_ligne, ',')!==false) { + if (strpos($param_ligne, ',') !== false) { list($key, $value) = explode(',', $param_ligne); if (!array_key_exists('options', $params)) { $params['options'] = array(); } } else { - $key=$param_ligne; - $value=null; + $key = $param_ligne; + $value = null; } $params['options'][$key] = $value; } @@ -345,7 +345,7 @@ if ($action == 'update') { //In sellist we have only one line and it can have come to do SQL expression if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { - $params['options'] = array($parameters=>null); + $params['options'] = array($parameters => null); } } else { //Else it's separated key/value and coma list @@ -447,7 +447,7 @@ if ($action == 'encrypt') { if ($extrafields->attributes[$elementtype]['entityid'][$attributekey] == $conf->entity || empty($extrafields->attributes[$elementtype]['entityid'][$attributekey])) { dol_syslog("Loop on each extafields of table ".$arrayofelement['table_element']); - $sql .= "SELECT te.rowid, te.".$attributekey; + $sql = "SELECT te.rowid, te.".$attributekey; $sql .= " FROM ".MAIN_DB_PREFIX.$arrayofelement['table_element']." as t, ".MAIN_DB_PREFIX.$arrayofelement['table_element'].'_extrafields as te'; $sql .= " WHERE te.fk_object = t.rowid"; $sql .= " AND te.".$attributekey." NOT LIKE 'dolcrypt:%'"; @@ -462,7 +462,7 @@ if ($action == 'encrypt') { $resql = $db->query($sql); if ($resql) { $num_rows = $db->num_rows($resql); - $i=0; + $i = 0; while ($i < $num_rows) { $objtmp = $db->fetch_object($resql); $id = $objtmp->rowid; From cf952d3fdeebb9527024e515bbc59df013e06405 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:23:37 +0100 Subject: [PATCH 05/22] Fix: Initialise $fieldtocount to fix PhanUndeclaredVariableAssignOp --- htdocs/core/customreports.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 9498ed91d9c..d6e4f788500 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -390,6 +390,7 @@ if ($action == 'viewgraph') { // Get all possible values of fields when a 'group by' is set, and save this into $arrayofvaluesforgroupby // $arrayofvaluesforgroupby will be used to forge lael of each grouped series if (is_array($search_groupby) && count($search_groupby)) { + $fieldtocount = ''; foreach ($search_groupby as $gkey => $gval) { $gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval); From 0b16a0618e1e60ca271f2f1e0cc75a83fb8f3b7f Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:56:59 +0100 Subject: [PATCH 06/22] Fix: Initialise $logouthtmltext to fix PhanUndeclaredVariableAssignOp --- htdocs/core/get_info.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index 28434f7d405..a8828f8c456 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -88,6 +88,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { } $logouttext = ''; +$logouthtmltext = ''; if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { //$logouthtmltext=$appli.'
'; if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { From a34798c8328072b1af076f88b11a6378cfe708dd Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:57:50 +0100 Subject: [PATCH 07/22] Fix: Initialise $toprightmenu to fix PhanUndeclaredVariableAssignOp --- htdocs/core/get_info.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index a8828f8c456..2b5fc8f69d4 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -89,6 +89,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { $logouttext = ''; $logouthtmltext = ''; +$toprightmenu = ''; if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { //$logouthtmltext=$appli.'
'; if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { From bee172c4b762bde8dd4e876026d41c71a5c72d0f Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:00:51 +0100 Subject: [PATCH 08/22] Fix: Initialise $x to fix PhanUndeclaredVariableAssignOp & optimize --- htdocs/core/lib/functions2.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index cfe406a7684..36cb26e4b6d 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1589,8 +1589,9 @@ function check_value($mask, $value) function binhex($bin, $pad = false, $upper = false) { $last = dol_strlen($bin) - 1; + $x = 0; for ($i = 0; $i <= $last; $i++) { - $x += $bin[$last - $i] * pow(2, $i); + $x += ($bin[$last - $i] ? 1 : 0) << $i; } $x = dechex($x); if ($pad) { From 83f2282517d46bfce976c55fd8390e75b4c6ec0b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:04:36 +0100 Subject: [PATCH 09/22] Fix: Initialise $bookmarkList to fix PhanUndeclaredVariableAssignOp --- htdocs/core/multicompany_page.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index 864dd76cc3d..9286e3efaaa 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -91,7 +91,9 @@ print ''."\n"; print '
'; //print '
'; - +if (!isset($bookmarkList)) { + $bookmarkList = ''; +} if (!isModEnabled('multicompany')) { $langs->load("admin"); $bookmarkList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).''; @@ -128,7 +130,7 @@ if (!isModEnabled('multicompany')) { // Execute hook printBookmarks - $parameters = array('multicompany'=>$multicompanyList); + $parameters = array('multicompany' => $multicompanyList); $reshook = $hookmanager->executeHooks('printMultiCompanyEntities', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { $multicompanyList .= $hookmanager->resPrint; From a5d16b326b0e68b82fbd0651a15e5c00dbca5b64 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:06:35 +0100 Subject: [PATCH 10/22] Fix: Initialise $amount_ttc_diff to fix PhanUndeclaredVariableAssignOp --- htdocs/fourn/facture/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 97f21ccb533..db8b2f6c8e6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1172,6 +1172,7 @@ if (empty($reshook)) { $TTotalByTva[$line->tva_tx] += $line->total_ttc; } + $amount_ttc_diff = 0.; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef $am = $amount * $coef; From 3c49c976bfa4385df88b864deb48ad4ab9270d44 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:08:16 +0100 Subject: [PATCH 11/22] Fix: Initialise $moreforfilter to fix PhanUndeclaredVariableAssignOp --- htdocs/intracommreport/list.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index 3611ae2c51e..132163b1f89 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -113,20 +113,20 @@ else $result=restrictedArea($user, 'produit|service', '', '', '', '', '', $objca // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'i.ref'=>"Ref", - 'pfi.ref_fourn'=>"RefSupplier", - 'i.label'=>"ProductLabel", - 'i.description'=>"Description", - "i.note"=>"Note", + 'i.ref' => "Ref", + 'pfi.ref_fourn' => "RefSupplier", + 'i.label' => "ProductLabel", + 'i.description' => "Description", + "i.note" => "Note", ); $isInEEC = isInEEC($mysoc); // Definition of fields for lists $arrayfields = array( - 'i.ref' => array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'i.label' => array('label'=>$langs->trans("Label"), 'checked'=>1), - 'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(isModEnabled("product") && isModEnabled("service"))), + 'i.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 'i.label' => array('label' => $langs->trans("Label"), 'checked' => 1), + 'i.fk_product_type' => array('label' => $langs->trans("Type"), 'checked' => 0, 'enabled' => (isModEnabled("product") && isModEnabled("service"))), ); /* @@ -360,7 +360,7 @@ $param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>$langs->trans("PDFMerge"), //'presend'=>$langs->trans("SendByMail"), ); @@ -415,6 +415,9 @@ if ($search_all) { $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (!isset($moreforfilter)) { + $moreforfilter = ''; +} if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -470,7 +473,7 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) { if (!empty($arrayfields['i.fk_product_type']['checked'])) { print ''; - $array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); + $array = array('-1' => ' ', '0' => $langs->trans('Product'), '1' => $langs->trans('Service')); print $form->selectarray('search_type', $array, $search_type); print ''; } @@ -480,7 +483,7 @@ if (!empty($arrayfields['i.fk_product_type']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; */ // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -532,7 +535,7 @@ if (!empty($arrayfields['i.fk_product_type']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; */ // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['i.datec']['checked'])) { From f99f86284382704eed058b2e94e63c83ee08dccc Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:10:27 +0100 Subject: [PATCH 12/22] Fix: Initialise $choixdate to fix PhanUndeclaredVariableAssignOp + minor optimisation --- htdocs/opensurvey/wizard/choix_date.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 3eca1f0e68f..ff15655c5ff 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -38,6 +38,7 @@ $_SESSION["formatsondage"] = "D"; $erreur = false; $erreurNbchoice = 0; +$choixdate = ''; /* * Actions @@ -178,7 +179,7 @@ if (GETPOST('confirmation')) { // Add survey into database if (!$erreur && $erreurNb == 0) { - $_SESSION["toutchoix"] = substr("$choixdate", 1); + $_SESSION["toutchoix"] = substr($choixdate, 1); unset($_SESSION["nbrecaseshoraires"]); ajouter_sondage(); From ad96eb00a8a2d9a5371b641a68150b678b334c5b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:12:11 +0100 Subject: [PATCH 13/22] Fix: Initialise $textlate to fix PhanUndeclaredVariableAssignOp --- htdocs/partnership/partnership_list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 327b8e7988e..ccbda2e2e62 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -862,6 +862,7 @@ $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); +$textlate = ''; while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { From d2568a0878922e46299a025af531fc2d4a8ddd4e Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 12:25:09 +0100 Subject: [PATCH 14/22] Qual: Enable PhanUndeclaredVariableAssignOp --- 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 1d8a2f6f467..21d410a9665 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -497,7 +497,7 @@ return [ // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', // 'PhanPluginPrintfIncompatibleArgumentTypeWeak', - 'PhanUndeclaredVariableAssignOp', + // 'PhanUndeclaredVariableAssignOp', // 'PhanTypeExpectedObjectOrClassName', 'PhanEmptyFQSENInClasslike', // 'PhanTypeMismatchArgumentInternalReal', From 3d61fbf4f2b47b574d00802b5e9a569947fe922b Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:14:08 +0100 Subject: [PATCH 15/22] Fix: Initialise $errmsg to fix PhanUndeclaredVariableAssignOp --- htdocs/public/project/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 7d5df469aac..60c91239254 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -59,6 +59,7 @@ $langs->loadLangs(array("other", "dict", "bills", "companies", "errors", "paybox // Security check // No check on module enabled. Done later according to $validpaymentmethod +$errmsg = ''; $action = GETPOST('action', 'aZ09'); $id = GETPOSTINT('id'); $securekeyreceived = GETPOST("securekey", 'alpha'); From 449cb7758df8ccd89fed99c2262792577307c149 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:14:47 +0100 Subject: [PATCH 16/22] Fix: Initialise $errmsg to fix PhanUndeclaredVariableAssignOp --- htdocs/public/project/viewandvote.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index c436a2ead90..90b56165cc2 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -66,6 +66,7 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", // Security check // No check on module enabled. Done later according to $validpaymentmethod +$errmsg = ''; $action = GETPOST('action', 'aZ09'); $id = GETPOST('id'); $securekeyreceived = GETPOST("securekey"); @@ -172,7 +173,7 @@ if (strlen($idvote)) { // Has not already voted $conforbooth = new ActionComm($db); $resultconforbooth = $conforbooth->fetch($idvote); - if ($resultconforbooth<=0) { + if ($resultconforbooth <= 0) { $error++; $errmsg .= $conforbooth->error; } else { @@ -188,11 +189,11 @@ if (strlen($idvote)) { } } } - if ($votestatus=="ok") { + if ($votestatus == "ok") { setEventMessage($langs->trans("VoteOk"), 'mesgs'); - } elseif ($votestatus=="ko") { + } elseif ($votestatus == "ko") { setEventMessage($langs->trans("AlreadyVoted"), 'warnings'); - } elseif ($votestatus=="err") { + } elseif ($votestatus == "err") { setEventMessage($langs->trans("VoteError"), 'warnings'); } header("Refresh:0;url=".dol_buildpath('/public/project/viewandvote.php?id='.$id.'&securekey=', 1).$securekeyreceived); From bb7eda434231def4a18719c4bf48c35483f4bfea Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:16:35 +0100 Subject: [PATCH 17/22] Fix: Initialise $moreforfilter to fix PhanUndeclaredVariableAssignOp Also fix a few PhanUndeclaredGlobalVariable notifications. --- htdocs/public/test/test_arrays.php | 59 ++++++++++++++++-------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 71639adc51b..838052dac5b 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -68,27 +68,27 @@ if (empty($usedolheader)) { use_javascript_ajax)) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } @@ -201,10 +204,10 @@ if ($filtert) { if ($socid) { $nav .= ''; } -if ($showbirthday) { +if (isset($showbirthday) && $showbirthday) { $nav .= ''; } -if ($pid) { +if (isset($pid) && $pid) { $nav .= ''; } if ($type) { @@ -213,7 +216,7 @@ if ($type) { if ($usergroup) { $nav .= ''; } -$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); +$nav .= $form->selectDate($dateselect ?? '', 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; $nav .= ''; @@ -222,25 +225,25 @@ print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Tex $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter A (no combo forced)').': '; -$cate_arbo = array('field1'=>'value1a into the select list A', 'field2'=>'value2a'); +$cate_arbo = array('field1' => 'value1a into the select list A', 'field2' => 'value2a'); $moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 0); // List with no js combo $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter B (auto combo)').': '; -$cate_arbo = array('field1'=>'value1b into the select list B', 'field2'=>'value2b'); +$cate_arbo = array('field1' => 'value1b into the select list B', 'field2' => 'value2b'); $moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', -1); // List with js combo auto $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter C (combo forced)').': '; -$cate_arbo = array('field1'=>'value1c into the select list C', 'field2'=>'value2c'); +$cate_arbo = array('field1' => 'value1c into the select list C', 'field2' => 'value2c'); $moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter D (combo forced)').': '; -$cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2d'); +$cate_arbo = array('field1' => 'value1d into the select list D', 'field2' => 'value2d'); $moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced $moreforfilter .= '
'; @@ -328,7 +331,7 @@ $(document).ready(function(){ use_javascript_ajax)) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } From 114f5abd79475bb1be5136ff68330a970e39edb6 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:17:17 +0100 Subject: [PATCH 18/22] Fix: Initialise $total_ttc to fix PhanUndeclaredVariableAssignOp --- htdocs/salaries/paiement_salary.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 6e5b19c857e..5f3165ed14b 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -264,6 +264,7 @@ if ($action == 'create') { print "\n"; $total = 0; + $total_ttc = 0.; $totalrecu = 0; while ($i < $num) { From 751992b030037374f8e4541539e1cdb203a12dfa Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:20:16 +0100 Subject: [PATCH 19/22] Fix: Initialise $quantityToBeDelivered,$htmlforlines to fix PhanUndeclaredVariableAssignOp --- htdocs/takepos/invoice.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index a1d1f03cb54..f9d7e96cb4f 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -567,6 +567,7 @@ if (empty($reshook)) { echo ""; if ($nbofsuggested > 0) { + $quantityToBeDelivered = 0; echo "
".$langs->trans("SearchIntoBatch").": $nbofsuggested

"; foreach ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch as $dbatch) { // $dbatch is instance of Productbatch $batchStock = + $dbatch->qty; // To get a numeric @@ -1604,6 +1605,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categorie = new Categorie($db); $categories = $categorie->get_full_arbo('product'); + $htmlforlines = ''; foreach ($categories as $row) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $htmlforlines .= '
Date: Mon, 18 Mar 2024 13:54:05 +0100 Subject: [PATCH 20/22] Fix PhanPossiblyUndeclaredGlobalVariable and PhanPossiblyUndeclaredGlobalVariable --- htdocs/compta/prelevement/factures.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 1fe40efa05e..d100cf59961 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -274,10 +274,10 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; + $param = "&id=".$id; if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } - $param = "&id=".urlencode((string) ($id)); // Lines of title fields print '
'; @@ -325,10 +325,14 @@ if ($resql) { while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - if ($salaryBonPl) { + $itemurl = ''; + $partyurl = ''; + if ($salaryBonPl && ($salarytmp instanceof Salary) && ($user instanceof User)) { $salarytmp->fetch($obj->salaryid); $usertmp->fetch($obj->userid); - } else { + $itemurl = $salarytmp->getNomUrl(1); + $partyurl = $usertmp->getNomUrl(1); + } elseif ($invoicetmp instanceof Facture && $invoicetmpsupplier instanceof FactureFournisseur) { if ($obj->type == 'bank-transfer') { $invoicetmp = $invoicetmpsupplier; } else { @@ -337,22 +341,24 @@ if ($resql) { $invoicetmp->fetch($obj->facid); $thirdpartytmp->fetch($obj->socid); + $itemurl = $invoicetmp->getNomUrl(1); + $partyurl = $thirdpartytmp->getNomUrl(1); } print '
'; print '\n"; - if ($object->type == 'bank-transfer' && !$salaryBonPl) { + if ($object->type == 'bank-transfer' && !$salaryBonPl && $invoicetmp instanceof Facture) { print '\n"; } print '\n"; // Amount of invoice From c5b62a4a73631999e7183273266aa43345861815 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 18 Mar 2024 13:55:03 +0100 Subject: [PATCH 21/22] Add typing to fix PhanTypeMismatchDimFetch --- htdocs/compta/prelevement/class/bonprelevement.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 2cc21fb215d..e3a3eb07439 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -83,6 +83,9 @@ class BonPrelevement extends CommonObject public $factures = array(); + /** + * @var array + */ public $methodes_trans = array(); public $invoice_in_error = array(); @@ -171,6 +174,9 @@ class BonPrelevement extends CommonObject public $credite; public $note; public $date_trans; + /** + * @var int Current transport method, index to $methodes_trans + */ public $method_trans; public $fk_user_trans; public $date_credit; From 90882d46b2532beff42b1d87add039af46551dc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Mar 2024 14:36:09 +0100 Subject: [PATCH 22/22] Update factures.php --- htdocs/compta/prelevement/factures.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index d100cf59961..1dc1fd3d76d 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -274,7 +274,7 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $param = "&id=".$id; + $param = "&id=".((int) $id); if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); }
'; - print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); + print $itemurl; print "'; print dol_escape_htmltag($invoicetmp->ref_supplier); print "'; - print($salaryBonPl ? $usertmp->getNomUrl(-1) : $thirdpartytmp->getNomUrl(1)); + print $partyurl; print "