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