diff --git a/CLAUDE.md b/CLAUDE.md index 65e422e..0d4ac6c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,9 +18,9 @@ This is a classical PrestaShop legacy module with no npm, Composer, Makefile, or | File | Role | |------|------| -| `cyp_withdrawalbutton.php` | Main module class: install/uninstall, config form, hook handlers, utility methods | +| `simple_withdrawalbutton.php` | Main module class: install/uninstall, config form, hook handlers, utility methods | | `controllers/front/withdraw.php` | Public front controller for the withdrawal form (no auth required) | -| `controllers/admin/AdminCypWithdrawalController.php` | Backoffice list/detail view with status management | +| `controllers/admin/AdminSimpleWithdrawalController.php` | Backoffice list/detail view with status management | ### Request Flow @@ -32,7 +32,7 @@ This is a classical PrestaShop legacy module with no npm, Composer, Makefile, or ### Database -Single table `ps_cyp_withdrawal_request`. Schema is defined inline in `cyp_withdrawalbutton.php::install()` — no separate SQL files. Records are intentionally **not deleted on uninstall** (legal compliance). +Single table `ps_cyp_withdrawal_request`. Schema is defined inline in `simple_withdrawalbutton.php::install()` — no separate SQL files. Records are intentionally **not deleted on uninstall** (legal compliance). Key fields: `order_reference`, `withdrawal_scope` (ENUM: full|partial), `status` (ENUM: new|processing|closed), `customer_ip_hash` / `user_agent_hash` (SHA256, privacy). @@ -54,6 +54,6 @@ The items field in `form.tpl` is conditionally shown via vanilla JS only when `w - Use `pSQL()` for all DB string interpolation; `(int)` cast for integers - Hook registration/deregistration in `install()`/`uninstall()` -- Admin tab registered as `AdminCypWithdrawal` — the controller class name must match +- Admin tab registered as `AdminSimpleWithdrawal` — the controller class name must match - Module config stored via `Configuration::get/updateValue()` - Email sending uses `Mail::Send()` with template files in `mails/{lang}/` diff --git a/controllers/admin/AdminCypWithdrawalController.php b/controllers/admin/AdminSimpleWithdrawalController.php similarity index 94% rename from controllers/admin/AdminCypWithdrawalController.php rename to controllers/admin/AdminSimpleWithdrawalController.php index 51eca91..5289fd3 100644 --- a/controllers/admin/AdminCypWithdrawalController.php +++ b/controllers/admin/AdminSimpleWithdrawalController.php @@ -4,12 +4,12 @@ if (!defined('_PS_VERSION_')) { exit; } -class AdminCypWithdrawalController extends ModuleAdminController +class AdminSimpleWithdrawalController extends ModuleAdminController { public function __construct() { $this->bootstrap = true; - $this->table = Cyp_Withdrawalbutton::TABLE_REQUEST; + $this->table = Simple_withdrawalbutton::TABLE_REQUEST; $this->identifier = 'id_withdrawal_request'; $this->lang = false; $this->explicitSelect = true; @@ -103,7 +103,7 @@ class AdminCypWithdrawalController extends ModuleAdminController } $ok = Db::getInstance()->update( - Cyp_Withdrawalbutton::TABLE_REQUEST, + Simple_withdrawalbutton::TABLE_REQUEST, ['status' => $status], '`id_withdrawal_request` = ' . (int) $id ); @@ -119,7 +119,7 @@ class AdminCypWithdrawalController extends ModuleAdminController { $id = (int) Tools::getValue($this->identifier); $row = Db::getInstance()->getRow( - 'SELECT * FROM `' . _DB_PREFIX_ . pSQL(Cyp_Withdrawalbutton::TABLE_REQUEST) . '` + 'SELECT * FROM `' . _DB_PREFIX_ . pSQL(Simple_withdrawalbutton::TABLE_REQUEST) . '` WHERE `id_withdrawal_request` = ' . (int) $id ); diff --git a/controllers/front/withdraw.php b/controllers/front/withdraw.php index bfa52ab..82c26b1 100644 --- a/controllers/front/withdraw.php +++ b/controllers/front/withdraw.php @@ -4,7 +4,7 @@ if (!defined('_PS_VERSION_')) { exit; } -class Cyp_WithdrawalbuttonWithdrawModuleFrontController extends ModuleFrontController +class Simple_withdrawalbuttonWithdrawModuleFrontController extends ModuleFrontController { public $ssl = true; public $auth = false; @@ -32,8 +32,8 @@ class Cyp_WithdrawalbuttonWithdrawModuleFrontController extends ModuleFrontContr 'csrf_token' => $this->module->getFrontToken(), 'action_url' => $this->context->link->getModuleLink($this->module->name, 'withdraw', [], true), 'success_data' => $this->successData, - 'privacy_url' => (string) Configuration::get(Cyp_Withdrawalbutton::CONF_PRIVACY_URL), - 'revocation_url' => (string) Configuration::get(Cyp_Withdrawalbutton::CONF_REVOCATION_URL), + 'privacy_url' => (string) Configuration::get(Simple_withdrawalbutton::CONF_PRIVACY_URL), + 'revocation_url' => (string) Configuration::get(Simple_withdrawalbutton::CONF_REVOCATION_URL), ]); if ($this->currentView === 'confirm') { diff --git a/cyp_withdrawalbutton.php b/simple_withdrawalbutton.php similarity index 96% rename from cyp_withdrawalbutton.php rename to simple_withdrawalbutton.php index e23febc..ce19566 100644 --- a/cyp_withdrawalbutton.php +++ b/simple_withdrawalbutton.php @@ -14,18 +14,18 @@ if (!defined('_PS_VERSION_')) { exit; } -class Cyp_Withdrawalbutton extends Module +class Simple_withdrawalbutton extends Module { - public const TABLE_REQUEST = 'cyp_withdrawal_request'; - public const CONF_SHOP_EMAIL = 'CYP_WITHDRAWAL_SHOP_EMAIL'; - public const CONF_RATE_LIMIT = 'CYP_WITHDRAWAL_RATE_LIMIT'; - public const CONF_PRIVACY_URL = 'CYP_WITHDRAWAL_PRIVACY_URL'; - public const CONF_REVOCATION_URL = 'CYP_WITHDRAWAL_REVOCATION_URL'; - public const CONF_RETENTION_MONTHS = 'CYP_WITHDRAWAL_RETENTION_MONTHS'; + public const TABLE_REQUEST = 'simple_withdrawal_request'; + public const CONF_SHOP_EMAIL = 'SIMPLE_WITHDRAWAL_SHOP_EMAIL'; + public const CONF_RATE_LIMIT = 'SIMPLE_WITHDRAWAL_RATE_LIMIT'; + public const CONF_PRIVACY_URL = 'SIMPLE_WITHDRAWAL_PRIVACY_URL'; + public const CONF_REVOCATION_URL = 'SIMPLE_WITHDRAWAL_REVOCATION_URL'; + public const CONF_RETENTION_MONTHS = 'SIMPLE_WITHDRAWAL_RETENTION_MONTHS'; public function __construct() { - $this->name = 'cyp_withdrawalbutton'; + $this->name = 'simple_withdrawalbutton'; $this->tab = 'administration'; $this->version = '0.1.0'; $this->author = 'Cyprès / Akiko Sake'; @@ -100,7 +100,7 @@ class Cyp_Withdrawalbutton extends Module private function installTab() { - $className = 'AdminCypWithdrawal'; + $className = 'AdminSimpleWithdrawal'; if ((int) Tab::getIdFromClassName($className) > 0) { return true; } @@ -120,7 +120,7 @@ class Cyp_Withdrawalbutton extends Module private function uninstallTab() { - $idTab = (int) Tab::getIdFromClassName('AdminCypWithdrawal'); + $idTab = (int) Tab::getIdFromClassName('AdminSimpleWithdrawal'); if ($idTab <= 0) { return true; } @@ -182,7 +182,7 @@ class Cyp_Withdrawalbutton extends Module } } - $adminLink = $this->context->link->getAdminLink('AdminCypWithdrawal'); + $adminLink = $this->context->link->getAdminLink('AdminSimpleWithdrawal'); $withdrawalLink = $this->getWithdrawalLink(); $this->context->smarty->assign([ @@ -488,7 +488,7 @@ class Cyp_Withdrawalbutton extends Module } $scopeLabel = $this->getScopeLabel($data['withdrawal_scope'], $isoCode); - $adminLink = $this->context->link->getAdminLink('AdminCypWithdrawal'); + $adminLink = $this->context->link->getAdminLink('AdminSimpleWithdrawal'); $templateVars = [ '{id_withdrawal_request}' => (string) $idWithdrawalRequest, diff --git a/views/templates/admin/config_info.tpl b/views/templates/admin/config_info.tpl index 8524e51..4c67147 100644 --- a/views/templates/admin/config_info.tpl +++ b/views/templates/admin/config_info.tpl @@ -1,14 +1,14 @@
-

{l s='Installation notes' mod='cyp_withdrawalbutton'}

+

{l s='Installation notes' mod='simple_withdrawalbutton'}

- {l s='Frontend withdrawal page:' mod='cyp_withdrawalbutton'} + {l s='Frontend withdrawal page:' mod='simple_withdrawalbutton'} {$withdrawal_link|escape:'html':'UTF-8'}

- {l s='Back office requests:' mod='cyp_withdrawalbutton'} - {l s='Open withdrawal requests' mod='cyp_withdrawalbutton'} + {l s='Back office requests:' mod='simple_withdrawalbutton'} + {l s='Open withdrawal requests' mod='simple_withdrawalbutton'}

- {l s='The module keeps existing withdrawal records when it is uninstalled. Delete the database table manually only after checking your retention obligations.' mod='cyp_withdrawalbutton'} + {l s='The module keeps existing withdrawal records when it is uninstalled. Delete the database table manually only after checking your retention obligations.' mod='simple_withdrawalbutton'}

diff --git a/views/templates/admin/view.tpl b/views/templates/admin/view.tpl index 1f89158..393811d 100644 --- a/views/templates/admin/view.tpl +++ b/views/templates/admin/view.tpl @@ -1,7 +1,7 @@
- {l s='Withdrawal request' mod='cyp_withdrawalbutton'} #{$request.id_withdrawal_request|intval} + {l s='Withdrawal request' mod='simple_withdrawalbutton'} #{$request.id_withdrawal_request|intval}
@@ -9,46 +9,46 @@ - + - + - + - + - + - + - + - + @@ -59,15 +59,15 @@
- +
@@ -75,7 +75,7 @@ diff --git a/views/templates/front/confirm.tpl b/views/templates/front/confirm.tpl index 0f8f1f4..45be940 100644 --- a/views/templates/front/confirm.tpl +++ b/views/templates/front/confirm.tpl @@ -1,6 +1,6 @@
@@ -14,34 +14,34 @@
{/if} -

{l s='Bitte prüfen Sie Ihre Angaben. Wenn die Angaben korrekt sind, können Sie Ihren Widerruf jetzt absenden.' mod='cyp_withdrawalbutton'}

+

{l s='Bitte prüfen Sie Ihre Angaben. Wenn die Angaben korrekt sind, können Sie Ihren Widerruf jetzt absenden.' mod='simple_withdrawalbutton'}

-
{l s='Name' mod='cyp_withdrawalbutton'}
+
{l s='Name' mod='simple_withdrawalbutton'}
{$form_data.customer_name|escape:'html':'UTF-8'}
-
{l s='E-Mail-Adresse' mod='cyp_withdrawalbutton'}
+
{l s='E-Mail-Adresse' mod='simple_withdrawalbutton'}
{$form_data.customer_email|escape:'html':'UTF-8'}
-
{l s='Bestellnummer / Bestellreferenz' mod='cyp_withdrawalbutton'}
+
{l s='Bestellnummer / Bestellreferenz' mod='simple_withdrawalbutton'}
{$form_data.order_reference|escape:'html':'UTF-8'}
-
{l s='Widerruf betrifft' mod='cyp_withdrawalbutton'}
+
{l s='Widerruf betrifft' mod='simple_withdrawalbutton'}
{if $form_data.withdrawal_scope == 'partial'} - {l s='einen Teil der Bestellung' mod='cyp_withdrawalbutton'} + {l s='einen Teil der Bestellung' mod='simple_withdrawalbutton'} {else} - {l s='die gesamte Bestellung' mod='cyp_withdrawalbutton'} + {l s='die gesamte Bestellung' mod='simple_withdrawalbutton'} {/if}
{if $form_data.withdrawal_scope == 'partial'} -
{l s='Betroffene Artikel / Mengen' mod='cyp_withdrawalbutton'}
+
{l s='Betroffene Artikel / Mengen' mod='simple_withdrawalbutton'}
{$form_data.withdrawal_items_text|escape:'html':'UTF-8'|nl2br nofilter}
{/if} {if $form_data.message != ''} -
{l s='Nachricht / Bemerkung' mod='cyp_withdrawalbutton'}
+
{l s='Nachricht / Bemerkung' mod='simple_withdrawalbutton'}
{$form_data.message|escape:'html':'UTF-8'|nl2br nofilter}
{/if}
@@ -60,10 +60,10 @@ diff --git a/views/templates/front/form.tpl b/views/templates/front/form.tpl index bb148f8..f86d11f 100644 --- a/views/templates/front/form.tpl +++ b/views/templates/front/form.tpl @@ -1,17 +1,17 @@

- {l s='Sie können hier den Vertrag zu einer Bestellung vollständig oder teilweise widerrufen. Bitte geben Sie die Bestellnummer und bei einem Teilwiderruf die betroffenen Artikel und Mengen an.' mod='cyp_withdrawalbutton'} + {l s='Sie können hier den Vertrag zu einer Bestellung vollständig oder teilweise widerrufen. Bitte geben Sie die Bestellnummer und bei einem Teilwiderruf die betroffenen Artikel und Mengen an.' mod='simple_withdrawalbutton'}

{if isset($revocation_url) && $revocation_url != ''}

- {l s='Unsere Widerrufsbelehrung (14-Tage-Frist)' mod='cyp_withdrawalbutton'} + {l s='Unsere Widerrufsbelehrung (14-Tage-Frist)' mod='simple_withdrawalbutton'}

{/if} @@ -35,74 +35,74 @@
- {l s='Widerruf betrifft' mod='cyp_withdrawalbutton'} + {l s='Widerruf betrifft' mod='simple_withdrawalbutton'}
- + - {l s='Nur bei einem Teilwiderruf erforderlich.' mod='cyp_withdrawalbutton'} + {l s='Nur bei einem Teilwiderruf erforderlich.' mod='simple_withdrawalbutton'}

- {l s='Pflichtfelder sind mit * gekennzeichnet. Ein Widerrufsgrund ist nicht erforderlich.' mod='cyp_withdrawalbutton'} + {l s='Pflichtfelder sind mit * gekennzeichnet. Ein Widerrufsgrund ist nicht erforderlich.' mod='simple_withdrawalbutton'}

- {l s='Ihre Angaben (Name, E-Mail-Adresse) werden zur Bearbeitung Ihrer Widerrufserklärung verarbeitet. Rechtsgrundlage: Art. 6 Abs. 1 lit. b und c DSGVO.' mod='cyp_withdrawalbutton'} + {l s='Ihre Angaben (Name, E-Mail-Adresse) werden zur Bearbeitung Ihrer Widerrufserklärung verarbeitet. Rechtsgrundlage: Art. 6 Abs. 1 lit. b und c DSGVO.' mod='simple_withdrawalbutton'} {if isset($privacy_url) && $privacy_url != ''} - {l s='Datenschutzerklärung' mod='cyp_withdrawalbutton'} + {l s='Datenschutzerklärung' mod='simple_withdrawalbutton'} {/if}

diff --git a/views/templates/front/success.tpl b/views/templates/front/success.tpl index c3593f8..b10d84b 100644 --- a/views/templates/front/success.tpl +++ b/views/templates/front/success.tpl @@ -1,59 +1,59 @@
{if isset($success_data.mail_ok) && $success_data.mail_ok}
- {l s='Ihr Widerruf wurde übermittelt. Eine Eingangsbestätigung wurde an die angegebene E-Mail-Adresse gesendet.' mod='cyp_withdrawalbutton'} + {l s='Ihr Widerruf wurde übermittelt. Eine Eingangsbestätigung wurde an die angegebene E-Mail-Adresse gesendet.' mod='simple_withdrawalbutton'}
{else}
- {l s='Ihr Widerruf wurde gespeichert, aber die automatische Eingangsbestätigung konnte möglicherweise nicht versendet werden. Bitte kontaktieren Sie uns zusätzlich per E-Mail, falls Sie keine Bestätigung erhalten.' mod='cyp_withdrawalbutton'} + {l s='Ihr Widerruf wurde gespeichert, aber die automatische Eingangsbestätigung konnte möglicherweise nicht versendet werden. Bitte kontaktieren Sie uns zusätzlich per E-Mail, falls Sie keine Bestätigung erhalten.' mod='simple_withdrawalbutton'}
{/if}
{if isset($success_data.created_at)} -
{l s='Eingang:' mod='cyp_withdrawalbutton'}
+
{l s='Eingang:' mod='simple_withdrawalbutton'}
{$success_data.created_at|escape:'html':'UTF-8'}
{/if} {if isset($success_data.customer_email)} -
{l s='E-Mail-Adresse:' mod='cyp_withdrawalbutton'}
+
{l s='E-Mail-Adresse:' mod='simple_withdrawalbutton'}
{$success_data.customer_email|escape:'html':'UTF-8'}
{/if} {if isset($success_data.order_reference) && $success_data.order_reference != ''} -
{l s='Bestellnummer / Bestellreferenz' mod='cyp_withdrawalbutton'}
+
{l s='Bestellnummer / Bestellreferenz' mod='simple_withdrawalbutton'}
{$success_data.order_reference|escape:'html':'UTF-8'}
{/if} {if isset($success_data.withdrawal_scope)} -
{l s='Widerruf betrifft' mod='cyp_withdrawalbutton'}
+
{l s='Widerruf betrifft' mod='simple_withdrawalbutton'}
{if $success_data.withdrawal_scope == 'partial'} - {l s='einen Teil der Bestellung' mod='cyp_withdrawalbutton'} + {l s='einen Teil der Bestellung' mod='simple_withdrawalbutton'} {else} - {l s='die gesamte Bestellung' mod='cyp_withdrawalbutton'} + {l s='die gesamte Bestellung' mod='simple_withdrawalbutton'} {/if}
{/if} {if isset($success_data.withdrawal_items_text) && $success_data.withdrawal_items_text != ''} -
{l s='Betroffene Artikel / Mengen' mod='cyp_withdrawalbutton'}
+
{l s='Betroffene Artikel / Mengen' mod='simple_withdrawalbutton'}
{$success_data.withdrawal_items_text|escape:'html':'UTF-8'|nl2br nofilter}
{/if} {if isset($success_data.message) && $success_data.message != ''} -
{l s='Nachricht / Bemerkung' mod='cyp_withdrawalbutton'}
+
{l s='Nachricht / Bemerkung' mod='simple_withdrawalbutton'}
{$success_data.message|escape:'html':'UTF-8'|nl2br nofilter}
{/if}

- {l s='Diese Bestätigung betrifft nur den Eingang Ihrer Widerrufserklärung. Die weitere Bearbeitung und Prüfung erfolgt separat.' mod='cyp_withdrawalbutton'} + {l s='Diese Bestätigung betrifft nur den Eingang Ihrer Widerrufserklärung. Die weitere Bearbeitung und Prüfung erfolgt separat.' mod='simple_withdrawalbutton'}

diff --git a/views/templates/hook/customer_account.tpl b/views/templates/hook/customer_account.tpl index 741ac4b..c34f886 100644 --- a/views/templates/hook/customer_account.tpl +++ b/views/templates/hook/customer_account.tpl @@ -1,6 +1,6 @@ undo - {l s='Vertrag widerrufen' mod='cyp_withdrawalbutton'} + {l s='Vertrag widerrufen' mod='simple_withdrawalbutton'} diff --git a/views/templates/hook/footer.tpl b/views/templates/hook/footer.tpl index 99a6c9c..69b71ee 100644 --- a/views/templates/hook/footer.tpl +++ b/views/templates/hook/footer.tpl @@ -1,5 +1,5 @@
{l s='Received' mod='cyp_withdrawalbutton'}{l s='Received' mod='simple_withdrawalbutton'} {$request.created_at|escape:'html':'UTF-8'}
{l s='Confirmation sent' mod='cyp_withdrawalbutton'}{l s='Confirmation sent' mod='simple_withdrawalbutton'} {if $request.confirmation_sent_at}{$request.confirmation_sent_at|escape:'html':'UTF-8'}{else}-{/if}
{l s='Order reference' mod='cyp_withdrawalbutton'}{l s='Order reference' mod='simple_withdrawalbutton'} {$request.order_reference|escape:'html':'UTF-8'} {if $order_link != ''} -
{l s='Open order' mod='cyp_withdrawalbutton'} +
{l s='Open order' mod='simple_withdrawalbutton'} {/if}
{l s='Name' mod='cyp_withdrawalbutton'}{l s='Name' mod='simple_withdrawalbutton'} {$request.customer_name|escape:'html':'UTF-8'}
{l s='Email' mod='cyp_withdrawalbutton'}{l s='Email' mod='simple_withdrawalbutton'} {$request.customer_email|escape:'html':'UTF-8'}
{l s='Scope' mod='cyp_withdrawalbutton'}{l s='Scope' mod='simple_withdrawalbutton'} {if $request.withdrawal_scope == 'partial'} - {l s='Partial withdrawal' mod='cyp_withdrawalbutton'} + {l s='Partial withdrawal' mod='simple_withdrawalbutton'} {else} - {l s='Full order' mod='cyp_withdrawalbutton'} + {l s='Full order' mod='simple_withdrawalbutton'} {/if}
{l s='Affected items / quantities' mod='cyp_withdrawalbutton'}{l s='Affected items / quantities' mod='simple_withdrawalbutton'} {if $request.withdrawal_items_text}{$request.withdrawal_items_text|escape:'html':'UTF-8'|nl2br nofilter}{else}-{/if}
{l s='Message' mod='cyp_withdrawalbutton'}{l s='Message' mod='simple_withdrawalbutton'} {if $request.message}{$request.message|escape:'html':'UTF-8'|nl2br nofilter}{else}-{/if}