diff --git a/admin-dev/tabs/AdminDiscounts.php b/admin-dev/tabs/AdminDiscounts.php
index 8e54c244a..b84e57179 100644
--- a/admin-dev/tabs/AdminDiscounts.php
+++ b/admin-dev/tabs/AdminDiscounts.php
@@ -169,7 +169,40 @@ class AdminDiscounts extends AdminTab
if (!$object->add(true, false, $categories))
$this->_errors[] = Tools::displayError('An error occurred while creating object.').' '.$this->table.'';
elseif (($_POST[$this->identifier] = $object->id /* voluntary */) AND $this->postImage($object->id) AND $this->_redirect)
- Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&token='.$token);
+ {
+ if ($customer = new Customer($object->id_customer) AND Validate::isLoadedObject($customer))
+ {
+ if (Validate::isEmail($customer->email))
+ {
+ $data = array(
+ '{firstname}' => $customer->firstname,
+ '{lastname}' => $customer->lastname,
+ '{email}' => $customer->email,
+ '{voucher_num}' => $object->name);
+
+ @Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'voucher_new', Mail::l('New voucher'), $data, $customer->email, $customer->firstname.' '.$customer->lastname);
+ }
+ }
+ elseif ($group = new Group($object->id_group) AND Validate::isLoadedObject($group))
+ {
+ $customer = null;
+ $customers = $group->getCustomers();
+
+ if ($customers)
+ foreach ($customers as $customer)
+ {
+ $data = array(
+ '{firstname}' => $customer['firstname'],
+ '{lastname}' => $customer['lastname'],
+ '{email}' => $customer['email'],
+ '{voucher_num}' => $object->name);
+
+ @Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'voucher_new', Mail::l('New voucher'), $data, $customer['email'], $customer['firstname'].' '.$customer['lastname']);
+ }
+ }
+
+ Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&token='.$token);
+ }
}
else
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
diff --git a/mails/de/voucher_new.html b/mails/de/voucher_new.html
new file mode 100644
index 000000000..5ce47f6b6
--- /dev/null
+++ b/mails/de/voucher_new.html
@@ -0,0 +1,39 @@
+
+
+
+
+ Message from {shop_name}
+
+
+
+
+
+
+ |
+
+ | |
+
+ | Hi {firstname} {lastname}, |
+
+ | |
+
+ |
+ This is to inform you about the creation of a voucher.
+ |
+
+ | |
+
+
+ Here is the code of your voucher : {voucher_num}.
+ Simply copy/paste this code during the payment process for your next order.
+ |
+
+ | |
+
+ |
+ {shop_name} powered with PrestaShop™
+ |
+
+
+
+
\ No newline at end of file
diff --git a/mails/de/voucher_new.txt b/mails/de/voucher_new.txt
new file mode 100644
index 000000000..b7c81e6cd
--- /dev/null
+++ b/mails/de/voucher_new.txt
@@ -0,0 +1,14 @@
+Hi {firstname} {lastname},
+
+This is to inform you about the creation of a voucher.
+
+Here is the code of your voucher : {voucher_num}.
+
+Simply copy/paste this code during the payment process for your next order.
+
+Thank you for shopping at {shop_name}.
+
+{shop_name} - {shop_url}
+
+
+{shop_url} powered by PrestaShop™
\ No newline at end of file
diff --git a/mails/en/voucher_new.html b/mails/en/voucher_new.html
new file mode 100644
index 000000000..5ce47f6b6
--- /dev/null
+++ b/mails/en/voucher_new.html
@@ -0,0 +1,39 @@
+
+
+
+
+ Message from {shop_name}
+
+
+
+
+
+
+ |
+
+ | |
+
+ | Hi {firstname} {lastname}, |
+
+ | |
+
+ |
+ This is to inform you about the creation of a voucher.
+ |
+
+ | |
+
+
+ Here is the code of your voucher : {voucher_num}.
+ Simply copy/paste this code during the payment process for your next order.
+ |
+
+ | |
+
+ |
+ {shop_name} powered with PrestaShop™
+ |
+
+
+
+
\ No newline at end of file
diff --git a/mails/en/voucher_new.txt b/mails/en/voucher_new.txt
new file mode 100644
index 000000000..b7c81e6cd
--- /dev/null
+++ b/mails/en/voucher_new.txt
@@ -0,0 +1,14 @@
+Hi {firstname} {lastname},
+
+This is to inform you about the creation of a voucher.
+
+Here is the code of your voucher : {voucher_num}.
+
+Simply copy/paste this code during the payment process for your next order.
+
+Thank you for shopping at {shop_name}.
+
+{shop_name} - {shop_url}
+
+
+{shop_url} powered by PrestaShop™
\ No newline at end of file
diff --git a/mails/es/voucher_new.html b/mails/es/voucher_new.html
new file mode 100644
index 000000000..5ce47f6b6
--- /dev/null
+++ b/mails/es/voucher_new.html
@@ -0,0 +1,39 @@
+
+
+
+
+ Message from {shop_name}
+
+
+
+
+
+
+ |
+
+ | |
+
+ | Hi {firstname} {lastname}, |
+
+ | |
+
+ |
+ This is to inform you about the creation of a voucher.
+ |
+
+ | |
+
+
+ Here is the code of your voucher : {voucher_num}.
+ Simply copy/paste this code during the payment process for your next order.
+ |
+
+ | |
+
+ |
+ {shop_name} powered with PrestaShop™
+ |
+
+
+
+
\ No newline at end of file
diff --git a/mails/es/voucher_new.txt b/mails/es/voucher_new.txt
new file mode 100644
index 000000000..b7c81e6cd
--- /dev/null
+++ b/mails/es/voucher_new.txt
@@ -0,0 +1,14 @@
+Hi {firstname} {lastname},
+
+This is to inform you about the creation of a voucher.
+
+Here is the code of your voucher : {voucher_num}.
+
+Simply copy/paste this code during the payment process for your next order.
+
+Thank you for shopping at {shop_name}.
+
+{shop_name} - {shop_url}
+
+
+{shop_url} powered by PrestaShop™
\ No newline at end of file
diff --git a/mails/fr/voucher_new.html b/mails/fr/voucher_new.html
new file mode 100644
index 000000000..3fdc69765
--- /dev/null
+++ b/mails/fr/voucher_new.html
@@ -0,0 +1,39 @@
+
+
+
+
+ Message de {shop_name}
+
+
+
+
+
+
+ |
+
+ | |
+
+ | Bonjour {firstname} {lastname}, |
+
+ | |
+
+ |
+ Nous vous informons de la génération d'un bon de réduction.
+ |
+
+ | |
+
+
+ Voici le numéro de votre bon de réduction : {voucher_num}.
+ Copiez-collez ce numéro dans le panier de votre prochain achat avant de régler la commande.
+ |
+
+ | |
+
+ |
+ {shop_name} réalisé avec PrestaShop™
+ |
+
+
+
+
\ No newline at end of file
diff --git a/mails/fr/voucher_new.txt b/mails/fr/voucher_new.txt
new file mode 100644
index 000000000..cda3d95e6
--- /dev/null
+++ b/mails/fr/voucher_new.txt
@@ -0,0 +1,13 @@
+Bonjour {firstname} {lastname},
+
+Nous vous informons de la génération d'un bon de réduction.
+
+Voici le numéro de votre bon de réduction : {voucher_num}.
+Copiez-collez ce numéro dans le panier de votre prochain achat avant de régler la commande.
+
+Merci et à bientôt sur {shop_name}.
+
+{shop_name} - {shop_url}
+
+
+{shop_url} réalisé par PrestaShop™
\ No newline at end of file
diff --git a/mails/it/voucher_new.html b/mails/it/voucher_new.html
new file mode 100644
index 000000000..5ce47f6b6
--- /dev/null
+++ b/mails/it/voucher_new.html
@@ -0,0 +1,39 @@
+
+
+
+
+ Message from {shop_name}
+
+
+
+
+
+
+ |
+
+ | |
+
+ | Hi {firstname} {lastname}, |
+
+ | |
+
+ |
+ This is to inform you about the creation of a voucher.
+ |
+
+ | |
+
+
+ Here is the code of your voucher : {voucher_num}.
+ Simply copy/paste this code during the payment process for your next order.
+ |
+
+ | |
+
+ |
+ {shop_name} powered with PrestaShop™
+ |
+
+
+
+
\ No newline at end of file
diff --git a/mails/it/voucher_new.txt b/mails/it/voucher_new.txt
new file mode 100644
index 000000000..b7c81e6cd
--- /dev/null
+++ b/mails/it/voucher_new.txt
@@ -0,0 +1,14 @@
+Hi {firstname} {lastname},
+
+This is to inform you about the creation of a voucher.
+
+Here is the code of your voucher : {voucher_num}.
+
+Simply copy/paste this code during the payment process for your next order.
+
+Thank you for shopping at {shop_name}.
+
+{shop_name} - {shop_url}
+
+
+{shop_url} powered by PrestaShop™
\ No newline at end of file