Skip to content

Commit

Permalink
Merge branch '1.0' into 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Corepex committed May 2, 2024
2 parents 383325d + 95f272f commit 26dc7ce
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public function addCondition(AbstractFilterDefinitionType $filterDefinition, Pro
$value = $preSelect;
}

$value = trim($value);
if (!empty($value)) {
$value = trim($value);
}

$currentFilter[$field] = $value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public function get(object $object, array $config = null): mixed
if (is_bool($value) || $source['forceBool']) {
$values[] = $source['fieldname'];
} else {
$values[] = $value;
if(is_array($value)) {
$values = array_merge($values, $value);
} else {
$values[] = $value;
}
}
}
}
Expand All @@ -73,7 +77,11 @@ public function get(object $object, array $config = null): mixed
if (is_bool($value) || $source['forceBool']) {
$values[] = $source['fieldname'];
} else {
$values[] = $value;
if(is_array($value)) {
$values = array_merge($values, $value);
} else {
$values[] = $value;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/IndexService/ProductList/DefaultMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,9 @@ protected function buildOrderBy(): ?string

if ($this->getVariantMode() == ProductListInterface::VARIANT_MODE_INCLUDE_PARENT_OBJECT) {
if (strtoupper($this->order) == 'DESC') {
$orderByStringArray[] = 'max(`' . $key . '`) ' . $direction;
$orderByStringArray[] = 'max(' . $this->resource->quoteIdentifier($key) . ') ' . $direction;
} else {
$orderByStringArray[] = 'min(`' . $key . '`) ' . $direction;
$orderByStringArray[] = 'min(' . $this->resource->quoteIdentifier($key) . ') ' . $direction;
}
} else {
$orderByStringArray[] = $key . ' ' . $direction;
Expand Down
5 changes: 5 additions & 0 deletions src/IndexService/ProductList/DefaultMysql/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,9 @@ public function getLastRecordCount(): int
{
return $this->lastRecordCount;
}

public function quoteIdentifier(string $value): string
{
return $this->db->quoteIdentifier($value);
}
}
4 changes: 2 additions & 2 deletions src/OrderManager/V7/OrderAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,15 @@ public function setPaymentProvider(PaymentInterface $paymentProvider, AbstractOr

// update authorizedData
$authorizedData = $paymentProvider->getAuthorizedData();
foreach ((array)$authorizedData as $field => $value) {
foreach ($authorizedData as $field => $value) {
$setter = 'setAuth_' . $field;
if (method_exists($providerData, $setter)) {
$providerData->{$setter}($value);
}
}

if (method_exists($providerData, 'setPaymentFinished')) {
$providerData->setPaymentFinished(new \DateTime());
$providerData->setPaymentFinished(new Carbon());
}

if (method_exists($providerData, 'setConfigurationKey')) {
Expand Down
8 changes: 4 additions & 4 deletions src/PricingManager/Condition/Bracket.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ class Bracket implements BracketInterface
protected array $conditions = [];

/**
* @var string[] BracketInterface::OPERATOR_*
* @var list<string|null> BracketInterface::OPERATOR_*
*/
protected array $operator = [];

/**
* @param ConditionInterface $condition
* @param string $operator BracketInterface::OPERATOR_*
* @param string|null $operator BracketInterface::OPERATOR_*
*
* @return $this
*/
public function addCondition(ConditionInterface $condition, string $operator): static
public function addCondition(ConditionInterface $condition, ?string $operator): static
{
$this->conditions[] = $condition;
$this->operator[] = $operator;
Expand All @@ -49,7 +49,7 @@ public function addCondition(ConditionInterface $condition, string $operator): s
public function check(EnvironmentInterface $environment): bool
{
// A bracket without conditions is not restricted and thus doesn't fail
if (empty($this->conditions)) {
if (!$this->conditions) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/VoucherService/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static function isUsedToken(string $code, int $maxUsages = 1): bool
public function check(int $maxUsages = null, bool $isCheckout = false): bool
{
if (isset($maxUsages)) {
if ($this->getUsages() + Reservation::getReservationCount($this->getToken()) - (int)$isCheckout <= $maxUsages) {
if ($this->getUsages() + Reservation::getReservationCount($this->getToken()) - (int)$isCheckout < $maxUsages) {
return true;
}

Expand Down

0 comments on commit 26dc7ce

Please sign in to comment.