* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2015 Marcin Haba
+ * Copyright (C) 2013-2016 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
}
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();
- $jobs = $finder->findAll($sql);
+ $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($criteria);
$jobids = array();
$waitForFull = false;