* Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015-2024 Alexandre Spangaro * Copyright (C) 2019-2022 Thibault Foucart * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/adherents/type.php * \ingroup member * \brief Member's type setup */ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; // Load translation files required by the page $langs->load("members"); $rowid = GETPOSTINT('rowid'); $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $mode = GETPOST('mode', 'alpha'); $sall = GETPOST("sall", "alpha"); $filter = GETPOST("filter", 'alpha'); $search_ref = GETPOST('search_ref', 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_email = GETPOST('search_email', 'alpha'); $type = GETPOST('type', 'intcomma'); $status = GETPOST('status', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortorder) { $sortorder = "DESC"; } if (!$sortfield) { $sortfield = "d.lastname"; } $label = GETPOST("label", "alpha"); $morphy = GETPOST("morphy", "alpha"); $status = GETPOST("status", "intcomma"); $subscription = GETPOSTINT("subscription"); $amount = GETPOST('amount', 'alpha'); $duration_value = GETPOSTINT('duration_value'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOSTINT("vote"); $comment = GETPOST("comment", 'restricthtml'); $mail_valid = GETPOST("mail_valid", 'restricthtml'); $caneditamount = GETPOSTINT("caneditamount"); // Initialize a technical objects $object = new AdherentType($db); $extrafields = new ExtraFields($db); $hookmanager->initHooks(array('membertypecard', 'globalcard')); // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); // Security check $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); /* * Actions */ 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 $search_ref = ""; $search_lastname = ""; $search_login = ""; $search_email = ""; $type = ""; $sall = ""; } if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } if ($cancel) { $action = ''; if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } } if ($action == 'add' && $user->hasRight('adherent', 'configurer')) { $object->label = trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; $object->amount = ($amount == '' ? '' : price2num($amount, 'MT')); $object->caneditamount = $caneditamount; $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->note_public = trim($comment); $object->note_private = ''; $object->mail_valid = trim($mail_valid); $object->vote = $vote; // $vote is already int // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) { $error++; } if (empty($object->label)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); } else { $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle = '".$db->escape($object->label)."'"; $sql .= " WHERE entity IN (".getEntity('member_type').")"; $result = $db->query($sql); $num = null; if ($result) { $num = $db->num_rows($result); } if ($num) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorLabelAlreadyExists", $login), null, 'errors'); } } if (!$error) { $id = $object->create($user); if ($id > 0) { $backurlforlist = $_SERVER["PHP_SELF"]; $urltogo = $backtopage ? str_replace('__ID__', (string) $id, $backtopage) : $backurlforlist; $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', (string) $object->id, $urltogo); // New method to autoselect field created after a New on another form object creation header("Location: " . $urltogo); exit; } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } } else { $action = 'create'; } } if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->fetch($rowid); $object->oldcopy = dol_clone($object, 2); $object->label = trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; $object->amount = ($amount == '' ? '' : price2num($amount, 'MT')); $object->caneditamount = $caneditamount; $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->note_public = trim($comment); $object->note_private = ''; $object->mail_valid = trim($mail_valid); $object->vote = $vote; // $vote is already int. // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) { $error++; } $ret = $object->update($user); if ($ret >= 0 && !count($object->errors)) { setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs'); } else { setEventMessages($object->error, $object->errors, 'errors'); } header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$object->id); exit; } if ($action == 'confirm_delete' && $user->hasRight('adherent', 'configurer')) { $object->fetch($rowid); $res = $object->delete($user); if ($res > 0) { setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; } else { setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors'); $action = ''; } } /* * View */ $form = new Form($db); $formproduct = new FormProduct($db); $title = $langs->trans("MembersTypeSetup"); $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-type'); $arrayofselected = is_array($toselect) ? $toselect : array(); // List of members type if (!$rowid && $action != 'create' && $action != 'edit') { //print dol_get_fiche_head(''); $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy, d.duration"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $nbtotalofrecords = $num; $i = 0; $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.$limit; } $newcardbutton = ''; $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')); $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')); if ($user->hasRight('adherent', 'configurer')) { $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); } print '
'; if ($optioncss != '') { print ''; } print ''; print ''; print ''; print ''; print ''; print ''; print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); $moreforfilter = ''; print '
'; print ''."\n"; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } print "\n"; $membertype = new AdherentType($db); $i = 0; $savnbfield = 10; /*$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0;*/ $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $objp = $db->fetch_object($result); $membertype->id = $objp->rowid; $membertype->ref = $objp->rowid; $membertype->label = $objp->rowid; $membertype->status = $objp->status; $membertype->subscription = $objp->subscription; $membertype->amount = $objp->amount; $membertype->caneditamount = $objp->caneditamount; if ($mode == 'kanban') { if ($i == 0) { print ''; } } else { print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if ($user->hasRight('adherent', 'configurer')) { print ''; } } print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if ($user->hasRight('adherent', 'configurer')) { print ''; } } print ""; } $i++; } // If no record found if ($num == 0) { /*$colspan = 1; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { $colspan++; } }*/ $colspan = 9; print ''; } print "
 '.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("MembersNature").''.$langs->trans("MembershipDuration").''.$langs->trans("SubscriptionRequired").''.$langs->trans("Amount").''.$langs->trans("CanEditAmountShort").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").' 
'; print '
'; } //output kanban $membertype->label = $objp->label; print $membertype->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print '
'; print '
rowid.'">'.img_edit().''; print $membertype->getNomUrl(1); //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' print ''.dol_escape_htmltag($objp->label).''; if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else { print $langs->trans("MorAndPhy"); } print ''; if ($objp->duration) { $duration_value = intval($objp->duration); if ($duration_value > 1) { $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")); } else { $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")); } $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); print max(1, $duration_value).' '.$dur[$unit]; } print ''.yn($objp->subscription).''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().'
'.$langs->trans("NoRecordFound").'
"; print '
'; print '
'; } else { dol_print_error($db); } } // Creation if ($action == 'create') { $object = new AdherentType($db); print load_fiche_titre($langs->trans("NewMemberType"), '', 'members'); print '
'; print ''; print ''; print ''; print dol_get_fiche_head(''); print ''; print ''; print ''; print ''; // Morphy $morphys = array(); $morphys[""] = $langs->trans("MorAndPhy"); $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); print '"; print ''; print ''; print ''; print ''; print ''; print ''; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print ''; print "
'.$langs->trans("Label").'
'.$langs->trans("Status").''; print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); print '
'.$langs->trans("MembersNature").''; print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy'); print "
'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).''; print $form->selectyesno("subscription", 1, 1); print '
'.$langs->trans("Amount").''; print ''; print '
'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).''; print $form->selectyesno("caneditamount", GETPOSTISSET('caneditamount') ? GETPOST('caneditamount') : 0, 1); print '
'.$langs->trans("VoteAllowed").''; print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1); print '
'.$langs->trans("Duration").''; print ' '; print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOSTISSET("duration_unit") ? GETPOST('duration_unit', 'aZ09') : 'y', 0, 1); print '
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print '
'.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print '
\n"; print dol_get_fiche_end(); print $form->buttonsSaveCancel(); print "
\n"; } // View if ($rowid > 0) { if ($action != 'edit') { $object = new AdherentType($db); $object->fetch($rowid); $object->fetch_optionals(); /* * Confirmation deletion */ if ($action == 'delete') { print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1); } $head = member_type_prepare_head($object); print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group'); $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'rowid', $linkback); print '
'; print '
'; print ''; // Morphy print ''; print ''; print ''; // Amount print ''; print ''; print ''; // Duration print ''; // Description print '"; // Welcome email content print '"; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'.$langs->trans("MembersNature").''.$object->getmorphylib($object->morphy).'
'.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).''; print yn($object->subscription); print '
'.$langs->trans("Amount").''; print((is_null($object->amount) || $object->amount === '') ? '' : ''.price($object->amount).''); print '
'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).''; print yn($object->caneditamount); print '
'.$langs->trans("VoteAllowed").''; print yn($object->vote); print '
'.$langs->trans("Duration").''.$object->duration_value.' '; if ($object->duration_value > 1) { $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")); } elseif ($object->duration_value > 0) { $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")); } print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; print '
'.$langs->trans("Description").'
'; print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)); print "
'.$langs->trans("WelcomeEMail").'
'; print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->mail_valid)); print "
'; print '
'; print dol_get_fiche_end(); /* * Buttons */ print '
'; // Edit if ($user->hasRight('adherent', 'configurer')) { print ''; } // Add if ($object->morphy == 'phy') { $morphy = 'phy'; } elseif ($object->morphy == 'mor') { $morphy = 'mor'; } else { $morphy = ''; } if ($user->hasRight('adherent', 'configurer') && !empty($object->status)) { print ''; } else { print ''; } // Delete if ($user->hasRight('adherent', 'configurer')) { print ''; } print "
"; // Show list of members (nearly same code than in page list.php) $membertypestatic = new AdherentType($db); $now = dol_now(); $sql = "SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,"; $sql .= " d.datefin,"; $sql .= " d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,"; $sql .= " t.libelle as type, t.subscription, t.amount"; $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE d.fk_adherent_type = t.rowid "; $sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND t.rowid = ".((int) $object->id); if ($sall) { $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); } if ($status != '') { $sql .= natural_search('d.statut', $status, 2); } if ($action == 'search') { if (GETPOST('search', 'alpha')) { $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha')); } } if (!empty($search_ref)) { $sql .= natural_search("d.ref", $search_ref); } if (!empty($search_lastname)) { $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname); } if (!empty($search_login)) { $sql .= natural_search("d.login", $search_login); } if (!empty($search_email)) { $sql .= natural_search("d.email", $search_email); } if ($filter == 'uptodate') { $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; } if ($filter == 'outofdate') { $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; } // Count total nb of records $nbtotalofrecords = ''; if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); $resql = $db->query($sqlforcount); if ($resql) { $objforcount = $db->fetch_object($resql); $nbtotalofrecords = $objforcount->nbtotalofrecords; } else { dol_print_error($db); } if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } $db->free($resql); } // Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); if ($limit) { $sql .= $db->plimit($limit + 1, $offset); } $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; $titre = $langs->trans("MembersList"); if ($status != '') { if ($status == '-1,1') { $titre = $langs->trans("MembersListQualified"); } elseif ($status == '-1') { $titre = $langs->trans("MembersListToValid"); } elseif ($status == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); } elseif ($status == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); } elseif ($status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } elseif ($status == '0') { $titre = $langs->trans("MembersListResiliated"); } elseif ($status == '-2') { $titre = $langs->trans("MembersListExcluded"); } } elseif ($action == 'search') { $titre = $langs->trans("MembersListQualified"); } if ($type > 0) { $membertype = new AdherentType($db); $result = $membertype->fetch($type); $titre .= " (".$membertype->label.")"; } $param = "&rowid=".urlencode((string) ($object->id)); if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if (!empty($status)) { $param .= "&status=".urlencode($status); } if (!empty($search_ref)) { $param .= "&search_ref=".urlencode($search_ref); } if (!empty($search_lastname)) { $param .= "&search_lastname=".urlencode($search_lastname); } if (!empty($search_login)) { $param .= "&search_login=".urlencode($search_login); } if (!empty($search_email)) { $param .= "&search_email=".urlencode($search_email); } if (!empty($filter)) { $param .= "&filter=".urlencode($filter); } if ($sall) { print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; } print '
'; print ''; print ''; print ''; print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); $moreforfilter = ''; print '
'; print ''."\n"; // Fields title search print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } print "\n"; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); } print "\n"; $adh = new Adherent($db); $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $datefin = $db->jdate($objp->datefin); $adh->id = $objp->rowid; $adh->ref = $objp->ref; $adh->login = $objp->login; $adh->lastname = $objp->lastname; $adh->firstname = $objp->firstname; $adh->datefin = $datefin; $adh->need_subscription = $objp->subscription; $adh->statut = $objp->status; $adh->status = $objp->status; $adh->email = $objp->email; $adh->photo = $objp->photo; print ''; // Actions if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print '"; } // Ref print "\n"; // Lastname if ($objp->company != '') { print ''."\n"; } else { print ''."\n"; } // Login print "\n"; // Type /*print ''; */ // Moral/Physique print "\n"; // EMail print "\n"; // Status print '"; // Date end subscription if ($datefin) { print ''; } else { print ''; } // Actions if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print '"; } print "\n"; $i++; } if ($i == 0) { print ''; } print "
'; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; print ''; print ''; print ' '; print '  '; print ''; print '  '; print ''; print '
'; if ($user->hasRight('adherent', 'creer')) { print ''.img_edit().''; } if ($user->hasRight('adherent', 'supprimer')) { print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; } print ""; print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); print "'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).''.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 32).'".dol_escape_htmltag($objp->login)."'; $membertypestatic->id=$objp->type_id; $membertypestatic->label=$objp->type; print $membertypestatic->getNomUrl(1,12); print '".$adh->getmorphylib($objp->morphy, 1)."".dol_print_email($objp->email, 0, 0, 1)."'; print $adh->getLibStatut(2); print "'; if ($datefin < dol_now() && $objp->status > 0) { print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); } else { print dol_print_date($datefin, 'day'); } print ''; if (!empty($objp->subscription)) { print ''.$langs->trans("SubscriptionNotReceived").''; if ($objp->status > 0) { print " ".img_warning(); } } else { print ' '; } print ''; if ($user->hasRight('adherent', 'creer')) { print ''.img_edit().''; } if ($user->hasRight('adherent', 'supprimer')) { print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; } print "
'.$langs->trans("None").'
\n"; print '
'; print '
'; } else { dol_print_error($db); } } /* ************************************************************************** */ /* */ /* Edition mode */ /* */ /* ************************************************************************** */ if ($action == 'edit') { $object = new AdherentType($db); $object->fetch($rowid); $object->fetch_optionals(); $head = member_type_prepare_head($object); print '
'; print ''; print ''; print ''; print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group'); print ''; print ''; print ''; print ''; // Morphy $morphys[""] = $langs->trans("MorAndPhy"); $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); print '"; print ''; print ''; print ''; print ''; print ''; print '"; print '"; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Label").'
'.$langs->trans("Status").''; print $form->selectarray('status', array('0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); print '
'.$langs->trans("MembersNature").''; print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : $object->morphy); print "
'.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription", $object->subscription, 1); print '
'.$langs->trans("Amount").''; print ''; print '
'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmountDetail")).''; print $form->selectyesno("caneditamount", $object->caneditamount, 1); print '
'.$langs->trans("VoteAllowed").''; print $form->selectyesno("vote", $object->vote, 1); print '
'.$langs->trans("Duration").''; print ' '; print $formproduct->selectMeasuringUnits("duration_unit", "time", ($object->duration_unit === '' ? 'y' : $object->duration_unit), 0, 1); print '
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print "
'.$langs->trans("WelcomeEMail").''; $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print "
'; print dol_get_fiche_end(); print $form->buttonsSaveCancel(); print "
"; } } // End of page llxFooter(); $db->close();