[-] MO : Fix PSCFV-12556 implementation of reset method

This commit is contained in:
sfroment42
2014-09-24 11:01:53 +02:00
parent 56809f52c4
commit 045e4083c3
+24 -10
View File
@@ -63,12 +63,10 @@ class Blocktopmenu extends Module
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
} }
public function install() public function install($delete_params = true)
{ {
if (!parent::install() || if (!parent::install() ||
!$this->registerHook('displayTop') || !$this->registerHook('displayTop') ||
!Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT3,CAT26') ||
!Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_SEARCH', '1') ||
!$this->registerHook('actionObjectCategoryUpdateAfter') || !$this->registerHook('actionObjectCategoryUpdateAfter') ||
!$this->registerHook('actionObjectCategoryDeleteAfter') || !$this->registerHook('actionObjectCategoryDeleteAfter') ||
!$this->registerHook('actionObjectCategoryAddAfter') || !$this->registerHook('actionObjectCategoryAddAfter') ||
@@ -85,9 +83,13 @@ class Blocktopmenu extends Module
!$this->registerHook('actionObjectProductDeleteAfter') || !$this->registerHook('actionObjectProductDeleteAfter') ||
!$this->registerHook('actionObjectProductAddAfter') || !$this->registerHook('actionObjectProductAddAfter') ||
!$this->registerHook('categoryUpdate') || !$this->registerHook('categoryUpdate') ||
!$this->registerHook('actionShopDataDuplication') || !$this->registerHook('actionShopDataDuplication'))
!$this->installDB())
return false; return false;
if ($delete_params)
if (!$this->installDb() || !Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT3,CAT26') || !Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_SEARCH', '1'))
return false;
return true; return true;
} }
@@ -111,13 +113,15 @@ class Blocktopmenu extends Module
) ENGINE = '._MYSQL_ENGINE_.' CHARACTER SET utf8 COLLATE utf8_general_ci;')); ) ENGINE = '._MYSQL_ENGINE_.' CHARACTER SET utf8 COLLATE utf8_general_ci;'));
} }
public function uninstall() public function uninstall($delete_params = true)
{ {
if (!parent::uninstall() || if (!parent::uninstall())
!Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') ||
!Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH') ||
!$this->uninstallDB())
return false; return false;
if ($delete_params)
if (!$this->uninstallDB() || !Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') || !Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH'))
return false;
return true; return true;
} }
@@ -128,6 +132,16 @@ class Blocktopmenu extends Module
return true; return true;
} }
public function reset()
{
if (!$this->uninstall(false))
return false;
if (!$this->install(false))
return false;
return true;
}
public function getContent() public function getContent()
{ {
$this->context->controller->addjQueryPlugin('hoverIntent'); $this->context->controller->addjQueryPlugin('hoverIntent');