Skip to content

Commit

Permalink
Fix for module activation check
Browse files Browse the repository at this point in the history
  • Loading branch information
sowbiba committed Nov 27, 2023
1 parent 63bdd7b commit 4ca20b1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/DependencyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,25 @@ private function getDependencies($addRoutes = false)
)
);

if ($dependencyData && is_array($dependencyData) && !empty($dependencyData['id_module'])) {
// For PS < 8.0, enable/disable for a module is decided by the shop association
// We assume that if the module is disabled for one shop, i's considered as disabled
$isModuleActiveForAllShops = (bool) \DbCore::getInstance()->getValue(
sprintf("SELECT id_module
FROM `%smodule_shop`
WHERE id_module=%d AND id_shop IN ('%s')
GROUP BY id_module
HAVING COUNT(*)=%d",
_DB_PREFIX_,
(int) $dependencyData['id_module'],
implode(',', array_map('intval', \Shop::getContextListShopID())),
(int) count(\Shop::getContextListShopID())
)
);

$dependencyData['active'] = $isModuleActiveForAllShops;
}

if ($addRoutes) {
$dependencies[$dependency['name']] = array_merge(
$dependency,
Expand Down

0 comments on commit 4ca20b1

Please sign in to comment.