diff --git a/Migrations/Migration20211206112100.php b/Migrations/Migration20211206112100.php new file mode 100644 index 0000000..f209760 --- /dev/null +++ b/Migrations/Migration20211206112100.php @@ -0,0 +1,36 @@ +execute('ALTER TABLE `xplugin_ws5_mollie_orders` DROP INDEX `cOrderId`;'); + $this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` DROP INDEX `kBestellung`;'); + $this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` ADD UNIQUE( `kBestellung`, `cOrderId`);'); + + } + + public function down() + { + $this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` DROP INDEX `kBestellung`;'); + $this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` ADD UNIQUE(`kBestellung`);'); + $this->execute('ALTER TABLE `xplugin_ws5_mollie_orders` ADD UNIQUE(`cOrderId`);'); + + } + + public function getDescription(): string + { + return 'Fix UNIQUE Index on Orders-Table.'; + } +} diff --git a/info.xml b/info.xml index d6428a9..b74ccc2 100644 --- a/info.xml +++ b/info.xml @@ -7,8 +7,8 @@ 102 5.0.0 ws5_mollie - 2021-12-03 - 1.3.3 + 2021-12-06 + 1.3.4 689388c6-9f04-4648-b516-e67d96b0dc1d diff --git a/lib/Checkout/AbstractCheckout.php b/lib/Checkout/AbstractCheckout.php index 611e1f5..74f0405 100644 --- a/lib/Checkout/AbstractCheckout.php +++ b/lib/Checkout/AbstractCheckout.php @@ -518,7 +518,7 @@ public static function sendReminders(): void return; } - $remindables = Shop::Container()->getDB()->executeQueryPrepared("SELECT kId FROM xplugin_ws5_mollie_orders WHERE (dReminder IS NULL OR dReminder = '0000-00-00 00:00:00') AND dCreated < NOW() - INTERVAL :d MINUTE AND cStatus IN ('created','open', 'expired', 'failed', 'canceled')", [ + $remindables = Shop::Container()->getDB()->executeQueryPrepared("SELECT kId FROM xplugin_ws5_mollie_orders WHERE (dReminder IS NULL OR dReminder = '0000-00-00 00:00:00') AND dCreated > NOW() - INTERVAL 7 DAY AND dCreated < NOW() - INTERVAL :d MINUTE AND cStatus IN ('created','open', 'expired', 'failed', 'canceled')", [ ':d' => $reminder ], 2); foreach ($remindables as $remindable) { diff --git a/lib/Queue.php b/lib/Queue.php index 1d8bed6..d2144e8 100644 --- a/lib/Queue.php +++ b/lib/Queue.php @@ -68,7 +68,7 @@ private static function getOpen(int $limit): Generator if (!defined('MOLLIE_HOOK_DELAY')) { define('MOLLIE_HOOK_DELAY', 3); } - $open = Shop::Container()->getDB()->executeQueryPrepared("SELECT * FROM xplugin_ws5_mollie_queue WHERE (dDone IS NULL OR dDone = '0000-00-00 00:00:00') AND `bLock` IS NULL AND (cType LIKE 'webhook:%%' OR (cType LIKE 'hook:%%') AND dCreated < DATE_SUB(NOW(), INTERVAL :hd MINUTE)) ORDER BY dCreated DESC LIMIT 0, :LIMIT;", [ + $open = Shop::Container()->getDB()->executeQueryPrepared("SELECT * FROM xplugin_ws5_mollie_queue WHERE (dDone IS NULL OR dDone = '0000-00-00 00:00:00') AND `bLock` IS NULL AND (cType LIKE 'webhook:%%' OR (cType LIKE 'hook:%%' AND dCreated < DATE_SUB(NOW(), INTERVAL :hd MINUTE))) ORDER BY dCreated DESC LIMIT 0, :LIMIT;", [ ':LIMIT' => $limit, ':hd' => MOLLIE_HOOK_DELAY ], 2);