diff --git a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature index 792a6f019..73a086ca1 100644 --- a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature +++ b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature @@ -478,4 +478,132 @@ Scenario: Returns a list of the cases for the logged in user (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 12 records \ No newline at end of file + And the response has 12 records + + +#Case Tasks + +Scenario: case tasks of case 180 + Given I request "cases/235641998533b158ec1f951078648880/tasks" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And that "tas_uid" is set to "1655978655335cc3a8bb542099129747" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Task 1" + And that "rou_next_task" is set to "9985264545335cc3bd0ad26061293336" + And that "rou_condition" is set to "" + And that "rou_to_last_user" is set to "FALSE" + And that "rou_optional" is set to "FALSE" + And that "usr_uid" is set to "Administrator" + And that "usr_firstname" is set to "Administrator" + And that "usr_lastname" is set to "" + And that "del_init_date" is set to "2014-04-01 15:37:51" + And that "del_task_due_date" is set to "2014-04-02 15:37:50" + And that "del_finish_date" is set to "2014-04-01 15:37:54" + And that "duration" is set to "0 Hours 0 Minutes 3 Seconds" + And that "color" is set to "#006633" + And that "tas_uid" is set to "9985264545335cc3bd0ad26061293336" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Task 2" + And that "rou_next_task" is set to "-1" + And that "rou_condition" is set to "" + And that "rou_to_last_user" is set to "FALSE" + And that "rou_optional" is set to "FALSE" + And that "usr_uid" is set to "Administrator" + And that "usr_firstname" is set to "Administrator" + And that "usr_lastname" is set to "" + And that "del_init_date" is set to "2014-04-02 22:57:10" + And that "del_task_due_date" is set to "2014-04-02 15:37:54" + And that "del_finish_date" is set to "Not finished" + And that "duration" is set to "Not finished" + And that "color" is set to "#FF0000" + +Scenario: case tasks of case 145, case on unassigned list + Given I request "cases/940289753533b0d265a3885025822950/tasks" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And that "tas_uid" is set to "30657958950ec8d5c50aef0095926988" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Cyclical" + And that "rou_type" is set to "" + And that "color" is set to "#939598" + And that "tas_uid" is set to "57516479450ec8d5f696207052804906" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Manual" + And that "rou_type" is set to "" + And that "color" is set to "#939598" + + And that "tas_uid" is set to "70190429650ec8d77e3e6e1056691766" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Last" + And that "rou_type" is set to "" + And that "color" is set to "#939598" + + And that "tas_uid" is set to "86489868150ec8d68a1a9e7010589518" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Init" + And that "rou_type" is set to "" + And that "color" is set to "#939598" + And that "tas_uid" is set to "89648437550ec8d593c2159010276089" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Reports to" + And that "rou_type" is set to "4" + And that "rou_next_task" is set to "94757080050ec8d6e2b93a0015133851" + And that "rou_to_last_user" is set to "FALSE" + And that "rou_optional" is set to "FALSE" + And that "usr_uid" is set to "Administrator" + And that "usr_firstname" is set to "Administrator" + And that "usr_lastname" is set to "" + And that "del_init_date" is set to "2014-04-01 15:01:58" + And that "del_task_due_date" is set to "2014-04-02 15:01:58" + And that "del_finish_date" is set to "2014-04-01 15:02:17" + And that "duration" is set to "0 Hours 0 Minutes 19 Seconds" + And that "rou_next_task" is set to "30657958950ec8d5c50aef0095926988" + And that "rou_to_last_user" is set to "FALSE" + And that "rou_optional" is set to "FALSE" + And that "usr_uid" is set to "Administrator" + And that "usr_firstname" is set to "Administrator" + And that "usr_lastname" is set to "" + And that "del_init_date" is set to "2014-04-01 15:01:58" + And that "del_task_due_date" is set to "2014-04-02 15:01:58" + And that "del_finish_date" is set to "2014-04-01 15:02:17" + And that "duration" is set to "0 Hours 0 Minutes 19 Seconds" + And that "rou_next_task" is set to "57516479450ec8d5f696207052804906" + And that "rou_to_last_user" is set to "FALSE" + And that "rou_optional" is set to "FALSE" + And that "usr_uid" is set to "Administrator" + And that "usr_firstname" is set to "Administrator" + And that "usr_lastname" is set to "" + And that "del_init_date" is set to "2014-04-01 15:01:58" + And that "del_task_due_date" is set to "2014-04-02 15:01:58" + And that "del_finish_date" is set to "2014-04-01 15:02:17" + And that "duration" is set to "0 Hours 0 Minutes 19 Seconds" + And that "rou_next_task" is set to "86489868150ec8d68a1a9e7010589518" + And that "rou_to_last_user" is set to "FALSE" + And that "rou_optional" is set to "FALSE" + And that "usr_uid" is set to "Administrator" + And that "usr_firstname" is set to "Administrator" + And that "usr_lastname" is set to "" + And that "del_init_date" is set to "2014-04-01 15:01:58" + And that "del_task_due_date" is set to "2014-04-02 15:01:58" + And that "del_finish_date" is set to "2014-04-01 15:02:17" + And that "duration" is set to "0 Hours 0 Minutes 19 Seconds" + And that "color" is set to "#006633" + And that "tas_uid" is set to "94757080050ec8d6e2b93a0015133851" + And that "tas_type" is set to "NORMAL" + And that "tas_title" is set to "Self Service" + And that "rou_type" is set to "5" + And that "rou_next_task" is set to "70190429650ec8d77e3e6e1056691766" + And that "rou_condition" is set to "" + And that "rou_to_last_user" is set to "FALSE" + And that "rou_optional" is set to "FALSE" + And that "usr_uid" is set to "None" + And that "usr_firstname" is set to "null" + And that "usr_lastname" is set to "null" + And that "del_init_date" is set to "Case not started yet" + And that "del_task_due_date" is set to "2014-04-02 15:02:17" + And that "del_finish_date" is set to "Not finished" + And that "duration" is set to "Not finished" + And that "color" is set to "#FF0000" \ No newline at end of file diff --git a/features/backend/application_cases/case_actions/negative_tests_cases_actions.feature b/features/backend/application_cases/case_actions/negative_tests_cases_actions.feature index 4b6c0054e..1d6d5ac34 100644 --- a/features/backend/application_cases/case_actions/negative_tests_cases_actions.feature +++ b/features/backend/application_cases/case_actions/negative_tests_cases_actions.feature @@ -6,76 +6,73 @@ Background: Scenario Outline: Create a new case (Negative Test) - Given POST this data: - """ - { - "pro_uid": "", - "tas_uid": "", - "variables": [{"name": "admin", "amount":"1030"}] - } - """ + Given POST this data: + """ + { + "pro_uid": "", + "tas_uid": "", + "variables": [{"name": "admin", "amount":"1030"}] + } + """ And I request "cases" Then the response status code should be And the response status message should have the following text "" - - + Examples: | Description | pro_uid | tas_uid | error_code | error_message | | Create new case with pro_uid wrong | 99209594750ec1111111927000421575 | 68707275350ec281ada1c95068712556 | 400 | pro_uid | - | Create new case with tas_uid wrong | 46279907250ec73b9b25a78031279680 | 99371337811111111111116024620271 | 400 | tas_uid | + | Create new case with tas_uid wrong | 46279907250ec73b9b25a78031279680 | 99371337811111111111116024620271 | 400 | tas_uid | | Create new case without pro_uid | | 52838134750ec7dd0989fc0015625952 | 400 | pro_uid | - | Create new case without tas_uid | 34579467750ec8d55e8b115057818502 | | 400 | tas_uid | + | Create new case without tas_uid | 34579467750ec8d55e8b115057818502 | | 400 | tas_uid | | Create new case whith pro_uid and tas_uid wrong | 8245849601111111181ecc7039804404 | 5690001111111118e4a9243080698854 | 400 | pro_uid | - - Scenario Outline: Create a new case Impersonate (Negative Test) - Given POST this data: - """ - { - "pro_uid": "", - "usr_uid": "", - "tas_uid": "", - "variables": [{"name": "pruebaQA", "amount":"10400"}] - } - """ + Given POST this data: + """ + { + "pro_uid": "", + "usr_uid": "", + "tas_uid": "", + "variables": [{"name": "pruebaQA", "amount":"10400"}] + } + """ And I request "cases/impersonate" - Then the response status code should be + Then the response status code should be And the response status message should have the following text "" Examples: - | Description | pro_uid | usr_uid | tas_uid | error_code | error_message | - | Create new case with process "Derivation rules - sequential" invalid pro_uid | 99201111111111111138927000421575 | 51049032352d56710347233042615067 | 68707275350ec281ada1c95068712556 | 400 | pro_uid | - | Create new case with process "Derivation rules - evaluation" invalid tas_uid | 99209594750ec27ea338927000421575 | 44811996752d567110634a1013636964 | 68707211111111111111111111712556 | 400 | tas_uid | - | Create new case with process "Derivation rules - Parallel" usr_uid | 99209594750ec27ea338927000421575 | 24166331111111111111115035621101 | 68707275350ec281ada1c95068712556 | 400 | usr_uid | - | Create new case with process "Derivation rules - without pro_uid | | 86677227852d5671f40ba25017213081 | 68707275350ec281ada1c95068712556 | 400 | pro_uid | - | Create new case with process "Derivation rules - selection" tas_uid | 99209594750ec27ea338927000421575 | 62625000752d5672d6661e6072881167 | | 400 | tas_uid | + | Description | pro_uid | usr_uid | tas_uid | error_code | error_message | + | Create new case with process "Derivation rules - sequential" invalid pro_uid | 99201111111111111138927000421575 | 51049032352d56710347233042615067 | 68707275350ec281ada1c95068712556 | 400 | pro_uid | + | Create new case with process "Derivation rules - evaluation" invalid tas_uid | 99209594750ec27ea338927000421575 | 44811996752d567110634a1013636964 | 68707211111111111111111111712556 | 400 | tas_uid | + | Create new case with process "Derivation rules - Parallel" usr_uid | 99209594750ec27ea338927000421575 | 24166331111111111111115035621101 | 68707275350ec281ada1c95068712556 | 400 | usr_uid | + | Create new case with process "Derivation rules - without pro_uid | | 86677227852d5671f40ba25017213081 | 68707275350ec281ada1c95068712556 | 400 | pro_uid | + | Create new case with process "Derivation rules - selection" tas_uid | 99209594750ec27ea338927000421575 | 62625000752d5672d6661e6072881167 | | 400 | tas_uid | Scenario Outline: Create a case, derivate and cancel. then try do pause or route #Create case - Given POST this data: - """ - { - "pro_uid": "", - "tas_uid": "", - "variables": [{"name": "admin", "amount":"1030"}] - } - """ + Given POST this data: + """ + { + "pro_uid": "", + "tas_uid": "", + "variables": [{"name": "admin", "amount":"1030"}] + } + """ And I request "cases" Then the response status code should be 200 And store "app_uid" in session array as variable "app_uid_" #Send some variables - And PUT this data: - """ - { - "continue": "yes", - "tasks": "Cyclical" + And PUT this data: + """ + { + "continue": "yes", + "tasks": "Cyclical" - } - """ + } + """ And I request "cases/app_uid/variable" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 200 And the content type is "application/json" @@ -83,7 +80,7 @@ Scenario Outline: Create a case, derivate and cancel. then try do pause or route And the type is "object" #Cancel case - And PUT this data: + And PUT this data: """ { @@ -96,36 +93,37 @@ Scenario Outline: Create a case, derivate and cancel. then try do pause or route And the type is "object" #Route case: it should not allow - And PUT this data: - """ - { - "case_uid": "", - "del_index": "1" - } - """ + And PUT this data: + """ + { + "case_uid": "", + "del_index": "1" + } + """ And I request "cases/app_uid/route-case" with the key "app_uid" stored in session array as variable "app_uid_" Then the response status code should be 400 And the response status message should have the following text "" #Pause case - And PUT this data: + And PUT this data: + """ + { + "unpaused_date": "2016-12-12" + } """ - { - "unpaused_date": "2016-12-12" - } - """ - And I request "cases/app_uid/pause" with the key "app_uid" stored in session array as variable "app_uid_" - Then the response status code should be 400 - And the response status message should have the following text "" + And I request "cases/app_uid/pause" with the key "app_uid" stored in session array as variable "app_uid_" + Then the response status code should be 400 + And the response status message should have the following text "" - Examples: - | Description | case_number | pro_uid | tas_uid | error_message_route | error_message_pause | - | Create new case with process "Derivation rules - sequential" | 1 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 | This case delegation is already closed | This case delegation is already closed | + Examples: + + | Description | case_number | pro_uid | tas_uid | error_message_route | error_message_pause | + | Create new case with process "Derivation rules - sequential" | 1 | 99209594750ec27ea338927000421575 | 68707275350ec281ada1c95068712556 | This case delegation is already closed | canceled | #Delete case - Scenario Outline: Delete a case created previously in this script +Scenario Outline: Delete a case created previously in this script Given that I want to delete a resource with the key "app_uid" stored in session array as variable "app_uid_" And I request "cases" And the content type is "application/json" diff --git a/features/backend/projects/activity/main_tests_activity.feature b/features/backend/projects/activity/main_tests_activity.feature index d6623b113..ba69c4519 100644 --- a/features/backend/projects/activity/main_tests_activity.feature +++ b/features/backend/projects/activity/main_tests_activity.feature @@ -5,7 +5,6 @@ Feature: Activity Resources Main Tests the process name is "Test Activity" there are three Activity Resources in the process - Background: Given that I have a valid access_token @@ -58,195 +57,216 @@ Scenario Outline: Get the Definition of a Activity are exactly three activity | 24689389453502b73597aa5052425148 | Task 3 | -Scenario Outline: Get a activity (Verification of initial values) - Given I request "project/59534741653502b6d1820d6012095837/activity/" +Scenario: Get a activity (Verification of initial values) "Task1" + Given I request "project/59534741653502b6d1820d6012095837/activity/28629650453502b70b7f3a8051740006" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - And the property "tas_type" of "properties" is set to "" - And the property "tas_duration" of "properties" is set to "" - And the property "tas_type_day" of "properties" is set to "" - And the property "tas_timeunit" of "properties" is set to "" - And the property "tas_priority_variable" of "properties" is set to "" - And the property "tas_assign_type" of "properties" is set to "" - And the property "tas_assign_variable" of "properties" is set to "" - And the property "tas_transfer_fly" of "properties" is set to "" - And the property "tas_send_last_email" of "properties" is set to "" - And the property "tas_derivation_screen_tpl" of "properties" is set to "" - And the property "tas_selfservice_timeout" of "properties" is set to "" - And the property "tas_selfservice_time" of "properties" is set to "" - And the property "tas_selfservice_time_unit" of "properties" is set to "" - And the property "tas_selfservice_trigger_uid" of "properties" is set to "" - And the property "tas_title" of "properties" is set to "" - And the property "tas_description" of "properties" is set to "" - And the property "tas_def_title" of "properties" is set to "" - And the property "tas_def_description" of "properties" is set to "" - And the property "tas_def_message" of "properties" is set to "" - And the property "tas_def_subject_message" of "properties" is set to "" - And the property "tas_calendar" of "properties" is set to "" - And the property "tas_def_message_type" of "properties" is set to "" - And the property "tas_def_message_template" of "properties" is set to "" - - Examples: - - | activity | tas_type | tas_duration | tas_type_day | tas_timeunit | tas_priority_variable | tas_assign_type | tas_assign_variable | tas_transfer_fly | tas_send_last_email | tas_derivation_screen_tpl | tas_selfservice_timeout | tas_selfservice_time | tas_selfservice_time_unit | tas_selfservice_trigger_uid | tas_title | tas_description | tas_def_title | tas_def_description | tas_def_message | tas_def_subject_message | tas_calendar | tas_def_message_type | tas_def_message_template | - | 28629650453502b70b7f3a8051740006 | NORMAL | 1 | | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | FALSE | | 0 | | | | Task 1 | | | | | | | text | alert_message.html | - | 52976670353502b71e2b0a8036043148 | NORMAL | 1 | | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | FALSE | | 0 | | | | Task 2 | | | | | | | text | alert_message.html | - | 24689389453502b73597aa5052425148 | NORMAL | 1 | | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | FALSE | | 0 | | | | Task 3 | | | | | | | text | alert_message.html | + And the property "tas_type" of "properties" is set to "NORMAL" + And the property "tas_duration" of "properties" is set to "1" + And the property "tas_type_day" of "properties" is set to "" + And the property "tas_timeunit" of "properties" is set to "DAYS" + And the property "tas_priority_variable" of "properties" is set to "" + And the property "tas_assign_type" of "properties" is set to "BALANCED" + And the property "tas_assign_variable" of "properties" is set to "@@SYS_NEXT_USER_TO_BE_ASSIGNED" + And the property "tas_group_variable" of "properties" is set to "" + And the property "tas_transfer_fly" of "properties" is set to "FALSE" + And the property "tas_derivation_screen_tpl" of "properties" is set to "" + And the property "tas_selfservice_timeout" of "properties" is set to "0" + And the property "tas_selfservice_time" of "properties" is set to "" + And the property "tas_selfservice_time_unit" of "properties" is set to "" + And the property "tas_selfservice_trigger_uid" of "properties" is set to "" + And the property "tas_title" of "properties" is set to "Task 1" + And the property "tas_description" of "properties" is set to "" + And the property "tas_def_title" of "properties" is set to "" + And the property "tas_def_description" of "properties" is set to "" + And the property "tas_calendar" of "properties" is set to "" + And the property "tas_def_message_type" of "properties" is set to "text" + And the property "tas_def_message_template" of "properties" is set to "alert_message.html" -Scenario Outline: Update the Definition of a Activity and the check if the values had changed +Scenario: Get a activity (Verification of initial values) "Task2" + Given I request "project/59534741653502b6d1820d6012095837/activity/52976670353502b71e2b0a8036043148" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the property "tas_type" of "properties" is set to "NORMAL" + And the property "tas_duration" of "properties" is set to "1" + And the property "tas_type_day" of "properties" is set to "" + And the property "tas_timeunit" of "properties" is set to "DAYS" + And the property "tas_priority_variable" of "properties" is set to "" + And the property "tas_assign_type" of "properties" is set to "BALANCED" + And the property "tas_assign_variable" of "properties" is set to "@@SYS_NEXT_USER_TO_BE_ASSIGNED" + And the property "tas_transfer_fly" of "properties" is set to "FALSE" + And the property "tas_derivation_screen_tpl" of "properties" is set to "" + And the property "tas_selfservice_timeout" of "properties" is set to "0" + And the property "tas_selfservice_time" of "properties" is set to "" + And the property "tas_selfservice_time_unit" of "properties" is set to "" + And the property "tas_selfservice_trigger_uid" of "properties" is set to "" + And the property "tas_title" of "properties" is set to "Task 2" + And the property "tas_description" of "properties" is set to "" + And the property "tas_def_title" of "properties" is set to "" + And the property "tas_def_description" of "properties" is set to "" + And the property "tas_calendar" of "properties" is set to "" + And the property "tas_def_message_type" of "properties" is set to "text" + And the property "tas_def_message_template" of "properties" is set to "alert_message.html" + + +Scenario: Get a activity (Verification of initial values) "Task3" + Given I request "project/59534741653502b6d1820d6012095837/activity/24689389453502b73597aa5052425148" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the property "tas_type" of "properties" is set to "NORMAL" + And the property "tas_duration" of "properties" is set to "1" + And the property "tas_type_day" of "properties" is set to "" + And the property "tas_timeunit" of "properties" is set to "DAYS" + And the property "tas_priority_variable" of "properties" is set to "" + And the property "tas_assign_type" of "properties" is set to "BALANCED" + And the property "tas_assign_variable" of "properties" is set to "@@SYS_NEXT_USER_TO_BE_ASSIGNED" + And the property "tas_transfer_fly" of "properties" is set to "FALSE" + And the property "tas_derivation_screen_tpl" of "properties" is set to "" + And the property "tas_selfservice_timeout" of "properties" is set to "0" + And the property "tas_selfservice_time" of "properties" is set to "" + And the property "tas_selfservice_time_unit" of "properties" is set to "" + And the property "tas_selfservice_trigger_uid" of "properties" is set to "" + And the property "tas_title" of "properties" is set to "Task 3" + And the property "tas_description" of "properties" is set to "" + And the property "tas_def_title" of "properties" is set to "" + And the property "tas_def_description" of "properties" is set to "" + And the property "tas_calendar" of "properties" is set to "" + And the property "tas_def_message_type" of "properties" is set to "text" + And the property "tas_def_message_template" of "properties" is set to "alert_message.html" + + +Scenario: Update the Definition of a Activity "Task1" and the check if the values had changed Given PUT this data: """ { "definition": {}, "properties": { - "tas_type": "", - "tas_duration": "", - "tas_timeunit": "", - "tas_priority_variable": "", - "tas_assign_type": "", - "tas_assign_variable": "", - "tas_transfer_fly": "", - "tas_derivation_screen_tpl": "", - "tas_selfservice_time_unit": "", - "tas_selfservice_timeout": "", - "tas_selfservice_trigger_uid": "", - "tas_title": "", - "tas_description": "", - "tas_def_title": "", - "tas_def_description": "", - "tas_def_message": "", - "tas_def_subject_message": "", - "tas_calendar": "", - "tas_def_message_type": "", - "tas_def_message_template": "" + "tas_type": "ADHOC", + "tas_duration": 2, + "tas_type_day": "DAYS", + "tas_timeunit": "DAYS", + "tas_priority_variable": "@@PROCESS", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@USER_LOGGED", + "tas_group_variable": "@@USER_LOGGED", + "tas_transfer_fly": "TRUE", + "tas_send_last_email": "TRUE", + "tas_derivation_screen_tpl": "test activity.html", + "tas_selfservice_timeout": 1, + "tas_selfservice_time": 1, + "tas_selfservice_time_unit": "HOURS", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task 1 Update Activity", + "tas_description": "Update Description", + "tas_def_title": "Case Title", + "tas_def_description": "Case Description UPDATE", + "tas_def_message": "Esta es una Notificacion - UPDATE ", + "tas_def_subject_message": "UPDATE Titulo de Notificacion 1", + "tas_calendar": "14606161052f50839307899033145440", + "tas_def_message_type": "text", + "tas_def_message_template": "test activity.html" } } """ - And I request "project/59534741653502b6d1820d6012095837/activity/" + And I request "project/59534741653502b6d1820d6012095837/activity/28629650453502b70b7f3a8051740006" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - Examples: + - | test_description | activity | tas_type | tas_duration | tas_timeunit | tas_priority_variable | tas_assign_type | tas_assign_variable | tas_transfer_fly | tas_derivation_screen_tpl | tas_selfservice_time_unit | tas_selfservice_timeout | tas_selfservice_trigger_uid | tas_title | tas_description | tas_def_title | tas_def_description | tas_def_message | tas_def_subject_message | tas_calendar | tas_def_message_type | tas_def_message_template | - | Update Task1 | 28629650453502b70b7f3a8051740006 | ADHOC | 2 | DAYS | @@PROCESS | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | test activity.html | HOURS | 1 | | Task 1 Update Activity | Update Description | Case Title | Case Description UPDATE | Esta es una Notificacion - UPDATE | UPDATE Titulo de Notificacion 1 | 14606161052f50839307899033145440 | text | test activity.html | - | Update Task2 | 52976670353502b71e2b0a8036043148 | NORMAL | 3 | HOURS | @@PROCESS | BALANCED | @@USER_LOGGED | TRUE | test activity.html | HOURS | 1 | | Task 2 Update Activity | Update Description | Case Title | Case Description UPDATE | Esta es una Notificacion - UPDATE | UPDATE Titulo de Notificacion 1 | 14606161052f50839307899033145440 | text | test activity.html | - | Update Task3 | 24689389453502b73597aa5052425148 | NORMAL | 2 | HOURS | @@PROCESS | BALANCED | @@USER_LOGGED | FALSE | test activity.html | HOURS | 1 | | Task 3 Update Activity | Update Description | Case Title | Case Description UPDATE | Esta es una Notificacion - UPDATE | UPDATE Titulo de Notificacion 1 | 14606161052f50839307899033145440 | text | test activity.html | - - -Scenario Outline: Get a activity (Review of variables after the update) - Given I request "project/59534741653502b6d1820d6012095837/activity/" +Scenario: Get a activity (Review of variables after the update) Task1 + Given I request "project/59534741653502b6d1820d6012095837/activity/28629650453502b70b7f3a8051740006" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - And the property "tas_type" of "properties" is set to "" - And the property "tas_duration" of "properties" is set to "" - And the property "tas_timeunit" of "properties" is set to "" - And the property "tas_priority_variable" of "properties" is set to "" - And the property "tas_assign_type" of "properties" is set to "" - And the property "tas_assign_variable" of "properties" is set to "" - And the property "tas_transfer_fly" of "properties" is set to "" - And the property "tas_derivation_screen_tpl" of "properties" is set to "" - And the property "tas_selfservice_time_unit" of "properties" is set to "" - And the property "tas_selfservice_timeout" of "properties" is set to "" - And the property "tas_selfservice_trigger_uid" of "properties" is set to "" - And the property "tas_title" of "properties" is set to "" - And the property "tas_description" of "properties" is set to "" - And the property "tas_def_title" of "properties" is set to "" - And the property "tas_def_description" of "properties" is set to "" - And the property "tas_def_message" of "properties" is set to "" - And the property "tas_def_subject_message" of "properties" is set to "" - And the property "tas_calendar" of "properties" is set to "" - And the property "tas_def_message_type" of "properties" is set to "" - And the property "tas_def_message_template" of "properties" is set to "" + And the property "tas_type" of "properties" is set to "ADHOC" + And the property "tas_timeunit" of "properties" is set to "DAYS" + And the property "tas_priority_variable" of "properties" is set to "@@PROCESS" + And the property "tas_assign_type" of "properties" is set to "BALANCED" + And the property "tas_transfer_fly" of "properties" is set to "TRUE" + And the property "tas_send_last_email" of "properties" is set to "TRUE" + And the property "tas_derivation_screen_tpl" of "properties" is set to "test activity.html" + And the property "tas_selfservice_trigger_uid" of "properties" is set to "" + And the property "tas_title" of "properties" is set to "Task 1 Update Activity" + And the property "tas_description" of "properties" is set to "Update Description" + And the property "tas_def_title" of "properties" is set to "Case Title" + And the property "tas_def_description" of "properties" is set to "Case Description UPDATE" + And the property "tas_def_message" of "properties" is set to "Esta es una Notificacion - UPDATE" + And the property "tas_def_subject_message" of "properties" is set to "UPDATE Titulo de Notificacion 1" + And the property "tas_def_message_type" of "properties" is set to "text" - Examples: - - | activity | tas_type | tas_duration | tas_timeunit | tas_priority_variable | tas_assign_type | tas_assign_variable | tas_transfer_fly | tas_derivation_screen_tpl | tas_selfservice_time_unit | tas_selfservice_timeout | tas_selfservice_trigger_uid | tas_title | tas_description | tas_def_title | tas_def_description | tas_def_message | tas_def_subject_message | tas_calendar | tas_def_message_type | tas_def_message_template | - | 28629650453502b70b7f3a8051740006 | ADHOC | 2 | DAYS | @@PROCESS | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | test activity.html | HOURS | 1 | | Task 1 Update Activity | Update Description | Case Title | Case Description UPDATE | Esta es una Notificacion - UPDATE | UPDATE Titulo de Notificacion 1 | 14606161052f50839307899033145440 | text | test activity.html | - | 52976670353502b71e2b0a8036043148 | NORMAL | 3 | HOURS | @@PROCESS | BALANCED | @@USER_LOGGED | TRUE | test activity.html | HOURS | 1 | | Task 2 Update Activity | Update Description | Case Title | Case Description UPDATE | Esta es una Notificacion - UPDATE | UPDATE Titulo de Notificacion 1 | 14606161052f50839307899033145440 | text | test activity.html | - | 24689389453502b73597aa5052425148 | NORMAL | 2 | HOURS | @@PROCESS | BALANCED | @@USER_LOGGED | FALSE | test activity.html | HOURS | 1 | | Task 3 Update Activity | Update Description | Case Title | Case Description UPDATE | Esta es una Notificacion - UPDATE | UPDATE Titulo de Notificacion 1 | 14606161052f50839307899033145440 | text | test activity.html | - - -Scenario Outline: Update the Definition of a Activity to return to baseline + +Scenario: Update the Definition of a Activity to return to baseline of the task1 Given PUT this data: """ { "definition": {}, "properties": { - "tas_type": "", - "tas_duration": "", - "tas_timeunit": "", - "tas_priority_variable": "", - "tas_assign_type": "", - "tas_assign_variable": "", - "tas_transfer_fly": "", - "tas_derivation_screen_tpl": "", - "tas_selfservice_time_unit": "", - "tas_selfservice_timeout": "", - "tas_selfservice_trigger_uid": "", - "tas_title": "", - "tas_description": "", - "tas_def_title": "", - "tas_def_description": "", - "tas_def_message": "", - "tas_def_subject_message": "", - "tas_calendar": "", - "tas_def_message_type": "", - "tas_def_message_template": "" + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": "", + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task 1", + "tas_description": "", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "", + "tas_def_message_type": "text", + "tas_def_message_template": "alert_message.html" } + } """ - And I request "project/59534741653502b6d1820d6012095837/activity/" + And I request "project/59534741653502b6d1820d6012095837/activity/28629650453502b70b7f3a8051740006" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - Examples: - - | activity | tas_type | tas_duration | tas_timeunit | tas_priority_variable | tas_assign_type | tas_assign_variable | tas_transfer_fly | tas_derivation_screen_tpl | tas_selfservice_timeout | tas_selfservice_time | tas_selfservice_time_unit | tas_selfservice_trigger_uid | tas_title | tas_description | tas_def_title | tas_def_description | tas_def_message | tas_def_subject_message | tas_calendar | tas_def_message_type | tas_def_message_template | - | 28629650453502b70b7f3a8051740006 | NORMAL | 1 | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | | 0 | | | | Task 1 | | | | | | | text | alert_message.html | - | 52976670353502b71e2b0a8036043148 | NORMAL | 1 | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | | 0 | | | | Task 2 | | | | | | | text | alert_message.html | - | 24689389453502b73597aa5052425148 | NORMAL | 1 | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | | 0 | | | | Task 3 | | | | | | | text | alert_message.html | - - -Scenario Outline: Get a activity (Verification of initial values) - Given I request "project/59534741653502b6d1820d6012095837/activity/" + +Scenario: Get a activity (Verification of initial values) Task1 + Given I request "project/59534741653502b6d1820d6012095837/activity/28629650453502b70b7f3a8051740006" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - And the property "tas_type" of "properties" is set to "" - And the property "tas_duration" of "properties" is set to "" - And the property "tas_type_day" of "properties" is set to "" - And the property "tas_timeunit" of "properties" is set to "" - And the property "tas_priority_variable" of "properties" is set to "" - And the property "tas_assign_type" of "properties" is set to "" - And the property "tas_assign_variable" of "properties" is set to "" - And the property "tas_transfer_fly" of "properties" is set to "" - And the property "tas_send_last_email" of "properties" is set to "" - And the property "tas_derivation_screen_tpl" of "properties" is set to "" - And the property "tas_selfservice_timeout" of "properties" is set to "" - And the property "tas_selfservice_time" of "properties" is set to "" - And the property "tas_selfservice_time_unit" of "properties" is set to "" - And the property "tas_selfservice_trigger_uid" of "properties" is set to "" - And the property "tas_title" of "properties" is set to "" - And the property "tas_description" of "properties" is set to "" - And the property "tas_def_title" of "properties" is set to "" - And the property "tas_def_description" of "properties" is set to "" - And the property "tas_def_message" of "properties" is set to "" - And the property "tas_def_subject_message" of "properties" is set to "" - And the property "tas_calendar" of "properties" is set to "" - And the property "tas_def_message_type" of "properties" is set to "" - And the property "tas_def_message_template" of "properties" is set to "" - - Examples: - - | activity | tas_type | tas_duration | tas_type_day | tas_timeunit | tas_priority_variable | tas_assign_type | tas_assign_variable | tas_transfer_fly | tas_send_last_email | tas_derivation_screen_tpl | tas_selfservice_timeout | tas_selfservice_time | tas_selfservice_time_unit | tas_selfservice_trigger_uid | tas_title | tas_description | tas_def_title | tas_def_description | tas_def_message | tas_def_subject_message | tas_calendar | tas_def_message_type | tas_def_message_template | - | 28629650453502b70b7f3a8051740006 | NORMAL | 1 | | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | FALSE | | 0 | | | | Task 1 | | | | | | | text | alert_message.html | - | 52976670353502b71e2b0a8036043148 | NORMAL | 1 | | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | FALSE | | 0 | | | | Task 2 | | | | | | | text | alert_message.html | - | 24689389453502b73597aa5052425148 | NORMAL | 1 | | DAYS | | BALANCED | @@SYS_NEXT_USER_TO_BE_ASSIGNED | FALSE | FALSE | | 0 | | | | Task 3 | | | | | | | text | alert_message.html | \ No newline at end of file + And the property "tas_type" of "properties" is set to "NORMAL" + And the property "tas_duration" of "properties" is set to "1" + And the property "tas_type_day" of "properties" is set to "" + And the property "tas_timeunit" of "properties" is set to "DAYS" + And the property "tas_priority_variable" of "properties" is set to "" + And the property "tas_assign_type" of "properties" is set to "BALANCED" + And the property "tas_assign_variable" of "properties" is set to "@@SYS_NEXT_USER_TO_BE_ASSIGNED" + And the property "tas_group_variable" of "properties" is set to "" + And the property "tas_transfer_fly" of "properties" is set to "FALSE" + And the property "tas_send_last_email" of "properties" is set to "FALSE" + And the property "tas_derivation_screen_tpl" of "properties" is set to "" + And the property "tas_selfservice_timeout" of "properties" is set to "0" + And the property "tas_selfservice_time" of "properties" is set to "" + And the property "tas_selfservice_time_unit" of "properties" is set to "" + And the property "tas_selfservice_trigger_uid" of "properties" is set to "" + And the property "tas_title" of "properties" is set to "Task 1" + And the property "tas_description" of "properties" is set to "" + And the property "tas_def_title" of "properties" is set to "" + And the property "tas_def_description" of "properties" is set to "" + And the property "tas_calendar" of "properties" is set to "" + And the property "tas_def_message_type" of "properties" is set to "text" + And the property "tas_def_message_template" of "properties" is set to "alert_message.html" \ No newline at end of file diff --git a/features/backend/projects/output_documents/main_tests_output.feature b/features/backend/projects/output_documents/main_tests_output.feature index 5aeb1f024..f06fbbfad 100644 --- a/features/backend/projects/output_documents/main_tests_output.feature +++ b/features/backend/projects/output_documents/main_tests_output.feature @@ -39,6 +39,7 @@ Feature: Output Documents Main Tests "out_doc_title": "", "out_doc_description": "", "out_doc_filename": "", + "out_doc_template": "", "out_doc_report_generator": "", "out_doc_landscape": "", "out_doc_media": "", @@ -66,22 +67,22 @@ Feature: Output Documents Main Tests Examples: - | test_description | project | out_doc_number | out_doc_title | out_doc_description |out_doc_filename | out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | - | Create with old version and both | 4224292655297723eb98691001100052 | 1 | Endpoint Old Version | Output Document old version - EndPoint | Output 1 | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | - | Craate with old version and pdf security | 4224292655297723eb98691001100052 | 2 | Endpoint Old Version PDF SECURITY | Output Document old version PDF SECURITY | Output 2 | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | - | Create with old version only doc | 4224292655297723eb98691001100052 | 3 | Endpoint Old Version Doc | Output Document old version solo doc | Output 3 | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 1 | | | 0 | | | | - | Create with old version only pdf | 4224292655297723eb98691001100052 | 4 | Endpoint Old Version PDF | Output Document old version solo pdf | Output 4 | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample | sample | print | - | Create with new version and both | 4224292655297723eb98691001100052 | 5 | Endpoint New Version | Output Document new version - EndPoint | Output 5 | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | - | Create with new version and pdf security | 4224292655297723eb98691001100052 | 6 | Endpoint New Version PDF SECURITY | Output Document new version PDF SECURITY | Output 6 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | - | Create with new version only doc | 4224292655297723eb98691001100052 | 7 | Endpoint New Version Doc | Output Document new version solo doc | Output 7 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 1 | | | 0 | | | | - | Create with new version only pdf | 4224292655297723eb98691001100052 | 8 | Endpoint New Version PDF | Output Document new version solo pdf | Output 8 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample | sample | print | - | Create with special characters in out doc title | 4224292655297723eb98691001100052 | 9 | test !@#$%^&*€¤¾½²³€¼½¼ | Output Document old version - EndPoint | Output 9 | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | - | Create with special characters in out doc description | 4224292655297723eb98691001100052 | 10 | Endpoint Old1 | test %^&*€¤¾½²³€ | Output 10 | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | - | Create with special characters in out doc filename | 4224292655297723eb98691001100052 | 11 | Endpoint Old Version Doc 2 | Output Document old version solo doc | Output @#$%^&*€¤ | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 1 | | | 0 | | | | - | Create with special characters in out doc destination path | 4224292655297723eb98691001100052 | 12 | Endpoint New Version 16 | Output Document new version - EndPoint | Output 13 | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | 23rg@#$% | | 0 | | | | - | Create with special characters in out doc tags | 4224292655297723eb98691001100052 | 13 | Endpoint New Version PDF SECURI17 | Output Document new version PDF SECURITY | Output 14 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | vfv23@$@% | 1 | sample | sample | print\|modify\|copy\|forms | - | Create with special characters in out doc pdf security open password | 4224292655297723eb98691001100052 | 14 | Endpoint New Version PDF 19 | Output Document new version solo pdf | Output 15 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample432@$#@$¼€¼½ | sample | print | - | Create with special characters in out doc pdf security owner password | 4224292655297723eb98691001100052 | 15 | Endpoint New Version 20 | Output Document new version - EndPoint | Output 16 | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | sample432@$#@$¼€¼½ | | + | test_description | project | out_doc_number | out_doc_title | out_doc_description |out_doc_filename | out_doc_template |out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | + | Create with old version and both | 4224292655297723eb98691001100052 | 1 | Endpoint Old Version | Output Document old version - EndPoint | Output 1 | Example | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | + | Craate with old version and pdf security | 4224292655297723eb98691001100052 | 2 | Endpoint Old Version PDF SECURITY | Output Document old version PDF SECURITY | Output 2 | Example | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | Create with old version only doc | 4224292655297723eb98691001100052 | 3 | Endpoint Old Version Doc | Output Document old version solo doc | Output 3 | Example | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 1 | | | 0 | | | | + | Create with old version only pdf | 4224292655297723eb98691001100052 | 4 | Endpoint Old Version PDF | Output Document old version solo pdf | Output 4 | Example | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample | sample | print | + | Create with new version and both | 4224292655297723eb98691001100052 | 5 | Endpoint New Version | Output Document new version - EndPoint | Output 5 | Example | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | + | Create with new version and pdf security | 4224292655297723eb98691001100052 | 6 | Endpoint New Version PDF SECURITY | Output Document new version PDF SECURITY | Output 6 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | Create with new version only doc | 4224292655297723eb98691001100052 | 7 | Endpoint New Version Doc | Output Document new version solo doc | Output 7 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 1 | | | 0 | | | | + | Create with new version only pdf | 4224292655297723eb98691001100052 | 8 | Endpoint New Version PDF | Output Document new version solo pdf | Output 8 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample | sample | print | + | Create with special characters in out doc title | 4224292655297723eb98691001100052 | 9 | test !@#$%^&*€¤¾½²³€¼½¼ | Output Document old version - EndPoint | Output 9 | Example | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | + | Create with special characters in out doc description | 4224292655297723eb98691001100052 | 10 | Endpoint Old1 | test %^&*€¤¾½²³€ | Output 10 | Example | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | Create with special characters in out doc filename | 4224292655297723eb98691001100052 | 11 | Endpoint Old Version Doc 2 | Output Document old version solo doc | Output @#$%^&*€¤ | Example | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 1 | | | 0 | | | | + | Create with special characters in out doc destination path | 4224292655297723eb98691001100052 | 12 | Endpoint New Version 16 | Output Document new version - EndPoint | Output 13 | Example | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | 23rg@#$% | | 0 | | | | + | Create with special characters in out doc tags | 4224292655297723eb98691001100052 | 13 | Endpoint New Version PDF SECURI17 | Output Document new version PDF SECURITY | Output 14 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | vfv23@$@% | 1 | sample | sample | print\|modify\|copy\|forms | + | Create with special characters in out doc pdf security open password | 4224292655297723eb98691001100052 | 14 | Endpoint New Version PDF 19 | Output Document new version solo pdf | Output 15 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample432@$#@$¼€¼½ | sample | print | + | Create with special characters in out doc pdf security owner password | 4224292655297723eb98691001100052 | 15 | Endpoint New Version 20 | Output Document new version - EndPoint | Output 16 | Example | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | sample432@$#@$¼€¼½ | | Scenario: Create Output Documents with same name @@ -91,6 +92,7 @@ Feature: Output Documents Main Tests "out_doc_title": "Endpoint Old Version", "out_doc_description": "Output Document old version - EndPoint", "out_doc_filename": "Output 1", + "out_doc_template": "Example", "out_doc_report_generator": "HTML2PDF", "out_doc_landscape": "1", "out_doc_media": "Letter", @@ -130,6 +132,7 @@ Feature: Output Documents Main Tests "out_doc_title": "", "out_doc_description": "", "out_doc_filename": "", + "out_doc_template": "", "out_doc_report_generator": "", "out_doc_landscape": "", "out_doc_media": "", @@ -156,11 +159,11 @@ Feature: Output Documents Main Tests Examples: - | test_description | project | out_doc_number | out_doc_title | out_doc_description |out_doc_filename | out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | - | Update out doc title and description | 4224292655297723eb98691001100052 | 1 | Endpoint Old Version UPDATE | Output Document old version - UPDATE | Output 1 | HTML2PDF | 0 | Letter | 20 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | - | Update out doc title and out doc generate | 4224292655297723eb98691001100052 | 2 | Endpoint Old Version PDF SECURITY UPDATE | Output UPDATE old version PDF SECURITY | Output 2 | TCPDF | 1 | Legal | 20 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy | - | Update out doc title and description | 4224292655297723eb98691001100052 | 5 | Endpoint New Version UPDATE | Output UPDATE new version - EndPoint | Output 5 | TCPDF | 0 | Letter | 30 | 20 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | - | Update out doc title and out doc generate | 4224292655297723eb98691001100052 | 6 | Endpoint New Version PDF SECURITY UPDATE | Output UPDATE new version PDF SECURITY | Output 6 | HTML2PDF | 1 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy | + | test_description | project | out_doc_number | out_doc_title | out_doc_description |out_doc_filename | out_doc_template | out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | + | Update out doc title and description | 4224292655297723eb98691001100052 | 1 | Endpoint Old Version UPDATE | Output Document old version - UPDATE | Output 1 | Example | HTML2PDF | 0 | Letter | 20 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | + | Update out doc title and out doc generate | 4224292655297723eb98691001100052 | 2 | Endpoint Old Version PDF SECURITY UPDATE | Output UPDATE old version PDF SECURITY | Output 2 | Example | TCPDF | 1 | Legal | 20 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy | + | Update out doc title and description | 4224292655297723eb98691001100052 | 5 | Endpoint New Version UPDATE | Output UPDATE new version - EndPoint | Output 5 | Example | TCPDF | 0 | Letter | 30 | 20 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | + | Update out doc title and out doc generate | 4224292655297723eb98691001100052 | 6 | Endpoint New Version PDF SECURITY UPDATE | Output UPDATE new version PDF SECURITY | Output 6 | Example | HTML2PDF | 1 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy | Scenario Outline: Get a single Output Document and check some properties diff --git a/features/backend/projects/output_documents/negative_tests_output.feature b/features/backend/projects/output_documents/negative_tests_output.feature index a748869fb..fa76a24fc 100644 --- a/features/backend/projects/output_documents/negative_tests_output.feature +++ b/features/backend/projects/output_documents/negative_tests_output.feature @@ -12,6 +12,7 @@ Feature: Output Documents Negative Tests "out_doc_title": "", "out_doc_description": "", "out_doc_filename": "", + "out_doc_template": "", "out_doc_report_generator": "", "out_doc_landscape": "", "out_doc_media": "", @@ -37,19 +38,19 @@ Feature: Output Documents Negative Tests Examples: - | test_description | project | out_doc_title | out_doc_description |out_doc_filename | out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | error_code | error_message | - | Invalid PDF Generator | 4224292655297723eb98691001100052 | Endpoint New Version 4 | Output Document new version - EndPoint | Output 5 | @#$%¼¤¾½ | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | 400 | out_doc_report_generator | - | Invalid landscape | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURIT5 | Output Document new version PDF SECURITY | Output 6 | TCPDF | 34 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | 400 | out_doc_landscape | - | Invalid media type | 4224292655297723eb98691001100052 | Endpoint New Version Doc6 | Output Document new version solo doc | Output 7 | TCPDF | 0 | Legal!@#$$$%^&| 25 | 25 | 25 | 25 | WORD | HTML | 1 | | | 0 | | | | 400 | out_doc_media | - | Invalid document type | 4224292655297723eb98691001100052 | Endpoint New Version PDF7 | Output Document new version solo pdf | Output 8 | TCPDF | 0 | Legal | 25,56.98 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample | sample | print | 400 | out_doc_left_margin | - | Invalid left margin | 4224292655297723eb98691001100052 | Endpoint New Version8 | Output Document new version - EndPoint | Output 9 | TCPDF | 1 | Letter | 30 | 30,7.98 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | 400 | out_doc_right_margin | - | Invalid right margin | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURIT9 | Output Document new version PDF SECURITY | Output 10 | TCPDF | 0 | Legal | 25 | 25 | 25,54.98 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | 400 | out_doc_top_margin | - | Invalid top margin | 4224292655297723eb98691001100052 | Endpoint New Version Doc10 | Output Document new version solo doc | Output 11 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25,34.09 | WORD | HTML | 1 | | | 0 | | | | 400 | out_doc_bottom_margin | - | Invalid bottom margin | 4224292655297723eb98691001100052 | Endpoint New Version PDF 11 | Output Document new version solo pdf | Output 12 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDtest@#$$ | HTML | 1 | | | 1 | sample | sample | print | 400 | out_doc_generate | - | Invalid doc versioning | 4224292655297723eb98691001100052 | Endpoint New Version PDF 15 | Output Document new version solo pdf | Output 16 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1,99.98 | | | 1 | sample | sample | print | 400 | out_doc_versioning | - | Invalid doc pdf security enabled | 4224292655297723eb98691001100052 | Endpoint New Version Doc 18 | Output Document new version solo doc | Output 18 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 1 | | | 23454 | | | | 400 | out_doc_generate | - | Invalid doc pdf security permissions | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURI22 | Output Document new version PDF SECURITY | Output 21 | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modfy\|cop\|for\|aaa | 400 | out_doc_pdf_security_permissions | - | Field requered out doc title | 4224292655297723eb98691001100052 | | Output Document old version - EndPoint | Output 22 | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | 400 | out_doc_title | - | Field required out doc filename | 4224292655297723eb98691001100052 | Endpoint Old Version Doc | Output Document old version solo doc | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 1 | | | 0 | | | | 400 | out_doc_generate | - | Output created with same name | 4224292655297723eb98691001100052 | Endpoint Old Version (base) | Output Document old version solo doc | Output 23 | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 0 | | | | 400 | Output Document with the same name in this process | + | test_description | project | out_doc_title | out_doc_description |out_doc_filename | out_doc_template | out_doc_report_generator | out_doc_landscape | out_doc_media | out_doc_left_margin | out_doc_right_margin | out_doc_top_margin | out_doc_bottom_margin | out_doc_generate | out_doc_type | out_doc_versioning | out_doc_destination_path | out_doc_tags | out_doc_pdf_security_enabled | out_doc_pdf_security_open_password | out_doc_pdf_security_owner_password | out_doc_pdf_security_permissions | error_code | error_message | + | Invalid PDF Generator | 4224292655297723eb98691001100052 | Endpoint New Version 4 | Output Document new version - EndPoint | Output 5 | Example | @#$%¼¤¾½ | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | 400 | out_doc_report_generator | + | Invalid landscape | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURIT5 | Output Document new version PDF SECURITY | Output 6 | Example | TCPDF | 34 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | 400 | out_doc_landscape | + | Invalid media type | 4224292655297723eb98691001100052 | Endpoint New Version Doc6 | Output Document new version solo doc | Output 7 | Example | TCPDF | 0 | Legal!@#$$$%^&| 25 | 25 | 25 | 25 | WORD | HTML | 1 | | | 0 | | | | 400 | out_doc_media | + | Invalid document type | 4224292655297723eb98691001100052 | Endpoint New Version PDF7 | Output Document new version solo pdf | Output 8 | Example | TCPDF | 0 | Legal | 25,56.98 | 25 | 25 | 25 | PDF | HTML | 1 | | | 1 | sample | sample | print | 400 | out_doc_left_margin | + | Invalid left margin | 4224292655297723eb98691001100052 | Endpoint New Version8 | Output Document new version - EndPoint | Output 9 | Example | TCPDF | 1 | Letter | 30 | 30,7.98 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | 400 | out_doc_right_margin | + | Invalid right margin | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURIT9 | Output Document new version PDF SECURITY | Output 10 | Example | TCPDF | 0 | Legal | 25 | 25 | 25,54.98 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | 400 | out_doc_top_margin | + | Invalid top margin | 4224292655297723eb98691001100052 | Endpoint New Version Doc10 | Output Document new version solo doc | Output 11 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25,34.09 | WORD | HTML | 1 | | | 0 | | | | 400 | out_doc_bottom_margin | + | Invalid bottom margin | 4224292655297723eb98691001100052 | Endpoint New Version PDF 11 | Output Document new version solo pdf | Output 12 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDtest@#$$ | HTML | 1 | | | 1 | sample | sample | print | 400 | out_doc_generate | + | Invalid doc versioning | 4224292655297723eb98691001100052 | Endpoint New Version PDF 15 | Output Document new version solo pdf | Output 16 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 1,99.98 | | | 1 | sample | sample | print | 400 | out_doc_versioning | + | Invalid doc pdf security enabled | 4224292655297723eb98691001100052 | Endpoint New Version Doc 18 | Output Document new version solo doc | Output 18 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 1 | | | 23454 | | | | 400 | out_doc_generate | + | Invalid doc pdf security permissions | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURI22 | Output Document new version PDF SECURITY | Output 21 | Example | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 1 | sample | sample | print\|modfy\|cop\|for\|aaa | 400 | out_doc_pdf_security_permissions | + | Field requered out doc title | 4224292655297723eb98691001100052 | | Output Document old version - EndPoint | Output 22 | Example | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | | 0 | | | | 400 | out_doc_title | + | Field required out doc filename | 4224292655297723eb98691001100052 | Endpoint Old Version Doc | Output Document old version solo doc | | Example | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 1 | | | 0 | | | | 400 | out_doc_generate | + | Output created with same name | 4224292655297723eb98691001100052 | Endpoint Old Version (base) | Output Document old version solo doc | Output 23 | Example | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 1 | | | 0 | | | | 400 | Output Document with the same name in this process | diff --git a/features/backend/projects/project_export_import/main_tests_project_export_import.feature b/features/backend/projects/project_export_import/main_tests_project_export_import.feature index 437a9efbd..f8a898781 100644 --- a/features/backend/projects/project_export_import/main_tests_project_export_import.feature +++ b/features/backend/projects/project_export_import/main_tests_project_export_import.feature @@ -1,21 +1,14 @@ @ProcessMakerMichelangelo @RestAPI Feature: Import/Export Process Main Tests Requirements: - a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") already loaded + a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN", "Export process empty") already loaded there are many activities, steps, triggers, pmtables, asignee, process supervisor, process permissions, etc. in the process Background: Given that I have a valid access_token -Scenario: Get for Export Project - Given I request "project/1455892245368ebeb11c1a5001393784/export" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/xml" - And the type is "array" - -#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc. +#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc. del proyecto "Process Complete BPMN" Scenario: Get a List DynaForms of a Project Process Complete BPMN Given I request "project/1455892245368ebeb11c1a5001393784/dynaforms" @@ -39,6 +32,7 @@ Scenario: Get the Output Documents List when there are exactly two output docume And the response charset is "UTF-8" And the content type is "application/json" And the type is "array" + And that "out_doc_template" is set to "Ejemplo de Output Document" And the response has 1 records Scenario: Get the Triggers List when there are exactly two triggers @@ -86,6 +80,20 @@ Scenario: Get a list templates folder of process files manager And the type is "array" And the response has 1 records +Scenario: Verify that there are report tables + Given I request "project/1455892245368ebeb11c1a5001393784/report-tables" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 1 record + +Scenario: Get the Case Trackers Objects of a Project + And I request "project/1455892245368ebeb11c1a5001393784/case-tracker/objects" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 1 record + Scenario: Get a single Process Given that I want to get a resource with the key "obj_uid" stored in session array And I request "project/1455892245368ebeb11c1a5001393784/process" @@ -122,6 +130,24 @@ Scenario: Get a single Process And that "pro_summary_dynaform" is set to "898822326536be3a12addb0034537553" And that "pro_calendar" is set to "14606161052f50839307899033145440" +#Export Process + +Scenario: Get for Export Project + Given I request "project/1455892245368ebeb11c1a5001393784/export" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/xml" + And save exported process to "/home/wendy/uploadfiles/" as "Process_Complete_BPMN" + + +Scenario: Delete a Project created previously in this script + Given that I want to delete a resource with the key "prj_uid" stored in session array + And I request "projects/1455892245368ebeb11c1a5001393784" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + #Import Process Scenario Outline: Import a process @@ -136,9 +162,10 @@ Scenario Outline: Import a process Examples: | project_file | import_option | prj_uid_number | | /home/wendy/uploadfiles/Process_NewCreate_BPMN.pmx | create | 1 | - | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | overwrite | 2 | - | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | disable | 3 | - | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | keep | 4 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | 2 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | overwrite | 3 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | disable | 4 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | keep | 5 | #Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc. @@ -154,9 +181,10 @@ Scenario Outline: Get a List DynaForms of a Project Process Complete BPMN Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 4 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 26 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 26 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 26 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 26 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 26 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 26 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 26 | Scenario Outline: Get the Input Documents List when there are exactly zero input documents @@ -170,9 +198,10 @@ Scenario Outline: Get the Input Documents List when there are exactly zero input Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get the Output Documents List when there are exactly two output documents @@ -186,9 +215,10 @@ Scenario Outline: Get the Output Documents List when there are exactly two outpu Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get the Triggers List when there are exactly two triggers @@ -202,9 +232,10 @@ Scenario Outline: Get the Triggers List when there are exactly two triggers Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 3 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 3 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 3 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 3 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 3 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 3 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 3 | Scenario Outline: List assignees of each activity @@ -220,9 +251,10 @@ Scenario Outline: List assignees of each activity Examples: | import_option | prj_uid_number | prj_uid | records | project | activity | records | aas_uid | aas_type | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | 601816709536cfeae7d7cd9079578104 | 771350954536cfec446fab9019867857 | 1 | 70084316152d56749e0f393054862525 | group | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 4790702485368efad167477011123879 | 1 | 70084316152d56749e0f393054862525 | group | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 2072984565368efc137a394001073529 | 1 | 70084316152d56749e0f393054862525 | group | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 4790702485368efad167477011123879 | 1 | 70084316152d56749e0f393054862525 | group | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 2072984565368efc137a394001073529 | 1 | 70084316152d56749e0f393054862525 | group | Scenario Outline: Get a List of current process supervisors of a project @@ -236,9 +268,10 @@ Scenario Outline: Get a List of current process supervisors of a project Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get a List of current Process Permissions of a project @@ -250,9 +283,10 @@ Scenario Outline: Get a List of current Process Permissions of a project Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get a list templates folder of process files manager @@ -266,9 +300,10 @@ Scenario Outline: Get a list templates folder of process files manager Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario: Get a single Process process "Process Complete BPMN" @@ -358,8 +393,8 @@ Scenario Outline: Delete a Project created previously in this script | prj_uid_number | | 1 | | 2 | - | 3 | | 4 | + | 5 | Scenario: Get a list of projects @@ -380,4 +415,66 @@ Scenario Outline: Import a process Examples: | project_file | import_option | | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | - \ No newline at end of file + + +#For example, to export a empty process + +Scenario: Get for Export Project "Export process empty" + Given I request "project/5195971265375127fce82f4015927137/export" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/xml" + And save exported process to "/home/wendy/uploadfiles/" as "Export process empty" + +Scenario: Delete a Project created previously in this script "Export process empty" + Given that I want to delete a resource with the key "prj_uid" stored in session array + And I request "projects/5195971265375127fce82f4015927137" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + +Scenario: Import a process "Export process empty" + Given POST upload a project file "/home/wendy/uploadfiles/Export_process_empty.pmx" to "project/import?option=create" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + +Scenario: Get a List DynaForms of a Project "Export process empty" + Given I request "project/5195971265375127fce82f4015927137/dynaforms" with the key "prj_uid" stored in session array + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 records + +Scenario: Get the Input Documents List when there are exactly zero input documents + Given I request "project/5195971265375127fce82f4015927137/input-documents" with the key "prj_uid" stored in session array + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 records + +Scenario: Get the Output Documents List when there are exactly zero output documents + Given I request "project/5195971265375127fce82f4015927137/output-documents" with the key "prj_uid" stored in session array + 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 0 records + +Scenario: Verify that there are report tables + Given I request "project/5195971265375127fce82f4015927137/report-tables" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 0 record + +Scenario: Get the Case Trackers Objects of a Project + And I request "project/5195971265375127fce82f4015927137/case-tracker/objects" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 record \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index ba7a8d63a..0f8f07ea2 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1623,4 +1623,29 @@ class RestContext extends BehatContext throw new \Exception("JSON Response does not have '$varName' property\n\n" ); } } + /** + * @Given /^save exported process to "([^"]*)"$/ + * @Given /^save exported process to "([^"]*)" as "([^"]*)"$/ + */ + public function saveExportedProcessTo($destinationFolder, $exportedProcessFileName="") + { + + if($exportedProcessFileName == ""){//Obtain name from XML + $exportedProcessFileName=$this->_data->xpath('//metadata/meta[@key="name"]'); + $exportedProcessFileName = $exportedProcessFileName[0]; + $exportedProcessFileName = "ExpBehat ".$exportedProcessFileName; + + + } + + $exportedProcessFileName = $destinationFolder.str_replace(" ","_",$exportedProcessFileName).".pmx"; + + $this->printDebug("Exporting process to: $exportedProcessFileName"); + + file_put_contents($exportedProcessFileName, $this->_response->getBody(true)); + + + + } + } \ No newline at end of file diff --git a/features/json/process_template_sequencial.json b/features/json/process_template_sequencial.json index 9fe68aed2..5b66a18c4 100644 --- a/features/json/process_template_sequencial.json +++ b/features/json/process_template_sequencial.json @@ -299,7 +299,52 @@ ] } ], - "artifacts": [], + "artifacts": [ + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "180", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + }, + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "420", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + }, + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "660", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + }, + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "900", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + } + ], "laneset": [], "lanes": [] } diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php index 4dacdf2c2..bc9868f52 100755 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/class.processes.php @@ -370,6 +370,24 @@ class Processes return $oCaseScheduler->Exists( $sUid ); } + /** + * Verify if exists the "Process User" in table PROCESS_USER + * + * @param string $processUserUid Unique id of "Process User" + * + * return bool Return true if exists the "Process User" in table PROCESS_USER, false otherwise + */ + public function processUserExists($processUserUid) + { + try { + $processUser = new ProcessUser(); + + return $processUser->Exists($processUserUid); + } catch (Exception $e) { + throw $e; + } + } + /** * get an unused input GUID * @@ -602,6 +620,24 @@ class Processes return $sNewUid; } + /** + * Get an unused "Process User" unique id + * + * return string Return a new generated unique id + */ + public function getUnusedProcessUserUid() + { + try { + do { + $newUid = G::generateUniqueID(); + } while ($this->processUserExists($newUid)); + + return $newUid; + } catch (Exception $e) { + throw $e; + } + } + /** * change the GUID for a serialized process * @@ -726,6 +762,13 @@ class Processes $oData->caseScheduler[$key]['PRO_UID'] = $sNewProUid; } } + + if (isset($oData->processUser)) { + foreach ($oData->processUser as $key => $value) { + $oData->processUser[$key]["PRO_UID"] = $sNewProUid; + } + } + return true; } @@ -1503,6 +1546,32 @@ class Processes } } + /** + * Create "Process User" records + * + * @param array $arrayData Data to create + * + * return void + */ + public function createProcessUser(array $arrayData) + { + try { + $processUser = new ProcessUser(); + + foreach ($arrayData as $value) { + $record = $value; + + if ($processUser->Exists($record["PU_UID"])) { + $result = $processUser->remove($record["PU_UID"]); + } + + $result = $processUser->create($record); + } + } catch (Exception $e) { + throw $e; + } + } + /** * Gets Input Documents Rows from aProcess. * @@ -1966,6 +2035,34 @@ class Processes $oData->uid["CASE_SCHEDULER"] = $map; } + /** + * Renew all the unique id for "Process User" + * + * @param $data Object with the data + * + * return void + */ + public function renewAllProcessUserUid(&$data) + { + try { + if (isset($data->processUser)) { + $map = array(); + + foreach ($data->processUser as $key => $value) { + $record = $value; + + $newUid = $this->getUnusedProcessUserUid(); + $map[$record["PU_UID"]] = $newUid; + $data->processUser[$key]["PU_UID"] = $newUid; + } + + $data->uid["PROCESS_USER"] = $map; + } + } catch (Exception $e) { + throw $e; + } + } + /** * Renew the GUID's for all the Uids for all the elements * @@ -1994,6 +2091,7 @@ class Processes $this->renewAllFieldCondition( $oData ); $this->renewAllEvent( $oData ); $this->renewAllCaseScheduler( $oData ); + $this->renewAllProcessUserUid($oData); } /** @@ -2166,6 +2264,7 @@ class Processes * @param string $sProUid * @return $aDynaform array */ + //Deprecated public function getGroupwfSupervisor ($sProUid, &$oData) { try { @@ -2481,6 +2580,50 @@ class Processes } } + /** + * Get "Process User" (Groups) records of a Process + * + * @param string $processUid Unique id of Process + * + * return array Return an array with all "Process User" (Groups) + */ + public function getProcessUser($processUid) + { + try { + $arrayProcessUser = array(); + + //Get data + $criteria = new Criteria("workflow"); + + $criteria->add(ProcessUserPeer::PRO_UID, $processUid, Criteria::EQUAL); + $criteria->add(ProcessUserPeer::PU_TYPE, "GROUP_SUPERVISOR", Criteria::EQUAL); + + $rsCriteria = ProcessUserPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + //Verify group status + $criteria2 = new Criteria("workflow"); + + $criteria2->add(GroupwfPeer::GRP_UID, $row["USR_UID"], Criteria::EQUAL); + $criteria2->add(GroupwfPeer::GRP_STATUS, "ACTIVE", Criteria::EQUAL); + + $rsCriteria2 = GroupwfPeer::doSelectRS($criteria2); + + if ($rsCriteria2->next()) { + $arrayProcessUser[] = $row; + } + } + + //Return + return $arrayProcessUser; + } catch (Exception $e) { + throw $e; + } + } + /** * Get Task User Rows from an array of data * @@ -2638,6 +2781,129 @@ class Processes } } #@!neyek + /** + * Merge groupwfs data + * + * @param array $arrayGroupwfsData Data groupwfs + * @param array $arrayData Data for merge + * @param string $groupUidFieldNameInArrayData Field name of unique id + * + * return array Return an array with all groupwfs data + */ + public function groupwfsMerge(array $arrayGroupwfsData, array $arrayData, $groupUidFieldNameInArrayData = "GRP_UID") + { + try { + $arrayUid = array(); + + foreach ($arrayGroupwfsData as $value) { + $record = $value; + + $arrayUid[] = $record["GRP_UID"]; + } + + //Merge + $groupwf = new Groupwf(); + + foreach ($arrayData as $value) { + $record = $value; + + if (isset($record[$groupUidFieldNameInArrayData]) && !in_array($record[$groupUidFieldNameInArrayData], $arrayUid)) { + $arrayGroupwfsData[] = $groupwf->Load($record[$groupUidFieldNameInArrayData]); + } + } + + //Return + return $arrayGroupwfsData; + } catch (Exception $e) { + throw $e; + } + } + + /** + * Update unique ids in groupwfs data by database + * + * @param object $data Data + * + * return object Return data + */ + public function groupwfsUpdateUidByDatabase($data) + { + try { + //Get Groupwf of database + $arrayGroupwf = array(); + + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(GroupwfPeer::GRP_UID); + $criteria->addSelectColumn(ContentPeer::CON_VALUE); + $criteria->addJoin(GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN); + $criteria->add(ContentPeer::CON_CATEGORY, "GRP_TITLE", Criteria::EQUAL); + $criteria->add(ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL); + + $rsCriteria = GroupwfPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $arrayGroupwf[] = $row; + } + + //Check if any group name exists in database + $arrayUid = array(); + + foreach ($data->groupwfs as $key => $value) { + $groupwfsRecord = $value; + + foreach ($arrayGroupwf as $key2 => $value2) { + $groupwfRecord = $value2; + + if ($groupwfRecord["CON_VALUE"] == $groupwfsRecord["GRP_TITLE"] && $groupwfRecord["GRP_UID"] != $groupwfsRecord["GRP_UID"]) { + //Update unique id + $uidOld = $data->groupwfs[$key]["GRP_UID"]; + + $data->groupwfs[$key]["GRP_UID"] = $groupwfRecord["GRP_UID"]; + $arrayUid[$uidOld] = $groupwfRecord["GRP_UID"]; + break; + } + } + } + + //Update in $data + if (count($arrayUid) > 0) { + foreach ($data->taskusers as $key => $value) { + $record = $value; + + if (isset($arrayUid[$record["USR_UID"]])) { + $data->taskusers[$key]["USR_UID"]= $arrayUid[$record["USR_UID"]]; + } + } + + foreach ($data->objectPermissions as $key => $value) { + $record = $value; + + if (isset($arrayUid[$record["USR_UID"]])) { + $data->objectPermissions[$key]["USR_UID"]= $arrayUid[$record["USR_UID"]]; + } + } + + if (isset($data->processUser)) { + foreach ($data->processUser as $key => $value) { + $record = $value; + + if (isset($arrayUid[$record["USR_UID"]])) { + $data->processUser[$key]["USR_UID"]= $arrayUid[$record["USR_UID"]]; + } + } + } + } + + //Return + return $data; + } catch (Exception $e) { + throw $e; + } + } /** * change Status of any Process @@ -2681,7 +2947,9 @@ class Processes $oData->caseScheduler = $this->getCaseSchedulerRow( $sProUid ); $oData->processCategory = $this->getProcessCategoryRow( $sProUid ); $oData->taskExtraProperties = $this->getTaskExtraPropertiesRows( $sProUid ); - $this->getGroupwfSupervisor( $sProUid, $oData); + $oData->processUser = $this->getProcessUser($sProUid); + + $oData->groupwfs = $this->groupwfsMerge($oData->groupwfs, $oData->processUser, "USR_UID"); //krumo ($oData);die; //$oJSON = new Services_JSON(); @@ -2975,7 +3243,7 @@ class Processes $oCriteria->addSelectColumn( ContentPeer::CON_ID ); $oCriteria->addSelectColumn( ContentPeer::CON_VALUE ); $oCriteria->add( ContentPeer::CON_CATEGORY, 'GRP_TITLE' ); - $oCriteria->add( ContentPeer::CON_LANG, 'en' ); + $oCriteria->add(ContentPeer::CON_LANG, SYS_LANG); $oCriteria->addJoin( ContentPeer::CON_ID, GroupwfPeer::GRP_UID ); $oDataset = ContentPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); @@ -3049,6 +3317,7 @@ class Processes * @param $sGroupList array of a group list * @return $mergedGroupList array of existing groups */ + //Deprecated public function mergeExistingGroups ($sGroupList) { $oCriteria = new Criteria( 'workflow' ); @@ -3101,6 +3370,7 @@ class Processes * the task and the group list * @return $mergedTaskUserList array of the merged task user list */ + //Deprecated public function mergeExistingUsers ($sBaseGroupList, $sGroupList, $sTaskUserList) { foreach ($sTaskUserList as $taskuser) { @@ -3710,6 +3980,8 @@ class Processes //Create data related to Configuration table $this->createTaskExtraPropertiesRows( isset( $oData->taskExtraProperties ) ? $oData->taskExtraProperties : array () ); + + $this->createProcessUser((isset($oData->processUser))? $oData->processUser : array()); } @@ -4037,7 +4309,7 @@ class Processes * @param $proId process Uid * @return $result */ - public function getTaskExtraPropertiesRows( $proId ) + public function getTaskExtraPropertiesRows($proId) { try { diff --git a/workflow/engine/methods/processes/processes_Import_Ajax.php b/workflow/engine/methods/processes/processes_Import_Ajax.php index 7e52dd886..47d991337 100644 --- a/workflow/engine/methods/processes/processes_Import_Ajax.php +++ b/workflow/engine/methods/processes/processes_Import_Ajax.php @@ -24,57 +24,18 @@ use ProcessMaker\Importer\XmlImporter; -ini_set( 'max_execution_time', '0' ); - -if (isset($_FILES["PROCESS_FILENAME"])) { - $ext = pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION); - - if ($ext == "pmx") { - $importer = new XmlImporter(); - $importer->setData("usr_uid", $_SESSION['USER_LOGGED']); - $importer->setSaveDir(PATH_DOCUMENT . 'input'); - $importer->setSourceFromGlobals("PROCESS_FILENAME"); - - try { - $prjUid = $importer->import(); - - $result = array( - "success" => true, - "catchMessage" => "", - "ExistProcessInDatabase" => 0, - "ExistGroupsInDatabase" => 0, - "sNewProUid" => $prjUid, - "project_type" => "bpmn" - ); - } catch (Exception $e) { - $result = array( - "success" => true, - "catchMessage" => "", //$e->getMessage(), - "ExistProcessInDatabase" => 1, - "ExistGroupsInDatabase" => 0, - "groupBeforeAccion" => "uploadFileNewProcess", - "sNewProUid" => "", - "proFileName" => $_FILES['PROCESS_FILENAME']['name'], - "project_type" => "bpmn" - ); - } - - echo json_encode($result); - exit(0); - } -} elseif (isset($_POST["PRO_FILENAME"]) && file_exists(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"]) && pathinfo(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"], PATHINFO_EXTENSION) == "pmx") { - switch ($_POST["IMPORT_OPTION"]) { - case 1: $option = XmlImporter::IMPORT_OPTION_OVERWRITE; break; - case 2: $option = XmlImporter::IMPORT_OPTION_DISABLE_AND_CREATE_NEW; break; - case 3: $option = XmlImporter::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW; break; - } +ini_set("max_execution_time", 0); +if (isset($_FILES["PROCESS_FILENAME"]) && + pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "pmx" +) { $importer = new XmlImporter(); - $importer->setData("usr_uid", $_SESSION['USER_LOGGED']); - $importer->setSourceFile(PATH_DOCUMENT . 'input' . PATH_SEP . $_POST["PRO_FILENAME"]); + $importer->setData("usr_uid", $_SESSION["USER_LOGGED"]); + $importer->setSaveDir(PATH_DOCUMENT . "input"); + $importer->setSourceFromGlobals("PROCESS_FILENAME"); try { - $prjUid = $importer->import($option); + $prjUid = $importer->import(); $result = array( "success" => true, @@ -84,16 +45,18 @@ if (isset($_FILES["PROCESS_FILENAME"])) { "sNewProUid" => $prjUid, "project_type" => "bpmn" ); - } catch (\Exception $e) { + } catch (Exception $e) { $result = array( "success" => true, - "catchMessage" => $e->getMessage(), - "ExistProcessInDatabase" => 1, - "ExistGroupsInDatabase" => 0, - "groupBeforeAccion" => "uploadFileNewProcess", + "catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)))? "" : $e->getMessage(), + "ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS)? 1 : 0, + "ExistGroupsInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0, "sNewProUid" => "", - "proFileName" => "", - "project_type" => "bpmn" + "project_type" => "bpmn", + + "proFileName" => $_FILES["PROCESS_FILENAME"]["name"], + "groupBeforeAccion" => "uploadFileNewProcess", + "importOption" => 0 ); } @@ -101,38 +64,73 @@ if (isset($_FILES["PROCESS_FILENAME"])) { exit(0); } -function reservedWordsSqlValidate ($data) -{ - $arrayAux = array (); - $reservedWordsSql = G::reservedWordsSql(); +if (isset($_POST["PRO_FILENAME"]) && + file_exists(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"]) && + pathinfo(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"], PATHINFO_EXTENSION) == "pmx" +) { + $option = XmlImporter::IMPORT_OPTION_CREATE_NEW; - foreach ($data->reportTables as $rptIndex => $rptValue) { - if (in_array( strtoupper( $rptValue["REP_TAB_NAME"] ), $reservedWordsSql )) { - $arrayAux[] = $rptValue["REP_TAB_NAME"]; - } + switch ((isset($_POST["IMPORT_OPTION"]))? (int)($_POST["IMPORT_OPTION"]) : 0) { + case 1: + $option = XmlImporter::IMPORT_OPTION_OVERWRITE; + break; + case 2: + $option = XmlImporter::IMPORT_OPTION_DISABLE_AND_CREATE_NEW; + break; + case 3: + $option = XmlImporter::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW; + break; } - if (count( $arrayAux ) > 0) { - throw (new Exception( G::LoadTranslation( "ID_PMTABLE_INVALID_NAME", array (implode( ", ", $arrayAux ) - ) ) )); + $optionGroup = XmlImporter::GROUP_IMPORT_OPTION_CREATE_NEW; + + switch ((isset($_POST["optionGroupExistInDatabase"]))? (int)($_POST["optionGroupExistInDatabase"]) : 0) { + case 1: + $optionGroup = XmlImporter::GROUP_IMPORT_OPTION_RENAME; + break; + case 2: + $optionGroup = XmlImporter::GROUP_IMPORT_OPTION_MERGE_PREEXISTENT; + break; } - $arrayAux = array (); + $importer = new XmlImporter(); + $importer->setData("usr_uid", $_SESSION["USER_LOGGED"]); + $importer->setSourceFile(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"]); - foreach ($data->reportTablesVars as $rptIndex => $rptValue) { - if (in_array( strtoupper( $rptValue["REP_VAR_NAME"] ), $reservedWordsSql )) { - $arrayAux[] = $rptValue["REP_VAR_NAME"]; - } + try { + $prjUid = $importer->import($option, $optionGroup); + + $result = array( + "success" => true, + "catchMessage" => "", + "ExistProcessInDatabase" => 0, + "ExistGroupsInDatabase" => 0, + "sNewProUid" => $prjUid, + "project_type" => "bpmn" + ); + } catch (Exception $e) { + $result = array( + "success" => true, + "catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)))? "" : $e->getMessage(), + "ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS)? 1 : 0, + "ExistGroupsInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0, + "sNewProUid" => "", + "project_type" => "bpmn", + + "proFileName" => $_POST["PRO_FILENAME"], + "groupBeforeAccion" => "uploadFileNewProcess", + "importOption" => (isset($_POST["IMPORT_OPTION"]))? (int)($_POST["IMPORT_OPTION"]) : 0 + ); } - if (count( $arrayAux ) > 0) { - throw (new Exception( G::LoadTranslation( "ID_PMTABLE_INVALID_FIELD_NAME", array (implode( ", ", $arrayAux ) - ) ) )); - } + echo G::json_encode($result); + exit(0); } $action = isset( $_REQUEST['ajaxAction'] ) ? $_REQUEST['ajaxAction'] : null; +$importer = new XmlImporter(); + $result = new stdClass(); $result->success = true; $result->catchMessage = ""; @@ -201,7 +199,7 @@ if ($action == "uploadFileNewProcess") { $oData = $oProcess->getProcessData( $path . $filename ); } - reservedWordsSqlValidate( $oData ); + $importer->throwExceptionIfExistsReservedWordsSql($oData); //!Upload file $Fields['PRO_FILENAME'] = $filename; @@ -223,12 +221,8 @@ if ($action == "uploadFileNewProcess") { if (! is_null( $optionGroupExistInDatabase )) { if ($optionGroupExistInDatabase == 1) { $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); - } else if ($optionGroupExistInDatabase == 2) { - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); - $oData->objectPermissions = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->objectPermissions ); + } elseif ($optionGroupExistInDatabase == 2) { + $oData = $oProcess->groupwfsUpdateUidByDatabase($oData); } $result->ExistGroupsInDatabase = 0; } else { @@ -290,7 +284,7 @@ if ($action == "uploadFileNewProcessExist") { $oData = $oProcess->getProcessData( $path . $filename ); } - reservedWordsSqlValidate( $oData ); + $importer->throwExceptionIfExistsReservedWordsSql($oData); $Fields['PRO_FILENAME'] = $filename; $sProUid = $oData->process['PRO_UID']; @@ -301,11 +295,8 @@ if ($action == "uploadFileNewProcessExist") { if (! is_null( $optionGroupExistInDatabase )) { if ($optionGroupExistInDatabase == 1) { $oData->groupwfs = $oProcess->renameExistingGroups( $oData->groupwfs ); - } else if ($optionGroupExistInDatabase == 2) { - $oBaseGroup = $oData->groupwfs; - $oNewGroup = $oProcess->mergeExistingGroups( $oData->groupwfs ); - $oData->groupwfs = $oNewGroup; - $oData->taskusers = $oProcess->mergeExistingUsers( $oBaseGroup, $oNewGroup, $oData->taskusers ); + } elseif ($optionGroupExistInDatabase == 2) { + $oData = $oProcess->groupwfsUpdateUidByDatabase($oData); } $result->ExistGroupsInDatabase = 0; } else { @@ -359,7 +350,7 @@ if ($action == "uploadFileNewProcessExist") { } //!data ouput - $result->fileName = $filename; + $result->proFileName = $filename; $result->importOption = $option; $result->sNewProUid = $sNewProUid; $result->success = true; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php b/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php index d103d37e7..5c1262ba5 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Calendar.php @@ -251,9 +251,7 @@ class Calendar $obj = \CalendarDefinitionPeer::retrieveByPK($calendarUid); if (!(is_object($obj) && get_class($obj) == "CalendarDefinition")) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarUid), "The calendar with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_CALENDAR_DOES_NOT_EXIST", array($fieldNameForException, $calendarUid))); } } catch (\Exception $e) { throw $e; @@ -273,9 +271,7 @@ class Calendar { try { if ($this->existsName($calendarName, $calendarUidExclude)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $calendarName), "The calendar name with {0}: \"{1}\" already exists"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_CALENDAR_NAME_ALREADY_EXISTS", array($fieldNameForException, $calendarName))); } } catch (\Exception $e) { throw $e; @@ -331,7 +327,7 @@ class Calendar if (isset($arrayData["CAL_WORK_HOUR"])) { foreach ($arrayData["CAL_WORK_HOUR"] as $value) { if ($value["DAY"] != 0 && !in_array($value["DAY"], $arrayData["CAL_WORK_DAYS"], true)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exist in \"{1}\"."))); + throw new \Exception(\G::LoadTranslation("ID_VALUE_SPECIFIED_DOES_NOT_EXIST", array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]))); } $arrayCalendarWorkHour[] = array( @@ -438,7 +434,7 @@ class Calendar foreach ($arrayAux as $value) { if (isset($arrayData["CAL_WORK_HOUR"]) && $value["DAY"] != 0 && !in_array($value["DAY"], $calendarWorkDays, true)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]), "Value specified for \"{0}\" does not exist in \"{1}\"."))); + throw new \Exception(\G::LoadTranslation("ID_VALUE_SPECIFIED_DOES_NOT_EXIST", array($this->arrayWorkHourFieldNameForException["day"], $this->arrayFieldNameForException["calendarWorkDays"]))); } $arrayCalendarWorkHour[] = array( diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/CaseTracker.php b/workflow/engine/src/ProcessMaker/BusinessModel/CaseTracker.php index 8e529e568..6c6b9ab6e 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/CaseTracker.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/CaseTracker.php @@ -17,11 +17,9 @@ class CaseTracker $arrayDataIni = $arrayData; //Verify data - $process = new \Process(); + $process = new \ProcessMaker\BusinessModel\Process(); - if (!$process->exists($processUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}"))); - } + $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid"); //Update $caseTracker = new \CaseTracker(); @@ -64,11 +62,9 @@ class CaseTracker $arrayCaseTracker = array(); //Verify data - $process = new \Process(); + $process = new \ProcessMaker\BusinessModel\Process(); - if (!$process->exists($processUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}"))); - } + $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid"); //Get data $criteria = new \Criteria(); @@ -118,11 +114,9 @@ class CaseTracker $arrayAvailableCaseTrackerObject = array(); //Verify data - $process = new \Process(); + $process = new \ProcessMaker\BusinessModel\Process(); - if (!$process->exists($processUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}"))); - } + $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid"); //Get Uids $arrayDynaFormUid = array(); @@ -315,11 +309,9 @@ class CaseTracker $arrayCaseTrackerObject = array(); //Verify data - $process = new \Process(); + $process = new \ProcessMaker\BusinessModel\Process(); - if (!$process->exists($processUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" does not exist in table {1}"))); - } + $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid"); $dynaform = new \Dynaform(); $inputDocument = new \InputDocument(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php b/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php index 315ffa524..acf8ac6e3 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/CaseTrackerObject.php @@ -67,30 +67,28 @@ class CaseTrackerObject unset($arrayData["CTO_UID"]); //Verify data - $process = new \Process(); + $process = new \ProcessMaker\BusinessModel\Process(); - if (!$process->exists($processUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}"))); - } + $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid"); if (!isset($arrayData["CTO_TYPE_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_TYPE_OBJ")))); } if (!isset($arrayData["CTO_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_UID_OBJ")))); } $step = new \ProcessMaker\BusinessModel\Step(); - $msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]); + $msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"], strtolower("CTO_UID_OBJ")); if ($msg != "") { - throw (new \Exception($msg)); + throw new \Exception($msg); } if ($this->existsRecord($processUid, $arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT"), "The record \"{0}\", exists in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT"))); } $ctoPosition = $arrayData["CTO_POSITION"]; @@ -144,28 +142,28 @@ class CaseTrackerObject //Verify data if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($caseTrackerObjectUid, "CASE_TRACKER_OBJECT"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid))); } if (isset($arrayData["CTO_TYPE_OBJ"]) && !isset($arrayData["CTO_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_UID_OBJ")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_UID_OBJ")))); } if (!isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array(strtolower("CTO_TYPE_OBJ")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array(strtolower("CTO_TYPE_OBJ")))); } if (isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) { $step = new \ProcessMaker\BusinessModel\Step(); - $msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]); + $msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"], strtolower("CTO_UID_OBJ")); if ($msg != "") { - throw (new \Exception($msg)); + throw new \Exception($msg); } if ($this->existsRecord($processUid, $arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"], 0, $caseTrackerObjectUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT"), "The record \"{0}\", exists in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($processUid . ", " . $arrayData["CTO_TYPE_OBJ"] . ", " . $arrayData["CTO_UID_OBJ"], "CASE_TRACKER_OBJECT"))); } } @@ -230,7 +228,7 @@ class CaseTrackerObject //Verify data if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($caseTrackerObjectUid, "CASE_TRACKER_OBJECT"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid))); } //Delete @@ -256,7 +254,7 @@ class CaseTrackerObject $caseTrackerObject = new \CaseTrackerObject(); if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($caseTrackerObjectUid, "CASE_TRACKER_OBJECT"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid))); } //Get data diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php index dbcc3752c..3b9f66751 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php @@ -282,9 +282,7 @@ class DynaForm $rsCriteria = \DynaformPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $dynaFormUid), "The DynaForm with {0}: {1}, does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_DOES_NOT_EXIST", array($fieldNameForException, $dynaFormUid))); } } catch (\Exception $e) { throw $e; @@ -305,9 +303,7 @@ class DynaForm { try { if ($this->existsTitle($processUid, $dynaFormTitle, $dynaFormUidExclude)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $dynaFormTitle), "The DynaForm title with {0}: \"{1}\", already exists"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_TITLE_ALREADY_EXISTS", array($fieldNameForException, $dynaFormTitle))); } } catch (\Exception $e) { throw $e; @@ -331,9 +327,7 @@ class DynaForm $arrayDynaFormData = $dynaForm->Load($dynaFormUid); if ($arrayDynaFormData["DYN_TYPE"] != "grid") { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $dynaFormUid), "The DynaForm with {0}: {1}, is not grid"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IS_NOT_GRID", array($fieldNameForException, $dynaFormUid))); } } catch (\Exception $e) { throw $e; @@ -458,10 +452,11 @@ class DynaForm $processUid = $arrayDynaFormData["PRO_UID"]; - //Verify dependencies dynaforms - $resultDependeds = $this->dynaFormDepends($dynaFormUid, $processUid); - if ($resultDependeds != '') { - throw (new \Exception($resultDependeds)); + //Verify dependences dynaforms + $resultDepends = $this->dynaFormDepends($dynaFormUid, $processUid); + + if ($resultDepends != "") { + throw new \Exception($resultDepends); } //Delete @@ -512,27 +507,27 @@ class DynaForm $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true); if (!isset($arrayData["COPY_IMPORT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("COPY_IMPORT")))); } if (!isset($arrayData["COPY_IMPORT"]["PRJ_UID"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")))); } $arrayData["COPY_IMPORT"]["PRJ_UID"] = trim($arrayData["COPY_IMPORT"]["PRJ_UID"]); if ($arrayData["COPY_IMPORT"]["PRJ_UID"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.PRJ_UID")))); } if (!isset($arrayData["COPY_IMPORT"]["DYN_UID"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")))); } $arrayData["COPY_IMPORT"]["DYN_UID"] = trim($arrayData["COPY_IMPORT"]["DYN_UID"]); if ($arrayData["COPY_IMPORT"]["DYN_UID"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")))); } $this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]); @@ -715,29 +710,29 @@ class DynaForm $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true); if ($arrayData["DYN_TYPE"] == "grid") { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->arrayFieldNameForException["dynaFormType"], "xmlform"), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($this->arrayFieldNameForException["dynaFormType"], "xmlform"))); } if (!isset($arrayData["PMTABLE"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE")))); } if (!isset($arrayData["PMTABLE"]["TAB_UID"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")))); } $arrayData["PMTABLE"]["TAB_UID"] = trim($arrayData["PMTABLE"]["TAB_UID"]); if ($arrayData["PMTABLE"]["TAB_UID"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID")))); } if (!isset($arrayData["PMTABLE"]["FIELDS"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")))); } if (count($arrayData["PMTABLE"]["FIELDS"]) == 0) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")))); } $this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]); @@ -756,7 +751,7 @@ class DynaForm } if ($flagValidFieldKey == 0) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "The attribute {0}, has an element invalid (incorrect keys)"))); + throw new \Exception(\G::LoadTranslation("ID_ATTRIBUTE_HAS_INVALID_ELEMENT_KEY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")))); } //Is Primary Key @@ -777,7 +772,7 @@ class DynaForm } if ($flagValidFieldPk == 0) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS.FLD_NAME"), $invalidFieldPk), "The field {0}: {1}, is not a primary key field of the PM Table"))); + throw new \Exception(\G::LoadTranslation("ID_PMTABLE_FIELD_IS_NOT_PRIMARY_KEY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS.FLD_NAME"), $invalidFieldPk))); } //All Primary Keys @@ -793,7 +788,7 @@ class DynaForm } if ($flagAllFieldPk == 0) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($missingFieldPk, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")), "The primary key field {0} of the PM Table is missing in the attribute {1}"))); + throw new \Exception(\G::LoadTranslation("ID_PMTABLE_PRIMARY_KEY_FIELD_IS_MISSING_IN_ATTRIBUTE", array($missingFieldPk, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS")))); } //Total of Primary Keys @@ -801,7 +796,7 @@ class DynaForm $n2 = count($arrayFieldPkAux); if ($n1 != $n2) { - throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($n1, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"), $n2), "The total primary key fields of the PM Table is {0}, the attribute {1} has {2} primary keys"))); + throw new \Exception(\G::LoadTranslation("ID_PMTABLE_TOTAL_PRIMARY_KEY_FIELDS_IS_NOT_EQUAL_IN_ATTRIBUTE", array($n1, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"), $n2))); } //Set data @@ -889,7 +884,7 @@ class DynaForm //Return return $arrayDataAux; } else { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($msgMethod)), "It is trying to create a DynaForm by \"{0}\", please send only one attribute for creation"))); + throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IT_IS_TRYING_CREATE_BY_SEVERAL_METHODS", array($this->getFieldNameByFormatFieldName($msgMethod)))); } } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Group.php b/workflow/engine/src/ProcessMaker/BusinessModel/Group.php index 626c1adea..32cfaa2cf 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Group.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Group.php @@ -143,9 +143,7 @@ class Group $group = new \Groupwf(); if (!$group->GroupwfExists($groupUid)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $groupUid), "The group with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_GROUP_DOES_NOT_EXIST", array($fieldNameForException, $groupUid))); } } catch (\Exception $e) { throw $e; @@ -165,9 +163,7 @@ class Group { try { if ($this->existsTitle($groupTitle, $groupUidExclude)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $groupTitle), "The group title with {0}: \"{1}\" already exists"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_GROUP_TITLE_ALREADY_EXISTS", array($fieldNameForException, $groupTitle))); } } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Group/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/Group/User.php index d2de2b6aa..967481d0c 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Group/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Group/User.php @@ -95,9 +95,7 @@ class User $obj = \GroupUserPeer::retrieveByPK($groupUid, $userUid); if (!(is_object($obj) && get_class($obj) == "GroupUser")) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $userUid), "The user with {0}: {1} is not assigned to the group"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_GROUP_USER_IS_NOT_ASSIGNED", array($fieldNameForException, $userUid))); } } catch (\Exception $e) { throw $e; @@ -119,9 +117,7 @@ class User $obj = \GroupUserPeer::retrieveByPK($groupUid, $userUid); if (is_object($obj) && get_class($obj) == "GroupUser") { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $userUid), "The user with {0}: {1} is already assigned to the group"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_GROUP_USER_IS_ALREADY_ASSIGNED", array($fieldNameForException, $userUid))); } } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php index 5880be1ca..2add33162 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php @@ -161,9 +161,7 @@ class InputDocument $rsCriteria = \InputDocumentPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $inputDocumentUid), "The Input Document with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_INPUT_DOCUMENT_DOES_NOT_EXIST", array($fieldNameForException, $inputDocumentUid))); } } catch (\Exception $e) { throw $e; @@ -184,9 +182,7 @@ class InputDocument { try { if ($this->existsTitle($processUid, $inputDocumentTitle, $inputDocumentUidExclude)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $inputDocumentTitle), "The Input Document title with {0}: \"{1}\" already exists"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_INPUT_DOCUMENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $inputDocumentTitle))); } } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php index 2f14f4b7d..fe8b10e4a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php @@ -83,6 +83,7 @@ class OutputDocument 'out_doc_title' => $aRow['OUT_DOC_TITLE'], 'out_doc_description' => $aRow['OUT_DOC_DESCRIPTION'], 'out_doc_filename' => $aRow['OUT_DOC_FILENAME'], + 'out_doc_template' => $aRow['OUT_DOC_TEMPLATE'], 'out_doc_report_generator' => $aRow['OUT_DOC_REPORT_GENERATOR'], 'out_doc_landscape' => $aRow['OUT_DOC_LANDSCAPE'], 'out_doc_media' => $aRow['OUT_DOC_MEDIA'], @@ -190,6 +191,7 @@ class OutputDocument 'out_doc_title' => $aRow['OUT_DOC_TITLE'], 'out_doc_description' => $aRow['OUT_DOC_DESCRIPTION'], 'out_doc_filename' => $aRow['OUT_DOC_FILENAME'], + 'out_doc_template' => $aRow['OUT_DOC_TEMPLATE'], 'out_doc_report_generator' => $aRow['OUT_DOC_REPORT_GENERATOR'], 'out_doc_landscape' => $aRow['OUT_DOC_LANDSCAPE'], 'out_doc_media' => $aRow['OUT_DOC_MEDIA'], @@ -241,10 +243,7 @@ class OutputDocument $outputDocumentData = array_change_key_case($outputDocumentData, CASE_UPPER); $outputDocumentData['PRO_UID'] = $sProcessUID; //Verify data - $process = new \Process(); - if (!$process->exists($sProcessUID)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($sProcessUID, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}"))); - } + Validator::proUid($sProcessUID, '$pro_uid'); if ($outputDocumentData["OUT_DOC_TITLE"]=="") { throw (new \Exception( 'Invalid value specified for out_doc_title, can not be null')); } @@ -329,6 +328,9 @@ class OutputDocument if (isset($outputDocumentData['OUT_DOC_FILENAME'])) { $oOutputDocument->setOutDocFilename($outputDocumentData['OUT_DOC_FILENAME']); } + if (isset($outputDocumentData['OUT_DOC_TEMPLATE'])) { + $oOutputDocument->setOutDocTemplate($outputDocumentData['OUT_DOC_TEMPLATE']); + } $oOutputDocument->save(); $oConnection->commit(); } else { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php index bdc035709..c030f24b2 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php @@ -176,7 +176,7 @@ class Process $fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]] : ""; if ($arrayFieldDefinition[$fieldName]["required"] && !isset($arrayData[$fieldName])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($fieldNameAux))); } } } @@ -201,12 +201,12 @@ class Process case 1: //empty if (!$arrayFieldDefinition[$fieldName]["empty"] && trim($fieldValue) . "" == "") { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux))); } //defaultValues if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0 && !in_array($fieldValue, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])))); } //type @@ -220,17 +220,17 @@ class Process switch ($arrayFieldDefinition[$fieldName]["type"]) { case "date": if (!preg_match("/^" . $eregDate . "$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\"."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux))); } break; case "hour": if (!preg_match("/^" . $eregHour . "$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\"."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux))); } break; case "datetime": if (!preg_match("/^" . $eregDatetime . "$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\"."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux))); } break; } @@ -242,7 +242,7 @@ class Process //type if (!is_array($fieldValue)) { if ($fieldValue != "" && !preg_match("/^\s*array\s*\(.*\)\s*$/", $fieldValue)) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", this value must be an array."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($fieldNameAux))); } } @@ -259,7 +259,7 @@ class Process } if (count($arrayAux) == 0) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameAux), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux))); } } @@ -277,7 +277,7 @@ class Process foreach ($arrayAux as $value) { if (!in_array($value, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"])))); } } } @@ -307,7 +307,7 @@ class Process $nameForException = (isset($arrayFieldNameForException[$key]))? $arrayFieldNameForException[$key] : ""; if (!is_null($value) && ($value . "" == "" || !preg_match("/^(?:\+|\-)?(?:0|[1-9]\d*)$/", $value . "") || (int)($value) < 0)) { - throw (new \Exception(str_replace(array("{0}"), array($nameForException), "Invalid value for \"{0}\". Expecting positive integer value."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER", array($nameForException))); } } } catch (\Exception $e) { @@ -329,9 +329,7 @@ class Process $process = new \Process(); if (!$process->processExists($processUid)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processUid), "The project with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_PROJECT_DOES_NOT_EXIST", array($fieldNameForException, $processUid))); } } catch (\Exception $e) { throw $e; @@ -352,9 +350,7 @@ class Process $user = new \Users(); if (!$user->userExists($userUid)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $userUid), "The user with {0}: {1}, does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_EXIST", array($fieldNameForException, $userUid))); } } catch (\Exception $e) { throw $e; @@ -374,9 +370,7 @@ class Process { try { if ($this->existsTitle($processTitle, $processUidExclude)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processTitle), "The project title with {0}: \"{1}\", already exists"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_PROJECT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $processTitle))); } } catch (\Exception $e) { throw $e; @@ -397,9 +391,7 @@ class Process $obj = \ProcessCategoryPeer::retrieveByPK($processCategoryUid); if (!(is_object($obj) && get_class($obj) == "ProcessCategory")) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $processCategoryUid), "The project category with {0}: {1}, does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_PROJECT_CATEGORY_DOES_NOT_EXIST", array($fieldNameForException, $processCategoryUid))); } } catch (\Exception $e) { throw $e; @@ -420,9 +412,7 @@ class Process $obj = \AdditionalTablesPeer::retrieveByPK($additionalTableUid); if (!(is_object($obj) && get_class($obj) == "AdditionalTables")) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $additionalTableUid), "The PM Table with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_PMTABLE_DOES_NOT_EXIST", array($fieldNameForException, $additionalTableUid))); } } catch (\Exception $e) { throw $e; @@ -454,9 +444,7 @@ class Process $rsCriteria = \TaskPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $taskUid), "The activity with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($fieldNameForException, $taskUid))); } } catch (\Exception $e) { throw $e; @@ -488,9 +476,7 @@ class Process } if ($flag == 0) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $fileName), "The routing screen template with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_ROUTING_SCREEN_TEMPLATE_DOES_NOT_EXIST", array($fieldNameForException, $fileName))); } } catch (\Exception $e) { throw $e; @@ -1649,7 +1635,8 @@ class Process if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) { $dyn = new \dynaFormHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml"); - if ($dyn->getHeaderAttribute("type") !== "xmlform" && $dyn->getHeaderAttribute("type") !== "") { // skip it, if that is not a xmlform + if ($dyn->getHeaderAttribute("type") !== "xmlform" && $dyn->getHeaderAttribute("type") !== "") { + // skip it, if that is not a xmlform $oDataset->next(); continue; } @@ -1701,7 +1688,8 @@ class Process if (is_file(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml")) { $dyn = new \dynaFormHandler(PATH_DYNAFORM . $aRow['DYN_FILENAME'] . ".xml"); - if ($dyn->getHeaderAttribute("type") === "xmlform") { // skip it, if that is not a xmlform + if ($dyn->getHeaderAttribute("type") === "xmlform") { + // skip it, if that is not a xmlform $oDataset->next(); continue; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php b/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php index db858723b..f57feff9a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php @@ -108,26 +108,43 @@ class ProjectUser throw (new \Exception( 'This id for prj_uid: '. $sProcessUID .' does not correspond to a registered process')); } $aUsers = array(); - $sDelimiter = \DBAdapter::getStringDelimiter(); + $usersIds = array(); + $oCriteria = new \Criteria('workflow'); - $oCriteria->setDistinct(); - $oCriteria->addSelectColumn(\UsersPeer::USR_UID); - $oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME); - $oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME); - $oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME); - $oCriteria->addJoin(\TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN); - $oCriteria->addJoin(\TaskUserPeer::TAS_UID, \TaskPeer::TAS_UID, \Criteria::LEFT_JOIN); + $oCriteria->addSelectColumn(\TaskUserPeer::USR_UID); + $oCriteria->addJoin(\TaskPeer::TAS_UID, \TaskUserPeer::TAS_UID, \Criteria::LEFT_JOIN); $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID); $oCriteria->add(\TaskUserPeer::TU_TYPE, 1); $oCriteria->add(\TaskUserPeer::TU_RELATION, 1); - $oCriteria->addGroupByColumn(\TaskUserPeer::USR_UID); $oDataset = \TaskUserPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { + while ($oDataset->next()) { + $aRow = $oDataset->getRow(); + if (!in_array($aRow['USR_UID'], $usersIds)) { + $usersIds[] = $aRow['USR_UID']; + } + } + + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\GroupUserPeer::USR_UID); + $oCriteria->addJoin(\TaskPeer::TAS_UID, \TaskUserPeer::TAS_UID, \Criteria::LEFT_JOIN); + $oCriteria->addJoin(\TaskUserPeer::TAS_UID, \GroupUserPeer::GRP_UID, \Criteria::LEFT_JOIN); + $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\TaskUserPeer::TU_TYPE, 1); + $oCriteria->add(\TaskUserPeer::TU_RELATION, 2); + $oDataset = \TaskUserPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + while ($oDataset->next()) { + $aRow = $oDataset->getRow(); + if (!in_array($aRow['USR_UID'], $usersIds)) { + $usersIds[] = $aRow['USR_UID']; + } + } + + foreach($usersIds as $value) { \G::LoadClass( 'case' ); $oCase = new \Cases(); - $startTasks = $oCase->getStartCases( $aRow['USR_UID'] ); + $startTasks = $oCase->getStartCases( $value ); foreach ($startTasks as $task) { if ((isset( $task['pro_uid'] )) && ($task['pro_uid'] == $sProcessUID) ) { $taskValue = explode( '(', $task['value'] ); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Step.php b/workflow/engine/src/ProcessMaker/BusinessModel/Step.php index be848289a..c5c4d4cf1 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Step.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Step.php @@ -118,12 +118,13 @@ class Step /** * Verify if exists the "Object UID" in the corresponding table * - * @param string $type Type of Step (DYNAFORM, INPUT_DOCUMENT, OUTPUT_DOCUMENT) - * @param string $objectUid Unique id of Object + * @param string $type Type of Step (DYNAFORM, INPUT_DOCUMENT, OUTPUT_DOCUMENT) + * @param string $objectUid Unique id of Object + * @param string $fieldNameForException Field name for the exception * * return strin Return empty string if $objectUid exists in the corresponding table, return string with data if $objectUid doesn't exist */ - public function existsObjectUid($type, $objectUid) + public function existsObjectUid($type, $objectUid, $fieldNameForException) { try { $msg = ""; @@ -133,21 +134,21 @@ class Step $dynaform = new \Dynaform(); if (!$dynaform->dynaformExists($objectUid)) { - $msg = str_replace(array("{0}", "{1}"), array($objectUid, "DYNAFORM"), "The UID \"{0}\" does not exist in table {1}"); + $msg = \G::LoadTranslation("ID_DYNAFORM_DOES_NOT_EXIST", array($fieldNameForException, $objectUid)); } break; case "INPUT_DOCUMENT": $inputdoc = new \InputDocument(); if (!$inputdoc->InputExists($objectUid)) { - $msg = str_replace(array("{0}", "{1}"), array($objectUid, "INPUT_DOCUMENT"), "The UID \"{0}\" does not exist in table {1}"); + $msg = \G::LoadTranslation("ID_INPUT_DOCUMENT_DOES_NOT_EXIST", array($fieldNameForException, $objectUid)); } break; case "OUTPUT_DOCUMENT": $outputdoc = new \OutputDocument(); if (!$outputdoc->OutputExists($objectUid)) { - $msg = str_replace(array("{0}", "{1}"), array($objectUid, "OUTPUT_DOCUMENT"), "The UID \"{0}\" does not exist in table {1}"); + $msg = \G::LoadTranslation("ID_OUTPUT_DOCUMENT_DOES_NOT_EXIST", array($fieldNameForException, $objectUid)); } break; } @@ -171,7 +172,8 @@ class Step if (!in_array($stepTypeObj, $arrayDefaultValues)) { $field = $this->arrayParamException["stepTypeObj"]; - throw (new \Exception(str_replace(array("{0}", "{1}"), array($field, implode("|", $arrayDefaultValues)), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); + + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($field, implode("|", $arrayDefaultValues)))); } } @@ -189,7 +191,7 @@ class Step if (!in_array($stepMode, $arrayDefaultValues)) { $field = $this->arrayParamException["stepMode"]; - throw (new \Exception(str_replace(array("{0}", "{1}"), array($field, implode("|", $arrayDefaultValues)), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($field, implode("|", $arrayDefaultValues)))); } } @@ -205,9 +207,7 @@ class Step $step = new \Step(); if (!$step->StepExists($stepUid)) { - $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["stepUid"], $stepUid), "The step with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array($this->arrayParamException["stepUid"], $stepUid))); } } @@ -223,9 +223,7 @@ class Step $task = new \Task(); if (!$task->taskExists($taskUid)) { - $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["taskUid"], $taskUid), "The activity with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($this->arrayParamException["taskUid"], $taskUid))); } } @@ -241,9 +239,7 @@ class Step $process = new \Process(); if (!$process->exists($processUid)) { - $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["processUid"], $processUid), "The project with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_PROJECT_DOES_NOT_EXIST", array($this->arrayParamException["processUid"], $processUid))); } } @@ -269,47 +265,47 @@ class Step $this->throwExceptionIfNotExistsProcess($processUid); if (!isset($arrayData["STEP_TYPE_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepTypeObj"]))); } $arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]); if ($arrayData["STEP_TYPE_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepTypeObj"]))); } if (!isset($arrayData["STEP_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepUidObj"]))); } $arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]); if ($arrayData["STEP_UID_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepUidObj"]))); } if (!isset($arrayData["STEP_MODE"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepMode"]))); } $arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]); if ($arrayData["STEP_MODE"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepMode"]))); } $this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]); $this->throwExceptionIfHaveInvalidValueInMode($arrayData["STEP_MODE"]); - $msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"]); + $msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], $this->arrayParamException["stepUidObj"]); if ($msg != "") { - throw (new \Exception($msg)); + throw new \Exception($msg); } if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"), "The record \"{0}\", exists in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"))); } //Create @@ -367,18 +363,18 @@ class Step //Verify data if (isset($arrayData["STEP_TYPE_OBJ"]) && !isset($arrayData["STEP_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepUidObj"]))); } if (!isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepTypeObj"]))); } if (isset($arrayData["STEP_TYPE_OBJ"])) { $arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]); if ($arrayData["STEP_TYPE_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepTypeObj"]))); } } @@ -386,7 +382,7 @@ class Step $arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]); if ($arrayData["STEP_UID_OBJ"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepUidObj"]))); } } @@ -394,7 +390,7 @@ class Step $arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]); if ($arrayData["STEP_MODE"] == "") { - throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "Invalid value for \"{0}\", it can not be empty."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepMode"]))); } } @@ -407,14 +403,14 @@ class Step } if (isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) { - $msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"]); + $msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], $this->arrayParamException["stepUidObj"]); if ($msg != "") { - throw (new \Exception($msg)); + throw new \Exception($msg); } if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], 0, $stepUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"), "The record \"{0}\", exists in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"))); } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Step/Trigger.php b/workflow/engine/src/ProcessMaker/BusinessModel/Step/Trigger.php index f66a0c17f..4beb7c2fc 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Step/Trigger.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Step/Trigger.php @@ -95,24 +95,24 @@ class Trigger $step = new \Step(); if (!$step->StepExists($stepUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array("step_uid", $stepUid))); } } $task = new \Task(); if (!$task->taskExists($taskUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array("act_uid", $taskUid))); } $trigger = new \Triggers(); if (!$trigger->TriggerExists($triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array("tri_uid", $triggerUid))); } if ($this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"))); } //Create @@ -175,14 +175,14 @@ class Trigger $step = new \Step(); if (!$step->StepExists($stepUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array("step_uid", $stepUid))); } } $trigger = new \Triggers(); if (!$trigger->TriggerExists($triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array("tri_uid", $triggerUid))); } //Update @@ -245,7 +245,7 @@ class Trigger //Verify data if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_RECORD_DOES_NOT_EXIST_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"))); } //Get position @@ -326,7 +326,7 @@ class Trigger //Verify data if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}"))); + throw new \Exception(\G::LoadTranslation("ID_RECORD_DOES_NOT_EXIST_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"))); } //Get data @@ -372,7 +372,8 @@ class Trigger * * @return void */ - public function moveStepTriggers($tasUid, $stepUid, $triUid, $type, $newPos) { + public function moveStepTriggers($tasUid, $stepUid, $triUid, $type, $newPos) + { $stepTrigger = new \ProcessMaker\BusinessModel\Step(); $tempStep = $stepUid; $typeCompare = $type; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php index ef2d4a8ad..7a47256ac 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php @@ -75,9 +75,7 @@ class Task $task = new \Task(); if (!$task->taskExists($taskUid)) { - $msg = str_replace(array("{0}", "{1}"), array($this->arrayParamException["taskUid"], $taskUid), "The activity with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($this->arrayParamException["taskUid"], $taskUid))); } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php index e7a3876ed..6d60ac187 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php @@ -265,9 +265,7 @@ class Trigger $rsCriteria = \TriggersPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $triggerUid), "The trigger with {0}: {1}, does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array($fieldNameForException, $triggerUid))); } } catch (\Exception $e) { throw $e; @@ -288,9 +286,7 @@ class Trigger { try { if (!$this->verifyNameTrigger($processUid, $triggerTitle, $triggerUidExclude)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $triggerTitle), "The trigger title with {0}: \"{1}\" already exists"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_TRIGGER_TITLE_ALREADY_EXISTS", array($fieldNameForException, $triggerTitle))); } } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php b/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php index a744d23c5..6299c2078 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/TriggerWizard.php @@ -111,9 +111,7 @@ class TriggerWizard $arrayLibrary = $this->library->getRegisteredClasses(); if (!isset($arrayLibrary[$this->libraryGetLibraryName($libraryName)])) { - $msg = str_replace(array("{0}", "{1}"), array($libraryFieldNameForException, $libraryName), "The library with {0}: \"{1}\" does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_LIBRARY_DOES_NOT_EXIST", array($libraryFieldNameForException, $libraryName))); } } catch (\Exception $e) { throw $e; @@ -138,9 +136,7 @@ class TriggerWizard $library = $this->library->getLibraryDefinition($this->libraryGetLibraryName($libraryName)); if (!isset($library->methods[$methodName])) { - $msg = str_replace(array("{0}", "{1}"), array($methodFieldNameForException, $methodName), "The function with {0}: \"{1}\" does not exist in the library."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_LIBRARY_FUNCTION_DOES_NOT_EXIST", array($methodFieldNameForException, $methodName))); } } catch (\Exception $e) { throw $e; @@ -177,26 +173,20 @@ class TriggerWizard $triggerParam = unserialize($arrayTriggerData["TRI_PARAM"]); if ($arrayTriggerData["TRI_PARAM"] == "" || !isset($triggerParam["hash"])) { - $msg = str_replace(array("{0}", "{1}"), array($triggerUidFieldNameForException, $triggerUid), "The trigger with {0}: {1}, has not been created with the wizard"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_TRIGGER_HAS_NOT_BEEN_CREATED_WITH_WIZARD", array($triggerUidFieldNameForException, $triggerUid))); } $arrayTriggerData["TRI_PARAM"] = $triggerParam; if (md5($arrayTriggerData["TRI_WEBBOT"]) != $arrayTriggerData["TRI_PARAM"]["hash"]) { - $msg = str_replace(array("{0}", "{1}"), array($triggerUidFieldNameForException, $triggerUid), "The trigger with {0}: {1}, has been modified manually. It is invalid for the wizard"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_TRIGGER_HAS_BEEN_MODIFIED_MANUALLY_INVALID_FOR_WIZARD", array($triggerUidFieldNameForException, $triggerUid))); } $triggerParamLibraryName = (preg_match("/^class\.?(.*)\.pmFunctions\.php$/", $arrayTriggerData["TRI_PARAM"]["params"]["LIBRARY_CLASS"], $arrayMatch))? ((isset($arrayMatch[1]) && $arrayMatch[1] != "")? $arrayMatch[1] : "pmFunctions") : $arrayTriggerData["TRI_PARAM"]["params"]["LIBRARY_CLASS"]; $triggerParamMethodName = $arrayTriggerData["TRI_PARAM"]["params"]["PMFUNTION_NAME"]; if ($libraryName != $triggerParamLibraryName || $methodName != $triggerParamMethodName) { - $msg = str_replace(array("{0}", "{1}", "{2}", "{3}"), array($libraryName, $methodName, $triggerUidFieldNameForException, $triggerUid), "The wizard with the library \"{0}\" and function \"{1}\", is invalid for the trigger with {2}: {3}"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_WIZARD_LIBRARY_AND_FUNCTION_IS_INVALID_FOR_TRIGGER", array($libraryName, $methodName, $triggerUidFieldNameForException, $triggerUid))); } } catch (\Exception $e) { throw $e; @@ -231,22 +221,22 @@ class TriggerWizard if ($nInputParam > 0 || $nOutputParam > 0) { if (!isset($arrayData["TRI_PARAMS"])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($fieldNameForException))); } if (!is_array($arrayData["TRI_PARAMS"])) { - throw (new \Exception(str_replace(array("{0}"), array($fieldNameForException), "Invalid value for \"{0}\", this value must be an array."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($fieldNameForException))); } $arrayData["TRI_PARAMS"] = array_change_key_case($arrayData["TRI_PARAMS"], CASE_UPPER); if ($nInputParam > 0) { if (!isset($arrayData["TRI_PARAMS"]["INPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")))); } if (!is_array($arrayData["TRI_PARAMS"]["INPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")), "Invalid value for \"{0}\", this value must be an array."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".INPUT")))); } $arrayParamData["input"] = $arrayData["TRI_PARAMS"]["INPUT"]; @@ -254,11 +244,11 @@ class TriggerWizard if ($nOutputParam > 0) { if (!isset($arrayData["TRI_PARAMS"]["OUTPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "Undefined value for \"{0}\", it is required."))); + throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")))); } if (!is_array($arrayData["TRI_PARAMS"]["OUTPUT"])) { - throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")), "Invalid value for \"{0}\", this value must be an array."))); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($this->getFieldNameByFormatFieldName($fieldNameForException . ".OUTPUT")))); } $arrayParamData["output"] = $arrayData["TRI_PARAMS"]["OUTPUT"]; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php index b00b2a48b..22dc4ca19 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php @@ -344,9 +344,7 @@ class Validator { try { if (!is_array($data)) { - $msg = str_replace(array("{0}"), array($dataNameForException), "Invalid value for \"{0}\", this value must be an array."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($dataNameForException))); } } catch (\Exception $e) { throw $e; @@ -365,9 +363,7 @@ class Validator { try { if (empty($data)) { - $msg = str_replace(array("{0}"), array($dataNameForException), "Invalid value for \"{0}\", it can not be empty."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($dataNameForException))); } } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index 50853580a..836167f6b 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -178,9 +178,7 @@ class WebEntry $webEntry = \WebEntryPeer::retrieveByPK($webEntryUid); if (is_null($webEntry)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $webEntryUid), "The web entry with {0}: {1} does not exist."); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_DOES_NOT_EXIST", array($fieldNameForException, $webEntryUid))); } } catch (\Exception $e) { throw $e; @@ -201,9 +199,7 @@ class WebEntry { try { if ($this->existsTitle($processUid, $webEntryTitle, $webEntryUidExclude)) { - $msg = str_replace(array("{0}", "{1}"), array($fieldNameForException, $webEntryTitle), "The web entry title with {0}: \"{1}\" already exists"); - - throw (new \Exception($msg)); + throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_TITLE_ALREADY_EXISTS", array($fieldNameForException, $webEntryTitle))); } } catch (\Exception $e) { throw $e; @@ -262,11 +258,11 @@ class WebEntry if (isset($arrayData["TAS_UID"])) { if ($arrayTaskData["TAS_START"] == "FALSE") { - throw (new \Exception(str_replace(array("{0}"), array($arrayTaskData["TAS_TITLE"]), "The task \"{0}\" is not initial task"))); + throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_IS_NOT_INITIAL_ACTIVITY", array($arrayTaskData["TAS_TITLE"]))); } if ($arrayTaskData["TAS_ASSIGN_TYPE"] != "BALANCED") { - throw (new \Exception(str_replace(array("{0}"), array($arrayTaskData["TAS_TITLE"]), "Web Entry only works with tasks which have \"Cyclical Assignment\", the task \"{0}\" does not have a valid assignment type. Please change the Assignment Rules"))); + throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_ACTIVITY_DOES_NOT_HAVE_VALID_ASSIGNMENT_TYPE", array($arrayTaskData["TAS_TITLE"]))); } } @@ -274,7 +270,7 @@ class WebEntry $task = new \Tasks(); if ($task->assignUsertoTask($arrayData["TAS_UID"]) == 0) { - throw (new \Exception(str_replace(array("{0}"), array($arrayTaskData["TAS_TITLE"]), "The task \"{0}\" does not have users"))); + throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_HAVE_USERS", array($arrayTaskData["TAS_TITLE"]))); } } @@ -286,7 +282,7 @@ class WebEntry $step = new \ProcessMaker\BusinessModel\Step(); if (!$step->existsRecord($arrayDataMain["TAS_UID"], "DYNAFORM", $arrayData["DYN_UID"])) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayDynaFormData["DYN_TITLE"], $arrayTaskData["TAS_TITLE"]), "The DynaForm \"{0}\" isn't assigned to the task \"{1}\""))); + throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY", array($arrayDynaFormData["DYN_TITLE"], $arrayTaskData["TAS_TITLE"]))); } } @@ -299,7 +295,7 @@ class WebEntry $projectUser = new \ProcessMaker\BusinessModel\ProjectUser(); if (!$projectUser->userIsAssignedToTask($arrayData["USR_UID"], $arrayDataMain["TAS_UID"])) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"]), "The user \"{0}\" does not have the task \"{1}\" assigned"))); + throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_HAVE_ACTIVITY_ASSIGNED", array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"]))); } } } catch (\Exception $e) { @@ -605,7 +601,7 @@ class WebEntry $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); } - throw (new \Exception("The registry cannot be created!.\n" . $msg)); + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg); } } catch (\Exception $e) { $cnn->rollback(); @@ -690,7 +686,7 @@ class WebEntry $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); } - throw (new \Exception("The registry cannot be created!.\n" . $msg)); + throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg); } } catch (\Exception $e) { $cnn->rollback(); diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php index 58797862c..f37a01434 100644 --- a/workflow/engine/src/ProcessMaker/Importer/Importer.php +++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php @@ -18,22 +18,58 @@ abstract class Importer const IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW = "project.import.keep_without_changing_and_create_new"; const IMPORT_OPTION_CREATE_NEW = "project.import.create_new"; - /** - * Success, Project imported successfully. - */ - const IMPORT_STAT_SUCCESS = 100; - /** - * Error, Target Project already exists. - */ - const IMPORT_STAT_TARGET_ALREADY_EXISTS = 101; - /** - * Error, Invalid file type or the file have corrupt data. - */ - const IMPORT_STAT_INVALID_SOURCE_FILE = 102; + const GROUP_IMPORT_OPTION_RENAME = "group.import.rename"; + const GROUP_IMPORT_OPTION_MERGE_PREEXISTENT = "group.import.merge.preexistent"; + const GROUP_IMPORT_OPTION_CREATE_NEW = "group.import.create_new"; + + const IMPORT_STAT_SUCCESS = 100; //Success, Project imported successfully. + const IMPORT_STAT_TARGET_ALREADY_EXISTS = 101; //Error, Target Project already exists. + const IMPORT_STAT_INVALID_SOURCE_FILE = 102; //Error, Invalid file type or the file have corrupt data. + const IMPORT_STAT_GROUP_ALREADY_EXISTS = 105; //Error, Group already exists. public abstract function load(); - public function import($option = self::IMPORT_OPTION_CREATE_NEW) + /** + * Verify if exists reserved words SQL + * + * @param object $data Data + * + * return void Throw exception if exists reserved words SQL + */ + public function throwExceptionIfExistsReservedWordsSql($data) + { + $arrayReservedWordsSql = \G::reservedWordsSql(); + + $arrayAux = array(); + + foreach ($data->reportTables as $key => $value) { + $record = $value; + + if (in_array(strtoupper($record["REP_TAB_NAME"]), $arrayReservedWordsSql)) { + $arrayAux[] = $record["REP_TAB_NAME"]; + } + } + + if (count($arrayAux) > 0) { + throw new \Exception(\G::LoadTranslation("ID_PMTABLE_INVALID_NAME", array(implode(", ", $arrayAux)))); + } + + $arrayAux = array(); + + foreach ($data->reportTablesVars as $key => $value) { + $record = $value; + + if (in_array(strtoupper($record["REP_VAR_NAME"]), $arrayReservedWordsSql)) { + $arrayAux[] = $record["REP_VAR_NAME"]; + } + } + + if (count($arrayAux) > 0) { + throw new \Exception(\G::LoadTranslation("ID_PMTABLE_INVALID_FIELD_NAME", array(implode(", ", $arrayAux)))); + } + } + + public function import($option = self::IMPORT_OPTION_CREATE_NEW, $optionGroup = self::GROUP_IMPORT_OPTION_CREATE_NEW) { $this->prepare(); @@ -42,11 +78,21 @@ abstract class Importer switch ($option) { case self::IMPORT_OPTION_CREATE_NEW: if ($this->targetExists()) { - throw new \Exception(sprintf( - "Project already exists, you need set an action to continue. " . - "Available actions: [%s|%s|%s|%s].", self::IMPORT_OPTION_CREATE_NEW, - self::IMPORT_OPTION_OVERWRITE, self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW, self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW - ), self::IMPORT_STAT_TARGET_ALREADY_EXISTS); + throw new \Exception( + \G::LoadTranslation( + "ID_IMPORTER_PROJECT_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE", + array(implode( + "|", + array( + self::IMPORT_OPTION_CREATE_NEW, + self::IMPORT_OPTION_OVERWRITE, + self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW, + self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW + ) + )) + ), + self::IMPORT_STAT_TARGET_ALREADY_EXISTS + ); } $generateUid = false; break; @@ -68,6 +114,41 @@ abstract class Importer break; } + $processes = new \Processes(); + + switch ($optionGroup) { + case self::GROUP_IMPORT_OPTION_CREATE_NEW: + $arrayAux = $processes->checkExistingGroups($this->importData["tables"]["workflow"]["groupwfs"]); + + if (is_array($arrayAux) && count($arrayAux) > 0) { + throw new \Exception( + \G::LoadTranslation( + "ID_IMPORTER_GROUP_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE", + array(implode( + "|", + array( + self::GROUP_IMPORT_OPTION_CREATE_NEW, + self::GROUP_IMPORT_OPTION_RENAME, + self::GROUP_IMPORT_OPTION_MERGE_PREEXISTENT + ) + )) + ), + self::IMPORT_STAT_GROUP_ALREADY_EXISTS + ); + } + break; + case self::GROUP_IMPORT_OPTION_RENAME: + $arrayAux = $processes->renameExistingGroups($this->importData["tables"]["workflow"]["groupwfs"]); + + if (is_array($arrayAux) && count($arrayAux) > 0) { + $this->importData["tables"]["workflow"]["groupwfs"] = $arrayAux; + } + break; + case self::GROUP_IMPORT_OPTION_MERGE_PREEXISTENT: + $this->importData["tables"]["workflow"] = (array)($processes->groupwfsUpdateUidByDatabase((object)($this->importData["tables"]["workflow"]))); + break; + } + $this->importData["tables"]["bpmn"]["project"][0]["prj_name"] = $name; $this->importData["tables"]["bpmn"]["diagram"][0]["dia_name"] = $name; $this->importData["tables"]["bpmn"]["process"][0]["pro_name"] = $name; @@ -95,7 +176,7 @@ abstract class Importer { if ($this->validateSource() === false) { throw new \Exception( - "Error, Invalid file type or the file have corrupt data", + \G::LoadTranslation("ID_IMPORTER_ERROR_FILE_INVALID_TYPE_OR_CORRUPT_DATA"), self::IMPORT_STAT_INVALID_SOURCE_FILE ); } @@ -122,12 +203,14 @@ abstract class Importer public function validateImportData() { if (! isset($this->importData["tables"]["bpmn"])) { - throw new \Exception("BPMN Definition is missing."); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_BPMN_DEFINITION_IS_MISSING")); } if (! isset($this->importData["tables"]["bpmn"]["project"]) || count($this->importData["tables"]["bpmn"]["project"]) !== 1) { - throw new \Exception("BPMN table: \"Project\", definition is missing or has multiple definition."); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_BPMN_PROJECT_TABLE_DEFINITION_IS_MISSING")); } + $this->throwExceptionIfExistsReservedWordsSql((object)($this->importData["tables"]["workflow"])); + return true; } @@ -201,13 +284,13 @@ abstract class Importer public function setSourceFromGlobals($varName) { if (! array_key_exists($varName, $_FILES)) { - throw new \Exception("Couldn't find specified source \"$varName\" in PHP Globals"); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_COULD_NOT_FIND_SPECIFIED_SOURCE_IN_PHP_GLOBALS", array($varName))); } $data = $_FILES[$varName]; if ($data["error"] != 0) { - throw new \Exception("Error while uploading file. Error code: {$data["error"]}"); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_ERROR_WHILE_UPLOADING_FILE", array($data["error"]))); } if (! is_dir($this->getSaveDir())) { @@ -386,17 +469,19 @@ abstract class Importer * Imports a Project sent through the POST method ($_FILES) * * @param array $arrayData Data - * @param string $option Option ("CREATE", "OVERWRITE", "DISABLE", "KEEP") + * @param string $option Option for Project ("CREATE", "OVERWRITE", "DISABLE", "KEEP") + * @param string $optionGroup Option for Group ("CREATE", "RENAME", "MERGE") * @param array $arrayFieldName The field's names * * return array Returns the data sent and the unique id of Project */ - public function importPostFile(array $arrayData, $option = "CREATE", array $arrayFieldName = array()) + public function importPostFile(array $arrayData, $option = "CREATE", $optionGroup = "CREATE", array $arrayFieldName = array()) { try { //Set data $arrayFieldName["projectFile"] = (isset($arrayFieldName["projectFile"]))? $arrayFieldName["projectFile"] : "PROJECT_FILE"; $arrayFieldName["option"] = (isset($arrayFieldName["option"]))? $arrayFieldName["option"] : "OPTION"; + $arrayFieldName["optionGroup"] = (isset($arrayFieldName["optionGroup"]))? $arrayFieldName["optionGroup"] : "OPTION_GROUP"; $arrayFieldDefinition = array( $arrayFieldName["projectFile"] => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "projectFile") @@ -418,6 +503,9 @@ abstract class Importer $optionCaseUpper = (strtoupper($option) == $option)? true : false; $option = strtoupper($option); + $optionGroupCaseUpper = (strtoupper($optionGroup) == $optionGroup)? true : false; + $optionGroup = strtoupper($optionGroup); + //Verify data $process = new \ProcessMaker\BusinessModel\Process(); $validator = new \ProcessMaker\BusinessModel\Validator(); @@ -427,37 +515,56 @@ abstract class Importer $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayFieldDefinition, $arrayFieldNameForException, true); $arrayOptionDefaultValues = array("CREATE", "OVERWRITE", "DISABLE", "KEEP"); + $arrayOptionGroupDefaultValues = array("CREATE", "RENAME", "MERGE"); - if ($option . "" != "") { - if (!in_array($option, $arrayOptionDefaultValues, true)) { - $strdv = implode("|", $arrayOptionDefaultValues); + $arrayAux = array( + array($option, $arrayOptionDefaultValues, $arrayFieldNameForException["option"], $optionCaseUpper), + array($optionGroup, $arrayOptionGroupDefaultValues, $arrayFieldNameForException["optionGroup"], $optionGroupCaseUpper) + ); - throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayFieldNameForException["option"], ($optionCaseUpper)? $strdv : strtolower($strdv)), "Invalid value for \"{0}\", it only accepts values: \"{1}\"."))); + foreach ($arrayAux as $value) { + $opt = $value[0]; + $arrayDefaultValues = $value[1]; + $fieldNameForException = $value[2]; + $caseUpper = $value[3]; + + if ($opt != "") { + if (!in_array($opt, $arrayDefaultValues, true)) { + $strdv = implode("|", $arrayDefaultValues); + + throw new \Exception( + \G::LoadTranslation( + "ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", + array($fieldNameForException, ($caseUpper)? $strdv : strtolower($strdv)) + ) + ); + } } } if ((isset($_FILES["filePmx"]) && pathinfo($_FILES["filePmx"]["name"], PATHINFO_EXTENSION) != "pmx") || (isset($arrayData[$arrayFieldName["projectFile"]]) && pathinfo($arrayData[$arrayFieldName["projectFile"]], PATHINFO_EXTENSION) != "pmx") ) { - throw (new \Exception("The file extension not is \"pmx\"")); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_FILE_EXTENSION_IS_NOT_PMX")); } //Set variables - $opt = self::IMPORT_OPTION_CREATE_NEW; //CREATE + $arrayAux = array( + (($option != "")? "CREATE" : "") => self::IMPORT_OPTION_CREATE_NEW, + "OVERWRITE" => self::IMPORT_OPTION_OVERWRITE, + "DISABLE" => self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW, + "KEEP" => self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW + ); - switch ($option) { - case "OVERWRITE": - $opt = self::IMPORT_OPTION_OVERWRITE; - break; - case "DISABLE": - $opt = self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW; - break; - case "KEEP": - $opt = self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW; - break; - } + $option = $arrayAux[$option]; - $option = $opt; + $arrayAux = array( + (($optionGroup != "")? "CREATE" : "") => self::GROUP_IMPORT_OPTION_CREATE_NEW, + "RENAME" => self::GROUP_IMPORT_OPTION_RENAME, + "MERGE" => self::GROUP_IMPORT_OPTION_MERGE_PREEXISTENT + ); + + $optionGroup = $arrayAux[$optionGroup]; if (isset($_FILES["filePmx"])) { $this->setSourceFromGlobals("filePmx"); @@ -467,19 +574,38 @@ abstract class Importer if (isset($arrayData[$arrayFieldName["projectFile"]]) && file_exists($filePmx)) { $this->setSourceFile($filePmx); } else { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayFieldNameForException["projectFile"], $arrayData[$arrayFieldName["projectFile"]]), "The file with {0}: \"{1}\" does not exist."))); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_FILE_DOES_NOT_EXIST", array($arrayFieldNameForException["projectFile"], $arrayData[$arrayFieldName["projectFile"]]))); } } //Import try { - $projectUid = $this->import($option); + $projectUid = $this->import($option, $optionGroup); $arrayData = array_merge(array("PRJ_UID" => $projectUid), $arrayData); } catch (\Exception $e) { - $msg = str_replace(array(self::IMPORT_OPTION_CREATE_NEW, self::IMPORT_OPTION_OVERWRITE, self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW, self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW), $arrayOptionDefaultValues, $e->getMessage()); + $strOpt = implode("|", $arrayOptionDefaultValues); + $strOptg = implode("|", $arrayOptionGroupDefaultValues); - throw (new \Exception($msg)); + $strOpt = ($optionCaseUpper)? $strOpt : strtolower($strOpt); + $strOptg = ($optionGroupCaseUpper)? $strOptg : strtolower($strOptg); + + $msg = str_replace( + array( + self::IMPORT_OPTION_CREATE_NEW, + self::IMPORT_OPTION_OVERWRITE, + self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW, + self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW, + + self::GROUP_IMPORT_OPTION_CREATE_NEW, + self::GROUP_IMPORT_OPTION_RENAME, + self::GROUP_IMPORT_OPTION_MERGE_PREEXISTENT + ), + array_merge(explode("|", $strOpt), explode("|", $strOptg)), + $e->getMessage() + ); + + throw new \Exception($msg); } //Return diff --git a/workflow/engine/src/ProcessMaker/Importer/XmlImporter.php b/workflow/engine/src/ProcessMaker/Importer/XmlImporter.php index 29f9d74cd..a3b2eff4b 100644 --- a/workflow/engine/src/ProcessMaker/Importer/XmlImporter.php +++ b/workflow/engine/src/ProcessMaker/Importer/XmlImporter.php @@ -33,20 +33,20 @@ class XmlImporter extends Importer $this->version = $this->root->getAttribute("version"); if (empty($this->version)) { - throw new \Exception("ProcessMaker Project version is missing on file source."); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_FILE_PROCESSMAKER_PROJECT_VERSION_IS_MISSING")); } // read metadata section $metadataNode = $this->root->getElementsByTagName("metadata"); if ($metadataNode->length != 1) { - throw new \Exception("Invalid Document format, metadata section is missing or has multiple definition."); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_FILE_INVALID_DOCUMENT_FORMAT_METADATA_IS_MISSING")); } $metadataNodeList = $metadataNode->item(0)->getElementsByTagName("meta"); if ($metadataNodeList->length == 0) { - throw new \Exception("Invalid Document format, metadata information is corrupt."); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_FILE_INVALID_DOCUMENT_FORMAT_METADATA_IS_CORRUPT")); } @@ -59,9 +59,9 @@ class XmlImporter extends Importer $definitions = $this->root->getElementsByTagName("definition"); if ($definitions->length == 0) { - throw new \Exception("Definition section is missing."); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_FILE_DEFINITION_SECTION_IS_MISSING")); } elseif ($definitions->length < 2) { - throw new \Exception("Definition section is incomplete."); + throw new \Exception(\G::LoadTranslation("ID_IMPORTER_FILE_DEFINITION_SECTION_IS_INCOMPLETE")); } $tables = array(); @@ -89,7 +89,10 @@ class XmlImporter extends Importer $columns = array(); foreach ($recordsNode->childNodes as $columnNode) { - if ($columnNode->nodeName == "#text") continue; + if ($columnNode->nodeName == "#text") { + continue; + } + //$columns[strtoupper($columnNode->nodeName)] = self::getTextNode($columnNode);; $columnName = $defClass == "workflow" ? strtoupper($columnNode->nodeName) : $columnNode->nodeName; $columns[$columnName] = self::getTextNode($columnNode); @@ -132,7 +135,7 @@ class XmlImporter extends Importer { if ($node->nodeType == XML_ELEMENT_NODE) { return $node->textContent; - } else if ($node->nodeType == XML_TEXT_NODE || $node->nodeType == XML_CDATA_SECTION_NODE) { + } elseif ($node->nodeType == XML_TEXT_NODE || $node->nodeType == XML_CDATA_SECTION_NODE) { return (string) simplexml_import_dom($node->parentNode); } } diff --git a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php index 0e0d1880b..35d3267b0 100644 --- a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php @@ -668,6 +668,7 @@ class BpmnWorkflow extends Project\Bpmn $diagram = isset($projectData["diagrams"]) && isset($projectData["diagrams"][0]) ? $projectData["diagrams"][0] : array(); $result = array(); + $projectData['prj_uid'] = $prjUid; $bwp = BpmnWorkflow::load($prjUid); $projectRecord = array_change_key_case($projectData, CASE_UPPER); $bwp->update($projectRecord); @@ -799,7 +800,6 @@ class BpmnWorkflow extends Project\Bpmn $bwp->removeGateway($gatewayData["GAT_UID"]); } } - /* * Diagram's Events Handling */ diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php index 0c5a521e6..fa3727e55 100644 --- a/workflow/engine/src/ProcessMaker/Project/Workflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php @@ -129,7 +129,7 @@ class Workflow extends Handler { //return Project::getAll($start, $limit, $filter, $changeCaseTo); $process = new Process(); - $processes = $process->getAllProcesses( $start, $limit, "", ""); + $processes = $process->getAllProcesses($start, $limit); //$processes = $process->getAll(); if ($changeCaseTo != CASE_UPPER) { diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index eae11b29e..893d5e909 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -63,6 +63,9 @@ class Project extends Api public function post($prj_name, $request_data) { try { + if (!isset($request_data['prj_author'])) { + $request_data['prj_author'] = $this->getUserId(); + } return Adapter\BpmnWorkflow::createFromStruct($request_data); } catch (\Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -128,7 +131,7 @@ class Project extends Api * * @status 201 */ - public function doPostImport(array $request_data, $option = null) + public function doPostImport(array $request_data, $option = null, $option_group = null) { try { $importer = new \ProcessMaker\Importer\XmlImporter(); @@ -136,7 +139,12 @@ class Project extends Api $importer->setSaveDir(PATH_DOCUMENT . "input"); $importer->setData("usr_uid", $this->getUserId()); - $arrayData = $importer->importPostFile($request_data, $option, array("projectFile" => "project_file", "option" => "option")); + $arrayData = $importer->importPostFile( + $request_data, + $option, + $option_group, + array("projectFile" => "project_file", "option" => "option", "optionGroup" => "option_group") + ); $response = $arrayData; diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity/Step/Trigger.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity/Step/Trigger.php index 8f602248a..496a18dd5 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity/Step/Trigger.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity/Step/Trigger.php @@ -12,20 +12,20 @@ use \Luracast\Restler\RestException; class Trigger extends Api { /** - * @url GET /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid/:type + * @url GET /:prj_uid/activity/:act_uid/step/:step_uid/trigger/:tri_uid/:type * - * @param string $triggerUid - * @param string $stepUid - * @param string $activityUid - * @param string $projectUid - * @param string $type {@from body}{@choice before,after} + * @param string $tri_uid + * @param string $step_uid + * @param string $act_uid + * @param string $prj_uid + * @param string $type {@from body}{@choice before,after} */ - public function doGetActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, $type) + public function doGetActivityStepTrigger($tri_uid, $step_uid, $act_uid, $prj_uid, $type) { try { $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $activityUid, $triggerUid); + $response = $stepTrigger->getTrigger($step_uid, strtoupper($type), $act_uid, $tri_uid); return $response; } catch (\Exception $e) { @@ -34,65 +34,65 @@ class Trigger extends Api } /** - * @url POST /:projectUid/activity/:activityUid/step/:stepUid/trigger + * @url POST /:prj_uid/activity/:act_uid/step/:step_uid/trigger * - * @param string $stepUid - * @param string $activityUid - * @param string $projectUid + * @param string $step_uid + * @param string $act_uid + * @param string $prj_uid * @param StepTriggerPostStructure $request_data * * @status 201 */ - public function doPostActivityStepTrigger($stepUid, $activityUid, $projectUid, StepTriggerPostStructure $request_data = null) + public function doPostActivityStepTrigger($step_uid, $act_uid, $prj_uid, StepTriggerPostStructure $request_data = null) { try { $request_data = (array)($request_data); $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $arrayData = $stepTrigger->create($stepUid, $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data); + $arrayData = $stepTrigger->create($step_uid, $request_data["st_type"], $act_uid, $request_data["tri_uid"], $request_data); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } /** - * @url PUT /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid + * @url PUT /:prj_uid/activity/:act_uid/step/:step_uid/trigger/:tri_uid * - * @param string $triggerUid - * @param string $stepUid - * @param string $activityUid - * @param string $projectUid + * @param string $tri_uid + * @param string $step_uid + * @param string $act_uid + * @param string $prj_uid * @param StepTriggerPutStructure $request_data */ - public function doPutActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, StepTriggerPutStructure $request_data = null) + public function doPutActivityStepTrigger($tri_uid, $step_uid, $act_uid, $prj_uid, StepTriggerPutStructure $request_data = null) { try { $request_data = (array)($request_data); $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $arrayData = $stepTrigger->update($stepUid, $request_data["st_type"], $activityUid, $triggerUid, $request_data); + $arrayData = $stepTrigger->update($step_uid, $request_data["st_type"], $act_uid, $tri_uid, $request_data); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } /** - * @url DELETE /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid/:type + * @url DELETE /:prj_uid/activity/:act_uid/step/:step_uid/trigger/:tri_uid/:type * - * @param string $triggerUid - * @param string $stepUid - * @param string $activityUid - * @param string $projectUid - * @param string $type {@from body}{@choice before,after} + * @param string $tri_uid + * @param string $step_uid + * @param string $act_uid + * @param string $prj_uid + * @param string $type {@from body}{@choice before,after} */ - public function doDeleteActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, $type) + public function doDeleteActivityStepTrigger($tri_uid, $step_uid, $act_uid, $prj_uid, $type) { try { $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $stepTrigger->delete($stepUid, strtoupper($type), $activityUid, $triggerUid); + $stepTrigger->delete($step_uid, strtoupper($type), $act_uid, $tri_uid); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -101,19 +101,19 @@ class Trigger extends Api //Step "Assign Task" /** - * @url GET /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type + * @url GET /:prj_uid/activity/:act_uid/step/trigger/:tri_uid/:type * - * @param string $triggerUid - * @param string $activityUid - * @param string $projectUid - * @param string $type {@from body}{@choice before-assignment,before-routing,after-routing} + * @param string $tri_uid + * @param string $act_uid + * @param string $prj_uid + * @param string $type {@from body}{@choice before-assignment,before-routing,after-routing} */ - public function doGetActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type) + public function doGetActivityStepAssignTaskTrigger($tri_uid, $act_uid, $prj_uid, $type) { try { $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $response = $stepTrigger->getTrigger("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid); + $response = $stepTrigger->getTrigger("", strtoupper(str_replace("-", "_", $type)), $act_uid, $tri_uid); return $response; } catch (\Exception $e) { @@ -122,62 +122,62 @@ class Trigger extends Api } /** - * @url POST /:projectUid/activity/:activityUid/step/trigger + * @url POST /:prj_uid/activity/:act_uid/step/trigger * - * @param string $activityUid - * @param string $projectUid + * @param string $act_uid + * @param string $prj_uid * @param StepAssignTaskTriggerPostStructure $request_data * * @status 201 */ - public function doPostActivityStepAssignTaskTrigger($activityUid, $projectUid, StepAssignTaskTriggerPostStructure $request_data = null) + public function doPostActivityStepAssignTaskTrigger($act_uid, $prj_uid, StepAssignTaskTriggerPostStructure $request_data = null) { try { $request_data = (array)($request_data); $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $arrayData = $stepTrigger->create("", $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data); + $arrayData = $stepTrigger->create("", $request_data["st_type"], $act_uid, $request_data["tri_uid"], $request_data); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } /** - * @url PUT /:projectUid/activity/:activityUid/step/trigger/:triggerUid + * @url PUT /:prj_uid/activity/:act_uid/step/trigger/:tri_uid * - * @param string $triggerUid - * @param string $activityUid - * @param string $projectUid + * @param string $tri_uid + * @param string $act_uid + * @param string $prj_uid * @param StepAssignTaskTriggerPutStructure $request_data */ - public function doPutActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, StepAssignTaskTriggerPutStructure $request_data = null) + public function doPutActivityStepAssignTaskTrigger($tri_uid, $act_uid, $prj_uid, StepAssignTaskTriggerPutStructure $request_data = null) { try { $request_data = (array)($request_data); $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $arrayData = $stepTrigger->update("", $request_data["st_type"], $activityUid, $triggerUid, $request_data); + $arrayData = $stepTrigger->update("", $request_data["st_type"], $act_uid, $tri_uid, $request_data); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } /** - * @url DELETE /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type + * @url DELETE /:prj_uid/activity/:act_uid/step/trigger/:tri_uid/:type * - * @param string $triggerUid - * @param string $activityUid - * @param string $projectUid - * @param string $type {@from body}{@choice before-assignment,before-routing,after-routing} + * @param string $tri_uid + * @param string $act_uid + * @param string $prj_uid + * @param string $type {@from body}{@choice before-assignment,before-routing,after-routing} */ - public function doDeleteActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type) + public function doDeleteActivityStepAssignTaskTrigger($tri_uid, $act_uid, $prj_uid, $type) { try { $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger(); - $stepTrigger->delete("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid); + $stepTrigger->delete("", strtoupper(str_replace("-", "_", $type)), $act_uid, $tri_uid); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php index f55c911b4..708fb8718 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php @@ -128,6 +128,11 @@ class OutputDocumentStructure */ public $out_doc_filename; + /** + * @var string {@from body} + */ + public $out_doc_template; + /** * @var string {@from body} {@choice TCPDF,HTML2PDF} */ diff --git a/workflow/engine/src/Tests/BusinessModel/CalendarTest.php b/workflow/engine/src/Tests/BusinessModel/CalendarTest.php index 47131c50f..337b25e9f 100644 --- a/workflow/engine/src/Tests/BusinessModel/CalendarTest.php +++ b/workflow/engine/src/Tests/BusinessModel/CalendarTest.php @@ -256,7 +256,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @covers \ProcessMaker\BusinessModel\Calendar::create * * @expectedException Exception - * @expectedExceptionMessage The calendar name with CAL_NAME: "PHPUnit Calendar0" already exists + * @expectedExceptionMessage The calendar name with CAL_NAME: "PHPUnit Calendar0" already exists. */ public function testCreateExceptionExistsCalName() { @@ -371,7 +371,7 @@ class CalendarTest extends \PHPUnit_Framework_TestCase * @param array $arrayRecord Data of the calendars * * @expectedException Exception - * @expectedExceptionMessage The calendar name with CAL_NAME: "PHPUnit Calendar1" already exists + * @expectedExceptionMessage The calendar name with CAL_NAME: "PHPUnit Calendar1" already exists. */ public function testUpdateExceptionExistsCalName($arrayRecord) { diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index a776cb1b7..f02e76a8f 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -846,7 +846,12 @@ importProcessExistGroup = function() success : function(o, resp) { var resp_ = Ext.util.JSON.decode(resp.response.responseText); var sNewProUid = resp_.sNewProUid; - window.location.href = "processes_Map?PRO_UID=" + sNewProUid; + + if (typeof(resp_.project_type) != "undefined" && resp_.project_type == "bpmn") { + window.location.href = "../designer?prj_uid=" + sNewProUid; + } else { + window.location.href = "processes_Map?PRO_UID=" + sNewProUid; + } }, failure: function(o, resp) { w.close(); @@ -975,17 +980,16 @@ importProcessExistProcess = function() success: function(o, resp) { var resp_ = Ext.util.JSON.decode(resp.response.responseText); var sNewProUid = resp_.sNewProUid; - var projectType = (typeof(resp_.project_type) != "undefined")? resp_.project_type : "classicProject"; if (resp_.ExistGroupsInDatabase == 0) { - if (projectType == "classicProject") { - window.location.href = "processes_Map?PRO_UID=" + sNewProUid; - } else { + if (typeof(resp_.project_type) != "undefined" && resp_.project_type == "bpmn") { window.location.href = "../designer?prj_uid=" + sNewProUid; + } else { + window.location.href = "processes_Map?PRO_UID=" + sNewProUid; } } else { - importProcessGlobal.proFileName = resp_.fileName; + importProcessGlobal.proFileName = resp_.proFileName; importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion; importProcessGlobal.sNewProUid = resp_.sNewProUid; importProcessGlobal.importOption = resp_.importOption; @@ -1090,8 +1094,9 @@ importProcess = function() if (resp_.catchMessage == "") { if (resp_.ExistProcessInDatabase == "0") { if (resp_.ExistGroupsInDatabase == "0") { - var sNewProUid = resp_.sNewProUid; - if (resp_.project_type && resp_.project_type == "bpmn") { + var sNewProUid = resp_.sNewProUid; + + if (typeof(resp_.project_type) != "undefined" && resp_.project_type == "bpmn") { window.location.href = "../designer?prj_uid=" + sNewProUid; } else { window.location.href = "processes_Map?PRO_UID=" + sNewProUid;