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