summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
fb3a3aa)
checking and TariffChangeIsAllowed() function call added in the
SetUserInfo() function.
tariff = tariff.substr(0, pos);
}
tariff = tariff.substr(0, pos);
}
- if (tariffs->FindByName(tariff))
- if (ptr->GetProperty().tariffName.Get() != tariff)
- if (!ptr->GetProperty().tariffName.Set(tariff,
- admin,
- login,
- &store))
- return true;
+ const TARIFF * newTariff = tariffs->FindByName(tariff);
+ if (newTariff)
+ {
+ const TARIFF * currentTariff = ptr->GetTariff();
+ std::string message = currentTariff->TariffChangeIsAllowed(*newTariff);
+ if (message.empty())
+ {
+ if (ptr->GetProperty().tariffName.Get() != tariff)
+ {
+ if (!ptr->GetProperty().tariffName.Set(tariff,
+ admin,
+ login,
+ &store))
+ return true;
+ }
+ }
+ else
+ {
+ GetStgLogger()("Tariff change is prohibited for user %s. %s", ptr->GetLogin().c_str(), message.c_str());
+ }
+ }
if (nextTariff != "" &&
tariffs->FindByName(nextTariff))
if (nextTariff != "" &&
tariffs->FindByName(nextTariff))