Merge branch 'develop' into gli-2941
This commit is contained in:
@@ -72,6 +72,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as total_guests,
|
||||
(SELECT SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order`) as los,
|
||||
hbd.`id_room` AS id_room_information,
|
||||
(SELECT GROUP_CONCAT(CONCAT(ps.period, \'~\', ps.cnt) ORDER BY ps.period SEPARATOR \'::\') FROM (SELECT CONCAT(hbd.`date_from`, \'|\', hbd.`date_to`) AS period, COUNT(*) AS cnt FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = a.`id_order` GROUP BY hbd.`date_from`, hbd.`date_to`) AS ps) AS stay_periods,
|
||||
(SELECT COUNT(spod.`id_service_product_order_detail`) FROM `'._DB_PREFIX_.'service_product_order_detail` spod WHERE spod.`id_order` = a.`id_order` AND spod.`id_htl_booking_detail`=0) as num_products';
|
||||
|
||||
$this->_join = '
|
||||
@@ -196,6 +197,15 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'type'=>'date',
|
||||
'displayed' => false,
|
||||
),
|
||||
'stay_periods' => array(
|
||||
'title' => $this->l('Stay Periods'),
|
||||
'type' => 'text',
|
||||
'callback' => 'formatStayPeriods',
|
||||
'optional' => true,
|
||||
'search' => false,
|
||||
'displayed' => true,
|
||||
'visible_default' => true,
|
||||
),
|
||||
'total_guests' => array(
|
||||
'title' => $this->l('Guests'),
|
||||
'type' => 'range',
|
||||
@@ -212,7 +222,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'visible_default' => true
|
||||
),
|
||||
'los' => array(
|
||||
'title' => $this->l('Stay period'),
|
||||
'title' => $this->l('Stay duration'),
|
||||
'align' => 'text-center',
|
||||
'type' => 'range',
|
||||
'havingFilter' => true,
|
||||
@@ -359,6 +369,43 @@ class AdminOrdersControllerCore extends AdminController
|
||||
return Tools::displayPrice($echo, (int)$idCurrency);
|
||||
}
|
||||
|
||||
public function formatStayPeriods($value, $row)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return '--';
|
||||
}
|
||||
|
||||
$stayPeriods = array();
|
||||
foreach (explode('::', $value) as $stays) {
|
||||
$countStays = explode('~', $stays);
|
||||
$stayDates = explode('|', $countStays[0]);
|
||||
if (count($stayDates) === 2) {
|
||||
$stayPeriods[] = array(
|
||||
'from' => Tools::displayDate(trim($stayDates[0])),
|
||||
'to' => Tools::displayDate(trim($stayDates[1])),
|
||||
'count' => isset($countStays[1]) ? (int)$countStays[1] : 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$datesDisplay = array();
|
||||
foreach (array_slice($stayPeriods, 0, 1) as $stayPeriod) {
|
||||
$datesDisplay[] = $stayPeriod['from'].' - '.$stayPeriod['to'];
|
||||
}
|
||||
|
||||
$stayPeriodHtml = implode('<br>', $datesDisplay);
|
||||
$uniqueStayPeriods = count($stayPeriods);
|
||||
|
||||
if ($uniqueStayPeriods > 1) {
|
||||
$this->context->smarty->assign(array(
|
||||
'stay_periods' => $stayPeriods,
|
||||
'extra_stay_periods_count' => $uniqueStayPeriods - 1,
|
||||
));
|
||||
$stayPeriodHtml .= ' '.$this->createTemplate('_stay_periods_tooltip.tpl')->fetch();
|
||||
}
|
||||
return $stayPeriodHtml;
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
if (empty($this->display)) {
|
||||
@@ -1409,7 +1456,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->addJqueryUI('ui.datepicker');
|
||||
$this->addJqueryUI('ui.tooltip', 'base', true);
|
||||
|
||||
$this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js');
|
||||
$this->addJqueryUI(array('ui.tooltip'), 'base', true);
|
||||
|
||||
@@ -4005,10 +4051,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->errors[] = $this->l('Please select a file to upload.');
|
||||
} elseif ($objHotelBookingDocument->fileInfo['size'] > Tools::getMaxUploadSize()) {
|
||||
$this->errors[] = $this->l('Uploaded file size is too large.');
|
||||
} elseif(!(ImageManager::isRealImage($objHotelBookingDocument->fileInfo['tmp_name'])
|
||||
|| $objHotelBookingDocument->fileInfo['mime'] == 'application/pdf')
|
||||
) {
|
||||
$this->errors[] = $this->l('Please upload an image or a PDF file only. Allowed image formats: .gif, .jpg, .jpeg and .png');
|
||||
} else {
|
||||
$objHotelBookingDocument->setFileType();
|
||||
if (!$objHotelBookingDocument->file_type) {
|
||||
$this->errors[] = $this->l('Please upload an image or a PDF file only. Allowed image formats: .gif, .jpg, .jpeg and .png');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this order.');
|
||||
|
||||
Reference in New Issue
Block a user