dolibarr 20.0.5
interface_50_modTicket_TicketEmail.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2014-2016 Jean-François Ferry <hello@librethic.io>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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::VERSIONS['prod'];
47 $this->picto = 'ticket';
48 }
49
61 public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
62 {
63 global $mysoc;
64
65 $ok = 0;
66
67 if (empty($conf->ticket) || !isModEnabled('ticket')) {
68 return 0; // Module not active, we do nothing
69 }
70
71 switch ($action) {
72 case 'TICKET_ASSIGNED':
73 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
74
75 if ($object->fk_user_assign > 0) {
76 if ($object->fk_user_assign != $user->id) {
77 $userstat = new User($this->db);
78 $res = $userstat->fetch($object->fk_user_assign);
79 if ($res > 0) {
80 // Send email to notification email
81 if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
82 // Init to avoid errors
83 $filepath = array();
84 $filename = array();
85 $mimetype = array();
86
87 $appli = $mysoc->name;
88
89 // Send email to assigned user
90 $sendto = $userstat->email;
91 $subject_assignee = 'TicketAssignedToYou';
92 $body_assignee = 'TicketAssignedEmailBody';
93 $see_ticket_assignee = 'SeeThisTicketIntomanagementInterface';
94
95 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
96 $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
97 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
98 }
99 if (!empty($sendto)) {
100 $this->composeAndSendAssigneeMessage($sendto, $subject_assignee, $body_assignee, $see_ticket_assignee, $object, $langs);
101 }
102 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
103 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
104 }
105 }
106 } else {
107 $this->error = $userstat->error;
108 $this->errors = $userstat->errors;
109 }
110 }
111
112 // Send an email to the Customer to inform him that his ticket has been taken in charge.
113 if (getDolGlobalString('TICKET_NOTIFY_CUSTOMER_TICKET_ASSIGNED') && empty($object->oldcopy->fk_user_assign)) {
114 $langs->load('ticket');
115
116 $subject_customer = 'TicketAssignedCustomerEmail';
117 $body_customer = 'TicketAssignedCustomerBody';
118 $see_ticket_customer = 'TicketNewEmailBodyInfosTrackUrlCustomer';
119
120 // Get all external contacts linked to the ticket
121 $linked_contacts = $object->listeContact(-1, 'thirdparty');
122
123 // Initialize and fill recipient addresses at least with origin_email
124 $sendto = '';
125 $temp_emails = [];
126 if ($object->origin_email) {
127 $temp_emails[] = $object->origin_email;
128 }
129
130 if (!empty($linked_contacts)) {
131 foreach ($linked_contacts as $contact) {
132 // Avoid the email from being sent twice in case of duplicated contact
133 if (!in_array($contact['email'], $temp_emails)) {
134 $temp_emails[] = $contact['email'];
135 }
136 }
137 }
138
139 $sendto = implode(", ", $temp_emails);
140 unset($temp_emails);
141 unset($linked_contacts);
142
143 // If recipients, we send the email
144 if ($sendto) {
145 $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
146 }
147 }
148 $ok = 1;
149 }
150 break;
151
152 case 'TICKET_CREATE':
153 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
154
155 $langs->load('ticket');
156
157 $subject_admin = 'TicketNewEmailSubjectAdmin';
158 $body_admin = 'TicketNewEmailBodyAdmin';
159
160 $subject_customer = 'TicketNewEmailSubjectCustomer';
161 $body_customer = 'TicketNewEmailBodyCustomer';
162 $see_ticket_customer = 'TicketNewEmailBodyInfosTrackUrlCustomer';
163
164 $subject_assignee = 'TicketAssignedToYou';
165 $body_assignee = 'TicketAssignedEmailBody';
166 $see_ticket_assignee = 'SeeThisTicketIntomanagementInterface';
167
168 // Send email to notification email
169 // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page
170 // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface
171 if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) {
172 $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO');
173 if ($sendto) {
174 $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs);
175 }
176 }
177
178 // Send email to assignee if an assignee was set at creation
179 if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id && empty($object->context['disableticketemail'])) {
180 $userstat = new User($this->db);
181 $res = $userstat->fetch($object->fk_user_assign);
182 if ($res > 0) {
183 // Send email to notification email
184 if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
185 // Send email to assigned user
186 $sendto = $userstat->email;
187 if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
188 $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
189 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
190 }
191
192 if (!empty($sendto)) {
193 $this->composeAndSendAssigneeMessage($sendto, $subject_assignee, $body_assignee, $see_ticket_assignee, $object, $langs);
194 }
195
196 if (!getDolUserString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
197 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
198 }
199 }
200 } else {
201 $this->error = $userstat->error;
202 $this->errors = $userstat->errors;
203 }
204 }
205
206 // Send email to customer
207 // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page
208 // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface
209 if (empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) {
210 $sendto = '';
211
212 // if contact selected send to email's contact else send to email's thirdparty
213
214 $contactid = empty($object->context['contactid']) ? 0 : $object->context['contactid'];
215 $res = 0;
216
217 if (!empty($contactid)) {
218 $contact = new Contact($this->db);
219 $res = $contact->fetch($contactid);
220 }
221
222 if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
223 $sendto = $contact->email;
224 } elseif (!empty($object->fk_soc)) {
225 $object->fetch_thirdparty();
226 $sendto = $object->thirdparty->email;
227 }
228
229 if ($sendto) {
230 $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
231 }
232 }
233
234 $ok = 1;
235 break;
236
237 case 'TICKET_DELETE':
238 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
239 break;
240
241 case 'TICKET_MODIFY':
242 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
243 break;
244
245 case 'TICKET_CLOSE':
246 dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
247 $langs->load('ticket');
248
249 $subject_admin = 'TicketCloseEmailSubjectAdmin';
250 $body_admin = 'TicketCloseEmailBodyAdmin';
251 $subject_customer = 'TicketCloseEmailSubjectCustomer';
252 $body_customer = 'TicketCloseEmailBodyCustomer';
253 $see_ticket_customer = 'TicketCloseEmailBodyInfosTrackUrlCustomer';
254
255 // Send email to notification email
256 // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing
257 if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) {
258 $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO');
259 if ($sendto) {
260 $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs);
261 }
262 }
263
264 // Send email to customer.
265 // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing
266 if (empty($object->context['disableticketemail'])) {
267 $linked_contacts = $object->listeContact(-1, 'thirdparty');
268 $linked_contacts = array_merge($linked_contacts, $object->listeContact(-1, 'internal'));
269 if (empty($linked_contacts) && getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') && !empty($object->fk_soc)) {
270 $object->fetch_thirdparty();
271 $linked_contacts[]['email'] = $object->thirdparty->email;
272 }
273
274 $contactid = empty($object->context['contactid']) ? 0 : $object->context['contactid'];
275 $res = 0;
276
277 if ($contactid > 0) {
278 // TODO This security test has no sens. We must check that $contactid is inside $linked_contacts[]['id'] when $linked_contacts[]['source'] = 'external' or 'thirdparty'
279 // Refuse email if not
280 $contact = new Contact($this->db);
281 $res = $contact->fetch($contactid);
282 if (! in_array($contact, $linked_contacts)) {
283 $error_msg = $langs->trans('Error'). ': ';
284 $error_msg .= $langs->transnoentities('TicketWrongContact');
285 setEventMessages($error_msg, [], 'errors');
286 $ok = 0;
287 break;
288 }
289 }
290
291 $sendto = '';
292 if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) {
293 $sendto = $contact->email;
294 } elseif (!empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) {
295 // if sending to all contacts or sending to contacts while mass closing
296 $temp_emails = [];
297 foreach ($linked_contacts as $contact) {
298 $temp_emails[] = $contact['email'];
299 }
300 $sendto = implode(", ", $temp_emails);
301 unset($temp_emails);
302 unset($linked_contacts);
303 }
304 if ($sendto) {
305 $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
306 }
307 }
308 $ok = 1;
309 break;
310 }
311
312 return $ok;
313 }
314
325 private function composeAndSendAdminMessage($sendto, $base_subject, $body, Ticket $object, Translate $langs)
326 {
327 global $conf, $mysoc;
328
329 // Init to avoid errors
330 $filepath = array();
331 $filename = array();
332 $mimetype = array();
333
334 $appli = $mysoc->name;
335
336 /* Send email to admin */
337 $subject = '['.$appli.'] '.$langs->transnoentities($base_subject, $object->ref, $object->track_id);
338 $message_admin = $langs->transnoentities($body, $object->track_id).'<br>';
339 $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
340 $message_admin .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
341 $message_admin .= '<li>'.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
342 $message_admin .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
343 $message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>';
344 // Extrafields
345 $extraFields = new ExtraFields($this->db);
346 $extraFields->fetch_name_optionals_label($object->table_element);
347 if (is_array($object->array_options) && count($object->array_options) > 0) {
348 foreach ($object->array_options as $key => $value) {
349 $key = substr($key, 8); // remove "options_"
350 $message_admin .= '<li>'.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value, '', $object->table_element).'</li>';
351 }
352 }
353 if ($object->fk_soc > 0) {
354 $object->fetch_thirdparty();
355 $message_admin .= '<li>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</li>';
356 }
357 $message_admin .= '</ul>';
358
359 $message = $object->message;
360 if (!dol_textishtml($message)) {
361 $message = dol_nl2br($message);
362 }
363 $message_admin .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
364 $message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
365
366 $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>';
367
368 $trackid = 'tic'.$object->id;
369
370 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
371 $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
372 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
373 }
374 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
375 $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
376 if ($mailfile->error) {
377 dol_syslog($mailfile->error, LOG_DEBUG);
378 } else {
379 $result = $mailfile->sendfile();
380 }
381 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
382 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
383 }
384 }
385
397 private function composeAndSendCustomerMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs)
398 {
399 global $conf, $extrafields, $mysoc, $user;
400
401 // Init to avoid errors
402 $filepath = array();
403 $filename = array();
404 $mimetype = array();
405
406 $appli = $mysoc->name;
407
408 $subject = '['.$appli.'] '.$langs->transnoentities($base_subject);
409 $message_customer = $langs->transnoentities($body, $object->track_id).'<br>';
410 $message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
411 $message_customer .= '<li>'.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'</li>';
412 $message_customer .= '<li>'.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'</li>';
413 $message_customer .= '<li>'.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'</li>';
414
415 // Extrafields
416 if (is_array($extrafields->attributes[$object->table_element]['label'])) {
417 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $value) {
418 $enabled = 1;
419 if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$key])) {
420 $enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1);
421 }
422 $perms = 1;
423 if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) {
424 $perms = (int) dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1);
425 }
426
427 $qualified = true;
428 if (empty($enabled)) {
429 $qualified = false;
430 }
431 if (empty($perms)) {
432 $qualified = false;
433 }
434
435 if ($qualified) {
436 $message_customer .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>';
437 }
438 }
439 }
440
441 $message_customer .= '</ul>';
442
443 $message = $object->message;
444 if (!dol_textishtml($message)) {
445 $message = dol_nl2br($message);
446 }
447 $message_customer .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
448
449 if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
450 $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.((int) $object->track_id);
451 $message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
452 $message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
453 } else {
454 $message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmailNoInterface').'</p>';
455 }
456
457 $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>';
458
459 $trackid = 'tic'.$object->id;
460
461 $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
462
463 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
464 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
465 }
466
467 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
468 $mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, '', '', 0, -1, '', '', $trackid, '', 'ticket');
469 if ($mailfile->error) {
470 dol_syslog($mailfile->error, LOG_DEBUG);
471 } else {
472 $result = $mailfile->sendfile();
473 if ($result) {
474 // update last_msg_sent date
475 $object->fetch($object->id);
476 $object->date_last_msg_sent = dol_now();
477 $object->update($user);
478 }
479 }
480 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
481 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
482 }
483 }
484
496 private function composeAndSendAssigneeMessage($sendto, $base_subject, $body, $see_ticket, Ticket $object, Translate $langs)
497 {
498 global $conf, $user, $mysoc;
499
500 // Init to avoid errors
501 $filepath = array();
502 $filename = array();
503 $mimetype = array();
504
505 // Send email to assigned user
506 $appli = $mysoc->name;
507
508 $subject = '['.$appli.'] '.$langs->transnoentities($base_subject);
509 $message = '<p>'.$langs->transnoentities($body, $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."</p>";
510 $message .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
511 $message .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
512 $message .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
513 $message .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
514 // Extrafields
515 if (is_array($object->array_options) && count($object->array_options) > 0) {
516 foreach ($object->array_options as $key => $value) {
517 $message .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
518 }
519 }
520
521 $message .= '</ul>';
522 $message .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
523 $message .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans($see_ticket).'</a></p>';
524
525 $from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>';
526
527 $message = dol_nl2br($message);
528
529 $old_MAIN_MAIL_AUTOCOPY_TO = null;
530 if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
531 $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
532 $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
533 }
534
535 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
536 $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1);
537 if ($mailfile->error) {
538 setEventMessages($mailfile->error, $mailfile->errors, 'errors');
539 } else {
540 $result = $mailfile->sendfile();
541 if ($result) {
542 // update last_msg_sent date
543 $object->fetch($object->id);
544 $object->date_last_msg_sent = dol_now();
545 $object->update($user);
546 }
547 }
548 if (!getDolUserString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
549 $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
550 }
551 }
552}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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 triggers must inherit.
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 Dolibarr 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_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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 a Dolibarr global constant int value.
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:140