From 206fdb367f94c059509e474d76a48353fc6afaf3 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 4 Jul 2019 10:33:29 +0200 Subject: [PATCH] quota needs a left join to report mailboxes without quota --- api/src/Mail/Smtp/Sql.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/Mail/Smtp/Sql.php b/api/src/Mail/Smtp/Sql.php index a162fc4de1..43ccdda9ab 100644 --- a/api/src/Mail/Smtp/Sql.php +++ b/api/src/Mail/Smtp/Sql.php @@ -366,8 +366,8 @@ class Sql extends Mail\Smtp } if ($return_extra) { - $join .= ' JOIN '.self::TABLE.' quota ON quota.account_id='.Api\Accounts\Sql::TABLE.'.account_id'; - $cols .= ',account_id,quota.mail_value AS quota'; + $join .= ' LEFT JOIN '.self::TABLE.' quota ON quota.account_id='.Api\Accounts\Sql::TABLE.'.account_id AND quota.mail_type='.self::TYPE_QUOTA; + $cols .= ','.Api\Accounts\Sql::TABLE.'.account_id AS account_id,quota.mail_value AS quota'; } $mailboxes = array(); foreach($this->db->select(self::TABLE, $cols, @@ -384,7 +384,7 @@ class Sql extends Mail\Smtp { $mailboxes[$row['uid']] = [ 'mbox' => $mailbox, - 'quota' => $row['quota'] ? $row['quota'] : $GLOBALS['egw_info']['server']['default_quota'], + 'quota' => !empty($row['quota']) ? $row['quota'] : $GLOBALS['egw_info']['server']['default_quota'], 'groups' => array_values($GLOBALS['egw']->accounts->memberships($row['account_id'])), ]; }