Al derivar de un script task y end email no envía el correo

R-1763
Process Name - limit size

R-1763
Process Name - limit size
This commit is contained in:
Dheeyi William
2016-09-01 14:51:00 -04:00
parent db477509b2
commit f59382b176
4 changed files with 37 additions and 17 deletions

View File

@@ -27,6 +27,11 @@ class PMXPublisher
return $filename;
}
/**
* @param $outputFile
* @param bool $dirName
* @return mixed|string
*/
public function truncateName($outputFile, $dirName = true)
{
$limit = 200;
@@ -34,23 +39,27 @@ class PMXPublisher
$limit = 150;
}
if ($dirName) {
if (strlen(basename($outputFile)) >= $limit) {
$lastPos = strrpos(basename($outputFile), '.');
$fileName = substr(basename($outputFile), 0, $lastPos);
$currentLocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, 'en_US.UTF-8');
$filename = basename($outputFile);
if (strlen($filename) >= $limit) {
$lastPos = strrpos($filename, '.');
$fileName = substr($filename, 0, $lastPos);
$newFileName = \G::inflect($fileName);
$excess = strlen($newFileName) - $limit;
$newFileName = substr($newFileName, 0, strlen($newFileName) - $excess);
$newFileName = substr($newFileName, 0, strlen($newFileName) - $excess - 1);
$newOutputFile = str_replace($fileName, $newFileName, $outputFile);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$newOutputFile = str_replace("/", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $newOutputFile);
}
$outputFile = $newOutputFile;
}
setlocale(LC_CTYPE, $currentLocale);
} else {
$outputFile = \G::inflect($outputFile);
if (strlen($outputFile) >= $limit) {
$excess = strlen($outputFile) - $limit;
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess);
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess - 1);
$outputFile = $newFileName;
}
}

View File

@@ -161,31 +161,40 @@ class XmlExporter extends Exporter
return $this->dom->createCDATASection($value);
}
}
public function truncateName($outputFile,$dirName = true)
/**
* @param $outputFile
* @param bool $dirName
* @return mixed|string
*/
public function truncateName($outputFile, $dirName = true)
{
$limit = 200;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$limit = 150;
}
if($dirName) {
if (strlen(basename($outputFile)) >= $limit) {
$lastPos = strrpos(basename($outputFile),'.');
$fileName = substr(basename($outputFile),0,$lastPos);
if ($dirName) {
$currentLocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, 'en_US.UTF-8');
$filename = basename($outputFile);
if (strlen($filename) >= $limit) {
$lastPos = strrpos($filename, '.');
$fileName = substr($filename, 0, $lastPos);
$newFileName = \G::inflect($fileName);
$excess = strlen($newFileName) - $limit;
$newFileName = substr($newFileName,0,strlen($newFileName)-$excess);
$newOutputFile = str_replace($fileName,$newFileName,$outputFile);
$newFileName = substr($newFileName, 0, strlen($newFileName) - $excess - 1);
$newOutputFile = str_replace($fileName, $newFileName, $outputFile);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$newOutputFile = str_replace("/", DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, $newOutputFile);
$newOutputFile = str_replace("/", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $newOutputFile);
}
$outputFile = $newOutputFile;
}
}
setlocale(LC_CTYPE, $currentLocale);
} else {
$outputFile = \G::inflect($outputFile);
if (strlen($outputFile) >= $limit) {
$excess = strlen($outputFile) - $limit;
$newFileName = substr($outputFile,0,strlen($outputFile)-$excess);
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess - 1);
$outputFile = $newFileName;
}
}