dolibarr  x.y.z
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 
223  public function create($user, $notrigger = 0)
224  {
225  global $conf, $langs;
226 
227  // Check properties
228  if ($this->body === 'InvalidHTMLString') {
229  $this->error = 'InvalidHTMLString';
230  return -1;
231  }
232 
233  $this->title = trim($this->title);
234  $this->email_from = trim($this->email_from);
235 
236  if (!$this->email_from) {
237  $this->error = $langs->trans("ErrorMailFromRequired");
238  return -1;
239  }
240 
241  $error = 0;
242  $now = dol_now();
243  $this->db->begin();
244 
245  $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing";
246  $sql .= " (date_creat, fk_user_creat, entity)";
247  $sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", ".((int) $conf->entity).")";
248 
249  if (!$this->title) {
250  $this->title = $langs->trans("NoTitle");
251  }
252 
253  dol_syslog(__METHOD__, LOG_DEBUG);
254  $resql = $this->db->query($sql);
255  if ($resql) {
256  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mailing");
257 
258  $result = $this->update($user, 1);
259  if ($result < 0) {
260  $error++;
261  }
262 
263  if (!$error && !$notrigger) {
264  // Call trigger
265  $result = $this->call_trigger('MAILING_CREATE', $user);
266  if ($result < 0) {
267  $error++;
268  }
269  // End call triggers
270  }
271 
272  if (!$error) {
273  $this->db->commit();
274  return $this->id;
275  } else {
276  $this->db->rollback();
277  dol_syslog(__METHOD__ . ' ' . $this->error, LOG_ERR);
278  return -2;
279  }
280  } else {
281  $this->error = $this->db->lasterror();
282  $this->db->rollback();
283  return -1;
284  }
285  }
286 
294  public function update($user, $notrigger = 0)
295  {
296  // Check properties
297  if ($this->body === 'InvalidHTMLString') {
298  $this->error = 'InvalidHTMLString';
299  return -1;
300  }
301 
302  $error = 0;
303  $this->db->begin();
304 
305  $sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
306  $sql .= " SET titre = '".$this->db->escape($this->title)."'";
307  $sql .= ", sujet = '".$this->db->escape($this->sujet)."'";
308  $sql .= ", body = '".$this->db->escape($this->body)."'";
309  $sql .= ", email_from = '".$this->db->escape($this->email_from)."'";
310  $sql .= ", email_replyto = '".$this->db->escape($this->email_replyto)."'";
311  $sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'";
312  $sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'";
313  $sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'";
314  $sql .= " WHERE rowid = ".(int) $this->id;
315 
316  dol_syslog(__METHOD__, LOG_DEBUG);
317  $resql = $this->db->query($sql);
318  if ($resql) {
319  if (!$error && !$notrigger) {
320  // Call trigger
321  $result = $this->call_trigger('MAILING_MODIFY', $user);
322  if ($result < 0) {
323  $error++;
324  }
325  // End call triggers
326  }
327 
328  if (!$error) {
329  dol_syslog(__METHOD__ . ' success');
330  $this->db->commit();
331  return 1;
332  } else {
333  $this->db->rollback();
334  dol_syslog(__METHOD__ . ' ' . $this->error, LOG_ERR);
335  return -2;
336  }
337  } else {
338  $this->error = $this->db->lasterror();
339  $this->db->rollback();
340  return -1;
341  }
342  }
343 
350  public function fetch($rowid)
351  {
352  global $conf;
353 
354  $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage";
355  $sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
356  $sql .= ", m.statut, m.nbemail";
357  $sql .= ", m.fk_user_creat, m.fk_user_valid";
358  $sql .= ", m.date_creat";
359  $sql .= ", m.date_valid";
360  $sql .= ", m.date_envoi";
361  $sql .= ", m.extraparams";
362  $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
363  $sql .= " WHERE m.rowid = ".(int) $rowid;
364 
365  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
366  $result = $this->db->query($sql);
367  if ($result) {
368  if ($this->db->num_rows($result)) {
369  $obj = $this->db->fetch_object($result);
370 
371  $this->id = $obj->rowid;
372  $this->ref = $obj->rowid;
373  $this->statut = $obj->statut;
374  $this->nbemail = $obj->nbemail;
375  $this->title = $obj->title;
376 
377  $this->sujet = $obj->sujet;
378  if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5))) {
379  $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5);
380  } else {
381  $this->body = $obj->body;
382  }
383 
384  $this->bgcolor = $obj->bgcolor;
385  $this->bgimage = $obj->bgimage;
386 
387  $this->email_from = $obj->email_from;
388  $this->email_replyto = $obj->email_replyto;
389  $this->email_errorsto = $obj->email_errorsto;
390 
391  $this->user_creat = $obj->fk_user_creat;
392  $this->user_creation = $obj->fk_user_creat;
393  $this->user_valid = $obj->fk_user_valid;
394  $this->user_validation = $obj->fk_user_valid;
395 
396  $this->date_creat = $this->db->jdate($obj->date_creat);
397  $this->date_creation = $this->db->jdate($obj->date_creat);
398  $this->date_valid = $this->db->jdate($obj->date_valid);
399  $this->date_validation = $this->db->jdate($obj->date_valid);
400  $this->date_envoi = $this->db->jdate($obj->date_envoi);
401 
402  $this->extraparams = (array) json_decode($obj->extraparams, true);
403 
404  return 1;
405  } else {
406  dol_syslog(get_class($this)."::fetch Erreur -1");
407  return -1;
408  }
409  } else {
410  dol_syslog(get_class($this)."::fetch Erreur -2");
411  return -2;
412  }
413  }
414 
415 
425  public function createFromClone(User $user, $fromid, $option1, $option2)
426  {
427  global $langs;
428 
429  $error = 0;
430 
431  $object = new Mailing($this->db);
432 
433  $this->db->begin();
434 
435  // Load source object
436  $object->fetch($fromid);
437  $object->id = 0;
438  $object->statut = 0;
439 
440  // Clear fields
441  $object->title = $langs->trans("CopyOf").' '.$object->title.' '.dol_print_date(dol_now());
442 
443  // If no option copy content
444  if (empty($option1)) {
445  // Clear values
446  $object->nbemail = 0;
447  $object->sujet = '';
448  $object->body = '';
449  $object->bgcolor = '';
450  $object->bgimage = '';
451 
452  //$object->email_from = ''; // We do not reset from email because it is a mandatory value
453  $object->email_replyto = '';
454  $object->email_errorsto = '';
455 
456  $object->user_creat = $user->id;
457  $object->user_valid = '';
458 
459  $object->date_creat = '';
460  $object->date_valid = '';
461  $object->date_envoi = '';
462  }
463 
464  // Create clone
465  $object->context['createfromclone'] = 'createfromclone';
466  $result = $object->create($user);
467 
468  // Other options
469  if ($result < 0) {
470  $this->error = $object->error;
471  $this->errors = array_merge($this->errors, $object->errors);
472  $error++;
473  }
474 
475  if (!$error) {
476  // Clone recipient targets
477  if (!empty($option2)) {
478  require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
479 
480  $mailing_target = new MailingTargets($this->db);
481 
482  $target_array = array();
483 
484  $sql = "SELECT fk_contact,";
485  $sql .= " lastname,";
486  $sql .= " firstname,";
487  $sql .= " email,";
488  $sql .= " other,";
489  $sql .= " source_url,";
490  $sql .= " source_id ,";
491  $sql .= " source_type";
492  $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles";
493  $sql .= " WHERE fk_mailing = ".((int) $fromid);
494 
495  $result = $this->db->query($sql);
496  if ($result) {
497  if ($this->db->num_rows($result)) {
498  while ($obj = $this->db->fetch_object($result)) {
499  $target_array[] = array(
500  'fk_contact'=>$obj->fk_contact,
501  'lastname'=>$obj->lastname,
502  'firstname'=>$obj->firstname,
503  'email'=>$obj->email,
504  'other'=>$obj->other,
505  'source_url'=>$obj->source_url,
506  'source_id'=>$obj->source_id,
507  'source_type'=>$obj->source_type
508  );
509  }
510  }
511  } else {
512  $this->error = $this->db->lasterror();
513  return -1;
514  }
515 
516  $mailing_target->addTargetsToDatabase($object->id, $target_array);
517  }
518  }
519 
520  unset($object->context['createfromclone']);
521 
522  // End
523  if (!$error) {
524  $this->db->commit();
525  return $object->id;
526  } else {
527  $this->db->rollback();
528  return -1;
529  }
530  }
531 
538  public function valid($user)
539  {
540  $now = dol_now();
541 
542  $sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
543  $sql .= " SET statut = 1, date_valid = '".$this->db->idate($now)."', fk_user_valid=".$user->id;
544  $sql .= " WHERE rowid = ".((int) $this->id);
545 
546  dol_syslog("Mailing::valid", LOG_DEBUG);
547  if ($this->db->query($sql)) {
548  return 1;
549  } else {
550  $this->error = $this->db->lasterror();
551  return -1;
552  }
553  }
554 
555 
563  public function delete($rowid, $notrigger = 0)
564  {
565  global $user;
566 
567  $error = 0;
568  $this->db->begin();
569 
570  if (!$notrigger) {
571  $result = $this->call_trigger('MAILING_DELETE', $user);
572  if ($result < 0) {
573  $error++;
574  }
575  }
576 
577  if (!$error) {
578  $sql = "DELETE FROM " . MAIN_DB_PREFIX . "mailing";
579  $sql .= " WHERE rowid = " . ((int) $rowid);
580 
581  dol_syslog(__METHOD__, LOG_DEBUG);
582  $resql = $this->db->query($sql);
583  if ($resql) {
584  $res = $this->delete_targets();
585  if ($res <= 0) {
586  $error++;
587  }
588 
589  if (!$error) {
590  dol_syslog(__METHOD__ . ' success');
591  $this->db->commit();
592  return 1;
593  } else {
594  $this->db->rollback();
595  dol_syslog(__METHOD__ . ' ' . $this->error, LOG_ERR);
596  return -2;
597  }
598  } else {
599  $this->db->rollback();
600  $this->error = $this->db->lasterror();
601  return -1;
602  }
603  } else {
604  $this->db->rollback();
605  return -1;
606  }
607  }
608 
609  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
615  public function delete_targets()
616  {
617  // phpcs:enable
618  $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
619  $sql .= " WHERE fk_mailing = ".((int) $this->id);
620 
621  dol_syslog("Mailing::delete_targets", LOG_DEBUG);
622  $resql = $this->db->query($sql);
623  if ($resql) {
624  $this->refreshNbOfTargets();
625 
626  return 1;
627  } else {
628  $this->error = $this->db->lasterror();
629  return 0;
630  }
631  }
632 
633 
634  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
641  public function reset_targets_status($user)
642  {
643  // phpcs:enable
644  $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
645  $sql .= " SET statut = 0";
646  $sql .= " WHERE fk_mailing = ".((int) $this->id);
647 
648  dol_syslog("Mailing::reset_targets_status", LOG_DEBUG);
649  $resql = $this->db->query($sql);
650  if ($resql) {
651  return 1;
652  } else {
653  $this->error = $this->db->lasterror();
654  return -1;
655  }
656  }
657 
658 
665  public function countNbOfTargets($mode)
666  {
667  $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
668  $sql .= " WHERE fk_mailing = ".((int) $this->id);
669  if ($mode == 'alreadysent') {
670  $sql .= " AND statut <> 0";
671  } elseif ($mode == 'alreadysentok') {
672  $sql .= " AND statut > 0";
673  } elseif ($mode == 'alreadysentko') {
674  $sql .= " AND statut = -1";
675  } else {
676  $this->error = 'BadValueForParameterMode';
677  return -2;
678  }
679 
680  $resql = $this->db->query($sql);
681  if ($resql) {
682  $obj = $this->db->fetch_object($resql);
683  if ($obj) {
684  return $obj->nb;
685  }
686  } else {
687  $this->error = $this->db->lasterror();
688  return -1;
689  }
690  return 0;
691  }
692 
699  public function refreshNbOfTargets()
700  {
701  $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
702  $sql .= " WHERE fk_mailing = ".((int) $this->id);
703 
704  $resql = $this->db->query($sql);
705  if ($resql) {
706  $obj = $this->db->fetch_object($resql);
707  if ($obj) {
708  $nbforupdate = $obj->nb;
709 
710  $sql = 'UPDATE '.MAIN_DB_PREFIX.'mailing SET nbemail = '.((int) $nbforupdate);
711  $sql .= ' WHERE rowid = '.((int) $this->id);
712 
713  $resqlupdate = $this->db->query($sql);
714  if (! $resqlupdate) {
715  $this->error = $this->db->lasterror();
716  return -1;
717  } else {
718  $this->nbemail = (int) $nbforupdate;
719  }
720  }
721  } else {
722  $this->error = $this->db->lasterror();
723  return -1;
724  }
725 
726  return 1;
727  }
728 
739  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
740  {
741  global $db, $conf, $langs, $hookmanager;
742  global $dolibarr_main_authentication, $dolibarr_main_demo;
743  global $menumanager;
744 
745  if (!empty($conf->dol_no_mouse_hover)) {
746  $notooltip = 1; // Force disable tooltips
747  }
748 
749  $result = '';
750  $companylink = '';
751 
752  $label = '<u>'.$langs->trans("ShowEMailing").'</u>';
753  $label .= '<br>';
754  $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
755 
756  $url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id;
757 
758  if ($option != 'nolink') {
759  // Add param to save lastsearch_values or not
760  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
761  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
762  $add_save_lastsearch_values = 1;
763  }
764  if ($add_save_lastsearch_values) {
765  $url .= '&save_lastsearch_values=1';
766  }
767  }
768 
769  $linkclose = '';
770  if (empty($notooltip)) {
771  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
772  $label = $langs->trans("ShowEMailing");
773  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
774  }
775  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
776  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
777  } else {
778  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
779  }
780 
781  $linkstart = '<a href="'.$url.'"';
782  $linkstart .= $linkclose.'>';
783  $linkend = '</a>';
784 
785  $result .= $linkstart;
786  if ($withpicto) {
787  $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);
788  }
789  if ($withpicto != 2) {
790  $result .= $this->ref;
791  }
792  $result .= $linkend;
793  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
794 
795  global $action;
796  $hookmanager->initHooks(array('emailingdao'));
797  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
798  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
799  if ($reshook > 0) {
800  $result = $hookmanager->resPrint;
801  } else {
802  $result .= $hookmanager->resPrint;
803  }
804 
805  return $result;
806  }
807 
814  public function getLibStatut($mode = 0)
815  {
816  return $this->LibStatut($this->statut, $mode);
817  }
818 
819  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
827  public function LibStatut($status, $mode = 0)
828  {
829  // phpcs:enable
830  global $langs;
831  $langs->load("mailing");
832 
833  $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]);
834  $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts[$status]);
835 
836  $statusType = 'status'.$status;
837  if ($status == 2) {
838  $statusType = 'status3';
839  }
840  if ($status == 3) {
841  $statusType = 'status6';
842  }
843 
844  return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
845  }
846 
847 
857  public static function libStatutDest($status, $mode = 0, $desc = '')
858  {
859  global $langs;
860  $langs->load("mails");
861 
862  $labelStatus = array();
863  $labelStatusShort = array();
864 
865  $labelStatus[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
866  $labelStatus[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
867  $labelStatus[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
868  $labelStatus[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
869  $labelStatus[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
870  $labelStatusShort[-1] = $langs->transnoentitiesnoconv('MailingStatusError');
871  $labelStatusShort[0] = $langs->transnoentitiesnoconv('MailingStatusNotSent');
872  $labelStatusShort[1] = $langs->transnoentitiesnoconv('MailingStatusSent');
873  $labelStatusShort[2] = $langs->transnoentitiesnoconv('MailingStatusRead');
874  $labelStatusShort[3] = $langs->transnoentitiesnoconv('MailingStatusNotContact');
875 
876  $statusType = 'status'.$status;
877  if ($status == -1) {
878  $statusType = 'status8';
879  }
880  if ($status == 1) {
881  $statusType = 'status6';
882  }
883  if ($status == 2) {
884  $statusType = 'status4';
885  }
886 
887  $param = array();
888  if ($status == - 1) {
889  $param = array('badgeParams'=>array('attr'=>array('title'=>$desc)));
890  }
891  return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode, '', $param);
892  }
893 }
$object ref
Definition: info.php:78
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.
__construct($db)
Constructor.
fetch($rowid)
Get object from database.
update($user, $notrigger=0)
Update emailing record.
create($user, $notrigger=0)
Create an EMailing.
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.
Definition: user.class.php:45
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_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.
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_textishtml($msg, $option=0)
Return if a text is a html content.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.
Definition: inc.php:41