From b68047428a73a0e11065d6a5534f25559533c8bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Feb 2016 16:02:30 +0100 Subject: [PATCH] Fix filter on cron --- htdocs/cron/class/cronjob.class.php | 3 ++- htdocs/cron/list.php | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 9ef47c30ea7..5a3be50c738 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -395,7 +395,8 @@ class Cronjob extends CommonObject $sql.= " t.test"; $sql.= " FROM ".MAIN_DB_PREFIX."cronjob as t"; $sql.= " WHERE 1 = 1"; - if ($status >= 0) $sql.= " AND t.status = ".(empty($status)?'0':'1'); + if ($status >= 0 && $status < 2) $sql.= " AND t.status = ".(empty($status)?'0':'1'); + if ($status == 2) $sql.= " AND t.status = 2"; //Manage filter if (is_array($filter) && count($filter)>0) { foreach($filter as $key => $value) { diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 49f5878d436..a42feafc437 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2015 Laurent Destailleur + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2016 Laurent Destailleur * * 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 @@ -35,11 +35,6 @@ $langs->load("bills"); if (!$user->rights->cron->read) accessforbidden(); - -/* - * Actions - */ - $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $id=GETPOST('id','int'); @@ -57,7 +52,7 @@ if (empty($sortorder)) $sortorder="DESC"; if (empty($sortfield)) $sortfield="t.status"; if (empty($arch)) $arch = 0; if ($page == -1) { - $page = 0 ; + $page = 0 ; } $limit = $conf->global->MAIN_SIZE_LISTE_LIMIT; @@ -65,6 +60,11 @@ $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; + +/* + * Actions + */ + // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { @@ -79,8 +79,8 @@ if (!empty($search_label)) } // Delete jobs -if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete){ - +if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete) +{ //Delete cron task $object = new Cronjob($db); $object->id=$id; @@ -92,8 +92,8 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del } // Execute jobs -if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute){ - +if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->execute) +{ $object = new Cronjob($db); $job = $object->fetch($id);