Skip to content

Commit

Permalink
[-] MO : fix update table socolissimo_delivery
Browse files Browse the repository at this point in the history
fix update table socolissimo_delivery
  • Loading branch information
quadrateam committed May 3, 2016
1 parent 0c5b6c0 commit 1dd26d5
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
6 changes: 3 additions & 3 deletions socolissimo.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct()
{
$this->name = 'socolissimo';
$this->tab = 'shipping_logistics';
$this->version = '2.10.00';
$this->version = '2.10.1';
$this->author = 'Quadra Informatique';
$this->limited_countries = array('fr','be');
$this->module_key = '8b991db851bdf7c64ca441f1a4481964';
Expand Down Expand Up @@ -174,7 +174,7 @@ public function install()
`lotacheminement` varchar(64) NOT NULL,
`distributionsort` varchar(64) NOT NULL,
`versionplantri` text(10) NOT NULL,
`dyforwardingcharges` decimal(20.6) NOT NULL,
`dyforwardingcharges` decimal(20,6) NOT NULL,
PRIMARY KEY (`id_cart`,`id_customer`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';

Expand Down Expand Up @@ -1603,7 +1603,7 @@ public function runUpgrades($install = false)
if (version_compare(_PS_VERSION_, '1.5', '<'))
{
if (Configuration::get('SOCOLISSIMO_VERSION') != $this->version)
foreach (array('2.8.0', '2.8.4', '2.8.5','2.9.20','2.9.21','2.9.22','2.9.24','2.9.25','2.10.00') as $version)
foreach (array('2.8.0', '2.8.4', '2.8.5','2.9.20','2.9.21','2.9.22','2.9.24','2.9.25','2.10.00','2.10.1') as $version)
{
$file = dirname(__FILE__).'/upgrade/install-'.$version.'.php';
if (version_compare(Configuration::get('SOCOLISSIMO_VERSION'), $version,'<') && file_exists($file))
Expand Down
51 changes: 51 additions & 0 deletions upgrade/install-2.10.1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 [email protected] 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 <[email protected]> Quadra Informatique <[email protected]>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

if (!defined('_PS_VERSION_'))
exit;

function upgrade_module_2_10_1($object, $install = false)
{
// change column dyforwardingcharges checking exitence first (2.10.1 update)
$query = 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME= "dyforwardingcharges"
AND TABLE_NAME= "'._DB_PREFIX_.'socolissimo_delivery_info"
AND TABLE_SCHEMA = "'._DB_NAME_.'"';

$result = Db::getInstance()->ExecuteS($query);

if ($result)
{
$query = 'ALTER TABLE '._DB_PREFIX_.'socolissimo_delivery_info modify `dyforwardingcharges` decimal(20,6) NOT NULL';
Db::getInstance()->Execute($query);
}
else {
$query = 'ALTER TABLE '._DB_PREFIX_.'socolissimo_delivery_info add `dyforwardingcharges` decimal(20,6) NOT NULL';
Db::getInstance()->Execute($query);
}
Configuration::updateValue('SOCOLISSIMO_VERSION', '2.10.1');
return true;
}

0 comments on commit 1dd26d5

Please sign in to comment.