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