✏️ 正在编辑: install-1.2.0.php
路径:
/home/bpioifn/www/pigmentse/modules/axepta/upgrade/install-1.2.0.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * 1961-2020 BNP Paribas * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) that is available * through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0 * If you are unable to obtain it through the world-wide-web, please send an email * to modules@quadra-informatique.fr so we can send you a copy immediately. * * @author Quadra Informatique <modules@quadra-informatique.fr> * @copyright 1961-2020 BNP Paribas * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ if (!defined('_PS_VERSION_')) { exit; } require_once _PS_MODULE_DIR_ . 'axepta/classes/AxeptaLogger.php'; // Add UX function upgrade_module_1_2_0($module) { AxeptaLogger::log('Start', AxeptaLogger::LOG_DEBUG , AxeptaLogger::FILE_DEBUG); // Create new table paygate_position $query = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'axepta_xml_paygate_position` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `position` INT(11) NOT NULL, `iso` VARCHAR(3) DEFAULT NULL, `trigram` VARCHAR(3) NOT NULL, `is_default` BOOL NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8'; if (Db::getInstance()->execute($query) == false) { return false; } $query = 'DELETE FROM `' . _DB_PREFIX_ . 'translation` WHERE `domain` LIKE "ModulesAxepta%"'; if (!Db::getInstance()->execute($query)) { return false; } #36906 : Rename Axepta $id_axepta_tab = Tab::getIdFromClassName('axepta'); if ($id_axepta_tab) { $query = 'UPDATE `' . _DB_PREFIX_ . 'tab_lang` SET `name` = "Axepta BNP Paribas" WHERE `id_tab` = "'.pSQL($id_axepta_tab).'"'; if (Db::getInstance()->execute($query) == false) { return false; } } $queryCVMconfig = 'SELECT id_axepta_configuration_account, active FROM `' . _DB_PREFIX_ . 'axepta_configuration_account_paygate` WHERE `trigram` = "CVM"'; if (($CVMs = Db::getInstance()->executeS($queryCVMconfig)) === false) { return false; } $queryVIMconfig = 'SELECT id_axepta_configuration_account, active FROM `' . _DB_PREFIX_ . 'axepta_configuration_account_paygate` WHERE `trigram` = "VIM"'; if (($VIMs = Db::getInstance()->executeS($queryVIMconfig)) === false) { return false; } $VIMsToAdd = array(); foreach ($CVMs as $CVMData) { foreach ($VIMs as $key => $VIMData) { if ($VIMData['id_axepta_configuration_account'] == $CVMData['id_axepta_configuration_account']) { unset($VIMs[$key]); continue 2; } } $VIMsToAdd[] = $CVMData; } foreach ($VIMsToAdd as $VIMToAdd) { $query = 'INSERT INTO `' . _DB_PREFIX_ . 'axepta_configuration_account_paygate` (id_axepta_configuration_account,trigram,active) VALUES (' . $VIMToAdd['id_axepta_configuration_account'] . ',"VIM",' . $VIMToAdd['active'] . ')'; if(!Db::getInstance()->execute($query)) { return false; } } if (!AxeptaXml::insertXmlToDb()){ return false; } return true; }
💾 保存文件
← 返回文件管理器