versionamiento con ID sin compatibilidad de versionamiento anterior

This commit is contained in:
Alvaro Campos
2011-02-16 21:44:56 +00:00
parent 188b72a047
commit fe30b3b2d5
2 changed files with 98 additions and 75 deletions

View File

@@ -1,10 +1,10 @@
<?php
/**
* cases_ShowOutputDocument.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -14,13 +14,13 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
/*
* Created on 13-02-2008
@@ -31,7 +31,7 @@
require_once ( "classes/model/AppDocumentPeer.php" );
$oAppDocument = new AppDocument();
$oAppDocument->Fields = $oAppDocument->load($_GET['a'],(isset($_GET['v']) )? $_GET['v'] : NULL );
$oAppDocument->Fields = $oAppDocument->load($_GET['a'],isset($_GET['v']) ? $_GET['v'] : NULL );
$sAppDocUid = $oAppDocument->getAppDocUid();
$info = pathinfo( $oAppDocument->getAppDocFilename() );
@@ -47,7 +47,7 @@
}
}
$ver= (isset($_GET['v']) && $_GET['v']!='') ? '_'.$_GET['v'] : '';
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $info['basename'] .$ver. '.' . $ext ;
G::streamFile ( $realPath, true );
$realPath = PATH_DOCUMENT . $oAppDocument->Fields['APP_UID'] . '/outdocs/' . $sAppDocUid .$ver. '.' . $ext ; G::streamFile ( $realPath, true );
// G::streamFile ( $realPath, true ,$info['basename'] .$ver. '.' . $ext );
G::streamFile ( $realPath, true);
?>

View File

@@ -323,72 +323,7 @@
}
//END: If there is a Break Step registered from Plugin
$sFilename = preg_replace('[^A-Za-z0-9_]', '_', G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
if ( $sFilename == '' ) $sFilename='_';
$pathOutput = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs'. PATH_SEP ;
G::mk_dir ( $pathOutput );
switch ( $aOD['OUT_DOC_TYPE'] ) {
case 'HTML' :
$oOutputDocument->generate( $_GET['UID'], $Fields['APP_DATA'], $pathOutput,
$sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'] );
break;
case 'JRXML' :
//creating the xml with the application data;
$xmlData = "<dynaform>\n";
foreach ( $Fields['APP_DATA'] as $key => $val ) {
$xmlData .= " <$key>$val</$key>\n";
}
$xmlData .= "</dynaform>\n";
$iSize = file_put_contents ( $javaOutput . 'addressBook.xml' , $xmlData );
G::LoadClass ('javaBridgePM');
$JBPM = new JavaBridgePM();
$JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils");
$util->setInputPath( $javaInput );
$util->setOutputPath( $javaOutput );
//$content = file_get_contents ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.jrxml' );
//$iSize = file_put_contents ( $javaInput . $aOD['OUT_DOC_UID'] . '.jrxml', $content );
copy ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.jrxml', $javaInput . $aOD['OUT_DOC_UID'] . '.jrxml' );
$outputFile = $javaOutput . $sFilename . '.pdf' ;
print $util->jrxml2pdf( $aOD['OUT_DOC_UID'] . '.jrxml' , basename($outputFile) );
//$content = file_get_contents ( $outputFile );
//$iSize = file_put_contents ( $pathOutput . $sFilename . '.pdf' , $content );
copy ( $outputFile, $pathOutput . $sFilename . '.pdf' );
//die;
break;
case 'ACROFORM' :
//creating the xml with the application data;
$xmlData = "<dynaform>\n";
foreach ( $Fields['APP_DATA'] as $key => $val ) {
$xmlData .= " <$key>$val</$key>\n";
}
$xmlData .= "</dynaform>\n";
//$iSize = file_put_contents ( $javaOutput . 'addressBook.xml' , $xmlData );
G::LoadClass ('javaBridgePM');
$JBPM = new JavaBridgePM();
$JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils");
$util->setInputPath( $javaInput );
$util->setOutputPath( $javaOutput );
copy ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.pdf', $javaInput . $aOD['OUT_DOC_UID'] . '.pdf' );
$outputFile = $javaOutput . $sFilename . '.pdf' ;
print $util->writeVarsToAcroFields( $aOD['OUT_DOC_UID'] . '.pdf' , $xmlData );
copy ( $javaOutput. $aOD['OUT_DOC_UID'] . '.pdf', $pathOutput . $sFilename . '.pdf' );
break;
default :
throw ( new Exception ('invalid output document' ));
}
require_once 'classes/model/AppFolder.php';
require_once 'classes/model/AppDocument.php';
@@ -469,6 +404,94 @@
}
}
//$sFilename = ereg_replace('[^A-Za-z0-9_]', '_', G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
//if ( $sFilename == '' ) $sFilename='_';
$sFilename = $aFields['APP_DOC_UID']. "_".$lastDocVersion;
$pathOutput = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP . 'outdocs'. PATH_SEP ;
G::mk_dir ( $pathOutput );
switch ( $aOD['OUT_DOC_TYPE'] ) {
case 'HTML' :
$aProperties = array(); //maui
if(!isset($aOD['OUT_DOC_MEDIA']))
$aOD['OUT_DOC_MEDIA'] = 'Letter';
if(!isset($aOD['OUT_DOC_LEFT_MARGIN']))
$aOD['OUT_DOC_LEFT_MARGIN'] = '15';
if(!isset($aOD['OUT_DOC_RIGHT_MARGIN']))
$aOD['OUT_DOC_RIGHT_MARGIN'] = '15';
if(!isset($aOD['OUT_DOC_TOP_MARGIN']))
$aOD['OUT_DOC_TOP_MARGIN'] = '15';
if(!isset($aOD['OUT_DOC_BOTTOM_MARGIN']))
$aOD['OUT_DOC_BOTTOM_MARGIN'] = '15';
$aProperties['media']=$aOD['OUT_DOC_MEDIA'];
$aProperties['margins']=array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN'],);
$oOutputDocument->generate( $_GET['UID'], $Fields['APP_DATA'], $pathOutput,
//$sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'],$aProperties );
$sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'] );
break;
case 'JRXML' :
//creating the xml with the application data;
$xmlData = "<dynaform>\n";
foreach ( $Fields['APP_DATA'] as $key => $val ) {
$xmlData .= " <$key>$val</$key>\n";
}
$xmlData .= "</dynaform>\n";
$iSize = file_put_contents ( $javaOutput . 'addressBook.xml' , $xmlData );
G::LoadClass ('javaBridgePM');
$JBPM = new JavaBridgePM();
$JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils");
$util->setInputPath( $javaInput );
$util->setOutputPath( $javaOutput );
//$content = file_get_contents ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.jrxml' );
//$iSize = file_put_contents ( $javaInput . $aOD['OUT_DOC_UID'] . '.jrxml', $content );
copy ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.jrxml', $javaInput . $aOD['OUT_DOC_UID'] . '.jrxml' );
$outputFile = $javaOutput . $sFilename . '.pdf' ;
print $util->jrxml2pdf( $aOD['OUT_DOC_UID'] . '.jrxml' , basename($outputFile) );
//$content = file_get_contents ( $outputFile );
//$iSize = file_put_contents ( $pathOutput . $sFilename . '.pdf' , $content );
copy ( $outputFile, $pathOutput . $sFilename . '.pdf' );
//die;
break;
case 'ACROFORM' :
//creating the xml with the application data;
$xmlData = "<dynaform>\n";
foreach ( $Fields['APP_DATA'] as $key => $val ) {
$xmlData .= " <$key>$val</$key>\n";
}
$xmlData .= "</dynaform>\n";
//$iSize = file_put_contents ( $javaOutput . 'addressBook.xml' , $xmlData );
G::LoadClass ('javaBridgePM');
$JBPM = new JavaBridgePM();
$JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils");
$util->setInputPath( $javaInput );
$util->setOutputPath( $javaOutput );
copy ( PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.pdf', $javaInput . $aOD['OUT_DOC_UID'] . '.pdf' );
$outputFile = $javaOutput . $sFilename . '.pdf' ;
print $util->writeVarsToAcroFields( $aOD['OUT_DOC_UID'] . '.pdf' , $xmlData );
copy ( $javaOutput. $aOD['OUT_DOC_UID'] . '.pdf', $pathOutput . $sFilename . '.pdf' );
break;
default :
throw ( new Exception ('invalid output document' ));
}
//Execute after triggers - Start
$Fields['APP_DATA'] = $oCase->ExecuteTriggers ( $_SESSION['TASK'], 'OUTPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] );
$Fields['DEL_INDEX']= $_SESSION['INDEX'];