]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser_tariffs.cpp
Ticket 37. ALTER TABLE tariffs query added for change_policy_timeout
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser_tariffs.cpp
index 7444a03f959d23d2f7f0a9264ed8bf937e410d28..867181afda0e95631d1d6f459557e4f4b33351cf 100644 (file)
@@ -171,7 +171,11 @@ int CHG_TARIFF::Start(void *, const char * el, const char ** attr)
     {
         if (strcasecmp(el, m_tag.c_str()) == 0)
         {
-            td.tariffConf.name = attr[1];
+            const TARIFF * tariff = m_tariffs.FindByName(attr[1]);
+            if (tariff != NULL)
+                td = tariff->GetTariffData();
+            else
+                return -1;
             return 0;
         }
     }
@@ -289,6 +293,12 @@ int CHG_TARIFF::Start(void *, const char * el, const char ** attr)
             td.tariffConf.period = TARIFF::StringToPeriod(attr[1]);
             return 0;
         }
+
+        if (strcasecmp(el, "ChangePolicy") == 0)
+        {
+            td.tariffConf.changePolicy = TARIFF::StringToChangePolicy(attr[1]);
+            return 0;
+        }
     }
     return -1;
 }