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