Compare commits

...

3 Commits

Author SHA1 Message Date
Molkobain
4e1bf80b9f Merge remote-tracking branch 'origin/support/3.2' into develop 2026-09-15 10:17:15 +02:00
Molkobain
2ac4229ee0 N°10070 - Loss of DroidSansFallback font which impacts exports in east asian character sets (#1048)
* N°10070 - Loss of DroidSansFallback font which impacts exports in east asian character sets

* N°10070 - Add unit test
2026-09-15 10:03:52 +02:00
Timmy38
e6d485855e N°10045 Fix modules in production-modules automatically set to visible false 2026-09-14 16:34:40 +02:00
7 changed files with 3083 additions and 15 deletions

View File

@@ -61,7 +61,7 @@ foreach ($aTcpdfFontsDirContent as $sTcpdfFontResourceName) {
* 2) Then adding the DroidSansFallback font (useful for CJK data for example)
*/
echo $sCurrentScriptFileName.": ---2) Copying font files to TCPDF ($sTcPdfFontsFolder)...\n";
$aFontFilesToCopy = glob(__DIR__.'\droidsansfallback.*');
$aFontFilesToCopy = glob(__DIR__.DIRECTORY_SEPARATOR.'droidsansfallback.*');
foreach ($aFontFilesToCopy as $sFontFileToCopy) {
$sFontFileName = basename($sFontFileToCopy);
echo $sCurrentScriptFileName.': copying '.$sFontFileName."\n";

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -1670,20 +1670,7 @@ JS
$oExtensionsMap = iTopExtensionsMap::GetExtensionsMap($oWizard->GetParameter('target_env', ITOP_DEFAULT_ENV));
$oExtensionsMap->DeclareExtensionAsRemoved($aRemovedExtensionCodes);
$aAvailableModules = $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad);
$bRemoteExtensionsShouldBeMandatory = !$oWizard->GetParameter('force-uninstall', false);
if ($bRemoteExtensionsShouldBeMandatory) {
foreach ($aAvailableModules as $key => $aModule) {
$bIsExtra = (array_key_exists('root_dir', $aModule) && (strpos($aModule['root_dir'], $sExtraDir) !== false)); // Some modules (root, datamodel) have no 'root_dir'
if ($bIsExtra) {
// Modules in data/production-modules/ are considered as mandatory and always installed
$aAvailableModules[$key]['visible'] = false;
}
}
}
return $aAvailableModules;
return $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad);
}
/**

View File

@@ -0,0 +1,38 @@
<?php
/*
* @copyright Copyright (C) 2010-2026 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Test\UnitTest\DotMake\Dependencies\Composer\Tcpdf;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
/**
* @coversNothing
*/
class TcpdfUpdateFontsTest extends ItopTestCase
{
public function testThatDroidSansFallbackFilesAreCopiedToTcpdfFontsFolderAfterLibraryUpdate(): void
{
$sSourcePattern = APPROOT
.'.make'.DIRECTORY_SEPARATOR.'dependencies'.DIRECTORY_SEPARATOR.'composer'.DIRECTORY_SEPARATOR.'tcpdf'.DIRECTORY_SEPARATOR.'droidsansfallback.*';
$aSourceFiles = glob($sSourcePattern);
$this->assertIsArray($aSourceFiles, 'Unable to read source TCPDF custom font files.');
$this->assertNotEmpty($aSourceFiles, 'No source files found for pattern droidsansfallback.*');
foreach ($aSourceFiles as $sSourceFilePath) {
$sFontFileName = basename($sSourceFilePath);
$sDestinationFilePath = APPROOT
.'lib'.DIRECTORY_SEPARATOR.'tecnickcom'.DIRECTORY_SEPARATOR.'tcpdf'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$sFontFileName;
$this->assertFileExists($sDestinationFilePath, "Missing copied font file: {$sFontFileName}");
$this->assertSame(
hash_file('sha256', $sSourceFilePath),
hash_file('sha256', $sDestinationFilePath),
"Copied font file content mismatch: {$sFontFileName}"
);
}
}
}

View File

@@ -2,9 +2,13 @@
namespace Combodo\iTop\Test\UnitTest\Setup;
use AnalyzeInstallation;
use CheckResult;
use Combodo\iTop\Setup\FeatureRemoval\ModelReflectionSerializer;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use Config;
use ModuleDiscovery;
use WizardController;
use SetupUtils;
/**
@@ -28,6 +32,13 @@ class SetupUtilsTest extends ItopTestCase
$this->RequireOnceItopFile('setup/setuputils.class.inc.php');
$this->RequireOnceItopFile('setup/setuppage.class.inc.php');
$this->RequireOnceItopFile('setup/wizardcontroller.class.inc.php');
}
protected function tearDown(): void
{
parent::tearDown();
ModuleDiscovery::ResetCache();
}
/**
@@ -219,6 +230,30 @@ OUTPUT;
$this->ValidateCheckResults($expected, $aRes);
}
/**
* Bug N°10045
*/
public function testAnalyzeInstallationDoesNotAutomaticallySetModulesInProductionModulesVisibilityToFalse()
{
$this->RequireOnceItopFile('setup/moduleinstallation/AnalyzeInstallation.php');
$this->SetNonPublicProperty(AnalyzeInstallation::GetInstance(), 'aAvailableModules', null);
$sRemoteEnv = 'production-temp';
$sExtraDir = \utils::GetDataPath().$sRemoteEnv.'-modules/';
$sExtraModuleName = 'extra-module';
$this->createModule($sExtraDir, $sExtraModuleName, '1.0.0');
$oWizard = new WizardController('WizStepWelcome');
$oWizard->SetParameter('source_dir', APPROOT.'datamodels/2.x');
$oWizard->SetParameter('remote_env', $sRemoteEnv);
$aModules = SetupUtils::AnalyzeInstallation($oWizard);
$this->assertContains($sExtraModuleName, array_keys($aModules), 'Module discovery should have found the extra module');
$this->assertTrue($aModules[$sExtraModuleName]['visible'], 'AnalyzeInstallation should not have automatically set the extra module visibility to false');
}
private function ValidateCheckResults(array $expected, array $aActualCheckResults)
{
$aActual = [];
@@ -232,4 +267,37 @@ OUTPUT;
self::assertEquals($expected, $aActual);
}
protected function createModule($sDirectory, $sModuleName, $sModuleVersion, $bMandatory = false, $bVisible = true)
{
$sModuleDir = $sDirectory.'/'.$sModuleName;
SetupUtils::builddir($sModuleDir);
$this->aFileToClean[] = $sDirectory;
$sModuleFileName = $sModuleDir.'/module.'.$sModuleName.'.php';
$sMandatory = var_export($bMandatory, true);
$sVisible = var_export($bVisible, true);
file_put_contents(
$sModuleFileName,
<<<PHP
<?php
SetupWebPage::AddModule(
__FILE__,
"$sModuleName/$sModuleVersion",
[
'label' => "$sModuleName",
'dependencies' => [],
'mandatory' => $sMandatory,
'visible' => $sVisible,
'datamodel' => [],
'data.struct' => [],
'data.sample' => [],
'doc.manual_setup' => '',
'doc.more_information' => '',
]
);
PHP
);
}
}