Skip to content

Commit ff410ed

Browse files
authored
Merge pull request #707 from abhishek-webkul/update-demo-data
Remove demo data creation if 'Install demo data' is set to 'No' during installation
2 parents 22865cb + f6fabaf commit ff410ed

File tree

23 files changed

+88
-94
lines changed

23 files changed

+88
-94
lines changed

controllers/admin/AdminStatsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,8 +1686,8 @@ public static function getDirectRevenueRatio($dateFrom, $dateTo, $idHotel = null
16861686
WHERE o.`valid` = 1 AND hbi.`active` = 1 AND hbd.`is_refunded` = 0
16871687
AND o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"
16881688
AND o.`source` = "'.pSQL(Configuration::get('PS_SHOP_DOMAIN')).'"'.
1689-
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').
1690-
'GROUP BY o.`id_order`
1689+
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').'
1690+
GROUP BY o.`id_order`
16911691
) AS t';
16921692
$directRevenue = (float) Db::getInstance()->getValue($sql);
16931693

modules/blocknavigationmenu/blocknavigationmenu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function install()
112112
|| !$this->callInstallTab()
113113
|| !$this->registerModuleHooks()
114114
|| !Configuration::updateValue('WK_SHOW_FOOTER_NAVIGATION_BLOCK', 1)
115-
|| !$objCustomNavigationLink->insertDemoData()
115+
|| !$objCustomNavigationLink->insertDemoData(isset($this->populateData) ? $this->populateData : null)
116116
) {
117117
return false;
118118
}

modules/blocknavigationmenu/classes/WkCustomNavigationLink.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function cleanPositions()
147147
return (bool) Db::getInstance()->execute($sql);
148148
}
149149

150-
public function insertDemoData($qloInstallData = 0)
150+
public function insertDemoData($populateData = null)
151151
{
152152
//insert home link to the list
153153
$languages = Language::getLanguages(false);
@@ -166,8 +166,8 @@ public function insertDemoData($qloInstallData = 0)
166166

167167
// enter modules links
168168
$modsElems = array();
169-
if ($qloInstallData) {
170-
// if module is installing or resetting
169+
// if module is installing or resetting
170+
if (is_null($populateData)) {
171171
if (Module::isEnabled('wkabouthotelblock')) {
172172
$modsElems['Interior'] = 'hotelInteriorBlock';
173173
}
@@ -181,12 +181,15 @@ public function insertDemoData($qloInstallData = 0)
181181
$modsElems['Testimonials'] = 'hotelTestimonialBlock';
182182
}
183183
} else {
184-
// if QloApps is installing then enter modules links directly
185-
$modsElems['Interior'] = 'hotelInteriorBlock';
186-
$modsElems['Amenities'] = 'hotelAmenitiesBlock';
187-
$modsElems['Rooms'] = 'hotelRoomsBlock';
188-
$modsElems['Testimonials'] = 'hotelTestimonialBlock';
184+
// if QloApps is installing and $populateData = 1 then enter modules links directly
185+
if ($populateData) {
186+
$modsElems['Interior'] = 'hotelInteriorBlock';
187+
$modsElems['Amenities'] = 'hotelAmenitiesBlock';
188+
$modsElems['Rooms'] = 'hotelRoomsBlock';
189+
$modsElems['Testimonials'] = 'hotelTestimonialBlock';
190+
}
189191
}
192+
190193
if ($modsElems) {
191194
$indexLink = Context::getContext()->shop->getBaseURI();
192195
foreach ($modsElems as $name => $modElm) {

modules/hotelreservationsystem/hotelreservationsystem.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,16 +598,15 @@ public function install()
598598
|| !$this->registerModuleHooks()
599599
|| !$this->callInstallTab()
600600
|| !$objHtlHelper->insertDefaultHotelEntries()
601+
|| !$objHtlHelper->createHotelRoomDefaultFeatures()
602+
|| !$objHtlHelper->insertHotelCommonFeatures()
601603
) {
602604
return false;
603605
}
604606

605607
// if module should be populated while installation
606608
if (isset($this->populateData) && $this->populateData) {
607-
if (!$objHtlHelper->createHotelRoomDefaultFeatures()
608-
|| !$objHtlHelper->insertHotelCommonFeatures()
609-
|| !$objHtlHelper->createDummyDataForProject()
610-
) {
609+
if (!$objHtlHelper->createDummyDataForProject()) {
611610
return false;
612611
}
613612
}

modules/wkabouthotelblock/classes/WkHotelInteriorImage.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ public function insertModuleDemoData()
145145
$HOTEL_INTERIOR_HEADING[$lang['id_lang']] = 'Interior';
146146
$HOTEL_INTERIOR_DESCRIPTION[$lang['id_lang']] = 'Families travelling with kids will find Amboseli national park a safari destination matched to no other, with less tourist traffic, breathtaking open space.';
147147
}
148-
Configuration::updateValue('HOTEL_INTERIOR_BLOCK_NAV_LINK', 1);
149148
// update global configuration values in multilang
150149
Configuration::updateValue('HOTEL_INTERIOR_HEADING', $HOTEL_INTERIOR_HEADING);
151150
Configuration::updateValue('HOTEL_INTERIOR_DESCRIPTION', $HOTEL_INTERIOR_DESCRIPTION);

modules/wkabouthotelblock/controllers/admin/AdminAboutHotelBlockSettingController.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ public function __construct()
3636
'title' => $this->l('Hotel Interior Description'),
3737
'icon' => 'icon-cogs',
3838
'fields' => array(
39-
'HOTEL_INTERIOR_BLOCK_NAV_LINK' => array(
40-
'title' => $this->l('Show link at navigation'),
41-
'hint' => $this->l('Enable, if you want to display a link at navigation menu for the interior block at home page.'),
42-
'validation' => 'isBool',
43-
'cast' => 'intval',
44-
'type' => 'bool',
45-
'required' => true
46-
),
4739
'HOTEL_INTERIOR_HEADING' => array(
4840
'title' => $this->l('Interior Block Title'),
4941
'type' => 'textLang',

modules/wkabouthotelblock/wkabouthotelblock.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,24 @@ public function hookActionObjectLanguageAddAfter($params)
8585
public function install()
8686
{
8787
$objAboutHotelBlockDb = new WkAboutHotelBlockDb();
88-
$objHtlInteriorImg = new WkHotelInteriorImage();
8988
if (!parent::install()
9089
|| !$objAboutHotelBlockDb->createTables()
9190
|| !$this->registerModuleHooks()
9291
|| !$this->callInstallTab()
93-
|| !$objHtlInteriorImg->insertModuleDemoData()
9492
) {
9593
return false;
9694
}
95+
96+
// if module should create demo data during installation
97+
if (isset($this->populateData) && $this->populateData) {
98+
$objHtlInteriorImg = new WkHotelInteriorImage();
99+
if (!$objHtlInteriorImg->insertModuleDemoData()) {
100+
return false;
101+
}
102+
} else {
103+
Tools::deleteDirectory($this->local_path.'views/img/dummy_img');
104+
}
105+
97106
return true;
98107
}
99108

modules/wkhotelfeaturesblock/classes/WkHotelFeaturesData.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ public function cleanPositions()
138138
// enter the default demo data of the module
139139
public function insertModuleDemoData()
140140
{
141-
Configuration::updateValue('HOTEL_AMENITIES_BLOCK_NAV_LINK', 1);
142-
143141
$languages = Language::getLanguages(false);
144142
$HOTEL_AMENITIES_HEADING = array();
145143
$HOTEL_AMENITIES_DESCRIPTION = array();

modules/wkhotelfeaturesblock/controllers/admin/AdminFeaturesModuleSettingController.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ public function __construct()
4242
'title' => $this->l('Hotel Amenity Setting'),
4343
'icon' => 'icon-cogs',
4444
'fields' => array(
45-
'HOTEL_AMENITIES_BLOCK_NAV_LINK' => array(
46-
'title' => $this->l('Show link at navigation'),
47-
'hint' => $this->l('Enable, if you want to display a link at navigation menu for the amenities block at home page.'),
48-
'validation' => 'isBool',
49-
'cast' => 'intval',
50-
'type' => 'bool',
51-
'required' => true
52-
),
5345
'HOTEL_AMENITIES_HEADING' => array(
5446
'title' => $this->l('Amenity Block Title'),
5547
'type' => 'textLang',
-21.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)