BUG 7306 Case Tracker download documents doesnt work, shows 404 Not Found page.
The file workflow/engine/methods/tracker/tracker_ShowOutputDocument.php was incomplete, there were not some validations like versioning, and there were not taking into account the extension of the file to download. I add those validations, taking like example the file /workflow/engine/methods/cases/cases_ShowOutputDocument.php
This commit is contained in:
@@ -152,6 +152,7 @@ try {
|
||||
$aOD = $oOutputDocument->load($aFields['DOC_UID']);
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $aFields['APP_UID']);
|
||||
$oCriteria->add(AppDelegationPeer::DEL_INDEX, $aFields['DEL_INDEX']);
|
||||
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
@@ -27,31 +27,63 @@
|
||||
*
|
||||
* @author David Callizaya <davidsantos@colosa.com>
|
||||
*/
|
||||
if (!isset($_SESSION['PROCESS']))
|
||||
{
|
||||
G::header('location: login');
|
||||
}
|
||||
require_once ( "classes/model/AppDocumentPeer.php" );
|
||||
|
||||
require_once ( "classes/model/AppDocumentPeer.php" );
|
||||
$oAppDocument = new AppDocument();
|
||||
$oAppDocument->Fields = $oAppDocument->load($_GET['a'],(isset($_GET['v']) )? $_GET['v'] : NULL );
|
||||
|
||||
$oAppDocument = new AppDocument();
|
||||
$oAppDocument->Fields = $oAppDocument->load($_GET['a']);
|
||||
|
||||
$sAppDocUid = $oAppDocument->getAppDocUid();
|
||||
$info = pathinfo( $oAppDocument->getAppDocFilename() );
|
||||
if (!isset($_GET['ext'])) {
|
||||
$sAppDocUid = $oAppDocument->getAppDocUid();
|
||||
$info = pathinfo( $oAppDocument->getAppDocFilename() );
|
||||
if (!isset($_GET['ext'])) {
|
||||
$ext = $info['extension'];
|
||||
}
|
||||
else {
|
||||
if ($_GET['ext'] != '') {
|
||||
$ext = $_GET['ext'];
|
||||
}
|
||||
else {
|
||||
$ext = $info['extension'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($_GET['ext'] != '') {
|
||||
$ext = $_GET['ext'];
|
||||
}
|
||||
else {
|
||||
$ext = $info['extension'];
|
||||
}
|
||||
}
|
||||
$ver= (isset($_GET['v']) && $_GET['v']!='') ? '_'.$_GET['v'] : '';
|
||||
|
||||
$realPath = PATH_DOCUMENT . $_SESSION['APPLICATION'] . '/outdocs/' . $info['basename'] . '.' . $ext ;
|
||||
G::streamFile ( $realPath, true );
|
||||
if(!$ver) //This code is in the case the outputdocument won't be versioned
|
||||
$ver='_1';
|
||||
|
||||
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid .$ver. '.' . $ext ;
|
||||
$realPath1 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] .$ver. '.' . $ext ;
|
||||
$realPath2 = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename']. '.' . $ext ;
|
||||
$sw_file_exists=false;
|
||||
if(file_exists($realPath)){
|
||||
$sw_file_exists=true;
|
||||
}elseif(file_exists($realPath1)){
|
||||
$sw_file_exists=true;
|
||||
$realPath=$realPath1;
|
||||
}elseif(file_exists($realPath2)){
|
||||
$sw_file_exists=true;
|
||||
$realPath=$realPath2;
|
||||
}
|
||||
if(!$sw_file_exists){
|
||||
$error_message="'".$info['basename'] .$ver. '.' . $ext."' ".G::LoadTranslation('ID_ERROR_STREAMING_FILE');
|
||||
if((isset($_POST['request']))&&($_POST['request']==true)){
|
||||
$res ['success'] = 'failure';
|
||||
$res ['message'] = $error_message;
|
||||
print G::json_encode ( $res );
|
||||
}else{
|
||||
G::SendMessageText($error_message, "ERROR");
|
||||
$backUrlObj=explode("sys".SYS_SYS,$_SERVER['HTTP_REFERER']);
|
||||
G::header("location: "."/sys".SYS_SYS.$backUrlObj[1]);
|
||||
die;
|
||||
}
|
||||
|
||||
}else{
|
||||
if((isset($_POST['request']))&&($_POST['request']==true)){
|
||||
$res ['success'] = 'success';
|
||||
$res ['message'] = $info['basename'] .$ver. '.' . $ext;
|
||||
print G::json_encode ( $res );
|
||||
}else{
|
||||
G::streamFile ( $realPath, true ,$info['basename'] .$ver. '.' . $ext );
|
||||
}
|
||||
}
|
||||
//G::streamFile ( $realPath, true);
|
||||
?>
|
||||
Reference in New Issue
Block a user