dolibarr 23.0.3
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-2025 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31if (!defined('NOLOGIN')) {
32 define("NOLOGIN", 1); // This means this output page does not require to be logged.
33}
34if (!defined('NOCSRFCHECK')) {
35 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
36}
37if (!defined('NOIPCHECK')) {
38 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
39}
40if (!defined('NOBROWSERNOTIF')) {
41 define('NOBROWSERNOTIF', '1');
42}
43
44
45// For MultiCompany module.
46// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
47// Because 2 entities can have the same ref.
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.'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
57require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
58require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
59require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
60
61// Init vars
62$errmsg = '';
63$error = 0;
64$backtopage = GETPOST('backtopage', 'alpha');
65$action = GETPOST('action', 'aZ09');
66
76// Load translation files
77$langs->loadLangs(array("members", "companies", "install", "other", "projects"));
78
79if (!getDolGlobalString('PROJECT_ENABLE_PUBLIC')) {
80 print $langs->trans("FormForPublicLeadRegistrationHasNotBeenEnabled");
81 exit;
82}
83
84// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
85$hookmanager->initHooks(array('publicnewleadcard', 'globalcard'));
86
87$extrafields = new ExtraFields($db);
88
89$object = new Project($db);
90
91$user->loadDefaultValues();
92
93// Security check
94if (empty($conf->project->enabled)) {
95 httponly_accessforbidden('Module Project not enabled');
96}
97
98
112function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction
113{
114 global $conf, $langs, $mysoc;
115
116 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
117
118 print '<body id="mainbody" class="publicnewmemberform">';
119
120 include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
121 htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('PROJECT_PUBLIC_INTERFACE_TOPIC'), 'PROJECT_IMAGE_PUBLIC_NEWLEAD');
122
123 print '<div class="divmainbodylarge">';
124}
125
133function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
134{
135 print '</div>';
136
137 printCommonFooter('public');
138
139 print "</body>\n";
140 print "</html>\n";
141}
142
143
144
145/*
146 * Actions
147 */
148
149$parameters = array();
150// Note that $action and $object may have been modified by some hooks
151$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
152if ($reshook < 0) {
153 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
154}
155
156// Action called when page is submitted
157if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous public submission form. Check is done on the constant to enable feature + mitigation.
158 $error = 0;
159 $urlback = '';
160
161 $db->begin();
162
163 if (!GETPOST('lastname', 'alpha')) {
164 $error++;
165 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
166 }
167 if (!GETPOST('firstname', 'alpha')) {
168 $error++;
169 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
170 }
171 if (!GETPOST('email', 'alpha')) {
172 $error++;
173 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
174 }
175 if (!GETPOST('description', 'alpha')) {
176 $error++;
177 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Message"))."<br>\n";
178 }
179 if (GETPOST('email', 'alpha') && !isValidEmail(GETPOST('email', 'alpha'))) {
180 $error++;
181 $langs->load("errors");
182 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email', 'alpha'))."<br>\n";
183 }
184 // Set default opportunity status
185 $defaultoppstatus = getDolGlobalInt('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD');
186 if (empty($defaultoppstatus)) {
187 $error++;
188 $langs->load("errors");
189 $errmsg .= $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Project"))."<br>\n";
190 }
191
192 $visibility = getDolGlobalString('PROJET_VISIBILITY');
193
194 $proj = new Project($db);
195 $thirdparty = new Societe($db);
196
197 if (!$error) {
198 // Search thirdparty and set it if found to the new created project
199 $result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', GETPOST('email', 'alpha'));
200 if ($result > 0) {
201 $proj->socid = $thirdparty->id;
202 } else {
203 // Create the prospect
204 if (GETPOST('societe', 'alpha')) {
205 $thirdparty->name = GETPOST('societe', 'alpha');
206 $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('lastname', 'alpha'));
207 } else {
208 $thirdparty->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('lastname', 'alpha'));
209 }
210 $thirdparty->email = GETPOST('email', 'alpha');
211 $thirdparty->address = GETPOST('address', 'alpha');
212 $thirdparty->zip = GETPOST('zip', 'int');
213 $thirdparty->town = GETPOST('town', 'alpha');
214 $thirdparty->country_id = GETPOSTINT('country_id');
215 $thirdparty->state_id = GETPOSTINT('state_id');
216 $thirdparty->client = $thirdparty::PROSPECT;
217 $thirdparty->code_client = 'auto';
218 $thirdparty->code_fournisseur = 'auto';
219
220 // Fill array 'array_options' with data from the form
221 $extrafields->fetch_name_optionals_label($thirdparty->table_element);
222 $ret = $extrafields->setOptionalsFromPost(null, $thirdparty, '', 1);
223 if ($ret < 0) {
224 $error++;
225 $errmsg = ($extrafields->error ? $extrafields->error.'<br>' : '').implode('<br>', $extrafields->errors);
226 }
227
228 if (!$error) {
229 $result = $thirdparty->create($user);
230 if ($result <= 0) {
231 $error++;
232 $errmsg = ($thirdparty->error ? $thirdparty->error.'<br>' : '').implode('<br>', $thirdparty->errors);
233 } else {
234 $proj->socid = $thirdparty->id;
235 }
236 }
237 }
238 }
239
240 if (!$error) {
241 // Defined the ref into $defaultref
242 $defaultref = '';
243 $modele = getDolGlobalString('PROJECT_ADDON', 'mod_project_simple');
244
245 // Search template files
246 $file = '';
247 $classname = '';
248 $reldir = '';
249 $filefound = 0;
250 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
251 foreach ($dirmodels as $reldir) {
252 $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
253 if (file_exists($file)) {
254 $filefound = 1;
255 $classname = $modele;
256 break;
257 }
258 }
259
260 if ($filefound && !empty($classname)) {
261 $result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
262 if (class_exists($classname)) {
263 $modProject = new $classname();
264 '@phan-var-force ModeleNumRefProjects $modProject';
265
266 $defaultref = $modProject->getNextValue($thirdparty, $object);
267 }
268 }
269
270 if (is_numeric($defaultref) && $defaultref <= 0) {
271 $defaultref = '';
272 }
273
274 if (empty($defaultref)) {
275 $defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
276 }
277
278 if ($visibility === "1") {
279 $proj->public = 1;
280 } elseif ($visibility === "0") {
281 $proj->public = 0;
282 } elseif (empty($visibility)) {
283 $proj->public = 1;
284 }
285
286 $proj->ref = $defaultref;
287 $proj->statut = $proj::STATUS_DRAFT;
288 $proj->status = $proj::STATUS_DRAFT;
289 $proj->usage_opportunity = 1;
290 $proj->title = $langs->trans("LeadFromPublicForm");
291 $proj->description = GETPOST("description", "alphanohtml");
292 $proj->opp_status = $defaultoppstatus;
293 $proj->fk_opp_status = $defaultoppstatus;
294
295 $proj->ip = getUserRemoteIP();
296 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
297 $now = dol_now();
298 $minmonthpost = dol_time_plus_duree($now, -1, "m");
299 $nb_post_ip = 0;
300 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
301 $sql = "SELECT COUNT(rowid) as nb_projets";
302 $sql .= " FROM ".MAIN_DB_PREFIX."projet";
303 $sql .= " WHERE ip = '".$db->escape($proj->ip)."'";
304 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
305 $resql = $db->query($sql);
306 if ($resql) {
307 $num = $db->num_rows($resql);
308 $i = 0;
309 while ($i < $num) {
310 $i++;
311 $obj = $db->fetch_object($resql);
312 $nb_post_ip = $obj->nb_projets;
313 }
314 }
315 }
316
317 // Fill array 'array_options' with data from the form
318 $extrafields->fetch_name_optionals_label($proj->table_element);
319 $ret = $extrafields->setOptionalsFromPost(null, $proj);
320 if ($ret < 0) {
321 $error++;
322 }
323
324 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
325 $error++;
326 $errmsg = $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
327 array_push($proj->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
328 }
329 // Create the project
330 if (!$error) {
331 $result = $proj->create($user);
332 if ($result > 0) {
333 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
334 $object = $proj;
335
336 if ($object->email) {
337 $subject = '';
338 $msg = '';
339
340 // Send subscription email
341 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
342 $formmail = new FormMail($db);
343 // Set output language
344 $outputlangs = new Translate('', $conf);
345 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
346 // Load traductions files required by page
347 $outputlangs->loadLangs(array("main", "members", "projects"));
348 // Get email content from template
349 $arraydefaultmessage = null;
350 $labeltouse = getDolGlobalString('PROJECT_EMAIL_TEMPLATE_AUTOLEAD');
351
352 if (!empty($labeltouse)) {
353 $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
354 }
355
356 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
357 $subject = $arraydefaultmessage->topic;
358 $msg = $arraydefaultmessage->content;
359 }
360 if (empty($labeltosue)) {
361 $appli = $mysoc->name;
362
363 $labeltouse = '['.$appli.'] '.$langs->trans("YourMessage");
364 $msg = $langs->trans("YourMessageHasBeenReceived");
365 }
366
367 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
368 complete_substitutions_array($substitutionarray, $outputlangs, $object);
369 $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
370 $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
371 if ($subjecttosend && $texttosend) {
372 $moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
373
374 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
375 }
376 /*if ($result < 0) {
377 $error++;
378 setEventMessages($object->error, $object->errors, 'errors');
379 }*/
380 }
381
382 if (!empty($backtopage)) {
383 $urlback = $backtopage;
384 } elseif (getDolGlobalString('PROJECT_URL_REDIRECT_LEAD')) {
385 $urlback = getDolGlobalString('PROJECT_URL_REDIRECT_LEAD');
386 // TODO Make replacement of __AMOUNT__, etc...
387 } else {
388 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
389 }
390
391 if (!empty($entity)) {
392 $urlback .= '&entity='.$entity;
393 }
394
395 dol_syslog("project lead ".$proj->ref." has been created, we redirect to ".$urlback);
396 } else {
397 $error++;
398 $errmsg .= $proj->error.'<br>'.implode('<br>', $proj->errors);
399 }
400 } else {
401 setEventMessage($errmsg, 'errors');
402 }
403 }
404
405 if (!$error) {
406 $db->commit();
407
408 header("Location: ".$urlback);
409 exit;
410 } else {
411 $db->rollback();
412 }
413}
414
415// Action called after a submitted was send and member created successfully
416// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
417if (empty($reshook) && $action == 'added') { // Test on permission not required here
418 llxHeaderVierge($langs->trans("NewLeadForm"));
419
420 // Si on a pas ete redirige
421 print '<br><br>';
422 print '<div class="center">';
423 print $langs->trans("NewLeadbyWeb");
424 print '</div>';
425
427 exit;
428}
429
430
431
432/*
433 * View
434 */
435
436$form = new Form($db);
437$formcompany = new FormCompany($db);
438
439$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
440
441llxHeaderVierge($langs->trans("NewContact"));
442
443print '<br>';
444
445print load_fiche_titre($langs->trans("NewContact"), '', '', 0, '', 'center');
446
447
448print '<div align="center">';
449print '<div id="divsubscribe">';
450
451print '<div class="center subscriptionformhelptext opacitymedium justify">';
452if (getDolGlobalString('PROJECT_NEWFORM_TEXT')) {
453 print $langs->trans(getDolGlobalString('PROJECT_NEWFORM_TEXT'))."<br>\n";
454} else {
455 print $langs->trans("FormForNewLeadDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
456}
457print '</div>';
458
459dol_htmloutput_errors($errmsg);
460
461// Print form
462print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newlead">'."\n";
463print '<input type="hidden" name="token" value="'.newToken().'" / >';
464print '<input type="hidden" name="entity" value="'.$entity.'" />';
465print '<input type="hidden" name="action" value="add" />';
466
467print '<br>';
468
469print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
470//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
471
472print dol_get_fiche_head();
473
474print '<script type="text/javascript">
475jQuery(document).ready(function () {
476 jQuery(document).ready(function () {
477 jQuery("#selectcountry_id").change(function() {
478 document.newlead.action.value="create";
479 document.newlead.submit();
480 });
481 });
482});
483</script>';
484
485
486print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
487
488// Lastname
489print '<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";
490// Firstname
491print '<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";
492// EMail
493print '<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";
494// Company
495print '<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";
496// Address
497print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
498print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
499// Zip / Town
500print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
501print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
502print ' / ';
503print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
504print '</td></tr>';
505// Country
506print '<tr><td>'.$langs->trans('Country').'</td><td>';
507$country_id = GETPOST('country_id');
508if (!$country_id && getDolGlobalString('PROJECT_NEWFORM_FORCECOUNTRYCODE')) {
509 $country_id = getCountry($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE, '2', $db, $langs);
510}
511if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
512 $country_code = dol_user_country();
513 //print $country_code;
514 if ($country_code) {
515 $new_country_id = getCountry($country_code, '3', $db, $langs);
516 //print 'xxx'.$country_code.' - '.$new_country_id;
517 if ($new_country_id) {
518 $country_id = $new_country_id;
519 }
520 }
521}
522$country_code = getCountry($country_id, '2', $db, $langs);
523print $form->select_country($country_id, 'country_id');
524print '</td></tr>';
525// State
526if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
527 print '<tr><td>'.$langs->trans('State').'</td><td>';
528 if ($country_code) {
529 print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
530 } else {
531 print '';
532 }
533 print '</td></tr>';
534}
535
536// Other attributes
537$parameters['tpl_context'] = 'public'; // define template context to public
538include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
539// Comments
540print '<tr>';
541print '<td class="tdtop">'.$langs->trans("Message").' <span class="star">*</span></td>';
542print '<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>';
543print '</tr>'."\n";
544
545print "</table>\n";
546
547print dol_get_fiche_end();
548
549// Save
550print '<div class="center">';
551print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
552if (!empty($backtopage)) {
553 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
554}
555print '</div>';
556
557
558print "</form>\n";
559print "<br>";
560print '</div></div>';
561
562
564
565$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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.
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show header for new prospect.
Definition new.php:122
llxFooterVierge()
Show footer for new societe.
Definition new.php:143
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
global $mysoc
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:125
dol_now($mode='gmt')
Return date for now.
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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, $attop=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-...
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted 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)
Output 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.