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