Commit cb85be5c authored by Tibor Katelbach's avatar Tibor Katelbach

budget clear bug

parent 709cc3a1
...@@ -52,8 +52,10 @@ $actions = PHDB::find(Actions::COLLECTION, [ ...@@ -52,8 +52,10 @@ $actions = PHDB::find(Actions::COLLECTION, [
"parentType" => Form::ANSWER_COLLECTION] ); "parentType" => Form::ANSWER_COLLECTION] );
//clear any existing todos //clear any existing todos
foreach ($answers as $ix => $a) { if(isset($answers)){
$answers[$ix]["todo"] = []; foreach ($answers as $ix => $a) {
$answers[$ix]["todo"] = [];
}
} }
//reset todo with actions //reset todo with actions
foreach ($actions as $id => $a) { foreach ($actions as $id => $a) {
...@@ -74,11 +76,13 @@ foreach ($actions as $id => $a) { ...@@ -74,11 +76,13 @@ foreach ($actions as $id => $a) {
} }
} }
//overload existing todo and add to answerObj //overload existing todo and add to answerObj
foreach ($answers as $ix => $a) { if(isset($answers)){
if(empty($answers[$ix]["todo"])) foreach ($answers as $ix => $a) {
unset($answers[$ix]["todo"]); if(empty($answers[$ix]["todo"]))
else unset($answers[$ix]["todo"]);
echo "<script>answerObj.answers.".$copyF.".".$budgetKey."[".$ix."].todo = ".json_encode($answers[$ix]["todo"]).";</script>"; else
echo "<script>answerObj.answers.".$copyF.".".$budgetKey."[".$ix."].todo = ".json_encode($answers[$ix]["todo"]).";</script>";
}
} }
$editBtnL = ""; $editBtnL = "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment