dolibarr  x.y.z
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 
43 
44 // For MultiCompany module.
45 // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
46 $entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
47 if (is_numeric($entity)) {
48  define("DOLENTITY", $entity);
49 }
50 
51 // Load Dolibarr environment
52 require '../../main.inc.php';
53 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
54 require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
55 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
56 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
57 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
58 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
59 
60 // Init vars
61 $errmsg = '';
62 $error = 0;
63 $backtopage = GETPOST('backtopage', 'alpha');
64 $action = GETPOST('action', 'aZ09');
65 
66 // Load translation files
67 $langs->loadLangs(array("members", "companies", "install", "other", "projects"));
68 
69 if (empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
70  print $langs->trans("Form for public lead registration has not been enabled");
71  exit;
72 }
73 
74 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
75 $hookmanager->initHooks(array('publicnewleadcard', 'globalcard'));
76 
77 $extrafields = new ExtraFields($db);
78 
79 $object = new Project($db);
80 
81 $user->loadDefaultValues();
82 
83 // Security check
84 if (empty($conf->project->enabled)) {
85  httponly_accessforbidden('Module Project not enabled');
86 }
87 
88 
100 function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
101 {
102  global $user, $conf, $langs, $mysoc;
103 
104  top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
105 
106  print '<body id="mainbody" class="publicnewmemberform">';
107 
108  // Define urllogo
109  $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
110 
111  if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
112  $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
113  } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
114  $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
115  } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
116  $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
117  }
118 
119  print '<div class="center">';
120 
121  // Output html code for logo
122  if ($urllogo) {
123  print '<div class="backgreypublicpayment">';
124  print '<div class="logopublicpayment">';
125  print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
126  print '>';
127  print '</div>';
128  if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
129  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>';
130  }
131  print '</div>';
132  }
133 
134  if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_NEWLEAD)) {
135  print '<div class="backimagepublicnewlead">';
136  print '<img id="idPROJECT_IMAGE_PUBLIC_NEWLEAD" src="'.$conf->global->PROJECT_IMAGE_PUBLIC_NEWLEAD.'">';
137  print '</div>';
138  }
139 
140  print '</div>';
141 
142  print '<div class="divmainbodylarge">';
143 }
144 
150 function llxFooterVierge()
151 {
152  print '</div>';
153 
154  printCommonFooter('public');
155 
156  print "</body>\n";
157  print "</html>\n";
158 }
159 
160 
161 
162 /*
163  * Actions
164  */
165 
166 $parameters = array();
167 // Note that $action and $object may have been modified by some hooks
168 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
169 if ($reshook < 0) {
170  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
171 }
172 
173 // Action called when page is submitted
174 if (empty($reshook) && $action == 'add') {
175  $error = 0;
176  $urlback = '';
177 
178  $db->begin();
179 
180  if (!GETPOST("lastname")) {
181  $error++;
182  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
183  }
184  if (!GETPOST("firstname")) {
185  $error++;
186  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
187  }
188  if (!GETPOST("email")) {
189  $error++;
190  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
191  }
192  if (!GETPOST("description")) {
193  $error++;
194  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Message"))."<br>\n";
195  }
196  if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
197  $error++;
198  $langs->load("errors");
199  $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
200  }
201  // Set default opportunity status
202  $defaultoppstatus = getDolGlobalString('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD');
203  if (empty($defaultoppstatus)) {
204  $error++;
205  $langs->load("errors");
206  $errmsg .= $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Project"))."<br>\n";
207  }
208 
209  $proj = new Project($db);
210  $thirdparty = new Societe($db);
211 
212  if (!$error) {
213  // Search thirdparty and set it if found to the new created project
214  $result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', $object->email);
215  if ($result > 0) {
216  $proj->socid = $thirdparty->id;
217  } else {
218  // Create the prospect
219  if (GETPOST('societe')) {
220  $thirdparty->name = GETPOST('societe');
221  $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
222  } else {
223  $thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
224  }
225  $thirdparty->address = GETPOST('address');
226  $thirdparty->zip = GETPOST('zip');
227  $thirdparty->town = GETPOST('town');
228  $thirdparty->country_id = GETPOST('country_id', 'int');
229  $thirdparty->state_id = GETPOST('state_id');
230  $thirdparty->client = $thirdparty::PROSPECT;
231  $thirdparty->code_client = 'auto';
232  $thirdparty->code_fournisseur = 'auto';
233 
234  // Fill array 'array_options' with data from the form
235  $extrafields->fetch_name_optionals_label($thirdparty->table_element);
236  $ret = $extrafields->setOptionalsFromPost(null, $thirdparty, '', 1);
237  //var_dump($thirdparty->array_options);exit;
238  if ($ret < 0) {
239  $error++;
240  $errmsg = ($extrafields->error ? $extrafields->error.'<br>' : '').join('<br>', $extrafields->errors);
241  }
242 
243  if (!$error) {
244  $result = $thirdparty->create($user);
245  if ($result <= 0) {
246  $error++;
247  $errmsg = ($thirdparty->error ? $thirdparty->error.'<br>' : '').join('<br>', $thirdparty->errors);
248  } else {
249  $proj->socid = $thirdparty->id;
250  }
251  }
252  }
253  }
254 
255  if (!$error) {
256  // Defined the ref into $defaultref
257  $defaultref = '';
258  $modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
259 
260  // Search template files
261  $file = ''; $classname = ''; $filefound = 0;
262  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
263  foreach ($dirmodels as $reldir) {
264  $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
265  if (file_exists($file)) {
266  $filefound = 1;
267  $classname = $modele;
268  break;
269  }
270  }
271 
272  if ($filefound) {
273  $result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
274  $modProject = new $classname;
275 
276  $defaultref = $modProject->getNextValue($thirdparty, $object);
277  }
278 
279  if (is_numeric($defaultref) && $defaultref <= 0) {
280  $defaultref = '';
281  }
282 
283  if (empty($defaultref)) {
284  $defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
285  }
286 
287  $proj->ref = $defaultref;
288  $proj->statut = $proj::STATUS_DRAFT;
289  $proj->status = $proj::STATUS_DRAFT;
290  $proj->public = 1;
291  $proj->usage_opportunity = 1;
292  $proj->title = $langs->trans("LeadFromPublicForm");
293  $proj->description = GETPOST("description", "alphanohtml");
294  $proj->opp_status = $defaultoppstatus;
295  $proj->fk_opp_status = $defaultoppstatus;
296 
297  $proj->ip = getUserRemoteIP();
298  $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
299  $now = dol_now();
300  $minmonthpost = dol_time_plus_duree($now, -1, "m");
301  $nb_post_ip = 0;
302  if ($nb_post_max > 0) { // Calculate only if there is a limit to check
303  $sql = "SELECT COUNT(rowid) as nb_projets";
304  $sql .= " FROM ".MAIN_DB_PREFIX."projet";
305  $sql .= " WHERE ip = '".$db->escape($proj->ip)."'";
306  $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
307  $resql = $db->query($sql);
308  if ($resql) {
309  $num = $db->num_rows($resql);
310  $i = 0;
311  while ($i < $num) {
312  $i++;
313  $obj = $db->fetch_object($resql);
314  $nb_post_ip = $obj->nb_projets;
315  }
316  }
317  }
318 
319  // Fill array 'array_options' with data from the form
320  $extrafields->fetch_name_optionals_label($proj->table_element);
321  $ret = $extrafields->setOptionalsFromPost(null, $proj);
322  if ($ret < 0) {
323  $error++;
324  }
325 
326  if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
327  $error++;
328  $errmsg = $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
329  array_push($proj->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
330  }
331  // Create the project
332  if (!$error) {
333  $result = $proj->create($user);
334  if ($result > 0) {
335  require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
336  $object = $proj;
337 
338  if ($object->email) {
339  $subject = '';
340  $msg = '';
341 
342  // Send subscription email
343  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
344  $formmail = new FormMail($db);
345  // Set output language
346  $outputlangs = new Translate('', $conf);
347  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
348  // Load traductions files required by page
349  $outputlangs->loadLangs(array("main", "members", "projects"));
350  // Get email content from template
351  $arraydefaultmessage = null;
352  $labeltouse = $conf->global->PROJECT_EMAIL_TEMPLATE_AUTOLEAD;
353 
354  if (!empty($labeltouse)) {
355  $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
356  }
357 
358  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
359  $subject = $arraydefaultmessage->topic;
360  $msg = $arraydefaultmessage->content;
361  }
362  if (empty($labeltosue)) {
363  $labeltouse = '['.$mysoc->name.'] '.$langs->trans("YourMessage");
364  $msg = $langs->trans("YourMessageHasBeenReceived");
365  }
366 
367  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
368  complete_substitutions_array($substitutionarray, $outputlangs, $object);
369  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
370  $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
371 
372  if ($subjecttosend && $texttosend) {
373  $moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
374 
375  $result = $object->send_an_email($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 (!empty($conf->global->PROJECT_URL_REDIRECT_LEAD)) {
386  $urlback = $conf->global->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>'.join('<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 // If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url.
418 // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
419 if (empty($reshook) && $action == 'added') {
420  llxHeaderVierge($langs->trans("NewLeadForm"));
421 
422  // Si on a pas ete redirige
423  print '<br><br>';
424  print '<div class="center">';
425  print $langs->trans("NewLeadbyWeb");
426  print '</div>';
427 
428  llxFooterVierge();
429  exit;
430 }
431 
432 
433 
434 /*
435  * View
436  */
437 
438 $form = new Form($db);
439 $formcompany = new FormCompany($db);
440 
441 $extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
442 
443 llxHeaderVierge($langs->trans("NewContact"));
444 
445 
446 print load_fiche_titre($langs->trans("NewContact"), '', '', 0, 0, 'center');
447 
448 
449 print '<div align="center">';
450 print '<div id="divsubscribe">';
451 
452 print '<div class="center subscriptionformhelptext justify">';
453 if (!empty($conf->global->PROJECT_NEWFORM_TEXT)) {
454  print $langs->trans($conf->global->PROJECT_NEWFORM_TEXT)."<br>\n";
455 } else {
456  print $langs->trans("FormForNewLeadDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
457 }
458 print '</div>';
459 
460 dol_htmloutput_errors($errmsg);
461 
462 // Print form
463 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newlead">'."\n";
464 print '<input type="hidden" name="token" value="'.newToken().'" / >';
465 print '<input type="hidden" name="entity" value="'.$entity.'" />';
466 print '<input type="hidden" name="action" value="add" />';
467 
468 print '<br>';
469 
470 print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
471 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
472 
473 print dol_get_fiche_head('');
474 
475 print '<script type="text/javascript">
476 jQuery(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 
487 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
488 
489 // Lastname
490 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";
491 // Firstname
492 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";
493 // EMail
494 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";
495 // Company
496 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";
497 // Address
498 print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
499 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";
500 // Zip / Town
501 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
502 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
503 print ' / ';
504 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
505 print '</td></tr>';
506 // Country
507 print '<tr><td>'.$langs->trans('Country').'</td><td>';
508 $country_id = GETPOST('country_id');
509 if (!$country_id && !empty($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE)) {
510  $country_id = getCountry($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
511 }
512 if (!$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);
524 print $form->select_country($country_id, 'country_id');
525 print '</td></tr>';
526 // State
527 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
528  print '<tr><td>'.$langs->trans('State').'</td><td>';
529  if ($country_code) {
530  print $formcompany->select_state(GETPOST("state_id", 'int'), $country_code);
531  } else {
532  print '';
533  }
534  print '</td></tr>';
535 }
536 
537 // Other attributes
538 $tpl_context = 'public'; // define template context to public
539 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
540 // Comments
541 print '<tr>';
542 print '<td class="tdtop">'.$langs->trans("Message").' <span style="color: red">*</span></td>';
543 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>';
544 print '</tr>'."\n";
545 
546 print "</table>\n";
547 
548 print dol_get_fiche_end();
549 
550 // Save
551 print '<div class="center">';
552 print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
553 if (!empty($backtopage)) {
554  print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
555 }
556 print '</div>';
557 
558 
559 print "</form>\n";
560 print "<br>";
561 print '</div></div>';
562 
563 
565 
566 $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:1530
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
Show header for new member.
Definition: new.php:116
llxFooterVierge()
Show footer for new member.
Definition: new.php:165
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.