[*] Project : US + CA TaxSystem
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
function remove_tab($tabname)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
DELETE t, l
|
||||
FROM `ps_tab` t LEFT JOIN `PREFIX_tab_lang` l ON (t.id_tab = l.id_tab)
|
||||
WHERE t.`class_name` = '.pSQL($tabname));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
|
||||
function update_tax_rules()
|
||||
{
|
||||
// Add new columns
|
||||
Db::getInstance()->Execute('
|
||||
ALTER TABLE `'._DB_PREFIX_.'tax_rule`
|
||||
ADD `zipcode_from` INT NOT NULL AFTER `id_state` ,
|
||||
ADD `zipcode_to` INT NOT NULL AFTER `zipcode_from` ,
|
||||
ADD `behavior` INT NOT NULL AFTER `zipcode_to`,
|
||||
ADD `description` VARCHAR( 100 ) NOT NULL AFTER `id_tax`;
|
||||
');
|
||||
|
||||
// Drop integrity constraint
|
||||
Db::getInstance()->Execute('
|
||||
ALTER TABLE `'._DB_PREFIX_.'tax_rule` DROP INDEX tax_rule
|
||||
');
|
||||
|
||||
// Create new format rules
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'tax_rule` (`id_tax_rules_group`, `id_country`, `id_state`, `id_tax`, `behavior`, `zipcode_from`, `zipcode_to`)
|
||||
SELECT r.`id_tax_rules_group`, r.`id_country`, r.`id_state`, r.`id_tax`, 0, z.`from_zip_code`, z.`to_zip_code`
|
||||
FROM `'._DB_PREFIX_.'tax_rule` r INNER JOIN `'._DB_PREFIX_.'county_zip_code` z ON (z.`id_county` = r.`id_county`)
|
||||
');
|
||||
|
||||
// update behavior
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'tax_rule` SET `behavior` = GREATEST(`state_behavior`, `county_behavior`);
|
||||
');
|
||||
|
||||
|
||||
// Clean old entries
|
||||
Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'tax_rule`
|
||||
WHERE `id_county` != 0
|
||||
AND `zipcode_from` = 0
|
||||
');
|
||||
|
||||
// Remove old columns
|
||||
Db::getInstance()->Execute('
|
||||
ALTER TABLE `'._DB_PREFIX_.'tax_rule`
|
||||
DROP `id_county`,
|
||||
DROP `state_behavior`,
|
||||
DROP `county_behavior`
|
||||
');
|
||||
}
|
||||
|
||||
+11
-28
@@ -178,7 +178,7 @@ CREATE TABLE `PREFIX_cart` (
|
||||
KEY `id_lang` (`id_lang`),
|
||||
KEY `id_currency` (`id_currency`),
|
||||
KEY `id_guest` (`id_guest`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -324,7 +324,7 @@ CREATE TABLE `PREFIX_configuration_lang` (
|
||||
|
||||
CREATE TABLE `PREFIX_connections` (
|
||||
`id_connections` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_guest` int(10) unsigned NOT NULL,
|
||||
`id_page` int(10) unsigned NOT NULL,
|
||||
@@ -442,7 +442,7 @@ CREATE TABLE `PREFIX_customer` (
|
||||
KEY `customer_login` (`email`,`passwd`),
|
||||
KEY `id_customer_passwd` (`id_customer`,`passwd`),
|
||||
KEY `id_gender` (`id_gender`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -487,7 +487,7 @@ CREATE TABLE `PREFIX_customer_thread` (
|
||||
KEY `id_contact` (`id_contact`),
|
||||
KEY `id_customer` (`id_customer`),
|
||||
KEY `id_order` (`id_order`),
|
||||
KEY `id_product` (`id_product`)
|
||||
KEY `id_product` (`id_product`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
@@ -942,7 +942,7 @@ CREATE TABLE `PREFIX_orders` (
|
||||
KEY `id_currency` (`id_currency`),
|
||||
KEY `id_address_delivery` (`id_address_delivery`),
|
||||
KEY `id_address_invoice` (`id_address_invoice`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_shop` (`id_shop`),
|
||||
INDEX `date_add`(`date_add`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
@@ -1119,7 +1119,7 @@ CREATE TABLE `PREFIX_page_type` (
|
||||
|
||||
CREATE TABLE `PREFIX_page_viewed` (
|
||||
`id_page` int(10) unsigned NOT NULL,
|
||||
`id_group_shop` INT UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_group_shop` INT UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_shop` INT UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_date_range` int(10) unsigned NOT NULL,
|
||||
`counter` int(10) unsigned NOT NULL,
|
||||
@@ -1637,14 +1637,14 @@ CREATE TABLE `PREFIX_tax_rule` (
|
||||
`id_tax_rules_group` int(11) NOT NULL,
|
||||
`id_country` int(11) NOT NULL,
|
||||
`id_state` int(11) NOT NULL,
|
||||
`id_county` int(11) NOT NULL,
|
||||
`zipcode_from` INT NOT NULL,
|
||||
`zipcode_to` INT NOT NULL,
|
||||
`id_tax` int(11) NOT NULL,
|
||||
`state_behavior` int(11) NOT NULL,
|
||||
`county_behavior` int(11) NOT NULL,
|
||||
`behavior` int(11) NOT NULL,
|
||||
`description` VARCHAR( 100 ) NOT NULL,
|
||||
PRIMARY KEY (`id_tax_rule`),
|
||||
KEY `id_tax_rules_group` (`id_tax_rules_group`),
|
||||
KEY `id_tax` (`id_tax`),
|
||||
UNIQUE KEY `tax_rule` (`id_tax_rules_group`, `id_country`, `id_state`, `id_county`)
|
||||
KEY `id_tax` (`id_tax`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_tax_rules_group` (
|
||||
@@ -1688,23 +1688,6 @@ CREATE TABLE `PREFIX_import_match` (
|
||||
PRIMARY KEY (`id_import_match`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE `PREFIX_county` (
|
||||
`id_county` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`id_state` int(11) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id_county`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 ;
|
||||
|
||||
|
||||
CREATE TABLE `PREFIX_county_zip_code` (
|
||||
`id_county` INT NOT NULL ,
|
||||
`from_zip_code` INT NOT NULL ,
|
||||
`to_zip_code` INT NOT NULL ,
|
||||
PRIMARY KEY ( `id_county` , `from_zip_code` , `to_zip_code` )
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_address_format` (
|
||||
`id_country` int(10) unsigned NOT NULL,
|
||||
`format` varchar(255) NOT NULL DEFAULT '',
|
||||
|
||||
@@ -66,7 +66,8 @@ INSERT INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`
|
||||
(63, 'beforeAuthentication', 'Before Authentication', 'Before authentication', 0, 0),
|
||||
(64, 'paymentTop', 'Top of payment page', 'Top of payment page', 0, 0),
|
||||
(65, 'afterCreateHtaccess', 'After htaccess creation', 'After htaccess creation', 0, 0),
|
||||
(66, 'afterSaveAdminMeta', 'After save configuration in AdminMeta', 'After save configuration in AdminMeta', 0, 0);
|
||||
(66, 'afterSaveAdminMeta', 'After save configuration in AdminMeta', 'After save configuration in AdminMeta', 0, 0),
|
||||
(67, 'taxManager', 'Tax Manager Factory', '' , 0, 0);
|
||||
|
||||
INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES
|
||||
(1, 'PS_LANG_DEFAULT', '1', NOW(), NOW()),
|
||||
@@ -1180,7 +1181,7 @@ INSERT INTO `PREFIX_address_format` (`id_country`, `format`)
|
||||
UPDATE `PREFIX_address_format` set `format`='firstname lastname
|
||||
company
|
||||
address1 address2
|
||||
city, State:name postcode
|
||||
city, State:name postcode
|
||||
Country:name
|
||||
phone' where `id_country`=21;
|
||||
|
||||
@@ -1199,3 +1200,4 @@ postcode city
|
||||
State:name
|
||||
Country:name
|
||||
phone' where `id_country`=10;
|
||||
|
||||
|
||||
@@ -22,4 +22,20 @@ INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `vie
|
||||
AND a.`view` = 1
|
||||
);
|
||||
|
||||
UPDATE `PREFIX_tab` SET `class_name` = 'AdminThemes' WHERE `class_name` = 'AdminAppearance';
|
||||
UPDATE `PREFIX_tab` SET `class_name` = 'AdminThemes' WHERE `class_name` = 'AdminAppearance';
|
||||
|
||||
INSERT INTO `PREFIX_hook` (
|
||||
`name` ,
|
||||
`title` ,
|
||||
`description` ,
|
||||
`position` ,
|
||||
`live_edit`
|
||||
)
|
||||
VALUES ('taxmanager', 'taxmanager', NULL , '1', '0');
|
||||
|
||||
/* PHP:update_tax_rules(); */;
|
||||
|
||||
/* PHP:remove_tab(AdminCounty); */;
|
||||
DROP TABLE `PREFIX_county_zip_code`;
|
||||
DROP TABLE `PREFIX_county`;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ $engineType = 'ENGINE_TYPE';
|
||||
|
||||
if (function_exists('date_default_timezone_set'))
|
||||
date_default_timezone_set('Europe/Paris');
|
||||
|
||||
|
||||
// if _PS_ROOT_DIR_ is defined, use it instead of "guessing" the module dir.
|
||||
if (defined('_PS_ROOT_DIR_') AND !defined('_PS_MODULE_DIR_'))
|
||||
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_.'/modules/');
|
||||
@@ -133,6 +133,10 @@ require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'create_multistore.php');
|
||||
|
||||
require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'add_order_state.php');
|
||||
|
||||
require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'update_tax_rules.php');
|
||||
|
||||
require_once(_PS_INSTALLER_PHP_UPGRADE_DIR_.'remove_tab.php');
|
||||
|
||||
//old version detection
|
||||
global $oldversion, $logger;
|
||||
$oldversion = false;
|
||||
@@ -313,9 +317,9 @@ if ($confFile->error != false)
|
||||
|
||||
// Settings updated, compile and cache directories must be emptied
|
||||
$arrayToClean = array(
|
||||
INSTALL_PATH.'/../tools/smarty/cache/',
|
||||
INSTALL_PATH.'/../tools/smarty/compile/',
|
||||
INSTALL_PATH.'/../tools/smarty_v2/cache/',
|
||||
INSTALL_PATH.'/../tools/smarty/cache/',
|
||||
INSTALL_PATH.'/../tools/smarty/compile/',
|
||||
INSTALL_PATH.'/../tools/smarty_v2/cache/',
|
||||
INSTALL_PATH.'/../tools/smarty_v2/compile/');
|
||||
foreach ($arrayToClean as $dir)
|
||||
if (!file_exists($dir))
|
||||
|
||||
Reference in New Issue
Block a user