From d221775f05c7bbbc9bd907e86d3e5a3058fd0d71 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Mon, 27 Jun 2011 21:59:27 +0200 Subject: [PATCH] bacula-web: Fixed bug in sql query when number of volume in pool is zero --- gui/bacula-web/includes/bweb.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/bacula-web/includes/bweb.inc.php b/gui/bacula-web/includes/bweb.inc.php index fedbc189b7..8a144df239 100644 --- a/gui/bacula-web/includes/bweb.inc.php +++ b/gui/bacula-web/includes/bweb.inc.php @@ -449,13 +449,13 @@ class Bweb extends DB case 'mysql': $query = 'SELECT COUNT(*) as vols,Pool.name as pool_name '; $query .= 'FROM Media '; - $query .= 'LEFT JOIN Pool ON (Media.PoolId = Pool.PoolId) '; + $query .= 'RIGHT JOIN Pool ON (Media.PoolId = Pool.PoolId) '; $query .= 'WHERE Media.poolid = ' . $pool_id; break; case 'pgsql': $query = 'SELECT COUNT(*) as vols,Pool.name as pool_name '; $query .= 'FROM Media '; - $query .= 'LEFT OUTER JOIN Pool ON (Media.PoolId = Pool.PoolId) '; + $query .= 'RIGHT JOIN Pool ON (Media.PoolId = Pool.PoolId) '; $query .= 'WHERE Media.poolid = ' . $pool_id; $query .= 'GROUP BY pool.name'; break; @@ -464,8 +464,8 @@ class Bweb extends DB $res = $this->db_link->query( $query ); if( PEAR::isError( $res ) ) $this->triggerDBError( 'Unable to get volume number from pool', $res ); - else - $vols = $res->fetchRow( ); + + $vols = $res->fetchRow( ); return array( $vols['pool_name'], $vols['vols'] ); } -- 2.39.5