Download project

This commit is contained in:
Roman Pyrih
2024-11-20 09:09:44 +01:00
parent 547a138d6a
commit 5ff041757f
40737 changed files with 7766183 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.2.1
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_2_1($module)
{
return $module->addCheckboxCarrierRestrictionsForModule();
}

View File

@@ -0,0 +1,94 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.2.10
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_2_10($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$shopsList = \Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
\Configuration::updateValue(
'PS_CHECKOUT_CARD_PAYMENT_ENABLED',
true,
false,
null,
(int) \Context::getContext()->shop->id
);
// New configurations for express checkout feature
\Configuration::updateValue(
'PS_CHECKOUT_EC_ORDER_PAGE',
false,
false,
null,
(int) \Context::getContext()->shop->id
);
\Configuration::updateValue(
'PS_CHECKOUT_EC_CHECKOUT_PAGE',
false,
false,
null,
(int) \Context::getContext()->shop->id
);
\Configuration::updateValue(
'PS_CHECKOUT_EC_PRODUCT_PAGE',
false,
false,
null,
(int) \Context::getContext()->shop->id
);
}
// register new hooks for express checkout
$hooks = [
'displayExpressCheckout',
'DisplayFooterProduct',
'displayPersonalInformationTop',
'actionBeforeCartUpdateQty',
'header',
];
$module->registerHook($hooks);
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.2.11
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_2_11($module)
{
$db = Db::getInstance();
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$db->execute('ALTER TABLE `' . _DB_PREFIX_ . 'pscheckout_order_matrice` CHANGE `id_order_prestashop` `id_order_prestashop` INT(10) UNSIGNED NOT NULL;');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.2.12
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_2_12($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('displayInvoiceLegalFreeText');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.2.2
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_2_2($module)
{
return $module->installTabs();
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Removes files or directories.
*
* @param array $files An array of files to remove
*
* @return true|string True if everything goes fine, error details otherwise
*/
function removePsCheckoutPhpUnitFromFsDuringUpgrade(array $files)
{
$files = array_reverse($files);
foreach ($files as $file) {
if (is_dir($file)) {
$iterator = new FilesystemIterator($file, FilesystemIterator::CURRENT_AS_PATHNAME | FilesystemIterator::SKIP_DOTS);
removePsCheckoutPhpUnitFromFsDuringUpgrade(iterator_to_array($iterator));
if (!rmdir($file) && file_exists($file)) {
return 'Deletion of directory ' . $file . 'failed';
}
} elseif (!unlink($file) && file_exists($file)) {
return 'Deletion of file ' . $file . 'failed';
}
}
return true;
}
/**
* Update main function for module Version 1.2.9
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_1_2_9($module)
{
/*
* PHPUNIT REMOVAL
* This step removes the folder vendor/phpunit, when added from a previous release installed on the shop.
*/
$path = __DIR__ . '/../vendor/phpunit';
if (file_exists($path)) {
$result = removePsCheckoutPhpUnitFromFsDuringUpgrade([$path]);
if ($result !== true) {
$module->getLogger()->error('Could not delete PHPUnit from module.');
return false;
}
}
return true;
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.3.0
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_3_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('actionObjectShopAddAfter');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,78 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.4.0
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_4_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$db = Db::getInstance();
// Remove our ModuleAdminControllers from SEO & URLs page
$queryMeta = new DbQuery();
$queryMeta->select('id_meta');
$queryMeta->from('meta');
$queryMeta->where('page LIKE "module-' . $module->name . '-Admin%"');
$queryMetaResults = $db->executeS($queryMeta);
if (false === empty($queryMetaResults)) {
foreach ($queryMetaResults as $queryMetaResult) {
$db->delete(
'meta',
'id_meta = ' . (int) $queryMetaResult['id_meta']
);
$db->delete(
'meta_lang',
'id_meta = ' . (int) $queryMetaResult['id_meta']
);
}
}
$module->registerHook('displayAdminOrderLeft');
$module->registerHook('displayAdminOrderMainBottom');
$module->registerHook('actionAdminControllerSetMedia');
$module->unregisterHook('actionOrderSlipAdd');
$module->unregisterHook('actionOrderStatusUpdate');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.4.1
*
* @param Module $module
*
* @return bool
*/
function upgrade_module_1_4_1($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('displayPaymentTop');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.5.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_1_5_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
if (empty(Currency::checkPaymentCurrencies($module->id))) {
return 'checkbox' === $module->currencies_mode ? $module->addCheckboxCurrencyRestrictionsForModule() : $module->addRadioCurrencyRestrictionsForModule();
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module Version 1.5.1
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_1_5_1($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('displayPaymentTop');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.0.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_0_0($module)
{
$db = Db::getInstance();
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
Configuration::updateGlobalValue('PS_CHECKOUT_LOGGER_MAX_FILES', '30');
Configuration::updateGlobalValue('PS_CHECKOUT_LOGGER_LEVEL', '100');
Configuration::updateGlobalValue('PS_CHECKOUT_LOGGER_HTTP', '1');
Configuration::updateGlobalValue('PS_CHECKOUT_LOGGER_HTTP_FORMAT', 'DEBUG');
Configuration::updateGlobalValue('PS_CHECKOUT_INTEGRATION_DATE', '2020-07-30');
$module->registerHook(Ps_checkout::HOOK_LIST);
$db->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'pscheckout_cart` (
`id_pscheckout_cart` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_cart` int unsigned NOT NULL,
`paypal_intent` varchar(20) DEFAULT "CAPTURE",
`paypal_order` varchar(20) NULL,
`paypal_status` varchar(20) NULL,
`paypal_funding` varchar(20) NULL,
`paypal_token` varchar(1024) NULL,
`paypal_token_expire` datetime NULL,
`paypal_authorization_expire` datetime NULL,
`isExpressCheckout` tinyint(1) unsigned DEFAULT 0 NOT NULL,
`isHostedFields` tinyint(1) unsigned DEFAULT 0 NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_pscheckout_cart`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;
');
$db->execute('
INSERT INTO `' . _DB_PREFIX_ . 'pscheckout_cart` (`id_cart`, `paypal_order`, `date_add`, `date_upd`)
SELECT o.id_cart, om.id_order_paypal, o.date_add, o.date_upd
FROM `' . _DB_PREFIX_ . 'pscheckout_order_matrice` AS om
INNER JOIN `' . _DB_PREFIX_ . 'orders` AS o ON (om.id_order_prestashop = o.id_order)
');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.1.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_1_0($module)
{
$db = Db::getInstance();
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$createFundingSourceTable = (bool) $db->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'pscheckout_funding_source` (
`name` varchar(20) NOT NULL,
`active` tinyint(1) unsigned DEFAULT 0 NOT NULL,
`position` tinyint(2) unsigned NOT NULL,
`id_shop` int unsigned NOT NULL,
PRIMARY KEY (`name`, `id_shop`),
INDEX (`id_shop`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;
');
if ($createFundingSourceTable) {
$shopsList = \Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
$isCardEnabled = (bool) \Configuration::get('PS_CHECKOUT_CARD_PAYMENT_ENABLED', null, null, $shopId);
if (false === $isCardEnabled) {
$db->insert(
'pscheckout_funding_source',
[
'name' => 'card',
'position' => 2,
'active' => 0,
'id_shop' => (int) $shopId,
]
);
}
}
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return $createFundingSourceTable;
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.10.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_10_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('displayProductPriceBlock');
if (false === (bool) version_compare(_PS_VERSION_, '1.7.0.0', '>=')) {
// Register hooks only for PrestaShop 1.6, used for Banner Pay in 4X
$module->registerHook('displayCartTotalPriceLabel');
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.11.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_11_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
if (true === (bool) version_compare(_PS_VERSION_, '1.7.1.0', '>=')) {
// Register hooks only for PrestaShop 1.7.1, used for payment methods logo block
$module->registerHook('displayProductAdditionalInfo');
$module->updatePosition(Hook::getIdByName('displayProductAdditionalInfo'), false, 1);
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.15.3
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_15_3($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('header');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.15.4
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_15_4($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('actionObjectOrderPaymentAddAfter');
$module->registerHook('actionObjectOrderPaymentUpdateAfter');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,64 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.18.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_18_0($module)
{
$db = Db::getInstance();
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$shopsList = \Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
$db->insert(
'pscheckout_funding_source',
[
'name' => 'paylater',
'position' => 10,
'active' => 1,
'id_shop' => (int) $shopId,
]
);
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.19.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_19_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$shopsList = \Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
Configuration::updateValue('PS_CHECKOUT_PAY_LATER_HOME_PAGE_BANNER', '0', false, null, (int) $shopId);
Configuration::updateValue('PS_CHECKOUT_PAY_LATER_CATEGORY_PAGE_BANNER', '0', false, null, (int) $shopId);
Configuration::updateValue('PS_CHECKOUT_PAY_LATER_PRODUCT_PAGE_BANNER', '0', false, null, (int) $shopId);
Configuration::updateValue('PS_CHECKOUT_PAY_LATER_ORDER_PAGE_BANNER', '0', false, null, (int) $shopId);
Configuration::updateValue('PS_CHECKOUT_INTEGRATION_DATE', '2022-05-11', false, null, (int) $shopId);
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,93 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.2.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_2_0($module)
{
$db = Db::getInstance();
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$createFundingSourceTable = (bool) $db->execute('
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'pscheckout_funding_source` (
`name` varchar(20) NOT NULL,
`active` tinyint(1) unsigned DEFAULT 0 NOT NULL,
`position` tinyint(2) unsigned NOT NULL,
`id_shop` int unsigned NOT NULL,
PRIMARY KEY (`name`, `id_shop`),
INDEX (`id_shop`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;
');
if ($createFundingSourceTable) {
$shopsList = \Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
$isCardEnabled = (bool) \Configuration::get(
'PS_CHECKOUT_CARD_PAYMENT_ENABLED',
null,
null,
$shopId
);
$hasFundingSourceCard = (bool) $db->getValue('
SELECT 1
FROM `' . _DB_PREFIX_ . 'pscheckout_funding_source`
WHERE `name` = "card"
AND `id_shop` = ' . (int) $shopId
);
if (false === $isCardEnabled && false === $hasFundingSourceCard) {
$db->insert(
'pscheckout_funding_source',
[
'name' => 'card',
'position' => 2,
'active' => 0,
'id_shop' => (int) $shopId,
]
);
}
}
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.20.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_20_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$shopsList = \Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
Configuration::updateValue('PS_CHECKOUT_INTEGRATION_DATE', '2022-14-06', false, null, (int) $shopId);
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_21_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('displayPaymentReturn');
$module->registerHook('displayOrderDetail');
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.3.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_3_0($module)
{
$result = true;
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
foreach (\Shop::getShops(false, null, true) as $shopId) {
$result = $result && (bool) Configuration::updateValue(
'PS_CHECKOUT_PAYPAL_BUTTON',
json_encode([
'shape' => 'pill',
'label' => 'pay',
'color' => 'gold',
]),
false,
null,
(int) $shopId
);
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return $result;
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.7.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_7_0($module)
{
$db = Db::getInstance();
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$db->execute('ALTER TABLE `' . _DB_PREFIX_ . 'pscheckout_cart` CHANGE `paypal_token` `paypal_token` text DEFAULT NULL;');
$module->disableIncompatibleCountries();
$module->disableIncompatibleCurrencies();
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 2.9.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_2_9_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
if (false === (bool) version_compare(_PS_VERSION_, '1.7.0.0', '>=')) {
// Register hooks only for PrestaShop 1.6, used for ExpressCheckout
$module->registerHook('actionBeforeCartUpdateQty');
$module->registerHook('actionAfterDeleteProductInCart');
} else {
// Register hook only for PrestaShop 1.7, used for ExpressCheckout
$module->registerHook('actionObjectProductInCartDeleteAfter');
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 3.0.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_3_0_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$shopsList = \Shop::getShops(false, null, true);
$module->registerHook('actionObjectShopDeleteAfter', $shopsList);
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 3.1.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_3_1_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$shopsList = \Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
Configuration::updateValue('PS_CHECKOUT_LIABILITY_SHIFT_REQ', '1', false, null, (int) $shopId);
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,75 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 7.3.3.1
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_7_3_3_1($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
$module->registerHook('displayPaymentReturn');
$module->registerHook('displayOrderDetail');
$module->registerHook('displayHeader');
try {
$db = Db::getInstance();
$db->delete(
'pscheckout_cart',
'paypal_order IS NULL'
);
$db->update(
'pscheckout_cart',
[
'paypal_token' => null,
'paypal_token_expire' => null,
],
'paypal_token IS NOT NULL',
0,
true
);
} catch (Exception $exception) {
PrestaShopLogger::addLog($exception->getMessage(), 3, $exception->getCode(), 'Module', $module->id, false);
return false;
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,269 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 7.3.4.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_7_3_4_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
try {
$shopsList = Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
Configuration::updateValue('PS_CHECKOUT_LIABILITY_SHIFT_REQ', '0', false, null, (int) $shopId);
}
Configuration::updateGlobalValue('PS_CHECKOUT_LIABILITY_SHIFT_REQ', '0');
$db = Db::getInstance();
// Check module OrderState
$moduleOrderStates = [
'PS_CHECKOUT_STATE_PENDING' => (int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_PENDING'),
'PS_CHECKOUT_STATE_COMPLETED' => (int) Configuration::getGlobalValue('PS_OS_PAYMENT'),
'PS_CHECKOUT_STATE_CANCELED' => (int) Configuration::getGlobalValue('PS_OS_CANCELED'),
'PS_CHECKOUT_STATE_ERROR' => (int) Configuration::getGlobalValue('PS_OS_ERROR'),
'PS_CHECKOUT_STATE_REFUNDED' => (int) Configuration::getGlobalValue('PS_OS_REFUND'),
'PS_CHECKOUT_STATE_PARTIALLY_REFUNDED' => (int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_PARTIAL_REFUND'),
'PS_CHECKOUT_STATE_PARTIALLY_PAID' => (int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_PARTIALLY_PAID'),
'PS_CHECKOUT_STATE_AUTHORIZED' => (int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_AUTHORIZED'),
];
$moduleOrderStatesId = array_values($moduleOrderStates);
$moduleOrderStatesIdToDelete = [
(int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_WAITING_PAYPAL_PAYMENT'),
(int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_WAITING_CREDIT_CARD_PAYMENT'),
(int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_WAITING_LOCAL_PAYMENT'),
(int) Configuration::getGlobalValue('PS_CHECKOUT_STATE_WAITING_CAPTURE'),
];
$orderStateCollection = new PrestaShopCollection(OrderState::class);
$orderStateCollection->where('module_name', '=', $module->name);
$orderStateCollection->where('deleted', '=', '0');
/** @var OrderState[] $orderStates */
$orderStates = $orderStateCollection->getResults();
$currentModuleOrderStatesId = [];
if (!empty($orderStates)) {
foreach ($orderStates as $orderState) {
$orderStateId = (int) $orderState->id;
if (
!in_array($orderStateId, $moduleOrderStatesId, true)
|| in_array($orderState->id, $moduleOrderStatesIdToDelete, true)
) {
$orderState->deleted = true;
$orderState->save();
} else {
$currentModuleOrderStatesId[] = $orderStateId;
}
}
}
foreach ($moduleOrderStates as $configuration_key => $id_order_state) {
if (
!$id_order_state
|| !in_array((int) $id_order_state, $currentModuleOrderStatesId, true)
) {
switch ($configuration_key) {
case 'PS_CHECKOUT_STATE_AUTHORIZED':
ps_checkout_create_order_state_7_3_4_0(
'PS_CHECKOUT_STATE_AUTHORIZED',
'#3498D8',
[
'en' => 'Authorized. To be captured by merchant',
'fr' => 'Autorisation. A capturer par le marchand',
'es' => 'Autorizado. El vendedor lo capturará',
'it' => 'Autorizzato. Sarà acquisito dal commerciante',
'nl' => 'Goedgekeurd. Door retailer te registreren.',
'de' => 'Autorisiert. Wird von Händler erfasst.',
'pl' => 'Pomyślna autoryzacja. Transfer do przeprowadzenia przez sklep',
'pt' => 'Autorizado. A ser capturado pelo comerciante',
]
);
break;
case 'PS_CHECKOUT_STATE_PARTIALLY_REFUNDED':
ps_checkout_create_order_state_7_3_4_0(
'PS_CHECKOUT_STATE_PARTIALLY_REFUNDED',
'#01B887',
[
'en' => 'Partial refund',
'fr' => 'Remboursement partiel',
'es' => 'Reembolso parcial',
'it' => 'Rimborso parziale',
'nl' => 'Gedeeltelijke terugbetaling',
'de' => 'Teilweise Rückerstattung',
'pl' => 'Częściowy zwrot',
'pt' => 'Reembolso parcial',
]
);
break;
case 'PS_CHECKOUT_STATE_PENDING':
ps_checkout_create_order_state_7_3_4_0('PS_CHECKOUT_STATE_PENDING', '#34209E', [
'en' => 'Waiting for payment',
'fr' => 'En attente de paiement',
'es' => 'Esperando el pago',
'it' => 'In attesa di pagamento',
'nl' => 'Wachten op betaling',
'de' => 'Warten auf Zahlung',
'pl' => 'Oczekiwanie na płatność',
'pt' => 'Aguardando pagamento',
]);
break;
case 'PS_CHECKOUT_STATE_PARTIALLY_PAID':
ps_checkout_create_order_state_7_3_4_0(
'PS_CHECKOUT_STATE_PARTIALLY_PAID',
'#3498D8',
[
'en' => 'Partial payment',
'fr' => 'Paiement partiel',
'es' => 'Pago parcial',
'it' => 'Pagamento parziale',
'nl' => 'Gedeeltelijke betaling',
'de' => 'Teilweise Zahlung',
'pl' => 'Częściowa płatność',
'pt' => 'Pagamento parcial',
]
);
break;
default:
Configuration::updateGlobalValue($configuration_key, $id_order_state);
}
} else {
Configuration::updateGlobalValue($configuration_key, $id_order_state);
}
}
// Installing FundingSource if table pscheckout_funding_source is empty or incomplete - including BLIK
$fundingSources = ['paypal', 'paylater', 'card', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort', 'blik'];
$availableFundingSourcesByShops = [];
$maxPositionByShops = [];
$availableFundingSources = $db->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'pscheckout_funding_source');
if (!empty($availableFundingSources)) {
foreach ($availableFundingSources as $availableFundingSource) {
$currentPosition = (int) $availableFundingSource['position'];
$shopId = (int) $availableFundingSource['id_shop'];
if (
!isset($maxPositionByShops[$shopId])
|| $maxPositionByShops[$shopId] < $currentPosition
) {
$maxPositionByShops[$shopId] = $currentPosition;
}
$availableFundingSourcesByShops[$shopId][] = $availableFundingSource['name'];
}
}
foreach ($shopsList as $shopId) {
$currentPosition = isset($maxPositionByShops[(int) $shopId]) ? $maxPositionByShops[(int) $shopId] + 1 : 1;
foreach ($fundingSources as $fundingSource) {
if (
!isset($availableFundingSourcesByShops[(int) $shopId])
|| !in_array($fundingSource, $availableFundingSourcesByShops[(int) $shopId], true)
) {
$db->insert(
'pscheckout_funding_source',
[
'name' => pSQL($fundingSource),
'active' => 1,
'position' => (int) $currentPosition,
'id_shop' => (int) $shopId,
]
);
++$currentPosition;
}
}
}
} catch (Exception $exception) {
PrestaShopLogger::addLog($exception->getMessage(), 3, $exception->getCode(), 'Module', $module->id);
return false;
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}
function ps_checkout_create_order_state_7_3_4_0($configuration_key, $color, $nameByLangIsoCode)
{
$orderStateNameByLangId = [];
foreach (Language::getLanguages(false) as $language) {
$languageIsoCode = Tools::strtolower($language['iso_code']);
if (isset($nameByLangIsoCode[$languageIsoCode])) {
$orderStateNameByLangId[(int) $language['id_lang']] = $nameByLangIsoCode[$languageIsoCode];
} elseif (isset($nameByLangIsoCode['en'])) {
$orderStateNameByLangId[(int) $language['id_lang']] = $nameByLangIsoCode['en'];
}
}
$orderState = new OrderState();
$orderState->name = $orderStateNameByLangId;
$orderState->module_name = 'ps_checkout';
$orderState->unremovable = true;
$orderState->color = $color;
$orderState->delivery = false;
$orderState->shipped = false;
$orderState->pdf_delivery = false;
$orderState->pdf_invoice = false;
$orderState->hidden = false;
$orderState->invoice = false;
$orderState->send_email = false;
$orderState->paid = false;
$orderState->logable = false;
$orderState->deleted = false;
$orderState->template = [];
$orderState->save();
Configuration::updateGlobalValue($configuration_key, $orderState->id);
$orderStateImage = $configuration_key === 'PS_CHECKOUT_STATE_PARTIALLY_REFUNDED' ? 'refund.gif' : 'waiting.gif';
$moduleOrderStateImgPath = _PS_MODULE_DIR_ . 'ps_checkout/views/img/OrderStatesIcons/' . $orderStateImage;
$coreOrderStateImgPath = _PS_IMG_DIR_ . 'os/' . $orderState->id . '.gif';
if (
Tools::file_exists_cache($moduleOrderStateImgPath)
&& !Tools::file_exists_cache($coreOrderStateImgPath)
&& is_writable(_PS_IMG_DIR_ . 'os/')
) {
Tools::copy($moduleOrderStateImgPath, $coreOrderStateImgPath);
}
}

View File

@@ -0,0 +1,56 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 7.3.5.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_7_3_5_0($module)
{
try {
$db = Db::getInstance();
$databaseFields = [];
$fields = $db->executeS('SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'pscheckout_cart`');
if (!empty($fields)) {
foreach ($fields as $field) {
if (isset($field['Field'])) {
$databaseFields[] = $field['Field'];
}
}
}
if (!empty($databaseFields) && !in_array('environment', $databaseFields, true)) {
$db->execute('ALTER TABLE `' . _DB_PREFIX_ . 'pscheckout_cart` ADD COLUMN `environment` varchar(20) DEFAULT NULL;');
}
} catch (Exception $exception) {
PrestaShopLogger::addLog($exception->getMessage(), 4, 1, 'Module', $module->id);
return false;
}
return true;
}

View File

@@ -0,0 +1,85 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 7.3.6.0
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_7_3_6_0($module)
{
// Force PrestaShop to upgrade for all shop to avoid issues
$savedShopContext = Shop::getContext();
$savedShopId = Shop::getContextShopID();
$savedGroupShopId = Shop::getContextShopGroupID();
Shop::setContext(Shop::CONTEXT_ALL);
try {
$shopsList = Shop::getShops(false, null, true);
foreach ($shopsList as $shopId) {
// Require the liability shift for all shops
Configuration::updateValue('PS_CHECKOUT_LIABILITY_SHIFT_REQ', '1', false, null, (int) $shopId);
// Update global value only if it is not already set to SCA_ALWAYS
if (Configuration::get('PS_CHECKOUT_HOSTED_FIELDS_CONTINGENCIES', null, null, $shopId) !== 'SCA_ALWAYS') {
Configuration::updateValue('PS_CHECKOUT_HOSTED_FIELDS_CONTINGENCIES', 'SCA_WHEN_REQUIRED', false, null, (int) $shopId);
}
}
// Require the liability shift for all shops
Configuration::updateGlobalValue('PS_CHECKOUT_LIABILITY_SHIFT_REQ', '1');
// Update global value only if it is not already set to SCA_ALWAYS
if (Configuration::getGlobalValue('PS_CHECKOUT_HOSTED_FIELDS_CONTINGENCIES') !== 'SCA_ALWAYS') {
Configuration::updateGlobalValue('PS_CHECKOUT_HOSTED_FIELDS_CONTINGENCIES', 'SCA_WHEN_REQUIRED');
}
// Add new configuration for displaying the logo on the product page and the cart
Configuration::updateGlobalValue('PS_CHECKOUT_DISPLAY_LOGO_PRODUCT', '1');
Configuration::updateGlobalValue('PS_CHECKOUT_DISPLAY_LOGO_CART', '1');
// Remove Sofort
Db::getInstance()->delete(
'pscheckout_funding_source',
'name LIKE "sofort"'
);
} catch (Exception $exception) {
PrestaShopLogger::addLog($exception->getMessage(), 3, $exception->getCode(), 'Module', $module->id);
return false;
}
// Restore initial PrestaShop shop context
if (Shop::CONTEXT_SHOP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedShopId);
} elseif (Shop::CONTEXT_GROUP === $savedShopContext) {
Shop::setContext($savedShopContext, $savedGroupShopId);
} else {
Shop::setContext($savedShopContext);
}
return true;
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Update main function for module version 7.3.6.3
*
* @param Ps_checkout $module
*
* @return bool
*/
function upgrade_module_7_3_6_3($module)
{
try {
$db = Db::getInstance();
$db->update('pscheckout_cart', ['paypal_token' => null, 'paypal_token_expire' => null], 'paypal_token IS NOT NULL', 0, true);
$db->update('pscheckout_cart', ['paypal_status' => 'CANCELED'], 'paypal_status = "CREATED" AND date_add < DATE_SUB(NOW(), INTERVAL 1 HOUR)');
$db->delete('pscheckout_cart', 'paypal_order IS NULL OR paypal_order = ""');
} catch (Exception $exception) {
PrestaShopLogger::addLog($exception->getMessage(), 4, 1, 'Module', $module->id);
}
return true;
}