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