Merge branch 'develop' into fix-sendermail-signature

This commit is contained in:
Laurent Destailleur 2025-03-05 20:25:33 +01:00 committed by GitHub
commit f413fda6b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 29 deletions

View file

@ -19,7 +19,7 @@ WARNING:
The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The directory /build has been moved into /dev/build.
* The use of GETPOST function is not allowed inside extrafields conditions or any strings that contains dynamic code evaluated with dol_eval()
* The deprecated variable $trigger_name (duplicate of variable $triggersendname) has been removed. You must use $triggersendname everywhere now.
***** ChangeLog for 21.0.0 compared to 20.0 *****

View file

@ -7488,12 +7488,6 @@ parameters:
count: 1
path: ../../../htdocs/core/actions_sendmails.inc.php
-
message: '#^Variable \$paramname2 might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/actions_sendmails.inc.php
-
message: '#^Variable \$result might not be defined\.$#'
identifier: variable.undefined

View file

@ -2667,11 +2667,11 @@ class Propal extends CommonObject
if ($resql) {
// Status self::STATUS_REFUSED by default
$modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf);
$trigger_name = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger()
$triggersendname = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger()
if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED
$trigger_name = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger()
$modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL') ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->model_pdf;
if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED
$triggersendname = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger()
$modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL', $this->model_pdf);
// The connected company is classified as a client
$soc = new Societe($this->db);

View file

@ -24,24 +24,25 @@
* \brief Code for actions on sending mails from object page
*/
// $mysoc must be defined
// $id must be defined
// $paramname may be defined
// $autocopy may be defined (used to know the automatic BCC to add)
// $triggersendname must be set (can be '')
// $actiontypecode can be set
// $object and $subject may be defined
/**
* @var Societe $mysoc
* @var CommonObject $object
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Societe $mysoc
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
* @var string $action
* @var int $id
* @var string $dolibarr_main_url_root
* @var string $action
* @var ?string $subject
* @var ?string $triggersendname (can be '')
* @var ?string $sendcontext
* @var ?string $autocopy (used to know the automatic BCC to add)
* @var ?string $actiontypecode
* @var ?string $paramname
*/
'
@phan-var-force Societe $mysoc
@ -446,9 +447,9 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$object->email_tocc = $sendtocc;
$object->email_tobcc = $sendtobcc;
// Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprecated)
if (!empty($triggersendname) || !empty($trigger_name)) {
$result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable
// Call of triggers (you should have set $triggersendname to execute trigger.
if (!empty($triggersendname)) {
$result = $object->call_trigger($triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable
if ($result < 0) {
$error++;
}
@ -464,12 +465,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
setEventMessages($mesg, null, 'mesgs');
$moreparam = '';
if (isset($paramval2)) { // @phan-var-suppress-current-line PhanPluginUndeclaredVariableIsset
// @phan-var-suppress-next-line PhanUndeclaredGlobalVariable
$moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2;
}
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ?? 'id').'='.(is_object($object) ? $object->id : '').$moreparam);
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ?? 'id').'='.(is_object($object) ? $object->id : ''));
exit;
} else {
$langs->load("other");