Skip to content
Snippets Groups Projects
Commit bdaedf12 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

salesproject: no state check on postponed when in recordstate new

parent 2f732d0a
No related branches found
No related tags found
No related merge requests found
...@@ -7,19 +7,22 @@ import("system.translate"); ...@@ -7,19 +7,22 @@ import("system.translate");
import("system.question"); import("system.question");
import("system.neon"); import("system.neon");
var state = vars.get("$field.STATE"); if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW)
// Postponed
if (state == '23d38486-4cce-41ce-a8df-164ad44df706')
{ {
var stateName = KeywordUtils.getViewValue($KeywordRegistry.salesprojectState(), state); var state = vars.get("$field.STATE");
var clearForecast = question.askYesNo(translate.withArguments("Clear forecast and set state to '%0'?", [stateName]), translate.withArguments("Would you really like to clear the forecast and set the state to '%0'?" + "\n" + translate.text("This cannot be undone!"), [stateName]), false);
// Postponed
if (!clearForecast) if (state == '23d38486-4cce-41ce-a8df-164ad44df706')
{ {
// reset to value from db var stateName = KeywordUtils.getViewValue($KeywordRegistry.salesprojectState(), state);
neon.setFieldValue("$field.STATE", db.cell(SqlCondition.begin() var clearForecast = question.askYesNo(translate.withArguments("Clear forecast and set state to '%0'?", [stateName]), translate.withArguments("Would you really like to clear the forecast and set the state to '%0'?" + "\n" + translate.text("This cannot be undone!"), [stateName]), false);
.andPrepareVars("SALESPROJECT.SALESPROJECTID", "$field.SALESPROJECTID")
.buildSql("select STATE from SALESPROJECT", "1=2"))); if (!clearForecast)
{
// reset to value from db
neon.setFieldValue("$field.STATE", db.cell(SqlCondition.begin()
.andPrepareVars("SALESPROJECT.SALESPROJECTID", "$field.SALESPROJECTID")
.buildSql("select STATE from SALESPROJECT", "1=2")));
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment