From c12a6bd4d1b7728724c464c30ee769c11b7e4d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Thu, 10 Nov 2022 17:10:51 +0100 Subject: [PATCH 01/20] FIX: GetNextValue() adding regexsql() function --- htdocs/core/db/DoliDB.class.php | 19 +++++++++++++++++++ htdocs/core/db/pgsql.class.php | 18 ++++++++++++++++++ htdocs/core/lib/functions2.lib.php | 7 ++++++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 63fec8968ec..31cc300fb2f 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -79,6 +79,25 @@ abstract class DoliDB implements Database { return 'IF('.$test.','.$resok.','.$resko.')'; } + + + /** + * Format a SQL REGEXP + * + * @param string $subject string tested + * @param string $pattern SQL pattern to match + * @param string $sqlstring whether or not the string being tested is an SQL expression + * @return string SQL string + */ + public function regexpsql($subject, $pattern, $sqlstring = false) + { + if ($sqlstring) { + return "(". $subject ." REGEXP '" . $pattern . "')"; + } + + return "('". $subject ."' REGEXP '" . $pattern . "')"; + } + /** * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 543e24a1b12..833be28d6bb 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -724,6 +724,24 @@ class DoliDBPgsql extends DoliDB return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)'; } + /** + * Format a SQL REGEXP + * + * @param string $subject string tested + * @param string $pattern SQL pattern to match + * @param string $sqlstring whether or not the string being tested is an SQL expression + * @return string SQL string + */ + public function regexpsql($subject, $pattern, $sqlstring = false) + { + if ($sqlstring) { + return "(". $subject ." ~ '" . $pattern . "')"; + } + + return "('". $subject ."' ~ '" . $pattern . "')"; + } + + /** * Renvoie le code erreur generique de l'operation precedente. * diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 0035688c66f..b8a1135c838 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1282,6 +1282,11 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $sql .= " FROM ".MAIN_DB_PREFIX.$table; $sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike)."'"; $sql .= " AND ".$field." NOT LIKE '(PROV%)'"; + + // To ensure that all variables within the MAX() brackets are integers + $sql .= " AND ". $db->regexpsql($sqlstring, '^[0-9]+$', true); + + if ($bentityon) { // only if entity enable $sql .= " AND entity IN (".getEntity($sharetable).")"; } elseif (!empty($forceentity)) { @@ -1293,7 +1298,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if ($sqlwhere) { $sql .= ' AND '.$sqlwhere; } - + //print $sql.'
'; dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG); $resql = $db->query($sql); From 97618510e52359892360657114a74839122cbf4c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Nov 2022 16:19:12 +0000 Subject: [PATCH 02/20] Fixing style errors. --- htdocs/core/db/DoliDB.class.php | 18 +++++++++--------- htdocs/core/db/pgsql.class.php | 16 ++++++++-------- htdocs/core/lib/functions2.lib.php | 10 +++++----- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 31cc300fb2f..2116148adb8 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -79,23 +79,23 @@ abstract class DoliDB implements Database { return 'IF('.$test.','.$resok.','.$resko.')'; } - - - /** + + + /** * Format a SQL REGEXP * * @param string $subject string tested - * @param string $pattern SQL pattern to match + * @param string $pattern SQL pattern to match * @param string $sqlstring whether or not the string being tested is an SQL expression * @return string SQL string */ public function regexpsql($subject, $pattern, $sqlstring = false) { - if ($sqlstring) { - return "(". $subject ." REGEXP '" . $pattern . "')"; - } - - return "('". $subject ."' REGEXP '" . $pattern . "')"; + if ($sqlstring) { + return "(". $subject ." REGEXP '" . $pattern . "')"; + } + + return "('". $subject ."' REGEXP '" . $pattern . "')"; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 833be28d6bb..ee72c63bc0d 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -724,24 +724,24 @@ class DoliDBPgsql extends DoliDB return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)'; } - /** + /** * Format a SQL REGEXP * * @param string $subject string tested - * @param string $pattern SQL pattern to match + * @param string $pattern SQL pattern to match * @param string $sqlstring whether or not the string being tested is an SQL expression * @return string SQL string */ public function regexpsql($subject, $pattern, $sqlstring = false) { - if ($sqlstring) { - return "(". $subject ." ~ '" . $pattern . "')"; - } - - return "('". $subject ."' ~ '" . $pattern . "')"; + if ($sqlstring) { + return "(". $subject ." ~ '" . $pattern . "')"; + } + + return "('". $subject ."' ~ '" . $pattern . "')"; } - + /** * Renvoie le code erreur generique de l'operation precedente. * diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index b8a1135c838..e194a45f9dc 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1282,11 +1282,11 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $sql .= " FROM ".MAIN_DB_PREFIX.$table; $sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike)."'"; $sql .= " AND ".$field." NOT LIKE '(PROV%)'"; - - // To ensure that all variables within the MAX() brackets are integers - $sql .= " AND ". $db->regexpsql($sqlstring, '^[0-9]+$', true); - + // To ensure that all variables within the MAX() brackets are integers + $sql .= " AND ". $db->regexpsql($sqlstring, '^[0-9]+$', true); + + if ($bentityon) { // only if entity enable $sql .= " AND entity IN (".getEntity($sharetable).")"; } elseif (!empty($forceentity)) { @@ -1298,7 +1298,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if ($sqlwhere) { $sql .= ' AND '.$sqlwhere; } - + //print $sql.'
'; dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG); $resql = $db->query($sql); From c767d3f8df945da29269cfffa7363cc80b26cbd9 Mon Sep 17 00:00:00 2001 From: FLIO Date: Tue, 29 Nov 2022 14:20:10 +0100 Subject: [PATCH 03/20] Fix(scrutinizer) https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/compta/facture/list.php?selectedLabels%5B0%5D=9&selectedSeverities%5B0%5D=10&orderField=lastFound&order=desc&honorSelectedPaths=0 --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4a4a02e87c4..d0e2ccb5094 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -171,6 +171,8 @@ class Facture extends CommonInvoice public $total_ttc; public $revenuestamp; + public $resteapayer; + /** * ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other * ! Closing when no payment: replaced, abandoned @@ -199,6 +201,7 @@ class Facture extends CommonInvoice public $fk_facture_source; public $linked_objects = array(); + public $date_valid; public $date_lim_reglement; public $cond_reglement_code; // Code in llx_c_paiement public $mode_reglement_code; // Code in llx_c_paiement From 8c6235a116b67e880e59a5d1fb61ca539ff2cac3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 29 Nov 2022 17:40:57 +0100 Subject: [PATCH 04/20] fix issue in choix_date --- htdocs/opensurvey/wizard/choix_date.php | 213 ++++++++++++------------ 1 file changed, 110 insertions(+), 103 deletions(-) diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 46983829c3b..3e4d37bbae4 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -37,6 +37,7 @@ if (!$user->rights->opensurvey->write) { $_SESSION["formatsondage"] = "D"; $erreur = false; +$erreurNbchoice = 0; /* * Actions @@ -49,114 +50,120 @@ if (GETPOST('confirmation')) { $nbofchoice = count($_SESSION["totalchoixjour"]); $errheure = array(); - for ($i = 0; $i < $nbofchoice; $i++) { - // Show hours choices - for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $horairesi = GETPOST("horaires".$i); - $_SESSION["horaires$i"][$j] = $horairesi[$j]; - - $tmphorairesi = GETPOST('horaires'.$i, 'array'); - - if (!is_array($tmphorairesi)) { - $errheure[$i][$j] = true; - $erreur = true; - continue; - } - - // A range like 8:00-11:00 - $creneaux = array(); - $heures = array(); - if (preg_match("/(\d{1,2}:\d{2})-(\d{1,2}:\d{2})/", $tmphorairesi[$j], $creneaux)) { - //on recupere les deux parties du preg_match qu'on redécoupe autour des ":" - $debutcreneau = explode(":", $creneaux[1]); - $fincreneau = explode(":", $creneaux[2]); - - //comparaison des heures de fin et de debut - //si correctes, on entre les données dans la variables de session - if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { - $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2}h\d{0,2})-(\d{1,2}h\d{0,2})$;i", $tmphorairesi[$j], $creneaux)) { //si c'est un creneau type 8h00-11h00 - //on recupere les deux parties du preg_match qu'on redécoupe autour des "H" - $debutcreneau = preg_split("/h/i", $creneaux[1]); - $fincreneau = preg_split("/h/i", $creneaux[2]); - - //comparaison des heures de fin et de debut - //si correctes, on entre les données dans la variables de session - if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { - $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2}):(\d{2})$;", $tmphorairesi[$j], $heures)) { //si c'est une heure simple type 8:00 - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < 24 && $heures[2] < 60) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2})h(\d{0,2})$;i", $tmphorairesi[$j], $heures)) { //si c'est une heure encore plus simple type 8h - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < 24 && $heures[2] < 60) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2})-(\d{1,2})$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau simple type 8-11 - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif (preg_match(";^(\d{1,2})h-(\d{1,2})h$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau H type 8h-11h - //si valeures correctes, on entre les données dans la variables de session - if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { - $_SESSION["horaires$i"][$j] = $heures[0]; - } else { //sinon message d'erreur et nettoyage de la case - $errheure[$i][$j] = true; - $erreur = true; - } - } elseif ($tmphorairesi[$j] == "") { //Si la case est vide - unset($_SESSION["horaires$i"][$j]); - } else { //pour tout autre format, message d'erreur - $errheure[$i][$j] = true; - $erreur = true; - } - - if (issetAndNoEmpty('horaires'.$i, $_SESSION) === false || issetAndNoEmpty($j, $_SESSION['horaires'.$i]) === false) { - if (issetAndNoEmpty('horaires'.$i, $_SESSION) === true) { - $_SESSION["horaires$i"][$j] = ''; - } else { - $_SESSION["horaires$i"] = array(); - $_SESSION["horaires$i"][$j] = ''; - } - } - } - - if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") { - $choixdate .= ","; - $choixdate .= $_SESSION["totalchoixjour"][$i]; - } else { + if ($nbofchoice * $_SESSION["nbrecaseshoraires"] > 200) { + setEventMessages($langs->trans("ErrorFieldTooLong"), null, 'errors'); + $erreurNb++; + } else { + for ($i = 0; $i < $nbofchoice; $i++) { + // Show hours choices for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - if ($_SESSION["horaires$i"][$j] != "") { - $choixdate .= ","; - $choixdate .= $_SESSION["totalchoixjour"][$i]; - $choixdate .= "@"; - // On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite - $choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]); + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; + + $tmphorairesi = GETPOST('horaires'.$i, 'array'); + + if (!is_array($tmphorairesi)) { + $errheure[$i][$j] = true; + $erreur = true; + continue; + } + + // A range like 8:00-11:00 + $creneaux = array(); + $heures = array(); + if (preg_match("/(\d{1,2}:\d{2})-(\d{1,2}:\d{2})/", $tmphorairesi[$j], $creneaux)) { + //on recupere les deux parties du preg_match qu'on redécoupe autour des ":" + $debutcreneau = explode(":", $creneaux[1]); + $fincreneau = explode(":", $creneaux[2]); + + //comparaison des heures de fin et de debut + //si correctes, on entre les données dans la variables de session + if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { + $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2}h\d{0,2})-(\d{1,2}h\d{0,2})$;i", $tmphorairesi[$j], $creneaux)) { //si c'est un creneau type 8h00-11h00 + //on recupere les deux parties du preg_match qu'on redécoupe autour des "H" + $debutcreneau = preg_split("/h/i", $creneaux[1]); + $fincreneau = preg_split("/h/i", $creneaux[2]); + + //comparaison des heures de fin et de debut + //si correctes, on entre les données dans la variables de session + if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) { + $_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2}):(\d{2})$;", $tmphorairesi[$j], $heures)) { //si c'est une heure simple type 8:00 + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < 24 && $heures[2] < 60) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2})h(\d{0,2})$;i", $tmphorairesi[$j], $heures)) { //si c'est une heure encore plus simple type 8h + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < 24 && $heures[2] < 60) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2})-(\d{1,2})$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau simple type 8-11 + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif (preg_match(";^(\d{1,2})h-(\d{1,2})h$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau H type 8h-11h + //si valeures correctes, on entre les données dans la variables de session + if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) { + $_SESSION["horaires$i"][$j] = $heures[0]; + } else { //sinon message d'erreur et nettoyage de la case + $errheure[$i][$j] = true; + $erreur = true; + } + } elseif ($tmphorairesi[$j] == "") { //Si la case est vide + unset($_SESSION["horaires$i"][$j]); + } else { //pour tout autre format, message d'erreur + $errheure[$i][$j] = true; + $erreur = true; + } + + if (issetAndNoEmpty('horaires'.$i, $_SESSION) === false || issetAndNoEmpty($j, $_SESSION['horaires'.$i]) === false) { + if (issetAndNoEmpty('horaires'.$i, $_SESSION) === true) { + $_SESSION["horaires$i"][$j] = ''; + } else { + $_SESSION["horaires$i"] = array(); + $_SESSION["horaires$i"][$j] = ''; + } + } + } + + if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") { + $choixdate .= ","; + $choixdate .= $_SESSION["totalchoixjour"][$i]; + } else { + for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { + if ($_SESSION["horaires$i"][$j] != "") { + $choixdate .= ","; + $choixdate .= $_SESSION["totalchoixjour"][$i]; + $choixdate .= "@"; + // On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite + $choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]); + } } } } } + if (!empty($errheure)) { setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors'); } @@ -170,7 +177,7 @@ if (GETPOST('confirmation')) { } // Add survey into database - if (!$erreur) { + if (!$erreur && $erreurNb==0) { $_SESSION["toutchoix"] = substr("$choixdate", 1); ajouter_sondage(); From 46d57f548dc47039b11e4e91c76ed94bc28b5251 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 29 Nov 2022 17:48:05 +0100 Subject: [PATCH 05/20] modify size of column responses --- .../mysql/tables/llx_opensurvey_user_studs-opensurvey.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql index 03ad9b35ec5..004b376c9ac 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql @@ -19,6 +19,6 @@ CREATE TABLE llx_opensurvey_user_studs ( id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, nom VARCHAR(64) NOT NULL, id_sondage VARCHAR(16) NOT NULL, - reponses VARCHAR(100) NOT NULL, -- Not used for 'F' surveys + reponses VARCHAR(200) NOT NULL, -- Not used for 'F' surveys tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=innodb; From 51f02d9eafe6256991dc69625d62262759a06dd1 Mon Sep 17 00:00:00 2001 From: FLIO Date: Tue, 29 Nov 2022 22:32:51 +0100 Subject: [PATCH 06/20] Fix(scrutinizer) https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/resource/contact.php?selectedLabels%5B0%5D=9&selectedSeverities%5B0%5D=10&orderField=lastFound&order=desc&honorSelectedPaths=0 --- htdocs/resource/class/dolresource.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 3e1a2615cd9..bcd97493ac7 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -51,6 +51,11 @@ class Dolresource extends CommonObject public $busy; public $mandatory; + /** + * @var integer + */ + public $socid; + /** * @var int ID */ From 00bf293b33041def533e1f19e59f23559f76fcb7 Mon Sep 17 00:00:00 2001 From: FLIO Date: Tue, 29 Nov 2022 22:50:07 +0100 Subject: [PATCH 07/20] Fix(scrutinizer) https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/loan/info.php?selectedLabels%5B0%5D=9&selectedSeverities%5B0%5D=10&orderField=lastFound&order=desc&honorSelectedPaths=0 --- htdocs/loan/class/loan.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 81a00904794..03deb595000 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -66,6 +66,7 @@ class Loan extends CommonObject public $account_capital; public $account_insurance; public $account_interest; + public $total_paid; /** * @var integer|string date_creation From 9d59f0e038b8a7d146cb52c3a688ccf0a62a21e3 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 30 Nov 2022 11:32:13 +0100 Subject: [PATCH 08/20] add request migration to table opensurvey_user_studs --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index bef3e07e910..d2d139e5088 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -53,6 +53,8 @@ ALTER TABLE llx_user DROP COLUMN idpers2; ALTER TABLE llx_user DROP COLUMN idpers3; +ALTER TABLE llx_opensurvey_user_studs MODIFY reponses VARCHAR(200) NOT NULL; + -- v17 UPDATE llx_c_paiement SET code = 'BANCON' WHERE code = 'BAN' AND libelle = 'Bancontact'; From 6a9862bcaedd34ec1b9a13a9537e17d6d3ed77c9 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 30 Nov 2022 14:14:17 +0100 Subject: [PATCH 09/20] correct whitespace in choix_date.php file --- htdocs/opensurvey/wizard/choix_date.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 3e4d37bbae4..d8f89b18e16 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -177,7 +177,7 @@ if (GETPOST('confirmation')) { } // Add survey into database - if (!$erreur && $erreurNb==0) { + if (!$erreur && $erreurNb == 0) { $_SESSION["toutchoix"] = substr("$choixdate", 1); ajouter_sondage(); From d9862ea0071c046954e62e0ea4999beeb95c3ed2 Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 30 Nov 2022 14:16:58 +0100 Subject: [PATCH 10/20] Fix(scrutinizer) --- htdocs/resource/class/dolresource.class.php | 5 ----- htdocs/resource/contact.php | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index bcd97493ac7..3e1a2615cd9 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -51,11 +51,6 @@ class Dolresource extends CommonObject public $busy; public $mandatory; - /** - * @var integer - */ - public $socid; - /** * @var int ID */ diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 45e4ce4b329..00bafdfee11 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -114,10 +114,7 @@ llxHeader('', $langs->trans("Resource")); // View and edit mode if ($id > 0 || !empty($ref)) { - $soc = new Societe($db); - $soc->fetch($object->socid); - - + $head = resource_prepare_head($object); print dol_get_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), -1, 'resource'); From c6e32c940169c20db2b1725b8c6f08f7d7333b2e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 30 Nov 2022 13:17:35 +0000 Subject: [PATCH 11/20] Fixing style errors. --- htdocs/resource/contact.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 00bafdfee11..3b032fffb94 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -114,7 +114,6 @@ llxHeader('', $langs->trans("Resource")); // View and edit mode if ($id > 0 || !empty($ref)) { - $head = resource_prepare_head($object); print dol_get_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), -1, 'resource'); From 7430092f2fa8fc36d9d8c9817ca8924751179267 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 30 Nov 2022 14:45:21 +0100 Subject: [PATCH 12/20] FIX insert extra fields when datetime is a timestamp in a string --- 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 7e78549e0fa..3436eba57f4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6270,7 +6270,7 @@ abstract class CommonObject case 'date': case 'datetime': // If data is a string instead of a timestamp, we convert it - if (!is_int($this->array_options[$key])) { + if (!is_numeric($this->array_options[$key]) || $this->array_options[$key] != intval($this->array_options[$key])) { $this->array_options[$key] = strtotime($this->array_options[$key]); } $new_array_options[$key] = $this->db->idate($this->array_options[$key]); From 0e1959dcce22c59f67bd1ba1027b5b564a8307f1 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 30 Nov 2022 15:09:55 +0100 Subject: [PATCH 13/20] FIX reload stickler-ci From d667d5d43f64a26c7560ac8c07b0ab44eb785db2 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 30 Nov 2022 15:17:27 +0100 Subject: [PATCH 14/20] NEW dolGetElementUrl for mailing object --- htdocs/core/lib/functions2.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8003c414dcb..9295c749732 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2234,7 +2234,11 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $classpath = 'compta/facture/class'; $classfile = 'facture-rec'; $classname = 'FactureRec'; - $module='facture'; + $module = 'facture'; + } elseif ($objecttype == 'mailing') { + $classpath = 'comm/mailing/class'; + $classfile = 'mailing'; + $classname = 'Mailing'; } if (isModEnabled($module)) { From 4bd57e72a582dba24ebfc097616f93e9f06b58ef Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 30 Nov 2022 15:35:01 +0100 Subject: [PATCH 15/20] NEW add quantity in update keys in supplier prices import --- htdocs/core/modules/modProduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 940c4fb2f9a..5224f82a2f5 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -860,7 +860,7 @@ class modProduct extends DolibarrModules )); } - $this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier'); + $this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier', 'sp.quantity'=>"QtyMin"); } if (!empty($conf->global->PRODUIT_MULTIPRICES)) { From 66de178b463070bb1e227bdea8a46f23f9b61fb7 Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 30 Nov 2022 15:52:33 +0100 Subject: [PATCH 16/20] Fix(scrutinizer) --- htdocs/loan/class/loan.class.php | 1 - htdocs/loan/info.php | 2 -- 2 files changed, 3 deletions(-) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 03deb595000..81a00904794 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -66,7 +66,6 @@ class Loan extends CommonObject public $account_capital; public $account_insurance; public $account_interest; - public $total_paid; /** * @var integer|string date_creation diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php index 49618d0f46c..188a61c61e6 100644 --- a/htdocs/loan/info.php +++ b/htdocs/loan/info.php @@ -102,8 +102,6 @@ $morehtmlref .= ''; $linkback = ''.$langs->trans("BackToList").''; -$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; From 67d28dc81b84f84ea486bb01d3fe82a462c86ffc Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 30 Nov 2022 16:03:19 +0100 Subject: [PATCH 17/20] Fix(scrutinizer) --- htdocs/compta/facture/class/facture.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d0e2ccb5094..e67408544a6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -201,7 +201,6 @@ class Facture extends CommonInvoice public $fk_facture_source; public $linked_objects = array(); - public $date_valid; public $date_lim_reglement; public $cond_reglement_code; // Code in llx_c_paiement public $mode_reglement_code; // Code in llx_c_paiement From fc146b2dc61724cc5980eb46c8b503c9f2cba547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 17:59:42 +0100 Subject: [PATCH 18/20] add hooks init --- htdocs/compta/bank/annuel.php | 3 +++ htdocs/compta/bank/document.php | 3 +++ htdocs/compta/bank/graph.php | 3 +++ htdocs/compta/bank/releve.php | 3 +++ 4 files changed, 12 insertions(+) diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 610cf17498c..7365d1ed552 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -39,6 +39,9 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 160); $id = GETPOST('account') ?GETPOST('account', 'alpha') : GETPOST('id'); $ref = GETPOST('ref'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankstats', 'globalcard')); + // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 595d627609b..0960b984c04 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -38,6 +38,9 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankaccountdocuments', 'globalcard')); + // Security check if ($user->socid) { $action = ''; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index a3fd0b0b15b..c11e13f1e71 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -35,6 +35,9 @@ $langs->loadLangs(array('banks', 'categories')); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankstats', 'globalcard')); + // Security check if (GETPOST('account') || GETPOST('ref')) { $id = GETPOST('account') ? GETPOST('account') : GETPOST('ref'); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 8f5e7f29069..2e532984d99 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -62,6 +62,9 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha'); $rel = GETPOST("rel", 'alphanohtml'); $backtopage = GETPOST('backtopage', 'alpha'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankaccountstatement', 'globalcard')); + // Security check $fieldid = (!empty($ref) ? $ref : $id); $fieldname = (!empty($ref) ? 'ref' : 'rowid'); From 45b7ddb8a8d8f124b659a274c8cff44ff80088b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Nov 2022 18:00:39 +0100 Subject: [PATCH 19/20] add hooks init --- htdocs/compta/bank/annuel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 7365d1ed552..177855c9302 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -40,7 +40,7 @@ $id = GETPOST('account') ?GETPOST('account', 'alpha') : GETPOST('id'); $ref = GETPOST('ref'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('bankstats', 'globalcard')); +$hookmanager->initHooks(array('bankannualreport', 'globalcard')); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); From a06dd9f86916966dbbda4e5c44cb5bc9427e5049 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 1 Dec 2022 15:38:21 +0100 Subject: [PATCH 20/20] FIX fetch object in member subscription modify trigger for events --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index f31a4c2c93e..e3f798dec62 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -742,7 +742,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (!is_object($member)) { // This should not happen include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $member = new Adherent($this->db); - $member->fetch($this->fk_adherent); + $member->fetch($object->fk_adherent); } if (empty($object->actionmsg2)) {