dolibarr 19.0.4
new.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
7 * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
8 * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30if (!defined('NOLOGIN')) {
31 define("NOLOGIN", 1); // This means this output page does not require to be logged.
32}
33if (!defined('NOCSRFCHECK')) {
34 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
35}
36if (!defined('NOIPCHECK')) {
37 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
38}
39if (!defined('NOBROWSERNOTIF')) {
40 define('NOBROWSERNOTIF', '1');
41}
42
43
44// For MultiCompany module.
45// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
46$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
47if (is_numeric($entity)) {
48 define("DOLENTITY", $entity);
49}
50
51// Load Dolibarr environment
52require '../../main.inc.php';
53require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
54require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
55require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
56require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
57require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
58require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
59
60// Init vars
61$errmsg = '';
62$error = 0;
63$backtopage = GETPOST('backtopage', 'alpha');
64$action = GETPOST('action', 'aZ09');
65
66// Load translation files
67$langs->loadLangs(array("members", "companies", "install", "other", "projects"));
68
69if (!getDolGlobalString('PROJECT_ENABLE_PUBLIC')) {
70 print $langs->trans("Form for public lead registration has not been enabled");
71 exit;
72}
73
74// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
75$hookmanager->initHooks(array('publicnewleadcard', 'globalcard'));
76
77$extrafields = new ExtraFields($db);
78
79$object = new Project($db);
80
81$user->loadDefaultValues();
82
83// Security check
84if (empty($conf->project->enabled)) {
85 httponly_accessforbidden('Module Project not enabled');
86}
87
88
100function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
101{
102 global $user, $conf, $langs, $mysoc;
103
104 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
105
106 print '<body id="mainbody" class="publicnewmemberform">';
107
108 // Define urllogo
109 $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
110
111 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
112 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
113 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
114 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
115 } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
116 $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
117 }
118
119 print '<div class="center">';
120
121 // Output html code for logo
122 if ($urllogo) {
123 print '<div class="backgreypublicpayment">';
124 print '<div class="logopublicpayment">';
125 print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
126 print '>';
127 print '</div>';
128 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
129 print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
130 }
131 print '</div>';
132 }
133
134 if (getDolGlobalString('PROJECT_IMAGE_PUBLIC_NEWLEAD')) {
135 print '<div class="backimagepublicnewlead">';
136 print '<img id="idPROJECT_IMAGE_PUBLIC_NEWLEAD" src="' . getDolGlobalString('PROJECT_IMAGE_PUBLIC_NEWLEAD').'">';
137 print '</div>';
138 }
139
140 print '</div>';
141
142 print '<div class="divmainbodylarge">';
143}
144
151{
152 print '</div>';
153
154 printCommonFooter('public');
155
156 print "</body>\n";
157 print "</html>\n";
158}
159
160
161
162/*
163 * Actions
164 */
165
166$parameters = array();
167// Note that $action and $object may have been modified by some hooks
168$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
169if ($reshook < 0) {
170 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
171}
172
173// Action called when page is submitted
174if (empty($reshook) && $action == 'add') {
175 $error = 0;
176 $urlback = '';
177
178 $db->begin();
179
180 if (!GETPOST("lastname")) {
181 $error++;
182 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
183 }
184 if (!GETPOST("firstname")) {
185 $error++;
186 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
187 }
188 if (!GETPOST("email")) {
189 $error++;
190 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
191 }
192 if (!GETPOST("description")) {
193 $error++;
194 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Message"))."<br>\n";
195 }
196 if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
197 $error++;
198 $langs->load("errors");
199 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
200 }
201 // Set default opportunity status
202 $defaultoppstatus = getDolGlobalString('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD');
203 if (empty($defaultoppstatus)) {
204 $error++;
205 $langs->load("errors");
206 $errmsg .= $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Project"))."<br>\n";
207 }
208
209 $visibility = getDolGlobalString('PROJET_VISIBILITY');
210
211 $proj = new Project($db);
212 $thirdparty = new Societe($db);
213
214 if (!$error) {
215 // Search thirdparty and set it if found to the new created project
216 $result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', GETPOST('email'));
217 if ($result > 0) {
218 $proj->socid = $thirdparty->id;
219 } else {
220 // Create the prospect
221 if (GETPOST('societe')) {
222 $thirdparty->name = GETPOST('societe');
223 $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
224 } else {
225 $thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
226 }
227 $thirdparty->email = GETPOST('email');
228 $thirdparty->address = GETPOST('address');
229 $thirdparty->zip = GETPOST('zip');
230 $thirdparty->town = GETPOST('town');
231 $thirdparty->country_id = GETPOST('country_id', 'int');
232 $thirdparty->state_id = GETPOST('state_id');
233 $thirdparty->client = $thirdparty::PROSPECT;
234 $thirdparty->code_client = 'auto';
235 $thirdparty->code_fournisseur = 'auto';
236
237 // Fill array 'array_options' with data from the form
238 $extrafields->fetch_name_optionals_label($thirdparty->table_element);
239 $ret = $extrafields->setOptionalsFromPost(null, $thirdparty, '', 1);
240 //var_dump($thirdparty->array_options);exit;
241 if ($ret < 0) {
242 $error++;
243 $errmsg = ($extrafields->error ? $extrafields->error.'<br>' : '').join('<br>', $extrafields->errors);
244 }
245
246 if (!$error) {
247 $result = $thirdparty->create($user);
248 if ($result <= 0) {
249 $error++;
250 $errmsg = ($thirdparty->error ? $thirdparty->error.'<br>' : '').join('<br>', $thirdparty->errors);
251 } else {
252 $proj->socid = $thirdparty->id;
253 }
254 }
255 }
256 }
257
258 if (!$error) {
259 // Defined the ref into $defaultref
260 $defaultref = '';
261 $modele = !getDolGlobalString('PROJECT_ADDON') ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
262
263 // Search template files
264 $file = '';
265 $classname = '';
266 $filefound = 0;
267 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
268 foreach ($dirmodels as $reldir) {
269 $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
270 if (file_exists($file)) {
271 $filefound = 1;
272 $classname = $modele;
273 break;
274 }
275 }
276
277 if ($filefound) {
278 $result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
279 $modProject = new $classname();
280
281 $defaultref = $modProject->getNextValue($thirdparty, $object);
282 }
283
284 if (is_numeric($defaultref) && $defaultref <= 0) {
285 $defaultref = '';
286 }
287
288 if (empty($defaultref)) {
289 $defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
290 }
291
292 if ($visibility === "1") {
293 $proj->public = 1;
294 } elseif ($visibility === "0") {
295 $proj->public = 0;
296 } elseif (empty($visibility)) {
297 $proj->public = 1;
298 }
299
300 $proj->ref = $defaultref;
301 $proj->statut = $proj::STATUS_DRAFT;
302 $proj->status = $proj::STATUS_DRAFT;
303 $proj->usage_opportunity = 1;
304 $proj->title = $langs->trans("LeadFromPublicForm");
305 $proj->description = GETPOST("description", "alphanohtml");
306 $proj->opp_status = $defaultoppstatus;
307 $proj->fk_opp_status = $defaultoppstatus;
308
309 $proj->ip = getUserRemoteIP();
310 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
311 $now = dol_now();
312 $minmonthpost = dol_time_plus_duree($now, -1, "m");
313 $nb_post_ip = 0;
314 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
315 $sql = "SELECT COUNT(rowid) as nb_projets";
316 $sql .= " FROM ".MAIN_DB_PREFIX."projet";
317 $sql .= " WHERE ip = '".$db->escape($proj->ip)."'";
318 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
319 $resql = $db->query($sql);
320 if ($resql) {
321 $num = $db->num_rows($resql);
322 $i = 0;
323 while ($i < $num) {
324 $i++;
325 $obj = $db->fetch_object($resql);
326 $nb_post_ip = $obj->nb_projets;
327 }
328 }
329 }
330
331 // Fill array 'array_options' with data from the form
332 $extrafields->fetch_name_optionals_label($proj->table_element);
333 $ret = $extrafields->setOptionalsFromPost(null, $proj);
334 if ($ret < 0) {
335 $error++;
336 }
337
338 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
339 $error++;
340 $errmsg = $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
341 array_push($proj->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
342 }
343 // Create the project
344 if (!$error) {
345 $result = $proj->create($user);
346 if ($result > 0) {
347 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
348 $object = $proj;
349
350 if ($object->email) {
351 $subject = '';
352 $msg = '';
353
354 // Send subscription email
355 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
356 $formmail = new FormMail($db);
357 // Set output language
358 $outputlangs = new Translate('', $conf);
359 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
360 // Load traductions files required by page
361 $outputlangs->loadLangs(array("main", "members", "projects"));
362 // Get email content from template
363 $arraydefaultmessage = null;
364 $labeltouse = $conf->global->PROJECT_EMAIL_TEMPLATE_AUTOLEAD;
365
366 if (!empty($labeltouse)) {
367 $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
368 }
369
370 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
371 $subject = $arraydefaultmessage->topic;
372 $msg = $arraydefaultmessage->content;
373 }
374 if (empty($labeltosue)) {
375 $appli = $mysoc->name;
376
377 $labeltouse = '['.$appli.'] '.$langs->trans("YourMessage");
378 $msg = $langs->trans("YourMessageHasBeenReceived");
379 }
380
381 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
382 complete_substitutions_array($substitutionarray, $outputlangs, $object);
383 $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
384 $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
385 if ($subjecttosend && $texttosend) {
386 $moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
387
388 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
389 }
390 /*if ($result < 0) {
391 $error++;
392 setEventMessages($object->error, $object->errors, 'errors');
393 }*/
394 }
395
396 if (!empty($backtopage)) {
397 $urlback = $backtopage;
398 } elseif (getDolGlobalString('PROJECT_URL_REDIRECT_LEAD')) {
399 $urlback = $conf->global->PROJECT_URL_REDIRECT_LEAD;
400 // TODO Make replacement of __AMOUNT__, etc...
401 } else {
402 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
403 }
404
405 if (!empty($entity)) {
406 $urlback .= '&entity='.$entity;
407 }
408
409 dol_syslog("project lead ".$proj->ref." has been created, we redirect to ".$urlback);
410 } else {
411 $error++;
412 $errmsg .= $proj->error.'<br>'.join('<br>', $proj->errors);
413 }
414 } else {
415 setEventMessage($errmsg, 'errors');
416 }
417 }
418
419 if (!$error) {
420 $db->commit();
421
422 Header("Location: ".$urlback);
423 exit;
424 } else {
425 $db->rollback();
426 }
427}
428
429// Action called after a submitted was send and member created successfully
430// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
431if (empty($reshook) && $action == 'added') {
432 llxHeaderVierge($langs->trans("NewLeadForm"));
433
434 // Si on a pas ete redirige
435 print '<br><br>';
436 print '<div class="center">';
437 print $langs->trans("NewLeadbyWeb");
438 print '</div>';
439
441 exit;
442}
443
444
445
446/*
447 * View
448 */
449
450$form = new Form($db);
451$formcompany = new FormCompany($db);
452
453$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
454
455llxHeaderVierge($langs->trans("NewContact"));
456
457
458print load_fiche_titre($langs->trans("NewContact"), '', '', 0, 0, 'center');
459
460
461print '<div align="center">';
462print '<div id="divsubscribe">';
463
464print '<div class="center subscriptionformhelptext opacitymedium justify">';
465if (getDolGlobalString('PROJECT_NEWFORM_TEXT')) {
466 print $langs->trans($conf->global->PROJECT_NEWFORM_TEXT)."<br>\n";
467} else {
468 print $langs->trans("FormForNewLeadDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
469}
470print '</div>';
471
472dol_htmloutput_errors($errmsg);
473
474// Print form
475print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newlead">'."\n";
476print '<input type="hidden" name="token" value="'.newToken().'" / >';
477print '<input type="hidden" name="entity" value="'.$entity.'" />';
478print '<input type="hidden" name="action" value="add" />';
479
480print '<br>';
481
482print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
483//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
484
485print dol_get_fiche_head('');
486
487print '<script type="text/javascript">
488jQuery(document).ready(function () {
489 jQuery(document).ready(function () {
490 jQuery("#selectcountry_id").change(function() {
491 document.newlead.action.value="create";
492 document.newlead.submit();
493 });
494 });
495});
496</script>';
497
498
499print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
500
501// Lastname
502print '<tr><td>'.$langs->trans("Lastname").' <span class="star">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'" required></td></tr>'."\n";
503// Firstname
504print '<tr><td>'.$langs->trans("Firstname").' <span class="star">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'" required></td></tr>'."\n";
505// EMail
506print '<tr><td>'.$langs->trans("Email").' <span class="star">*</span></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'" required></td></tr>'."\n";
507// Company
508print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
509// Address
510print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
511print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
512// Zip / Town
513print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
514print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
515print ' / ';
516print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
517print '</td></tr>';
518// Country
519print '<tr><td>'.$langs->trans('Country').'</td><td>';
520$country_id = GETPOST('country_id');
521if (!$country_id && getDolGlobalString('PROJECT_NEWFORM_FORCECOUNTRYCODE')) {
522 $country_id = getCountry($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
523}
524if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
525 $country_code = dol_user_country();
526 //print $country_code;
527 if ($country_code) {
528 $new_country_id = getCountry($country_code, 3, $db, $langs);
529 //print 'xxx'.$country_code.' - '.$new_country_id;
530 if ($new_country_id) {
531 $country_id = $new_country_id;
532 }
533 }
534}
535$country_code = getCountry($country_id, 2, $db, $langs);
536print $form->select_country($country_id, 'country_id');
537print '</td></tr>';
538// State
539if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
540 print '<tr><td>'.$langs->trans('State').'</td><td>';
541 if ($country_code) {
542 print $formcompany->select_state(GETPOST("state_id", 'int'), $country_code);
543 } else {
544 print '';
545 }
546 print '</td></tr>';
547}
548
549// Other attributes
550$parameters['tpl_context']='public'; // define template context to public
551include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
552// Comments
553print '<tr>';
554print '<td class="tdtop">'.$langs->trans("Message").' <span class="star">*</span></td>';
555print '<td class="tdtop"><textarea name="description" id="description" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_5.'" required>'.dol_escape_htmltag(GETPOST('description', 'restricthtml'), 0, 1).'</textarea></td>';
556print '</tr>'."\n";
557
558print "</table>\n";
559
560print dol_get_fiche_end();
561
562// Save
563print '<div class="center">';
564print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
565if (!empty($backtopage)) {
566 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
567}
568print '</div>';
569
570
571print "</form>\n";
572print "<br>";
573print '</div></div>';
574
575
577
578$db->close();
if(!defined( 'NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined( 'NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined( 'NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined( 'NOIPCHECK')) llxHeaderVierge()
Header function.
Class to manage standard extra fields.
Class to build HTML component for third parties management Only common components are here.
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 projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
llxFooterVierge()
Show footer for new societe.
Definition new.php:158
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:125
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_user_country()
Return country code for current user.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
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.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
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_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.