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