Merged in victorsl/processmaker (pull request #659)

ProcessMaker-BE "FilesManager - Correccion de bug en deleteProcessFilesManager()"
This commit is contained in:
Erik Amaru Ortiz
2014-08-14 10:30:14 -04:00

View File

@@ -412,17 +412,11 @@ 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));
$sPath = str_replace($sFile,'',$path); if (file_exists($path)) {
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1); unlink($path);
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
$sMainDirectory = 'mailTemplates';
} else {
$sMainDirectory = 'public';
} }
$oProcessMap = new \processMap(new \DBConnection());
$oProcessMap->deleteFile($sProcessUID, $sMainDirectory, $sSubDirectory, $sFile);
$rs = \ProcessFilesPeer::doDelete($criteria); $rs = \ProcessFilesPeer::doDelete($criteria);
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;