diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 61adcc07a..1648045f8 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -2348,13 +2348,13 @@ {assign var="prev_business_source" value=$booking_source.business_source_name} {/if} - {/foreach} {if $booking_sources}{/if} -

{l s='Leave unselected to use the default Walk-in source.'}

+

{l s='Walk-in is selected by default. Change it if this booking came from a different source.'}

diff --git a/classes/Source.php b/classes/Source.php index e124e8cf5..4f453e96b 100644 --- a/classes/Source.php +++ b/classes/Source.php @@ -150,7 +150,7 @@ class SourceCore extends ObjectModel } return Db::getInstance()->executeS(' - SELECT a.`id_source`, a.`id_business_source`, al.`name`, bsl.`name` AS `business_source_name` + SELECT a.`id_source`, a.`id_business_source`, a.`code`, al.`name`, bsl.`name` AS `business_source_name` FROM `'._DB_PREFIX_.'source` a LEFT JOIN `'._DB_PREFIX_.'source_lang` al ON (al.`id_source` = a.`id_source` AND al.`id_lang` = '.(int)$idLang.') LEFT JOIN `'._DB_PREFIX_.'business_source_lang` bsl ON (bsl.`id_business_source` = a.`id_business_source` AND bsl.`id_lang` = '.(int)$idLang.') diff --git a/classes/helper/HelperKpiRow.php b/classes/helper/HelperKpiRow.php index f47022bf7..b10bce643 100644 --- a/classes/helper/HelperKpiRow.php +++ b/classes/helper/HelperKpiRow.php @@ -44,7 +44,7 @@ class HelperKpiRowCore extends Helper if (isset($this->context->cookie->$cookieKey)) { $kpi->visible = (bool) $this->context->cookie->$cookieKey; } else { - $kpi->visible = true; + $kpi->visible = isset($kpi->visible) ? (bool) $kpi->visible : true; } $countVisible = $kpi->visible ? ++$countVisible : $countVisible; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 4bd81bb4d..7c71ec915 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -288,7 +288,6 @@ class AdminOrdersControllerCore extends AdminController 'filter_key' => 'a!source', 'list' => $this->all_order_sources, 'optional' => true, - 'visible_default' => true ), 'booking_source_name' => array( 'title' => $this->l('Booking Source'), @@ -393,14 +392,7 @@ class AdminOrdersControllerCore extends AdminController return '--'; } - $html = Tools::safeOutput($echo); - - if (isset($row['booking_source_code']) && $row['booking_source_code'] === 'DIRECT_WEBSITE') { - $title = $this->l('Visit website', 'AdminOrders', true); - $html .= ' '; - } - - return $html; + return Tools::safeOutput($echo); } public function formatStayPeriods($value, $row) @@ -3026,12 +3018,25 @@ class AdminOrdersControllerCore extends AdminController $helper->id = 'box-order-source'; $helper->icon = 'icon-globe'; $helper->color = 'color1'; + $helper->visible = false; $helper->title = $this->l('Order Source'); $helper->tooltip = $this->l('Order source shows from which source the order was placed.'); $helper->subtitle = $orderHistory[0]['id_employee'] ? $this->l('Back office') : $this->l('Front office'); $helper->value = $objOrder->source; $this->kpis[] = $helper; + $objBookingSource = new Source((int)$objOrder->id_source, $this->context->language->id); + if (Validate::isLoadedObject($objBookingSource)) { + $helper = new HelperKpi(); + $helper->id = 'box-booking-source'; + $helper->icon = 'icon-tag'; + $helper->color = 'color2'; + $helper->title = $this->l('Booking Source'); + $helper->tooltip = $this->l('Booking source shows the source from which this booking originated, e.g. Walk-in, Website, OTA.'); + $helper->value = $objBookingSource->name; + $this->kpis[] = $helper; + } + $objCustomerThread = new CustomerThread(); $idCustomerThread = $objCustomerThread->getIdCustomerThreadByIdOrder($objOrder->id); $helper = new HelperKpi(); diff --git a/controllers/admin/AdminSourcesController.php b/controllers/admin/AdminSourcesController.php index 81a6557c8..c51d5dd36 100644 --- a/controllers/admin/AdminSourcesController.php +++ b/controllers/admin/AdminSourcesController.php @@ -176,7 +176,7 @@ class AdminSourcesControllerCore extends AdminController 'class' => 'fixed-width-xs' ), 'name' => array( - 'title' => $this->l('Name'), + 'title' => $this->l('Booking Source'), 'width' => 'auto', 'filter_key' => 'b!name' ),