dolibarr 22.0.5
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-2024 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
75// Load translation files
76$langs->loadLangs(array("members", "companies", "install", "other", "projects"));
77
78if (!getDolGlobalString('PROJECT_ENABLE_PUBLIC')) {
79 print $langs->trans("Form for public lead registration has not been enabled");
80 exit;
81}
82
83// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
84$hookmanager->initHooks(array('publicnewleadcard', 'globalcard'));
85
86$extrafields = new ExtraFields($db);
87
88$object = new Project($db);
89
90$user->loadDefaultValues();
91
92// Security check
93if (empty($conf->project->enabled)) {
94 httponly_accessforbidden('Module Project not enabled');
95}
96
97
111function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction
112{
113 global $conf, $langs, $mysoc;
114
115 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
116
117 print '<body id="mainbody" class="publicnewmemberform">';
118
119 include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
120 htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('PROJECT_PUBLIC_INTERFACE_TOPIC'), 'PROJECT_IMAGE_PUBLIC_NEWLEAD');
121
122 print '<div class="divmainbodylarge">';
123}
124
132function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
133{
134 print '</div>';
135
136 printCommonFooter('public');
137
138 print "</body>\n";
139 print "</html>\n";
140}
141
142
143
144/*
145 * Actions
146 */
147
148$parameters = array();
149// Note that $action and $object may have been modified by some hooks
150$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
151if ($reshook < 0) {
152 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
153}
154
155// Action called when page is submitted
156if (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.
157 $error = 0;
158 $urlback = '';
159
160 $db->begin();
161
162 if (!GETPOST('lastname', 'alpha')) {
163 $error++;
164 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
165 }
166 if (!GETPOST('firstname', 'alpha')) {
167 $error++;
168 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
169 }
170 if (!GETPOST('email', 'alpha')) {
171 $error++;
172 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
173 }
174 if (!GETPOST('description', 'alpha')) {
175 $error++;
176 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Message"))."<br>\n";
177 }
178 if (GETPOST('email', 'alpha') && !isValidEmail(GETPOST('email', 'alpha'))) {
179 $error++;
180 $langs->load("errors");
181 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email', 'alpha'))."<br>\n";
182 }
183 // Set default opportunity status
184 $defaultoppstatus = getDolGlobalInt('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD');
185 if (empty($defaultoppstatus)) {
186 $error++;
187 $langs->load("errors");
188 $errmsg .= $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Project"))."<br>\n";
189 }
190
191 $visibility = getDolGlobalString('PROJET_VISIBILITY');
192
193 $proj = new Project($db);
194 $thirdparty = new Societe($db);
195
196 if (!$error) {
197 // Search thirdparty and set it if found to the new created project
198 $result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', GETPOST('email', 'alpha'));
199 if ($result > 0) {
200 $proj->socid = $thirdparty->id;
201 } else {
202 // Create the prospect
203 if (GETPOST('societe', 'alpha')) {
204 $thirdparty->name = GETPOST('societe', 'alpha');
205 $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('lastname', 'alpha'));
206 } else {
207 $thirdparty->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('lastname', 'alpha'));
208 }
209 $thirdparty->email = GETPOST('email', 'alpha');
210 $thirdparty->address = GETPOST('address', 'alpha');
211 $thirdparty->zip = GETPOST('zip', 'int');
212 $thirdparty->town = GETPOST('town', 'alpha');
213 $thirdparty->country_id = GETPOSTINT('country_id');
214 $thirdparty->state_id = GETPOSTINT('state_id');
215 $thirdparty->client = $thirdparty::PROSPECT;
216 $thirdparty->code_client = 'auto';
217 $thirdparty->code_fournisseur = 'auto';
218
219 // Fill array 'array_options' with data from the form
220 $extrafields->fetch_name_optionals_label($thirdparty->table_element);
221 $ret = $extrafields->setOptionalsFromPost(null, $thirdparty, '', 1);
222 if ($ret < 0) {
223 $error++;
224 $errmsg = ($extrafields->error ? $extrafields->error.'<br>' : '').implode('<br>', $extrafields->errors);
225 }
226
227 if (!$error) {
228 $result = $thirdparty->create($user);
229 if ($result <= 0) {
230 $error++;
231 $errmsg = ($thirdparty->error ? $thirdparty->error.'<br>' : '').implode('<br>', $thirdparty->errors);
232 } else {
233 $proj->socid = $thirdparty->id;
234 }
235 }
236 }
237 }
238
239 if (!$error) {
240 // Defined the ref into $defaultref
241 $defaultref = '';
242 $modele = getDolGlobalString('PROJECT_ADDON', 'mod_project_simple');
243
244 // Search template files
245 $file = '';
246 $classname = '';
247 $reldir = '';
248 $filefound = 0;
249 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
250 foreach ($dirmodels as $reldir) {
251 $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
252 if (file_exists($file)) {
253 $filefound = 1;
254 $classname = $modele;
255 break;
256 }
257 }
258
259 if ($filefound && !empty($classname)) {
260 $result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
261 if (class_exists($classname)) {
262 $modProject = new $classname();
263 '@phan-var-force ModeleNumRefProjects $modProject';
264
265 $defaultref = $modProject->getNextValue($thirdparty, $object);
266 }
267 }
268
269 if (is_numeric($defaultref) && $defaultref <= 0) {
270 $defaultref = '';
271 }
272
273 if (empty($defaultref)) {
274 $defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
275 }
276
277 if ($visibility === "1") {
278 $proj->public = 1;
279 } elseif ($visibility === "0") {
280 $proj->public = 0;
281 } elseif (empty($visibility)) {
282 $proj->public = 1;
283 }
284
285 $proj->ref = $defaultref;
286 $proj->statut = $proj::STATUS_DRAFT;
287 $proj->status = $proj::STATUS_DRAFT;
288 $proj->usage_opportunity = 1;
289 $proj->title = $langs->trans("LeadFromPublicForm");
290 $proj->description = GETPOST("description", "alphanohtml");
291 $proj->opp_status = $defaultoppstatus;
292 $proj->fk_opp_status = $defaultoppstatus;
293
294 $proj->ip = getUserRemoteIP();
295 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
296 $now = dol_now();
297 $minmonthpost = dol_time_plus_duree($now, -1, "m");
298 $nb_post_ip = 0;
299 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
300 $sql = "SELECT COUNT(rowid) as nb_projets";
301 $sql .= " FROM ".MAIN_DB_PREFIX."projet";
302 $sql .= " WHERE ip = '".$db->escape($proj->ip)."'";
303 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
304 $resql = $db->query($sql);
305 if ($resql) {
306 $num = $db->num_rows($resql);
307 $i = 0;
308 while ($i < $num) {
309 $i++;
310 $obj = $db->fetch_object($resql);
311 $nb_post_ip = $obj->nb_projets;
312 }
313 }
314 }
315
316 // Fill array 'array_options' with data from the form
317 $extrafields->fetch_name_optionals_label($proj->table_element);
318 $ret = $extrafields->setOptionalsFromPost(null, $proj);
319 if ($ret < 0) {
320 $error++;
321 }
322
323 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
324 $error++;
325 $errmsg = $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
326 array_push($proj->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
327 }
328 // Create the project
329 if (!$error) {
330 $result = $proj->create($user);
331 if ($result > 0) {
332 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
333 $object = $proj;
334
335 if ($object->email) {
336 $subject = '';
337 $msg = '';
338
339 // Send subscription email
340 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
341 $formmail = new FormMail($db);
342 // Set output language
343 $outputlangs = new Translate('', $conf);
344 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
345 // Load traductions files required by page
346 $outputlangs->loadLangs(array("main", "members", "projects"));
347 // Get email content from template
348 $arraydefaultmessage = null;
349 $labeltouse = getDolGlobalString('PROJECT_EMAIL_TEMPLATE_AUTOLEAD');
350
351 if (!empty($labeltouse)) {
352 $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
353 }
354
355 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
356 $subject = $arraydefaultmessage->topic;
357 $msg = $arraydefaultmessage->content;
358 }
359 if (empty($labeltosue)) {
360 $appli = $mysoc->name;
361
362 $labeltouse = '['.$appli.'] '.$langs->trans("YourMessage");
363 $msg = $langs->trans("YourMessageHasBeenReceived");
364 }
365
366 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
367 complete_substitutions_array($substitutionarray, $outputlangs, $object);
368 $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
369 $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
370 if ($subjecttosend && $texttosend) {
371 $moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
372
373 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
374 }
375 /*if ($result < 0) {
376 $error++;
377 setEventMessages($object->error, $object->errors, 'errors');
378 }*/
379 }
380
381 if (!empty($backtopage)) {
382 $urlback = $backtopage;
383 } elseif (getDolGlobalString('PROJECT_URL_REDIRECT_LEAD')) {
384 $urlback = getDolGlobalString('PROJECT_URL_REDIRECT_LEAD');
385 // TODO Make replacement of __AMOUNT__, etc...
386 } else {
387 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
388 }
389
390 if (!empty($entity)) {
391 $urlback .= '&entity='.$entity;
392 }
393
394 dol_syslog("project lead ".$proj->ref." has been created, we redirect to ".$urlback);
395 } else {
396 $error++;
397 $errmsg .= $proj->error.'<br>'.implode('<br>', $proj->errors);
398 }
399 } else {
400 setEventMessage($errmsg, 'errors');
401 }
402 }
403
404 if (!$error) {
405 $db->commit();
406
407 header("Location: ".$urlback);
408 exit;
409 } else {
410 $db->rollback();
411 }
412}
413
414// Action called after a submitted was send and member created successfully
415// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
416if (empty($reshook) && $action == 'added') { // Test on permission not required here
417 llxHeaderVierge($langs->trans("NewLeadForm"));
418
419 // Si on a pas ete redirige
420 print '<br><br>';
421 print '<div class="center">';
422 print $langs->trans("NewLeadbyWeb");
423 print '</div>';
424
426 exit;
427}
428
429
430
431/*
432 * View
433 */
434
435$form = new Form($db);
436$formcompany = new FormCompany($db);
437
438$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
439
440llxHeaderVierge($langs->trans("NewContact"));
441
442print '<br>';
443
444print load_fiche_titre($langs->trans("NewContact"), '', '', 0, '', 'center');
445
446
447print '<div align="center">';
448print '<div id="divsubscribe">';
449
450print '<div class="center subscriptionformhelptext opacitymedium justify">';
451if (getDolGlobalString('PROJECT_NEWFORM_TEXT')) {
452 print $langs->trans(getDolGlobalString('PROJECT_NEWFORM_TEXT'))."<br>\n";
453} else {
454 print $langs->trans("FormForNewLeadDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
455}
456print '</div>';
457
458dol_htmloutput_errors($errmsg);
459
460// Print form
461print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newlead">'."\n";
462print '<input type="hidden" name="token" value="'.newToken().'" / >';
463print '<input type="hidden" name="entity" value="'.$entity.'" />';
464print '<input type="hidden" name="action" value="add" />';
465
466print '<br>';
467
468print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
469//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
470
471print dol_get_fiche_head();
472
473print '<script type="text/javascript">
474jQuery(document).ready(function () {
475 jQuery(document).ready(function () {
476 jQuery("#selectcountry_id").change(function() {
477 document.newlead.action.value="create";
478 document.newlead.submit();
479 });
480 });
481});
482</script>';
483
484
485print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
486
487// Lastname
488print '<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";
489// Firstname
490print '<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";
491// EMail
492print '<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";
493// Company
494print '<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";
495// Address
496print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
497print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
498// Zip / Town
499print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
500print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
501print ' / ';
502print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
503print '</td></tr>';
504// Country
505print '<tr><td>'.$langs->trans('Country').'</td><td>';
506$country_id = GETPOST('country_id');
507if (!$country_id && getDolGlobalString('PROJECT_NEWFORM_FORCECOUNTRYCODE')) {
508 $country_id = getCountry($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE, '2', $db, $langs);
509}
510if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
511 $country_code = dol_user_country();
512 //print $country_code;
513 if ($country_code) {
514 $new_country_id = getCountry($country_code, '3', $db, $langs);
515 //print 'xxx'.$country_code.' - '.$new_country_id;
516 if ($new_country_id) {
517 $country_id = $new_country_id;
518 }
519 }
520}
521$country_code = getCountry($country_id, '2', $db, $langs);
522print $form->select_country($country_id, 'country_id');
523print '</td></tr>';
524// State
525if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
526 print '<tr><td>'.$langs->trans('State').'</td><td>';
527 if ($country_code) {
528 print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
529 } else {
530 print '';
531 }
532 print '</td></tr>';
533}
534
535// Other attributes
536$parameters['tpl_context'] = 'public'; // define template context to public
537include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
538// Comments
539print '<tr>';
540print '<td class="tdtop">'.$langs->trans("Message").' <span class="star">*</span></td>';
541print '<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>';
542print '</tr>'."\n";
543
544print "</table>\n";
545
546print dol_get_fiche_end();
547
548// Save
549print '<div class="center">';
550print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
551if (!empty($backtopage)) {
552 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
553}
554print '</div>';
555
556
557print "</form>\n";
558print "<br>";
559print '</div></div>';
560
561
563
564$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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.
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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_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-...
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.
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.