Intégration du module OrderStatusNotify

This commit is contained in:
2020-03-02 12:19:02 +01:00
parent b8430cf78e
commit 04a53140c2
22 changed files with 2793 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<hooks>
<hook id="orderstatusnotify.hook.back" class="OrderStatusNotify\Hook\BackHook" scope="request">
<tag name="hook.event_listener" event="main.top-menu-tools" type="back" />
</hook>
</hooks>
<services>
<service id="orderstatusnotify.mailing.service" class="OrderStatusNotify\EventListeners\OrderStatusListener">
<argument type="service" id="mailer" />
<tag name="kernel.event_subscriber"/>
</service>
</services>
</config>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
<fullnamespace>OrderStatusNotify\OrderStatusNotify</fullnamespace>
<descriptive locale="en_US">
<title>Send email on order status' change</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Envoi d'email lors du changement de statut d'une commande</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.0</version>
<authors>
<author>
<name>Laurent LE CORRE</name>
<email>laurent@thecoredev.fr</email>
</author>
</authors>
<type>classic</type>
<thelia>2.3.0</thelia>
<stability>beta</stability>
</module>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="orderstatusnotify.back" path="/admin/module/orderstatusnotify">
<default key="_controller">OrderStatusNotify\Controller\Back\OrderStatusController::showStatus</default>
</route>
<route id="orderstatusnotify.toggle-online" path="/admin/module/orderstatusnotify/toggle-online">
<default key="_controller">OrderStatusNotify\Controller\Back\OrderStatusController::setToggleVisibilityAction</default>
</route>
</routes>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia" namespace="OrderStatusNotify\Model">
<table name="order_status_notification">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="order_status_id" required="true" type="INTEGER" />
<column name="to_notify" required="true" type="BOOLEAN" default="false" />
<foreign-key foreignTable="order_status" name="fk_order_status_notify_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="order_status_id" />
</foreign-key>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,2 @@
# Sqlfile -> Database map
thelia.sql=thelia

View File

@@ -0,0 +1,40 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- order_status_notification
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `order_status_notification`;
CREATE TABLE `order_status_notification`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`order_status_id` INTEGER NOT NULL,
`to_notify` TINYINT(1) DEFAULT 0 NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_order_status_notify_id` (`order_status_id`),
CONSTRAINT `fk_order_status_notify_id`
FOREIGN KEY (`order_status_id`)
REFERENCES `order_status` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
-- ---------------------------------------------------------------------
-- Affectation du modèle d'email
-- ---------------------------------------------------------------------
INSERT INTO `message` (name,secured,text_layout_file_name,text_template_file_name,html_layout_file_name,html_template_file_name,created_at,updated_at,version,version_created_at,version_created_by) VALUES
('order_status_changed',NULL,NULL,NULL,NULL,'order_status_changed.html','2020-02-12 19:18:35.0','2020-03-01 09:56:48.0',3,'2020-03-01 09:56:48.0',NULL);
INSERT INTO `message_i18n` (id,locale,title,subject,text_message,html_message)
(SELECT max(id), 'fr_FR','Informer le client du changement de statut de sa commande','Votre commande {$order_ref} chez {config key="store_name"}',NULL,'Bonjour,
Votre commande référence {$order_ref} vient de passer à l''état {$new_status}.'
from `message`);