Merge pull request #23844 from frederic34/send_an_email

deprecate method send_an_email
This commit is contained in:
Laurent Destailleur 2023-02-09 14:52:23 +01:00 committed by GitHub
commit e4beda03f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 11 deletions

View File

@ -674,7 +674,7 @@ if (empty($reshook)) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
@ -745,7 +745,7 @@ if (empty($reshook)) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
@ -816,7 +816,7 @@ if (empty($reshook)) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -440,11 +440,37 @@ class Adherent extends CommonObject
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to erros to
* @param string $moreinheader Add more html headers
* @deprecated since V18
* @see sendEmail
* @return int <0 if KO, >0 if OK
*/
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
// phpcs:enable
dol_syslog('Warning using deprecated Adherent::send_an_email', LOG_WARNING);
return $this->sendEmail($text, $subject, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, $errors_to, $moreinheader);
}
/**
* Function sending an email to the current member with the text supplied in parameter.
*
* @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message
* @param array $filename_list Array of attached files
* @param array $mimetype_list Array of mime types of attached files
* @param array $mimefilename_list Array of public names of attached files
* @param string $addr_cc Email cc
* @param string $addr_bcc Email bcc
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to erros to
* @param string $moreinheader Add more html headers
* @since V18
* @return int <0 if KO, >0 if OK
*/
public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
global $conf, $langs;
// Detect if message is HTML

View File

@ -405,7 +405,7 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscripti
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader);
if ($result < 0) {
$errmsg = $object->error;
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -2314,7 +2314,6 @@ class Project extends CommonObject
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function sending an email to the current member with the text supplied in parameter.
*
@ -2329,12 +2328,14 @@ class Project extends CommonObject
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to erros to
* @param string $moreinheader Add more html headers
* @since V18
* @return int <0 if KO, >0 if OK
*/
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
// phpcs:enable
global $conf, $langs;
// TODO EMAIL
return 1;
}
}

View File

@ -372,7 +372,7 @@ if (empty($reshook) && $action == 'add') {
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
/*if ($result < 0) {
$error++;

View File

@ -360,7 +360,7 @@ if (empty($reshook) && $action == 'add') {
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
}

View File

@ -775,7 +775,7 @@ if ($ispaymentok) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/payment/paymentok.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader);
if ($result < 0) {
$errmsg = $object->error;

View File

@ -371,7 +371,7 @@ if (empty($reshook) && $action == 'add') {
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
/*if ($result < 0) {
$error++;