]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/Class/JobManager.php
baculum: Assign Baculum copyright to Kern Sibbald
[bacula/bacula] / gui / baculum / protected / Class / JobManager.php
index c2670edcfd98311c9bdc69325d1ed25598310210..729b80615747abcd93ddd2a283ecd38c67a3c123 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -63,9 +63,18 @@ 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();
-               $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;