diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 8b459e2c7b6..f7f4394a80f 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -37,6 +37,7 @@ 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 = GETPOST('rowid', 'int'); @@ -55,13 +56,15 @@ $type = GETPOST('type', 'intcomma'); $status = GETPOST('status', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); +// Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +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; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -84,14 +87,12 @@ $comment = GETPOST("comment", 'restricthtml'); $mail_valid = GETPOST("mail_valid", 'restricthtml'); $caneditamount = GETPOSTINT("caneditamount"); -// Security check -$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); - +// Initialize technical objects $object = new AdherentType($db); - $extrafields = new ExtraFields($db); +$hookmanager->initHooks(array('membertypecard', 'globalcard')); -// fetch optionals attributes and labels +// Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); 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 @@ -103,14 +104,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x' } -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('membertypecard', 'globalcard')); +// Security check +$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); /* * Actions */ +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} + if ($cancel) { $action = ''; @@ -340,9 +349,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print '