dolibarr 25.0.0-alpha
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-2026 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
32// Load Dolibarr environment
33require '../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php';
44require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
45require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
47require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
48require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
49require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
50require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
51require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
53require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
54if (isModEnabled('project')) {
55 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
56 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
57}
58require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
59
60
61$langs->loadLangs(array('bills', 'companies', 'donations', 'users'));
62
63$id = GETPOST('rowid') ? GETPOSTINT('rowid') : GETPOSTINT('id');
64$ref = GETPOST('ref', 'alpha');
65$action = GETPOST('action', 'aZ09');
66$cancel = GETPOST('cancel', 'alpha');
67$confirm = GETPOST('confirm', 'alpha');
68$backtopage = GETPOST('backtopage', 'alpha');
69$socid = GETPOSTINT('socid');
70$amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT');
71$donation_date = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
72$projectid = (GETPOST('projectid') ? GETPOSTINT('projectid') : 0);
73$public_donation = GETPOSTINT("public");
74
75$object = new Don($db);
76if ($id > 0 || $ref) {
77 $object->fetch($id, $ref);
78}
79
80$soc = null;
81if (!empty($socid) && $socid > 0) {
82 $soc = new Societe($db);
83 if ($socid > 0) {
84 $soc->fetch($socid);
85 }
86}
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 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
298 $result = $object->delete($user);
299 if ($result > 0) {
300 header("Location: index.php");
301 exit;
302 } else {
303 dol_syslog($object->error, LOG_DEBUG);
304 setEventMessages($object->error, $object->errors, 'errors');
305 }
306 }
307
308 // Action validation
309 if ($action == 'valid_promesse' && $permissiontoadd) {
310 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
311 if ($object->valid_promesse($id, $user->id) >= 0) {
312 setEventMessages($langs->trans("DonationValidated", $object->ref), null);
313 $action = '';
314 } else {
315 setEventMessages($object->error, $object->errors, 'errors');
316 }
317 }
318
319 // Action cancel
320 if ($action == 'set_cancel' && $permissiontoadd) {
321 if ($object->set_cancel($id) >= 0) {
322 $action = '';
323 } else {
324 setEventMessages($object->error, $object->errors, 'errors');
325 }
326 }
327
328 // Action set paid
329 if ($action == 'set_paid' && $permissiontoadd) {
330 $modepayment = GETPOSTINT('modepayment');
331 if ($object->setPaid($id, $modepayment) >= 0) {
332 $action = '';
333 } else {
334 setEventMessages($object->error, $object->errors, 'errors');
335 }
336 } elseif ($action == 'classin' && $user->hasRight('don', 'creer')) {
337 $object->setProject($projectid);
338 }
339
340 if ($action == 'set_validate' && $permissiontoadd) {
341 $object->fetch($id);
342 if ($object->reopen($user) >= 0) {
343 $action = '';
344 } else {
345 setEventMessages($object->error, $object->errors, 'errors');
346 }
347 }
348
349 if ($action == 'update_extras' && $permissiontoeditextra) {
350 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
351
352 $attribute_name = GETPOST('attribute', 'aZ09');
353
354 // Fill array 'array_options' with data from update form
355 $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
356 if ($ret < 0) {
357 $error++;
358 }
359
360 if (!$error) {
361 $result = $object->updateExtraField($attribute_name, 'DON_MODIFY');
362 if ($result < 0) {
363 setEventMessages($object->error, $object->errors, 'errors');
364 $error++;
365 }
366 }
367
368 if ($error) {
369 $action = 'edit_extras';
370 }
371 }
372
373 // Actions to build doc
374 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
375}
376
377
378/*
379 * View
380 */
381
382$bankaccountstatic = new Account($db);
383
384$title = $langs->trans("Donation");
385
386$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:Modul_Spenden';
387
388llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card');
389
390$form = new Form($db);
391$formfile = new FormFile($db);
392$formcompany = new FormCompany($db);
393$formproject = null;
394if (isModEnabled('project')) {
395 $formproject = new FormProjets($db);
396}
397
398if ($action == 'create') {
399 print load_fiche_titre($langs->trans("AddDonation"), '', 'object_donation');
400
401 print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
402 print '<input type="hidden" name="token" value="'.newToken().'">';
403 print '<input type="hidden" name="action" value="add">';
404 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
405
406 print dol_get_fiche_head([]);
407
408 print '<table class="border centpercent">';
409 print '<tbody>';
410
411 // Ref
412 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
413
414 // Company
415 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
416 // Thirdparty
417 if (is_object($soc) && $soc->id > 0) {
418 print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
419 print '<td>';
420 print $soc->getNomUrl(1);
421 print '<input type="hidden" name="socid" value="'.$soc->id.'">';
422 // Outstanding Bill
423 $arrayoutstandingbills = $soc->getOutstandingBills();
424 $outstandingBills = $arrayoutstandingbills['opened'];
425 print ' ('.$langs->trans('CurrentOutstandingBill').': ';
426 print price($outstandingBills, 0, $langs, 0, 0, -1, $conf->currency);
427 if ($soc->outstanding_limit != '') {
428 if ($outstandingBills > $soc->outstanding_limit) {
429 print img_warning($langs->trans("OutstandingBillReached"));
430 }
431 print ' / '.price($soc->outstanding_limit, 0, $langs, 0, 0, -1, $conf->currency);
432 }
433 print ')';
434 print '</td>';
435 } else {
436 print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
437 print '<td>';
438 $filter = '((s.client:IN:1,2,3) AND (status:=:1))';
439 print $form->select_company($socid, 'socid', $filter, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
440 // Option to reload page to retrieve customer information. Note, this clear other input
441 if (getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
442 print '<script type="text/javascript">
443 $(document).ready(function() {
444 $("#socid").change(function() {
445 console.log("We have changed the company - Reload page");
446 var socid = $(this).val();
447 var fac_rec = $(\'#fac_rec\').val();
448 // reload page
449 $("input[name=action]").val("create");
450 $("form[name=add]").submit();
451 });
452 });
453 </script>';
454 }
455 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>';
456 print '</td>';
457 }
458 print '</tr>'."\n";
459 }
460
461 // Date
462 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
463 print $form->selectDate($donation_date ? $donation_date : -1, '', 0, 0, 0, "add", 1, 1);
464 print '</td>';
465
466 // Amount
467 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>';
468
469 // Public donation
470 print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
471 print $form->selectyesno("public", $public_donation, 1);
472 print "</td></tr>\n";
473
474 if (!isModEnabled('societe') || !getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
475 print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
476 print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
477 print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
478 print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
479 print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(GETPOST("address", "alphanohtml"), 0, 1).'</textarea></td></tr>';
480
481 // Zip / Town
482 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
483 print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
484 print ' ';
485 print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
486 print '</tr>';
487
488 // Country
489 print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
490 print img_picto('', 'globe-americas', 'class="paddingrightonly"').$form->select_country(GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id);
491 if ($user->admin) {
492 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
493 }
494 print '</td></tr>';
495
496 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>';
497 }
498
499 // Payment mode
500 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
501 $selected = GETPOSTINT('modepayment');
502 print img_picto('', 'payment', 'class="pictofixedwidth"');
503 print $form->select_types_paiements((string) $selected, 'modepayment', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
504 print "</td></tr>\n";
505
506 // Public note
507 print '<tr>';
508 print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
509 print '<td>';
510 if (!isset($note_public)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
511 $note_public = $object->getDefaultCreateValueFor('note_public');
512 }
513 $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
514 print $doleditor->Create(1);
515 print '</td></tr>';
516
517 // Private note
518 if (empty($user->socid)) {
519 print '<tr>';
520 print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
521 print '<td>';
522 if (!isset($note_private)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
523 $note_private = $object->getDefaultCreateValueFor('note_private');
524 }
525 $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
526 print $doleditor->Create(1);
527 print '</td></tr>';
528 }
529
530 if (isModEnabled('project') && $formproject !== null) {
531 print "<tr><td>".$langs->trans("Project")."</td><td>";
532 print img_picto('', 'project', 'class="pictofixedwidth"');
533 print $formproject->select_projects(-1, (string) $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
534 print "</td></tr>\n";
535 }
536
537 // Other attributes
538 $parameters = array();
539 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
540 print $hookmanager->resPrint;
541 if (empty($reshook)) {
542 print $object->showOptionals($extrafields, 'create', $parameters);
543 }
544
545 print '</tbody>';
546 print "</table>\n";
547
548 print dol_get_fiche_end();
549
550 print $form->buttonsSaveCancel('CreateDraft');
551
552 print "</form>\n";
553}
554
555
556/* ************************************************************ */
557/* */
558/* Donation card in edit mode */
559/* */
560/* ************************************************************ */
561
562if (!empty($id) && $action == 'edit') {
563 $hselected = 'card';
564 $head = donation_prepare_head($object);
565
566 print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
567 print '<input type="hidden" name="token" value="'.newToken().'">';
568 print '<input type="hidden" name="action" value="update">';
569 print '<input type="hidden" name="rowid" value="'.$object->id.'">';
570 print '<input type="hidden" name="amount" value="'.$object->amount.'">';
571 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
572
573 print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation');
574
575 print '<table class="border centpercent">';
576
577 // Ref
578 print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
579 print $object->getNomUrl();
580 print '</td>';
581 print '</tr>';
582
583 // Date
584 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
585 print $form->selectDate($object->date, '', 0, 0, 0, "update");
586 print '</td>';
587
588 // Amount
589 if ($object->status == 0) {
590 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>';
591 } else {
592 print '<tr><td>'.$langs->trans("Amount").'</td><td>';
593 print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
594 print '</td></tr>';
595 }
596
597 print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
598 print $form->selectyesno("public", $object->public, 1);
599 print "</td>";
600 print "</tr>\n";
601
602 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
603 $company = new Societe($db);
604
605 print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
606 if ($object->socid > 0) {
607 $result = $company->fetch($object->socid);
608 print $company->getNomUrl(1);
609 }
610 print '</td></tr>';
611 } else {
612 $langs->load("companies");
613 print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
614 print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
615 print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.dol_escape_htmltag($object->firstname).'"></td></tr>';
616 print '<tr><td>'.$langs->trans("Address").'</td><td>';
617 print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address, 0, 1).'</textarea></td></tr>';
618
619 // Zip / Town
620 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
621 print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOSTISSET("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
622 print ' ';
623 print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
624 print '</tr>';
625
626 // Country
627 print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
628 print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
629 if ($user->admin) {
630 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
631 }
632 print '</td></tr>';
633
634 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>';
635 }
636 // Payment mode
637 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
638 if ($object->mode_reglement_id) {
639 $selected = (string) $object->mode_reglement_id;
640 } else {
641 $selected = '';
642 }
643 $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
644 print "</td></tr>\n";
645
646 // Status
647 print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
648
649 // Project
650 if (isModEnabled('project')) {
651 $formproject = new FormProjets($db);
652
653 $langs->load('projects');
654 print '<tr><td>'.$langs->trans('Project').'</td><td>';
655 $formproject->select_projects(-1, (string) $object->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
656 print '</td></tr>';
657 }
658
659 // Other attributes
660 $parameters = array();
661 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
662 print $hookmanager->resPrint;
663 if (empty($reshook)) {
664 print $object->showOptionals($extrafields, 'edit', $parameters);
665 }
666
667 print "</table>\n";
668
669 print dol_get_fiche_end();
670
671 print $form->buttonsSaveCancel();
672
673 print "</form>\n";
674}
675
676
677
678/* ************************************************************ */
679/* */
680/* Donation card in view mode */
681/* */
682/* ************************************************************ */
683if (!empty($id) && $action != 'edit') {
684 $totalpaid = 0;
685 $formconfirm = "";
686 // Confirmation delete
687 if ($action == 'delete') {
688 $text = $langs->trans("ConfirmDeleteADonation");
689 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1);
690 }
691
692 $result = $object->fetch($id);
693 if ($result < 0) {
694 recordNotFound('', 0);
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', 0, '', '', 0, '', 1);
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">'.dolGetButtonAction($langs->trans("Delete"), $langs->trans("Delete"), 'delete', 'card.php?rowid='.$object->id.'&action=delete&token='.newToken(), '', true, array('attr' => array('class' => 'reposition')))."</div>\n";
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 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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
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...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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:540
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:738
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:181
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.