diff --git a/src/new/config/reference.php b/src/new/config/reference.php index a52f4b18b..848c5bec1 100644 --- a/src/new/config/reference.php +++ b/src/new/config/reference.php @@ -476,7 +476,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * datetime?: array{ * default_format?: scalar|Param|null, // Default: "Y-m-d\\TH:i:sP" * default_deserialization_formats?: list, - * default_timezone?: scalar|Param|null, // Default: "Europe/Berlin" + * default_timezone?: scalar|Param|null, // Default: "UTC" * cdata?: scalar|Param|null, // Default: true * }, * array_collection?: array{ @@ -576,7 +576,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * datetime?: array{ * default_format?: scalar|Param|null, // Default: "Y-m-d\\TH:i:sP" * default_deserialization_formats?: list, - * default_timezone?: scalar|Param|null, // Default: "Europe/Berlin" + * default_timezone?: scalar|Param|null, // Default: "UTC" * cdata?: scalar|Param|null, // Default: true * }, * array_collection?: array{ diff --git a/src/new/src/PSC/Shop/QueueBundle/Event/Order/Revocation/PositionRequest.php b/src/new/src/PSC/Shop/QueueBundle/Event/Order/Revocation/PositionRequest.php new file mode 100644 index 000000000..f037b03a5 --- /dev/null +++ b/src/new/src/PSC/Shop/QueueBundle/Event/Order/Revocation/PositionRequest.php @@ -0,0 +1,77 @@ + $this->order, + 'position' => $this->position, + ); + } + + public function setData($data) + { + $this->order = $data['order'] ?? null; + $this->position = $data['position'] ?? null; + } + + /** + * @return string + */ + public function getOrder() + { + return $this->order; + } + + /** + * @param string $order + */ + public function setOrder($order) + { + $this->order = $order; + } + + /** + * @return string + */ + public function getPosition() + { + return $this->position; + } + + /** + * @param string $position + */ + public function setPosition($position) + { + $this->position = $position; + } +} diff --git a/src/new/src/PSC/Shop/QueueBundle/Event/Order/Revocation/Request.php b/src/new/src/PSC/Shop/QueueBundle/Event/Order/Revocation/Request.php new file mode 100644 index 000000000..bb22928fd --- /dev/null +++ b/src/new/src/PSC/Shop/QueueBundle/Event/Order/Revocation/Request.php @@ -0,0 +1,97 @@ + $this->order, + 'alias' => $this->alias, + 'email' => $this->email, + ); + } + + public function setData($data) + { + $this->order = $data['order'] ?? null; + $this->alias = $data['alias'] ?? null; + $this->email = $data['email'] ?? null; + } + + /** + * @return string + */ + public function getOrder() + { + return $this->order; + } + + /** + * @param string $order + */ + public function setOrder($order) + { + $this->order = $order; + } + + /** + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * @param string $alias + */ + public function setAlias($alias) + { + $this->alias = $alias; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + */ + public function setEmail($email) + { + $this->email = $email; + } +} diff --git a/src/new/src/PSC/Shop/QueueBundle/Type/Mail.php b/src/new/src/PSC/Shop/QueueBundle/Type/Mail.php index 02a73e082..797d5afea 100755 --- a/src/new/src/PSC/Shop/QueueBundle/Type/Mail.php +++ b/src/new/src/PSC/Shop/QueueBundle/Type/Mail.php @@ -25,6 +25,8 @@ use PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Finish; use PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Start; use PSC\Shop\QueueBundle\Event\EventInterface; use PSC\Shop\QueueBundle\Event\Order\Create; +use PSC\Shop\QueueBundle\Event\Order\Revocation\PositionRequest as RevocationPositionRequest; +use PSC\Shop\QueueBundle\Event\Order\Revocation\Request as RevocationRequest; use PSC\Shop\QueueBundle\Event\Position\ApprovalExternalAccept; use PSC\Shop\QueueBundle\Event\Position\ApprovalExternalDeclined; use PSC\Shop\QueueBundle\Event\Position\ApprovalExternalRequest; @@ -1709,6 +1711,155 @@ class Mail implements QueueInterface, ConfigurableElementInterface return false; } + return true; + } + if ($event instanceof RevocationRequest) { + $templateVars->loadOrder($event->getOrder()); + $vars = $templateVars->getTwigVars(); + // Zusätzliche Variablen für die Mail an den Kunden inkl. Deep-Link + // auf die auftragsbezogene Widerrufsseite im Alt-System. + $vars['revocationEmail'] = $event->getEmail(); + $vars['revocationAlias'] = $event->getAlias(); + $vars['revocationLink'] = '/revocationform/order/uuid/' . $event->getOrder(); + try { + $message = new TemplatedEmail() + ->subject($subject->render($vars)) + ->from(new Address($from->render($vars), $fromName->render($vars))) + ->to(new Address($to->render($vars), $toName->render($vars))); + if ($text) { + $message->text($text->render($vars)); + } + + if ($bcc) { + $bccArray = explode(',', $bcc->render($vars)); + foreach ($bccArray as $bc) { + if (trim($bc) != '') { + $message->addBcc(trim($bc)); + } + } + } + + if ($html) { + $message->html($html->render(array_merge($vars, [ + 'email' => new WrappedTemplatedEmail($this->_template, $message), + ]))); + } + + foreach ($mailDoc->getFiles() as $file) { + if ($file['name'] != '' && $file['content'] != '') { + $fileContent = $this->_template->createTemplate($file['content']); + $fileName = $this->_template->createTemplate($file['name']); + $message->attach($fileContent->render($vars), $fileName->render($vars)); + } + } + $this->_logService->createLogEntry( + $templateVars->getOrder()->getShop(), + new Contact(), + LogEntry::INFO, + PSCShopQueueBundle::class, + $queue->getName(), + 'Revocation Request Mail send', + [ + 'message' => $message->getTextBody(), + 'from' => $from->render($vars), + 'to' => $to->render($vars), + 'subject' => $subject->render($vars), + ], + ); + $this->sendMail($message); + } catch (\Exception $e) { + $this->_logService->createLogEntry( + $templateVars->getOrder()->getShop(), + new Contact(), + LogEntry::ERROR, + PSCShopQueueBundle::class, + $queue->getName(), + 'Revocation Request Mail error', + [ + 'error' => $e->getMessage(), + ], + ); + $this->_error = $e->getMessage(); + return false; + } + + return true; + } + if ($event instanceof RevocationPositionRequest) { + $templateVars->loadOrder($event->getOrder()); + $vars = $templateVars->getPosTwigVars($event->getPosition()); + try { + $message = new TemplatedEmail() + ->subject($subject->render($vars)) + ->from( + new Address( + $from->render($templateVars->getTwigVars()), + $fromName->render($templateVars->getTwigVars()), + ), + ) + ->to( + new Address( + $to->render($templateVars->getTwigVars()), + $toName->render($templateVars->getTwigVars()), + ), + ); + if ($text) { + $message->text($text->render($vars)); + } + + if ($bcc) { + $bccArray = explode(',', $bcc->render($vars)); + foreach ($bccArray as $bc) { + if (trim($bc) != '') { + $message->addBcc(trim($bc)); + } + } + } + + if ($html) { + $message->html($html->render(array_merge($vars, [ + 'email' => new WrappedTemplatedEmail($this->_template, $message), + ]))); + } + + foreach ($mailDoc->getFiles() as $file) { + if ($file['name'] != '' && $file['content'] != '') { + $fileContent = $this->_template->createTemplate($file['content']); + $fileName = $this->_template->createTemplate($file['name']); + $message->attach($fileContent->render($vars), $fileName->render($vars)); + } + } + $this->_logService->createLogEntry( + $templateVars->getOrder()->getShop(), + new Contact(), + LogEntry::INFO, + PSCShopQueueBundle::class, + $queue->getName(), + 'Revocation Position Request Mail send', + [ + 'message' => $message->getTextBody(), + 'from' => $from->render($templateVars->getTwigVars()), + 'to' => $to->render($templateVars->getTwigVars()), + 'subject' => $subject->render($vars), + ], + ); + $this->sendMail($message); + } catch (\Exception $e) { + $this->_logService->createLogEntry( + $templateVars->getOrder()->getShop(), + new Contact(), + LogEntry::ERROR, + PSCShopQueueBundle::class, + $queue->getName(), + 'Revocation Position Request Mail error', + [ + 'error' => $e->getMessage(), + ], + ); + $this->_error = $e->getMessage(); + return false; + } + return true; } } diff --git a/src/new/version.yaml b/src/new/version.yaml index 54b5fe56e..7cba19c88 100755 --- a/src/new/version.yaml +++ b/src/new/version.yaml @@ -1,8 +1,20 @@ info: - datum: 10.06.2026 - release: 2.3.6 + datum: 23.06.2026 + release: 2.3.7 changelog: + - version: 2.3.7 + datum: 23.06.2026 + changes: + - "Dashboard: Speicherverbrauch von System- und Daten-Volume mit Icons" + - "Produkt: Option \"Widerrufsbutton aktivieren\" (pro Produkt)" + - "Auftragsdetails: Positionen-Ansicht überarbeitet (Spalten Widerruf/Status, Preise, Aktionen; Vorschaubilder wie in der Auftragsliste)" + - "Auftragsposition: Widerruf-Status mit Datum (ob/wann widerrufen) inkl. Anzeige im Backend" + - "Widerrufsformular im Shop unter /revocationform (Bestellnummer + E-Mail + Captcha)" + - "Deep-Link /revocationform/order/uuid/: Kunde kann pro Position widerrufen (Flag + Zeitpunkt werden gesetzt)" + - "Neue Events für die Mail-Queue: order_revocation_request (Widerruf angefordert) und order_revocation_position_request (Position widerrufen)" + - "Mail-Variablen order_revocation_request: order, shop, contact, revocationEmail, revocationAlias, revocationLink (Deep-Link-Pfad, z.B. https://{Shop-Domain}{{ revocationLink }})" + - "Mail-Variablen order_revocation_position_request: order, position, shop, contact" - version: 2.3.6 datum: 10.06.2026 changes: diff --git a/src/old/application/data/models/generated/BaseArticle.php b/src/old/application/data/models/generated/BaseArticle.php index b54f74356..0863e9353 100755 --- a/src/old/application/data/models/generated/BaseArticle.php +++ b/src/old/application/data/models/generated/BaseArticle.php @@ -124,6 +124,8 @@ abstract class BaseArticle extends Doctrine_Record $this->hasColumn('not_buy', 'boolean'); + $this->hasColumn('revoke_button_enable', 'boolean', 1); + $this->hasColumn('file', 'string', 255, array('type' => 'string', 'length' => '255')); $this->hasColumn('file1', 'string', 255, array('type' => 'string', 'length' => '255')); $this->hasColumn('file2', 'string', 255, array('type' => 'string', 'length' => '255')); diff --git a/src/old/application/data/models/generated/BaseOrderspos.php b/src/old/application/data/models/generated/BaseOrderspos.php index 0f15c6a1e..14d493f0d 100755 --- a/src/old/application/data/models/generated/BaseOrderspos.php +++ b/src/old/application/data/models/generated/BaseOrderspos.php @@ -103,6 +103,9 @@ abstract class BaseOrderspos extends Doctrine_Record $this->hasColumn('ref', 'string', 255); $this->hasColumn('kst', 'string', 255); + + $this->hasColumn('revoked', 'boolean', 1); + $this->hasColumn('revoked_at', 'timestamp'); } public function setUp() diff --git a/src/old/application/design/vorlagen/bootstrap4_api/config/revocationform.ini b/src/old/application/design/vorlagen/bootstrap4_api/config/revocationform.ini new file mode 100644 index 000000000..5dceb57bc --- /dev/null +++ b/src/old/application/design/vorlagen/bootstrap4_api/config/revocationform.ini @@ -0,0 +1,28 @@ +[revocation] +; general form metainformation +global.class ="form-horizontal" + +user.revocation.action = "/revocationform" +user.revocation.method = "post" + +user.revocation.legend = "Widerruf" + +; Bestellnummer +user.revocation.elements.ordernumber.type = "text" +user.revocation.elements.ordernumber.options.label = "Bestellnummer" +user.revocation.elements.ordernumber.options.required = true + +; Email +user.revocation.elements.self_email.type = "text" +user.revocation.elements.self_email.options.label = "Email" +user.revocation.elements.self_email.options.required = true +user.revocation.elements.self_email.options.validators.email.validator = "EmailAddress" + +; Captcha +user.revocation.elements.cp.type = "captcha" +user.revocation.elements.cp.options.label = "" +user.revocation.elements.cp.options.captcha.captcha = "Image" + +user.revocation.elements.submit.type = "submit" +user.revocation.elements.submit.options.class = "submit btn btn-success btn-large" +user.revocation.elements.submit.options.label = "Widerruf absenden" diff --git a/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/done.phtml b/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/done.phtml new file mode 100644 index 000000000..a34bca11b --- /dev/null +++ b/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/done.phtml @@ -0,0 +1,17 @@ +
+ +
+ +
+ +

translate('Widerruf erhalten') ?>

+ +

+ translate('Wir haben Ihren Widerruf erhalten und werden ihn bearbeiten.')?> +

+ +
+ +
+ +
diff --git a/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/index.phtml b/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/index.phtml new file mode 100644 index 000000000..39da18972 --- /dev/null +++ b/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/index.phtml @@ -0,0 +1,52 @@ +
+ +
+ +

translate('Widerruf') ?>

+ +

translate('Sie möchten eine Bestellung widerrufen?')?>

+ +
+
+ +
+ +

+ translate('Geben Sie bitte Ihre Bestellnummer und die E-Mail-Adresse Ihrer Bestellung an und fahren Sie mit "Widerruf absenden" fort.')?> +

+
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ form->cp ?> +
+ + +
+ +
+
+ +
diff --git a/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/order.phtml b/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/order.phtml new file mode 100644 index 000000000..7bf5da00a --- /dev/null +++ b/src/old/application/design/vorlagen/bootstrap4_api/templates/revocationform/order.phtml @@ -0,0 +1,41 @@ +
+
+

translate('Widerruf') ?> – escape($this->order->alias) ?>

+

translate('Wählen Sie die Positionen aus, die Sie widerrufen möchten.')?>

+
+
+ +
+ + + + + + + + + + + positions as $pos): ?> + + + + + + + + +
translate('Pos') ?>translate('Produkt') ?>translate('Auflage') ?>translate('Widerruf') ?>
escape($pos->pos) ?>escape($pos->Article->title) ?>escape($pos->count) ?> + revoked): ?> + translate('Widerrufen am') ?> escape($pos->revoked_at) ?> + Article->revoke_button_enable): ?> +
+ + +
+ + translate('Widerruf nicht möglich') ?> + +
+
+
diff --git a/src/old/application/design/vorlagen/tailwindcss/config/revocationform.ini b/src/old/application/design/vorlagen/tailwindcss/config/revocationform.ini new file mode 100644 index 000000000..5dceb57bc --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss/config/revocationform.ini @@ -0,0 +1,28 @@ +[revocation] +; general form metainformation +global.class ="form-horizontal" + +user.revocation.action = "/revocationform" +user.revocation.method = "post" + +user.revocation.legend = "Widerruf" + +; Bestellnummer +user.revocation.elements.ordernumber.type = "text" +user.revocation.elements.ordernumber.options.label = "Bestellnummer" +user.revocation.elements.ordernumber.options.required = true + +; Email +user.revocation.elements.self_email.type = "text" +user.revocation.elements.self_email.options.label = "Email" +user.revocation.elements.self_email.options.required = true +user.revocation.elements.self_email.options.validators.email.validator = "EmailAddress" + +; Captcha +user.revocation.elements.cp.type = "captcha" +user.revocation.elements.cp.options.label = "" +user.revocation.elements.cp.options.captcha.captcha = "Image" + +user.revocation.elements.submit.type = "submit" +user.revocation.elements.submit.options.class = "submit btn btn-success btn-large" +user.revocation.elements.submit.options.label = "Widerruf absenden" diff --git a/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/done.phtml b/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/done.phtml new file mode 100644 index 000000000..63465e665 --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/done.phtml @@ -0,0 +1,7 @@ +
+ +

translate('Widerruf erhalten') ?>

+ +

translate('Wir haben Ihren Widerruf erhalten und werden ihn bearbeiten.')?>

+ +
diff --git a/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/index.phtml b/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/index.phtml new file mode 100644 index 000000000..d4d6dba4c --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/index.phtml @@ -0,0 +1,13 @@ +
+ +

translate('Widerruf') ?>

+ +

translate('Sie möchten eine Bestellung widerrufen?')?>

+ +

translate('Geben Sie bitte Ihre Bestellnummer und die E-Mail-Adresse Ihrer Bestellung an und fahren Sie mit "Widerruf absenden" fort.')?>

+ +
+ partial('completeform.phtml', array('buttonName' => 'Widerruf absenden', 'buttonClass' => '', 'form' => $this->form)) ?> +
+ +
diff --git a/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/order.phtml b/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/order.phtml new file mode 100644 index 000000000..91482ee53 --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss/templates/revocationform/order.phtml @@ -0,0 +1,46 @@ +
+ +

translate('Widerruf') ?>

+

translate('Auftrag') ?>: escape($this->order->alias) ?> · translate('Wählen Sie die Positionen aus, die Sie widerrufen möchten.')?>

+ +
+ + + + + + + + + + + positions as $pos): ?> + + + + + + + + +
translate('Pos') ?>translate('Produkt') ?>translate('Auflage') ?>translate('Widerruf') ?>
escape($pos->pos) ?>escape($pos->Article->title) ?>escape($pos->count) ?> + revoked): ?> + + + translate('Widerrufen am') ?> escape($pos->revoked_at) ?> + + Article->revoke_button_enable): ?> +
+ + +
+ + + + translate('Widerruf nicht möglich') ?> + + +
+
+ +
diff --git a/src/old/application/design/vorlagen/tailwindcss_wp/config/revocationform.ini b/src/old/application/design/vorlagen/tailwindcss_wp/config/revocationform.ini new file mode 100644 index 000000000..5dceb57bc --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss_wp/config/revocationform.ini @@ -0,0 +1,28 @@ +[revocation] +; general form metainformation +global.class ="form-horizontal" + +user.revocation.action = "/revocationform" +user.revocation.method = "post" + +user.revocation.legend = "Widerruf" + +; Bestellnummer +user.revocation.elements.ordernumber.type = "text" +user.revocation.elements.ordernumber.options.label = "Bestellnummer" +user.revocation.elements.ordernumber.options.required = true + +; Email +user.revocation.elements.self_email.type = "text" +user.revocation.elements.self_email.options.label = "Email" +user.revocation.elements.self_email.options.required = true +user.revocation.elements.self_email.options.validators.email.validator = "EmailAddress" + +; Captcha +user.revocation.elements.cp.type = "captcha" +user.revocation.elements.cp.options.label = "" +user.revocation.elements.cp.options.captcha.captcha = "Image" + +user.revocation.elements.submit.type = "submit" +user.revocation.elements.submit.options.class = "submit btn btn-success btn-large" +user.revocation.elements.submit.options.label = "Widerruf absenden" diff --git a/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/done.phtml b/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/done.phtml new file mode 100644 index 000000000..63465e665 --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/done.phtml @@ -0,0 +1,7 @@ +
+ +

translate('Widerruf erhalten') ?>

+ +

translate('Wir haben Ihren Widerruf erhalten und werden ihn bearbeiten.')?>

+ +
diff --git a/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/index.phtml b/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/index.phtml new file mode 100644 index 000000000..d4d6dba4c --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/index.phtml @@ -0,0 +1,13 @@ +
+ +

translate('Widerruf') ?>

+ +

translate('Sie möchten eine Bestellung widerrufen?')?>

+ +

translate('Geben Sie bitte Ihre Bestellnummer und die E-Mail-Adresse Ihrer Bestellung an und fahren Sie mit "Widerruf absenden" fort.')?>

+ +
+ partial('completeform.phtml', array('buttonName' => 'Widerruf absenden', 'buttonClass' => '', 'form' => $this->form)) ?> +
+ +
diff --git a/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/order.phtml b/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/order.phtml new file mode 100644 index 000000000..91482ee53 --- /dev/null +++ b/src/old/application/design/vorlagen/tailwindcss_wp/templates/revocationform/order.phtml @@ -0,0 +1,46 @@ +
+ +

translate('Widerruf') ?>

+

translate('Auftrag') ?>: escape($this->order->alias) ?> · translate('Wählen Sie die Positionen aus, die Sie widerrufen möchten.')?>

+ +
+ + + + + + + + + + + positions as $pos): ?> + + + + + + + + +
translate('Pos') ?>translate('Produkt') ?>translate('Auflage') ?>translate('Widerruf') ?>
escape($pos->pos) ?>escape($pos->Article->title) ?>escape($pos->count) ?> + revoked): ?> + + + translate('Widerrufen am') ?> escape($pos->revoked_at) ?> + + Article->revoke_button_enable): ?> +
+ + +
+ + + + translate('Widerruf nicht möglich') ?> + + +
+
+ +
diff --git a/src/old/application/modules/default/controllers/RevocationformController.php b/src/old/application/modules/default/controllers/RevocationformController.php new file mode 100644 index 000000000..91772288a --- /dev/null +++ b/src/old/application/modules/default/controllers/RevocationformController.php @@ -0,0 +1,153 @@ +_configPath . '/revocationform.ini', 'revocation'); + + if ($config->global) { + $form = new EasyBib_Form($config->user->revocation); + $form->addAttribs(array('class' => $config->global->class, 'id' => 'revocationform')); + } else { + $form = new Zend_Form($config->user->revocation); + $form->addAttribs(array('class' => 'niceform', 'id' => 'revocationform')); + } + + if (isset($form->cp)) { + $form->cp->setOptions(array( + 'captcha' => array( + 'captcha' => 'Image', + 'font' => APPLICATION_PATH . '/fonts/verdana.ttf', + 'imgDir' => PUBLIC_PATH . '/temp/thumb/', + 'imgUrl' => '/temp/thumb/', + 'wordLen' => '4', + ), + )); + } + + if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) { + $order = Doctrine_Query::create() + ->from('Orders o') + ->leftJoin('o.Contact c') + ->where('o.shop_id = ? AND o.alias = ? AND c.self_email = ? AND o.enable = 1', array( + $this->shop->id, + $this->_getParam('ordernumber'), + $this->_getParam('self_email'), + )) + ->fetchOne(); + + if ($order) { + $dbMongo = TP_Mongo::getInstance(); + $dbMongo->Job->insertOne(array( + 'shop' => $this->shop->id, + 'event' => 'order_revocation_request', + 'data' => array( + 'order' => $order->uuid, + 'alias' => $order->alias, + 'email' => $this->_getParam('self_email'), + ), + 'created' => new MongoDB\BSON\UTCDateTime(), + 'updated' => new MongoDB\BSON\UTCDateTime(), + )); + + $this->view->priorityMessenger('Ihr Widerruf wurde erfolgreich übermittelt', 'success'); + $this->redirectSpeak('/revocationform/done'); + } else { + $this->view->priorityMessenger('Es wurde kein passender Auftrag gefunden', 'error'); + $this->redirectSpeak('/revocationform'); + } + } + + $this->view->form = $form; + + if ($this->shop->private && !Zend_Auth::getInstance()->hasIdentity()) { + $this->_helper->layout->setLayout('private'); + } else { + $this->_helper->layout->setLayout('default'); + } + } + + public function doneAction() + { + if ($this->shop->private && !Zend_Auth::getInstance()->hasIdentity()) { + $this->_helper->layout->setLayout('private'); + } else { + $this->_helper->layout->setLayout('default'); + } + } + + /** + * Deep-Link auf einen konkreten Auftrag (per UUID). Hier kann der Kunde + * final pro Position widerrufen. Beim Widerruf werden das Flag und der + * Zeitpunkt auf der Position gesetzt und das Event + * order_revocation_position_request ausgelöst. + */ + public function orderAction() + { + $uuid = $this->_getParam('uuid'); + + $order = Doctrine_Query::create() + ->from('Orders o') + ->where('o.shop_id = ? AND o.uuid = ? AND o.enable = 1', array($this->shop->id, $uuid)) + ->fetchOne(); + + if (!$order) { + $this->view->priorityMessenger('Es wurde kein passender Auftrag gefunden', 'error'); + $this->redirectSpeak('/revocationform'); + return; + } + + // Eine Position widerrufen + if ($this->getRequest()->isPost() && $this->_getParam('pos')) { + /** @var Orderspos $pos */ + $pos = Doctrine_Query::create() + ->from('Orderspos p') + ->leftJoin('p.Article a') + ->where('p.uuid = ? AND p.orders_id = ?', array($this->_getParam('pos'), $order->id)) + ->fetchOne(); + + if ($pos && $pos->Article && $pos->Article->revoke_button_enable && !$pos->revoked) { + $pos->revoked = 1; + $pos->revoked_at = date('Y-m-d H:i:s'); + $pos->save(); + + $dbMongo = TP_Mongo::getInstance(); + $dbMongo->Job->insertOne(array( + 'shop' => $this->shop->id, + 'event' => 'order_revocation_position_request', + 'data' => array( + 'order' => $order->uuid, + 'position' => $pos->uuid, + ), + 'created' => new MongoDB\BSON\UTCDateTime(), + 'updated' => new MongoDB\BSON\UTCDateTime(), + )); + + $this->view->priorityMessenger('Die Position wurde erfolgreich widerrufen', 'success'); + } else { + $this->view->priorityMessenger('Für diese Position ist kein Widerruf möglich', 'error'); + } + + $this->redirectSpeak('/revocationform/order/uuid/' . $order->uuid); + return; + } + + $this->view->order = $order; + $this->view->positions = $order->Orderspos; + + if ($this->shop->private && !Zend_Auth::getInstance()->hasIdentity()) { + $this->_helper->layout->setLayout('private'); + } else { + $this->_helper->layout->setLayout('default'); + } + } +} diff --git a/src/old/library/TP/Controller/Action.php b/src/old/library/TP/Controller/Action.php index bbacee8da..455eedfb4 100755 --- a/src/old/library/TP/Controller/Action.php +++ b/src/old/library/TP/Controller/Action.php @@ -523,6 +523,7 @@ class TP_Controller_Action extends Zend_Controller_Action !Zend_Auth::getInstance()->hasIdentity() && $this->getRequest()->getParam('controller') != 'user' && $this->getRequest()->getParam('controller') != 'cms' && + $this->getRequest()->getParam('controller') != 'revocationform' && $this->getRequest()->getParam('action') != 'login' ) { $this->_redirect('/user/login'); diff --git a/src/old/library/TP/Plugin/Auth.php b/src/old/library/TP/Plugin/Auth.php index be28f10e7..d5538a713 100755 --- a/src/old/library/TP/Plugin/Auth.php +++ b/src/old/library/TP/Plugin/Auth.php @@ -59,6 +59,13 @@ class TP_Plugin_Auth extends Zend_Controller_Plugin_Abstract $resource = $controller; + // Öffentlich zugängliche Controller, die (noch) keinen ACL-Eintrag in der + // Datenbank besitzen. Das Widerrufsformular ist für nicht eingeloggte + // Kunden gedacht und wird daher hier freigegeben. + if ($module == 'default' && $controller == 'revocationform') { + return; + } + if (!$this->_acl->has($module.'_'.$resource)) { $this->_request->setModuleName($this->_nosite['module']); $this->_request->setControllerName($this->_nosite['controller']);