[-] Installer : no more sql or php error when upgrade. ( @todo update_feature_detachable_cache )
This commit is contained in:
@@ -29,7 +29,9 @@ function add_new_groups($french, $standard)
|
||||
{
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'group` (`id_group`, `date_add`, `date_upd`) VALUES (NULL, NOW(), NOW())');
|
||||
$last_id = Db::getInstance()->Insert_ID();
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
$languages = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `'._DB_PREFIX_.'lang`');
|
||||
|
||||
$sql = '';
|
||||
foreach ($languages as $lang)
|
||||
if (strtolower($lang['iso_code']) == 'fr')
|
||||
@@ -45,4 +47,4 @@ function add_new_groups($french, $standard)
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_GUEST_GROUP", "'.(int)$last_id.'", NOW(), NOW())');
|
||||
else if (strtolower($standard) == 'test')
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_TEST", "'.(int)$last_id.'", NOW(), NOW())');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,12 @@ function generate_order_reference()
|
||||
$orders = Db::getInstance()->executeS('SELECT id_order FROM '._DB_PREFIX_.'orders');
|
||||
foreach ($orders as $order)
|
||||
{
|
||||
$random_ref = '';
|
||||
for ($i = 0, $passwd = ''; $i < 9; $i++)
|
||||
$random_ref .= substr('ABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(0,25), 1);
|
||||
Db::getInstance()->execute('
|
||||
UPDATE '._DB_PREFIX_.'orders
|
||||
SET reference = \''.Order::generateReference().'\'
|
||||
WHERE id_order = '.$order['id_order']);
|
||||
SET reference = \''.$random_ref.'\'
|
||||
WHERE id_order = '.(int)$order['id_order']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ function migrate_orders()
|
||||
$sum_tax_amount += $products['total_wt'] - $products['total_price'];
|
||||
|
||||
$order_details['reduction_amount_tax_incl']= $reduction_amount_tax_incl;
|
||||
$order_details['reduction_amount_tax_excl']= (float)Tools::ps_round($reduction_amount_tax_incl / $tax_rate, 2);
|
||||
$order_details['reduction_amount_tax_excl']= (float)mo_ps_round($reduction_amount_tax_incl / $tax_rate);
|
||||
$order_details['total_price_tax_incl']= (float)$products['total_wt'];
|
||||
$order_details['total_price_tax_excl']= (float)$products['total_price'];
|
||||
$order_details['unit_price_tax_incl']= (float)$products['product_price_wt'];
|
||||
@@ -89,7 +89,9 @@ function migrate_orders()
|
||||
$average_tax_used += ($sum_tax_amount / $sum_total_products) * 0.01;
|
||||
|
||||
// this was done like that previously
|
||||
$wrapping_tax_rate = 1 + ((float)Configuration::get('PS_GIFT_WRAPPING_TAX') / 100);
|
||||
$wrapping_tax_rate = 1 + (float)Db::getInstance()->getValue('SELECT value
|
||||
FROM `'._DB_PREFIX_.'configuration`
|
||||
WHERE name = "PS_GIFT_WRAPPING_TAX"') / 100;
|
||||
$carrier_tax_rate = 1 + ((float)$order['carrier_tax_rate'] / 100);
|
||||
|
||||
$total_discount_tax_excl = $order['total_discounts'] / $average_tax_used;
|
||||
@@ -127,6 +129,34 @@ function migrate_orders()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mo_ps_round is a simplification of Tools::ps_round:
|
||||
* - round is always 2
|
||||
* - no call to Configuration class
|
||||
*
|
||||
* @param mixed $val
|
||||
* @return void
|
||||
*/
|
||||
function mo_ps_round($val){
|
||||
static $ps_price_round_mode;
|
||||
if (empty($ps_price_round_mode))
|
||||
{
|
||||
$ps_price_round_mode = Db::getInstance()->getValue('SELECT value
|
||||
FROM `'._DB_PREFIX_.'configuration`
|
||||
WHERE name = "PS_PRICE_ROUND_MODE"');
|
||||
}
|
||||
|
||||
switch ($ps_price_round_mode)
|
||||
{
|
||||
case PS_ROUND_UP:
|
||||
return ceil($val * 100)/100;
|
||||
case PS_ROUND_DOWN:
|
||||
return floor($val * 100)/100;
|
||||
default:
|
||||
return round($val, 2);
|
||||
}
|
||||
}
|
||||
|
||||
function mo_duplicateTables()
|
||||
{
|
||||
Db::getInstance()->execute('CREATE TABLE `'._DB_PREFIX_.'orders_2` LIKE `'._DB_PREFIX_.'orders`');
|
||||
@@ -167,9 +197,9 @@ function mo_getPriceDisplayMethod($id_group)
|
||||
function mo_setProductPrices($row, $tax_calculation_method)
|
||||
{
|
||||
if ($tax_calculation_method == PS_TAX_EXC)
|
||||
$row['product_price'] = Tools::ps_round($row['product_price'], 2);
|
||||
$row['product_price'] = mo_ps_round($row['product_price']);
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price'] * (1 + $row['tax_rate'] / 100), 2);
|
||||
$row['product_price_wt'] = mo_ps_round($row['product_price'] * (1 + $row['tax_rate'] / 100));
|
||||
|
||||
$group_reduction = 1;
|
||||
if ($row['group_reduction'] > 0)
|
||||
@@ -181,8 +211,8 @@ function mo_setProductPrices($row, $tax_calculation_method)
|
||||
$row['product_price'] = ($row['product_price'] - $row['product_price'] * ($row['reduction_percent'] * 0.01));
|
||||
else
|
||||
{
|
||||
$reduction = Tools::ps_round($row['product_price_wt'] * ($row['reduction_percent'] * 0.01), 2);
|
||||
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $reduction), 2);
|
||||
$reduction = mo_ps_round($row['product_price_wt'] * ($row['reduction_percent'] * 0.01));
|
||||
$row['product_price_wt'] = mo_ps_round(($row['product_price_wt'] - $reduction));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +221,7 @@ function mo_setProductPrices($row, $tax_calculation_method)
|
||||
if ($tax_calculation_method == PS_TAX_EXC)
|
||||
$row['product_price'] = ($row['product_price'] - ($row['reduction_amount'] / (1 + $row['tax_rate'] / 100)));
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round(($row['product_price_wt'] - $row['reduction_amount']), 2);
|
||||
$row['product_price_wt'] = mo_ps_round(($row['product_price_wt'] - $row['reduction_amount']));
|
||||
}
|
||||
|
||||
if ($row['group_reduction'] > 0)
|
||||
@@ -199,18 +229,18 @@ function mo_setProductPrices($row, $tax_calculation_method)
|
||||
if ($tax_calculation_method == PS_TAX_EXC)
|
||||
$row['product_price'] = $row['product_price'] * $group_reduction;
|
||||
else
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] * $group_reduction , 2);
|
||||
$row['product_price_wt'] = mo_ps_round($row['product_price_wt'] * $group_reduction);
|
||||
}
|
||||
|
||||
if (($row['reduction_percent'] OR $row['reduction_amount'] OR $row['group_reduction']) AND $tax_calculation_method == PS_TAX_EXC)
|
||||
$row['product_price'] = Tools::ps_round($row['product_price'], 2);
|
||||
$row['product_price'] = mo_ps_round($row['product_price']);
|
||||
|
||||
if ($tax_calculation_method == PS_TAX_EXC)
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price'] * (1 + ($row['tax_rate'] * 0.01)), 2) + Tools::ps_round($row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100), 2);
|
||||
$row['product_price_wt'] = mo_ps_round($row['product_price'] * (1 + ($row['tax_rate'] * 0.01))) + mo_ps_round($row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100));
|
||||
else
|
||||
{
|
||||
$row['product_price_wt_but_ecotax'] = $row['product_price_wt'];
|
||||
$row['product_price_wt'] = Tools::ps_round($row['product_price_wt'] + $row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100), 2);
|
||||
$row['product_price_wt'] = mo_ps_round($row['product_price_wt'] + $row['ecotax'] * (1 + $row['ecotax_tax_rate'] / 100));
|
||||
}
|
||||
|
||||
$row['total_wt'] = $row['product_quantity'] * $row['product_price_wt'];
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
function set_product_suppliers()
|
||||
{
|
||||
$ps_currency_default = Db::getInstance()->getValue('SELECT value
|
||||
FROM `'._DB_PREFIX_.'configuration` WHERE name="PS_CURRENCY_DEFAULT"');
|
||||
|
||||
//Get all products with positive quantity
|
||||
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->query('
|
||||
SELECT id_supplier, id_product, supplier_reference, wholesale_price
|
||||
@@ -13,9 +16,13 @@ function set_product_suppliers()
|
||||
//Set default supplier for product
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'product_supplier`
|
||||
(`id_product`, `id_product_attribute`, `id_supplier`, `product_supplier_reference`, `product_supplier_price_te`, `id_currency`)
|
||||
(`id_product`, `id_product_attribute`, `id_supplier`,
|
||||
`product_supplier_reference`, `product_supplier_price_te`,
|
||||
`id_currency`)
|
||||
VALUES
|
||||
("'.(int)$row['id_product'].'", "0", "'.(int)$row['id_supplier'].'", "'.(int)$row['supplier_reference'].'", "'.(int)$row['wholesale_price'].'", "'.(int)Configuration::get('PS_CURRENCY_DEFAULT').'")
|
||||
("'.(int)$row['id_product'].'", "0", "'.(int)$row['id_supplier'].'",
|
||||
"'.(int)$row['supplier_reference'].'", "'.(int)$row['wholesale_price'].'",
|
||||
"'.(int)$ps_currency_default.'"
|
||||
');
|
||||
|
||||
//Try to get product attribues
|
||||
@@ -31,10 +38,14 @@ function set_product_suppliers()
|
||||
// set supplier for attribute
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'product_supplier`
|
||||
(`id_product`, `id_product_attribute`, `id_supplier`, `product_supplier_reference`, `product_supplier_price_te`, `id_currency`)
|
||||
(`id_product`, `id_product_attribute`,
|
||||
`id_supplier`, `product_supplier_reference`,
|
||||
`product_supplier_price_te`, `id_currency`)
|
||||
VALUES
|
||||
("'.(int)$row['id_product'].'", "'.(int)$attribute['id_product_attribute'].'", "'.(int)$row['id_supplier'].'", "'.(int)$attribute['supplier_reference'].'", "'.(int)$attribute['wholesale_price'].'", "'.(int)Configuration::get('PS_CURRENCY_DEFAULT').'")
|
||||
("'.(int)$row['id_product'].'", "'.(int)$attribute['id_product_attribute'].'",
|
||||
"'.(int)$row['id_supplier'].'", "'.(int)$attribute['supplier_reference'].'",
|
||||
"'.(int)$attribute['wholesale_price'].'", "'.(int)$ps_currency_default.'")
|
||||
');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
|
||||
function update_feature_detachable_cache()
|
||||
{
|
||||
// $array_features = arary(
|
||||
// 'specific_price', 'scene',
|
||||
// 'product_download', 'customization_field', 'cart_rule',
|
||||
// 'group', 'pack', 'alias');
|
||||
|
||||
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', (int)SpecificPrice::isCurrentlyUsed('specific_price'));
|
||||
Configuration::updateGlobalValue('PS_SCENE_FEATURE_ACTIVE', (int)Scene::isCurrentlyUsed('scene', true));
|
||||
Configuration::updateGlobalValue('PS_VIRTUAL_PROD_FEATURE_ACTIVE', (int)ProductDownload::isCurrentlyUsed('product_download', true));
|
||||
|
||||
@@ -2,33 +2,38 @@
|
||||
|
||||
function update_modules_multishop()
|
||||
{
|
||||
//BlockCMS
|
||||
$block_cms = Module::getInstanceByName('blockcms');
|
||||
if ($block_cms->id)
|
||||
$block_cms_installed = (bool)Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'module` WHERE name = "blockcms"');
|
||||
if($block_cms_installed)
|
||||
{
|
||||
Db::getInstance()->execute('CREATE TABLE '._DB_PREFIX_.'blocklink_shop (
|
||||
`id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
|
||||
`id_shop` varchar(255) NOT NULL,
|
||||
PRIMARY KEY(`id_blocklink`, `id_shop`))
|
||||
ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
|
||||
|
||||
Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_shop` (
|
||||
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_cms_block`, `id_shop`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'cms_block_shop (cms_block, id_shop)
|
||||
(SELECT id_cms_block, 1 FROM '._DB_PREFIX_.'cms_block)');
|
||||
}
|
||||
$block_cms = Module::getInstanceByName('blocklink');
|
||||
Db::getInstance()->execute('
|
||||
CREATE TABLE '._DB_PREFIX_.'blocklink_shop (
|
||||
Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'blocklink_shop` (
|
||||
`id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
|
||||
`id_shop` varchar(255) NOT NULL,
|
||||
PRIMARY KEY(`id_blocklink`, `id_shop`))
|
||||
ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'blocklink_shop (id_blocklink, id_shop)
|
||||
(SELECT id_blocklink, 1 FROM '._DB_PREFIX_.'blocklink)');
|
||||
|
||||
Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_shop` (
|
||||
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_cms_block`, `id_shop`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'cms_block_shop (cms_block, id_shop)
|
||||
(SELECT id_cms_block, 1 FROM '._DB_PREFIX_.'cms_block)');
|
||||
}
|
||||
|
||||
$block_link_installed = (bool)Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'module` WHERE name = "blocklink"');
|
||||
if($block_link_installed)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'blocklink_shop` (
|
||||
`id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
|
||||
`id_shop` varchar(255) NOT NULL,
|
||||
PRIMARY KEY(`id_blocklink`, `id_shop`))
|
||||
ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'blocklink_shop` (id_blocklink, id_shop)
|
||||
(SELECT id_blocklink, 1 FROM `'._DB_PREFIX_.'blocklink`)');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ function update_order_detail_taxes()
|
||||
$order_detail_taxes = Db::getInstance()->executeS('
|
||||
SELECT `id_order_detail`, `tax_name`, `tax_rate` FROM `'._DB_PREFIX_.'order_detail`
|
||||
');
|
||||
$id_lang_list = Db::getInstance()->executeS('SELECT id_lang FROM `'._DB_PREFIX_.'lang`');
|
||||
|
||||
foreach ($order_detail_taxes as $order_detail_tax)
|
||||
{
|
||||
@@ -13,27 +14,41 @@ function update_order_detail_taxes()
|
||||
|
||||
$alternative_tax_name = 'Tax '.$order_detail_tax['tax_rate'];
|
||||
$create_tax = true;
|
||||
|
||||
if ($id_tax = (int)Tax::getTaxIdByName($order_detail_tax['tax_name'], false) || $id_tax = (int)Tax::getTaxIdByName($alternative_tax_name, false))
|
||||
$id_tax = (int)Db::getInstance()->getValue('SELECT t.`id_tax`
|
||||
FROM `'._DB_PREFIX_.'tax` t
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (tl.id_tax = t.id_tax)
|
||||
WHERE tl.`name` = \''.pSQL($order_detail_tax['tax_name']).'\' ');
|
||||
$id_tax_alt = (int)Db::getInstance()->getValue('SELECT t.`id_tax`
|
||||
FROM `'._DB_PREFIX_.'tax` t
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (tl.id_tax = t.id_tax)
|
||||
WHERE tl.`name` = \''.pSQL($alternative_tax_name).'\' ');
|
||||
|
||||
if ( $id_tax || $id_tax_alt)
|
||||
{
|
||||
$tax = new Tax($id_tax);
|
||||
if (Validate::isLoadedObject($tax))
|
||||
if ((string)$tax->rate == (string)$order_detail_tax['tax_rate'])
|
||||
$create_tax = false;
|
||||
else
|
||||
echo (string)$tax->rate.'!='.(string)$order_detail_tax['tax_rate'];
|
||||
$create_tax = !(bool)Db::getInstance()->getValue('SELECT count(*)
|
||||
FROM `'._DB_PREFIX_.'tax`
|
||||
WHERE id_tax = '. (int)$id_tax .'
|
||||
AND rate = "'.pSql($order_detail_tax['tax_rate']).'"
|
||||
');
|
||||
}
|
||||
|
||||
if ($create_tax)
|
||||
{
|
||||
$tax = new Tax();
|
||||
$tax->rate = (float)$order_detail_tax['tax_rate'];
|
||||
$tax->name[Configuration::get('PS_LANG_DEFAULT')] = (isset($order_detail_tax['tax_name']) ? $order_detail_tax['tax_name'] : $alternative_tax_name);
|
||||
$tax->deleted = true;
|
||||
$tax->active = false;
|
||||
$tax->save();
|
||||
$tax_name = (isset($order_detail_tax['tax_name']) ? $order_detail_tax['tax_name'] : $alternative_tax_name);
|
||||
|
||||
$id_tax = $tax->id;
|
||||
Db::getInstance()->Execute(
|
||||
'INSERT INTO `'._DB_PREFIX_.'tax` (`rate`, `active`, `deleted`)
|
||||
VALUES (\''.(float)$order_detail_tax['tax_rate'].'\', 0, 1)'
|
||||
);
|
||||
|
||||
$id_tax = Db::getInstance()->Insert_ID();
|
||||
foreach ($id_lang_list as $id_lang)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'tax_lang` (`id_tax`, `id_lang`, `name`)
|
||||
VALUES ('.(int)$id_tax.','.(int)$id_lang['id_lang'].',\''.pSQL($tax_name).'\')
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
Db::getInstance()->execute('
|
||||
@@ -42,4 +57,4 @@ function update_order_detail_taxes()
|
||||
');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,11 @@ CREATE TABLE IF NOT EXISTS `PREFIX_shop` (
|
||||
KEY `id_category` (`id_category`),
|
||||
KEY `id_theme` (`id_theme`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_shop` (`id_shop`, `id_group_shop`, `name`, `id_category`, `active`) VALUES (1, 1, 'Default', 1, 1);
|
||||
|
||||
INSERT INTO `PREFIX_shop`
|
||||
(`id_shop`, `id_group_shop`, `name`, `id_category`, `id_theme`, `active`, `deleted`)
|
||||
VALUES
|
||||
(1, 1, (SELECT value FROM `PREFIX_configuration` WHERE name = 'PS_SHOP_NAME'), 1, 1, 1, 0);
|
||||
|
||||
ALTER TABLE `PREFIX_configuration` ADD `id_group_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_configuration` , ADD `id_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_group_shop`;
|
||||
ALTER TABLE `PREFIX_configuration` DROP INDEX `name` , ADD INDEX `name` ( `name` ) ;
|
||||
|
||||
@@ -67,9 +67,18 @@ ALTER TABLE `PREFIX_tax_rule`
|
||||
|
||||
ALTER TABLE `PREFIX_tax_rule` DROP INDEX tax_rule;
|
||||
|
||||
INSERT INTO `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 `PREFIX_tax_rule` r INNER JOIN `PREFIX_county_zip_code` z ON (z.`id_county` = r.`id_county`);
|
||||
INSERT INTO `PREFIX_tax_rule`
|
||||
(`id_tax_rules_group`, `id_country`, `id_state`, `id_tax`,
|
||||
`behavior`, `zipcode_from`, `zipcode_to`, `id_county`,
|
||||
`description`, `state_behavior`, `county_behavior`)
|
||||
SELECT r.`id_tax_rules_group`, r.`id_country`, r.`id_state`, r.`id_tax`,
|
||||
0, z.`from_zip_code`, z.`to_zip_code`, r.`id_county`,
|
||||
r.`description`, r.`state_behavior`, r.county_behavior
|
||||
FROM
|
||||
`PREFIX_tax_rule` r
|
||||
INNER JOIN
|
||||
`PREFIX_county_zip_code` z
|
||||
ON (z.`id_county` = r.`id_county`);
|
||||
|
||||
UPDATE `PREFIX_tax_rule` SET `behavior` = GREATEST(`state_behavior`, `county_behavior`);
|
||||
|
||||
|
||||
@@ -381,16 +381,19 @@ INSERT INTO `PREFIX_order_carrier` (`id_order`, `id_carrier`, `id_order_invoice`
|
||||
FROM `PREFIX_orders` o
|
||||
);
|
||||
|
||||
INSERT INTO `PREFIX_order_payment` (`id_order_invoice`, `id_order`, `id_currency`, `amount`, `payment_method`, `conversion_rate`, `date_add`) (
|
||||
SELECT (
|
||||
SELECT oi.`id_order_invoice`
|
||||
FROM `PREFIX_order_invoice` oi
|
||||
WHERE oi.`id_order` = o.`id_order`
|
||||
), o.`id_order`, o.`id_currency`, o.`total_paid_real`, o.`payment`, o.`conversion_rate`, o.`date_add`
|
||||
FROM `PREFIX_orders` o
|
||||
LEFT JOIN `PREFIX_order_payment` op ON (op.`id_order` = o.`id_order`)
|
||||
WHERE op.`id_order_payment` IS NULL
|
||||
);
|
||||
INSERT IGNORE INTO `PREFIX_order_payment` (`id_order_invoice`, `id_order`, `id_currency`, `amount`, `payment_method`, `conversion_rate`, `date_add`)
|
||||
(
|
||||
SELECT
|
||||
(
|
||||
SELECT oi.`id_order_invoice`
|
||||
FROM `PREFIX_order_invoice` oi
|
||||
WHERE oi.`id_order` = o.`id_order`
|
||||
),
|
||||
o.`id_order`, o.`id_currency`, o.`total_paid_real`, o.`payment`, o.`conversion_rate`, o.`date_add`
|
||||
FROM `PREFIX_orders` o
|
||||
LEFT JOIN `PREFIX_order_payment` op ON (op.`id_order` = o.`id_order`)
|
||||
WHERE op.`id_order_payment` IS NULL
|
||||
);
|
||||
|
||||
INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES
|
||||
('PS_SMARTY_CONSOLE', '0', NOW(), NOW()),('PS_INVOICE_MODEL', 'invoice', NOW(), NOW());
|
||||
@@ -420,7 +423,7 @@ WHERE `class_name` = 'AdminAccounting';
|
||||
|
||||
ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount` `amount_tax_excl` DECIMAL( 10, 2 ) default NULL;
|
||||
ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount_tax_incl` DECIMAL(10,2) default NULL AFTER `amount_tax_excl`;
|
||||
ALTER TABLE `PREFIX_image_type` DROP INDEX `name`;
|
||||
/* PHP:drop_image_type_non_unique_index(); */;
|
||||
ALTER TABLE `PREFIX_image_type` ADD `id_theme` INT(11) NOT NULL AFTER `id_image_type`;
|
||||
ALTER TABLE `PREFIX_image_type` ADD UNIQUE (`id_theme` ,`name`);
|
||||
UPDATE `PREFIX_image_type` SET `id_theme`=1;
|
||||
@@ -432,4 +435,4 @@ PRIMARY KEY (`id_webservice_account` , `id_shop`),
|
||||
KEY `id_shop` (`id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `PREFIX_group` ADD `show_prices` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `price_display_method`;
|
||||
ALTER TABLE `PREFIX_group` ADD `show_prices` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `price_display_method`;
|
||||
|
||||
Reference in New Issue
Block a user