dolibarr 21.0.0-beta
type.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
7 * Copyright (C) 2015-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
8 * Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
9 * Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
10 * Copyright (C) 2021 Waël Almoman <info@almoman.com>
11 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
12 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <https://www.gnu.org/licenses/>.
26 */
27
34// Load Dolibarr environment
35require '../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
38require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
40require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
41
50// Load translation files required by the page
51$langs->load("members");
52
53$rowid = GETPOSTINT('rowid');
54$action = GETPOST('action', 'aZ09');
55$massaction = GETPOST('massaction', 'alpha');
56$cancel = GETPOST('cancel', 'alpha');
57$toselect = GETPOST('toselect', 'array');
58$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
59$backtopage = GETPOST('backtopage', 'alpha');
60$mode = GETPOST('mode', 'alpha');
61
62$sall = GETPOST("sall", "alpha");
63$filter = GETPOST("filter", 'alpha');
64$search_ref = GETPOST('search_ref', 'alpha');
65$search_lastname = GETPOST('search_lastname', 'alpha');
66$search_login = GETPOST('search_login', 'alpha');
67$search_email = GETPOST('search_email', 'alpha');
68$type = GETPOST('type', 'intcomma');
69$status = GETPOST('status', 'alpha');
70$optioncss = GETPOST('optioncss', 'alpha');
71
72// Load variable for pagination
73$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
74$sortfield = GETPOST('sortfield', 'aZ09comma');
75$sortorder = GETPOST('sortorder', 'aZ09comma');
76$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
77if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
78 // If $page is not defined, or '' or -1 or if we click on clear filters
79 $page = 0;
80}
81$offset = $limit * $page;
82$pageprev = $page - 1;
83$pagenext = $page + 1;
84if (!$sortorder) {
85 $sortorder = "DESC";
86}
87if (!$sortfield) {
88 $sortfield = "d.lastname";
89}
90
91$label = GETPOST("label", "alpha");
92$morphy = GETPOST("morphy", "alpha");
93$status = GETPOST("status", "intcomma");
94$subscription = GETPOSTINT("subscription");
95$amount = GETPOST('amount', 'alpha');
96$duration_value = GETPOSTINT('duration_value');
97$duration_unit = GETPOST('duration_unit', 'alpha');
98$vote = GETPOSTINT("vote");
99$comment = GETPOST("comment", 'restricthtml');
100$mail_valid = GETPOST("mail_valid", 'restricthtml');
101$caneditamount = GETPOSTINT("caneditamount");
102
103// Initialize a technical object
104$object = new AdherentType($db);
105$extrafields = new ExtraFields($db);
106$hookmanager->initHooks(array('membertypecard', 'globalcard'));
107
108// Fetch optionals attributes and labels
109$extrafields->fetch_name_optionals_label($object->table_element);
110
111
112// Definition of array of fields for columns
113$tableprefix = 't';
114$arrayfields = array();
115foreach ($object->fields as $key => $val) {
116 // If $val['visible']==0, then we never show the field
117 if (!empty($val['visible'])) {
118 $visible = (int) dol_eval((string) $val['visible'], 1);
119 $arrayfields[$tableprefix.'.'.$key] = array(
120 'label' => $val['label'],
121 'checked' => (($visible < 0) ? 0 : 1),
122 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
123 'position' => $val['position'],
124 'help' => isset($val['help']) ? $val['help'] : ''
125 );
126 }
127}
128
129
130// Security check
131$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
132
133
134/*
135 * Actions
136 */
137$error = 0;
138
139if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
140 $search_ref = "";
141 $search_lastname = "";
142 $search_login = "";
143 $search_email = "";
144 $type = "";
145 $sall = "";
146}
147
148if (GETPOST('cancel', 'alpha')) {
149 $action = 'list';
150 $massaction = '';
151}
152if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
153 $massaction = '';
154}
155
156if ($cancel) {
157 $action = '';
158
159 if (!empty($backtopage)) {
160 header("Location: ".$backtopage);
161 exit;
162 }
163}
164
165if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
166 $object->label = trim($label);
167 $object->morphy = trim($morphy);
168 $object->status = (int) $status;
169 $object->subscription = (int) $subscription;
170 $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
171 $object->caneditamount = $caneditamount;
172 $object->duration_value = $duration_value;
173 $object->duration_unit = $duration_unit;
174 $object->note_public = trim($comment);
175 $object->note_private = '';
176 $object->mail_valid = trim($mail_valid);
177 $object->vote = $vote; // $vote is already int
178
179 // Fill array 'array_options' with data from add form
180 $ret = $extrafields->setOptionalsFromPost(null, $object);
181 if ($ret < 0) {
182 $error++;
183 }
184
185 if (empty($object->label)) {
186 $error++;
187 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
188 } else {
189 $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle = '".$db->escape($object->label)."'";
190 $sql .= " WHERE entity IN (".getEntity('member_type').")";
191 $result = $db->query($sql);
192 $num = null;
193 if ($result) {
194 $num = $db->num_rows($result);
195 }
196 if ($num) {
197 $error++;
198 $langs->load("errors");
199 setEventMessages($langs->trans("ErrorLabelAlreadyExists", $object->label), null, 'errors');
200 }
201 }
202
203 if (!$error) {
204 $id = $object->create($user);
205 if ($id > 0) {
206 $backurlforlist = $_SERVER["PHP_SELF"];
207
208 $urltogo = $backtopage ? str_replace('__ID__', (string) $id, $backtopage) : $backurlforlist;
209 $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect field created after a New on another form object creation
210
211 header("Location: " . $urltogo);
212 exit;
213 } else {
214 setEventMessages($object->error, $object->errors, 'errors');
215 $action = 'create';
216 }
217 } else {
218 $action = 'create';
219 }
220}
221
222if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
223 $object->fetch($rowid);
224
225 $object->oldcopy = dol_clone($object, 2);
226
227 $object->label = trim($label);
228 $object->morphy = trim($morphy);
229 $object->status = (int) $status;
230 $object->subscription = (int) $subscription;
231 $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
232 $object->caneditamount = $caneditamount;
233 $object->duration_value = $duration_value;
234 $object->duration_unit = $duration_unit;
235 $object->note_public = trim($comment);
236 $object->note_private = '';
237 $object->mail_valid = trim($mail_valid);
238 $object->vote = $vote; // $vote is already int.
239
240 // Fill array 'array_options' with data from add form
241 $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
242 if ($ret < 0) {
243 $error++;
244 }
245
246 $ret = $object->update($user);
247
248 if ($ret >= 0 && !count($object->errors)) {
249 setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs');
250 } else {
251 setEventMessages($object->error, $object->errors, 'errors');
252 }
253
254 header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$object->id);
255 exit;
256}
257
258if ($action == 'confirm_delete' && $user->hasRight('adherent', 'configurer')) {
259 $object->fetch($rowid);
260 $res = $object->delete($user);
261
262 if ($res > 0) {
263 setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs');
264 header("Location: ".$_SERVER["PHP_SELF"]);
265 exit;
266 } else {
267 setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors');
268 $action = '';
269 }
270}
271
272
273/*
274 * View
275 */
276
277$form = new Form($db);
278$formproduct = new FormProduct($db);
279
280$title = $langs->trans("MembersTypeSetup");
281$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
282
283llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-type');
284
285$arrayofselected = is_array($toselect) ? $toselect : array();
286
287// List of members type
288if (!$rowid && $action != 'create' && $action != 'edit') {
289 //print dol_get_fiche_head([]);
290
291 $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy, d.duration";
292 $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
293 $sql .= " WHERE d.entity IN (".getEntity('member_type').")";
294
295 $result = $db->query($sql);
296 if ($result) {
297 $num = $db->num_rows($result);
298 $nbtotalofrecords = $num;
299
300 $i = 0;
301
302 $param = '';
303 if (!empty($mode)) {
304 $param .= '&mode='.urlencode($mode);
305 }
306 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
307 $param .= '&contextpage='.$contextpage;
308 }
309 if ($limit > 0 && $limit != $conf->liste_limit) {
310 $param .= '&limit='.$limit;
311 }
312
313 $newcardbutton = '';
314
315 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
316 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
317
318 if ($user->hasRight('adherent', 'configurer')) {
319 $newcardbutton .= dolGetButtonTitleSeparator();
320 $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
321 }
322
323 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
324 if ($optioncss != '') {
325 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
326 }
327 print '<input type="hidden" name="token" value="'.newToken().'">';
328 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
329 print '<input type="hidden" name="action" value="list">';
330 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
331 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
332 print '<input type="hidden" name="mode" value="'.$mode.'">';
333
334
335 print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
336
337 $moreforfilter = '';
338
339 print '<div class="div-table-responsive">';
340 print '<table class="tagtable noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
341
342 print '<tr class="liste_titre">';
343 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
344 print '<th>&nbsp;</th>';
345 }
346 print '<th>'.$langs->trans("Ref").'</th>';
347 print '<th>'.$langs->trans("Label").'</th>';
348 print '<th class="center">'.$langs->trans("MembersNature").'</th>';
349 print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
350 print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
351 print '<th class="center">'.$langs->trans("Amount").'</th>';
352 print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
353 print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
354 print '<th class="center">'.$langs->trans("Status").'</th>';
355 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
356 print '<th>&nbsp;</th>';
357 }
358 print "</tr>\n";
359
360 $membertype = new AdherentType($db);
361
362 $i = 0;
363 $savnbfield = 10;
364 /*$savnbfield = $totalarray['nbfield'];
365 $totalarray = array();
366 $totalarray['nbfield'] = 0;*/
367
368 $imaxinloop = ($limit ? min($num, $limit) : $num);
369 while ($i < $imaxinloop) {
370 $objp = $db->fetch_object($result);
371
372 $membertype->id = $objp->rowid;
373 $membertype->ref = $objp->rowid;
374 $membertype->label = $objp->rowid;
375 $membertype->status = $objp->status;
376 $membertype->subscription = $objp->subscription;
377 $membertype->amount = $objp->amount;
378 $membertype->caneditamount = $objp->caneditamount;
379
380 if ($mode == 'kanban') {
381 if ($i == 0) {
382 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
383 print '<div class="box-flex-container kanban">';
384 }
385 //output kanban
386 $membertype->label = $objp->label;
387 print $membertype->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
388 if ($i == ($imaxinloop - 1)) {
389 print '</div>';
390 print '</td></tr>';
391 }
392 } else {
393 print '<tr class="oddeven">';
394
395 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
396 if ($user->hasRight('adherent', 'configurer')) {
397 print '<td class="center"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
398 }
399 }
400
401 print '<td class="nowraponall">';
402 print $membertype->getNomUrl(1);
403 //<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
404 print '</td>';
405
406 print '<td>'.dol_escape_htmltag($objp->label).'</td>';
407
408 print '<td class="center">';
409 if ($objp->morphy == 'phy') {
410 print $langs->trans("Physical");
411 } elseif ($objp->morphy == 'mor') {
412 print $langs->trans("Moral");
413 } else {
414 print $langs->trans("MorAndPhy");
415 }
416 print '</td>';
417
418 print '<td class="center nowrap">';
419 if ($objp->duration) {
420 $duration_value = intval($objp->duration);
421 if ($duration_value > 1) {
422 $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years"));
423 } else {
424 $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year"));
425 }
426 $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);
427 print max(1, $duration_value).' '.$dur[$unit];
428 }
429 print '</td>';
430
431 print '<td class="center">'.yn($objp->subscription).'</td>';
432
433 print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
434
435 print '<td class="center">'.yn($objp->caneditamount).'</td>';
436
437 print '<td class="center">'.yn($objp->vote).'</td>';
438
439 print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
440
441 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
442 if ($user->hasRight('adherent', 'configurer')) {
443 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
444 }
445 }
446 print "</tr>";
447 }
448 $i++;
449 }
450
451 // Show total line
452 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
453
454 // If no record found
455 if ($num == 0) {
456 $colspan = 1;
457 foreach ($arrayfields as $key => $val) {
458 //if (!empty($val['checked'])) {
459 $colspan++;
460 //}
461 }
462 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
463 }
464
465 print "</table>";
466 print '</div>';
467
468 print '</form>';
469 } else {
470 dol_print_error($db);
471 }
472}
473
474// Creation
475if ($action == 'create') {
476 print load_fiche_titre($langs->trans("NewMemberType"), '', 'members');
477
478 print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
479 print '<input type="hidden" name="token" value="'.newToken().'">';
480 print '<input type="hidden" name="action" value="add">';
481 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
482
483 print dol_get_fiche_head(array());
484
485 print '<table class="border centpercent">';
486 print '<tbody>';
487
488 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
489
490 print '<tr><td>'.$langs->trans("Status").'</td><td>';
491 print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
492 print '</td></tr>';
493
494 // Morphy
495 $morphys = array();
496 $morphys[""] = $langs->trans("MorAndPhy");
497 $morphys["phy"] = $langs->trans("Physical");
498 $morphys["mor"] = $langs->trans("Moral");
499 print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
500 print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
501 print "</td></tr>";
502
503 print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
504 print $form->selectyesno("subscription", 1, 1);
505 print '</td></tr>';
506
507 print '<tr><td>'.$langs->trans("Amount").'</td><td>';
508 print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
509 print '</td></tr>';
510
511 print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
512 print $form->selectyesno("caneditamount", GETPOSTISSET('caneditamount') ? GETPOST('caneditamount') : 0, 1);
513 print '</td></tr>';
514
515 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
516 print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
517 print '</td></tr>';
518
519 print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
520 print '<input name="duration_value" size="5" value="'.GETPOST('duraction_unit', 'aZ09').'"> ';
521 print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1);
522 print '</td></tr>';
523
524 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
525 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
526 $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
527 $doleditor->Create();
528
529 print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
530 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
531 $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
532 $doleditor->Create();
533 print '</td></tr>';
534
535 // Other attributes
536 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
537
538 print '<tbody>';
539 print "</table>\n";
540
541 print dol_get_fiche_end();
542
543 print $form->buttonsSaveCancel();
544
545 print "</form>\n";
546}
547
548// View
549if ($rowid > 0) {
550 if ($action != 'edit') {
551 $object = new AdherentType($db);
552 $object->fetch($rowid);
553 $object->fetch_optionals();
554
555 /*
556 * Confirmation deletion
557 */
558 if ($action == 'delete') {
559 print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1);
560 }
561
562 $head = member_type_prepare_head($object);
563
564 print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
565
566 $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
567
568 dol_banner_tab($object, 'rowid', $linkback);
569
570 print '<div class="fichecenter">';
571 print '<div class="underbanner clearboth"></div>';
572
573 print '<table class="tableforfield border centpercent">';
574
575 // Morphy
576 print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
577 print '</tr>';
578
579 print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
580 print yn($object->subscription);
581 print '</tr>';
582
583 // Amount
584 print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
585 print((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
586 print '</tr>';
587
588 print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
589 print yn($object->caneditamount);
590 print '</td></tr>';
591
592 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
593 print yn($object->vote);
594 print '</tr>';
595
596 // Duration
597 print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
598 if ($object->duration_value > 1) {
599 $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years"));
600 } elseif ($object->duration_value > 0) {
601 $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year"));
602 }
603 print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
604 print '</td></tr>';
605
606 // Description
607 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td><div class="longmessagecut">';
609 print "</div></td></tr>";
610
611 // Welcome email content
612 print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td><div class="longmessagecut">';
614 print "</div></td></tr>";
615
616 // Other attributes
617 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
618
619 print '</table>';
620 print '</div>';
621
622 print dol_get_fiche_end();
623
624
625 /*
626 * Buttons
627 */
628
629 print '<div class="tabsAction">';
630
631 // Edit
632 if ($user->hasRight('adherent', 'configurer')) {
633 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>';
634 }
635
636 // Add
637 if ($object->morphy == 'phy') {
638 $morphy = 'phy';
639 } elseif ($object->morphy == 'mor') {
640 $morphy = 'mor';
641 } else {
642 $morphy = '';
643 }
644
645 if ($user->hasRight('adherent', 'configurer') && !empty($object->status)) {
646 print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.($morphy ? '&morphy='.urlencode($morphy) : '').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
647 } else {
648 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
649 }
650
651 // Delete
652 if ($user->hasRight('adherent', 'configurer')) {
653 print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
654 }
655
656 print "</div>";
657
658
659 // Show list of members (nearly same code than in page list.php)
660
661 $membertypestatic = new AdherentType($db);
662
663 $now = dol_now();
664
665 $sql = "SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
666 $sql .= " d.datefin,";
667 $sql .= " d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
668 $sql .= " t.libelle as type, t.subscription, t.amount";
669
670 $sqlfields = $sql; // $sql fields to remove for count total
671
672 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
673 $sql .= " WHERE d.fk_adherent_type = t.rowid ";
674 $sql .= " AND d.entity IN (".getEntity('adherent').")";
675 $sql .= " AND t.rowid = ".((int) $object->id);
676 if ($sall) {
677 $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
678 }
679 if ($status != '') {
680 $sql .= natural_search('d.statut', $status, 2);
681 }
682 if ($action == 'search') {
683 if (GETPOST('search', 'alpha')) {
684 $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
685 }
686 }
687 if (!empty($search_ref)) {
688 $sql .= natural_search("d.ref", $search_ref);
689 }
690 if (!empty($search_lastname)) {
691 $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname);
692 }
693 if (!empty($search_login)) {
694 $sql .= natural_search("d.login", $search_login);
695 }
696 if (!empty($search_email)) {
697 $sql .= natural_search("d.email", $search_email);
698 }
699 if ($filter == 'uptodate') {
700 $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
701 }
702 if ($filter == 'outofdate') {
703 $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
704 }
705
706 // Count total nb of records
707 $nbtotalofrecords = '';
708 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
709 /* The fast and low memory method to get and count full list converts the sql into a sql count */
710 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
711 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
712 $resql = $db->query($sqlforcount);
713 if ($resql) {
714 $objforcount = $db->fetch_object($resql);
715 $nbtotalofrecords = $objforcount->nbtotalofrecords;
716 } else {
717 dol_print_error($db);
718 }
719
720 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
721 $page = 0;
722 $offset = 0;
723 }
724 $db->free($resql);
725 }
726
727 // Complete request and execute it with limit
728 $sql .= $db->order($sortfield, $sortorder);
729 if ($limit) {
730 $sql .= $db->plimit($limit + 1, $offset);
731 }
732
733 $resql = $db->query($sql);
734 if ($resql) {
735 $num = $db->num_rows($resql);
736 $i = 0;
737
738 $titre = $langs->trans("MembersList");
739 if ($status != '') {
740 if ($status == '-1,1') {
741 $titre = $langs->trans("MembersListQualified");
742 } elseif ($status == '-1') {
743 $titre = $langs->trans("MembersListToValid");
744 } elseif ($status == '1' && !$filter) {
745 $titre = $langs->trans("MembersListValid");
746 } elseif ($status == '1' && $filter == 'uptodate') {
747 $titre = $langs->trans("MembersListUpToDate");
748 } elseif ($status == '1' && $filter == 'outofdate') {
749 $titre = $langs->trans("MembersListNotUpToDate");
750 } elseif ($status == '0') {
751 $titre = $langs->trans("MembersListResiliated");
752 } elseif ($status == '-2') {
753 $titre = $langs->trans("MembersListExcluded");
754 }
755 } elseif ($action == 'search') {
756 $titre = $langs->trans("MembersListQualified");
757 }
758
759 if ($type > 0) {
760 $membertype = new AdherentType($db);
761 $result = $membertype->fetch($type);
762 $titre .= " (".$membertype->label.")";
763 }
764
765 $param = "&rowid=".urlencode((string) ($object->id));
766 if (!empty($mode)) {
767 $param .= '&mode='.urlencode($mode);
768 }
769 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
770 $param .= '&contextpage='.urlencode($contextpage);
771 }
772 if ($limit > 0 && $limit != $conf->liste_limit) {
773 $param .= '&limit='.((int) $limit);
774 }
775 if (!empty($status)) {
776 $param .= "&status=".urlencode($status);
777 }
778 if (!empty($search_ref)) {
779 $param .= "&search_ref=".urlencode($search_ref);
780 }
781 if (!empty($search_lastname)) {
782 $param .= "&search_lastname=".urlencode($search_lastname);
783 }
784 if (!empty($search_login)) {
785 $param .= "&search_login=".urlencode($search_login);
786 }
787 if (!empty($search_email)) {
788 $param .= "&search_email=".urlencode($search_email);
789 }
790 if (!empty($filter)) {
791 $param .= "&filter=".urlencode($filter);
792 }
793
794 if ($sall) {
795 print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
796 }
797
798 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
799 print '<input type="hidden" name="token" value="'.newToken().'">';
800 print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'"></td>';
801 print '<input class="flat" type="hidden" name="page_y" value=""></td>';
802
803 print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
804
805 $moreforfilter = '';
806
807 print '<div class="div-table-responsive">';
808 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
809
810 // Fields title search
811 print '<tr class="liste_titre_filter">';
812
813 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
814 print '<td class="liste_titre center maxwidthsearch">';
815 $searchpicto = $form->showFilterButtons('left');
816 print $searchpicto;
817 print '</td>';
818 }
819
820 print '<td class="liste_titre left">';
821 print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
822
823 print '<td class="liste_titre left">';
824 print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
825
826 print '<td class="liste_titre left">';
827 print '<input class="flat maxwidth100" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
828
829 print '<td class="liste_titre">&nbsp;</td>';
830
831 print '<td class="liste_titre left">';
832 print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
833
834 print '<td class="liste_titre">&nbsp;</td>';
835
836 print '<td class="liste_titre">&nbsp;</td>';
837
838 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
839 print '<td class="liste_titre center nowraponall">';
840 print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
841 print '&nbsp; ';
842 print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
843 print '</td>';
844 }
845
846 print "</tr>\n";
847
848 print '<tr class="liste_titre">';
849 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
850 print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
851 }
852 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder);
853 print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
854 print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
855 print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
856 print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder);
857 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder);
858 print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder);
859 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
860 print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
861 }
862 print "</tr>\n";
863
864 $adh = new Adherent($db);
865
866 $imaxinloop = ($limit ? min($num, $limit) : $num);
867 while ($i < $imaxinloop) {
868 $objp = $db->fetch_object($resql);
869
870 $datefin = $db->jdate($objp->datefin);
871
872 $adh->id = $objp->rowid;
873 $adh->ref = $objp->ref;
874 $adh->login = $objp->login;
875 $adh->lastname = $objp->lastname;
876 $adh->firstname = $objp->firstname;
877 $adh->datefin = $datefin;
878 $adh->need_subscription = $objp->subscription;
879 $adh->statut = $objp->status;
880 $adh->status = $objp->status;
881 $adh->email = $objp->email;
882 $adh->photo = $objp->photo;
883
884 print '<tr class="oddeven">';
885
886 // Actions
887 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
888 print '<td class="center">';
889 if ($user->hasRight('adherent', 'creer')) {
890 print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
891 }
892 if ($user->hasRight('adherent', 'supprimer')) {
893 print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
894 }
895 print "</td>";
896 }
897
898 // Ref
899 print "<td>";
900 print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
901 print "</td>\n";
902
903 // Lastname
904 if ($objp->company != '') {
905 print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
906 } else {
907 print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n";
908 }
909
910 // Login
911 print "<td>".dol_escape_htmltag($objp->login)."</td>\n";
912
913 // Type
914 /*print '<td class="nowrap">';
915 $membertypestatic->id=$objp->type_id;
916 $membertypestatic->label=$objp->type;
917 print $membertypestatic->getNomUrl(1,12);
918 print '</td>';
919 */
920
921 // Moral/Physique
922 print "<td>".$adh->getmorphylib($objp->morphy, 1)."</td>\n";
923
924 // EMail
925 print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
926
927 // Status
928 print '<td class="nowrap">';
929 print $adh->getLibStatut(2);
930 print "</td>";
931
932 // Date end subscription
933 if ($datefin) {
934 print '<td class="nowrap center">';
935 if ($datefin < dol_now() && $objp->status > 0) {
936 print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
937 } else {
938 print dol_print_date($datefin, 'day');
939 }
940 print '</td>';
941 } else {
942 print '<td class="nowrap center">';
943 if (!empty($objp->subscription)) {
944 print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
945 if ($objp->status > 0) {
946 print " ".img_warning();
947 }
948 } else {
949 print '&nbsp;';
950 }
951 print '</td>';
952 }
953
954 // Actions
955 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
956 print '<td class="center">';
957 if ($user->hasRight('adherent', 'creer')) {
958 print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
959 }
960 if ($user->hasRight('adherent', 'supprimer')) {
961 print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
962 }
963 print "</td>";
964 }
965 print "</tr>\n";
966 $i++;
967 }
968
969 if ($i == 0) {
970 print '<tr><td colspan="9"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
971 }
972
973 print "</table>\n";
974 print '</div>';
975 print '</form>';
976 } else {
977 dol_print_error($db);
978 }
979 }
980
981 /* ************************************************************************** */
982 /* */
983 /* Edition mode */
984 /* */
985 /* ************************************************************************** */
986
987 if ($action == 'edit') {
988 $object = new AdherentType($db);
989 $object->fetch($rowid);
990 $object->fetch_optionals();
991
992 $head = member_type_prepare_head($object);
993
994 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
995 print '<input type="hidden" name="token" value="'.newToken().'">';
996 print '<input type="hidden" name="rowid" value="'.$object->id.'">';
997 print '<input type="hidden" name="action" value="update">';
998
999 print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
1000
1001 print '<table class="border centpercent">';
1002
1003 print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
1004
1005 print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
1006
1007 print '<tr><td>'.$langs->trans("Status").'</td><td>';
1008 print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
1009 print '</td></tr>';
1010
1011 // Morphy
1012 $morphys[""] = $langs->trans("MorAndPhy");
1013 $morphys["phy"] = $langs->trans("Physical");
1014 $morphys["mor"] = $langs->trans("Moral");
1015 print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
1016 print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : $object->morphy);
1017 print "</td></tr>";
1018
1019 print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
1020 print $form->selectyesno("subscription", $object->subscription, 1);
1021 print '</td></tr>';
1022
1023 print '<tr><td>'.$langs->trans("Amount").'</td><td>';
1024 print '<input name="amount" size="5" value="';
1025 print((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
1026 print '">';
1027 print '</td></tr>';
1028
1029 print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).'</td><td>';
1030 print $form->selectyesno("caneditamount", $object->caneditamount, 1);
1031 print '</td></tr>';
1032
1033 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
1034 print $form->selectyesno("vote", $object->vote, 1);
1035 print '</td></tr>';
1036
1037 print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
1038 print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
1039 print $formproduct->selectMeasuringUnits("duration_unit", "time", ($object->duration_unit === '' ? 'y' : $object->duration_unit), 0, 1);
1040 print '</td></tr>';
1041
1042 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
1043 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
1044 $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
1045 $doleditor->Create();
1046 print "</td></tr>";
1047
1048 print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
1049 $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
1050 $doleditor->Create();
1051 print "</td></tr>";
1052
1053 // Other attributes
1054 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
1055
1056 print '</table>';
1057
1058 print dol_get_fiche_end();
1059
1060 print $form->buttonsSaveCancel();
1061
1062 print "</form>";
1063 }
1064}
1065
1066// End of page
1067llxFooter();
1068$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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:71
Class to manage members of a foundation.
Class to manage members type.
Class to manage a WYSIWYG editor.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class with static methods for building HTML components related to products Only components common to ...
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
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 '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
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'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array(), $allowlink=0, $allowscript=0, $allowstyle=0, $allowphp=0)
Clean a string to keep only desirable HTML tags.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
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...
member_type_prepare_head(AdherentType $object)
Return array head with list of tabs to view object information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.