Initial Commit

This commit is contained in:
2019-11-21 12:25:31 +01:00
commit f4aabcb9b1
13959 changed files with 787761 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Cheque;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Install\Database;
use Thelia\Model\MessageQuery;
use Thelia\Model\Order;
use Thelia\Module\BaseModule;
use Thelia\Module\PaymentModuleInterface;
class Cheque extends BaseModule implements PaymentModuleInterface
{
const MESSAGE_DOMAIN = "Cheque";
public function pay(Order $order)
{
// Nothing special to to.
}
/**
*
* This method is call on Payment loop.
*
* If you return true, the payment method will de display
* If you return false, the payment method will not be display
*
* @return boolean
*/
public function isValidPayment()
{
return $this->getCurrentOrderTotalAmount() > 0;
}
public function postActivation(ConnectionInterface $con = null)
{
$database = new Database($con);
// Insert email message
$database->insertSql(null, array(__DIR__ . "/Config/setup.sql"));
}
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
{
// Delete our message
if (null !== $message = MessageQuery::create()->findOneByName('order_confirmation_cheque')) {
$message->delete($con);
}
parent::destroy($con, $deleteModuleData);
}
/**
* if you want, you can manage stock in your module instead of order process.
* Return false if you want to manage yourself the stock
*
* @return bool
*/
public function manageStockOnCreation()
{
return false;
}
}

View File

@@ -0,0 +1,25 @@
<?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">
<forms>
<form name="cheque.instructions.configure" class="Cheque\Form\ConfigurationForm" />
</forms>
<hooks>
<hook id="cheque.hook" class="Cheque\Hook\HookManager" scope="request">
<tag name="hook.event_listener" event="module.configuration" type="back" templates="render:module_configuration.html" />
<tag name="hook.event_listener" event="order-placed.additional-payment-info" type="front" method="onAdditionalPaymentInfo" />
</hook>
</hooks>
<services>
<service id="send.cheque.mail" class="Cheque\Listener\SendPaymentConfirmationEmail" scope="request">
<argument type="service" id="mailer"/>
<tag name="kernel.event_subscriber"/>
</service>
</services>
</config>

View File

@@ -0,0 +1,25 @@
<?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_1.xsd">
<fullnamespace>Cheque\Cheque</fullnamespace>
<descriptive locale="en_US">
<title>Cheque</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Cheque</title>
</descriptive>
<images-folder>images</images-folder>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>2.3.1</version>
<author>
<name>Manuel Raynaud</name>
<email>manu@raynaud.io</email>
</author>
<type>payment</type>
<thelia>2.2.0</thelia>
<stability>alpha</stability>
</module>

View File

@@ -0,0 +1,9 @@
<?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="cheque.configure" path="/admin/cheque/configure" methods="post">
<default key="_controller">Cheque\Controller\ConfigureController::configure</default>
</route>
</routes>

View File

@@ -0,0 +1,32 @@
-- ---------------------------------------------------------------------
-- Mail template for cheque
-- ---------------------------------------------------------------------
-- First, delete existing entries
SET @var := 0;
SELECT @var := `id` FROM `message` WHERE name="order_confirmation_cheque";
DELETE FROM `message` WHERE `id`=@var;
-- Then add new entries
SELECT @max := MAX(`id`) FROM `message`;
SET @max := @max+1;
-- insert message
INSERT INTO `message` (`id`, `name`, `secured`) VALUES
(@max,
'order_confirmation_cheque',
'0'
);
-- and mail templates
INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES
(@max,
'en_US',
'Confirmation of payment by cheque',
'Payment of order {$order_ref}', 'Dear customer,\r\nThis is a confirmation of the payment by cheque of your order {$order_ref} on our shop.\r\nYour invoice is now available in your customer account at {config key="url_site"}\r\nThank you again for your purchase.\r\nThe {config key="store_name"} team.', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">\r\n<head>\r\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\r\n <title>courriel de confirmation de commande de {config key="url_site"} </title>\r\n <style type="text/css">\r\n body {\r\n font-family: Arial, Helvetica, sans-serif;\r\n font-size: 100%;\r\n text-align: center;\r\n }\r\n #liencompte {\r\n margin: 15px 0;\r\n text-align: center;\r\n font-size: 10pt;\r\n }\r\n #wrapper {\r\n width: 480pt;\r\n margin: 0 auto;\r\n }\r\n #entete {\r\n padding-bottom: 20px;\r\n margin-bottom: 10px;\r\n border-bottom: 1px dotted #000;\r\n }\r\n #logotexte {\r\n float: left;\r\n width: 180pt;\r\n height: 75pt;\r\n border: 1pt solid #000;\r\n font-size: 18pt;\r\n text-align: center;\r\n }\r\n </style>\r\n</head>\r\n<body>\r\n<div id="wrapper">\r\n <div id="entete">\r\n <h1 id="logotexte">{config key="store_name"}</h1>\r\n <h2 id="info">The payment of your order is confirmed</h2>\r\n <h3 id="commande">Reference {$order_ref} </h3>\r\n </div>\r\n <p id="liencompte">\r\n Your invoice is now available in your customer account on\r\n <a href="{config key="url_site"}">{config key="store_name"}</a>.\r\n </p>\r\n <p>Thank you for your order !</p>\r\n <p>The {config key="store_name"} team.</p>\r\n</div>\r\n</body>\r\n</html>'
),
(@max,
'fr_FR',
'Confirmation de paiement par chèque',
'Paiement de la commande : {$order_ref}',
'Cher client,\r\nCe message confirme le paiement par chèque de votre commande numero {$order_ref} sur notre boutique.\r\nVotre facture est maintenant disponible dans votre compte client à l''adresse {config key="url_site"}\r\nMerci encore pour votre achat !\r\nL''équipe {config key="store_name"}', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr">\r\n<head>\r\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\r\n <title>Confirmation du paiement de votre commande sur {config key="url_site"} </title>\r\n <style type="text/css">\r\n body {\r\n font-family: Arial, Helvetica, sans-serif;\r\n font-size: 100%;\r\n text-align: center;\r\n }\r\n #liencompte {\r\n margin: 15px 0;\r\n text-align: center;\r\n font-size: 10pt;\r\n }\r\n #wrapper {\r\n width: 480pt;\r\n margin: 0 auto;\r\n }\r\n #entete {\r\n padding-bottom: 20px;\r\n margin-bottom: 10px;\r\n border-bottom: 1px dotted #000;\r\n }\r\n #logotexte {\r\n float: left;\r\n width: 180pt;\r\n height: 75pt;\r\n border: 1pt solid #000;\r\n font-size: 18pt;\r\n text-align: center;\r\n }\r\n </style>\r\n</head>\r\n<body>\r\n<div id="wrapper">\r\n <div id="entete">\r\n <h1 id="logotexte">{config key="store_name"}</h1>\r\n <h2 id="info">Confirmation du paiement de votre commande</h2>\r\n <h3 id="commande">N&deg; {$order_ref}</h3>\r\n </div>\r\n <p id="liencompte">\r\n Le suivi de votre commande est disponible dans la rubrique mon compte sur\r\n <a href="{config key="url_site"}">{config key="url_site"}</a>\r\n </p>\r\n <p>Merci pour votre achat !</p>\r\n <p>L''équipe {config key="store_name"}</p>\r\n</div>\r\n</body>\r\n</html>'
);

View File

@@ -0,0 +1,98 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Cheque\Controller;
use Cheque\Cheque;
use Cheque\Form\ConfigurationForm;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Tools\URL;
/**
* Class SetTransferConfig
* @package WireTransfer\Controller
* @author Thelia <info@thelia.net>
*/
class ConfigureController extends BaseAdminController
{
public function configure()
{
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'Cheque', AccessManager::UPDATE)) {
return $response;
}
// Initialize the potential exception
$ex = null;
// Create the Form from the request
$configurationForm = $this->createForm('cheque.instructions.configure');
try {
// Check the form against constraints violations
$form = $this->validateForm($configurationForm, "POST");
// Get the form field values
$data = $form->getData();
Cheque::setConfigValue('instructions', $data['instructions'], $this->getCurrentEditionLocale());
Cheque::setConfigValue('payable_to', $data['payable_to']);
// Log configuration modification
$this->adminLogAppend(
"cheque.configuration.message",
AccessManager::UPDATE,
sprintf("Cheque instructions configuration updated")
);
// Everything is OK.
return new RedirectResponse(URL::getInstance()->absoluteUrl('/admin/module/Cheque'));
} catch (FormValidationException $ex) {
// Form cannot be validated. Create the error message using
// the BaseAdminController helper method.
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
}
catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();
}
// At this point, the form has errors, and should be redisplayed. We don not redirect,
// just redisplay the same template.
// Setup the Form error context, to make error information available in the template.
$this->setupFormErrorContext(
$this->getTranslator()->trans("Cheque instructions configuration", [], Cheque::MESSAGE_DOMAIN),
$error_msg,
$configurationForm,
$ex
);
// Do not redirect at this point, or the error context will be lost.
// Just redisplay the current template.
return $this->render('module-configure', array('module_code' => 'Cheque'));
}
}

View File

@@ -0,0 +1,90 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Cheque\Form;
use Cheque\Cheque;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
/**
* Class ConfigurationForm
* @package Cheque\Form
* @author Thelia <info@thelia.net>
*/
class ConfigurationForm extends BaseForm
{
protected function trans($str, $params = [])
{
return Translator::getInstance()->trans($str, $params, Cheque::MESSAGE_DOMAIN);
}
protected function buildForm()
{
$this->formBuilder
->add(
'payable_to',
'text',
[
'constraints' => [ new NotBlank() ],
'label' => $this->trans('Cheque is payable to: '),
'label_attr' => [
'for' => 'payable_to',
'help' => $this->trans('The name to which the cheque shoud be payable to.')
],
'attr' => [
'rows' => 10,
'placeholder' => $this->trans('Pay cheque to')
]
]
)
->add(
'instructions',
'textarea',
[
'constraints' => [],
'required' => false,
'label' => $this->trans('Cheque instructions'),
'label_attr' => [
'for' => 'namefield',
'help' => $this->trans('Please enter here the payment by cheque instructions')
],
'attr' => [
'rows' => 10,
'placeholder' => $this->trans('Payment instruction')
]
]
)
;
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return 'cheque_configuration_instructions';
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Cheque\Hook;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
/**
* Class HookManager
*
* @package Cheque\Hook
* @author Franck Allimant <franck@cqfdev.fr>
*/
class HookManager extends BaseHook {
public function onAdditionalPaymentInfo(HookRenderEvent $event)
{
$content = $this->render("order-placed.additional-payment-info.html", [
'placed_order_id' => $event->getArgument('placed_order_id')
]);
$event->add($content);
}
}

View File

@@ -0,0 +1,5 @@
<?php
return [
'Cheque instructions configuration' => 'Scheck-Anleitungen-Konfiguration',
];

View File

@@ -0,0 +1,5 @@
<?php
return array(
'Cheque instructions configuration' => 'Cheque instructions configuration',
);

View File

@@ -0,0 +1,5 @@
<?php
return [
'Cheque instructions configuration' => 'Instructions de paiement par chèque',
];

View File

@@ -0,0 +1,5 @@
<?php
return [
'Cheque instructions configuration' => 'Çek yönergeleri yapılandırma',
];

View File

@@ -0,0 +1,11 @@
<?php
return [
'Cheque instructions' => 'Scheck-Anweisungen',
'Cheque instructions configuration' => 'Scheck-Anleitungen-Konfiguration',
'Cheque is payable to: ' => 'Scheck ist zahlbar an: ',
'Pay cheque to' => 'Scheck bezahlen an',
'Payment instruction' => 'Zahlungsanweisungen',
'Please enter here the payment by cheque instructions' => 'Bitte geben Sie hier die Zahlung durch Scheck Anweisungen ein',
'The name to which the cheque shoud be payable to.' => 'Der Name, an den der Scheck bezahlbar sein soll.',
];

View File

@@ -0,0 +1,11 @@
<?php
return array(
'Cheque instructions' => 'Cheque instructions',
'Cheque instructions configuration' => 'Cheque instructions configuration',
'Cheque is payable to: ' => 'Cheque is payable to: ',
'Pay cheque to' => 'Pay cheque to',
'Payment instruction' => 'Payment instruction',
'Please enter here the payment by cheque instructions' => 'Please enter here the payment by cheque instructions',
'The name to which the cheque shoud be payable to.' => 'The name to which the cheque shoud be payable to.',
);

View File

@@ -0,0 +1,11 @@
<?php
return [
'Cheque instructions' => 'Instructions de paiement',
'Cheque instructions configuration' => 'Instructions de paiement par chèque',
'Cheque is payable to: ' => 'Ordre du chèque',
'Pay cheque to' => 'Ordre du chèque',
'Payment instruction' => 'Instructions de paiement',
'Please enter here the payment by cheque instructions' => 'Indiquez ici les instructions particulières de paiement par chèque',
'The name to which the cheque shoud be payable to.' => 'Le nom à fare figurer sur le chèque',
];

View File

@@ -0,0 +1,6 @@
<?php
return [
'Be sure to sign your cheque !' => 'Vergessen Sie nicht, Ihren Scheck zu unterschreiben !',
'Please make your cheque payable to <b>%name</b>, and send it to the following address :' => 'Bitte stellen Sie den Scheck auf <b>%name</b>, und senden Sie es an die folgende Adresse : ',
];

View File

@@ -0,0 +1,6 @@
<?php
return array(
'Be sure to sign your cheque !' => 'Be sure to sign your cheque !',
'Please make your cheque payable to <b>%name</b>, and send it to the following address :' => 'Please make your cheque payable to <b>%name</b>, and send it to the following address :',
);

View File

@@ -0,0 +1,6 @@
<?php
return [
'Be sure to sign your cheque !' => 'N\'oubliez par de signer votre chèque !',
'Please make your cheque payable to <b>%name</b>, and send it to the following address :' => 'Merci de libeller votre chèque à l\'ordre de %name, et de l\'expédier à l\'adresse suivante :',
];

View File

@@ -0,0 +1,6 @@
<?php
return [
'Be sure to sign your cheque !' => 'Çekini imzalamak emin olun!',
'Please make your cheque payable to <b>%name</b>, and send it to the following address :' => 'Lütfen, Çek <b>%name</b> için ödenecek olun ve aşağıdaki adrese gönderin:',
];

View File

@@ -0,0 +1,11 @@
<?php
return [
'Cheque instructions' => 'Çek yönergeleri',
'Cheque instructions configuration' => 'Çek yönergeleri yapılandırma',
'Cheque is payable to: ' => 'Çek için ödenir: ',
'Pay cheque to' => 'Çek için ödeme',
'Payment instruction' => 'Ödeme talimatı',
'Please enter here the payment by cheque instructions' => 'Lütfen burada ödeme çek yönergeleri tarafından girin',
'The name to which the cheque shoud be payable to.' => 'Adı için çek shoud için ödenecek.',
];

View File

@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -0,0 +1,85 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Cheque\Listener;
use Cheque\Cheque;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Action\BaseAction;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Mailer\MailerFactory;
/**
* Class SendEMail
* @package IciRelais\Listener
* @author Thelia <info@thelia.net>
*/
class SendPaymentConfirmationEmail extends BaseAction implements EventSubscriberInterface
{
/**
* @var MailerFactory
*/
protected $mailer;
public function __construct(MailerFactory $mailer)
{
$this->mailer = $mailer;
}
/**
* @param OrderEvent $event
*
* Check if we're the payment module, and send the payment confirmation email to the customer if it's the case.
*/
public function sendConfirmationEmail(OrderEvent $event)
{
if ($event->getOrder()->getPaymentModuleId() === Cheque::getModuleId()) {
if ($event->getOrder()->isPaid()) {
$order = $event->getOrder();
$this->mailer->sendEmailToCustomer(
'order_confirmation_cheque',
$order->getCustomer(),
[
'order_id' => $order->getId(),
'order_ref' => $order->getRef()
]
);
}
}
}
/**
* @inheritdoc
*/
public static function getSubscribedEvents()
{
return array(
TheliaEvents::ORDER_UPDATE_STATUS => array("sendConfirmationEmail", 128)
);
}
}

View File

@@ -0,0 +1,11 @@
{
"name": "thelia/cheque-module",
"license": "LGPL-3.0+",
"type": "thelia-module",
"require": {
"thelia/installer": "~1.1"
},
"extra": {
"installer-name": "Cheque"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,55 @@
{if isset($smarty.get.errmes) && !empty($smarty.get.errmes)}
<div class="alert alert-danger">
{$smarty.get.errmes}
</div>
{/if}
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-12 title title-without-tabs">
{intl d='cheque.bo.default' l="Cheque instructions configuration"}
</div>
</div>
<div class="form-container">
<div class="row">
<div class="col-md-12">
{form name="cheque.instructions.configure"}
<form action="{url path="/admin/cheque/configure"}" method="post">
{include
file = "includes/inner-form-toolbar.html"
hide_submit_buttons = false
page_url = {url path="/admin/module/Cheque"}
close_url = {url path="/admin/modules"}
}
{form_hidden_fields}
{if $form_error}
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger">{$form_error_message}</div>
</div>
</div>
{/if}
{loop type="module-config" name="get-payable-to" module="Cheque" variable="payable_to"}
{render_form_field field="payable_to" value=$VALUE}
{/loop}
{loop type="module-config" name="get-instruction" module="Cheque" variable="instructions" locale=$edit_language_locale}
{render_form_field field="instructions" extra_class="wysiwyg" value=$VALUE}
{/loop}
</form>
{/form}
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,21 @@
{loop type="module-config" name="cheque-instructions" module="cheque" variable="payable_to"}
<p>{intl d='cheque.fo.default' l="Please make your cheque payable to <b>%name</b>, and send it to the following address :" name={$VALUE}}</p>
{/loop}
<blockquote>
{config key="store_name"}<br>
{config key="store_address1"}<br />
{if ! empty({config key="store_address2"})}{config key="store_address2"}<br />{/if}
{if ! empty({config key="store_address3"})}{config key="store_address3"}<br />{/if}
{config key="store_zipcode"}, {config key="store_city"}<br />
{if {config key="store_country"}}
{loop type="country" name="store_country" id={config key="store_country"}}
{$TITLE}<br />
{/loop}
{/if}
</blockquote>
<p><span class="glyphicon glyphicon-warning-sign"></span> {intl d='cheque.fo.default' l="Be sure to sign your cheque !"}</p>
{loop type="module-config" name="cheque-instructions" module="cheque" variable="instructions"}
<p>{$VALUE nofilter}</p>
{/loop}