dolibarr  20.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-2023 Frédéric France <frederic.france@netlogic.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 
31 if (!defined('NOLOGIN')) {
32  define("NOLOGIN", 1); // This means this output page does not require to be logged.
33 }
34 if (!defined('NOCSRFCHECK')) {
35  define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
36 }
37 if (!defined('NOIPCHECK')) {
38  define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
39 }
40 if (!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));
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 (!getDolGlobalString('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 (!getDolGlobalString('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 (getDolGlobalString('PROJECT_IMAGE_PUBLIC_NEWLEAD')) {
137  print '<div class="backimagepublicnewlead">';
138  print '<img id="idPROJECT_IMAGE_PUBLIC_NEWLEAD" src="' . getDolGlobalString('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  $visibility = getDolGlobalString('PROJET_VISIBILITY');
212 
213  $proj = new Project($db);
214  $thirdparty = new Societe($db);
215 
216  if (!$error) {
217  // Search thirdparty and set it if found to the new created project
218  $result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', $object->email);
219  if ($result > 0) {
220  $proj->socid = $thirdparty->id;
221  } else {
222  // Create the prospect
223  if (GETPOST('societe')) {
224  $thirdparty->name = GETPOST('societe');
225  $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
226  } else {
227  $thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
228  }
229  $thirdparty->email = GETPOST('email');
230  $thirdparty->address = GETPOST('address');
231  $thirdparty->zip = GETPOST('zip');
232  $thirdparty->town = GETPOST('town');
233  $thirdparty->country_id = GETPOSTINT('country_id');
234  $thirdparty->state_id = GETPOSTINT('state_id');
235  $thirdparty->client = $thirdparty::PROSPECT;
236  $thirdparty->code_client = 'auto';
237  $thirdparty->code_fournisseur = 'auto';
238 
239  // Fill array 'array_options' with data from the form
240  $extrafields->fetch_name_optionals_label($thirdparty->table_element);
241  $ret = $extrafields->setOptionalsFromPost(null, $thirdparty, '', 1);
242  //var_dump($thirdparty->array_options);exit;
243  if ($ret < 0) {
244  $error++;
245  $errmsg = ($extrafields->error ? $extrafields->error.'<br>' : '').implode('<br>', $extrafields->errors);
246  }
247 
248  if (!$error) {
249  $result = $thirdparty->create($user);
250  if ($result <= 0) {
251  $error++;
252  $errmsg = ($thirdparty->error ? $thirdparty->error.'<br>' : '').implode('<br>', $thirdparty->errors);
253  } else {
254  $proj->socid = $thirdparty->id;
255  }
256  }
257  }
258  }
259 
260  if (!$error) {
261  // Defined the ref into $defaultref
262  $defaultref = '';
263  $modele = !getDolGlobalString('PROJECT_ADDON') ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
264 
265  // Search template files
266  $file = '';
267  $classname = '';
268  $filefound = 0;
269  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
270  foreach ($dirmodels as $reldir) {
271  $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
272  if (file_exists($file)) {
273  $filefound = 1;
274  $classname = $modele;
275  break;
276  }
277  }
278 
279  if ($filefound) {
280  $result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
281  $modProject = new $classname();
282 
283  $defaultref = $modProject->getNextValue($thirdparty, $object);
284  }
285 
286  if (is_numeric($defaultref) && $defaultref <= 0) {
287  $defaultref = '';
288  }
289 
290  if (empty($defaultref)) {
291  $defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
292  }
293 
294  if ($visibility === "1") {
295  $proj->public = 1;
296  } elseif ($visibility === "0") {
297  $proj->public = 0;
298  } elseif (empty($visibility)) {
299  $proj->public = 1;
300  }
301 
302  $proj->ref = $defaultref;
303  $proj->statut = $proj::STATUS_DRAFT;
304  $proj->status = $proj::STATUS_DRAFT;
305  $proj->usage_opportunity = 1;
306  $proj->title = $langs->trans("LeadFromPublicForm");
307  $proj->description = GETPOST("description", "alphanohtml");
308  $proj->opp_status = $defaultoppstatus;
309  $proj->fk_opp_status = $defaultoppstatus;
310 
311  $proj->ip = getUserRemoteIP();
312  $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
313  $now = dol_now();
314  $minmonthpost = dol_time_plus_duree($now, -1, "m");
315  $nb_post_ip = 0;
316  if ($nb_post_max > 0) { // Calculate only if there is a limit to check
317  $sql = "SELECT COUNT(rowid) as nb_projets";
318  $sql .= " FROM ".MAIN_DB_PREFIX."projet";
319  $sql .= " WHERE ip = '".$db->escape($proj->ip)."'";
320  $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
321  $resql = $db->query($sql);
322  if ($resql) {
323  $num = $db->num_rows($resql);
324  $i = 0;
325  while ($i < $num) {
326  $i++;
327  $obj = $db->fetch_object($resql);
328  $nb_post_ip = $obj->nb_projets;
329  }
330  }
331  }
332 
333  // Fill array 'array_options' with data from the form
334  $extrafields->fetch_name_optionals_label($proj->table_element);
335  $ret = $extrafields->setOptionalsFromPost(null, $proj);
336  if ($ret < 0) {
337  $error++;
338  }
339 
340  if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
341  $error++;
342  $errmsg = $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
343  array_push($proj->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
344  }
345  // Create the project
346  if (!$error) {
347  $result = $proj->create($user);
348  if ($result > 0) {
349  require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
350  $object = $proj;
351 
352  if ($object->email) {
353  $subject = '';
354  $msg = '';
355 
356  // Send subscription email
357  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
358  $formmail = new FormMail($db);
359  // Set output language
360  $outputlangs = new Translate('', $conf);
361  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
362  // Load traductions files required by page
363  $outputlangs->loadLangs(array("main", "members", "projects"));
364  // Get email content from template
365  $arraydefaultmessage = null;
366  $labeltouse = getDolGlobalString('PROJECT_EMAIL_TEMPLATE_AUTOLEAD');
367 
368  if (!empty($labeltouse)) {
369  $arraydefaultmessage = $formmail->getEMailTemplate($db, 'project', $user, $outputlangs, 0, 1, $labeltouse);
370  }
371 
372  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
373  $subject = $arraydefaultmessage->topic;
374  $msg = $arraydefaultmessage->content;
375  }
376  if (empty($labeltosue)) {
377  $appli = $mysoc->name;
378 
379  $labeltouse = '['.$appli.'] '.$langs->trans("YourMessage");
380  $msg = $langs->trans("YourMessageHasBeenReceived");
381  }
382 
383  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
384  complete_substitutions_array($substitutionarray, $outputlangs, $object);
385  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
386  $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
387  if ($subjecttosend && $texttosend) {
388  $moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
389 
390  $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
391  }
392  /*if ($result < 0) {
393  $error++;
394  setEventMessages($object->error, $object->errors, 'errors');
395  }*/
396  }
397 
398  if (!empty($backtopage)) {
399  $urlback = $backtopage;
400  } elseif (getDolGlobalString('PROJECT_URL_REDIRECT_LEAD')) {
401  $urlback = getDolGlobalString('PROJECT_URL_REDIRECT_LEAD');
402  // TODO Make replacement of __AMOUNT__, etc...
403  } else {
404  $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
405  }
406 
407  if (!empty($entity)) {
408  $urlback .= '&entity='.$entity;
409  }
410 
411  dol_syslog("project lead ".$proj->ref." has been created, we redirect to ".$urlback);
412  } else {
413  $error++;
414  $errmsg .= $proj->error.'<br>'.implode('<br>', $proj->errors);
415  }
416  } else {
417  setEventMessage($errmsg, 'errors');
418  }
419  }
420 
421  if (!$error) {
422  $db->commit();
423 
424  header("Location: ".$urlback);
425  exit;
426  } else {
427  $db->rollback();
428  }
429 }
430 
431 // Action called after a submitted was send and member created successfully
432 // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
433 if (empty($reshook) && $action == 'added') {
434  llxHeaderVierge($langs->trans("NewLeadForm"));
435 
436  // Si on a pas ete redirige
437  print '<br><br>';
438  print '<div class="center">';
439  print $langs->trans("NewLeadbyWeb");
440  print '</div>';
441 
442  llxFooterVierge();
443  exit;
444 }
445 
446 
447 
448 /*
449  * View
450  */
451 
452 $form = new Form($db);
453 $formcompany = new FormCompany($db);
454 
455 $extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
456 
457 llxHeaderVierge($langs->trans("NewContact"));
458 
459 
460 print load_fiche_titre($langs->trans("NewContact"), '', '', 0, 0, 'center');
461 
462 
463 print '<div align="center">';
464 print '<div id="divsubscribe">';
465 
466 print '<div class="center subscriptionformhelptext opacitymedium justify">';
467 if (getDolGlobalString('PROJECT_NEWFORM_TEXT')) {
468  print $langs->trans(getDolGlobalString('PROJECT_NEWFORM_TEXT'))."<br>\n";
469 } else {
470  print $langs->trans("FormForNewLeadDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
471 }
472 print '</div>';
473 
474 dol_htmloutput_errors($errmsg);
475 
476 // Print form
477 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newlead">'."\n";
478 print '<input type="hidden" name="token" value="'.newToken().'" / >';
479 print '<input type="hidden" name="entity" value="'.$entity.'" />';
480 print '<input type="hidden" name="action" value="add" />';
481 
482 print '<br>';
483 
484 print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
485 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
486 
487 print dol_get_fiche_head();
488 
489 print '<script type="text/javascript">
490 jQuery(document).ready(function () {
491  jQuery(document).ready(function () {
492  jQuery("#selectcountry_id").change(function() {
493  document.newlead.action.value="create";
494  document.newlead.submit();
495  });
496  });
497 });
498 </script>';
499 
500 
501 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
502 
503 // Lastname
504 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";
505 // Firstname
506 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";
507 // EMail
508 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";
509 // Company
510 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";
511 // Address
512 print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
513 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";
514 // Zip / Town
515 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
516 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
517 print ' / ';
518 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
519 print '</td></tr>';
520 // Country
521 print '<tr><td>'.$langs->trans('Country').'</td><td>';
522 $country_id = GETPOST('country_id');
523 if (!$country_id && getDolGlobalString('PROJECT_NEWFORM_FORCECOUNTRYCODE')) {
524  $country_id = getCountry($conf->global->PROJECT_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
525 }
526 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
527  $country_code = dol_user_country();
528  //print $country_code;
529  if ($country_code) {
530  $new_country_id = getCountry($country_code, 3, $db, $langs);
531  //print 'xxx'.$country_code.' - '.$new_country_id;
532  if ($new_country_id) {
533  $country_id = $new_country_id;
534  }
535  }
536 }
537 $country_code = getCountry($country_id, 2, $db, $langs);
538 print $form->select_country($country_id, 'country_id');
539 print '</td></tr>';
540 // State
541 if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
542  print '<tr><td>'.$langs->trans('State').'</td><td>';
543  if ($country_code) {
544  print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
545  } else {
546  print '';
547  }
548  print '</td></tr>';
549 }
550 
551 // Other attributes
552 $parameters['tpl_context'] = 'public'; // define template context to public
553 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
554 // Comments
555 print '<tr>';
556 print '<td class="tdtop">'.$langs->trans("Message").' <span class="star">*</span></td>';
557 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>';
558 print '</tr>'."\n";
559 
560 print "</table>\n";
561 
562 print dol_get_fiche_end();
563 
564 // Save
565 print '<div class="center">';
566 print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
567 if (!empty($backtopage)) {
568  print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
569 }
570 print '</div>';
571 
572 
573 print "</form>\n";
574 print "<br>";
575 print '</div></div>';
576 
577 
579 
580 $db->close();
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition: card.php:58
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:111
llxFooterVierge()
Show footer for new societe.
Definition: new.php:160
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('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') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:745
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:124
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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)
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 a 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 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.
Definition: main.inc.php:1786
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.