NEW Add email in event histor for reminder email of expired subsription
This commit is contained in:
parent
f4346c1469
commit
90d3b80efb
@ -2742,7 +2742,58 @@ class Adherent extends CommonObject
|
||||
{
|
||||
$nbok++;
|
||||
|
||||
// TODO Add event email sent for member
|
||||
$message = $msg;
|
||||
$sendto = $to;
|
||||
$sendtocc = '';
|
||||
$sendtobcc = '';
|
||||
$actioncode='EMAIL';
|
||||
$extraparams='';
|
||||
|
||||
$actionmsg='';
|
||||
$actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
|
||||
if ($message)
|
||||
{
|
||||
$actionmsg=$langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||
$actionmsg=dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||
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') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$actioncomm->code = 'AC_'.$actioncode;
|
||||
$actioncomm->label = $actionmsg2;
|
||||
$actioncomm->note = $actionmsg;
|
||||
$actioncomm->fk_project = 0;
|
||||
$actioncomm->datep = $now;
|
||||
$actioncomm->datef = $now;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->socid = $adherent->thirdparty->id;
|
||||
$actioncomm->contactid = 0;
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is en email (content should be added into note)
|
||||
$actioncomm->email_msgid = $cmail->msgid;
|
||||
$actioncomm->email_from = $from;
|
||||
$actioncomm->email_sender= '';
|
||||
$actioncomm->email_to = $to;
|
||||
$actioncomm->email_tocc = $sendtocc;
|
||||
$actioncomm->email_tobcc = $sendtobcc;
|
||||
$actioncomm->email_subject = $subject;
|
||||
$actioncomm->errors_to = '';
|
||||
|
||||
$actioncomm->fk_element = $adherent->id;
|
||||
$actioncomm->elementtype = $adherent->element;
|
||||
|
||||
$actioncomm->extraparams = $extraparams;
|
||||
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -439,6 +439,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$object->sendtouserid = $sendtouserid;
|
||||
}
|
||||
|
||||
// TODO Set object->email_xxx properties
|
||||
$object->email_msgid = $mailfile->msgid;
|
||||
//...
|
||||
|
||||
// Call of triggers
|
||||
if (! empty($trigger_name))
|
||||
{
|
||||
|
||||
@ -818,7 +818,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$actioncomm->code = 'AC_'.$action;
|
||||
$actioncomm->label = $object->actionmsg2;
|
||||
$actioncomm->note = $object->actionmsg; // TODO Replace with $actioncomm->email_msgid ? $object->email_content : $object->actionmsg
|
||||
$actioncomm->note = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
|
||||
$actioncomm->fk_project = $projectid;
|
||||
$actioncomm->datep = $now;
|
||||
$actioncomm->datef = $now;
|
||||
@ -831,19 +831,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$actioncomm->contactid = $contactforaction->id;
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is en email (content should be added into note)
|
||||
$actioncomm->email_msgid = $object->email_msgid;
|
||||
$actioncomm->email_from = $object->email_from;
|
||||
$actioncomm->email_sender= $object->email_sender;
|
||||
$actioncomm->email_to = $object->email_to;
|
||||
$actioncomm->email_tocc = $object->email_tocc;
|
||||
$actioncomm->email_tobcc = $object->email_tobcc;
|
||||
// Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label)
|
||||
$actioncomm->email_msgid = $object->email_msgid;
|
||||
$actioncomm->email_from = $object->email_from;
|
||||
$actioncomm->email_sender = $object->email_sender;
|
||||
$actioncomm->email_to = $object->email_to;
|
||||
$actioncomm->email_tocc = $object->email_tocc;
|
||||
$actioncomm->email_tobcc = $object->email_tobcc;
|
||||
$actioncomm->email_subject = $object->email_subject;
|
||||
$actioncomm->errors_to = $object->errors_to;
|
||||
$actioncomm->errors_to = $object->errors_to;
|
||||
|
||||
$actioncomm->fk_element = $elementid;
|
||||
$actioncomm->elementtype = $elementtype;
|
||||
|
||||
if (property_exists($object,'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) {
|
||||
$actioncomm->attachedfiles=$object->attachedfiles;
|
||||
}
|
||||
if (property_exists($object,'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid)>0) {
|
||||
$actioncomm->userassigned=$object->sendtouserid;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user