// fix upgrade problems #PSCFV-2457 #PSCFV-2462 #PSCFV-1225
// (also reverted upgrade modifications from rev. 14682 15127 15129 15134 15165) git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15465 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -27,7 +27,9 @@
|
||||
|
||||
function add_column_order_state_deleted_if_not_exists()
|
||||
{
|
||||
$res = true;
|
||||
$column = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'order_state` LIKE "deleted"');
|
||||
|
||||
if (empty($column))
|
||||
$res = Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'order_state`
|
||||
ADD COLUMN `deleted` tinyint(1) UNSIGNED NOT NULL default "0" AFTER `paid`');
|
||||
|
||||
57
install-dev/upgrade/php/add_missing_columns_customer.php
Normal file
57
install-dev/upgrade/php/add_missing_columns_customer.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
function add_missing_columns_customer()
|
||||
{
|
||||
$db = Db::getInstance();
|
||||
$res = true;
|
||||
$current_fields = $db->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'customer`');
|
||||
foreach ($current_fields as $k => $field)
|
||||
$current_fields[$k] = $field['Field'];
|
||||
|
||||
$missing_fields = array(
|
||||
'id_risk' => 'ALTER TABLE `'._DB_PREFIX_.'customer`
|
||||
ADD `id_risk` int(10) unsigned NOT NULL DEFAULT "1"',
|
||||
'company' => 'ALTER TABLE `'._DB_PREFIX_.'customer` ADD `company` varchar(64)',
|
||||
'siret' => 'ALTER TABLE `'._DB_PREFIX_.'customer` ADD `siret` varchar(14)',
|
||||
'ape' => 'ALTER TABLE `'._DB_PREFIX_.'customer` ADD `ape` varchar(5)',
|
||||
'website' => 'ALTER TABLE `'._DB_PREFIX_.'customer` ADD `website` varchar(128)',
|
||||
'outstanding_allow_amount' => 'ALTER TABLE `'._DB_PREFIX_.'customer`
|
||||
ADD `outstanding_allow_amount` DECIMAL( 10,6 ) NOT NULL default "0.00"',
|
||||
'show_public_prices' => 'ALTER TABLE `'._DB_PREFIX_.'customer`
|
||||
ADD `show_public_prices` tinyint(1) unsigned NOT NULL default "0"',
|
||||
'max_payment_days' => 'ALTER TABLE `'._DB_PREFIX_.'customer`
|
||||
ADD `max_payment_days` int(10) unsigned NOT NULL default "60"'
|
||||
);
|
||||
|
||||
foreach ($missing_fields as $field => $query)
|
||||
|
||||
if (!in_array($field, $current_fields));
|
||||
$res &= $db->execute($query);
|
||||
|
||||
return $res;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
function add_missing_shop_column_pagenotfound()
|
||||
{
|
||||
$res = true;
|
||||
$exists = Db::getInstance()->executeS('SHOW TABLE LIKE "'._DB_PREFIX_.'pagenotfound"');
|
||||
if (count($exists))
|
||||
{
|
||||
$fields = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'pagenotfound`');
|
||||
foreach ($fields as $k => $field)
|
||||
$fields[$k] = $field['Field'];
|
||||
|
||||
if (!in_array('id_shop_group', $fields))
|
||||
$res &= Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'pagenotfound`
|
||||
ADD `id_shop_group` INT(10) AFTER `id_pagenotfound`');
|
||||
|
||||
if (!in_array('id_shop', $fields))
|
||||
$res &= DB::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'pagenotfound`
|
||||
ADD `id_shop` INT(10) AFTER `id_pagenotfound`');
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
@@ -54,17 +54,17 @@ function create_multistore()
|
||||
VALUES(1, \''.pSQL($shop_domain).'\', \''.pSQL($shop_domain_ssl).'\', \''.pSQL($_PS_DIRECTORY_).'\', \'\', 1, 1)');
|
||||
|
||||
// Stock conversion
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_shop_group`, `id_shop`, `quantity`)
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`)
|
||||
VALUES (SELECT `p.id_product`, 0, 1, 1, `p.quantity` FROM `'._DB_PREFIX_.'.product` p);';
|
||||
$res &= Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_shop_group`, `id_shop`, `quantity`)
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'.stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`)
|
||||
VALUES (SELECT `id_product`, `id_product_attribute`, 1, 1, `quantity` FROM `'._DB_PREFIX_.'product_attribute` p);';
|
||||
$res &= Db::getInstance()->execute($sql);
|
||||
|
||||
// Add admin tabs
|
||||
$shopTabId = add_new_tab('AdminShop', 'it:Shops|es:Shops|fr:Boutiques|de:Shops|en:Shops', 0, true);
|
||||
add_new_tab('AdminShopGroup', 'it:Group Shops|es:Group Shops|fr:Groupes de boutique|de:Group Shops|en:Group Shops', $shopTabId);
|
||||
add_new_tab('AdminGroupShop', 'it:Group Shops|es:Group Shops|fr:Groupes de boutique|de:Group Shops|en:Group Shops', $shopTabId);
|
||||
add_new_tab('AdminShopUrl', 'it:Shop Urls|es:Shop Urls|fr:URLs de boutique|de:Shop Urls|en:Shop Urls', $shopTabId);
|
||||
|
||||
return $res;
|
||||
|
||||
@@ -32,7 +32,7 @@ function module_blockwishlist_multishop()
|
||||
{
|
||||
$res = Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'wishlist`
|
||||
ADD `id_shop` INTEGER NOT NULL default \'1\' AFTER `counter`,
|
||||
ADD `id_shop_group` INTEGER NOT NULL default \'1\' AFTER `id_shop`');
|
||||
ADD `id_group_shop` INTEGER NOT NULL default \'1\' AFTER `id_shop`');
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
SET NAMES 'utf8';
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_group_shop` (
|
||||
`id_shop_group` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_group_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`share_customer` TINYINT(1) NOT NULL,
|
||||
`share_order` TINYINT(1) NOT NULL,
|
||||
`share_stock` TINYINT(1) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_shop_group`)
|
||||
PRIMARY KEY (`id_group_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_group_shop` (`id_shop_group`, `name`, `active`, `deleted`, `share_stock`, `share_customer`, `share_order`) VALUES (1, 'Default', 1, 0, 0, 0, 0);
|
||||
INSERT INTO `PREFIX_group_shop` (`id_group_shop`, `name`, `active`, `deleted`, `share_stock`, `share_customer`, `share_order`) VALUES (1, 'Default', 1, 0, 0, 0, 0);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_shop` (
|
||||
`id_shop` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_shop_group` int(11) unsigned NOT NULL,
|
||||
`id_group_shop` int(11) unsigned NOT NULL,
|
||||
`name` varchar(64) CHARACTER SET utf8 NOT NULL,
|
||||
`id_category` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`id_theme` INT(1) UNSIGNED NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id_shop`),
|
||||
KEY `id_shop_group` (`id_shop_group`),
|
||||
KEY `id_group_shop` (`id_group_shop`),
|
||||
KEY `id_category` (`id_category`),
|
||||
KEY `id_theme` (`id_theme`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `PREFIX_shop`
|
||||
(`id_shop`, `id_shop_group`, `name`, `id_category`, `id_theme`, `active`, `deleted`)
|
||||
(`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_shop_group` INT(11) UNSIGNED DEFAULT NULL AFTER `id_configuration` , ADD `id_shop` INT(11) UNSIGNED DEFAULT NULL AFTER `id_shop_group`;
|
||||
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` ) ;
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_shop_group`);
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_group_shop`);
|
||||
ALTER TABLE `PREFIX_configuration` ADD INDEX (`id_shop`);
|
||||
INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, 'PS_SHOP_DEFAULT', '1', NOW(), NOW());
|
||||
|
||||
@@ -123,9 +123,9 @@ CREATE TABLE `PREFIX_currency_shop` (
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `PREFIX_currency_shop` (id_shop, id_currency) (SELECT 1, id_currency FROM PREFIX_currency);
|
||||
|
||||
ALTER TABLE `PREFIX_cart` ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cart` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_shop_group`, ADD INDEX `id_shop_group` (`id_shop_group`), ADD INDEX `id_shop` (`id_shop`);
|
||||
ALTER TABLE `PREFIX_cart` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cart` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
ALTER TABLE `PREFIX_customer` ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_shop_group`, ADD INDEX `id_shop_group` (`id_shop_group`), ADD INDEX `id_shop` (`id_shop`);
|
||||
ALTER TABLE `PREFIX_customer` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
ALTER TABLE `PREFIX_orders` ADD `id_group_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_order` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_group_shop` (`id_group_shop`), ADD INDEX `id_shop` (`id_shop`);
|
||||
|
||||
|
||||
@@ -5,12 +5,18 @@ ALTER TABLE `PREFIX_supplier` DROP `id_address`;
|
||||
UPDATE `PREFIX_meta` SET `page` = 'contact' WHERE `page` = 'contact-form';
|
||||
|
||||
RENAME TABLE `PREFIX_group_shop` TO `PREFIX_shop_group`;
|
||||
ALTER TABLE `PREFIX_shop_group` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `PREFIX_shop` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_stock_available` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_cart` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_configuration` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_connections` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_customer` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_delivery` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_orders` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_page_viewed` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_specific_price` CHANGE `id_group_shop` `id_shop_group` INT( 11 ) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `PREFIX_product` ADD `id_tax_rules_group` int(10) unsigned NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_product_shop_TMP` (
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
|
||||
@@ -26,21 +26,13 @@ UPDATE PREFIX_order_detail_tax odt
|
||||
LEFT JOIN PREFIX_order_detail od ON (od.id_order_detail = odt.id_order_detail)
|
||||
SET total_amount = odt.unit_amount * od.product_quantity;
|
||||
|
||||
ALTER TABLE `PREFIX_pagenotfound` ADD `id_shop_group` INT(10) AFTER `id_pagenotfound`, ADD `id_shop` INT(10) AFTER `id_pagenotfound`;
|
||||
/* PHP:add_missing_shop_column_pagenotfound(); */;
|
||||
|
||||
/* PHP:add_new_groups('Non identifié', 'Unidentified'); */;
|
||||
/* PHP:editorial_update_multishop(); */;
|
||||
/* PHP:update_module_product_comments(); */;
|
||||
|
||||
ALTER TABLE `PREFIX_customer`
|
||||
ADD `id_risk` int(10) unsigned NOT NULL DEFAULT '1',
|
||||
ADD `company` varchar(64),
|
||||
ADD `siret` varchar(14),
|
||||
ADD `ape` varchar(5),
|
||||
ADD `website` varchar(128),
|
||||
ADD `outstanding_allow_amount` DECIMAL( 10,6 ) NOT NULL default '0.00',
|
||||
ADD `show_public_prices` tinyint(1) unsigned NOT NULL default '0',
|
||||
ADD `max_payment_days` int(10) unsigned NOT NULL default '60';
|
||||
/* PHP:add_missing_columns_customer(); */;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_risk` (
|
||||
`id_risk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
@@ -55,4 +47,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_risk_lang` (
|
||||
`name` varchar(20) NOT NULL,
|
||||
PRIMARY KEY (`id_risk`,`id_lang`),
|
||||
KEY `id_risk` (`id_risk`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
UPDATE `PREFIX_tab` SET `class_name`="AdminShopGroup" WHERE class_name="AdminGroupShop";
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
SET NAMES 'utf8';
|
||||
|
||||
ALTER TABLE `PREFIX_cart_rule` ADD `shop_restriction` tinyint(1) unsigned NOT NULL default 0 AFTER `product_restriction`;
|
||||
|
||||
|
||||
CREATE TABLE `PREFIX_cart_rule_shop` (
|
||||
`id_cart_rule` int(10) unsigned NOT NULL,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_cart_rule`, `id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `PREFIX_configuration`(`id_shop_group`, `id_shop`, `name`, `value`, `date_add`, `date_upd`)
|
||||
INSERT INTO `PREFIX_configuration`(`id_group_shop`, `id_shop`, `name`, `value`, `date_add`, `date_upd`)
|
||||
VALUES
|
||||
(NULL, NULL, 'PS_LOGO', 'logo.jpg', NOw(), NOW()),
|
||||
(NULL, NULL, 'PS_LOGO_MAIL', 'logo_mail.jpg', NOw(), NOW()),
|
||||
@@ -26,4 +26,4 @@ CREATE TABLE `PREFIX_module_preference` (
|
||||
UNIQUE KEY `employee_module` (`id_employee`, `module`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `PREFIX_category_shop` ADD `position` int(10) unsigned NOT NULL default 0 AFTER `id_shop`;
|
||||
ALTER TABLE `PREFIX_category_shop` ADD `position` int(10) unsigned NOT NULL default 0 AFTER `id_shop`;
|
||||
@@ -19,6 +19,7 @@ CREATE TABLE `PREFIX_product_tax_rules_group_shop` (
|
||||
|
||||
INSERT INTO `PREFIX_product_tax_rules_group_shop` (`id_product`, `id_tax_rules_group`, `id_shop`)
|
||||
(SELECT `id_product`, `id_tax_rules_group`, `id_shop` FROM `PREFIX_product`, `PREFIX_shop`);
|
||||
ALTER TABLE `PREFIX_product` DROP `id_tax_rules_group`;
|
||||
|
||||
CREATE TABLE `PREFIX_carrier_tax_rules_group_shop` (
|
||||
`id_carrier` int(11) unsigned NOT NULL,
|
||||
|
||||
@@ -252,7 +252,7 @@ if (empty($fail_result))
|
||||
if (!file_exists($file))
|
||||
{
|
||||
$logger->logError('Error while loading sql upgrade file.');
|
||||
$fail_result .= '<action result="fail" error="33" />'."\n";
|
||||
$fail_result .= '<action result="fail" error="33" sqlfile="'.$version.'" />'."\n";
|
||||
}
|
||||
if (!$sqlContent = file_get_contents($file))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user