Merge branch 'master' of bitbucket.org:colosa/processmaker
Conflicts: features/backend/project_activity_resources/activity.feature features/backend/triggers_resources/triggers.feature features/bootstrap/RestContext.php
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Testing events
|
||||
Feature: Events Resources
|
||||
|
||||
@1: TEST FOR POST EVENT /----------------------------------------------------------------------
|
||||
Scenario: Create a event
|
||||
@1: TEST FOR GET EVENTS /----------------------------------------------------------------------
|
||||
Scenario: List all the events (result 0 events)
|
||||
Given that I have a valid access_token
|
||||
And I request "project/251815090529619a99a2bf4013294414/events"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 0 record
|
||||
|
||||
|
||||
@2: TEST FOR POST EVENT /----------------------------------------------------------------------
|
||||
Scenario: Create a new event
|
||||
Given that I have a valid access_token
|
||||
And POST this data:
|
||||
"""
|
||||
@@ -24,8 +33,15 @@ Feature: Testing events
|
||||
Then the response status code should be 201
|
||||
And store "evn_uid" in session array
|
||||
|
||||
@3: TEST FOR GET EVENTS /----------------------------------------------------------------------
|
||||
Scenario: List all the events (result 1 event)
|
||||
Given that I have a valid access_token
|
||||
And I request "project/251815090529619a99a2bf4013294414/events"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 1 record
|
||||
|
||||
@2: TEST FOR PUT EVENT /-----------------------------------------------------------------------
|
||||
@4: TEST FOR PUT EVENT /-----------------------------------------------------------------------
|
||||
Scenario: Update a event
|
||||
Given that I have a valid access_token
|
||||
And PUT this data:
|
||||
@@ -51,8 +67,8 @@ Feature: Testing events
|
||||
And the type is "object"
|
||||
|
||||
|
||||
@3: TEST FOR GET EVENT /-----------------------------------------------------------------------
|
||||
Scenario: Get a event
|
||||
@5: TEST FOR GET EVENT /-----------------------------------------------------------------------
|
||||
Scenario: Get a event (with change in "evn_description")
|
||||
Given that I have a valid access_token
|
||||
And that I want to get a resource with the key "evn_uid" stored in session array
|
||||
And I request "project/251815090529619a99a2bf4013294414/event"
|
||||
@@ -62,11 +78,19 @@ Feature: Testing events
|
||||
And that "evn_description" is set to "change description"
|
||||
|
||||
|
||||
@4: TEST FOR DELETE EVENT /-----------------------------------------------------------------------
|
||||
@6: TEST FOR DELETE EVENT /-----------------------------------------------------------------------
|
||||
Scenario: Delete a event
|
||||
Given that I have a valid access_token
|
||||
And that I want to delete a resource with the key "evn_uid" stored in session array
|
||||
And I request "project/251815090529619a99a2bf4013294414/event"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
And the type is "object"
|
||||
|
||||
@7: TEST FOR GET EVENTS /----------------------------------------------------------------------
|
||||
Scenario: List all the events (result 0 events)
|
||||
Given that I have a valid access_token
|
||||
And I request "project/251815090529619a99a2bf4013294414/events"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 0 record
|
||||
@@ -18,11 +18,81 @@ Feature: Output Documents Resources
|
||||
And the type is "object"
|
||||
|
||||
Scenario: Create a new output document for a project
|
||||
Given this scenario is not implemented yet
|
||||
|
||||
Scenario: Update a output document for a project
|
||||
Given this scenario is not implemented yet
|
||||
|
||||
Scenario: Delete a output document of a project
|
||||
Given this scenario is not implemented yet
|
||||
Given POST this data:
|
||||
"""
|
||||
{
|
||||
"out_doc_title": "Output doc #1",
|
||||
"out_doc_description": "Output doc #1 - Desc",
|
||||
"out_doc_filename": "od_generated_1",
|
||||
"out_doc_template": "",
|
||||
"out_doc_report_generator": "HTML2PDF",
|
||||
"out_doc_landscape": 0,
|
||||
"out_doc_media": "Letter",
|
||||
"out_doc_left_margin": 0,
|
||||
"out_doc_right_margin": 0,
|
||||
"out_doc_top_margin": 0,
|
||||
"out_doc_bottom_margin": 0,
|
||||
"out_doc_generate": "BOTH",
|
||||
"out_doc_type": "HTML",
|
||||
"out_doc_current_revision": 0,
|
||||
"out_doc_field_mapping": "",
|
||||
"out_doc_versioning": 0,
|
||||
"out_doc_destination_path": "",
|
||||
"out_doc_tags": "",
|
||||
"out_doc_pdf_security_enabled": 0,
|
||||
"out_doc_pdf_security_open_password": "",
|
||||
"out_doc_pdf_security_owner_password": "",
|
||||
"out_doc_pdf_security_permissions": ""
|
||||
}
|
||||
"""
|
||||
And I request "project/4224292655297723eb98691001100052/output-document"
|
||||
Then the response status code should be 201
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "object"
|
||||
And store "out_doc_uid" in session array as variable "out_doc_uid"
|
||||
|
||||
Scenario: Update a output document for a project
|
||||
Given PUT this data:
|
||||
"""
|
||||
{
|
||||
"out_doc_title": "Output doc #1",
|
||||
"out_doc_description": "Output doc #1 - Desc DESCRIPTION Modified",
|
||||
"out_doc_filename": "od_generated_1",
|
||||
"out_doc_template": "",
|
||||
"out_doc_report_generator": "HTML2PDF",
|
||||
"out_doc_landscape": 0,
|
||||
"out_doc_media": "Letter",
|
||||
"out_doc_left_margin": 0,
|
||||
"out_doc_right_margin": 0,
|
||||
"out_doc_top_margin": 0,
|
||||
"out_doc_bottom_margin": 0,
|
||||
"out_doc_generate": "BOTH",
|
||||
"out_doc_type": "HTML",
|
||||
"out_doc_current_revision": 0,
|
||||
"out_doc_field_mapping": "",
|
||||
"out_doc_versioning": 0,
|
||||
"out_doc_destination_path": "",
|
||||
"out_doc_tags": "",
|
||||
"out_doc_pdf_security_enabled": 0,
|
||||
"out_doc_pdf_security_open_password": "",
|
||||
"out_doc_pdf_security_owner_password": "",
|
||||
"out_doc_pdf_security_permissions": ""
|
||||
}
|
||||
"""
|
||||
And that I want to update a resource with the key "out_doc_uid" stored in session array
|
||||
And I request "project/4224292655297723eb98691001100052/output-document"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
And that "out_doc_description": "Output doc #1 - Desc DESCRIPTION Modified"
|
||||
|
||||
Scenario: Delete a output document of a project
|
||||
Given that I want to delete a resource with the key "out_doc_uid" stored in session array
|
||||
And I request "project/4224292655297723eb98691001100052/output-document"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
|
||||
|
||||
@@ -155,4 +155,4 @@ Feature: Activity Resources
|
||||
| project | activity | error_code |
|
||||
| 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095200000 | 400 |
|
||||
| 251815090529619a99a2bf4013294414 | | 404 |
|
||||
| | 97192372152a5c78f04a794095806311 | 400 |
|
||||
| | 97192372152a5c78f04a794095806311 | 400 |
|
||||
|
||||
@@ -301,3 +301,150 @@ Feature: Project Properties - Step Resources
|
||||
And the type is "array"
|
||||
And the json data is an empty array
|
||||
|
||||
#TRIGGERS OF STEP "ASSIGN TASK"
|
||||
|
||||
#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers
|
||||
# List assigned Triggers to a Step
|
||||
Scenario: List Triggers assigned to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/triggers"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the json data is an empty array
|
||||
|
||||
#POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger
|
||||
# Assign a Trigger to a Step
|
||||
Scenario: Assign "Trigger Demo1" to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And POST this data:
|
||||
"""
|
||||
{
|
||||
"tri_uid": "81919273152cd636c665080083928728",
|
||||
"st_type": "BEFORE_ASSIGNMENT",
|
||||
"st_condition": "",
|
||||
"st_position": 1
|
||||
}
|
||||
"""
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 201
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
#POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger
|
||||
# Assign a Trigger to a Step
|
||||
Scenario: Assign "Trigger Demo2" to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And POST this data:
|
||||
"""
|
||||
{
|
||||
"tri_uid": "56359776552cd6378b38e47080912028",
|
||||
"st_type": "BEFORE_ASSIGNMENT",
|
||||
"st_condition": "",
|
||||
"st_position": 2
|
||||
}
|
||||
"""
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 201
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
#PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}
|
||||
# Update a Trigger assignation of a Step
|
||||
Scenario: Update "Trigger Demo1" assigned to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And PUT this data:
|
||||
"""
|
||||
{
|
||||
"st_type": "BEFORE_ASSIGNMENT",
|
||||
"st_condition": "@@FIELD2 == 2"
|
||||
}
|
||||
"""
|
||||
And that I want to update a resource with the key "tgr1" stored in session array
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
And that "st_condition" is set to "@@FIELD2 == 2"
|
||||
|
||||
#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers
|
||||
# List assigned Triggers to a Step
|
||||
Scenario: List Triggers assigned to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/triggers"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the "tri_uid" property in row 1 equals "56359776552cd6378b38e47080912028"
|
||||
And the "tri_title" property in row 1 equals "Trigger Demo2"
|
||||
And the "tri_description" property in row 1 equals "Description"
|
||||
And the "st_type" property in row 1 equals "BEFORE_ASSIGNMENT"
|
||||
And the "st_condition" property in row 1 equals ""
|
||||
And the "st_position" property in row 1 equals "2"
|
||||
|
||||
#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/available-triggers/{type}
|
||||
# List available Triggers to assign to a Step
|
||||
Scenario: List available Triggers to assign to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/available-triggers/before-assignment"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the "tri_uid" property in row 0 equals "57401970252cd6393531551040242546"
|
||||
And the "tri_title" property in row 0 equals "Trigger Demo3"
|
||||
And the "tri_description" property in row 0 equals "Description"
|
||||
And the "tri_type" property in row 0 equals "SCRIPT"
|
||||
And the "tri_webbot" property in row 0 equals ""
|
||||
And the "tri_param" property in row 0 equals ""
|
||||
|
||||
#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}
|
||||
# Get a single Trigger assigned to a Step
|
||||
Scenario: Get a single Trigger "Trigger Demo1" assigned to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728/before-assignment"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
And that "tri_uid" is set to "81919273152cd636c665080083928728"
|
||||
And that "tri_title" is set to "Trigger Demo1"
|
||||
And that "tri_description" is set to "Description"
|
||||
And that "st_type" is set to "BEFORE_ASSIGNMENT"
|
||||
And that "st_condition" is set to "@@FIELD2 == 2"
|
||||
And that "st_position" is set to "1"
|
||||
|
||||
#DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}
|
||||
# Remove a Trigger assignation of a Step
|
||||
Scenario: Remove "Trigger Demo1" assigned to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And that I want to delete a resource with the key "tgr1" stored in session array
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728/before-assignment"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
#DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}
|
||||
# Remove a Trigger assignation of a Step
|
||||
Scenario: Remove "Trigger Demo2" assigned to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And that I want to delete a resource with the key "tgr2" stored in session array
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/56359776552cd6378b38e47080912028/before-assignment"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers
|
||||
# List assigned Triggers to a Step
|
||||
Scenario: List Triggers assigned to Step "Assign Task" of "Task2"
|
||||
Given that I have a valid access_token
|
||||
And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/triggers"
|
||||
And the content type is "application/json"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the json data is an empty array
|
||||
|
||||
|
||||
@@ -123,4 +123,4 @@ Feature: Testing triggers
|
||||
| 251815090529619a99a2bf4013294414 | Especial !@#$%^&*(){[/½‘€¤@ | Trigger con caracteres especiales |SCRIPT |
|
||||
| 251815090529619a99a2bf4013294414 | | Trigger con nombre en blanco |SCRIPT |
|
||||
| 251815090529619a99a2bf4013294414 | Trigger 3 | Descripcion con caracteres especiales !@#$%^&*(){[/½‘€¤@ |SCRIPT |
|
||||
| 251815090529619a99a2bf4013294414 | Trigger 4 | descripcion |SCRI123%@$|
|
||||
| 251815090529619a99a2bf4013294414 | Trigger 4 | descripcion |SCRI123%@$|
|
||||
|
||||
@@ -1100,13 +1100,13 @@ class RestContext extends BehatContext
|
||||
public function theResponseHasRecords($quantityOfRecords)
|
||||
{
|
||||
$data = $this->_data;
|
||||
if (!is_array($data)) {
|
||||
throw new Exception("the Response data is not an array!\n\n" );
|
||||
}
|
||||
$currentRecordsCount=count($data);
|
||||
if($currentRecordsCount!=$quantityOfRecords){
|
||||
if (!is_array($data)) {
|
||||
throw new Exception("the Response data is not an array!\n\n" );
|
||||
}
|
||||
$currentRecordsCount=count($data);
|
||||
if($currentRecordsCount!=$quantityOfRecords){
|
||||
throw new Exception('Records quantity not match ' . $quantityOfRecords . ' (actual: ' . $currentRecordsCount . ")\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1171,4 +1171,4 @@ class RestContext extends BehatContext
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
23
features/test/test_scenario_outline.feature
Normal file
23
features/test/test_scenario_outline.feature
Normal file
@@ -0,0 +1,23 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Project Properties - Assignee Resources
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
Scenario Outline: Get a list of available users and groups to be assigned to an activity with filter
|
||||
Given that I want to make a new "test"
|
||||
And his "name" is "<name>"
|
||||
And his "lastname" is "<lastname>"
|
||||
When I request "test"
|
||||
Then the response status code should be 200
|
||||
And the response should be JSON
|
||||
#And that "id" is set to "<id>"
|
||||
And the "id" property equals "<id>"
|
||||
|
||||
Examples:
|
||||
| name | lastname | age | id |
|
||||
| erik | sample1 | 7 | 2 |
|
||||
| wendy | sample2 | 15 | 3 |
|
||||
| wendy2 | sample22 | 15 | 4 |
|
||||
| wendy3 | sample23 | 15 | 5 |
|
||||
|
||||
@@ -3088,6 +3088,14 @@ class Bootstrap
|
||||
"$>php composer.phar install"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (! file_exists(PATH_TRUNK . 'vendor' . PATH_SEP . "autoload.php")) {
|
||||
throw new Exception(
|
||||
"ERROR: Problems with Verdors!" . PHP_EOL .
|
||||
"Please execute the following command to repare vendors:" .PHP_EOL.PHP_EOL.
|
||||
"$>php composer.phar update"
|
||||
);
|
||||
}
|
||||
|
||||
require_once PATH_TRUNK . 'vendor' . PATH_SEP . "autoload.php";
|
||||
|
||||
@@ -21,6 +21,11 @@ class Event
|
||||
*/
|
||||
public function getEvents($sProcessUID, $filter = '', $sEventUID = '')
|
||||
{
|
||||
$oProcess = new \Process();
|
||||
if (!($oProcess->processExists($sProcessUID))) {
|
||||
throw (new \Exception( 'This process doesn\'t exist!' ));
|
||||
}
|
||||
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\EventPeer::EVN_UID);
|
||||
@@ -88,6 +93,12 @@ class Event
|
||||
if ( ($sProcessUID == '') || (count($dataEvent) == 0) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$oProcess = new \Process();
|
||||
if (!($oProcess->processExists($sProcessUID))) {
|
||||
throw (new \Exception( 'This process doesn\'t exist!' ));
|
||||
}
|
||||
|
||||
$dataEvent = array_change_key_case($dataEvent, CASE_UPPER);
|
||||
|
||||
if ( $create && (isset($dataEvent['ENV_UID'])) ) {
|
||||
|
||||
167
workflow/engine/src/BusinessModel/ProcessPermissions.php
Normal file
167
workflow/engine/src/BusinessModel/ProcessPermissions.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \Cases;
|
||||
use \Criteria;
|
||||
use \ObjectPermissionPeer;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
class ProcessPermissions
|
||||
{
|
||||
/**
|
||||
* Get list for ProcessPermissions
|
||||
* @var string $sProcessUID. Uid for Process
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getProcessPermissions($sProcessUID, $sPermissionUid = '')
|
||||
{
|
||||
G::LoadClass('case');
|
||||
Cases::verifyTable();
|
||||
$aObjectsPermissions = array();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
|
||||
if ($sPermissionUid != '') {
|
||||
$oCriteria->add(ObjectPermissionPeer::OP_UID, $sPermissionUid);
|
||||
}
|
||||
$oDataset = ObjectPermissionPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
//Obtain task target
|
||||
if (($aRow['TAS_UID'] != '') && ($aRow['TAS_UID'] != '0')) {
|
||||
try {
|
||||
$oTask = new \Task();
|
||||
$aFields = $oTask->load($aRow['TAS_UID']);
|
||||
$sTaskTarget = $aFields['TAS_TITLE'];
|
||||
} catch (\Exception $oError) {
|
||||
$sTaskTarget = 'All Tasks';
|
||||
}
|
||||
} else {
|
||||
$sTaskTarget = G::LoadTranslation('ID_ANY_TASK');
|
||||
}
|
||||
//Obtain user or group
|
||||
if ($aRow['OP_USER_RELATION'] == 1) {
|
||||
$oUser = new \Users();
|
||||
$aFields = $oUser->load($aRow['USR_UID']);
|
||||
$sUserGroup = $aFields['USR_FIRSTNAME'] . ' ' . $aFields['USR_LASTNAME'] . ' (' . $aFields['USR_USERNAME'] . ')';
|
||||
} else {
|
||||
$oGroup = new \Groupwf();
|
||||
if ($aRow['USR_UID'] != '') {
|
||||
try {
|
||||
$aFields = $oGroup->load($aRow['USR_UID']);
|
||||
$sUserGroup = $aFields['GRP_TITLE'];
|
||||
} catch (\Exception $oError) {
|
||||
$sUserGroup = '(GROUP DELETED)';
|
||||
}
|
||||
} else {
|
||||
$sUserGroup = G::LoadTranslation('ID_ANY');
|
||||
}
|
||||
}
|
||||
//Obtain task source
|
||||
if (($aRow['OP_TASK_SOURCE'] != '') && ($aRow['OP_TASK_SOURCE'] != '0')) {
|
||||
try {
|
||||
$oTask = new \Task();
|
||||
$aFields = $oTask->load($aRow['OP_TASK_SOURCE']);
|
||||
$sTaskSource = $aFields['TAS_TITLE'];
|
||||
} catch (\Exception $oError) {
|
||||
$sTaskSource = 'All Tasks';
|
||||
}
|
||||
} else {
|
||||
$sTaskSource = G::LoadTranslation('ID_ANY_TASK');
|
||||
}
|
||||
//Obtain object and type
|
||||
switch ($aRow['OP_OBJ_TYPE']) {
|
||||
case 'ALL':
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY': //For backward compatibility (some process with ANY instead of ALL
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
/* case 'ANY_DYNAFORM':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_DYNAFORM');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY_INPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_INPUT');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY_OUTPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_OUTPUT');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break; */
|
||||
case 'DYNAFORM':
|
||||
$sObjectType = G::LoadTranslation('ID_DYNAFORM');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oDynaform = new \Dynaform();
|
||||
$aFields = $oDynaform->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['DYN_TITLE'];
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'INPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_INPUT_DOCUMENT');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oInputDocument = new \InputDocument();
|
||||
$aFields = $oInputDocument->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['INP_DOC_TITLE'];
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'OUTPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oOutputDocument = new \OutputDocument();
|
||||
$aFields = $oOutputDocument->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['OUT_DOC_TITLE'];
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'CASES_NOTES':
|
||||
$sObjectType = G::LoadTranslation('ID_CASES_NOTES');
|
||||
$sObject = 'N/A';
|
||||
break;
|
||||
case 'MSGS_HISTORY':
|
||||
$sObjectType = G::LoadTranslation('MSGS_HISTORY');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
default:
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
}
|
||||
//Participated
|
||||
if ($aRow['OP_PARTICIPATE'] == 0) {
|
||||
$sParticipated = G::LoadTranslation('ID_NO');
|
||||
} else {
|
||||
$sParticipated = G::LoadTranslation('ID_YES');
|
||||
}
|
||||
//Obtain action (permission)
|
||||
$sAction = G::LoadTranslation('ID_' . $aRow['OP_ACTION']);
|
||||
//Add to array
|
||||
$aObjectsPermissions[] = array_merge($aRow, array('OP_UID' => $aRow['OP_UID'], 'TASK_TARGET' => $sTaskTarget, 'GROUP_USER' => $sUserGroup, 'TASK_SOURCE' => $sTaskSource, 'OBJECT_TYPE' => $sObjectType, 'OBJECT' => $sObject, 'PARTICIPATED' => $sParticipated, 'ACTION' => $sAction, 'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS']));
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
if ($sPermissionUid != '' && empty($aObjectsPermissions)) {
|
||||
throw (new \Exception( 'This row doesn\'t exist!' ));
|
||||
} else if ($sPermissionUid != '' && !empty($aObjectsPermissions)) {
|
||||
return current($aObjectsPermissions);
|
||||
}
|
||||
return $aObjectsPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,13 +550,53 @@ class ProcessSupervisor
|
||||
throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID ));
|
||||
}
|
||||
}
|
||||
$sPuUID = \G::generateUniqueID();
|
||||
$oProcessUser->create(array('PU_UID' => $sPuUID,
|
||||
'PRO_UID' => $sProcessUID,
|
||||
'USR_UID' => $sUsrUID,
|
||||
'PU_TYPE' => $sTypeUID));
|
||||
$oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID);
|
||||
return $oCriteria;
|
||||
// validate Groups
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID);
|
||||
$oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID);
|
||||
$oCriteria->addAsColumn('GRP_TITLE', \ContentPeer::CON_VALUE);
|
||||
$aConditions [] = array(\ProcessUserPeer::USR_UID, \ContentPeer::CON_ID);
|
||||
$aConditions [] = array(\ContentPeer::CON_CATEGORY, \DBAdapter::getStringDelimiter().'GRP_TITLE'.\DBAdapter::getStringDelimiter());
|
||||
$aConditions [] = array(\ContentPeer::CON_LANG, \DBAdapter::getStringDelimiter().SYS_LANG.\DBAdapter::getStringDelimiter());
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
|
||||
$oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(\ProcessUserPeer::USR_UID, $sUsrUID);
|
||||
$oCriteria->addAscendingOrderByColumn(\ContentPeer::CON_VALUE);
|
||||
$oDataset = \ProcessUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$sPuUIDT = $aRow['PU_UID'];
|
||||
$oDataset->next();
|
||||
}
|
||||
// validate Users
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID);
|
||||
$oCriteria->addJoin(\ProcessUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
|
||||
$oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(\ProcessUserPeer::USR_UID, $sUsrUID);
|
||||
$oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$oDataset = \ProcessUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$sPuUIDT = $aRow['PU_UID'];
|
||||
$oDataset->next();
|
||||
}
|
||||
if (is_null($sPuUIDT)) {
|
||||
$sPuUID = \G::generateUniqueID();
|
||||
$oProcessUser->create(array('PU_UID' => $sPuUID,
|
||||
'PRO_UID' => $sProcessUID,
|
||||
'USR_UID' => $sUsrUID,
|
||||
'PU_TYPE' => $sTypeUID));
|
||||
$oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID);
|
||||
return $oCriteria;
|
||||
} else {
|
||||
throw (new \Exception('This relation already exist!'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -568,18 +608,13 @@ class ProcessSupervisor
|
||||
*/
|
||||
public function addProcessSupervisorDynaform($sProcessUID, $sDynUID)
|
||||
{
|
||||
$oStepSupervisor = new \StepSupervisor();
|
||||
$oStepSupervisor->create(array('PRO_UID' => $sProcessUID,
|
||||
'STEP_TYPE_OBJ' => "DYNAFORM",
|
||||
'STEP_UID_OBJ' => $sDynUID,
|
||||
'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM")));
|
||||
$oTypeDynaform = \DynaformPeer::retrieveByPK($sDynUID);
|
||||
if (is_null( $oTypeDynaform )) {
|
||||
throw (new \Exception( 'This id: '. $sDynUID .' do not correspond to a registered Dynaform'));
|
||||
}
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION);
|
||||
$oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE');
|
||||
$oCriteria->addAlias('C', 'CONTENT');
|
||||
$aConditions = array();
|
||||
@@ -599,13 +634,50 @@ class ProcessSupervisor
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aResp = array('pud_uid' => $aRow['STEP_UID'],
|
||||
'pud_position' => $aRow['STEP_POSITION'],
|
||||
'dyn_uid' => $aRow['STEP_UID_OBJ'],
|
||||
'dyn_title' => $aRow['DYN_TITLE']);
|
||||
$sPuUIDT = $aRow['STEP_UID'];
|
||||
$oDataset->next();
|
||||
}
|
||||
return $aResp;
|
||||
if (is_null($sPuUIDT)) {
|
||||
$oStepSupervisor = new \StepSupervisor();
|
||||
$oStepSupervisor->create(array('PRO_UID' => $sProcessUID,
|
||||
'STEP_TYPE_OBJ' => "DYNAFORM",
|
||||
'STEP_UID_OBJ' => $sDynUID,
|
||||
'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM")));
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION);
|
||||
$oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE');
|
||||
$oCriteria->addAlias('C', 'CONTENT');
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \DynaformPeer::DYN_UID );
|
||||
$aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'DYNAFORM' . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\DynaformPeer::DYN_UID, 'C.CON_ID' );
|
||||
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'DYN_TITLE' . $sDelimiter );
|
||||
$aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter );
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sDynUID);
|
||||
$oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'DYNAFORM');
|
||||
$oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION);
|
||||
$oDataset = \StepSupervisorPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aResp = array('pud_uid' => $aRow['STEP_UID'],
|
||||
'pud_position' => $aRow['STEP_POSITION'],
|
||||
'dyn_uid' => $aRow['STEP_UID_OBJ'],
|
||||
'dyn_title' => $aRow['DYN_TITLE']);
|
||||
$oDataset->next();
|
||||
}
|
||||
return $aResp;
|
||||
} else {
|
||||
throw (new \Exception('This relation already exist!'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,18 +689,13 @@ class ProcessSupervisor
|
||||
*/
|
||||
public function addProcessSupervisorInputDocument($sProcessUID, $sInputDocumentUID)
|
||||
{
|
||||
$oStepSupervisor = new \StepSupervisor();
|
||||
$oStepSupervisor->create(array('PRO_UID' => $sProcessUID,
|
||||
'STEP_TYPE_OBJ' => "INPUT_DOCUMENT",
|
||||
'STEP_UID_OBJ' => $sInputDocumentUID,
|
||||
'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM")));
|
||||
$oTypeInputDocument= \InputDocumentPeer::retrieveByPK($sInputDocumentUID);
|
||||
if (is_null( $oTypeInputDocument )) {
|
||||
throw (new \Exception( 'This id: '. $sInputDocumentUID .' do not correspond to a registered InputDocument'));
|
||||
}
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION);
|
||||
$oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE');
|
||||
$oCriteria->addAlias('C', 'CONTENT');
|
||||
$aConditions = array();
|
||||
@@ -648,13 +715,51 @@ class ProcessSupervisor
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aResp = array('pui_uid' => $aRow['STEP_UID'],
|
||||
'pui_position' => $aRow['STEP_POSITION'],
|
||||
'input_doc_uid' => $aRow['STEP_UID_OBJ'],
|
||||
'input_doc_title' => $aRow['INP_DOC_TITLE']);
|
||||
$sPuUIDT = $aRow['STEP_UID'];
|
||||
$oDataset->next();
|
||||
}
|
||||
return $aResp;
|
||||
if (is_null($sPuUIDT)) {
|
||||
$oStepSupervisor = new \StepSupervisor();
|
||||
$oStepSupervisor->create(array('PRO_UID' => $sProcessUID,
|
||||
'STEP_TYPE_OBJ' => "INPUT_DOCUMENT",
|
||||
'STEP_UID_OBJ' => $sInputDocumentUID,
|
||||
'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM")));
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ);
|
||||
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION);
|
||||
$oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE');
|
||||
$oCriteria->addAlias('C', 'CONTENT');
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \InputDocumentPeer::INP_DOC_UID);
|
||||
$aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'INPUT_DOCUMENT' . $sDelimiter);
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(\InputDocumentPeer::INP_DOC_UID, 'C.CON_ID');
|
||||
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'INP_DOC_TITLE' . $sDelimiter);
|
||||
$aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
|
||||
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sInputDocumentUID);
|
||||
$oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT');
|
||||
$oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION);
|
||||
$oDataset = \StepSupervisorPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aResp = array('pui_uid' => $aRow['STEP_UID'],
|
||||
'pui_position' => $aRow['STEP_POSITION'],
|
||||
'input_doc_uid' => $aRow['STEP_UID_OBJ'],
|
||||
'input_doc_title' => $aRow['INP_DOC_TITLE']);
|
||||
$oDataset->next();
|
||||
}
|
||||
return $aResp;
|
||||
} else {
|
||||
throw (new \Exception('This relation already exist!'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -381,9 +381,11 @@ class Step
|
||||
$rsCriteria = \StepPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rsCriteria->next();
|
||||
|
||||
return $rsCriteria->getRow();
|
||||
if ($rsCriteria->next()) {
|
||||
return $rsCriteria->getRow();
|
||||
} else {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -393,20 +395,60 @@ class Step
|
||||
* Get available triggers of a Step
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER)
|
||||
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
|
||||
* @param string $taskUid Unique id of Task
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
public function getAvailableTriggers($stepUid, $type)
|
||||
public function getAvailableTriggers($stepUid, $type, $taskUid = "")
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$step = new \Step();
|
||||
|
||||
if ($stepUid != "" && !$step->StepExists($stepUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
$task = new \Task();
|
||||
|
||||
if ($stepUid == "" && !$task->taskExists($taskUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
//Get data
|
||||
$arrayAvailableTrigger = array();
|
||||
|
||||
$trigger = new \BusinessModel\Trigger();
|
||||
|
||||
$arrayDataUid = $this->getDataUids($stepUid);
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
$processUid = $arrayDataUid["PRO_UID"];
|
||||
if ($stepUid != "") {
|
||||
$arrayDataUid = $this->getDataUids($stepUid);
|
||||
|
||||
$processUid = $arrayDataUid["PRO_UID"];
|
||||
} else {
|
||||
$arrayData = $task->load($taskUid);
|
||||
|
||||
$processUid = $arrayData["PRO_UID"];
|
||||
|
||||
$flagStepAssignTask = 1;
|
||||
|
||||
switch ($type) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "AFTER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Get Uids
|
||||
$arrayUid = array();
|
||||
@@ -415,6 +457,11 @@ class Step
|
||||
|
||||
$criteria->addSelectColumn(\StepTriggerPeer::TRI_UID);
|
||||
$criteria->add(\StepTriggerPeer::STEP_UID, $stepUid, \Criteria::EQUAL);
|
||||
|
||||
if ($flagStepAssignTask == 1) {
|
||||
$criteria->add(\StepTriggerPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$criteria->add(\StepTriggerPeer::ST_TYPE, $type, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \StepTriggerPeer::doSelectRS($criteria);
|
||||
@@ -459,21 +506,37 @@ class Step
|
||||
* Get all triggers of a Step
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $taskUid Unique id of Task
|
||||
*
|
||||
* return array
|
||||
*/
|
||||
public function getTriggers($stepUid)
|
||||
public function getTriggers($stepUid, $taskUid = "")
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$step = new \Step();
|
||||
|
||||
if ($stepUid != "" && !$step->StepExists($stepUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
$task = new \Task();
|
||||
|
||||
if ($stepUid == "" && !$task->taskExists($taskUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
//Get data
|
||||
$arrayTrigger = array();
|
||||
|
||||
$bmTrigger = new \BusinessModel\Trigger();
|
||||
$bmStepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$arrayDataUid = $this->getDataUids($stepUid);
|
||||
if ($stepUid != "") {
|
||||
$arrayDataUid = $this->getDataUids($stepUid);
|
||||
|
||||
$taskUid = $arrayDataUid["TAS_UID"];
|
||||
$taskUid = $arrayDataUid["TAS_UID"];
|
||||
}
|
||||
|
||||
$processMap = new \ProcessMap();
|
||||
$stepTrigger = new \StepTrigger();
|
||||
@@ -495,15 +558,20 @@ class Step
|
||||
$triggerType = $index;
|
||||
$type = $value;
|
||||
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
switch ($triggerType) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$flagStepAssignTask = 1;
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$flagStepAssignTask = 1;
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$flagStepAssignTask = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -527,6 +595,10 @@ class Step
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
if ($flagStepAssignTask == 1) {
|
||||
$row["ST_TYPE"] = $triggerType;
|
||||
}
|
||||
|
||||
$arrayTrigger[] = $bmStepTrigger->getTriggerDataFromRecord($row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,14 @@ class Trigger
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $triggerUid Unique id of Trigger
|
||||
* @param int $position Position
|
||||
* @param string $triggerUidExclude Unique id of Trigger to exclude
|
||||
*
|
||||
* return bool Return true if exists the record in table STEP_TRIGGER, false otherwise
|
||||
*/
|
||||
public function existsRecord($stepUid, $type, $triggerUid, $position = 0, $triggerUidExclude = "")
|
||||
public function existsRecord($stepUid, $type, $taskUid, $triggerUid, $position = 0, $triggerUidExclude = "")
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
@@ -22,6 +23,7 @@ class Trigger
|
||||
$criteria->addSelectColumn(\StepTriggerPeer::STEP_UID);
|
||||
$criteria->add(\StepTriggerPeer::STEP_UID, $stepUid, \Criteria::EQUAL);
|
||||
$criteria->add(\StepTriggerPeer::ST_TYPE, $type, \Criteria::EQUAL);
|
||||
$criteria->add(\StepTriggerPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
|
||||
|
||||
if ($triggerUid != "") {
|
||||
$criteria->add(\StepTriggerPeer::TRI_UID, $triggerUid, \Criteria::EQUAL);
|
||||
@@ -52,26 +54,53 @@ class Trigger
|
||||
* Assign Trigger to a Step
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER)
|
||||
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $triggerUid Unique id of Trigger
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Data of the Trigger assigned to a Step
|
||||
*/
|
||||
public function create($stepUid, $type, $triggerUid, $arrayData)
|
||||
public function create($stepUid, $type, $taskUid, $triggerUid, $arrayData)
|
||||
{
|
||||
try {
|
||||
$step = new \BusinessModel\Step();
|
||||
$stepUidIni = $stepUid;
|
||||
$typeIni = $type;
|
||||
|
||||
$arrayDataUid = $step->getDataUids($stepUid);
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
$taskUid = $arrayDataUid["TAS_UID"];
|
||||
if ($stepUid == "") {
|
||||
$flagStepAssignTask = 1;
|
||||
|
||||
switch ($type) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "AFTER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Verify data
|
||||
$step = new \Step();
|
||||
if ($flagStepAssignTask == 0) {
|
||||
$step = new \Step();
|
||||
|
||||
if (!$step->StepExists($stepUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
if (!$step->StepExists($stepUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
}
|
||||
|
||||
$task = new \Task();
|
||||
|
||||
if (!$task->taskExists($taskUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
$trigger = new \Triggers();
|
||||
@@ -80,12 +109,12 @@ class Trigger
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
if ($this->existsRecord($stepUid, $type, $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}")));
|
||||
if ($this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}")));
|
||||
}
|
||||
|
||||
if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, "", $arrayData["st_position"])) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
|
||||
if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, $taskUid, "", $arrayData["st_position"])) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $taskUid . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
|
||||
}
|
||||
|
||||
//Create
|
||||
@@ -97,7 +126,7 @@ class Trigger
|
||||
$arrayData["st_position"] = $stepTrigger->getNextPosition($stepUid, $type, $taskUid) - 1;
|
||||
}
|
||||
|
||||
$arrayData = $this->update($stepUid, $type, $triggerUid, $arrayData);
|
||||
$arrayData = $this->update($stepUidIni, $typeIni, $taskUid, $triggerUid, $arrayData);
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
@@ -109,26 +138,44 @@ class Trigger
|
||||
* Update Trigger of a Step
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER)
|
||||
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $triggerUid Unique id of Trigger
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Data updated of the Trigger assigned to a Step
|
||||
*/
|
||||
public function update($stepUid, $type, $triggerUid, $arrayData)
|
||||
public function update($stepUid, $type, $taskUid, $triggerUid, $arrayData)
|
||||
{
|
||||
try {
|
||||
$step = new \BusinessModel\Step();
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
$arrayDataUid = $step->getDataUids($stepUid);
|
||||
if ($stepUid == "") {
|
||||
$flagStepAssignTask = 1;
|
||||
|
||||
$taskUid = $arrayDataUid["TAS_UID"];
|
||||
switch ($type) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "AFTER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Verify data
|
||||
$step = new \Step();
|
||||
if ($flagStepAssignTask == 0) {
|
||||
$step = new \Step();
|
||||
|
||||
if (!$step->StepExists($stepUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
if (!$step->StepExists($stepUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
}
|
||||
|
||||
$trigger = new \Triggers();
|
||||
@@ -137,8 +184,8 @@ class Trigger
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, "", $arrayData["st_position"], $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
|
||||
if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, $taskUid, "", $arrayData["st_position"], $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $taskUid . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
|
||||
}
|
||||
|
||||
//Update
|
||||
@@ -171,23 +218,35 @@ class Trigger
|
||||
* Delete Trigger of a Step
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER)
|
||||
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $triggerUid Unique id of Trigger
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function delete($stepUid, $type, $triggerUid)
|
||||
public function delete($stepUid, $type, $taskUid, $triggerUid)
|
||||
{
|
||||
try {
|
||||
$step = new \BusinessModel\Step();
|
||||
|
||||
$arrayDataUid = $step->getDataUids($stepUid);
|
||||
|
||||
$taskUid = $arrayDataUid["TAS_UID"];
|
||||
if ($stepUid == "") {
|
||||
switch ($type) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "AFTER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Verify data
|
||||
if (!$this->existsRecord($stepUid, $type, $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}")));
|
||||
if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
//Get position
|
||||
@@ -234,23 +293,41 @@ class Trigger
|
||||
* Get data of a Trigger
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER)
|
||||
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $triggerUid Unique id of Trigger
|
||||
*
|
||||
* return array Return an array with data of a Trigger
|
||||
*/
|
||||
public function getTrigger($stepUid, $type, $triggerUid)
|
||||
public function getTrigger($stepUid, $type, $taskUid, $triggerUid)
|
||||
{
|
||||
try {
|
||||
$step = new \BusinessModel\Step();
|
||||
$typeIni = $type;
|
||||
|
||||
$arrayDataUid = $step->getDataUids($stepUid);
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
$taskUid = $arrayDataUid["TAS_UID"];
|
||||
if ($stepUid == "") {
|
||||
$flagStepAssignTask = 1;
|
||||
|
||||
switch ($type) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "AFTER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Verify data
|
||||
if (!$this->existsRecord($stepUid, $type, $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}")));
|
||||
if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
|
||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}")));
|
||||
}
|
||||
|
||||
//Get data
|
||||
@@ -274,6 +351,10 @@ class Trigger
|
||||
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
if ($flagStepAssignTask == 1) {
|
||||
$row["ST_TYPE"] = $typeIni;
|
||||
}
|
||||
|
||||
return $this->getTriggerDataFromRecord($row);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -89,16 +89,16 @@ class Assignee extends Api
|
||||
*
|
||||
* @param string $prjUid
|
||||
* @param string $actUid
|
||||
* @param string $ass_uid
|
||||
* @param string $ass_type {@choice user,group}
|
||||
* @param string $aas_uid
|
||||
* @param string $aas_type {@choice user,group}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostActivityAssignee($prjUid, $actUid, $ass_uid, $ass_type)
|
||||
public function doPostActivityAssignee($prjUid, $actUid, $aas_uid, $aas_type)
|
||||
{
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$arrayData = $task->addTaskAssignee($prjUid, $actUid, $ass_uid, $ass_type);
|
||||
$arrayData = $task->addTaskAssignee($prjUid, $actUid, $aas_uid, $aas_type);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
@@ -107,18 +107,18 @@ class Assignee extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/activity/:actUid/assignee/:assUid
|
||||
* @url DELETE /:prjUid/activity/:actUid/assignee/:aasUid
|
||||
*
|
||||
* @param string $prjUid
|
||||
* @param string $actUid
|
||||
* @param string $assUid
|
||||
* @param string $aasUid
|
||||
*
|
||||
*/
|
||||
public function doDeleteActivityAssignee($prjUid, $actUid, $assUid)
|
||||
public function doDeleteActivityAssignee($prjUid, $actUid, $aasUid)
|
||||
{
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$arrayData = $task->removeTaskAssignee($prjUid, $actUid, $assUid);
|
||||
$arrayData = $task->removeTaskAssignee($prjUid, $actUid, $aasUid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
|
||||
@@ -124,6 +124,44 @@ class Step extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
//Step "Assign Task"
|
||||
|
||||
/**
|
||||
* @url GET /:projectUid/activity/:activityUid/step/triggers
|
||||
*/
|
||||
public function doGetActivityStepAssignTaskTriggers($activityUid, $projectUid)
|
||||
{
|
||||
try {
|
||||
$step = new \BusinessModel\Step();
|
||||
|
||||
$response = $step->getTriggers("", $activityUid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:projectUid/activity/:activityUid/step/available-triggers/:type
|
||||
*
|
||||
* @param string $activityUid
|
||||
* @param string $projectUid
|
||||
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
|
||||
*/
|
||||
public function doGetActivityStepAssignTaskAvailableTriggers($activityUid, $projectUid, $type)
|
||||
{
|
||||
try {
|
||||
$step = new \BusinessModel\Step();
|
||||
|
||||
$response = $step->getAvailableTriggers("", strtoupper(str_replace("-", "_", $type)), $activityUid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class StepPostStructure
|
||||
|
||||
@@ -25,7 +25,7 @@ class Trigger extends Api
|
||||
try {
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $triggerUid);
|
||||
$response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $activityUid, $triggerUid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -50,7 +50,7 @@ class Trigger extends Api
|
||||
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$arrayData = $stepTrigger->create($stepUid, $request_data["st_type"], $request_data["tri_uid"], $request_data);
|
||||
$arrayData = $stepTrigger->create($stepUid, $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class Trigger extends Api
|
||||
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$arrayData = $stepTrigger->update($stepUid, $request_data["st_type"], $triggerUid, $request_data);
|
||||
$arrayData = $stepTrigger->update($stepUid, $request_data["st_type"], $activityUid, $triggerUid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -92,7 +92,92 @@ class Trigger extends Api
|
||||
try {
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$stepTrigger->delete($stepUid, strtoupper($type), $triggerUid);
|
||||
$stepTrigger->delete($stepUid, strtoupper($type), $activityUid, $triggerUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
//Step "Assign Task"
|
||||
|
||||
/**
|
||||
* @url GET /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type
|
||||
*
|
||||
* @param string $triggerUid
|
||||
* @param string $activityUid
|
||||
* @param string $projectUid
|
||||
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
|
||||
*/
|
||||
public function doGetActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type)
|
||||
{
|
||||
try {
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$response = $stepTrigger->getTrigger("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:projectUid/activity/:activityUid/step/trigger
|
||||
*
|
||||
* @param string $activityUid
|
||||
* @param string $projectUid
|
||||
* @param StepAssignTaskTriggerPostStructure $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostActivityStepAssignTaskTrigger($activityUid, $projectUid, StepAssignTaskTriggerPostStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$arrayData = $stepTrigger->create("", $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:projectUid/activity/:activityUid/step/trigger/:triggerUid
|
||||
*
|
||||
* @param string $triggerUid
|
||||
* @param string $activityUid
|
||||
* @param string $projectUid
|
||||
* @param StepAssignTaskTriggerPutStructure $request_data
|
||||
*/
|
||||
public function doPutActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, StepAssignTaskTriggerPutStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$arrayData = $stepTrigger->update("", $request_data["st_type"], $activityUid, $triggerUid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type
|
||||
*
|
||||
* @param string $triggerUid
|
||||
* @param string $activityUid
|
||||
* @param string $projectUid
|
||||
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
|
||||
*/
|
||||
public function doDeleteActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type)
|
||||
{
|
||||
try {
|
||||
$stepTrigger = new \BusinessModel\Step\Trigger();
|
||||
|
||||
$stepTrigger->delete("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -140,3 +225,44 @@ class StepTriggerPutStructure
|
||||
public $st_position;
|
||||
}
|
||||
|
||||
class StepAssignTaskTriggerPostStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true}
|
||||
*/
|
||||
public $st_type;
|
||||
|
||||
/**
|
||||
* @var string {@from body}{@min 32}{@max 32}{@required true}
|
||||
*/
|
||||
public $tri_uid;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $st_condition;
|
||||
|
||||
/**
|
||||
* @var int {@from body}{@min 1}
|
||||
*/
|
||||
public $st_position;
|
||||
}
|
||||
|
||||
class StepAssignTaskTriggerPutStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true}
|
||||
*/
|
||||
public $st_type;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $st_condition;
|
||||
|
||||
/**
|
||||
* @var int {@from body}{@min 1}
|
||||
*/
|
||||
public $st_position;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Activity\Step\ProcessPermissions Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class ProcessPermissions extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:projectUid/process-permissions
|
||||
*/
|
||||
public function doGetProcessPermissions($projectUid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->getProcessPermissions($projectUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $objectPermissionUid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:projectUid/process-permission/:objectPermissionUid
|
||||
*/
|
||||
public function doGetProcessPermission($projectUid, $objectPermissionUid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->getProcessPermissions($projectUid, $objectPermissionUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,8 +311,4 @@ class ProcessSupervisors extends Api
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ debug = 1
|
||||
input-document = "Services\Api\ProcessMaker\Project\InputDocument"
|
||||
output-documents = "Services\Api\ProcessMaker\Project\OutputDocuments"
|
||||
supervisors = "Services\Api\ProcessMaker\Project\ProcessSupervisors"
|
||||
process-permissions = "Services\Api\ProcessMaker\Project\ProcessPermissions"
|
||||
case-scheduler = "Services\Api\ProcessMaker\Project\CaseScheduler"
|
||||
|
||||
[alias: projects]
|
||||
project = "Services\Api\ProcessMaker\Project"
|
||||
|
||||
Reference in New Issue
Block a user