Fix filter on cron

This commit is contained in:
Laurent Destailleur 2016-02-07 16:02:30 +01:00
parent 9da0164d90
commit b68047428a
2 changed files with 14 additions and 13 deletions

View File

@ -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) {

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.srouceforge.net>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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);