diff --git a/src/Calc/Calc.php b/src/Calc/Calc.php index 417daec..523b6d8 100644 --- a/src/Calc/Calc.php +++ b/src/Calc/Calc.php @@ -85,7 +85,11 @@ class Calc if($collection->getName() == "opt") continue; if($collection->getFormel() != "") { $formel = $this->formelCalc->parse($collection->getFormel()); - eval('$var = ' . $formel . ';'); + if(preg_match("/^[a-z](.*)/", $formel)) { + eval('$var = "' . $formel . '";'); + }else{ + eval('$var = ' . $formel . ';'); + } }else{ if(!isset($this->engine->getVariables()[$collection->getName()])) { $var = 'XXXXXXXXXXXX'; diff --git a/src/Calc/CalcValues.php b/src/Calc/CalcValues.php index 9dc95b9..1febd14 100644 --- a/src/Calc/CalcValues.php +++ b/src/Calc/CalcValues.php @@ -90,7 +90,12 @@ class CalcValues if($collection->getName() == "opt") continue; if($collection->getFormel() != "") { $formel = $this->formelCalc->parse($collection->getFormel()); - eval('$var = ' . $formel . ';'); + if(preg_match("/^[a-z](.*)/", $formel)) { + eval('$var = "' . $formel . '";'); + }else{ + eval('$var = ' . $formel . ';'); + } + }else{ if(!isset($this->engine->getVariables()[$collection->getName()])) { $var = 'XXXXXXXX'; @@ -126,4 +131,4 @@ class CalcValues return $price; } -} \ No newline at end of file +} diff --git a/src/Option/Type/Template.php b/src/Option/Type/Template.php index 6f5b819..01471c8 100644 --- a/src/Option/Type/Template.php +++ b/src/Option/Type/Template.php @@ -12,7 +12,7 @@ class Template extends Base /** * @return String */ - public function getSelect(): String + public function getSelect() { return $this->select; } @@ -20,7 +20,7 @@ class Template extends Base /** * @param String $select */ - public function setSelect(String $select): void + public function setSelect($select) { $this->select = $select; } diff --git a/tests/Customer/A/formels.txt b/tests/Customer/A/formels.txt index 42fb7de..b71179f 100644 --- a/tests/Customer/A/formels.txt +++ b/tests/Customer/A/formels.txt @@ -693,10 +693,10 @@ if(!function_exists('getSammelformMengenAbschlagPlano')) { function getMaschine($breite, $hoehe) { if($breite > 49 || $hoehe > 49) { - return '"kba"'; + return 'kba'; } - return '"gto"'; + return 'gto'; } function getGeiferRand($format) { @@ -730,4 +730,4 @@ if(!function_exists('getSammelformMengenAbschlagPlano')) { } -} \ No newline at end of file +}