<?php
/**
* ---------------------------------------------------------------------------------
*
* This file is part of the 'giftonordermodule' module feature (main || related module)
* Developped for Prestashop platform.
* You are not allowed to use it on several site
* You are not allowed to redistribute this module
* This header must not be removed
*
* @category  giftonordermodule
* @author    OleaCorner <contact@oleacorner.com> <www.oleacorner.com>
* @copyright OleaCorner
* @version   4.3
* @license   XXX
*         
* ---------------------------------------------------------------------------------
*/

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

function upgrade_module_4_2_1($object, $install = false)
{
	$update_ok = true;
	
	$query = 'SHOW COLUMNS FROM `'._DB_PREFIX_.'giftonorder` LIKE \'criteria_attributes_detectsall\'';
	$res = Db::getInstance ()->ExecuteS ($query);
	if (count ($res) == 0)
	{
		$query = 'ALTER TABLE `'._DB_PREFIX_.'giftonorder` 
		 				ADD COLUMN `criteria_attributes_detectsall` TINYINT(1) DEFAULT 0';
		if (!Db::getInstance ()->Execute ($query))
			$update_ok = false;
	}
	
	Configuration::updateValue ('OLEA_GIFTONORDER_VERSION', '4.2.1');
	return $update_ok;
}