From f8ea5ac0776e80476a0f41a6bdb418c645feacdd Mon Sep 17 00:00:00 2001
From: Zephyriony <142790847+zephyriony@users.noreply.github.com>
Date: Fri, 15 Mar 2024 23:33:51 +0100
Subject: [PATCH 01/77] Proposed function for records that can't be found
---
htdocs/core/lib/functions.lib.php | 66 +++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 4a6e3a42f01..b8762bb0414 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -13905,3 +13905,69 @@ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto'
return '&' . http_build_query($TParam);
}
+
+/**
+ * Displays an error page when a record is not found. It allows customization of the message,
+ * whether to include the header and footer, and if only the message should be shown without additional details.
+ * The function also supports executing additional hooks for customized handling of error pages.
+ *
+ * @param string $message Custom error message to display. If empty, a default "Record Not Found" message is shown.
+ * @param int $printheader Determines if the page header should be printed (1 = yes, 0 = no).
+ * @param int $printfooter Determines if the page footer should be printed (1 = yes, 0 = no).
+ * @param int $showonlymessage If set to 1, only the error message is displayed without any additional information or hooks.
+ * @param mixed $params Optional parameters to pass to hooks for further processing or customization.
+ * @global object $conf Dolibarr configuration object (global)
+ * @global object $db Database connection object (global)
+ * @global object $user Current user object (global)
+ * @global Translate $langs Language translation object, initialized within the function if not already.
+ * @global object $hookmanager Hook manager object, initialized within the function if not already for executing hooks.
+ * @global string $action Current action, can be modified by hooks.
+ * @global object $object Current object, can be modified by hooks.
+ * @return void This function terminates script execution after outputting the error page.
+ */
+
+function recordNotFound($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)
+ {
+ global $conf, $db, $user, $langs, $hookmanager;
+ global $action, $object;
+
+ if (!is_object($langs)) {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
+ $langs = new Translate('', $conf);
+ $langs->setDefaultLang();
+ }
+
+ $langs->load("errors");
+
+ if ($printheader) {
+ if (function_exists("llxHeader")) {
+ llxHeader('');
+ } elseif (function_exists("llxHeaderVierge")) {
+ llxHeaderVierge('');
+ }
+ }
+ print '
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Aperiam non blanditiis delectus accusamus reprehenderit voluptates repellat. Excepturi illo delectus nisi labore, iste voluptatibus dignissimos explicabo, corrupti voluptatum et facere cum?
-
-
-
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-
-
-
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
-
-
-
-
-
';
+
'.$langs->trans('ContentOfMailHOlder').'
+ ';
+ if (!(empty($user->signature))) {
+ $out .= '
Lorem, ipsum dolor sit amet consectetur adipisicing elit sit amet consectetur
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index d2e29b3941a..4160930b410 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -191,3 +191,5 @@ helpWithAi=Generate message from AI
YouCanMakeSomeInstructionForEmail=You can make some instructions for your Email (Example: generate image in email template...)
ModelTemplate=Email template
YouCanChooseAModelForYouMailContent= You can choose one of template models or generate one with AI
+TitleOfMailHolder=Title of the e-mail goes here
+ContentOfMailHOlder=Content of email goes here...
\ No newline at end of file
From 884cc5bd554a76a8c65a82c552bf09e803320e9f Mon Sep 17 00:00:00 2001
From: MDW
Date: Mon, 18 Mar 2024 12:18:06 +0100
Subject: [PATCH 45/77] 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 46/77] 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 47/77] 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 48/77] 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 49/77] 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 50/77] 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 51/77] 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 52/77] 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 53/77] 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 54/77] 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 55/77] 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 '
';
}
@@ -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 56/77] 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 57/77] 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 58/77] 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 59/77] 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 60/77] 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 61/77] 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 .= '