dolibarr 25.0.0-alpha
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-2025 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 * Copyright (C) 2021 Waël Almoman <info@almoman.com>
10 * Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
11 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
37if (!defined('NOLOGIN')) {
38 define("NOLOGIN", 1); // This means this output page does not require to be logged.
39}
40if (!defined('NOCSRFCHECK')) {
41 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
42}
43if (!defined('NOBROWSERNOTIF')) {
44 define('NOBROWSERNOTIF', '1');
45}
46
47
48// For MultiCompany module.
49// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
50// Because 2 entities can have the same ref.
51$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
52// if (is_numeric($entity)) { // $entity is casted to int
53define("DOLENTITY", $entity);
54// }
55
56
57// Load Dolibarr environment
58require '../../main.inc.php';
59require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
60require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
61require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
62
63require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
64require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
65require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
66require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
67require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
68if (isModEnabled('project') || isModEnabled('eventorganization')) {
69 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
70}
71
72// Init vars
73$backtopage = GETPOST('backtopage', 'alpha');
74$action = GETPOST('action', 'aZ09');
75$ws = GETPOST('ws', 'aZ09'); // Website reference where the this public page is embedded or from where is called
76$paymentmethod = GETPOST('paymentmethod', 'aZ09'); // Payment method to use
77
78$errmsg = '';
79$num = 0;
80$error = 0;
81
91// Load translation files
92$langs->loadLangs(array("main", "donations", "companies", "install", "other"));
93
94// Security check
95if (!isModEnabled('invoice')) {
96 httponly_accessforbidden('Module invoice not enabled');
97}
98
99if (!getDolGlobalString('PRODUCT_ID_FOR_FREE_AMOUNT_INVOICE')) {
100 httponly_accessforbidden('PRODUCT_ID_FOR_FREE_AMOUNT_INVOICE is not defined');
101}
102
103if (!getDolGlobalString('DONATION_INVOICE_MIN_AMOUNT')) {
104 httponly_accessforbidden('DONATION_INVOICE_MIN_AMOUNT is not defined');
105}
106
107// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
108//$hookmanager->initHooks(array( 'globalcard'));
109
110$extrafields = new ExtraFields($db);
111
112$object = new Facture($db);
113
114$user->loadDefaultValues();
115
116
131function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $ws = '') // @phan-suppress-current-line PhanRedefineFunction
132{
133 global $conf, $langs, $mysoc;
134
135 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
136
137 print '<body id="mainbody" class="publicnewmemberform">';
138
139 if (!$ws) {
140 include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
141 htmlPrintOnlineHeader($mysoc, $langs, 1);
142 }
143
144 print '<div class="divmainbodylarge">';
145}
146
154function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
155{
156 global $conf, $langs;
157
158 print '</div>';
159
160 printCommonFooter('public');
161
162 if (!empty($conf->use_javascript_ajax)) {
163 print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
164 print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>'."\n";
165 }
166
167 print "</body>\n";
168 print "</html>\n";
169}
170
171
172
173/*
174 * Actions
175 */
176
177$parameters = array();
178// Note that $action and $object may have been modified by some hooks
179$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
180if ($reshook < 0) {
181 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
182}
183
184// Action called when page is submitted
185if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous form. Check is done on constant to enable and mitigation.
186 $error = 0;
187 $urlback = '';
188
189 $email = GETPOST("email", "aZ09arobase");
190 $firstname = GETPOST("firstname", "aZ09");
191 $lastname = GETPOST("lastname", "aZ09");
192 $societe = GETPOST("societe", "aZ09");
193 $idprof2 = GETPOST("idprof2", "aZ09");
194 $tva_intra = GETPOST("tva_intra", "aZ09");
195 $address = GETPOST("address");
196 $zipcode = GETPOST("zipcode", "aZ09");
197 $town = GETPOST("town", "aZ09");
198 $country_id = GETPOSTINT("country_id");
199 $amount = (float) GETPOST("amount", "int");
200 $companyId = 0;
201 $productIdForFreeAmountInvoice = (int) getDolGlobalString('PRODUCT_ID_FOR_FREE_AMOUNT_INVOICE');
202
203 if (!$email || !isValidEmail($email)) {
204 $langs->load('errors');
205 $error++;
206 $errmsg .= $langs->trans("ErrorBadEMail", $email)."<br>\n";
207 }
208 if ($firstname && !preg_match('/^[a-zA-Z0-9À-ÖØ-öø-ÿ \'\-]*$/u', $firstname)) {
209 $langs->load('errors');
210 $error++;
211 $errmsg .= $langs->trans("firstnameContainsLettersOnly")."<br>\n";
212 }
213 if ($lastname && !preg_match('/^[a-zA-Z0-9À-ÖØ-öø-ÿ \'\-]*$/u', $lastname)) {
214 $langs->load('errors');
215 $error++;
216 $errmsg .= $langs->trans("lastnameContainsLettersOnly")."<br>\n";
217 }
218 if (!$idprof2) {
219 $langs->load('errors');
220 $error++;
221 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("companyBusinessNumber"))."<br>\n";
222 }
223 if (!$address) {
224 $langs->load('errors');
225 $error++;
226 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Address"))."<br>\n";
227 }
228 if (!$zipcode) {
229 $langs->load('errors');
230 $error++;
231 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Zip"))."<br>\n";
232 }
233 if (!$town) {
234 $langs->load('errors');
235 $error++;
236 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Town"))."<br>\n";
237 }
238 if (!$country_id) {
239 $langs->load('errors');
240 $error++;
241 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Country"))."<br>\n";
242 }
243 if (!$societe) {
244 $langs->load('errors');
245 $error++;
246 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentities("Company"))."<br>\n";
247 } else {
248 // Check if company exists
249 $company = new Societe($db);
250 $result = $company->findNearest(0, '', '', '', '', $idprof2, '', '', '', '', $email);
251 if ($result > 0) {
252 $companyId = $result;
253 } elseif ($result < 0) {
254 $error++;
255 $errmsg .= $langs->trans("donationErrorMessageContactEmail", $mysoc->email)."<br>\n";
256 }
257 }
258 if (!$amount || $amount <= (float) getDolGlobalString("DONATION_INVOICE_MIN_AMOUNT")) {
259 $error++;
260 $errmsg .= $langs->trans("ErrorFieldMinimumAmount", (float) getDolGlobalString("DONATION_INVOICE_MIN_AMOUNT"))."<br>\n";
261 }
262
263 // Check Captcha code if is enabled
264 $sessionkey = 'dol_antispam_value';
265 $ok = (array_key_exists($sessionkey, $_SESSION) && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code'))));
266 if (!$ok) {
267 $error++;
268 $langs->load("errors");
269 $errmsg .= $langs->trans("ErrorBadValueForCode")."<br>\n";
270 $action = '';
271 }
272
273 // Start of transaction
274 $db->begin();
275
276 // Create invoice for this donation
277 $invoice = new Facture($db);
278
279 if (!$error && $companyId <= 0) {
280 // create company
281 $company = new Societe($db);
282
283 if (!empty($societe)) {
284 $company->name = $societe;
285 } else {
286 $company->name = dolGetFirstLastname($firstname, $lastname);
287 }
288
289 $company->name_alias = "";
290 $company->idprof2 = $idprof2;
291 $company->address = $address;
292 $company->zip = $zipcode;
293 $company->town = $town;
294 $company->country_id = $country_id;
295 $company->email = $email;
296 $company->client = 1;
297 $company->code_client = 'auto';
298 $company->status = 1; // client
299 $company->tva_intra = $tva_intra;
300
301 $company->ip = getUserRemoteIP();
302
303 $result = $company->create($user);
304 if ($result < 0) {
305 $langs->load('errors');
306 $error++;
307 $errmsg .= implode('<br>', $company->errors)."<br>\n";
308 } else {
309 $companyId = $result;
310 }
311 }
312
313 if (!$error && $companyId > 0) {
314 $invoice->socid = $companyId;
315 $invoice->type = Facture::TYPE_STANDARD;
316 $invoice->cond_reglement_id = 1;
317 $invoice->date = dol_now();
318 $invoice->module_source = 'donation';
319 if (!empty($ws)) {
320 $invoice->module_source .= '@' . $ws;
321 }
322 $invoice->status = Facture::STATUS_DRAFT;
323 $invoice->ip = getUserRemoteIP();
324
325 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1);
326 $now = dol_now();
327 $minmonthpost = dol_time_plus_duree($now, -1, "m");
328 // Calculate nb of post for IP
329 $nb_post_ip = 0;
330 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
331 $sql = "SELECT COUNT(rowid) as nb_invoice";
332 $sql .= " FROM ".MAIN_DB_PREFIX."facture";
333 $sql .= " WHERE ip = '".$db->escape($invoice->ip)."'";
334 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
335 $resql = $db->query($sql);
336 if ($resql) {
337 $num = $db->num_rows($resql);
338 $i = 0;
339 while ($i < $num) {
340 $i++;
341 $obj = $db->fetch_object($resql);
342 $nb_post_ip = $obj->nb_invoice;
343 }
344 }
345 }
346
347 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
348 $error++;
349 $langs->load('errors');
350 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
351 array_push($invoice->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
352 }
353
354 if (!$error) {
355 $result = $invoice->create($user);
356 if ($result <= 0) {
357 $error++;
358 $errmsg .= $invoice->error."<br>\n";
359 }
360 }
361
362 // Issuer Company
363 $issuerCompany = new Societe($db);
364 $result = $issuerCompany->fetch($companyId);
365 if ($result < 0) {
366 $error++;
367 $errmsg .= $issuerCompany->error."<br>\n";
368 }
369
370 $tva_tx = get_default_tva($mysoc, $issuerCompany, $productIdForFreeAmountInvoice);
371
372 // Get product for free amount invoice line
373 $product = new Product($db);
374 $result = $product->fetch($productIdForFreeAmountInvoice);
375 if ($result < 0) {
376 $error++;
377 $errmsg .= $product->error."<br>\n";
378 } else {
379 $desc = $product->label;
380 $productId = $product->id;
381 // Add line for the invoice
382 $result = $invoice->addline($desc, $amount, 1, $tva_tx, 0, 0, $productId, 0, "", "", 0, 0, 0, 'TTC', $amount);
383 if ($result <= 0) {
384 $error++;
385 $errmsg .= $invoice->error."<br>\n";
386 }
387 }
388
389 // Fill array 'array_options' with data from add form
390 /*$extrafields->fetch_name_optionals_label($donation->table_element);
391 $ret = $extrafields->setOptionalsFromPost(null, $donation);
392 if ($ret < 0) {
393 $error++;
394 $errmsg .= $donation->error;
395 }*/
396 }
397
398 if (!$error) {
399 $urlback = getOnlinePaymentUrl(0, 'invoice', (string) $invoice->ref, 0, '');
400 if ($ws) {
401 $urlback .= (strpos($urlback, '?') ? '&' : '?').'ws='.urlencode($ws);
402 }
403 if ($paymentmethod) {
404 $urlback .= (strpos($urlback, '?') ? '&' : '?').'paymentmethod='.urlencode($paymentmethod);
405 }
406 $db->commit();
407
408 header("Location: ".$urlback);
409 exit;
410 } else {
411 $db->rollback();
412 $action = "create";
413 }
414}
415
416// Action called after a submitted was send and donation created successfully
417// If we ask to redirect to the payment page, we never go here because a redirect was done to the payment url.
418// backtopage parameter with an url was set on donation submit page, we never go here because a redirect was done to this url.
419
420if (empty($reshook) && $action == 'added') { // Test on permission not required here
421 llxHeaderVierge($langs->trans("NewDonationForm"));
422
423 // If we have not been redirected
424 print '<br><br>';
425 print '<div class="center">';
426 print $langs->trans("NewDonationbyWeb").'<br>';
427 print '</div>';
428
430 exit;
431}
432
433
434/*
435 * View
436 */
437
438$form = new Form($db);
439$formcompany = new FormCompany($db);
440$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
441
442
443llxHeaderVierge($langs->trans("NewDonation"), '', 0, 0, array(), array(), $ws); // @phpstan-ignore-line
444if (!$ws) {
445 print '<br>';
446 print load_fiche_titre(img_picto('', '', 'class="pictofixedwidth"').' &nbsp; '.$langs->trans("NewDonation"), '', '', 0, '', 'center');
447
448
449 print '<div align="center">';
450 print '<div id="divsubscribe">';
451
452 print '<div class="center subscriptionformhelptext opacitymedium justify">';
453 print $langs->trans("NewDonationDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
454
455 print '</div>';
456}
457
458dol_htmloutput_errors($errmsg);
460
461// Print form
462print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newdonation">'."\n";
463print '<input type="hidden" name="token" value="'.newToken().'" />';
464print '<input type="hidden" name="entity" value="'.$entity.'" />';
465print '<input type="hidden" name="page_y" value="" />';
466
467if (!$action || $action == 'create') {
468 print '<input type="hidden" name="action" value="add" />';
469 print '<input type="hidden" name="ws" value="'.$ws.'">';
470 print '<input type="hidden" name="paymentmethod" value="'.$paymentmethod.'">';
471 print '<br>';
472
473 $messagemandatory = '<span class="">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
474 //print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
475 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
476
477 print dol_get_fiche_head();
478
479 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
480
481 // Add a specific style or table head for the project row
482 if ((isModEnabled('project') || isModEnabled('eventorganization')) && !empty($projectTitle)) {
483 print '<tr>';
484 print '<td class="project-label">' . $langs->trans("project") . '</td>';
485 print '<td class="project-value">' . dol_escape_htmltag($projectTitle) . '</td>';
486 print '</tr>';
487 }
488
489 // EMail
490 print '<tr id="tremail"><td class="fieldrequired minwidth300">'.$langs->trans("Email").'</td><td>';
491 print '<input type="email" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email', "aZ09arobase")).'"></td></tr>'."\n";
492
493 // Company
494 print '<tr id="trcompany" class="trcompany"><td class="fieldrequired">'.$langs->trans("Company").'</td><td>';
495 print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
496 print '<input type="text" name="societe" class="minwidth300" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
497
498 // Firstname
499 print '<tr id="trfirstname"><td class="classfortooltip">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
500
501 // Lastname
502 print '<tr id="trlastname"><td class="classfortooltip">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
503
504 // Address
505 print '<tr id="tradress"><td class="fieldrequired">'.$langs->trans("Address").'</td><td>'."\n";
506 print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
507
508 // Zip / Town
509 print '<tr id="trzip"><td class="fieldrequired">'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
510 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
511 print ' / ';
512 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
513 print '</td></tr>';
514
515 // Country
516 print '<tr id="trcountry"><td class="fieldrequired">'.$langs->trans('Country').'</td><td>';
517 print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
518 $country_id = GETPOSTINT('country_id');
519 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
520 $country_code = dol_user_country();
521 //print $country_code;
522 if ($country_code) {
523 $new_country_id = getCountry($country_code, '3', $db, $langs);
524 //print 'xxx'.$country_code.' - '.$new_country_id;
525 if ($new_country_id) {
526 $country_id = $new_country_id;
527 }
528 }
529 }
530 $country_code = getCountry($country_id, '2', $db, $langs);
531 print $form->select_country($country_id, 'country_id');
532 print '</td></tr>';
533
534 //Idprof2 (siret...)
535 print '<tr id="trsiret"><td class="fieldrequired">'.$langs->trans("companyBusinessNumber").'</td><td><input type="text" name="idprof2" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('idprof2')).'"></td></tr>'."\n";
536
537 //Tva_intra
538 print '<tr id="trtva"><td>'.$langs->trans("companyTIN").'</td><td><input type="text" name="tva_intra" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('tva_intra')).'"></td></tr>'."\n";
539
540 print '<tr><td colspan="2"><hr></td></tr>';
541
542 // Amount
543 $amount = (float) (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
544
545 // - If a min is set, we take it into account
546 $amount = max(0, (float) $amount, (float) getDolGlobalInt("DONATION_INVOICE_MIN_AMOUNT"));
547
548 // Clean the amount
549 $amount = price2num($amount);
550 $showedamount = $amount > 0 ? $amount : 5;
551 print '<tr><td class="fieldrequired">'.$langs->trans("donationAmount");
552 print '</td><td class="nowrap">';
553
554 print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
555 print ' '.$langs->trans("Currency".getDolCurrency()).'<span class="opacitymedium hideifautoturnover"> - ';
556 print $langs->trans("AnyAmountForDonation");
557 print '</span>';
558
559 print '</td></tr>';
560
561 // Display Captcha code if is enabled
562 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
563 print '<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
564 print '<span class="span-icon-security inline-block">';
565 print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
566 print '</span>';
567 print '<span class="nowrap inline-block">';
568 print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
569 print '<a class="inline-block valignmiddle" href="" tabindex="4" data-role="button">'.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').'</a>';
570 print '</span>';
571 print '</td></tr>';
572
573
574
575 print "</table>\n";
576
577 print dol_get_fiche_end();
578
579 // Save / Submit
580 print '<div class="center">';
581 print '<input type="submit" value="'.$langs->trans("GetDonationButtonLabel").'" id="submitsave" class="button">';
582 if (!empty($backtopage)) {
583 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
584 }
585 print '</div>';
586
587
588 print "</form>\n";
589 print "<br>";
590 print '</div></div>';
591}
592
593//htmlPrintOnlineFooter($mysoc, $langs);
595
596$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage standard extra fields.
Class to manage invoices.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
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 to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[], $ws='')
Show header for new prospect.
Definition new.php:123
llxFooterVierge()
Show footer for new societe.
Definition new.php:144
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
global $mysoc
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0, $tz='')
Add a delay to a date.
Definition date.lib.php:127
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dol_user_country()
Return country code for current user.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:542
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:740
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
dol_htmloutput_events($disabledoutputofmessages=0)
Print formatted messages to output (Used to show messages on html output).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:183
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.