Merge branch 'master' of git://github.com/colosa/processmaker into BUG-12112

This commit is contained in:
Victor Saisa Lopez
2013-07-09 17:09:34 -04:00
9 changed files with 445 additions and 438 deletions

View File

@@ -956,6 +956,7 @@ class Cases
} }
if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) { if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) {
//There are changes //There are changes
$Fields['APP_STATUS'] = (isset($Fields['APP_STATUS'])) ? $Fields['APP_STATUS'] : $FieldsBefore['APP_STATUS'];
$appHistory = new AppHistory(); $appHistory = new AppHistory();
$aFieldsHistory = $Fields; $aFieldsHistory = $Fields;
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference); $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);

View File

@@ -139,9 +139,14 @@ class spoolRun
public function create ($aData) public function create ($aData)
{ {
if (is_array($aData['app_msg_attach'])) { if (is_array($aData['app_msg_attach'])) {
$attachment = implode(",", $aData['app_msg_attach']); $attachment = $aData['app_msg_attach'];
$aData['app_msg_attach'] = $attachment; } else {
$attachment = @unserialize($aData['app_msg_attach']);
if ($attachment === false) {
$attachment = explode(',', $aData['app_msg_attach']);
}
} }
$aData['app_msg_attach'] = serialize($attachment);
$aData['app_msg_show_message'] = (isset($aData['app_msg_show_message'])) ? $aData['app_msg_show_message'] : 1; $aData['app_msg_show_message'] = (isset($aData['app_msg_show_message'])) ? $aData['app_msg_show_message'] : 1;
$sUID = $this->db_insert( $aData ); $sUID = $this->db_insert( $aData );
@@ -184,7 +189,7 @@ class spoolRun
$this->fileData['cc'] = $sCC; $this->fileData['cc'] = $sCC;
$this->fileData['bcc'] = $sBCC; $this->fileData['bcc'] = $sBCC;
$this->fileData['template'] = $sTemplate; $this->fileData['template'] = $sTemplate;
$this->fileData['attachments'] = is_array( $aAttachment ) ? $aAttachment : ($aAttachment != '' ? explode( ',', $aAttachment ) : array ()); $this->fileData['attachments'] = $aAttachment;
$this->fileData['envelope_to'] = array (); $this->fileData['envelope_to'] = array ();
$this->fileData["contentTypeIsHtml"] = $bContentTypeIsHtml; $this->fileData["contentTypeIsHtml"] = $bContentTypeIsHtml;
@@ -443,8 +448,12 @@ class spoolRun
$oPHPMailer->Body = $msBody; $oPHPMailer->Body = $msBody;
if (is_array( $this->fileData['attachments'] )) { $attachment = @unserialize($this->fileData['attachments']);
foreach ($this->fileData['attachments'] as $key => $fileAttach) { if ($attachment === false) {
$attachment = $this->fileData['attachments'];
}
if (is_array($attachment)) {
foreach ($attachment as $key => $fileAttach) {
if (file_exists( $fileAttach )) { if (file_exists( $fileAttach )) {
$oPHPMailer->AddAttachment( $fileAttach, is_int( $key ) ? '' : $key ); $oPHPMailer->AddAttachment( $fileAttach, is_int( $key ) ? '' : $key );
} }

View File

@@ -1,363 +1,363 @@
<?php <?php
/** /**
* class.pmTrAlfresco.pmFunctions.php * class.pmTrAlfresco.pmFunctions.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc. * Copyright (C) 2004 - 2008 Colosa Inc.
* * * *
*/ */
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// pmTrAlfresco PM Functions // pmTrAlfresco PM Functions
// //
// Copyright (C) 2007 COLOSA // Copyright (C) 2007 COLOSA
// //
// License: LGPL, see LICENSE // License: LGPL, see LICENSE
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
/** /**
* Alfresco Triggers that allow ProcessMaker to perform common DM actions * Alfresco Triggers that allow ProcessMaker to perform common DM actions
* @class pmTrAlfresco * @class pmTrAlfresco
* @name Alfresco DM Triggers v. 0.1 * @name Alfresco DM Triggers v. 0.1
* @icon /images/triggers/alfrescoIcon.png * @icon /images/triggers/alfrescoIcon.png
* @className class.pmTrAlfresco.pmFunctions.php * @className class.pmTrAlfresco.pmFunctions.php
*/ */
/** /**
* @method * @method
* *
* Cancel Checkedout document/file * Cancel Checkedout document/file
* *
* @name cancelCheckout * @name cancelCheckout
* @label Cancel Checkedout document/file * @label Cancel Checkedout document/file
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $docUid | Document Uid * @param string | $docUid | Document Uid
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* *
* @return object | $result | Response | * @return object | $result | Response |
* *
*/ */
G::LoadSystem('restClient'); G::LoadSystem('restClient');
// Validation left // Validation left
function cancelCheckout($alfrescoServerUrl, $docUid, $user = "", $pwd = "") function cancelCheckout($alfrescoServerUrl, $docUid, $user = "", $pwd = "")
{ {
//require_once(PATH_CORE. 'classes' . PATH_SEP.'triggers' . PATH_SEP . 'class.pmTrAlfresco.php'); //require_once(PATH_CORE. 'classes' . PATH_SEP.'triggers' . PATH_SEP . 'class.pmTrAlfresco.php');
$alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/s/workspace:SpacesStore/i/$docUid"; $alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/s/workspace:SpacesStore/i/$docUid";
$domapi_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml;type=entry"); $domapi_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml;type=entry");
//$alfrescoMessage = $domapi_exec['header']; //$alfrescoMessage = $domapi_exec['header'];
$domapi_res = G::json_decode($domapi_exec->getResponse()); $domapi_res = G::json_decode($domapi_exec->getResponse());
return $domapi_res; return $domapi_res;
} }
/** /**
* @method * @method
* *
* Checkin document/file * Checkin document/file
* *
* @name Checkin * @name Checkin
* @label Checkin document/file * @label Checkin document/file
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $docUid | Document Uid * @param string | $docUid | Document Uid
* @param string | $comments | Comments * @param string | $comments | Comments
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* *
* @return string | $result | Response | * @return string | $result | Response |
* *
*/ */
function checkIn($alfrescoServerUrl, $docUid, $comments, $user = "", $pwd = "") function checkIn($alfrescoServerUrl, $docUid, $comments, $user = "", $pwd = "")
{ {
$alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/i/$docUid?checkin=true&checkinComment=$comments"; $alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/i/$docUid?checkin=true&checkinComment=$comments";
$xmlData = array(); $xmlData = array();
$xmlData = '<?xml version="1.0" encoding="utf-8"?><entry xmlns="http://www.w3.org/2005/Atom"/>'; $xmlData = '<?xml version="1.0" encoding="utf-8"?><entry xmlns="http://www.w3.org/2005/Atom"/>';
$alfresco_exec = RestClient::put($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml"); $alfresco_exec = RestClient::put($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml");
$alfrescoMessage = $alfresco_exec->getResponseMessage(); $alfrescoMessage = $alfresco_exec->getResponseMessage();
if ($alfrescoMessage === 'OK') { if ($alfrescoMessage === 'OK') {
return "The Document has been Checkedin"; return "The Document has been Checkedin";
} elseif ($alfrescoMessage === 'Internal Server Error') { } elseif ($alfrescoMessage === 'Internal Server Error') {
return "Please enter a Valid Document Id"; return "Please enter a Valid Document Id";
} else { } else {
return $alfrescoMessage; return $alfrescoMessage;
} }
} }
/** /**
* @method * @method
* *
* Checkout document/file * Checkout document/file
* *
* @name Checkout * @name Checkout
* @label Checkout document/file * @label Checkout document/file
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $docUid | Document Uid * @param string | $docUid | Document Uid
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* *
* @return string | $result | Response | * @return string | $result | Response |
* *
*/ */
// Validation done // Validation done
function checkOut($alfrescoServerUrl, $docUid, $user = "", $pwd = "") function checkOut($alfrescoServerUrl, $docUid, $user = "", $pwd = "")
{ {
$alfresco_url = "$alfrescoServerUrl/s/cmis/checkedout"; $alfresco_url = "$alfrescoServerUrl/s/cmis/checkedout";
$xmlData = array(); $xmlData = array();
$xmlData = '<?xml version="1.0" encoding="utf-8"?>' . '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">' . '<cmisra:object>' . '<cmis:properties>' . '<cmis:propertyId propertyDefinitionId="cmis:objectId">' . '<cmis:value>workspace://SpacesStore/' . $docUid . '</cmis:value>' . '</cmis:propertyId>' . '</cmis:properties>' . '</cmisra:object>' . '</entry>'; $xmlData = '<?xml version="1.0" encoding="utf-8"?>' . '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">' . '<cmisra:object>' . '<cmis:properties>' . '<cmis:propertyId propertyDefinitionId="cmis:objectId">' . '<cmis:value>workspace://SpacesStore/' . $docUid . '</cmis:value>' . '</cmis:propertyId>' . '</cmis:properties>' . '</cmisra:object>' . '</entry>';
$alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml;type=entry"); $alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml;type=entry");
$alfrescoMessage = $alfresco_exec->getResponseMessage(); $alfrescoMessage = $alfresco_exec->getResponseMessage();
if ($alfrescoMessage === 'Created') { if ($alfrescoMessage === 'Created') {
return "The Document has been Checkedout"; return "The Document has been Checkedout";
} elseif ($alfrescoMessage === 'Conflict') { } elseif ($alfrescoMessage === 'Conflict') {
return "The Document you are trying to checkout has already been Checkedout"; return "The Document you are trying to checkout has already been Checkedout";
} else { } else {
return $alfrescoMessage; return $alfrescoMessage;
} }
} }
/** /**
* @method * @method
* *
* Create a folder in Alfresco Repository * Create a folder in Alfresco Repository
* *
* @name createFolder * @name createFolder
* @label Create a folder in Alfresco Repository * @label Create a folder in Alfresco Repository
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $parentFolder | Parent Folder Name * @param string | $parentFolder | Parent Folder Name
* @param string | $folderName | Name of the Folder to be created * @param string | $folderName | Name of the Folder to be created
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* *
* @return string | $result | Response | * @return string | $result | Response |
* *
*/ */
function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd) function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd)
{ {
$name = explode("/", $folderName); $name = explode("/", $folderName);
$init = substr($parentFolder, 0, 1); $init = substr($parentFolder, 0, 1);
$parentFolder = ($init == "/") ? substr($parentFolder, 1) . "/" : $parentFolder . "/"; $parentFolder = ($init == "/") ? substr($parentFolder, 1) . "/" : $parentFolder . "/";
$alfresco_url = "$alfrescoServerUrl/s/cmis/p/" . $parentFolder . "children"; $alfresco_url = "$alfrescoServerUrl/s/cmis/p/" . $parentFolder . "children";
$xmlData = array(); $xmlData = array();
$xmlData = '<?xml version="1.0" encoding="utf-8"?>' . '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">' . '<title>' . $name[0] . '</title>' . '<cmisra:object>' . '<cmis:properties>' . '<cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:folder</cmis:value></cmis:propertyId>' . '</cmis:properties>' . '</cmisra:object>' . '</entry>'; $xmlData = '<?xml version="1.0" encoding="utf-8"?>' . '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">' . '<title>' . $name[0] . '</title>' . '<cmisra:object>' . '<cmis:properties>' . '<cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:folder</cmis:value></cmis:propertyId>' . '</cmis:properties>' . '</cmisra:object>' . '</entry>';
$alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml"); $alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml");
$alfrescoMessage = $alfresco_exec->getResponseMessage(); $alfrescoMessage = $alfresco_exec->getResponseMessage();
$folderName = substr(strstr($folderName, "/"), 1); $folderName = substr(strstr($folderName, "/"), 1);
$parentFolder = $parentFolder . "" . $name[0]; $parentFolder = $parentFolder . "" . $name[0];
if ($folderName != null) { if ($folderName != null) {
createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd); createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd);
} }
if ($alfrescoMessage === 'Created') { if ($alfrescoMessage === 'Created') {
return "The Folder has been Created"; return "The Folder has been Created";
} else { } else {
return $alfrescoMessage; return $alfrescoMessage;
} }
} }
/** /**
* @method * @method
* *
* Delete an object(Folder/File) from Alfresco Repository * Delete an object(Folder/File) from Alfresco Repository
* *
* @name deleteObject * @name deleteObject
* @label Delete an object(Folder/File) from Alfresco Repository * @label Delete an object(Folder/File) from Alfresco Repository
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $objetcId | Id of the Object(Folder/File) to be deleted * @param string | $objetcId | Id of the Object(Folder/File) to be deleted
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* *
* @return object | $result | Response | * @return object | $result | Response |
* *
*/ */
function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd)
{ {
$alfresco_url = "$alfrescoServerUrl/s/cmis/s/workspace:SpacesStore/i/$objetcId"; $alfresco_url = "$alfrescoServerUrl/s/cmis/s/workspace:SpacesStore/i/$objetcId";
$alfresco_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml"); $alfresco_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml");
$alfresco_res = G::json_decode($alfresco_exec->getResponse()); $alfresco_res = G::json_decode($alfresco_exec->getResponse());
return $alfresco_res; return $alfresco_res;
} }
/** /**
* @method * @method
* *
* Download Document/File from Alfresco Repository * Download Document/File from Alfresco Repository
* *
* @name downloadDoc * @name downloadDoc
* @label Download Document/File from Alfresco Repository * @label Download Document/File from Alfresco Repository
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $pathFile | File Source * @param string | $pathFile | File Source
* @param string | $pathFolder | Folder Name * @param string | $pathFolder | Folder Name
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* @param string | $mainFolder | The main folder in alfreco to save the files * @param string | $mainFolder | The main folder in alfreco to save the files
* *
* @return string | $result | Response | * @return string | $result | Response |
* *
*/ */
function downloadDoc($alfrescoServerUrl, $pathFile, $pathFolder, $user, $pwd, $mainFolder = 'Sites') function downloadDoc($alfrescoServerUrl, $pathFile, $pathFolder, $user, $pwd, $mainFolder = 'Sites')
{ {
if (!(G::verifyPath($pathFolder))) { if (!(G::verifyPath($pathFolder))) {
$result = new stdclass(); $result = new stdclass();
$result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $pathFolder)); $result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $pathFolder));
return $result; return $result;
} }
$dataPathFile = pathinfo($pathFile); $dataPathFile = pathinfo($pathFile);
$nameFile = $dataPathFile['basename']; $nameFile = $dataPathFile['basename'];
$alfresco_url = "$alfrescoServerUrl" . PATH_SEP . "s" . PATH_SEP . "cmis" . PATH_SEP . "p" . PATH_SEP . $mainFolder . PATH_SEP . "$pathFile"; $alfresco_url = "$alfrescoServerUrl" . PATH_SEP . "s" . PATH_SEP . "cmis" . PATH_SEP . "p" . PATH_SEP . $mainFolder . PATH_SEP . "$pathFile";
$alfresco_exec = RestClient::get($alfresco_url, $user, $pwd, 'application/atom+xml'); $alfresco_exec = RestClient::get($alfresco_url, $user, $pwd, 'application/atom+xml');
$sXmlArray = $alfresco_exec->getResponse(); $sXmlArray = $alfresco_exec->getResponse();
$sXmlArray = eregi_replace("[\n|\r|\n\r]", '', $sXmlArray); $sXmlArray = eregi_replace("[\n|\r|\n\r]", '', $sXmlArray);
$xmlObject = simplexml_load_string((string) $sXmlArray); $xmlObject = simplexml_load_string((string) $sXmlArray);
if (!isset($xmlObject->content)) { if (!isset($xmlObject->content)) {
$result = new stdclass(); $result = new stdclass();
$result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $nameFile)); $result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $nameFile));
return $result; return $result;
} }
$linkContent = (string) $xmlObject->content->attributes()->src; $linkContent = (string) $xmlObject->content->attributes()->src;
$alfresco_exec = RestClient::get($linkContent, $user, $pwd, 'application/atom+xml'); $alfresco_exec = RestClient::get($linkContent, $user, $pwd, 'application/atom+xml');
$sXmlArray = $alfresco_exec->getResponse(); $sXmlArray = $alfresco_exec->getResponse();
$content = eregi_replace("[\n|\r|\n\r]", '', $sXmlArray); $content = eregi_replace("[\n|\r|\n\r]", '', $sXmlArray);
if ('/' != substr($pathFolder, -1)) { if ('/' != substr($pathFolder, -1)) {
$pathFolder .= '/'; $pathFolder .= '/';
} }
$fp = fopen($pathFolder . $nameFile, "w+"); $fp = fopen($pathFolder . $nameFile, "w+");
fwrite($fp, $content); fwrite($fp, $content);
fclose($fp); fclose($fp);
return true; return true;
} }
/** /**
* @method * @method
* *
* Get a list of Checkedout Document/File from Alfresco Repository * Get a list of Checkedout Document/File from Alfresco Repository
* *
* @name getCheckedoutFiles * @name getCheckedoutFiles
* @label Get a list of Checkedout Document/File from Alfresco Repository * @label Get a list of Checkedout Document/File from Alfresco Repository
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* *
* @return object | $result | Response | * @return object | $result | Response |
* *
*/ */
function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd) function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd)
{ {
$getChildrenUrl = "$alfrescoServerUrl/s/cmis/checkedout"; $getChildrenUrl = "$alfrescoServerUrl/s/cmis/checkedout";
$domapi_exec = RestClient::get($getChildrenUrl, $user, $pwd, 'application/atom+xml'); $domapi_exec = RestClient::get($getChildrenUrl, $user, $pwd, 'application/atom+xml');
$sXmlArray = G::json_decode($domapi_exec->getResponse()); $sXmlArray = G::json_decode($domapi_exec->getResponse());
$sXmlArray = trim($sXmlArray); $sXmlArray = trim($sXmlArray);
$xXmlArray = simplexml_load_string($sXmlArray); $xXmlArray = simplexml_load_string($sXmlArray);
$aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1); $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1);
return $alfresco_res; return $alfresco_res;
} }
/** /**
* @method * @method
* *
* Get Children of the given folder * Get Children of the given folder
* *
* @name getFolderChildren * @name getFolderChildren
* @label Get Children of the given folder * @label Get Children of the given folder
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $folderId | FolderId of the Folder whose children is to be listed * @param string | $folderId | FolderId of the Folder whose children is to be listed
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* *
* @return object | $result | Response | * @return object | $result | Response |
* *
*/ */
function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd)
{ {
$getChildrenUrl = "$alfrescoServerUrl/service/api/node/workspace/SpacesStore/$folderId/children"; $getChildrenUrl = "$alfrescoServerUrl/service/api/node/workspace/SpacesStore/$folderId/children";
$alfresco_exec = RestClient::get($getChildrenUrl, $user, $pwd); $alfresco_exec = RestClient::get($getChildrenUrl, $user, $pwd);
$sXmlArray = $alfresco_exec->getResponse(); $sXmlArray = $alfresco_exec->getResponse();
$sXmlArray = trim($sXmlArray); $sXmlArray = trim($sXmlArray);
$xXmlArray = simplexml_load_string($sXmlArray); $xXmlArray = simplexml_load_string($sXmlArray);
$aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1); $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1);
return $aXmlArray; return $aXmlArray;
} }
/** /**
* @method * @method
* *
* Uplaod file/document in Alfresco Repository * Uplaod file/document in Alfresco Repository
* *
* @name uploadDoc * @name uploadDoc
* @label Uplaod file/document in Alfresco Repository * @label Uplaod file/document in Alfresco Repository
* *
* @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco
* @param string | $fileSource | File Source * @param string | $fileSource | File Source
* @param string | $title | File Title * @param string | $title | File Title
* @param string | $description | Description about File * @param string | $description | Description about File
* @param string | $docType | Type of document to be Uploaded * @param string | $docType | Type of document to be Uploaded
* @param string | $user | Valid Admin username to connect to Alfresco server * @param string | $user | Valid Admin username to connect to Alfresco server
* @param string | $pwd | Valid Admin password to connect to Alfresco server * @param string | $pwd | Valid Admin password to connect to Alfresco server
* @param string | $path | Path of document to be Uploaded * @param string | $path | Path of document to be Uploaded
* @param string | $mainFolder | The main folder in alfreco to save the files * @param string | $mainFolder | The main folder in alfreco to save the files
* *
* @return object | $result | Response | * @return object | $result | Response |
* *
*/ */
function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docType, $user, $pwd, $path = '', $mainFolder= 'Sites') function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docType, $user, $pwd, $path = '', $mainFolder= 'Sites')
{ {
if (!(file_exists($fileSource))) { if (!(file_exists($fileSource))) {
$result = new stdclass(); $result = new stdclass();
$result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $fileSource)); $result->error = G::Loadtranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array('pluginFile' => $fileSource));
return $result; return $result;
} }
$filep = fopen($fileSource, "r"); $filep = fopen($fileSource, "r");
$fileLength = filesize($fileSource); $fileLength = filesize($fileSource);
$fileContent = fread($filep, $fileLength); $fileContent = fread($filep, $fileLength);
$fileContent = base64_encode($fileContent); $fileContent = base64_encode($fileContent);
if ($path != '') { if ($path != '') {
createFolder($alfrescoServerUrl, $mainFolder, $path, $user, $pwd); createFolder($alfrescoServerUrl, $mainFolder, $path, $user, $pwd);
$path = $path . PATH_SEP; $path = $path . PATH_SEP;
} }
$alfresco_url = "$alfrescoServerUrl/s/cmis/p/$mainFolder/" . $path . "children"; $alfresco_url = "$alfrescoServerUrl/s/cmis/p/$mainFolder/" . $path . "children";
$xmlData = array(); $xmlData = array();
$xmlData = '<?xml version="1.0" encoding="utf-8"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"><title>' . $title . '</title><summary>' . $description . '</summary><content type="application/' . $docType . '">' . $fileContent . '</content><cmisra:object><cmis:properties><cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId></cmis:properties></cmisra:object></entry>'; $xmlData = '<?xml version="1.0" encoding="utf-8"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"><title>' . $title . '</title><summary>' . $description . '</summary><content type="application/' . $docType . '">' . $fileContent . '</content><cmisra:object><cmis:properties><cmis:propertyId propertyDefinitionId="cmis:objectTypeId"><cmis:value>cmis:document</cmis:value></cmis:propertyId></cmis:properties></cmisra:object></entry>';
$alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml"); $alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml");
$response = $alfresco_exec->getHeaders(); $response = $alfresco_exec->getHeaders();
switch ($response['code']) { switch ($response['code']) {
case '201': case '201':
//Created //Created
$sXmlArray = $alfresco_exec->getResponse(); $sXmlArray = $alfresco_exec->getResponse();
$sXmlArray = trim($sXmlArray); $sXmlArray = trim($sXmlArray);
$xXmlArray = simplexml_load_string($sXmlArray); $xXmlArray = simplexml_load_string($sXmlArray);
$aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1); $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1);
break; break;
case '409': case '409':
//file exists //file exists
$aXmlArray = 'There is already a file with the same name: ' . $title; $aXmlArray = 'There is already a file with the same name: ' . $title;
break; break;
default: default:
$aXmlArray = $response['message']; $aXmlArray = $response['message'];
break; break;
} }
return $aXmlArray; return $aXmlArray;
} }

View File

@@ -423,13 +423,17 @@ class pmTablesProxy extends HttpProxyController
$primaryKeys = $additionalTables->getPrimaryKeys(); $primaryKeys = $additionalTables->getPrimaryKeys();
foreach ($result['rows'] as $i => $row) { if (is_array($result['rows'])) {
$primaryKeysValues = array (); foreach ($result['rows'] as $i => $row) {
foreach ($primaryKeys as $key) { $primaryKeysValues = array ();
$primaryKeysValues[] = isset( $row[$key['FLD_NAME']] ) ? $row[$key['FLD_NAME']] : ''; foreach ($primaryKeys as $key) {
} $primaryKeysValues[] = isset( $row[$key['FLD_NAME']] ) ? $row[$key['FLD_NAME']] : '';
}
$result['rows'][$i]['__index__'] = G::encrypt( implode( ',', $primaryKeysValues ), 'pmtable' ); $result['rows'][$i]['__index__'] = G::encrypt( implode( ',', $primaryKeysValues ), 'pmtable' );
}
} else {
$result['rows'] = array();
} }
return $result; return $result;

View File

@@ -173,37 +173,16 @@ if ($actionAjax == 'sendMailMessage_JXP') {
$_POST['APP_MSG_UID'] = $_REQUEST['APP_MSG_UID']; $_POST['APP_MSG_UID'] = $_REQUEST['APP_MSG_UID'];
G::LoadClass( 'case' ); G::LoadClass( 'case' );
$oCase = new Cases();
require_once 'classes/model/Configuration.php';
G::LoadClass( 'spool' ); G::LoadClass( 'spool' );
$oCase = new Cases(); $oCase = new Cases();
$data = $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ); $data = $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] );
//print_r($data);
G::LoadClass("system");
$oConfiguration = new Configuration(); $aSetup = System::getEmailConfiguration();
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria( 'workflow' ); $passwd = $aSetup['MESS_PASSWORD'];
$oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' );
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
$oCriteria->add( ConfigurationPeer::PRO_UID, '' );
$oCriteria->add( ConfigurationPeer::USR_UID, '' );
$oCriteria->add( ConfigurationPeer::APP_UID, '' );
if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
$oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => ''
) );
$aConfiguration = array ();
} else {
$aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' );
if ($aConfiguration['CFG_VALUE'] != '') {
$aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] );
} else {
$aConfiguration = array ();
}
}
$passwd = $aConfiguration['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' ); $passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec ); $auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) { if (count( $auxPass ) > 1) {
@@ -214,16 +193,25 @@ if ($actionAjax == 'sendMailMessage_JXP') {
$passwd = implode( '', $auxPass ); $passwd = implode( '', $auxPass );
} }
} }
$aConfiguration['MESS_PASSWORD'] = $passwd; $aSetup['MESS_PASSWORD'] = $passwd;
if ($aSetup['MESS_RAUTH'] == false || (is_string($aSetup['MESS_RAUTH']) && $aSetup['MESS_RAUTH'] == 'false')) {
$aSetup['MESS_RAUTH'] = 0;
} else {
$aSetup['MESS_RAUTH'] = 1;
}
$oSpool = new spoolRun(); $oSpool = new spoolRun();
if ($aConfiguration['MESS_RAUTH'] == false || (is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false')) { $oSpool->setConfig(
$aConfiguration['MESS_RAUTH'] = 0; array (
} else { 'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
$aConfiguration['MESS_RAUTH'] = 1; 'MESS_SERVER' => $aSetup['MESS_SERVER'],
} 'MESS_PORT' => $aSetup['MESS_PORT'],
$oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $passwd,'SMTPAuth' => $aConfiguration['MESS_RAUTH'] 'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
) ); 'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
'SMTPSecure' => $aSetup['SMTPSecure'],
'SMTPAuth' => $aSetup['MESS_RAUTH']
)
);
$oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending' $oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending'
) ); ) );

View File

@@ -757,37 +757,11 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
//print_r($data); //print_r($data);
$oConfiguration = new Configuration(); G::LoadClass("system");
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' );
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
$oCriteria->add( ConfigurationPeer::PRO_UID, '' );
$oCriteria->add( ConfigurationPeer::USR_UID, '' );
$oCriteria->add( ConfigurationPeer::APP_UID, '' );
if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
$oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => ''
) );
$aConfiguration = array ();
} else {
$aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' );
if ($aConfiguration['CFG_VALUE'] != '') {
$aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] );
} else {
$aConfiguration = array ();
}
}
$oSpool = new spoolRun(); $aSetup = System::getEmailConfiguration();
if ($aConfiguration['MESS_RAUTH'] == false || (is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false')) {
$aConfiguration['MESS_RAUTH'] = 0;
} else {
$aConfiguration['MESS_RAUTH'] = 1;
}
$oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'],'SMTPAuth' => $aConfiguration['MESS_RAUTH'] $passwd = $aSetup['MESS_PASSWORD'];
) );
$passwd = $oSpool->config['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' ); $passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec ); $auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) { if (count( $auxPass ) > 1) {
@@ -798,7 +772,25 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$passwd = implode( '', $auxPass ); $passwd = implode( '', $auxPass );
} }
} }
$oSpool->config['MESS_PASSWORD'] = $passwd; $aSetup['MESS_PASSWORD'] = $passwd;
if ($aSetup['MESS_RAUTH'] == false || (is_string($aSetup['MESS_RAUTH']) && $aSetup['MESS_RAUTH'] == 'false')) {
$aSetup['MESS_RAUTH'] = 0;
} else {
$aSetup['MESS_RAUTH'] = 1;
}
$oSpool = new spoolRun();
$oSpool->setConfig(
array (
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
'MESS_SERVER' => $aSetup['MESS_SERVER'],
'MESS_PORT' => $aSetup['MESS_PORT'],
'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
'SMTPSecure' => $aSetup['SMTPSecure'],
'SMTPAuth' => $aSetup['MESS_RAUTH']
)
);
$oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending' $oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending'
) ); ) );
$oSpool->sendMail(); $oSpool->sendMail();

View File

@@ -21,7 +21,12 @@
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
parent.location = "../cases/casesStartPage?action=startCase";
</script>');
}
/* Permissions */ /* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) { switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2: case - 2:

View File

@@ -21,6 +21,12 @@
* 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. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
parent.location = "../cases/casesStartPage?action=startCase";
</script>');
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) { if (($RBAC_Response = $RBAC->userCanAccess( "PM_CASES" )) != 1) {
return $RBAC_Response; return $RBAC_Response;
} }

View File

@@ -924,6 +924,8 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
$noLoginFiles[] = 'cases_ShowDocument'; $noLoginFiles[] = 'cases_ShowDocument';
$noLoginFiles[] = 'cases_CatchExecute'; $noLoginFiles[] = 'cases_CatchExecute';
$noLoginFiles[] = 'cases_SaveData'; $noLoginFiles[] = 'cases_SaveData';
$noLoginFiles[] = 'cases_Derivate';
$noLoginFiles[] = 'cases_NextStep';
$noLoginFolders[] = 'services'; $noLoginFolders[] = 'services';
$noLoginFolders[] = 'tracker'; $noLoginFolders[] = 'tracker';