diff --git a/features/backend/events_resources/event.feature b/features/backend/events_resources/event.feature index 183bc91f3..10808acc7 100644 --- a/features/backend/events_resources/event.feature +++ b/features/backend/events_resources/event.feature @@ -1,8 +1,17 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Testing events +Feature: Events Resources - @1: TEST FOR POST EVENT /---------------------------------------------------------------------- - Scenario: Create a event + @1: TEST FOR GET EVENTS /---------------------------------------------------------------------- + Scenario: List all the events (result 0 events) + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/events" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 0 record + + + @2: TEST FOR POST EVENT /---------------------------------------------------------------------- + Scenario: Create a new event Given that I have a valid access_token And POST this data: """ @@ -24,8 +33,15 @@ Feature: Testing events Then the response status code should be 201 And store "evn_uid" in session array + @3: TEST FOR GET EVENTS /---------------------------------------------------------------------- + Scenario: List all the events (result 1 event) + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/events" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 1 record - @2: TEST FOR PUT EVENT /----------------------------------------------------------------------- + @4: TEST FOR PUT EVENT /----------------------------------------------------------------------- Scenario: Update a event Given that I have a valid access_token And PUT this data: @@ -51,8 +67,8 @@ Feature: Testing events And the type is "object" - @3: TEST FOR GET EVENT /----------------------------------------------------------------------- - Scenario: Get a event + @5: TEST FOR GET EVENT /----------------------------------------------------------------------- + Scenario: Get a event (with change in "evn_description") Given that I have a valid access_token And that I want to get a resource with the key "evn_uid" stored in session array And I request "project/251815090529619a99a2bf4013294414/event" @@ -62,11 +78,19 @@ Feature: Testing events And that "evn_description" is set to "change description" - @4: TEST FOR DELETE EVENT /----------------------------------------------------------------------- + @6: TEST FOR DELETE EVENT /----------------------------------------------------------------------- Scenario: Delete a event Given that I have a valid access_token And that I want to delete a resource with the key "evn_uid" stored in session array And I request "project/251815090529619a99a2bf4013294414/event" Then the response status code should be 200 And the response charset is "UTF-8" - And the type is "object" \ No newline at end of file + And the type is "object" + + @7: TEST FOR GET EVENTS /---------------------------------------------------------------------- + Scenario: List all the events (result 0 events) + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/events" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 0 record \ No newline at end of file diff --git a/features/backend/output_documents_resources/output_document.feature b/features/backend/output_documents_resources/output_document.feature index 43c9a2950..54632d117 100644 --- a/features/backend/output_documents_resources/output_document.feature +++ b/features/backend/output_documents_resources/output_document.feature @@ -4,25 +4,249 @@ Feature: Output Documents Resources Background: Given that I have a valid access_token + @1: TEST FOR GET OUTPUT DOCUMENT /-------------------------------------------------------------------- Scenario: Get a List output documents of a project - Given I request "project/4224292655297723eb98691001100052/output-documents" - Then the response status code should be 200 - And the content type is "application/json" - And the type is "array" + Given I request "project/4224292655297723eb98691001100052/output-documents" + 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 2 records + @2: TEST FOR GET SINGLE OUTPUT DOCUMENT /-------------------------------------------------------------------- Scenario: Get a single output document of a project Given I request "project/4224292655297723eb98691001100052/output-document/270088687529c8ace5e5272077582449" Then the response status code should be 200 + And the response charset is "UTF-8" And the content type is "application/json" And the type is "object" - Scenario: Create a new output document for a project - Given this scenario is not implemented yet - - Scenario: Update a output document for a project - Given this scenario is not implemented yet - - Scenario: Delete a output document of a project - Given this scenario is not implemented yet + + @3: TEST FOR POST OUTPUT DOCUMENT /-------------------------------------------------------------------- + Scenario Outline: Create a new output document for a project + Given POST this data: + """ + { + "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_current_revision": "", + "out_doc_field_mapping": "", + "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": "" + } + """ + And I request "project//output-document" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "out_doc_uid" in session array as variable "out_doc_uid_" + + Examples: + + | 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_current_revision | out_doc_field_mapping | 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 | + | 4224292655297723eb98691001100052 | 1 | Endpoint Old Version | Output Document old version - EndPoint | Output 1 | | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | 2 | Endpoint Old Version PDF SECURITY | Output Document old version PDF SECURITY | Output 2 | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | 3 | Endpoint Old Version Doc | Output Document old version solo doc | Output 3 | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 0 | | 1 | | | 0 | | | | + | 4224292655297723eb98691001100052 | 4 | Endpoint Old Version PDF | Output Document old version solo pdf | Output 4 | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 0 | | 1 | | | 1 | sample | sample | print | + | 4224292655297723eb98691001100052 | 5 | Endpoint New Version | Output Document new version - EndPoint | Output 5 | | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | 6 | Endpoint New Version PDF SECURITY | Output Document new version PDF SECURITY | Output 6 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | 7 | Endpoint New Version Doc | Output Document new version solo doc | Output 7 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | DOC | HTML | 0 | | 1 | | | 0 | | | | + | 4224292655297723eb98691001100052 | 8 | Endpoint New Version PDF | Output Document new version solo pdf | Output 8 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 0 | | 1 | | | 1 | sample | sample | print | + + + @4: TEST FOR GET OUTPUT DOCUMENT /-------------------------------------------------------------------- + Scenario: Get a List output documents of a project + Given I request "project/4224292655297723eb98691001100052/output-documents" + 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 10 records + + + @5: TEST FOR PUT UPDATE OUTPUT DOCUMENT /-------------------------------------------------------------------- + Scenario Outline: Update a output document for a project + Given PUT this data: + """ + { + "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_current_revision": "", + "out_doc_field_mapping": "", + "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": "" + } + """ + And that I want to update a resource with the key "out_doc_uid" stored in session array as variable "out_doc_uid_" + And I request "project//output-document" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + + Examples: + + | 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_current_revision | out_doc_field_mapping | 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 | + | 4224292655297723eb98691001100052 | 1 | Endpoint Old Version UPDATE | Output Document old version - UPDATE | Output 1 | | HTML2PDF | 0 | Letter | 20 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | 2 | Endpoint Old Version PDF SECURITY UPDATE | Output UPDATE old version PDF SECURITY | Output 2 | | HTML2PDF | 1 | Legal | 20 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\| modify\|copy | + | 4224292655297723eb98691001100052 | 5 | Endpoint New Version UPDATE | Output UPDATE new version - EndPoint | Output 5 | | TCPDF | 0 | Letter | 30 | 20 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | 6 | Endpoint New Version PDF SECURITY UPDATE | Output UPDATE new version PDF SECURITY | Output 6 | | TCPDF | 1 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy | + + + + @6: TEST FOR GET OUTPUT DOCUMENT /-------------------------------------------------------------------- + Scenario Outline: Get a output Document + + Given that I want to get a resource with the key "out_doc_uid" stored in session array as variable "out_doc_uid_" + And I request "project//output-document" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And that "out_doc_title" is set to "" + And that "out_doc_description" is set to "" + And that "out_doc_filename" is set to "" + + Examples: + + | project | out_doc_number | out_doc_title | out_doc_description |out_doc_filename | + | 4224292655297723eb98691001100052 | 1 | Endpoint Old Version UPDATE | Output Document old version - UPDATE | Output 1 | + | 4224292655297723eb98691001100052 | 2 | Endpoint Old Version PDF SECURITY UPDATE | Output UPDATE old version PDF SECURITY | Output 2 | + | 4224292655297723eb98691001100052 | 5 | Endpoint New Version UPDATE | Output UPDATE new version - EndPoint | Output 5 | + | 4224292655297723eb98691001100052 | 6 | Endpoint New Version PDF SECURITY UPDATE | Output UPDATE new version PDF SECURITY | Output 6 | + + + + + + @7: TEST FOR DELETE OUTPUT DOCUMENT /-------------------------------------------------------------------- + Scenario Outline: Delete a output document of a project + Given that I want to delete a resource with the key "out_doc_uid" stored in session array as variable "out_doc_uid_" + And I request "project//output-document" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + + | project | out_doc_number | + | 4224292655297723eb98691001100052 | 1 | + | 4224292655297723eb98691001100052 | 2 | + | 4224292655297723eb98691001100052 | 3 | + | 4224292655297723eb98691001100052 | 4 | + | 4224292655297723eb98691001100052 | 5 | + | 4224292655297723eb98691001100052 | 6 | + | 4224292655297723eb98691001100052 | 7 | + | 4224292655297723eb98691001100052 | 8 | + + + @8: TEST FOR GET OUTPUT DOCUMENT /-------------------------------------------------------------------- + Scenario: Get a List output documents of a project + Given I request "project/4224292655297723eb98691001100052/output-documents" + 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 2 records + + + + @9: TEST FOR GET OUTPUT DOCUMENT PRUEBAS NEGATIVAS /--------------------------------------------------- + Scenario Outline: Create a new output document for a project + Given POST this data: + """ + { + "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_current_revision": "", + "out_doc_field_mapping": "", + "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": "" + } + """ + And I request "project//output-document" + Then the response status code should be 400 + + + Examples: + + | 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_current_revision | out_doc_field_mapping | 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 | + | 4224292655297723eb98691001100052 | test !@#$%^&*€¤¾½²³€¼½¼ | Output Document old version - EndPoint | Output 1 | | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint Old1 | test %^&*€¤¾½²³€ | Output 2 | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | Endpoint Old Version Doc 2 | Output Document old version solo doc | Output @#$%^&*€¤ | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 0 | | 1 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint Old Version PDF 3 | Output Document old version solo pdf | Output 4 | sample @#$%^&*€¤ | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 0 | | 1 | | | 1 | sample | sample | print | + | 4224292655297723eb98691001100052 | Endpoint New Version 4 | Output Document new version - EndPoint | Output 5 | | @#$%¼¤¾½ | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURIT5 | Output Document new version PDF SECURITY | Output 6 | | TCPDF | 34 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | Endpoint New Version Doc6 | Output Document new version solo doc | Output 7 | | TCPDF | 0 | Legal!@#$$$%^&| 25 | 25 | 25 | 25 | WORD | HTML | 0 | | 1 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF7 | Output Document new version solo pdf | Output 8 | | TCPDF | 0 | Legal | 25,56.98 | 25 | 25 | 25 | PDF | HTML | 0 | | 1 | | | 1 | sample | sample | print | + | 4224292655297723eb98691001100052 | Endpoint New Version8 | Output Document new version - EndPoint | Output 9 | | TCPDF | 1 | Letter | 30 | 30,7.98 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 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 | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | Endpoint New Version Doc10 | Output Document new version solo doc | Output 11 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25,34.09 | WORD | HTML | 0 | | 1 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF 11 | Output Document new version solo pdf | Output 12 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDFtest@#$$ | HTML | 0 | | 1 | | | 1 | sample | sample | print | + | 4224292655297723eb98691001100052 | Endpoint New Version 12 | Output Document new version - EndPoint | Output 13 | | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTMLsample2@#| 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURI13 | Output Document new version PDF SECURITY | Output 14 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 45,988.566 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | Endpoint New Version Doc 14 | Output Document new version solo doc | Output 15 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 0 | 324#$%%^^@@ | 1 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF 15 | Output Document new version solo pdf | Output 16 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 0 | | 1,99.98 | | | 1 | sample | sample | print | + | 4224292655297723eb98691001100052 | Endpoint New Version 16 | Output Document new version - EndPoint | Output 16 | | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | 23rg@#$% | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURI17 | Output Document new version PDF SECURITY | Output 17 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | vfv23@$@% | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | Endpoint New Version Doc 18 | Output Document new version solo doc | Output 18 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 0 | | 1 | | | 23454 | | | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF 19 | Output Document new version solo pdf | Output 19 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | PDF | HTML | 0 | | 1 | | | 1 | sample432@$#@$¼€¼½ | sample | print | + | 4224292655297723eb98691001100052 | Endpoint New Version 20 | Output Document new version - EndPoint | Output 20 | | TCPDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | sample432@$#@$¼€¼½ | | + | 4224292655297723eb98691001100052 | Endpoint New Version PDF SECURI22 | Output Document new version PDF SECURITY | Output 21 | | TCPDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|form\|aaa | + | 4224292655297723eb98691001100052 | | Output Document old version - EndPoint | Output 22 | | HTML2PDF | 1 | Letter | 30 | 30 | 30 | 30 | BOTH | HTML | 0 | | 0 | | | 0 | | | | + | 4224292655297723eb98691001100052 | Endpoint Old Version PDF SECURITY | | Output 23 | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | BOTH | HTML | 0 | | 1 | | | 1 | sample | sample | print\|modify\|copy\|forms | + | 4224292655297723eb98691001100052 | Endpoint Old Version Doc | Output Document old version solo doc | | | HTML2PDF | 0 | Legal | 25 | 25 | 25 | 25 | WORD | HTML | 0 | | 1 | | | 0 | | | | + \ No newline at end of file diff --git a/features/backend/project_activity_resources/activity.feature b/features/backend/project_activity_resources/activity.feature index cf81cef31..7fc4b8bec 100644 --- a/features/backend/project_activity_resources/activity.feature +++ b/features/backend/project_activity_resources/activity.feature @@ -1,120 +1,158 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Testing activity - @1: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- - Scenario: Get a activity +Feature: Activity Resources + + Background: Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + + @1: TEST FOR GET PROPERTIES & DEFINITION OF A ACTIVITY /----------------------------------------------------------------------- + Scenario Outline: Get an activity + Given I request "project//activity/" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" And the "definition" property type is "array" And the "properties" property type is "array" - And that "tas_title" is set to "Task 1" + And that "tas_title" is set to "" + Examples: + | project | activity | tas_title | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | Task 1 | + + @2: TEST FOR GET PROPERTIES ACTIVITY /--------------------------------------------------------- - Scenario: Get properties of activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=properties" + Scenario Outline: Get properties of activity + Given I request "project//activity/?filter=properties" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" And the response has not a "definition" property + Examples: + + | project | activity | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | + + @3: TEST FOR GET DEFINITION ACTIVITY /--------------------------------------------------------- - Scenario: Get definition of activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=definition" + Scenario Outline: Get definition of activity + Given I request "project//activity/?filter=definition" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" And the response has not a "properties" property + Examples: + + | project | activity | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | + + @4: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- - Scenario: Put propertie of activity - Given that I have a valid access_token - And PUT this data: - """ + Scenario Outline: Put property of activity + Given PUT this data: + """ { - "definition": [], - "properties": { - "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": null, - "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 Edit", - "tas_description": "", - "tas_def_title": "", - "tas_def_description": "", - "tas_def_message": "", - "tas_def_subject_message": "", - "tas_calendar": "" + + "definition": {}, + "properties": + { + "tas_title": "", + "tas_description": "", + "tas_priority_variable": "@@VAR_PRIORITY", + "tas_derivation_screen_tpl": "template.html", + "tas_start": , + "tas_assign_type" : "", + "tas_assign_variable": "@@USER_LOGGED", + "tas_group_variable": "@@GROUP_UID", + "tas_selfservice_timeout": "", + "tas_selfservice_time": "", + "tas_selfservice_time_unit" : "", + "tas_selfservice_trigger_uid" : "3229227245298e1c5191f95009451434", + "tas_transfer_fly": , + "tas_duration" : "", + "tas_timeunit" : "", + "tas_type_day": "", + "tas_calendar": "00000000000000000000000000000001", + "tas_type": "", + "tas_def_title": "Case Title", + "tas_def_description": "Case Descripction", + "tas_send_last_email": , + "tas_def_subject_message": "", + "tas_def_message_type": "template", + "tas_def_message": "", + "tas_def_message_template": "template.html" } } - """ - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + """ + And I request "project//activity/" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" + + + + Examples: + + | project | activity | tas_title | tas_description | tas_start | tas_assign_type | tas_selfservice_timeout | tas_selfservice_time | tas_selfservice_time_unit | tas_transfer_fly | tas_duration | tas_timeunit | tas_type_day | tas_type | tas_send_last_email | tas_def_subject_message | tas_def_message | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | update activity | update description | true | BALANCED | 0 | 0 | DAYS | true | 4 | DAYS | 1 | NORMAL | true | Email desde tarea | Contenido del email | @5: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- - Scenario: Get a activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Scenario Outline: Get a activity + Given I request "project//activity/" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - And that "tas_title" is set to "Task Edit" + And that "tas_title" is set to "" + Examples: - @6: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- - Scenario: Put propertie of activity - Given that I have a valid access_token - And PUT this data: - """ - { - "definition": [], - "properties": { - "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": null, - "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": "" - } - } - """ - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" - Then the response status code should be 200 + | project | activity | tas_title | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | Task Edit | + +@6: TEST FOR GET PROPERTIES & DEFINITION OF A ACTIVITY /----------------------------------------------------------------------- + Scenario Outline: Get an activity + Given I request "project//activity/" + Then the response status code should be And the response charset is "UTF-8" - And the type is "object" \ No newline at end of file + And the type is "object" + + + Examples: + + | project | activity | tas_title | error_code | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095845000 | Task 1 | 400 | + | 251815090529619a99a2bf4013294414 | | Task 1 | 404 | + | | 97192372152a5c78f04a794095806311 | Task 1 | 400 | + + +@7: TEST FOR GET PROPERTIES ACTIVITY /--------------------------------------------------------- + Scenario Outline: Get properties of activity + Given I request "project//activity/?filter=properties" + Then the response status code should be + And the response charset is "UTF-8" + And the type is "object" + + Examples: + + | project | activity | error_code | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095801000 | 400 | + | 251815090529619a99a2bf4013294414 | | 404 | + | | 97192372152a5c78f04a794095806311 | 400 | + +@8: TEST FOR GET DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario Outline: Get definition of activity + Given I request "project//activity/?filter=definition" + Then the response status code should be + And the response charset is "UTF-8" + And the type is "object" + + Examples: + + | project | activity | error_code | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095200000 | 400 | + | 251815090529619a99a2bf4013294414 | | 404 | + | | 97192372152a5c78f04a794095806311 | 400 | diff --git a/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature b/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature index 26ec23bd0..885a04cc6 100644 --- a/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature +++ b/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature @@ -1,21 +1,162 @@ -@ProcessMakerMichelangelo @RestAPI -Feature: Project Properties - Ad hoc Assignee Resources +@ProcessMakerMichelangelo @RestAPI @assignee +Feature: Project Properties -Adhoc Assignee Resources Background: Given that I have a valid access_token - Scenario: List AdHoc assignees of an activity - Given this scenario is not implemented yet - - Scenario: Get a list of available AdHoc users and groups to be assigned to an activity - Given this scenario is not implemented yet - - Scenario: Get a single AdHoc user or group of an activity - Given this scenario is not implemented yet - - Scenario: Assign an AdHoc user or group to an activity - Given this scenario is not implemented yet - - Scenario: Remove an AdHoc assignee from an activity - Given this scenario is not implemented yet + Scenario Outline: Get a list of available adhoc users and groups to be assigned to an activity + Given I request "project//activity//adhoc-available-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 82 | 35762872152cda4323207c6035916735 | group | + +Scenario Outline: Get a list of available adhoc users and groups to be assigned to an activity with filter + Given I request "project//activity//adhoc-available-assignee?filter=&start=&limit=" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | filter | start | limit | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 50 | 3 | 90268877852b7b4b9f134b1096735994 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 1 | 1 | 90268877852b7b4b9f134b1096735994 | group | + + Scenario Outline: Assign a adhoc user or group to an activity + Given POST this data: +""" +{ + "aas_uid": "", + "aas_type": "" +} +""" + And I request "project//activity//adhoc-assignee" + Then the response status code should be 201 + And the type is "object" + + Examples: + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 84643774552cda42dabb732033709262 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 95888918452cda41a2b5d11013819411 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 16698718252cda431814024050455569 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | group | + + + + Scenario Outline: List adhoc assignees of an activity + Given I request "project//activity//adhoc-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 7 | 10732248352cda434c43997043577116 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 5 | 90706007452cda42ed1c326093152317 | group | + + + Scenario Outline: After assignation - List adhoc assignees of an activity with filter + Given I request "project//activity//adhoc-assignee?filter=" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 1 record + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | records | aas_uid | aas_type | filter | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 1 | 84643774552cda42dabb732033709262 | user | emi | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 1 | 90706007452cda42ed1c326093152317 | group | dep | + + Scenario Outline: Get a single adhoc user or group of an activity + Given I request "project//activity//adhoc-assignee/" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And the "aas_uid" property equals "" + And the "aas_name" property equals "" + And the "aas_lastname" property equals "" + And the "aas_username" property equals "" + And the "aas_type" property equals "user" + + Examples: + | project | activity | aas_uid | aas_type | aas_name | aas_lastname | aas_username | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 95888918452cda41a2b5d11013819411 | user | Mike | Balisi | mike | + + Scenario Outline: Remove adhoc assignee from an activity + Given that I want to delete a resource with the key "aas_uid" stored in session array + And I request "project//activity//adhoc-assignee/" + Then the response status code should be 200 + + Examples: + | project | activity | aas_uid | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 84643774552cda42dabb732033709262 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 95888918452cda41a2b5d11013819411 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 16698718252cda431814024050455569 | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + 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 4 records + + + + Scenario Outline: List assignees of an activity with bad parameters + Given I request "project//activity//adhoc-assignee" + Then the response status code should be 400 + + + Examples: + | project | activity | + | 4224292655297723eb98691001100052 | 1234556 | + | 122134324 | 65496814252977243d57684076211485 | + | 345345345 | 345345345 | + | | | + + +Scenario Outline: Assign a user or group to an activity (Field validation) + Given POST this data: +""" +{ + "ass_uid": "", + "ass_type": "" +} +""" + And I request "project//activity//adhoc-assignee" + Then the response status code should be 400 + And the type is "object" + + # Asignando un user vacio + # Asignando un user inexistente + # Asignando un usuario como grupo + # Asignando un usuario con type inexistente + + Examples: + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | !@#$%^&*()_+=-[]{};:~, | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 15746307552d00a66624889076110382 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | department | diff --git a/features/backend/project_properties_step_resources/step.feature b/features/backend/project_properties_step_resources/step.feature index ce23727fc..e10e6113e 100644 --- a/features/backend/project_properties_step_resources/step.feature +++ b/features/backend/project_properties_step_resources/step.feature @@ -301,3 +301,150 @@ Feature: Project Properties - Step Resources And the type is "array" And the json data is an empty array + #TRIGGERS OF STEP "ASSIGN TASK" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers + # List assigned Triggers to a Step + Scenario: List Triggers assigned to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/triggers" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the json data is an empty array + + #POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger + # Assign a Trigger to a Step + Scenario: Assign "Trigger Demo1" to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And POST this data: + """ + { + "tri_uid": "81919273152cd636c665080083928728", + "st_type": "BEFORE_ASSIGNMENT", + "st_condition": "", + "st_position": 1 + } + """ + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + + #POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger + # Assign a Trigger to a Step + Scenario: Assign "Trigger Demo2" to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And POST this data: + """ + { + "tri_uid": "56359776552cd6378b38e47080912028", + "st_type": "BEFORE_ASSIGNMENT", + "st_condition": "", + "st_position": 2 + } + """ + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + + #PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid} + # Update a Trigger assignation of a Step + Scenario: Update "Trigger Demo1" assigned to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And PUT this data: + """ + { + "st_type": "BEFORE_ASSIGNMENT", + "st_condition": "@@FIELD2 == 2" + } + """ + And that I want to update a resource with the key "tgr1" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "st_condition" is set to "@@FIELD2 == 2" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers + # List assigned Triggers to a Step + Scenario: List Triggers assigned to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/triggers" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the "tri_uid" property in row 1 equals "56359776552cd6378b38e47080912028" + And the "tri_title" property in row 1 equals "Trigger Demo2" + And the "tri_description" property in row 1 equals "Description" + And the "st_type" property in row 1 equals "BEFORE_ASSIGNMENT" + And the "st_condition" property in row 1 equals "" + And the "st_position" property in row 1 equals "2" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/available-triggers/{type} + # List available Triggers to assign to a Step + Scenario: List available Triggers to assign to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/available-triggers/before-assignment" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the "tri_uid" property in row 0 equals "57401970252cd6393531551040242546" + And the "tri_title" property in row 0 equals "Trigger Demo3" + And the "tri_description" property in row 0 equals "Description" + And the "tri_type" property in row 0 equals "SCRIPT" + And the "tri_webbot" property in row 0 equals "" + And the "tri_param" property in row 0 equals "" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type} + # Get a single Trigger assigned to a Step + Scenario: Get a single Trigger "Trigger Demo1" assigned to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728/before-assignment" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "tri_uid" is set to "81919273152cd636c665080083928728" + And that "tri_title" is set to "Trigger Demo1" + And that "tri_description" is set to "Description" + And that "st_type" is set to "BEFORE_ASSIGNMENT" + And that "st_condition" is set to "@@FIELD2 == 2" + And that "st_position" is set to "1" + + #DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type} + # Remove a Trigger assignation of a Step + Scenario: Remove "Trigger Demo1" assigned to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And that I want to delete a resource with the key "tgr1" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728/before-assignment" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + #DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type} + # Remove a Trigger assignation of a Step + Scenario: Remove "Trigger Demo2" assigned to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And that I want to delete a resource with the key "tgr2" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/56359776552cd6378b38e47080912028/before-assignment" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers + # List assigned Triggers to a Step + Scenario: List Triggers assigned to Step "Assign Task" of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/triggers" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the json data is an empty array + diff --git a/features/backend/project_property_assignee_resources/activity_assignee.feature b/features/backend/project_property_assignee_resources/activity_assignee.feature index 767728660..aeda6ed74 100644 --- a/features/backend/project_property_assignee_resources/activity_assignee.feature +++ b/features/backend/project_property_assignee_resources/activity_assignee.feature @@ -4,18 +4,159 @@ Feature: Project Properties - Assignee Resources Background: Given that I have a valid access_token - Scenario: List assignees of an activity - Given this scenario is not implemented yet - - Scenario: Get a list of available users and groups to be assigned to an activity - Given this scenario is not implemented yet - - Scenario: Get a single user or group of an activity - Given this scenario is not implemented yet - - Scenario: Assign a user or group to an activity - Given this scenario is not implemented yet + Scenario Outline: Get a list of available users and groups to be assigned to an activity + Given I request "project//activity//available-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" - Scenario: Remove assignee from an activity - Given this scenario is not implemented yet + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 82 | 35762872152cda4323207c6035916735 | group | +Scenario Outline: Get a list of available users and groups to be assigned to an activity with filter + Given I request "project//activity//available-assignee?filter=&start=&limit=" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | filter | start | limit | records | aas_uid | aas_type| + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 50 | 3 | 90268877852b7b4b9f134b1096735994 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 1 | 1 | 90268877852b7b4b9f134b1096735994 | group | + + Scenario Outline: Assign a user or group to an activity + Given POST this data: +""" +{ + "aas_uid": "", + "aas_type": "" +} +""" + And I request "project//activity//assignee" + Then the response status code should be 201 + And the type is "object" + + Examples: + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 66386662252cda3f9a63226052377198 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 35762872152cda4323207c6035916735 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | group | + + + + + Scenario Outline: After assignation - List assignees of an activity + Given I request "project//activity//assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 7 | 135762872152cda4323207c6035916735 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 5 | 90706007452cda42ed1c326093152317 | group | + + +Scenario Outline: List assignees of an activity with filter + Given I request "project//activity//assignee?filter=" + 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 record + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | records | aas_uid | aas_type | filter | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 1 | 69191356252cda41acde328048794164 | user | oli | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 1 | 90706007452cda42ed1c326093152317 | group | dep | + + Scenario Outline: Get a single user or group of an activity + Given I request "project//activity//assignee/" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And the "aas_uid" property equals "" + And the "aas_name" property equals "" + And the "aas_lastname" property equals "" + And the "aas_username" property equals "" + And the "aas_type" property equals "" + + Examples: + | project | activity | aas_uid | aas_type | aas_name | aas_lastname | aas_username | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | user | Olivia | Austin | olivia | + + Scenario Outline: Remove assignee from an activity + Given that I want to delete a resource with the key "aas_uid" stored in session array + And I request "project//activity//assignee/" + Then the response status code should be 200 + + Examples: + | project | activity | aas_uid | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 66386662252cda3f9a63226052377198 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 35762872152cda4323207c6035916735 | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | + + + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" + 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 4 records + + Scenario Outline: List assignees of an activity with bad parameters + Given I request "project//activity//assignee" + Then the response status code should be 400 + + + Examples: + | project | activity | + | 4224292655297723eb98691001100052 | 1234556 | + | 122134324 | 65496814252977243d57684076211485 | + | 345345345 | 345345345 | + | | | + + +Scenario Outline: Assign a user or group to an activity (Field validation) + Given POST this data: +""" +{ + "ass_uid": "", + "ass_type": "" +} +""" + And I request "project//activity//assignee" + Then the response status code should be 400 + And the type is "object" + + # Asignando un user inexistente + # Asignando un usuario como grupo + # Asignando un usuario con type inexistente + Examples: + + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | !@#$%^&*()_+=-[]{};:~, | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | department | + \ No newline at end of file diff --git a/features/backend/project_resources/projects.feature b/features/backend/project_resources/projects.feature deleted file mode 100644 index 7b57a1141..000000000 --- a/features/backend/project_resources/projects.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ProcessMakerMichelangelo @RestAPI -Feature: Projects End Point. -Lists available projects/processes for an specific workspace - - Scenario: Get a list of projects - Given that I have a valid access_token - And I request "projects" - 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" - - diff --git a/features/backend/triggers_resources/triggers.feature b/features/backend/triggers_resources/triggers.feature index c137e9be4..4029987fd 100644 --- a/features/backend/triggers_resources/triggers.feature +++ b/features/backend/triggers_resources/triggers.feature @@ -1,55 +1,126 @@ @ProcessMakerMichelangelo @RestAPI Feature: Testing triggers - + + Background: + Given that I have a valid access_token + @1: TEST FOR POST TRIGGER /-------------------------------------------------------------------- - Scenario: Create a trigger - Given that I have a valid access_token - And POST this data: + Scenario Outline: Get a list of triggers of a project + Given I request "project//triggers" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has records + + Examples: + | project | records | + | 251815090529619a99a2bf4013294414 | 0 | + + @2: TEST FOR POST TRIGGER /-------------------------------------------------------------------- + Scenario Outline: Create a trigger + + Given POST this data: """ { - "tri_title": "nuevo trigger", - "tri_description": "descripcion" + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_webbot": "", + "tri_param": "PRIVATE" } """ - And I request "project/251815090529619a99a2bf4013294414/trigger" + And I request "project//trigger" Then the response status code should be 201 - And store "tri_uid" in session array + And store "tri_uid" in session array as variable "tri_uid_" + Examples: - @2: TEST FOR PUT TRIGGER /----------------------------------------------------------------------- - Scenario: Update a trigger - Given that I have a valid access_token - And PUT this data: + | project | tri_number | tri_title | tri_description |tri_type | tri_webbot | + | 251815090529619a99a2bf4013294414 | 1 | nuevo trigger 2 | descripcion |SCRIPT | @@user1 = @@USER_LOGGED; \n $x = rand();| + | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | descripcion de otro trigger |SCRIPT | //Trigger with comments | + + + @3: TEST FOR PUT TRIGGER /----------------------------------------------------------------------- + Scenario Outline: Update a trigger + + Given PUT this data: """ { - "tri_title": "trigger editado", - "tri_description": "descripcion editada" + "tri_title": "", + "tri_description": "" } """ - And that I want to update a resource with the key "tri_uid" stored in session array - And I request "project/251815090529619a99a2bf4013294414/trigger" + And that I want to update a resource with the key "tri_uid" stored in session array as variable "tri_uid_" + And I request "project//trigger" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" + Examples: - @3: TEST FOR GET TRIGGER /----------------------------------------------------------------------- - Scenario: Get a trigger - Given that I have a valid access_token - And that I want to get a resource with the key "tri_uid" stored in session array - And I request "project/251815090529619a99a2bf4013294414/trigger" + | project | tri_number | tri_title | tri_description | + | 251815090529619a99a2bf4013294414 | 1 | trigger editado 2 | descripcion editada | + | 251815090529619a99a2bf4013294414 | 2 | otro trigger editado 2 | descripcion de otro trigger editado | + + + @4: TEST FOR GET TRIGGER /----------------------------------------------------------------------- + Scenario Outline: Get a trigger + + Given that I want to get a resource with the key "tri_uid" stored in session array as variable "tri_uid_" + And I request "project//trigger" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - And that "tri_title" is set to "trigger editado" - And that "tri_description" is set to "descripcion editada" + And that "tri_title" is set to "" + And that "tri_description" is set to "" + + Examples: + + | project | tri_number | tri_title | tri_description | + | 251815090529619a99a2bf4013294414 | 1 | trigger editado 2 | descripcion editada | + | 251815090529619a99a2bf4013294414 | 2 | otro trigger editado 2 | descripcion de otro trigger editado | - @4: TEST FOR DELETE TRIGGER /----------------------------------------------------------------------- - Scenario: Get a trigger - Given that I have a valid access_token - And that I want to delete a resource with the key "tri_uid" stored in session array - And I request "project/251815090529619a99a2bf4013294414/trigger" + + @5: TEST FOR DELETE TRIGGER /----------------------------------------------------------------------- + Scenario Outline: Get a trigger + + Given that I want to delete a resource with the key "tri_uid" stored in session array as variable "tri_uid_" + And I request "project//trigger" Then the response status code should be 200 And the response charset is "UTF-8" - And the type is "object" \ No newline at end of file + And the type is "object" + + Examples: + + | project | tri_number | + | 251815090529619a99a2bf4013294414 | 1 | + | 251815090529619a99a2bf4013294414 | 2 | + + + + + @6: TEST FOR POST TRIGGER /-------------------------------------------------------------------- + Scenario Outline: Create a trigger + + Given POST this data: + """ + { + "tri_title": "", + "tri_description": "" + "tri_type": "", + "tri_webbot": "", + "tri_param": "PRIVATE" + } + """ + And I request "project//trigger" + Then the response status code should be 400 + + Examples: + + | project | tri_title | tri_description |tri_type | + | 251815090529619a99a2bf4013294414 | Especial !@#$%^&*(){[/½‘€¤@ | Trigger con caracteres especiales |SCRIPT | + | 251815090529619a99a2bf4013294414 | | Trigger con nombre en blanco |SCRIPT | + | 251815090529619a99a2bf4013294414 | Trigger 3 | Descripcion con caracteres especiales !@#$%^&*(){[/½‘€¤@ |SCRIPT | + | 251815090529619a99a2bf4013294414 | Trigger 4 | descripcion |SCRI123%@$| diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index faa40a073..44e8130ae 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1100,13 +1100,75 @@ class RestContext extends BehatContext public function theResponseHasRecords($quantityOfRecords) { $data = $this->_data; - if (!is_array($data)) { - throw new Exception("the Response data is not an array!\n\n" ); - } - $currentRecordsCount=count($data); - if($currentRecordsCount!=$quantityOfRecords){ + if (!is_array($data)) { + throw new Exception("the Response data is not an array!\n\n" ); + } + $currentRecordsCount=count($data); + if($currentRecordsCount!=$quantityOfRecords){ throw new Exception('Records quantity not match ' . $quantityOfRecords . ' (actual: ' . $currentRecordsCount . ")\n\n"); - } + } } + /** + * @Given /^that I want to update a resource with the key "([^"]*)" stored in session array as variable "([^"]*)"$/ + */ + public function thatIWantToUpdateAResourceWithTheKeyStoredInSessionArrayAsVariable($varName, $sessionVarName) + { + if (file_exists("session.data")) { + $sessionData = json_decode(file_get_contents("session.data")); + } else { + $sessionData = array(); + } + if (!isset($sessionData->$sessionVarName) ) { + $varValue = ''; + } else { + $varValue = $sessionData->$sessionVarName; + } + + $this->_restUpdateQueryStringSuffix = "/" . $varValue; + $this->_restObjectMethod = 'put'; + } + + /** + * @Given /^that I want to get a resource with the key "([^"]*)" stored in session array as variable "([^"]*)"$/ + */ + public function thatIWantToGetAResourceWithTheKeyStoredInSessionArrayAsVariable($varName, $sessionVarName) + { + if (file_exists("session.data")) { + $sessionData = json_decode(file_get_contents("session.data")); + } else { + $sessionData = array(); + } + if (!isset($sessionData->$sessionVarName) ) { + $varValue = ''; + } else { + $varValue = $sessionData->$sessionVarName; + } + + $this->_restGetQueryStringSuffix = "/" . $varValue; + $this->_restObjectMethod = 'get'; + } + + /** + * @Given /^that I want to delete a resource with the key "([^"]*)" stored in session array as variable "([^"]*)"$/ + */ + public function thatIWantToDeleteAResourceWithTheKeyStoredInSessionArrayAsVariable($varName, $sessionVarName) + { + if (file_exists("session.data")) { + $sessionData = json_decode(file_get_contents("session.data")); + } else { + $sessionData = array(); + } + if (!isset($sessionData->$sessionVarName) ) { + $varValue = ''; + } else { + $varValue = $sessionData->$sessionVarName; + } + + $this->_restDeleteQueryStringSuffix = "/" . $varValue; + $this->_restObjectMethod = 'delete'; + } + + + } diff --git a/features/test/test_scenario_outline.feature b/features/test/test_scenario_outline.feature new file mode 100644 index 000000000..fad79a619 --- /dev/null +++ b/features/test/test_scenario_outline.feature @@ -0,0 +1,23 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Project Properties - Assignee Resources + + Background: + Given that I have a valid access_token + +Scenario Outline: Get a list of available users and groups to be assigned to an activity with filter + Given that I want to make a new "test" + And his "name" is "" + And his "lastname" is "" + When I request "test" + Then the response status code should be 200 + And the response should be JSON + #And that "id" is set to "" + And the "id" property equals "" + + Examples: + | name | lastname | age | id | + | erik | sample1 | 7 | 2 | + | wendy | sample2 | 15 | 3 | + | wendy2 | sample22 | 15 | 4 | + | wendy3 | sample23 | 15 | 5 | + diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index e5f027af3..9645c7999 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -60,7 +60,7 @@ class Bootstrap return false; } - public function registerClass($classname, $includeFile) + public static function registerClass($classname, $includeFile) { BootStrap::$includeClassPaths[strtolower($classname)] = $includeFile; return; @@ -120,7 +120,7 @@ class Bootstrap } // default configuration - $config = array('debug' => 0, 'debug_sql' => 0, 'debug_time' => 0, 'debug_calendar' => 0, 'wsdl_cache' => 1, 'memory_limit' => "256M", 'time_zone' => 'America/New_York', 'memcached' => 0, 'memcached_server' => '', 'default_skin' => 'neoclassic', 'default_lang' => 'en', 'proxy_host' => '', 'proxy_port' => '', 'proxy_user' => '', 'proxy_pass' => '' , 'size_log_file' => 5000000 , 'number_log_file' => 5); + $config = array('debug' => 0, 'debug_sql' => 0, 'debug_time' => 0, 'debug_calendar' => 0, 'wsdl_cache' => 1, 'memory_limit' => "256M", 'time_zone' => 'America/New_York', 'memcached' => 0, 'memcached_server' => '', 'default_skin' => 'neoclassic', 'default_lang' => 'en', 'proxy_host' => '', 'proxy_port' => '', 'proxy_user' => '', 'proxy_pass' => '' , 'size_log_file' => 5000000 , 'number_log_file' => 5, 'ie_cookie_lifetime' => 1); // read the global env.ini configuration file if ($readGlobalIniFile && ($globalConf = @parse_ini_file($globalIniFile)) !== false) { @@ -3088,6 +3088,14 @@ class Bootstrap "$>php composer.phar install" ); } + } + + if (! file_exists(PATH_TRUNK . 'vendor' . PATH_SEP . "autoload.php")) { + throw new Exception( + "ERROR: Problems with Verdors!" . PHP_EOL . + "Please execute the following command to repare vendors:" .PHP_EOL.PHP_EOL. + "$>php composer.phar update" + ); } require_once PATH_TRUNK . 'vendor' . PATH_SEP . "autoload.php"; diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 776fe8f7d..d08f57f43 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -2748,7 +2748,11 @@ class XmlForm_Field_Link extends XmlForm_Field $html = "htmlentities($link, ENT_QUOTES, "utf-8") . "\""; $html = $html . " id=\"form[$id]\" name=\"form[$id]\" pm:field=\"pm:field\""; - $html = $html . (($this->onclick)? " onclick=\"" . htmlentities($onclick, ENT_QUOTES, "utf-8") . "\"" : null); + if ((strrpos($_SERVER['HTTP_USER_AGENT'], "Chrome") === false ? false : true) && trim($this->htmlentities($link, ENT_QUOTES, "utf-8")) === "#") { + $html = $html . (($this->onclick) ? " onclick=\"" . htmlentities($onclick, ENT_QUOTES, "utf-8") . " return false;\"" : " onclick=\" return false;\""); + } else { + $html = $html . (($this->onclick) ? " onclick=\"" . htmlentities($onclick, ENT_QUOTES, "utf-8") . "\"" : null); + } $html = $html . (($this->target)? " target=\"" . htmlentities($target, ENT_QUOTES, "utf-8") . "\"" : null); switch ($owner->type) { diff --git a/workflow/engine/bin/cron.php b/workflow/engine/bin/cron.php index 87edca6a0..ec985c7a2 100755 --- a/workflow/engine/bin/cron.php +++ b/workflow/engine/bin/cron.php @@ -62,6 +62,7 @@ if (file_exists(PATH_DATA . "cron")) { for ($i = 1; $i <= count($argv) - 1; $i++) { if (strpos($argv[$i], "+force") !== false) { $force = true; + unset($argv[$i]); break; } } diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index f8c5f017a..9045f07d0 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -27,9 +27,7 @@ */ // // It works with the table CONFIGURATION in a WF dataBase -// // Copyright (C) 2007 COLOSA -// // License: LGPL, see LICENSE //////////////////////////////////////////////////// @@ -556,7 +554,6 @@ class Configurations // extends Configuration $creationDateMask = str_replace(' \\d\\e ', ' [xx] ', $creationDateMask); } - for ($i = 0; $i < strlen($creationDateMask); $i++) { if ($creationDateMask[$i] != ' ' && isset($maskTime[$creationDateMask[$i]])) { $newCreation .= $maskTime[$creationDateMask[$i]]; @@ -566,11 +563,19 @@ class Configurations // extends Configuration } $langLocate = SYS_LANG; + + require_once 'model/Language.php'; + $language = new language(); + $lanLocation = $language->findLocationByLanId(SYS_LANG); + $location = isset($lanLocation['LAN_LOCATION']) ? $lanLocation['LAN_LOCATION'] : ''; + if (G::toLower(PHP_OS) == 'linux' || G::toLower(PHP_OS) == 'darwin') { if (SYS_LANG == 'es') { $langLocate = 'es_ES'; } else if (strlen(SYS_LANG) > 2) { $langLocate = str_replace('-', '_', SYS_LANG); + } else if ($location != '') { + $langLocate = SYS_LANG.'_'.$location; } else { $langLocate = 'en_US'; } diff --git a/workflow/engine/classes/class.patch.php b/workflow/engine/classes/class.patch.php index ec10a6099..1f8eab0e6 100644 --- a/workflow/engine/classes/class.patch.php +++ b/workflow/engine/classes/class.patch.php @@ -2,7 +2,6 @@ G::LoadClass("Task"); G::LoadClass("TaskUser"); -G::LoadClass("System"); /** * class, helping to set some not desirable settings but necesary @@ -26,6 +25,10 @@ class p11835 extends patch */ static public function isApplicable() { + if (! class_exists('System')) { + G::LoadClass("System"); + } + patch::$isPathchable = false; $con = Propel::getConnection("workflow"); $stmt = $con->prepareStatement("describe TASK;"); diff --git a/workflow/engine/classes/model/Language.php b/workflow/engine/classes/model/Language.php index 942574f2d..866d92640 100755 --- a/workflow/engine/classes/model/Language.php +++ b/workflow/engine/classes/model/Language.php @@ -22,11 +22,9 @@ * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ //require_once 'classes/model/om/BaseLanguage.php'; - //require_once 'classes/model/Content.php'; //require_once 'classes/model/IsoCountry.php'; //require_once 'classes/model/Translation.php'; @@ -34,12 +32,11 @@ /** * Skeleton subclass for representing a row from the 'LANGUAGE' table. * - * - * * You should add additional methods to this class to meet the * application requirements. This class will only be generated as * long as it does not already exist in the output directory. * + * * @package workflow.engine.classes.model */ class Language extends BaseLanguage @@ -133,6 +130,16 @@ class Language extends BaseLanguage return $oDataset->getRow(); } + public function findLocationByLanId ($LAN_ID) + { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( LanguagePeer::LAN_LOCATION ); + $oCriteria->add( LanguagePeer::LAN_ID, $LAN_ID, Criteria::LIKE ); + $oDataset = LanguagePeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + return $oDataset->getRow(); + } /* * Import a language file * diff --git a/workflow/engine/classes/model/om/BaseLanguage.php b/workflow/engine/classes/model/om/BaseLanguage.php index e2ec33125..1adf216c9 100755 --- a/workflow/engine/classes/model/om/BaseLanguage.php +++ b/workflow/engine/classes/model/om/BaseLanguage.php @@ -1,19 +1,13 @@ lan_id; } + /** + * Get the [lan_location] column value. + * + * @return string + */ + public function getLanLocation() + { + + return $this->lan_location; + } + /** * Get the [lan_name] column value. * @@ -182,6 +193,28 @@ abstract class BaseLanguage extends BaseObject implements Persistent } // setLanId() + /** + * Set the value of [lan_location] column. + * + * @param string $v new value + * @return void + */ + public function setLanLocation($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->lan_location !== $v || $v === '') { + $this->lan_location = $v; + $this->modifiedColumns[] = LanguagePeer::LAN_LOCATION; + } + + } // setLanLocation() + /** * Set the value of [lan_name] column. * @@ -333,17 +366,19 @@ abstract class BaseLanguage extends BaseObject implements Persistent $this->lan_id = $rs->getString($startcol + 0); - $this->lan_name = $rs->getString($startcol + 1); + $this->lan_location = $rs->getString($startcol + 1); - $this->lan_native_name = $rs->getString($startcol + 2); + $this->lan_name = $rs->getString($startcol + 2); - $this->lan_direction = $rs->getString($startcol + 3); + $this->lan_native_name = $rs->getString($startcol + 3); - $this->lan_weight = $rs->getInt($startcol + 4); + $this->lan_direction = $rs->getString($startcol + 4); - $this->lan_enabled = $rs->getString($startcol + 5); + $this->lan_weight = $rs->getInt($startcol + 5); - $this->lan_calendar = $rs->getString($startcol + 6); + $this->lan_enabled = $rs->getString($startcol + 6); + + $this->lan_calendar = $rs->getString($startcol + 7); $this->resetModified(); @@ -558,21 +593,24 @@ abstract class BaseLanguage extends BaseObject implements Persistent return $this->getLanId(); break; case 1: - return $this->getLanName(); + return $this->getLanLocation(); break; case 2: - return $this->getLanNativeName(); + return $this->getLanName(); break; case 3: - return $this->getLanDirection(); + return $this->getLanNativeName(); break; case 4: - return $this->getLanWeight(); + return $this->getLanDirection(); break; case 5: - return $this->getLanEnabled(); + return $this->getLanWeight(); break; case 6: + return $this->getLanEnabled(); + break; + case 7: return $this->getLanCalendar(); break; default: @@ -596,12 +634,13 @@ abstract class BaseLanguage extends BaseObject implements Persistent $keys = LanguagePeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getLanId(), - $keys[1] => $this->getLanName(), - $keys[2] => $this->getLanNativeName(), - $keys[3] => $this->getLanDirection(), - $keys[4] => $this->getLanWeight(), - $keys[5] => $this->getLanEnabled(), - $keys[6] => $this->getLanCalendar(), + $keys[1] => $this->getLanLocation(), + $keys[2] => $this->getLanName(), + $keys[3] => $this->getLanNativeName(), + $keys[4] => $this->getLanDirection(), + $keys[5] => $this->getLanWeight(), + $keys[6] => $this->getLanEnabled(), + $keys[7] => $this->getLanCalendar(), ); return $result; } @@ -637,21 +676,24 @@ abstract class BaseLanguage extends BaseObject implements Persistent $this->setLanId($value); break; case 1: - $this->setLanName($value); + $this->setLanLocation($value); break; case 2: - $this->setLanNativeName($value); + $this->setLanName($value); break; case 3: - $this->setLanDirection($value); + $this->setLanNativeName($value); break; case 4: - $this->setLanWeight($value); + $this->setLanDirection($value); break; case 5: - $this->setLanEnabled($value); + $this->setLanWeight($value); break; case 6: + $this->setLanEnabled($value); + break; + case 7: $this->setLanCalendar($value); break; } // switch() @@ -682,29 +724,32 @@ abstract class BaseLanguage extends BaseObject implements Persistent } if (array_key_exists($keys[1], $arr)) { - $this->setLanName($arr[$keys[1]]); + $this->setLanLocation($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { - $this->setLanNativeName($arr[$keys[2]]); + $this->setLanName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { - $this->setLanDirection($arr[$keys[3]]); + $this->setLanNativeName($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { - $this->setLanWeight($arr[$keys[4]]); + $this->setLanDirection($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { - $this->setLanEnabled($arr[$keys[5]]); + $this->setLanWeight($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { - $this->setLanCalendar($arr[$keys[6]]); + $this->setLanEnabled($arr[$keys[6]]); } + if (array_key_exists($keys[7], $arr)) { + $this->setLanCalendar($arr[$keys[7]]); + } } /** @@ -720,6 +765,10 @@ abstract class BaseLanguage extends BaseObject implements Persistent $criteria->add(LanguagePeer::LAN_ID, $this->lan_id); } + if ($this->isColumnModified(LanguagePeer::LAN_LOCATION)) { + $criteria->add(LanguagePeer::LAN_ID, $this->lan_location); + } + if ($this->isColumnModified(LanguagePeer::LAN_NAME)) { $criteria->add(LanguagePeer::LAN_NAME, $this->lan_name); } @@ -798,6 +847,8 @@ abstract class BaseLanguage extends BaseObject implements Persistent public function copyInto($copyObj, $deepCopy = false) { + $copyObj->setLanLocation($this->lan_location); + $copyObj->setLanName($this->lan_name); $copyObj->setLanNativeName($this->lan_native_name); @@ -845,6 +896,7 @@ abstract class BaseLanguage extends BaseObject implements Persistent * same instance for all member of this class. The method could therefore * be static, but this would prevent one from overriding the behavior. * + * * @return LanguagePeer */ public function getPeer() diff --git a/workflow/engine/classes/model/om/BaseLanguagePeer.php b/workflow/engine/classes/model/om/BaseLanguagePeer.php index 460414a16..01d0ccaa7 100755 --- a/workflow/engine/classes/model/om/BaseLanguagePeer.php +++ b/workflow/engine/classes/model/om/BaseLanguagePeer.php @@ -34,6 +34,9 @@ abstract class BaseLanguagePeer /** the column name for the LAN_ID field */ const LAN_ID = 'LANGUAGE.LAN_ID'; + /** the column name for the LAN_LOCATION field */ + const LAN_LOCATION = 'LANGUAGE.LAN_LOCATION'; + /** the column name for the LAN_NAME field */ const LAN_NAME = 'LANGUAGE.LAN_NAME'; @@ -63,10 +66,10 @@ abstract class BaseLanguagePeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('LanId', 'LanName', 'LanNativeName', 'LanDirection', 'LanWeight', 'LanEnabled', 'LanCalendar', ), - BasePeer::TYPE_COLNAME => array (LanguagePeer::LAN_ID, LanguagePeer::LAN_NAME, LanguagePeer::LAN_NATIVE_NAME, LanguagePeer::LAN_DIRECTION, LanguagePeer::LAN_WEIGHT, LanguagePeer::LAN_ENABLED, LanguagePeer::LAN_CALENDAR, ), - BasePeer::TYPE_FIELDNAME => array ('LAN_ID', 'LAN_NAME', 'LAN_NATIVE_NAME', 'LAN_DIRECTION', 'LAN_WEIGHT', 'LAN_ENABLED', 'LAN_CALENDAR', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + BasePeer::TYPE_PHPNAME => array ('LanId', 'LanLocation', 'LanName', 'LanNativeName', 'LanDirection', 'LanWeight', 'LanEnabled', 'LanCalendar', ), + BasePeer::TYPE_COLNAME => array (LanguagePeer::LAN_ID, LanguagePeer::LAN_LOCATION, LanguagePeer::LAN_NAME, LanguagePeer::LAN_NATIVE_NAME, LanguagePeer::LAN_DIRECTION, LanguagePeer::LAN_WEIGHT, LanguagePeer::LAN_ENABLED, LanguagePeer::LAN_CALENDAR, ), + BasePeer::TYPE_FIELDNAME => array ('LAN_ID', 'LAN_LOCATION', 'LAN_NAME', 'LAN_NATIVE_NAME', 'LAN_DIRECTION', 'LAN_WEIGHT', 'LAN_ENABLED', 'LAN_CALENDAR', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,) ); /** @@ -76,10 +79,10 @@ abstract class BaseLanguagePeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('LanId' => 0, 'LanName' => 1, 'LanNativeName' => 2, 'LanDirection' => 3, 'LanWeight' => 4, 'LanEnabled' => 5, 'LanCalendar' => 6, ), - BasePeer::TYPE_COLNAME => array (LanguagePeer::LAN_ID => 0, LanguagePeer::LAN_NAME => 1, LanguagePeer::LAN_NATIVE_NAME => 2, LanguagePeer::LAN_DIRECTION => 3, LanguagePeer::LAN_WEIGHT => 4, LanguagePeer::LAN_ENABLED => 5, LanguagePeer::LAN_CALENDAR => 6, ), - BasePeer::TYPE_FIELDNAME => array ('LAN_ID' => 0, 'LAN_NAME' => 1, 'LAN_NATIVE_NAME' => 2, 'LAN_DIRECTION' => 3, 'LAN_WEIGHT' => 4, 'LAN_ENABLED' => 5, 'LAN_CALENDAR' => 6, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + BasePeer::TYPE_PHPNAME => array ('LanId' => 0, 'LanLocation' => 1, 'LanName' => 2, 'LanNativeName' => 3, 'LanDirection' => 4, 'LanWeight' => 5, 'LanEnabled' => 6, 'LanCalendar' => 7, ), + BasePeer::TYPE_COLNAME => array (LanguagePeer::LAN_ID => 0, LanguagePeer::LAN_LOCATION => 1, LanguagePeer::LAN_NAME => 2, LanguagePeer::LAN_NATIVE_NAME => 3, LanguagePeer::LAN_DIRECTION => 4, LanguagePeer::LAN_WEIGHT => 5, LanguagePeer::LAN_ENABLED => 6, LanguagePeer::LAN_CALENDAR => 7, ), + BasePeer::TYPE_FIELDNAME => array ('LAN_ID' => 0, 'LAN_LOCATION' => 1, 'LAN_NAME' => 2, 'LAN_NATIVE_NAME' => 3, 'LAN_DIRECTION' => 4, 'LAN_WEIGHT' => 5, 'LAN_ENABLED' => 6, 'LAN_CALENDAR' => 7, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7,) ); /** @@ -182,6 +185,8 @@ abstract class BaseLanguagePeer $criteria->addSelectColumn(LanguagePeer::LAN_ID); + $criteria->addSelectColumn(LanguagePeer::LAN_LOCATION); + $criteria->addSelectColumn(LanguagePeer::LAN_NAME); $criteria->addSelectColumn(LanguagePeer::LAN_NATIVE_NAME); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 746f7a5b5..b11a50a30 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -698,6 +698,7 @@ + diff --git a/workflow/engine/data/mssql/insert.sql b/workflow/engine/data/mssql/insert.sql index 6e68e0cab..99b0195f2 100755 --- a/workflow/engine/data/mssql/insert.sql +++ b/workflow/engine/data/mssql/insert.sql @@ -25,143 +25,143 @@ SELECT 'PER_NAME','','00000000000000000000000000000003','en','Users' UNION ALL SELECT 'PER_NAME','','00000000000000000000000000000001','en','Login' UNION ALL SELECT 'PER_NAME','','00000000000000000000000000000002','en','Setup'; -INSERT INTO [LANGUAGE] ([LAN_ID],[LAN_NAME],[LAN_NATIVE_NAME],[LAN_DIRECTION],[LAN_WEIGHT],[LAN_ENABLED],[LAN_CALENDAR]) -SELECT 'aa','Afar','','L','0','0','GREGORIAN' UNION ALL -SELECT 'ab','Abkhazian','','L','1','0','GREGORIAN' UNION ALL -SELECT 'af','Afrikaans','','L','2','0','GREGORIAN' UNION ALL -SELECT 'am','Amharic','','L','3','0','GREGORIAN' UNION ALL -SELECT 'ar','Arabic','','L','4','0','GREGORIAN' UNION ALL -SELECT 'as','Assamese','','L','5','0','GREGORIAN' UNION ALL -SELECT 'ay','Aymara','','L','6','0','GREGORIAN' UNION ALL -SELECT 'az','Azerbaijani','','L','7','0','GREGORIAN' UNION ALL -SELECT 'ba','Bashkir','','L','8','0','GREGORIAN' UNION ALL -SELECT 'be','Byelorussian','','L','9','0','GREGORIAN' UNION ALL -SELECT 'bg','Bulgarian','','L','10','0','GREGORIAN' UNION ALL -SELECT 'bh','Bihari','','L','11','0','GREGORIAN' UNION ALL -SELECT 'bi','Bislama','','L','12','0','GREGORIAN' UNION ALL -SELECT 'bn','Bengali','','L','13','0','GREGORIAN' UNION ALL -SELECT 'bo','Tibetan','','L','14','0','GREGORIAN' UNION ALL -SELECT 'br','Breton','','L','15','0','GREGORIAN' UNION ALL -SELECT 'ca','Catalan','','L','16','0','GREGORIAN' UNION ALL -SELECT 'co','Corsican','','L','17','0','GREGORIAN' UNION ALL -SELECT 'cs','Czech','','L','18','0','GREGORIAN' UNION ALL -SELECT 'cy','Welsh','','L','19','0','GREGORIAN' UNION ALL -SELECT 'da','Danish','','L','20','0','GREGORIAN' UNION ALL -SELECT 'de','German','','L','21','0','GREGORIAN' UNION ALL -SELECT 'dz','Bhutani','','L','22','0','GREGORIAN' UNION ALL -SELECT 'el','Greek','','L','23','0','GREGORIAN' UNION ALL -SELECT 'en','English','','L','24','1','GREGORIAN' UNION ALL -SELECT 'eo','Esperanto','','L','25','0','GREGORIAN' UNION ALL -SELECT 'es','Spanish','','L','26','0','GREGORIAN' UNION ALL -SELECT 'et','Estonian','','L','27','0','GREGORIAN' UNION ALL -SELECT 'eu','Basque','','L','28','0','GREGORIAN' UNION ALL -SELECT 'fa','Persian','','R','29','0','PERSIAN' UNION ALL -SELECT 'fi','Finnish','','L','30','0','GREGORIAN' UNION ALL -SELECT 'fj','Fiji','','L','31','0','GREGORIAN' UNION ALL -SELECT 'fo','Faeroese','','L','32','0','GREGORIAN' UNION ALL -SELECT 'fr','French','','L','33','0','GREGORIAN' UNION ALL -SELECT 'fy','Frisian','','L','34','0','GREGORIAN' UNION ALL -SELECT 'ga','Irish','','L','35','0','GREGORIAN' UNION ALL -SELECT 'gd','Gaelic','','L','36','0','GREGORIAN' UNION ALL -SELECT 'gl','Galician','','L','37','0','GREGORIAN' UNION ALL -SELECT 'gn','Guarani','','L','38','0','GREGORIAN' UNION ALL -SELECT 'gu','Gujarati','','L','39','0','GREGORIAN' UNION ALL -SELECT 'ha','Hausa','','L','40','0','GREGORIAN' UNION ALL -SELECT 'hi','Hindi','','L','41','0','GREGORIAN' UNION ALL -SELECT 'hr','Croatian','','L','42','0','GREGORIAN' UNION ALL -SELECT 'hu','Hungarian','','L','43','0','GREGORIAN' UNION ALL -SELECT 'hy','Armenian','','L','44','0','GREGORIAN' UNION ALL -SELECT 'ia','Interlingua','','L','45','0','GREGORIAN' UNION ALL -SELECT 'ie','Interlingue','','L','46','0','GREGORIAN' UNION ALL -SELECT 'ik','Inupiak','','L','47','0','GREGORIAN' UNION ALL -SELECT 'in','Indonesian','','L','48','0','GREGORIAN' UNION ALL -SELECT 'is','Icelandic','','L','49','0','GREGORIAN' UNION ALL -SELECT 'it','Italian','','L','50','0','GREGORIAN' UNION ALL -SELECT 'iw','Hebrew','','R','51','0','GREGORIAN' UNION ALL -SELECT 'ja','Japanese','','L','52','0','GREGORIAN' UNION ALL -SELECT 'ji','Yiddish','','L','53','0','GREGORIAN' UNION ALL -SELECT 'jw','Javanese','','L','54','0','GREGORIAN' UNION ALL -SELECT 'ka','Georgian','','L','55','0','GREGORIAN' UNION ALL -SELECT 'kk','Kazakh','','L','56','0','GREGORIAN' UNION ALL -SELECT 'kl','Greenlandic','','L','57','0','GREGORIAN' UNION ALL -SELECT 'km','Cambodian','','L','58','0','GREGORIAN' UNION ALL -SELECT 'kn','Kannada','','L','59','0','GREGORIAN' UNION ALL -SELECT 'ko','Korean','','L','60','0','GREGORIAN' UNION ALL -SELECT 'ks','Kashmiri','','L','61','0','GREGORIAN' UNION ALL -SELECT 'ku','Kurdish','','L','62','0','GREGORIAN' UNION ALL -SELECT 'ky','Kirghiz','','L','63','0','GREGORIAN' UNION ALL -SELECT 'la','Latin','','L','64','0','GREGORIAN' UNION ALL -SELECT 'ln','Lingala','','L','65','0','GREGORIAN' UNION ALL -SELECT 'lo','Laothian','','L','66','0','GREGORIAN' UNION ALL -SELECT 'lt','Lithuanian','','L','67','0','GREGORIAN' UNION ALL -SELECT 'lv','Latvian','','L','68','0','GREGORIAN' UNION ALL -SELECT 'mg','Malagasy','','L','69','0','GREGORIAN' UNION ALL -SELECT 'mi','Maori','','L','70','0','GREGORIAN' UNION ALL -SELECT 'mk','Macedonian','','L','71','0','GREGORIAN' UNION ALL -SELECT 'ml','Malayalam','','L','72','0','GREGORIAN' UNION ALL -SELECT 'mn','Mongolian','','L','73','0','GREGORIAN' UNION ALL -SELECT 'mo','Moldavian','','L','74','0','GREGORIAN' UNION ALL -SELECT 'mr','Marathi','','L','75','0','GREGORIAN' UNION ALL -SELECT 'ms','Malay','','L','76','0','GREGORIAN' UNION ALL -SELECT 'mt','Maltese','','L','77','0','GREGORIAN' UNION ALL -SELECT 'my','Burmese','','L','78','0','GREGORIAN' UNION ALL -SELECT 'na','Nauru','','L','79','0','GREGORIAN' UNION ALL -SELECT 'ne','Nepali','','L','80','0','GREGORIAN' UNION ALL -SELECT 'nl','Dutch','','L','81','0','GREGORIAN' UNION ALL -SELECT 'no','Norwegian','','L','82','0','GREGORIAN' UNION ALL -SELECT 'oc','Occitan','','L','83','0','GREGORIAN' UNION ALL -SELECT 'om','Oromo','','L','84','0','GREGORIAN' UNION ALL -SELECT 'or','Oriya','','L','85','0','GREGORIAN' UNION ALL -SELECT 'pa','Punjabi','','L','86','0','GREGORIAN' UNION ALL -SELECT 'pl','Polish','','L','87','0','GREGORIAN' UNION ALL -SELECT 'ps','Pashto','','L','88','0','GREGORIAN' UNION ALL -SELECT 'pt','Portuguese','','L','89','0','GREGORIAN' UNION ALL -SELECT 'qu','Quechua','','L','90','0','GREGORIAN' UNION ALL -SELECT 'rm','Rhaeto-Romance','','L','91','0','GREGORIAN' UNION ALL -SELECT 'rn','Kirundi','','L','92','0','GREGORIAN' UNION ALL -SELECT 'ro','Romanian','','L','93','0','GREGORIAN' UNION ALL -SELECT 'ru','Russian','','L','94','0','GREGORIAN' UNION ALL -SELECT 'rw','Kinyarwanda','','L','95','0','GREGORIAN' UNION ALL -SELECT 'sa','Sanskrit','','L','96','0','GREGORIAN' UNION ALL -SELECT 'sd','Sindhi','','L','97','0','GREGORIAN' UNION ALL -SELECT 'sg','Sangro','','L','98','0','GREGORIAN' UNION ALL -SELECT 'sh','Serbo-Croatian','','L','99','0','GREGORIAN' UNION ALL -SELECT 'si','Singhalese','','L','100','0','GREGORIAN' UNION ALL -SELECT 'sk','Slovak','','L','101','0','GREGORIAN' UNION ALL -SELECT 'sl','Slovenian','','L','102','0','GREGORIAN' UNION ALL -SELECT 'sm','Samoan','','L','103','0','GREGORIAN' UNION ALL -SELECT 'sn','Shona','','L','104','0','GREGORIAN' UNION ALL -SELECT 'so','Somali','','L','105','0','GREGORIAN' UNION ALL -SELECT 'sq','Albanian','','L','106','0','GREGORIAN' UNION ALL -SELECT 'sr','Serbian','','L','107','0','GREGORIAN' UNION ALL -SELECT 'ss','Siswati','','L','108','0','GREGORIAN' UNION ALL -SELECT 'st','Sesotho','','L','109','0','GREGORIAN' UNION ALL -SELECT 'su','Sudanese','','L','110','0','GREGORIAN' UNION ALL -SELECT 'sv','Swedish','','L','111','0','GREGORIAN' UNION ALL -SELECT 'sw','Swahili','','L','112','0','GREGORIAN' UNION ALL -SELECT 'ta','Tamil','','L','113','0','GREGORIAN' UNION ALL -SELECT 'te','Tegulu','','L','114','0','GREGORIAN' UNION ALL -SELECT 'tg','Tajik','','L','115','0','GREGORIAN' UNION ALL -SELECT 'th','Thai','','L','116','0','GREGORIAN' UNION ALL -SELECT 'ti','Tigrinya','','L','117','0','GREGORIAN' UNION ALL -SELECT 'tk','Turkmen','','L','118','0','GREGORIAN' UNION ALL -SELECT 'tl','Tagalog','','L','119','0','GREGORIAN' UNION ALL -SELECT 'tn','Setswana','','L','120','0','GREGORIAN' UNION ALL -SELECT 'to','Tonga','','L','121','0','GREGORIAN' UNION ALL -SELECT 'tr','Turkish','','L','122','0','GREGORIAN' UNION ALL -SELECT 'ts','Tsonga','','L','123','0','GREGORIAN' UNION ALL -SELECT 'tt','Tatar','','L','124','0','GREGORIAN' UNION ALL -SELECT 'tw','Twi','','L','125','0','GREGORIAN' UNION ALL -SELECT 'uk','Ukrainian','','L','126','0','GREGORIAN' UNION ALL -SELECT 'ur','Urdu','','L','127','0','GREGORIAN' UNION ALL -SELECT 'uz','Uzbek','','L','128','0','GREGORIAN' UNION ALL -SELECT 'vi','Vietnamese','','L','129','0','GREGORIAN' UNION ALL -SELECT 'vo','Volapuk','','L','130','0','GREGORIAN' UNION ALL -SELECT 'wo','Wolof','','L','131','0','GREGORIAN' UNION ALL -SELECT 'xh','Xhosa','','L','132','0','GREGORIAN' UNION ALL -SELECT 'yo','Yoruba','','L','133','0','GREGORIAN' UNION ALL -SELECT 'zh','Chinese','','L','134','0','GREGORIAN' UNION ALL -SELECT 'zu','Zulu','','L','135','0','GREGORIAN' ; +INSERT INTO [LANGUAGE] ([LAN_ID],[LAN_LOCATION],[LAN_NAME],[LAN_NATIVE_NAME],[LAN_DIRECTION],[LAN_WEIGHT],[LAN_ENABLED],[LAN_CALENDAR]) +SELECT 'aa', '', 'Afar', '', 'L', 0, '0', 'GREGORIAN' UNION ALL +SELECT 'ab', '', 'Abkhazian', '', 'L', 1, '0', 'GREGORIAN' UNION ALL +SELECT 'af', '', 'Afrikaans', '', 'L', 2, '0', 'GREGORIAN' UNION ALL +SELECT 'am', '', 'Amharic', '', 'L', 3, '0', 'GREGORIAN' UNION ALL +SELECT 'ar', '', 'Arabic', '', 'L', 4, '0', 'GREGORIAN' UNION ALL +SELECT 'as', '', 'Assamese', '', 'L', 5, '0', 'GREGORIAN' UNION ALL +SELECT 'ay', '', 'Aymara', '', 'L', 6, '0', 'GREGORIAN' UNION ALL +SELECT 'az', '', 'Azerbaijani', '', 'L', 7, '0', 'GREGORIAN' UNION ALL +SELECT 'ba', '', 'Bashkir', '', 'L', 8, '0', 'GREGORIAN' UNION ALL +SELECT 'be', '', 'Byelorussian', '', 'L', 9, '0', 'GREGORIAN' UNION ALL +SELECT 'bg', 'BG', 'Bulgarian', '', 'L', 10, '0', 'GREGORIAN' UNION ALL +SELECT 'bh', '', 'Bihari', '', 'L', 11, '0', 'GREGORIAN' UNION ALL +SELECT 'bi', '', 'Bislama', '', 'L', 12, '0', 'GREGORIAN' UNION ALL +SELECT 'bn', 'BD', 'Bengali', '', 'L', 13, '0', 'GREGORIAN' UNION ALL +SELECT 'bo', '', 'Tibetan', '', 'L', 14, '0', 'GREGORIAN' UNION ALL +SELECT 'br', '', 'Breton', '', 'L', 15, '0', 'GREGORIAN' UNION ALL +SELECT 'ca', 'ES', 'Catalan', '', 'L', 16, '0', 'GREGORIAN' UNION ALL +SELECT 'co', '', 'Corsican', '', 'L', 17, '0', 'GREGORIAN' UNION ALL +SELECT 'cs', 'CZ', 'Czech', '', 'L', 18, '0', 'GREGORIAN' UNION ALL +SELECT 'cy', '', 'Welsh', '', 'L', 19, '0', 'GREGORIAN' UNION ALL +SELECT 'da', 'DK', 'Danish', '', 'L', 20, '1', 'GREGORIAN' UNION ALL +SELECT 'de', 'DE', 'German', '', 'L', 21, '0', 'GREGORIAN' UNION ALL +SELECT 'dz', '', 'Bhutani', '', 'L', 22, '0', 'GREGORIAN' UNION ALL +SELECT 'el', 'GR', 'Greek', '', 'L', 23, '0', 'GREGORIAN' UNION ALL +SELECT 'en', 'US', 'English', '', 'L', 24, '1', 'GREGORIAN' UNION ALL +SELECT 'eo', '', 'Esperanto', '', 'L', 25, '0', 'GREGORIAN' UNION ALL +SELECT 'es', 'ES', 'Spanish', '', 'L', 26, '0', 'GREGORIAN' UNION ALL +SELECT 'et', 'EE', 'Estonian', '', 'L', 27, '0', 'GREGORIAN' UNION ALL +SELECT 'eu', '', 'Basque', '', 'L', 28, '0', 'GREGORIAN' UNION ALL +SELECT 'fa', 'IR', 'Persian', '', 'R', 29, '0', 'PERSIAN' UNION ALL +SELECT 'fi', 'FI', 'Finnish', '', 'L', 30, '0', 'GREGORIAN' UNION ALL +SELECT 'fj', '', 'Fiji', '', 'L', 31, '0', 'GREGORIAN' UNION ALL +SELECT 'fo', 'FO', 'Faeroese', '', 'L', 32, '0', 'GREGORIAN' UNION ALL +SELECT 'fr', 'FR', 'French', '', 'L', 33, '0', 'GREGORIAN' UNION ALL +SELECT 'fy', '', 'Frisian', '', 'L', 34, '0', 'GREGORIAN' UNION ALL +SELECT 'ga', '', 'Irish', '', 'L', 35, '0', 'GREGORIAN' UNION ALL +SELECT 'gd', '', 'Gaelic', '', 'L', 36, '0', 'GREGORIAN' UNION ALL +SELECT 'gl', '', 'Galician', '', 'L', 37, '0', 'GREGORIAN' UNION ALL +SELECT 'gn', '', 'Guarani', '', 'L', 38, '0', 'GREGORIAN' UNION ALL +SELECT 'gu', '', 'Gujarati', '', 'L', 39, '0', 'GREGORIAN' UNION ALL +SELECT 'ha', '', 'Hausa', '', 'L', 40, '0', 'GREGORIAN' UNION ALL +SELECT 'hi', '', 'Hindi', '', 'L', 41, '0', 'GREGORIAN' UNION ALL +SELECT 'hr', 'HR', 'Croatian', '', 'L', 42, '0', 'GREGORIAN' UNION ALL +SELECT 'hu', 'HU', 'Hungarian', '', 'L', 43, '0', 'GREGORIAN' UNION ALL +SELECT 'hy', '', 'Armenian', '', 'L', 44, '0', 'GREGORIAN' UNION ALL +SELECT 'ia', '', 'Interlingua', '', 'L', 45, '0', 'GREGORIAN' UNION ALL +SELECT 'ie', '', 'Interlingue', '', 'L', 46, '0', 'GREGORIAN' UNION ALL +SELECT 'ik', '', 'Inupiak', '', 'L', 47, '0', 'GREGORIAN' UNION ALL +SELECT 'in', 'ID', 'Indonesian', '', 'L', 48, '0', 'GREGORIAN' UNION ALL +SELECT 'is', 'IS', 'Icelandic', '', 'L', 49, '0', 'GREGORIAN' UNION ALL +SELECT 'it', 'IT', 'Italian', '', 'L', 50, '0', 'GREGORIAN' UNION ALL +SELECT 'iw', 'IL', 'Hebrew', '', 'R', 51, '0', 'GREGORIAN' UNION ALL +SELECT 'ja', 'JP', 'Japanese', '', 'L', 52, '0', 'GREGORIAN' UNION ALL +SELECT 'ji', '', 'Yiddish', '', 'L', 53, '0', 'GREGORIAN' UNION ALL +SELECT 'jw', '', 'Javanese', '', 'L', 54, '0', 'GREGORIAN' UNION ALL +SELECT 'ka', '', 'Georgian', '', 'L', 55, '0', 'GREGORIAN' UNION ALL +SELECT 'kk', '', 'Kazakh', '', 'L', 56, '0', 'GREGORIAN' UNION ALL +SELECT 'kl', '', 'Greenlandic', '', 'L', 57, '0', 'GREGORIAN' UNION ALL +SELECT 'km', '', 'Cambodian', '', 'L', 58, '0', 'GREGORIAN' UNION ALL +SELECT 'kn', '', 'Kannada', '', 'L', 59, '0', 'GREGORIAN' UNION ALL +SELECT 'ko', 'KR', 'Korean', '', 'L', 60, '0', 'GREGORIAN' UNION ALL +SELECT 'ks', '', 'Kashmiri', '', 'L', 61, '0', 'GREGORIAN' UNION ALL +SELECT 'ku', '', 'Kurdish', '', 'L', 62, '0', 'GREGORIAN' UNION ALL +SELECT 'ky', '', 'Kirghiz', '', 'L', 63, '0', 'GREGORIAN' UNION ALL +SELECT 'la', '', 'Latin', '', 'L', 64, '0', 'GREGORIAN' UNION ALL +SELECT 'ln', '', 'Lingala', '', 'L', 65, '0', 'GREGORIAN' UNION ALL +SELECT 'lo', '', 'Laothian', '', 'L', 66, '0', 'GREGORIAN' UNION ALL +SELECT 'lt', 'LT', 'Lithuanian', '', 'L', 67, '0', 'GREGORIAN' UNION ALL +SELECT 'lv', 'LV', 'Latvian', '', 'L', 68, '0', 'GREGORIAN' UNION ALL +SELECT 'mg', '', 'Malagasy', '', 'L', 69, '0', 'GREGORIAN' UNION ALL +SELECT 'mi', '', 'Maori', '', 'L', 70, '0', 'GREGORIAN' UNION ALL +SELECT 'mk', '', 'Macedonian', '', 'L', 71, '0', 'GREGORIAN' UNION ALL +SELECT 'ml', '', 'Malayalam', '', 'L', 72, '0', 'GREGORIAN' UNION ALL +SELECT 'mn', '', 'Mongolian', '', 'L', 73, '0', 'GREGORIAN' UNION ALL +SELECT 'mo', '', 'Moldavian', '', 'L', 74, '0', 'GREGORIAN' UNION ALL +SELECT 'mr', '', 'Marathi', '', 'L', 75, '0', 'GREGORIAN' UNION ALL +SELECT 'ms', 'MY', 'Malay', '', 'L', 76, '0', 'GREGORIAN' UNION ALL +SELECT 'mt', '', 'Maltese', '', 'L', 77, '0', 'GREGORIAN' UNION ALL +SELECT 'my', '', 'Burmese', '', 'L', 78, '0', 'GREGORIAN' UNION ALL +SELECT 'na', '', 'Nauru', '', 'L', 79, '0', 'GREGORIAN' UNION ALL +SELECT 'ne', '', 'Nepali', '', 'L', 80, '0', 'GREGORIAN' UNION ALL +SELECT 'nl', 'NL', 'Dutch', '', 'L', 81, '0', 'GREGORIAN' UNION ALL +SELECT 'no', 'NO', 'Norwegian', '', 'L', 82, '0', 'GREGORIAN' UNION ALL +SELECT 'oc', '', 'Occitan', '', 'L', 83, '0', 'GREGORIAN' UNION ALL +SELECT 'om', '', 'Oromo', '', 'L', 84, '0', 'GREGORIAN' UNION ALL +SELECT 'or', '', 'Oriya', '', 'L', 85, '0', 'GREGORIAN' UNION ALL +SELECT 'pa', '', 'Punjabi', '', 'L', 86, '0', 'GREGORIAN' UNION ALL +SELECT 'pl', 'PL', 'Polish', '', 'L', 87, '1', 'GREGORIAN' UNION ALL +SELECT 'ps', '', 'Pashto', '', 'L', 88, '0', 'GREGORIAN' UNION ALL +SELECT 'pt', 'BR', 'Portuguese', '', 'L', 89, '1', 'GREGORIAN' UNION ALL +SELECT 'qu', '', 'Quechua', '', 'L', 90, '0', 'GREGORIAN' UNION ALL +SELECT 'rm', '', 'Rhaeto-Romance', '', 'L', 91, '0', 'GREGORIAN' UNION ALL +SELECT 'rn', '', 'Kirundi', '', 'L', 92, '0', 'GREGORIAN' UNION ALL +SELECT 'ro', 'RO', 'Romanian', '', 'L', 93, '0', 'GREGORIAN' UNION ALL +SELECT 'ru', 'RU', 'Russian', '', 'L', 94, '0', 'GREGORIAN' UNION ALL +SELECT 'rw', '', 'Kinyarwanda', '', 'L', 95, '0', 'GREGORIAN' UNION ALL +SELECT 'sa', '', 'Sanskrit', '', 'L', 96, '0', 'GREGORIAN' UNION ALL +SELECT 'sd', '', 'Sindhi', '', 'L', 97, '0', 'GREGORIAN' UNION ALL +SELECT 'sg', '', 'Sangro', '', 'L', 98, '0', 'GREGORIAN' UNION ALL +SELECT 'sh', '', 'Serbo-Croatian', '', 'L', 99, '0', 'GREGORIAN' UNION ALL +SELECT 'si', '', 'Singhalese', '', 'L', 100, '0', 'GREGORIAN' UNION ALL +SELECT 'sk', 'SK', 'Slovak', '', 'L', 101, '0', 'GREGORIAN' UNION ALL +SELECT 'sl', 'SI', 'Slovenian', '', 'L', 102, '0', 'GREGORIAN' UNION ALL +SELECT 'sm', '', 'Samoan', '', 'L', 103, '0', 'GREGORIAN' UNION ALL +SELECT 'sn', '', 'Shona', '', 'L', 104, '0', 'GREGORIAN' UNION ALL +SELECT 'so', '', 'Somali', '', 'L', 105, '0', 'GREGORIAN' UNION ALL +SELECT 'sq', '', 'Albanian', '', 'L', 106, '0', 'GREGORIAN' UNION ALL +SELECT 'sr', 'YU', 'Serbian', '', 'L', 107, '0', 'GREGORIAN' UNION ALL +SELECT 'ss', '', 'Siswati', '', 'L', 108, '0', 'GREGORIAN' UNION ALL +SELECT 'st', '', 'Sesotho', '', 'L', 109, '0', 'GREGORIAN' UNION ALL +SELECT 'su', '', 'Sudanese', '', 'L', 110, '0', 'GREGORIAN' UNION ALL +SELECT 'sv', 'SE', 'Swedish', '', 'L', 111, '0', 'GREGORIAN' UNION ALL +SELECT 'sw', '', 'Swahili', '', 'L', 112, '0', 'GREGORIAN' UNION ALL +SELECT 'ta', 'LK', 'Tamil', '', 'L', 113, '0', 'GREGORIAN' UNION ALL +SELECT 'te', '', 'Tegulu', '', 'L', 114, '0', 'GREGORIAN' UNION ALL +SELECT 'tg', '', 'Tajik', '', 'L', 115, '0', 'GREGORIAN' UNION ALL +SELECT 'th', 'TH', 'Thai', '', 'L', 116, '0', 'GREGORIAN' UNION ALL +SELECT 'ti', '', 'Tigrinya', '', 'L', 117, '0', 'GREGORIAN' UNION ALL +SELECT 'tk', '', 'Turkmen', '', 'L', 118, '0', 'GREGORIAN' UNION ALL +SELECT 'tl', 'PH', 'Tagalog', '', 'L', 119, '0', 'GREGORIAN' UNION ALL +SELECT 'tn', '', 'Setswana', '', 'L', 120, '0', 'GREGORIAN' UNION ALL +SELECT 'to', '', 'Tonga', '', 'L', 121, '0', 'GREGORIAN' UNION ALL +SELECT 'tr', 'TR', 'Turkish', '', 'L', 122, '0', 'GREGORIAN' UNION ALL +SELECT 'ts', '', 'Tsonga', '', 'L', 123, '0', 'GREGORIAN' UNION ALL +SELECT 'tt', '', 'Tatar', '', 'L', 124, '0', 'GREGORIAN' UNION ALL +SELECT 'tw', '', 'Twi', '', 'L', 125, '0', 'GREGORIAN' UNION ALL +SELECT 'uk', 'UA', 'Ukrainian', '', 'L', 126, '0', 'GREGORIAN' UNION ALL +SELECT 'ur', '', 'Urdu', '', 'L', 127, '0', 'GREGORIAN' UNION ALL +SELECT 'uz', '', 'Uzbek', '', 'L', 128, '0', 'GREGORIAN' UNION ALL +SELECT 'vi', 'VN', 'Vietnamese', '', 'L', 129, '0', 'GREGORIAN' UNION ALL +SELECT 'vo', '', 'Volapuk', '', 'L', 130, '0', 'GREGORIAN' UNION ALL +SELECT 'wo', '', 'Wolof', '', 'L', 131, '0', 'GREGORIAN' UNION ALL +SELECT 'xh', '', 'Xhosa', '', 'L', 132, '0', 'GREGORIAN' UNION ALL +SELECT 'yo', '', 'Yoruba', '', 'L', 133, '0', 'GREGORIAN' UNION ALL +SELECT 'zh', 'CN', 'Chinese', '', 'L', 134, '0', 'GREGORIAN' UNION ALL +SELECT 'zu', '', 'Zulu', '', 'L', 135, '0', 'GREGORIAN' ; INSERT INTO [ISO_COUNTRY] ([IC_UID],[IC_NAME],[IC_SORT_ORDER]) SELECT 'AD', 'Andorra','' UNION ALL diff --git a/workflow/engine/data/mssql/schema.sql b/workflow/engine/data/mssql/schema.sql index dfd1d81f9..4fcda9090 100755 --- a/workflow/engine/data/mssql/schema.sql +++ b/workflow/engine/data/mssql/schema.sql @@ -749,6 +749,7 @@ END CREATE TABLE [LANGUAGE] ( [LAN_ID] VARCHAR(4) default '' NOT NULL, + [LAN_LOCATION] VARCHAR(4) default '' NOT NULL, [LAN_NAME] VARCHAR(30) default '' NOT NULL, [LAN_NATIVE_NAME] VARCHAR(30) default '' NOT NULL, [LAN_DIRECTION] CHAR(1) default 'L' NOT NULL, diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index d9ac92235..ea845556e 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -25,143 +25,143 @@ INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES ('PER_NAME','','00000000000000000000000000000001','en','Login'), ('PER_NAME','','00000000000000000000000000000002','en','Setup'); -INSERT INTO LANGUAGE (LAN_ID,LAN_NAME,LAN_NATIVE_NAME,LAN_DIRECTION,LAN_WEIGHT,LAN_ENABLED,LAN_CALENDAR) VALUES -('aa','Afar','','L','0','0','GREGORIAN'), -('ab','Abkhazian','','L','1','0','GREGORIAN'), -('af','Afrikaans','','L','2','0','GREGORIAN'), -('am','Amharic','','L','3','0','GREGORIAN'), -('ar','Arabic','','L','4','0','GREGORIAN'), -('as','Assamese','','L','5','0','GREGORIAN'), -('ay','Aymara','','L','6','0','GREGORIAN'), -('az','Azerbaijani','','L','7','0','GREGORIAN'), -('ba','Bashkir','','L','8','0','GREGORIAN'), -('be','Byelorussian','','L','9','0','GREGORIAN'), -('bg','Bulgarian','','L','10','0','GREGORIAN'), -('bh','Bihari','','L','11','0','GREGORIAN'), -('bi','Bislama','','L','12','0','GREGORIAN'), -('bn','Bengali','','L','13','0','GREGORIAN'), -('bo','Tibetan','','L','14','0','GREGORIAN'), -('br','Breton','','L','15','0','GREGORIAN'), -('ca','Catalan','','L','16','0','GREGORIAN'), -('co','Corsican','','L','17','0','GREGORIAN'), -('cs','Czech','','L','18','0','GREGORIAN'), -('cy','Welsh','','L','19','0','GREGORIAN'), -('da','Danish','','L','20','0','GREGORIAN'), -('de','German','','L','21','0','GREGORIAN'), -('dz','Bhutani','','L','22','0','GREGORIAN'), -('el','Greek','','L','23','0','GREGORIAN'), -('en','English','','L','24','1','GREGORIAN'), -('eo','Esperanto','','L','25','0','GREGORIAN'), -('es','Spanish','','L','26','0','GREGORIAN'), -('et','Estonian','','L','27','0','GREGORIAN'), -('eu','Basque','','L','28','0','GREGORIAN'), -('fa','Persian','','R','29','0','PERSIAN'), -('fi','Finnish','','L','30','0','GREGORIAN'), -('fj','Fiji','','L','31','0','GREGORIAN'), -('fo','Faeroese','','L','32','0','GREGORIAN'), -('fr','French','','L','33','0','GREGORIAN'), -('fy','Frisian','','L','34','0','GREGORIAN'), -('ga','Irish','','L','35','0','GREGORIAN'), -('gd','Gaelic','','L','36','0','GREGORIAN'), -('gl','Galician','','L','37','0','GREGORIAN'), -('gn','Guarani','','L','38','0','GREGORIAN'), -('gu','Gujarati','','L','39','0','GREGORIAN'), -('ha','Hausa','','L','40','0','GREGORIAN'), -('hi','Hindi','','L','41','0','GREGORIAN'), -('hr','Croatian','','L','42','0','GREGORIAN'), -('hu','Hungarian','','L','43','0','GREGORIAN'), -('hy','Armenian','','L','44','0','GREGORIAN'), -('ia','Interlingua','','L','45','0','GREGORIAN'), -('ie','Interlingue','','L','46','0','GREGORIAN'), -('ik','Inupiak','','L','47','0','GREGORIAN'), -('in','Indonesian','','L','48','0','GREGORIAN'), -('is','Icelandic','','L','49','0','GREGORIAN'), -('it','Italian','','L','50','0','GREGORIAN'), -('iw','Hebrew','','R','51','0','GREGORIAN'), -('ja','Japanese','','L','52','0','GREGORIAN'), -('ji','Yiddish','','L','53','0','GREGORIAN'), -('jw','Javanese','','L','54','0','GREGORIAN'), -('ka','Georgian','','L','55','0','GREGORIAN'), -('kk','Kazakh','','L','56','0','GREGORIAN'), -('kl','Greenlandic','','L','57','0','GREGORIAN'), -('km','Cambodian','','L','58','0','GREGORIAN'), -('kn','Kannada','','L','59','0','GREGORIAN'), -('ko','Korean','','L','60','0','GREGORIAN'), -('ks','Kashmiri','','L','61','0','GREGORIAN'), -('ku','Kurdish','','L','62','0','GREGORIAN'), -('ky','Kirghiz','','L','63','0','GREGORIAN'), -('la','Latin','','L','64','0','GREGORIAN'), -('ln','Lingala','','L','65','0','GREGORIAN'), -('lo','Laothian','','L','66','0','GREGORIAN'), -('lt','Lithuanian','','L','67','0','GREGORIAN'), -('lv','Latvian','','L','68','0','GREGORIAN'), -('mg','Malagasy','','L','69','0','GREGORIAN'), -('mi','Maori','','L','70','0','GREGORIAN'), -('mk','Macedonian','','L','71','0','GREGORIAN'), -('ml','Malayalam','','L','72','0','GREGORIAN'), -('mn','Mongolian','','L','73','0','GREGORIAN'), -('mo','Moldavian','','L','74','0','GREGORIAN'), -('mr','Marathi','','L','75','0','GREGORIAN'), -('ms','Malay','','L','76','0','GREGORIAN'), -('mt','Maltese','','L','77','0','GREGORIAN'), -('my','Burmese','','L','78','0','GREGORIAN'), -('na','Nauru','','L','79','0','GREGORIAN'), -('ne','Nepali','','L','80','0','GREGORIAN'), -('nl','Dutch','','L','81','0','GREGORIAN'), -('no','Norwegian','','L','82','0','GREGORIAN'), -('oc','Occitan','','L','83','0','GREGORIAN'), -('om','Oromo','','L','84','0','GREGORIAN'), -('or','Oriya','','L','85','0','GREGORIAN'), -('pa','Punjabi','','L','86','0','GREGORIAN'), -('pl','Polish','','L','87','0','GREGORIAN'), -('ps','Pashto','','L','88','0','GREGORIAN'), -('pt','Portuguese','','L','89','0','GREGORIAN'), -('qu','Quechua','','L','90','0','GREGORIAN'), -('rm','Rhaeto-Romance','','L','91','0','GREGORIAN'), -('rn','Kirundi','','L','92','0','GREGORIAN'), -('ro','Romanian','','L','93','0','GREGORIAN'), -('ru','Russian','','L','94','0','GREGORIAN'), -('rw','Kinyarwanda','','L','95','0','GREGORIAN'), -('sa','Sanskrit','','L','96','0','GREGORIAN'), -('sd','Sindhi','','L','97','0','GREGORIAN'), -('sg','Sangro','','L','98','0','GREGORIAN'), -('sh','Serbo-Croatian','','L','99','0','GREGORIAN'), -('si','Singhalese','','L','100','0','GREGORIAN'), -('sk','Slovak','','L','101','0','GREGORIAN'), -('sl','Slovenian','','L','102','0','GREGORIAN'), -('sm','Samoan','','L','103','0','GREGORIAN'), -('sn','Shona','','L','104','0','GREGORIAN'), -('so','Somali','','L','105','0','GREGORIAN'), -('sq','Albanian','','L','106','0','GREGORIAN'), -('sr','Serbian','','L','107','0','GREGORIAN'), -('ss','Siswati','','L','108','0','GREGORIAN'), -('st','Sesotho','','L','109','0','GREGORIAN'), -('su','Sudanese','','L','110','0','GREGORIAN'), -('sv','Swedish','','L','111','0','GREGORIAN'), -('sw','Swahili','','L','112','0','GREGORIAN'), -('ta','Tamil','','L','113','0','GREGORIAN'), -('te','Tegulu','','L','114','0','GREGORIAN'), -('tg','Tajik','','L','115','0','GREGORIAN'), -('th','Thai','','L','116','0','GREGORIAN'), -('ti','Tigrinya','','L','117','0','GREGORIAN'), -('tk','Turkmen','','L','118','0','GREGORIAN'), -('tl','Tagalog','','L','119','0','GREGORIAN'), -('tn','Setswana','','L','120','0','GREGORIAN'), -('to','Tonga','','L','121','0','GREGORIAN'), -('tr','Turkish','','L','122','0','GREGORIAN'), -('ts','Tsonga','','L','123','0','GREGORIAN'), -('tt','Tatar','','L','124','0','GREGORIAN'), -('tw','Twi','','L','125','0','GREGORIAN'), -('uk','Ukrainian','','L','126','0','GREGORIAN'), -('ur','Urdu','','L','127','0','GREGORIAN'), -('uz','Uzbek','','L','128','0','GREGORIAN'), -('vi','Vietnamese','','L','129','0','GREGORIAN'), -('vo','Volapuk','','L','130','0','GREGORIAN'), -('wo','Wolof','','L','131','0','GREGORIAN'), -('xh','Xhosa','','L','132','0','GREGORIAN'), -('yo','Yoruba','','L','133','0','GREGORIAN'), -('zh','Chinese','','L','134','0','GREGORIAN'), -('zu','Zulu','','L','135','0','GREGORIAN'); +INSERT INTO LANGUAGE (LAN_ID,LAN_LOCATION,LAN_NAME,LAN_NATIVE_NAME,LAN_DIRECTION,LAN_WEIGHT,LAN_ENABLED,LAN_CALENDAR) VALUES +('aa', '', 'Afar', '', 'L', 0, '0', 'GREGORIAN'), +('ab', '', 'Abkhazian', '', 'L', 1, '0', 'GREGORIAN'), +('af', '', 'Afrikaans', '', 'L', 2, '0', 'GREGORIAN'), +('am', '', 'Amharic', '', 'L', 3, '0', 'GREGORIAN'), +('ar', '', 'Arabic', '', 'L', 4, '0', 'GREGORIAN'), +('as', '', 'Assamese', '', 'L', 5, '0', 'GREGORIAN'), +('ay', '', 'Aymara', '', 'L', 6, '0', 'GREGORIAN'), +('az', '', 'Azerbaijani', '', 'L', 7, '0', 'GREGORIAN'), +('ba', '', 'Bashkir', '', 'L', 8, '0', 'GREGORIAN'), +('be', '', 'Byelorussian', '', 'L', 9, '0', 'GREGORIAN'), +('bg', 'BG', 'Bulgarian', '', 'L', 10, '0', 'GREGORIAN'), +('bh', '', 'Bihari', '', 'L', 11, '0', 'GREGORIAN'), +('bi', '', 'Bislama', '', 'L', 12, '0', 'GREGORIAN'), +('bn', 'BD', 'Bengali', '', 'L', 13, '0', 'GREGORIAN'), +('bo', '', 'Tibetan', '', 'L', 14, '0', 'GREGORIAN'), +('br', '', 'Breton', '', 'L', 15, '0', 'GREGORIAN'), +('ca', 'ES', 'Catalan', '', 'L', 16, '0', 'GREGORIAN'), +('co', '', 'Corsican', '', 'L', 17, '0', 'GREGORIAN'), +('cs', 'CZ', 'Czech', '', 'L', 18, '0', 'GREGORIAN'), +('cy', '', 'Welsh', '', 'L', 19, '0', 'GREGORIAN'), +('da', 'DK', 'Danish', '', 'L', 20, '1', 'GREGORIAN'), +('de', 'DE', 'German', '', 'L', 21, '0', 'GREGORIAN'), +('dz', '', 'Bhutani', '', 'L', 22, '0', 'GREGORIAN'), +('el', 'GR', 'Greek', '', 'L', 23, '0', 'GREGORIAN'), +('en', 'US', 'English', '', 'L', 24, '1', 'GREGORIAN'), +('eo', '', 'Esperanto', '', 'L', 25, '0', 'GREGORIAN'), +('es', 'ES', 'Spanish', '', 'L', 26, '0', 'GREGORIAN'), +('et', 'EE', 'Estonian', '', 'L', 27, '0', 'GREGORIAN'), +('eu', '', 'Basque', '', 'L', 28, '0', 'GREGORIAN'), +('fa', 'IR', 'Persian', '', 'R', 29, '0', 'PERSIAN'), +('fi', 'FI', 'Finnish', '', 'L', 30, '0', 'GREGORIAN'), +('fj', '', 'Fiji', '', 'L', 31, '0', 'GREGORIAN'), +('fo', 'FO', 'Faeroese', '', 'L', 32, '0', 'GREGORIAN'), +('fr', 'FR', 'French', '', 'L', 33, '0', 'GREGORIAN'), +('fy', '', 'Frisian', '', 'L', 34, '0', 'GREGORIAN'), +('ga', '', 'Irish', '', 'L', 35, '0', 'GREGORIAN'), +('gd', '', 'Gaelic', '', 'L', 36, '0', 'GREGORIAN'), +('gl', '', 'Galician', '', 'L', 37, '0', 'GREGORIAN'), +('gn', '', 'Guarani', '', 'L', 38, '0', 'GREGORIAN'), +('gu', '', 'Gujarati', '', 'L', 39, '0', 'GREGORIAN'), +('ha', '', 'Hausa', '', 'L', 40, '0', 'GREGORIAN'), +('hi', '', 'Hindi', '', 'L', 41, '0', 'GREGORIAN'), +('hr', 'HR', 'Croatian', '', 'L', 42, '0', 'GREGORIAN'), +('hu', 'HU', 'Hungarian', '', 'L', 43, '0', 'GREGORIAN'), +('hy', '', 'Armenian', '', 'L', 44, '0', 'GREGORIAN'), +('ia', '', 'Interlingua', '', 'L', 45, '0', 'GREGORIAN'), +('ie', '', 'Interlingue', '', 'L', 46, '0', 'GREGORIAN'), +('ik', '', 'Inupiak', '', 'L', 47, '0', 'GREGORIAN'), +('in', 'ID', 'Indonesian', '', 'L', 48, '0', 'GREGORIAN'), +('is', 'IS', 'Icelandic', '', 'L', 49, '0', 'GREGORIAN'), +('it', 'IT', 'Italian', '', 'L', 50, '0', 'GREGORIAN'), +('iw', 'IL', 'Hebrew', '', 'R', 51, '0', 'GREGORIAN'), +('ja', 'JP', 'Japanese', '', 'L', 52, '0', 'GREGORIAN'), +('ji', '', 'Yiddish', '', 'L', 53, '0', 'GREGORIAN'), +('jw', '', 'Javanese', '', 'L', 54, '0', 'GREGORIAN'), +('ka', '', 'Georgian', '', 'L', 55, '0', 'GREGORIAN'), +('kk', '', 'Kazakh', '', 'L', 56, '0', 'GREGORIAN'), +('kl', '', 'Greenlandic', '', 'L', 57, '0', 'GREGORIAN'), +('km', '', 'Cambodian', '', 'L', 58, '0', 'GREGORIAN'), +('kn', '', 'Kannada', '', 'L', 59, '0', 'GREGORIAN'), +('ko', 'KR', 'Korean', '', 'L', 60, '0', 'GREGORIAN'), +('ks', '', 'Kashmiri', '', 'L', 61, '0', 'GREGORIAN'), +('ku', '', 'Kurdish', '', 'L', 62, '0', 'GREGORIAN'), +('ky', '', 'Kirghiz', '', 'L', 63, '0', 'GREGORIAN'), +('la', '', 'Latin', '', 'L', 64, '0', 'GREGORIAN'), +('ln', '', 'Lingala', '', 'L', 65, '0', 'GREGORIAN'), +('lo', '', 'Laothian', '', 'L', 66, '0', 'GREGORIAN'), +('lt', 'LT', 'Lithuanian', '', 'L', 67, '0', 'GREGORIAN'), +('lv', 'LV', 'Latvian', '', 'L', 68, '0', 'GREGORIAN'), +('mg', '', 'Malagasy', '', 'L', 69, '0', 'GREGORIAN'), +('mi', '', 'Maori', '', 'L', 70, '0', 'GREGORIAN'), +('mk', '', 'Macedonian', '', 'L', 71, '0', 'GREGORIAN'), +('ml', '', 'Malayalam', '', 'L', 72, '0', 'GREGORIAN'), +('mn', '', 'Mongolian', '', 'L', 73, '0', 'GREGORIAN'), +('mo', '', 'Moldavian', '', 'L', 74, '0', 'GREGORIAN'), +('mr', '', 'Marathi', '', 'L', 75, '0', 'GREGORIAN'), +('ms', 'MY', 'Malay', '', 'L', 76, '0', 'GREGORIAN'), +('mt', '', 'Maltese', '', 'L', 77, '0', 'GREGORIAN'), +('my', '', 'Burmese', '', 'L', 78, '0', 'GREGORIAN'), +('na', '', 'Nauru', '', 'L', 79, '0', 'GREGORIAN'), +('ne', '', 'Nepali', '', 'L', 80, '0', 'GREGORIAN'), +('nl', 'NL', 'Dutch', '', 'L', 81, '0', 'GREGORIAN'), +('no', 'NO', 'Norwegian', '', 'L', 82, '0', 'GREGORIAN'), +('oc', '', 'Occitan', '', 'L', 83, '0', 'GREGORIAN'), +('om', '', 'Oromo', '', 'L', 84, '0', 'GREGORIAN'), +('or', '', 'Oriya', '', 'L', 85, '0', 'GREGORIAN'), +('pa', '', 'Punjabi', '', 'L', 86, '0', 'GREGORIAN'), +('pl', 'PL', 'Polish', '', 'L', 87, '1', 'GREGORIAN'), +('ps', '', 'Pashto', '', 'L', 88, '0', 'GREGORIAN'), +('pt', 'BR', 'Portuguese', '', 'L', 89, '1', 'GREGORIAN'), +('qu', '', 'Quechua', '', 'L', 90, '0', 'GREGORIAN'), +('rm', '', 'Rhaeto-Romance', '', 'L', 91, '0', 'GREGORIAN'), +('rn', '', 'Kirundi', '', 'L', 92, '0', 'GREGORIAN'), +('ro', 'RO', 'Romanian', '', 'L', 93, '0', 'GREGORIAN'), +('ru', 'RU', 'Russian', '', 'L', 94, '0', 'GREGORIAN'), +('rw', '', 'Kinyarwanda', '', 'L', 95, '0', 'GREGORIAN'), +('sa', '', 'Sanskrit', '', 'L', 96, '0', 'GREGORIAN'), +('sd', '', 'Sindhi', '', 'L', 97, '0', 'GREGORIAN'), +('sg', '', 'Sangro', '', 'L', 98, '0', 'GREGORIAN'), +('sh', '', 'Serbo-Croatian', '', 'L', 99, '0', 'GREGORIAN'), +('si', '', 'Singhalese', '', 'L', 100, '0', 'GREGORIAN'), +('sk', 'SK', 'Slovak', '', 'L', 101, '0', 'GREGORIAN'), +('sl', 'SI', 'Slovenian', '', 'L', 102, '0', 'GREGORIAN'), +('sm', '', 'Samoan', '', 'L', 103, '0', 'GREGORIAN'), +('sn', '', 'Shona', '', 'L', 104, '0', 'GREGORIAN'), +('so', '', 'Somali', '', 'L', 105, '0', 'GREGORIAN'), +('sq', '', 'Albanian', '', 'L', 106, '0', 'GREGORIAN'), +('sr', 'YU', 'Serbian', '', 'L', 107, '0', 'GREGORIAN'), +('ss', '', 'Siswati', '', 'L', 108, '0', 'GREGORIAN'), +('st', '', 'Sesotho', '', 'L', 109, '0', 'GREGORIAN'), +('su', '', 'Sudanese', '', 'L', 110, '0', 'GREGORIAN'), +('sv', 'SE', 'Swedish', '', 'L', 111, '0', 'GREGORIAN'), +('sw', '', 'Swahili', '', 'L', 112, '0', 'GREGORIAN'), +('ta', 'LK', 'Tamil', '', 'L', 113, '0', 'GREGORIAN'), +('te', '', 'Tegulu', '', 'L', 114, '0', 'GREGORIAN'), +('tg', '', 'Tajik', '', 'L', 115, '0', 'GREGORIAN'), +('th', 'TH', 'Thai', '', 'L', 116, '0', 'GREGORIAN'), +('ti', '', 'Tigrinya', '', 'L', 117, '0', 'GREGORIAN'), +('tk', '', 'Turkmen', '', 'L', 118, '0', 'GREGORIAN'), +('tl', 'PH', 'Tagalog', '', 'L', 119, '0', 'GREGORIAN'), +('tn', '', 'Setswana', '', 'L', 120, '0', 'GREGORIAN'), +('to', '', 'Tonga', '', 'L', 121, '0', 'GREGORIAN'), +('tr', 'TR', 'Turkish', '', 'L', 122, '0', 'GREGORIAN'), +('ts', '', 'Tsonga', '', 'L', 123, '0', 'GREGORIAN'), +('tt', '', 'Tatar', '', 'L', 124, '0', 'GREGORIAN'), +('tw', '', 'Twi', '', 'L', 125, '0', 'GREGORIAN'), +('uk', 'UA', 'Ukrainian', '', 'L', 126, '0', 'GREGORIAN'), +('ur', '', 'Urdu', '', 'L', 127, '0', 'GREGORIAN'), +('uz', '', 'Uzbek', '', 'L', 128, '0', 'GREGORIAN'), +('vi', 'VN', 'Vietnamese', '', 'L', 129, '0', 'GREGORIAN'), +('vo', '', 'Volapuk', '', 'L', 130, '0', 'GREGORIAN'), +('wo', '', 'Wolof', '', 'L', 131, '0', 'GREGORIAN'), +('xh', '', 'Xhosa', '', 'L', 132, '0', 'GREGORIAN'), +('yo', '', 'Yoruba', '', 'L', 133, '0', 'GREGORIAN'), +('zh', 'CN', 'Chinese', '', 'L', 134, '0', 'GREGORIAN'), +('zu', '', 'Zulu', '', 'L', 135, '0', 'GREGORIAN'); INSERT INTO ISO_COUNTRY (IC_UID,IC_NAME,IC_SORT_ORDER) VALUES ('AD', 'Andorra',' ') , diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index f85d5d7a4..fd7cc212f 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -322,6 +322,7 @@ CREATE TABLE `LANGUAGE` ( `LAN_ID` VARCHAR(4) default '' NOT NULL, `LAN_NAME` VARCHAR(30) default '' NOT NULL, + `LAN_LOCATION` VARCHAR(4) default '' NOT NULL, `LAN_NATIVE_NAME` VARCHAR(30) default '' NOT NULL, `LAN_DIRECTION` CHAR(1) default 'L' NOT NULL, `LAN_WEIGHT` INTEGER default 0 NOT NULL, diff --git a/workflow/engine/methods/cases/saveFormSupervisor.php b/workflow/engine/methods/cases/saveFormSupervisor.php new file mode 100644 index 000000000..4a8525aae --- /dev/null +++ b/workflow/engine/methods/cases/saveFormSupervisor.php @@ -0,0 +1,135 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + + +try { + + $oForm = new Form( $_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM ); + $oForm->validatePost(); + + //Includes + G::LoadClass( "case" ); + + //Load the variables + $oCase = new Cases(); + $Fields = $oCase->loadCase( $_SESSION["APPLICATION"] ); + + $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], G::getSystemConstants() ); + $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $_POST["form"] ); + + //save data in PM Tables if necessary + $newValues = array (); + foreach ($_POST['form'] as $sField => $sAux) { + if (isset( $oForm->fields[$sField]->pmconnection ) && isset( $oForm->fields[$sField]->pmfield )) { + if (($oForm->fields[$sField]->pmconnection != '') && ($oForm->fields[$sField]->pmfield != '')) { + if (isset( $oForm->fields[$oForm->fields[$sField]->pmconnection] )) { + require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php'; + $oAdditionalTables = new AdditionalTables(); + try { + $aData = $oAdditionalTables->load( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, true ); + } catch (Exception $oError) { + $aData = array ('FIELDS' => array () + ); + } + $aKeys = array (); + $aAux = explode( '|', $oForm->fields[$oForm->fields[$sField]->pmconnection]->keys ); + $i = 0; + $aValues = array (); + foreach ($aData['FIELDS'] as $aField) { + if ($aField['FLD_KEY'] == '1') { + $aKeys[$aField['FLD_NAME']] = (isset( $aAux[$i] ) ? G::replaceDataField( $aAux[$i], $Fields['APP_DATA'] ) : ''); + $i ++; + } + if ($aField['FLD_NAME'] == $oForm->fields[$sField]->pmfield) { + $aValues[$aField['FLD_NAME']] = $Fields['APP_DATA'][$sField]; + } else { + $aValues[$aField['FLD_NAME']] = ''; + } + } + try { + $aRow = $oAdditionalTables->getDataTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aKeys ); + } catch (Exception $oError) { + $aRow = false; + } + if ($aRow) { + foreach ($aValues as $sKey => $sValue) { + if ($sKey != $oForm->fields[$sField]->pmfield) { + $aValues[$sKey] = $aRow[$sKey]; + } + } + try { + $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aValues ); + } catch (Exception $oError) { + //Nothing + } + } else { + try { + // assembling the field list in order to save the data ina new record of a pm table + if (empty( $newValues )) { + $newValues = $aValues; + } else { + foreach ($aValues as $aValueKey => $aValueCont) { + if (trim( $newValues[$aValueKey] ) == '') { + $newValues[$aValueKey] = $aValueCont; + } + } + } + //$oAdditionalTables->saveDataInTable ( $oForm->fields [$oForm->fields [$sField]->pmconnection]->pmtable, $aValues ); + } catch (Exception $oError) { + //Nothing + } + } + } + } + } + } + + //save data + $aData = array (); + $aData['APP_NUMBER'] = $Fields['APP_NUMBER']; + $aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS']; + $aData['APP_DATA'] = $Fields['APP_DATA']; + $aData['DEL_INDEX'] = $_SESSION['INDEX']; + $aData['TAS_UID'] = $_SESSION['TASK']; + $aData['CURRENT_DYNAFORM'] = $_GET['UID']; + $aData['USER_UID'] = $_SESSION['USER_LOGGED']; + $aData['APP_STATUS'] = $Fields['APP_STATUS']; + $aData['PRO_UID'] = $_SESSION['PROCESS']; + + $oCase->updateCase( $_SESSION['APPLICATION'], $aData ); + + // saving the data ina pm table in case that is a new record + if (! empty( $newValues )) { + $id = key( $newValues ); + if (! $oAdditionalTables->updateDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues )) { + //<--This is to know if it is a new registry on the PM Table + $oAdditionalTables->saveDataInTable( $oForm->fields[$oForm->fields[$id]->pmconnection]->pmtable, $newValues ); + } + } + + die('OK'); + +} catch (Exception $e) { + die($e->getMessage()); +} diff --git a/workflow/engine/methods/oauth2/grant.php b/workflow/engine/methods/oauth2/grant.php index e2ddcfad1..bd720530b 100644 --- a/workflow/engine/methods/oauth2/grant.php +++ b/workflow/engine/methods/oauth2/grant.php @@ -28,6 +28,7 @@ curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); $data = @json_decode(curl_exec($ch)); curl_close($ch); diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index cd3fefdc4..775f310e8 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -498,30 +498,38 @@ try { case 'saveFile': global $G_PUBLISH; $G_PUBLISH = new Publisher(); - $sDir = ""; - if (isset($_REQUEST['MAIN_DIRECTORY'])) { - $sDir = $_REQUEST['MAIN_DIRECTORY']; - } + global $RBAC; + if ( $RBAC->userCanAccess('PM_FACTORY') == 1) { + G::LoadClass('processes'); + $app = new Processes(); + if (!$app->processExists($_REQUEST['pro_uid'])) { + echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED'); + die; + } - switch ($sDir) { - case 'mailTemplates': - $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; - break; - case 'public': - $sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; - break; - default: - $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; - break; + $sDir = ""; + if (isset($_REQUEST['MAIN_DIRECTORY'])) { + $sDir = $_REQUEST['MAIN_DIRECTORY']; + } + switch ($sDir) { + case 'mailTemplates': + $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + break; + case 'public': + $sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + break; + default: + $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + break; + } + $fp = fopen($sDirectory, 'w'); + $content = stripslashes($_REQUEST['fcontent']); + $content = str_replace("@amp@", "&", $content); + $content = base64_decode($content); + fwrite($fp, $content); + fclose($fp); + echo 'saved: ' . $sDirectory; } - - $fp = fopen($sDirectory, 'w'); - $content = stripslashes($_REQUEST['fcontent']); - $content = str_replace("@amp@", "&", $content); - $content = base64_decode($content); - fwrite($fp, $content); - fclose($fp); - echo 'saved: ' . $sDirectory; break; case 'events': $oProcessMap->eventsList($oData->pro_uid, $oData->type); diff --git a/workflow/engine/methods/processes/processes_UploadFiles.php b/workflow/engine/methods/processes/processes_UploadFiles.php index 4d6cca241..11fe25373 100755 --- a/workflow/engine/methods/processes/processes_UploadFiles.php +++ b/workflow/engine/methods/processes/processes_UploadFiles.php @@ -1,19 +1,27 @@ -userCanAccess('PM_FACTORY') == 1) { + G::LoadClass('processes'); + $app = new Processes(); + if (!$app->processExists($_POST['form']['PRO_UID'])) { + echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED'); + die; } + switch ($_POST['form']['MAIN_DIRECTORY']) { + case 'mailTemplates': + $sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : ''); + break; + case 'public': + $sDirectory = PATH_DATA_PUBLIC . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : ''); + break; + default: + die(); + break; + } + for ($i = 1; $i <= 5; $i ++) { + if ($_FILES['form']['tmp_name']['FILENAME' . (string) $i] != '') { + G::uploadFile( $_FILES['form']['tmp_name']['FILENAME' . (string) $i], $sDirectory, $_FILES['form']['name']['FILENAME' . (string) $i] ); + } + } } die( '' ); diff --git a/workflow/engine/methods/processes/processes_doUpload.php b/workflow/engine/methods/processes/processes_doUpload.php index 152832ad9..90dc80850 100755 --- a/workflow/engine/methods/processes/processes_doUpload.php +++ b/workflow/engine/methods/processes/processes_doUpload.php @@ -1,29 +1,39 @@ userCanAccess('PM_FACTORY') == 1) { + if (isset( $_SESSION['processes_upload'] )) { + $form = $_SESSION['processes_upload']; + G::LoadClass('processes'); + $app = new Processes(); + if (!$app->processExists($form['PRO_UID'])) { + $result = 0; + $msg = G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED'); + echo "{'result': $result, 'msg':'$msg'}"; + die; + } + switch ($form['MAIN_DIRECTORY']) { + case 'mailTemplates': + $sDirectory = PATH_DATA_MAILTEMPLATES . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : ''); + break; + case 'public': + $sDirectory = PATH_DATA_PUBLIC . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : ''); + break; + default: + die(); + break; + } } -} -if ($_FILES['form']['error'] == "0") { - G::uploadFile( $_FILES['form']['tmp_name'], $sDirectory, $_FILES['form']['name'] ); - $msg = "Uploaded (" . (round( (filesize( $sDirectory . $_FILES['form']['name'] ) / 1024) * 10 ) / 10) . " kb)"; - $result = 1; - //echo $sDirectory.$_FILES['form']['name']; -} else { - $msg = "Failed"; - $result = 0; -} - -echo "{'result': $result, 'msg':'$msg'}"; \ No newline at end of file + if ($_FILES['form']['error'] == "0") { + G::uploadFile( $_FILES['form']['tmp_name'], $sDirectory, $_FILES['form']['name'] ); + $msg = "Uploaded (" . (round( (filesize( $sDirectory . $_FILES['form']['name'] ) / 1024) * 10 ) / 10) . " kb)"; + $result = 1; + //echo $sDirectory.$_FILES['form']['name']; + } else { + $msg = "Failed"; + $result = 0; + } + + echo "{'result': $result, 'msg':'$msg'}"; +} \ No newline at end of file diff --git a/workflow/engine/methods/setup/pluginsList.php b/workflow/engine/methods/setup/pluginsList.php index d86e0eaf3..663256c06 100755 --- a/workflow/engine/methods/setup/pluginsList.php +++ b/workflow/engine/methods/setup/pluginsList.php @@ -58,6 +58,9 @@ if ($handle = opendir( PATH_PLUGINS )) { $status_label = $pluginDetail->enabled ? G::LoadTranslation( 'ID_ENABLED' ) : G::LoadTranslation( 'ID_DISABLED' ); $status = $pluginDetail->enabled ? 1 : 0; if (isset( $pluginDetail->aWorkspaces )) { + if (!is_array($pluginDetail->aWorkspaces)) { + $pluginDetail->aWorkspaces = array(); + } if (! in_array( SYS_SYS, $pluginDetail->aWorkspaces )) continue; } diff --git a/workflow/engine/src/BusinessModel/CaseScheduler.php b/workflow/engine/src/BusinessModel/CaseScheduler.php new file mode 100644 index 000000000..190aa2c2e --- /dev/null +++ b/workflow/engine/src/BusinessModel/CaseScheduler.php @@ -0,0 +1,526 @@ +clearSelectColumns(); + $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 ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_TIME_NEXT_RUN ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_LAST_RUN_TIME ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_STATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_LAST_STATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::USR_UID ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_OPTION ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_START_TIME ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_START_DATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_EVERY_DAYS ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_WEEK_DAYS ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_START_DAY ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_MONTHS ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_END_DATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_REPEAT_EVERY ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_REPEAT_UNTIL ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::CASE_SH_PLUGIN_UID ); + $oCriteria->add( \CaseSchedulerPeer::PRO_UID, $sProcessUID ); + $oDataset = \CaseSchedulerPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aRows = array(); + while ($aRow = $oDataset->getRow()) { + $aRow = array_change_key_case($aRow, CASE_LOWER); + $aRows[] = $aRow; + $oDataset->next(); + } + return $aRows; + } catch (Exception $e) { + throw $e; + } + } + + /** + * Return case scheduler of a project + * @param string $sProcessUID + * @param string $sCaseSchedulerUID + * @return array + * + * @access public + */ + public function getCaseScheduler($sProcessUID = '', $sCaseSchedulerUID = '') + { + try { + $oCriteria = new \Criteria( 'workflow' ); + $oCriteria->clearSelectColumns(); + $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 ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_TIME_NEXT_RUN ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_LAST_RUN_TIME ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_STATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_LAST_STATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::USR_UID ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_OPTION ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_START_TIME ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_START_DATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_EVERY_DAYS ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_WEEK_DAYS ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_START_DAY ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_MONTHS ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_END_DATE ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_REPEAT_EVERY ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_REPEAT_UNTIL ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING ); + $oCriteria->addSelectColumn( \CaseSchedulerPeer::CASE_SH_PLUGIN_UID ); + $oCriteria->add( \CaseSchedulerPeer::PRO_UID, $sProcessUID ); + $oCriteria->add( \CaseSchedulerPeer::SCH_UID, $sCaseSchedulerUID ); + $oDataset = \CaseSchedulerPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aRows = array(); + while ($aRow = $oDataset->getRow()) { + $aRow = array_change_key_case($aRow, CASE_LOWER); + $aRows = $aRow; + $oDataset->next(); + } + return $aRows; + } catch (Exception $e) { + throw $e; + } + } + + + /** + * Create a new case scheduler of a project + * @param string $sProcessUID + * @param array $aData + * @param string $userUID + * @return array + * + * @access public + */ + public function addCaseScheduler($sProcessUID, $aData, $userUID) + { + try { + require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php"); + $aData = array_change_key_case($aData, CASE_UPPER); + $oCaseScheduler = new \CaseScheduler(); + if (empty($aData)) { + die( 'The information sended is empty!' ); + } + $aData['SCH_UID'] = \G::generateUniqueID(); + $aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']); + $aData['SCH_STATE'] = 'ACTIVE'; + $aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE'; + $aData['USR_UID'] = $userUID; + $sOption = $aData['SCH_OPTION']; + if ($aData['SCH_START_DATE'] != '') { + $sDateTmp = $aData['SCH_START_DATE']; + } else { + $sDateTmp = date( 'Y-m-d' ); + } + $sTimeTmp = $aData['SCH_START_TIME']; + // $aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); + // $aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); + $nActualTime = $aData['SCH_START_TIME']; // time(); + $sValue = ''; + $sDaysPerformTask = ''; + $sWeeks = ''; + $sMonths = ''; + $sMonths = ''; + $sStartDay = ''; + $nSW = 0; + switch ($sOption) { + case '1': // Option 1 + $sValue = $aData['SCH_DAYS_PERFORM_TASK']; + switch ($sValue) { + case '1': + $aData['SCH_DAYS_PERFORM_TASK'] = $aData['SCH_DAYS_PERFORM_TASK'] . '|1'; + break; + case '2': + $aData['SCH_OPTION'] = '2'; + $aData['SCH_EVERY_DAYS'] = '1'; //check + $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; //check + break; + case '3': // Every [n] Days + $sDaysPerformTask = $aData['SCH_DAYS_PERFORM_TASK_OPT_3']; + $aData['SCH_DAYS_PERFORM_TASK'] = $aData['SCH_DAYS_PERFORM_TASK'] . '|' . $aData['SCH_DAYS_PERFORM_TASK_OPT_3']; + break; + } + break; + case '2': // If the option is zero, set by default 1 + if (empty( $aData['SCH_EVERY_DAYS'] )) { + $nEveryDays = 1; + } else { + $nEveryDays = $aData['SCH_EVERY_DAYS']; + } + $aData['SCH_EVERY_DAYS'] = $nEveryDays; + $sWeeks = ''; + if (! empty( $aData['SCH_WEEK_DAYS'] )) { + $aWeekDays = $aData['SCH_WEEK_DAYS']; + foreach ($aWeekDays as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + if (! empty( $aData['SCH_WEEK_DAYS_2'] )) { + $aWeekDays2 = $aData['SCH_WEEK_DAYS_2']; + foreach ($aWeekDays2 as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + $sStartTime = $aData['SCH_START_TIME']; + $aData['SCH_WEEK_DAYS'] = $sWeeks; + break; + case '3': + $nStartDay = $aData['SCH_START_DAY']; + if ($nStartDay == 1) { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_1']; + } else { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $aData['SCH_START_DAY_OPT_2_DAYS_WEEK']; + } + + $sMonths = ''; + if (! empty( $aData['SCH_MONTHS'] )) { + $aMonths = $aData['SCH_MONTHS']; + foreach ($aMonths as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $aData['SCH_MONTHS_2'] )) { + $aMonths2 = $aData['SCH_MONTHS_2']; + foreach ($aMonths2 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $aData['SCH_MONTHS_3'] )) { + $aMonths3 = $aData['SCH_MONTHS_3']; + foreach ($aMonths3 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + $aData['SCH_MONTHS'] = $sMonths; + $sStartDay = $aData['SCH_START_DAY']; + $sValue = $nStartDay; + break; + } + if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) { + if ($sStartDay == '') { + $sStartDay = date( 'Y-m-d' ); + } + $dCurrentDay = date( "d" ); + $dCurrentMonth = date( "m" ); + $aStartDay = explode( "|", $aData['SCH_START_DAY'] ); + if ($sOption == '3' && $aStartDay[0] == '1') { + $monthsArray = explode( "|", $sMonths ); + foreach ($monthsArray as $row) { + if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { + $startTime = $aData['SCH_START_TIME'] . ":00"; + $aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; + break; + } else { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + } + } + } else { +/* echo $sOption; echo " - "; + echo $sValue; echo " - "; echo $nActualTime; echo " - "; echo $sDaysPerformTask; echo " - "; echo $sWeeks; + echo " - "; echo $sStartDay; echo " - "; echo $sMonths; echo " - "; echo $sDateTmp; die(); + + */ + echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."
"; + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + echo $aData['SCH_TIME_NEXT_RUN']; die (); + } + + } else { + if ($sOption == '4') { + $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; + } + + $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; + + if ($sOption == 5) { + $aData['SCH_START_TIME'] = time(); + $aData['SCH_START_DATE'] = $aData['SCH_START_TIME']; + $nextRun = $aData['SCH_REPEAT_EVERY'] * 60 * 60; + $aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY']; + $date = $aData['SCH_START_TIME']; + $date += $nextRun; + $date = date( "Y-m-d H:i", $date ); + $aData['SCH_TIME_NEXT_RUN'] = $date; + } + } + if (trim( $aData['SCH_END_DATE'] ) != '') { + $aData['SCH_END_DATE'] = $aData['SCH_END_DATE']; + } + if (! empty( $aData['SCH_REPEAT_TASK_CHK'] )) { + $nOptEvery = $aData['SCH_REPEAT_EVERY_OPT']; + if ($nOptEvery == 2) { + $aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY'] * 60; + } else { + $aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY']; + } + } + if ((isset( $aData['CASE_SH_PLUGIN_UID'] )) && ($aData['CASE_SH_PLUGIN_UID'] != "")) { + $aData['CASE_SH_PLUGIN_UID'] = $aData['CASE_SH_PLUGIN_UID']; + } + $oCaseScheduler->create( $aData ); + $oCriteria = $this->getCaseScheduler($sProcessUID, $aData['SCH_UID']); + return $oCriteria; + } catch (Exception $oException) { + die( $oException->getMessage() ); + } + } + + /** + * Update case scheduler for a project + * @param string $sProcessUID + * @param string $sSchUID + * @param array $aData + * @param string $userUID + * + * @access public + */ + public function updateCaseScheduler($sProcessUID, $sSchUID = '', $aData, $userUID) + { + try { + require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php"); + $aData = array_change_key_case($aData, CASE_UPPER); + if (empty( $aData )) { + die( 'The information sended is empty!' ); + } + $oCaseScheduler = new \CaseScheduler(); + + $oCaseScheduler->Load($sSchUID); + $aData['SCH_DEL_USER_NAME'] = $aData['SCH_USER_NAME']; + if ($aData['SCH_USER_PASSWORD'] != 'DefaultPM') { + $aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_USER_PASSWORD'] ); + } + $aData['SCH_DEL_USER_UID'] = $aData['SCH_USER_UID']; + $aData['USR_UID'] = $userUID; + $sOption = $aData['SCH_OPTION']; + $sDateTmp = $aData['SCH_START_DATE']; + $sTimeTmp = $aData['SCH_START_TIME']; +// $aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); +// $aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) ); + $previousStartTime = date( 'Y-m-d', strtotime( $aData['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $aData['PREV_SCH_START_TIME'] ) ); + $previousStartDate = date( 'Y-m-d', strtotime( $aData['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $aData['PREV_SCH_START_TIME'] ) ); + $sValue = ''; + $sDaysPerformTask = ''; + $sWeeks = ''; + $sMonths = ''; + $sMonths = ''; + $sStartDay = ''; + $nSW = 0; + switch ($sOption) { + case '1': + // Option 1 + $sValue = $aData['SCH_DAYS_PERFORM_TASK']; + switch ($sValue) { + case '1': + $aData['SCH_DAYS_PERFORM_TASK'] = $aData['SCH_DAYS_PERFORM_TASK'] . '|1'; + break; + case '2': + $aData['SCH_OPTION'] = '2'; + $aData['SCH_EVERY_DAYS'] = '1'; + $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; + break; + case '3': // Every [n] Days + $sDaysPerformTask = $aData['SCH_DAYS_PERFORM_TASK_OPT_3']; + $aData['SCH_DAYS_PERFORM_TASK'] = $aData['SCH_DAYS_PERFORM_TASK'] . '|' . $aData['SCH_DAYS_PERFORM_TASK_OPT_3']; + break; + } + break; + case '2': + // If the option is zero, set by default 1 + if (empty( $aData['SCH_EVERY_DAYS'] )) { + $nEveryDays = 1; + } else { + $nEveryDays = $aData['SCH_EVERY_DAYS']; + } + $aData['SCH_EVERY_DAYS'] = $nEveryDays; + $sWeeks = ''; + if (! empty( $aData['SCH_WEEK_DAYS'] )) { + $aWeekDays = $aData['SCH_WEEK_DAYS']; + foreach ($aWeekDays as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + if (! empty( $aData['SCH_WEEK_DAYS_2'] )) { + $aWeekDays2 = $aData['SCH_WEEK_DAYS_2']; + foreach ($aWeekDays2 as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + $sStartTime = $aData['SCH_START_TIME']; + $aData['SCH_WEEK_DAYS'] = $sWeeks; + break; + case '3': + $nStartDay = $aData['SCH_START_DAY']; + if ($nStartDay == 1) { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_1']; + } else { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $aData['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $aData['SCH_START_DAY_OPT_2_DAYS_WEEK']; + } + + $sMonths = ''; + if (! empty( $aData['SCH_MONTHS'] )) { + $aMonths = $aData['SCH_MONTHS']; + foreach ($aMonths as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $aData['SCH_MONTHS_2'] )) { + $aMonths2 = $aData['SCH_MONTHS_2']; + foreach ($aMonths2 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + if (! empty( $aData['SCH_MONTHS_3'] )) { + $aMonths3 = $aData['SCH_MONTHS_3']; + foreach ($aMonths3 as $value) { + $sMonths = $sMonths . $value . '|'; + } + } + $aData['SCH_MONTHS'] = $sMonths; + $sStartDay = $aData['SCH_START_DAY']; + $sValue = $nStartDay; + break; + + } + if (trim( $aData['SCH_END_DATE'] ) != '') { + $aData['SCH_END_DATE'] = $aData['SCH_END_DATE']; + } + // if the start date has changed then recalculate the next run time + if ($aData['SCH_START_DATE'] == $aData['PREV_SCH_START_DATE']) { + $recalculateDate = false; + } else { + $recalculateDate = true; + } + if (date( 'H:i:s', strtotime( $aData['SCH_START_TIME'] ) ) == date( 'H:i:s', strtotime( $aData['PREV_SCH_START_TIME'] ) )) { + $recalculateTime = false; + } else { + $recalculateTime = true; + } + // if the start date has changed then recalculate the next run time + $nActualTime = $aData['SCH_START_TIME']; + if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) { + if ($sStartDay == '') { + $sStartDay = date( 'Y-m-d' ); + } + $dCurrentDay = date( "d" ); + $dCurrentMonth = date( "m" ); + $aStartDay = explode( "|", $aData['SCH_START_DAY'] ); + if ($sOption == '3' && $aStartDay[0] == '1') { + $monthsArray = explode( "|", $sMonths ); + foreach ($monthsArray as $row) { + if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) { + $startTime = $_POST['form']['SCH_START_TIME'] . ":00"; + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; + } elseif ($recalculateTime) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; + } + break; + } else { + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + } elseif ($recalculateTime) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; + } + } + } + } else { + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp ); + } elseif ($recalculateTime) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00"; + } + } + } else { + if ($sOption == '4') { + $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; + } + if ($recalculateDate) { + $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; + } elseif ($recalculateTime) { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $aData['SCH_START_TIME'] . ":00"; + } + if ($sOption == '5') { + $date = $oCaseScheduler->getSchLastRunTime(); + if ($date == null) { + $date = $oCaseScheduler->getSchStartTime(); + } + $date = strtotime( $date ); + $nextRun = $aData['SCH_REPEAT_EVERY'] * 60 * 60; + $aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY']; + $date += $nextRun; + $date = date( "Y-m-d H:i", $date ); + $aData['SCH_TIME_NEXT_RUN'] = $date; + } + } + if (! empty( $aData['SCH_REPEAT_TASK_CHK'] )) { + $nOptEvery = $aData['SCH_REPEAT_EVERY_OPT']; + if ($nOptEvery == 2) { + $aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY'] * 60; + } else { + $aData['SCH_REPEAT_EVERY'] = $aData['SCH_REPEAT_EVERY']; + } + } + $aData["SCH_UID"] = $sSchUID; + $oCaseScheduler->Update($aData); + $oCriteria = $this->getCaseScheduler($sProcessUID, $sSchUID); + return $oCriteria; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete a case scheduler of a project + * + * @param string $sProcessUID + * @param string $sSchUID + * + * @access public + */ + public function deleteCaseScheduler($sProcessUID, $sSchUID) + { + try { + require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php"); + $oCaseScheduler = new \CaseScheduler(); + if ( !isset($sSchUID ) ) { + return; + } + $oCaseScheduler->remove($sSchUID); + } catch (\Exception $e) { + throw $e; + } + } + +} + diff --git a/workflow/engine/src/BusinessModel/CaseTracker.php b/workflow/engine/src/BusinessModel/CaseTracker.php new file mode 100644 index 000000000..273bb6c68 --- /dev/null +++ b/workflow/engine/src/BusinessModel/CaseTracker.php @@ -0,0 +1,442 @@ +exists($processUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}"))); + } + + //Update + $caseTracker = new \CaseTracker(); + + $arrayData = array("PRO_UID" => $processUid); + + if (isset($arrayDataIni["map_type"])) { + $arrayData["CT_MAP_TYPE"] = $arrayDataIni["map_type"]; + } + + if (isset($arrayDataIni["routing_history"])) { + $arrayData["CT_DERIVATION_HISTORY"] = ($arrayDataIni["routing_history"])? 1 : 0; + } + + if (isset($arrayDataIni["message_history"])) { + $arrayData["CT_MESSAGE_HISTORY"] = ($arrayDataIni["message_history"])? 1 : 0; + } + + $result = $caseTracker->update($arrayData); + + $arrayData = $arrayDataIni; + + //Return + return $arrayData; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Case Tracker data of a Process + * + * @param string $processUid Unique id of Process + * + * return array Return an array with data of Case Tracker of a Process + */ + public function getCaseTracker($processUid) + { + try { + $arrayCaseTracker = array(); + + //Verify data + $process = new \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}"))); + } + + //Get data + $criteria = new \Criteria(); + + $criteria->add(\CaseTrackerPeer::PRO_UID, $processUid, \Criteria::EQUAL); + + $rsCriteria = \CaseTrackerPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $arrayCaseTracker = $row; + } else { + $caseTracker = new \CaseTracker(); + + $arrayCaseTracker = array( + "PRO_UID" => $processUid, + "CT_MAP_TYPE" => "PROCESSMAP", + "CT_DERIVATION_HISTORY" => 1, + "CT_MESSAGE_HISTORY" => 1 + ); + + $caseTracker->create($arrayCaseTracker); + } + + return array( + "map_type" => $arrayCaseTracker["CT_MAP_TYPE"], + "routing_history" => ($arrayCaseTracker["CT_DERIVATION_HISTORY"] == 1)? true : false, + "message_history" => ($arrayCaseTracker["CT_MESSAGE_HISTORY"] == 1)? true : false + ); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get available Case Tracker Objects of a Process + * + * @param string $processUid Unique id of Process + * + * return array Return an array with the Case Tracker Objects available of a Process + */ + public function getAvailableCaseTrackerObjects($processUid) + { + try { + $arrayAvailableCaseTrackerObject = array(); + + //Verify data + $process = new \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}"))); + } + + //Get Uids + $arrayDynaFormUid = array(); + $arrayInputDocumentUid = array(); + $arrayOutputDocumentUid = array(); + + $criteria = new \Criteria("workflow"); + + $criteria->add(\CaseTrackerObjectPeer::PRO_UID, $processUid, \Criteria::EQUAL); + + $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + switch ($row["CTO_TYPE_OBJ"]) { + case "DYNAFORM": + $arrayDynaFormUid[] = $row["CTO_UID_OBJ"]; + break; + case "INPUT_DOCUMENT": + $arrayInputDocumentUid[] = $row["CTO_UID_OBJ"]; + break; + case "OUTPUT_DOCUMENT": + $arrayOutputDocumentUid[] = $row["CTO_UID_OBJ"]; + break; + } + } + + //Array DB + $arrayCaseTrackerObject = array(); + + $arrayCaseTrackerObject[] = array( + "obj_uid" => "char", + "obj_title" => "char", + "obj_description" => "char", + "obj_type" => "char" + ); + + $delimiter = \DBAdapter::getStringDelimiter(); + + //DynaForms + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\DynaformPeer::DYN_UID); + $criteria->addAsColumn("DYN_TITLE", "CT.CON_VALUE"); + $criteria->addAsColumn("DYN_DESCRIPTION", "CD.CON_VALUE"); + + $criteria->addAlias("CT", \ContentPeer::TABLE_NAME); + $criteria->addAlias("CD", \ContentPeer::TABLE_NAME); + + $arrayCondition = array(); + $arrayCondition[] = array(\DynaformPeer::DYN_UID, "CT.CON_ID", \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "DYN_TITLE" . $delimiter, \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $arrayCondition = array(); + $arrayCondition[] = array(\DynaformPeer::DYN_UID, "CD.CON_ID", \Criteria::EQUAL); + $arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "DYN_DESCRIPTION" . $delimiter, \Criteria::EQUAL); + $arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $criteria->add(\DynaformPeer::PRO_UID, $processUid, \Criteria::EQUAL); + $criteria->add(\DynaformPeer::DYN_UID, $arrayDynaFormUid, \Criteria::NOT_IN); + $criteria->add(\DynaformPeer::DYN_TYPE, "xmlform", \Criteria::EQUAL); + + $rsCriteria = \DynaformPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + if ($row["DYN_TITLE"] . "" == "") { + //There is no transaltion for this Document name, try to get/regenerate the label + $row["DYN_TITLE"] = \Content::Load("DYN_TITLE", "", $row["DYN_UID"], SYS_LANG); + } + + $arrayCaseTrackerObject[] = array( + "obj_uid" => $row["DYN_UID"], + "obj_title" => $row["DYN_TITLE"], + "obj_description" => $row["DYN_DESCRIPTION"], + "obj_type" => "DYNAFORM" + ); + } + + //InputDocuments + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\InputDocumentPeer::INP_DOC_UID); + $criteria->addAsColumn("INP_DOC_TITLE", "CT.CON_VALUE"); + $criteria->addAsColumn("INP_DOC_DESCRIPTION", "CD.CON_VALUE"); + + $criteria->addAlias("CT", \ContentPeer::TABLE_NAME); + $criteria->addAlias("CD", \ContentPeer::TABLE_NAME); + + $arrayCondition = array(); + $arrayCondition[] = array(\InputDocumentPeer::INP_DOC_UID, "CT.CON_ID", \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "INP_DOC_TITLE" . $delimiter, \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $arrayCondition = array(); + $arrayCondition[] = array(\InputDocumentPeer::INP_DOC_UID, "CD.CON_ID", \Criteria::EQUAL); + $arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "INP_DOC_DESCRIPTION" . $delimiter, \Criteria::EQUAL); + $arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $criteria->add(\InputDocumentPeer::PRO_UID, $processUid, \Criteria::EQUAL); + $criteria->add(\InputDocumentPeer::INP_DOC_UID, $arrayInputDocumentUid, \Criteria::NOT_IN); + + $rsCriteria = \InputDocumentPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + if ($row["INP_DOC_TITLE"] . "" == "") { + //There is no transaltion for this Document name, try to get/regenerate the label + $row["INP_DOC_TITLE"] = \Content::Load("INP_DOC_TITLE", "", $row["INP_DOC_UID"], SYS_LANG); + } + + $arrayCaseTrackerObject[] = array( + "obj_uid" => $row["INP_DOC_UID"], + "obj_title" => $row["INP_DOC_TITLE"], + "obj_description" => $row["INP_DOC_DESCRIPTION"], + "obj_type" => "INPUT_DOCUMENT" + ); + } + + //OutputDocuments + $criteria = new \Criteria("workflow"); + + $criteria->addSelectColumn(\OutputDocumentPeer::OUT_DOC_UID); + $criteria->addAsColumn("OUT_DOC_TITLE", "CT.CON_VALUE"); + $criteria->addAsColumn("OUT_DOC_DESCRIPTION", "CD.CON_VALUE"); + + $criteria->addAlias("CT", \ContentPeer::TABLE_NAME); + $criteria->addAlias("CD", \ContentPeer::TABLE_NAME); + + $arrayCondition = array(); + $arrayCondition[] = array(\OutputDocumentPeer::OUT_DOC_UID, "CT.CON_ID", \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "OUT_DOC_TITLE" . $delimiter, \Criteria::EQUAL); + $arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $arrayCondition = array(); + $arrayCondition[] = array(\OutputDocumentPeer::OUT_DOC_UID, "CD.CON_ID", \Criteria::EQUAL); + $arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "OUT_DOC_DESCRIPTION" . $delimiter, \Criteria::EQUAL); + $arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + + $criteria->add(\OutputDocumentPeer::PRO_UID, $processUid, \Criteria::EQUAL); + $criteria->add(\OutputDocumentPeer::OUT_DOC_UID, $arrayOutputDocumentUid, \Criteria::NOT_IN); + + $rsCriteria = \OutputDocumentPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + if ($row["OUT_DOC_TITLE"] . "" == "") { + //There is no transaltion for this Document name, try to get/regenerate the label + $row["OUT_DOC_TITLE"] = \Content::Load("OUT_DOC_TITLE", "", $row["OUT_DOC_UID"], SYS_LANG); + } + + $arrayCaseTrackerObject[] = array( + "obj_uid" => $row["OUT_DOC_UID"], + "obj_title" => $row["OUT_DOC_TITLE"], + "obj_description" => $row["OUT_DOC_DESCRIPTION"], + "obj_type" => "OUTPUT_DOCUMENT" + ); + } + + //Set data + \G::LoadClass("ArrayPeer"); + + global $_DBArray; + + $_DBArray = (isset($_SESSION["_DBArray"]))? $_SESSION["_DBArray"] : ""; + $_DBArray["CASE_TRACKER_OBJECT"] = $arrayCaseTrackerObject; + + $_SESSION["_DBArray"] = $_DBArray; + + $criteria = new \Criteria("dbarray"); + + $criteria->setDBArrayTable("CASE_TRACKER_OBJECT"); + $criteria->addAscendingOrderByColumn("obj_type"); + $criteria->addAscendingOrderByColumn("obj_title"); + + $rsCriteria = \ArrayBasePeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $arrayAvailableCaseTrackerObject[] = $row; + } + + return $arrayAvailableCaseTrackerObject; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get all Case Tracker Objects of a Process + * + * @param string $processUid Unique id of Process + * + * return array Return an array with all Case Tracker Objects of a Process + */ + public function getCaseTrackerObjects($processUid) + { + try { + $arrayCaseTrackerObject = array(); + + //Verify data + $process = new \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}"))); + } + + $dynaform = new \Dynaform(); + $inputDocument = new \InputDocument(); + $outputDocument = new \OutputDocument(); + + //Array DB + $arraydbCaseTrackerObject = array(); + + $arraydbCaseTrackerObject[] = array( + "cto_uid" => "char", + "cto_type_obj" => "char", + "cto_uid_obj" => "char", + "cto_condition" => "char", + "cto_position" => "integer", + "obj_title" => "char", + "obj_description" => "char" + ); + + $criteria = new \Criteria("workflow"); + + $criteria->add(\CaseTrackerObjectPeer::PRO_UID, $processUid, \Criteria::EQUAL); + + $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $titleObj = ""; + $descriptionObj = ""; + + switch ($row["CTO_TYPE_OBJ"]) { + case "DYNAFORM": + $arrayData = $dynaform->load($row["CTO_UID_OBJ"]); + + $titleObj = $arrayData["DYN_TITLE"]; + $descriptionObj = $arrayData["DYN_DESCRIPTION"]; + break; + case "INPUT_DOCUMENT": + $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]); + + $titleObj = $arrayData["INP_DOC_TITLE"]; + $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"]; + break; + case "OUTPUT_DOCUMENT": + $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]); + + $titleObj = $arrayData["OUT_DOC_TITLE"]; + $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"]; + break; + } + + $arraydbCaseTrackerObject[] = array( + "cto_uid" => $row["CTO_UID"], + "cto_type_obj" => $row["CTO_TYPE_OBJ"], + "cto_uid_obj" => $row["CTO_UID_OBJ"], + "cto_condition" => $row["CTO_CONDITION"], + "cto_position" => (int)($row["CTO_POSITION"]), + "obj_title" => $titleObj, + "obj_description" => $descriptionObj + ); + } + + //Set data + \G::LoadClass("ArrayPeer"); + + global $_DBArray; + + $_DBArray = (isset($_SESSION["_DBArray"]))? $_SESSION["_DBArray"] : ""; + $_DBArray["CASE_TRACKER_OBJECT"] = $arraydbCaseTrackerObject; + + $_SESSION["_DBArray"] = $_DBArray; + + $criteria = new \Criteria("dbarray"); + + $criteria->setDBArrayTable("CASE_TRACKER_OBJECT"); + $criteria->addAscendingOrderByColumn("cto_position"); + + $rsCriteria = \ArrayBasePeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $arrayCaseTrackerObject[] = $row; + } + + return $arrayCaseTrackerObject; + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/BusinessModel/CaseTrackerObject.php b/workflow/engine/src/BusinessModel/CaseTrackerObject.php new file mode 100644 index 000000000..c4d6bacf9 --- /dev/null +++ b/workflow/engine/src/BusinessModel/CaseTrackerObject.php @@ -0,0 +1,317 @@ +addSelectColumn(\CaseTrackerObjectPeer::CTO_UID); + $criteria->add(\CaseTrackerObjectPeer::PRO_UID, $processUid, \Criteria::EQUAL); + + if ($caseTrackerObjectUidExclude != "") { + $criteria->add(\CaseTrackerObjectPeer::CTO_UID, $caseTrackerObjectUidExclude, \Criteria::NOT_EQUAL); + } + + if ($type != "") { + $criteria->add(\CaseTrackerObjectPeer::CTO_TYPE_OBJ, $type, \Criteria::EQUAL); + } + + if ($objectUid != "") { + $criteria->add(\CaseTrackerObjectPeer::CTO_UID_OBJ, $objectUid, \Criteria::EQUAL); + } + + if ($position > 0) { + $criteria->add(\CaseTrackerObjectPeer::CTO_POSITION, $position, \Criteria::EQUAL); + } + + $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteria->next()) { + return true; + } else { + return false; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Create Case Tracker Object for a Process + * + * @param string $processUid Unique id of Process + * @param array $arrayData Data + * + * return array Return data of the new Case Tracker Object created + */ + public function create($processUid, $arrayData) + { + try { + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + unset($arrayData["CTO_UID"]); + + //Verify data + $process = new \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}"))); + } + + if (!isset($arrayData["CTO_TYPE_OBJ"])) { + throw (new \Exception(str_replace(array("{0}"), array("CTO_TYPE_OBJ"), "The \"{0}\" attribute is not defined"))); + } + + if (!isset($arrayData["CTO_UID_OBJ"])) { + throw (new \Exception(str_replace(array("{0}"), array("CTO_UID_OBJ"), "The \"{0}\" attribute is not defined"))); + } + + $step = new \BusinessModel\Step(); + + $msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]); + + if ($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}"))); + } + + if (isset($arrayData["CTO_POSITION"]) && $this->existsRecord($processUid, "", "", $arrayData["CTO_POSITION"])) { + throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["CTO_POSITION"], $processUid . ", " . $arrayData["CTO_POSITION"], "CASE_TRACKER_OBJECT"), "The \"{0}\" position for the record \"{1}\", exists in table {2}"))); + } + + //Create + $caseTrackerObject = new \CaseTrackerObject(); + + $arrayData["PRO_UID"] = $processUid; + + if (!isset($arrayData["CTO_POSITION"])) { + $criteria = new \Criteria("workflow"); + + $criteria->add(\CaseTrackerObjectPeer::PRO_UID, $processUid); + + $arrayData["CTO_POSITION"] = \CaseTrackerObjectPeer::doCount($criteria) + 1; + } + + $caseTrackerObjectUid = $caseTrackerObject->create($arrayData); + + //Return + unset($arrayData["PRO_UID"]); + + $arrayData = array_change_key_case($arrayData, CASE_LOWER); + + unset($arrayData["cto_uid"]); + + return array_merge(array("cto_uid" => $caseTrackerObjectUid), $arrayData); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Update Case Tracker Object + * + * @param string $caseTrackerObjectUid Unique id of Case Tracker Object + * @param array $arrayData Data + * + * return array Return data of the Case Tracker Object updated + */ + public function update($caseTrackerObjectUid, $arrayData) + { + try { + $arrayData = array_change_key_case($arrayData, CASE_UPPER); + + $caseTrackerObject = new \CaseTrackerObject(); + + $arrayCaseTrackerObjectData = $caseTrackerObject->load($caseTrackerObjectUid); + + //Uids + $processUid = $arrayCaseTrackerObjectData["PRO_UID"]; + + //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}"))); + } + + if (isset($arrayData["CTO_TYPE_OBJ"]) && !isset($arrayData["CTO_UID_OBJ"])) { + throw (new \Exception(str_replace(array("{0}"), array("CTO_UID_OBJ"), "The \"{0}\" attribute is not defined"))); + } + + if (!isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) { + throw (new \Exception(str_replace(array("{0}"), array("CTO_TYPE_OBJ"), "The \"{0}\" attribute is not defined"))); + } + + if (isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"])) { + $step = new \BusinessModel\Step(); + + $msg = $step->existsObjectUid($arrayData["CTO_TYPE_OBJ"], $arrayData["CTO_UID_OBJ"]); + + if ($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}"))); + } + } + + if (isset($arrayData["CTO_POSITION"]) && $this->existsRecord($processUid, "", "", $arrayData["CTO_POSITION"], $caseTrackerObjectUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["CTO_POSITION"], $processUid . ", " . $arrayData["CTO_POSITION"], "CASE_TRACKER_OBJECT"), "The \"{0}\" position for the record \"{1}\", exists in table {2}"))); + } + + //Flags + $flagDataOject = (isset($arrayData["CTO_TYPE_OBJ"]) && isset($arrayData["CTO_UID_OBJ"]))? 1 : 0; + $flagDataCondition = (isset($arrayData["CTO_CONDITION"]))? 1 : 0; + $flagDataPosition = (isset($arrayData["CTO_POSITION"]))? 1 : 0; + + //Update + $arrayData["CTO_UID"] = $caseTrackerObjectUid; + + $arrayData = array_merge($arrayCaseTrackerObjectData, $arrayData); + + $result = $caseTrackerObject->update($arrayData); + + //Return + unset($arrayData["CTO_UID"]); + + if ($flagDataOject == 0) { + unset($arrayData["CTO_TYPE_OBJ"]); + unset($arrayData["CTO_UID_OBJ"]); + } + + if ($flagDataCondition == 0) { + unset($arrayData["CTO_CONDITION"]); + } + + if ($flagDataPosition == 0) { + unset($arrayData["CTO_POSITION"]); + } + + unset($arrayData["PRO_UID"]); + + return array_change_key_case($arrayData, CASE_LOWER); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete Case Tracker Object + * + * @param string $caseTrackerObjectUid Unique id of Case Tracker Object + * + * return void + */ + public function delete($caseTrackerObjectUid) + { + try { + $caseTrackerObject = new \CaseTrackerObject(); + + $arrayCaseTrackerObjectData = $caseTrackerObject->load($caseTrackerObjectUid); + + //Uids + $processUid = $arrayCaseTrackerObjectData["PRO_UID"]; + + //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}"))); + } + + //Delete + $result = $caseTrackerObject->remove($caseTrackerObjectUid); + + $caseTrackerObject->reorderPositions($processUid, $arrayCaseTrackerObjectData["CTO_POSITION"]); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Case Tracker Object + * + * @param string $caseTrackerObjectUid Unique id of Case Tracker Object + * + * return array Return an array with data of a Case Tracker Object + */ + public function getCaseTrackerObject($caseTrackerObjectUid) + { + try { + //Verify data + $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}"))); + } + + //Get data + $dynaform = new \Dynaform(); + $inputDocument = new \InputDocument(); + $outputDocument = new \OutputDocument(); + + $criteria = new \Criteria("workflow"); + + $criteria->add(\CaseTrackerObjectPeer::CTO_UID, $caseTrackerObjectUid, \Criteria::EQUAL); + + $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + + $row = $rsCriteria->getRow(); + + $titleObj = ""; + $descriptionObj = ""; + + switch ($row["CTO_TYPE_OBJ"]) { + case "DYNAFORM": + $arrayData = $dynaform->load($row["CTO_UID_OBJ"]); + + $titleObj = $arrayData["DYN_TITLE"]; + $descriptionObj = $arrayData["DYN_DESCRIPTION"]; + break; + case "INPUT_DOCUMENT": + $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]); + + $titleObj = $arrayData["INP_DOC_TITLE"]; + $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"]; + break; + case "OUTPUT_DOCUMENT": + $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]); + + $titleObj = $arrayData["OUT_DOC_TITLE"]; + $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"]; + break; + } + + return array( + "cto_uid" => $row["CTO_UID"], + "cto_type_obj" => $row["CTO_TYPE_OBJ"], + "cto_uid_obj" => $row["CTO_UID_OBJ"], + "cto_condition" => $row["CTO_CONDITION"], + "cto_position" => (int)($row["CTO_POSITION"]), + "obj_title" => $titleObj, + "obj_description" => $descriptionObj + ); + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/BusinessModel/DynaForm.php b/workflow/engine/src/BusinessModel/DynaForm.php index 73e3a5cc2..9304347f8 100644 --- a/workflow/engine/src/BusinessModel/DynaForm.php +++ b/workflow/engine/src/BusinessModel/DynaForm.php @@ -242,6 +242,11 @@ class DynaForm try { $arrayData = array_change_key_case($arrayData, CASE_UPPER); + //Uids + $arrayDataUid = $this->getDataUids($dynaFormUid); + + $processUid = $arrayDataUid["PRO_UID"]; + //Verify data $dynaForm = new \Dynaform(); @@ -249,12 +254,6 @@ class DynaForm throw (new \Exception(str_replace(array("{0}", "{1}"), array($dynaFormUid, "DYNAFORM"), "The UID \"{0}\" doesn't exist in table {1}"))); } - //Uids - $arrayDataUid = $this->getDataUids($dynaFormUid); - - $processUid = $arrayDataUid["PRO_UID"]; - - //Verify data if (isset($arrayData["DYN_TITLE"]) && $this->titleExists($processUid, $arrayData["DYN_TITLE"], $dynaFormUid)) { throw (new \Exception(\G::LoadTranslation("ID_EXIST_DYNAFORM"))); } @@ -283,6 +282,11 @@ class DynaForm public function delete($dynaFormUid) { try { + //Uids + $arrayDataUid = $this->getDataUids($dynaFormUid); + + $processUid = $arrayDataUid["PRO_UID"]; + //Verify data $dynaForm = new \Dynaform(); @@ -290,12 +294,6 @@ class DynaForm throw (new \Exception(str_replace(array("{0}", "{1}"), array($dynaFormUid, "DYNAFORM"), "The UID \"{0}\" doesn't exist in table {1}"))); } - //Uids - $arrayDataUid = $this->getDataUids($dynaFormUid); - - $processUid = $arrayDataUid["PRO_UID"]; - - //Verify data if ($this->dynaFormAssignedStep($dynaFormUid, $processUid)) { throw (new \Exception("You cannot delete this Dynaform while it is assigned to a step")); } diff --git a/workflow/engine/src/BusinessModel/Event.php b/workflow/engine/src/BusinessModel/Event.php index db552640d..c5dfa7b96 100644 --- a/workflow/engine/src/BusinessModel/Event.php +++ b/workflow/engine/src/BusinessModel/Event.php @@ -21,6 +21,11 @@ class Event */ public function getEvents($sProcessUID, $filter = '', $sEventUID = '') { + $oProcess = new \Process(); + if (!($oProcess->processExists($sProcessUID))) { + throw (new \Exception( 'This process doesn\'t exist!' )); + } + $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\EventPeer::EVN_UID); @@ -88,6 +93,12 @@ class Event if ( ($sProcessUID == '') || (count($dataEvent) == 0) ) { return false; } + + $oProcess = new \Process(); + if (!($oProcess->processExists($sProcessUID))) { + throw (new \Exception( 'This process doesn\'t exist!' )); + } + $dataEvent = array_change_key_case($dataEvent, CASE_UPPER); if ( $create && (isset($dataEvent['ENV_UID'])) ) { diff --git a/workflow/engine/src/BusinessModel/OutputDocument.php b/workflow/engine/src/BusinessModel/OutputDocument.php index 6c4aa665d..ba297dcc3 100644 --- a/workflow/engine/src/BusinessModel/OutputDocument.php +++ b/workflow/engine/src/BusinessModel/OutputDocument.php @@ -113,7 +113,7 @@ class OutputDocument /** * Return a single output document of a project * @param string $sProcessUID - * @param string $sOutputDocumentUID + * @param string $sOutputDocumentUID * @return array * * @access public @@ -228,6 +228,15 @@ class OutputDocument */ public function addOutputDocument($sProcessUID, $aData) { + $pemission = $aData['out_doc_pdf_security_permissions']; + $pemission = explode("|", $pemission); + foreach ($pemission as $row) { + if ($row == "print" || $row == "modify" || $row == "copy" || $row == "forms") { + $aData['out_doc_pdf_security_permissions'] = $aData['out_doc_pdf_security_permissions']; + } else { + throw (new \Exception( 'invalid value specified for `out_doc_pdf_security_permissions`')); + } + } try { require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "OutputDocument.php"); $aData = array_change_key_case($aData, CASE_UPPER); @@ -274,7 +283,17 @@ class OutputDocument * @access public */ public function updateOutputDocument($sProcessUID, $sOutputDocumentUID = '', $aData) - { $oConnection = \Propel::getConnection(\OutputDocumentPeer::DATABASE_NAME); + { + $oConnection = \Propel::getConnection(\OutputDocumentPeer::DATABASE_NAME); + $pemission = $aData['out_doc_pdf_security_permissions']; + $pemission = explode("|", $pemission); + foreach ($pemission as $row) { + if ($row == "print" || $row == "modify" || $row == "copy" || $row == "forms") { + $aData['out_doc_pdf_security_permissions'] = $aData['out_doc_pdf_security_permissions']; + } else { + throw (new \Exception( 'invalid value specified for `out_doc_pdf_security_permissions`')); + } + } try { $aData = array_change_key_case($aData, CASE_UPPER); $oOutputDocument = \OutputDocumentPeer::retrieveByPK($sOutputDocumentUID); diff --git a/workflow/engine/src/BusinessModel/ProcessPermissions.php b/workflow/engine/src/BusinessModel/ProcessPermissions.php new file mode 100644 index 000000000..cdd819333 --- /dev/null +++ b/workflow/engine/src/BusinessModel/ProcessPermissions.php @@ -0,0 +1,256 @@ + + * @copyright Colosa - Bolivia + */ +class ProcessPermissions +{ + /** + * Get list for Process Permissions + * + * @var string $sProcessUID. Uid for Process + * @var string $sPermissionUid. Uid for Process Permission + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return array + */ + public function getProcessPermissions($sProcessUID, $sPermissionUid = '') + { + G::LoadClass('case'); + Cases::verifyTable(); + $aObjectsPermissions = array(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID); + if ($sPermissionUid != '') { + $oCriteria->add(ObjectPermissionPeer::OP_UID, $sPermissionUid); + } + $oDataset = ObjectPermissionPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + //Obtain task target + if (($aRow['TAS_UID'] != '') && ($aRow['TAS_UID'] != '0')) { + try { + $oTask = new \Task(); + $aFields = $oTask->load($aRow['TAS_UID']); + $sTaskTarget = $aFields['TAS_TITLE']; + } catch (\Exception $oError) { + $sTaskTarget = 'All Tasks'; + } + } else { + $sTaskTarget = G::LoadTranslation('ID_ANY_TASK'); + } + //Obtain user or group + if ($aRow['OP_USER_RELATION'] == 1) { + $oUser = new \Users(); + $aFields = $oUser->load($aRow['USR_UID']); + $sUserGroup = $aFields['USR_FIRSTNAME'] . ' ' . $aFields['USR_LASTNAME'] . ' (' . $aFields['USR_USERNAME'] . ')'; + } else { + $oGroup = new \Groupwf(); + if ($aRow['USR_UID'] != '') { + try { + $aFields = $oGroup->load($aRow['USR_UID']); + $sUserGroup = $aFields['GRP_TITLE']; + } catch (\Exception $oError) { + $sUserGroup = '(GROUP DELETED)'; + } + } else { + $sUserGroup = G::LoadTranslation('ID_ANY'); + } + } + //Obtain task source + if (($aRow['OP_TASK_SOURCE'] != '') && ($aRow['OP_TASK_SOURCE'] != '0')) { + try { + $oTask = new \Task(); + $aFields = $oTask->load($aRow['OP_TASK_SOURCE']); + $sTaskSource = $aFields['TAS_TITLE']; + } catch (\Exception $oError) { + $sTaskSource = 'All Tasks'; + } + } else { + $sTaskSource = G::LoadTranslation('ID_ANY_TASK'); + } + //Obtain object and type + switch ($aRow['OP_OBJ_TYPE']) { + case 'ALL': + $sObjectType = G::LoadTranslation('ID_ALL'); + $sObject = G::LoadTranslation('ID_ALL'); + break; + case 'ANY': //For backward compatibility (some process with ANY instead of ALL + $sObjectType = G::LoadTranslation('ID_ALL'); + $sObject = G::LoadTranslation('ID_ALL'); + break; + /* case 'ANY_DYNAFORM': + $sObjectType = G::LoadTranslation('ID_ANY_DYNAFORM'); + $sObject = G::LoadTranslation('ID_ALL'); + break; + case 'ANY_INPUT': + $sObjectType = G::LoadTranslation('ID_ANY_INPUT'); + $sObject = G::LoadTranslation('ID_ALL'); + break; + case 'ANY_OUTPUT': + $sObjectType = G::LoadTranslation('ID_ANY_OUTPUT'); + $sObject = G::LoadTranslation('ID_ALL'); + break; */ + case 'DYNAFORM': + $sObjectType = G::LoadTranslation('ID_DYNAFORM'); + if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) { + $oDynaform = new \Dynaform(); + $aFields = $oDynaform->load($aRow['OP_OBJ_UID']); + $sObject = $aFields['DYN_TITLE']; + } else { + $sObject = G::LoadTranslation('ID_ALL'); + } + break; + case 'INPUT': + $sObjectType = G::LoadTranslation('ID_INPUT_DOCUMENT'); + if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) { + $oInputDocument = new \InputDocument(); + $aFields = $oInputDocument->load($aRow['OP_OBJ_UID']); + $sObject = $aFields['INP_DOC_TITLE']; + } else { + $sObject = G::LoadTranslation('ID_ALL'); + } + break; + case 'OUTPUT': + $sObjectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT'); + if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) { + $oOutputDocument = new \OutputDocument(); + $aFields = $oOutputDocument->load($aRow['OP_OBJ_UID']); + $sObject = $aFields['OUT_DOC_TITLE']; + } else { + $sObject = G::LoadTranslation('ID_ALL'); + } + break; + case 'CASES_NOTES': + $sObjectType = G::LoadTranslation('ID_CASES_NOTES'); + $sObject = 'N/A'; + break; + case 'MSGS_HISTORY': + $sObjectType = G::LoadTranslation('MSGS_HISTORY'); + $sObject = G::LoadTranslation('ID_ALL'); + break; + default: + $sObjectType = G::LoadTranslation('ID_ALL'); + $sObject = G::LoadTranslation('ID_ALL'); + break; + } + //Participated + if ($aRow['OP_PARTICIPATE'] == 0) { + $sParticipated = G::LoadTranslation('ID_NO'); + } else { + $sParticipated = G::LoadTranslation('ID_YES'); + } + //Obtain action (permission) + $sAction = G::LoadTranslation('ID_' . $aRow['OP_ACTION']); + //Add to array + $aObjectsPermissions[] = array_merge($aRow, array('OP_UID' => $aRow['OP_UID'], 'TASK_TARGET' => $sTaskTarget, 'GROUP_USER' => $sUserGroup, 'TASK_SOURCE' => $sTaskSource, 'OBJECT_TYPE' => $sObjectType, 'OBJECT' => $sObject, 'PARTICIPATED' => $sParticipated, 'ACTION' => $sAction, 'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS'])); + $oDataset->next(); + } + + if ($sPermissionUid != '' && empty($aObjectsPermissions)) { + throw (new \Exception( 'This row doesn\'t exist!' )); + } else if ($sPermissionUid != '' && !empty($aObjectsPermissions)) { + return current($aObjectsPermissions); + } + return $aObjectsPermissions; + } + + /** + * Save Process Permission + * + * @var array $data. Data for Process Permission + * @var string $sPermissionUid. Uid for Process Permission + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return void + */ + public function saveProcessPermission($data, $sPermissionUid = '') + { + try { + $data = array_change_key_case($data, CASE_UPPER); + + list ($iRelation, $sUserGroup) = explode( '|', $data['GROUP_USER'] ); + $sObjectUID = ''; + switch ($data['OP_OBJ_TYPE']) { + case 'ANY': + //case 'ANY_DYNAFORM':CASES_NOTES + //case 'ANY_INPUT': + //case 'ANY_OUTPUT': + $sObjectUID = ''; + break; + case 'DYNAFORM': + $sObjectUID = $data['DYNAFORMS']; + break; + case 'INPUT': + $sObjectUID = $data['INPUTS']; + break; + case 'OUTPUT': + $sObjectUID = $data['OUTPUTS']; + break; + } + $oOP = new \ObjectPermission(); + $permissionUid = ($sPermissionUid != '') ? $sPermissionUid : G::generateUniqueID(); + $aData = array ( + 'OP_UID' => $permissionUid, + 'PRO_UID' => $data['PRO_UID'], + 'TAS_UID' => $data['TAS_UID'], + 'USR_UID' => (string) $sUserGroup, + 'OP_USER_RELATION' => $iRelation, + 'OP_TASK_SOURCE' => $data['OP_TASK_SOURCE'], + 'OP_PARTICIPATE' => $data['OP_PARTICIPATE'], + 'OP_OBJ_TYPE' => $data['OP_OBJ_TYPE'], + 'OP_OBJ_UID' => $sObjectUID, + 'OP_ACTION' => $data['OP_ACTION'], + 'OP_CASE_STATUS' => $data['OP_CASE_STATUS'] + ); + $oOP->fromArray( $aData, \BasePeer::TYPE_FIELDNAME ); + if ($sPermissionUid == '') { + $oOP->save(); + $daraRes = $oOP->load($newUid); + return $daraRes; + } else { + $oOP->update($aData); + } + } catch (Exception $e) { + throw $e; + } + } + + /** + * Delete Process Permission + * + * @var string $sPermissionUid. Uid for Process Permission + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return void + */ + public function deleteProcessPermission($sPermissionUid) + { + try { + require_once 'classes/model/ObjectPermission.php'; + $oOP = new \ObjectPermission(); + $oOP = ObjectPermissionPeer::retrieveByPK( $sPermissionUid ); + $oOP->delete(); + } catch (Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/BusinessModel/ProcessSupervisor.php b/workflow/engine/src/BusinessModel/ProcessSupervisor.php index f80cf453d..adce6ce20 100644 --- a/workflow/engine/src/BusinessModel/ProcessSupervisor.php +++ b/workflow/engine/src/BusinessModel/ProcessSupervisor.php @@ -550,13 +550,53 @@ class ProcessSupervisor throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID )); } } - $sPuUID = \G::generateUniqueID(); - $oProcessUser->create(array('PU_UID' => $sPuUID, - 'PRO_UID' => $sProcessUID, - 'USR_UID' => $sUsrUID, - 'PU_TYPE' => $sTypeUID)); - $oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID); - return $oCriteria; + // validate Groups + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID); + $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID); + $oCriteria->addAsColumn('GRP_TITLE', \ContentPeer::CON_VALUE); + $aConditions [] = array(\ProcessUserPeer::USR_UID, \ContentPeer::CON_ID); + $aConditions [] = array(\ContentPeer::CON_CATEGORY, \DBAdapter::getStringDelimiter().'GRP_TITLE'.\DBAdapter::getStringDelimiter()); + $aConditions [] = array(\ContentPeer::CON_LANG, \DBAdapter::getStringDelimiter().SYS_LANG.\DBAdapter::getStringDelimiter()); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $oCriteria->add(\ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR'); + $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\ProcessUserPeer::USR_UID, $sUsrUID); + $oCriteria->addAscendingOrderByColumn(\ContentPeer::CON_VALUE); + $oDataset = \ProcessUserPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $sPuUIDT = $aRow['PU_UID']; + $oDataset->next(); + } + // validate Users + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID); + $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID); + $oCriteria->addJoin(\ProcessUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN); + $oCriteria->add(\ProcessUserPeer::PU_TYPE, 'SUPERVISOR'); + $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\ProcessUserPeer::USR_UID, $sUsrUID); + $oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME); + $oDataset = \ProcessUserPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $sPuUIDT = $aRow['PU_UID']; + $oDataset->next(); + } + if (is_null($sPuUIDT)) { + $sPuUID = \G::generateUniqueID(); + $oProcessUser->create(array('PU_UID' => $sPuUID, + 'PRO_UID' => $sProcessUID, + 'USR_UID' => $sUsrUID, + 'PU_TYPE' => $sTypeUID)); + $oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID); + return $oCriteria; + } else { + throw (new \Exception('This relation already exist!')); + } } /** @@ -568,18 +608,13 @@ class ProcessSupervisor */ public function addProcessSupervisorDynaform($sProcessUID, $sDynUID) { - $oStepSupervisor = new \StepSupervisor(); - $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, - 'STEP_TYPE_OBJ' => "DYNAFORM", - 'STEP_UID_OBJ' => $sDynUID, - 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + $oTypeDynaform = \DynaformPeer::retrieveByPK($sDynUID); + if (is_null( $oTypeDynaform )) { + throw (new \Exception( 'This id: '. $sDynUID .' do not correspond to a registered Dynaform')); + } $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); - $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); - $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); - $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); - $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); $oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE'); $oCriteria->addAlias('C', 'CONTENT'); $aConditions = array(); @@ -599,13 +634,50 @@ class ProcessSupervisor $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aResp = array('pud_uid' => $aRow['STEP_UID'], - 'pud_position' => $aRow['STEP_POSITION'], - 'dyn_uid' => $aRow['STEP_UID_OBJ'], - 'dyn_title' => $aRow['DYN_TITLE']); + $sPuUIDT = $aRow['STEP_UID']; $oDataset->next(); } - return $aResp; + if (is_null($sPuUIDT)) { + $oStepSupervisor = new \StepSupervisor(); + $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, + 'STEP_TYPE_OBJ' => "DYNAFORM", + 'STEP_UID_OBJ' => $sDynUID, + 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + $sDelimiter = \DBAdapter::getStringDelimiter(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); + $oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE'); + $oCriteria->addAlias('C', 'CONTENT'); + $aConditions = array(); + $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \DynaformPeer::DYN_UID ); + $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'DYNAFORM' . $sDelimiter ); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $aConditions = array(); + $aConditions[] = array(\DynaformPeer::DYN_UID, 'C.CON_ID' ); + $aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'DYN_TITLE' . $sDelimiter ); + $aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter ); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sDynUID); + $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'DYNAFORM'); + $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); + $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp = array('pud_uid' => $aRow['STEP_UID'], + 'pud_position' => $aRow['STEP_POSITION'], + 'dyn_uid' => $aRow['STEP_UID_OBJ'], + 'dyn_title' => $aRow['DYN_TITLE']); + $oDataset->next(); + } + return $aResp; + } else { + throw (new \Exception('This relation already exist!')); + } } /** @@ -617,18 +689,13 @@ class ProcessSupervisor */ public function addProcessSupervisorInputDocument($sProcessUID, $sInputDocumentUID) { - $oStepSupervisor = new \StepSupervisor(); - $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, - 'STEP_TYPE_OBJ' => "INPUT_DOCUMENT", - 'STEP_UID_OBJ' => $sInputDocumentUID, - 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + $oTypeInputDocument= \InputDocumentPeer::retrieveByPK($sInputDocumentUID); + if (is_null( $oTypeInputDocument )) { + throw (new \Exception( 'This id: '. $sInputDocumentUID .' do not correspond to a registered InputDocument')); + } $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); - $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); - $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); - $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); - $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); $oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE'); $oCriteria->addAlias('C', 'CONTENT'); $aConditions = array(); @@ -648,13 +715,51 @@ class ProcessSupervisor $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aResp = array('pui_uid' => $aRow['STEP_UID'], - 'pui_position' => $aRow['STEP_POSITION'], - 'input_doc_uid' => $aRow['STEP_UID_OBJ'], - 'input_doc_title' => $aRow['INP_DOC_TITLE']); + $sPuUIDT = $aRow['STEP_UID']; $oDataset->next(); } - return $aResp; + if (is_null($sPuUIDT)) { + $oStepSupervisor = new \StepSupervisor(); + $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, + 'STEP_TYPE_OBJ' => "INPUT_DOCUMENT", + 'STEP_UID_OBJ' => $sInputDocumentUID, + 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + $sDelimiter = \DBAdapter::getStringDelimiter(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); + $oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE'); + $oCriteria->addAlias('C', 'CONTENT'); + $aConditions = array(); + $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \InputDocumentPeer::INP_DOC_UID); + $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'INPUT_DOCUMENT' . $sDelimiter); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $aConditions = array(); + $aConditions[] = array(\InputDocumentPeer::INP_DOC_UID, 'C.CON_ID'); + $aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'INP_DOC_TITLE' . $sDelimiter); + $aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sInputDocumentUID); + $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT'); + $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); + $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp = array('pui_uid' => $aRow['STEP_UID'], + 'pui_position' => $aRow['STEP_POSITION'], + 'input_doc_uid' => $aRow['STEP_UID_OBJ'], + 'input_doc_title' => $aRow['INP_DOC_TITLE']); + $oDataset->next(); + } + return $aResp; + } else { + throw (new \Exception('This relation already exist!')); + } } /** diff --git a/workflow/engine/src/BusinessModel/Step.php b/workflow/engine/src/BusinessModel/Step.php index 926bb72a7..5cff40c2d 100644 --- a/workflow/engine/src/BusinessModel/Step.php +++ b/workflow/engine/src/BusinessModel/Step.php @@ -381,9 +381,11 @@ class Step $rsCriteria = \StepPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - $rsCriteria->next(); - - return $rsCriteria->getRow(); + if ($rsCriteria->next()) { + return $rsCriteria->getRow(); + } else { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + } } catch (\Exception $e) { throw $e; } @@ -393,20 +395,60 @@ class Step * Get available triggers of a Step * * @param string $stepUid Unique id of Step - * @param string $type Type (BEFORE, AFTER) + * @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING) + * @param string $taskUid Unique id of Task * * return array */ - public function getAvailableTriggers($stepUid, $type) + public function getAvailableTriggers($stepUid, $type, $taskUid = "") { try { + //Verify data + $step = new \Step(); + + if ($stepUid != "" && !$step->StepExists($stepUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + } + + $task = new \Task(); + + if ($stepUid == "" && !$task->taskExists($taskUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}"))); + } + + //Get data $arrayAvailableTrigger = array(); $trigger = new \BusinessModel\Trigger(); - $arrayDataUid = $this->getDataUids($stepUid); + $flagStepAssignTask = 0; - $processUid = $arrayDataUid["PRO_UID"]; + if ($stepUid != "") { + $arrayDataUid = $this->getDataUids($stepUid); + + $processUid = $arrayDataUid["PRO_UID"]; + } else { + $arrayData = $task->load($taskUid); + + $processUid = $arrayData["PRO_UID"]; + + $flagStepAssignTask = 1; + + switch ($type) { + case "BEFORE_ASSIGNMENT": + $stepUid = "-1"; + $type = "BEFORE"; + break; + case "BEFORE_ROUTING": + $stepUid = "-2"; + $type = "BEFORE"; + break; + case "AFTER_ROUTING": + $stepUid = "-2"; + $type = "AFTER"; + break; + } + } //Get Uids $arrayUid = array(); @@ -415,6 +457,11 @@ class Step $criteria->addSelectColumn(\StepTriggerPeer::TRI_UID); $criteria->add(\StepTriggerPeer::STEP_UID, $stepUid, \Criteria::EQUAL); + + if ($flagStepAssignTask == 1) { + $criteria->add(\StepTriggerPeer::TAS_UID, $taskUid, \Criteria::EQUAL); + } + $criteria->add(\StepTriggerPeer::ST_TYPE, $type, \Criteria::EQUAL); $rsCriteria = \StepTriggerPeer::doSelectRS($criteria); @@ -459,21 +506,37 @@ class Step * Get all triggers of a Step * * @param string $stepUid Unique id of Step + * @param string $taskUid Unique id of Task * * return array */ - public function getTriggers($stepUid) + public function getTriggers($stepUid, $taskUid = "") { try { + //Verify data + $step = new \Step(); + + if ($stepUid != "" && !$step->StepExists($stepUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + } + + $task = new \Task(); + + if ($stepUid == "" && !$task->taskExists($taskUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}"))); + } + //Get data $arrayTrigger = array(); $bmTrigger = new \BusinessModel\Trigger(); $bmStepTrigger = new \BusinessModel\Step\Trigger(); - $arrayDataUid = $this->getDataUids($stepUid); + if ($stepUid != "") { + $arrayDataUid = $this->getDataUids($stepUid); - $taskUid = $arrayDataUid["TAS_UID"]; + $taskUid = $arrayDataUid["TAS_UID"]; + } $processMap = new \ProcessMap(); $stepTrigger = new \StepTrigger(); @@ -495,15 +558,20 @@ class Step $triggerType = $index; $type = $value; + $flagStepAssignTask = 0; + switch ($triggerType) { case "BEFORE_ASSIGNMENT": $stepUid = "-1"; + $flagStepAssignTask = 1; break; case "BEFORE_ROUTING": $stepUid = "-2"; + $flagStepAssignTask = 1; break; case "AFTER_ROUTING": $stepUid = "-2"; + $flagStepAssignTask = 1; break; } @@ -527,6 +595,10 @@ class Step while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); + if ($flagStepAssignTask == 1) { + $row["ST_TYPE"] = $triggerType; + } + $arrayTrigger[] = $bmStepTrigger->getTriggerDataFromRecord($row); } } diff --git a/workflow/engine/src/BusinessModel/Step/Trigger.php b/workflow/engine/src/BusinessModel/Step/Trigger.php index c22b91dfc..ac96d71d3 100644 --- a/workflow/engine/src/BusinessModel/Step/Trigger.php +++ b/workflow/engine/src/BusinessModel/Step/Trigger.php @@ -8,13 +8,14 @@ class Trigger * * @param string $stepUid Unique id of Step * @param string $type Type (BEFORE, AFTER) + * @param string $taskUid Unique id of Task * @param string $triggerUid Unique id of Trigger * @param int $position Position * @param string $triggerUidExclude Unique id of Trigger to exclude * * return bool Return true if exists the record in table STEP_TRIGGER, false otherwise */ - public function existsRecord($stepUid, $type, $triggerUid, $position = 0, $triggerUidExclude = "") + public function existsRecord($stepUid, $type, $taskUid, $triggerUid, $position = 0, $triggerUidExclude = "") { try { $criteria = new \Criteria("workflow"); @@ -22,6 +23,7 @@ class Trigger $criteria->addSelectColumn(\StepTriggerPeer::STEP_UID); $criteria->add(\StepTriggerPeer::STEP_UID, $stepUid, \Criteria::EQUAL); $criteria->add(\StepTriggerPeer::ST_TYPE, $type, \Criteria::EQUAL); + $criteria->add(\StepTriggerPeer::TAS_UID, $taskUid, \Criteria::EQUAL); if ($triggerUid != "") { $criteria->add(\StepTriggerPeer::TRI_UID, $triggerUid, \Criteria::EQUAL); @@ -52,26 +54,53 @@ class Trigger * Assign Trigger to a Step * * @param string $stepUid Unique id of Step - * @param string $type Type (BEFORE, AFTER) + * @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING) + * @param string $taskUid Unique id of Task * @param string $triggerUid Unique id of Trigger * @param array $arrayData Data * * return array Data of the Trigger assigned to a Step */ - public function create($stepUid, $type, $triggerUid, $arrayData) + public function create($stepUid, $type, $taskUid, $triggerUid, $arrayData) { try { - $step = new \BusinessModel\Step(); + $stepUidIni = $stepUid; + $typeIni = $type; - $arrayDataUid = $step->getDataUids($stepUid); + $flagStepAssignTask = 0; - $taskUid = $arrayDataUid["TAS_UID"]; + if ($stepUid == "") { + $flagStepAssignTask = 1; + + switch ($type) { + case "BEFORE_ASSIGNMENT": + $stepUid = "-1"; + $type = "BEFORE"; + break; + case "BEFORE_ROUTING": + $stepUid = "-2"; + $type = "BEFORE"; + break; + case "AFTER_ROUTING": + $stepUid = "-2"; + $type = "AFTER"; + break; + } + } //Verify data - $step = new \Step(); + if ($flagStepAssignTask == 0) { + $step = new \Step(); - if (!$step->StepExists($stepUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + if (!$step->StepExists($stepUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + } + } + + $task = new \Task(); + + if (!$task->taskExists($taskUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}"))); } $trigger = new \Triggers(); @@ -80,12 +109,12 @@ class Trigger throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}"))); } - if ($this->existsRecord($stepUid, $type, $triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}"))); + if ($this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", exists in table {1}"))); } - if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, "", $arrayData["st_position"])) { - throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}"))); + if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, $taskUid, "", $arrayData["st_position"])) { + throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $taskUid . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}"))); } //Create @@ -97,7 +126,7 @@ class Trigger $arrayData["st_position"] = $stepTrigger->getNextPosition($stepUid, $type, $taskUid) - 1; } - $arrayData = $this->update($stepUid, $type, $triggerUid, $arrayData); + $arrayData = $this->update($stepUidIni, $typeIni, $taskUid, $triggerUid, $arrayData); return $arrayData; } catch (\Exception $e) { @@ -109,26 +138,44 @@ class Trigger * Update Trigger of a Step * * @param string $stepUid Unique id of Step - * @param string $type Type (BEFORE, AFTER) + * @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING) + * @param string $taskUid Unique id of Task * @param string $triggerUid Unique id of Trigger * @param array $arrayData Data * * return array Data updated of the Trigger assigned to a Step */ - public function update($stepUid, $type, $triggerUid, $arrayData) + public function update($stepUid, $type, $taskUid, $triggerUid, $arrayData) { try { - $step = new \BusinessModel\Step(); + $flagStepAssignTask = 0; - $arrayDataUid = $step->getDataUids($stepUid); + if ($stepUid == "") { + $flagStepAssignTask = 1; - $taskUid = $arrayDataUid["TAS_UID"]; + switch ($type) { + case "BEFORE_ASSIGNMENT": + $stepUid = "-1"; + $type = "BEFORE"; + break; + case "BEFORE_ROUTING": + $stepUid = "-2"; + $type = "BEFORE"; + break; + case "AFTER_ROUTING": + $stepUid = "-2"; + $type = "AFTER"; + break; + } + } //Verify data - $step = new \Step(); + if ($flagStepAssignTask == 0) { + $step = new \Step(); - if (!$step->StepExists($stepUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + if (!$step->StepExists($stepUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}"))); + } } $trigger = new \Triggers(); @@ -137,8 +184,8 @@ class Trigger throw (new \Exception(str_replace(array("{0}", "{1}"), array($triggerUid, "TRIGGERS"), "The UID \"{0}\" doesn't exist in table {1}"))); } - if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, "", $arrayData["st_position"], $triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}"))); + if (isset($arrayData["st_position"]) && $this->existsRecord($stepUid, $type, $taskUid, "", $arrayData["st_position"], $triggerUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["st_position"], $stepUid . ", " . $type . ", " . $taskUid . ", " . $arrayData["st_position"], "STEP_TRIGGER"), "The \"{0}\" position for the record \"{1}\", exists in table {2}"))); } //Update @@ -171,23 +218,35 @@ class Trigger * Delete Trigger of a Step * * @param string $stepUid Unique id of Step - * @param string $type Type (BEFORE, AFTER) + * @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING) + * @param string $taskUid Unique id of Task * @param string $triggerUid Unique id of Trigger * * return void */ - public function delete($stepUid, $type, $triggerUid) + public function delete($stepUid, $type, $taskUid, $triggerUid) { try { - $step = new \BusinessModel\Step(); - - $arrayDataUid = $step->getDataUids($stepUid); - - $taskUid = $arrayDataUid["TAS_UID"]; + if ($stepUid == "") { + switch ($type) { + case "BEFORE_ASSIGNMENT": + $stepUid = "-1"; + $type = "BEFORE"; + break; + case "BEFORE_ROUTING": + $stepUid = "-2"; + $type = "BEFORE"; + break; + case "AFTER_ROUTING": + $stepUid = "-2"; + $type = "AFTER"; + break; + } + } //Verify data - if (!$this->existsRecord($stepUid, $type, $triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}"))); + if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}"))); } //Get position @@ -234,23 +293,41 @@ class Trigger * Get data of a Trigger * * @param string $stepUid Unique id of Step - * @param string $type Type (BEFORE, AFTER) + * @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING) + * @param string $taskUid Unique id of Task * @param string $triggerUid Unique id of Trigger * * return array Return an array with data of a Trigger */ - public function getTrigger($stepUid, $type, $triggerUid) + public function getTrigger($stepUid, $type, $taskUid, $triggerUid) { try { - $step = new \BusinessModel\Step(); + $typeIni = $type; - $arrayDataUid = $step->getDataUids($stepUid); + $flagStepAssignTask = 0; - $taskUid = $arrayDataUid["TAS_UID"]; + if ($stepUid == "") { + $flagStepAssignTask = 1; + + switch ($type) { + case "BEFORE_ASSIGNMENT": + $stepUid = "-1"; + $type = "BEFORE"; + break; + case "BEFORE_ROUTING": + $stepUid = "-2"; + $type = "BEFORE"; + break; + case "AFTER_ROUTING": + $stepUid = "-2"; + $type = "AFTER"; + break; + } + } //Verify data - if (!$this->existsRecord($stepUid, $type, $triggerUid)) { - throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}"))); + if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}"))); } //Get data @@ -274,6 +351,10 @@ class Trigger $row = $rsCriteria->getRow(); + if ($flagStepAssignTask == 1) { + $row["ST_TYPE"] = $typeIni; + } + return $this->getTriggerDataFromRecord($row); } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php index b251bebf7..ecb806369 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php @@ -89,16 +89,16 @@ class Assignee extends Api * * @param string $prjUid * @param string $actUid - * @param string $ass_uid - * @param string $ass_type {@choice user,group} + * @param string $aas_uid + * @param string $aas_type {@choice user,group} * * @status 201 */ - public function doPostActivityAssignee($prjUid, $actUid, $ass_uid, $ass_type) + public function doPostActivityAssignee($prjUid, $actUid, $aas_uid, $aas_type) { try { $task = new \BusinessModel\Task(); - $arrayData = $task->addTaskAssignee($prjUid, $actUid, $ass_uid, $ass_type); + $arrayData = $task->addTaskAssignee($prjUid, $actUid, $aas_uid, $aas_type); } catch (\Exception $e) { //Response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -107,18 +107,18 @@ class Assignee extends Api } /** - * @url DELETE /:prjUid/activity/:actUid/assignee/:assUid + * @url DELETE /:prjUid/activity/:actUid/assignee/:aasUid * * @param string $prjUid * @param string $actUid - * @param string $assUid + * @param string $aasUid * */ - public function doDeleteActivityAssignee($prjUid, $actUid, $assUid) + public function doDeleteActivityAssignee($prjUid, $actUid, $aasUid) { try { $task = new \BusinessModel\Task(); - $arrayData = $task->removeTaskAssignee($prjUid, $actUid, $assUid); + $arrayData = $task->removeTaskAssignee($prjUid, $actUid, $aasUid); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step.php index 88d7e7f00..051be1dec 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step.php @@ -124,6 +124,44 @@ class Step extends Api throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } + + //Step "Assign Task" + + /** + * @url GET /:projectUid/activity/:activityUid/step/triggers + */ + public function doGetActivityStepAssignTaskTriggers($activityUid, $projectUid) + { + try { + $step = new \BusinessModel\Step(); + + $response = $step->getTriggers("", $activityUid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url GET /:projectUid/activity/:activityUid/step/available-triggers/:type + * + * @param string $activityUid + * @param string $projectUid + * @param string $type {@from body}{@choice before-assignment,before-routing,after-routing} + */ + public function doGetActivityStepAssignTaskAvailableTriggers($activityUid, $projectUid, $type) + { + try { + $step = new \BusinessModel\Step(); + + $response = $step->getAvailableTriggers("", strtoupper(str_replace("-", "_", $type)), $activityUid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } } class StepPostStructure diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php index c8f988dec..5a9a063bf 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php @@ -25,7 +25,7 @@ class Trigger extends Api try { $stepTrigger = new \BusinessModel\Step\Trigger(); - $response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $triggerUid); + $response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $activityUid, $triggerUid); return $response; } catch (\Exception $e) { @@ -50,7 +50,7 @@ class Trigger extends Api $stepTrigger = new \BusinessModel\Step\Trigger(); - $arrayData = $stepTrigger->create($stepUid, $request_data["st_type"], $request_data["tri_uid"], $request_data); + $arrayData = $stepTrigger->create($stepUid, $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -72,7 +72,7 @@ class Trigger extends Api $stepTrigger = new \BusinessModel\Step\Trigger(); - $arrayData = $stepTrigger->update($stepUid, $request_data["st_type"], $triggerUid, $request_data); + $arrayData = $stepTrigger->update($stepUid, $request_data["st_type"], $activityUid, $triggerUid, $request_data); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -92,7 +92,92 @@ class Trigger extends Api try { $stepTrigger = new \BusinessModel\Step\Trigger(); - $stepTrigger->delete($stepUid, strtoupper($type), $triggerUid); + $stepTrigger->delete($stepUid, strtoupper($type), $activityUid, $triggerUid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + //Step "Assign Task" + + /** + * @url GET /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type + * + * @param string $triggerUid + * @param string $activityUid + * @param string $projectUid + * @param string $type {@from body}{@choice before-assignment,before-routing,after-routing} + */ + public function doGetActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type) + { + try { + $stepTrigger = new \BusinessModel\Step\Trigger(); + + $response = $stepTrigger->getTrigger("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url POST /:projectUid/activity/:activityUid/step/trigger + * + * @param string $activityUid + * @param string $projectUid + * @param StepAssignTaskTriggerPostStructure $request_data + * + * @status 201 + */ + public function doPostActivityStepAssignTaskTrigger($activityUid, $projectUid, StepAssignTaskTriggerPostStructure $request_data = null) + { + try { + $request_data = (array)($request_data); + + $stepTrigger = new \BusinessModel\Step\Trigger(); + + $arrayData = $stepTrigger->create("", $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url PUT /:projectUid/activity/:activityUid/step/trigger/:triggerUid + * + * @param string $triggerUid + * @param string $activityUid + * @param string $projectUid + * @param StepAssignTaskTriggerPutStructure $request_data + */ + public function doPutActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, StepAssignTaskTriggerPutStructure $request_data = null) + { + try { + $request_data = (array)($request_data); + + $stepTrigger = new \BusinessModel\Step\Trigger(); + + $arrayData = $stepTrigger->update("", $request_data["st_type"], $activityUid, $triggerUid, $request_data); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url DELETE /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type + * + * @param string $triggerUid + * @param string $activityUid + * @param string $projectUid + * @param string $type {@from body}{@choice before-assignment,before-routing,after-routing} + */ + public function doDeleteActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type) + { + try { + $stepTrigger = new \BusinessModel\Step\Trigger(); + + $stepTrigger->delete("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } @@ -140,3 +225,44 @@ class StepTriggerPutStructure public $st_position; } +class StepAssignTaskTriggerPostStructure +{ + /** + * @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true} + */ + public $st_type; + + /** + * @var string {@from body}{@min 32}{@max 32}{@required true} + */ + public $tri_uid; + + /** + * @var string + */ + public $st_condition; + + /** + * @var int {@from body}{@min 1} + */ + public $st_position; +} + +class StepAssignTaskTriggerPutStructure +{ + /** + * @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true} + */ + public $st_type; + + /** + * @var string + */ + public $st_condition; + + /** + * @var int {@from body}{@min 1} + */ + public $st_position; +} + diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseScheduler.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseScheduler.php new file mode 100644 index 000000000..f1959c7c9 --- /dev/null +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseScheduler.php @@ -0,0 +1,242 @@ +getCaseSchedulers($prjUid); + //Response + $response = $arrayData; + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @param string $prjUid {@min 32} {@max 32} + * @param string $caseSchedulerUid {@min 32} {@max 32} + * + * @url GET /:prjUid/case-scheduler/:caseSchedulerUid + */ + public function doGetProjectCaseScheduler($prjUid, $caseSchedulerUid) + { + try { + $caseScheduler = new \BusinessModel\CaseScheduler(); + $objectData = $caseScheduler->getCaseScheduler($prjUid, $caseSchedulerUid); + //Response + $response = $objectData; + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @param string $prjUid {@min 32} {@max 32} + * @param CaseSchedulerStructure $request_data + * + * @url POST /:prjUid/case-scheduler + * + * @status 201 + */ + public function doPostProjectCaseScheduler($prjUid, CaseSchedulerStructure $request_data = null) + { + try { + $userUid = $this->getUserId(); + $request_data = (array)($request_data); + $caseScheduler = new \BusinessModel\CaseScheduler(); + $objectData = $caseScheduler->addCaseScheduler($prjUid, $request_data, $userUid); + //Response + $response = $objectData; + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @url PUT /:prjUid/case-scheduler/:schUid + * + * @param string $prjUid {@min 32} {@max 32} + * @param string $schUid {@min 32} {@max 32} + * @param CaseSchedulerStructure $request_data + * + */ + public function doPutProjectCaseScheduler($prjUid, $schUid, CaseSchedulerStructure $request_data) + { + try { + $userUid = $this->getUserId(); + $request_data = (array)($request_data); + $caseScheduler = new \BusinessModel\CaseScheduler(); + $objectData = $caseScheduler->updateCaseScheduler($prjUid, $schUid, $request_data, $userUid); + //Response + $response = $objectData; + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @url DELETE /:prjUid/case-scheduler/:schUid + * @param string $prjUid {@min 32} {@max 32} + * @param string $schUid {@min 32} {@max 32} + * + */ + public function doDeleteProjectCaseScheduler($prjUid, $schUid) + { + try { + $caseScheduler = new \BusinessModel\CaseScheduler(); + $caseScheduler->deleteCaseScheduler($prjUid, $schUid); + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + +} + +class CaseSchedulerStructure +{ /** + * @var string {@from body} {@min 0} {@max 100} + */ + public $sch_name; + + /** + * @var string {@from body} {@min 0} {@max 100} + */ + 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} + */ + public $sch_del_user_uid; + + /** + * @var string {@from body} {@min 32} {@max 32} + */ + public $pro_uid; + + /** + * @var string {@from body} {@min 32} {@max 32} + */ + public $tas_uid; + + /** + * @var string {@from body} + */ + public $sch_time_next_run; + + /** + * @var string {@from body} + */ + public $sch_last_run_time; + + /** + * @var string {@from body} {@min 0} {@max 15} + */ + public $sch_state; + + /** + * @var string {@from body} {@min 0} {@max 15} + */ + public $sch_last_state; + + /** + * @var string {@from body} {@min 32} {@max 32} + */ + public $usr_uid; + + /** + * @var string {@from body} + */ + public $sch_option; + + /** + * @var string {@from body} + */ + public $sch_start_time; + + /** + * @var string {@from body} + */ + public $sch_start_date; + + /** + * @var string {@from body} {@min 0} {@max 5} + */ + public $sch_days_perform_task; + + /** + * @var string {@from body} {@min 0} {@max 4} + */ + public $sch_every_days; + + /** + * @var string {@from body} {@min 0} {@max 14} + */ + public $sch_week_days; + + /** + * @var string {@from body} {@min 0} {@max 6} + */ + public $sch_start_day; + + /** + * @var string {@from body} {@min 0} {@max 24} + */ + public $sch_months; + + /** + * @var string {@from body} + */ + public $sch_end_date; + + /** + * @var string {@from body} {@min 0} {@max 15} + */ + public $sch_repeat_every; + + /** + * @var string {@from body} {@min 0} {@max 15} + */ + public $sch_repeat_until; + + /** + * @var string {@from body} {@min 0} {@max 4} + */ + public $sch_repeat_stop_if_running; + + /** + * @var string {@from body} {@min 0} {@max 100} + */ + public $case_sh_plugin_uid; +} + \ No newline at end of file diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseTracker.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseTracker.php new file mode 100644 index 000000000..bccdfec30 --- /dev/null +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseTracker.php @@ -0,0 +1,93 @@ +getCaseTracker($projectUid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url PUT /:projectUid/case-tracker/property + * + * @param string $projectUid {@min 32}{@max 32} + * @param array $request_data + * @param string $map_type {@from body}{@choice NONE,PROCESSMAP,STAGES} + * @param bool $routing_history {@from body} + * @param bool $message_history {@from body} + */ + public function doPutCaseTracker( + $projectUid, + $request_data, + $map_type = "NONE", + $routing_history = false, + $message_history = false + ) { + try { + $caseTracker = new \BusinessModel\CaseTracker(); + + $arrayData = $caseTracker->update($projectUid, $request_data); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url GET /:projectUid/case-tracker/objects + * + * @param string $projectUid {@min 32}{@max 32} + */ + public function doGetCaseTrackerObjects($projectUid) + { + try { + $caseTracker = new \BusinessModel\CaseTracker(); + + $response = $caseTracker->getCaseTrackerObjects($projectUid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url GET /:projectUid/case-tracker/available-objects + * + * @param string $projectUid {@min 32}{@max 32} + */ + public function doGetCaseTrackerAvailableObjects($projectUid) + { + try { + $caseTracker = new \BusinessModel\CaseTracker(); + + $response = $caseTracker->getAvailableCaseTrackerObjects($projectUid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } +} + diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseTrackerObject.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseTrackerObject.php new file mode 100644 index 000000000..21f0a9ccf --- /dev/null +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/CaseTrackerObject.php @@ -0,0 +1,112 @@ +getCaseTrackerObject($caseTrackerObjectUid); + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url POST /:projectUid/case-tracker/object + * + * @param string $projectUid {@min 32}{@max 32} + * @param array $request_data + * @param string $cto_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}{@required true} + * @param string $cto_uid_obj {@from body}{@min 32}{@max 32}{@required true} + * @param string $cto_condition + * @param int $cto_position {@from body}{@min 1} + * + * @status 201 + */ + public function doPostCaseTrackerObject( + $projectUid, + $request_data, + $cto_type_obj = "DYNAFORM", + $cto_uid_obj = "00000000000000000000000000000000", + $cto_condition = "", + $cto_position = 1 + ) { + try { + $caseTrackerObject = new \BusinessModel\CaseTrackerObject(); + + $arrayData = $caseTrackerObject->create($projectUid, $request_data); + + $response = $arrayData; + + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url PUT /:projectUid/case-tracker/object/:caseTrackerObjectUid + * + * @param string $caseTrackerObjectUid {@min 32}{@max 32} + * @param string $projectUid {@min 32}{@max 32} + * @param array $request_data + * @param string $cto_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT} + * @param string $cto_uid_obj {@from body}{@min 32}{@max 32} + * @param string $cto_condition + * @param int $cto_position {@from body}{@min 1} + */ + public function doPutCaseTrackerObject( + $caseTrackerObjectUid, + $projectUid, + $request_data, + $cto_type_obj = "DYNAFORM", + $cto_uid_obj = "00000000000000000000000000000000", + $cto_condition = "", + $cto_position = 1 + ) { + try { + $caseTrackerObject = new \BusinessModel\CaseTrackerObject(); + + $arrayData = $caseTrackerObject->update($caseTrackerObjectUid, $request_data); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @url DELETE /:projectUid/case-tracker/object/:caseTrackerObjectUid + * + * @param string $caseTrackerObjectUid {@min 32}{@max 32} + * @param string $projectUid {@min 32}{@max 32} + */ + public function doDeleteCaseTrackerObject($caseTrackerObjectUid, $projectUid) + { + try { + $caseTrackerObject = new \BusinessModel\CaseTrackerObject(); + + $caseTrackerObject->delete($caseTrackerObjectUid); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } +} + diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessPermissions.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessPermissions.php new file mode 100644 index 000000000..7879911b2 --- /dev/null +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessPermissions.php @@ -0,0 +1,157 @@ + + * @copyright Colosa - Bolivia + * + * @protected + */ +class ProcessPermissions extends Api +{ + /** + * @param string $projectUid {@min 1} {@max 32} + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return array + * + * @url GET /:projectUid/process-permissions + */ + public function doGetProcessPermissions($projectUid) + { + try { + $processPermissions = new \BusinessModel\ProcessPermissions(); + $response = $processPermissions->getProcessPermissions($projectUid); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @param string $projectUid {@min 1} {@max 32} + * @param string $objectPermissionUid {@min 1} {@max 32} + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return array + * + * @url GET /:projectUid/process-permission/:objectPermissionUid + */ + public function doGetProcessPermission($projectUid, $objectPermissionUid) + { + try { + $processPermissions = new \BusinessModel\ProcessPermissions(); + $response = $processPermissions->getProcessPermissions($projectUid, $objectPermissionUid); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @param string $projectUid {@min 1} {@max 32} + * @param array $request_data + * @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY} + * @param string $op_participate {@from body} {@choice 0,1} + * @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE} + * @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED} + * @param string $tas_uid {@from body} + * @param string $group_user {@from body} + * @param string $dynaforms {@from body} + * @param string $inputs {@from body} + * @param string $outputs {@from body} + * @param string $op_task_source {@from body} + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return array + * + * @url POST /:projectUid/process-permission/ + */ + public function doPostProcessPermission($projectUid, $request_data, $op_obj_type, $op_participate, $op_action, + $op_case_status, $tas_uid = '', $group_user = '', $dynaforms = '', $inputs = '', $outputs = '', $op_task_source = '') + { + try { + $request_data['pro_uid'] = $projectUid; + $processPermissions = new \BusinessModel\ProcessPermissions(); + $response = $processPermissions->saveProcessPermission($request_data); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @param string $projectUid {@min 1} {@max 32} + * @param string $objectPermissionUid {@min 1} {@max 32} + * @param array $request_data + * @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY} + * @param string $op_participate {@from body} {@choice 0,1} + * @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE} + * @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED} + * @param string $tas_uid {@from body} + * @param string $group_user {@from body} + * @param string $dynaforms {@from body} + * @param string $inputs {@from body} + * @param string $outputs {@from body} + * @param string $op_task_source {@from body} + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return array + * + * @url PUT /:projectUid/process-permission/:objectPermissionUid + */ + public function doPutProcessPermission($projectUid, $objectPermissionUid, $request_data, $op_obj_type, + $op_participate, $op_action, $op_case_status, $tas_uid = '', $group_user = '', $dynaforms = '', $inputs = '', + $outputs = '', $op_task_source = '') + { + try { + $request_data['pro_uid'] = $projectUid; + $processPermissions = new \BusinessModel\ProcessPermissions(); + $response = $processPermissions->saveProcessPermission($request_data, $objectPermissionUid); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + /** + * @param string $projectUid {@min 1} {@max 32} + * @param string $objectPermissionUid {@min 1} {@max 32} + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return void + * + * @url DELETE /:projectUid/process-permission/:objectPermissionUid + */ + public function doDeleteProcessPermission($projectUid, $objectPermissionUid) + { + try { + $processPermissions = new \BusinessModel\ProcessPermissions(); + $response = $processPermissions->deleteProcessPermission($objectPermissionUid, $projectUid); + return $response; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } +} + diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php index 3c9b680c9..2d7202fd6 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php @@ -311,8 +311,4 @@ class ProcessSupervisors extends Api } return $response; } - - - - } diff --git a/workflow/engine/src/Services/api.ini b/workflow/engine/src/Services/api.ini index 3956165ba..4226271a4 100644 --- a/workflow/engine/src/Services/api.ini +++ b/workflow/engine/src/Services/api.ini @@ -24,6 +24,10 @@ debug = 1 input-document = "Services\Api\ProcessMaker\Project\InputDocument" output-documents = "Services\Api\ProcessMaker\Project\OutputDocuments" supervisors = "Services\Api\ProcessMaker\Project\ProcessSupervisors" + process-permissions = "Services\Api\ProcessMaker\Project\ProcessPermissions" + case-scheduler = "Services\Api\ProcessMaker\Project\CaseScheduler" + case-tracker = "Services\Api\ProcessMaker\Project\CaseTracker" + case-tracker-object = "Services\Api\ProcessMaker\Project\CaseTrackerObject" [alias: projects] project = "Services\Api\ProcessMaker\Project" diff --git a/workflow/engine/templates/admin/emails.js b/workflow/engine/templates/admin/emails.js index 211daf05f..f317aae6d 100644 --- a/workflow/engine/templates/admin/emails.js +++ b/workflow/engine/templates/admin/emails.js @@ -67,18 +67,17 @@ Ext.onReady(function(){ Ext.getCmp('SendaTestMail').setVisible(true); Ext.getCmp('SendaTestMail').getEl().up('.x-form-item').setDisplayed(true); + Ext.getCmp('eFromName').setVisible(true); + Ext.getCmp('eFromName').getEl().up('.x-form-item').setDisplayed(true); + if(Ext.getCmp('SendaTestMail').checked) { Ext.getCmp('eMailto').setVisible(true); Ext.getCmp('eMailto').getEl().up('.x-form-item').setDisplayed(true); - Ext.getCmp('eFromName').setVisible(true); - Ext.getCmp('eFromName').getEl().up('.x-form-item').setDisplayed(true); } else { Ext.getCmp('eMailto').setVisible(false); Ext.getCmp('eMailto').getEl().up('.x-form-item').setDisplayed(false); Ext.getCmp('eMailto').setValue(' '); - Ext.getCmp('eFromName').setVisible(false); - Ext.getCmp('eFromName').getEl().up('.x-form-item').setDisplayed(false); } } @@ -97,20 +96,18 @@ Ext.onReady(function(){ Ext.getCmp('Password').getEl().up('.x-form-item').setDisplayed(false); Ext.getCmp('SendaTestMail').setVisible(false); Ext.getCmp('SendaTestMail').getEl().up('.x-form-item').setDisplayed(false); + Ext.getCmp('eFromName').setVisible(false); + Ext.getCmp('eFromName').getEl().up('.x-form-item').setDisplayed(false); if (Ext.getCmp('SendaTestMail').getValue().checked) { Ext.getCmp('eMailto').setVisible(true); Ext.getCmp('eMailto').setVisible(true); Ext.getCmp('eMailto').setValue(''); - Ext.getCmp('eFromName').setVisible(true); - Ext.getCmp('eFromName').getEl().up('.x-form-item').setDisplayed(true); } else { Ext.getCmp('eMailto').setVisible(false); Ext.getCmp('eMailto').getEl().up('.x-form-item').setDisplayed(false); Ext.getCmp('eMailto').setValue(' '); - Ext.getCmp('eFromName').setVisible(false); - Ext.getCmp('eFromName').getEl().up('.x-form-item').setDisplayed(false); } Ext.getCmp('UseSecureConnection').setVisible(false); diff --git a/workflow/engine/xmlform/steps/triggersAfter_Options.xml b/workflow/engine/xmlform/steps/triggersAfter_Options.xml index 930742b36..4fb33c027 100755 --- a/workflow/engine/xmlform/steps/triggersAfter_Options.xml +++ b/workflow/engine/xmlform/steps/triggersAfter_Options.xml @@ -13,9 +13,16 @@ getLanDirection() ); if ((isset( $_SESSION['USER_LOGGED'] )) && (! (isset( $_GET['sid'] )))) { - if (PHP_VERSION < 5.2) { - setcookie(session_name(), session_id(), time() + $timelife, '/', '; HttpOnly'); - } else { - setcookie(session_name(), session_id(), time() + $timelife, '/', null, false, true); + if (preg_match("/msie/i", $_SERVER ['HTTP_USER_AGENT']) != 1 || $config['ie_cookie_lifetime'] == 1) { + if (PHP_VERSION < 5.2) { + setcookie(session_name(), session_id(), time() + $timelife, '/', '; HttpOnly'); + } else { + setcookie(session_name(), session_id(), time() + $timelife, '/', null, false, true); + } } $RBAC->initRBAC(); //using optimization with memcache, the user data will be in memcache 8 hours, or until session id goes invalid @@ -959,10 +963,12 @@ try { $_SESSION['USER_LOGGED'] = $aUser['USR_UID']; $_SESSION['USR_USERNAME'] = $aUser['USR_USERNAME']; $bRedirect = false; - if (PHP_VERSION < 5.2) { - setcookie(session_name(), session_id(), time() + $timelife, '/', '; HttpOnly'); - } else { - setcookie(session_name(), session_id(), time() + $timelife, '/', null, false, true); + if (preg_match("/msie/i", $_SERVER ['HTTP_USER_AGENT']) != 1 || $config['ie_cookie_lifetime'] == 1) { + if (PHP_VERSION < 5.2) { + setcookie(session_name(), session_id(), time() + $timelife, '/', '; HttpOnly'); + } else { + setcookie(session_name(), session_id(), time() + $timelife, '/', null, false, true); + } } $RBAC->initRBAC(); $RBAC->loadUserRolePermission( $RBAC->sSystem, $_SESSION['USER_LOGGED'] );