dolibarr 22.0.5
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 * 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 if (method_exists($object, 'generateDocument')) {
155 $outputlangs = $langs;
156 $newlang = '';
157 if (getDolGlobalInt('MAIN_MULTILANGS') && GETPOST('lang_id', 'aZ09')) {
158 $newlang = GETPOST('lang_id', 'aZ09');
159 }
160 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
161 $newlang = $object->thirdparty->default_lang;
162 }
163 if (!empty($newlang)) {
164 $outputlangs = new Translate("", $conf);
165 $outputlangs->setDefaultLang($newlang);
166 }
167 $model = $object->model_pdf;
168 $ret = $object->fetch($id); // Reload to get new records
169 $hidedetails = 0;
170 $hidedesc = 0;
171 $hideref = 0;
172 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
173 }
174 }
175
176 header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
177 exit;
178 } else {
179 setEventMessages($object->error, $object->errors, 'errors');
180 $action = 'create';
181 }
182 }
183
184
185 // Action update object
186 if ($action == 'update' && $permissiontoadd) {
187 if (!empty($cancel)) {
188 header("Location: ".$_SERVER['PHP_SELF']."?id=".urlencode((string) ($id)));
189 exit;
190 }
191
192 if (empty($donation_date)) {
193 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
194 $action = "create";
195 $error++;
196 }
197
198 if (empty($amount)) {
199 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
200 $action = "create";
201 $error++;
202 }
203
204 if (!$error) {
205 $object->fetch($id);
206
207 $object->firstname = GETPOST("firstname", 'alpha');
208 $object->lastname = GETPOST("lastname", 'alpha');
209 $object->societe = GETPOST("societe", 'alpha');
210 $object->address = GETPOST("address", 'alpha');
211 $object->amount = GETPOSTFLOAT("amount");
212 $object->town = GETPOST("town", 'alpha');
213 $object->zip = GETPOST("zipcode", 'alpha');
214 $object->country_id = GETPOSTINT('country_id');
215 $object->email = GETPOST("email", 'alpha');
216 $object->date = $donation_date;
217 $object->public = $public_donation;
218 $object->fk_project = GETPOSTINT("fk_project");
219 $object->modepaymentid = GETPOSTINT('modepayment');
220
221 // Fill array 'array_options' with data from add form
222 $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
223 if ($ret < 0) {
224 $error++;
225 }
226
227 if ($object->update($user) > 0) {
228 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
229 exit;
230 } else {
231 setEventMessages($object->error, $object->errors, 'errors');
232 $action = "create";
233 }
234 }
235 }
236
237
238 // Action add/create object
239 if ($action == 'add' && $permissiontoadd) {
240 if (!empty($cancel)) {
241 header("Location: index.php");
242 exit;
243 }
244
245 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES') && !(GETPOSTINT("socid") > 0)) {
246 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
247 $action = "create";
248 $error++;
249 }
250 if (empty($donation_date)) {
251 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
252 $action = "create";
253 $error++;
254 }
255
256 if (empty($amount)) {
257 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
258 $action = "create";
259 $error++;
260 }
261
262 if (!$error) {
263 $object->socid = GETPOSTINT("socid");
264 $object->firstname = (string) GETPOST("firstname", 'alpha');
265 $object->lastname = (string) GETPOST("lastname", 'alpha');
266 $object->societe = (string) GETPOST("societe", 'alpha');
267 $object->address = (string) GETPOST("address", 'alpha');
268 $object->amount = price2num(GETPOST("amount", 'alpha'), '', 2);
269 $object->zip = (string) GETPOST("zipcode", 'alpha');
270 $object->town = (string) GETPOST("town", 'alpha');
271 $object->country_id = GETPOSTINT('country_id');
272 $object->email = (string) GETPOST('email', 'alpha');
273 $object->date = $donation_date;
274 $object->note_private = (string) GETPOST("note_private", 'restricthtml');
275 $object->note_public = (string) GETPOST("note_public", 'restricthtml');
276 $object->public = $public_donation;
277 $object->fk_project = GETPOSTINT("fk_project");
278 $object->modepaymentid = GETPOSTINT('modepayment');
279
280 // Fill array 'array_options' with data from add form
281 $ret = $extrafields->setOptionalsFromPost(null, $object);
282 if ($ret < 0) {
283 $error++;
284 }
285
286 $res = $object->create($user);
287 if ($res > 0) {
288 header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
289 exit;
290 } else {
291 setEventMessages($object->error, $object->errors, 'errors');
292 $action = "create";
293 }
294 }
295 }
296
297 // Action delete object
298 if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $permissiontodelete) {
299 $result = $object->delete($user);
300 if ($result > 0) {
301 header("Location: index.php");
302 exit;
303 } else {
304 dol_syslog($object->error, LOG_DEBUG);
305 setEventMessages($object->error, $object->errors, 'errors');
306 }
307 }
308
309 // Action validation
310 if ($action == 'valid_promesse' && $permissiontoadd) {
311 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
312 if ($object->valid_promesse($id, $user->id) >= 0) {
313 setEventMessages($langs->trans("DonationValidated", $object->ref), null);
314 $action = '';
315 } else {
316 setEventMessages($object->error, $object->errors, 'errors');
317 }
318 }
319
320 // Action cancel
321 if ($action == 'set_cancel' && $permissiontoadd) {
322 if ($object->set_cancel($id) >= 0) {
323 $action = '';
324 } else {
325 setEventMessages($object->error, $object->errors, 'errors');
326 }
327 }
328
329 // Action set paid
330 if ($action == 'set_paid' && $permissiontoadd) {
331 $modepayment = GETPOSTINT('modepayment');
332 if ($object->setPaid($id, $modepayment) >= 0) {
333 $action = '';
334 } else {
335 setEventMessages($object->error, $object->errors, 'errors');
336 }
337 } elseif ($action == 'classin' && $user->hasRight('don', 'creer')) {
338 $object->setProject($projectid);
339 }
340
341 if ($action == 'set_validate' && $permissiontoadd) {
342 $object->fetch($id);
343 if ($object->reopen($user) >= 0) {
344 $action = '';
345 } else {
346 setEventMessages($object->error, $object->errors, 'errors');
347 }
348 }
349
350 if ($action == 'update_extras' && $permissiontoeditextra) {
351 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
352
353 $attribute_name = GETPOST('attribute', 'aZ09');
354
355 // Fill array 'array_options' with data from update form
356 $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
357 if ($ret < 0) {
358 $error++;
359 }
360
361 if (!$error) {
362 $result = $object->updateExtraField($attribute_name, 'DON_MODIFY');
363 if ($result < 0) {
364 setEventMessages($object->error, $object->errors, 'errors');
365 $error++;
366 }
367 }
368
369 if ($error) {
370 $action = 'edit_extras';
371 }
372 }
373
374 // Actions to build doc
375 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
376}
377
378
379/*
380 * View
381 */
382
383$bankaccountstatic = new Account($db);
384
385$title = $langs->trans("Donation");
386
387$help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:Modul_Spenden';
388
389llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card');
390
391$form = new Form($db);
392$formfile = new FormFile($db);
393$formcompany = new FormCompany($db);
394$formproject = null;
395if (isModEnabled('project')) {
396 $formproject = new FormProjets($db);
397}
398
399if ($action == 'create') {
400 print load_fiche_titre($langs->trans("AddDonation"), '', 'object_donation');
401
402 print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
403 print '<input type="hidden" name="token" value="'.newToken().'">';
404 print '<input type="hidden" name="action" value="add">';
405 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
406
407 print dol_get_fiche_head([]);
408
409 print '<table class="border centpercent">';
410 print '<tbody>';
411
412 // Ref
413 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
414
415 // Company
416 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
417 // Thirdparty
418 if (is_object($soc) && $soc->id > 0) {
419 print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
420 print '<td>';
421 print $soc->getNomUrl(1);
422 print '<input type="hidden" name="socid" value="'.$soc->id.'">';
423 // Outstanding Bill
424 $arrayoutstandingbills = $soc->getOutstandingBills();
425 $outstandingBills = $arrayoutstandingbills['opened'];
426 print ' ('.$langs->trans('CurrentOutstandingBill').': ';
427 print price($outstandingBills, 0, $langs, 0, 0, -1, $conf->currency);
428 if ($soc->outstanding_limit != '') {
429 if ($outstandingBills > $soc->outstanding_limit) {
430 print img_warning($langs->trans("OutstandingBillReached"));
431 }
432 print ' / '.price($soc->outstanding_limit, 0, $langs, 0, 0, -1, $conf->currency);
433 }
434 print ')';
435 print '</td>';
436 } else {
437 print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
438 print '<td>';
439 $filter = '((s.client:IN:1,2,3) AND (status:=:1))';
440 print $form->select_company($socid, 'socid', $filter, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
441 // Option to reload page to retrieve customer information. Note, this clear other input
442 if (getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
443 print '<script type="text/javascript">
444 $(document).ready(function() {
445 $("#socid").change(function() {
446 console.log("We have changed the company - Reload page");
447 var socid = $(this).val();
448 var fac_rec = $(\'#fac_rec\').val();
449 // reload page
450 $("input[name=action]").val("create");
451 $("form[name=add]").submit();
452 });
453 });
454 </script>';
455 }
456 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>';
457 print '</td>';
458 }
459 print '</tr>'."\n";
460 }
461
462 // Date
463 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
464 print $form->selectDate($donation_date ? $donation_date : -1, '', 0, 0, 0, "add", 1, 1);
465 print '</td>';
466
467 // Amount
468 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>';
469
470 // Public donation
471 print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
472 print $form->selectyesno("public", $public_donation, 1);
473 print "</td></tr>\n";
474
475 if (!isModEnabled('societe') || !getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
476 print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
477 print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
478 print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
479 print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
480 print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(GETPOST("address", "alphanohtml"), 0, 1).'</textarea></td></tr>';
481
482 // Zip / Town
483 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
484 print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOST("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
485 print ' ';
486 print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
487 print '</tr>';
488
489 // Country
490 print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
491 print img_picto('', 'globe-americas', 'class="paddingrightonly"').$form->select_country(GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id);
492 if ($user->admin) {
493 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
494 }
495 print '</td></tr>';
496
497 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>';
498 }
499
500 // Payment mode
501 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
502 $selected = GETPOSTINT('modepayment');
503 print img_picto('', 'payment', 'class="pictofixedwidth"');
504 print $form->select_types_paiements((string) $selected, 'modepayment', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
505 print "</td></tr>\n";
506
507 // Public note
508 print '<tr>';
509 print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
510 print '<td>';
511 if (!isset($note_public)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
512 $note_public = $object->getDefaultCreateValueFor('note_public');
513 }
514 $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
515 print $doleditor->Create(1);
516 print '</td></tr>';
517
518 // Private note
519 if (empty($user->socid)) {
520 print '<tr>';
521 print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
522 print '<td>';
523 if (!isset($note_private)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
524 $note_private = $object->getDefaultCreateValueFor('note_private');
525 }
526 $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
527 print $doleditor->Create(1);
528 print '</td></tr>';
529 }
530
531 if (isModEnabled('project') && $formproject !== null) {
532 print "<tr><td>".$langs->trans("Project")."</td><td>";
533 print img_picto('', 'project', 'class="pictofixedwidth"');
534 print $formproject->select_projects(-1, (string) $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
535 print "</td></tr>\n";
536 }
537
538 // Other attributes
539 $parameters = array();
540 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
541 print $hookmanager->resPrint;
542 if (empty($reshook)) {
543 print $object->showOptionals($extrafields, 'create', $parameters);
544 }
545
546 print '</tbody>';
547 print "</table>\n";
548
549 print dol_get_fiche_end();
550
551 print $form->buttonsSaveCancel();
552
553 print "</form>\n";
554}
555
556
557/* ************************************************************ */
558/* */
559/* Donation card in edit mode */
560/* */
561/* ************************************************************ */
562
563if (!empty($id) && $action == 'edit') {
564 $hselected = 'card';
566
567 print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
568 print '<input type="hidden" name="token" value="'.newToken().'">';
569 print '<input type="hidden" name="action" value="update">';
570 print '<input type="hidden" name="rowid" value="'.$object->id.'">';
571 print '<input type="hidden" name="amount" value="'.$object->amount.'">';
572 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
573
574 print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation');
575
576 print '<table class="border centpercent">';
577
578 // Ref
579 print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
580 print $object->getNomUrl();
581 print '</td>';
582 print '</tr>';
583
584 // Date
585 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
586 print $form->selectDate($object->date, '', 0, 0, 0, "update");
587 print '</td>';
588
589 // Amount
590 if ($object->status == 0) {
591 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>';
592 } else {
593 print '<tr><td>'.$langs->trans("Amount").'</td><td>';
594 print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
595 print '</td></tr>';
596 }
597
598 print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
599 print $form->selectyesno("public", $object->public, 1);
600 print "</td>";
601 print "</tr>\n";
602
603 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
604 $company = new Societe($db);
605
606 print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
607 if ($object->socid > 0) {
608 $result = $company->fetch($object->socid);
609 print $company->getNomUrl(1);
610 }
611 print '</td></tr>';
612 } else {
613 $langs->load("companies");
614 print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
615 print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
616 print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.dol_escape_htmltag($object->firstname).'"></td></tr>';
617 print '<tr><td>'.$langs->trans("Address").'</td><td>';
618 print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address, 0, 1).'</textarea></td></tr>';
619
620 // Zip / Town
621 print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
622 print $formcompany->select_ziptown((GETPOSTISSET("zipcode") ? GETPOSTISSET("zipcode") : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
623 print ' ';
624 print $formcompany->select_ziptown((GETPOSTISSET("town") ? GETPOST("town") : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
625 print '</tr>';
626
627 // Country
628 print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
629 print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
630 if ($user->admin) {
631 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
632 }
633 print '</td></tr>';
634
635 print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
636 }
637 // Payment mode
638 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
639 if ($object->mode_reglement_id) {
640 $selected = (string) $object->mode_reglement_id;
641 } else {
642 $selected = '';
643 }
644 $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
645 print "</td></tr>\n";
646
647 // Status
648 print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
649
650 // Project
651 if (isModEnabled('project')) {
652 $formproject = new FormProjets($db);
653
654 $langs->load('projects');
655 print '<tr><td>'.$langs->trans('Project').'</td><td>';
656 $formproject->select_projects(-1, (string) $object->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
657 print '</td></tr>';
658 }
659
660 // Other attributes
661 $parameters = array();
662 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
663 print $hookmanager->resPrint;
664 if (empty($reshook)) {
665 print $object->showOptionals($extrafields, 'edit', $parameters);
666 }
667
668 print "</table>\n";
669
670 print dol_get_fiche_end();
671
672 print $form->buttonsSaveCancel();
673
674 print "</form>\n";
675}
676
677
678
679/* ************************************************************ */
680/* */
681/* Donation card in view mode */
682/* */
683/* ************************************************************ */
684if (!empty($id) && $action != 'edit') {
685 $totalpaid = 0;
686 $formconfirm = "";
687 // Confirmation delete
688 if ($action == 'delete') {
689 $text = $langs->trans("ConfirmDeleteADonation");
690 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1);
691 }
692
693 $result = $object->fetch($id);
694 if ($result < 0) {
695 dol_print_error($db, $object->error);
696 exit;
697 }
698 $result = $object->fetch_optionals();
699 if ($result < 0) {
700 dol_print_error($db);
701 exit;
702 }
703
704 $hselected = 'card';
705
707 print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'donation');
708
709 // Print form confirm
710 print $formconfirm;
711
712 $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
713
714 $morehtmlref = '<div class="refidno">';
715 // Project
716 if (isModEnabled('project') && $formproject !== null) {
717 $langs->load("projects");
718 $morehtmlref .= $langs->trans('Project').' ';
719 if ($user->hasRight('don', 'creer')) {
720 if ($action != 'classify') {
721 $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
722 }
723 if ($action == 'classify') {
724 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
725 $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
726 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
727 $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
728 $morehtmlref .= '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
729 $morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
730 $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
731 $morehtmlref .= '</form>';
732 } else {
733 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
734 }
735 } else {
736 if (!empty($object->fk_project)) {
737 $proj = new Project($db);
738 $proj->fetch($object->fk_project);
739 $morehtmlref .= ' : '.$proj->getNomUrl(1);
740 if ($proj->title) {
741 $morehtmlref .= ' - '.$proj->title;
742 }
743 } else {
744 $morehtmlref .= '';
745 }
746 }
747 }
748 $morehtmlref .= '</div>';
749
750
751 dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
752
753
754 print '<div class="fichecenter">';
755 print '<div class="fichehalfleft">';
756 print '<div class="underbanner clearboth"></div>';
757
758 print '<table class="border tableforfield" width="100%">';
759
760 // Date
761 print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">';
762 print dol_print_date($object->date, "day");
763 print "</td>";
764
765 print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">';
766 print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
767 print '</td></tr>';
768
769 print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
770 print yn($object->public);
771 print '</td></tr>';
772
773 if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
774 $company = new Societe($db);
775
776 print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
777 if ($object->socid > 0) {
778 $result = $company->fetch($object->socid);
779 print $company->getNomUrl(1);
780 }
781 print '</td></tr>';
782 } else {
783 print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
784 print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
785 print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
786 }
787
788 // Payment mode
789 print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
790 $form->form_modes_reglement('', (string) $object->mode_reglement_id, 'none');
791 print "</td></tr>\n";
792
793 // Other attributes
794 $cols = 2;
795 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
796
797 print '</table>';
798
799 print '</div>';
800 print '<div class="fichehalfright">';
801
802 /*
803 * Payments
804 */
805 $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
806 $sql .= " c.code as type_code, c.libelle as paiement_type,";
807 $sql .= " b.fk_account";
808 $sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
809 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
810 $sql .= ", ".MAIN_DB_PREFIX."c_paiement as c ";
811 $sql .= ", ".MAIN_DB_PREFIX."don as d";
812 $sql .= " WHERE d.rowid = ".((int) $id);
813 $sql .= " AND p.fk_donation = d.rowid";
814 $sql .= " AND d.entity IN (".getEntity('donation').")";
815 $sql .= " AND p.fk_typepayment = c.id";
816 $sql .= " ORDER BY dp";
817
818 //print $sql;
819 $resql = $db->query($sql);
820 if ($resql) {
821 $num = $db->num_rows($resql);
822 $i = 0;
823
824 print '<table class="noborder paymenttable centpercent">';
825 print '<tr class="liste_titre">';
826 print '<td>'.$langs->trans("RefPayment").'</td>';
827 print '<td>'.$langs->trans("Date").'</td>';
828 print '<td>'.$langs->trans("Type").'</td>';
829 if (isModEnabled("bank")) {
830 print '<td>'.$langs->trans("BankAccount").'</td>';
831 }
832 print '<td class="right">'.$langs->trans("Amount").'</td>';
833 print '</tr>';
834
835 while ($i < $num) {
836 $objp = $db->fetch_object($resql);
837
838 print '<tr class="oddeven"><td>';
839 print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
840 print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
841 $labeltype = ($langs->trans("PaymentType".$objp->type_code) != "PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
842 print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
843 if (isModEnabled("bank")) {
844 $bankaccountstatic->fetch($objp->fk_account);
845 /*$bankaccountstatic->id = $objp->fk_bank;
846 $bankaccountstatic->ref = $objp->baref;
847 $bankaccountstatic->label = $objp->baref;
848 $bankaccountstatic->number = $objp->banumber;
849 $bankaccountstatic->currency_code = $objp->bacurrency_code;
850
851 if (isModEnabled('accounting')) {
852 $bankaccountstatic->account_number = $objp->account_number;
853
854 $accountingjournal = new AccountingJournal($db);
855 $accountingjournal->fetch($objp->fk_accountancy_journal);
856 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
857 }
858 */
859 print '<td class="nowraponall">';
860 if ($bankaccountstatic->id) {
861 print $bankaccountstatic->getNomUrl(1, 'transactions');
862 }
863 print '</td>';
864 }
865 print '<td class="right">'.price($objp->amount)."</td>\n";
866 print "</tr>";
867 $totalpaid += $objp->amount;
868 $i++;
869 }
870
871 if ($object->paid == 0) {
872 $colspan = 3;
873 if (isModEnabled("bank")) {
874 $colspan++;
875 }
876 print '<tr><td colspan="'.$colspan.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaid)."</td></tr>\n";
877 print '<tr><td colspan="'.$colspan.'" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right">'.price($object->amount)."</td></tr>\n";
878
879 $remaintopay = $object->amount - $totalpaid;
880 $resteapayeraffiche = $remaintopay;
881
882 print '<tr><td colspan="'.$colspan.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
883 print '<td class="right'.(!empty($resteapayeraffiche) ? ' amountremaintopay' : '').'">'.price($resteapayeraffiche)."</td></tr>\n";
884 }
885 print "</table>";
886 $db->free($resql);
887 } else {
888 dol_print_error($db);
889 }
890
891 print '</div>';
892 print '</div>';
893
894 print '<div class="clearboth"></div>';
895
896 print dol_get_fiche_end();
897
898 $remaintopay = price2num($object->amount - $totalpaid, 'MT');
899
900
901 // Actions buttons
902
903 print '<div class="tabsAction">';
904 $parameters = array();
905 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
906 if (empty($reshook)) {
907 // Re-open
908 if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) {
909 print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("ReOpen").'</a>';
910 }
911
912 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>';
913
914 if ($object->status == $object::STATUS_DRAFT) {
915 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>';
916 }
917
918 if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $totalpaid == 0 && $object->paid == 0) {
919 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>";
920 }
921
922 // Create payment
923 if ($object->status == $object::STATUS_VALIDATED && $object->paid == 0 && $user->hasRight('don', 'creer')) {
924 if ($remaintopay == 0) {
925 print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span></div>';
926 } else {
927 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>';
928 }
929 }
930
931 // Classify 'paid'
932 if ($object->status == $object::STATUS_VALIDATED && $remaintopay == 0 && $object->paid == 0 && $user->hasRight('don', 'creer')) {
933 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>";
934 }
935 if ($object->status == $object::STATUS_PAID && $object->paid == 1 && $user->hasRight('don', 'creer')) {
936 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>";
937 }
938
939 // Delete
940 if ($user->hasRight('don', 'supprimer')) {
941 if ($object->status != $object::STATUS_PAID && $remaintopay == $object->amount) {
942 print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>";
943 } else {
944 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DeletionNotPossibleWhenAPaymentExists").'">'.$langs->trans("Delete")."</a></div>";
945 }
946 } else {
947 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
948 }
949 }
950
951 print "</div>";
952
953
954 print '<div class="fichecenter"><div class="fichehalfleft">';
955
956 /*
957 * Generated documents
958 */
959 $filename = dol_sanitizeFileName((string) $object->id);
960 $filedir = $conf->don->dir_output."/".dol_sanitizeFileName((string) $object->id);
961 $urlsource = $_SERVER['PHP_SELF'].'?rowid='.$object->id;
962 $genallowed = (int) (($object->paid == 0 || $user->admin) && $user->hasRight('don', 'lire'));
963 $delallowed = $user->hasRight('don', 'creer');
964
965 print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
966
967 // Show links to link elements
968 $tmparray = $form->showLinkToObjectBlock($object, array(), array('don'), 1);
969 $linktoelem = $tmparray['linktoelem'];
970 $htmltoenteralink = $tmparray['htmltoenteralink'];
971 print $htmltoenteralink;
972
973 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
974
975 // Show online payment link
976 // The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods()
977 include_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
978 $validpaymentmethod = getValidOnlinePaymentMethods('');
979 $useonlinepayment = count($validpaymentmethod);
980
981 if ($useonlinepayment) { //$object->statut != Facture::STATUS_DRAFT &&
982 print '<br><!-- Link to pay -->'."\n";
983 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
984 print showOnlinePaymentUrl('donation', $object->ref).'<br>';
985 }
986
987 print '</div><div class="fichehalfright">';
988
989 print '</div></div>';
990}
991
992llxFooter();
993$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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.
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.
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)
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).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.