dolibarr  18.0.6
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->email = GETPOST('email');
226  $thirdparty->address = GETPOST('address');
227  $thirdparty->zip = GETPOST('zip');
228  $thirdparty->town = GETPOST('town');
229  $thirdparty->country_id = GETPOST('country_id', 'int');
230  $thirdparty->state_id = GETPOST('state_id');
231  $thirdparty->client = $thirdparty::PROSPECT;
232  $thirdparty->code_client = 'auto';
233  $thirdparty->code_fournisseur = 'auto';
234 
235  // Fill array 'array_options' with data from the form
236  $extrafields->fetch_name_optionals_label($thirdparty->table_element);
237  $ret = $extrafields->setOptionalsFromPost(null, $thirdparty, '', 1);
238  //var_dump($thirdparty->array_options);exit;
239  if ($ret < 0) {
240  $error++;
241  $errmsg = ($extrafields->error ? $extrafields->error.'<br>' : '').join('<br>', $extrafields->errors);
242  }
243 
244  if (!$error) {
245  $result = $thirdparty->create($user);
246  if ($result <= 0) {
247  $error++;
248  $errmsg = ($thirdparty->error ? $thirdparty->error.'<br>' : '').join('<br>', $thirdparty->errors);
249  } else {
250  $proj->socid = $thirdparty->id;
251  }
252  }
253  }
254  }
255 
256  if (!$error) {
257  // Defined the ref into $defaultref
258  $defaultref = '';
259  $modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
260 
261  // Search template files
262  $file = ''; $classname = ''; $filefound = 0;
263  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
264  foreach ($dirmodels as $reldir) {
265  $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
266  if (file_exists($file)) {
267  $filefound = 1;
268  $classname = $modele;
269  break;
270  }
271  }
272 
273  if ($filefound) {
274  $result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
275  $modProject = new $classname;
276 
277  $defaultref = $modProject->getNextValue($thirdparty, $object);
278  }
279 
280  if (is_numeric($defaultref) && $defaultref <= 0) {
281  $defaultref = '';
282  }
283 
284  if (empty($defaultref)) {
285  $defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
286  }
287 
288  $proj->ref = $defaultref;
289  $proj->statut = $proj::STATUS_DRAFT;
290  $proj->status = $proj::STATUS_DRAFT;
291  $proj->public = 1;
292  $proj->usage_opportunity = 1;
293  $proj->title = $langs->trans("LeadFromPublicForm");
294  $proj->description = GETPOST("description", "alphanohtml");
295  $proj->opp_status = $defaultoppstatus;
296  $proj->fk_opp_status = $defaultoppstatus;
297 
298  $proj->ip = getUserRemoteIP();
299  $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
300  $now = dol_now();
301  $minmonthpost = dol_time_plus_duree($now, -1, "m");
302  $nb_post_ip = 0;
303  if ($nb_post_max > 0) { // Calculate only if there is a limit to check
304  $sql = "SELECT COUNT(rowid) as nb_projets";
305  $sql .= " FROM ".MAIN_DB_PREFIX."projet";
306  $sql .= " WHERE ip = '".$db->escape($proj->ip)."'";
307  $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
308  $resql = $db->query($sql);
309  if ($resql) {
310  $num = $db->num_rows($resql);
311  $i = 0;
312  while ($i < $num) {
313  $i++;
314  $obj = $db->fetch_object($resql);
315  $nb_post_ip = $obj->nb_projets;
316  }
317  }
318  }
319 
320  // Fill array 'array_options' with data from the form
321  $extrafields->fetch_name_optionals_label($proj->table_element);
322  $ret = $extrafields->setOptionalsFromPost(null, $proj);
323  if ($ret < 0) {
324  $error++;
325  }
326 
327  if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
328  $error++;
329  $errmsg = $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
330  array_push($proj->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
331  }
332  // Create the project
333  if (!$error) {
334  $result = $proj->create($user);
335  if ($result > 0) {
336  require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
337  $object = $proj;
338 
339  if ($object->email) {
340  $subject = '';
341  $msg = '';
342 
343  // Send subscription email
344  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
345  $formmail = new FormMail($db);
346  // Set output language
347  $outputlangs = new Translate('', $conf);
348  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
349  // Load traductions files required by page
350  $outputlangs->loadLangs(array("main", "members", "projects"));
351  // Get email content from template
352  $arraydefaultmessage = null;
353  $labeltouse = $conf->global->PROJECT_EMAIL_TEMPLATE_AUTOLEAD;
354 
355  if (!empty($labeltouse)) {
356  $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
357  }
358 
359  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
360  $subject = $arraydefaultmessage->topic;
361  $msg = $arraydefaultmessage->content;
362  }
363  if (empty($labeltosue)) {
364  $labeltouse = '['.$mysoc->name.'] '.$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 (!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 // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
418 if (empty($reshook) && $action == 'added') {
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 
427  llxFooterVierge();
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 
442 llxHeaderVierge($langs->trans("NewContact"));
443 
444 
445 print load_fiche_titre($langs->trans("NewContact"), '', '', 0, 0, 'center');
446 
447 
448 print '<div align="center">';
449 print '<div id="divsubscribe">';
450 
451 print '<div class="center subscriptionformhelptext opacitymedium justify">';
452 if (!empty($conf->global->PROJECT_NEWFORM_TEXT)) {
453  print $langs->trans($conf->global->PROJECT_NEWFORM_TEXT)."<br>\n";
454 } else {
455  print $langs->trans("FormForNewLeadDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
456 }
457 print '</div>';
458 
459 dol_htmloutput_errors($errmsg);
460 
461 // Print form
462 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newlead">'."\n";
463 print '<input type="hidden" name="token" value="'.newToken().'" / >';
464 print '<input type="hidden" name="entity" value="'.$entity.'" />';
465 print '<input type="hidden" name="action" value="add" />';
466 
467 print '<br>';
468 
469 print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
470 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
471 
472 print dol_get_fiche_head('');
473 
474 print '<script type="text/javascript">
475 jQuery(document).ready(function () {
476  jQuery(document).ready(function () {
477  jQuery("#selectcountry_id").change(function() {
478  document.newlead.action.value="create";
479  document.newlead.submit();
480  });
481  });
482 });
483 </script>';
484 
485 
486 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
487 
488 // Lastname
489 print '<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";
490 // Firstname
491 print '<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";
492 // EMail
493 print '<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";
494 // Company
495 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";
496 // Address
497 print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
498 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";
499 // Zip / Town
500 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
501 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
502 print ' / ';
503 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
504 print '</td></tr>';
505 // Country
506 print '<tr><td>'.$langs->trans('Country').'</td><td>';
507 $country_id = GETPOST('country_id');
508 if (!$country_id && !empty($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE)) {
509  $country_id = getCountry($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
510 }
511 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
512  $country_code = dol_user_country();
513  //print $country_code;
514  if ($country_code) {
515  $new_country_id = getCountry($country_code, 3, $db, $langs);
516  //print 'xxx'.$country_code.' - '.$new_country_id;
517  if ($new_country_id) {
518  $country_id = $new_country_id;
519  }
520  }
521 }
522 $country_code = getCountry($country_id, 2, $db, $langs);
523 print $form->select_country($country_id, 'country_id');
524 print '</td></tr>';
525 // State
526 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
527  print '<tr><td>'.$langs->trans('State').'</td><td>';
528  if ($country_code) {
529  print $formcompany->select_state(GETPOST("state_id", 'int'), $country_code);
530  } else {
531  print '';
532  }
533  print '</td></tr>';
534 }
535 
536 // Other attributes
537 $parameters['tpl_context']='public'; // define template context to public
538 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
539 // Comments
540 print '<tr>';
541 print '<td class="tdtop">'.$langs->trans("Message").' <span class="star">*</span></td>';
542 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>';
543 print '</tr>'."\n";
544 
545 print "</table>\n";
546 
547 print dol_get_fiche_end();
548 
549 // Save
550 print '<div class="center">';
551 print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
552 if (!empty($backtopage)) {
553  print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
554 }
555 print '</div>';
556 
557 
558 print "</form>\n";
559 print "<br>";
560 print '</div></div>';
561 
562 
564 
565 $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') && $user->hasRight('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') && $user->hasRight('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)) $sql
Social contributions to pay.
Definition: index.php:746
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:122
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='', $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)
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-...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 dolibarr global constant string value.
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.
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='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
Definition: main.inc.php:1641
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
Show header for new member.
Definition: new.php:113
llxFooterVierge()
Show footer for new member.
Definition: new.php:162
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.