diff --git a/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-install-4.0.7.php b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-install-4.0.7.php index 7a618535..38e0b850 100644 --- a/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-install-4.0.7.php +++ b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-install-4.0.7.php @@ -77,7 +77,7 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;", $payment_table ) . - ""); + "
(If you do not know how to run SQL queries, please contact your hosting provider)"); } /* diff --git a/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-install-4.0.8.php b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-install-4.0.8.php new file mode 100644 index 00000000..38e0b850 --- /dev/null +++ b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-install-4.0.8.php @@ -0,0 +1,131 @@ +startSetup(); + +$payment_table = $installer->getTable('mollie_payments'); +$method_table = $installer->getTable('mollie_methods'); +$order_table = $installer->getTable('sales_flat_order_payment'); + +/* + * Tabel Betalingen + */ +$installer->run( + sprintf(" + CREATE TABLE IF NOT EXISTS `%s` ( + `order_id` int(11) NOT NULL, + `method` varchar(3) NOT NULL, + `transaction_id` varchar(32) NOT NULL, + `bank_account` varchar(15) NOT NULL, + `bank_status` varchar(20) NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime DEFAULT NULL, + UNIQUE KEY `transaction_id` (`transaction_id`), + KEY `order_id` (`order_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;", + $payment_table + ) . "REPLACE INTO `{$installer->getTable('core_config_data')}` SET `path` = 'payment/mollie/description', `value` = 'Order %';" +); +if (!$installer->tableExists($payment_table)) +{ + echo(" +
Insufficient SQL rights to create the $payment_table table! Please make sure you have sufficient access rights to install modules and/or run this query manually:
" .
+		sprintf("
+			CREATE TABLE IF NOT EXISTS `%s` (
+			`order_id` int(11) NOT NULL,
+			`method` varchar(3) NOT NULL,
+			`transaction_id` varchar(32) NOT NULL,
+			`bank_account` varchar(15) NOT NULL,
+			`bank_status` varchar(20) NOT NULL,
+			`created_at` datetime NOT NULL,
+			`updated_at` datetime DEFAULT NULL,
+			 UNIQUE KEY `transaction_id` (`transaction_id`),
+			 KEY `order_id` (`order_id`)
+		) ENGINE=InnoDB DEFAULT CHARSET=utf8;",
+			$payment_table
+		) .
+		"

(If you do not know how to run SQL queries, please contact your hosting provider)
"); +} + +/* + * Tabel Betaalmethodes + */ + +if ($installer->tableExists($method_table)) +{ + $installer->run( + sprintf("DROP TABLE IF EXISTS `%s`", $method_table) + ); +} + +$installer->run( + sprintf(" + CREATE TABLE IF NOT EXISTS `%s` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `method_id` varchar(32) NOT NULL DEFAULT '', + `description` varchar(32) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `method_id` (`method_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;", + $method_table + ) +); + + +if (!$installer->tableExists($method_table)) +{ + echo(" +
Insufficient SQL rights to create the $method_table table! Please make sure you have sufficient access rights to install modules and/or run this query manually:
" .
+		sprintf("
+			CREATE TABLE IF NOT EXISTS `%s` (
+			  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+			  `method_id` varchar(32) NOT NULL DEFAULT '',
+			  `description` varchar(32) NOT NULL DEFAULT '',
+			  PRIMARY KEY (`id`),
+			  UNIQUE KEY `method_id` (`method_id`)
+			) ENGINE=InnoDB DEFAULT CHARSET=utf8;",
+			$method_table
+		) .
+		"

(If you do not know how to run SQL queries, please contact your hosting provider)
"); +} + +// update sales_flat_order_payment +for ($i = 0; $i < 10; $i++) +{ + $installer->run("UPDATE `".$order_table."` SET `method` = 'mpm_void_0".$i."' WHERE `method` = 'mpm_void_".$i."';"); +} + +$installer->endSetup(); \ No newline at end of file diff --git a/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-uninstall-4.0.7.php b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-uninstall-4.0.7.php index 621f8ff5..ce1258e5 100644 --- a/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-uninstall-4.0.7.php +++ b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-uninstall-4.0.7.php @@ -64,7 +64,7 @@ sprintf("DROP TABLE IF EXISTS `%s`", $installer->getTable('mollie_methods') ) . - ""; + "
(If you do not know how to run SQL queries, please contact your hosting provider)"; } $installer->endSetup(); diff --git a/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-uninstall-4.0.8.php b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-uninstall-4.0.8.php new file mode 100644 index 00000000..ce1258e5 --- /dev/null +++ b/app/code/community/Mollie/Mpm/sql/mpm_setup/mysql4-uninstall-4.0.8.php @@ -0,0 +1,70 @@ +startSetup(); + +$installer->run( + sprintf("DROP TABLE IF EXISTS `%s`", + $installer->getTable('mollie_payments') + ) +); +$installer->run( + sprintf("DROP TABLE IF EXISTS `%s`", + $installer->getTable('mollie_methods') + ) +); + +$installer->run(" + DELETE FROM `{$installer->getTable('core_config_data')}` where `path` LIKE 'payment/mollie/%'; + DELETE FROM `{$installer->getTable('core_resource')}` where `code` = 'mpm_setup';" +); + + +if ($installer->tableExists($installer->getTable('mollie_payments')) || $installer->tableExists($installer->getTable('mollie_methods'))) +{ + echo "
Insufficient SQL rights to uninstall correctly! Please make sure you have sufficient access rights to (un)install modules and/or run these queries manually:
" .
+		sprintf("DROP TABLE IF EXISTS `%s`",
+			$installer->getTable('mollie_payments')
+		) .
+		"

And:
" .
+		sprintf("DROP TABLE IF EXISTS `%s`",
+			$installer->getTable('mollie_methods')
+		) .
+		"

(If you do not know how to run SQL queries, please contact your hosting provider)
"; +} + +$installer->endSetup();