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