Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[-] INSTALLER : Second fix of bug #PSCFV-8168 loyalty CHANGE id_disco…

…unt to id_cart_rule
  • Loading branch information...
commit 0211e83413ad0c056b6235539a8fa1f9c6e96704 1 parent 06c1b35
Gregory Roussac authored March 26, 2013
43  install-dev/upgrade/php/p1540_add_missing_columns.php
... ...
@@ -0,0 +1,43 @@
  1
+<?php
  2
+/*
  3
+* 2007-2013 PrestaShop
  4
+*
  5
+* NOTICE OF LICENSE
  6
+*
  7
+* This source file is subject to the Open Software License (OSL 3.0)
  8
+* that is bundled with this package in the file LICENSE.txt.
  9
+* It is also available through the world-wide-web at this URL:
  10
+* http://opensource.org/licenses/osl-3.0.php
  11
+* If you did not receive a copy of the license and are unable to
  12
+* obtain it through the world-wide-web, please send an email
  13
+* to license@prestashop.com so we can send you a copy immediately.
  14
+*
  15
+* DISCLAIMER
  16
+*
  17
+* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
  18
+* versions in the future. If you wish to customize PrestaShop for your
  19
+* needs please refer to http://www.prestashop.com for more information.
  20
+*
  21
+*  @author PrestaShop SA <contact@prestashop.com>
  22
+*  @copyright  2007-2013 PrestaShop SA
  23
+*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  24
+*  International Registered Trademark & Property of PrestaShop SA
  25
+*/
  26
+
  27
+function p1540_add_missing_columns()
  28
+{
  29
+	$errors = array();
  30
+	$id_module = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name="loyalty"');
  31
+	if ($id_module)
  32
+	{
  33
+		$list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'loyalty`');
  34
+		foreach ($list_fields as $k => $field)
  35
+			$list_fields[$k] = $field['Field'];
  36
+
  37
+		if (in_array('id_discount', $list_fields))
  38
+			if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'loyalty` CHANGE `id_discount` `id_cart_rule` INT( 10 ) UNSIGNED NULL DEFAULT NULL '))
  39
+				$errors[] = Db::getInstance()->getMsgError();;				
  40
+	}
  41
+	if (count($errors))
  42
+		return array('error' => 1, 'msg' => implode(',', $errors)) ;	
  43
+}
4  install-dev/upgrade/sql/1.5.4.0.sql
@@ -51,4 +51,6 @@ UPDATE `PREFIX_customer` SET `id_gender` = 1 WHERE `email` LIKE 'pub@prestashop.
51 51
 
52 52
 UPDATE `PREFIX_cart_rule_carrier` crc INNER JOIN `PREFIX_carrier` c ON crc.`id_carrier` = c.`id_carrier` SET crc.`id_carrier` = c.`id_reference`;
53 53
 
54  
-UPDATE `PREFIX_order_payment` SET `order_reference` = LPAD(order_reference, 9 , '0');
  54
+UPDATE `PREFIX_order_payment` SET `order_reference` = LPAD(order_reference, 9 , '0');
  55
+
  56
+/* PHP:p1540_add_missing_columns(); */;

0 notes on commit 0211e83

Please sign in to comment.
Something went wrong with that request. Please try again.