Skip to content

Commit

Permalink
Merge branch '114-pui-daten-optional-machen' into 'master'
Browse files Browse the repository at this point in the history
Resolve "PUI Daten optional machen"

Closes #114 and #104

See merge request jtl5-plugins/ws5_mollie!29
  • Loading branch information
Christian Proske committed May 3, 2022
2 parents 7db9294 + 928c609 commit d1768ea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function boot(Dispatcher $dispatcher): void
parent::boot($dispatcher);

if (!Shop::isFrontend()) {
if ($authorized = Shop::Container()->getDB()->executeQuery('SELECT kId FROM xplugin_ws5_mollie_orders WHERE cStatus = "authorized" AND dCreated > DATE_SUB(NOW(), INTERVAL 30 DAY)', ReturnType::AFFECTED_ROWS)) {
$notificationSetting = self::Plugin('ws5_mollie')->getConfig()->getValue("notifications");
if (in_array($notificationSetting, ['Y', 'A']) && $authorized = Shop::Container()->getDB()->executeQuery('SELECT kId FROM xplugin_ws5_mollie_orders WHERE cStatus = "authorized" AND dCreated > DATE_SUB(NOW(), INTERVAL 30 DAY)', ReturnType::AFFECTED_ROWS)) {
Notification::getInstance()->add(
NotificationEntry::TYPE_WARNING,
'Mollie Authorized Orders',
Expand All @@ -46,7 +47,7 @@ public function boot(Dispatcher $dispatcher): void
);
}

if ($errors = Shop::Container()->getDB()->executeQuery('SELECT kId FROM xplugin_ws5_mollie_queue WHERE cError IS NOT NULL AND dCreated > DATE_SUB(NOW(), INTERVAL 30 DAY);', ReturnType::AFFECTED_ROWS)) {
if (in_array($notificationSetting, ['Y', 'Q']) && $errors = Shop::Container()->getDB()->executeQuery('SELECT kId FROM xplugin_ws5_mollie_queue WHERE cError IS NOT NULL AND dCreated > DATE_SUB(NOW(), INTERVAL 30 DAY);', ReturnType::AFFECTED_ROWS)) {
Notification::getInstance()->add(
NotificationEntry::TYPE_DANGER,
'Mollie Queue with Errors',
Expand Down
26 changes: 24 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-06</CreateDate>
<Version>1.3.4</Version>
<CreateDate>2022-05-03</CreateDate>
<Version>1.3.5</Version>
<ExsID>689388c6-9f04-4648-b516-e67d96b0dc1d</ExsID>
<Install>
<Hooks>
Expand Down Expand Up @@ -197,6 +197,19 @@
</SelectboxOptions>
</Setting>

<Setting type="selectbox" initialValue="Y" sort="100" conf="Y">
<Name>Mitteilungen (Glocke)</Name>
<Description>
<![CDATA[Welche Infos sollen in den Mitteilungen erschienen?]]></Description>
<ValueName>notifications</ValueName>
<SelectboxOptions>
<Option sort="1" value="Y">Queue &amp; Authorized</Option>
<Option sort="2" value="Q">Nur Queue</Option>
<Option sort="3" value="A">Nur Authorized</Option>
<Option sort="4" value="N">Keine</Option>
</SelectboxOptions>
</Setting>

</Settingslink>
</Adminmenu>
<PaymentMethod>
Expand Down Expand Up @@ -694,6 +707,15 @@
<Option value="payment" sort="2">Payment API</Option>
</SelectboxOptions>
</Setting>
<Setting type="selectbox" initialValue="N" sort="60" conf="Y">
<Name>PUI Daten übergeben</Name>
<Description>Macht den Auftrag in der WAWI ReadOnly.</Description>
<ValueName>usePUI</ValueName>
<SelectboxOptions>
<Option value="Y" sort="1">Ja</Option>
<Option value="N" sort="2">Nein</Option>
</SelectboxOptions>
</Setting>
<Setting type="zahl" initialValue="100" sort="50" conf="Y">
<Name>Gültigkeit in Tagen</Name>
<Description>Wie lange hat der Kunde Zeit die Überweisung zu tätigen?</Description>
Expand Down
5 changes: 5 additions & 0 deletions paymentmethod/Banktransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ class Banktransfer extends PaymentMethod

public function generatePUI(AbstractCheckout $checkout): string
{

if(self::Plugin('ws5_mollie')->getConfig()->getValue($this->moduleID . '_usePUI') === 'N'){
return false;
}

$template = self::Plugin('ws5_mollie')->getLocalization()->getTranslation('banktransferPUI');

return str_replace(
Expand Down

0 comments on commit d1768ea

Please sign in to comment.