* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT * @license https://opensource.org/licenses/MIT MIT License */ if (!defined('_PS_VERSION_')) { exit; } function upgrade_module_1_2_20($objArgTNTOfficiel_1_2_20) { $strTablePrefix = _DB_PREFIX_; // Dop unused log table. $strSQLTableLogDropTable = <<execute($strSQLTableLogDropTable) || !$objDB->execute($strSQLTableExtraAddColumns) || !$objDB->execute($strSQLTableExtraChangeColumns) || !$objDB->execute($strSQLTableExtraRenameTable) || !$objDB->execute($strSQLTableOrderChangeColumns) || !$objDB->execute($strSQLTableOrderRenameTable) || !$objDB->execute($strSQLTableParcelChangeColumns) || !$objDB->execute($strSQLTableParcelRenameTable) ) { return false; } $arrTemplateOverrideList = array( array( 'fileName' => 'view.tpl', 'directorySrc' => 'views/templates/admin/override/controllers/admin/templates/orders/helpers/view/', 'directoryDst' => 'controllers/admin/templates/orders/helpers/view/', ), ); $boolCopy = true; //$strModuleDirSrc = _PS_MODULE_DIR_.$objTNTOfficiel->name.DIRECTORY_SEPARATOR; $strModuleDirSrc = $objArgTNTOfficiel_1_2_20->getLocalPath(); foreach ($arrTemplateOverrideList as $arrTemplateOverride) { $strPathTemplateSrc = $strModuleDirSrc.$arrTemplateOverride['directorySrc']; $strFileTemplateSrc = $strPathTemplateSrc.$arrTemplateOverride['fileName']; $strPathTemplateDst = _PS_OVERRIDE_DIR_.$arrTemplateOverride['directoryDst']; $strFileTemplateDst = $strPathTemplateDst.$arrTemplateOverride['fileName']; try { // Create directory if unexist. if (!is_dir($strPathTemplateDst)) { mkdir($strPathTemplateDst, 0777, true); } // Delete previous template file if exist. if (file_exists($strFileTemplateDst)) { unlink($strFileTemplateDst); } // Copy new template file. $boolCopy = $boolCopy && copy($strFileTemplateSrc, $strFileTemplateDst); } catch (Exception $objException) { $objFileLogger = new FileLogger(); $objFileLogger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log'); $objFileLogger->logError($objException->getMessage()); return false; } } // If at least a file copy has fail. if (!$boolCopy) { return false; } // Reinstall Overrides: Module::uninstallOverrides() Module::installOverrides(). if (!($objArgTNTOfficiel_1_2_20->uninstallOverrides() && $objArgTNTOfficiel_1_2_20->installOverrides())) { return false; } // Success. return true; }