PM-3367:Error editing and deliting templates on Windows

PM-3367
Error editing and deliting templates on Windows
This commit is contained in:
dheeyi
2015-08-31 10:47:01 -04:00
parent f2ad397343
commit 683a0b6774

View File

@@ -345,12 +345,11 @@ class FilesManager
$path = str_replace("/", DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, $path); $path = str_replace("/", DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, $path);
} }
$path = explode(DIRECTORY_SEPARATOR,$path); $path = explode(DIRECTORY_SEPARATOR,$path);
$baseName = $path[count($path)-2].DIRECTORY_SEPARATOR.$path[count($path)-1]; $baseName = $path[count($path)-2]."\\\\".$path[count($path)-1];
$baseName2 = $path[count($path)-2]."/".$path[count($path)-1]; $baseName2 = $path[count($path)-2]."/".$path[count($path)-1];
$criteria = new \Criteria("workflow"); $criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID); $criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
$criteria->add(\ProcessFilesPeer::PRF_PATH, "%" . $baseName . "%", \Criteria::LIKE); $criteria->add( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName . '%', \Criteria::LIKE )->addOr( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName2 . '%', \Criteria::LIKE )));
$criteria->add(\ProcessFilesPeer::PRF_PATH, "%" . $baseName2 . "%", \Criteria::LIKE);
$rsCriteria = \ProcessFilesPeer::doSelectRS($criteria); $rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next(); $rsCriteria->next();
@@ -389,7 +388,7 @@ class FilesManager
if ($path == '') { if ($path == '') {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid'))); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
} }
$sFile = end(explode("/",$path)); $sFile = end(explode(DIRECTORY_SEPARATOR,$path));
$sPath = str_replace($sFile,'',$path); $sPath = str_replace($sFile,'',$path);
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1); $sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
@@ -463,7 +462,7 @@ class FilesManager
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid'))); throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
} }
$sFile = end(explode("/",$path)); $sFile = end(explode(DIRECTORY_SEPARATOR,$path));
$path = PATH_DATA_MAILTEMPLATES.$sProcessUID.DIRECTORY_SEPARATOR.$sFile; $path = PATH_DATA_MAILTEMPLATES.$sProcessUID.DIRECTORY_SEPARATOR.$sFile;
if (file_exists($path) && !is_dir($path)) { if (file_exists($path) && !is_dir($path)) {