Skip to content

Commit

Permalink
fix #94
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Proske committed Dec 6, 2021
1 parent 73fc4af commit 559bc29
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
36 changes: 36 additions & 0 deletions Migrations/Migration20211206112100.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* @copyright 2021 WebStollen GmbH
* @link https://www.webstollen.de
*/

namespace Plugin\ws5_mollie\Migrations;

use JTL\Plugin\Migration;
use JTL\Update\IMigration;

class Migration20211206112100 extends Migration implements IMigration
{
public function up()
{

$this->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.';
}
}
4 changes: 2 additions & 2 deletions info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<XMLVersion>102</XMLVersion>
<ShopVersion>5.0.0</ShopVersion>
<PluginID>ws5_mollie</PluginID>
<CreateDate>2021-12-03</CreateDate>
<Version>1.3.3</Version>
<CreateDate>2021-12-06</CreateDate>
<Version>1.3.4</Version>
<ExsID>689388c6-9f04-4648-b516-e67d96b0dc1d</ExsID>
<Install>
<Hooks>
Expand Down
2 changes: 1 addition & 1 deletion lib/Checkout/AbstractCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 559bc29

Please sign in to comment.