Fixes
This commit is contained in:
parent
6e8a3d1a7f
commit
ff0f6ca0d5
File diff suppressed because one or more lines are too long
@ -92,7 +92,7 @@ class Valid
|
|||||||
$opt->setIsValid(true);
|
$opt->setIsValid(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$opt->isValid() && $opt->getId() == $option->getDefault()) {
|
if(!$opt->isValid() && $opt->getId() == $option->getDefault() && $option->getSelectedOptions()->count() == 0) {
|
||||||
$isDefaultValid = false;
|
$isDefaultValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class Valid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($nextShouldBeValid) {
|
if($nextShouldBeValid && $option->getSelectedOptions()->count() === 0) {
|
||||||
foreach($option->getOptions() as $opt) {
|
foreach($option->getOptions() as $opt) {
|
||||||
if($opt->isValid()) {
|
if($opt->isValid()) {
|
||||||
$option->addSelectedOption($opt);
|
$option->addSelectedOption($opt);
|
||||||
|
|||||||
@ -10,6 +10,8 @@ class Select extends Base
|
|||||||
static public $modeColorDb = 'colordb';
|
static public $modeColorDb = 'colordb';
|
||||||
static public $modeDelivery = 'delivery';
|
static public $modeDelivery = 'delivery';
|
||||||
|
|
||||||
|
protected $multiSelect = false;
|
||||||
|
|
||||||
static public $modeNone = '';
|
static public $modeNone = '';
|
||||||
|
|
||||||
public $type = 'select';
|
public $type = 'select';
|
||||||
@ -112,6 +114,15 @@ class Select extends Base
|
|||||||
|
|
||||||
public function addSelectedOption(?Opt $opt): void
|
public function addSelectedOption(?Opt $opt): void
|
||||||
{
|
{
|
||||||
|
if(!$this->multiSelect) {
|
||||||
|
$this->selectedOptions = new \ArrayIterator([$opt]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach($this->selectedOptions as $sel) {
|
||||||
|
if($sel->getId() === $opt->getId()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->selectedOptions->append($opt);
|
$this->selectedOptions->append($opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class CalcComplexTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->engine->setVariable('produktart_nopresentationpdf', 2);
|
$this->engine->setVariable('produktart_nopresentationpdf', 2);
|
||||||
$this->engine->calc();
|
$this->engine->calc();
|
||||||
|
file_put_contents("/tmp/f1.txt", print_r($this->engine->getVariables(), true).print_r($this->engine->getDebugCalcVariables(), true).print_r($this->engine->getDebugCalcFormel(), true));
|
||||||
$this->assertSame(46.25, $this->engine->getPrice());
|
$this->assertSame(46.25, $this->engine->getPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,6 @@ class CalcTest extends TestCase
|
|||||||
public function testPrice(): void
|
public function testPrice(): void
|
||||||
{
|
{
|
||||||
$this->engine->calc();
|
$this->engine->calc();
|
||||||
file_put_contents("/tmp/f1.txt", print_r($this->engine->getVariables(), true).print_r($this->engine->getDebugCalcVariables(), true).print_r($this->engine->getDebugCalcFormel(), true));
|
|
||||||
self::assertSame(131.86, $this->engine->getPrice());
|
self::assertSame(131.86, $this->engine->getPrice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user