HOR-1777
Al realizar un export de un proceso (Normal/Granular) se hace un truncate del nombre sin embargo no se considera nombres de file Multibyte solo se toma en cuenta nombres de tipo Monobyte
This commit is contained in:
@@ -46,8 +46,7 @@ class PMXPublisher
|
||||
$lastPos = strrpos($filename, '.');
|
||||
$fileName = substr($filename, 0, $lastPos);
|
||||
$newFileName = \G::inflect($fileName);
|
||||
$excess = strlen($newFileName) - $limit;
|
||||
$newFileName = substr($newFileName, 0, strlen($newFileName) - $excess - 1);
|
||||
$newFileName = $this->truncateFilename($newFileName, $limit);
|
||||
$newOutputFile = str_replace($fileName, $newFileName, $outputFile);
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$newOutputFile = str_replace("/", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $newOutputFile);
|
||||
@@ -57,9 +56,31 @@ class PMXPublisher
|
||||
setlocale(LC_CTYPE, $currentLocale);
|
||||
} else {
|
||||
$outputFile = \G::inflect($outputFile);
|
||||
if (strlen($outputFile) >= $limit) {
|
||||
$excess = strlen($outputFile) - $limit;
|
||||
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess - 1);
|
||||
$outputFile = $this->truncateFilename($outputFile, $limit);
|
||||
}
|
||||
return $outputFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $outputFile
|
||||
* @param $limit
|
||||
* @return string
|
||||
*/
|
||||
private function truncateFilename($outputFile, $limit)
|
||||
{
|
||||
$limitFile = $limit;
|
||||
if (mb_strlen($outputFile) != strlen($outputFile)) {
|
||||
if (strlen($outputFile) >= $limitFile) {
|
||||
do {
|
||||
$newFileName = mb_strimwidth($outputFile, 0, $limit);
|
||||
--$limit;
|
||||
} while (strlen($newFileName) > $limitFile);
|
||||
$outputFile = $newFileName;
|
||||
}
|
||||
} else {
|
||||
if (strlen($outputFile) >= $limitFile) {
|
||||
$excess = strlen($outputFile) - $limitFile;
|
||||
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess);
|
||||
$outputFile = $newFileName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,8 +181,7 @@ class XmlExporter extends Exporter
|
||||
$lastPos = strrpos($filename, '.');
|
||||
$fileName = substr($filename, 0, $lastPos);
|
||||
$newFileName = \G::inflect($fileName);
|
||||
$excess = strlen($newFileName) - $limit;
|
||||
$newFileName = substr($newFileName, 0, strlen($newFileName) - $excess - 1);
|
||||
$newFileName = $this->truncateFilename($newFileName, $limit);
|
||||
$newOutputFile = str_replace($fileName, $newFileName, $outputFile);
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$newOutputFile = str_replace("/", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $newOutputFile);
|
||||
@@ -192,9 +191,31 @@ class XmlExporter extends Exporter
|
||||
setlocale(LC_CTYPE, $currentLocale);
|
||||
} else {
|
||||
$outputFile = \G::inflect($outputFile);
|
||||
if (strlen($outputFile) >= $limit) {
|
||||
$excess = strlen($outputFile) - $limit;
|
||||
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess - 1);
|
||||
$outputFile = $this->truncateFilename($outputFile, $limit);
|
||||
}
|
||||
return $outputFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $outputFile
|
||||
* @param $limit
|
||||
* @return string
|
||||
*/
|
||||
private function truncateFilename($outputFile, $limit)
|
||||
{
|
||||
$limitFile = $limit;
|
||||
if (mb_strlen($outputFile) != strlen($outputFile)) {
|
||||
if (strlen($outputFile) >= $limitFile) {
|
||||
do {
|
||||
$newFileName = mb_strimwidth($outputFile, 0, $limit);
|
||||
--$limit;
|
||||
} while (strlen($newFileName) > $limitFile);
|
||||
$outputFile = $newFileName;
|
||||
}
|
||||
} else {
|
||||
if (strlen($outputFile) >= $limitFile) {
|
||||
$excess = strlen($outputFile) - $limitFile;
|
||||
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess);
|
||||
$outputFile = $newFileName;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user