Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -283,11 +283,11 @@ class Calendar
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Group
|
||||
* Create Calendar
|
||||
*
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new Group created
|
||||
* return array Return data of the new Calendar created
|
||||
*/
|
||||
public function create($arrayData)
|
||||
{
|
||||
|
||||
@@ -310,7 +310,6 @@ class CaseScheduler
|
||||
$sDaysPerformTask = '';
|
||||
$sWeeks = '';
|
||||
$sMonths = '';
|
||||
$sMonths = '';
|
||||
$sStartDay = '';
|
||||
$nSW = 0;
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = '';
|
||||
@@ -609,7 +608,6 @@ class CaseScheduler
|
||||
$sDaysPerformTask = '';
|
||||
$sWeeks = '';
|
||||
$sMonths = '';
|
||||
$sMonths = '';
|
||||
$sStartDay = '';
|
||||
$nSW = 0;
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = '';
|
||||
|
||||
@@ -276,7 +276,7 @@ class Cases
|
||||
//Complete empty values
|
||||
$applicationUid = $data["APP_UID"]; //APP_UID
|
||||
//Get all the indexes returned by Solr as columns
|
||||
for($i = count($columsToInclude); $i <= count($data) - 1; $i++) {
|
||||
for ($i = count($columsToInclude); $i <= count($data) - 1; $i++) {
|
||||
if (is_array($data[$columsToIncludeFinal[$i]])) {
|
||||
foreach ($data[$columsToIncludeFinal[$i]] as $delIndex) {
|
||||
$delIndexes[] = $delIndex;
|
||||
@@ -305,8 +305,7 @@ class Cases
|
||||
foreach ($indexes as $index) {
|
||||
$row = $aaappsDBData[$index];
|
||||
}
|
||||
if(!isset($row))
|
||||
{
|
||||
if (!isset($row)) {
|
||||
continue;
|
||||
}
|
||||
\G::LoadClass('wsBase');
|
||||
@@ -501,7 +500,7 @@ class Cases
|
||||
$oDataset->next();
|
||||
}
|
||||
//Return
|
||||
if(empty($result)) {
|
||||
if (empty($result)) {
|
||||
throw (new \Exception('Incorrect or unavailable information about this case: ' .$applicationUid));
|
||||
} else {
|
||||
return $result;
|
||||
|
||||
@@ -14,10 +14,6 @@ class InputDocument
|
||||
public function getCasesInputDocuments($applicationUid, $userUid)
|
||||
{
|
||||
try {
|
||||
$oApplication = \ApplicationPeer::retrieveByPk($applicationUid);
|
||||
if (!is_object($oApplication)) {
|
||||
throw (new \Exception("The Application with app_uid: '$applicationUid' doesn't exist!"));
|
||||
}
|
||||
$sApplicationUID = $applicationUid;
|
||||
$sUserUID = $userUid;
|
||||
\G::LoadClass('case');
|
||||
@@ -62,10 +58,6 @@ class InputDocument
|
||||
public function getCasesInputDocument($applicationUid, $userUid, $inputDocumentUid)
|
||||
{
|
||||
try {
|
||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
|
||||
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
|
||||
throw (new \Exception('This input document with inp_doc_uid: '.$inputDocumentUid.' doesn\'t exist!'));
|
||||
}
|
||||
$sApplicationUID = $applicationUid;
|
||||
$sUserUID = $userUid;
|
||||
\G::LoadClass('case');
|
||||
@@ -90,6 +82,10 @@ class InputDocument
|
||||
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
|
||||
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
|
||||
if ($docrow['app_doc_uid'] == $inputDocumentUid) {
|
||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, $row['DOC_VERSION'] );
|
||||
if (is_null( $oAppDocument )) {
|
||||
throw (new \Exception('This input document with id: '.$inputDocumentUid.' doesn\'t exist!'));
|
||||
}
|
||||
$result = $docrow;
|
||||
}
|
||||
}
|
||||
@@ -183,12 +179,14 @@ class InputDocument
|
||||
//Triggers
|
||||
$arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
|
||||
//Add Input Document
|
||||
if (empty($_FILES)) {
|
||||
throw (new \Exception('This document filename doesn\'t exist!'));
|
||||
}
|
||||
if (!$_FILES["form"]["error"]) {
|
||||
$_FILES["form"]["error"] = 0;
|
||||
}
|
||||
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
|
||||
$appDocUid = $case->addInputDocument(
|
||||
$inputDocumentUid,
|
||||
$appDocUid = $case->addInputDocument($inputDocumentUid,
|
||||
$appDocUid,
|
||||
$docVersion,
|
||||
$appDocType,
|
||||
@@ -201,19 +199,15 @@ class InputDocument
|
||||
"xmlform",
|
||||
$_FILES["form"]["name"],
|
||||
$_FILES["form"]["error"],
|
||||
$_FILES["form"]["tmp_name"]
|
||||
);
|
||||
}
|
||||
//Trigger - Execute after - Start
|
||||
$arrayField["APP_DATA"] = $case->executeTriggers(
|
||||
$taskUid,
|
||||
"INPUT_DOCUMENT",
|
||||
$inputDocumentUid,
|
||||
"AFTER",
|
||||
$arrayField["APP_DATA"]
|
||||
);
|
||||
//Trigger - Execute after - End
|
||||
|
||||
$_FILES["form"]["tmp_name"]);
|
||||
}
|
||||
//Trigger - Execute after - Start
|
||||
$arrayField["APP_DATA"] = $case->executeTriggers ($taskUid,
|
||||
"INPUT_DOCUMENT",
|
||||
$inputDocumentUid,
|
||||
"AFTER",
|
||||
$arrayField["APP_DATA"]);
|
||||
//Trigger - Execute after - End
|
||||
//Save data
|
||||
$arrayData = array();
|
||||
$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
|
||||
@@ -228,4 +222,3 @@ class InputDocument
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,10 +56,6 @@ class OutputDocument
|
||||
public function getCasesOutputDocument($applicationUid, $userUid, $applicationDocumentUid)
|
||||
{
|
||||
try {
|
||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, 1 );
|
||||
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
|
||||
throw (new \Exception('This output document with id: '.$applicationDocumentUid.' doesn\'t exist!'));
|
||||
}
|
||||
$sApplicationUID = $applicationUid;
|
||||
$sUserUID = $userUid;
|
||||
\G::LoadClass('case');
|
||||
@@ -84,6 +80,10 @@ class OutputDocument
|
||||
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
|
||||
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
|
||||
if ($docrow['app_doc_uid'] == $applicationDocumentUid) {
|
||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $row['DOC_VERSION'] );
|
||||
if (is_null( $oAppDocument )) {
|
||||
throw (new \Exception('This output document with id: '.$applicationDocumentUid.' doesn\'t exist!'));
|
||||
}
|
||||
$result = $docrow;
|
||||
}
|
||||
}
|
||||
@@ -104,13 +104,14 @@ class OutputDocument
|
||||
public function removeOutputDocument($applicationDocumentUid)
|
||||
{
|
||||
try {
|
||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, 1 );
|
||||
$oAppDocumentVersion = new \AppDocument();
|
||||
$lastDocVersion = $oAppDocumentVersion->getLastAppDocVersion($applicationDocumentUid);
|
||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $lastDocVersion);
|
||||
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
|
||||
throw (new \Exception('This output document with id: '.$applicationDocumentUid.' doesn\'t exist!'));
|
||||
}
|
||||
\G::LoadClass('wsBase');
|
||||
$ws = new \wsBase();
|
||||
$ws->removeDocument($applicationDocumentUid);
|
||||
$aFields = array ('APP_DOC_UID' => $applicationDocumentUid,'DOC_VERSION' => $lastDocVersion,'APP_DOC_STATUS' => 'DELETED');
|
||||
$oAppDocument->update( $aFields );
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -269,6 +270,11 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
$g->sessionVarRestore();
|
||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $aFields['APP_DOC_UID'], $lastDocVersion);
|
||||
if ($oAppDocument->getAppDocStatus() == 'DELETED') {
|
||||
$oAppDocument->setAppDocStatus('ACTIVE');
|
||||
$oAppDocument->save();
|
||||
}
|
||||
$response = $this->getCasesOutputDocument($applicationUid, $userUid, $aFields['APP_DOC_UID']);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -628,3 +634,4 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ class OutputDocument
|
||||
$aData['out_doc_pdf_security_open_password'] = \G::encrypt( $aData['out_doc_pdf_security_open_password'], $outDocUid );
|
||||
$aData['out_doc_pdf_security_owner_password'] = \G::encrypt( $aData['out_doc_pdf_security_owner_password'], $outDocUid );
|
||||
}
|
||||
$this->updateOutputDocument($sProcessUID, $aData, $outDocUid, 1);
|
||||
$this->updateOutputDocument($sProcessUID, $aData, 1, $outDocUid);
|
||||
//Return
|
||||
unset($aData["PRO_UID"]);
|
||||
$aData = array_change_key_case($aData, CASE_LOWER);
|
||||
@@ -287,7 +287,7 @@ class OutputDocument
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function updateOutputDocument($sProcessUID, $aData, $sOutputDocumentUID = '', $sFlag)
|
||||
public function updateOutputDocument($sProcessUID, $aData, $sFlag, $sOutputDocumentUID = '')
|
||||
{
|
||||
$oConnection = \Propel::getConnection(\OutputDocumentPeer::DATABASE_NAME);
|
||||
$pemission = $aData['out_doc_pdf_security_permissions'];
|
||||
@@ -309,7 +309,7 @@ class OutputDocument
|
||||
if (isset($aData['OUT_DOC_TITLE'])) {
|
||||
$uid = $this->titleExists($sProcessUID, $aData["OUT_DOC_TITLE"]);
|
||||
if ($uid != '') {
|
||||
if ($uid != $sOutputDocumentUID && $sFlag == 0) {
|
||||
if ($uid != $sOutputDocumentUID && $sFlag == 0) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_OUTPUT_NOT_SAVE")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1456,39 +1456,6 @@ class Process
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all Web Entries of a Process
|
||||
*
|
||||
* @param string $processUid Unique id of Process
|
||||
*
|
||||
* return array Return an array with all Web Entries of a Process
|
||||
*/
|
||||
public function getWebEntries($processUid)
|
||||
{
|
||||
try {
|
||||
$arrayWebEntry = array();
|
||||
|
||||
//Verify data
|
||||
//Get data
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$webEntry->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
$arrayWebEntryData = $webEntry->getData($processUid);
|
||||
|
||||
foreach ($arrayWebEntryData as $index => $value) {
|
||||
$row = $value;
|
||||
|
||||
$arrayWebEntry[] = $webEntry->getWebEntryDataFromRecord($row);
|
||||
}
|
||||
|
||||
//Return
|
||||
return $arrayWebEntry;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field names which are primary key in a PM Table
|
||||
*
|
||||
|
||||
@@ -1031,3 +1031,4 @@ class ProcessSupervisor
|
||||
$oCriteria->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ class ProjectUser
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function postProjectWsUserCanStartTask($sProcessUID, $sActivityUID, $oData)
|
||||
public function projectWsUserCanStartTask($sProcessUID, $sActivityUID, $oData)
|
||||
{
|
||||
try {
|
||||
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
|
||||
|
||||
@@ -207,7 +207,6 @@ class User
|
||||
public function create($arrayData)
|
||||
{
|
||||
try {
|
||||
global $RBAC;
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
$form = $arrayData;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,3 +81,4 @@ class InputDocument extends Api
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,4 +78,4 @@ class OutputDocument extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,26 +175,6 @@ class Project extends Api
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/web-entries
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetWebEntries($prj_uid)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $process->getWebEntries($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/variables
|
||||
*
|
||||
|
||||
@@ -86,7 +86,7 @@ class OutputDocuments extends Api
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->updateOutputDocument($prjUid, $request_data, $outputDocumentUid, 0);
|
||||
$outputDocument->updateOutputDocument($prjUid, $request_data, 0, $outputDocumentUid);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
|
||||
@@ -81,7 +81,7 @@ class ProjectUsers extends Api
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$user = new \ProcessMaker\BusinessModel\ProjectUser();
|
||||
$objectData = $user->postProjectWsUserCanStartTask($prj_uid, $act_uid, $request_data);
|
||||
$objectData = $user->projectWsUserCanStartTask($prj_uid, $act_uid, $request_data);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -11,21 +11,51 @@ use \Luracast\Restler\RestException;
|
||||
*/
|
||||
class WebEntry extends Api
|
||||
{
|
||||
private $webEntry;
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/web-entry/:tas_uid/:dyn_uid
|
||||
* Constructor of the class
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* return void
|
||||
*/
|
||||
public function doGetWebEntry($dyn_uid, $tas_uid, $prj_uid)
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase(false);
|
||||
$webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
$this->webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
|
||||
$response = $webEntry->getWebEntry($prj_uid, $tas_uid, $dyn_uid);
|
||||
$this->webEntry->setFormatFieldNameInUppercase(false);
|
||||
$this->webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/web-entries
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetWebEntries($prj_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->webEntry->getWebEntries($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/web-entry/:we_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $we_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetWebEntry($prj_uid, $we_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->webEntry->getWebEntry($we_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -44,11 +74,7 @@ class WebEntry extends Api
|
||||
public function doPostWebEntry($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase(false);
|
||||
$webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $webEntry->create($prj_uid, $request_data);
|
||||
$arrayData = $this->webEntry->create($prj_uid, $this->getUserId(), $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
@@ -59,20 +85,31 @@ class WebEntry extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/web-entry/:tas_uid/:dyn_uid
|
||||
* @url PUT /:prj_uid/web-entry/:we_uid
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $we_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doDeleteWebEntry($dyn_uid, $tas_uid, $prj_uid)
|
||||
public function doPutWebEntry($prj_uid, $we_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase(false);
|
||||
$webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
$arrayData = $this->webEntry->update($we_uid, $this->getUserId(), $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
$webEntry->delete($prj_uid, $tas_uid, $dyn_uid);
|
||||
/**
|
||||
* @url DELETE /:prj_uid/web-entry/:we_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $we_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteWebEntry($prj_uid, $we_uid)
|
||||
{
|
||||
try {
|
||||
$this->webEntry->delete($we_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user