From be3f10e6d2b04403b60dcb02a5b368d23994b63b Mon Sep 17 00:00:00 2001 From: Daksh Amalseda Date: Thu, 9 Oct 2025 01:53:43 +0530 Subject: [PATCH 1/3] Added spellcheck="false" on form field that does not need spellchecking (#35682) * fixed bug * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/don/card.php | 8 ++++---- htdocs/don/payment/payment.php | 2 +- htdocs/user/card.php | 8 ++++---- htdocs/variants/combinations.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index f41bbbc5fe9..e971eff396e 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -465,7 +465,7 @@ if ($action == 'create') { print ''; // Amount - print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; + print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; // Public donation print ''.$langs->trans("PublicDonation").""; @@ -494,7 +494,7 @@ if ($action == 'create') { } print ''; - print "".''.$langs->trans("EMail").''.img_picto('', 'object_email', 'class="paddingrightonly"').''; + print ''.$langs->trans("EMail").''.img_picto('', 'object_email', 'class="paddingrightonly"').''; } // Payment mode @@ -588,7 +588,7 @@ if (!empty($id) && $action == 'edit') { // Amount if ($object->status == 0) { - print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; + print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; } else { print ''.$langs->trans("Amount").''; print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency); @@ -632,7 +632,7 @@ if (!empty($id) && $action == 'edit') { } print ''; - print "".''.$langs->trans("EMail").''; + print ''.$langs->trans("EMail").''; } // Payment mode print "".$langs->trans("PaymentMode")."\n"; diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index 7315bfda257..3541f2ec8fc 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -219,7 +219,7 @@ if ($action == 'create') { print ''.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print ''; - print ''."\n"; + print ''."\n"; // Check transmitter print ''.$langs->trans('CheckTransmitter'); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index fe108c3cddd..b2060d33963 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1308,7 +1308,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print $ldap_mobile; } else { - print ''; + print ''; } print ''; @@ -1332,7 +1332,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print $ldap_mail; } else { - print ''; + print ''; } print ''; @@ -2377,7 +2377,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "".''.$langs->trans("Login").''; print ''; if ($user->admin && !$object->ldap_sid) { - print ''; + print ''; } else { print ''; print $object->login; @@ -2769,7 +2769,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print img_picto('', 'phoning_mobile', 'class="pictofixedwidth"'); if ($permissiontoedit && empty($object->ldap_sid)) { - print ''; + print ''; } else { print ''; print $object->user_mobile; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index d10b34fe159..bad1f4f8269 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -718,7 +718,7 @@ if (!empty($id) || !empty($ref)) { } ?> - + Date: Thu, 9 Oct 2025 05:38:40 +0200 Subject: [PATCH 2/3] clean code (#35687) * clean code * clean code member setup * clean code member setup * clean code member setup * clean code member setup --- dev/build/phpstan/phpstan-baseline.neon | 12 ----- htdocs/adherents/admin/member.php | 60 ++++++++++++++++++++++++- htdocs/asterisk/wrapper.php | 53 ++++++---------------- 3 files changed, 72 insertions(+), 53 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 32aec6d0659..8fc43ff3b1a 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -6840,12 +6840,6 @@ parameters: count: 2 path: ../../../htdocs/core/lib/admin.lib.php - - - message: '#^Variable \$strictw3c in empty\(\) always exists and is not falsy\.$#' - identifier: empty.variable - count: 13 - path: ../../../htdocs/core/lib/admin.lib.php - - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse @@ -14580,12 +14574,6 @@ parameters: count: 1 path: ../../../htdocs/public/eventorganization/subscriptionok.php - - - message: '#^Variable \$suffix might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/public/eventorganization/subscriptionok.php - - message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#' identifier: function.alreadyNarrowedType diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 32a02575fe9..31c6a2c43f9 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -37,6 +37,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; /** * @var Conf $conf @@ -76,9 +77,63 @@ $error = 0; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -global $conf; +if ($action == 'updateMask') { + $maskconst = GETPOST('maskconst', 'aZ09'); + $maskvalue = GETPOST('maskvalue', 'alpha'); -if ($action == 'set_default') { + $res = 0; + + if ($maskconst && preg_match('/_MASK$/', $maskconst)) { + $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); + } + + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} elseif ($action == 'specimen') { // For fiche expensereport + $modele = GETPOST('module', 'alpha'); + + $adherentspecimen = new Adherent($db); + $adherentspecimen->initAsSpecimen(); + $adherentspecimen->status = 0; // Force statut draft to show watermark + + // Search template files + $file = ''; + $classname = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/member/doc/pdf_".$modele.".modules.php", 0); + if (file_exists($file)) { + $classname = "pdf_".$modele; + break; + } + } + + if ($classname !== '') { + require_once $file; + + $module = new $classname($db); + '@phan-var-force ModelePDFMember $module'; + /** @var ModelePDFMember $module */ + + if ($module->write_file($adherentspecimen, $langs) > 0) { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=member&file=SPECIMEN.pdf"); + return; + } else { + setEventMessages($module->error, $module->errors, 'errors'); + dol_syslog($module->error, LOG_ERR); + } + } else { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} elseif ($action == 'set_default') { $ret = addDocumentModel($value, $type, $label, $scandir); $res = true; } elseif ($action == 'del_default') { @@ -286,6 +341,7 @@ foreach ($dirModMember as $dirroot) { continue; } $modCodeMember = new $file(); + /** @var ModeleNumRefMembers $modCodeMember */ // Show modules according to features level if ($modCodeMember->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 5fa452e781f..530fddf7bd9 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024-2025 MDW +/* Copyright (C) 2009-2010 Laurent Destailleur + * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,9 +94,6 @@ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = } require_once '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -105,6 +102,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + // Security check if (!isModEnabled('clicktodial')) { accessforbidden(); @@ -112,34 +112,9 @@ if (!isModEnabled('clicktodial')) { // Define Asterisk setup -if (!getDolGlobalString('ASTERISK_HOST')) { - $conf->global->ASTERISK_HOST = "127.0.0.1"; -} -if (!getDolGlobalString('ASTERISK_TYPE')) { - $conf->global->ASTERISK_TYPE = "SIP/"; -} -if (!getDolGlobalString('ASTERISK_INDICATIF')) { - $conf->global->ASTERISK_INDICATIF = "0"; -} -if (!getDolGlobalString('ASTERISK_PORT')) { - $conf->global->ASTERISK_PORT = 5038; -} if (getDolGlobalString('ASTERISK_INDICATIF') == 'NONE') { $conf->global->ASTERISK_INDICATIF = ''; } -if (!getDolGlobalString('ASTERISK_CONTEXT')) { - $conf->global->ASTERISK_CONTEXT = "from-internal"; -} -if (!getDolGlobalString('ASTERISK_WAIT_TIME')) { - $conf->global->ASTERISK_WAIT_TIME = "30"; -} -if (!getDolGlobalString('ASTERISK_PRIORITY')) { - $conf->global->ASTERISK_PRIORITY = "1"; -} -if (!getDolGlobalString('ASTERISK_MAX_RETRY')) { - $conf->global->ASTERISK_MAX_RETRY = "2"; -} - $login = GETPOST('login', 'alphanohtml'); $password = GETPOST('password', 'password'); @@ -153,29 +128,29 @@ $caller = preg_replace('/[\n\r]/', '', $caller); $called = preg_replace('/[\n\r]/', '', $called); // IP address of Asterisk server -$strHost = getDolGlobalString('ASTERISK_HOST'); +$strHost = getDolGlobalString('ASTERISK_HOST', '127.0.0.1'); // Specify the type of extension through which your extension is connected. // ex: SIP/, IAX2/, ZAP/, etc -$channel = getDolGlobalString('ASTERISK_TYPE'); +$channel = getDolGlobalString('ASTERISK_TYPE', 'SIP/'); // Outgoing call sign -$prefix = getDolGlobalString('ASTERISK_INDICATIF'); +$prefix = getDolGlobalString('ASTERISK_INDICATIF', '0'); // Asterisk Port -$port = getDolGlobalString('ASTERISK_PORT'); +$port = getDolGlobalInt('ASTERISK_PORT', 5038); // Context ( generalement from-internal ) -$strContext = getDolGlobalString('ASTERISK_CONTEXT'); +$strContext = getDolGlobalString('ASTERISK_CONTEXT', 'from-internal'); // Waiting time before hanging up -$strWaitTime = getDolGlobalString('ASTERISK_WAIT_TIME'); +$strWaitTime = getDolGlobalString('ASTERISK_WAIT_TIME', '30'); // Priority -$strPriority = getDolGlobalString('ASTERISK_PRIORITY'); +$strPriority = getDolGlobalString('ASTERISK_PRIORITY', '1'); // Number of call attempts -$strMaxRetry = getDolGlobalString('ASTERISK_MAX_RETRY'); +$strMaxRetry = getDolGlobalString('ASTERISK_MAX_RETRY', "2"); /* From e9a9c7ac61aa219364e6c354dd557cc5f4ea89a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 9 Oct 2025 05:45:01 +0200 Subject: [PATCH 3/3] add societe and ticket on api upload document (#35681) * Add support for 'societe' modules on api upload document * Add ticket module handling in API documents class * Update api_documents.class.php * Update api_documents.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/api/class/api_documents.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index a1a66cfb469..ab0d6da9155 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -892,6 +892,16 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $object = new Contact($this->db); $fetchbyid = true; + } elseif ($modulepart == 'societe' || $modulepart == 'company') { + $modulepart = 'societe'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $object = new Societe($this->db); + $fetchbyid = true; + } elseif ($modulepart == 'ticket' ) { + $modulepart = 'ticket'; + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; + $object = new Ticket($this->db); + $fetchbyid = true; } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { $modulepart = 'contrat'; require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';