X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8c11e9e35e0cd09e25f513c15dc0c4a0613aa2f0..d230cb2411b6d2d6603a930f165bbd3138831eeb:/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp
diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp
index a4531703..88ab2670 100644
--- a/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp
+++ b/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp
@@ -29,127 +29,131 @@ return -1;
//-----------------------------------------------------------------------------
void PARSER_GET_TARIFFS::CreateAnswer()
{
-std::string s;
-char vs[100];
-int hd, hn, md, mn;
-
-answerList->erase(answerList->begin(), answerList->end());
-
-answerList->push_back("");
+answer = "";
std::list dataList;
tariffs->GetTariffsData(&dataList);
std::list::const_iterator it = dataList.begin();
for (; it != dataList.end(); ++it)
{
- s = "tariffConf.name + "\">";
- answerList->push_back(s);
-
- for (int j = 0; j < DIR_NUM; j++)
- {
- hd = it->dirPrice[j].hDay;
- md = it->dirPrice[j].mDay;
-
- hn = it->dirPrice[j].hNight;
- mn = it->dirPrice[j].mNight;
+ answer += "tariffConf.name + "\">";
- strprintf(&s, "");
+ answer += "";
}
-answerList->push_back("");
+answer += "";
}
//-----------------------------------------------------------------------------
// ADD TARIFF
@@ -179,19 +183,10 @@ return -1;
//-----------------------------------------------------------------------------
void PARSER_ADD_TARIFF::CreateAnswer()
{
-//answerList->clear();
-answerList->erase(answerList->begin(), answerList->end());
-
if (tariffs->Add(tariffToAdd, currAdmin) == 0)
- {
- answerList->push_back("");
- }
+ answer = "";
else
- {
- std::string s;
- strprintf(&s, "", tariffs->GetStrError().c_str());
- answerList->push_back(s);
- }
+ answer = "GetStrError() + "\"/>";
}
//-----------------------------------------------------------------------------
// DEL TARIFF
@@ -219,27 +214,12 @@ return -1;
//-----------------------------------------------------------------------------
void PARSER_DEL_TARIFF::CreateAnswer()
{
-//answerList->clear();
-answerList->erase(answerList->begin(), answerList->end());
-
if (users->TariffInUse(tariffToDel))
- {
- std::string s;
- strprintf(&s, "", tariffToDel.c_str());
- answerList->push_back(s);
- return;
- }
-
-if (tariffs->Del(tariffToDel, currAdmin) == 0)
- {
- answerList->push_back("");
- }
+ answer = "";
+else if (tariffs->Del(tariffToDel, currAdmin) == 0)
+ answer = "";
else
- {
- std::string s;
- strprintf(&s, "", tariffs->GetStrError().c_str());
- answerList->push_back(s);
- }
+ answer = "GetStrError() + "\"/>";
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -481,24 +461,20 @@ return -1;
//-----------------------------------------------------------------------------
void PARSER_CHG_TARIFF::CreateAnswer()
{
-answerList->erase(answerList->begin(), answerList->end());
-
if (!td.tariffConf.name.data().empty())
{
TARIFF_DATA tariffData = td.GetData();
if (tariffs->Chg(tariffData, currAdmin) == 0)
{
- answerList->push_back("");
+ answer = "";
return;
}
else
{
- std::string s;
- strprintf(&s, "", tariffs->GetStrError().c_str());
- answerList->push_back(s);
+ answer = "GetStrError() + "\"/>";
return;
}
}
-answerList->push_back("");
+answer = "";
}
//-----------------------------------------------------------------------------