diff --git a/src/FilterService/FilterType/ElasticSearch/SelectCategory.php b/src/FilterService/FilterType/ElasticSearch/SelectCategory.php index 54d53ca14..b7ae82d14 100644 --- a/src/FilterService/FilterType/ElasticSearch/SelectCategory.php +++ b/src/FilterService/FilterType/ElasticSearch/SelectCategory.php @@ -70,7 +70,7 @@ public function addCondition(AbstractFilterDefinitionType $filterDefinition, Pro } elseif (empty($value) && !$isReload && method_exists($filterDefinition, 'getPreSelect')) { $value = $filterDefinition->getPreSelect(); if ($value instanceof ElementInterface) { - $value = $value->getId(); + $value = (string)$value->getId(); } } diff --git a/src/FilterService/FilterType/SelectFromMultiSelect.php b/src/FilterService/FilterType/SelectFromMultiSelect.php index 7769e3d2b..0b17013fa 100644 --- a/src/FilterService/FilterType/SelectFromMultiSelect.php +++ b/src/FilterService/FilterType/SelectFromMultiSelect.php @@ -67,7 +67,9 @@ public function addCondition(AbstractFilterDefinitionType $filterDefinition, Pro $value = $preSelect; } - $value = trim($value); + if ($value) { + $value = trim($value); + } $currentFilter[$field] = $value; $db = Db::get(); diff --git a/src/VoucherService/TokenManager/Single.php b/src/VoucherService/TokenManager/Single.php index 9f86a4cec..4ff915a7e 100644 --- a/src/VoucherService/TokenManager/Single.php +++ b/src/VoucherService/TokenManager/Single.php @@ -19,6 +19,7 @@ use Knp\Component\Pager\PaginatorInterface; use Pimcore\Bundle\EcommerceFrameworkBundle\CartManager\CartInterface; use Pimcore\Bundle\EcommerceFrameworkBundle\Exception\InvalidConfigException; +use Pimcore\Bundle\EcommerceFrameworkBundle\Exception\VoucherServiceException; use Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractOrder; use Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractVoucherTokenType; use Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\Reservation; @@ -259,6 +260,8 @@ public function checkToken(string $code, CartInterface $cart): bool if ($token->check((int)$this->configuration->getUsages())) { return true; } + + throw new VoucherServiceException('Max usage limit reached.', VoucherServiceException::ERROR_CODE_NO_MORE_USAGES); } return false;