From: Marcin Haba Date: Sat, 9 Jan 2016 07:44:52 +0000 (+0100) Subject: baculum: Fix restore group most recent backups for MySQL X-Git-Tag: Release-7.4.0~34 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f2451ac8523209909e488a40e47674e13e8048f9;p=bacula%2Fbacula baculum: Fix restore group most recent backups for MySQL --- diff --git a/gui/baculum/protected/Class/JobManager.php b/gui/baculum/protected/Class/JobManager.php index c2670edcfd..bb90b4401b 100644 --- a/gui/baculum/protected/Class/JobManager.php +++ b/gui/baculum/protected/Class/JobManager.php @@ -63,8 +63,17 @@ class JobManager extends TModule { } public function getRecentJobids($jobname, $clientid) { - $sql = "name='$jobname' AND clientid='$clientid' AND jobstatus IN ('T', 'W') AND level IN ('F', 'I', 'D') ORDER BY endtime DESC"; + $sql = "name='$jobname' AND clientid='$clientid' AND jobstatus IN ('T', 'W') AND level IN ('F', 'I', 'D')"; $finder = JobRecord::finder(); + $criteria = new TActiveRecordCriteria; + $order = 'endtime'; + $cfg = $this->Application->getModule('configuration'); + $appCfg = $cfg->getApplicationConfig(); + if($cfg->isPostgreSQLType($appCfg['db']['type'])) { + $order = strtolower($order); + } + $criteria->OrdersBy[$order] = 'desc'; + $criteria->Condition = $sql; $jobs = $finder->findAll($sql); $jobids = array();