From f2f74e1885d334d664d9308b59219c05a23ab1a1 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Mon, 27 May 2013 16:44:14 -0400 Subject: [PATCH] Improvement in Alfresco PM functions --- .../triggers/class.pmAlfrescoFunctions.php | 18 +++++++++--------- .../templates/triggers/triggers_EditWizard.php | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php b/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php index a01371535..fee5e5835 100755 --- a/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php +++ b/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php @@ -208,9 +208,9 @@ function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) function downloadDoc($alfrescoServerUrl, $pathFile, $pathFolder, $user, $pwd, $mainFolder = 'Sites') { if (!(G::verifyPath($pathFolder))) { - G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $pathFolder)); - G::header('Location: ' . $_SERVER['HTTP_REFERER']); - die; + $result = new stdclass(); + $result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $pathFolder)); + return $result; } $dataPathFile = pathinfo($pathFile); @@ -223,9 +223,9 @@ function downloadDoc($alfrescoServerUrl, $pathFile, $pathFolder, $user, $pwd, $m $xmlObject = simplexml_load_string((string) $sXmlArray); if (!isset($xmlObject->content)) { - G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $nameFile . ' in Alfresco')); - G::header('Location: ' . $_SERVER['HTTP_REFERER']); - die; + $result = new stdclass(); + $result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $nameFile)); + return $result; } $linkContent = (string) $xmlObject->content->attributes()->src; @@ -323,9 +323,9 @@ function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docType, $user, $pwd, $path = '', $mainFolder= 'Sites') { if (!(file_exists($fileSource))) { - G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $fileSource)); - G::header('Location: ' . $_SERVER['HTTP_REFERER']); - die; + $result = new stdclass(); + $result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $fileSource)); + return $result; } $filep = fopen($fileSource, "r"); $fileLength = filesize($fileSource); diff --git a/workflow/engine/templates/triggers/triggers_EditWizard.php b/workflow/engine/templates/triggers/triggers_EditWizard.php index 8c080801a..714ea50c5 100755 --- a/workflow/engine/templates/triggers/triggers_EditWizard.php +++ b/workflow/engine/templates/triggers/triggers_EditWizard.php @@ -153,7 +153,7 @@ try { $template->assign ( 'ADD_TRI_VARIABLE', $tri_Button ); // $template->assign ( 'ADD_TRI_VALUE', str_replace ( "'", "", // str_replace ( '"', '', $paramDefaultValue ) ) ); - $paramValue = $_GET[trim( str_replace( "$", "", $paramName ) )]; + $paramValue = isset($_GET[trim( str_replace( "$", "", $paramName ) )]) ? $_GET[trim( str_replace( "$", "", $paramName ) )] : ''; $template->assign ( 'ADD_TRI_VALUE', str_replace("\'", "'", $paramValue) ); //turn single quotes to double quotes into an array asignation $template->assign ( 'ADD_TRI_VALUE', str_replace("'", """, $paramValue) );