dolibarr 23.0.3
card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
6 * Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
7 * Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
8 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2025 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// Load Dolibarr environment
32require '../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
38require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
39require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
43require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
44if (isModEnabled('project')) {
45 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
46 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
47}
48require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
49
59$langs->loadLangs(array('bills', 'companies', 'donations', 'users'));
60
61$id = GETPOST('rowid') ? GETPOSTINT('rowid') : GETPOSTINT('id');
62$ref = GETPOST('ref', 'alpha');
63$action = GETPOST('action', 'aZ09');
64$cancel = GETPOST('cancel', 'alpha');
65$confirm = GETPOST('confirm', 'alpha');
66$backtopage = GETPOST('backtopage', 'alpha');
67$socid = GETPOSTINT('socid');
68$amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT');
69$donation_date = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
70$projectid = (GETPOST('projectid') ? GETPOSTINT('projectid') : 0);
71$public_donation = GETPOSTINT("public");
72
73$object = new Don($db);
74if ($id > 0 || $ref) {
75 $object->fetch($id, $ref);
76}
77
78$soc = null;
79if (!empty($socid) && $socid > 0) {
80 $soc = new Societe($db);
81 if ($socid > 0) {
82 $soc->fetch($socid);
83 }
84}
85
86$extrafields = new ExtraFields($db);
87
88// fetch optionals attributes and labels
89$extrafields->fetch_name_optionals_label($object->table_element);
90$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
91
92// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
93$hookmanager->initHooks(array($object->element.'card', 'globalcard'));
94
95$upload_dir = $conf->don->dir_output;
96
97
98// Security check
99$result = restrictedArea($user, 'don', $object->id);
100
101$permissiontoread = $user->hasRight('don', 'lire');
102$permissiontoadd = $user->hasRight('don', 'creer');
103$permissiontodelete = $user->hasRight('don', 'supprimer');
104$permissiontoeditextra = $permissiontoadd;
105if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) {
106 // For action 'update_extras', is there a specific permission set for the attribute to update
107 $permissiontoeditextra = dol_eval((string) $extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')]);
108}
109
110
111/*
112 * Actions
113 */
114
115$error = 0;
116
117$parameters = array();
118
119$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
120if ($reshook < 0) {
121 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
122}
123
124if (empty($reshook)) {
125 $backurlforlist = DOL_URL_ROOT.'/don/list.php';
126
127 if (empty($backtopage) || ($cancel && empty($id))) {
128 if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
129 if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
130 $backtopage = $backurlforlist;
131 } else {
132 $backtopage = DOL_URL_ROOT.'/don/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
133 }
134 }
135 }
136
137 if ($cancel) {
138 if (!empty($backtopageforcancel)) {
139 header("Location: ".$backtopageforcancel);
140 exit;
141 } elseif (!empty($backtopage)) {
142 header("Location: ".$backtopage);
143 exit;
144 }
145 $action = '';
146 }
147
148 // Action reopen object
149 if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
150 $result = $object->reopen($user);
151 if ($result >= 0) {
152 // Define output language
153 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
154 $outputlangs = $langs;
155 $newlang = '';
156 if (getDolGlobalInt('MAIN_MULTILANGS') && GETPOST('lang_id', 'aZ09')) {
157 $newlang = GETPOST('lang_id', 'aZ09');
158 }
159 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
160 $newlang = $object->thirdparty->default_lang;
161 }
162 if (!empty($newlang)) {
163 $outputlangs = new Translate("", $conf);
164 $outputlangs->setDefaultLang($newlang);
165 }
166 $model = $object->model_pdf;
167 $ret = $object->fetch($id); // Reload to get new records
168 $hidedetails = 0;
169 $hidedesc = 0;
170 $hideref = 0;
171 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
172 }
173
174 header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
175 exit;
176 } else {
177 setEventMessages($object->error, $object->errors, 'errors');
178 $action = 'create';
179 }
180 }
181
182
183 // Action update object
184 if ($action == 'update' && $permissiontoadd) {
185 if (!empty($cancel)) {
186 header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode((string) ($id)));
187 exit;
188 }
189
190 if (empty($donation_date)) {
191 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
192 $action = "create";
193 $error++;
194 }
195
196 if (empty($amount)) {
197 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
198 $action = "create";
199 $error++;
200 }
201
202 if (!$error) {
203 $object->fetch($id);
204
205 $object->firstname = GETPOST("firstname", 'alpha');
206 $object->lastname = GETPOST("lastname", 'alpha');
207 $object->societe = GETPOST("societe", 'alpha');
208 $object->address = GETPOST("address", 'alpha');
209 $object->amount = GETPOSTFLOAT("amount");
210 $object->town = GETPOST("town", 'alpha');
211 $object->zip = GETPOST("zipcode", 'alpha');
212 $object->country_id = GETPOSTINT('country_id');
213 $object->email = GETPOST("email", 'alpha');
214 $object->date = $donation_date;
215 $object->public = $public_donation;
216 $object->fk_project = GETPOSTINT("fk_project");
217 $object->modepaymentid = GETPOSTINT('modepayment');
218
219 // Fill array 'array_options' with data from add form
220 $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
221 if ($ret < 0) {
222 $error++;
223 }
224
225 if ($object->update($user) > 0) {
226 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
227 exit;
228 } else {
229 setEventMessages($object->error, $object->errors, 'errors');
230 $action = "create";
231 }
232 }
233 }
234
235
236 // Action add/create object
237 if ($action == 'add' && $permissiontoadd) {
238 if (!empty($cancel)) {
239 header("Location: index.php");
240 exit;
241 }
242
243 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES') && !(GETPOSTINT("socid") > 0)) {
244 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
245 $action = "create";
246 $error++;
247 }
248 if (empty($donation_date)) {
249 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
250 $action = "create";
251 $error++;
252 }
253
254 if (empty($amount)) {
255 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
256 $action = "create";
257 $error++;
258 }
259
260 if (!$error) {
261 $object->socid = GETPOSTINT("socid");
262 $object->firstname = (string) GETPOST("firstname", 'alpha');
263 $object->lastname = (string) GETPOST("lastname", 'alpha');
264 $object->societe = (string) GETPOST("societe", 'alpha');
265 $object->address = (string) GETPOST("address", 'alpha');
266 $object->amount = (float) price2num(GETPOST("amount", 'alpha'), '', 2);
267 $object->zip = (string) GETPOST("zipcode", 'alpha');
268 $object->town = (string) GETPOST("town", 'alpha');
269 $object->country_id = GETPOSTINT('country_id');
270 $object->email = (string) GETPOST('email', 'alpha');
271 $object->date = $donation_date;
272 $object->note_private = (string) GETPOST("note_private", 'restricthtml');
273 $object->note_public = (string) GETPOST("note_public", 'restricthtml');
274 $object->public = $public_donation;
275 $object->fk_project = GETPOSTINT("fk_project");
276 $object->modepaymentid = GETPOSTINT('modepayment');
277
278 // Fill array 'array_options' with data from add form
279 $ret = $extrafields->setOptionalsFromPost(null, $object);
280 if ($ret < 0) {
281 $error++;
282 }
283
284 $res = $object->create($user);
285 if ($res > 0) {
286 header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
287 exit;
288 } else {
289 setEventMessages($object->error, $object->errors, 'errors');
290 $action = "create";
291 }
292 }
293 }
294
295 // Action delete object
296 if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $permissiontodelete) {
297 $result = $object->delete($user);
298 if ($result > 0) {
299 header("Location: index.php");
300 exit;
301 } else {
302 dol_syslog($object->error, LOG_DEBUG);
303 setEventMessages($object->error, $object->errors, 'errors');
304 }
305 }
306
307 // Action validation
308 if ($action == 'valid_promesse' && $permissiontoadd) {
309 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
310 if ($object->valid_promesse($id, $user->id) >= 0) {
311 setEventMessages($langs->trans("DonationValidated", $object->ref), null);
312 $action = '';
313 } else {
314 setEventMessages($object->error, $object->errors, 'errors');
315 }
316 }
317
318 // Action cancel
319 if ($action == 'set_cancel' && $permissiontoadd) {
320 if ($object->set_cancel($id) >= 0) {
321 $action = '';
322 } else {
323 setEventMessages($object->error, $object->errors, 'errors');
324 }
325 }
326
327 // Action set paid
328 if ($action == 'set_paid' && $permissiontoadd) {
329 $modepayment = GETPOSTINT('modepayment');
330 if ($object->setPaid($id, $modepayment) >= 0) {
331 $action = '';
332 } else {
333 setEventMessages($object->error, $object->errors, 'errors');
334 }
335 } elseif ($action == 'classin' && $user->hasRight('don', 'creer')) {
336 $object->setProject($projectid);
337 }
338
339 if ($action == 'set_validate' && $permissiontoadd) {
340 $object->fetch($id);
341 if ($object->reopen($user) >= 0) {
342 $action = '';
343 } else {
344 setEventMessages($object->error, $object->errors, 'errors');
345 }
346 }
347
348 if ($action == 'update_extras' && $permissiontoeditextra) {
349 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
350
351 $attribute_name = GETPOST('attribute', 'aZ09');
352
353 // Fill array 'array_options' with data from update form
354 $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
355 if ($ret < 0) {
356 $error++;
357 }
358
359 if (!$error) {
360 $result = $object->updateExtraField($attribute_name, 'DON_MODIFY');
361 if ($result < 0) {
362 setEventMessages($object->error, $object->errors, 'errors');
363 $error++;
364 }
365 }
366
367 if ($error) {
368 $action = 'edit_extras';
369 }
370 }
371
372 // Actions to build doc
373 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
374}
375
376
377/*
378 * View
379 */
380
381$bankaccountstatic = new Account($db);
382
383$title = $langs->trans("Donation");
384
385$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:Modul_Spenden';
386
387llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card');
388
389$form = new Form($db);
390$formfile = new FormFile($db);
391$formcompany = new FormCompany($db);
392$formproject = null;
393if (isModEnabled('project')) {
394 $formproject = new FormProjets($db);
395}
396
397if ($action == 'create') {
398 print load_fiche_titre($langs->trans("AddDonation"), '', 'object_donation');
399
400 print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
401 print '<input type="hidden" name="token" value="'.newToken().'">';
402 print '<input type="hidden" name="action" value="add">';
403 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
404
405 print dol_get_fiche_head([]);
406
407 print '<table class="border centpercent">';
408 print '<tbody>';
409
410 // Ref
411 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
412
413 // Company
414 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
415 // Thirdparty
416 if (is_object($soc) && $soc->id > 0) {
417 print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
418 print '<td>';
419 print $soc->getNomUrl(1);
420 print '<input type="hidden" name="socid" value="'.$soc->id.'">';
421 // Outstanding Bill
422 $arrayoutstandingbills = $soc->getOutstandingBills();
423 $outstandingBills = $arrayoutstandingbills['opened'];
424 print ' ('.$langs->trans('CurrentOutstandingBill').': ';
425 print price($outstandingBills, 0, $langs, 0, 0, -1, $conf->currency);
426 if ($soc->outstanding_limit != '') {
427 if ($outstandingBills > $soc->outstanding_limit) {
428 print img_warning($langs->trans("OutstandingBillReached"));
429 }
430 print ' / '.price($soc->outstanding_limit, 0, $langs, 0, 0, -1, $conf->currency);
431 }
432 print ')';
433 print '</td>';
434 } else {
435 print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
436 print '<td>';
437 $filter = '((s.client:IN:1,2,3) AND (status:=:1))';
438 print $form->select_company($socid, 'socid', $filter, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
439 // Option to reload page to retrieve customer information. Note, this clear other input
440 if (getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
441 print '<script type="text/javascript">
442 $(document).ready(function() {
443 $("#socid").change(function() {
444 console.log("We have changed the company - Reload page");
445 var socid = $(this).val();
446 var fac_rec = $(\'#fac_rec\').val();
447 // reload page
448 $("input[name=action]").val("create");
449 $("form[name=add]").submit();
450 });
451 });
452 </script>';
453 }
454 print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
455 print '</td>';
456 }
457 print '</tr>'."\n";
458 }
459
460 // Date
461 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
462 print $form->selectDate($donation_date ? $donation_date : -1, '', 0, 0, 0, "add", 1, 1);
463 print '</td>';
464
465 // Amount
466 print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10" spellcheck="false"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
467
468 // Public donation
469 print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
470 print $form->selectyesno("public", $public_donation, 1);
471 print "</td></tr>\n";
472
473 if (!isModEnabled('societe') || !getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
474 print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
475 print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
476 print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
477 print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
478 print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(GETPOST("address", "alphanohtml"), 0, 1).'</textarea></td></tr>';
479
480 // Zip / Town
481 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
482 print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
483 print ' ';
484 print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
485 print '</tr>';
486
487 // Country
488 print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
489 print img_picto('', 'globe-americas', 'class="paddingrightonly"').$form->select_country(GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id);
490 if ($user->admin) {
491 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
492 }
493 print '</td></tr>';
494
495 print '<tr><td>'.$langs->trans("EMail").'</td><td>'.img_picto('', 'object_email', 'class="paddingrightonly"').'<input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200" spellcheck="false"></td></tr>';
496 }
497
498 // Payment mode
499 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
500 $selected = GETPOSTINT('modepayment');
501 print img_picto('', 'payment', 'class="pictofixedwidth"');
502 print $form->select_types_paiements((string) $selected, 'modepayment', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
503 print "</td></tr>\n";
504
505 // Public note
506 print '<tr>';
507 print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
508 print '<td>';
509 if (!isset($note_public)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
510 $note_public = $object->getDefaultCreateValueFor('note_public');
511 }
512 $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
513 print $doleditor->Create(1);
514 print '</td></tr>';
515
516 // Private note
517 if (empty($user->socid)) {
518 print '<tr>';
519 print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
520 print '<td>';
521 if (!isset($note_private)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
522 $note_private = $object->getDefaultCreateValueFor('note_private');
523 }
524 $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
525 print $doleditor->Create(1);
526 print '</td></tr>';
527 }
528
529 if (isModEnabled('project') && $formproject !== null) {
530 print "<tr><td>".$langs->trans("Project")."</td><td>";
531 print img_picto('', 'project', 'class="pictofixedwidth"');
532 print $formproject->select_projects(-1, (string) $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
533 print "</td></tr>\n";
534 }
535
536 // Other attributes
537 $parameters = array();
538 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
539 print $hookmanager->resPrint;
540 if (empty($reshook)) {
541 print $object->showOptionals($extrafields, 'create', $parameters);
542 }
543
544 print '</tbody>';
545 print "</table>\n";
546
547 print dol_get_fiche_end();
548
549 print $form->buttonsSaveCancel();
550
551 print "</form>\n";
552}
553
554
555/* ************************************************************ */
556/* */
557/* Donation card in edit mode */
558/* */
559/* ************************************************************ */
560
561if (!empty($id) && $action == 'edit') {
562 $hselected = 'card';
563 $head = donation_prepare_head($object);
564
565 print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
566 print '<input type="hidden" name="token" value="'.newToken().'">';
567 print '<input type="hidden" name="action" value="update">';
568 print '<input type="hidden" name="rowid" value="'.$object->id.'">';
569 print '<input type="hidden" name="amount" value="'.$object->amount.'">';
570 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
571
572 print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation');
573
574 print '<table class="border centpercent">';
575
576 // Ref
577 print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
578 print $object->getNomUrl();
579 print '</td>';
580 print '</tr>';
581
582 // Date
583 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
584 print $form->selectDate($object->date, '', 0, 0, 0, "update");
585 print '</td>';
586
587 // Amount
588 if ($object->status == 0) {
589 print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.price($object->amount).'" spellcheck="false"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
590 } else {
591 print '<tr><td>'.$langs->trans("Amount").'</td><td>';
592 print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
593 print '</td></tr>';
594 }
595
596 print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
597 print $form->selectyesno("public", $object->public, 1);
598 print "</td>";
599 print "</tr>\n";
600
601 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
602 $company = new Societe($db);
603
604 print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
605 if ($object->socid > 0) {
606 $result = $company->fetch($object->socid);
607 print $company->getNomUrl(1);
608 }
609 print '</td></tr>';
610 } else {
611 $langs->load("companies");
612 print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
613 print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
614 print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.dol_escape_htmltag($object->firstname).'"></td></tr>';
615 print '<tr><td>'.$langs->trans("Address").'</td><td>';
616 print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address, 0, 1).'</textarea></td></tr>';
617
618 // Zip / Town
619 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
620 print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOSTISSET("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
621 print ' ';
622 print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
623 print '</tr>';
624
625 // Country
626 print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
627 print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
628 if ($user->admin) {
629 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
630 }
631 print '</td></tr>';
632
633 print '<tr><td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'" spellcheck="false"></td></tr>';
634 }
635 // Payment mode
636 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
637 if ($object->mode_reglement_id) {
638 $selected = (string) $object->mode_reglement_id;
639 } else {
640 $selected = '';
641 }
642 $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
643 print "</td></tr>\n";
644
645 // Status
646 print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
647
648 // Project
649 if (isModEnabled('project')) {
650 $formproject = new FormProjets($db);
651
652 $langs->load('projects');
653 print '<tr><td>'.$langs->trans('Project').'</td><td>';
654 $formproject->select_projects(-1, (string) $object->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
655 print '</td></tr>';
656 }
657
658 // Other attributes
659 $parameters = array();
660 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
661 print $hookmanager->resPrint;
662 if (empty($reshook)) {
663 print $object->showOptionals($extrafields, 'edit', $parameters);
664 }
665
666 print "</table>\n";
667
668 print dol_get_fiche_end();
669
670 print $form->buttonsSaveCancel();
671
672 print "</form>\n";
673}
674
675
676
677/* ************************************************************ */
678/* */
679/* Donation card in view mode */
680/* */
681/* ************************************************************ */
682if (!empty($id) && $action != 'edit') {
683 $totalpaid = 0;
684 $formconfirm = "";
685 // Confirmation delete
686 if ($action == 'delete') {
687 $text = $langs->trans("ConfirmDeleteADonation");
688 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1);
689 }
690
691 $result = $object->fetch($id);
692 if ($result < 0) {
693 dol_print_error($db, $object->error);
694 exit;
695 }
696 $result = $object->fetch_optionals();
697 if ($result < 0) {
698 dol_print_error($db);
699 exit;
700 }
701
702 $hselected = 'card';
703
704 $head = donation_prepare_head($object);
705 print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'donation');
706
707 // Print form confirm
708 print $formconfirm;
709
710 $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
711
712 $morehtmlref = '<div class="refidno">';
713 // Project
714 if (isModEnabled('project') && $formproject !== null) {
715 $langs->load("projects");
716 //$morehtmlref .= '<br>';
717 if ($permissiontoadd) {
718 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
719 if ($action != 'classify') {
720 $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
721 }
722 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
723 } else {
724 if (!empty($object->fk_project)) {
725 $proj = new Project($db);
726 $proj->fetch($object->fk_project);
727 $morehtmlref .= $proj->getNomUrl(1);
728 if ($proj->title) {
729 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
730 }
731 }
732 }
733 }
734 $morehtmlref .= '</div>';
735
736
737 dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
738
739
740 print '<div class="fichecenter">';
741 print '<div class="fichehalfleft">';
742 print '<div class="underbanner clearboth"></div>';
743
744 print '<table class="border tableforfield" width="100%">';
745
746 // Date
747 print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">';
748 print dol_print_date($object->date, "day");
749 print "</td>";
750
751 print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">';
752 print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
753 print '</td></tr>';
754
755 print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
756 print yn($object->public);
757 print '</td></tr>';
758
759 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
760 $company = new Societe($db);
761
762 print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
763 if ($object->socid > 0) {
764 $result = $company->fetch($object->socid);
765 print $company->getNomUrl(1);
766 }
767 print '</td></tr>';
768 } else {
769 print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
770 print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
771 print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
772 }
773
774 // Payment mode
775 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
776 $form->form_modes_reglement('', (string) $object->mode_reglement_id, 'none');
777 print "</td></tr>\n";
778
779 // Other attributes
780 $cols = 2;
781 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
782
783 print '</table>';
784
785 print '</div>';
786 print '<div class="fichehalfright">';
787
788 /*
789 * Payments
790 */
791 $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
792 $sql .= " c.code as type_code, c.libelle as paiement_type,";
793 $sql .= " b.fk_account";
794 $sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
795 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
796 $sql .= ", ".MAIN_DB_PREFIX."c_paiement as c ";
797 $sql .= ", ".MAIN_DB_PREFIX."don as d";
798 $sql .= " WHERE d.rowid = ".((int) $id);
799 $sql .= " AND p.fk_donation = d.rowid";
800 $sql .= " AND d.entity IN (".getEntity('donation').")";
801 $sql .= " AND p.fk_typepayment = c.id";
802 $sql .= " ORDER BY dp";
803
804 //print $sql;
805 $resql = $db->query($sql);
806 if ($resql) {
807 $num = $db->num_rows($resql);
808 $i = 0;
809
810 print '<table class="noborder paymenttable centpercent">';
811 print '<tr class="liste_titre">';
812 print '<td>'.$langs->trans("RefPayment").'</td>';
813 print '<td>'.$langs->trans("Date").'</td>';
814 print '<td>'.$langs->trans("Type").'</td>';
815 if (isModEnabled("bank")) {
816 print '<td>'.$langs->trans("BankAccount").'</td>';
817 }
818 print '<td class="right">'.$langs->trans("Amount").'</td>';
819 print '</tr>';
820
821 while ($i < $num) {
822 $objp = $db->fetch_object($resql);
823
824 print '<tr class="oddeven"><td>';
825 print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
826 print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
827 $labeltype = ($langs->trans("PaymentType".$objp->type_code) != "PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
828 print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
829 if (isModEnabled("bank")) {
830 $bankaccountstatic->fetch($objp->fk_account);
831 /*$bankaccountstatic->id = $objp->fk_bank;
832 $bankaccountstatic->ref = $objp->baref;
833 $bankaccountstatic->label = $objp->baref;
834 $bankaccountstatic->number = $objp->banumber;
835 $bankaccountstatic->currency_code = $objp->bacurrency_code;
836
837 if (isModEnabled('accounting')) {
838 $bankaccountstatic->account_number = $objp->account_number;
839
840 $accountingjournal = new AccountingJournal($db);
841 $accountingjournal->fetch($objp->fk_accountancy_journal);
842 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
843 }
844 */
845 print '<td class="nowraponall">';
846 if ($bankaccountstatic->id) {
847 print $bankaccountstatic->getNomUrl(1, 'transactions');
848 }
849 print '</td>';
850 }
851 print '<td class="right">'.price($objp->amount)."</td>\n";
852 print "</tr>";
853 $totalpaid += $objp->amount;
854 $i++;
855 }
856
857 if ($object->paid == 0) {
858 $colspan = 3;
859 if (isModEnabled("bank")) {
860 $colspan++;
861 }
862 print '<tr><td colspan="'.$colspan.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaid)."</td></tr>\n";
863 print '<tr><td colspan="'.$colspan.'" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right">'.price($object->amount)."</td></tr>\n";
864
865 $remaintopay = $object->amount - $totalpaid;
866 $resteapayeraffiche = $remaintopay;
867
868 print '<tr><td colspan="'.$colspan.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
869 print '<td class="right'.(!empty($resteapayeraffiche) ? ' amountremaintopay' : '').'">'.price($resteapayeraffiche)."</td></tr>\n";
870 }
871 print "</table>";
872 $db->free($resql);
873 } else {
874 dol_print_error($db);
875 }
876
877 print '</div>';
878 print '</div>';
879
880 print '<div class="clearboth"></div>';
881
882 print dol_get_fiche_end();
883
884 $remaintopay = price2num($object->amount - $totalpaid, 'MT');
885
886
887 // Actions buttons
888
889 print '<div class="tabsAction">';
890 $parameters = array();
891 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
892 if (empty($reshook)) {
893 // Re-open
894 if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) {
895 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("ReOpen").'</a>';
896 }
897
898 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
899
900 if ($object->status == $object::STATUS_DRAFT) {
901 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=valid_promesse&token='.newToken().'">'.$langs->trans("ValidPromess").'</a></div>';
902 }
903
904 if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $totalpaid == 0 && $object->paid == 0) {
905 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_cancel&token='.newToken().'">'.$langs->trans("ClassifyCanceled")."</a></div>";
906 }
907
908 // Create payment
909 if ($object->status == $object::STATUS_VALIDATED && $object->paid == 0 && $user->hasRight('don', 'creer')) {
910 if ($remaintopay == 0) {
911 print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span></div>';
912 } else {
913 print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid='.$object->id.'&action=create&token='.newToken().'">'.$langs->trans('DoPayment').'</a></div>';
914 }
915 }
916
917 // Classify 'paid'
918 if ($object->status == $object::STATUS_VALIDATED && $remaintopay == 0 && $object->paid == 0 && $user->hasRight('don', 'creer')) {
919 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_paid&token='.newToken().'">'.$langs->trans("ClassifyPaid")."</a></div>";
920 }
921 if ($object->status == $object::STATUS_PAID && $object->paid == 1 && $user->hasRight('don', 'creer')) {
922 print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_validate&token='.newToken().'">'.$langs->trans("ReOpen")."</a></div>";
923 }
924
925 // Delete
926 if ($user->hasRight('don', 'supprimer')) {
927 if ($object->status != $object::STATUS_PAID && $remaintopay == $object->amount) {
928 print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>";
929 } else {
930 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DeletionNotPossibleWhenAPaymentExists").'">'.$langs->trans("Delete")."</a></div>";
931 }
932 } else {
933 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
934 }
935 }
936
937 print "</div>";
938
939
940 print '<div class="fichecenter"><div class="fichehalfleft">';
941
942 /*
943 * Generated documents
944 */
945 $filename = dol_sanitizeFileName((string) $object->id);
946 $filedir = $conf->don->dir_output."/".dol_sanitizeFileName((string) $object->id);
947 $urlsource = $_SERVER['PHP_SELF'].'?rowid='.$object->id;
948 $genallowed = (int) (($object->paid == 0 || $user->admin) && $user->hasRight('don', 'lire'));
949 $delallowed = $user->hasRight('don', 'creer');
950
951 print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
952
953 // Show links to link elements
954 $tmparray = $form->showLinkToObjectBlock($object, array(), array('don'), 1);
955 $linktoelem = $tmparray['linktoelem'];
956 $htmltoenteralink = $tmparray['htmltoenteralink'];
957 print $htmltoenteralink;
958
959 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
960
961 // Show online payment link
962 // The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods()
963 include_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
964 $validpaymentmethod = getValidOnlinePaymentMethods('');
965 $useonlinepayment = count($validpaymentmethod);
966
967 if ($useonlinepayment) { //$object->statut != Facture::STATUS_DRAFT &&
968 print '<br><!-- Link to pay -->'."\n";
969 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
970 print showOnlinePaymentUrl('donation', $object->ref).'<br>';
971 }
972
973 print '</div><div class="fichehalfright">';
974
975 print '</div></div>';
976}
977
978llxFooter();
979$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage bank accounts.
Class to manage a WYSIWYG editor.
Class to manage donations.
Definition don.class.php:41
Class to manage standard extra fields.
Class to build HTML component for third parties management Only common components are here.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage building of HTML components.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
global $mysoc
donation_prepare_head($object)
Prepare array with list of tabs.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
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)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
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...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.