]> git.stg.codes - stg.git/blobdiff - projects/stargazer/user_impl.cpp
Ticket 37. In the ProcessNewMonth() function switch construction changed
[stg.git] / projects / stargazer / user_impl.cpp
index 5d505307a72302bbddccbe92be280aefdea592a7..72a3378f771876873f39aab1caf8ea408efde56b 100644 (file)
@@ -1178,10 +1178,24 @@ if (nextTariff.ConstData() != "")
     {
     const TARIFF * nt = tariffs->FindByName(nextTariff);
     if (nt == NULL)
+        {
         WriteServLog("Cannot change tariff for user %s. Tariff %s not exist.",
                      login.c_str(), property.tariffName.Get().c_str());
+        }
     else
-        property.tariffName.Set(nextTariff, sysAdmin, login, store);
+        {
+        if (tariff->TariffChangelsAllowed(*nt) == "")
+            {
+            property.tariffName.Set(nextTariff, sysAdmin, login, store);
+            }
+        else
+            {
+            std::string message = tariff->TariffChangelsAllowed(*nt);
+            WriteServLog("Tariff change is prohibited for user %s. %s",
+                         login.c_str(),
+                         message.c_str());
+            }
+        }
     ResetNextTariff();
     WriteConf();
     }