dolibarr 19.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
26require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27
28
32class 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 $evenunsubscribe;
68
72 public $nbemail;
73
77 public $bgcolor;
78
82 public $bgimage;
83
87 public $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely
88
92 public $email_from;
93
97 public $sendto;
98
102 public $email_replyto;
103
107 public $email_errorsto;
108
112 public $joined_file1;
113
117 public $joined_file2;
118
122 public $joined_file3;
123
127 public $joined_file4;
128
133 public $user_creation;
134
139 public $user_creat;
140
145 public $user_validation;
146
151 public $user_valid;
152
157 public $date_creat;
158
162 public $date_creation;
163
168 public $date_valid;
169
173 public $date_validation;
174
178 public $date_envoi;
179
183 public $extraparams = array();
184
188 public $statut_dest = array();
189
193 public $labelStatus = array();
194
198 public $substitutionarray;
199
203 public $substitutionarrayfortest;
204
205 const STATUS_DRAFT = 0;
206 const STATUS_VALIDATED = 1;
207 const STATUS_SENTPARTIALY = 2;
208 const STATUS_SENTCOMPLETELY = 3;
209
210
216 public function __construct($db)
217 {
218 global $langs;
219
220 $this->db = $db;
221
222 // List of language codes for status
223 $this->labelStatus[0] = 'MailingStatusDraft';
224 $this->labelStatus[1] = 'MailingStatusValidated';
225 $this->labelStatus[2] = 'MailingStatusSentPartialy';
226 $this->labelStatus[3] = 'MailingStatusSentCompletely';
227
228 $this->statut_dest[0] = 'MailingStatusNotSent';
229 $this->statut_dest[1] = 'MailingStatusSent';
230 $this->statut_dest[2] = 'MailingStatusRead';
231 $this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore
232 $this->statut_dest[-1] = 'MailingStatusError';
233 }
234
242 public function create($user, $notrigger = 0)
243 {
244 global $conf, $langs;
245
246 // Check properties
247 if (preg_match('/^InvalidHTMLStringCantBeCleaned/', $this->body)) {
248 $this->error = 'InvalidHTMLStringCantBeCleaned';
249 return -1;
250 }
251
252 $this->title = trim($this->title);
253 $this->email_from = trim($this->email_from);
254
255 if (!$this->email_from) {
256 $this->error = $langs->trans("ErrorMailFromRequired");
257 return -1;
258 }
259
260 $error = 0;
261 $now = dol_now();
262 $this->db->begin();
263
264 $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing";
265 $sql .= " (date_creat, fk_user_creat, entity)";
266 $sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", ".((int) $conf->entity).")";
267
268 if (!$this->title) {
269 $this->title = $langs->trans("NoTitle");
270 }
271
272 dol_syslog(__METHOD__, LOG_DEBUG);
273 $resql = $this->db->query($sql);
274 if ($resql) {
275 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mailing");
276
277 $result = $this->update($user, 1);
278 if ($result < 0) {
279 $error++;
280 }
281
282 if (!$error && !$notrigger) {
283 // Call trigger
284 $result = $this->call_trigger('MAILING_CREATE', $user);
285 if ($result < 0) {
286 $error++;
287 }
288 // End call triggers
289 }
290
291 if (!$error) {
292 $this->db->commit();
293 return $this->id;
294 } else {
295 $this->db->rollback();
296 dol_syslog(__METHOD__ . ' ' . $this->error, LOG_ERR);
297 return -2;
298 }
299 } else {
300 $this->error = $this->db->lasterror();
301 $this->db->rollback();
302 return -1;
303 }
304 }
305
313 public function update($user, $notrigger = 0)
314 {
315 // Check properties
316 if (preg_match('/^InvalidHTMLStringCantBeCleaned/', $this->body)) {
317 $this->error = 'InvalidHTMLStringCantBeCleaned';
318 return -1;
319 }
320
321 $error = 0;
322 $this->db->begin();
323
324 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
325 $sql .= " SET titre = '".$this->db->escape($this->title)."'";
326 $sql .= ", sujet = '".$this->db->escape($this->sujet)."'";
327 $sql .= ", body = '".$this->db->escape($this->body)."'";
328 $sql .= ", email_from = '".$this->db->escape($this->email_from)."'";
329 $sql .= ", email_replyto = '".$this->db->escape($this->email_replyto)."'";
330 $sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'";
331 $sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'";
332 $sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'";
333 $sql .= ", evenunsubscribe = ".((int) $this->evenunsubscribe);
334 $sql .= " WHERE rowid = ".(int) $this->id;
335
336 dol_syslog(__METHOD__, LOG_DEBUG);
337 $resql = $this->db->query($sql);
338 if ($resql) {
339 if (!$error && !$notrigger) {
340 // Call trigger
341 $result = $this->call_trigger('MAILING_MODIFY', $user);
342 if ($result < 0) {
343 $error++;
344 }
345 // End call triggers
346 }
347
348 if (!$error) {
349 dol_syslog(__METHOD__ . ' success');
350 $this->db->commit();
351 return 1;
352 } else {
353 $this->db->rollback();
354 dol_syslog(__METHOD__ . ' ' . $this->error, LOG_ERR);
355 return -2;
356 }
357 } else {
358 $this->error = $this->db->lasterror();
359 $this->db->rollback();
360 return -1;
361 }
362 }
363
371 public function fetch($rowid, $ref = '')
372 {
373 global $conf;
374
375 $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe";
376 $sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
377 $sql .= ", m.statut, m.nbemail";
378 $sql .= ", m.fk_user_creat, m.fk_user_valid";
379 $sql .= ", m.date_creat";
380 $sql .= ", m.date_valid";
381 $sql .= ", m.date_envoi";
382 $sql .= ", m.extraparams";
383 $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
384 $sql .= " WHERE entity IN (".getEntity('mailing').")";
385 if ($ref) {
386 $sql .= " AND m.titre = '".$this->db->escape($ref)."'";
387 } else {
388 $sql .= " AND m.rowid = ".(int) $rowid;
389 }
390
391 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
392 $result = $this->db->query($sql);
393 if ($result) {
394 if ($this->db->num_rows($result)) {
395 $obj = $this->db->fetch_object($result);
396
397 $this->id = $obj->rowid;
398 $this->ref = $obj->rowid;
399 $this->statut = $obj->statut;
400 $this->nbemail = $obj->nbemail;
401 $this->title = $obj->title;
402
403 $this->sujet = $obj->sujet;
404 if (getDolGlobalString('FCKEDITOR_ENABLE_MAILING') && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5))) {
405 $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5);
406 } else {
407 $this->body = $obj->body;
408 }
409
410 $this->bgcolor = $obj->bgcolor;
411 $this->bgimage = $obj->bgimage;
412 $this->evenunsubscribe = $obj->evenunsubscribe;
413
414 $this->email_from = $obj->email_from;
415 $this->email_replyto = $obj->email_replyto;
416 $this->email_errorsto = $obj->email_errorsto;
417
418 $this->user_creation_id = $obj->fk_user_creat;
419 $this->user_validation_id = $obj->fk_user_valid;
420
421 $this->date_creat = $this->db->jdate($obj->date_creat);
422 $this->date_creation = $this->db->jdate($obj->date_creat);
423 $this->date_valid = $this->db->jdate($obj->date_valid);
424 $this->date_validation = $this->db->jdate($obj->date_valid);
425 $this->date_envoi = $this->db->jdate($obj->date_envoi);
426
427 $this->extraparams = (array) json_decode($obj->extraparams, true);
428
429 return 1;
430 } else {
431 dol_syslog(get_class($this)."::fetch Erreur -1");
432 return -1;
433 }
434 } else {
435 dol_syslog(get_class($this)."::fetch Erreur -2");
436 return -2;
437 }
438 }
439
440
450 public function createFromClone(User $user, $fromid, $option1, $option2)
451 {
452 global $langs;
453
454 $error = 0;
455
456 $object = new Mailing($this->db);
457
458 $this->db->begin();
459
460 // Load source object
461 $object->fetch($fromid);
462 $object->id = 0;
463 $object->statut = 0;
464
465 // Clear fields
466 $object->title = $langs->trans("CopyOf").' '.$object->title.' '.dol_print_date(dol_now());
467
468 // If no option copy content
469 if (empty($option1)) {
470 // Clear values
471 $object->nbemail = 0;
472 $object->sujet = '';
473 $object->body = '';
474 $object->bgcolor = '';
475 $object->bgimage = '';
476 $object->evenunsubscribe = 0;
477
478 //$object->email_from = ''; // We do not reset from email because it is a mandatory value
479 $object->email_replyto = '';
480 $object->email_errorsto = '';
481
482 $object->user_creation_id = $user->id;
483 $object->user_validation_id = '';
484
485 $object->date_creat = '';
486 $object->date_valid = '';
487 $object->date_envoi = '';
488 }
489
490 // Create clone
491 $object->context['createfromclone'] = 'createfromclone';
492 $result = $object->create($user);
493
494 // Other options
495 if ($result < 0) {
496 $this->error = $object->error;
497 $this->errors = array_merge($this->errors, $object->errors);
498 $error++;
499 }
500
501 if (!$error) {
502 // Clone recipient targets
503 if (!empty($option2)) {
504 require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
505
506 $mailing_target = new MailingTargets($this->db);
507
508 $target_array = array();
509
510 $sql = "SELECT fk_contact,";
511 $sql .= " lastname,";
512 $sql .= " firstname,";
513 $sql .= " email,";
514 $sql .= " other,";
515 $sql .= " source_url,";
516 $sql .= " source_id ,";
517 $sql .= " source_type";
518 $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles";
519 $sql .= " WHERE fk_mailing = ".((int) $fromid);
520
521 $result = $this->db->query($sql);
522 if ($result) {
523 if ($this->db->num_rows($result)) {
524 while ($obj = $this->db->fetch_object($result)) {
525 $target_array[] = array(
526 'fk_contact'=>$obj->fk_contact,
527 'lastname'=>$obj->lastname,
528 'firstname'=>$obj->firstname,
529 'email'=>$obj->email,
530 'other'=>$obj->other,
531 'source_url'=>$obj->source_url,
532 'source_id'=>$obj->source_id,
533 'source_type'=>$obj->source_type
534 );
535 }
536 }
537 } else {
538 $this->error = $this->db->lasterror();
539 return -1;
540 }
541
542 $mailing_target->addTargetsToDatabase($object->id, $target_array);
543 }
544 }
545
546 unset($object->context['createfromclone']);
547
548 // End
549 if (!$error) {
550 $this->db->commit();
551 return $object->id;
552 } else {
553 $this->db->rollback();
554 return -1;
555 }
556 }
557
564 public function valid($user)
565 {
566 $now = dol_now();
567
568 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
569 $sql .= " SET statut = 1, date_valid = '".$this->db->idate($now)."', fk_user_valid=".$user->id;
570 $sql .= " WHERE rowid = ".((int) $this->id);
571
572 dol_syslog("Mailing::valid", LOG_DEBUG);
573 if ($this->db->query($sql)) {
574 return 1;
575 } else {
576 $this->error = $this->db->lasterror();
577 return -1;
578 }
579 }
580
581
589 public function delete($user, $notrigger = 0)
590 {
591 $error = 0;
592
593 $this->db->begin();
594
595 if (!$notrigger) {
596 $result = $this->call_trigger('MAILING_DELETE', $user);
597 if ($result < 0) {
598 $error++;
599 }
600 }
601
602 if (!$error) {
603 $sql = "DELETE FROM " . MAIN_DB_PREFIX . "mailing";
604 $sql .= " WHERE rowid = " . ((int) $this->id);
605
606 dol_syslog(__METHOD__, LOG_DEBUG);
607 $resql = $this->db->query($sql);
608 if ($resql) {
609 $res = $this->delete_targets();
610 if ($res <= 0) {
611 $error++;
612 }
613
614 if (!$error) {
615 dol_syslog(__METHOD__ . ' success');
616 $this->db->commit();
617 return 1;
618 } else {
619 $this->db->rollback();
620 dol_syslog(__METHOD__ . ' ' . $this->error, LOG_ERR);
621 return -2;
622 }
623 } else {
624 $this->db->rollback();
625 $this->error = $this->db->lasterror();
626 return -1;
627 }
628 } else {
629 $this->db->rollback();
630 return -1;
631 }
632 }
633
634 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
640 public function delete_targets()
641 {
642 // phpcs:enable
643 $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
644 $sql .= " WHERE fk_mailing = ".((int) $this->id);
645
646 dol_syslog("Mailing::delete_targets", LOG_DEBUG);
647 $resql = $this->db->query($sql);
648 if ($resql) {
649 $this->refreshNbOfTargets();
650
651 return 1;
652 } else {
653 $this->error = $this->db->lasterror();
654 return 0;
655 }
656 }
657
658
659 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
666 public function reset_targets_status($user)
667 {
668 // phpcs:enable
669 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
670 $sql .= " SET statut = 0";
671 $sql .= " WHERE fk_mailing = ".((int) $this->id);
672
673 dol_syslog("Mailing::reset_targets_status", LOG_DEBUG);
674 $resql = $this->db->query($sql);
675 if ($resql) {
676 return 1;
677 } else {
678 $this->error = $this->db->lasterror();
679 return -1;
680 }
681 }
682
683
690 public function countNbOfTargets($mode)
691 {
692 $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
693 $sql .= " WHERE fk_mailing = ".((int) $this->id);
694 if ($mode == 'alreadysent') {
695 $sql .= " AND statut <> 0";
696 } elseif ($mode == 'alreadysentok') {
697 $sql .= " AND statut > 0";
698 } elseif ($mode == 'alreadysentko') {
699 $sql .= " AND statut = -1";
700 } else {
701 $this->error = 'BadValueForParameterMode';
702 return -2;
703 }
704
705 $resql = $this->db->query($sql);
706 if ($resql) {
707 $obj = $this->db->fetch_object($resql);
708 if ($obj) {
709 return $obj->nb;
710 }
711 } else {
712 $this->error = $this->db->lasterror();
713 return -1;
714 }
715 return 0;
716 }
717
724 public function refreshNbOfTargets()
725 {
726 $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
727 $sql .= " WHERE fk_mailing = ".((int) $this->id);
728
729 $resql = $this->db->query($sql);
730 if ($resql) {
731 $obj = $this->db->fetch_object($resql);
732 if ($obj) {
733 $nbforupdate = $obj->nb;
734
735 $sql = 'UPDATE '.MAIN_DB_PREFIX.'mailing SET nbemail = '.((int) $nbforupdate);
736 $sql .= ' WHERE rowid = '.((int) $this->id);
737
738 $resqlupdate = $this->db->query($sql);
739 if (! $resqlupdate) {
740 $this->error = $this->db->lasterror();
741 return -1;
742 } else {
743 $this->nbemail = (int) $nbforupdate;
744 }
745 }
746 } else {
747 $this->error = $this->db->lasterror();
748 return -1;
749 }
750
751 return 1;
752 }
753
761 public function getTooltipContentArray($params)
762 {
763 global $conf, $langs;
764
765 $nofetch = !empty($params['nofetch']);
766 $langs->load('mails');
767
768 $datas = array();
769 $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ShowEMailing").'</u>';
770 if (isset($this->statut)) {
771 $datas['picto'] .= ' '.$this->getLibStatut(5);
772 }
773 $datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
774 if (isset($this->title)) {
775 $datas['title'] .= '<br><b>'.$langs->trans('MailTitle').':</b> '.$this->title;
776 }
777 if (isset($this->sujet)) {
778 $datas['subject'] .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->sujet;
779 }
780
781 return $datas;
782 }
783
794 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
795 {
796 global $conf, $langs, $hookmanager;
797
798 if (!empty($conf->dol_no_mouse_hover)) {
799 $notooltip = 1; // Force disable tooltips
800 }
801
802 $result = '';
803 $params = [
804 'id' => $this->id,
805 'objecttype' => $this->element,
806 'option' => $option,
807 'nofetch' => 1,
808 ];
809 $classfortooltip = 'classfortooltip';
810 $dataparams = '';
811 if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
812 $classfortooltip = 'classforajaxtooltip';
813 $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
814 $label = '';
815 } else {
816 $label = implode($this->getTooltipContentArray($params));
817 }
818
819 $url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id;
820
821 if ($option != 'nolink') {
822 // Add param to save lastsearch_values or not
823 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
824 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
825 $add_save_lastsearch_values = 1;
826 }
827 if ($add_save_lastsearch_values) {
828 $url .= '&save_lastsearch_values=1';
829 }
830 }
831
832 $linkclose = '';
833 if (empty($notooltip)) {
834 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
835 $label = $langs->trans("ShowEMailing");
836 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
837 }
838 $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
839 $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
840 } else {
841 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
842 }
843
844 $linkstart = '<a href="'.$url.'"';
845 $linkstart .= $linkclose.'>';
846 $linkend = '</a>';
847
848 $result .= $linkstart;
849 if ($withpicto) {
850 $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (($withpicto != 2) ? 'class="paddingright"' : ''), 0, 0, $notooltip ? 0 : 1);
851 }
852 if ($withpicto != 2) {
853 $result .= $this->ref;
854 }
855 $result .= $linkend;
856 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
857
858 global $action;
859 $hookmanager->initHooks(array('emailingdao'));
860 $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
861 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
862 if ($reshook > 0) {
863 $result = $hookmanager->resPrint;
864 } else {
865 $result .= $hookmanager->resPrint;
866 }
867
868 return $result;
869 }
870
877 public function getLibStatut($mode = 0)
878 {
879 return $this->LibStatut($this->statut, $mode);
880 }
881
882 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
890 public function LibStatut($status, $mode = 0)
891 {
892 // phpcs:enable
893 global $langs;
894 $langs->load("mailing");
895
896 $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]);
897 $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatus[$status]);
898
899 $statusType = 'status'.$status;
900 if ($status == 2) {
901 $statusType = 'status3';
902 }
903 if ($status == 3) {
904 $statusType = 'status6';
905 }
906
907 return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
908 }
909
910
920 public static function libStatutDest($status, $mode = 0, $desc = '')
921 {
922 global $langs;
923 $langs->load("mails");
924
925 $labelStatus = array();
926 $labelStatusShort = array();
927
928 $labelStatus[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
929 $labelStatus[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
930 $labelStatus[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
931 $labelStatus[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
932 $labelStatus[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
933 $labelStatusShort[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
934 $labelStatusShort[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
935 $labelStatusShort[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
936 $labelStatusShort[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
937 $labelStatusShort[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
938
939 $statusType = 'status'.$status;
940 if ($status == -1) {
941 $statusType = 'status8';
942 }
943 if ($status == 1) {
944 $statusType = 'status6';
945 }
946 if ($status == 2) {
947 $statusType = 'status4';
948 }
949
950 $param = array();
951 if ($status == - 1) {
952 $param = array('badgeParams'=>array('attr'=>array('title'=>$desc)));
953 }
954 return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode, '', $param);
955 }
956}
$object ref
Definition info.php:79
Parent class of all other business classes (invoices, contracts, proposals, orders,...
call_trigger($triggerName, $user)
Call trigger based on this instance.
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.
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)
createFromClone(User $user, $fromid, $option1, $option2)
Load an object from its id and create a new one in database.
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.
LibStatut($status, $mode=0)
Return the label of a given status.
Parent class of emailing target selectors modules.
Class to manage Dolibarr users.
dol_html_entity_decode($a, $b, $c='UTF-8', $keepsomeentities=0)
Replace html_entity_decode functions to manage errors.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_textishtml($msg, $option=0)
Return if a text is a html content.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e e e e e statut
Definition invoice.php:1907