// Fixed upgrade warnings #PSCFV-3633
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16910 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -37,10 +37,10 @@ function migrate_orders()
|
||||
|
||||
// init insert order detail query
|
||||
$values_order_detail = array();
|
||||
$col_order_detail = Db::getInstance()->executeS('SHOW FIELDS
|
||||
FROM `'._DB_PREFIX_.'order_detail`');
|
||||
$col_order_detail = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'order_detail`');
|
||||
foreach ($col_order_detail as $k => $field)
|
||||
$col_order_detail[$k] = $field['Field'];
|
||||
if ($field['Field'] != 'id_order_invoice')
|
||||
$col_order_detail[$k] = $field['Field'];
|
||||
|
||||
if (!$col_order_detail)
|
||||
return array('error' => 1, 'msg' => 'unable to get fields list from order_detail table');
|
||||
@@ -85,11 +85,10 @@ function migrate_orders()
|
||||
$default_group_id = mo_getCustomerDefaultGroup((int)$order['id_customer']);
|
||||
$price_display_method = mo_getPriceDisplayMethod((int)$default_group_id);
|
||||
$order_details_list = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON p.id_product = od.product_id
|
||||
WHERE od.`id_order` = '.(int)($order['id_order']));
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = od.product_id
|
||||
WHERE od.`id_order` = '.(int)$order['id_order']);
|
||||
|
||||
foreach ($order_details_list as $order_details)
|
||||
{
|
||||
@@ -102,12 +101,12 @@ function migrate_orders()
|
||||
$sum_total_products += $products['total_wt'];
|
||||
$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)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'];
|
||||
$order_details['unit_price_tax_excl']= (float)$products['product_price'];
|
||||
$order_details['reduction_amount_tax_incl'] = $reduction_amount_tax_incl;
|
||||
$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'];
|
||||
$order_details['unit_price_tax_excl'] = (float)$products['product_price'];
|
||||
foreach (array_keys($order_details) as $k)
|
||||
if (!in_array($k, $col_order_detail))
|
||||
unset($order_details[$k]);
|
||||
@@ -154,12 +153,12 @@ function migrate_orders()
|
||||
if (!Db::getInstance()->execute($insert_order_detail. implode(',', $values_order_detail)))
|
||||
{
|
||||
$res = false;
|
||||
$array_errors[] = '[insert order detail] - '.Db::getInstance()->getMsgError();
|
||||
$array_errors[] = '[insert order detail 1] - '.Db::getInstance()->getMsgError();
|
||||
}
|
||||
if (!Db::getInstance()->execute($insert_order. implode(',', $values_order)))
|
||||
{
|
||||
$res = false;
|
||||
$array_errors[] = '[insert order] - '.Db::getInstance()->getMsgError();
|
||||
$array_errors[] = '[insert order 1] - '.Db::getInstance()->getMsgError();
|
||||
}
|
||||
$values_order = array();
|
||||
$values_order_detail = array();
|
||||
@@ -172,12 +171,12 @@ function migrate_orders()
|
||||
if (!Db::getInstance()->execute($insert_order_detail. implode(',', $values_order_detail)))
|
||||
{
|
||||
$res = false;
|
||||
$array_errors[] = Db::getInstance()->getMsgError();
|
||||
$array_errors[] = '[insert order detail 2] - '.Db::getInstance()->getMsgError();
|
||||
}
|
||||
if (!Db::getInstance()->execute($insert_order. implode(',', $values_order)))
|
||||
{
|
||||
$res = false;
|
||||
$array_errors[] = Db::getInstance()->getMsgError();
|
||||
$array_errors[] = '[insert order 2] - '.Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,14 +86,14 @@ INSERT INTO `PREFIX_stock` (id_product, id_product_attribute, id_shop, quantity)
|
||||
) FROM PREFIX_product p);
|
||||
|
||||
ALTER TABLE PREFIX_stock_mvt ADD id_stock INT UNSIGNED NOT NULL AFTER id_stock_mvt;
|
||||
UPDATE PREFIX_stock_mvt sm SET sm.id_stock = (
|
||||
UPDATE PREFIX_stock_mvt sm SET sm.id_stock = IFNULL((
|
||||
SELECT IFNULL(s.id_stock, 0)
|
||||
FROM PREFIX_stock s
|
||||
WHERE s.id_product = sm.id_product
|
||||
AND s.id_product_attribute = sm.id_product_attribute
|
||||
ORDER BY s.id_shop
|
||||
LIMIT 1
|
||||
);
|
||||
), 0);
|
||||
DELETE FROM PREFIX_stock_mvt WHERE id_stock = 0;
|
||||
ALTER TABLE PREFIX_stock_mvt DROP id_product, DROP id_product_attribute;
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ CREATE TABLE `PREFIX_order_invoice` (
|
||||
KEY `id_order` (`id_order`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `PREFIX_order_detail` ADD `id_order_invoice` int(11) NULL AFTER `id_order`;
|
||||
ALTER TABLE `PREFIX_order_detail` ADD `id_order_invoice` int(11) NOT NULL DEFAULT 0 AFTER `id_order`;
|
||||
|
||||
ALTER TABLE `PREFIX_payment_cc` CHANGE `id_payment_cc` `id_order_payment` INT NOT NULL auto_increment;
|
||||
ALTER TABLE `PREFIX_payment_cc` ADD `id_order_invoice` varchar(255) NOT NULL AFTER `id_order_payment`;
|
||||
|
||||
@@ -286,8 +286,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_stock_mvt` (
|
||||
ALTER TABLE `PREFIX_orders` DROP COLUMN `id_warehouse`;
|
||||
ALTER TABLE `PREFIX_supplier` ADD COLUMN `id_address` int(10) unsigned NOT NULL default '0' AFTER `id_supplier`;
|
||||
ALTER TABLE `PREFIX_address` ADD COLUMN `id_warehouse` int(10) unsigned NOT NULL DEFAULT 0 AFTER `id_supplier`;
|
||||
ALTER TABLE `PREFIX_order_detail`
|
||||
ADD COLUMN `id_warehouse` int(10) unsigned NOT NULL default '0' AFTER `id_order_invoice`;
|
||||
ALTER TABLE `PREFIX_order_detail` ADD COLUMN `id_warehouse` int(10) unsigned NOT NULL default '0' AFTER `id_order_invoice`;
|
||||
|
||||
|
||||
ALTER TABLE `PREFIX_stock_mvt_reason` ADD COLUMN `deleted` tinyint(1) unsigned NOT NULL default '0' AFTER `date_upd`;
|
||||
|
||||
Reference in New Issue
Block a user