From 9694a001792d8060b29cf79f35ebb3dd6531339d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jan 2017 12:39:12 +0100 Subject: [PATCH] Fix sort is lost on agenda/event of projects --- htdocs/core/lib/company.lib.php | 4 ++-- htdocs/projet/info.php | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index ccec6af47d0..f5f8ec5456d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -965,7 +965,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac * @return mixed Return html part or void if noprint is 1 * TODO change function to be able to list event linked to an object. */ -function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC') +function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC') { global $bc,$user,$conf; global $form; @@ -1183,7 +1183,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= } $out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder); $out.=''.$langs->trans("Label").''; - $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep, a.id', '', $param, '', $sortfield, $sortorder); + $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, '', $sortfield, $sortorder); $out.=''.$langs->trans("Type").''; $out.=''; $out.=''; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 0c37f999259..3f9d9ee1275 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -35,6 +35,18 @@ $ref = GETPOST('ref','alpha'); $socid = GETPOST('socid','int'); $action = GETPOST('action','alpha'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield","alpha"); +$sortorder = GETPOST("sortorder"); +$page = GETPOST("page"); +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; +if (! $sortfield) $sortfield="a.datep,a.id"; +if (! $sortorder) $sortorder="ASC"; +$offset = $limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + if (GETPOST('actioncode','array')) { $actioncode=GETPOST('actioncode','array',3); @@ -181,7 +193,7 @@ if (!empty($object->id)) // List of all actions $filters=array(); $filters['search_agenda_label']=$search_agenda_label; - show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters); + show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder); }