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