dolibarr 24.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-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", "errors"));
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 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
350 array_push($invoice->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
351 }
352
353 if (!$error) {
354 $result = $invoice->create($user);
355 if ($result <= 0) {
356 $error++;
357 $errmsg .= $invoice->error."<br>\n";
358 }
359 }
360
361 // Issuer Company
362 $issuerCompany = new Societe($db);
363 $result = $issuerCompany->fetch($companyId);
364 if ($result < 0) {
365 $error++;
366 $errmsg .= $issuerCompany->error."<br>\n";
367 }
368
369 $tva_tx = get_default_tva($mysoc, $issuerCompany, $productIdForFreeAmountInvoice);
370
371 // Get product for free amount invoice line
372 $product = new Product($db);
373 $result = $product->fetch($productIdForFreeAmountInvoice);
374 if ($result < 0) {
375 $error++;
376 $errmsg .= $product->error."<br>\n";
377 } else {
378 $desc = $product->label;
379 $productId = $product->id;
380 // Add line for the invoice
381 $result = $invoice->addline($desc, $amount, 1, $tva_tx, 0, 0, $productId, 0, "", "", 0, 0, 0, 'TTC', $amount);
382 if ($result <= 0) {
383 $error++;
384 $errmsg .= $invoice->error."<br>\n";
385 }
386 }
387
388 // Fill array 'array_options' with data from add form
389 /*$extrafields->fetch_name_optionals_label($donation->table_element);
390 $ret = $extrafields->setOptionalsFromPost(null, $donation);
391 if ($ret < 0) {
392 $error++;
393 $errmsg .= $donation->error;
394 }*/
395 }
396
397 if (!$error) {
398 $urlback = getOnlinePaymentUrl(0, 'invoice', (string) $invoice->ref, 0, '');
399 if ($ws) {
400 $urlback .= (strpos($urlback, '?') ? '&' : '?').'ws='.urlencode($ws);
401 }
402 if ($paymentmethod) {
403 $urlback .= (strpos($urlback, '?') ? '&' : '?').'paymentmethod='.urlencode($paymentmethod);
404 }
405 $db->commit();
406
407 header("Location: ".$urlback);
408 exit;
409 } else {
410 $db->rollback();
411 $action = "create";
412 }
413}
414
415// Action called after a submitted was send and donation created successfully
416// If we ask to redirect to the payment page, we never go here because a redirect was done to the payment url.
417// backtopage parameter with an url was set on donation submit page, we never go here because a redirect was done to this url.
418
419if (empty($reshook) && $action == 'added') { // Test on permission not required here
420 llxHeaderVierge($langs->trans("NewDonationForm"));
421
422 // If we have not been redirected
423 print '<br><br>';
424 print '<div class="center">';
425 print $langs->trans("NewDonationbyWeb").'<br>';
426 print '</div>';
427
429 exit;
430}
431
432
433/*
434 * View
435 */
436
437$form = new Form($db);
438$formcompany = new FormCompany($db);
439$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
440
441
442llxHeaderVierge($langs->trans("NewDonation"), '', 0, 0, array(), array(), $ws);
443if (!$ws) {
444 print '<br>';
445 print load_fiche_titre(img_picto('', '', 'class="pictofixedwidth"').' &nbsp; '.$langs->trans("NewDonation"), '', '', 0, '', 'center');
446
447
448 print '<div align="center">';
449 print '<div id="divsubscribe">';
450
451 print '<div class="center subscriptionformhelptext opacitymedium justify">';
452 print $langs->trans("NewDonationDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
453
454 print '</div>';
455}
456
457dol_htmloutput_errors($errmsg);
459
460// Print form
461print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newdonation">'."\n";
462print '<input type="hidden" name="token" value="'.newToken().'" />';
463print '<input type="hidden" name="entity" value="'.$entity.'" />';
464print '<input type="hidden" name="page_y" value="" />';
465
466if (!$action || $action == 'create') {
467 print '<input type="hidden" name="action" value="add" />';
468 print '<input type="hidden" name="ws" value="'.$ws.'">';
469 print '<input type="hidden" name="paymentmethod" value="'.$paymentmethod.'">';
470 print '<br>';
471
472 $messagemandatory = '<span class="">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
473 //print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
474 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
475
476 print dol_get_fiche_head();
477
478 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
479
480 // Add a specific style or table head for the project row
481 if ((isModEnabled('project') || isModEnabled('eventorganization')) && !empty($projectTitle)) {
482 print '<tr>';
483 print '<td class="project-label">' . $langs->trans("project") . '</td>';
484 print '<td class="project-value">' . dol_escape_htmltag($projectTitle) . '</td>';
485 print '</tr>';
486 }
487
488 // EMail
489 print '<tr id="tremail"><td class="fieldrequired minwidth300">'.$langs->trans("Email").'</td><td>';
490 print '<input type="email" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email', "aZ09arobase")).'"></td></tr>'."\n";
491
492 // Company
493 print '<tr id="trcompany" class="trcompany"><td class="fieldrequired">'.$langs->trans("Company").'</td><td>';
494 print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
495 print '<input type="text" name="societe" class="minwidth300" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
496
497 // Firstname
498 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";
499
500 // Lastname
501 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";
502
503 // Address
504 print '<tr id="tradress"><td class="fieldrequired">'.$langs->trans("Address").'</td><td>'."\n";
505 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";
506
507 // Zip / Town
508 print '<tr id="trzip"><td class="fieldrequired">'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
509 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
510 print ' / ';
511 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
512 print '</td></tr>';
513
514 // Country
515 print '<tr id="trcountry"><td class="fieldrequired">'.$langs->trans('Country').'</td><td>';
516 print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
517 $country_id = GETPOSTINT('country_id');
518 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
519 $country_code = dol_user_country();
520 //print $country_code;
521 if ($country_code) {
522 $new_country_id = getCountry($country_code, '3', $db, $langs);
523 //print 'xxx'.$country_code.' - '.$new_country_id;
524 if ($new_country_id) {
525 $country_id = $new_country_id;
526 }
527 }
528 }
529 $country_code = getCountry($country_id, '2', $db, $langs);
530 print $form->select_country($country_id, 'country_id');
531 print '</td></tr>';
532
533 //Idprof2 (siret...)
534 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";
535
536 //Tva_intra
537 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";
538
539 print '<tr><td colspan="2"><hr></td></tr>';
540
541 // Amount
542 $amount = (float) (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
543
544 // - If a min is set, we take it into account
545 $amount = max(0, (float) $amount, (float) getDolGlobalInt("DONATION_INVOICE_MIN_AMOUNT"));
546
547 // Clean the amount
548 $amount = price2num($amount);
549 $showedamount = $amount > 0 ? $amount : 5;
550 print '<tr><td class="fieldrequired">'.$langs->trans("donationAmount");
551 print '</td><td class="nowrap">';
552
553 print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
554 print ' '.$langs->trans("Currency".getDolCurrency()).'<span class="opacitymedium hideifautoturnover"> - ';
555 print $langs->trans("AnyAmountForDonation");
556 print '</span>';
557
558 print '</td></tr>';
559
560 // Display Captcha code if is enabled
561 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
562 print '<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
563 print '<span class="span-icon-security inline-block">';
564 print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
565 print '</span>';
566 print '<span class="nowrap inline-block">';
567 print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
568 print '<a class="inline-block valignmiddle" href="" tabindex="4" data-role="button">'.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').'</a>';
569 print '</span>';
570 print '</td></tr>';
571
572
573
574 print "</table>\n";
575
576 print dol_get_fiche_end();
577
578 // Save / Submit
579 print '<div class="center">';
580 print '<input type="submit" value="'.$langs->trans("GetDonationButtonLabel").'" id="submitsave" class="button">';
581 if (!empty($backtopage)) {
582 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
583 }
584 print '</div>';
585
586
587 print "</form>\n";
588 print "<br>";
589 print '</div></div>';
590}
591
592//htmlPrintOnlineFooter($mysoc, $langs);
594
595$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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)
Add a delay to a date.
Definition date.lib.php:126
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_user_country()
Return country code for current user.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
dol_htmloutput_events($disabledoutputofmessages=0)
Print formatted messages to output (Used to show messages on html output).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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_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)
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.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.