dolibarr 18.0.6
interface_50_modTicket_TicketEmail.class.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (C) 2014-2016 Jean-François Ferry <hello@librethic.io>
4 * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
5 * Copyright (C) 2023-2025 Benjamin Falière <benjamin@faliere.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
26require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
27
28
33{
39 public function __construct($db)
40 {
41 $this->db = $db;
42
43 $this->name = preg_replace('/^Interface/i', '', get_class($this));
44 $this->family = "ticket";
45 $this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties";
46 $this->version = self::VERSION_DOLIBARR; // 'development', 'experimental', 'dolibarr' or version
47 $this->picto = 'ticket';
48 }
49
61 public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
62 {
63 $ok = 0;
64
65 if (empty($conf->ticket) || !isModEnabled('ticket')) {
66 return 0; // Module not active, we do nothing
67 }
68
69 switch ($action) {
70 case 'TICKET_ASSIGNED':
71 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
72
73 if ($object->fk_user_assign > 0) {
74 if ($object->fk_user_assign != $user->id) {
75 $userstat = new User($this->db);
76 $res = $userstat->fetch($object->fk_user_assign);
77 if ($res > 0) {
78 // Send email to notification email
79 if (empty($conf->global->TICKET_DISABLE_ALL_MAILS)) {
80 // Send email to assigned user
81 $sendto = $userstat->email;
82 $subject_assignee = 'TicketAssignedToYou';
83 $body_assignee = 'TicketAssignedEmailBody';
84 $see_ticket_assignee = 'SeeThisTicketIntomanagementInterface';
85
86 if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
87 $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
88 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
89 }
90 if (!empty($sendto)) {
91 $this->composeAndSendAssigneeMessage($sendto, $subject_assignee, $body_assignee, $see_ticket_assignee, $object, $langs);
92 }
93 if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
94 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
95 }
96 }
97 } else {
98 $this->error = $userstat->error;
99 $this->errors = $userstat->errors;
100 }
101 }
102
103 // Send an email to the Customer to inform him that his ticket has been taken in charge.
104 if (!empty($conf->global->TICKET_NOTIFY_CUSTOMER_TICKET_ASSIGNED) && empty($object->oldcopy->fk_user_assign)) {
105 $langs->load('ticket');
106
107 $subject_customer = 'TicketAssignedCustomerEmail';
108 $body_customer = 'TicketAssignedCustomerBody';
109 $see_ticket_customer = 'TicketNewEmailBodyInfosTrackUrlCustomer';
110
111 // Get all external contacts linked to the ticket
112 $linked_contacts = $object->listeContact(-1, 'thirdparty');
113
114 // Initialize and fill recipient addresses at least with origin_email
115 $sendto = '';
116 $temp_emails = [];
117 if ($object->origin_email) {
118 $temp_emails[] = $object->origin_email;
119 }
120
121 if (!empty($linked_contacts)) {
122 foreach ($linked_contacts as $contact) {
123 // Avoid the email from being sent twice in case of duplicated contact
124 if (!in_array($contact['email'], $temp_emails)) {
125 $temp_emails[] = $contact['email'];
126 }
127 }
128 }
129
130 $sendto = implode(", ", $temp_emails);
131 unset($temp_emails);
132 unset($linked_contacts);
133
134 // If recipients, we send the email
135 if ($sendto) {
136 $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
137 }
138 }
139 $ok = 1;
140 }
141 break;
142
143 case 'TICKET_CREATE':
144 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
145
146 $langs->load('ticket');
147
148 $subject_admin = 'TicketNewEmailSubjectAdmin';
149 $body_admin = 'TicketNewEmailBodyAdmin';
150
151 $subject_customer = 'TicketNewEmailSubjectCustomer';
152 $body_customer = 'TicketNewEmailBodyCustomer';
153 $see_ticket_customer = 'TicketNewEmailBodyInfosTrackUrlCustomer';
154
155 $subject_assignee = 'TicketAssignedToYou';
156 $body_assignee = 'TicketAssignedEmailBody';
157 $see_ticket_assignee = 'SeeThisTicketIntomanagementInterface';
158
159 // Send email to notification email
160 if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) {
161 $sendto = empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
162 if ($sendto) {
163 $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs);
164 }
165 }
166
167 // Send email to assignee if an assignee was set at creation
168 if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id && empty($object->context['disableticketemail'])) {
169 $userstat = new User($this->db);
170 $res = $userstat->fetch($object->fk_user_assign);
171 if ($res > 0) {
172 // Send email to notification email
173 if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
174 // Send email to assigned user
175 $sendto = $userstat->email;
176 if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
177 $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
178 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
179 }
180
181 if (!empty($sendto)) {
182 $this->composeAndSendAssigneeMessage($sendto, $subject_assignee, $body_assignee, $see_ticket_assignee, $object, $langs);
183 }
184
185 if (!getDolUserString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
186 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
187 }
188 }
189 } else {
190 $this->error = $userstat->error;
191 $this->errors = $userstat->errors;
192 }
193 }
194
195 // Send email to customer
196 if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) {
197 $sendto = '';
198
199 //if contact selected send to email's contact else send to email's thirdparty
200
201 $contactid = GETPOST('contactid', 'alpha');
202 $res = 0;
203
204 if (!empty($contactid)) {
205 $contact = new Contact($this->db);
206 $res = $contact->fetch($contactid);
207 }
208
209 if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
210 $sendto = $contact->email;
211 } elseif (!empty($object->fk_soc)) {
212 $object->fetch_thirdparty();
213 $sendto = $object->thirdparty->email;
214 }
215
216 if ($sendto) {
217 $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
218 }
219 }
220
221 $ok = 1;
222 break;
223
224 case 'TICKET_DELETE':
225 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
226 break;
227
228 case 'TICKET_MODIFY':
229 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
230 break;
231
232 case 'TICKET_CLOSE':
233 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
234 $langs->load('ticket');
235
236 $subject_admin = 'TicketCloseEmailSubjectAdmin';
237 $body_admin = 'TicketCloseEmailBodyAdmin';
238 $subject_customer = 'TicketCloseEmailSubjectCustomer';
239 $body_customer = 'TicketCloseEmailBodyCustomer';
240 $see_ticket_customer = 'TicketCloseEmailBodyInfosTrackUrlCustomer';
241
242 // Send email to notification email
243 if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) {
244 $sendto = empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
245 if ($sendto) {
246 $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs);
247 }
248 }
249
250 // Send email to customer.
251 if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail'])) {
252 $linked_contacts = $object->listeContact(-1, 'thirdparty');
253 $linked_contacts = array_merge($linked_contacts, $object->listeContact(-1, 'internal'));
254 if (empty($linked_contacts) && !empty($conf->global->TICKET_NOTIFY_AT_CLOSING) && !empty($object->fk_soc)) {
255 $object->fetch_thirdparty();
256 $linked_contacts[]['email'] = $object->thirdparty->email;
257 }
258
259 $contactid = GETPOST('contactid', 'int');
260 $res = 0;
261
262 if ($contactid > 0) {
263 // TODO This security test has no sens. We must check that $contactid is inside $linked_contacts[]['id'] when $linked_contacts[]['source'] = 'external' or 'thirdparty'
264 // Refuse email if not
265 $contact = new Contact($this->db);
266 $res = $contact->fetch($contactid);
267 if (! in_array($contact, $linked_contacts)) {
268 $error_msg = $langs->trans('Error'). ': ';
269 $error_msg .= $langs->transnoentities('TicketWrongContact');
270 setEventMessages($error_msg, [], 'errors');
271 $ok = 0;
272 break;
273 }
274 }
275
276 $sendto = '';
277 if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
278 $sendto = $contact->email;
279 } elseif ( !empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) {
280 // if sending to all contacts or sending to contacts while mass closing
281 $temp_emails = [];
282 foreach ($linked_contacts as $contact) {
283 $temp_emails[] = $contact['email'];
284 }
285 $sendto = implode(", ", $temp_emails);
286 unset($temp_emails);
287 unset($linked_contacts);
288 }
289 if ($sendto) {
290 $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
291 }
292 }
293 $ok = 1;
294 break;
295 }
296
297 return $ok;
298 }
299
310 private function composeAndSendAdminMessage($sendto, $base_subject, $body, Ticket $object, Translate $langs)
311 {
312 global $conf;
313
314 // Init to avoid errors
315 $filepath = array();
316 $filename = array();
317 $mimetype = array();
318
319 /* Send email to admin */
320 $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities($base_subject, $object->ref, $object->track_id);
321 $message_admin = $langs->transnoentities($body, $object->track_id).'<br>';
322 $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
323 $message_admin .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
324 $message_admin .= '<li>'.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
325 $message_admin .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
326 $message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>';
327 // Extrafields
328 $extraFields = new ExtraFields($this->db);
329 $extraFields->fetch_name_optionals_label($object->table_element);
330 if (is_array($object->array_options) && count($object->array_options) > 0) {
331 foreach ($object->array_options as $key => $value) {
332 $key = substr($key, 8); // remove "options_"
333 $message_admin .= '<li>'.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value, '', $object->table_element).'</li>';
334 }
335 }
336 if ($object->fk_soc > 0) {
337 $object->fetch_thirdparty();
338 $message_admin .= '<li>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</li>';
339 }
340 $message_admin .= '</ul>';
341
342 $message = $object->message;
343 if (!dol_textishtml($message)) {
344 $message = dol_nl2br($message);
345 }
346 $message_admin .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
347 $message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
348
349 $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
350
351 $trackid = 'tic'.$object->id;
352
353 if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
354 $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
355 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
356 }
357 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
358 $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
359 if ($mailfile->error) {
360 dol_syslog($mailfile->error, LOG_DEBUG);
361 } else {
362 $result = $mailfile->sendfile();
363 }
364 if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
365 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
366 }
367 }
368
380 private function composeAndSendCustomerMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs)
381 {
382 global $conf, $user;
383
384 // Init to avoid errors
385 $filepath = array();
386 $filename = array();
387 $mimetype = array();
388
389 $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities($base_subject);
390 $message_customer = $langs->transnoentities($body, $object->track_id).'<br>';
391 $message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
392 $message_customer .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
393 $message_customer .= '<li>'.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
394 $message_customer .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
395
396 // Extrafields
397 if (is_array($this->attributes[$object->table_element]['label'])) {
398 foreach ($this->attributes[$object->table_element]['label'] as $key => $value) {
399 $enabled = 1;
400 if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) {
401 $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
402 }
403 $perms = 1;
404 if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) {
405 $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
406 }
407
408 $qualified = true;
409 if (empty($enabled)) {
410 $qualified = false;
411 }
412 if (empty($perms)) {
413 $qualified = false;
414 }
415
416 if ($qualified) {
417 $message_customer .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>';
418 }
419 }
420 }
421
422 $message_customer .= '</ul>';
423
424 $message = $object->message;
425 if (!dol_textishtml($message)) {
426 $message = dol_nl2br($message);
427 }
428 $message_customer .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
429
430 if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
431 $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.$object->track_id;
432 $message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
433 $message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
434 } else {
435 $message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmailNoInterface').'</p>';
436 }
437
438 $from = (empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM.' ').'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
439
440 $trackid = 'tic'.$object->id;
441
442 $old_MAIN_MAIL_AUTOCOPY_TO = null;
443 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
444 $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
445 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
446 }
447
448 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
449 $mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
450 if ($mailfile->error) {
451 dol_syslog($mailfile->error, LOG_DEBUG);
452 } else {
453 $result = $mailfile->sendfile();
454 if ($result) {
455 // update last_msg_sent date
456 $object->fetch($object->id);
457 $object->date_last_msg_sent = dol_now();
458 $object->update($user);
459 }
460 }
461 if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
462 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
463 }
464 }
465
477 private function composeAndSendAssigneeMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs)
478 {
479 global $conf, $user, $mysoc;
480
481 // Init to avoid errors
482 $filepath = array();
483 $filename = array();
484 $mimetype = array();
485
486 // Send email to assigned user
487 $appli = $mysoc->name;
488
489 $subject = '['.$appli.'] '.$langs->transnoentities($base_subject);
490 $message = '<p>'.$langs->transnoentities($body, $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."</p>";
491 $message .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
492 $message .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
493 $message .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
494 $message .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
495 // Extrafields
496 if (is_array($object->array_options) && count($object->array_options) > 0) {
497 foreach ($object->array_options as $key => $value) {
498 $message .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
499 }
500 }
501
502 $message .= '</ul>';
503 $message .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
504 $message .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans($see_ticket).'</a></p>';
505
506 $from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>';
507
508 $message = dol_nl2br($message);
509
510 $old_MAIN_MAIL_AUTOCOPY_TO = null;
511 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
512 $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
513 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
514 }
515
516 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
517 $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1);
518 if ($mailfile->error) {
519 setEventMessages($mailfile->error, $mailfile->errors, 'errors');
520 } else {
521 $result = $mailfile->sendfile();
522 if ($result) {
523 // update last_msg_sent date
524 $object->fetch($object->id);
525 $object->date_last_msg_sent = dol_now();
526 $object->update($user);
527 }
528 }
529 if (!getDolUserString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
530 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
531 }
532 }
533}
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to stock current configuration.
Class to manage contact/addresses.
Class that all the triggers must extend.
Class to manage standard extra fields.
Class of triggers for ticket module.
composeAndSendAssigneeMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs)
Composes and sends a message concerning a ticket, to be sent to user assigned to the ticket.
composeAndSendCustomerMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs)
Composes and sends a message concerning a ticket, to be sent to customer addresses.
runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
Function called when a Dolibarrr business event is done.
composeAndSendAdminMessage($sendto, $base_subject, $body, Ticket $object, Translate $langs)
Composes and sends a message concerning a ticket, to be sent to admin address.
Class to manage translations.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
Class to generate the form for creating a new ticket.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:123