diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 062fcb1d998..485bd551976 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -44,6 +44,17 @@ $constname=GETPOST('constname', 'alpha'); $constvalue=GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here $constnote=GETPOST('constnote', 'alpha'); +// Load variable for pagination +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (empty($sortfield)) $sortfield = 'entity,name'; +if (empty($sortorder)) $sortorder = 'ASC'; /* @@ -176,9 +187,11 @@ jQuery(document).ready(function() { print load_fiche_titre($langs->trans("OtherSetup"), '', 'title_setup'); -print $langs->trans("ConstDesc")."
\n"; +print ''.$langs->trans("ConstDesc")."
\n"; print "
\n"; +$param = ''; + print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; print ''; print ''; @@ -186,16 +199,19 @@ print ''; print '
'; print ''; print ''; -print ''; +print getTitleFieldOfList('Name', 0, $_SERVER['PHP_SELF'], 'name', '', $param, '', $sortfield, $sortorder, '')."\n"; print ''; print ''; -if (! empty($conf->multicompany->enabled) && !$user->entity) print ''; +print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center')."\n"; +if (! empty($conf->multicompany->enabled) && !$user->entity) +{ + print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center')."\n"; +} print ''; print "\n"; // Line to add new record -$var=false; print "\n"; print ''."\n"; @@ -204,6 +220,8 @@ print ''; print ''; +print ''; // Limit to superadmin if (! empty($conf->multicompany->enabled) && !$user->entity) { @@ -229,13 +247,14 @@ $sql.= ", ".$db->decrypt('name')." as name"; $sql.= ", ".$db->decrypt('value')." as value"; $sql.= ", type"; $sql.= ", note"; +$sql.= ", tms"; $sql.= ", entity"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug elseif (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name')); -$sql.= " ORDER BY entity, name ASC"; +$sql.= $db->order($sortfield, $sortorder); dol_syslog("Const::listConstant", LOG_DEBUG); $result = $db->query($sql); @@ -243,13 +262,11 @@ if ($result) { $num = $db->num_rows($result); $i = 0; - $var=false; while ($i < $num) { $obj = $db->fetch_object($result); - print "\n"; print ''."\n"; @@ -267,6 +284,11 @@ if ($result) print ''; print ''; + // Date last change + print ''; + // Entity limit to superadmin if (! empty($conf->multicompany->enabled) && !$user->entity) {
'.$langs->trans("Name").''.$langs->trans("Value").''.$langs->trans("Comment").''.$langs->trans("Entity").''.$langs->trans("Action").'
'; +print '
'.$obj->name.''; + print dol_print_date($db->jdate($obj->tms), 'dayhour'); + print '