This commit is contained in:
Thomas Peterson 2025-07-18 20:30:41 +02:00
parent 017a7931b3
commit 4a2fed26de
11 changed files with 1714 additions and 1279 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
<?php
namespace PSC\Library\Calc\Calc;
use PSC\Library\Calc\Article;
@ -10,15 +11,14 @@ use PSC\Library\Calc\General\Type\EdgeCollection;
use PSC\Library\Calc\General\Type\EdgeCollectionContainer;
use PSC\Library\Calc\Option\Type\Base;
use PSC\Library\Calc\Option\Type\Checkbox;
use PSC\Library\Calc\Option\Type\ColorDBSelect;
use PSC\Library\Calc\Option\Type\Input;
use PSC\Library\Calc\Option\Type\Row;
use PSC\Library\Calc\Option\Type\Select;
use PSC\Library\Calc\Option\Type\ColorDBSelect;
use PSC\Library\Calc\Option\Type\Select\ColorOpt;
class Valid
{
/** @var Engine */
protected $engine = null;
@ -42,40 +42,40 @@ class Valid
private function validRec(\ArrayIterator $options, $withFormel = true): void
{
foreach($options as $option) {
if($option instanceof Row) {
foreach($option->getColumns() as $col) {
foreach ($options as $option) {
if ($option instanceof Row) {
foreach ($option->getColumns() as $col) {
$this->validRec($col->getOptions(), $withFormel);
}
}
if($option instanceof Input) {
if($option->getMaxValue() && $option->getRawValue() > $option->getMaxValue()) {
if ($option instanceof Input) {
if ($option->getMaxValue() && $option->getRawValue() > $option->getMaxValue()) {
$option->addValidationError(new Max(intval($option->getRawValue()), $option->getMaxValue()));
}
if($option->getMinValue() && $option->getRawValue() < $option->getMinValue()) {
if ($option->getMinValue() && $option->getRawValue() < $option->getMinValue()) {
$option->addValidationError(new Min(intval($option->getRawValue()), $option->getMinValue()));
}
}
if(($option instanceof Select || $option instanceof Checkbox) && !($option instanceOf ColorDBSelect)) {
if (($option instanceof Select || $option instanceof Checkbox) && !($option instanceof ColorDBSelect)) {
$valid = false;
$nextShouldBeValid = false;
$isDefaultValid = true;
$option->clearSelected();
/** @var Select\Opt $opt */
foreach ($option->getOptions() as $opt) {
if(count($opt->getEdgesCollectionContainer()) > 0) {
if (count($opt->getEdgesCollectionContainer()) > 0) {
$opt->setIsValid(false);
}
$groupsValid = [];
/** @var EdgeCollection $collection */
foreach($opt->getEdgesCollectionContainer() as $collection) {
if(!$withFormel && trim($collection->getFormel()) != "") continue;
foreach ($opt->getEdgesCollectionContainer() as $collection) {
if (!$withFormel && trim($collection->getFormel()) != '')
continue;
$groupsValid[$collection->getName()] = false;
if(trim($collection->getFormel()) != "") {
if (trim($collection->getFormel()) != '') {
$value = $this->formelCalc->parse($collection->getFormel(), true);
eval('$value = ' . $value . ';');
/** @var Edge $edge */
@ -85,7 +85,7 @@ class Valid
$groupsValid[$collection->getName()] = true;
}
}
}else {
} else {
/** @var Edge $edge */
foreach ($collection as $edge) {
if ($this->edgeIsValid($collection->getName(), $edge)) {
@ -96,44 +96,57 @@ class Valid
}
}
if(!in_array(false, $groupsValid)) {
if (!in_array(false, $groupsValid)) {
$opt->setIsValid(true);
}
if(!$opt->isValid() && $opt->getId() == $option->getDefault() && $option->getSelectedOptions()->count() == 0) {
if (
!$opt->isValid() &&
$opt->getId() == $option->getDefault() &&
$option->getSelectedOptions()->count() == 0
) {
$isDefaultValid = false;
}
if($option->getDefault() === null && $opt->isValid()) {
if ($option->getDefault() === null && $opt->isValid()) {
$option->setDefault($opt->getId());
if(!$this->engine->hasVariable($option->getId())) {
if (!$this->engine->hasVariable($option->getId())) {
$this->engine->setVariable($option->getId(), $opt->getId());
}
}
if($option->getDefault() !== null && $opt->isValid() && !$isDefaultValid) {
if ($option->getDefault() !== null && $opt->isValid() && !$isDefaultValid) {
$option->setDefault($opt->getId());
$this->engine->setVariable($option->getId(), $opt->getId());
if(isset($this->engine->validVars[$option->getId()]) && $opt->getId() != $this->engine->validVars[$option->getId()]) {
if (
isset($this->engine->validVars[$option->getId()]) &&
$opt->getId() != $this->engine->validVars[$option->getId()]
) {
$this->engine->validDirty = true;
}
$isDefaultValid = true;
}
if($option instanceof Checkbox) {
if (isset($this->engine->getVariables()[$option->getId()]) && is_array($this->engine->getVariables()[$option->getId()]) && in_array($opt->getId(), $this->engine->getVariables()[$option->getId()])) {
if ($option instanceof Checkbox) {
if (
isset($this->engine->getVariables()[$option->getId()]) &&
is_array($this->engine->getVariables()[$option->getId()]) &&
in_array($opt->getId(), $this->engine->getVariables()[$option->getId()])
) {
$option->addSelectedOption($opt);
}
}else {
if (isset($this->engine->getVariables()[$option->getId()]) && $this->engine->getVariables()[$option->getId()] == $opt->getId()) {
if(!$opt->isValid()) {
} else {
if (
isset($this->engine->getVariables()[$option->getId()]) &&
$this->engine->getVariables()[$option->getId()] == $opt->getId()
) {
if (!$opt->isValid()) {
$nextShouldBeValid = true;
} else {
$option->addSelectedOption($opt);
}
} else {
if($nextShouldBeValid && $opt->isValid()) {
if ($nextShouldBeValid && $opt->isValid()) {
$this->engine->getVariables()[$option->getId()] = $opt->getId();
$option->addSelectedOption($opt);
$nextShouldBeValid = false;
@ -141,14 +154,14 @@ class Valid
}
}
if($opt->isValid() && !$valid) {
if ($opt->isValid() && !$valid) {
$valid = true;
}
}
if($nextShouldBeValid && $option->getSelectedOptions()->count() === 0) {
foreach($option->getOptions() as $opt) {
if($opt->isValid()) {
if ($nextShouldBeValid && $option->getSelectedOptions()->count() === 0) {
foreach ($option->getOptions() as $opt) {
if ($opt->isValid()) {
$option->addSelectedOption($opt);
break;
}
@ -157,54 +170,51 @@ class Valid
$option->processValue();
$option->setIsValid($valid);
}
if($option instanceof ColorDBSelect) {
if ($option instanceof ColorDBSelect) {
if (isset($this->engine->getVariables()[$option->getId()])) {
$element = array_find((array)$option->getOptions(), function(ColorOpt $o1) use ($option) {
$element = array_find((array) $option->getOptions(), function (ColorOpt $o1) use ($option) {
return $o1->getId() === $this->engine->getVariables()[$option->getId()];
});
if($element) {
if ($element) {
$option->addSelectedOption($element);
}else{
} else {
$option->addSelectedOption($option->getOptions()[0]);
}
}elseif($option->getDefault() != null) {
$element = array_find((array)$option->getOptions(), function(ColorOpt $o1) use ($option) {
} elseif ($option->getDefault() != null) {
$element = array_find((array) $option->getOptions(), function (ColorOpt $o1) use ($option) {
return $o1->getId() === $option->getDefault();
});
$option->addSelectedOption($element);
}else{
} else {
$option->addSelectedOption($option->getOptions()[0]);
}
}
$mainEdges = true;
foreach($option->getEdgesCollectionContainer() as $collection) {
foreach ($option->getEdgesCollectionContainer() as $collection) {
/** @var Edge $edge */
$collValid = false;
foreach($collection as $edge) {
if(!$collValid && $this->edgeIsValid($collection->getName(), $edge)) {
$collValid = true;
foreach ($collection as $edge) {
if (!$collValid && $this->edgeIsValid($collection->getName(), $edge)) {
$collValid = true;
}
}
if(!$collValid) {
if (!$collValid) {
$mainEdges = false;
break;
}
}
}
if(!$mainEdges && $option->isValid()) {
if (!$mainEdges && $option->isValid()) {
$option->setIsValid(false);
}
$this->engine->setVariables($option->parseAdditionalValues($this->engine->getVariables()));
$this->engine->addCalcVariable($option->getId() . '_valid', (int)$option->isValid());
$this->engine->addCalcVariable($option->getId() . '_valid', (int) $option->isValid());
}
}
private function edgeIsValid(mixed $section, Edge $edge): bool
@ -212,37 +222,49 @@ class Valid
$valid = false;
$skipTests = false;
if(!isset($this->engine->getVariables()[$section])) {
if (!isset($this->engine->getVariables()[$section])) {
$skipTests = true;
}
if(!$skipTests && !$valid && $edge->isRegion() &&
$edge->getFrom() <= $this->engine->getVariables()[$section] &&
$edge->getTo() >= $this->engine->getVariables()[$section]) {
if (
!$skipTests &&
!$valid &&
$edge->isRegion() &&
$edge->getFrom() <= $this->engine->getVariables()[$section] &&
$edge->getTo() >= $this->engine->getVariables()[$section]
) {
$valid = true;
}
if(!$skipTests && !$valid && $edge->isRegion() &&
$edge->getFrom() <= $this->engine->getVariables()[$section] &&
$edge->getTo() == 0) {
if (
!$skipTests &&
!$valid &&
$edge->isRegion() &&
$edge->getFrom() <= $this->engine->getVariables()[$section] &&
$edge->getTo() == 0
) {
$valid = true;
}
if(!$skipTests && !$valid && !$edge->isRegion() && in_array($this->engine->getVariables()[$section], $edge->getValues())) {
$valid = true;
if (
!$skipTests &&
!$valid &&
!$edge->isRegion() &&
in_array($this->engine->getVariables()[$section], $edge->getValues())
) {
$valid = true;
}
if(!$skipTests && $valid && $edge->getEdgesCollectionContainer()->count()) {
if (!$skipTests && $valid && $edge->getEdgesCollectionContainer()->count()) {
$valid = false;
/** @var EdgeCollection $collection */
foreach($edge->getEdgesCollectionContainer() as $collection) {
foreach($collection as $subEdge) {
if(!$valid) {
foreach ($edge->getEdgesCollectionContainer() as $collection) {
foreach ($collection as $subEdge) {
if (!$valid) {
$valid = $this->edgeIsValid($collection->getName(), $subEdge);
}
}
}
}
return $valid;
@ -250,19 +272,15 @@ class Valid
private function edgeIsValidWithValue(mixed $value, Edge $edge): bool
{
if($edge->isRegion() &&
$edge->getFrom() <= $value &&
$edge->getTo() >= $value) {
if ($edge->isRegion() && $edge->getFrom() <= $value && $edge->getTo() >= $value) {
return true;
}
if($edge->isRegion() &&
$edge->getFrom() <= $value &&
$edge->getTo() == 0) {
if ($edge->isRegion() && $edge->getFrom() <= $value && $edge->getTo() == 0) {
return true;
}
if(!$edge->isRegion() && in_array($value, $edge->getValues())) {
if (!$edge->isRegion() && in_array($value, $edge->getValues())) {
return true;
}

View File

@ -215,6 +215,9 @@ class Select extends Base
$this->element->setColorSystem($colorSystem);
$this->element->addOptions($value);
if ($this->element->getDefault() != '') {
$this->element->addSelectedOption($this->element->getOptionById($this->element->getDefault()));
}
}
private function parseModeColorDbJson(): void
@ -256,6 +259,9 @@ class Select extends Base
$this->element->setColorSystem($colorSystem);
$this->element->addOptions($value);
if ($this->element->getDefault() != '') {
$this->element->addSelectedOption($this->element->getOptionById($this->element->getDefault()));
}
}
private function parseModeNormalXML()

View File

@ -1,4 +1,5 @@
<?php
namespace PSC\Library\Calc\Option\Type;
use PSC\Library\Calc\Error\Validation\Base as PSCBase;
@ -17,11 +18,11 @@ class Base
protected $default = null;
/** @var string $help */
protected ?string $help = null;
protected null|string $help = null;
protected ?string $helpLink = null;
protected null|string $helpLink = null;
protected ?string $helpId = null;
protected null|string $helpId = null;
/** @var boolean $require */
protected $require = false;
@ -160,7 +161,7 @@ class Base
$this->default = $default;
}
public function getHelp(): ?string
public function getHelp(): null|string
{
return $this->help;
}
@ -175,7 +176,7 @@ class Base
$this->helpId = $var;
}
public function getHelpId(): ?string
public function getHelpId(): null|string
{
return $this->helpId;
}
@ -185,7 +186,7 @@ class Base
$this->helpLink = $var;
}
public function getHelpLink(): ?string
public function getHelpLink(): null|string
{
return $this->helpLink;
}
@ -201,7 +202,7 @@ class Base
/**
* @param string $rawValue
*/
public function setRawValue($rawValue)
public function setRawValue(mixed $rawValue): void
{
$this->rawValue = $rawValue;
}
@ -331,12 +332,13 @@ class Base
$this->amount = $amount;
}
public function toArray() : array {
public function toArray(): array
{
return [
'id' => $this->getId(),
'name' => $this->getName(),
'type' => $this->getType(),
'valid' => $this->isValid()
'valid' => $this->isValid(),
];
}
@ -345,18 +347,18 @@ class Base
$obj = new \stdClass();
$obj->id = $this->getId();
$obj->name = $this->getName();
if($this->default !== null) {
if ($this->default !== null) {
$obj->default = $this->default;
}
$obj->dependencys = [];
if($this->isAjaxExport()) {
if ($this->isAjaxExport()) {
$obj->exportAjax = $this->isAjaxExport();
}
if($this->isDisplayOnly()) {
if ($this->isDisplayOnly()) {
$obj->displayOnly = $this->isDisplayOnly();
}
foreach($this->edgesCollectionContainer as $col) {
foreach ($this->edgesCollectionContainer as $col) {
$obj->dependencys[] = $col->generateJson();
}
@ -369,24 +371,24 @@ class Base
'_attributes' => [
'id' => $this->getId(),
'type' => ucfirst($this->getType()),
]
],
];
if($this->name != "") {
if ($this->name != '') {
$tmp = array_merge_recursive($tmp, ['_attributes' => [
'name' => $this->name
'name' => $this->name,
]]);
}
if($this->isDisplayOnly()) {
if ($this->isDisplayOnly()) {
$tmp = array_merge_recursive($tmp, ['_attributes' => [
'displayOnly' => $this->isDisplayOnly()?'1':'0'
'displayOnly' => $this->isDisplayOnly() ? '1' : '0',
]]);
}
if($this->isAjaxExport()) {
if ($this->isAjaxExport()) {
$tmp = array_merge_recursive($tmp, ['_attributes' => [
'exportAjax' => $this->isAjaxExport()?'1':'0'
'exportAjax' => $this->isAjaxExport() ? '1' : '0',
]]);
}
foreach($this->edgesCollectionContainer as $col) {
foreach ($this->edgesCollectionContainer as $col) {
$tmp[$col->getName()] = $col->generateXML();
}

View File

@ -39,6 +39,11 @@ class Select extends Base
$this->options->append($option);
}
public function getOptionById(string $id): null|Opt
{
return array_find((array) $this->options, fn($item) => $item->getId() == $id);
}
public function addOptions(array $options)
{
$this->options = new \ArrayIterator($options);
@ -56,6 +61,14 @@ class Select extends Base
}
}
public function setRawValue(mixed $value): void
{
parent::setRawValue($value);
if ($this->getSelectedOption() === null || $this->getSelectedOption()->getId() != $value) {
$this->addSelectedOption($this->getOptionById($value));
}
}
public function getValue()
{
$this->processValue();
@ -88,14 +101,16 @@ class Select extends Base
$this->container = $container;
}
/**
* @return \ArrayIterator
*/
public function getOptions()
public function getOptions(): \ArrayIterator
{
return $this->options;
}
public function clearOptions(): void
{
$this->options = [];
}
public function clearSelected(): void
{
$this->selectedOptions = new \ArrayIterator();

View File

@ -1,4 +1,5 @@
<?php
namespace PSC\Library\Calc\Tests\Calc;
use PHPUnit\Framework\TestCase;
@ -42,4 +43,17 @@ class ColorDBTest extends TestCase
$this->assertSame('78', $option->getSelectedOption()->getId());
}
public function testSetVar()
{
$this->engine->setVariable('colorpantone', '128');
$this->engine->calc();
$this->assertSame(
'128',
$this->engine
->getArticle()
->getOptionById('colorpantone')
->getRawValue(),
);
}
}

View File

@ -1,4 +1,5 @@
<?php
namespace PSC\Library\Calc\Tests\Customer\GG;
use PHPUnit\Framework\TestCase;
@ -10,7 +11,6 @@ use PSC\Library\Calc\Tests\Mock\PaperRepostory;
class CalcTest extends TestCase
{
/** @var Engine */
protected $engine = null;
@ -29,8 +29,6 @@ class CalcTest extends TestCase
$this->engine->setTemplates(file_get_contents(__DIR__ . '/calcTemplates.xml'));
$this->engine->loadString(file_get_contents(__DIR__ . '/calc.xml'));
}
public function tearDown(): void
@ -52,8 +50,19 @@ class CalcTest extends TestCase
$this->engine->setVariable('farbe_2_v_wert_pantone', '7555');
$this->engine->calc();
$this->assertSame(175.75, $this->engine->getPrice());
$this->assertSame($this->engine->getArticle()->getOptionById('farbe_1_v_wert_pantone')->getRawValue(), '128');
$this->assertSame($this->engine->getArticle()->getOptionById('farbe_2_v_wert_pantone')->getRawValue(), '7555');
$this->assertSame(
$this->engine
->getArticle()
->getOptionById('farbe_1_v_wert_pantone')
->getRawValue(),
'128',
);
$this->assertSame(
$this->engine
->getArticle()
->getOptionById('farbe_2_v_wert_pantone')
->getRawValue(),
'7555',
);
}
}

View File

@ -1,4 +1,5 @@
<?php
namespace PSC\Library\Calc\Tests\Json;
use PHPUnit\Framework\TestCase;
@ -11,31 +12,34 @@ class FromJsonTest extends TestCase
public function testFromJson()
{
$engine1 = new Engine();
self::assertTrue($engine1->loadJson(file_get_contents(__DIR__ .'/from.json')));
self::assertTrue($engine1->loadJson(file_get_contents(__DIR__ . '/from.json')));
self::assertCount(1, $engine1->getArticles());
self::assertInstanceOf(Input::class, $engine1->getArticle()->getOptionById('auflage'));
$engine2 = new Engine();
self::assertTrue($engine2->loadString(file_get_contents(__DIR__ .'/from.xml')));
self::assertTrue($engine2->loadString(file_get_contents(__DIR__ . '/from.xml')));
self::assertCount(1, $engine2->getArticles());
self::assertInstanceOf(Input::class, $engine2->getArticle()->getOptionById('auflage'));
self::assertSame(1011.42, $engine1->getPrice());
self::assertSame($engine1->getPrice(), $engine2->getPrice());
self::assertEqualsCanonicalizing(
$engine1->getArticle()->getOptionById('farbe1')->getSelectedOption(),
$engine2->getArticle()->getOptionById('farbe1')->getSelectedOption(),
);
self::assertEqualsCanonicalizing($engine1->getArticle(), $engine2->getArticle());
$tempXML = tempnam(sys_get_temp_dir(), 'calc');
$tempJson = tempnam(sys_get_temp_dir(), 'calc');
file_put_contents($tempXML, $engine1->generateXML());
file_put_contents($tempJson, $engine2->generateJson());
self::assertJsonFileEqualsJsonFile(__DIR__.'/from.json', $tempJson);
self::assertXmlFileEqualsXmlFile(__DIR__.'/from.xml', $tempXML);
self::assertJsonFileEqualsJsonFile(__DIR__ . '/from.json', $tempJson);
self::assertXmlFileEqualsXmlFile(__DIR__ . '/from.xml', $tempXML);
self::assertCount(5, $engine1->getArticle()->getOptionById('farbigkeit')->getOptions());
self::assertCount(5, $engine2->getArticle()->getOptionById('farbigkeit')->getOptions());
@unlink($tempXML);
@unlink($tempJson);
unlink($tempXML);
unlink($tempJson);
}
}

View File

@ -1 +1,297 @@
[{"uuid":"df2df718-b28e-482d-bf0c-67d246f05d32","name":"Test Artikel","options":[{"id":"auflage","name":"Auflage","default":"100","dependencys":[],"placeHolder":"Placeholder","required":false,"type":2},{"id":"seiten_umschlag","name":"Seiten Umschlag","default":"2","dependencys":[],"placeHolder":"Placeholder","required":false,"type":2},{"id":"seiten_anzahl_inhalt","name":"Seiten Anzahl Inhalt","default":"10","dependencys":[{"relation":"auflage","formula":"","borders":[{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"$Vauflage$V*0.12","price":0,"value":"1-10","dependencys":[{"relation":"seiten_umschlag","formula":"","borders":[{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"$Vseiten_umschlag$V*0.24","price":0,"value":"1-2","dependencys":[]},{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"$Vseiten_umschlag$V*0.23","price":0,"value":"3-","dependencys":[]}]}]},{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"$Vauflage$V*0.11","price":0,"value":"11-","dependencys":[{"relation":"seiten_umschlag","formula":"","borders":[{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"$Vseiten_umschlag$V*0.21","price":0,"value":"1-2","dependencys":[]},{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"$Vseiten_umschlag$V*0.20","price":0,"value":"3-","dependencys":[]}]}]}]}],"placeHolder":"Placeholder","required":true,"type":2},{"id":"farbigkeit","name":"Farbigkeit","default":"10","dependencys":[],"type":3,"options":[{"id":"10","name":"1\/0 farbig","dependencys":[{"relation":"auflage","formula":"","borders":[{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"","price":0,"value":"1-101","dependencys":[]}]}]},{"id":"11","name":"1\/1 farbig","dependencys":[]},{"id":"20","name":"2\/0 farbig","dependencys":[]},{"id":"21","name":"2\/1 farbig","dependencys":[]},{"id":"22","name":"2\/2 farbig","dependencys":[{"relation":"auflage","formula":"","borders":[{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"","price":0,"value":"11-50","dependencys":[]}]}]}],"mode":"normal"},{"id":"calc","name":"calc","dependencys":[{"relation":"auflage","formula":"","borders":[{"calcValue":"","calcValue1":"","calcValue2":"","calcValue3":"","calcValue4":"","calcValue5":"","calcValue6":"","calcValue7":"","calcValue8":"","calcValue9":"","calcValue10":"","flatRate":"","formula":"$Vauflage$V*$Vseiten_anzahl_inhalt$V","price":0,"value":"1-","dependencys":[]}]}],"type":1}]}]
[
{
"uuid": "df2df718-b28e-482d-bf0c-67d246f05d32",
"name": "Test Artikel",
"options": [
{
"id": "auflage",
"name": "Auflage",
"default": "100",
"dependencys": [],
"placeHolder": "Placeholder",
"required": false,
"type": 2
},
{
"id": "seiten_umschlag",
"name": "Seiten Umschlag",
"default": "2",
"dependencys": [],
"placeHolder": "Placeholder",
"required": false,
"type": 2
},
{
"id": "farbe1",
"name": "Farbe1",
"default": "142",
"container": "pantone+-solid-uncoated",
"mode": "colordb",
"dependencys": [],
"required": true,
"options": [
{
"dependencys": [],
"id": "142",
"name": "142"
}
],
"type": 3
},
{
"id": "seiten_anzahl_inhalt",
"name": "Seiten Anzahl Inhalt",
"default": "10",
"dependencys": [
{
"relation": "auflage",
"formula": "",
"borders": [
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "$Vauflage$V*0.12",
"price": 0,
"value": "1-10",
"dependencys": [
{
"relation": "seiten_umschlag",
"formula": "",
"borders": [
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "$Vseiten_umschlag$V*0.24",
"price": 0,
"value": "1-2",
"dependencys": []
},
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "$Vseiten_umschlag$V*0.23",
"price": 0,
"value": "3-",
"dependencys": []
}
]
}
]
},
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "$Vauflage$V*0.11",
"price": 0,
"value": "11-",
"dependencys": [
{
"relation": "seiten_umschlag",
"formula": "",
"borders": [
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "$Vseiten_umschlag$V*0.21",
"price": 0,
"value": "1-2",
"dependencys": []
},
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "$Vseiten_umschlag$V*0.20",
"price": 0,
"value": "3-",
"dependencys": []
}
]
}
]
}
]
}
],
"placeHolder": "Placeholder",
"required": true,
"type": 2
},
{
"id": "farbigkeit",
"name": "Farbigkeit",
"default": "10",
"dependencys": [],
"type": 3,
"options": [
{
"id": "10",
"name": "1\/0 farbig",
"dependencys": [
{
"relation": "auflage",
"formula": "",
"borders": [
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "",
"price": 0,
"value": "1-101",
"dependencys": []
}
]
}
]
},
{
"id": "11",
"name": "1\/1 farbig",
"dependencys": []
},
{
"id": "20",
"name": "2\/0 farbig",
"dependencys": []
},
{
"id": "21",
"name": "2\/1 farbig",
"dependencys": []
},
{
"id": "22",
"name": "2\/2 farbig",
"dependencys": [
{
"relation": "auflage",
"formula": "",
"borders": [
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "",
"price": 0,
"value": "11-50",
"dependencys": []
}
]
}
]
}
],
"mode": "normal"
},
{
"id": "calc",
"name": "calc",
"dependencys": [
{
"relation": "auflage",
"formula": "",
"borders": [
{
"calcValue": "",
"calcValue1": "",
"calcValue2": "",
"calcValue3": "",
"calcValue4": "",
"calcValue5": "",
"calcValue6": "",
"calcValue7": "",
"calcValue8": "",
"calcValue9": "",
"calcValue10": "",
"flatRate": "",
"formula": "$Vauflage$V*$Vseiten_anzahl_inhalt$V",
"price": 0,
"value": "1-",
"dependencys": []
}
]
}
],
"type": 1
}
]
}
]

View File

@ -7,10 +7,14 @@
<option id="auflage" name="Auflage" type="Input" placeholder="Placeholder" default="100"></option>
<option id="seiten_umschlag" name="Seiten Umschlag" type="Input" default="2" placeholder="Placeholder"></option>
<option id="seiten_umschlag" name="Seiten Umschlag" type="Input" default="2"
placeholder="Placeholder"></option>
<option id="farbe1" name="Farbe1" type="Select"
mode="colordb" container="pantone+-solid-uncoated" default="142" require="true" />
<option id="seiten_anzahl_inhalt" name="Seiten Anzahl Inhalt" type="Input" default="10" require="true" placeholder="Placeholder">
<option id="seiten_anzahl_inhalt" name="Seiten Anzahl Inhalt" type="Input" default="10"
require="true" placeholder="Placeholder">
<auflage>
<grenze formel="$Vauflage$V*0.12" value="1-10">
<seiten_umschlag>

View File

@ -7,6 +7,9 @@
<option id="auflage" name="Auflage" type="Input" placeholder="Placeholder" default="100"></option>
<option id="farbe1" name="Farbe1" type="Select"
mode="colordb" container="pantone+-solid-uncoated" default="142" require="true" />
<option id="startkosten_1c" name="Startkosten 1C" type="Hidden" default="1">
<farbigkeit_inhalt>
<!-- einfarbiger Inhalt -->