dolibarr  x.y.z
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  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 /* We need object $user->default_values
26 if (!defined('NOREQUIREUSER')) {
27  define('NOREQUIREUSER', '1');
28 }*/
29 if (!defined('NOTOKENRENEWAL')) {
30  define('NOTOKENRENEWAL', '1');
31 }
32 if (!defined('NOREQUIREMENU')) {
33  define('NOREQUIREMENU', '1');
34 }
35 if (!defined('NOREQUIREHTML')) {
36  define('NOREQUIREHTML', '1');
37 }
38 if (!defined('NOLOGIN')) {
39  define("NOLOGIN", 1); // This means this output page does not require to be logged.
40 }
41 if (!defined('NOIPCHECK')) {
42  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
43 }
44 if (!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 $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
51 if (is_numeric($entity)) {
52  define("DOLENTITY", $entity);
53 }
54 
55 // Load Dolibarr environment
56 require '../../main.inc.php';
57 require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
58 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php';
59 require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
60 require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
61 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
62 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
63 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
64 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
65 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
66 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
67 
68 // Load translation files required by the page
69 $langs->loadLangs(array('companies', 'other', 'mails', 'ticket'));
70 
71 // Get parameters
72 $id = GETPOST('id', 'int');
73 $msg_id = GETPOST('msg_id', 'int');
74 $socid = GETPOST('socid', 'int');
75 $suffix = "";
76 
77 $action = GETPOST('action', 'aZ09');
78 $cancel = GETPOST('cancel', 'aZ09');
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 (!empty($conf->global->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 = DOL_URL_ROOT.'/public/ticket/index.php';
116 
117  header("Location: ".$backtopage);
118  exit;
119  }
120 
121  if (GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) {
125  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
126 
127  // Set tmp directory TODO Use a dedicated directory for temp mails 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';
137  }
138 
139  // Remove file
140  if (GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) {
141  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
142 
143  // Set tmp directory
144  $vardir = $conf->ticket->dir_output.'/';
145  $upload_dir_tmp = $vardir.'/temp/'.session_id();
146 
147  // TODO Delete only files that was uploaded from email form
148  dol_remove_file_process(GETPOST('removedfile'), 0, 0);
149  $action = 'create_ticket';
150  }
151 
152  if ($action == 'create_ticket' && GETPOST('save', 'alpha')) {
153  $error = 0;
154  $origin_email = GETPOST('email', 'alpha');
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 existant avec cette adresse 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 (!empty($conf->global->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  if (!GETPOST("subject", "restricthtml")) {
216  $error++;
217  array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")));
218  $action = '';
219  }
220  if (!GETPOST("message", "restricthtml")) {
221  $error++;
222  array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")));
223  $action = '';
224  }
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 (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) {
235  $sessionkey = 'dol_antispam_value';
236  $ok = (array_key_exists($sessionkey, $_SESSION) === true && (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", "restricthtml");
278  $object->message = GETPOST("message", "restricthtml");
279  $object->origin_email = $origin_email;
280 
281  $object->type_code = GETPOST("type_code", 'aZ09');
282  $object->category_code = GETPOST("category_code", 'aZ09');
283  $object->severity_code = GETPOST("severity_code", 'aZ09');
284 
285  if (!is_object($user)) {
286  $user = new User($db);
287  }
288 
289  // create third-party with contact
290  $usertoassign = 0;
291  if ($with_contact && !($with_contact->id > 0)) {
292  $company = new Societe($db);
293  if (!empty($company_name)) {
294  $company->name = $company_name;
295  } else {
296  $company->particulier = 1;
297  $company->name = dolGetFirstLastname($contact_firstname, $contact_lastname);
298  }
299  $result = $company->create($user);
300  if ($result < 0) {
301  $error++;
302  $errors = ($company->error ? array($company->error) : $company->errors);
303  array_push($object->errors, $errors);
304  $action = 'create_ticket';
305  }
306 
307  // create contact and link to this new company
308  if (!$error) {
309  $with_contact->email = $origin_email;
310  $with_contact->lastname = $contact_lastname;
311  $with_contact->firstname = $contact_firstname;
312  $with_contact->socid = $company->id;
313  $with_contact->phone_pro = $contact_phone;
314  $result = $with_contact->create($user);
315  if ($result < 0) {
316  $error++;
317  $errors = ($with_contact->error ? array($with_contact->error) : $with_contact->errors);
318  array_push($object->errors, $errors);
319  $action = 'create_ticket';
320  } else {
321  $contacts = array($with_contact);
322  }
323  }
324  }
325 
326  if (!empty($searched_companies) && is_array($searched_companies)) {
327  $object->fk_soc = $searched_companies[0]->id;
328  }
329 
330  if (is_array($contacts) && count($contacts) > 0 && $cid >= 0) {
331  $object->fk_soc = $contacts[$cid]->socid;
332  $usertoassign = $contacts[$cid]->id;
333  }
334 
335  $ret = $extrafields->setOptionalsFromPost(null, $object);
336 
337  // Generate new ref
338  $object->ref = $object->getDefaultRef();
339 
340  $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
341 
342  if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
343  $error++;
344  $errors = array($langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
345  array_push($object->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
346  $action = 'create_ticket';
347  }
348 
349  if (!$error) {
350  $id = $object->create($user);
351  if ($id <= 0) {
352  $error++;
353  $errors = ($object->error ? array($object->error) : $object->errors);
354  array_push($object->errors, $object->error ? array($object->error) : $object->errors);
355  $action = 'create_ticket';
356  }
357  }
358 
359  if (!$error && $id > 0) {
360  if ($usertoassign > 0) {
361  $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0);
362  }
363 
364  if (!$error) {
365  $object->db->commit();
366  $action = "infos_success";
367  } else {
368  $object->db->rollback();
369  setEventMessages($object->error, $object->errors, 'errors');
370  $action = 'create_ticket';
371  }
372 
373  if (!$error) {
374  $res = $object->fetch($id);
375  if ($res) {
376  // Create form object
377  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
378  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
379  $formmail = new FormMail($db);
380 
381  // Init to avoid errors
382  $filepath = array();
383  $filename = array();
384  $mimetype = array();
385 
386  $attachedfiles = $formmail->get_attached_files();
387  $filepath = $attachedfiles['paths'];
388  $filename = $attachedfiles['names'];
389  $mimetype = $attachedfiles['mimes'];
390 
391  // Send email to customer
392 
393  $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id);
394  $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'<br><br>';
395  $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'<br>';
396 
397  $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
398  $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'" rel="nofollow noopener">'.$object->track_id.'</a>').'<br>';
399  $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'<br><br>';
400 
401  $message .= $infos_new_ticket;
402  $message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name));
403 
404  $sendto = GETPOST('email', 'alpha');
405 
406  $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>';
407  $replyto = $from;
408  $sendtocc = '';
409  $deliveryreceipt = 0;
410 
411  if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
412  $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
413  $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
414  }
415  include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
416  $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket');
417  if ($mailfile->error || !empty($mailfile->errors)) {
418  setEventMessages($mailfile->error, $mailfile->errors, 'errors');
419  } else {
420  $result = $mailfile->sendfile();
421  }
422  if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
423  $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
424  }
425 
426  // Send email to TICKET_NOTIFICATION_EMAIL_TO
427  $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
428  if ($sendto) {
429  $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id);
430  $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'<br><br>';
431  $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
432  $message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
433  $message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
434  $message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
435  $message_admin .= '<li>'.$langs->trans('From').' : '.$object->origin_email.'</li>';
436  // Extrafields
437  $extrafields->fetch_name_optionals_label($object->table_element);
438  if (is_array($object->array_options) && count($object->array_options) > 0) {
439  foreach ($object->array_options as $key => $value) {
440  $key = substr($key, 8); // remove "options_"
441  $message_admin .= '<li>'.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'</li>';
442  }
443  }
444  $message_admin .= '</ul>';
445 
446  $message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
447  $message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'" rel="nofollow noopener">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
448 
449  $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
450  $replyto = $from;
451 
452  if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
453  $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
454  $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
455  }
456  include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
457  $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket');
458  if ($mailfile->error || !empty($mailfile->errors)) {
459  setEventMessages($mailfile->error, $mailfile->errors, 'errors');
460  } else {
461  $result = $mailfile->sendfile();
462  }
463  if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
464  $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
465  }
466  }
467  }
468 
469  // Copy files into ticket directory
470  $destdir = $conf->ticket->dir_output.'/'.$object->ref;
471  if (!dol_is_dir($destdir)) {
472  dol_mkdir($destdir);
473  }
474  foreach ($filename as $i => $val) {
475  dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1);
476  $formmail->remove_attached_files($i);
477  }
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 }
496 
497 
498 /*
499  * View
500  */
501 
502 $form = new Form($db);
503 $formticket = new FormTicket($db);
504 
505 if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) {
506  print '<div class="error">'.$langs->trans('TicketPublicInterfaceForbidden').'</div>';
507  $db->close();
508  exit();
509 }
510 
511 $arrayofjs = array();
512 $arrayofcss = array('/opensurvey/css/style.css', '/ticket/css/styles.css.php');
513 
514 llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss);
515 
516 
517 print '<div class="ticketpublicarea">';
518 
519 if ($action != "infos_success") {
520  $formticket->withfromsocid = isset($socid) ? $socid : $user->socid;
521  $formticket->withtitletopic = 1;
522  $formticket->withcompany = 0;
523  $formticket->withusercreate = 1;
524  $formticket->fk_user_create = 0;
525  $formticket->withemail = 1;
526  $formticket->ispublic = 1;
527  $formticket->withfile = 2;
528  $formticket->action = 'create_ticket';
529  $formticket->withcancel = 1;
530 
531  $formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : ''));
532 
533  print load_fiche_titre($langs->trans('NewTicket'), '', '', 0, 0, 'marginleftonly');
534 
535  if (empty($conf->global->TICKET_NOTIFICATION_EMAIL_FROM)) {
536  $langs->load("errors");
537  print '<div class="error">';
538  print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'<br>';
539  print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket"));
540  print '</div>';
541  } else {
542  //print '<div class="info marginleftonly marginrightonly">'.$langs->trans('TicketPublicInfoCreateTicket').'</div>';
543  $formticket->showForm(0, 'edit', 1, $with_contact);
544  }
545 }
546 
547 print '</div>';
548 
549 // End of page
550 htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object);
551 
552 llxFooter('', 'public');
553 
554 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:70
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.
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
Definition: user.class.php:45
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:121
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:1814
dol_is_dir($folder)
Test if filename is a directory.
Definition: files.lib.php:450
dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=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:1654
dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=1)
Move a file into another name.
Definition: files.lib.php:874
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return 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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
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:194
llxHeaderTicket($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
Show header for public pages.
Definition: ticket.lib.php:216