dolibarr 21.0.4
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
475// Creation
476if ($action == 'create') {
477 print load_fiche_titre($langs->trans("NewMemberType"), '', 'members');
478
479 print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
480 print '<input type="hidden" name="token" value="'.newToken().'">';
481 print '<input type="hidden" name="action" value="add">';
482 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
483
484 print dol_get_fiche_head(array());
485
486 print '<table class="border centpercent">';
487 print '<tbody>';
488
489 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
490
491 print '<tr><td>'.$langs->trans("Status").'</td><td>';
492 print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
493 print '</td></tr>';
494
495 // Morphy
496 $morphys = array();
497 $morphys[""] = $langs->trans("MorAndPhy");
498 $morphys["phy"] = $langs->trans("Physical");
499 $morphys["mor"] = $langs->trans("Moral");
500 print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
501 print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
502 print "</td></tr>";
503
504 print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
505 print $form->selectyesno("subscription", 1, 1);
506 print '</td></tr>';
507
508 print '<tr><td>'.$langs->trans("Amount").'</td><td>';
509 print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
510 print '</td></tr>';
511
512 print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
513 print $form->selectyesno("caneditamount", GETPOSTISSET('caneditamount') ? GETPOST('caneditamount') : 0, 1);
514 print '</td></tr>';
515
516 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
517 print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
518 print '</td></tr>';
519
520 print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
521 print '<input name="duration_value" size="5" value="'.GETPOST('duraction_unit', 'aZ09').'"> ';
522 print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1);
523 print '</td></tr>';
524
525 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
526 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
527 $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
528 $doleditor->Create();
529
530 print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
531 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
532 $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
533 $doleditor->Create();
534 print '</td></tr>';
535
536 // Other attributes
537 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
538
539 print '<tbody>';
540 print "</table>\n";
541
542 print dol_get_fiche_end();
543
544 print $form->buttonsSaveCancel();
545
546 print "</form>\n";
547}
548
549// View
550if ($rowid > 0) {
551 if ($action != 'edit') {
552 $object = new AdherentType($db);
553 $object->fetch($rowid);
554 $object->fetch_optionals();
555
556 /*
557 * Confirmation deletion
558 */
559 if ($action == 'delete') {
560 print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1);
561 }
562
563 $head = member_type_prepare_head($object);
564
565 print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
566
567 $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
568
569 dol_banner_tab($object, 'rowid', $linkback);
570
571 print '<div class="fichecenter">';
572 print '<div class="underbanner clearboth"></div>';
573
574 print '<table class="tableforfield border centpercent">';
575
576 // Morphy
577 print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
578 print '</tr>';
579
580 print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
581 print yn($object->subscription);
582 print '</tr>';
583
584 // Amount
585 print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
586 print((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
587 print '</tr>';
588
589 print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
590 print yn($object->caneditamount);
591 print '</td></tr>';
592
593 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
594 print yn($object->vote);
595 print '</tr>';
596
597 $durationarray = array();
598 if ($object->duration_value > 1) {
599 $durationarray = array("s" => $langs->trans("Seconds"), "mn" => $langs->trans("Minutes"), "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 } else {
601 $durationarray = array("s" => $langs->trans("Seconds"), "mn" => $langs->trans("Minutes"), "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
604 // Duration
605 print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">';
606 print $object->duration_value > 0 ? $object->duration_value : '';
607 print '&nbsp;';
608 print (!empty($object->duration_unit) && isset($durationarray[$object->duration_unit]) ? $langs->trans($durationarray[$object->duration_unit]) : '');
609 print '</td></tr>';
610
611 // Description
612 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td><div class="longmessagecut">';
614 print "</div></td></tr>";
615
616 // Welcome email content
617 print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td><div class="longmessagecut">';
619 print "</div></td></tr>";
620
621 // Other attributes
622 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
623
624 print '</table>';
625 print '</div>';
626
627 print dol_get_fiche_end();
628
629
630 /*
631 * Buttons
632 */
633
634 print '<div class="tabsAction">';
635
636 // Edit
637 if ($user->hasRight('adherent', 'configurer')) {
638 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>';
639 }
640
641 // Add
642 if ($object->morphy == 'phy') {
643 $morphy = 'phy';
644 } elseif ($object->morphy == 'mor') {
645 $morphy = 'mor';
646 } else {
647 $morphy = '';
648 }
649
650 if ($user->hasRight('adherent', 'configurer') && !empty($object->status)) {
651 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>';
652 } else {
653 print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
654 }
655
656 // Delete
657 if ($user->hasRight('adherent', 'configurer')) {
658 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>';
659 }
660
661 print "</div>";
662
663
664 // Show list of members (nearly same code than in page list.php)
665
666 $membertypestatic = new AdherentType($db);
667
668 $now = dol_now();
669
670 $sql = "SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
671 $sql .= " d.datefin,";
672 $sql .= " d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
673 $sql .= " t.libelle as type, t.subscription, t.amount";
674
675 $sqlfields = $sql; // $sql fields to remove for count total
676
677 $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
678 $sql .= " WHERE d.fk_adherent_type = t.rowid ";
679 $sql .= " AND d.entity IN (".getEntity('adherent').")";
680 $sql .= " AND t.rowid = ".((int) $object->id);
681 if ($sall) {
682 $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);
683 }
684 if ($status != '') {
685 $sql .= natural_search('d.statut', $status, 2);
686 }
687 if ($action == 'search') {
688 if (GETPOST('search', 'alpha')) {
689 $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
690 }
691 }
692 if (!empty($search_ref)) {
693 $sql .= natural_search("d.ref", $search_ref);
694 }
695 if (!empty($search_lastname)) {
696 $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname);
697 }
698 if (!empty($search_login)) {
699 $sql .= natural_search("d.login", $search_login);
700 }
701 if (!empty($search_email)) {
702 $sql .= natural_search("d.email", $search_email);
703 }
704 if ($filter == 'uptodate') {
705 $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
706 }
707 if ($filter == 'outofdate') {
708 $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
709 }
710
711 // Count total nb of records
712 $nbtotalofrecords = '';
713 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
714 /* The fast and low memory method to get and count full list converts the sql into a sql count */
715 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
716 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
717 $resql = $db->query($sqlforcount);
718 if ($resql) {
719 $objforcount = $db->fetch_object($resql);
720 $nbtotalofrecords = $objforcount->nbtotalofrecords;
721 } else {
722 dol_print_error($db);
723 }
724
725 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
726 $page = 0;
727 $offset = 0;
728 }
729 $db->free($resql);
730 }
731
732 // Complete request and execute it with limit
733 $sql .= $db->order($sortfield, $sortorder);
734 if ($limit) {
735 $sql .= $db->plimit($limit + 1, $offset);
736 }
737
738 $resql = $db->query($sql);
739 if ($resql) {
740 $num = $db->num_rows($resql);
741 $i = 0;
742
743 $titre = $langs->trans("MembersList");
744 if ($status != '') {
745 if ($status == '-1,1') {
746 $titre = $langs->trans("MembersListQualified");
747 } elseif ($status == '-1') {
748 $titre = $langs->trans("MembersListToValid");
749 } elseif ($status == '1' && !$filter) {
750 $titre = $langs->trans("MembersListValid");
751 } elseif ($status == '1' && $filter == 'uptodate') {
752 $titre = $langs->trans("MembersListUpToDate");
753 } elseif ($status == '1' && $filter == 'outofdate') {
754 $titre = $langs->trans("MembersListNotUpToDate");
755 } elseif ($status == '0') {
756 $titre = $langs->trans("MembersListResiliated");
757 } elseif ($status == '-2') {
758 $titre = $langs->trans("MembersListExcluded");
759 }
760 } elseif ($action == 'search') {
761 $titre = $langs->trans("MembersListQualified");
762 }
763
764 if ($type > 0) {
765 $membertype = new AdherentType($db);
766 $result = $membertype->fetch($type);
767 $titre .= " (".$membertype->label.")";
768 }
769
770 $param = "&rowid=".urlencode((string) ($object->id));
771 if (!empty($mode)) {
772 $param .= '&mode='.urlencode($mode);
773 }
774 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
775 $param .= '&contextpage='.urlencode($contextpage);
776 }
777 if ($limit > 0 && $limit != $conf->liste_limit) {
778 $param .= '&limit='.((int) $limit);
779 }
780 if (!empty($status)) {
781 $param .= "&status=".urlencode($status);
782 }
783 if (!empty($search_ref)) {
784 $param .= "&search_ref=".urlencode($search_ref);
785 }
786 if (!empty($search_lastname)) {
787 $param .= "&search_lastname=".urlencode($search_lastname);
788 }
789 if (!empty($search_login)) {
790 $param .= "&search_login=".urlencode($search_login);
791 }
792 if (!empty($search_email)) {
793 $param .= "&search_email=".urlencode($search_email);
794 }
795 if (!empty($filter)) {
796 $param .= "&filter=".urlencode($filter);
797 }
798
799 if ($sall) {
800 print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
801 }
802
803 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
804 print '<input type="hidden" name="token" value="'.newToken().'">';
805 print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'"></td>';
806 print '<input class="flat" type="hidden" name="page_y" value=""></td>';
807
808 print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
809
810 $moreforfilter = '';
811
812 print '<div class="div-table-responsive">';
813 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
814
815 // Fields title search
816 print '<tr class="liste_titre_filter">';
817
818 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
819 print '<td class="liste_titre center maxwidthsearch">';
820 $searchpicto = $form->showFilterButtons('left');
821 print $searchpicto;
822 print '</td>';
823 }
824
825 print '<td class="liste_titre left">';
826 print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
827
828 print '<td class="liste_titre left">';
829 print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
830
831 print '<td class="liste_titre left">';
832 print '<input class="flat maxwidth100" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
833
834 print '<td class="liste_titre">&nbsp;</td>';
835
836 print '<td class="liste_titre left">';
837 print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
838
839 print '<td class="liste_titre">&nbsp;</td>';
840
841 print '<td class="liste_titre">&nbsp;</td>';
842
843 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
844 print '<td class="liste_titre center nowraponall">';
845 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")).'">';
846 print '&nbsp; ';
847 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")).'">';
848 print '</td>';
849 }
850
851 print "</tr>\n";
852
853 print '<tr class="liste_titre">';
854 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
855 print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
856 }
857 print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder);
858 print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
859 print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
860 print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
861 print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder);
862 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder);
863 print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder);
864 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
865 print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
866 }
867 print "</tr>\n";
868
869 $adh = new Adherent($db);
870
871 $imaxinloop = ($limit ? min($num, $limit) : $num);
872 while ($i < $imaxinloop) {
873 $objp = $db->fetch_object($resql);
874
875 $datefin = $db->jdate($objp->datefin);
876
877 $adh->id = $objp->rowid;
878 $adh->ref = $objp->ref;
879 $adh->login = $objp->login;
880 $adh->lastname = $objp->lastname;
881 $adh->firstname = $objp->firstname;
882 $adh->datefin = $datefin;
883 $adh->need_subscription = $objp->subscription;
884 $adh->statut = $objp->status;
885 $adh->status = $objp->status;
886 $adh->email = $objp->email;
887 $adh->photo = $objp->photo;
888
889 print '<tr class="oddeven">';
890
891 // Actions
892 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
893 print '<td class="center">';
894 if ($user->hasRight('adherent', 'creer')) {
895 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>';
896 }
897 if ($user->hasRight('adherent', 'supprimer')) {
898 print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
899 }
900 print "</td>";
901 }
902
903 // Ref
904 print "<td>";
905 print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
906 print "</td>\n";
907
908 // Lastname
909 if ($objp->company != '') {
910 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";
911 } else {
912 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";
913 }
914
915 // Login
916 print "<td>".dol_escape_htmltag($objp->login)."</td>\n";
917
918 // Type
919 /*print '<td class="nowrap">';
920 $membertypestatic->id=$objp->type_id;
921 $membertypestatic->label=$objp->type;
922 print $membertypestatic->getNomUrl(1,12);
923 print '</td>';
924 */
925
926 // Moral/Physique
927 print "<td>".$adh->getmorphylib($objp->morphy, 1)."</td>\n";
928
929 // EMail
930 print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
931
932 // Status
933 print '<td class="nowrap">';
934 print $adh->getLibStatut(2);
935 print "</td>";
936
937 // Date end subscription
938 if ($datefin) {
939 print '<td class="nowrap center">';
940 if ($datefin < dol_now() && $objp->status > 0) {
941 print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
942 } else {
943 print dol_print_date($datefin, 'day');
944 }
945 print '</td>';
946 } else {
947 print '<td class="nowrap center">';
948 if (!empty($objp->subscription)) {
949 print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
950 if ($objp->status > 0) {
951 print " ".img_warning();
952 }
953 } else {
954 print '&nbsp;';
955 }
956 print '</td>';
957 }
958
959 // Actions
960 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
961 print '<td class="center">';
962 if ($user->hasRight('adherent', 'creer')) {
963 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>';
964 }
965 if ($user->hasRight('adherent', 'supprimer')) {
966 print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
967 }
968 print "</td>";
969 }
970 print "</tr>\n";
971 $i++;
972 }
973
974 if ($i == 0) {
975 print '<tr><td colspan="9"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
976 }
977
978 print "</table>\n";
979 print '</div>';
980 print '</form>';
981 } else {
982 dol_print_error($db);
983 }
984 }
985
986 /* ************************************************************************** */
987 /* */
988 /* Edition mode */
989 /* */
990 /* ************************************************************************** */
991
992 if ($action == 'edit') {
993 $object = new AdherentType($db);
994 $object->fetch($rowid);
995 $object->fetch_optionals();
996
997 $head = member_type_prepare_head($object);
998
999 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
1000 print '<input type="hidden" name="token" value="'.newToken().'">';
1001 print '<input type="hidden" name="rowid" value="'.$object->id.'">';
1002 print '<input type="hidden" name="action" value="update">';
1003
1004 print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
1005
1006 print '<table class="border centpercent">';
1007
1008 print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
1009
1010 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>';
1011
1012 print '<tr><td>'.$langs->trans("Status").'</td><td>';
1013 print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
1014 print '</td></tr>';
1015
1016 // Morphy
1017 $morphys[""] = $langs->trans("MorAndPhy");
1018 $morphys["phy"] = $langs->trans("Physical");
1019 $morphys["mor"] = $langs->trans("Moral");
1020 print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
1021 print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : $object->morphy);
1022 print "</td></tr>";
1023
1024 print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
1025 print $form->selectyesno("subscription", $object->subscription, 1);
1026 print '</td></tr>';
1027
1028 print '<tr><td>'.$langs->trans("Amount").'</td><td>';
1029 print '<input name="amount" size="5" value="';
1030 print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
1031 print '">';
1032 print '</td></tr>';
1033
1034 print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).'</td><td>';
1035 print $form->selectyesno("caneditamount", $object->caneditamount, 1);
1036 print '</td></tr>';
1037
1038 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
1039 print $form->selectyesno("vote", $object->vote, 1);
1040 print '</td></tr>';
1041
1042 print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
1043 print '<input name="duration_value" size="5" value="'.($object->duration_value > 0 ? $object->duration_value : '').'"> ';
1044 print $formproduct->selectMeasuringUnits("duration_unit", "time", ($object->duration_unit === '' ? 'y' : $object->duration_unit), 0, 1);
1045 print '</td></tr>';
1046
1047 print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
1048 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
1049 $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
1050 $doleditor->Create();
1051 print "</td></tr>";
1052
1053 print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
1054 $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
1055 $doleditor->Create();
1056 print "</td></tr>";
1057
1058 // Other attributes
1059 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
1060
1061 print '</table>';
1062
1063 print dol_get_fiche_end();
1064
1065 print $form->buttonsSaveCancel();
1066
1067 print "</form>";
1068 }
1069}
1070
1071// End of page
1072llxFooter();
1073$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.
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_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.
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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.