diff --git a/features/backend/projects/case_scheduler/basic_sequence_case_scheduler.feature b/features/backend/projects/case_scheduler/basic_sequence_case_scheduler.feature index c72ee983f..ee1e11375 100644 --- a/features/backend/projects/case_scheduler/basic_sequence_case_scheduler.feature +++ b/features/backend/projects/case_scheduler/basic_sequence_case_scheduler.feature @@ -11,7 +11,6 @@ Feature: Case Scheduler Resources "sch_option": "3", "sch_name": "Test scheduler #1", "sch_del_user_name": "admin", - "sch_del_user_pass": "admin", "tas_uid": "46941969352af5be2ab3f39001216717", "sch_start_time": "18:00", "sch_start_date": "2014-01-20", @@ -54,7 +53,6 @@ Feature: Case Scheduler Resources { "sch_name": "Test scheduler #1 modify", "sch_del_user_name": "admin", - "sch_del_user_pass": "admin", "tas_uid": "46941969352af5be2ab3f39001216717", "sch_start_time": "20:00", "sch_start_date": "2014-02-01", diff --git a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature index a0c3c7082..5fd271a70 100644 --- a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature +++ b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature @@ -21,7 +21,6 @@ Feature: Case Scheduler Main Tests """ { "sch_del_user_name": "", - "sch_del_user_pass": "", "tas_uid": "", "sch_name": "", "sch_option": "", @@ -46,20 +45,20 @@ Feature: Case Scheduler Main Tests Examples: - | test_description | sch_uid_number | sch_del_user_name | sch_del_user_pass | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every | error_code | - | Create with Daily | 1 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ | 1 | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 201 | - | Create with Weekly, sch_week_days=monday | 2 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 201 | - | Create with Weekly, sch_week_days=tuesday, wednesday, thursday, friday, saturday, sunday | 3 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|4\|5\|6\|7 | | | | | | 201 | - | Create with Monthly and day of month, day of month=1, of the month(s)=3,4 | 4 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 201 | - | Create with Monthly and day of month, day of month=1, of the month=1,2,5,6,7,8,9,10,11,12 | 5 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 2 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 201 | - | Create with Monthly and the day=first and Monday | 6 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 3 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 1\|7 | | 201 | - | Create with Monthly and the day=second and Saturday | 7 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 4 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 2\|6 | | 201 | - | Create with Monthly and the day=Third and Friday | 8 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 5 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 3\|5 | | 201 | - | Create with Monthly and the day=second and Thursday | 9 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 6 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 2\|4 | | 201 | - | Create with Monthly and the day=last and Wednesday | 10 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 7 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 5\|3 | | 201 | - | Create with Monthly and the day=last and Wednesday, of the month=1,2,6,7,8,9,10,11,12 | 11 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 8 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 1\|2\|6\|7\|8\|9\|10\|11\|12 | 5\|3 | | 201 | - | Create with One time only | 12 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-One Time only 678%$@ | 4 | | | 20:00 | | | | | | | 201 | - | Create with Every | 13 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Every 987&%@ | 5 | | | | | | | | | 12.30 | 201 | + | test_description | sch_uid_number | sch_del_user_name | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every | error_code | + | Create with Daily | 1 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ | 1 | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 201 | + | Create with Weekly, sch_week_days=monday | 2 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 201 | + | Create with Weekly, sch_week_days=tuesday, wednesday, thursday, friday, saturday, sunday | 3 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|4\|5\|6\|7 | | | | | | 201 | + | Create with Monthly and day of month, day of month=1, of the month(s)=3,4 | 4 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 201 | + | Create with Monthly and day of month, day of month=1, of the month=1,2,5,6,7,8,9,10,11,12 | 5 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 2 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 201 | + | Create with Monthly and the day=first and Monday | 6 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 3 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 1\|7 | | 201 | + | Create with Monthly and the day=second and Saturday | 7 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 4 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 2\|6 | | 201 | + | Create with Monthly and the day=Third and Friday | 8 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 5 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 3\|5 | | 201 | + | Create with Monthly and the day=second and Thursday | 9 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 6 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 2\|4 | | 201 | + | Create with Monthly and the day=last and Wednesday | 10 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 7 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 5\|3 | | 201 | + | Create with Monthly and the day=last and Wednesday, of the month=1,2,6,7,8,9,10,11,12 | 11 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 8 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 1\|2\|6\|7\|8\|9\|10\|11\|12 | 5\|3 | | 201 | + | Create with One time only | 12 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-One Time only 678%$@ | 4 | | | 20:00 | | | | | | | 201 | + | Create with Every | 13 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Every 987&%@ | 5 | | | | | | | | | 12.30 | 201 | Scenario: Create a new case scheduler with same name @@ -69,8 +68,7 @@ Feature: Case Scheduler Main Tests "sch_option": "5", "sch_name": "Case Scheduler-Every 987&%@", "sch_del_user_name": "admin", - "sch_del_user_pass": "admin", - "tas_uid": "46941969352af5be2ab3f39001216717", + "tas_uid": "46941969352af5be2ab3f39001216717", "sch_start_time": "", "sch_start_date": "", "sch_end_date": "", @@ -101,7 +99,6 @@ Feature: Case Scheduler Main Tests """ { "sch_del_user_name": "", - "sch_del_user_pass": "", "tas_uid": "", "sch_name": "", "sch_option": "", @@ -125,12 +122,12 @@ Feature: Case Scheduler Main Tests Examples: - | test_description | sch_uid_number | sch_del_user_name | sch_del_user_pass | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every |sch_state | - | Update Daily | 1 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Daily 123@#$ | 1 | 2014-02-30 | 2014-03-20 | 12:30 | | | | | | |ACTIVE | - | Update Weekly, sch_week_days=monday | 2 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Weekly monday 345%$# | 2 | 2014-03-20 | 2014-04-20 | 08:30 | 2 | | | | | |ACTIVE | - | Update Monthly and day of month, day of month=1, of the month(s)=3,4 | 4 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Monthly 567&^% 1 | 3 | 2014-04-21 | 2014-05-18 | 18:30 | | 1 | 18 | 3\|4\|5 | | |ACTIVE | - | Update One time only | 12 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-One Time only 678%$@ | 4 | | | 20:30 | | | | | | |ACTIVE | - | Update Every | 13 | admin | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Every 987&%@ | 5 | | | | | | | | | 18.30 |ACTIVE | + | test_description | sch_uid_number | sch_del_user_name | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every |sch_state | + | Update Daily | 1 | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Daily 123@#$ | 1 | 2014-02-30 | 2014-03-20 | 12:30 | | | | | | |ACTIVE | + | Update Weekly, sch_week_days=monday | 2 | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Weekly monday 345%$# | 2 | 2014-03-20 | 2014-04-20 | 08:30 | 2 | | | | | |ACTIVE | + | Update Monthly and day of month, day of month=1, of the month(s)=3,4 | 4 | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Monthly 567&^% 1 | 3 | 2014-04-21 | 2014-05-18 | 18:30 | | 1 | 18 | 3\|4\|5 | | |ACTIVE | + | Update One time only | 12 | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-One Time only 678%$@ | 4 | | | 20:30 | | | | | | |ACTIVE | + | Update Every | 13 | admin | 1352844695225ff5fe54de2005407079 | Update Case Scheduler-Every 987&%@ | 5 | | | | | | | | | 18.30 |ACTIVE | Scenario Outline: Get a single case scheduler of a project and check some properties diff --git a/features/backend/projects/case_scheduler/negative_tests_case_scheduler.feature b/features/backend/projects/case_scheduler/negative_tests_case_scheduler.feature index 87869ff32..ef6274e91 100644 --- a/features/backend/projects/case_scheduler/negative_tests_case_scheduler.feature +++ b/features/backend/projects/case_scheduler/negative_tests_case_scheduler.feature @@ -10,7 +10,6 @@ Feature: Output Documents Negative Tests """ { "sch_del_user_name": "", - "sch_del_user_pass": "", "tas_uid": "", "sch_name": "", "sch_option": "", @@ -32,28 +31,27 @@ Feature: Output Documents Negative Tests Examples: - | test_description | sch_del_user_name | sch_del_user_pass | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every | error_code | error_message | - | Invalid sch_option | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 21 | 20 | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option | - | Invalid sch_del_user_name | sample | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | User | - | Invalid sch_del_user_pass | admin | sample | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# 22 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|5\|6\|7 | | | | | | 400 | password | - | Invalid tas_uid | admin | admin | 00000000000005be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | Task not found | - | Invalid sch_start_time | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 2 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | sch_start_time | - | Invalid sch_start_date | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 3 | 3 | 2014-20-35 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_date | - | Invalid sch_week_days | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 4 | 2 | 2014-03-21 | 2014-04-18 | 18:00 | 8\|9\|10 | | | | | | 400 | sch_week_days | - | Invalid sch_start_date | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 5 | 3 | 2014-33-76 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 3\|5 | | 400 | sch_start_date | - | Invalid sch_start_day_opt_1 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 6 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 87 | 3\|4\|5 | 2\|4 | | 400 | sch_start_day_opt_1 | - | Invalid sch_start_day_opt_2 | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 7 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 9\|10 | | 400 | sch_start_day_opt_2 | - | Invalid sch_months | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 8 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 13\|54\|65 | 5\|3 | | 400 | sch_months | - | Invalid sch_end_date | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 23 | 1 | 2014-01-30 | 2015-54-87 | 12:00 | | | | | | | 400 | sch_end_date | - | Invalid sch_repeat_every | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Every 987&%@ 10 | 5 | | | | | | | | | 43:30 | 400 | sch_repeat_every | - | Field requered sch_option | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 11 | | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option | - | Field requered sch_name | admin | admin | 46941969352af5be2ab3f39001216717 | | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | sch_name | - | Field requered sch_del_user_name | | sample | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# 12 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|4\|5\|6\|7 | | | | | | 400 | User | - | Field requered sch_del_user_pass | admin | | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 113 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | password | - | Field requered tas_uid | admin | admin | | Case Scheduler-Monthly 567&^% 14 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | tas_uid | - | Field requered sch_start_time | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 15 | 3 | 2014-20-35 | 2014-04-18 | | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_time | - | Field requered sch_start_date | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 16 | 3 | | 2014-04-18 | 18:00 | 8\|9\|10 | 2 | | 3\|4\|5 | 2\|6 | | 400 | sch_start_date | - | Field requered sch_week_days | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# 17 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | | | | | | | 400 | sch_week_days | - | Field requered sch_start_day | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 18 | 3 | 2014-33-76 | 2014-04-18 | 18:00 | | | | 3\|4\|5 | 3\|5 | | 400 | sch_start_day | - | Field requered sch_months | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 19 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 16 | | 2\|4 | | 400 | sch_months | - | Field requered sch_end_date | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 24 | 1 | 2014-01-30 | | 12:00 | | | | | | | 400 | sch_end_date | \ No newline at end of file + | test_description | sch_del_user_name | tas_uid | sch_name | sch_option | sch_start_date | sch_end_date | sch_start_time | sch_week_days | sch_start_day | sch_start_day_opt_1 | sch_months | sch_start_day_opt_2 | sch_repeat_every | error_code | error_message | + | Invalid sch_option | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 21 | 20 | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option | + | Invalid sch_del_user_name | sample | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | User | + | Invalid tas_uid | admin | 00000000000005be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | Task not found | + | Invalid sch_start_time | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 2 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | sch_start_time | + | Invalid sch_start_date | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 3 | 3 | 2014-20-35 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_date | + | Invalid sch_week_days | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 4 | 2 | 2014-03-21 | 2014-04-18 | 18:00 | 8\|9\|10 | | | | | | 400 | sch_week_days | + | Invalid sch_start_date | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 5 | 3 | 2014-33-76 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 3\|5 | | 400 | sch_start_date | + | Invalid sch_start_day_opt_1 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 6 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 87 | 3\|4\|5 | 2\|4 | | 400 | sch_start_day_opt_1 | + | Invalid sch_start_day_opt_2 | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 7 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 9\|10 | | 400 | sch_start_day_opt_2 | + | Invalid sch_months | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 8 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 2 | | 13\|54\|65 | 5\|3 | | 400 | sch_months | + | Invalid sch_end_date | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 23 | 1 | 2014-01-30 | 2015-54-87 | 12:00 | | | | | | | 400 | sch_end_date | + | Invalid sch_repeat_every | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Every 987&%@ 10 | 5 | | | | | | | | | 43:30 | 400 | sch_repeat_every | + | Field requered sch_option | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 11 | | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option | + | Field requered sch_name | admin | 46941969352af5be2ab3f39001216717 | | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | sch_name | + | Field requered sch_del_user_name | | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# 12 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|4\|5\|6\|7 | | | | | | 400 | User | + | Field requered sch_del_user_pass | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 113 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | password | + | Field requered tas_uid | admin | | Case Scheduler-Monthly 567&^% 14 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | tas_uid | + | Field requered sch_start_time | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 15 | 3 | 2014-20-35 | 2014-04-18 | | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_time | + | Field requered sch_start_date | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 16 | 3 | | 2014-04-18 | 18:00 | 8\|9\|10 | 2 | | 3\|4\|5 | 2\|6 | | 400 | sch_start_date | + | Field requered sch_week_days | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# 17 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | | | | | | | 400 | sch_week_days | + | Field requered sch_start_day | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 18 | 3 | 2014-33-76 | 2014-04-18 | 18:00 | | | | 3\|4\|5 | 3\|5 | | 400 | sch_start_day | + | Field requered sch_months | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 19 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 16 | | 2\|4 | | 400 | sch_months | + | Field requered sch_end_date | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 24 | 1 | 2014-01-30 | | 12:00 | | | | | | | 400 | sch_end_date | \ No newline at end of file diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 4e07b40db..7eb813e38 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -372,6 +372,8 @@ class WebApplication \Propel::init(PATH_CONFIG . "databases.php"); + \Bootstrap::LoadTranslationObject(defined( 'SYS_LANG' ) ? SYS_LANG : "en"); + return true; } } \ No newline at end of file diff --git a/workflow/engine/src/BusinessModel/CaseScheduler.php b/workflow/engine/src/BusinessModel/CaseScheduler.php index ecca9db2e..35e44225b 100644 --- a/workflow/engine/src/BusinessModel/CaseScheduler.php +++ b/workflow/engine/src/BusinessModel/CaseScheduler.php @@ -20,7 +20,6 @@ class CaseScheduler $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_UID ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_NAME ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DEL_USER_NAME ); - $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DEL_USER_PASS ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DEL_USER_UID ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::PRO_UID ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::TAS_UID ); @@ -78,7 +77,6 @@ class CaseScheduler $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_UID ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_NAME ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DEL_USER_NAME ); - $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DEL_USER_PASS ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DEL_USER_UID ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::PRO_UID ); $oCriteria->addSelectColumn( \CaseSchedulerPeer::TAS_UID ); @@ -190,74 +188,44 @@ class CaseScheduler * Checks if the user exists * * @param string $userName Name - * @param string $userPass Password - * @param string $sProcessUID Process + * @param string $sTaskUID Task * * return message */ - public function getUser($userName, $userPass, $sProcessUID, $sTaskUID) + public function getUser($userName, $sTaskUID) { try { - $sPRO_UID = $sProcessUID; $sTASKS = $sTaskUID; $sWS_USER = trim( $userName ); - $sWS_PASS = trim( $userPass ); - if (\G::is_https()) { - $http = 'https://'; - } else { - $http = 'http://'; - } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; - @$client = new \SoapClient( $endpoint ); - $user = $sWS_USER; - $pass = $sWS_PASS; - $params = array ('userid' => $user,'password' => $pass); - $result = $client->__SoapCall('login', array ($params)); - $fields['status_code'] = $result->status_code; - $fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message; - $fields['version'] = $result->version; - $fields['time_stamp'] = $result->timestamp; - $messageCode = 1; - \G::LoadClass( 'Task' ); - \G::LoadClass( 'User' ); - \G::LoadClass( 'TaskUser' ); - \G::LoadClass( 'Groupwf' ); - if (! class_exists( 'GroupUser' )) { - \G::LoadClass( 'GroupUser' ); - } - if ($result->status_code == 0) { + $oCriteria = new \Criteria( 'workflow' ); + $oCriteria->addSelectColumn( \UsersPeer::USR_UID ); + $oCriteria->addSelectColumn( \TaskUserPeer::USR_UID ); + $oCriteria->addSelectColumn( \TaskUserPeer::TAS_UID ); + $oCriteria->addSelectColumn( \UsersPeer::USR_USERNAME ); + $oCriteria->addSelectColumn( \UsersPeer::USR_FIRSTNAME ); + $oCriteria->addSelectColumn( \UsersPeer::USR_LASTNAME ); + $oCriteria->addJoin( \TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN ); + $oCriteria->add( \TaskUserPeer::TAS_UID, $sTASKS ); + $oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER ); + $userIsAssigned = \TaskUserPeer::doCount( $oCriteria ); + if ($userIsAssigned < 1) { $oCriteria = new \Criteria( 'workflow' ); $oCriteria->addSelectColumn( \UsersPeer::USR_UID ); - $oCriteria->addSelectColumn( \TaskUserPeer::USR_UID ); - $oCriteria->addSelectColumn( \TaskUserPeer::TAS_UID ); - $oCriteria->addSelectColumn( \UsersPeer::USR_USERNAME ); - $oCriteria->addSelectColumn( \UsersPeer::USR_FIRSTNAME ); - $oCriteria->addSelectColumn( \UsersPeer::USR_LASTNAME ); - $oCriteria->addJoin( \TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN ); + $oCriteria->addJoin( \UsersPeer::USR_UID, \GroupUserPeer::USR_UID, \Criteria::LEFT_JOIN ); + $oCriteria->addJoin( \GroupUserPeer::GRP_UID, \TaskUserPeer::USR_UID, \Criteria::LEFT_JOIN ); $oCriteria->add( \TaskUserPeer::TAS_UID, $sTASKS ); $oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER ); - $userIsAssigned = \TaskUserPeer::doCount( $oCriteria ); - if ($userIsAssigned < 1) { - $oCriteria = new \Criteria( 'workflow' ); - $oCriteria->addSelectColumn( \UsersPeer::USR_UID ); - $oCriteria->addJoin( \UsersPeer::USR_UID, \GroupUserPeer::USR_UID, \Criteria::LEFT_JOIN ); - $oCriteria->addJoin( \GroupUserPeer::GRP_UID, \TaskUserPeer::USR_UID, \Criteria::LEFT_JOIN ); - $oCriteria->add( \TaskUserPeer::TAS_UID, $sTASKS ); - $oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER ); - $userIsAssigned = \GroupUserPeer::doCount( $oCriteria ); - if (! ($userIsAssigned >= 1)) { - throw (new \Exception( "The User \'" . $sWS_USER . "\' doesn't have the activity \'" . $sTASKS . "\' assigned")); - } + $userIsAssigned = \GroupUserPeer::doCount( $oCriteria ); + if (! ($userIsAssigned >= 1)) { + throw (new \Exception( "The User \'" . $sWS_USER . "\' doesn't have the activity \'" . $sTASKS . "\' assigned")); } - $oDataset = \TaskUserPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + } + $oDataset = \TaskUserPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $messageCode = $aRow['USR_UID']; $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $messageCode = $aRow['USR_UID']; - $oDataset->next(); - } - } else { - throw (new \Exception( $result->message)); } return $messageCode; } catch (\Exception $e) { @@ -295,12 +263,13 @@ class CaseScheduler if ($this->existsName($sProcessUID, $aData['SCH_NAME'])) { throw (new \Exception( 'Duplicate Case Scheduler name')); } - $mUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['SCH_DEL_USER_PASS'], $sProcessUID, $aData['TAS_UID']); + $mUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['TAS_UID']); $oUser = \UsersPeer::retrieveByPK( $mUser ); if (is_null($oUser)) { throw (new \Exception($mUser)); } - $aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']); + $oUserPass = $oUser->getUsrPassword(); + $aData['SCH_DEL_USER_PASS'] = $oUserPass; if ($sOption != '5') { $pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/"; if (!preg_match($pattern, $aData['SCH_START_TIME'])) { @@ -586,12 +555,13 @@ class CaseScheduler if ($this->existsNameUpdate($sSchUID, $aData['SCH_NAME'])) { throw (new \Exception( 'Duplicate Case Scheduler name')); } - $mUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['SCH_DEL_USER_PASS'], $sProcessUID, $aData['TAS_UID']); + $mUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['TAS_UID']); $oUser = \UsersPeer::retrieveByPK( $mUser ); if (is_null($oUser)) { throw (new \Exception($mUser)); } - $aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']); + $oUserPass = $oUser->getUsrPassword(); + $aData['SCH_DEL_USER_PASS'] = $oUserPass; if ($sOption != '5') { $pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/"; if (!preg_match($pattern, $aData['SCH_START_TIME'])) { @@ -850,12 +820,11 @@ class CaseScheduler /** * Delete a case scheduler of a project * - * @param string $sProcessUID * @param string $sSchUID * * @access public */ - public function deleteCaseScheduler($sProcessUID, $sSchUID) + public function deleteCaseScheduler($sSchUID) { try { require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php"); diff --git a/workflow/engine/src/BusinessModel/Cases.php b/workflow/engine/src/BusinessModel/Cases.php index db8136c41..1a58a02c7 100644 --- a/workflow/engine/src/BusinessModel/Cases.php +++ b/workflow/engine/src/BusinessModel/Cases.php @@ -23,8 +23,14 @@ class Cases */ public function getList($dataList = array()) { - G::LoadClass("applications"); + Validator::isArray($dataList, '$dataList'); + if (!isset($dataList["userId"])) { + throw (new \Exception("The user with userId: '' does not exist.")); + } else { + Validator::usrUid($dataList["userId"], "userId"); + } + G::LoadClass("applications"); $solrEnabled = false; $userUid = $dataList["userId"]; $callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001"; @@ -44,6 +50,11 @@ class Cases $dateTo = isset( $dataList["dateTo"] ) ? substr( $dataList["dateTo"], 0, 10 ) : ""; $first = isset( $dataList["first"] ) ? true :false; + $valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search'); + if (!in_array($action, $valuesCorrect)) { + throw (new \Exception('The value for $action is incorrect.')); + } + if ($action == 'search' || $action == 'to_reassign') { $userUid = ($user == "CURRENT_USER") ? $userUid : $user; if ($first) { @@ -115,6 +126,11 @@ class Cases $category ); } + if (!empty($result['data'])) { + foreach ($result['data'] as &$value) { + $value = array_change_key_case($value, CASE_LOWER); + } + } return $result; } @@ -221,17 +237,11 @@ class Cases { continue; } - $aRow["APP_NUMBER"] = $row["APP_NUMBER"]; - $aRow["APP_STATUS"] = $row["APP_STATUS"]; - $aRow["PRO_UID"] = $row["PRO_UID"]; - $aRow["DEL_INDEX"] = $row["DEL_INDEX"]; - $arrayData[] = array( - "guid" => $aRow["APP_UID"], - "name" => $aRow["APP_NUMBER"], - "status" => $aRow["APP_STATUS"], - "delIndex" => $aRow["DEL_INDEX"], - "processId" => $aRow["PRO_UID"] - ); + \G::LoadClass('wsBase'); + $ws = new \wsBase(); + $fields = $ws->getCaseInfo($caseUid, $row["DEL_INDEX"]); + //Return + return $fields; } } $case = array(); @@ -253,13 +263,8 @@ class Cases return $arrayData; } } else { - $arrayData = array(); $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\AppCacheViewPeer::APP_UID); $criteria->addSelectColumn(\AppCacheViewPeer::DEL_INDEX); - $criteria->addSelectColumn(\AppCacheViewPeer::APP_NUMBER); - $criteria->addSelectColumn(\AppCacheViewPeer::APP_STATUS); - $criteria->addSelectColumn(\AppCacheViewPeer::PRO_UID); $criteria->add(\AppCacheViewPeer::USR_UID, $userUid); $criteria->add(\AppCacheViewPeer::APP_UID, $caseUid); $criteria->add( @@ -279,16 +284,14 @@ class Cases $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); - $arrayData[] = array( - "guid" => $row["APP_UID"], - "name" => $row["APP_NUMBER"], - "status" => $row["APP_STATUS"], - "delIndex" => $row["DEL_INDEX"], - "processId" => $row["PRO_UID"] - ); } - return $arrayData; + \G::LoadClass('wsBase'); + $ws = new \wsBase(); + $fields = $ws->getCaseInfo($caseUid, $row["DEL_INDEX"]); + //Return + return $fields; } + } catch (\Exception $e) { throw $e; } @@ -304,11 +307,34 @@ class Cases public function getTaskCase($caseUid) { try { + $result = array (); \G::LoadClass('wsBase'); - $ws = new \wsBase(); - $fields = $ws->taskCase($caseUid); + $oCriteria = new \Criteria( 'workflow' ); + $del = \DBAdapter::getStringDelimiter(); + $oCriteria->addSelectColumn( \AppDelegationPeer::DEL_INDEX ); + $oCriteria->addSelectColumn( \AppDelegationPeer::TAS_UID ); + $oCriteria->addAsColumn( 'TAS_TITLE', 'C1.CON_VALUE' ); + $oCriteria->addAlias( "C1", 'CONTENT' ); + $tasTitleConds = array (); + $tasTitleConds[] = array (\AppDelegationPeer::TAS_UID,'C1.CON_ID'); + $tasTitleConds[] = array ('C1.CON_CATEGORY',$del . 'TAS_TITLE' . $del); + $tasTitleConds[] = array ('C1.CON_LANG',$del . SYS_LANG . $del); + $oCriteria->addJoinMC( $tasTitleConds, \Criteria::LEFT_JOIN ); + $oCriteria->add( \AppDelegationPeer::APP_UID, $caseUid ); + $oCriteria->add( \AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' ); + $oCriteria->add( \AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL ); + $oDataset = \AppDelegationPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $result = array ('guid' => $aRow['TAS_UID'], + 'name' => $aRow['TAS_TITLE'], + 'delegate' => $aRow['DEL_INDEX'] + ); + $oDataset->next(); + } //Return - return $fields; + return $result; } catch (\Exception $e) { throw $e; } @@ -345,17 +371,20 @@ class Cases * * @param string $prjUid Unique id of Project * @param string $usrUid Unique id of User - * @param string $caseUid Unique id of Case + * @param string $actUid Unique id of Case * @param array $variables * * return array Return an array with Task Case */ - public function addCaseImpersonate($prjUid, $usrUid, $caseUid, $variables) + public function addCaseImpersonate($prjUid, $usrUid, $actUid, $variables) { try { \G::LoadClass('wsBase'); $ws = new \wsBase(); - $fields = $ws->newCaseImpersonate($prjUid, $usrUid, $variables, '1352844695225ff5fe54de2005407079'); + if ($variables) { + $variables = array_shift($variables); + } + $fields = $ws->newCaseImpersonate($prjUid, $usrUid, $variables, $actUid); //Return return $fields; } catch (\Exception $e) { @@ -388,5 +417,319 @@ class Cases } } -} + /** + * Reassign Case + * + * @param string $caseUid Unique id of Case + * @param string $userUid Unique id of User + * @param string $delIndex + * @param string $bExecuteTriggersBeforeAssignment + * + * return array Return an array with Task Case + */ + public function updateRouteCase($caseUid, $userUid, $delIndex) + { + try { + \G::LoadClass('wsBase'); + $ws = new \wsBase(); + $fields = $ws->derivateCase($userUid, $caseUid, $delIndex, $bExecuteTriggersBeforeAssignment = false); + //Return + return $fields; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * get all upload document that they have send it + * + * @param string $sProcessUID Unique id of Process + * @param string $sApplicationUID Unique id of Case + * @param string $sTasKUID Unique id of Activity + * @param string $sUserUID Unique id of User + * @return object + */ + public function getAllUploadedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID) + { + \G::LoadClass("configuration"); + $conf = new \Configurations(); + $confEnvSetting = $conf->getFormats(); + //verifica si existe la tabla OBJECT_PERMISSION + $cases = new \cases(); + $cases->verifyTable(); + $listing = false; + $oPluginRegistry = & \PMPluginRegistry::getSingleton(); + if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) { + $folderData = new \folderData(null, null, $sApplicationUID, null, $sUserUID); + $folderData->PMType = "INPUT"; + $folderData->returnList = true; + //$oPluginRegistry = & PMPluginRegistry::getSingleton(); + $listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData); + } + $aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID); + if (!is_array($aObjectPermissions)) { + $aObjectPermissions = array( + 'DYNAFORMS' => array(-1), + 'INPUT_DOCUMENTS' => array(-1), + 'OUTPUT_DOCUMENTS' => array(-1) + ); + } + if (!isset($aObjectPermissions['DYNAFORMS'])) { + $aObjectPermissions['DYNAFORMS'] = array(-1); + } else { + if (!is_array($aObjectPermissions['DYNAFORMS'])) { + $aObjectPermissions['DYNAFORMS'] = array(-1); + } + } + if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) { + $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1); + } else { + if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) { + $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1); + } + } + if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) { + $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1); + } else { + if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) { + $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1); + } + } + $aDelete = $cases->getAllObjectsFrom($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID, 'DELETE'); + $oAppDocument = new \AppDocument(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, array('INPUT'), \Criteria::IN); + $oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN); + //$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN); + $oCriteria->add( + $oCriteria->getNewCriterion( + \AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], \Criteria::IN)-> + addOr($oCriteria->getNewCriterion(\AppDocumentPeer::USR_UID, array($sUserUID, '-1'), \Criteria::IN)) + ); + $aConditions = array(); + $aConditions[] = array(\AppDocumentPeer::APP_UID, \AppDelegationPeer::APP_UID); + $aConditions[] = array(\AppDocumentPeer::DEL_INDEX, \AppDelegationPeer::DEL_INDEX); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $oCriteria->add(\AppDelegationPeer::PRO_UID, $sProcessUID); + $oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX); + $oDataset = \AppDocumentPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + $aInputDocuments = array(); + $aInputDocuments[] = array( + 'APP_DOC_UID' => 'char', + 'DOC_UID' => 'char', + 'APP_DOC_COMMENT' => 'char', + 'APP_DOC_FILENAME' => 'char', 'APP_DOC_INDEX' => 'integer' + ); + $oUser = new \Users(); + while ($aRow = $oDataset->getRow()) { + $oCriteria2 = new \Criteria('workflow'); + $oCriteria2->add(\AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria2->add(\AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); + $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria2); + $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset2->next(); + $aRow2 = $oDataset2->getRow(); + $oTask = new \Task(); + if ($oTask->taskExists($aRow2['TAS_UID'])) { + $aTask = $oTask->load($aRow2['TAS_UID']); + } else { + $aTask = array('TAS_TITLE' => '(TASK DELETED)'); + } + $aAux = $oAppDocument->load($aRow['APP_DOC_UID'], $aRow['DOC_VERSION']); + $lastVersion = $oAppDocument->getLastAppDocVersion($aRow['APP_DOC_UID'], $sApplicationUID); + + try { + $aAux1 = $oUser->load($aAux['USR_UID']); + + $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); + } catch (Exception $oException) { + //$sUser = '(USER DELETED)'; + $sUser = '***'; + } + $aFields = array( + 'APP_DOC_UID' => $aAux['APP_DOC_UID'], + 'DOC_UID' => $aAux['DOC_UID'], + 'APP_DOC_COMMENT' => $aAux['APP_DOC_COMMENT'], + 'APP_DOC_FILENAME' => $aAux['APP_DOC_FILENAME'], + 'APP_DOC_INDEX' => $aAux['APP_DOC_INDEX'], + 'TYPE' => $aAux['APP_DOC_TYPE'], + 'ORIGIN' => $aTask['TAS_TITLE'], + 'CREATE_DATE' => $aAux['APP_DOC_CREATE_DATE'], + 'CREATED_BY' => $sUser + ); + if ($aFields['APP_DOC_FILENAME'] != '') { + $aFields['TITLE'] = $aFields['APP_DOC_FILENAME']; + } else { + $aFields['TITLE'] = $aFields['APP_DOC_COMMENT']; + } + //$aFields['POSITION'] = $_SESSION['STEP_POSITION']; + $aFields['CONFIRM'] = \G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); + if (in_array($aRow['APP_DOC_UID'], $aDelete['INPUT_DOCUMENTS'])) { + $aFields['ID_DELETE'] = \G::LoadTranslation('ID_DELETE'); + } + $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_DOWNLOAD'); + $aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION']; + $aFields['DOC_VERSION'] = $aRow['DOC_VERSION']; + if (is_array($listing)) { + foreach ($listing as $folderitem) { + if ($folderitem->filename == $aRow['APP_DOC_UID']) { + $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_GET_EXTERNAL_FILE'); + $aFields['DOWNLOAD_LINK'] = $folderitem->downloadScript; + continue; + } + } + } + if ($lastVersion == $aRow['DOC_VERSION']) { + //Show only last version + $aInputDocuments[] = $aFields; + } + $oDataset->next(); + } + $oAppDocument = new \AppDocument(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, array('ATTACHED'), \Criteria::IN); + $oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN); + $oCriteria->add( + $oCriteria->getNewCriterion( + \AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], \Criteria::IN + )-> + addOr($oCriteria->getNewCriterion(\AppDocumentPeer::USR_UID, array($sUserUID, '-1'), \Criteria::IN))); + $aConditions = array(); + $aConditions[] = array(\AppDocumentPeer::APP_UID, \AppDelegationPeer::APP_UID); + $aConditions[] = array(\AppDocumentPeer::DEL_INDEX, \AppDelegationPeer::DEL_INDEX); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $oCriteria->add(\AppDelegationPeer::PRO_UID, $sProcessUID); + $oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX); + $oDataset = \AppDocumentPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $oCriteria2 = new \Criteria('workflow'); + $oCriteria2->add(\AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria2->add(\AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); + $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria2); + $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset2->next(); + $aRow2 = $oDataset2->getRow(); + $oTask = new \Task(); + if ($oTask->taskExists($aRow2['TAS_UID'])) { + $aTask = $oTask->load($aRow2['TAS_UID']); + } else { + $aTask = array('TAS_TITLE' => '(TASK DELETED)'); + } + $aAux = $oAppDocument->load($aRow['APP_DOC_UID'], $aRow['DOC_VERSION']); + $lastVersion = $oAppDocument->getLastAppDocVersion($aRow['APP_DOC_UID'], $sApplicationUID); + try { + $aAux1 = $oUser->load($aAux['USR_UID']); + + $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); + } catch (Exception $oException) { + $sUser = '***'; + } + $aFields = array( + 'APP_DOC_UID' => $aAux['APP_DOC_UID'], + 'DOC_UID' => $aAux['DOC_UID'], + 'APP_DOC_COMMENT' => $aAux['APP_DOC_COMMENT'], + 'APP_DOC_FILENAME' => $aAux['APP_DOC_FILENAME'], + 'APP_DOC_INDEX' => $aAux['APP_DOC_INDEX'], + 'TYPE' => $aAux['APP_DOC_TYPE'], + 'ORIGIN' => $aTask['TAS_TITLE'], + 'CREATE_DATE' => $aAux['APP_DOC_CREATE_DATE'], + 'CREATED_BY' => $sUser + ); + if ($aFields['APP_DOC_FILENAME'] != '') { + $aFields['TITLE'] = $aFields['APP_DOC_FILENAME']; + } else { + $aFields['TITLE'] = $aFields['APP_DOC_COMMENT']; + } + //$aFields['POSITION'] = $_SESSION['STEP_POSITION']; + $aFields['CONFIRM'] = G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); + if (in_array($aRow['APP_DOC_UID'], $aDelete['INPUT_DOCUMENTS'])) { + $aFields['ID_DELETE'] = G::LoadTranslation('ID_DELETE'); + } + $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_DOWNLOAD'); + $aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID']; + if ($lastVersion == $aRow['DOC_VERSION']) { + //Show only last version + $aInputDocuments[] = $aFields; + } + $oDataset->next(); + } + // Get input documents added/modified by a supervisor - Begin + $oAppDocument = new \AppDocument(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, array('INPUT'), \Criteria::IN); + $oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN); + $oCriteria->add(\AppDocumentPeer::DEL_INDEX, 100000); + $oCriteria->addJoin(\AppDocumentPeer::APP_UID, \ApplicationPeer::APP_UID, \Criteria::LEFT_JOIN); + $oCriteria->add(\ApplicationPeer::PRO_UID, $sProcessUID); + $oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX); + $oDataset = \AppDocumentPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + $oUser = new \Users(); + while ($aRow = $oDataset->getRow()) { + $aTask = array('TAS_TITLE' => '[ ' . G::LoadTranslation('ID_SUPERVISOR') . ' ]'); + $aAux = $oAppDocument->load($aRow['APP_DOC_UID'], $aRow['DOC_VERSION']); + $lastVersion = $oAppDocument->getLastAppDocVersion($aRow['APP_DOC_UID'], $sApplicationUID); + try { + $aAux1 = $oUser->load($aAux['USR_UID']); + $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); + } catch (Exception $oException) { + $sUser = '***'; + } + $aFields = array( + 'APP_DOC_UID' => $aAux['APP_DOC_UID'], + 'DOC_UID' => $aAux['DOC_UID'], + 'APP_DOC_COMMENT' => $aAux['APP_DOC_COMMENT'], + 'APP_DOC_FILENAME' => $aAux['APP_DOC_FILENAME'], + 'APP_DOC_INDEX' => $aAux['APP_DOC_INDEX'], + 'TYPE' => $aAux['APP_DOC_TYPE'], + 'ORIGIN' => $aTask['TAS_TITLE'], + 'CREATE_DATE' => $aAux['APP_DOC_CREATE_DATE'], + 'CREATED_BY' => $sUser + ); + if ($aFields['APP_DOC_FILENAME'] != '') { + $aFields['TITLE'] = $aFields['APP_DOC_FILENAME']; + } else { + $aFields['TITLE'] = $aFields['APP_DOC_COMMENT']; + } + //$aFields['POSITION'] = $_SESSION['STEP_POSITION']; + $aFields['CONFIRM'] = \G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); + if (in_array($aRow['APP_DOC_UID'], $aDelete['INPUT_DOCUMENTS'])) { + $aFields['ID_DELETE'] = \G::LoadTranslation('ID_DELETE'); + } + $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_DOWNLOAD'); + $aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION']; + $aFields['DOC_VERSION'] = $aRow['DOC_VERSION']; + if (is_array($listing)) { + foreach ($listing as $folderitem) { + if ($folderitem->filename == $aRow['APP_DOC_UID']) { + $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_GET_EXTERNAL_FILE'); + $aFields['DOWNLOAD_LINK'] = $folderitem->downloadScript; + continue; + } + } + } + if ($lastVersion == $aRow['DOC_VERSION']) { + //Show only last version + $aInputDocuments[] = $aFields; + } + $oDataset->next(); + } + // Get input documents added/modified by a supervisor - End + global $_DBArray; + $_DBArray['inputDocuments'] = $aInputDocuments; + \G::LoadClass('ArrayPeer'); + $oCriteria = new \Criteria('dbarray'); + $oCriteria->setDBArrayTable('inputDocuments'); + $oCriteria->addDescendingOrderByColumn('CREATE_DATE'); + return $oCriteria; + } +} diff --git a/workflow/engine/src/BusinessModel/InputDocument.php b/workflow/engine/src/BusinessModel/InputDocument.php index ca28a52b8..5757b96e6 100644 --- a/workflow/engine/src/BusinessModel/InputDocument.php +++ b/workflow/engine/src/BusinessModel/InputDocument.php @@ -462,192 +462,5 @@ class InputDocument throw $e; } } - - /** - * Get data of Cases InputDocument - * - * @param string $caseUid - * @param string $userUid - * - * return array Return an array with data of an InputDocument - */ - public function getCasesInputDocument($caseUid, $userUid) - { - try { - - /// - global $G_PUBLISH; - $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2'; - - $endpoint = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint; - - $sessionId = isset( $_SESSION['SESSION_ID'] ) ? $_SESSION['SESSION_ID'] : ''; - - //Apply proxy settings - $proxy = array (); - $sysConf = \System::getSystemConfiguration(); - if ($sysConf['proxy_host'] != '') { - $proxy['proxy_host'] = $sysConf['proxy_host']; - if ($sysConf['proxy_port'] != '') { - $proxy['proxy_port'] = $sysConf['proxy_port']; - } - if ($sysConf['proxy_user'] != '') { - $proxy['proxy_login'] = $sysConf['proxy_user']; - } - if ($sysConf['proxy_pass'] != '') { - $proxy['proxy_password'] = $sysConf['proxy_pass']; - } - } - - @$client = new \SoapClient( $endpoint, $proxy ); - /// - - - $caseId = $caseUid; - $sessionId = $userUid; - $params = array ('sessionId' => $sessionId,'caseId' => $caseId); - - $wsResponse = $client->__SoapCall( 'InputDocumentList', array ($params)); - - //g::pr($wsResponse); - $result = \G::PMWSCompositeResponse( $wsResponse, 'documents' ); - - $G_PUBLISH = new \Publisher(); - $rows[] = array ('guid' => 'char','name' => 'char','processId' => 'char'); - - if (is_array( $result )) { - foreach ($result as $key => $item) { - if (isset( $item->item )) { - foreach ($item->item as $index => $val) { - if ($val->key == 'guid') { - $guid = $val->value; - } - if ($val->key == 'filename') { - $filename = $val->value; - } - if ($val->key == 'docId') { - $docId = $val->value; - } - if ($val->key == 'version') { - $version = $val->value; - } - if ($val->key == 'createDate') { - $createDate = $val->value; - } - if ($val->key == 'createBy') { - $createBy = $val->value; - } - if ($val->key == 'type') { - $type = $val->value; - } - if ($val->key == 'link') { - $link = $val->value; - } - } - } elseif (is_array( $item )) { - foreach ($item as $index => $val) { - if ($val->key == 'guid') { - $guid = $val->value; - } - if ($val->key == 'filename') { - $filename = $val->value; - } - if ($val->key == 'docId') { - $docId = $val->value; - } - if ($val->key == 'version') { - $version = $val->value; - } - if ($val->key == 'createDate') { - $createDate = $val->value; - } - if ($val->key == 'createBy') { - $createBy = $val->value; - } - if ($val->key == 'type') { - $type = $val->value; - } - if ($val->key == 'link') { - $link = $val->value; - } - } - } else { - if (isset( $item->guid )) { - $guid = $item->guid; - } - if (isset( $item->filename )) { - $filename = $item->filename; - } - if (isset( $item->docId )) { - $docId = $item->docId; - } - if (isset( $item->version )) { - $version = $item->version; - } - if (isset( $item->createDate )) { - $createDate = $item->createDate; - } - if (isset( $item->createBy )) { - $createBy = $item->createBy; - } - if (isset( $item->type )) { - $type = $item->type; - } - if (isset( $item->link )) { - $link = $item->link; - } - } - $rows[] = array ('guid' => $guid,'filename' => $filename,'docId' => $docId,'version' => $version,'createDate' => $createDate,'createBy' => $createBy,'type' => $type,'link' => $link); - } - } - return $rows; - /* testing// - global $_DBArray; - $_DBArray = (isset( $_SESSION['_DBArray'] ) ? $_SESSION['_DBArray'] : ''); - $_DBArray['inputDocument'] = $rows; - $documentArray = array (); - $documentArray[] = array ('guid' => 'char','filename' => 'char' - ); - if (isset( $_DBArray['inputDocument'] )) { - foreach ($_DBArray['inputDocument'] as $key => $val) { - if ($key != 0 && isset( $val['filename'] )) { - $documentArray[] = array ('guid' => $val['guid'],'filename' => $val['filename'] - ); - } - } - } - if (isset( $_DBArray['outputDocument'] )) { - foreach ($_DBArray['outputDocument'] as $key => $val) { - if ($key != 0 && isset( $val['filename'] )) { - $documentArray[] = array ('guid' => $val['guid'],'filename' => $val['filename'] - ); - } - } - } - $_DBArray['documents'] = $documentArray; - $_DBArray['WS_TMP_CASE_UID'] = $frm["CASE_ID"]; - $_SESSION['_DBArray'] = $_DBArray; - - G::LoadClass( 'ArrayPeer' ); - $c = new Criteria( 'dbarray' ); - $c->setDBArrayTable( 'inputDocument' ); - $c->addAscendingOrderByColumn( 'name' ); - $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/wsrInputDocumentList', $c ); - - } elseif (is_object( $result )) { - $_SESSION['WS_SESSION_ID'] = ''; - $fields['status_code'] = $result->status_code; - $fields['message'] = $result->message; - $fields['time_stamp'] = date( "Y-m-d H:i:s" ); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/wsShowResult', null, $fields ); - } - G::RenderPage( 'publish', 'raw' ); - break;*/ - - } catch (\Exception $e) { - throw $e; - } - } - } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php index 34f0e83a5..035072984 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Cases.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Cases.php @@ -175,9 +175,8 @@ class Cases extends Api try { $userUid = $this->getUserId(); $cases = new \BusinessModel\Cases(); - $arrayData = $cases->getCaseInfo($cas_uid, $userUid); - $response = $arrayData; - return $response; + $oData = $cases->getCaseInfo($cas_uid, $userUid); + return $oData; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -188,13 +187,12 @@ class Cases extends Api * * @param string $cas_uid {@min 32}{@max 32} */ - public function doGetTaskCase($cas_uid) + public function doGetTaskCase($cas_uid) { try { $cases = new \BusinessModel\Cases(); - $arrayData = $cases->getTaskCase($cas_uid); - $response = $arrayData; - return $response; + $oData = $cases->getTaskCase($cas_uid); + return $oData; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -214,8 +212,7 @@ class Cases extends Api $userUid = $this->getUserId(); $cases = new \BusinessModel\Cases(); $arrayData = $cases->addCase($prj_uid, $act_uid, $userUid, $variables); - $response = $arrayData; - return $response; + return $arrayData; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -229,13 +226,12 @@ class Cases extends Api * @param string $act_uid {@from body} {@min 32}{@max 32} * @param array $variables {@from body} */ - public function doPostCaseImpersonate($prj_uid, $usr_uid, $act_uid, $variables) + public function doPostCaseImpersonate($prj_uid, $usr_uid, $act_uid, $variables=null) { try { $cases = new \BusinessModel\Cases(); $arrayData = $cases->addCaseImpersonate($prj_uid, $usr_uid, $act_uid, $variables); - $response = $arrayData; - return $response; + return $arrayData; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -254,8 +250,7 @@ class Cases extends Api $userUid = $this->getUserId(); $cases = new \BusinessModel\Cases(); $arrayData = $cases->updateReassignCase($cas_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target); - $response = $arrayData; - return $response; + return $arrayData; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -268,14 +263,13 @@ class Cases extends Api * @param string $usr_uid_source {@from body} {@min 32}{@max 32} * @param string $usr_uid_target {@from body} {@min 32}{@max 32} */ - public function doPutRouteCase($cas_uid, $del_index, $usr_uid_source, $usr_uid_target) + public function doPutRouteCase($cas_uid, $del_index) { try { $userUid = $this->getUserId(); $cases = new \BusinessModel\Cases(); - $arrayData = $cases->updateRouteCase($cas_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target); - $response = $arrayData; - return $response; + $arrayData = $cases->updateRouteCase($cas_uid, $userUid, $del_index); + return $arrayData; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseScheduler.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseScheduler.php index 0a34c2732..f5f7c51a8 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseScheduler.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseScheduler.php @@ -108,7 +108,7 @@ class CaseScheduler extends Api { try { $caseScheduler = new \BusinessModel\CaseScheduler(); - $caseScheduler->deleteCaseScheduler($prjUid, $schUid); + $caseScheduler->deleteCaseScheduler($schUid); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -128,11 +128,6 @@ class CaseSchedulerStructure */ public $sch_del_user_name; - /** - * @var string {@from body} {@min 0} {@max 100} - */ - public $sch_del_user_pass; - /** * @var string {@from body} {@min 0} {@max 100} */ diff --git a/workflow/engine/src/Tests/BusinessModel/CasesTest.php b/workflow/engine/src/Tests/BusinessModel/CasesTest.php new file mode 100644 index 000000000..4ff197711 --- /dev/null +++ b/workflow/engine/src/Tests/BusinessModel/CasesTest.php @@ -0,0 +1,175 @@ + + * @copyright Colosa - Bolivia + * + * @protected + * @package Tests\BusinessModel + */ +class CasesTest extends \PHPUnit_Framework_TestCase +{ + protected $oCases; + + /** + * Set class for test + * + * @coversNothing + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function setUp() + { + $this->oCases = new \BusinessModel\Cases(); + return true; + } + + /** + * Test error for type in first field the function + * + * @covers \BusinessModel\Cases::getList + * @expectedException Exception + * @expectedExceptionMessage Invalid value for '$dataList' it must be an array. + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesErrorArray() + { + $this->oCases->getList(true); + } + + /** + * Test error for empty userId in array + * + * @covers \BusinessModel\Cases::getList + * @expectedException Exception + * @expectedExceptionMessage The user with userId: '' does not exist. + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesErrorUserIdArray() + { + $this->oCases->getList(array()); + } + + /** + * Test error for not exists userId in array + * + * @covers \BusinessModel\Cases::getList + * @expectedException Exception + * @expectedExceptionMessage The user with userId: 'UidInexistente' does not exist. + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesErrorNotExistsUserIdArray() + { + $this->oCases->getList(array('userId' => 'UidInexistente')); + } + + /** + * Test error for incorrect value $action in array + * + * @covers \BusinessModel\Cases::getList + * @expectedException Exception + * @expectedExceptionMessage The value for $action is incorrect. + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesErrorIncorrectValueArray() + { + $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'incorrect')); + } + + /** + * Test get list to do + * + * @covers \BusinessModel\Cases::getList + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesToDo() + { + $response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001')); + $this->assertTrue(is_array($response)); + $this->assertTrue(is_numeric($response['totalCount'])); + $this->assertTrue(is_array($response['data'])); + } + + /** + * Test get list draft + * + * @covers \BusinessModel\Cases::getList + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesDraft() + { + $response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'draft')); + $this->assertTrue(is_array($response)); + $this->assertTrue(is_numeric($response['totalCount'])); + $this->assertTrue(is_array($response['data'])); + } + + /** + * Test get list participated + * + * @covers \BusinessModel\Cases::getList + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesParticipated() + { + $response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'sent')); + $this->assertTrue(is_array($response)); + $this->assertTrue(is_numeric($response['totalCount'])); + $this->assertTrue(is_array($response['data'])); + } + + /** + * Test get list unassigned + * + * @covers \BusinessModel\Cases::getList + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesUnassigned() + { + $response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'unassigned')); + $this->assertTrue(is_array($response)); + $this->assertTrue(is_numeric($response['totalCount'])); + $this->assertTrue(is_array($response['data'])); + } + + /** + * Test get list search + * + * @covers \BusinessModel\Cases::getList + * + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + */ + public function testGetListCasesSearch() + { + $response = $this->oCases->getList(array('userId' => '00000000000000000000000000000001', 'action' => 'search')); + $this->assertTrue(is_array($response)); + $this->assertTrue(is_numeric($response['totalCount'])); + $this->assertTrue(is_array($response['data'])); + } +} +