29require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing_targets.class.php';
40 public $element =
'mailing';
45 public $table_element =
'mailing';
50 public $picto =
'mail-bulk';
55 public $messtype =
'email';
75 public $evenunsubscribe;
126 public $email_replyto;
131 public $email_errorsto;
136 public $joined_file1;
141 public $joined_file2;
146 public $joined_file3;
151 public $joined_file4;
161 public $extraparams = array();
166 public $statut_dest = array();
171 public $substitutionarray;
176 public $substitutionarrayfortest;
181 public $targets = array();
189 public $fields = array(
190 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'visible' => -2,
'notnull' => 1,
'index' => 1,
'position' => 1,
'comment' =>
'Id'),
191 'fk_project' => array(
'type' =>
'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)',
'label' =>
'Fk project',
'enabled' =>
"isModEnabled('project')",
'visible' => -1,
'position' => 10),
194 const STATUS_DRAFT = 0;
195 const STATUS_VALIDATED = 1;
196 const STATUS_SENTPARTIALY = 2;
197 const STATUS_SENTCOMPLETELY = 3;
210 $this->labelStatus[0] =
'MailingStatusDraft';
211 $this->labelStatus[1] =
'MailingStatusValidated';
212 $this->labelStatus[2] =
'MailingStatusSentPartialy';
213 $this->labelStatus[3] =
'MailingStatusSentCompletely';
215 $this->statut_dest[0] =
'MailingStatusNotSent';
216 $this->statut_dest[1] =
'MailingStatusSent';
217 $this->statut_dest[2] =
'MailingStatusRead';
218 $this->statut_dest[3] =
'MailingStatusReadAndUnsubscribe';
219 $this->statut_dest[-1] =
'MailingStatusError';
229 public function create($user, $notrigger = 0)
231 global
$conf, $langs;
234 if (preg_match(
'/^InvalidHTMLStringCantBeCleaned/', $this->body)) {
235 $this->error =
'InvalidHTMLStringCantBeCleaned';
239 $this->title = trim($this->title);
240 $this->email_from = trim($this->email_from);
241 if (empty($this->messtype)) {
242 $this->messtype =
'email';
244 if (!$this->email_from) {
245 if ($this->messtype !==
'sms') {
246 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MailFrom"));
248 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PhoneFrom"));
258 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"mailing";
259 $sql .=
" (messtype, date_creat, fk_user_creat, entity)";
260 $sql .=
" VALUES ('".$this->db->escape($this->messtype).
"', '".$this->db->idate($now).
"', ".((int) $user->id).
", ".((int)
$conf->entity).
")";
263 $this->title = $langs->trans(
"NoTitle");
268 $resql = $this->db->query($sql);
270 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"mailing");
272 $result = $this->
update($user, 1);
277 if (!$error && !$notrigger) {
279 $result = $this->call_trigger(
'MAILING_CREATE', $user);
290 $this->db->rollback();
291 dol_syslog(__METHOD__ .
' ' . $this->error, LOG_ERR);
295 $this->error = $this->db->lasterror();
296 $this->db->rollback();
308 public function update($user, $notrigger = 0)
313 if (preg_match(
'/^InvalidHTMLStringCantBeCleaned/', $this->body)) {
314 $this->error =
'InvalidHTMLStringCantBeCleaned';
318 if (empty($this->messtype)) {
319 $this->messtype =
'email';
325 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"mailing";
326 $sql .=
" SET titre = '".$this->db->escape($this->title).
"'";
327 $sql .=
", messtype = '".$this->db->escape($this->messtype).
"'";
328 $sql .=
", sujet = '".$this->db->escape($this->sujet).
"'";
329 $sql .=
", body = '".$this->db->escape($this->body).
"'";
330 $sql .=
", email_from = '".$this->db->escape($this->email_from).
"'";
331 $sql .=
", email_replyto = '".$this->db->escape($this->email_replyto).
"'";
332 $sql .=
", email_errorsto = '".$this->db->escape($this->email_errorsto).
"'";
333 $sql .=
", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) :
null).
"'";
334 $sql .=
", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) :
null).
"'";
335 $sql .=
", evenunsubscribe = ".((int) $this->evenunsubscribe);
336 $sql .=
", note_public = '".$this->db->escape($this->note_public).
"'";
337 $sql .=
", note_private = '".$this->db->escape($this->note_private).
"'";
338 $sql .=
", fk_project = '".((int) $this->fk_project).
"'";
339 $sql .=
" WHERE rowid = ".(int) $this->
id;
342 $resql = $this->db->query($sql);
344 if (!$error && !$notrigger) {
346 $result = $this->call_trigger(
'MAILING_MODIFY', $user);
358 $this->db->rollback();
359 dol_syslog(__METHOD__ .
' ' . $this->error, LOG_ERR);
363 if ($this->db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
364 $this->error = $langs->trans(
"ErrorTitleAlreadyExists", $this->title);
366 $this->error = $this->db->lasterror();
368 $this->db->rollback();
380 public function fetch($rowid, $ref =
'')
382 $sql =
"SELECT m.rowid, m.messtype, m.titre as title, m.entity, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe";
383 $sql .=
", m.note_public, m.note_private";
384 $sql .=
", m.email_from, m.email_replyto, m.email_errorsto";
385 $sql .=
", m.statut as status, m.nbemail";
386 $sql .=
", m.fk_user_creat, m.fk_user_valid";
387 $sql .=
", m.tms as date_modification";
388 $sql .=
", m.date_creat";
389 $sql .=
", m.date_valid";
390 $sql .=
", m.date_envoi";
391 $sql .=
", m.extraparams";
393 $sql .=
", m.name_from";
394 $sql .=
", m.fk_user_modif";
395 $sql .=
", m.fk_user_appro";
396 $sql .=
", m.date_appro";
398 $sql .=
", m.joined_file1";
399 $sql .=
", m.joined_file2";
400 $sql .=
", m.joined_file3";
401 $sql .=
", m.joined_file4";
402 $sql .=
", m.fk_project";
403 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing as m";
404 $sql .=
" WHERE entity IN (".getEntity(
'mailing').
")";
406 $sql .=
" AND m.titre = '".$this->db->escape($ref).
"'";
408 $sql .=
" AND m.rowid = ".(int) $rowid;
411 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
412 $result = $this->db->query($sql);
414 if ($this->db->num_rows($result)) {
415 $obj = $this->db->fetch_object($result);
417 $this->
id = $obj->rowid;
418 $this->entity = $obj->entity;
419 $this->
ref = $obj->rowid;
420 $this->title = $obj->title;
421 $this->messtype = $obj->messtype;
423 $this->statut = $obj->status;
424 $this->
status = $obj->status;
426 $this->nbemail = $obj->nbemail;
428 $this->sujet = $obj->sujet;
432 $this->body = $obj->body;
435 $this->bgcolor = $obj->bgcolor;
436 $this->bgimage = $obj->bgimage;
437 $this->evenunsubscribe = $obj->evenunsubscribe;
438 $this->note_public = $obj->note_public;
439 $this->note_private = $obj->note_private;
441 $this->email_from = $obj->email_from;
442 $this->email_replyto = $obj->email_replyto;
443 $this->email_errorsto = $obj->email_errorsto;
445 $this->user_creation_id = $obj->fk_user_creat;
446 $this->user_validation_id = $obj->fk_user_valid;
448 $this->date_creation = $this->db->jdate($obj->date_creat);
449 $this->date_validation = $this->db->jdate($obj->date_valid);
450 $this->date_envoi = $this->db->jdate($obj->date_envoi);
451 $this->date_modification = $this->db->jdate($obj->date_modification);
453 $this->extraparams = (array) json_decode($obj->extraparams,
true);
455 $this->tag = $obj->tag;
456 $this->name_from = $obj->name_from;
457 $this->fk_user_modif = $obj->fk_user_modif;
458 $this->fk_user_appro = $obj->fk_user_appro;
459 $this->date_appro = $obj->date_appro;
460 $this->cible = $obj->cible;
461 $this->joined_file1 = $obj->joined_file1;
462 $this->joined_file2 = $obj->joined_file2;
463 $this->joined_file3 = $obj->joined_file3;
464 $this->joined_file4 = $obj->joined_file4;
465 $this->fk_project = $obj->fk_project;
467 if ($this->messtype ==
'sms') {
468 $this->picto =
'phone';
473 dol_syslog(get_class($this).
"::fetch Erreur -1");
477 dol_syslog(get_class($this).
"::fetch Erreur -2");
495 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
503 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
504 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
505 $sql .=
' WHERE t.entity IN ('.getEntity($this->element).
')';
507 $sql .=
' WHERE 1 = 1';
511 if (is_array($filter)) {
512 dol_syslog(
"You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING);
514 if (count($filter) > 0) {
515 foreach ($filter as $key => $value) {
516 if ($key ==
't.rowid' || $key ==
't.fk_soc' || $key ==
't.fk_project') {
517 $sqlwhere[] = $this->db->sanitize($key).
' = '.((int) $value);
518 } elseif (!empty($this->fields[$key]) && in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
519 $sqlwhere[] = $this->db->sanitize($key).
" = '".$this->db->idate((
int) $value).
"'";
520 } elseif ($key ==
'customsql') {
521 $sqlwhere[] = $value;
522 } elseif (strpos($value,
'%') ===
false) {
523 $sqlwhere[] = $this->db->sanitize($key).
' IN ('.$this->db->sanitize($this->db->escape($value)).
')';
525 $sqlwhere[] = $this->db->sanitize($key).
" LIKE '%".$this->db->escape($value).
"%'";
529 if (count($sqlwhere) > 0) {
530 $sql .=
' AND ('.implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
538 $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
540 $this->errors[] = $errormessage;
541 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
545 if (!empty($sortfield)) {
546 $sql .= $this->db->order($sortfield, $sortorder);
548 if (!empty($limit)) {
549 $sql .= $this->db->plimit($limit, $offset);
552 $resql = $this->db->query($sql);
554 $num = $this->db->num_rows($resql);
556 while ($i < ($limit ? min($limit, $num) : $num)) {
557 $obj = $this->db->fetch_object($resql);
559 $record =
new self($this->db);
560 $record->setVarsFromFetchObj($obj);
562 $records[$record->id] = $record;
566 $this->db->free($resql);
570 $this->errors[] =
'Error '.$this->db->lasterror();
571 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
607 if (empty($option1)) {
622 $object->user_creation_id = $user->id;
623 $object->user_validation_id =
null;
629 $object->context[
'createfromclone'] =
'createfromclone';
630 $result =
$object->create($user, $notrigger);
640 if (!empty($option2)) {
641 require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
645 $target_array = array();
647 $sql =
"SELECT fk_contact,";
648 $sql .=
" lastname,";
649 $sql .=
" firstname,";
652 $sql .=
" source_url,";
653 $sql .=
" source_id ,";
654 $sql .=
" source_type";
655 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles";
656 $sql .=
" WHERE fk_mailing = ".((int) $fromid);
658 $result = $this->db->query($sql);
660 if ($this->db->num_rows($result)) {
661 while ($obj = $this->db->fetch_object($result)) {
662 $target_array[] = array(
663 'fk_contact' => $obj->fk_contact,
664 'lastname' => $obj->lastname,
665 'firstname' => $obj->firstname,
666 'email' => $obj->email,
667 'other' => $obj->other,
668 'source_url' => $obj->source_url,
669 'source_id' => $obj->source_id,
670 'source_type' => $obj->source_type
675 $this->error = $this->db->lasterror();
679 $mailing_target->addTargetsToDatabase(
$object->id, $target_array);
683 unset(
$object->context[
'createfromclone']);
690 $this->db->rollback();
705 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"mailing ";
706 $sql .=
" SET statut = 1, date_valid = '".$this->db->idate($now).
"', fk_user_valid=".$user->id;
707 $sql .=
" WHERE rowid = ".((int) $this->
id);
710 if ($this->db->query($sql)) {
713 $this->error = $this->db->lasterror();
728 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"mailing ";
729 $sql .=
" SET statut = 0, tms = '".$this->db->idate($now).
"', fk_user_modif=".$user->id;
730 $sql .=
" WHERE rowid = ".((int) $this->
id);
733 if ($this->db->query($sql)) {
736 $this->error = $this->db->lasterror();
748 public function delete($user, $notrigger = 0)
755 $result = $this->call_trigger(
'MAILING_DELETE', $user);
762 $sql =
"DELETE FROM " . MAIN_DB_PREFIX .
"mailing";
763 $sql .=
" WHERE rowid = " . ((int) $this->
id);
766 $resql = $this->db->query($sql);
778 $this->db->rollback();
779 dol_syslog(__METHOD__ .
' ' . $this->error, LOG_ERR);
783 $this->db->rollback();
784 $this->error = $this->db->lasterror();
788 $this->db->rollback();
802 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"mailing_cibles";
803 $sql .=
" WHERE fk_mailing = ".((int) $this->
id);
805 dol_syslog(
"Mailing::delete_targets", LOG_DEBUG);
806 $resql = $this->db->query($sql);
812 $this->error = $this->db->lasterror();
828 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"mailing_cibles";
829 $sql .=
" SET statut = 0";
830 $sql .=
" WHERE fk_mailing = ".((int) $this->
id);
832 dol_syslog(
"Mailing::reset_targets_status", LOG_DEBUG);
833 $resql = $this->db->query($sql);
837 $this->error = $this->db->lasterror();
854 $sql =
"SELECT email, statut FROM ".MAIN_DB_PREFIX.
"mailing_cibles";
855 $sql .=
" WHERE fk_mailing = ".((int) $this->
id);
856 $sql .=
" AND rowid = ".((int) $id);
857 $resql = $this->db->query($sql);
859 $nb = $this->db->num_rows($resql);
860 $obj = $this->db->fetch_object($resql);
861 if ($obj->statut != -1) {
862 $langs->load(
"errors");
863 $this->error = $langs->trans(
'ErrorIsNotInError', $obj->email);
867 $this->error = $this->db->lasterror();
870 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"mailing_cibles";
871 $sql .=
" SET statut = 0";
872 $sql .=
" WHERE fk_mailing = ".((int) $this->
id);
873 $sql .=
" AND rowid = ".((int) $id);
874 $sql .=
" AND statut = -1";
876 dol_syslog(
"Mailing::reset_targets_status", LOG_DEBUG);
877 $resql = $this->db->query($sql);
881 $this->error = $this->db->lasterror();
894 $sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"mailing_cibles";
895 $sql .=
" WHERE fk_mailing = ".((int) $this->
id);
896 if ($mode ==
'alreadysent') {
897 $sql .=
" AND statut <> 0";
898 } elseif ($mode ==
'alreadysentok') {
899 $sql .=
" AND statut > 0";
900 } elseif ($mode ==
'alreadysentko') {
901 $sql .=
" AND statut = -1";
902 } elseif ($mode ==
'all') {
905 $this->error =
'BadValueForParameterMode';
909 $resql = $this->db->query($sql);
911 $obj = $this->db->fetch_object($resql);
916 $this->error = $this->db->lasterror();
930 $sql =
"SELECT COUNT(rowid) as nb";
931 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles";
932 $sql .=
" WHERE fk_mailing = ".((int) $this->
id);
934 $resql = $this->db->query($sql);
936 $obj = $this->db->fetch_object($resql);
938 $nbforupdate = $obj->nb;
940 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'mailing SET nbemail = '.((int) $nbforupdate);
941 $sql .=
' WHERE rowid = '.((int) $this->
id);
943 $resqlupdate = $this->db->query($sql);
944 if (! $resqlupdate) {
945 $this->error = $this->db->lasterror();
948 $this->nbemail = (int) $nbforupdate;
952 $this->error = $this->db->lasterror();
970 $langs->load(
'mails');
973 $datas[
'picto'] =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"ShowEMailing").
'</u>';
974 if (isset($this->
status)) {
975 $datas[
'picto'] .=
' '.$this->getLibStatut(5);
977 $datas[
'ref'] =
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
978 if (isset($this->title)) {
979 $datas[
'title'] =
'<br><b>'.$langs->trans(
'MailTitle').
':</b> '.$this->title;
981 if (isset($this->sujet)) {
982 $datas[
'subject'] =
'<br><b>'.$langs->trans(
'MailTopic').
':</b> '.$this->sujet;
998 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
1000 global
$conf, $langs, $hookmanager;
1002 if (!empty(
$conf->dol_no_mouse_hover)) {
1009 'objecttype' => $this->element,
1010 'option' => $option,
1013 $classfortooltip =
'classfortooltip';
1016 $classfortooltip =
'classforajaxtooltip';
1017 $dataparams =
' data-params="'.dol_escape_htmltag(json_encode($params)).
'"';
1023 $url = DOL_URL_ROOT.
'/comm/mailing/card.php?id='.$this->id;
1025 if ($option !=
'nolink') {
1027 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
1028 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
1029 $add_save_lastsearch_values = 1;
1031 if ($add_save_lastsearch_values) {
1032 $url .=
'&save_lastsearch_values=1';
1037 if (empty($notooltip)) {
1039 $label = $langs->trans(
"ShowEMailing");
1040 $linkclose .=
' alt="'.dolPrintHTMLForAttribute($label).
'"';
1042 $linkclose .= ($label ?
' title="'.dolPrintHTMLForAttribute($label).
'"' :
' title="tocomplete"');
1043 $linkclose .= $dataparams.
' class="'.$classfortooltip.($morecss ?
' '.$morecss :
'').
'"';
1045 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
1048 $linkstart =
'<a href="'.$url.
'"';
1049 $linkstart .= $linkclose.
'>';
1052 $result .= $linkstart;
1054 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), (($withpicto != 2) ?
'class="paddingright"' :
''), 0, 0, $notooltip ? 0 : 1);
1056 if ($withpicto != 2) {
1057 $result .= $this->ref;
1059 $result .= $linkend;
1063 $hookmanager->initHooks(array(
'emailingdao'));
1064 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
1065 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
1067 $result = $hookmanager->resPrint;
1069 $result .= $hookmanager->resPrint;
1098 $langs->load(
"mailing");
1100 $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]);
1101 $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatus[$status]);
1103 $statusType =
'status'.$status;
1105 $statusType =
'status3';
1108 $statusType =
'status6';
1111 return dolGetStatus($labelStatus, $labelStatusShort,
'', $statusType, $mode);
1127 $langs->load(
"mails");
1129 $labelStatus = array();
1130 $labelStatusShort = array();
1132 $labelStatus[-1] = $langs->transnoentitiesnoconv(
'MailingStatusError');
1133 $labelStatus[0] = $langs->transnoentitiesnoconv(
'MailingStatusNotSent');
1134 $labelStatus[1] = $langs->transnoentitiesnoconv(
'MailingStatusSent');
1135 $labelStatus[2] = $langs->transnoentitiesnoconv(
'MailingStatusRead');
1136 $labelStatus[3] = $langs->transnoentitiesnoconv(
'MailingStatusNotContact');
1137 $labelStatusShort[-1] = $langs->transnoentitiesnoconv(
'MailingStatusError');
1138 $labelStatusShort[0] = $langs->transnoentitiesnoconv(
'MailingStatusNotSent');
1139 $labelStatusShort[1] = $langs->transnoentitiesnoconv(
'MailingStatusSent');
1140 $labelStatusShort[2] = $langs->transnoentitiesnoconv(
'MailingStatusRead');
1141 $labelStatusShort[3] = $langs->transnoentitiesnoconv(
'MailingStatusNotContact');
1143 $statusType =
'status'.$status;
1144 if ($status == -1) {
1145 $statusType =
'status8';
1148 $statusType =
'status6';
1151 $statusType =
'status4';
1155 if ($status == -1) {
1156 $param = array(
'badgeParams' => array(
'attr' => array(
'title' => $desc)));
1159 return dolGetStatus($labelStatus[$status], $labelStatusShort[$status],
'', $statusType, $mode,
'', $param);
if(! $sortfield) if(! $sortorder) $object
Parent class of all other business classes (invoices, contracts, proposals, orders,...
setErrorsFromObject($object)
setErrorsFromObject
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
Class to manage emailings module.
static libStatutDest($status, $mode=0, $desc='')
Return the label of a given status of a recipient TODO Add class mailin_target.class....
getLibStatut($mode=0)
Return label of status of emailing (draft, validated, ...)
delete_targets()
Delete targets emailing.
valid($user)
Validate emailing.
countNbOfTargets($mode)
Count number of target with status.
create($user, $notrigger=0)
Create an EMailing.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Load list of objects in memory from the database.
setDraft($user)
SetDraft emailing.
fetch($rowid, $ref='')
Get object from database.
getTooltipContentArray($params)
getTooltipContentArray
__construct($db)
Constructor.
update($user, $notrigger=0)
Update emailing record.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
refreshNbOfTargets()
Refresh denormalized value ->nbemail into emailing record Note: There is also the method update_nb in...
reset_targets_status($user)
Change status of each recipient.
resetTargetErrorStatus($user, $id)
Reset status of a specific recipient in error.
createFromClone(User $user, $fromid, $option1, $option2, $notrigger=0)
Load an object from its id and create a new one in database.
LibStatut($status, $mode=0)
Return the label of a given status.
Parent class of emailing target selectors modules.
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dol_html_entity_decode($a, $b, $c='UTF-8', $keepsomeentities=0)
Replace html_entity_decode functions to manage errors.
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_textishtml($msg, $option=0)
Return if a text is a html content.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.