Merge branch 'ticket/r12792-delivery-dates' into dev

This commit is contained in:
Rodney Figaro 2017-04-11 09:57:38 +02:00
commit 7da27e2d3f

View File

@ -675,7 +675,7 @@ abstract class PaymentModule extends PaymentModuleCore
PrestaShopLogger::addLog('PaymentModule::validateOrder - Mail is about to be sent', 1, null, 'Cart', (int)$id_cart, true);
// antadis 12792
$str = $this->getFormatDeliveryDates($order->id, $order->id_lang);
$str = $this->getFormatDeliveryDates($order->id_lang);
$data['{delivery_dates_block_html}'] = $str['html'];
$data['{delivery_dates_block_txt}'] = $str['txt'];
@ -734,12 +734,13 @@ abstract class PaymentModule extends PaymentModuleCore
}
}
private function getFormatDeliveryDates($id_order, $id_lang)
private function getFormatDeliveryDates($id_lang)
{
$str = array('html' => '-', 'txt' => '-');
// antadis 12792
$delivery_dates = OrderDeliveryDates::getDeliveryRangeDates($id_order, $id_lang);
if ($this->context->cart) {
$delivery_dates = SaleCore::getDeliveryRangeDates($this->context->cart);
if (is_array($delivery_dates)) {
if ($id_lang == '1') {
$str['html'] = 'entre le <strong>'.$delivery_dates['start']->format('d/m/Y').'</strong> et le <strong>'.$delivery_dates['end']->format('d/m/Y').'</strong>';
@ -751,8 +752,8 @@ abstract class PaymentModule extends PaymentModuleCore
$str['txt'] = 'between '.$delivery_dates['start']->format('d/m/Y').' and '.$delivery_dates['end']->format('d/m/Y');
}
}
elseif (!empty($delivery_dates)) {
$other_delay = $delivery_dates;
elseif ($delivery_dates === SaleCore::DATE_RANGE_OTHER_DELAY) {
$other_delay = $this->context->cart->checkProductOtherDeliveryDelai(true);
if ($id_lang == '1') {
$str['html'] = 'sous <strong>'.$other_delay.'</strong>';
@ -763,6 +764,7 @@ abstract class PaymentModule extends PaymentModuleCore
$str['txt'] = 'within '.$other_delay;
}
}
}
// end antadis 12792
return $str;