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