dolibarr  20.0.0-beta
create_ticket.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
3  * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
4  * Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
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 /* We need object $user->default_values
27 if (!defined('NOREQUIREUSER')) {
28  define('NOREQUIREUSER', '1');
29 }*/
30 if (!defined('NOREQUIREMENU')) {
31  define('NOREQUIREMENU', '1');
32 }
33 if (!defined('NOREQUIREHTML')) {
34  define('NOREQUIREHTML', '1');
35 }
36 if (!defined('NOLOGIN')) {
37  define("NOLOGIN", 1); // This means this output page does not require to be logged.
38 }
39 if (!defined('NOIPCHECK')) {
40  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
41 }
42 if (!defined('NOBROWSERNOTIF')) {
43  define('NOBROWSERNOTIF', '1');
44 }
45 
46 // For MultiCompany module.
47 // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
48 // Because 2 entities can have the same ref.
49 $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
50 if (is_numeric($entity)) {
51  define("DOLENTITY", $entity);
52 }
53 
54 // Load Dolibarr environment
55 require '../../main.inc.php';
56 require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
57 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
58 require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
59 require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
60 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
61 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
62 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
63 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
64 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
65 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
66 
67 // Load translation files required by the page
68 $langs->loadLangs(array('companies', 'other', 'mails', 'ticket'));
69 
70 // Get parameters
71 $id = GETPOSTINT('id');
72 $msg_id = GETPOSTINT('msg_id');
73 $socid = GETPOSTINT('socid');
74 $suffix = "";
75 
76 $action = GETPOST('action', 'aZ09');
77 $cancel = GETPOST('cancel', 'aZ09');
78 
79 
80 $backtopage = '';
81 
82 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
83 $hookmanager->initHooks(array('publicnewticketcard', 'globalcard'));
84 
85 $object = new Ticket($db);
86 $extrafields = new ExtraFields($db);
87 $contacts = array();
88 $with_contact = null;
89 if (getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
90  $with_contact = new Contact($db);
91 }
92 
93 $extrafields->fetch_name_optionals_label($object->table_element);
94 
95 if (!isModEnabled('ticket')) {
96  httponly_accessforbidden('Module Ticket not enabled');
97 }
98 
99 
100 /*
101  * Actions
102  */
103 
104 $parameters = array(
105  'id' => $id,
106 );
107 // Note that $action and $object may have been modified by some hooks
108 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
109 if ($reshook < 0) {
110  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
111 }
112 // Add file in email form
113 if (empty($reshook)) {
114  if ($cancel) {
115  $backtopage = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/');
116 
117  header("Location: ".$backtopage);
118  exit;
119  }
120 
121  if (GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) {
122  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
123 
124  // Set tmp directory
125  // TODO Use a dedicated directory for temporary emails files
126  $vardir = $conf->ticket->dir_output;
127  $upload_dir_tmp = $vardir.'/temp/'.session_id();
128  if (!dol_is_dir($upload_dir_tmp)) {
129  dol_mkdir($upload_dir_tmp);
130  }
131 
132  dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0);
133  $action = 'create_ticket';
134  }
135 
136  // Remove file
137  if (GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) {
138  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
139 
140  // Set tmp directory
141  // TODO Use a dedicated directory for temporary emails files
142  $vardir = $conf->ticket->dir_output.'/';
143  $upload_dir_tmp = $vardir.'/temp/'.session_id();
144 
145  // TODO Delete only files that was uploaded from form
146  dol_remove_file_process(GETPOST('removedfile'), 0, 0);
147  $action = 'create_ticket';
148  }
149 
150  if ($action == 'create_ticket' && GETPOST('save', 'alpha')) {
151  $error = 0;
152  $origin_email = GETPOST('email', 'alpha');
153  if (empty($origin_email)) {
154  $error++;
155  array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email")));
156  $action = '';
157  } else {
158  // Search company saved with email
159  $searched_companies = $object->searchSocidByEmail($origin_email, '0');
160 
161  // Chercher un contact existent avec cette address email
162  // Le premier contact trouvé est utilisé pour déterminer le contact suivi
163  $contacts = $object->searchContactByEmail($origin_email);
164 
165  // Ensure that contact is active and select first active contact
166  $cid = -1;
167  foreach ($contacts as $key => $contact) {
168  if ((int) $contact->statut == 1) {
169  $cid = $key;
170  break;
171  }
172  }
173 
174  // Option to require email exists to create ticket
175  if (getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS') && ($cid < 0 || empty($contacts[$cid]->socid))) {
176  $error++;
177  array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket"));
178  $action = '';
179  }
180  }
181 
182  $contact_lastname = '';
183  $contact_firstname = '';
184  $company_name = '';
185  $contact_phone = '';
186  if ($with_contact) {
187  // set linked contact to add in form
188  if (is_array($contacts) && count($contacts) == 1) {
189  $with_contact = current($contacts);
190  }
191 
192  // check mandatory fields on contact
193  $contact_lastname = trim(GETPOST('contact_lastname', 'alphanohtml'));
194  $contact_firstname = trim(GETPOST('contact_firstname', 'alphanohtml'));
195  $company_name = trim(GETPOST('company_name', 'alphanohtml'));
196  $contact_phone = trim(GETPOST('contact_phone', 'alphanohtml'));
197  if (!($with_contact->id > 0)) {
198  // check lastname
199  if (empty($contact_lastname)) {
200  $error++;
201  array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Lastname')));
202  $action = '';
203  }
204  // check firstname
205  if (empty($contact_firstname)) {
206  $error++;
207  array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Firstname')));
208  $action = '';
209  }
210  }
211  }
212 
213  if (!GETPOST("subject", "restricthtml")) {
214  $error++;
215  array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")));
216  $action = '';
217  }
218  if (!GETPOST("message", "restricthtml")) {
219  $error++;
220  array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")));
221  $action = '';
222  }
223 
224  // Check email address
225  if (!empty($origin_email) && !isValidEmail($origin_email)) {
226  $error++;
227  array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email")));
228  $action = '';
229  }
230 
231  // Check Captcha code if is enabled
232  if (getDolGlobalInt('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
233  $sessionkey = 'dol_antispam_value';
234  $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml'))));
235  if (!$ok) {
236  $error++;
237  array_push($object->errors, $langs->trans("ErrorBadValueForCode"));
238  $action = '';
239  }
240  }
241 
242  if (!$error) {
243  $object->type_code = GETPOST("type_code", 'aZ09');
244  $object->category_code = GETPOST("category_code", 'aZ09');
245  $object->severity_code = GETPOST("severity_code", 'aZ09');
246  $object->ip = getUserRemoteIP();
247 
248  $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
249  $now = dol_now();
250  $minmonthpost = dol_time_plus_duree($now, -1, "m");
251 
252  // Calculate nb of post for IP
253  $nb_post_ip = 0;
254  if ($nb_post_max > 0) { // Calculate only if there is a limit to check
255  $sql = "SELECT COUNT(ref) as nb_tickets";
256  $sql .= " FROM ".MAIN_DB_PREFIX."ticket";
257  $sql .= " WHERE ip = '".$db->escape($object->ip)."'";
258  $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
259  $resql = $db->query($sql);
260  if ($resql) {
261  $num = $db->num_rows($resql);
262  $i = 0;
263  while ($i < $num) {
264  $i++;
265  $obj = $db->fetch_object($resql);
266  $nb_post_ip = $obj->nb_tickets;
267  }
268  }
269  }
270 
271  $object->track_id = generate_random_id(16);
272 
273  $object->db->begin();
274 
275  $object->subject = GETPOST("subject", "restricthtml");
276  $object->message = GETPOST("message", "restricthtml");
277  $object->origin_email = $origin_email;
278 
279  $object->type_code = GETPOST("type_code", 'aZ09');
280  $object->category_code = GETPOST("category_code", 'aZ09');
281  $object->severity_code = GETPOST("severity_code", 'aZ09');
282 
283  if (!is_object($user)) {
284  $user = new User($db);
285  }
286 
287  // create third-party with contact
288  $usertoassign = 0;
289  if ($with_contact && !($with_contact->id > 0)) {
290  $company = new Societe($db);
291  if (!empty($company_name)) {
292  $company->name = $company_name;
293  } else {
294  $company->particulier = 1;
295  $company->name = dolGetFirstLastname($contact_firstname, $contact_lastname);
296  }
297  $result = $company->create($user);
298  if ($result < 0) {
299  $error++;
300  $errors = ($company->error ? array($company->error) : $company->errors);
301  array_push($object->errors, $errors);
302  $action = 'create_ticket';
303  }
304 
305  // create contact and link to this new company
306  if (!$error) {
307  $with_contact->email = $origin_email;
308  $with_contact->lastname = $contact_lastname;
309  $with_contact->firstname = $contact_firstname;
310  $with_contact->socid = $company->id;
311  $with_contact->phone_pro = $contact_phone;
312  $result = $with_contact->create($user);
313  if ($result < 0) {
314  $error++;
315  $errors = ($with_contact->error ? array($with_contact->error) : $with_contact->errors);
316  array_push($object->errors, $errors);
317  $action = 'create_ticket';
318  } else {
319  $contacts = array($with_contact);
320  }
321  }
322  }
323 
324  if (!empty($searched_companies) && is_array($searched_companies)) {
325  $object->fk_soc = $searched_companies[0]->id;
326  }
327 
328  if (is_array($contacts) && count($contacts) > 0 && $cid >= 0) {
329  $object->fk_soc = $contacts[$cid]->socid;
330  $usertoassign = $contacts[$cid]->id;
331  }
332 
333  $ret = $extrafields->setOptionalsFromPost(null, $object);
334 
335  // Generate new ref
336  $object->ref = $object->getDefaultRef();
337 
338  $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
339  $object->context['contactid'] = GETPOSTINT('contactid'); // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
340 
341  $object->context['createdfrompublicinterface'] = 1; // To make a difference between a ticket created from the public interface and a ticket directly created from dolibarr
342 
343  if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
344  $error++;
345  array_push($object->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
346  $action = 'create_ticket';
347  }
348 
349  if (!$error) {
350  // Creation of the ticket
351  $id = $object->create($user);
352  if ($id <= 0) {
353  $error++;
354  $errors = ($object->error ? array($object->error) : $object->errors);
355  array_push($object->errors, $object->error ? array($object->error) : $object->errors);
356  $action = 'create_ticket';
357  }
358  }
359 
360  if (!$error && $id > 0) {
361  if ($usertoassign > 0) {
362  $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0);
363  }
364 
365  if (!$error) {
366  $object->db->commit();
367  $action = "infos_success";
368  } else {
369  $object->db->rollback();
370  setEventMessages($object->error, $object->errors, 'errors');
371  $action = 'create_ticket';
372  }
373 
374  if (!$error) {
375  $res = $object->fetch($id);
376  if ($res) {
377  // Create form object
378  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
379  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
380  $formmail = new FormMail($db);
381 
382  // Init to avoid errors
383  $filepath = array();
384  $filename = array();
385  $mimetype = array();
386 
387  $attachedfiles = $formmail->get_attached_files();
388  $filepath = $attachedfiles['paths'];
389  $filename = $attachedfiles['names'];
390  $mimetype = $attachedfiles['mimes'];
391 
392  // Send email to customer
393  $appli = $mysoc->name;
394 
395  $subject = '['.$appli.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id);
396  $message = (getDolGlobalString('TICKET_MESSAGE_MAIL_NEW') !== '' ? getDolGlobalString('TICKET_MESSAGE_MAIL_NEW') : $langs->transnoentities('TicketNewEmailBody')).'<br><br>';
397  $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'<br>';
398 
399  $url_public_ticket = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', dol_buildpath('/public/ticket/', 2)).'view.php?track_id='.$object->track_id;
400  $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'" rel="nofollow noopener">'.$object->track_id.'</a>').'<br>';
401  $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'<br><br>';
402 
403  $message .= $infos_new_ticket;
404  $message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name));
405 
406  $sendto = GETPOST('email', 'alpha');
407 
408  $from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' <'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>';
409  $replyto = $from;
410  $sendtocc = '';
411  $deliveryreceipt = 0;
412 
413  if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') {
414  $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO');
415  $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
416  }
417  include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
418  $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket');
419  if ($mailfile->error || !empty($mailfile->errors)) {
420  setEventMessages($mailfile->error, $mailfile->errors, 'errors');
421  } else {
422  $result = $mailfile->sendfile();
423  }
424  if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') {
425  $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
426  }
427 
428  // Send email to TICKET_NOTIFICATION_EMAIL_TO
429  $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO');
430  if ($sendto) {
431  $appli = $mysoc->name;
432 
433  $subject = '['.$appli.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id);
434  $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'<br><br>';
435  $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
436  $message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
437  $message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
438  $message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
439  $message_admin .= '<li>'.$langs->trans('From').' : '.$object->origin_email.'</li>';
440  // Extrafields
441  $extrafields->fetch_name_optionals_label($object->table_element);
442  if (is_array($object->array_options) && count($object->array_options) > 0) {
443  foreach ($object->array_options as $key => $value) {
444  $key = substr($key, 8); // remove "options_"
445  $message_admin .= '<li>'.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'</li>';
446  }
447  }
448  $message_admin .= '</ul>';
449 
450  $message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
451  $message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'" rel="nofollow noopener">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
452 
453  $from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' <' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>';
454  $replyto = $from;
455 
456  if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '') {
457  $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO');
458  $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
459  }
460  include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
461  $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket');
462  if ($mailfile->error || !empty($mailfile->errors)) {
463  setEventMessages($mailfile->error, $mailfile->errors, 'errors');
464  } else {
465  $result = $mailfile->sendfile();
466  }
467  if ((getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO') !== '')) {
468  $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
469  }
470  }
471  }
472 
473  // Copy files into ticket directory
474  $object->copyFilesForTicket('');
475 
476  //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
477 
478  // Make a redirect to avoid to have ticket submitted twice if we make back
479  $messagetoshow = $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '{s1}', '{s2}');
480  $messagetoshow = str_replace(array('{s1}', '{s2}'), array('<strong>'.$object->track_id.'</strong>', '<strong>'.$object->ref.'</strong>'), $messagetoshow);
481  setEventMessages($messagetoshow, null, 'warnings');
482  setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
483 
484  header("Location: index.php".(!empty($entity) && isModEnabled('multicompany') ? '?entity='.$entity : ''));
485  exit;
486  }
487  } else {
488  setEventMessages($object->error, $object->errors, 'errors');
489  }
490  }
491  }
492 }
493 if (!empty($object->errors) || !empty($object->error)) {
494  setEventMessages($object->error, $object->errors, 'errors');
495 }
496 
497 
498 /*
499  * View
500  */
501 
502 $form = new Form($db);
503 $formticket = new FormTicket($db);
504 
505 if (!getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
506  print '<div class="error">'.$langs->trans('TicketPublicInterfaceForbidden').'</div>';
507  $db->close();
508  exit();
509 }
510 
511 $arrayofjs = array();
512 
513 $arrayofcss = array('/opensurvey/css/style.css', getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', '/ticket/').'css/styles.css.php');
514 
515 llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss);
516 
517 
518 print '<div class="ticketpublicarea ticketlargemargin centpercent">';
519 
520 if ($action != "infos_success") {
521  $formticket->withfromsocid = isset($socid) ? $socid : $user->socid;
522  $formticket->withtitletopic = 1;
523  $formticket->withcompany = 0;
524  $formticket->withusercreate = 1;
525  $formticket->fk_user_create = 0;
526  $formticket->withemail = 1;
527  $formticket->ispublic = 1;
528  $formticket->withfile = 2;
529  $formticket->action = 'create_ticket';
530  $formticket->withcancel = 1;
531 
532  $formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : ''));
533 
534  print load_fiche_titre($langs->trans('NewTicket'), '', '', 0, 0, 'marginleftonly');
535 
536  if (!getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM')) {
537  $langs->load("errors");
538  print '<div class="error">';
539  print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'<br>';
540  print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket"));
541  print '</div>';
542  } else {
543  //print '<div class="info marginleftonly marginrightonly">'.$langs->trans('TicketPublicInfoCreateTicket').'</div>';
544  $formticket->showForm(0, 'edit', 1, $with_contact);
545  }
546 }
547 
548 print '</div>';
549 
550 if (getDolGlobalInt('TICKET_SHOW_COMPANY_FOOTER')) {
551  // End of page
552  htmlPrintOnlineFooter($mysoc, $langs, 0, $suffix, $object);
553 }
554 
555 llxFooter('', 'public');
556 
557 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
llxFooter()
Empty footer.
Definition: wrapper.php:69
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage contact/addresses.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
Definition: user.class.php:50
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:745
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:124
dol_add_file_process($upload_dir, $allowoverwrite=0, $updatesessionordb=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='', $generatethumbs=1, $object=null)
Get and save an upload file (for example after submitting a new file a mail form).
Definition: files.lib.php:1862
dol_remove_file_process($filenb, $donotupdatesession=0, $donotdeletefile=1, $trackid='')
Remove an uploaded file (for example after submitting a new file a mail form).
Definition: files.lib.php:2043
dol_is_dir($folder)
Test if filename is a directory.
Definition: files.lib.php:489
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
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.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getUserRemoteIP()
Return the IP of remote user.
isModEnabled($module)
Is Dolibarr module enabled.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Class to generate the form for creating a new ticket.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
generate_random_id($car=16)
Generate a random id.
Definition: ticket.lib.php:205
llxHeaderTicket($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show http header, open body tag and show HTML header banner for public pages for tickets.
Definition: ticket.lib.php:227