dolibarr  19.0.0-dev
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
33 require '../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
38 require_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', 'alopha');
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');
67 if (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;
74 if (!$sortorder) {
75  $sortorder = "DESC";
76 }
77 if (!$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 
109 if (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 
118 if (GETPOST('cancel', 'alpha')) {
119  $action = 'list';
120  $massaction = '';
121 }
122 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
123  $massaction = '';
124 }
125 
126 if ($cancel) {
127  $action = '';
128 
129  if (!empty($backtopage)) {
130  header("Location: ".$backtopage);
131  exit;
132  }
133 }
134 
135 if ($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 
187 if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
188  $object->fetch($rowid);
189 
190  $object->oldcopy = dol_clone($object);
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 = (boolean) 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 
223 if ($action == 'confirm_delete' && $user->hasRight('adherent', 'configurer')) {
224  $object->fetch($rowid);
225  $res = $object->delete();
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 
247 llxHeader('', $langs->trans("MembersTypeSetup"), $help_url);
248 
249 $arrayofselected = is_array($toselect) ? $toselect : array();
250 
251 // List of members type
252 if (!$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";
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 .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
284  }
285 
286  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
287  if ($optioncss != '') {
288  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
289  }
290  print '<input type="hidden" name="token" value="'.newToken().'">';
291  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
292  print '<input type="hidden" name="action" value="list">';
293  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
294  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
295  print '<input type="hidden" name="mode" value="'.$mode.'">';
296 
297 
298  print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
299 
300  $moreforfilter = '';
301 
302  print '<div class="div-table-responsive">';
303  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
304 
305  print '<tr class="liste_titre">';
306  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
307  print '<th>&nbsp;</th>';
308  }
309  print '<th>'.$langs->trans("Ref").'</th>';
310  print '<th>'.$langs->trans("Label").'</th>';
311  print '<th class="center">'.$langs->trans("MembersNature").'</th>';
312  print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
313  print '<th class="center">'.$langs->trans("Amount").'</th>';
314  print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
315  print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
316  print '<th class="center">'.$langs->trans("Status").'</th>';
317  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
318  print '<th>&nbsp;</th>';
319  }
320  print "</tr>\n";
321 
322  $membertype = new AdherentType($db);
323 
324  $i = 0;
325  $savnbfield = 9;
326  /*$savnbfield = $totalarray['nbfield'];
327  $totalarray = array();
328  $totalarray['nbfield'] = 0;*/
329 
330  $imaxinloop = ($limit ? min($num, $limit) : $num);
331  while ($i < $imaxinloop) {
332  $objp = $db->fetch_object($result);
333 
334  $membertype->id = $objp->rowid;
335  $membertype->ref = $objp->rowid;
336  $membertype->label = $objp->rowid;
337  $membertype->status = $objp->status;
338  $membertype->subscription = $objp->subscription;
339  $membertype->amount = $objp->amount;
340  $membertype->caneditamount = $objp->caneditamount;
341 
342  if ($mode == 'kanban') {
343  if ($i == 0) {
344  print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
345  print '<div class="box-flex-container kanban">';
346  }
347  //output kanban
348  $membertype->label = $objp->label;
349  print $membertype->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
350  if ($i == ($imaxinloop - 1)) {
351  print '</div>';
352  print '</td></tr>';
353  }
354  } else {
355  print '<tr class="oddeven">';
356  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
357  if ($user->hasRight('adherent', 'configurer')) {
358  print '<td class="center"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
359  }
360  }
361  print '<td class="nowraponall">';
362  print $membertype->getNomUrl(1);
363  //<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
364  print '</td>';
365  print '<td>'.dol_escape_htmltag($objp->label).'</td>';
366  print '<td class="center">';
367  if ($objp->morphy == 'phy') {
368  print $langs->trans("Physical");
369  } elseif ($objp->morphy == 'mor') {
370  print $langs->trans("Moral");
371  } else {
372  print $langs->trans("MorAndPhy");
373  }
374  print '</td>';
375  print '<td class="center">'.yn($objp->subscription).'</td>';
376  print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
377  print '<td class="center">'.yn($objp->caneditamount).'</td>';
378  print '<td class="center">'.yn($objp->vote).'</td>';
379  print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
380  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
381  if ($user->hasRight('adherent', 'configurer')) {
382  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
383  }
384  }
385  print "</tr>";
386  }
387  $i++;
388  }
389 
390  // If no record found
391  if ($num == 0) {
392  /*$colspan = 1;
393  foreach ($arrayfields as $key => $val) {
394  if (!empty($val['checked'])) {
395  $colspan++;
396  }
397  }*/
398  $colspan = 9;
399  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
400  }
401 
402  print "</table>";
403  print '</div>';
404 
405  print '</form>';
406  } else {
407  dol_print_error($db);
408  }
409 }
410 
411 // Creation
412 if ($action == 'create') {
413  $object = new AdherentType($db);
414 
415  print load_fiche_titre($langs->trans("NewMemberType"), '', 'members');
416 
417  print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
418  print '<input type="hidden" name="token" value="'.newToken().'">';
419  print '<input type="hidden" name="action" value="add">';
420 
421  print dol_get_fiche_head('');
422 
423  print '<table class="border centpercent">';
424  print '<tbody>';
425 
426  print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
427 
428  print '<tr><td>'.$langs->trans("Status").'</td><td>';
429  print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
430  print '</td></tr>';
431 
432  // Morphy
433  $morphys = array();
434  $morphys[""] = $langs->trans("MorAndPhy");
435  $morphys["phy"] = $langs->trans("Physical");
436  $morphys["mor"] = $langs->trans("Moral");
437  print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
438  print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
439  print "</td></tr>";
440 
441  print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
442  print $form->selectyesno("subscription", 1, 1);
443  print '</td></tr>';
444 
445  print '<tr><td>'.$langs->trans("Amount").'</td><td>';
446  print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
447  print '</td></tr>';
448 
449  print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
450  print $form->selectyesno("caneditamount", GETPOSTISSET('caneditamount') ? GETPOST('caneditamount') : 0, 1);
451  print '</td></tr>';
452 
453  print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
454  print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
455  print '</td></tr>';
456 
457  print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
458  print '<input name="duration_value" size="5" value="'.GETPOST('duraction_unit', 'aZ09').'"> ';
459  print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1);
460  print '</td></tr>';
461 
462  print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
463  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
464  $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
465  $doleditor->Create();
466 
467  print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
468  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
469  $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
470  $doleditor->Create();
471  print '</td></tr>';
472 
473  // Other attributes
474  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
475 
476  print '<tbody>';
477  print "</table>\n";
478 
479  print dol_get_fiche_end();
480 
481  print $form->buttonsSaveCancel();
482 
483  print "</form>\n";
484 }
485 
486 // View
487 if ($rowid > 0) {
488  if ($action != 'edit') {
489  $object = new AdherentType($db);
490  $object->fetch($rowid);
491  $object->fetch_optionals();
492 
493  /*
494  * Confirmation deletion
495  */
496  if ($action == 'delete') {
497  print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1);
498  }
499 
500  $head = member_type_prepare_head($object);
501 
502  print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
503 
504  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
505 
506  dol_banner_tab($object, 'rowid', $linkback);
507 
508  print '<div class="fichecenter">';
509  print '<div class="underbanner clearboth"></div>';
510 
511  print '<table class="tableforfield border centpercent">';
512 
513  // Morphy
514  print '<tr><td>'.$langs->trans("MembersNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
515  print '</tr>';
516 
517  print '<tr><td>'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).'</td><td>';
518  print yn($object->subscription);
519  print '</tr>';
520 
521  // Amount
522  print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
523  print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
524  print '</tr>';
525 
526  print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
527  print yn($object->caneditamount);
528  print '</td></tr>';
529 
530  print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
531  print yn($object->vote);
532  print '</tr>';
533 
534  print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
535  if ($object->duration_value > 1) {
536  $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"));
537  } elseif ($object->duration_value > 0) {
538  $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"));
539  }
540  print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
541  print '</td></tr>';
542 
543  print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
544  print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private));
545  print "</td></tr>";
546 
547  print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
548  print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->mail_valid));
549  print "</td></tr>";
550 
551  // Other attributes
552  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
553 
554  print '</table>';
555  print '</div>';
556 
557  print dol_get_fiche_end();
558 
559 
560  /*
561  * Buttons
562  */
563 
564  print '<div class="tabsAction">';
565 
566  // Edit
567  if ($user->hasRight('adherent', 'configurer')) {
568  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>';
569  }
570 
571  // Add
572  if ($object->morphy == 'phy') {
573  $morphy = 'phy';
574  } elseif ($object->morphy == 'mor') {
575  $morphy = 'mor';
576  } else {
577  $morphy = '';
578  }
579 
580  if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) {
581  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>';
582  } else {
583  print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
584  }
585 
586  // Delete
587  if ($user->hasRight('adherent', 'configurer')) {
588  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>';
589  }
590 
591  print "</div>";
592 
593 
594  // Show list of members (nearly same code than in page list.php)
595 
596  $membertypestatic = new AdherentType($db);
597 
598  $now = dol_now();
599 
600  $sql = "SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
601  $sql .= " d.datefin,";
602  $sql .= " d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
603  $sql .= " t.libelle as type, t.subscription, t.amount";
604 
605  $sqlfields = $sql; // $sql fields to remove for count total
606 
607  $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
608  $sql .= " WHERE d.fk_adherent_type = t.rowid ";
609  $sql .= " AND d.entity IN (".getEntity('adherent').")";
610  $sql .= " AND t.rowid = ".((int) $object->id);
611  if ($sall) {
612  $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);
613  }
614  if ($status != '') {
615  $sql .= natural_search('d.statut', $status, 2);
616  }
617  if ($action == 'search') {
618  if (GETPOST('search', 'alpha')) {
619  $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
620  }
621  }
622  if (!empty($search_ref)) {
623  $sql .= natural_search("d.ref", $search_ref);
624  }
625  if (!empty($search_lastname)) {
626  $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname);
627  }
628  if (!empty($search_login)) {
629  $sql .= natural_search("d.login", $search_login);
630  }
631  if (!empty($search_email)) {
632  $sql .= natural_search("d.email", $search_email);
633  }
634  if ($filter == 'uptodate') {
635  $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
636  }
637  if ($filter == 'outofdate') {
638  $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
639  }
640 
641  // Count total nb of records
642  $nbtotalofrecords = '';
643  if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
644  /* The fast and low memory method to get and count full list converts the sql into a sql count */
645  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
646  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
647  $resql = $db->query($sqlforcount);
648  if ($resql) {
649  $objforcount = $db->fetch_object($resql);
650  $nbtotalofrecords = $objforcount->nbtotalofrecords;
651  } else {
652  dol_print_error($db);
653  }
654 
655  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
656  $page = 0;
657  $offset = 0;
658  }
659  $db->free($resql);
660  }
661 
662  // Complete request and execute it with limit
663  $sql .= $db->order($sortfield, $sortorder);
664  if ($limit) {
665  $sql .= $db->plimit($limit + 1, $offset);
666  }
667 
668  $resql = $db->query($sql);
669  if ($resql) {
670  $num = $db->num_rows($resql);
671  $i = 0;
672 
673  $titre = $langs->trans("MembersList");
674  if ($status != '') {
675  if ($status == '-1,1') {
676  $titre = $langs->trans("MembersListQualified");
677  } elseif ($status == '-1') {
678  $titre = $langs->trans("MembersListToValid");
679  } elseif ($status == '1' && !$filter) {
680  $titre = $langs->trans("MembersListValid");
681  } elseif ($status == '1' && $filter == 'uptodate') {
682  $titre = $langs->trans("MembersListUpToDate");
683  } elseif ($status == '1' && $filter == 'outofdate') {
684  $titre = $langs->trans("MembersListNotUpToDate");
685  } elseif ($status == '0') {
686  $titre = $langs->trans("MembersListResiliated");
687  } elseif ($status == '-2') {
688  $titre = $langs->trans("MembersListExcluded");
689  }
690  } elseif ($action == 'search') {
691  $titre = $langs->trans("MembersListQualified");
692  }
693 
694  if ($type > 0) {
695  $membertype = new AdherentType($db);
696  $result = $membertype->fetch($type);
697  $titre .= " (".$membertype->label.")";
698  }
699 
700  $param = "&rowid=".urlencode($object->id);
701  if (!empty($mode)) {
702  $param .= '&mode='.urlencode($mode);
703  }
704  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
705  $param .= '&contextpage='.urlencode($contextpage);
706  }
707  if ($limit > 0 && $limit != $conf->liste_limit) {
708  $param .= '&limit='.((int) $limit);
709  }
710  if (!empty($status)) {
711  $param .= "&status=".urlencode($status);
712  }
713  if (!empty($search_ref)) {
714  $param .= "&search_ref=".urlencode($search_ref);
715  }
716  if (!empty($search_lastname)) {
717  $param .= "&search_lastname=".urlencode($search_lastname);
718  }
719  if (!empty($search_firstname)) {
720  $param .= "&search_firstname=".urlencode($search_firstname);
721  }
722  if (!empty($search_login)) {
723  $param .= "&search_login=".urlencode($search_login);
724  }
725  if (!empty($search_email)) {
726  $param .= "&search_email=".urlencode($search_email);
727  }
728  if (!empty($filter)) {
729  $param .= "&filter=".urlencode($filter);
730  }
731 
732  if ($sall) {
733  print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
734  }
735 
736  print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" name="formfilter" autocomplete="off">';
737  print '<input type="hidden" name="token" value="'.newToken().'">';
738  print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'"></td>';
739 
740  print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
741 
742  $moreforfilter = '';
743 
744  print '<div class="div-table-responsive">';
745  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
746 
747  // Fields title search
748  print '<tr class="liste_titre_filter">';
749 
750  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
751  print '<td class="liste_titre center maxwidthsearch">';
752  $searchpicto = $form->showFilterButtons('left');
753  print $searchpicto;
754  print '</td>';
755  }
756 
757  print '<td class="liste_titre left">';
758  print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
759 
760  print '<td class="liste_titre left">';
761  print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
762 
763  print '<td class="liste_titre left">';
764  print '<input class="flat maxwidth100" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
765 
766  print '<td class="liste_titre">&nbsp;</td>';
767 
768  print '<td class="liste_titre left">';
769  print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
770 
771  print '<td class="liste_titre">&nbsp;</td>';
772 
773  print '<td class="liste_titre">&nbsp;</td>';
774 
775  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
776  print '<td class="liste_titre center nowraponall">';
777  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")).'">';
778  print '&nbsp; ';
779  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")).'">';
780  print '</td>';
781  }
782 
783  print "</tr>\n";
784 
785  print '<tr class="liste_titre">';
786  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
787  print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
788  }
789  print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder);
790  print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
791  print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
792  print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
793  print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder);
794  print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder);
795  print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder);
796  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
797  print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
798  }
799  print "</tr>\n";
800 
801  $adh = new Adherent($db);
802 
803  $imaxinloop = ($limit ? min($num, $limit) : $num);
804  while ($i < $imaxinloop) {
805  $objp = $db->fetch_object($resql);
806 
807  $datefin = $db->jdate($objp->datefin);
808 
809  $adh->id = $objp->rowid;
810  $adh->ref = $objp->ref;
811  $adh->login = $objp->login;
812  $adh->lastname = $objp->lastname;
813  $adh->firstname = $objp->firstname;
814  $adh->datefin = $datefin;
815  $adh->need_subscription = $objp->subscription;
816  $adh->statut = $objp->status;
817  $adh->email = $objp->email;
818  $adh->photo = $objp->photo;
819 
820  print '<tr class="oddeven">';
821 
822  // Actions
823  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
824  print '<td class="center">';
825  if ($user->hasRight('adherent', 'creer')) {
826  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>';
827  }
828  if ($user->hasRight('adherent', 'supprimer')) {
829  print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
830  }
831  print "</td>";
832  }
833 
834  // Ref
835  print "<td>";
836  print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
837  print "</td>\n";
838 
839  // Lastname
840  if ($objp->company != '') {
841  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";
842  } else {
843  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";
844  }
845 
846  // Login
847  print "<td>".dol_escape_htmltag($objp->login)."</td>\n";
848 
849  // Type
850  /*print '<td class="nowrap">';
851  $membertypestatic->id=$objp->type_id;
852  $membertypestatic->label=$objp->type;
853  print $membertypestatic->getNomUrl(1,12);
854  print '</td>';
855  */
856 
857  // Moral/Physique
858  print "<td>".$adh->getmorphylib($objp->morphy, 1)."</td>\n";
859 
860  // EMail
861  print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
862 
863  // Status
864  print '<td class="nowrap">';
865  print $adh->getLibStatut(2);
866  print "</td>";
867 
868  // Date end subscription
869  if ($datefin) {
870  print '<td class="nowrap center">';
871  if ($datefin < dol_now() && $objp->status > 0) {
872  print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
873  } else {
874  print dol_print_date($datefin, 'day');
875  }
876  print '</td>';
877  } else {
878  print '<td class="nowrap center">';
879  if (!empty($objp->subscription)) {
880  print '<span class="opacitymedium">'.$langs->trans("SubscriptionNotReceived").'</span>';
881  if ($objp->status > 0) {
882  print " ".img_warning();
883  }
884  } else {
885  print '&nbsp;';
886  }
887  print '</td>';
888  }
889 
890  // Actions
891  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
892  print '<td class="center">';
893  if ($user->hasRight('adherent', 'creer')) {
894  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>';
895  }
896  if ($user->hasRight('adherent', 'supprimer')) {
897  print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
898  }
899  print "</td>";
900  }
901  print "</tr>\n";
902  $i++;
903  }
904 
905  if ($i == 0) {
906  print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
907  }
908 
909  print "</table>\n";
910  print '</div>';
911  print '</form>';
912  } else {
913  dol_print_error($db);
914  }
915  }
916 
917  /* ************************************************************************** */
918  /* */
919  /* Edition mode */
920  /* */
921  /* ************************************************************************** */
922 
923  if ($action == 'edit') {
924  $object = new AdherentType($db);
925  $object->fetch($rowid);
926  $object->fetch_optionals();
927 
928  $head = member_type_prepare_head($object);
929 
930  print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
931  print '<input type="hidden" name="token" value="'.newToken().'">';
932  print '<input type="hidden" name="rowid" value="'.$object->id.'">';
933  print '<input type="hidden" name="action" value="update">';
934 
935  print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
936 
937  print '<table class="border centpercent">';
938 
939  print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
940 
941  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>';
942 
943  print '<tr><td>'.$langs->trans("Status").'</td><td>';
944  print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
945  print '</td></tr>';
946 
947  // Morphy
948  $morphys[""] = $langs->trans("MorAndPhy");
949  $morphys["phy"] = $langs->trans("Physical");
950  $morphys["mor"] = $langs->trans("Moral");
951  print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
952  print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : $object->morphy);
953  print "</td></tr>";
954 
955  print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
956  print $form->selectyesno("subscription", $object->subscription, 1);
957  print '</td></tr>';
958 
959  print '<tr><td>'.$langs->trans("Amount").'</td><td>';
960  print '<input name="amount" size="5" value="';
961  print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
962  print '">';
963  print '</td></tr>';
964 
965  print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).'</td><td>';
966  print $form->selectyesno("caneditamount", $object->caneditamount, 1);
967  print '</td></tr>';
968 
969  print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
970  print $form->selectyesno("vote", $object->vote, 1);
971  print '</td></tr>';
972 
973  print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
974  print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
975  print $formproduct->selectMeasuringUnits("duration_unit", "time", ($object->duration_unit === '' ? 'y' : $object->duration_unit), 0, 1);
976  print '</td></tr>';
977 
978  print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
979  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
980  $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
981  $doleditor->Create();
982  print "</td></tr>";
983 
984  print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
985  $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
986  $doleditor->Create();
987  print "</td></tr>";
988 
989  // Other attributes
990  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
991 
992  print '</table>';
993 
994  print dol_get_fiche_end();
995 
996  print $form->buttonsSaveCancel();
997 
998  print "</form>";
999  }
1000 }
1001 
1002 // End of page
1003 llxFooter();
1004 $db->close();
AdherentType
Class to manage members type.
Definition: adherent_type.class.php:35
yn
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
Definition: functions.lib.php:6824
dol_trunc
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.
Definition: functions.lib.php:4059
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dol_string_onlythesehtmltags
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.
Definition: functions.lib.php:7118
dol_escape_htmltag
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...
Definition: functions.lib.php:1600
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5477
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:609
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:5107
member_type_prepare_head
member_type_prepare_head(AdherentType $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:175
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4784
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_clone
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
Definition: functions.lib.php:1255
img_edit
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
Definition: functions.lib.php:4652
dol_banner_tab
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.
Definition: functions.lib.php:2205
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5955
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2675
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4135
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
dolGetButtonTitle
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.
Definition: functions.lib.php:11263
GETPOSTINT
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:926
print_barre_liste
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.
Definition: functions.lib.php:5530
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
Adherent
Class to manage members of a foundation.
Definition: adherent.class.php:47
$sql
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
restrictedArea
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.
Definition: security.lib.php:353
FormProduct
Class with static methods for building HTML components related to products Only components common to ...
Definition: html.formproduct.class.php:30
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:11654
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2177
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:207
dol_get_fiche_head
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.
Definition: functions.lib.php:1979
getDolGlobalString
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:142
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:509
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5295
natural_search
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...
Definition: functions.lib.php:10024
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4473
dol_htmlentitiesbr
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...
Definition: functions.lib.php:7469
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:3056
price
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.
Definition: functions.lib.php:5829
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156
DolEditor
Class to manage a WYSIWYG editor.
Definition: doleditor.class.php:30