Skip to content

Commit 5d4dd17

Browse files
Merge pull request #2802 from dpfaffenbauer/issue/2801
[Currency/MoneyBundle] check for max-value > 0
2 parents 49dd924 + 40b64a5 commit 5d4dd17

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/CoreShop/Bundle/CurrencyBundle/CoreExtension/MoneyCurrency.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, arr
263263
);
264264
}
265265

266-
if ((string) $this->getMaxValue() !== '' && $data->getValue() > $this->getMaxValue()) {
266+
if ((string) $this->getMaxValue() !== '' && $this->getMaxValue() > 0 && $data->getValue() > $this->getMaxValue()) {
267267
throw new Model\Element\ValidationException(
268268
'Value in field [ ' . $this->getName() . ' ] is bigger than ' . $this->getMaxValue(),
269269
);

src/CoreShop/Bundle/MoneyBundle/CoreExtension/Money.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public function checkValidity(mixed $data, bool $omitMandatoryCheck = false, arr
612612
throw new ValidationException('Value in field [ ' . $this->getName() . ' ] is not at least ' . $this->getMinValue());
613613
}
614614

615-
if (null !== $this->getMaxValue() && $data > $this->getMaxValue()) {
615+
if (null !== $this->getMaxValue() && $this->getMaxValue() > 0 && $data > $this->getMaxValue()) {
616616
throw new ValidationException('Value in field [ ' . $this->getName() . ' ] is bigger than ' . $this->getMaxValue());
617617
}
618618
}

0 commit comments

Comments
 (0)