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