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