BUG-17411 Output document generados con smarty para codigo en template
This commit is contained in:
@@ -178,12 +178,12 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_DESCRIPTION'])){
|
||||
$description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_GENERATE'])){
|
||||
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_GENERATE'])){
|
||||
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
}
|
||||
if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){
|
||||
$pdfSecurity = 'Disabled';
|
||||
}else{
|
||||
@@ -199,14 +199,14 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_TAGS'])){
|
||||
$description .= ", Tags: ".$aData['OUT_DOC_TAGS'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
}
|
||||
G::auditLog("CreateOutputDocument", $description);
|
||||
|
||||
return $aData['OUT_DOC_UID'];
|
||||
@@ -268,12 +268,12 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_DESCRIPTION'])){
|
||||
$description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
}
|
||||
if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){
|
||||
$pdfSecurity = 'Disabled';
|
||||
}else{
|
||||
@@ -289,14 +289,14 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_TAGS'])){
|
||||
$description .= ", Tags: ".$aData['OUT_DOC_TAGS'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
}
|
||||
if (isset($aData['OUT_DOC_TEMPLATE'])) {
|
||||
$description .= ", [EDIT TEMPLATE]";
|
||||
}
|
||||
@@ -556,6 +556,24 @@ class OutputDocument extends BaseOutputDocument
|
||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||
$sContent = G::replaceDataGridField($sContent, $aFields);
|
||||
|
||||
if (strpos($sContent, '<!---{') !== false) {
|
||||
$template = new Smarty();
|
||||
$template->compile_dir = PATH_SMARTY_C;
|
||||
$template->cache_dir = PATH_SMARTY_CACHE;
|
||||
$template->config_dir = PATH_THIRDPARTY . 'smarty/configs';
|
||||
$template->caching = false;
|
||||
$template->left_delimiter = '<!---{';
|
||||
$template->right_delimiter = '}--->';
|
||||
$oFile = fopen($sPath . $sFilename . '_smarty.html', 'wb');
|
||||
fwrite($oFile, $sContent);
|
||||
fclose($oFile);
|
||||
$template->templateFile = $sPath . $sFilename . '_smarty.html';
|
||||
//assign the variables and use the template $template
|
||||
$template->assign($aFields);
|
||||
$sContent = $template->fetch($template->templateFile);
|
||||
unlink($template->templateFile);
|
||||
}
|
||||
|
||||
G::verifyPath($sPath, true);
|
||||
|
||||
//Start - Create .doc
|
||||
|
||||
Reference in New Issue
Block a user