Merge branch 'ticket-11756-DelayInConfirmationMail'

This commit is contained in:
Marion Muszynski 2016-11-22 11:58:38 +01:00
commit c1fcfb5f85
2 changed files with 20 additions and 9 deletions

View File

@ -1,6 +1,12 @@
<h4>{l s='Delivery Delay' mod='privatesales_delay'}</h4>
{foreach from=$delivery_date item=date}
<p>
<b style="color: #e26ea2;">{$date.name}</b> : {l s='Date de réception prévue entre le' mod='privatesales_delay'} <b>{$date.date_start|date_format:'%d/%m/%Y'}</b> {l s='et le' mod='privatesales_delay'} <b>{$date.date_end|date_format:'%d/%m/%Y'}</b>
</p>
{/foreach}
{foreach from=$delivery_date key=k item=date}
{if $k == 5}
<p>
<b style="color: #e26ea2;">{$date.name}</b> : {l s='Date de réception prévue avant le' mod='privatesales_delay'} <b>24/12/{$date.date_start|date_format:'%Y'}</b>
</p>
{else}
<p>
<b style="color: #e26ea2;">{$date.name}</b> : {l s='Date de réception prévue entre le' mod='privatesales_delay'} <b>{$date.date_start|date_format:'%d/%m/%Y'}</b> {l s='et le' mod='privatesales_delay'} <b>{$date.date_end|date_format:'%d/%m/%Y'}</b>
</p>
{/if}
{/foreach}

View File

@ -1,9 +1,9 @@
<?php
include_once(_PS_ROOT_DIR_.'/modules/privatesales/Sale.php');
class PrivateSales_Delay extends Module
class PrivateSales_Delay extends Module
{
public function __construct()
public function __construct()
{
$this->name = 'privatesales_delay';
$this->tab = 'pricing_promotion';
@ -146,7 +146,7 @@ class PrivateSales_Delay extends Module
return TRUE;
}
public function hookdeliveryDelay($params)
public function hookdeliveryDelay($params)
{
global $smarty, $cookie;
@ -163,7 +163,12 @@ class PrivateSales_Delay extends Module
$products = $order->getProducts();
$products = SaleDelay::associateDelay($products);
$delays = array_keys($products);
$delivery_date = SaleDelay::getDeliveryDate($delays, $cookie->id_lang, null, true);
if ($order!=null) {
$date = new DateTime($order->date_add);
} else {
$date = new DateTime();
}
$delivery_date = SaleDelay::getDeliveryDate($delays, $cookie->id_lang, $date, true);
$smarty->assign(array(
'delivery_date' => $delivery_date