Merge pull request #1162 from vishal-singh-webkul/gli-2199

Fixed: Hotel permission are not being created for new hotels.
This commit is contained in:
Rohit Jain
2024-07-29 16:45:07 +05:30
committed by GitHub

View File

@@ -183,10 +183,10 @@ class HotelBranchInformation extends ObjectModel
/* Query definition */
$query = 'REPLACE INTO `'._DB_PREFIX_.'htl_access` (`id_profile`, `id_hotel`, `access`)';
$query .= ' VALUES '.'(1, '.(int)$idHotel.', 1)';
$query .= ' VALUES '.'('.(int) _PS_ADMIN_PROFILE_.', '.(int)$idHotel.', 1)';
/* Profile selection */
$profiles = Db::getInstance()->executeS('SELECT `id_profile` FROM '._DB_PREFIX_.'profile WHERE `id_profile` != 1');
if (!$profiles || empty($profiles)) {
$profiles = Db::getInstance()->executeS('SELECT `id_profile` FROM '._DB_PREFIX_.'profile WHERE `id_profile` != '.(int) _PS_ADMIN_PROFILE_);
if ($profiles) {
foreach ($profiles as $profile) {
$access = 0;
if (isset($context->employee->id_profile)) {