]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp
Add notifications in test tariffs class
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser_tariff.cpp
index e2daa336f45b4410a032e8d091e9607477e7c093..9bac0294bbc171d731ea169813cea5c14e58b966 100644 (file)
@@ -1,8 +1,8 @@
 #include <cstdio> // snprintf
 #include <cstring>
 
+#include "stg/tariffs.h"
 #include "parser.h"
-#include "tariffs.h"
 
 const int pt_mega = 1024 * 1024;
 //-----------------------------------------------------------------------------
@@ -180,7 +180,7 @@ void PARSER_ADD_TARIFF::CreateAnswer()
 //answerList->clear();
 answerList->erase(answerList->begin(), answerList->end());
 
-if (tariffs->Add(tariffToAdd, *currAdmin) == 0)
+if (tariffs->Add(tariffToAdd, currAdmin) == 0)
     {
     answerList->push_back("<AddTariff Result=\"Ok\"/>");
     }
@@ -228,7 +228,7 @@ if (users->TariffInUse(tariffToDel))
     return;
     }
 
-if (tariffs->Del(tariffToDel, *currAdmin) == 0)
+if (tariffs->Del(tariffToDel, currAdmin) == 0)
     {
     answerList->push_back("<DelTariff Result=\"Ok\"/>");
     }
@@ -388,7 +388,10 @@ else
         snprintf(st, 50, "Time%d", j);
         if (strcasecmp(el, st) == 0)
             {
-            int h1, m1, h2, m2;
+            int h1 = 0;
+            int m1 = 0;
+            int h2 = 0;
+            int m2 = 0;
             if (ParseTariffTimeStr(attr[1], h1, m1, h2, m2) == 0)
                 {
                 td.dirPrice[j].hDay = h1;
@@ -475,7 +478,7 @@ answerList->erase(answerList->begin(), answerList->end());
 if (!td.tariffConf.name.data().empty())
     {
     TARIFF_DATA tariffData = td.GetData();
-    if (tariffs->Chg(tariffData, *currAdmin) == 0)
+    if (tariffs->Chg(tariffData, currAdmin) == 0)
         {
         answerList->push_back("<SetTariff Result=\"ok\"/>");
         return;