From f786f0c59d9a95d6829aaf58d99c882a609355ed Mon Sep 17 00:00:00 2001 From: Roger Rehnelt Date: Sat, 3 Oct 2026 15:38:49 +0200 Subject: Widerrufsformular: Bestätigung ohne Bestelldaten, Name und Schlüssel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jeder Widerruf wird angenommen; die Eingangsbestätigung an die eingetragene Adresse enthält nur die eigenen Angaben, der Betreiber bekommt die Bestelldaten mit Vermerken. Neues Pflichtfeld Name; der Link aus der Bestellmail bestätigt den Widerruf. Co-Authored-By: Claude Opus 5.5 --- views/mods/mod_revocation/ajaxDialogContent.phtml | 12 +++ views/mods/mod_revocation/mail_row.phtml | 3 +- views/mods/mod_revocation/mail_row_html.phtml | 5 +- .../mod_revocation/mails/mail_admin_html.phtml | 83 ++++++--------------- .../mod_revocation/mails/mail_admin_text.phtml | 66 +++++++++-------- .../mod_revocation/mails/mail_customer_html.phtml | 86 +++++++--------------- .../mod_revocation/mails/mail_customer_text.phtml | 53 ++++++------- views/mods/mod_revocation/order_view_row.phtml | 3 + views/mods/mod_revocation/page_form.phtml | 14 +++- views/mods/mod_revocation/wp_footer.phtml | 12 ++- 10 files changed, 154 insertions(+), 183 deletions(-) diff --git a/views/mods/mod_revocation/ajaxDialogContent.phtml b/views/mods/mod_revocation/ajaxDialogContent.phtml index 163d004..e10202c 100644 --- a/views/mods/mod_revocation/ajaxDialogContent.phtml +++ b/views/mods/mod_revocation/ajaxDialogContent.phtml @@ -22,6 +22,7 @@ $arReason = \wpsgRevocation\Revocation::getReasons(); if (!is_array($dialog_config)) $dialog_config = []; $contact_email = ""; + $contact_name = ""; $customer_login_id = intval(\wpsg_ShopController::getShop()->callMod('wpsg_mod_kundenverwaltung', 'isLoggedIn')); @@ -30,6 +31,7 @@ $arReason = \wpsgRevocation\Revocation::getReasons(); $oCustomer = \wpsg_customer::getInstance($customer_login_id); $contact_email = $oCustomer->getEmail(); + $contact_name = trim($oCustomer->getFirstname().' '.$oCustomer->getName()); } @@ -136,6 +138,16 @@ $arReason = \wpsgRevocation\Revocation::getReasons(); +
+ +
+ +
+
+ + + +
diff --git a/views/mods/mod_revocation/mail_row.phtml b/views/mods/mod_revocation/mail_row.phtml index e9db4e4..183d68b 100755 --- a/views/mods/mod_revocation/mail_row.phtml +++ b/views/mods/mod_revocation/mail_row.phtml @@ -11,7 +11,8 @@ $amount = $this->view['wpsg_mod_revocation']['amount']; $order_product_id = intval($this->view['wpsg_mod_revocation']['order_product_id']); - $revo_url = home_url('/').'?wpsg_revo_order='.urlencode($order_nr).'&wpsg_revo_product='.urlencode($product_nr).'&wpsg_revo_amount='.urlencode($amount); + // Schlüssel der Bestellung (S18): bestätigt den Widerruf; keine Nonce, siehe Revocation::orderToken() + $revo_url = home_url('/').'?wpsg_revo_order='.urlencode($order_nr).'&wpsg_revo_product='.urlencode($product_nr).'&wpsg_revo_amount='.urlencode($amount).'&wpsg_revo_key='.urlencode((string)($this->view['wpsg_mod_revocation']['key'] ?? '')); ?> diff --git a/views/mods/mod_revocation/mail_row_html.phtml b/views/mods/mod_revocation/mail_row_html.phtml index 4628b9d..ae060c1 100755 --- a/views/mods/mod_revocation/mail_row_html.phtml +++ b/views/mods/mod_revocation/mail_row_html.phtml @@ -13,13 +13,14 @@ $amount = $this->view['wpsg_mod_revocation']['amount']; $order_product_id = intval($this->view['wpsg_mod_revocation']['order_product_id']); - $revo_url = home_url('/').'?wpsg_revo_order='.urlencode($order_nr).'&wpsg_revo_product='.urlencode($product_nr).'&wpsg_revo_amount='.urlencode($amount); + // Schlüssel der Bestellung (S18): bestätigt den Widerruf; keine Nonce, siehe Revocation::orderToken() + $revo_url = home_url('/').'?wpsg_revo_order='.urlencode($order_nr).'&wpsg_revo_product='.urlencode($product_nr).'&wpsg_revo_amount='.urlencode($amount).'&wpsg_revo_key='.urlencode((string)($this->view['wpsg_mod_revocation']['key'] ?? '')); ?>   : - + diff --git a/views/mods/mod_revocation/mails/mail_admin_html.phtml b/views/mods/mod_revocation/mails/mail_admin_html.phtml index 4ff7820..c819841 100644 --- a/views/mods/mod_revocation/mails/mail_admin_html.phtml +++ b/views/mods/mod_revocation/mails/mail_admin_html.phtml @@ -2,80 +2,45 @@ /** @version 4.6.1 */ declare(strict_types=1); - + /** - * @author: Daniel Schmitzer - * @date: 14.04.26 - * @time: 09:21 + * Mail an den Betreiber (HTML) * + * Mit Bestelldaten (Platzhalter nur bei genau einer gefundenen Bestellung), Bestätigung und Vermerken (S18). */ - + namespace wpsgRevocation; - + $arSubmitData = \wpsg_ShopController::getShop()->view['arSubmitData'] ?? []; - $arReason = Revocation::getReasons(); + $time = (string)($arSubmitData[0]['time'] ?? \current_time('mysql')); ?>

-

+

- : %kunde_anrede% %kunde_vname% %kunde_name%
- : %kunde_email% + :
+ :
+ :


- $d): - - $oOrder = $d['oOrder']; - $oOrderProduct = $d['oOrderProduct']; - - $reasonText = array_values(array_filter( - $arReason, - function($item) use ($d) { - return $item['id'] === $d['reason']; - } - ))[0]['text'] ?? __('Kein Grund angegeben', 'wpsg'); -?> - -
-

- : - getNr(); ?> -

- -

- : - x getProduct()->getProductName(true); ?> - / : - getProduct()->getNr(); ?> -

+ +
+

: getNr():$d['order_nr']); ?>

+

: getCustomer()->getEMail()); ?>

+

: x getProduct()->getProductName(true).' / '.__('Artikelnummer', 'wpsg').': '.$oOrderProduct->getProduct()->getNr():$d['product_nr']); ?>

+

:

+

:

+

:

+

:

+
+ -

- : - -

- -

- : - -

-
- - +

- : - +
+ get_option('wpsg_shopdata_name')); ?> -

- -

- -

- -

-
- get_option('wpsg_shopdata_name'); ?> - - -

\ No newline at end of file diff --git a/views/mods/mod_revocation/mails/mail_admin_text.phtml b/views/mods/mod_revocation/mails/mail_admin_text.phtml index c0e3342..4253b8d 100644 --- a/views/mods/mod_revocation/mails/mail_admin_text.phtml +++ b/views/mods/mod_revocation/mails/mail_admin_text.phtml @@ -1,45 +1,53 @@ view['arSubmitData'] ?? []; - $arReason = Revocation::getReasons(); + $time = (string)($arSubmitData[0]['time'] ?? \current_time('mysql')); + +?> + + + + + + + + -?> - - - - %kunde_anrede% %kunde_vname% %kunde_name% - %kunde_email% - - $d) { + - /** @var \wpsg_order $oOrder */ - $oOrder = $d['oOrder']; - /** @var \wpsg_order_product $oOrderProduct */ - $oOrderProduct = $d['oOrderProduct']; + + getNr():$d['order_nr']); ?> -?> - getNr(); ?> - x getProduct()->getProductName(true); ?> / : getProduct()->getNr(); ?> - - + getCustomer()->getEMail(); ?> + x getProduct()->getProductName(true).' / '.__('Artikelnummer', 'wpsg').': '.$oOrderProduct->getProduct()->getNr():$d['product_nr']); ?> + + + + + + + + + + + + + + - - - + - get_option('wpsg_shopdata_name'); ?> - \ No newline at end of file diff --git a/views/mods/mod_revocation/mails/mail_customer_html.phtml b/views/mods/mod_revocation/mails/mail_customer_html.phtml index 7430fe3..96ee023 100644 --- a/views/mods/mod_revocation/mails/mail_customer_html.phtml +++ b/views/mods/mod_revocation/mails/mail_customer_html.phtml @@ -2,76 +2,42 @@ /** @version 4.6.1 */ declare(strict_types=1); - + /** - * @author: Daniel Schmitzer - * @date: 14.04.26 - * @time: 09:21 + * Eingangsbestätigung an die eingetragene Adresse (HTML) * + * Nur die Angaben des Absenders, keine Daten aus der Bestellung (S18): Die Adresse hat der Absender selbst eingetragen. + * Ohne order_id versendet, Platzhalter wie %kunde_name% bleiben deshalb leer. */ - - namespace wpsgRevocation; - - $arSubmitData = \wpsg_ShopController::getShop()->view['arSubmitData'] ?? []; - $arReason = Revocation::getReasons(); - -?> -

%kunde_anrede% %kunde_name%,

- -

-

- - $d): + namespace wpsgRevocation; - $oOrder = $d['oOrder']; - $oOrderProduct = $d['oOrderProduct']; + $arSubmitData = \wpsg_ShopController::getShop()->view['arSubmitData'] ?? []; + $time = (string)($arSubmitData[0]['time'] ?? \current_time('mysql')); - $reasonText = array_values(array_filter( - $arReason, - function($item) use ($d) { - return $item['id'] === $d['reason']; - } - ))[0]['text'] ?? __('Kein Grund angegeben', 'wpsg'); ?> - -
-

- : - getNr(); ?> -

- -

- : - x getProduct()->getProductName(true); ?> - / : - getProduct()->getNr(); ?> -

- -

- : - -

- - -

- : - -

- -
- +

,

+ +

+ + +
+

:

+

:

+

:

+

:

+

:

+

- : - + :
+ :
+ :

- -

+

-
- get_option('wpsg_shopdata_name'); ?> - - -

\ No newline at end of file +
+ get_option('wpsg_shopdata_name')); ?> - +

diff --git a/views/mods/mod_revocation/mails/mail_customer_text.phtml b/views/mods/mod_revocation/mails/mail_customer_text.phtml index 6dd0b92..5812b68 100644 --- a/views/mods/mod_revocation/mails/mail_customer_text.phtml +++ b/views/mods/mod_revocation/mails/mail_customer_text.phtml @@ -2,53 +2,46 @@ /** @version 4.6.1 */ declare(strict_types=1); - + /** - * @author: Daniel Schmitzer - * @date: 14.04.26 - * @time: 09:21 + * Eingangsbestätigung an die eingetragene Adresse * + * Nur die Angaben des Absenders, keine Daten aus der Bestellung (S18): Die Adresse hat der Absender selbst eingetragen. + * Ohne order_id versendet, Platzhalter wie %kunde_name% bleiben deshalb leer. */ - + namespace wpsgRevocation; - + $arSubmitData = \wpsg_ShopController::getShop()->view['arSubmitData'] ?? []; - $arReason = Revocation::getReasons(); + $time = (string)($arSubmitData[0]['time'] ?? \current_time('mysql')); -?> %kunde_anrede% %kunde_name%, +?> , - + - + + - $d): + - $oOrder = $d['oOrder']; - $oOrderProduct = $d['oOrderProduct']; + + - $reasonText = array_values(array_filter( - $arReason, - function($item) use ($d) { - return $item['id'] === $d['reason']; - } - ))[0]['text'] ?? __('Kein Grund angegeben', 'wpsg'); -?> + - getNr(); ?> + - x getProduct()->getProductName(true); ?> / : getProduct()->getNr(); ?> + - + + - - - + + + - - + - - diff --git a/views/mods/mod_revocation/order_view_row.phtml b/views/mods/mod_revocation/order_view_row.phtml index 7261e8a..9bfd17f 100644 --- a/views/mods/mod_revocation/order_view_row.phtml +++ b/views/mods/mod_revocation/order_view_row.phtml @@ -18,6 +18,9 @@ : + + + 0) echo ' · '.esc_html(implode(', ', $arNotes)); ?> diff --git a/views/mods/mod_revocation/page_form.phtml b/views/mods/mod_revocation/page_form.phtml index c444916..f76b2b8 100644 --- a/views/mods/mod_revocation/page_form.phtml +++ b/views/mods/mod_revocation/page_form.phtml @@ -19,12 +19,14 @@ // Vorbelegung des Kontaktfeldes für eingeloggte Kunden $contact_email = ''; + $contact_name = ''; $customer_login_id = intval(\wpsg_ShopController::getShop()->callMod('wpsg_mod_kundenverwaltung', 'isLoggedIn')); if ($customer_login_id > 0) { $oCustomer = \wpsg_customer::getInstance($customer_login_id); $contact_email = $oCustomer->getEmail(); + $contact_name = trim($oCustomer->getFirstname().' '.$oCustomer->getName()); } @@ -33,6 +35,7 @@ $get_product = isset($_GET['wpsg_revo_product']) ? \sanitize_text_field($_GET['wpsg_revo_product']) : ''; $get_amount = isset($_GET['wpsg_revo_amount']) ? max(1, intval($_GET['wpsg_revo_amount'])) : 1; $get_contact = isset($_GET['wpsg_revo_contact']) ? \sanitize_email($_GET['wpsg_revo_contact']) : ''; + $get_key = isset($_GET['wpsg_revo_key']) ? \sanitize_key($_GET['wpsg_revo_key']) : ''; // Schlüssel aus der Bestellmail (S18) if ($contact_email === '' && $get_contact !== '' && \is_email($get_contact)) $contact_email = $get_contact; @@ -84,6 +87,15 @@ +
+ +
+ +
+
+ + +
@@ -194,7 +206,7 @@ } else { form.style.display = 'none'; - msg.innerHTML = '
'; + msg.innerHTML = '
'; msg.scrollIntoView({ behavior: 'smooth', block: 'center' }); } diff --git a/views/mods/mod_revocation/wp_footer.phtml b/views/mods/mod_revocation/wp_footer.phtml index ef013c2..c210881 100644 --- a/views/mods/mod_revocation/wp_footer.phtml +++ b/views/mods/mod_revocation/wp_footer.phtml @@ -177,7 +177,7 @@ success.className = 'wpsg_revocation_page_success'; success.setAttribute('role', 'status'); success.tabIndex = -1; - success.textContent = ; + success.textContent = ; el_dialog_content.replaceChildren(success); el_dialog.querySelector('.wpsg_revocation_button_submit').hidden = true; @@ -323,6 +323,7 @@ const get_product_nr = urlParams.get('wpsg_revo_product'); const get_amount = urlParams.get('wpsg_revo_amount'); const get_contact = urlParams.get('wpsg_revo_contact'); + const get_key = urlParams.get('wpsg_revo_key'); if (get_order_nr !== null) { @@ -373,6 +374,15 @@ } + // Schlüssel aus der Bestellmail bestätigt den Widerruf (S18) + if (get_key) { + + const keyInput = form.querySelector('input[name="wpsg_revocation_reason[key]"]'); + + if (keyInput) keyInput.value = get_key; + + } + }; checkAndFillForm(); -- cgit v1.2.3