Fixed: AdminSearchController added service products, room features, room types, hotels, and QloApps related features in result, added controller wise permission on each search

This commit is contained in:
vishalsingh.qlo325
2024-03-06 16:17:19 +05:30
parent 17256b4ccb
commit 796fd8e483
11 changed files with 897 additions and 80 deletions

View File

@@ -30,6 +30,22 @@ class AdminSearchControllerCore extends AdminController
{
$this->bootstrap = true;
parent::__construct();
$this->controllers = array(
'AdminProducts' => 1,
'AdminCategories' => 1,
'AdminFeatures' => 1,
'AdminOrders' => 1,
'AdminOrderRefundRules' => 1,
'AdminRoomTypeGlobalDemand' => 1,
'AdminGroups' => 1,
'AdminHotelFeatures' => 1,
'AdminCustomers' => 1,
'AdminAddHotel' => 1,
'AdminNormalProducts' => 1,
'AdminAddresses' => 1,
'AdminCustomerThreads' => 1,
'AdminModules' => 1
);
}
public function postProcess()
@@ -39,6 +55,10 @@ class AdminSearchControllerCore extends AdminController
$searchType = (int)Tools::getValue('bo_search_type');
/* Handle empty search field */
if (!empty($this->query)) {
if ($this->context->employee->id_profile != _PS_ADMIN_PROFILE_) {
$this->setControllerAccesses();
}
if (!$searchType && strlen($this->query) > 1) {
$this->searchFeatures();
}
@@ -48,7 +68,11 @@ class AdminSearchControllerCore extends AdminController
/* Handle product ID */
if ($searchType == 1 && (int)$this->query && Validate::isUnsignedInt((int)$this->query)) {
if (($product = new Product($this->query)) && Validate::isLoadedObject($product)) {
Tools::redirectAdmin('index.php?tab=AdminProducts&id_product='.(int)($product->id).'&token='.Tools::getAdminTokenLite('AdminProducts'));
if ($product->booking_product) {
Tools::redirectAdmin('index.php?tab=AdminProducts&id_product='.(int)($product->id).'&updateproduct&token='.Tools::getAdminTokenLite('AdminProducts'));
} else {
Tools::redirectAdmin('index.php?tab=AdminNormalProducts&id_product='.(int)($product->id).'&updateproduct&token='.Tools::getAdminTokenLite('AdminNormalProducts'));
}
}
}
@@ -73,6 +97,10 @@ class AdminSearchControllerCore extends AdminController
if ($searchType == 6) {
$this->searchIP();
}
if (isset($this->_list['customers']) && is_array($this->_list['customers']) && count($this->_list['customers'])) {
$this->addHotelRestrictionsToSearchedCustomers('customers');
}
}
/* Order */
@@ -113,10 +141,10 @@ class AdminSearchControllerCore extends AdminController
$this->_list['orders'][] = $row;
}
}
} elseif ($searchType == 3) {
$this->errors[] = Tools::displayError('No order was found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
}
}
$this->searchOrderMessages();
}
/* Invoices */
@@ -147,10 +175,44 @@ class AdminSearchControllerCore extends AdminController
/* Normal catalog search */
$this->searchModule();
}
if (!$searchType || $searchType == 8) {
if ($searchType == 8 && (int)$this->query && Validate::isUnsignedInt((int)$this->query)) {
if (($objHotelBranchInfo = new HotelBranchInformation((int) $this->query))
&& Validate::isLoadedObject($objHotelBranchInfo)
) {
Tools::redirectAdmin('index.php?tab=AdminAddHotel&id='.$objHotelBranchInfo->id.'&updatehtl_branch_info'.'&token='.Tools::getAdminTokenLite('AdminAddHotel'));
}
}
$this->searchHotel();
}
if (!$searchType) {
$this->searchAddress();
$this->searchHotelFeatures();
$this->searchAdditionalFacilities();
$this->searchRefundRules();
}
}
$this->display = 'view';
}
public function setControllerAccesses()
{
$sql = 'SELECT a.`view`, t.`class_name` FROM `'._DB_PREFIX_.'access` a
LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)
WHERE t.`class_name` IN ("'.implode('", "', array_keys($this->controllers)).'")
AND a.`id_profile` = '.(int) $this->context->employee->id_profile.'
';
if ($tabs = Db::getInstance()->executeS($sql)) {
foreach ($tabs as $tab) {
$this->controllers[$tab['class_name']] = $tab['view'];
}
}
}
public function searchIP()
{
@@ -168,44 +230,43 @@ class AdminSearchControllerCore extends AdminController
*/
public function searchCatalog()
{
$this->context = Context::getContext();
if ($this->_list['products'] = Product::searchByName($this->context->language->id, $this->query)) {
if (isset($this->controllers['AdminProducts'])
&& $this->controllers['AdminProducts']
&& ($this->_list['products'] = Product::searchByName($this->context->language->id, $this->query))
) {
$objRoomType = new HotelRoomType();
$accessableHotels = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1);
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$accessibleHotels = HotelBranchInformation::getProfileAccessedHotels(
$this->context->employee->id_profile,
1,
1
);
foreach ($this->_list['products'] as $key => $product) {
$toUnset = false;
if ($product['booking_product']) {
$roomInfo = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product']);
if (!in_array($roomInfo['id_hotel'], $accessibleHotels)) {
$toUnset = true;
if ($roomInfo = $objRoomType->getRoomTypeInfoByIdProduct($product['id_product'])) {
if (!in_array($roomInfo['id_hotel'], $accessableHotels)) {
unset($this->_list['products'][$key]);
}
} else {
$associations = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product['id_product']);
// proceed only if access can not be determined from hotels
if (!count(array_intersect($associations['hotels'], $accessibleHotels))) {
$toUnset = true;
foreach ($associations['room_types'] as $idProduct) {
$roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($idProduct);
if (in_array($roomTypeInfo['id_hotel'], $accessibleHotels)) {
$toUnset = false;
break;
}
} else if ($associatedData = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product['id_product'])) {
$count = 0;
foreach ($associatedData['room_types'] as $id_room_type) {
$objRoomType = new HotelRoomType($id_room_type);
if (in_array($objRoomType->id_hotel, $accessableHotels)) {
$count += 1;
}
}
}
if ($toUnset) {
if ($count) {
$this->_list['service_products'][] = $this->_list['products'][$key];
}
unset($this->_list['products'][$key]);
}
}
}
$this->_list['categories'] = Category::searchByName($this->context->language->id, $this->query);
if (isset($this->controllers['AdminCategories']) && $this->controllers['AdminCategories']) {
$this->_list['categories'] = Category::searchByName($this->context->language->id, $this->query);
}
if (isset($this->controllers['AdminFeatures']) && $this->controllers['AdminFeatures']) {
$this->_list['catalog_features'] = Feature::searchByName($this->query, $this->context->language->id);
}
}
/**
@@ -215,29 +276,41 @@ class AdminSearchControllerCore extends AdminController
*/
public function searchCustomer()
{
$this->_list['customers'] = Customer::searchByName($this->query);
if (isset($this->controllers['AdminCustomers'])
&& $this->controllers['AdminCustomers']
) {
$this->_list['customers'] = Customer::searchByName($this->query);
}
$objGroup = new Group();
if (isset($this->controllers['AdminGroups']) && $this->controllers['AdminGroups']) {
$this->_list['groups'] = $objGroup->getRelatedGroups($this->query);
}
}
public function searchModule()
{
$this->_list['modules'] = array();
$all_modules = Module::getModulesOnDisk(true, true, Context::getContext()->employee->id);
foreach ($all_modules as $module) {
if (stripos($module->name, $this->query) !== false || stripos($module->displayName, $this->query) !== false || stripos($module->description, $this->query) !== false) {
$module->linkto = 'index.php?tab=AdminModules&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name).'&token='.Tools::getAdminTokenLite('AdminModules');
$this->_list['modules'][] = $module;
if (isset($this->controllers['AdminModules']) && $this->controllers['AdminModules']) {
$this->_list['modules'] = array();
$all_modules = Module::getModulesOnDisk(true, true, Context::getContext()->employee->id);
foreach ($all_modules as $module) {
if (stripos($module->name, $this->query) !== false || stripos($module->displayName, $this->query) !== false || stripos($module->description, $this->query) !== false) {
$module->linkto = 'index.php?tab=AdminModules&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name).'&token='.Tools::getAdminTokenLite('AdminModules');
$this->_list['modules'][] = $module;
}
}
}
if (!is_numeric(trim($this->query)) && !Validate::isEmail($this->query)) {
$iso_lang = Tools::strtolower(Context::getContext()->language->iso_code);
$iso_country = Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')));
if (($json_content = Tools::file_get_contents('https://api-addons.prestashop.com/'._PS_VERSION_.'/search/'.urlencode($this->query).'/'.$iso_country.'/'.$iso_lang.'/')) != false) {
$results = json_decode($json_content, true);
if (isset($results['id'])) {
$this->_list['addons'] = array($results);
} else {
$this->_list['addons'] = $results;
if (!is_numeric(trim($this->query)) && !Validate::isEmail($this->query)) {
$iso_lang = Tools::strtolower(Context::getContext()->language->iso_code);
$iso_country = Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')));
if (($json_content = Tools::file_get_contents('https://api-addons.prestashop.com/'._PS_VERSION_.'/search/'.urlencode($this->query).'/'.$iso_country.'/'.$iso_lang.'/')) != false) {
$results = json_decode($json_content, true);
if (isset($results['id'])) {
$this->_list['addons'] = array($results);
} else {
$this->_list['addons'] = $results;
}
}
}
}
@@ -301,8 +374,167 @@ class AdminSearchControllerCore extends AdminController
}
}
public function searchHotel()
{
if (class_exists('HotelBranchInformation')) {
if (isset($this->controllers['AdminAddHotel']) && $this->controllers['AdminAddHotel']) {
$objHotelBranchInformation = new HotelBranchInformation();
$this->_list['hotels'] = $objHotelBranchInformation->getAccessibleHotelByName($this->query);
}
}
}
public function searchOrderMessages()
{
if (class_exists('CustomerMessage')) {
if (isset($this->controllers['AdminCustomerThreads']) && $this->controllers['AdminCustomerThreads']) {
$objCustomerMessage = new CustomerMessage();
if ($this->_list['order_messages'] = $objCustomerMessage->searchCustomerMessage($this->query)) {
$accesibleHotels = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1);
foreach ($this->_list['order_messages'] as $key => $msg) {
if ($msg['id_order']) {
// To set set restriction on the messages belonging to an order. While the other messages will be show to all
$idHotel = HotelBookingDetail::getIdHotelByIdOrder($msg['id_order']);
if (!in_array($idHotel, $accesibleHotels)) {
unset($this->_list['order_messages'][$key]);
}
}
}
}
}
}
}
public function searchAddress()
{
if (isset($this->controllers['AdminAddresses']) && $this->controllers['AdminAddresses']) {
$objAddress = new Address();
if ($this->_list['customer_address'] = $objAddress->getCustomersAddresses($this->query)) {
$this->addHotelRestrictionsToSearchedCustomers('customer_address');
}
}
}
public function searchHotelFeatures()
{
if (class_exists('HotelFeatures')) {
if (isset($this->controllers['AdminHotelFeatures']) && $this->controllers['AdminHotelFeatures']) {
$objHotelFeatures = new HotelFeatures();
if ($hotelFeatures = $objHotelFeatures->searchHotelFeatureByName($this->query)) {
$features = array();
foreach ($hotelFeatures as $key => $hotelFeature) {
$features[$hotelFeature['id']]['name'] = $hotelFeature['name'];
if ($hotelFeature['parent_feature_id']) {
$features[$hotelFeature['id']]['id'] = $hotelFeature['parent_feature_id'];
} else {
$features[$hotelFeature['id']]['id'] = $hotelFeature['id'];
}
}
$this->_list['hotel_features'] = $features;
}
}
}
}
public function searchAdditionalFacilities()
{
if (class_exists('HotelRoomTypeGlobalDemand')) {
if (isset($this->controllers['AdminRoomTypeGlobalDemand']) && $this->controllers['AdminRoomTypeGlobalDemand']) {
$objHotelRoomTypeGlobalDemands = new HotelRoomTypeGlobalDemand();
if ($globalDemads = $objHotelRoomTypeGlobalDemands->searchRoomTypeDemandsByName($this->query)) {
foreach ($globalDemads as $key => $demand) {
if (!(int) $globalDemads[$key]['price']) {
$globalDemads[$key]['price'] = $globalDemads[$key]['option_price'];
}
$globalDemads[$key]['per_day_price_calc'] = $this->l('No');
if ($globalDemads[$key]['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY) {
$globalDemads[$key]['per_day_price_calc'] = $this->l('Yes');
}
}
$this->_list['global_demands'] = $globalDemads;
}
}
}
}
public function searchRefundRules()
{
if (class_exists('HotelOrderRefundRules')) {
if (isset($this->controllers['AdminOrderRefundRulesController']) && $this->controllers['AdminOrderRefundRulesController']) {
$objRefundRule = new HotelOrderRefundRules();
if ($refundRules = $objRefundRule->searchOrderRefundRulesByName($this->query)) {
foreach ($refundRules as $key => $rule) {
$refundRules[$key]['deduction_type'] = $this->l('Percentage');
if ($rule['payment_type'] == HotelOrderRefundRules::WK_REFUND_RULE_PAYMENT_TYPE_FIXED) {
$refundRules[$key]['deduction_type'] = $this->l('Fixed Amount');
$refundRules[$key]['deduction_value_full_pay'] = Tools::displayPrice($rule['deduction_value_full_pay']);
$refundRules[$key]['deduction_value_adv_pay'] = Tools::displayPrice($rule['deduction_value_adv_pay']);
} else if ($rule['payment_type'] == HotelOrderRefundRules::WK_REFUND_RULE_PAYMENT_TYPE_PERCENTAGE) {
$refundRules[$key]['deduction_value_full_pay'] = $rule['deduction_value_full_pay'].' %';
$refundRules[$key]['deduction_value_adv_pay'] = $rule['deduction_value_adv_pay'].' %';
}
}
$this->_list['refund_rules'] = $refundRules;
}
}
}
}
protected function addHotelRestrictionsToSearchedCustomers($index)
{
$accessibleHotels = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 1);
foreach ($this->_list[$index] as $key => $item) {
if ($this->context->employee->id_profile != _PS_ADMIN_PROFILE_) {
$customerBelongsToHotel = 0;
if(isset($item['id_customer'])) {
$customerOrders = Order::getCustomerOrders($item['id_customer']);
if (count($customerOrders)) {
foreach($customerOrders as $order) {
$idHotel = HotelBookingDetail::getIdHotelByIdOrder($order['id_order']);
if (!in_array($idHotel, $accessibleHotels)) {
$customerBelongsToHotel += 1;
}
}
}
}
if (!$customerBelongsToHotel) {
unset($this->_list[$index][$key]);
}
}
}
}
protected function initGroupList()
{
$this->show_toolbar = false;
$this->fields_list['groups'] = array(
'id_group' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name'), 'align' => 'center', 'width' => 65),
'reduction' => array('title' => $this->l('Discount')),
'show_prices' => array('title' => $this->l('Show prices'), 'callback' => 'printShowPricesIcon'),
'date_add' => array('title' => $this->l('Creation date'), 'width' => 130, 'align' => 'right', 'type' => 'datetime'),
);
}
public function printShowPricesIcon($id_group, $tr)
{
$group = new Group($tr['id_group']);
if (!Validate::isLoadedObject($group)) {
return;
}
return '<a class="list-action-enable'.($group->show_prices ? ' action-enabled' : ' action-disabled').'" href="index.php?tab=AdminGroups&amp;id_group='.(int)$group->id.'&amp;changeShowPricesVal&amp;token='.Tools::getAdminTokenLite('AdminGroups').'">
'.($group->show_prices ? '<i class="icon-check"></i>' : '<i class="icon-remove"></i>').
'</a>';
}
protected function initOrderList()
{
$this->show_toolbar = false;
$this->fields_list['orders'] = array(
'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 65),
'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
@@ -314,6 +546,43 @@ class AdminSearchControllerCore extends AdminController
);
}
protected function initGlobalDemandList()
{
$this->show_toolbar = false;
$this->fields_list['global_demands'] = array(
'id_global_demand' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name')),
'option_name' => array('title' => $this->l('Advance Option Name')),
'price' => array('title' => $this->l('Price'), 'type' => 'price', 'currency' => true),
'per_day_price_calc' => array('title' => $this->l('Per day price calculation'))
);
}
protected function initRefundRuleList()
{
$this->show_toolbar = false;
$this->fields_list['refund_rules'] = array(
'id_refund_rule' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name')),
'payment_type' => array('title' => $this->l('Payment Type')),
'deduction_value_full_pay' => array('title' => $this->l('Full Payment Deduction Percentage/Amount')),
'deduction_value_adv_pay' => array('title' => $this->l('Full Payment Deduction Percentage/Amount')),
'days' => array('title' => $this->l('Days Before Check-in')),
);
}
protected function initOrderMessagesList()
{
$this->show_toolbar = false;
$this->fields_list['order_messages'] = array(
'id_customer_thread' => array('title' => $this->l('ID '), 'align' => 'center', 'width' => 65),
'customer_name' => array('title' => $this->l('Customer Name'), 'align' => 'center'),
'email' => array('title' => $this->l('Customer email')),
'message' => array('title' => $this->l('Message'), 'width' => 70),
'status' => array('title' => $this->l('Status'), 'width' => 280),
);
}
protected function initCustomerList()
{
$genders_icon = array('default' => 'unknown.gif');
@@ -342,13 +611,69 @@ class AdminSearchControllerCore extends AdminController
$this->fields_list['products'] = array(
'id_product' => array('title' => $this->l('ID'), 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 'auto'),
'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 150),
// 'reference' => array('title' => $this->l('Reference'), 'align' => 'center', 'width' => 150),
'price_tax_excl' => array('title' => $this->l('Price (tax excl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60),
'price_tax_incl' => array('title' => $this->l('Price (tax incl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60),
'active' => array('title' => $this->l('Active'), 'width' => 70, 'active' => 'status', 'align' => 'center', 'type' => 'bool')
);
}
protected function initServiceProdList()
{
$this->show_toolbar = false;
$this->fields_list['service_products'] = array(
'id_product' => array('title' => $this->l('ID'), 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 'auto'),
'price_tax_excl' => array('title' => $this->l('Price (tax excl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60),
'price_tax_incl' => array('title' => $this->l('Price (tax incl.)'), 'align' => 'right', 'type' => 'price', 'width' => 60),
'active' => array('title' => $this->l('Active'), 'width' => 70, 'active' => 'status', 'align' => 'center', 'type' => 'bool')
);
}
protected function initFeatureList()
{
$this->show_toolbar = false;
$this->fields_list['catalog_features'] = array(
'id_feature' => array('title' => $this->l('ID'), 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 'auto'),
'logo' => array('title' => $this->l('Logo'),'image' => 'rf', 'align' => 'right', 'type' => 'price', 'width' => 60),
);
}
protected function initHotelList()
{
$this->show_toolbar = false;
$this->fields_list['hotels'] = array(
'id' => array('title' => $this->l('ID'), 'width' => 25),
'hotel_name' => array('title' => $this->l('Name'), 'width' => 'auto'),
'city' => array('title' => $this->l('City'), 'align' => 'right'),
'state_name' => array('title' => $this->l('State'), 'align' => 'right'),
'country_name' => array('title' => $this->l('Country'), 'align' => 'right'),
'active' => array('title' => $this->l('Active'), 'width' => 70, 'active' => 'status', 'align' => 'center', 'type' => 'bool')
);
}
protected function initAddressList()
{
$this->show_toolbar = false;
$this->fields_list['customer_address'] = array(
'id_address' => array('title' => $this->l('ID'), 'width' => 25),
'firstname' => array('title' => $this->l('First Name'), 'width' => 'auto'),
'lastname' => array('title' => $this->l('Last Name'), 'align' => 'right'),
'address1' => array('title' => $this->l('Address'), 'align' => 'right'),
'postcode' => array('title' => $this->l('Zip/Postal Code'), 'align' => 'right'),
'city' => array('title' => $this->l('City'), 'width' => 70)
);
}
protected function initHotelFeatureList()
{
$this->show_toolbar = false;
$this->fields_list['hotel_features'] = array(
'name' => array('title' => $this->l('name'), 'width' => 'auto'),
);
}
public function setMedia()
{
parent::setMedia();
@@ -403,7 +728,6 @@ class AdminSearchControllerCore extends AdminController
$helper->show_toolbar = false;
$helper->table = 'product';
$helper->currentIndex = $this->context->link->getAdminLink('AdminProducts', false);
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
@@ -420,6 +744,152 @@ class AdminSearchControllerCore extends AdminController
$this->tpl_view_vars['num_products'] = count($this->_list['products']);
$this->tpl_view_vars['products'] = $view;
}
if (isset($this->_list['service_products']) && $this->_list['service_products']&& count($this->_list['service_products'])) {
$view = '';
$this->initServiceProdList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_product';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'product';
$helper->currentIndex = $this->context->link->getAdminLink('AdminNormalProducts', false);
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
if ($query) {
$helper->currentIndex .= '&bo_query='.$query.'&bo_search_type='.$searchType;
}
$helper->token = Tools::getAdminTokenLite('AdminNormalProducts');
if ($this->_list['service_products']) {
$view = $helper->generateList($this->_list['service_products'], $this->fields_list['service_products']);
}
$this->tpl_view_vars['num_service_products'] = count($this->_list['service_products']);
$this->tpl_view_vars['service_products'] = $view;
}
if (isset($this->_list['catalog_features']) && $this->_list['catalog_features']&& count($this->_list['catalog_features'])) {
$view = '';
$this->initFeatureList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_feature';
$helper->imageType = 'jpg';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'feature';
$helper->currentIndex = $this->context->link->getAdminLink('AdminFeatures', false);
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
if ($query) {
$helper->currentIndex .= '&bo_query='.$query.'&bo_search_type='.$searchType;
}
$helper->token = Tools::getAdminTokenLite('AdminFeatures');
if ($this->_list['catalog_features']) {
$view = $helper->generateList($this->_list['catalog_features'], $this->fields_list['catalog_features']);
}
$this->tpl_view_vars['num_catalog_features'] = count($this->_list['catalog_features']);
$this->tpl_view_vars['catalog_features'] = $view;
}
if (isset($this->_list['customer_address']) && $this->_list['customer_address']&& count($this->_list['customer_address'])) {
$view = '';
$this->initAddressList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_address';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'address';
$helper->currentIndex = $this->context->link->getAdminLink('AdminAddresses', false);
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
if ($query) {
$helper->currentIndex .= '&bo_query='.$query.'&bo_search_type='.$searchType;
}
$helper->token = Tools::getAdminTokenLite('AdminAddresses');
if ($this->_list['customer_address']) {
$view = $helper->generateList($this->_list['customer_address'], $this->fields_list['customer_address']);
}
$this->tpl_view_vars['num_customer_address'] = count($this->_list['customer_address']);
$this->tpl_view_vars['customer_address'] = $view;
}
if (isset($this->_list['order_messages']) && $this->_list['order_messages']&& count($this->_list['order_messages'])) {
$view = '';
$this->initOrderMessagesList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_customer_message';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'feature';
$helper->currentIndex = $this->context->link->getAdminLink('AdminCustomerThreads', false);
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
if ($query) {
$helper->currentIndex .= '&bo_query='.$query.'&bo_search_type='.$searchType;
}
$helper->token = Tools::getAdminTokenLite('AdminCustomerThreads');
if ($this->_list['order_messages']) {
$view = $helper->generateList($this->_list['order_messages'], $this->fields_list['order_messages']);
}
$this->tpl_view_vars['num_order_messages'] = count($this->_list['order_messages']);
$this->tpl_view_vars['order_messages'] = $view;
}
if (isset($this->_list['hotels']) && $this->_list['hotels']&& count($this->_list['hotels'])) {
$view = '';
$this->initHotelList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'htl_branch_info';
$helper->currentIndex = $this->context->link->getAdminLink('AdminAddHotel', false);
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
if ($query) {
$helper->currentIndex .= '&bo_query='.$query.'&bo_search_type='.$searchType;
}
$helper->token = Tools::getAdminTokenLite('AdminAddHotel');
if ($this->_list['hotels']) {
$view = $helper->generateList($this->_list['hotels'], $this->fields_list['hotels']);
}
$this->tpl_view_vars['num_hotels'] = count($this->_list['hotels']);
$this->tpl_view_vars['hotels'] = $view;
}
if (isset($this->_list['customers']) && count($this->_list['customers'])) {
$view = '';
$this->initCustomerList();
@@ -443,6 +913,101 @@ class AdminSearchControllerCore extends AdminController
$this->tpl_view_vars['num_customers'] = count($this->_list['customers']);
$this->tpl_view_vars['customers'] = $view;
}
if (isset($this->_list['hotel_features']) && count($this->_list['hotel_features'])) {
$view = '';
$this->initHotelFeatureList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id';
$helper->actions = array('edit', 'view');
$helper->show_toolbar = false;
$helper->table = 'htl_features';
$helper->currentIndex = $this->context->link->getAdminLink('AdminHotelFeatures', false);
$helper->token = Tools::getAdminTokenLite('AdminHotelFeatures');
if ($this->_list['hotel_features']) {
$view = $helper->generateList($this->_list['hotel_features'], $this->fields_list['hotel_features']);
}
$this->tpl_view_vars['num_hotel_features'] = count($this->_list['hotel_features']);
$this->tpl_view_vars['hotel_features'] = $view;
}
if (isset($this->_list['groups']) && count($this->_list['groups'])) {
$view = '';
$this->initGroupList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_group';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'group';
$helper->currentIndex = $this->context->link->getAdminLink('AdminGroups', false);
$query = trim(Tools::getValue('bo_query'));
$searchType = (int)Tools::getValue('bo_search_type');
if ($query) {
$helper->currentIndex .= '&bo_query='.$query.'&bo_search_type='.$searchType;
}
$helper->token = Tools::getAdminTokenLite('AdminGroups');
if ($this->_list['groups']) {
$view = $helper->generateList($this->_list['groups'], $this->fields_list['groups']);
}
$this->tpl_view_vars['num_groups'] = count($this->_list['groups']);
$this->tpl_view_vars['groups'] = $view;
}
if (isset($this->_list['global_demands']) && count($this->_list['global_demands'])) {
$view = '';
$this->initGlobalDemandList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_global_demand';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'htl_room_type_global_demand';
$helper->currentIndex = $this->context->link->getAdminLink('AdminRoomTypeGlobalDemand', false);
$helper->token = Tools::getAdminTokenLite('AdminRoomTypeGlobalDemand');
if ($this->_list['global_demands']) {
$view = $helper->generateList($this->_list['global_demands'], $this->fields_list['global_demands']);
}
$this->tpl_view_vars['num_global_demands'] = count($this->_list['global_demands']);
$this->tpl_view_vars['global_demands'] = $view;
}
if (isset($this->_list['refund_rules']) && count($this->_list['refund_rules'])) {
$view = '';
$this->initRefundRuleList();
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_refund_rule';
$helper->actions = array('edit');
$helper->show_toolbar = false;
$helper->table = 'htl_order_refund_rules';
$helper->currentIndex = $this->context->link->getAdminLink('AdminOrderRefundRules', false);
$helper->token = Tools::getAdminTokenLite('AdminOrderRefundRules');
if ($this->_list['refund_rules']) {
$view = $helper->generateList($this->_list['refund_rules'], $this->fields_list['refund_rules']);
}
$this->tpl_view_vars['num_refund_rules'] = count($this->_list['refund_rules']);
$this->tpl_view_vars['refund_rules'] = $view;
}
if (isset($this->_list['orders']) && count($this->_list['orders'])) {
$view = '';
$this->initOrderList();