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,10 +2512,22 @@ namespace WebsitePanel.EnterpriseServer
}
ExchangeMailboxPlan plan = GetExchangeMailboxPlan(itemId, mailboxPlanId);
if (maxDiskSpace != -1)
{
if ((quotaUsed + plan.MailboxSizeMB) > (maxDiskSpace))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
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))
return BusinessErrorCodes.ERROR_EXCHANGE_STORAGE_QUOTAS_EXCEED_HOST_VALUES;
}
}
// get mailbox settings