Merged in darojas/processmaker (pull request #98)

Se modifican los metodos POST y PUT para case scheduler, se adicionan validaciones. Behat para Case scheduler. Se mofifican algunas descripciones en output-documents. Validaciones process supervisor
This commit is contained in:
erik ao
2014-01-21 16:10:39 -04:00
5 changed files with 436 additions and 111 deletions

View File

@@ -0,0 +1,83 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Case Scheduler Resources
Background:
Given that I have a valid access_token
Scenario: Create a new case scheduler for a project
Given POST this data:
"""
{
"sch_option": "3",
"sch_name": "Test scheduler #1",
"sch_del_user_name": "admin",
"sch_del_user_pass": "admin",
"tas_uid": "46941969352af5be2ab3f39001216717",
"sch_start_time": "18:00",
"sch_start_date": "2014-01-20",
"sch_end_date": "2014-01-20",
"sch_every_days": "",
"sch_week_days": "",
"sch_start_day": "1",
"sch_start_day_opt_1": "2",
"sch_start_day_opt_2": "",
"sch_months": "1|6|12",
"sch_repeat_every": "",
"sch_repeat_until": ""
}
"""
And I request "project/1265557095225ff5c688f46031700471/case-scheduler"
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 "sch_uid" in session array as variable "sch_uid"
Scenario: Get a List of case scheduler of a project
Given I request "project/1265557095225ff5c688f46031700471/case-schedulers"
Then the response status code should be 200
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "array"
And the response has 1 record
Scenario: Get a single case scheduler of a project
Given that I want to get a resource with the key "sch_uid" stored in session array
And I request "project/1265557095225ff5c688f46031700471/case-scheduler"
Then the response status code should be 200
And the content type is "application/json"
And the type is "object"
Scenario: Update a case scheduler for a project
Given PUT this data:
"""
{
"sch_name": "Test scheduler #1 modify",
"sch_del_user_name": "admin",
"sch_del_user_pass": "admin",
"tas_uid": "46941969352af5be2ab3f39001216717",
"sch_start_time": "20:00",
"sch_start_date": "2014-02-01",
"sch_end_date": "2014-02-01",
"sch_every_days": "",
"sch_week_days": "",
"sch_start_day": "1",
"sch_start_day_opt_1": "2",
"sch_start_day_opt_2": "",
"sch_months": "1|6|12",
"sch_repeat_every": "",
"sch_repeat_until": ""
}
"""
And that I want to update a resource with the key "sch_uid" stored in session array
And I request "project/1265557095225ff5c688f46031700471/case-scheduler"
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"
Scenario: Delete a case scheduler of a project
Given that I want to delete a resource with the key "sch_uid" stored in session array
And I request "project/1265557095225ff5c688f46031700471/case-scheduler"
Then the response status code should be 200
And the response charset is "UTF-8"

File diff suppressed because it is too large Load Diff

View File

@@ -362,13 +362,13 @@ class OutputDocument
}
/**
* Checks if the title exists in the InputDocuments of Process
* Checks if the title exists in the OutputDocuments of Process
*
* @param string $processUid Unique id of Process
* @param string $title Title
* @param string $inputDocumentUidExclude Unique id of InputDocument to exclude
* @param string $outputDocumentUidExclude Unique id of InputDocument to exclude
*
* return bool Return true if the title exists in the InputDocuments of Process, false otherwise
* return bool Return true if the title exists in the OutputDocuments of Process, false otherwise
*/
public function existsTitle($processUid, $title)
{

View File

@@ -63,6 +63,9 @@ class ProcessSupervisor
'usr_email' => $aRow['USR_EMAIL'] );
$oDataset->next();
}
if ($aResp == null){
$aResp = array();
}
return $aResp;
} catch (Exception $e) {
throw $e;
@@ -215,6 +218,7 @@ class ProcessSupervisor
$oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL);
$oCriteria->add(\UsersPeer::USR_UID, $aUIDS, \Criteria::IN);
$oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME);
$oCriteria->add(\UsersPeer::USR_ROLE, 'PROCESSMAKER_ADMIN', \Criteria::EQUAL);
$oDataset = \UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
@@ -295,6 +299,10 @@ class ProcessSupervisor
public function getProcessSupervisorDynaform($sProcessUID = '', $sPudUID = '')
{
try {
$oDynaformSupervisor = \StepSupervisorPeer::retrieveByPK( $sPudUID );
if (is_null( $oDynaformSupervisor ) ) {
throw (new \Exception( 'This id: '. $sPudUID .' do not correspond to a registered process supervisor '));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID);
@@ -440,6 +448,10 @@ class ProcessSupervisor
public function getProcessSupervisorInputDocument($sProcessUID = '', $sPuiUID = '')
{
try {
$oInputDocumentSupervisor = \StepSupervisorPeer::retrieveByPK( $sPuiUID );
if (is_null( $oInputDocumentSupervisor ) ) {
throw (new \Exception( 'This id: '. $sPuiUID .' do not correspond to a registered process supervisor '));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID);
@@ -610,7 +622,7 @@ class ProcessSupervisor
{
$oTypeDynaform = \DynaformPeer::retrieveByPK($sDynUID);
if (is_null( $oTypeDynaform )) {
throw (new \Exception( 'This id: '. $sDynUID .' do not correspond to a registered Dynaform'));
throw (new \Exception( 'This id for `dyn_uid`: '. $sDynUID .' do not correspond to a registered Dynaform'));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
@@ -691,7 +703,7 @@ class ProcessSupervisor
{
$oTypeInputDocument= \InputDocumentPeer::retrieveByPK($sInputDocumentUID);
if (is_null( $oTypeInputDocument )) {
throw (new \Exception( 'This id: '. $sInputDocumentUID .' do not correspond to a registered InputDocument'));
throw (new \Exception( 'This id for `inp_doc_uid`: '. $sInputDocumentUID .' do not correspond to a registered InputDocument'));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');

View File

@@ -175,7 +175,7 @@ class CaseSchedulerStructure
public $usr_uid;
/**
* @var string {@from body}
* @var string {@from body} {@choice 1,2,3,4,5}
*/
public $sch_option;
@@ -205,7 +205,7 @@ class CaseSchedulerStructure
public $sch_week_days;
/**
* @var string {@from body} {@choice 1,2}
* @var string {@from body} {@choice 1,2,}
*/
public $sch_start_day;
@@ -233,19 +233,5 @@ class CaseSchedulerStructure
*/
public $sch_repeat_every;
/**
* @var string {@from body} {@min 0} {@max 15}
*/
public $sch_repeat_until;
/**
* @var string {@from body} {@min 0} {@max 4}
*/
public $sch_repeat_stop_if_running;
/**
* @var string {@from body} {@min 0} {@max 100}
*/
public $case_sh_plugin_uid;
}