dolibarr  17.0.3
mailing.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
26 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27 
28 
32 class Mailing extends CommonObject
33 {
37  public $element = 'mailing';
38 
42  public $table_element = 'mailing';
43 
47  public $picto = 'email';
48 
52  public $title;
53 
57  public $sujet;
58 
62  public $body;
63 
67  public $nbemail;
68 
72  public $bgcolor;
73 
77  public $bgimage;
78 
82  public $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely
83 
87  public $email_from;
88 
92  public $sendto;
93 
97  public $email_replyto;
98 
102  public $email_errorsto;
103 
107  public $joined_file1;
108 
112  public $joined_file2;
113 
117  public $joined_file3;
118 
122  public $joined_file4;
123 
127  public $user_creation;
128 
133  public $user_creat;
134 
138  public $user_validation;
139 
144  public $user_valid;
145 
150  public $date_creat;
151 
155  public $date_creation;
156 
161  public $date_valid;
162 
166  public $date_validation;
167 
171  public $extraparams = array();
172 
176  public $statut_dest = array();
177 
181  public $statuts = array();
182 
186  public $substitutionarray;
187 
191  public $substitutionarrayfortest;
192 
193 
199  public function __construct($db)
200  {
201  $this->db = $db;
202 
203  // List of language codes for status
204  $this->statuts[0] = 'MailingStatusDraft';
205  $this->statuts[1] = 'MailingStatusValidated';
206  $this->statuts[2] = 'MailingStatusSentPartialy';
207  $this->statuts[3] = 'MailingStatusSentCompletely';
208 
209  $this->statut_dest[-1] = 'MailingStatusError';
210  $this->statut_dest[0] = 'MailingStatusNotSent';
211  $this->statut_dest[1] = 'MailingStatusSent';
212  $this->statut_dest[2] = 'MailingStatusRead';
213  $this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore
214  }
215 
222  public function create($user)
223  {
224  global $conf, $langs;
225 
226  // Check properties
227  if ($this->body === 'InvalidHTMLString') {
228  $this->error = 'InvalidHTMLString';
229  return -1;
230  }
231 
232  $this->db->begin();
233 
234  $this->title = trim($this->title);
235  $this->email_from = trim($this->email_from);
236 
237  if (!$this->email_from) {
238  $this->error = $langs->trans("ErrorMailFromRequired");
239  return -1;
240  }
241 
242  $now = dol_now();
243 
244  $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing";
245  $sql .= " (date_creat, fk_user_creat, entity)";
246  $sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", ".((int) $conf->entity).")";
247 
248  if (!$this->title) {
249  $this->title = $langs->trans("NoTitle");
250  }
251 
252  dol_syslog("Mailing::Create", LOG_DEBUG);
253  $result = $this->db->query($sql);
254  if ($result) {
255  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mailing");
256 
257  if ($this->update($user) > 0) {
258  $this->db->commit();
259  } else {
260  $this->error = $this->db->lasterror();
261  $this->db->rollback();
262  return -1;
263  }
264 
265  return $this->id;
266  } else {
267  $this->error = $this->db->lasterror();
268  $this->db->rollback();
269  return -1;
270  }
271  }
272 
279  public function update($user)
280  {
281  // Check properties
282  if ($this->body === 'InvalidHTMLString') {
283  $this->error = 'InvalidHTMLString';
284  return -1;
285  }
286 
287  $sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
288  $sql .= " SET titre = '".$this->db->escape($this->title)."'";
289  $sql .= ", sujet = '".$this->db->escape($this->sujet)."'";
290  $sql .= ", body = '".$this->db->escape($this->body)."'";
291  $sql .= ", email_from = '".$this->db->escape($this->email_from)."'";
292  $sql .= ", email_replyto = '".$this->db->escape($this->email_replyto)."'";
293  $sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'";
294  $sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'";
295  $sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'";
296  $sql .= " WHERE rowid = ".(int) $this->id;
297 
298  dol_syslog("Mailing::Update", LOG_DEBUG);
299  $result = $this->db->query($sql);
300  if ($result) {
301  return 1;
302  } else {
303  $this->error = $this->db->lasterror();
304  return -1;
305  }
306  }
307 
314  public function fetch($rowid)
315  {
316  global $conf;
317 
318  $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage";
319  $sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
320  $sql .= ", m.statut, m.nbemail";
321  $sql .= ", m.fk_user_creat, m.fk_user_valid";
322  $sql .= ", m.date_creat";
323  $sql .= ", m.date_valid";
324  $sql .= ", m.date_envoi";
325  $sql .= ", m.extraparams";
326  $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
327  $sql .= " WHERE m.rowid = ".(int) $rowid;
328 
329  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
330  $result = $this->db->query($sql);
331  if ($result) {
332  if ($this->db->num_rows($result)) {
333  $obj = $this->db->fetch_object($result);
334 
335  $this->id = $obj->rowid;
336  $this->ref = $obj->rowid;
337  $this->statut = $obj->statut;
338  $this->nbemail = $obj->nbemail;
339  $this->title = $obj->title;
340 
341  $this->sujet = $obj->sujet;
342  if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5))) {
343  $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5);
344  } else {
345  $this->body = $obj->body;
346  }
347 
348  $this->bgcolor = $obj->bgcolor;
349  $this->bgimage = $obj->bgimage;
350 
351  $this->email_from = $obj->email_from;
352  $this->email_replyto = $obj->email_replyto;
353  $this->email_errorsto = $obj->email_errorsto;
354 
355  $this->user_creat = $obj->fk_user_creat;
356  $this->user_creation = $obj->fk_user_creat;
357  $this->user_valid = $obj->fk_user_valid;
358  $this->user_validation = $obj->fk_user_valid;
359 
360  $this->date_creat = $this->db->jdate($obj->date_creat);
361  $this->date_creation = $this->db->jdate($obj->date_creat);
362  $this->date_valid = $this->db->jdate($obj->date_valid);
363  $this->date_validation = $this->db->jdate($obj->date_valid);
364  $this->date_envoi = $this->db->jdate($obj->date_envoi);
365 
366  $this->extraparams = (array) json_decode($obj->extraparams, true);
367 
368  return 1;
369  } else {
370  dol_syslog(get_class($this)."::fetch Erreur -1");
371  return -1;
372  }
373  } else {
374  dol_syslog(get_class($this)."::fetch Erreur -2");
375  return -2;
376  }
377  }
378 
379 
389  public function createFromClone(User $user, $fromid, $option1, $option2)
390  {
391  global $langs;
392 
393  $error = 0;
394 
395  $object = new Mailing($this->db);
396 
397  $this->db->begin();
398 
399  // Load source object
400  $object->fetch($fromid);
401  $object->id = 0;
402  $object->statut = 0;
403 
404  // Clear fields
405  $object->title = $langs->trans("CopyOf").' '.$object->title.' '.dol_print_date(dol_now());
406 
407  // If no option copy content
408  if (empty($option1)) {
409  // Clear values
410  $object->nbemail = 0;
411  $object->sujet = '';
412  $object->body = '';
413  $object->bgcolor = '';
414  $object->bgimage = '';
415 
416  //$object->email_from = ''; // We do not reset from email because it is a mandatory value
417  $object->email_replyto = '';
418  $object->email_errorsto = '';
419 
420  $object->user_creat = $user->id;
421  $object->user_valid = '';
422 
423  $object->date_creat = '';
424  $object->date_valid = '';
425  $object->date_envoi = '';
426  }
427 
428  // Create clone
429  $object->context['createfromclone'] = 'createfromclone';
430  $result = $object->create($user);
431 
432  // Other options
433  if ($result < 0) {
434  $this->error = $object->error;
435  $this->errors = array_merge($this->errors, $object->errors);
436  $error++;
437  }
438 
439  if (!$error) {
440  // Clone recipient targets
441  if (!empty($option2)) {
442  require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
443 
444  $mailing_target = new MailingTargets($this->db);
445 
446  $target_array = array();
447 
448  $sql = "SELECT fk_contact,";
449  $sql .= " lastname,";
450  $sql .= " firstname,";
451  $sql .= " email,";
452  $sql .= " other,";
453  $sql .= " source_url,";
454  $sql .= " source_id ,";
455  $sql .= " source_type";
456  $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles";
457  $sql .= " WHERE fk_mailing = ".((int) $fromid);
458 
459  $result = $this->db->query($sql);
460  if ($result) {
461  if ($this->db->num_rows($result)) {
462  while ($obj = $this->db->fetch_object($result)) {
463  $target_array[] = array(
464  'fk_contact'=>$obj->fk_contact,
465  'lastname'=>$obj->lastname,
466  'firstname'=>$obj->firstname,
467  'email'=>$obj->email,
468  'other'=>$obj->other,
469  'source_url'=>$obj->source_url,
470  'source_id'=>$obj->source_id,
471  'source_type'=>$obj->source_type
472  );
473  }
474  }
475  } else {
476  $this->error = $this->db->lasterror();
477  return -1;
478  }
479 
480  $mailing_target->addTargetsToDatabase($object->id, $target_array);
481  }
482  }
483 
484  unset($object->context['createfromclone']);
485 
486  // End
487  if (!$error) {
488  $this->db->commit();
489  return $object->id;
490  } else {
491  $this->db->rollback();
492  return -1;
493  }
494  }
495 
502  public function valid($user)
503  {
504  $now = dol_now();
505 
506  $sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
507  $sql .= " SET statut = 1, date_valid = '".$this->db->idate($now)."', fk_user_valid=".$user->id;
508  $sql .= " WHERE rowid = ".((int) $this->id);
509 
510  dol_syslog("Mailing::valid", LOG_DEBUG);
511  if ($this->db->query($sql)) {
512  return 1;
513  } else {
514  $this->error = $this->db->lasterror();
515  return -1;
516  }
517  }
518 
519 
527  public function delete($rowid, $notrigger = 0)
528  {
529  global $user;
530 
531  $this->db->begin();
532 
533  $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
534  $sql .= " WHERE rowid = ".((int) $rowid);
535 
536  dol_syslog("Mailing::delete", LOG_DEBUG);
537  $resql = $this->db->query($sql);
538  if ($resql) {
539  $res = $this->delete_targets();
540  if ($res <= 0) {
541  $this->db->rollback();
542  $this->error = $this->db->lasterror();
543  return -1;
544  }
545  } else {
546  $this->db->rollback();
547  $this->error = $this->db->lasterror();
548  return -1;
549  }
550 
551  if (!$notrigger) {
552  $result = $this->call_trigger('MAILING_DELETE', $user);
553  if ($result < 0) {
554  $this->db->rollback();
555  return -1;
556  }
557  }
558 
559  $this->db->commit();
560  return 1;
561  }
562 
563  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
569  public function delete_targets()
570  {
571  // phpcs:enable
572  $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
573  $sql .= " WHERE fk_mailing = ".((int) $this->id);
574 
575  dol_syslog("Mailing::delete_targets", LOG_DEBUG);
576  $resql = $this->db->query($sql);
577  if ($resql) {
578  $this->refreshNbOfTargets();
579 
580  return 1;
581  } else {
582  $this->error = $this->db->lasterror();
583  return 0;
584  }
585  }
586 
587 
588  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
595  public function reset_targets_status($user)
596  {
597  // phpcs:enable
598  $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
599  $sql .= " SET statut = 0";
600  $sql .= " WHERE fk_mailing = ".((int) $this->id);
601 
602  dol_syslog("Mailing::reset_targets_status", LOG_DEBUG);
603  $resql = $this->db->query($sql);
604  if ($resql) {
605  return 1;
606  } else {
607  $this->error = $this->db->lasterror();
608  return -1;
609  }
610  }
611 
612 
619  public function countNbOfTargets($mode)
620  {
621  $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
622  $sql .= " WHERE fk_mailing = ".((int) $this->id);
623  if ($mode == 'alreadysent') {
624  $sql .= " AND statut <> 0";
625  } elseif ($mode == 'alreadysentok') {
626  $sql .= " AND statut > 0";
627  } elseif ($mode == 'alreadysentko') {
628  $sql .= " AND statut = -1";
629  } else {
630  $this->error = 'BadValueForParameterMode';
631  return -2;
632  }
633 
634  $resql = $this->db->query($sql);
635  if ($resql) {
636  $obj = $this->db->fetch_object($resql);
637  if ($obj) {
638  return $obj->nb;
639  }
640  } else {
641  $this->error = $this->db->lasterror();
642  return -1;
643  }
644  return 0;
645  }
646 
653  public function refreshNbOfTargets()
654  {
655  $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
656  $sql .= " WHERE fk_mailing = ".((int) $this->id);
657 
658  $resql = $this->db->query($sql);
659  if ($resql) {
660  $obj = $this->db->fetch_object($resql);
661  if ($obj) {
662  $nbforupdate = $obj->nb;
663 
664  $sql = 'UPDATE '.MAIN_DB_PREFIX.'mailing SET nbemail = '.((int) $nbforupdate);
665  $sql .= ' WHERE rowid = '.((int) $this->id);
666 
667  $resqlupdate = $this->db->query($sql);
668  if (! $resqlupdate) {
669  $this->error = $this->db->lasterror();
670  return -1;
671  } else {
672  $this->nbemail = (int) $nbforupdate;
673  }
674  }
675  } else {
676  $this->error = $this->db->lasterror();
677  return -1;
678  }
679 
680  return 1;
681  }
682 
693  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
694  {
695  global $db, $conf, $langs, $hookmanager;
696  global $dolibarr_main_authentication, $dolibarr_main_demo;
697  global $menumanager;
698 
699  if (!empty($conf->dol_no_mouse_hover)) {
700  $notooltip = 1; // Force disable tooltips
701  }
702 
703  $result = '';
704  $companylink = '';
705 
706  $label = '<u>'.$langs->trans("ShowEMailing").'</u>';
707  $label .= '<br>';
708  $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
709 
710  $url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id;
711 
712  if ($option != 'nolink') {
713  // Add param to save lastsearch_values or not
714  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
715  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
716  $add_save_lastsearch_values = 1;
717  }
718  if ($add_save_lastsearch_values) {
719  $url .= '&save_lastsearch_values=1';
720  }
721  }
722 
723  $linkclose = '';
724  if (empty($notooltip)) {
725  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
726  $label = $langs->trans("ShowEMailing");
727  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
728  }
729  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
730  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
731  } else {
732  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
733  }
734 
735  $linkstart = '<a href="'.$url.'"';
736  $linkstart .= $linkclose.'>';
737  $linkend = '</a>';
738 
739  $result .= $linkstart;
740  if ($withpicto) {
741  $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
742  }
743  if ($withpicto != 2) {
744  $result .= $this->ref;
745  }
746  $result .= $linkend;
747  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
748 
749  global $action;
750  $hookmanager->initHooks(array('emailingdao'));
751  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
752  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
753  if ($reshook > 0) {
754  $result = $hookmanager->resPrint;
755  } else {
756  $result .= $hookmanager->resPrint;
757  }
758 
759  return $result;
760  }
761 
768  public function getLibStatut($mode = 0)
769  {
770  return $this->LibStatut($this->statut, $mode);
771  }
772 
773  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
781  public function LibStatut($status, $mode = 0)
782  {
783  // phpcs:enable
784  global $langs;
785  $langs->load("mailing");
786 
787  $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]);
788  $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts[$status]);
789 
790  $statusType = 'status'.$status;
791  if ($status == 2) {
792  $statusType = 'status3';
793  }
794  if ($status == 3) {
795  $statusType = 'status6';
796  }
797 
798  return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
799  }
800 
801 
811  public static function libStatutDest($status, $mode = 0, $desc = '')
812  {
813  global $langs;
814  $langs->load("mails");
815 
816  $labelStatus = array();
817  $labelStatusShort = array();
818 
819  $labelStatus[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
820  $labelStatus[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
821  $labelStatus[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
822  $labelStatus[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
823  $labelStatus[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
824  $labelStatusShort[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
825  $labelStatusShort[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
826  $labelStatusShort[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
827  $labelStatusShort[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
828  $labelStatusShort[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
829 
830  $statusType = 'status'.$status;
831  if ($status == -1) {
832  $statusType = 'status8';
833  }
834  if ($status == 1) {
835  $statusType = 'status6';
836  }
837  if ($status == 2) {
838  $statusType = 'status4';
839  }
840 
841  $param = array();
842  if ($status == - 1) {
843  $param = array('badgeParams'=>array('attr'=>array('title'=>$desc)));
844  }
845  return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode, '', $param);
846  }
847 }
db
$conf db
API class for accounts.
Definition: inc.php:41
ref
$object ref
Definition: info.php:78
Mailing\delete_targets
delete_targets()
Delete targets emailing.
Definition: mailing.class.php:569
MailingTargets
Parent class of emailing target selectors modules.
Definition: modules_mailings.php:32
Mailing\update
update($user)
Update emailing record.
Definition: mailing.class.php:279
CommonObject
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Definition: commonobject.class.php:44
Mailing\countNbOfTargets
countNbOfTargets($mode)
Count number of target with status.
Definition: mailing.class.php:619
Mailing\LibStatut
LibStatut($status, $mode=0)
Return the label of a given status.
Definition: mailing.class.php:781
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2550
Mailing\valid
valid($user)
Validate emailing.
Definition: mailing.class.php:502
Mailing
Class to manage emailings module.
Definition: mailing.class.php:32
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1628
Mailing\create
create($user)
Create an EMailing.
Definition: mailing.class.php:222
Mailing\refreshNbOfTargets
refreshNbOfTargets()
Refresh denormalized value ->nbemail into emailing record Note: There is also the method update_nb in...
Definition: mailing.class.php:653
Mailing\getNomUrl
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
Definition: mailing.class.php:693
Mailing\reset_targets_status
reset_targets_status($user)
Change status of each recipient.
Definition: mailing.class.php:595
User
Class to manage Dolibarr users.
Definition: user.class.php:46
Mailing\fetch
fetch($rowid)
Get object from database.
Definition: mailing.class.php:314
dol_html_entity_decode
dol_html_entity_decode($a, $b, $c='UTF-8', $keepsomeentities=0)
Replace html_entity_decode functions to manage errors.
Definition: functions.lib.php:7342
Mailing\__construct
__construct($db)
Constructor.
Definition: mailing.class.php:199
Mailing\libStatutDest
static libStatutDest($status, $mode=0, $desc='')
Return the label of a given status of a recipient TODO Add class mailin_target.class....
Definition: mailing.class.php:811
Mailing\getLibStatut
getLibStatut($mode=0)
Return label of status of emailing (draft, validated, ...)
Definition: mailing.class.php:768
Mailing\createFromClone
createFromClone(User $user, $fromid, $option1, $option2)
Load an object from its id and create a new one in database.
Definition: mailing.class.php:389
dolGetStatus
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
Definition: functions.lib.php:10745
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4360
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2951
CommonObject\call_trigger
call_trigger($triggerName, $user)
Call trigger based on this instance.
Definition: commonobject.class.php:5818
dol_textishtml
dol_textishtml($msg, $option=0)
Return if a text is a html content.
Definition: functions.lib.php:7475