dolibarr/htdocs/core/actions_sendmails.inc.php

511 lines
20 KiB
PHP
Raw Permalink Normal View History

<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
2024-03-13 19:43:34 +01:00
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
2018-12-01 16:55:45 +01:00
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/core/actions_sendmails.inc.php
* \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
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
// $object and $subject may be defined
/**
* @var CommonObject $object
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
* @var Societe $mysoc
* @var Translate $langs
*
* @var string $dolibarr_main_url_root
add baseline exclude for phpstan (#31632) * add baseline exclude for phpstan * update * update * update * update * update * merge * restore one filter * delete old errors * fix * fix * fix * $moreforfilter can t be empty * fix * enable check * refresh baseline * add phpdoc * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * update phpstan baseline * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
* @var string $action
* @var ?string $subject
*/
2024-03-13 19:43:34 +01:00
'
@phan-var-force Societe $mysoc
@phan-var-force CommonObject $object
';
$error = 0;
/*
* Add file in email form
*/
2021-01-02 09:35:57 +01:00
if (GETPOST('addfile', 'alpha')) {
$trackid = GETPOST('trackid', 'aZ09');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
$vardir = $conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
dol_add_file_process($upload_dir_tmp, 1, 0, 'addedfile', '', null, $trackid, 0);
$action = 'presend';
}
/*
* Remove file in email form
*/
2022-02-22 23:44:56 +01:00
if (GETPOST('removedfile') && !GETPOST('removAll')) {
$trackid = GETPOST('trackid', 'aZ09');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
$vardir = $conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
// TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir"
// GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array.
dol_remove_file_process(GETPOST('removedfile', 'alpha'), 0, 1, $trackid); // We do not delete because if file is the official PDF of doc, we don't want to remove it physically
$action = 'presend';
}
2015-08-24 16:05:15 +02:00
/*
* Remove all files in email form
*/
2021-01-02 09:35:57 +01:00
if (GETPOST('removAll', 'alpha')) {
$trackid = GETPOST('trackid', 'aZ09');
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
$keytoavoidconflict = empty($trackid) ? '' : '-'.$trackid;
2021-01-02 09:35:57 +01:00
if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) {
$listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
}
if (!empty($_SESSION["listofnames".$keytoavoidconflict])) {
$listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
}
if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) {
$listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
}
2015-08-24 16:05:15 +02:00
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->trackid = $trackid;
2021-01-02 09:35:57 +01:00
foreach ($listofpaths as $key => $value) {
2015-08-24 16:05:15 +02:00
$pathtodelete = $value;
$filetodelete = $listofnames[$key];
$result = dol_delete_file($pathtodelete, 1); // Delete uploaded Files
2015-08-24 16:05:15 +02:00
$langs->load("other");
setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs');
2015-08-24 16:05:15 +02:00
$formmail->remove_attached_files($key); // Update Session
}
}
/*
* Send mail
*/
2022-02-22 23:44:56 +01:00
if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPOST('removAll') && !GETPOST('removedfile') && !GETPOST('cancel') && !GETPOST('modelselected')) {
2021-01-02 09:35:57 +01:00
if (empty($trackid)) {
$trackid = GETPOST('trackid', 'aZ09');
}
2018-01-22 17:15:44 +01:00
// Set tmp user directory (used to convert images embedded as img src=data:image)
$vardir = $conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
2021-03-01 20:37:16 +01:00
$subject = '';
2022-04-07 13:28:24 +02:00
//$actionmsg = '';
2021-03-01 20:37:16 +01:00
$actionmsg2 = '';
$langs->load('mails');
$sendtosocid = 0; // Id of related thirdparty
2021-01-02 09:35:57 +01:00
if (is_object($object)) {
$result = $object->fetch($id);
2021-01-02 09:35:57 +01:00
if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) {
$resultthirdparty = $object->fetch_thirdparty();
$thirdparty = $object->thirdparty;
2021-01-02 09:35:57 +01:00
if (is_object($thirdparty)) {
$sendtosocid = $thirdparty->id;
}
} elseif ($object->element == 'member' || $object->element == 'user') {
$thirdparty = $object;
2021-01-02 09:35:57 +01:00
if ($object->socid > 0) {
$sendtosocid = $object->socid;
}
} elseif ($object->element == 'expensereport') {
$tmpuser = new User($db);
$tmpuser->fetch($object->fk_user_author);
$thirdparty = $tmpuser;
2021-01-02 09:35:57 +01:00
if ($object->socid > 0) {
$sendtosocid = $object->socid;
}
} elseif ($object->element == 'societe') {
$thirdparty = $object;
2021-01-02 09:35:57 +01:00
if (is_object($thirdparty) && $thirdparty->id > 0) {
$sendtosocid = $thirdparty->id;
}
} elseif ($object->element == 'contact') {
$contact = $object;
if ($contact->id > 0) {
$contact->fetch_thirdparty();
$thirdparty = $contact->thirdparty;
2021-01-02 09:35:57 +01:00
if (is_object($thirdparty) && $thirdparty->id > 0) {
$sendtosocid = $thirdparty->id;
}
}
2021-01-02 09:35:57 +01:00
} else {
2024-01-20 09:22:38 +01:00
dol_print_error(null, "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported");
2021-01-02 09:35:57 +01:00
}
2018-04-11 18:31:46 +02:00
2021-01-02 09:35:57 +01:00
if (is_object($hookmanager)) {
$parameters = array();
$reshook = $hookmanager->executeHooks('initSendToSocid', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
2018-04-11 18:31:46 +02:00
}
} else {
$thirdparty = $mysoc;
}
2021-01-02 09:35:57 +01:00
if ($result > 0) {
$sendto = '';
$sendtocc = '';
$sendtobcc = '';
$sendtoid = array();
$sendtouserid = array();
$sendtoccuserid = array();
// Define $sendto
2022-02-22 23:44:56 +01:00
$receiver = GETPOST('receiver', 'alphawithlgt');
2021-01-02 09:35:57 +01:00
if (!is_array($receiver)) {
if ($receiver == '-1') {
$receiver = array();
} else {
$receiver = array($receiver);
}
}
$tmparray = array();
2024-03-28 21:29:02 +01:00
if (trim(GETPOST('sendto', 'alphawithlgt'))) {
2021-07-31 16:54:18 +02:00
// Recipients are provided into free text field
2022-02-22 23:44:56 +01:00
$tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
}
2024-03-28 21:29:02 +01:00
if (trim(GETPOST('tomail', 'alphawithlgt'))) {
2021-07-31 16:54:18 +02:00
// Recipients are provided into free hidden text field
2022-02-22 23:44:56 +01:00
$tmparray[] = trim(GETPOST('tomail', 'alphawithlgt'));
2021-07-29 17:32:06 +02:00
}
2021-01-02 09:35:57 +01:00
if (count($receiver) > 0) {
// Recipient was provided from combo list
2021-01-02 09:35:57 +01:00
foreach ($receiver as $key => $val) {
if ($val == 'thirdparty') { // Key selected means current third party ('thirdparty' may be used for current member or current user too)
$tmparray[] = dol_string_nospecial($thirdparty->getFullName($langs), ' ', array(",")).' <'.$thirdparty->email.'>';
2021-01-02 09:35:57 +01:00
} elseif ($val == 'contact') { // Key selected means current contact
$tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>';
$sendtoid[] = $contact->id;
2024-12-26 11:15:22 +01:00
} elseif ($val && $object->element == 'project' && empty($object->socid)) { // $val is the Id of a contact
$contact = new Contact($db);
$ret = $contact->fetch((int) $val);
if ($ret > 0 && !empty($contact->socid)) {
$thirdparty = new Societe($db);
$thirdparty->fetch($contact->socid);
$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
$sendtoid[] = ((int) $val);
}
2021-01-02 09:35:57 +01:00
} elseif ($val) { // $val is the Id of a contact
$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
$sendtoid[] = ((int) $val);
}
}
}
2023-11-27 11:39:32 +01:00
if (getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
2022-02-22 23:44:56 +01:00
$receiveruser = GETPOST('receiveruser', 'alphawithlgt');
2021-01-02 09:35:57 +01:00
if (is_array($receiveruser) && count($receiveruser) > 0) {
2018-03-21 11:48:30 +01:00
$fuserdest = new User($db);
2021-01-02 09:35:57 +01:00
foreach ($receiveruser as $key => $val) {
$tmparray[] = $fuserdest->user_get_property($val, 'email');
$sendtouserid[] = $val;
2018-03-21 11:48:30 +01:00
}
}
}
$sendto = implode(',', $tmparray);
// Define $sendtocc
2022-02-22 23:44:56 +01:00
$receivercc = GETPOST('receivercc', 'alphawithlgt');
2021-01-02 09:35:57 +01:00
if (!is_array($receivercc)) {
if ($receivercc == '-1') {
$receivercc = array();
} else {
$receivercc = array($receivercc);
}
}
$tmparray = array();
2024-03-28 21:29:02 +01:00
if (trim(GETPOST('sendtocc', 'alphawithlgt'))) {
2022-02-22 23:44:56 +01:00
$tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
}
2021-01-02 09:35:57 +01:00
if (count($receivercc) > 0) {
foreach ($receivercc as $key => $val) {
2021-01-12 23:30:59 +01:00
if ($val == 'thirdparty') { // Key selected means current thirdparty (may be usd for current member or current user too)
2021-01-02 09:35:57 +01:00
// Recipient was provided from combo list
$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
2021-01-02 09:35:57 +01:00
} elseif ($val == 'contact') { // Key selected means current contact
// Recipient was provided from combo list
$tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
//$sendtoid[] = $contact->id; TODO Add also id of contact in CC ?
2021-01-02 09:35:57 +01:00
} elseif ($val) { // $val is the Id of a contact
$tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
//$sendtoid[] = ((int) $val); TODO Add also id of contact in CC ?
}
}
}
2023-11-27 11:39:32 +01:00
if (getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
2022-02-22 23:44:56 +01:00
$receiverccuser = GETPOST('receiverccuser', 'alphawithlgt');
2018-03-21 11:48:30 +01:00
2021-01-02 09:35:57 +01:00
if (is_array($receiverccuser) && count($receiverccuser) > 0) {
2018-03-21 11:48:30 +01:00
$fuserdest = new User($db);
2021-01-02 09:35:57 +01:00
foreach ($receiverccuser as $key => $val) {
$tmparray[] = $fuserdest->user_get_property($val, 'email');
$sendtoccuserid[] = $val;
2018-03-21 11:48:30 +01:00
}
}
}
$sendtocc = implode(',', $tmparray);
2021-01-02 09:35:57 +01:00
if (dol_strlen($sendto)) {
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$langs->load("commercial");
$reg = array();
$fromtype = GETPOST('fromtype', 'alpha');
if ($fromtype === 'robot') {
2023-10-15 15:32:35 +02:00
$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>';
2020-05-21 15:05:19 +02:00
} elseif ($fromtype === 'user') {
$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>';
2020-05-21 15:05:19 +02:00
} elseif ($fromtype === 'company') {
2023-10-15 15:32:35 +02:00
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
2020-05-21 15:05:19 +02:00
} elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
$tmp = explode(',', $user->email_aliases);
Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp (#30557) * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Update phan baseline (remove PhanTypeInvalidLeftOperandOfNumericOp) * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Fix: Change argument '' to null as by getAvailableDiscounts signature * Qual: Cast '' to float for Phan notice * Fix: Convert $number with price2num before using this parameter * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Add cast to ensure fmod is presented with floats
2024-08-15 16:57:02 +02:00
$from = trim($tmp[((int) $reg[1] - 1)]);
2020-05-21 15:05:19 +02:00
} elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
2023-12-13 15:20:53 +01:00
$tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES'));
Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp (#30557) * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Update phan baseline (remove PhanTypeInvalidLeftOperandOfNumericOp) * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Fix: Change argument '' to null as by getAvailableDiscounts signature * Qual: Cast '' to float for Phan notice * Fix: Convert $number with price2num before using this parameter * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Add cast to ensure fmod is presented with floats
2024-08-15 16:57:02 +02:00
$from = trim($tmp[((int) $reg[1] - 1)]);
2020-05-21 15:05:19 +02:00
} elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
$sql .= ' WHERE rowid = '.(int) $reg[1];
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
2021-01-02 09:35:57 +01:00
if ($obj) {
$from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
}
} elseif (preg_match('/from_template_(\d+)/', $fromtype, $reg)) {
$sql = 'SELECT rowid, email_from FROM '.MAIN_DB_PREFIX.'c_email_templates';
$sql .= ' WHERE rowid = '.(int) $reg[1];
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
if ($obj) {
$from = $obj->email_from;
}
2020-05-21 15:05:19 +02:00
} else {
2022-02-22 23:44:56 +01:00
$from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")).' <'.GETPOST('frommail').'>';
}
2022-02-22 23:44:56 +01:00
$replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")).' <'.GETPOST('replytomail').'>';
2024-02-18 02:12:34 +01:00
2020-09-18 01:29:17 +02:00
$message = GETPOST('message', 'restricthtml');
$subject = GETPOST('subject', 'restricthtml');
// Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
// become
// <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
$message = preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
$sendtobcc = GETPOST('sendtoccc', 'alphawithlgt');
// Autocomplete the $sendtobcc
// $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
2021-01-02 09:35:57 +01:00
if (!empty($autocopy)) {
2024-04-08 11:31:28 +02:00
$sendtobcc .= (getDolGlobalString($autocopy) ? (($sendtobcc ? ", " : "") . getDolGlobalString($autocopy)) : '');
}
$deliveryreceipt = GETPOSTINT('deliveryreceipt') ? 1 : 0;
2021-01-02 09:35:57 +01:00
if ($action == 'send' || $action == 'relance') {
$actionmsg2 = $langs->transnoentities('MailSentByTo', CMailFile::getValidAddress($from, 4, 0, 1), CMailFile::getValidAddress($sendto, 4, 0, 1));
2022-04-07 13:28:24 +02:00
/*if ($message) {
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
2021-01-02 09:35:57 +01:00
if ($sendtocc) {
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
}
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
2014-11-18 19:03:02 +01:00
$actionmsg = dol_concatdesc($actionmsg, $message);
2022-04-07 13:28:24 +02:00
}*/
}
// Create form object
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->trackid = $trackid; // $trackid must be defined
$attachedfiles = $formmail->get_attached_files();
$filepath = $attachedfiles['paths'];
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
2015-08-24 16:22:21 +02:00
// Make substitution in email content
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
$substitutionarray['__EMAIL__'] = $sendto;
2023-06-09 11:53:39 +02:00
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefined&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-undefined", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
2024-03-13 19:43:34 +01:00
$parameters = array('mode' => 'formemail');
complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
2017-08-28 12:18:18 +02:00
$subject = make_substitutions($subject, $substitutionarray);
$message = make_substitutions($message, $substitutionarray);
2017-08-28 12:18:18 +02:00
if (is_object($object) && method_exists($object, 'makeSubstitution')) {
$subject = $object->makeSubstitution($subject);
$message = $object->makeSubstitution($message);
}
2017-08-28 12:18:18 +02:00
// Send mail (substitutionarray must be done just before this)
2021-01-02 09:35:57 +01:00
if (empty($sendcontext)) {
$sendcontext = 'standard';
}
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, '', $upload_dir_tmp);
2022-08-04 09:14:34 +02:00
if (!empty($mailfile->error) || !empty($mailfile->errors)) {
2018-03-27 11:17:40 +02:00
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
$action = 'presend';
2020-05-21 15:05:19 +02:00
} else {
$result = $mailfile->sendfile();
if ($result) {
2018-05-17 16:50:40 +02:00
// Initialisation of datas of object to call trigger
2021-01-02 09:35:57 +01:00
if (is_object($object)) {
if (empty($actiontypecode)) {
2024-04-29 17:50:58 +02:00
$actiontypecode = 'AC_OTH_AUTO'; // Event inserted into agenda automatically
2021-01-02 09:35:57 +01:00
}
$object->socid = $sendtosocid; // To link to a company
$object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array.
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
2022-04-07 13:28:24 +02:00
$object->actionmsg = $message; // Long text
$object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentByTo')...);
2023-11-27 11:39:32 +01:00
if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
$object->actionmsg2 = $subject; // Short text
}
$object->trackid = $trackid;
2021-01-02 09:35:57 +01:00
$object->fk_element = $object->id;
$object->elementtype = $object->element;
if (is_array($attachedfiles) && count($attachedfiles) > 0) {
$object->attachedfiles = $attachedfiles;
2017-07-18 19:33:25 +02:00
}
2023-11-27 11:39:32 +01:00
if (is_array($sendtouserid) && count($sendtouserid) > 0 && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
$object->sendtouserid = $sendtouserid;
2018-03-21 22:58:17 +01:00
}
$object->email_msgid = $mailfile->msgid; // @todo Set msgid into $mailfile after sending
$object->email_from = $from;
$object->email_subject = $subject;
$object->email_to = $sendto;
$object->email_tocc = $sendtocc;
$object->email_tobcc = $sendtobcc;
$object->email_subject = $subject;
2020-04-02 12:03:29 +02:00
// Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprecated)
2021-01-02 09:35:57 +01:00
if (!empty($triggersendname) || !empty($trigger_name)) {
2020-04-02 12:03:29 +02:00
// Call trigger
$result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable
2021-01-02 09:35:57 +01:00
if ($result < 0) {
$error++;
}
2020-04-02 12:03:29 +02:00
// End call triggers
if ($error) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
2020-04-02 12:03:29 +02:00
// End call of triggers
}
// Redirect here
// This avoid sending mail twice if going out and then back to page
$mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
setEventMessages($mesg, null, 'mesgs');
2021-01-02 09:35:57 +01:00
$moreparam = '';
if (isset($paramval2)) { // @phan-var-suppress-current-line PhanPluginUndeclaredVariableIsset
// @phan-var-suppress-next-line PhanUndeclaredGlobalVariable
2021-01-02 09:35:57 +01:00
$moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2;
}
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ?? 'id').'='.(is_object($object) ? $object->id : '').$moreparam);
2021-01-02 09:35:57 +01:00
exit;
2020-05-21 15:05:19 +02:00
} else {
$langs->load("other");
$mesg = '<div class="error">';
2022-08-10 10:09:52 +02:00
if (!empty($mailfile->error) || !empty($mailfile->errors)) {
$mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
2022-08-10 10:09:52 +02:00
if (!empty($mailfile->error)) {
$mesg .= '<br>'.$mailfile->error;
}
if (!empty($mailfile->errors) && is_array($mailfile->errors)) {
$mesg .= '<br>'.implode('<br>', $mailfile->errors);
}
2020-05-21 15:05:19 +02:00
} else {
2020-10-28 17:48:20 +01:00
$mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
2023-11-27 11:39:32 +01:00
if (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
2020-10-23 16:39:45 +02:00
$mesg .= '<br>Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
} else {
$mesg .= '<br>Unknown Error, please refer to your administrator';
2020-10-23 16:39:45 +02:00
}
}
$mesg .= '</div>';
2015-08-24 16:05:15 +02:00
2015-11-19 13:59:58 +01:00
setEventMessages($mesg, null, 'warnings');
$action = 'presend';
}
}
2020-05-21 15:05:19 +02:00
} else {
$langs->load("errors");
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
2017-06-22 11:04:29 +02:00
dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
$action = 'presend';
}
2020-05-21 15:05:19 +02:00
} else {
$langs->load("errors");
setEventMessages($langs->trans('ErrorFailedToReadObject', $object->element), null, 'errors');
dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element);
$action = 'presend';
}
}