Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
380
workflow/engine/src/BusinessModel/OutputDocument.php
Normal file
380
workflow/engine/src/BusinessModel/OutputDocument.php
Normal file
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
|
||||
use \G;
|
||||
|
||||
class OutputDocument
|
||||
{
|
||||
/**
|
||||
* Return output documents of a project
|
||||
* @param string $sProcessUID
|
||||
* @return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getOutputDocuments($sProcessUID = '')
|
||||
{
|
||||
try {
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_UID);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LANDSCAPE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_MEDIA);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LEFT_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TOP_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_GENERATE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_CURRENT_REVISION);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_FIELD_MAPPING);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_VERSIONING);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_DESTINATION_PATH);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TAGS);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS);
|
||||
$oCriteria->addAsColumn('OUT_DOC_TITLE', 'C1.CON_VALUE');
|
||||
$oCriteria->addAsColumn('OUT_DOC_DESCRIPTION', 'C2.CON_VALUE');
|
||||
$oCriteria->addAsColumn('OUT_DOC_FILENAME', 'C3.CON_VALUE');
|
||||
$oCriteria->addAsColumn('OUT_DOC_TEMPLATE', 'C4.CON_VALUE');
|
||||
$oCriteria->addAlias('C1', 'CONTENT');
|
||||
$oCriteria->addAlias('C2', 'CONTENT');
|
||||
$oCriteria->addAlias('C3', 'CONTENT');
|
||||
$oCriteria->addAlias('C4', 'CONTENT'); $aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C1.CON_ID' );
|
||||
$aConditions[] = array('C1.CON_CATEGORY', $sDelimiter . 'OUT_DOC_TITLE' . $sDelimiter );
|
||||
$aConditions[] = array('C1.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C2.CON_ID' );
|
||||
$aConditions[] = array('C2.CON_CATEGORY', $sDelimiter . 'OUT_DOC_DESCRIPTION' . $sDelimiter );
|
||||
$aConditions[] = array('C2.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C3.CON_ID' );
|
||||
$aConditions[] = array('C3.CON_CATEGORY', $sDelimiter . 'OUT_DOC_FILENAME' . $sDelimiter );
|
||||
$aConditions[] = array('C3.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C4.CON_ID' );
|
||||
$aConditions[] = array('C4.CON_CATEGORY', $sDelimiter . 'OUT_DOC_TEMPLATE' . $sDelimiter );
|
||||
$aConditions[] = array('C4.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
|
||||
$oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$outputDocArray = array();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
if (($aRow['OUT_DOC_TITLE'] == null) || ($aRow['OUT_DOC_TITLE'] == "")) {
|
||||
// There is no transaltion for this Document name, try to get/regenerate the label
|
||||
$outputDocument = new \OutputDocument();
|
||||
$outputDocumentObj = $outputDocument->load($aRow['OUT_DOC_UID']);
|
||||
$aRow['OUT_DOC_TITLE'] = $outputDocumentObj['OUT_DOC_TITLE'];
|
||||
$aRow['OUT_DOC_DESCRIPTION'] = $outputDocumentObj['OUT_DOC_DESCRIPTION'];
|
||||
} else {
|
||||
$outputDocArray[] = array('out_doc_uid' => $aRow['OUT_DOC_UID'],
|
||||
'out_doc_title' => $aRow['OUT_DOC_TITLE'],
|
||||
'out_doc_description' => $aRow['OUT_DOC_DESCRIPTION'],
|
||||
'out_doc_filename' => $aRow['OUT_DOC_FILENAME'],
|
||||
'out_doc_template' => $aRow['OUT_DOC_TEMPLATE'],
|
||||
'out_doc_report_generator ' => $aRow['OUT_DOC_REPORT_GENERATOR'],
|
||||
'out_doc_landscape ' => $aRow['OUT_DOC_LANDSCAPE'],
|
||||
'out_doc_media ' => $aRow['OUT_DOC_MEDIA'],
|
||||
'out_doc_left_margin ' => $aRow['OUT_DOC_LEFT_MARGIN'],
|
||||
'out_doc_right_margin ' => $aRow['OUT_DOC_RIGHT_MARGIN'],
|
||||
'out_doc_top_margin ' => $aRow['OUT_DOC_TOP_MARGIN'],
|
||||
'out_doc_bottom_margin ' => $aRow['OUT_DOC_BOTTOM_MARGIN'],
|
||||
'out_doc_generate ' => $aRow['OUT_DOC_GENERATE'],
|
||||
'out_doc_type ' => $aRow['OUT_DOC_TYPE'],
|
||||
'out_doc_current_revision ' => $aRow['OUT_DOC_CURRENT_REVISION'],
|
||||
'out_doc_field_mapping ' => $aRow['OUT_DOC_FIELD_MAPPING'],
|
||||
'out_doc_versioning ' => $aRow['OUT_DOC_VERSIONING'],
|
||||
'out_doc_destination_path ' => $aRow['OUT_DOC_DESTINATION_PATH'],
|
||||
'out_doc_tags ' => $aRow['OUT_DOC_TAGS'],
|
||||
'out_doc_pdf_security_enabled ' => $aRow['OUT_DOC_PDF_SECURITY_ENABLED'],
|
||||
'out_doc_pdf_security_open_password ' => $aRow['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'],
|
||||
'out_doc_pdf_security_owner_password ' => $aRow['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'],
|
||||
'out_doc_pdf_security_permission ' => $aRow['OUT_DOC_PDF_SECURITY_PERMISSIONS']);
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
return $outputDocArray;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single output document of a project
|
||||
* @param string $sProcessUID
|
||||
* @param string $sOutputDocumentUID
|
||||
* @return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getOutputDocument($sProcessUID = '', $sOutputDocumentUID = '')
|
||||
{
|
||||
try {
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_UID);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LANDSCAPE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_MEDIA);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_LEFT_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TOP_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_GENERATE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TYPE);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_CURRENT_REVISION);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_FIELD_MAPPING);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_VERSIONING);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_DESTINATION_PATH);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_TAGS);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD);
|
||||
$oCriteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS);
|
||||
$oCriteria->add(\OutputDocumentPeer::OUT_DOC_UID, $sOutputDocumentUID);
|
||||
$oCriteria->addAsColumn('OUT_DOC_TITLE', 'C1.CON_VALUE');
|
||||
$oCriteria->addAsColumn('OUT_DOC_DESCRIPTION', 'C2.CON_VALUE');
|
||||
$oCriteria->addAsColumn('OUT_DOC_FILENAME', 'C3.CON_VALUE');
|
||||
$oCriteria->addAsColumn('OUT_DOC_TEMPLATE', 'C4.CON_VALUE');
|
||||
$oCriteria->addAlias('C1', 'CONTENT');
|
||||
$oCriteria->addAlias('C2', 'CONTENT');
|
||||
$oCriteria->addAlias('C3', 'CONTENT');
|
||||
$oCriteria->addAlias('C4', 'CONTENT');
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C1.CON_ID' );
|
||||
$aConditions[] = array('C1.CON_CATEGORY', $sDelimiter . 'OUT_DOC_TITLE' . $sDelimiter );
|
||||
$aConditions[] = array('C1.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C2.CON_ID' );
|
||||
$aConditions[] = array('C2.CON_CATEGORY', $sDelimiter . 'OUT_DOC_DESCRIPTION' . $sDelimiter );
|
||||
$aConditions[] = array('C2.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C3.CON_ID' );
|
||||
$aConditions[] = array('C3.CON_CATEGORY', $sDelimiter . 'OUT_DOC_FILENAME' . $sDelimiter );
|
||||
$aConditions[] = array('C3.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\OutputDocumentPeer::OUT_DOC_UID, 'C4.CON_ID' );
|
||||
$aConditions[] = array('C4.CON_CATEGORY', $sDelimiter . 'OUT_DOC_TEMPLATE' . $sDelimiter );
|
||||
$aConditions[] = array('C4.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
|
||||
$oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$outputDocArray = array();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
if (($aRow['OUT_DOC_TITLE'] == null) || ($aRow['OUT_DOC_TITLE'] == "")) {
|
||||
// There is no transaltion for this Document name, try to get/regenerate the label
|
||||
$outputDocument = new \OutputDocument();
|
||||
$outputDocumentObj = $outputDocument->load($aRow['OUT_DOC_UID']);
|
||||
$aRow['OUT_DOC_TITLE'] = $outputDocumentObj['OUT_DOC_TITLE'];
|
||||
$aRow['OUT_DOC_DESCRIPTION'] = $outputDocumentObj['OUT_DOC_DESCRIPTION'];
|
||||
} else {
|
||||
$outputDocArray[] = array('out_doc_uid' => $aRow['OUT_DOC_UID'],
|
||||
'out_doc_title' => $aRow['OUT_DOC_TITLE'],
|
||||
'out_doc_description' => $aRow['OUT_DOC_DESCRIPTION'],
|
||||
'out_doc_filename' => $aRow['OUT_DOC_FILENAME'],
|
||||
'out_doc_template' => $aRow['OUT_DOC_TEMPLATE'],
|
||||
'out_doc_report_generator ' => $aRow['OUT_DOC_REPORT_GENERATOR'],
|
||||
'out_doc_landscape ' => $aRow['OUT_DOC_LANDSCAPE'],
|
||||
'out_doc_media ' => $aRow['OUT_DOC_MEDIA'],
|
||||
'out_doc_left_margin ' => $aRow['OUT_DOC_LEFT_MARGIN'],
|
||||
'out_doc_right_margin ' => $aRow['OUT_DOC_RIGHT_MARGIN'],
|
||||
'out_doc_top_margin ' => $aRow['OUT_DOC_TOP_MARGIN'],
|
||||
'out_doc_bottom_margin ' => $aRow['OUT_DOC_BOTTOM_MARGIN'],
|
||||
'out_doc_generate ' => $aRow['OUT_DOC_GENERATE'],
|
||||
'out_doc_type ' => $aRow['OUT_DOC_TYPE'],
|
||||
'out_doc_current_revision ' => $aRow['OUT_DOC_CURRENT_REVISION'],
|
||||
'out_doc_field_mapping ' => $aRow['OUT_DOC_FIELD_MAPPING'],
|
||||
'out_doc_versioning ' => $aRow['OUT_DOC_VERSIONING'],
|
||||
'out_doc_destination_path ' => $aRow['OUT_DOC_DESTINATION_PATH'],
|
||||
'out_doc_tags ' => $aRow['OUT_DOC_TAGS'],
|
||||
'out_doc_pdf_security_enabled ' => $aRow['OUT_DOC_PDF_SECURITY_ENABLED'],
|
||||
'out_doc_pdf_security_open_password ' => $aRow['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'],
|
||||
'out_doc_pdf_security_owner_password ' => $aRow['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'],
|
||||
'out_doc_pdf_security_permission ' => $aRow['OUT_DOC_PDF_SECURITY_PERMISSIONS']);
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
return $outputDocArray;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new output document for a project
|
||||
* @param string $sProcessUID
|
||||
* @param array $aData
|
||||
* @return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function addOutputDocument($sProcessUID, $aData)
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "OutputDocument.php");
|
||||
$aData = array_change_key_case($aData, CASE_UPPER);
|
||||
$aData['PRO_UID'] = $sProcessUID;
|
||||
//Verify data
|
||||
$process = new \Process();
|
||||
if (!$process->exists($sProcessUID)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($sProcessUID, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
if (isset($aData["OUT_DOC_TITLE"]) && $this->existsTitle($sProcessUID, $aData["OUT_DOC_TITLE"])) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_OUTPUT_NOT_SAVE")));
|
||||
}
|
||||
$oOutputDocument = new \OutputDocument();
|
||||
if (isset( $aData['OUT_DOC_TITLE'] ) && $aData['OUT_DOC_TITLE'] != '') {
|
||||
if (isset( $aData['OUT_DOC_PDF_SECURITY_ENABLED'] ) && $aData['OUT_DOC_PDF_SECURITY_ENABLED'] == "0") {
|
||||
$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = "";
|
||||
$aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = "";
|
||||
$aData['OUT_DOC_PDF_SECURITY_PERMISSIONS'] = "";
|
||||
}
|
||||
if (isset( $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] ) && $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] != "") {
|
||||
$aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'] = \G::encrypt( $aData['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD'], $aData['OUT_DOC_UID'] );
|
||||
$aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'] = \G::encrypt( $aData['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD'], $aData['OUT_DOC_UID'] );
|
||||
}
|
||||
}
|
||||
if ($aData['OUT_DOC_UID'] == '') {
|
||||
$outDocUid = $oOutputDocument->create($aData);
|
||||
}
|
||||
//Return
|
||||
unset($aData["PRO_UID"]);
|
||||
$aData = array_change_key_case($aData, CASE_LOWER);
|
||||
$aData["out_doc_uid"] = $outDocUid;
|
||||
return $aData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a output document for a project
|
||||
* @param string $sProcessUID
|
||||
* @param string $sOutputDocumentUID
|
||||
* @param array $aData
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function updateOutputDocument($sProcessUID, $sOutputDocumentUID = '', $aData)
|
||||
{ $oConnection = \Propel::getConnection(\OutputDocumentPeer::DATABASE_NAME);
|
||||
try {
|
||||
$oOutputDocument = \OutputDocumentPeer::retrieveByPK($sOutputDocumentUID);
|
||||
if (!is_null($oOutputDocument)) {
|
||||
$oOutputDocument->fromArray($aData, \BasePeer::TYPE_FIELDNAME);
|
||||
if ($oOutputDocument->validate()) {
|
||||
$oConnection->begin();
|
||||
if (isset($aData['out_doc_title'])) {
|
||||
$oOutputDocument->setOutDocTitle($aData['out_doc_title']);
|
||||
}
|
||||
if (isset($aData['out_doc_description'])) {
|
||||
$oOutputDocument->setOutDocDescription($aData['out_doc_description']);
|
||||
}
|
||||
if (isset($aData['out_doc_filename'])) {
|
||||
$oOutputDocument->setOutDocFilename($aData['out_doc_filename']);
|
||||
}
|
||||
if (isset($aData['out_doc_template'])) {
|
||||
$oOutputDocument->setOutDocTemplate($aData['out_doc_template']);
|
||||
}
|
||||
$iResult = $oOutputDocument->save();
|
||||
$oConnection->commit();
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oOutputDocument->getValidationFailures();
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
$sMessage .= $oValidationFailure->getMessage();
|
||||
}
|
||||
throw (new \Exception('The registry cannot be updated!' . $sMessage));
|
||||
}
|
||||
} else {
|
||||
throw (new \Exception('This row doesn\'t exist!'));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a output document of a project
|
||||
*
|
||||
* @param string $sProcessUID
|
||||
* @param string $sOutputDocumentUID
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function deleteOutputDocument($sProcessUID, $sOutputDocumentUID)
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "OutputDocument.php");
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "ObjectPermission.php");
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Step.php");
|
||||
\G::LoadClass( 'processMap' );
|
||||
$oOutputDocument = new \OutputDocument();
|
||||
$fields = $oOutputDocument->load( $sOutputDocumentUID );
|
||||
$oOutputDocument->remove( $sOutputDocumentUID );
|
||||
$oStep = new \Step();
|
||||
$oStep->removeStep( 'OUTPUT_DOCUMENT', $sOutputDocumentUID );
|
||||
$oOP = new \ObjectPermission();
|
||||
$oOP->removeByObject( 'OUTPUT', $sOutputDocumentUID );
|
||||
//refresh dbarray with the last change in outputDocument
|
||||
$oMap = new \processMap();
|
||||
$oCriteria = $oMap->getOutputDocumentsCriteria( $fields['PRO_UID'] );
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the title exists in the InputDocuments of Process
|
||||
*
|
||||
* @param string $processUid Unique id of Process
|
||||
* @param string $title Title
|
||||
* @param string $inputDocumentUidExclude Unique id of InputDocument to exclude
|
||||
*
|
||||
* return bool Return true if the title exists in the InputDocuments of Process, false otherwise
|
||||
*/
|
||||
public function existsTitle($processUid, $title)
|
||||
{
|
||||
try {
|
||||
$delimiter = \DBAdapter::getStringDelimiter();
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_UID);
|
||||
$criteria->addAlias("CT", "CONTENT");
|
||||
$arrayCondition = array();
|
||||
$arrayCondition[] = array(\OutputDocumentPeer::OUT_DOC_UID, "CT.CON_ID", \Criteria::EQUAL);
|
||||
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "OUT_DOC_TITLE" . $delimiter, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
|
||||
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
|
||||
$criteria->add(\OutputDocumentPeer::PRO_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ContentPeer::CON_VALUE, $title, \Criteria::EQUAL);
|
||||
$rsCriteria = \OutputDocumentPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsCriteria->next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -861,23 +861,52 @@ class Task
|
||||
{
|
||||
try {
|
||||
$iType = 1;
|
||||
$oTaskUser = new \TaskUser();
|
||||
if ($assType == "user") {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 1));
|
||||
return array('aas_uid' => $sAssigneeUID,
|
||||
'aas_type' => $assType);
|
||||
} else {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 2));
|
||||
return array('aas_uid' => $sAssigneeUID,
|
||||
'aas_type' => $assType);
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );
|
||||
$oCriteria->add(\TaskUserPeer::USR_UID, $sAssigneeUID );
|
||||
$oCriteria->add(\TaskUserPeer::TAS_UID, $sTaskUID );
|
||||
$oCriteria->add(\TaskUserPeer::TU_TYPE, $iType );
|
||||
$oTaskUser = \TaskUserPeer::doSelectRS( $oCriteria );
|
||||
$oTaskUser->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
while ($oTaskUser->next()) {
|
||||
$aRow = $oTaskUser->getRow();
|
||||
$iRelation = $aRow['TU_RELATION'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$oTaskUser = \TaskUserPeer::retrieveByPK( $sTaskUID, $sAssigneeUID, $iType, $iRelation );
|
||||
if (! is_null( $oTaskUser )) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' is already assigned to task: ' . $sTaskUID ));
|
||||
} else {
|
||||
$oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sAssigneeUID );
|
||||
$oTypeAssigneeU = \UsersPeer::retrieveByPK( $sAssigneeUID );
|
||||
if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' do not correspond to a registered ' .$assType ));
|
||||
}
|
||||
if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
|
||||
$type = "user";
|
||||
if ( $type != $assType ) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' do not correspond to a registered ' .$assType ));
|
||||
}
|
||||
}
|
||||
if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
|
||||
$type = "group";
|
||||
if ( $type != $assType ) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' do not correspond to a registered ' .$assType ));
|
||||
}
|
||||
}
|
||||
$oTaskUser = new \TaskUser();
|
||||
if ( $assType == "user" ) {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 1));
|
||||
} else {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 2));
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1199,23 +1228,52 @@ class Task
|
||||
{
|
||||
try {
|
||||
$iType = 2;
|
||||
$oTaskUser = new \TaskUser();
|
||||
if ($assType == "user") {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 1));
|
||||
return array('aas_uid' => $sAssigneeUID,
|
||||
'aas_type' => $assType);
|
||||
} else {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 2));
|
||||
return array('aas_uid' => $sAssigneeUID,
|
||||
'aas_type' => $assType);
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );
|
||||
$oCriteria->add(\TaskUserPeer::USR_UID, $sAssigneeUID );
|
||||
$oCriteria->add(\TaskUserPeer::TAS_UID, $sTaskUID );
|
||||
$oCriteria->add(\TaskUserPeer::TU_TYPE, $iType );
|
||||
$oTaskUser = \TaskUserPeer::doSelectRS( $oCriteria );
|
||||
$oTaskUser->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
while ($oTaskUser->next()) {
|
||||
$aRow = $oTaskUser->getRow();
|
||||
$iRelation = $aRow['TU_RELATION'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$oTaskUser = \TaskUserPeer::retrieveByPK( $sTaskUID, $sAssigneeUID, $iType, $iRelation );
|
||||
if (! is_null( $oTaskUser )) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' is already assigned to task: ' . $sTaskUID ));
|
||||
} else {
|
||||
$oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sAssigneeUID );
|
||||
$oTypeAssigneeU = \UsersPeer::retrieveByPK( $sAssigneeUID );
|
||||
if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' do not correspond to a registered ' .$assType ));
|
||||
}
|
||||
if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) {
|
||||
$type = "user";
|
||||
if ( $type != $assType ) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' do not correspond to a registered ' .$assType ));
|
||||
}
|
||||
}
|
||||
if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) {
|
||||
$type = "group";
|
||||
if ( $type != $assType ) {
|
||||
throw (new \Exception( 'This id: '. $sAssigneeUID .' do not correspond to a registered ' .$assType ));
|
||||
}
|
||||
}
|
||||
$oTaskUser = new \TaskUser();
|
||||
if ( $assType == "user" ) {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 1));
|
||||
} else {
|
||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||
'USR_UID' => $sAssigneeUID,
|
||||
'TU_TYPE' => $iType,
|
||||
'TU_RELATION' => 2));
|
||||
}
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1230,7 +1288,7 @@ class Task
|
||||
* @access public
|
||||
*/
|
||||
public function removeTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
|
||||
{
|
||||
{
|
||||
try {
|
||||
$iType = 2;
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
@@ -1246,12 +1304,13 @@ class Task
|
||||
}
|
||||
$oTaskUser = \TaskUserPeer::retrieveByPK($sTaskUID, $sAssigneeUID, $iType, $iRelation);
|
||||
if (! is_null( $oTaskUser )) {
|
||||
\TaskUserPeer::doDelete($oCriteria);
|
||||
OutputDocumentsTaskUserPeer::doDelete($oCriteria);
|
||||
} else {
|
||||
throw (new \Exception( 'This row does not exist!' ));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,10 +82,14 @@ class Trigger
|
||||
|
||||
/**
|
||||
* List of Triggers in process
|
||||
* @var string $sProcessUID. Uid for Process
|
||||
*
|
||||
* return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTriggersCriteria($sProcessUID = '')
|
||||
public function getTriggers($sProcessUID = '')
|
||||
{
|
||||
$criteria = $this->getTriggerCriteria();
|
||||
|
||||
@@ -96,7 +100,7 @@ class Trigger
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$oDataset->next();
|
||||
$triggersArray = "";
|
||||
$triggersArray = array();
|
||||
//$triggersArray[] = array('TRI_UID' => 'char', 'PRO_UID' => 'char', 'TRI_TITLE' => 'char', 'TRI_DESCRIPTION' => 'char');
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
if (($aRow['TRI_TITLE'] == null) || ($aRow['TRI_TITLE'] == "")) {
|
||||
@@ -114,8 +118,12 @@ class Trigger
|
||||
|
||||
/**
|
||||
* Get data for TriggerUid
|
||||
* @var string $sTriggerUID. Uid for Trigger
|
||||
*
|
||||
* return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDataTrigger($sTriggerUID = '')
|
||||
{
|
||||
@@ -131,7 +139,12 @@ class Trigger
|
||||
|
||||
/**
|
||||
* Delete Trigger
|
||||
* @var string $sTriggerUID. Uid for Trigger
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteTrigger($sTriggerUID = '')
|
||||
{
|
||||
@@ -145,7 +158,15 @@ class Trigger
|
||||
|
||||
/**
|
||||
* Save Data for Trigger
|
||||
* @var string $sProcessUID. Uid for Process
|
||||
* @var string $dataTrigger. Data for Trigger
|
||||
* @var string $create. Create o Update Trigger
|
||||
* @var string $sTriggerUid. Uid for Trigger
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function saveTrigger($sProcessUID = '', $dataTrigger = array(), $create = false, $sTriggerUid = '')
|
||||
{
|
||||
@@ -185,12 +206,19 @@ class Trigger
|
||||
}
|
||||
return $dataResp;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify name for trigger in process
|
||||
* @var string $sProcessUID. Uid for Process
|
||||
* @var string $sTriggerName. Name for Trigger
|
||||
* @var string $sTriggerUid. Uid for Trigger
|
||||
*
|
||||
* return boolean
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function verifyNameTrigger($sProcessUID, $sTriggerName, $sTriggerUid = '')
|
||||
{
|
||||
|
||||
@@ -99,8 +99,6 @@ class Assignee extends Api
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$arrayData = $task->addTaskAssignee($prjUid, $actUid, $ass_uid, $ass_type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
@@ -138,7 +136,7 @@ class Assignee extends Api
|
||||
* @param int $limit
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAdhocAssignees($prjUid, $actUid, $filter = '', $start = '1', $limit = '50')
|
||||
public function doGetActivityAdhocAssignees($prjUid, $actUid, $filter = '', $start = '0', $limit = '50')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
@@ -163,7 +161,7 @@ class Assignee extends Api
|
||||
* @param int $limit
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAvailableAdhocAssignee($prjUid, $actUid, $filter = '', $start = '1', $limit = '50')
|
||||
public function doGetActivityAvailableAdhocAssignee($prjUid, $actUid, $filter = '', $start = '0', $limit = '50')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
@@ -216,8 +214,6 @@ class Assignee extends Api
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$arrayData = $task->addTaskAdhocAssignee($prjUid, $actUid, $ass_uid, $ass_type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
@@ -235,7 +231,6 @@ class Assignee extends Api
|
||||
*/
|
||||
public function doDeleteActivityAdhocAssignee($prjUid, $actUid, $assUid)
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$arrayData = $task->removeTaskAdhocAssignee($prjUid, $actUid, $assUid);
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\OutputDocuments Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class OutputDocuments extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/output-documents
|
||||
*/
|
||||
public function doGetProjectOutputDocuments($prjUid)
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->getOutputDocuments($prjUid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $outputDocumentUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/output-document/:outputDocumentUid
|
||||
*/
|
||||
public function doGetProjectOutputDocument($prjUid, $outputDocumentUid)
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->getOutputDocument($prjUid, $outputDocumentUid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/output-document
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param OutputDocumentStructure $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostProjectOutputDocument($prjUid, OutputDocumentStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$outputDocument = new \BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->addOutputDocument($prjUid, $request_data);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prjUid/output-document/:outputDocumentUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $outputDocumentUid {@min 32} {@max 32}
|
||||
* @param OutputDocumentStructure $request_data
|
||||
*
|
||||
*/
|
||||
public function doPutProjectOutputDocument($prjUid, $outputDocumentUid, OutputDocumentStructure $request_data)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$outputDocument = new \BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->updateOutputDocument($prjUid, $outputDocumentUid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/output-document/:outputDocumentUid
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $outputDocumentUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteProjectOutputDocument($prjUid, $outputDocumentUid)
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->deleteOutputDocument($prjUid, $outputDocumentUid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class OutputDocumentStructure
|
||||
{ /**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_title;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_description;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_filename;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_template;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 10}
|
||||
*/
|
||||
public $out_doc_report_generator;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_landscape;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 10}
|
||||
*/
|
||||
public $out_doc_media;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_left_margin;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_right_margin;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_top_margin;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_bottom_margin;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 10}
|
||||
*/
|
||||
public $out_doc_generate;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 32}
|
||||
*/
|
||||
public $out_doc_type;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_current_revision;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_field_mapping;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_versioning;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_destination_path;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_tags;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_pdf_security_enabled;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_pdf_security_open_password;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_pdf_security_owner_password;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_pdf_security_permission;
|
||||
|
||||
}
|
||||
@@ -7,6 +7,9 @@ use \Luracast\Restler\RestException;
|
||||
/**
|
||||
* Project\Activity\Step\Trigger Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Trigger extends Api
|
||||
@@ -14,13 +17,17 @@ class Trigger extends Api
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:projectUid/triggers
|
||||
*/
|
||||
public function doGetTriggers($projectUid)
|
||||
{
|
||||
try {
|
||||
$trigger = new \BusinessModel\Trigger();
|
||||
$response = $trigger->getTriggersCriteria($projectUid);
|
||||
$response = $trigger->getTriggers($projectUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -30,6 +37,9 @@ class Trigger extends Api
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $triggerUid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:projectUid/trigger/:triggerUid
|
||||
*/
|
||||
@@ -52,6 +62,10 @@ class Trigger extends Api
|
||||
* @param string $tri_type {@from body} {@choice SCRIPT}
|
||||
* @param string $tri_webbot {@from body}
|
||||
* @param string $tri_param {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:projectUid/trigger
|
||||
*/
|
||||
@@ -75,6 +89,10 @@ class Trigger extends Api
|
||||
* @param string $tri_type {@from body} {@choice SCRIPT}
|
||||
* @param string $tri_webbot {@from body}
|
||||
* @param string $tri_param {@from body}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:projectUid/trigger/:triggerUid
|
||||
*/
|
||||
@@ -92,7 +110,11 @@ class Trigger extends Api
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $triggerUid {@min 1} {@max 32}
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:projectUid/trigger/:triggerUid
|
||||
*/
|
||||
public function doDeleteTrigger($projectUid, $triggerUid)
|
||||
@@ -100,7 +122,6 @@ class Trigger extends Api
|
||||
try {
|
||||
$trigger = new \BusinessModel\Trigger();
|
||||
$response = $trigger->deleteTrigger($triggerUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ debug = 1
|
||||
trigger = "Services\Api\ProcessMaker\Project\Activity\Step\Trigger"
|
||||
project = "Services\Api\ProcessMaker\Project"
|
||||
trigger2 = "Services\Api\ProcessMaker\Project\Trigger"
|
||||
output-documents = "Services\Api\ProcessMaker\Project\OutputDocuments"
|
||||
|
||||
[alias: projects]
|
||||
project = "Services\Api\ProcessMaker\Project"
|
||||
|
||||
Reference in New Issue
Block a user