Merge remote branch 'upstream/master'

This commit is contained in:
Julio Cesar Laura
2014-03-25 10:39:53 -04:00
20 changed files with 2739 additions and 181 deletions

View File

@@ -6,82 +6,95 @@ Requirements:
Background:
Given that I have a valid access_token
Scenario: Returns information about a given case
Given I request "case"
Scenario: Returns information about a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the "ca_prj" property equals "ca_prj"
And the "ca_title" property equals "ca_title"
And the "ca_number" property equals "ca_number"
And the "ca_status" property equals "ca_status"
And the "ca_uid" property equals "ca_uid"
And the "ca_creator" property equals "ca_creator"
And the "ca_date" property equals "ca_date"
And the "ca_update" property equals "ca_update"
And the "ca_lastupdate" property equals "ca_lastupdate"
And the "ca_description" property equals "ca_description"
And the "ca_task" property equals "ca_task"
And the "ca_current_user" property equals "ca_current_user"
And the "ca_delegate" property equals "ca_delegate"
And the "ca_init_date" property equals "ca_init_date"
And the "ca_due_date" property equals "ca_duo_date"
And the "ca_finish_date" property equals "ca_finish_date"
And the "app_uid" property equals "48177942153275bfa28bd04070312685"
And the "app_number" property equals 16
And the "app_name" property equals "#16"
And the "app_status" property equals "TO_DO"
And the "app_init_usr_uid" property equals "00000000000000000000000000000001"
And the "app_init_usr_username" property equals "Administrator"
And the "pro_uid" property equals "99209594750ec27ea338927000421575"
And the "pro_name" property equals "Derivation rules - sequential"
And the "app_create_date" property equals "2014-03-17 16:32:58"
And the "app_update_date" property equals "2014-03-17 16:33:01"
Scenario: Returns the current task for a given case
Given I request "case/uid/current-task"
Scenario: Returns the current task for a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685/current-task"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the "ca_prj" property equals "ca_prj"
And the "tas_uid" property equals "73641967750ec281cf015d9009265327"
And the "tas_title" property equals "Cyclical"
And the "del_index" property equals "2"
Scenario: Create a new case in workspace with process Test Micheangelo
Scenario Outline: Create a new case in workspace with process "Derivation rules - sequential"
Given POST this data:
"""
{
"pro_uid": "99209594750ec27ea338927000421575",
"tas_uid": "68707275350ec281ada1c95068712556",
"variables": [{"name": "admin", "lastname":"admin"}]
}
"""
And I request "case"
Then the response status code should be 201
And I request "cases"
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 "object"
And store "" in session array
And store "caseId" in session array as variable "caseId_<case_number>"
And store "caseNumber" in session array as variable "caseNumber_<case_number>"
Examples:
| case_number |
| 1 |
Scenario: Create a new case Impersonate in workspace with process Test Micheangelo
Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential"
Given POST this data:
"""
{
"pro_uid": "99209594750ec27ea338927000421575",
"usr_uid": "24166330352d56730cdd525035621101",
"tas_uid": "68707275350ec281ada1c95068712556",
"variables": [{"name": "pruebaQA", "amount":"10400"}]
}
"""
And I request "case/impersonate"
Then the response status code should be 201
And I request "cases/impersonate"
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 "object"
And store "" in session array
And store "caseId" in session array as variable "caseId_<case_number>"
And store "caseNumber" in session array as variable "caseNumber_<case_number>"
Examples:
| case_number |
| 1 |
Scenario: Returns a list of the cases for the logged in user (Draft)
Given I request "cases/draft"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 2 records
Scenario: Reassigns a case to a different user
Given PUT this data:
"""
{
"usr_uid_source": "62625000752d5672d6661e6072881167",
"usr_uid_target": "24166330352d56730cdd525035621101",
}
"""
And that I want to update a resource with the key "" stored in session array
And that I want to update a resource with the key "case_number" stored in session array
And I request "case/{uid}/reassign-case"
Then the response status code should be 200
And the content type is "application/json"
@@ -93,9 +106,8 @@ Scenario: Autoderivate a case to the next task in the process
Given PUT this data:
"""
{
"case_uid": "78ef3ca7905019270643749052af5bd7",
"del_index": "1"
}
"""
And that I want to update a resource with the key "" stored in session array
@@ -103,4 +115,4 @@ Scenario: Autoderivate a case to the next task in the process
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
And the type is "object"

View File

@@ -0,0 +1,155 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Cases Actions - the features in this script are (getCaseInfo, taskCase, newCase, newCaseImpersonate, reassignCase and routeCase)
Requirements:
a workspace with five cases of the process "Test micheangelo" and "Test Users-Step-Properties End Point"
Background:
Given that I have a valid access_token
Scenario: Returns information about a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the "app_uid" property equals "48177942153275bfa28bd04070312685"
And the "app_number" property equals 16
And the "app_name" property equals "#16"
And the "app_status" property equals "TO_DO"
And the "app_init_usr_uid" property equals "00000000000000000000000000000001"
And the "app_init_usr_username" property equals "Administrator"
And the "pro_uid" property equals "99209594750ec27ea338927000421575"
And the "pro_name" property equals "Derivation rules - sequential"
And the "app_create_date" property equals "2014-03-17 16:32:58"
And the "app_update_date" property equals "2014-03-17 16:33:01"
Scenario: Returns the current task for a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685/current-task"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the "tas_uid" property equals "73641967750ec281cf015d9009265327"
And the "tas_title" property equals "Cyclical"
And the "del_index" property equals "2"
Scenario Outline: Create a new case in workspace with process "Derivation rules - sequential", "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection"
Given POST this data:
"""
{
"pro_uid": "<pro_uid>",
"tas_uid": "<tas_uid>",
"variables": [{"name": "admin", "lastname":"admin"}]
}
"""
And I request "cases"
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 "object"
And store "app_uid" in session array as variable "app_uid_<app_uid_number>"
And store "app_number" in session array as variable "app_number_<app_uid_number>"
Examples:
| Description | app_uid_number | pro_uid | tas_uid | variables |
| Create new case with process "Derivation rules - sequential" | 1 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 | |
| Create new case with process "Derivation rules - evaluation" | 2 | 46279907250ec73b9b25a78031279680 | 99371337850ec73c0a38eb6024620271 | |
| Create new case with process "Derivation rules - Parallel" | 3 | 35894775350ec7daa099378048029617 | 52838134750ec7dd0989fc0015625952 | |
| Create new case with process "Derivation rules - parallel evaluation" | 4 | 34579467750ec8d55e8b115057818502 | 89648437550ec8d593c2159010276089 | |
| Create new case with process "Derivation rules - selection" | 5 | 82458496050ec668981ecc7039804404 | 56900024450ec668e4a9243080698854 | |
Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential", "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection"
Given POST this data:
"""
{
"pro_uid": "<pro_uid>",
"usr_uid": "<usr_uid>",
"tas_uid": "<tas_uid>",
"variables": [{"name": "pruebaQA", "amount":"10400"}]
}
"""
And I request "cases/impersonate"
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 "object"
And store "app_uid" in session array as variable "app_uid_<app_uid_number>"
And store "app_number" in session array as variable "app_number_<app_uid_number>"
Examples:
| Description | app_uid_number | pro_uid | usr_uid | tas_uid | variables |
| Create new case with process "Derivation rules - sequential" - Case Start with chris | 6 | 99209594750ec27ea338927000421575 | 24166330352d56730cdd525035621101 | 68707275350ec281ada1c95068712556 | |
| Create new case with process "Derivation rules - evaluation" - Case Start with adam | 7 | 46279907250ec73b9b25a78031279680 | 44811996752d567110634a1013636964 | 99371337850ec73c0a38eb6024620271 | |
| Create new case with process "Derivation rules - Parallel" - Case Start with aaron | 8 | 35894775350ec7daa099378048029617 | 51049032352d56710347233042615067 | 52838134750ec7dd0989fc0015625952 | |
| Create new case with process "Derivation rules - parallel evaluation"- Case Start with jeremiah | 9 | 34579467750ec8d55e8b115057818502 | 86677227852d5671f40ba25017213081 | 89648437550ec8d593c2159010276089 | |
| Create new case with process "Derivation rules - selection" - Case Start with admin | 10 | 82458496050ec668981ecc7039804404 | 62625000752d5672d6661e6072881167 | 56900024450ec668e4a9243080698854 | |
Scenario: Returns a list of the cases for the logged in user (Draft)
Given I request "cases/draft"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 11 records
Scenario Outline: Reassigns a case to a different user
Given PUT this data:
"""
{
"usr_uid_source": "<usr_uid_source>",
"usr_uid_target": "<usr_uid_target>",
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "case/app_uid/reassign-case" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
Examples:
| Description | app_uid_number | usr_uid_source | usr_uid_target |
| Reassign the user adam | 1 | 00000000000000000000000000000001 | 44811996752d567110634a1013636964 |
| Reassign the user aaron | 2 | 00000000000000000000000000000001 | 51049032352d56710347233042615067 |
| Reassign the user jeremiah | 3 | 00000000000000000000000000000001 | 86677227852d5671f40ba25017213081 |
| Reassign the user chris | 4 | 00000000000000000000000000000001 | 24166330352d56730cdd525035621101 |
| Reassign the user zachary | 5 | 00000000000000000000000000000001 | 62625000752d5672d6661e6072881167 |
| Reassign the user admin | 6 | 24166330352d56730cdd525035621101 | 00000000000000000000000000000001 |
| Reassign the user admin | 7 | 44811996752d567110634a1013636964 | 00000000000000000000000000000001 |
| Reassign the user admin | 8 | 51049032352d56710347233042615067 | 00000000000000000000000000000001 |
| Reassign the user admin | 9 | 86677227852d5671f40ba25017213081 | 00000000000000000000000000000001 |
| Reassign the user admin | 10 | 62625000752d5672d6661e6072881167 | 00000000000000000000000000000001 |
Scenario Outline: Route a case to the next task in the process
Given PUT this data:
"""
{
}
"""
And that I want to update a resource with the key "app_uid_<app_uid_number>" stored in session array
And I request "case/app_uid/route-case" with the key "app_uid" stored in session array as variable "app_uid_<app_uid_number>"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
Examples:
| Description | app_uid_number |
| Route next activity "Derivation rules - sequential" | 1 |
| Route next activity "Derivation rules - evaluation" | 2 |
| Route next activity "Derivation rules - Parallel" | 3 |
| Route next activity "Derivation rules - parallel evaluation" | 4 |
| Route next activity "Derivation rules - selection" | 5 |
| Route next activity "Derivation rules - sequential" | 6 |
| Route next activity "Derivation rules - evaluation" | 7 |
| Route next activity "Derivation rules - Parallel" | 8 |
| Route next activity "Derivation rules - parallel evaluation" | 9 |
| Route next activity "Derivation rules - selection" | 10 |

View File

@@ -15,28 +15,55 @@ Scenario: Returns a list of the cases for the logged in user (Inbox)
And the response has 1 records
Scenario: Returns information about a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685"
Scenario: Get paging of list inbox
Given I request "cases/paged"
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 "guid" property equals "48177942153275bfa28bd04070312685"
And the "name" property equals "16"
And the "status" property equals "TO_DO"
And the "delIndex" property equals "2"
And the "processId" property equals "99209594750ec27ea338927000421575"
And the response has 1 records
Scenario: Returns the current task for a given case of the list Inbox
Given I request "cases/48177942153275bfa28bd04070312685/current-task"
Scenario: Get order type of Descending
Given I request "cases?dir=DESC"
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 "guid" property equals "73641967750ec281cf015d9009265327"
And the "name" property equals "Cyclical"
And the "delegate" property equals "2"
Scenario: Get order type of Acending
Given I request "cases?dir=ASC"
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"
Scenario: Get order type of Process Category
Given I request "cases?category=4177095085330818c324501061677193"
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"
Scenario: Get order type of Process
Given I request "cases?process=99209594750ec27ea338927000421575"
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"
Scenario: Get order type of Search
Given I request "cases?search=92535130653271a60de2e73021469732"
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"
Scenario: Returns a list of the cases for the logged in user (Draft)
Given I request "cases/draft"
Then the response status code should be 200
@@ -45,6 +72,55 @@ Scenario: Returns a list of the cases for the logged in user (Draft)
And the response has 1 records
Scenario: Get paging of list Draft
Given I request "cases/draft/paged"
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 records
Scenario: Get order type of Descending
Given I request "cases/draft?dir=DESC"
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"
Scenario: Get order type of Acending
Given I request "cases/draft?dir=ASC"
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"
Scenario: Get order type of Process Category
Given I request "cases/draft?category=4177095085330818c324501061677193"
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"
Scenario: Get order type of Process
Given I request "cases/draft?process=99209594750ec27ea338927000421575"
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"
Scenario: Get order type of Search
Given I request "cases/draft?search=92535130653271a60de2e73021469732"
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"
Scenario: Returns a list of the cases for the logged in user (Participated)
Given I request "cases/participated"
Then the response status code should be 200
@@ -53,6 +129,55 @@ Scenario: Returns a list of the cases for the logged in user (Participated)
And the response has 6 records
Scenario: Get paging of list Participated
Given I request "cases/participated/paged"
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 records
Scenario: Get order type of Descending
Given I request "cases/participated?dir=DESC"
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"
Scenario: Get order type of Acending
Given I request "cases/participated?dir=ASC"
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"
Scenario: Get order type of Process Category
Given I request "cases/participated?category=4177095085330818c324501061677193"
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"
Scenario: Get order type of Process
Given I request "cases/participated?process=99209594750ec27ea338927000421575"
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"
Scenario: Get order type of Search
Given I request "cases/participated?search=92535130653271a60de2e73021469732"
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"
Scenario: Returns a list of the cases for the logged in user (Unassigned)
Given I request "cases/unassigned"
Then the response status code should be 200
@@ -61,6 +186,55 @@ Scenario: Returns a list of the cases for the logged in user (Unassigned)
And the response has 1 records
Scenario: Get paging of list Unassigned
Given I request "cases/unassigned/paged"
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 records
Scenario: Get order type of Descending
Given I request "cases/unassigned?dir=DESC"
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"
Scenario: Get order type of Acending
Given I request "cases/unassigned?dir=ASC"
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"
Scenario: Get order type of Process Category
Given I request "cases/unassigned?category=4177095085330818c324501061677193"
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"
Scenario: Get order type of Process
Given I request "cases/unassigned?process=99209594750ec27ea338927000421575"
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"
Scenario: Get order type of Search
Given I request "cases/unassigned?search=92535130653271a60de2e73021469732"
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"
Scenario: Returns a list of the cases for the logged in user (Paused)
Given I request "cases/paused"
Then the response status code should be 200
@@ -69,84 +243,107 @@ Scenario: Returns a list of the cases for the logged in user (Paused)
And the response has 1 records
Scenario Outline: Create a new case in workspace with process "Derivation rules - sequential"
Given POST this data:
"""
{
"prj_uid": "99209594750ec27ea338927000421575",
"act_uid": "68707275350ec281ada1c95068712556",
"variables": [{"name": "admin", "lastname":"admin"}]
}
"""
And I request "cases"
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 "object"
And store "caseId" in session array as variable "caseId_<case_number>"
And store "caseNumber" in session array as variable "caseNumber_<case_number>"
Examples:
| case_number |
| 1 |
Scenario: Get paging of list Paused
Given I request "cases/paused/paged"
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 records
Scenario: Get order type of Descending
Given I request "cases/paused?dir=DESC"
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"
Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential"
Given POST this data:
"""
{
"prj_uid": "99209594750ec27ea338927000421575",
"usr_uid": "24166330352d56730cdd525035621101",
"act_uid": "68707275350ec281ada1c95068712556",
"variables": [{"name": "pruebaQA", "amount":"10400"}]
}
"""
And I request "cases/impersonate"
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 "object"
And store "caseId" in session array as variable "caseId_<case_number>"
And store "caseNumber" in session array as variable "caseNumber_<case_number>"
Examples:
| case_number |
| 1 |
Scenario: Get order type of Acending
Given I request "cases/paused?dir=ASC"
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"
Scenario: Reassigns a case to a different user
Given PUT this data:
"""
{
"del_index": "53643749052af5bdef3ca79050192707",
"usr_uid_source": "62625000752d5672d6661e6072881167",
"usr_uid_target": "24166330352d56730cdd525035621101"
}
"""
And that I want to update a resource with the key "" stored in session array
And I request "case/{uid}/reassign-case"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
Scenario: Get order type of Process Category
Given I request "cases/paused?category=4177095085330818c324501061677193"
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"
Scenario: Get order type of Process
Given I request "cases/paused?process=99209594750ec27ea338927000421575"
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"
Scenario: Autoderivate a case to the next task in the process
Given PUT this data:
"""
{
"case_uid": "78ef3ca7905019270643749052af5bd7",
"del_index": "1"
}
"""
And that I want to update a resource with the key "" stored in session array
And I request "case/{uid}/route-case"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
Scenario: Get order type of Search
Given I request "cases/paused?search=92535130653271a60de2e73021469732"
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"
Scenario: Returns a list of the cases for the logged in user (Advanced Search)
Given I request "cases/advanced-search"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario: Get paging of list Advanced Search
Given I request "cases/advanced-search/paged"
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 records
Scenario: Get order type of Descending
Given I request "cases/advanced-search?dir=DESC"
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"
Scenario: Get order type of Acending
Given I request "cases/advanced-search?dir=ASC"
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"
Scenario: Get order type of Process Category
Given I request "cases/advanced-search?category=4177095085330818c324501061677193"
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"
Scenario: Get order type of Process
Given I request "cases/advanced-search?process=99209594750ec27ea338927000421575"
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"
Scenario: Get order type of Search
Given I request "cases/advanced-search?search=92535130653271a60de2e73021469732"
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"

View File

@@ -1,5 +1,5 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Cases Actions - the features in this script are (inbox, draftCaseList, participatedCaseList, unassignedCaseList, pausedCaseList and advanced Search)
Feature: Cases Actions - the features in this script are (inbox, draftCaseList, participatedCaseList, unassignedCaseList, pausedCaseList and advanced Search) and (getCaseInfo, taskCase, newCase, newCaseImpersonate, reassignCase and routeCase)
Requirements:
a workspace with five of the process "Derivation rules - evaluation", "Derivation rules - Parallel", "Derivation rules - parallel evaluation", "Derivation rules - selection", "Derivation rules - sequential"
@@ -13,7 +13,104 @@ Scenario: Returns a list of the cases for the logged in user (Inbox)
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario Outline: Get paging of list inbox
Given I request "cases/paged?Start=<start>&limit=<limit>"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "<type>"
And the response has <records> records
Examples:
| test_description | start | limit | records | http_code | type |
| lowercase in Start | a | 1 | | 200 | array |
| uppercase in Start | A | 1 | | 200 | array |
| lowercase in Limit | 1 | a | | 200 | array |
| uppercase in Limit | 1 | A | | 200 | array |
| limit=3 | 1 | 3 | | 200 | array |
| start=3 | 3 | 3 | | 200 | array |
| limit and start =3 | 3 | 3 | | 200 | array |
| high number for start | 1000 | 1 | | 200 | array |
| high number for start | 1000 | 0 | | 200 | array |
| empty result | 1 | 0 | | 200 | array |
| empty string | 1 | 10000 | | 200 | array |
| invalid start | b | 25 | | 400 | string |
| invalid limit | 1 | c | | 400 | string |
| start equals zero | 0 | 20 | | 400 | string |
| search 0 | 0 | 0 | | 200 | array |
| search 0 | 0 | 100 | | 200 | array |
| negative numbers in start | -10 | 25 | | 400 | string |
| negative numbers in limit | 1 | -25 | | 400 | string |
| real numbers | 0.0 | 1.0 | | 200 | string |
| real numbers in start | 0.0 | 25 | | 200 | string |
| real numbers in limit | 1 | 1.4599 | | 400 | string |
| only start | 1 | | | 400 | string |
| only limit | | 25 | | 400 | string |
| without start and limit | | | | 400 | string |
Scenario Outline: Get order type of Descending and Acending
Given I request "cases?dir=<dir>"
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 <records> records
Examples:
| test_description | dir | records |
| Order for Acending | asc | |
| Order for Descending | desc | |
Scenario Outline: Get order type of Process Category
Given I request "cases?cat_uid=<cat_uid>"
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 <records> records
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | |
| Filter all categories | | |
Scenario Outline: Get order type of Process
Given I request "cases?pro_uid=<pro_uid>"
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 <records> records
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | |
| Filter all cases | | |
Scenario Outline: Get order type of Search of number the process
Given I request "cases?search=<search>"
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 <records> records
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | |
| Filter all cases | | |
Scenario: Returns a list of the cases for the logged in user (Draft)
Given I request "cases/draft"
@@ -23,12 +120,209 @@ Scenario: Returns a list of the cases for the logged in user (Draft)
And the response has 1 records
Scenario Outline: Get paging of list Draft
Given I request "cases/draft/paged?Start=<start>&limit=<limit>"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "<type>"
And the response has <records> records
Examples:
| test_description | start | limit | records | http_code | type |
| lowercase in Start | a | 1 | | 200 | array |
| uppercase in Start | A | 1 | | 200 | array |
| lowercase in Limit | 1 | a | | 200 | array |
| uppercase in Limit | 1 | A | | 200 | array |
| limit=3 | 1 | 3 | | 200 | array |
| start=3 | 3 | 3 | | 200 | array |
| limit and start =3 | 3 | 3 | | 200 | array |
| high number for start | 1000 | 1 | | 200 | array |
| high number for start | 1000 | 0 | | 200 | array |
| empty result | 1 | 0 | | 200 | array |
| empty string | 1 | 10000 | | 200 | array |
| invalid start | b | 25 | | 400 | string |
| invalid limit | 1 | c | | 400 | string |
| start equals zero | 0 | 20 | | 400 | string |
| search 0 | 0 | 0 | | 200 | array |
| search 0 | 0 | 100 | | 200 | array |
| negative numbers in start | -10 | 25 | | 400 | string |
| negative numbers in limit | 1 | -25 | | 400 | string |
| real numbers | 0.0 | 1.0 | | 200 | string |
| real numbers in start | 0.0 | 25 | | 200 | string |
| real numbers in limit | 1 | 1.4599 | | 400 | string |
| only start | 1 | | | 400 | string |
| only limit | | 25 | | 400 | string |
| without start and limit | | | | 400 | string |
Scenario Outline: Get order type of Descending and Ascending
Given I request "cases/draft?dir=<dir>"
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 <records> records
Examples:
| test_description | dir | records |
| Order for Acending | asc | |
| Order for Descending | desc | |
Scenario Outline: Get order type of Process Category
Given I request "cases/draft?cat_uid=<cat_uid>"
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 <records> records
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | |
| Filter all categories | | |
Scenario Outline: Get order type of Process
Given I request "cases/draft?pro_uid=<pro_uid>"
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 <records> records
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | |
| Filter all cases | | |
Scenario Outline: Get order type of Search of the process
Given I request "cases/draft?search=<search>"
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 <records> records
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | |
| Filter all cases | | |
Scenario: Returns a list of the cases for the logged in user (Participated)
Given I request "cases/participated"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 9 records
And the response has 6 records
Scenario Outline: Get paging of list Participated
Given I request "cases/participated/paged?Start=<start>&limit=<limit>"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "<type>"
And the response has <records> records
Examples:
| test_description | start | limit | records | http_code | type |
| lowercase in Start | a | 1 | | 200 | array |
| uppercase in Start | A | 1 | | 200 | array |
| lowercase in Limit | 1 | a | | 200 | array |
| uppercase in Limit | 1 | A | | 200 | array |
| limit=3 | 1 | 3 | | 200 | array |
| start=3 | 3 | 3 | | 200 | array |
| limit and start =3 | 3 | 3 | | 200 | array |
| high number for start | 1000 | 1 | | 200 | array |
| high number for start | 1000 | 0 | | 200 | array |
| empty result | 1 | 0 | | 200 | array |
| empty string | 1 | 10000 | | 200 | array |
| invalid start | b | 25 | | 400 | string |
| invalid limit | 1 | c | | 400 | string |
| start equals zero | 0 | 20 | | 400 | string |
| search 0 | 0 | 0 | | 200 | array |
| search 0 | 0 | 100 | | 200 | array |
| negative numbers in start | -10 | 25 | | 400 | string |
| negative numbers in limit | 1 | -25 | | 400 | string |
| real numbers | 0.0 | 1.0 | | 200 | string |
| real numbers in start | 0.0 | 25 | | 200 | string |
| real numbers in limit | 1 | 1.4599 | | 400 | string |
| only start | 1 | | | 400 | string |
| only limit | | 25 | | 400 | string |
| without start and limit | | | | 400 | string |
Scenario Outline: Get order type of Descending an Descending
Given I request "cases/participated?dir=<dir>"
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 <records> records
Examples:
| test_description | dir | records |
| Order for Acending | asc | |
| Order for Descending | desc | |
Scenario Outline: Get order type of Process Category
Given I request "cases/participated?cat_uid=<cat_uid>"
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 <records> records
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | |
| Filter all categories | | |
Scenario Outline: Get order type of Process
Given I request "cases/participated?pro_uid=<pro_uid>"
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 <records> records
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | |
| Filter all cases | | |
Scenario Outline: Get order type of Search
Given I request "cases/participated?search=<search>"
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 <records> records
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | |
| Filter all cases | | |
Scenario: Returns a list of the cases for the logged in user (Unassigned)
@@ -39,9 +333,360 @@ Scenario: Returns a list of the cases for the logged in user (Unassigned)
And the response has 1 records
Scenario Outline: Get paging of list Unassigned
Given I request "cases/Unassigned/paged?Start=<start>&limit=<limit>"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "<type>"
And the response has <records> records
Examples:
| test_description | start | limit | records | http_code | type |
| lowercase in Start | a | 1 | | 200 | array |
| uppercase in Start | A | 1 | | 200 | array |
| lowercase in Limit | 1 | a | | 200 | array |
| uppercase in Limit | 1 | A | | 200 | array |
| limit=3 | 1 | 3 | | 200 | array |
| start=3 | 3 | 3 | | 200 | array |
| limit and start =3 | 3 | 3 | | 200 | array |
| high number for start | 1000 | 1 | | 200 | array |
| high number for start | 1000 | 0 | | 200 | array |
| empty result | 1 | 0 | | 200 | array |
| empty string | 1 | 10000 | | 200 | array |
| invalid start | b | 25 | | 400 | string |
| invalid limit | 1 | c | | 400 | string |
| start equals zero | 0 | 20 | | 400 | string |
| search 0 | 0 | 0 | | 200 | array |
| search 0 | 0 | 100 | | 200 | array |
| negative numbers in start | -10 | 25 | | 400 | string |
| negative numbers in limit | 1 | -25 | | 400 | string |
| real numbers | 0.0 | 1.0 | | 200 | string |
| real numbers in start | 0.0 | 25 | | 200 | string |
| real numbers in limit | 1 | 1.4599 | | 400 | string |
| only start | 1 | | | 400 | string |
| only limit | | 25 | | 400 | string |
| without start and limit | | | | 400 | string |
Scenario Outline: Get order type of Descending and Acending
Given I request "cases/unassigned?dir=<dir>"
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 <records> records
Examples:
| test_description | dir | records |
| Order for Acending | asc | |
| Order for Descending | desc | |
Scenario Outline: Get order type of Process Category
Given I request "cases/unassigned?cat_uid=<cat_uid>"
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 <records> records
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | |
| Filter all categories | | |
Scenario Outline: Get order type of Process
Given I request "cases/unassigned?pro_uid=<pro_uid>"
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 <records> records
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | |
| Filter all cases | | |
Scenario Outline: Get order type of Search
Given I request "cases/unassigned?search=<search>"
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 <records> records
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | |
| Filter all cases | | |
Scenario: Returns a list of the cases for the logged in user (Paused)
Given I request "cases/paused"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
And the response has 1 records
Scenario Outline: Get paging of list Paused
Given I request "cases/paused/paged?Start=<start>&limit=<limit>"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "<type>"
And the response has <records> records
Examples:
| test_description | start | limit | records | http_code | type |
| lowercase in Start | a | 1 | | 200 | array |
| uppercase in Start | A | 1 | | 200 | array |
| lowercase in Limit | 1 | a | | 200 | array |
| uppercase in Limit | 1 | A | | 200 | array |
| limit=3 | 1 | 3 | | 200 | array |
| start=3 | 3 | 3 | | 200 | array |
| limit and start =3 | 3 | 3 | | 200 | array |
| high number for start | 1000 | 1 | | 200 | array |
| high number for start | 1000 | 0 | | 200 | array |
| empty result | 1 | 0 | | 200 | array |
| empty string | 1 | 10000 | | 200 | array |
| invalid start | b | 25 | | 400 | string |
| invalid limit | 1 | c | | 400 | string |
| start equals zero | 0 | 20 | | 400 | string |
| search 0 | 0 | 0 | | 200 | array |
| search 0 | 0 | 100 | | 200 | array |
| negative numbers in start | -10 | 25 | | 400 | string |
| negative numbers in limit | 1 | -25 | | 400 | string |
| real numbers | 0.0 | 1.0 | | 200 | string |
| real numbers in start | 0.0 | 25 | | 200 | string |
| real numbers in limit | 1 | 1.4599 | | 400 | string |
| only start | 1 | | | 400 | string |
| only limit | | 25 | | 400 | string |
| without start and limit | | | | 400 | string |
Scenario Outline: Get order type of Descending and Acending
Given I request "cases/paused?dir=<dir>"
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 <records> records
Examples:
| test_description | dir | records |
| Order for Acending | asc | |
| Order for Descending | desc | |
Scenario Outline: Get order type of Process Category
Given I request "cases/paused?cat_uid=<cat_uid>"
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 <records> records
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | |
| Filter all categories | | |
Scenario Outline: Get order type of Process
Given I request "cases/paused?pro_uid=<pro_uid>"
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 <records> records
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | |
| Filter all cases | | |
Scenario Outline: Get order type of Search
Given I request "cases/paused?search=<search>"
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 <records> records
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | |
| Filter all cases | | |
Scenario: Returns a list of the cases for the logged in user (Advanced Search)
Given I request "cases/advanced-search"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario Outline: Get paging of list Advanced Search
Given I request "cases/advanced-search/paged?Start=<start>&limit=<limit>"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "<type>"
And the response has <records> records
Examples:
| test_description | start | limit | records | http_code | type |
| lowercase in Start | a | 1 | | 200 | array |
| uppercase in Start | A | 1 | | 200 | array |
| lowercase in Limit | 1 | a | | 200 | array |
| uppercase in Limit | 1 | A | | 200 | array |
| limit=3 | 1 | 3 | | 200 | array |
| start=3 | 3 | 3 | | 200 | array |
| limit and start =3 | 3 | 3 | | 200 | array |
| high number for start | 1000 | 1 | | 200 | array |
| high number for start | 1000 | 0 | | 200 | array |
| empty result | 1 | 0 | | 200 | array |
| empty string | 1 | 10000 | | 200 | array |
| invalid start | b | 25 | | 400 | string |
| invalid limit | 1 | c | | 400 | string |
| start equals zero | 0 | 20 | | 400 | string |
| search 0 | 0 | 0 | | 200 | array |
| search 0 | 0 | 100 | | 200 | array |
| negative numbers in start | -10 | 25 | | 400 | string |
| negative numbers in limit | 1 | -25 | | 400 | string |
| real numbers | 0.0 | 1.0 | | 200 | string |
| real numbers in start | 0.0 | 25 | | 200 | string |
| real numbers in limit | 1 | 1.4599 | | 400 | string |
| only start | 1 | | | 400 | string |
| only limit | | 25 | | 400 | string |
| without start and limit | | | | 400 | string |
Scenario Outline: Get order type of Descending and Acending
Given I request "cases/advanced-search?dir=<dir>"
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 <records> records
Examples:
| test_description | dir | records |
| Order for Acending | asc | |
| Order for Descending | desc | |
Scenario Outline: Get order type of Process Category
Given I request "cases/advanced-search?cat_uid=<cat_uid>"
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 <records> records
Examples:
| test_description | cat_uid | records |
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | |
| Filter all categories | | |
Scenario Outline: Get order type of Process
Given I request "cases/advanced-search?pro_uid=<pro_uid>"
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 <records> records
Examples:
| test_description | pro_uid | records |
| Filter for cases "Derivation rules - sequential" | 99209594750ec27ea338927000421575 | |
| Filter all cases | | |
Scenario Outline: Get order type of Search
Given I request "cases/advanced-search?search=<search>"
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 <records> records
Examples:
| test_description | search | records |
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 92535130653271a60de2e73021469732 | |
| Filter all cases | | |
Scenario Outline: Get order for Status
Given I request "cases/advanced-search?app_status=<app_status>"
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 <records> records
Examples:
| test_description | app_status | records |
| Filter Status = All Status | | |
| Filter Status = Completed | COMPLETED | |
| Filter Status = Draft | DRAFT | |
| Filter Status = To Do | TO_DO | |
Scenario Outline: Get order for User
Given I request "cases/advanced-search?usr_uid=<usr_uid>"
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 <records> records
Examples:
| test_description | usr_uid | records |
| Filter Status = All User | | |
| Filter Status = aaron | 51049032352d56710347233042615067 | |
| Filter Status = admin | 00000000000000000000000000000001 | |
| Filter Status = chris | 24166330352d56730cdd525035621101 | |
Scenario Outline: Get order for date
Given I request "cases/advanced-search?date_from=<date_from>&date_to=<date_to>"
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 <records> records
Examples:
| test_description | date_from | date_to | records |
| Filter date = 2014-03-01 | 2014-03-01 | 2014-03-20 | |
| Filter date = 2014-03-15 | 2014-03-15 | 2014-03-20 | |

View File

@@ -37,4 +37,10 @@ Scenario: Returns a list of the cases for the logged in user (Paused)
Given I request "cases/paused"
Then the response status code should be 400
And the response has 4 records
And the response status message should have the following text "<records>"
Scenario: Returns a list of the cases for the logged in user (Advanced Search)
Given I request "cases/advanced-search"
Then the response status code should be 400
And the response has 4 records
And the response status message should have the following text "<records>"

View File

@@ -17,7 +17,8 @@ class Applications
$dir = null,
$sort = "APP_CACHE_VIEW.APP_NUMBER",
$category = null,
$configuration = true
$configuration = true,
$paged = false
) {
$callback = isset($callback)? $callback : "stcCallback1001";
$dir = isset($dir)? $dir : "DESC";
@@ -363,7 +364,7 @@ class Applications
//here we count how many records exists for this criteria.
//BUT there are some special cases, and if we dont optimize them the server will crash.
$doCountAlreadyExecuted = false;
$doCountAlreadyExecuted = $paged;
//case 1. when the SEARCH action is selected and none filter, search criteria is defined,
//we need to count using the table APPLICATION, because APP_CACHE_VIEW takes 3 seconds
@@ -378,8 +379,8 @@ class Applications
}
*/
$tableNameAux = '';
if ($doCountAlreadyExecuted == false) {
$totalCount = 0;
if ($doCountAlreadyExecuted == true) {
// in the case of reassign the distinct attribute shows a diferent count result comparing to the
// original list
//Check also $distinct in the method getListCounters(), this in AppCacheView.php

View File

@@ -1501,8 +1501,8 @@ class Processes
try {
$aInput = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( InputdocumentPeer::PRO_UID, $sProUid );
$oDataset = InputdocumentPeer::doSelectRS( $oCriteria );
$oCriteria->add( InputDocumentPeer::PRO_UID, $sProUid );
$oDataset = InputDocumentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
@@ -1597,8 +1597,8 @@ class Processes
try {
$aOutput = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( OutputdocumentPeer::PRO_UID, $sProUid );
$oDataset = OutputdocumentPeer::doSelectRS( $oCriteria );
$oCriteria->add( OutputDocumentPeer::PRO_UID, $sProUid );
$oDataset = OutputDocumentPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {

View File

@@ -54,5 +54,11 @@ class ProcessCategory extends BaseProcessCategory
$aRow = $dataset->getRow();
return $aRow;
}
public function exists ($catUid)
{
$oProCat = ProcessCategoryPeer::retrieveByPk( $catUid );
return (is_object( $oProCat ) && get_class( $oProCat ) == 'ProcessCategory');
}
}

View File

@@ -15,6 +15,7 @@ switch ($request) {
$aVars = array_merge( $aFields['APP_DATA'], $aVars );
$field = $aVars[$fieldname];
$response = new StdClass();
$response->headers = Array ();
$response->columns = Array ();
$response->rows = Array ();
@@ -81,6 +82,7 @@ switch ($request) {
$aVars = G::getSystemConstants();
}
ksort( $aVars );
$return_object = new StdClass();
$return_object->totalCount = 1;
foreach ($aVars as $i => $var) {
if (is_array( $var ) || is_object( $var )) {

View File

@@ -37,7 +37,7 @@ class Cases
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APP_CACHE_VIEW.APP_NUMBER";
$start = isset( $dataList["start"] ) ? $dataList["start"] : "0";
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "25";
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "config";
$filter = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
$process = isset( $dataList["process"] ) ? $dataList["process"] : "";
$category = isset( $dataList["category"] ) ? $dataList["category"] : "";
@@ -45,9 +45,10 @@ class Cases
$user = isset( $dataList["user"] ) ? $dataList["user"] : "";
$search = isset( $dataList["search"] ) ? $dataList["search"] : "";
$action = isset( $dataList["action"] ) ? $dataList["action"] : "todo";
$paged = isset( $dataList["paged"] ) ? $dataList["paged"] : true;
$type = "extjs";
$dateFrom = isset( $dataList["dateFrom"] ) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
$dateTo = isset( $dataList["dateTo"] ) ? substr( $dataList["dateTo"], 0, 10 ) : "";
$dateFrom = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
$dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
$first = isset( $dataList["first"] ) ? true :false;
$valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search');
@@ -55,6 +56,55 @@ class Cases
throw (new \Exception('The value for $action is incorrect.'));
}
$start = (int)$start;
$start = abs($start);
if ($start != 0) {
$start--;
}
if ($limit == 'config') {
G::LoadClass("configuration");
$conf = new \Configurations();
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
if (isset($generalConfCasesList['casesListRowNumber'])) {
$limit = (int)$generalConfCasesList['casesListRowNumber'];
} else {
$limit = 25;
}
} else {
$limit = (int)$limit;
}
if ($sort != 'APP_CACHE_VIEW.APP_NUMBER') {
$sort = G::toUpper($sort);
$columnsAppCacheView = \AppCacheViewPeer::getFieldNames(\BasePeer::TYPE_FIELDNAME);
if (!(in_array($sort, $columnsAppCacheView))) {
$sort = 'APP_CACHE_VIEW.APP_NUMBER';
}
}
$dir = G::toUpper($dir);
if (!($dir == 'DESC' || $dir == 'ASC')) {
$dir = 'DESC';
}
if ($process != '') {
Validator::proUid($process, '$pro_uid');
}
if ($category != '') {
Validator::catUid($category, '$cat_uid');
}
$status = G::toUpper($status);
$listStatus = array('TODO', 'DRAFT', 'COMPLETED', 'CANCEL', 'OPEN', 'CLOSE');
if (!(in_array($status, $listStatus))) {
$status = '';
}
if ($user != '') {
Validator::usrUid($user, '$usr_uid');
}
if ($dateFrom != '') {
Validator::isDate($dateFrom, 'Y-m-d', '$date_from');
}
if ($dateTo != '') {
Validator::isDate($dateTo, 'Y-m-d', '$date_to');
}
if ($action == 'search' || $action == 'to_reassign') {
$userUid = ($user == "CURRENT_USER") ? $userUid : $user;
if ($first) {
@@ -123,7 +173,9 @@ class Cases
$callback,
$dir,
(strpos($sort, ".") !== false)? $sort : "APP_CACHE_VIEW." . $sort,
$category
$category,
true,
$paged
);
}
if (!empty($result['data'])) {
@@ -131,6 +183,25 @@ class Cases
$value = array_change_key_case($value, CASE_LOWER);
}
}
if ($paged == false) {
$result = $result['data'];
} else {
$result['total'] = $result['totalCount'];
unset($result['totalCount']);
$result['start'] = $start+1;
$result['limit'] = $limit;
$result['sort'] = G::toLower($sort);
$result['dir'] = G::toLower($dir);
$result['cat_uid'] = $category;
$result['pro_uid'] = $process;
$result['search'] = $search;
if ($action == 'search') {
$result['app_status'] = G::toLower($status);
$result['usr_uid'] = $user;
$result['date_from'] = $dateFrom;
$result['date_to'] = $dateTo;
}
}
return $result;
}
@@ -258,7 +329,7 @@ class Cases
for ($i = 0; $i<=count($array['current_task'])-1; $i++) {
$current_task = $array['current_task'][$i];
$current_task['usr_uid'] = $current_task['userId'];
$current_task['usr_name'] = $current_task['userName'];
$current_task['usr_name'] = trim($current_task['userName']);
$current_task['tas_uid'] = $current_task['taskId'];
$current_task['tas_title'] = $current_task['taskName'];
$current_task['del_index'] = $current_task['delIndex'];
@@ -349,7 +420,7 @@ class Cases
for ($i = 0; $i<=count($array['current_task'])-1; $i++) {
$current_task = $array['current_task'][$i];
$current_task['usr_uid'] = $current_task['userId'];
$current_task['usr_name'] = $current_task['userName'];
$current_task['usr_name'] = trim($current_task['userName']);
$current_task['tas_uid'] = $current_task['taskId'];
$current_task['tas_title'] = $current_task['taskName'];
$current_task['del_index'] = $current_task['delIndex'];
@@ -432,7 +503,6 @@ class Cases
if(empty($result)) {
throw (new \Exception('Incorrect or unavailable information about this case: ' .$applicationUid));
} else {
$result = json_decode(json_encode($result), false);
return $result;
}
} catch (\Exception $e) {
@@ -496,6 +566,8 @@ class Cases
$ws = new \wsBase();
if ($variables) {
$variables = array_shift($variables);
} elseif ($variables == null) {
$variables = array(array());
}
$fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
$array = json_decode(json_encode($fields), true);
@@ -698,7 +770,6 @@ class Cases
}
}
/**
* get all upload document that they have send it
*
@@ -990,4 +1061,232 @@ class Cases
$oCriteria->addDescendingOrderByColumn('CREATE_DATE');
return $oCriteria;
}
/*
* get all generate document
*
* @name getAllGeneratedDocumentsCriteria
* @param string $sProcessUID
* @param string $sApplicationUID
* @param string $sTasKUID
* @param string $sUserUID
* @return object
*/
public function getAllGeneratedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID)
{
\G::LoadClass("configuration");
$conf = new \Configurations();
$confEnvSetting = $conf->getFormats();
//verifica si la tabla OBJECT_PERMISSION
$cases = new \cases();
$cases->verifyTable();
$listing = false;
$oPluginRegistry = & \PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new \folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "OUTPUT";
$folderData->returnList = true;
//$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
$aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);
if (!is_array($aObjectPermissions)) {
$aObjectPermissions = array('DYNAFORMS' => array(-1),'INPUT_DOCUMENTS' => array(-1),'OUTPUT_DOCUMENTS' => array(-1));
}
if (!isset($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1);
} else {
if (!is_array($aObjectPermissions['DYNAFORMS'])) {
$aObjectPermissions['DYNAFORMS'] = array(-1);
}
}
if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
} else {
if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
$aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
}
}
if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
} else {
if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
$aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
}
}
$aDelete = $cases->getAllObjectsFrom($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID, 'DELETE');
$oAppDocument = new \AppDocument();
$oCriteria = new \Criteria('workflow');
$oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID);
$oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
$oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN);
//$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], Criteria::IN);
$oCriteria->add(
$oCriteria->getNewCriterion(
\AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], \Criteria::IN)->addOr($oCriteria->getNewCriterion(\AppDocumentPeer::USR_UID, $sUserUID, \Criteria::EQUAL))
);
$aConditions = array();
$aConditions[] = array(\AppDocumentPeer::APP_UID, \AppDelegationPeer::APP_UID);
$aConditions[] = array(\AppDocumentPeer::DEL_INDEX, \AppDelegationPeer::DEL_INDEX);
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
$oCriteria->add(\AppDelegationPeer::PRO_UID, $sProcessUID);
$oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX);
$oDataset = \AppDocumentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aOutputDocuments = array();
$aOutputDocuments[] = array(
'APP_DOC_UID' => 'char',
'DOC_UID' => 'char',
'APP_DOC_COMMENT' => 'char',
'APP_DOC_FILENAME' => 'char',
'APP_DOC_INDEX' => 'integer'
);
$oUser = new \Users();
while ($aRow = $oDataset->getRow()) {
$oCriteria2 = new \Criteria('workflow');
$oCriteria2->add(\AppDelegationPeer::APP_UID, $sApplicationUID);
$oCriteria2->add(\AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']);
$oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria2);
$oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$oTask = new \Task();
if ($oTask->taskExists($aRow2['TAS_UID'])) {
$aTask = $oTask->load($aRow2['TAS_UID']);
} else {
$aTask = array('TAS_TITLE' => '(TASK DELETED)');
}
$lastVersion = $oAppDocument->getLastDocVersion($aRow['DOC_UID'], $sApplicationUID);
if ($lastVersion == $aRow['DOC_VERSION']) {
//Only show last document Version
$aAux = $oAppDocument->load($aRow['APP_DOC_UID'], $aRow['DOC_VERSION']);
//Get output Document information
$oOutputDocument = new \OutputDocument();
$aGields = $oOutputDocument->load($aRow['DOC_UID']);
//OUTPUTDOCUMENT
$outDocTitle = $aGields['OUT_DOC_TITLE'];
switch ($aGields['OUT_DOC_GENERATE']) {
//G::LoadTranslation(ID_DOWNLOAD)
case "PDF":
$fileDoc = 'javascript:alert("NO DOC")';
$fileDocLabel = " ";
$filePdf = 'cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand();
$filePdfLabel = ".pdf";
if (is_array($listing)) {
foreach ($listing as $folderitem) {
if (($folderitem->filename == $aRow['APP_DOC_UID']) && ($folderitem->type == "PDF")) {
$filePdfLabel = \G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .pdf";
$filePdf = $folderitem->downloadScript;
continue;
}
}
}
break;
case "DOC":
$fileDoc = 'cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand();
$fileDocLabel = ".doc";
$filePdf = 'javascript:alert("NO PDF")';
$filePdfLabel = " ";
if (is_array($listing)) {
foreach ($listing as $folderitem) {
if (($folderitem->filename == $aRow['APP_DOC_UID']) && ($folderitem->type == "DOC")) {
$fileDocLabel = \G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .doc";
$fileDoc = $folderitem->downloadScript;
continue;
}
}
}
break;
case "BOTH":
$fileDoc = 'cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand();
$fileDocLabel = ".doc";
if (is_array($listing)) {
foreach ($listing as $folderitem) {
if (($folderitem->filename == $aRow['APP_DOC_UID']) && ($folderitem->type == "DOC")) {
$fileDocLabel = G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .doc";
$fileDoc = $folderitem->downloadScript;
continue;
}
}
}
$filePdf = 'cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand();
$filePdfLabel = ".pdf";
if (is_array($listing)) {
foreach ($listing as $folderitem) {
if (($folderitem->filename == $aRow['APP_DOC_UID']) && ($folderitem->type == "PDF")) {
$filePdfLabel = \G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .pdf";
$filePdf = $folderitem->downloadScript;
continue;
}
}
}
break;
}
try {
$aAux1 = $oUser->load($aAux['USR_UID']);
$sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]);
} catch (\Exception $oException) {
$sUser = '(USER DELETED)';
}
//if both documents were generated, we choose the pdf one, only if doc was
//generate then choose the doc file.
$firstDocLink = $filePdf;
$firstDocLabel = $filePdfLabel;
if ($aGields['OUT_DOC_GENERATE'] == 'DOC') {
$firstDocLink = $fileDoc;
$firstDocLabel = $fileDocLabel;
}
$aFields = array(
'APP_DOC_UID' => $aAux['APP_DOC_UID'],
'DOC_UID' => $aAux['DOC_UID'],
'APP_DOC_COMMENT' => $aAux['APP_DOC_COMMENT'],
'APP_DOC_FILENAME' => $aAux['APP_DOC_FILENAME'],
'APP_DOC_INDEX' => $aAux['APP_DOC_INDEX'],
'ORIGIN' => $aTask['TAS_TITLE'],
'CREATE_DATE' => $aAux['APP_DOC_CREATE_DATE'],
'CREATED_BY' => $sUser,
'FILEDOC' => $fileDoc,
'FILEPDF' => $filePdf,
'OUTDOCTITLE' => $outDocTitle,
'DOC_VERSION' => $aAux['DOC_VERSION'],
'TYPE' => $aAux['APP_DOC_TYPE'] . ' ' . $aGields['OUT_DOC_GENERATE'],
'DOWNLOAD_LINK' => $firstDocLink,
'DOWNLOAD_FILE' => $aAux['APP_DOC_FILENAME'] . $firstDocLabel
);
if (trim($fileDocLabel) != '') {
$aFields['FILEDOCLABEL'] = $fileDocLabel;
}
if (trim($filePdfLabel) != '') {
$aFields['FILEPDFLABEL'] = $filePdfLabel;
}
if ($aFields['APP_DOC_FILENAME'] != '') {
$aFields['TITLE'] = $aFields['APP_DOC_FILENAME'];
} else {
$aFields['TITLE'] = $aFields['APP_DOC_COMMENT'];
}
//$aFields['POSITION'] = $_SESSION['STEP_POSITION'];
$aFields['CONFIRM'] = \G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT');
if (in_array($aRow['APP_DOC_UID'], $aObjectPermissions['OUTPUT_DOCUMENTS'])) {
if (in_array($aRow['APP_DOC_UID'], $aDelete['OUTPUT_DOCUMENTS'])) {
$aFields['ID_DELETE'] = \G::LoadTranslation('ID_DELETE');
}
}
$aOutputDocuments[] = $aFields;
}
$oDataset->next();
}
global $_DBArray;
$_DBArray['outputDocuments'] = $aOutputDocuments;
\G::LoadClass('ArrayPeer');
$oCriteria = new \Criteria('dbarray');
$oCriteria->setDBArrayTable('outputDocuments');
$oCriteria->addDescendingOrderByColumn('CREATE_DATE');
return $oCriteria;
}
}

View File

@@ -0,0 +1,234 @@
<?php
namespace BusinessModel\Cases;
class InputDocument
{
/**
* Get data of Cases InputDocument
*
* @param string $caseUid
* @param string $userUid
*
* return array Return an array with data of an InputDocument
*/
public function getCasesInputDocuments($caseUid, $userUid)
{
try {
$sApplicationUID = $caseUid;
$sUserUID = $userUid;
\G::LoadClass('case');
$oCase = new \Cases();
$fields = $oCase->loadCase( $sApplicationUID );
$sProcessUID = $fields['PRO_UID'];
$sTaskUID = '';
$oCaseRest = new \BusinessModel\Cases();
$oCaseRest->getAllUploadedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID);
$result = array ();
global $_DBArray;
foreach ($_DBArray['inputDocuments'] as $key => $row) {
if (isset( $row['DOC_VERSION'] )) {
$docrow = array ();
$docrow['app_doc_uid'] = $row['APP_DOC_UID'];
$docrow['app_doc_filename'] = $row['APP_DOC_FILENAME'];
$docrow['doc_uid'] = $row['DOC_UID'];
$docrow['app_doc_version'] = $row['DOC_VERSION'];
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
$result[] = $docrow;
}
}
return $result;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data of Cases InputDocument
*
* @param string $caseUid
* @param string $userUid
* @param string $inputDocumentUid
*
* return array Return an array with data of an InputDocument
*/
public function getCasesInputDocument($caseUid, $userUid, $inputDocumentUid)
{
try {
$sApplicationUID = $caseUid;
$sUserUID = $userUid;
\G::LoadClass('case');
$oCase = new \Cases();
$fields = $oCase->loadCase( $sApplicationUID );
$sProcessUID = $fields['PRO_UID'];
$sTaskUID = '';
$oCaseRest = new \BusinessModel\Cases();
$oCaseRest->getAllUploadedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
$result = array ();
global $_DBArray;
foreach ($_DBArray['inputDocuments'] as $key => $row) {
if (isset( $row['DOC_VERSION'] )) {
$docrow = array ();
$docrow['app_doc_uid'] = $row['APP_DOC_UID'];
$docrow['app_doc_filename'] = $row['APP_DOC_FILENAME'];
$docrow['doc_uid'] = $row['DOC_UID'];
$docrow['app_doc_version'] = $row['DOC_VERSION'];
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
if ($docrow['app_doc_uid'] == $inputDocumentUid) {
$result = $docrow;
}
}
}
return $result;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Delete InputDocument
*
* @param string $inputDocumentUid
*
* return array Return an array with data of an InputDocument
*/
public function removeInputDocument($inputDocumentUid)
{
try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This row doesn\'t exist!'));
}
\G::LoadClass('wsBase');
$ws = new \wsBase();
$ws->removeDocument($inputDocumentUid);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data of Cases InputDocument
*
* @param string $caseUid
* @param string $inputDocumentUid
* @param string $userUid
*
* return array Return an array with data of an InputDocument
*/
public function addCasesInputDocument($caseUid, $inputDocumentUid, $userUid)
{
try {
if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) {
$code = $_FILES['form']['error']['APP_DOC_FILENAME'];
switch ($code) {
case UPLOAD_ERR_INI_SIZE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' );
break;
case UPLOAD_ERR_FORM_SIZE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' );
break;
case UPLOAD_ERR_PARTIAL:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' );
break;
case UPLOAD_ERR_NO_FILE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' );
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' );
break;
case UPLOAD_ERR_CANT_WRITE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' );
break;
case UPLOAD_ERR_EXTENSION:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' );
break;
default:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' );
break;
}
\G::SendMessageText( $message, "ERROR" );
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
\G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
die();
}
\G::LoadClass("case");
//$inputDocumentUid = $_GET["UID"]; //$_POST["form"]["DOC_UID"]
$appDocUid = '';
//$appDocUid = $_POST["form"]["APP_DOC_UID"];
$docVersion = '';
//$docVersion = intval($_POST["form"]["docVersion"]);
$appDocType = 'INPUT';
//$appDocType = $_POST["form"]["APP_DOC_TYPE"];
$appDocComment = (isset($_POST["form"]["APP_DOC_COMMENT"]))? $_POST["form"]["APP_DOC_COMMENT"] : "";
$actionType = $_POST["form"]["actionType"];
$case = new \Cases();
$case->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs");
//Load the fields
$arrayField = $case->loadCase($_SESSION["APPLICATION"]);
$arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], \G::getSystemConstants());
//Triggers
$arrayTrigger = $case->loadTriggers($_SESSION["TASK"], "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
//Add Input Document
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
$appDocUid = $case->addInputDocument(
$inputDocumentUid,
$appDocUid,
$docVersion,
$appDocType,
$appDocComment,
$actionType,
$_SESSION["APPLICATION"],
$_SESSION["INDEX"],
$_SESSION["TASK"],
$_SESSION["USER_LOGGED"],
"xmlform",
$_FILES["form"]["name"]["APP_DOC_FILENAME"],
$_FILES["form"]["error"]["APP_DOC_FILENAME"],
$_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]
);
}
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
//Trigger - Execute after - Start
$arrayField["APP_DATA"] = $case->executeTriggers(
$_SESSION["TASK"],
"INPUT_DOCUMENT",
$inputDocumentUid,
"AFTER",
$arrayField["APP_DATA"]
);
//Trigger - Execute after - End
}
//Save data
$arrayData = array();
$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
//$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"];
$arrayData["APP_DATA"] = $arrayField["APP_DATA"];
$arrayData["DEL_INDEX"] = $_SESSION["INDEX"];
$arrayData["TAS_UID"] = $_SESSION["TASK"];
$case->updateCase($_SESSION["APPLICATION"], $arrayData);
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -0,0 +1,230 @@
<?php
namespace BusinessModel\Cases;
class OutputDocument
{
/**
* Get data of Cases OutputDocument
*
* @param string $caseUid
* @param string $userUid
*
* return array Return an array with data of an OutputDocument
*/
public function getCasesOutputDocuments($caseUid, $userUid)
{
try {
\G::LoadClass('case');
$oCase = new \Cases();
$fields = $oCase->loadCase( $caseUid );
$sProcessUID = $fields['PRO_UID'];
$sTaskUID = '';
$oCriteria = new \BusinessModel\Cases();
$oCriteria->getAllGeneratedDocumentsCriteria( $sProcessUID, $caseUid, $sTaskUID, $userUid);
$result = array ();
global $_DBArray;
foreach ($_DBArray['outputDocuments'] as $key => $row) {
if (isset( $row['DOC_VERSION'] )) {
$docrow = array ();
$docrow['app_doc_uid'] = $row['APP_DOC_UID'];
$docrow['app_doc_filename'] = $row['DOWNLOAD_FILE'];
$docrow['doc_uid'] = $row['DOC_UID'];
$docrow['app_doc_version'] = $row['DOC_VERSION'];
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
$result[] = $docrow;
}
}
return $result;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data of Cases OutputDocument
*
* @param string $caseUid
* @param string $userUid
* @param string $outputDocumentUid
*
* return array Return an array with data of an OutputDocument
*/
public function getCasesOutputDocument($caseUid, $userUid, $outputDocumentUid)
{
try {
$sApplicationUID = $caseUid;
$sUserUID = $userUid;
\G::LoadClass('case');
$oCase = new \Cases();
$fields = $oCase->loadCase( $sApplicationUID );
$sProcessUID = $fields['PRO_UID'];
$sTaskUID = '';
$oCaseRest = new \BusinessModel\Cases();
$oCaseRest->getAllGeneratedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
$result = array ();
global $_DBArray;
foreach ($_DBArray['outputDocuments'] as $key => $row) {
if (isset( $row['DOC_VERSION'] )) {
$docrow = array ();
$docrow['app_doc_uid'] = $row['APP_DOC_UID'];
$docrow['app_doc_filename'] = $row['DOWNLOAD_FILE'];
$docrow['doc_uid'] = $row['DOC_UID'];
$docrow['app_doc_version'] = $row['DOC_VERSION'];
$docrow['app_doc_create_date'] = $row['CREATE_DATE'];
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
if ($docrow['app_doc_uid'] == $outputDocumentUid) {
$result = $docrow;
}
}
}
return $result;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Delete OutputDocument
*
* @param string $outputDocumentUid
*
* return array Return an array with data of an OutputDocument
*/
public function removeOutputDocument($outputDocumentUid)
{
try {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $outputDocumentUid, 1 );
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
throw (new \Exception('This row doesn\'t exist!'));
}
\G::LoadClass('wsBase');
$ws = new \wsBase();
$ws->removeDocument($outputDocumentUid);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data of Cases OutputDocument
*
* @param string $caseUid
* @param string $outputDocumentUid
* @param string $userUid
*
* return array Return an array with data of an OutputDocument
*/
public function addCasesOutputDocument($caseUid, $outputDocumentUid, $userUid)
{
try {
if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) {
$code = $_FILES['form']['error']['APP_DOC_FILENAME'];
switch ($code) {
case UPLOAD_ERR_INI_SIZE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' );
break;
case UPLOAD_ERR_FORM_SIZE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' );
break;
case UPLOAD_ERR_PARTIAL:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' );
break;
case UPLOAD_ERR_NO_FILE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' );
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' );
break;
case UPLOAD_ERR_CANT_WRITE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' );
break;
case UPLOAD_ERR_EXTENSION:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' );
break;
default:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' );
break;
}
\G::SendMessageText( $message, "ERROR" );
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
\G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
die();
}
\G::LoadClass("case");
//$inputDocumentUid = $_GET["UID"]; //$_POST["form"]["DOC_UID"]
$appDocUid = '';
//$appDocUid = $_POST["form"]["APP_DOC_UID"];
$docVersion = '';
//$docVersion = intval($_POST["form"]["docVersion"]);
$appDocType = 'INPUT';
//$appDocType = $_POST["form"]["APP_DOC_TYPE"];
$appDocComment = (isset($_POST["form"]["APP_DOC_COMMENT"]))? $_POST["form"]["APP_DOC_COMMENT"] : "";
$actionType = $_POST["form"]["actionType"];
$case = new \Cases();
$case->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs");
//Load the fields
$arrayField = $case->loadCase($_SESSION["APPLICATION"]);
$arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], \G::getSystemConstants());
//Triggers
$arrayTrigger = $case->loadTriggers($_SESSION["TASK"], "INPUT_DOCUMENT", $outputDocumentUid, "AFTER");
//Add Input Document
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
$appDocUid = $case->addInputDocument(
$outputDocumentUid,
$appDocUid,
$docVersion,
$appDocType,
$appDocComment,
$actionType,
$_SESSION["APPLICATION"],
$_SESSION["INDEX"],
$_SESSION["TASK"],
$_SESSION["USER_LOGGED"],
"xmlform",
$_FILES["form"]["name"]["APP_DOC_FILENAME"],
$_FILES["form"]["error"]["APP_DOC_FILENAME"],
$_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]
);
}
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
//Trigger - Execute after - Start
$arrayField["APP_DATA"] = $case->executeTriggers(
$_SESSION["TASK"],
"INPUT_DOCUMENT",
$outputDocumentUid,
"AFTER",
$arrayField["APP_DATA"]
);
//Trigger - Execute after - End
}
//Save data
$arrayData = array();
$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
//$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"];
$arrayData["APP_DATA"] = $arrayField["APP_DATA"];
$arrayData["DEL_INDEX"] = $_SESSION["INDEX"];
$arrayData["TAS_UID"] = $_SESSION["TASK"];
$case->updateCase($_SESSION["APPLICATION"], $arrayData);
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -171,6 +171,56 @@ class Validator{
return $tri_uid;
}
/**
* Validate pro_uid
*
* @param string $pro_uid, Uid for process
* @param string $nameField . Name of field for message
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return string
*/
static public function proUid($pro_uid, $nameField = 'pro_uid')
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The process with $nameField: '' does not exist."));
}
$oProcess = new \Process();
if (!($oProcess->exists($pro_uid))) {
throw (new \Exception("The process with $nameField: '$pro_uid' does not exist."));
}
return $pro_uid;
}
/**
* Validate cat_uid
*
* @param string $cat_uid, Uid for category
* @param string $nameField . Name of field for message
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return string
*/
static public function catUid($cat_uid, $nameField = 'cat_uid')
{
$cat_uid = trim($cat_uid);
if ($cat_uid == '') {
throw (new \Exception("The category with $nameField: '' does not exist."));
}
$oCategory = new \ProcessCategory();
if (!($oCategory->exists($cat_uid))) {
throw (new \Exception("The category with $nameField: '$cat_uid' does not exist."));
}
return $cat_uid;
}
/**
* Validate date
*

View File

@@ -87,6 +87,10 @@ abstract class Exporter
$oProcess = new \Processes();
$workflowData = (array) $oProcess->getWorkflowData($this->prjUid);
$workflowData["process"]['PRO_DYNAFORMS'] = empty($workflowData["process"]['PRO_DYNAFORMS'])
? "" : serialize($workflowData["process"]['PRO_DYNAFORMS']);
$workflowData["process"] = array($workflowData["process"]);
$workflowData["processCategory"] = empty($workflowData["processCategory"]) ? array() : $workflowData["processCategory"];

View File

@@ -18,7 +18,13 @@ class Cases extends Api
/**
* Get list Cases To Do
*
* @param array $request_data , Data for list
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -26,13 +32,77 @@ class Cases extends Api
*
* @url GET
*/
public function doGetCasesListToDo($request_data = array())
public function doGetCasesListToDo(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$request_data['action'] = 'todo';
$request_data['userId'] = $this->getUserId();
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'todo';
$dataList['paged'] = false;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($request_data);
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Cases To Do with paged
*
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /paged
*/
public function doGetCasesListToDoPaged(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'todo';
$dataList['paged'] = true;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -42,7 +112,13 @@ class Cases extends Api
/**
* Get list Cases Draft
*
* @param array $request_data , Data for list
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -50,13 +126,77 @@ class Cases extends Api
*
* @url GET /draft
*/
public function doGetCasesListDraft($request_data = array())
public function doGetCasesListDraft(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$request_data['action'] = 'draft';
$request_data['userId'] = $this->getUserId();
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'draft';
$dataList['paged'] = false;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($request_data);
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Cases Draft with paged
*
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /draft/paged
*/
public function doGetCasesListDraftPaged(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'draft';
$dataList['paged'] = true;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -66,7 +206,13 @@ class Cases extends Api
/**
* Get list Cases Participated
*
* @param array $request_data , Data for list
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -74,13 +220,77 @@ class Cases extends Api
*
* @url GET /participated
*/
public function doGetCasesListParticipated($request_data = array())
public function doGetCasesListParticipated(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$request_data['action'] = 'sent';
$request_data['userId'] = $this->getUserId();
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'sent';
$dataList['paged'] = false;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($request_data);
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Cases Participated with paged
*
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /participated/paged
*/
public function doGetCasesListParticipatedPaged(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'sent';
$dataList['paged'] = true;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -90,7 +300,13 @@ class Cases extends Api
/**
* Get list Cases Unassigned
*
* @param array $request_data , Data for list
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -98,13 +314,77 @@ class Cases extends Api
*
* @url GET /unassigned
*/
public function doGetCasesListUnassigned($request_data = array())
public function doGetCasesListUnassigned(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$request_data['action'] = 'unassigned';
$request_data['userId'] = $this->getUserId();
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'unassigned';
$dataList['paged'] = false;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($request_data);
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Cases Unassigned with paged
*
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /unassigned/paged
*/
public function doGetCasesListUnassignedPaged(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'unassigned';
$dataList['paged'] = true;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -114,7 +394,13 @@ class Cases extends Api
/**
* Get list Cases Paused
*
* @param array $request_data , Data for list
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -122,13 +408,77 @@ class Cases extends Api
*
* @url GET /paused
*/
public function doGetCasesListPaused($request_data = array())
public function doGetCasesListPaused(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$request_data['action'] = 'paused';
$request_data['userId'] = $this->getUserId();
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'paused';
$dataList['paged'] = false;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($request_data);
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Cases Paused with paged
*
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /paused/paged
*/
public function doGetCasesListPausedPaged(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$search = ''
)
{
try {
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'paused';
$dataList['paged'] = false;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -138,7 +488,17 @@ class Cases extends Api
/**
* Get list Cases Advanced Search
*
* @param array $request_data , Data for list
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $app_status {@from path}
* @param string $user {@from path}
* @param string $dateFrom {@from path}
* @param string $dateTo {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -146,13 +506,97 @@ class Cases extends Api
*
* @url GET /advanced-search
*/
public function doGetCasesListAdvancedSearch($request_data = array())
public function doGetCasesListAdvancedSearch(
$start = 0,
$limit = 25,
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$app_status = '',
$user = '',
$dateFrom = '',
$dateTo = '',
$search = ''
)
{
try {
$request_data['action'] = 'search';
$request_data['userId'] = $this->getUserId();
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'search';
$dataList['paged'] = false;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['status'] = $app_status;
$dataList['user'] = $user;
$dataList['dateFrom'] = $dateFrom;
$dataList['dateTo'] = $dateTo;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($request_data);
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Cases Advanced Search with Paged
*
* @param string $paged {@from path}
* @param string $start {@from path}
* @param string $limit {@from path}
* @param string $dir {@from path}
* @param string $cat_uid {@from path}
* @param string $pro_uid {@from path}
* @param string $app_status {@from path}
* @param string $usr_uid {@from path}
* @param string $dateFrom {@from path}
* @param string $dateTo {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /advanced-search/paged
*/
public function doGetCasesListAdvancedSearchPaged(
$start = 0,
$limit = 'config',
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
$dir = 'DESC',
$cat_uid = '',
$pro_uid = '',
$app_status = '',
$usr_uid = '',
$date_from = '',
$date_to = '',
$search = ''
)
{
try {
$dataList['userId'] = $this->getUserId();
$dataList['action'] = 'search';
$dataList['paged'] = true;
$dataList['start'] = $start;
$dataList['limit'] = $limit;
$dataList['sort'] = $sort;
$dataList['dir'] = $dir;
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['status'] = $app_status;
$dataList['user'] = $usr_uid;
$dataList['dateFrom'] = $date_from;
$dataList['dateTo'] = $date_to;
$dataList['search'] = $search;
$oCases = new \BusinessModel\Cases();
$response = $oCases->getList($dataList);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -220,6 +664,7 @@ class Cases extends Api
* @param string $usr_uid {@from body} {@min 32}{@max 32}
* @param string $tas_uid {@from body} {@min 32}{@max 32}
* @param array $variables {@from body}
*
*/
public function doPostCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables=null)
{

View File

@@ -0,0 +1,83 @@
<?php
namespace Services\Api\ProcessMaker\Cases;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Cases\InputDocument Api Controller
*
* @protected
*/
class InputDocument extends Api
{
/**
* @url GET /:cas_uid/input-documents
*
* @param string $cas_uid {@min 32}{@max 32}
*/
public function doGetInputDocuments($cas_uid)
{
try {
$userUid = $this->getUserId();
$inputDocument = new \BusinessModel\Cases\InputDocument();
$response = $inputDocument->getCasesInputDocuments($cas_uid, $userUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:cas_uid/input-document/:inp_doc_uid
*
* @param string $cas_uid {@min 32}{@max 32}
* @param string $inp_doc_uid {@min 32}{@max 32}
*/
public function doGetInputDocument($cas_uid, $inp_doc_uid)
{
try {
$userUid = $this->getUserId();
$inputDocument = new \BusinessModel\Cases\InputDocument();
$response = $inputDocument->getCasesInputDocument($cas_uid, $userUid, $inp_doc_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:cas_uid/input-document/:inp_doc_uid
*
* @param string $cas_uid {@min 32}{@max 32}
* @param string $inp_doc_uid {@min 32}{@max 32}
*/
public function doDeleteInputDocument($cas_uid, $inp_doc_uid)
{
try {
$inputDocument = new \BusinessModel\Cases\InputDocument();
$inputDocument->removeInputDocument($inp_doc_uid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /:cas_uid/input-document
*
* @param string $cas_uid {@min 32}{@max 32}
* @param string $inp_doc_uid {@min 32}{@max 32}
*/
public function doPostInputDocument($cas_uid, $inp_doc_uid)
{
try {
$userUid = $this->getUserId();
$inputDocument = new \BusinessModel\Cases\InputDocument();
$response = $inputDocument->addCasesInputDocument($cas_uid, $inp_doc_uid, $userUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -0,0 +1,81 @@
<?php
namespace Services\Api\ProcessMaker\Cases;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Cases\OutputDocument Api Controller
*
* @protected
*/
class OutputDocument extends Api
{
/**
* @url GET /:cas_uid/output-documents
*
* @param string $cas_uid {@min 32}{@max 32}
*/
public function doGetOutputDocuments($cas_uid)
{
try {
$userUid = $this->getUserId();
$outputDocument = new \BusinessModel\Cases\OutputDocument();
$response = $outputDocument->getCasesOutputDocuments($cas_uid, $userUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:cas_uid/output-document/:out_doc_uid
*
* @param string $cas_uid {@min 32}{@max 32}
* @param string $out_doc_uid {@min 32}{@max 32}
*/
public function doGetOutputDocument($cas_uid, $out_doc_uid)
{
try {
$userUid = $this->getUserId();
$outputDocument = new \BusinessModel\Cases\OutputDocument();
$response = $outputDocument->getCasesOutputDocument($cas_uid, $userUid, $out_doc_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:cas_uid/output-document/:out_doc_uid
*
* @param string $cas_uid {@min 32}{@max 32}
* @param string $out_doc_uid {@min 32}{@max 32}
*/
public function doDeleteOutputDocument($cas_uid, $out_doc_uid)
{
try {
$outputDocument = new \BusinessModel\Cases\OutputDocument();
$outputDocument->removeOutputDocument($out_doc_uid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /:cas_uid/output-document
*
* @param string $cas_uid {@min 32}{@max 32}
* @param string $out_doc_uid {@min 32}{@max 32}
*/
public function doPostOutputDocument($cas_uid, $out_doc_uid)
{
try {
$userUid = $this->getUserId();
$outputDocument = new \BusinessModel\Cases\OutputDocument();
$response = $outputDocument->addCasesOutputDocument($cas_uid, $out_doc_uid, $userUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -64,4 +64,5 @@ debug = 1
[alias: cases]
case = "Services\Api\ProcessMaker\Case"
input-document = "Services\Api\ProcessMaker\Cases\InputDocument"
input-document = "Services\Api\ProcessMaker\Cases\InputDocument"
output-document = "Services\Api\ProcessMaker\Cases\OutputDocument"

View File

@@ -171,5 +171,108 @@ class CasesTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(is_numeric($response['totalCount']));
$this->assertTrue(is_array($response['data']));
}
/**
* Test add Case
*
* @covers \BusinessModel\Cases::addCase
*
* @copyright Colosa - Bolivia
*/
public function testAddCase()
{
$response = $this->oCases->addCase('1265557095225ff5c688f46031700471', '46941969352af5be2ab3f39001216717', '00000000000000000000000000000001', array('name' => 'John', 'lastname' => 'Petersson'));
$this->assertTrue(is_object($response));
$aResponse = json_decode(json_encode($response), true);
return $aResponse;
}
/**
* Test get Task Case
*
* @covers \BusinessModel\Cases::getTaskCase
* @depends testAddCase
* @param array $aResponse, Data for parent department
*
* @copyright Colosa - Bolivia
*/
public function testGetTaskCase(array $aResponse)
{
$response = $this->oCases->getTaskCase($aResponse['app_uid'], '00000000000000000000000000000001');
$this->assertTrue(is_array($response));
}
/**
* Test get Case Info
*
* @covers \BusinessModel\Cases::getCaseInfo
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testGetCaseInfo(array $aResponse)
{
$response = $this->oCases->getCaseInfo($aResponse['app_uid'], '00000000000000000000000000000001');
$this->assertTrue(is_object($response));
}
/**
* Test put reassign case
*
* @covers \BusinessModel\Cases::getCaseInfo
* @depends testAddCase
* @param array $aResponse
*
* @copyright Colosa - Bolivia
*/
public function testUpdateReassignCase(array $aResponse)
{
$response = $this->oCases->updateReassignCase($aResponse['app_uid'], '00000000000000000000000000000001', null, '00000000000000000000000000000001', '73005191052d56727901138030694610');
$this->assertTrue(empty($response));
}
/**
* Test add Case to test route case
*
* @covers \BusinessModel\Cases::addCase
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseRouteCase()
{
$response = $this->oCases->addCase('1265557095225ff5c688f46031700471', '46941969352af5be2ab3f39001216717', '00000000000000000000000000000001', array('name' => 'John', 'lastname' => 'Petersson'));
$this->assertTrue(is_object($response));
$aResponseRouteCase = json_decode(json_encode($response), true);
return $aResponseRouteCase;
}
/**
* Test put route case
*
* @covers \BusinessModel\Cases::updateRouteCase
* @depends testAddCaseRouteCase
* @param array $aResponseRouteCase
*
* @copyright Colosa - Bolivia
*/
public function testUpdateRouteCase(array $aResponseRouteCase)
{
$response = $this->oCases->updateRouteCase($aResponseRouteCase['app_uid'], '00000000000000000000000000000001', null);
$this->assertTrue(empty($response));
}
/**
* Test add Case impersonate
*
* @covers \BusinessModel\Cases::addCaseImpersonate
*
* @copyright Colosa - Bolivia
*/
public function testAddCaseImpersonate()
{
$response = $this->oCases->addCaseImpersonate('1265557095225ff5c688f46031700471', '73005191052d56727901138030694610', '46941969352af5be2ab3f39001216717', array(array('name' => 'John', 'lastname' => 'Petersson')));
$this->assertTrue(is_object($response));
}
}

View File

@@ -449,7 +449,7 @@ EditPMTable = function(){
if (row.data.TYPE != 'CLASSIC') {
tableType = row.data.PRO_UID ? 'report' : 'table';
proParam = PRO_UID !== false ? '&PRO_UID='+PRO_UID : '';
location.href = 'pmTables/edit?id='+row.data.ADD_TAB_UID+'&tableType=' + tableType + proParam;
location.href = 'pmTables/edit?id='+row.data.ADD_TAB_UID+'&flagProcessmap='+flagProcessmap+'&tableType=' + tableType + proParam;
}
else { //edit old report table
location.href = 'reportTables/reportTables_Edit?REP_TAB_UID='+row.data.ADD_TAB_UID
@@ -498,6 +498,10 @@ DeletePMTable = function() {
Ext.Msg.alert( _('ID_ERROR'), resp.result.message);
}
});
editButton.disable();
deleteButton.disable();
exportButton.disable();
dataButton.disable();
}
}
);