]> git.stg.codes - stg.git/blobdiff - projects/stargazer/tariff_impl.cpp
Ticket 37. if (year < 1990) checking added in the ts2time() function.
[stg.git] / projects / stargazer / tariff_impl.cpp
index 34590975882045b607466e3c15bb048559b41868..c8a0161c6deddb67f67677e3945a2b25ed7cb306 100644 (file)
@@ -147,6 +147,9 @@ else
 //-----------------------------------------------------------------------------
 std::string TARIFF_IMPL::TariffChangeIsAllowed(const TARIFF & to) const
 {
+time_t timeout = GetChangePolicyTimeout();
+if (stgTime > timeout && timeout != 0)
+    return "";
 switch (GetChangePolicy())
     {
     case TARIFF::ALLOW:
@@ -157,7 +160,7 @@ switch (GetChangePolicy())
         else
             return "New tariff '" + to.GetName() + "' is more expensive than current tariff '" + GetName() + "'. The policy is '" + TARIFF::ChangePolicyToString(GetChangePolicy()) + "'.";
     case TARIFF::TO_EXPENSIVE:
-        if (to.GetFee() > GetFee())
+        if (to.GetFee() >= GetFee())
             return "";
         else
             return "New tariff '" + to.GetName() + "' is more cheap than current tariff '" + GetName() + "'. The policy is '" + TARIFF::ChangePolicyToString(GetChangePolicy()) + "'.";