This commit is contained in:
Thomas Peterson 2021-12-07 16:19:33 +00:00
parent c13767b01b
commit 8d98e33712
2 changed files with 64 additions and 26 deletions

View File

@ -114,7 +114,11 @@ class Calc
if($edge->getCalcValue() != "") { if($edge->getCalcValue() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue()); $cv = $this->formelCalc->parse($edge->getCalcValue());
eval('$cv = ' . $cv . ';'); try {
eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($option->getId() . '_' . $collection->getName(), $cv); $this->engine->addCalcVariable($option->getId() . '_' . $collection->getName(), $cv);
$this->engine->setCalcVaribleStack($cv, $calcValueId); $this->engine->setCalcVaribleStack($cv, $calcValueId);
} }
@ -180,4 +184,4 @@ class Calc
return str_replace(',', '.', $value); return str_replace(',', '.', $value);
} }
} }

View File

@ -115,34 +115,47 @@ class CalcValues
if ($edge->getCalcValue() != "") { if ($edge->getCalcValue() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue()); $cv = $this->formelCalc->parse($edge->getCalcValue());
eval('$cv = ' . $cv . ';'); try {
eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id, $cv); $this->engine->addCalcVariable($id, $cv);
$this->engine->addCalcVariable($id . '_' . $collection->getName(), $cv); $this->engine->addCalcVariable($id . '_' . $collection->getName(), $cv);
} }
if ($edge->getCalcValue1() != "") { if ($edge->getCalcValue1() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue1()); $cv = $this->formelCalc->parse($edge->getCalcValue1());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_1', $cv); $this->engine->addCalcVariable($id . '_1', $cv);
$this->engine->addCalcVariable($id . '_' . $collection->getName() . '_1', $cv); $this->engine->addCalcVariable($id . '_' . $collection->getName() . '_1', $cv);
} }
if ($edge->getCalcValue2() != "") { if ($edge->getCalcValue2() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue2()); $cv = $this->formelCalc->parse($edge->getCalcValue2());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_2', $cv); $this->engine->addCalcVariable($id . '_2', $cv);
$this->engine->addCalcVariable($id . '_' . $collection->getName() . '_2', $cv); $this->engine->addCalcVariable($id . '_' . $collection->getName() . '_2', $cv);
} }
if ($edge->getCalcValue3() != "") { if ($edge->getCalcValue3() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue3()); $cv = $this->formelCalc->parse($edge->getCalcValue3());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_3', $cv); $this->engine->addCalcVariable($id . '_3', $cv);
@ -150,8 +163,11 @@ class CalcValues
} }
if ($edge->getCalcValue4() != "") { if ($edge->getCalcValue4() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue4()); $cv = $this->formelCalc->parse($edge->getCalcValue4());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_4', $cv); $this->engine->addCalcVariable($id . '_4', $cv);
@ -159,8 +175,11 @@ class CalcValues
} }
if ($edge->getCalcValue5() != "") { if ($edge->getCalcValue5() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue5()); $cv = $this->formelCalc->parse($edge->getCalcValue5());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_5', $cv); $this->engine->addCalcVariable($id . '_5', $cv);
@ -168,8 +187,11 @@ class CalcValues
} }
if ($edge->getCalcValue6() != "") { if ($edge->getCalcValue6() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue6()); $cv = $this->formelCalc->parse($edge->getCalcValue6());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_6', $cv); $this->engine->addCalcVariable($id . '_6', $cv);
@ -177,8 +199,11 @@ class CalcValues
} }
if ($edge->getCalcValue7() != "") { if ($edge->getCalcValue7() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue7()); $cv = $this->formelCalc->parse($edge->getCalcValue7());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_7', $cv); $this->engine->addCalcVariable($id . '_7', $cv);
@ -186,8 +211,11 @@ class CalcValues
} }
if ($edge->getCalcValue8() != "") { if ($edge->getCalcValue8() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue8()); $cv = $this->formelCalc->parse($edge->getCalcValue8());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_8', $cv); $this->engine->addCalcVariable($id . '_8', $cv);
@ -195,8 +223,11 @@ class CalcValues
} }
if ($edge->getCalcValue9() != "") { if ($edge->getCalcValue9() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue9()); $cv = $this->formelCalc->parse($edge->getCalcValue9());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_9', $cv); $this->engine->addCalcVariable($id . '_9', $cv);
@ -204,8 +235,11 @@ class CalcValues
} }
if ($edge->getCalcValue10() != "") { if ($edge->getCalcValue10() != "") {
$cv = $this->formelCalc->parse($edge->getCalcValue10()); $cv = $this->formelCalc->parse($edge->getCalcValue10());
eval('$cv = ' . $cv . ';'); try {
//echo $id . ' '. $this->formelCalc->parse($edge->getCalcValue()) . ' ' . $cv . ' '. PHP_EOL.PHP_EOL; eval('@$cv = ' . $cv . ';');
}catch (\Throwable $e) {
$cv = 0;
}
$this->engine->addCalcVariable($id . '_10', $cv); $this->engine->addCalcVariable($id . '_10', $cv);