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