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