From d157500d49866d666a1103b6b9537e91d4896e23 Mon Sep 17 00:00:00 2001 From: Andy Pieters Date: Tue, 13 Feb 2018 16:55:13 +0100 Subject: [PATCH] Fixed upgrade from version 4.1 --- paynlpaymentmethods/paynlpaymentmethods.php | 22 +++++++------------ .../{Upgrade-4.1.php => Upgrade-4.2.php} | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) rename paynlpaymentmethods/upgrade/{Upgrade-4.1.php => Upgrade-4.2.php} (91%) diff --git a/paynlpaymentmethods/paynlpaymentmethods.php b/paynlpaymentmethods/paynlpaymentmethods.php index 022d44f..34d9c61 100644 --- a/paynlpaymentmethods/paynlpaymentmethods.php +++ b/paynlpaymentmethods/paynlpaymentmethods.php @@ -82,8 +82,6 @@ public function install() if ( ! parent::install() || ! $this->registerHook('paymentOptions') || ! $this->registerHook('paymentReturn') - || ! $this->uninstallOverrides() - || ! $this->removeFeeTable() ) { return false; } @@ -94,17 +92,6 @@ public function install() return true; } - /** - * This table was added in a previous version, but is no longer needed - * - * @return bool - */ - private function removeFeeTable() - { - return (bool)Db::getInstance()->execute( - 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'paynl_pfee_cart`'); - } - public function createPaymentFeeProduct() { $id_product = Configuration::get('PAYNL_FEE_PRODUCT_ID'); @@ -137,6 +124,13 @@ public function createPaymentFeeProduct() return true; } + public function installOverrides() + { + // This version doesn't have overrides anymode, but prestashop still keeps them around. + // By overriding this method we can prevent prestashop from reinstalling the old overrides + return true; + } + public function uninstall() { @@ -249,7 +243,7 @@ private function getPaymentMethodsForCart($cart = null) $totalWithFee = $cartTotal + $paymentMethod->fee; if ($paymentMethod->fee > 0) { - $strFee = " (+ " . Tools::displayPrice($paymentMethod->fee, (int) $cart->id_currency, true) . ")"; + $strFee = " (+ " . Tools::displayPrice($paymentMethod->fee, (int)$cart->id_currency, true) . ")"; } $paymentMethod->name .= $strFee; diff --git a/paynlpaymentmethods/upgrade/Upgrade-4.1.php b/paynlpaymentmethods/upgrade/Upgrade-4.2.php similarity index 91% rename from paynlpaymentmethods/upgrade/Upgrade-4.1.php rename to paynlpaymentmethods/upgrade/Upgrade-4.2.php index 9a9cb3e..6f5d7b6 100644 --- a/paynlpaymentmethods/upgrade/Upgrade-4.1.php +++ b/paynlpaymentmethods/upgrade/Upgrade-4.2.php @@ -2,7 +2,7 @@ /** * @param $module PaynlPaymentMethods */ -function upgrade_module_4_1($module) +function upgrade_module_4_2($module) { $results = array();