Fixed: Old mailbox plan size taken in considearion when setting new mailbox plan

This commit is contained in:
robvde 2012-09-20 07:29:29 +04:00
parent 9167da75dc
commit e055d56d5f

View file

@ -2512,11 +2512,23 @@ namespace WebsitePanel.EnterpriseServer
} }
ExchangeMailboxPlan plan = GetExchangeMailboxPlan(itemId, mailboxPlanId); ExchangeMailboxPlan plan = GetExchangeMailboxPlan(itemId, mailboxPlanId);
if (maxDiskSpace != -1) if (maxDiskSpace != -1)
{
ExchangeAccount exchangeAccount = GetAccount(itemId, accountId);
if (exchangeAccount.MailboxPlanId > 0)
{
ExchangeMailboxPlan oldPlan = GetExchangeMailboxPlan(itemId, exchangeAccount.MailboxPlanId);
if (((quotaUsed - oldPlan.MailboxSizeMB) + plan.MailboxSizeMB) > (maxDiskSpace))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
}
else
{ {
if ((quotaUsed + plan.MailboxSizeMB) > (maxDiskSpace)) if ((quotaUsed + plan.MailboxSizeMB) > (maxDiskSpace))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES; return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
} }
}
// get mailbox settings // get mailbox settings
int exchangeServiceId = GetExchangeServiceID(org.PackageId); int exchangeServiceId = GetExchangeServiceID(org.PackageId);