X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/53536f012e78a3d28ca1290109667ce2aba794d7..7377ab11320e17a5368a731fa7b0d93cd9415e81:/projects/stargazer/plugins/store/files/file_store.cpp diff --git a/projects/stargazer/plugins/store/files/file_store.cpp b/projects/stargazer/plugins/store/files/file_store.cpp index 2a7eb6c1..51c37079 100644 --- a/projects/stargazer/plugins/store/files/file_store.cpp +++ b/projects/stargazer/plugins/store/files/file_store.cpp @@ -1465,6 +1465,19 @@ if (conf.ReadString("Period", &str, "month") < 0) td->tariffConf.period = TARIFF::MONTH; else td->tariffConf.period = TARIFF::StringToPeriod(str); + +if (conf.ReadString("ChangePolicy", &str, "allow") < 0) + td->tariffConf.changePolicy = TARIFF::ALLOW; +else + td->tariffConf.changePolicy = TARIFF::StringToChangePolicy(str); + +if (conf.ReadTime("ChangePolicyTimeout", &td->tariffConf.changePolicyTimeout, 0) < 0) + { + STG_LOCKER lock(&mutex); + errorStr = "Cannot read tariff " + tariffName + ". Parameter ChangePolicyTimeout"; + printfd(__FILE__, "FILES_STORE::RestoreTariff - changepolicytimeout read failed for tariff '%s'\n", tariffName.c_str()); + return -1; + } return 0; } //----------------------------------------------------------------------------- @@ -1526,6 +1539,8 @@ std::string fileName = storeSettings.GetTariffsDir() + "/" + tariffName + ".tf"; cf.WriteDouble("Free", td.tariffConf.free); cf.WriteString("TraffType", TARIFF::TraffTypeToString(td.tariffConf.traffType)); cf.WriteString("Period", TARIFF::PeriodToString(td.tariffConf.period)); + cf.WriteString("ChangePolicy", TARIFF::ChangePolicyToString(td.tariffConf.changePolicy)); + cf.WriteTime("ChangePolicyTimeout", td.tariffConf.changePolicyTimeout); } return 0;