From 96d60b92f471e8bcc810bd4f4fc491fe5a00413e Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 27 Nov 2024 22:39:52 +0100 Subject: [PATCH 01/19] fix: when create separate extarfields, if already exists always return false error (#32103) --- htdocs/core/class/extrafields.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 91ac9fe0b9550..05916ddfe80b5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -177,7 +177,9 @@ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtyp // Add declaration of field into table $result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams); $err2 = $this->errno; - if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { + if ($result2 > 0 + || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS') + || ($type == 'separate' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { $this->error = ''; $this->errno = '0'; return 1; From ff18a34c7179c01a50e827917540c841ee087b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Nov 2024 15:43:47 +0100 Subject: [PATCH 02/19] FIX: Ensure extraparams cannot be selected by the user (#32132) * FIX: Ensure extraparams cannot be selected by the user * Update newpayment.php --- htdocs/public/payment/newpayment.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 21e67dde87e50..2a07fa72ebc77 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1675,7 +1675,7 @@ } // - If a new amount was posted from the form if ($caneditamount && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) { - $amount = GETPOSTFLOAT('newamount', 'MT'); + $amount = GETPOSTFLOAT('newamount', 'MT'); } // - If a min is set or an amount from the posted form, we take them into account $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 24629554b3227..4791136e400a6 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -328,7 +328,7 @@ class Ticket extends CommonObject 'progress' => array('type' => 'integer', 'label' => 'Progression', 'visible' => -1, 'enabled' => 1, 'position' => 540, 'notnull' => -1, 'css' => 'right', 'help' => "", 'isameasure' => 2, 'csslist' => 'width50'), 'resolution' => array('type' => 'integer', 'label' => 'Resolution', 'visible' => -1, 'enabled' => 'getDolGlobalString("TICKET_ENABLE_RESOLUTION")', 'position' => 550, 'notnull' => 1), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'PDFTemplate', 'enabled' => 1, 'visible' => 0, 'position' => 560), - 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 570), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => 0, 'position' => 570), 'fk_statut' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 600, 'notnull' => 1, 'index' => 1, 'arrayofkeyval' => array(0 => 'Unread', 1 => 'Read', 2 => 'Assigned', 3 => 'InProgress', 5 => 'NeedMoreInformation', 7 => 'OnHold', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 900), ); From 3fc50f21a4b862800d4d792b88266789d6830793 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 28 Nov 2024 15:45:37 +0100 Subject: [PATCH 03/19] FIX set birthday alert (#32133) * FIX set birthday alert on contact personal data card * also on create card * fix travis --- htdocs/contact/card.php | 2 +- htdocs/contact/perso.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f7a52afa4895d..59b5863a9ffe0 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -241,7 +241,7 @@ // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0, 0, 0, GETPOSTINT("birthdaymonth"), GETPOSTINT("birthdayday"), GETPOSTINT("birthdayyear")); - $object->birthday_alert = GETPOSTINT("birthday_alert"); + $object->birthday_alert = (GETPOST('birthday_alert', 'alpha') == "on" ? 1 : 0); //Default language $object->default_lang = GETPOST('default_lang'); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 0661a80b685a9..209e04d199de4 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -56,7 +56,7 @@ // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0, 0, 0, GETPOST("birthdaymonth"), GETPOST("birthdayday"), GETPOST("birthdayyear")); - $object->birthday_alert = GETPOSTINT("birthday_alert"); + $object->birthday_alert = (GETPOST('birthday_alert', 'alpha') == "on" ? 1 : 0); if (GETPOST('deletephoto')) { $object->photo = ''; From 670e6464e8d08ea4fd26517ebb080bc2d3e4e73c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 22:25:53 +0100 Subject: [PATCH 04/19] Fix selection of state from country in member creation --- htdocs/adherents/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b02702218c804..b5a71fc5484a1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1079,9 +1079,9 @@ function initfieldrequired() { // State if (!getDolGlobalString('MEMBER_DISABLE_STATE')) { print ''.$langs->trans('State').''; - if ($soc->country_id) { + if ($soc->country_id || GETPOSTISSET('country_id')) { print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, $soc->country_code); + print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, GETPOSTISSET('country_id') ? GETPOSTINT('country_id') : $soc->country_code); } else { print $countrynotdefined; } From 3b93f7ffcc4a248cf0b4635e86cb7c95fac04fec Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 14:17:53 +0100 Subject: [PATCH 05/19] Debug v21 --- htdocs/admin/agenda_extsites.php | 4 ++-- htdocs/admin/agenda_other.php | 4 ++-- htdocs/admin/agenda_reminder.php | 2 +- htdocs/admin/agenda_xcal.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index c4490d27cb843..e0cff71b11ed1 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -223,11 +223,11 @@ $selectedvalue = 1; } -print ""; +print "
"; print ""; print '"; -print '"; +print ''; print ""; // Show external agenda diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index fcf6023b8348b..972ede049d2d4 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -221,7 +221,7 @@ $sql = "SELECT nom"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE type = 'action'"; -$sql .= " AND entity = ".$conf->entity; +$sql .= " AND entity = ".((int) $conf->entity); $resql = $db->query($sql); if ($resql) { @@ -346,7 +346,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_VIEW diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index d27d081d66e40..68e63d3eb32ab 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -182,7 +182,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // AGENDA REMINDER BROWSER diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 6c065ba69e3c0..3d380e1134486 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -121,7 +121,7 @@ print ''; print ""; -print ""; +print ""; //print ""; print ""; print ""; @@ -180,8 +180,8 @@ clearstatcache(); -//if ($mesg) print "
$mesg
"; -print "
"; + +print "

"; // Define $urlwithroot From 1a60e40b9f970711a861c80f476310dbdb364a25 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 14:44:11 +0100 Subject: [PATCH 06/19] Debug v21 --- htdocs/theme/md/dropdown.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index c5c521a3ac5b4..1b14f471c654f 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -41,7 +41,7 @@ div#topmenu-login-dropdown { position: fixed; - : 20px; + : 10px; top: 0px; } From 82f54e707e3587debe874138091c0b7f8ef57bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:45:26 +0100 Subject: [PATCH 07/19] Update extrafields.class.php (#32135) --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6aca908bffda1..4009a3f749e2c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1499,7 +1499,7 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ $sql .= $sqlwhere; //print $sql; - $sql .= ' ORDER BY '.implode(', ', $fields_label); + $sql .= $this->db->order(implode(',', $fields_label)); dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); $resql = $this->db->query($sql); From 1e213f041495ef06425ece773f14a81f375c1125 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Nov 2024 14:46:21 +0100 Subject: [PATCH 08/19] FIX result is always in error (#32141) * FIX result is always in error * FIX Blank line found at end of control structure --- htdocs/admin/modules.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 6b6faa7d4818e..f9cde4b5363c2 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -290,9 +290,8 @@ if (!is_numeric($checkRes) && $checkRes != '') { $langs->load("errors"); setEventMessages($modulename.' : '.$langs->trans($checkRes), null, 'errors'); + $error++; } - - $error++; } catch (Exception $e) { // Nothing done } From 34b2f2587500f670f86b8b9191f1a35282ef799f Mon Sep 17 00:00:00 2001 From: atm-GregM <85485123+atm-GregM@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:47:15 +0100 Subject: [PATCH 09/19] FIX data too long for column signature (#32144) * Fix data too long for column signature * Fix data too long for column signature --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 1 + htdocs/install/mysql/tables/llx_user.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 71037e6248e1c..5299e01857677 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -384,3 +384,4 @@ INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) values ALTER TABLE llx_facture_rec ADD COLUMN fk_societe_rib integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN is_also_delivery_note tinyint DEFAULT 0 NOT NULL; +ALTER TABLE llx_user MODIFY COLUMN signature LONGTEXT; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 065c6bd4f0d85..66d3acc0db3b8 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -60,7 +60,7 @@ create table llx_user email varchar(255), personal_email varchar(255), email_oauth2 varchar(255), -- an email to validate OAuth2 authentication when email differs from the OAuth2 email - signature text DEFAULT NULL, + signature longtext DEFAULT NULL, socialnetworks text DEFAULT NULL, -- json with socialnetworks From 4d885d1e344e81aff0e705ab142802372ec78090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:47:33 +0100 Subject: [PATCH 10/19] add phpdoc (#32136) --- htdocs/core/tpl/onlinepaymentlinks.tpl.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 59ef1023b2b0a..3964d67232d3b 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -14,7 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +/** + * @var Conf $conf + * @var Translate $langs + * @var string $servicename + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; From c0b42287c1180d81bfa8319478d21e147b9cb98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:47:53 +0100 Subject: [PATCH 11/19] add phpdoc (#32137) --- build/phpstan/phpstan-baseline.neon | 78 --------------------------- htdocs/core/tpl/passwordreset.tpl.php | 32 +++++++---- 2 files changed, 23 insertions(+), 87 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 192a9985d69a0..ba84964cca24e 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17598,84 +17598,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$disabled might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$dol_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$focus_element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 18 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$newpass1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$newpass2 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$passworduidhash might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$setnewpassword might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$urllogo might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$username might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - message: '#^Variable \$db might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index 61a27c6853a86..4754c76c4fb62 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -22,7 +22,29 @@ if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action + * @var string $captcha + * @var string $disabled + * @var string $dol_url_root + * @var string $focus_element + * @var string $mode + * @var string $message + * @var string $newpass1 + * @var string $newpass2 + * @var string $passworduidhash + * @var string $title + * @var string $urllogo + * @var string $user + * @var string $username + * + * @var int $setnewpassword + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -38,14 +60,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -/** - * @var HookManager $hookmanager - * @var string $action - * @var string $captcha - * @var string $message - * @var string $title - */ - /* * View From 9874e67acb125c737dffa03718c7a3554eeacac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:48:33 +0100 Subject: [PATCH 12/19] add phpdoc (#32138) * add phpdoc * add phpdoc --- build/phpstan/phpstan-baseline.neon | 54 ----------------------- htdocs/core/tpl/passwordforgotten.tpl.php | 27 ++++++++---- 2 files changed, 18 insertions(+), 63 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index ba84964cca24e..b4842b6c19ef3 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17544,60 +17544,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/originproductline.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$disabled might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$dol_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$focus_element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 10 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$urllogo might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$username might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - message: '#^Variable \$db might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 272c21ded9d8e..d01fb3a5f99bf 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -23,7 +23,24 @@ if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action + * @var string $captcha + * @var string $disabled + * @var string $dol_url_root + * @var string $focus_element + * @var string $mode + * @var string $message + * @var string $title + * @var string $urllogo + * @var string $user + * @var string $username + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -39,14 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -/** - * @var HookManager $hookmanager - * @var string $action - * @var string $captcha - * @var string $message - * @var string $title - */ - /* * View From c983cfff50c962acc110b9f092157a91188d21b5 Mon Sep 17 00:00:00 2001 From: nateogroup-antoine Date: Fri, 29 Nov 2024 14:50:25 +0100 Subject: [PATCH 13/19] Typo in log : SERVICES_ARE_ECOMMERCE_200238EC => SERVICE_ARE_ECOMMERCE_200238EC and set shipment origin for shipment created by api on an order (#32143) * Update functions.lib.php * set shipment origin for shipment created by api on an order --- htdocs/commande/class/api_orders.class.php | 1 + htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 701d923862757..bd39f0fae3fd2 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -1090,6 +1090,7 @@ public function createOrderShipment($id, $warehouse_id) $shipment = new Expedition($this->db); $shipment->socid = $this->commande->socid; $shipment->origin_id = $this->commande->id; + $shipment->origin = $this->commande->element; $result = $shipment->create(DolibarrApiAccess::$user); if ($result <= 0) { throw new RestException(500, 'Error on creating expedition :'.$this->db->lasterror()); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 06ce0567f5300..9c411ea7caf54 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7577,7 +7577,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $buyer_country_code = $thirdparty_buyer->country_code; $buyer_in_cee = isInEEC($thirdparty_buyer); - dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".((string) (int) $seller_in_cee).", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".((string) (int) $buyer_in_cee).", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); + dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".((string) (int) $seller_in_cee).", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".((string) (int) $buyer_in_cee).", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICE_ARE_ECOMMERCE_200238EC : '')); // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) // we use the buyer VAT. From 546a68eafb05f14b639b8af2ab5f38f82029b020 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 15:11:36 +0100 Subject: [PATCH 14/19] Fix the amount in linke is not correctly formatted. --- htdocs/core/lib/payments.lib.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index c299a33ed35c8..357730cdac7a5 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -270,12 +270,12 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y } if ($type == 'free') { - $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').price2num($amount, 'MT').($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) { if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { $out .= '&securekey='.urlencode(getDolGlobalString('PAYMENT_SECURITY_TOKEN')); } else { - $out .= '&securekey='.urlencode(dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2)); + $out .= '&securekey='.urlencode(dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 'sha1md5')); } } //if ($mode) $out.='&noidempotency=1'; @@ -297,7 +297,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + order_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -320,7 +320,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -343,7 +343,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + contractline_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -351,7 +351,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y } elseif ($type == 'member' || $type == 'membersubscription') { $newtype = 'member'; $out = $urltouse.'/public/payment/newpayment.php?source=member'; - $out .= '&amount='.$amount; + $out .= '&amount='.price2num($amount, 'MT'); $out .= '&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'member_ref'; @@ -365,11 +365,11 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= '&securekey='.urlencode(getDolGlobalString('PAYMENT_SECURITY_TOKEN')); } else { $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) { + if ($mode == 1) { // mode tuto $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$newtype."' + member_ref)"; } - if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $newtype.$ref, 2); + if ($mode == 0) { // mode real + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$newtype.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -392,7 +392,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + donation_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -415,7 +415,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } From 7b0e34ffdd5377cc5926bd5dc71ee6004ff4a9a0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 15:19:51 +0100 Subject: [PATCH 15/19] Fix css of public payment page --- htdocs/public/payment/newpayment.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2a07fa72ebc77..59f4039c6c810 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2108,19 +2108,19 @@ } if ($source == 'order' && $object->billed) { - print '

'.$langs->trans("OrderBilled").''; + print '

'.$langs->trans("OrderBilled").'
'; } elseif ($source == 'invoice' && $object->paye) { - print '

'.$langs->trans("InvoicePaid").''; + print '

'.$langs->trans("InvoicePaid").'
'; } elseif ($source == 'donation' && $object->paid) { - print '

'.$langs->trans("DonationPaid").''; + print '

'.$langs->trans("DonationPaid").'
'; } else { // Membership can be paid and we still allow to make renewal if (($source == 'member' || $source == 'membersubscription') && $object->datefin > dol_now()) { $langs->load("members"); - print '
'; + print '
'; $s = $langs->trans("MembershipPaid", '{s1}'); print str_replace('{s1}', ''.dol_print_date($object->datefin, 'day').'', $s); - print '
'; + print '
'; print '
'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'
'; print '
'; } From eab6a9f97baff3c8ab1f9472c8774b563668c69b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:49:04 +0100 Subject: [PATCH 16/19] Fix name of index --- .../mysql/tables/llx_bookcal_availabilities-bookcal.key.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql index 79a7fe8347205..53f3e91082db0 100644 --- a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql +++ b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql @@ -16,10 +16,10 @@ -- BEGIN MODULEBUILDER INDEXES ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_rowid (rowid); -ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT fk_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_status (status); -ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_type (type); -ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_bookcal_calendar FOREIGN KEY (fk_bookcal_calendar) REFERENCES llx_bookcal_calendar(rowid); +ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_fk_bookcal_calendar (fk_bookcal_calendar); +ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT fk_bookcal_availabilities_fk_bookcal_calendar FOREIGN KEY (fk_bookcal_calendar) REFERENCES llx_bookcal_calendar(rowid); -- END MODULEBUILDER INDEXES From 459f631eccf5c4d48032ee94a9f52e7cb3b29305 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:52:53 +0100 Subject: [PATCH 17/19] Reduce length --- htdocs/install/mysql/data/llx_c_holiday_types.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_holiday_types.sql b/htdocs/install/mysql/data/llx_c_holiday_types.sql index 92bc8739968d2..ef17d8f202cfd 100644 --- a/htdocs/install/mysql/data/llx_c_holiday_types.sql +++ b/htdocs/install/mysql/data/llx_c_holiday_types.sql @@ -57,7 +57,7 @@ insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '9M-M', 'Ειδική άδεια προστασίας μητρότητας 9 μηνών(χωρίς αποδοχές)', 0, 0, 0, 102, 24, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '4M-M', 'Τετράμηνη γονική Άδεια Ανατροφής Τέκνων(χωρίς αποδοχές)', 0, 0, 0, 102, 25, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8D-SP', 'Εξαήμερη ή Οκταήμερη Άδεια για μονογονεϊκές οικογένειες(με αποδοχές)', 0, 0, 0, 102, 26, 0); -insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8-14D-FC', 'Άδεια για ασθένεια μελών οικογένειας(χωρίς αποδοχές, 6 ημέρες/έτος ένα παιδί - 8 ημέρες/έτος δύο παιδιά και σε 14 ημέρες/έτος τρία (3) παιδιά και πάνω', 0, 0, 0, 102, 27, 0); +insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8-14D-FC', 'Αναρρωτική άδεια (άνευ αποδοχών, 6 ημέρες/έτος για ένα παιδί - 8 ημέρες/έτος για δύο και 14 ημέρες/έτος για τρία ή περισσότερα)', 0, 0, 0, 102, 27, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '10D-CD', 'Δεκαήμερη Γονική Άδεια για παιδί με σοβαρά νοσήματα και λόγω νοσηλείας παιδιών(με αποδοχές)', 0, 0, 0, 102, 28, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '30D-CD', 'Άδεια λόγω νοσηλείας των παιδιών(έως 30 ημέρες/έτος χωρίς αποδοχές)', 0, 0, 0, 102, 29, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '5D-CG', 'Άδεια φροντιστή(έως 5 ημέρες/έτος χωρίς αποδοχές)', 0, 0, 0, 102, 30, 0); From 82ae009e8be7a20082fee514216bd68f67d39327 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:53:45 +0100 Subject: [PATCH 18/19] Fix size too low --- htdocs/install/mysql/tables/llx_c_invoice_subtype.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql index 201df19923cda..c204df3b93324 100644 --- a/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql +++ b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql @@ -16,14 +16,13 @@ -- -- ======================================================================== -CREATE TABLE llx_c_invoice_subtype +CREATE TABLE llx_c_invoice_subtype ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_country integer NOT NULL, code varchar(5) NOT NULL, - label varchar(100), + label varchar(200), active tinyint DEFAULT 1 NOT NULL ) ENGINE=innodb; - From dd67fe7b6d57a0b77e997472961e04734dd5bc48 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:58:39 +0100 Subject: [PATCH 19/19] Fix duplicate record --- htdocs/install/mysql/data/llx_c_type_contact.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql index b7e649559e949..50a952bbea129 100644 --- a/htdocs/install/mysql/data/llx_c_type_contact.sql +++ b/htdocs/install/mysql/data/llx_c_type_contact.sql @@ -74,9 +74,9 @@ insert into llx_c_type_contact (element, source, code, libelle, active ) values insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1); -- Shipment / Expedition +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'CUSTOMER', 'Customer shipping contact', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Loading facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Delivery facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Customer shipping contact', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'DELIVERY', 'Delivery facility', 1); -- Intervention / Fichinter insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'internal', 'INTERREPFOLL', 'Responsable suivi de l''intervention', 1);
'.$langs->trans("Parameter")."'.$langs->trans("Value")."
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")."