Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
27
Rakefile
27
Rakefile
@@ -174,13 +174,11 @@ def buildPmdynaform(homeDir, targetDir, mode)
|
||||
|
||||
executeInto(homeDir, [ "default"])
|
||||
|
||||
system("cp -r #{homeDir}/build #{pmdynaformDir}")
|
||||
system("cp -r #{homeDir}/libs #{pmdynaformDir}")
|
||||
system("rm #{pmdynaformDir}/build/appBuild.js")
|
||||
readyForm = ""
|
||||
system("echo '#{readyForm}' >> #{pmdynaformDir}/build/appBuild.js ")
|
||||
system("cp #{Dir.pwd}/workflow/engine/templates/cases/cases_Step_Pmdynaform.html #{pmdynaformDir}/build/cases_Step_Pmdynaform.html")
|
||||
system("cp #{Dir.pwd}/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html #{pmdynaformDir}/build/cases_Step_Pmdynaform_Preview.html")
|
||||
require 'fileutils'
|
||||
Dir.mkdir("#{pmdynaformDir}/build")
|
||||
FileUtils.cp_r(Dir["#{homeDir}/build/*"],"#{pmdynaformDir}/build")
|
||||
Dir.mkdir("#{pmdynaformDir}/libs")
|
||||
FileUtils.cp_r(Dir["#{homeDir}/libs/*"],"#{pmdynaformDir}/libs")
|
||||
|
||||
template = ""
|
||||
config = File.read "#{homeDir}/config/templates.json"
|
||||
@@ -194,16 +192,12 @@ def buildPmdynaform(homeDir, targetDir, mode)
|
||||
template += s
|
||||
end
|
||||
|
||||
target = "#{pmdynaformDir}/build/cases_Step_Pmdynaform.html"
|
||||
html = File.read target
|
||||
while html['###TEMPLATES##'] do
|
||||
html['###TEMPLATES###'] = template
|
||||
end
|
||||
File.open(target, 'w+') do |file|
|
||||
file.write html
|
||||
end
|
||||
htmlTemplates=["cases_Step_Pmdynaform.html","cases_Step_Pmdynaform_Preview.html","cases_Step_Pmdynaform_View.html"]
|
||||
htmlTemplates.each do |htmlTemplate|
|
||||
|
||||
target = "#{pmdynaformDir}/build/cases_Step_Pmdynaform_Preview.html"
|
||||
FileUtils.cp("#{Dir.pwd}/workflow/engine/templates/cases/#{htmlTemplate}", "#{pmdynaformDir}/build/#{htmlTemplate}")
|
||||
|
||||
target = "#{pmdynaformDir}/build/#{htmlTemplate}"
|
||||
html = File.read target
|
||||
while html['###TEMPLATES##'] do
|
||||
html['###TEMPLATES###'] = template
|
||||
@@ -211,6 +205,7 @@ def buildPmdynaform(homeDir, targetDir, mode)
|
||||
File.open(target, 'w+') do |file|
|
||||
file.write html
|
||||
end
|
||||
end
|
||||
|
||||
puts "\nPmDynaform Build Finished!".magenta
|
||||
end
|
||||
|
||||
@@ -610,12 +610,12 @@ Scenario Outline: Get paging of list Advanced Search
|
||||
| high number for start | 1000 | 1 | 0 | 200 |
|
||||
| high number for start | 1000 | 0 | 0 | 200 |
|
||||
| empty result | 1 | 0 | 30 | 200 |
|
||||
| empty string | 1 | 10000 | 57 | 200 |
|
||||
| empty string | 1 | 10000 | 83 | 200 |
|
||||
| invalid start | b | 25 | 25 | 200 |
|
||||
| invalid limit | 1 | c | 30 | 200 |
|
||||
| start equals zero | 0 | 20 | 20 | 200 |
|
||||
| search 0 | 0 | 0 | 30 | 200 |
|
||||
| search 0 | 0 | 100 | 57 | 200 |
|
||||
| search 0 | 0 | 100 | 83 | 200 |
|
||||
| negative numbers in start | -10 | 25 | 25 | 200 |
|
||||
| negative numbers in limit | 1 | -25 | 25 | 200 |
|
||||
| real numbers | 0.0 | 1.0 | 1 | 200 |
|
||||
@@ -652,7 +652,7 @@ Scenario Outline: Get order type of Process Category
|
||||
Examples:
|
||||
|
||||
| test_description | cat_uid | records |
|
||||
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 26 |
|
||||
| Filter for Category "Category Cases Lists" | 4177095085330818c324501061677193 | 30 |
|
||||
| Filter all categories | | 30 |
|
||||
|
||||
|
||||
@@ -684,7 +684,7 @@ Scenario Outline: Get order type of Search
|
||||
Examples:
|
||||
|
||||
| test_description | search | records |
|
||||
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 17 | 10 |
|
||||
| Filter for cases "Derivation rules - Parallel -> Case number 6" | 17 | 16 |
|
||||
| Filter all cases | | 30 |
|
||||
|
||||
|
||||
@@ -719,7 +719,7 @@ Scenario Outline: Get order for User
|
||||
| Filter Status = All User | | 30 |
|
||||
| Filter Status = aaron | 51049032352d56710347233042615067 | 4 |
|
||||
| Filter Status = admin | 00000000000000000000000000000001 | 30 |
|
||||
| Filter Status = chris | 24166330352d56730cdd525035621101 | 6 |
|
||||
| Filter Status = chris | 24166330352d56730cdd525035621101 | 7 |
|
||||
|
||||
|
||||
Scenario Outline: Get order for date
|
||||
@@ -733,5 +733,5 @@ Scenario Outline: Get order for date
|
||||
Examples:
|
||||
|
||||
| test_description | date_from | date_to | records |
|
||||
| Filter date = 2014-03-01 | 2014-03-01 | 2014-03-31 | 5 |
|
||||
| Filter date = 2014-03-01 | 2014-03-01 | 2014-03-31 | 7 |
|
||||
| Filter date = 2014-03-15 | 2014-03-15 | 2014-04-01 | 30 |
|
||||
@@ -217,7 +217,7 @@ Scenario Outline: Delete folder
|
||||
|
||||
#BUG 15207, The "Upload" accepts files with other extensions
|
||||
|
||||
Scenario Outline: Upload files to same folders "Project - Process Complete BPMN"
|
||||
Scenario Outline: Upload files with incorret extension ".exe" - "Project - Process Complete BPMN"
|
||||
Given POST I want to upload the file "<file>" to path "<prf_path>". Url "project/1455892245368ebeb11c1a5001393784/file-manager"
|
||||
And store "prf_uid" in session array as variable "prf_uid_<prf_number>"
|
||||
And the response status message should have the following text "incorrect extension"
|
||||
|
||||
@@ -720,7 +720,6 @@ Scenario Outline: Get definition of a project
|
||||
And the type is "object"
|
||||
And that "prj_name" is set to "Update Evaluation"
|
||||
And that "prj_description" is set to "Update"
|
||||
And that "par_name" property in object "participants" equals "abcd"
|
||||
|
||||
|
||||
Examples:
|
||||
@@ -731,14 +730,18 @@ Scenario Outline: Get definition of a project
|
||||
|
||||
#Test of successful export and import of objects "Data Object, Data Store, Black Box and Text"
|
||||
|
||||
Scenario: Get for Export Project - Test process NEW
|
||||
Given that I want to get a resource with the key "new_uid" stored in session array as variable "project_new_uid_<project_new_uid_number>" in position 0
|
||||
And I request "project/<project_uid>/export"
|
||||
Scenario Outline: Get for Export Project - Test process NEW
|
||||
Given I request "project/new_uid/export" with the key "new_uid" stored in session array as variable "project_new_uid_<project_new_uid_number>" in position 0
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/xml"
|
||||
And save exported process to "/" as "Test process NEW.pmx"
|
||||
|
||||
Examples:
|
||||
|
||||
| project_new_uid_number |
|
||||
| 7 |
|
||||
|
||||
|
||||
Scenario Outline: Delete a Project activity created previously in this script - Test process NEW
|
||||
Given that I want to delete a resource with the key "new_uid" stored in session array as variable "project_new_uid_<project_new_uid_number>" in position 0
|
||||
@@ -765,7 +768,7 @@ Scenario Outline: Import a process - Test process NEW
|
||||
|
||||
Examples:
|
||||
| project_file | import_option | prj_uid_number |
|
||||
| Process_NewCreate_BPMN.pmx | create | 7 |
|
||||
| Process_NewCreate_BPMN.pmx | CREATE | 7 |
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1311,6 +1311,36 @@ class RestContext extends BehatContext
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^I request "([^"]*)" with the key "([^"]*)" stored in session array as variable "([^"]*)" in position (\d+)$/
|
||||
*/
|
||||
public function iRequestWithTheKeyStoredInSessionArrayAsVariableInPosition($pageUrl, $varName, $sessionVarName, $position)
|
||||
{
|
||||
if (file_exists("session.data")) {
|
||||
$sessionData = json_decode(file_get_contents("session.data"));
|
||||
} else {
|
||||
$sessionData = array();
|
||||
}
|
||||
if (!isset($sessionData->$sessionVarName) ) {
|
||||
$varValue = '';
|
||||
} else {
|
||||
foreach ($sessionData->$sessionVarName as $key => $value) {
|
||||
if($key == $position){
|
||||
$varValue = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pageUrl = str_replace($varName, $varValue, $pageUrl);
|
||||
|
||||
|
||||
$this->printDebug("URL: $pageUrl\n$varName = $varValue\nsessionVarName = $sessionVarName\n");
|
||||
|
||||
|
||||
$this->iRequest($pageUrl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given /^the property "([^"]*)" of "([^"]*)" is set to "([^"]*)"$/
|
||||
*/
|
||||
|
||||
544
features/json/process_template_with_DATA_participant.json
Normal file
544
features/json/process_template_with_DATA_participant.json
Normal file
@@ -0,0 +1,544 @@
|
||||
{
|
||||
"prj_uid": "89867911453cfc0a88166b6079100310",
|
||||
"prj_name": "Test process NEW",
|
||||
"prj_description": "",
|
||||
"prj_target_namespace": "",
|
||||
"prj_expresion_language": "",
|
||||
"prj_type_language": "",
|
||||
"prj_exporter": "",
|
||||
"prj_exporter_version": "",
|
||||
"prj_create_date": "2014-07-23 10:03:20",
|
||||
"prj_update_date": "2014-07-23 15:25:16",
|
||||
"prj_author": "00000000000000000000000000000001",
|
||||
"prj_author_version": "",
|
||||
"prj_original_source": "",
|
||||
"diagrams": [
|
||||
{
|
||||
"dia_uid": "44288077153cfc0a89424f9087061662",
|
||||
"prj_uid": "89867911453cfc0a88166b6079100310",
|
||||
"dia_name": "Test process NEW",
|
||||
"dia_is_closable": 0,
|
||||
"pro_uid": "93177932753cfc0a8986c44089014824",
|
||||
"activities": [
|
||||
{
|
||||
"act_uid": "42039389753cfc58a2db023038551328",
|
||||
"act_name": "Task # 3",
|
||||
"act_type": "TASK",
|
||||
"act_is_for_compensation": "0",
|
||||
"act_start_quantity": "1",
|
||||
"act_completion_quantity": "0",
|
||||
"act_task_type": "EMPTY",
|
||||
"act_implementation": "",
|
||||
"act_instantiate": "0",
|
||||
"act_script_type": "",
|
||||
"act_script": "",
|
||||
"act_loop_type": "NONE",
|
||||
"act_test_before": "0",
|
||||
"act_loop_maximum": "0",
|
||||
"act_loop_condition": "0",
|
||||
"act_loop_cardinality": "0",
|
||||
"act_loop_behavior": "0",
|
||||
"act_is_adhoc": "0",
|
||||
"act_is_collapsed": "0",
|
||||
"act_completion_condition": "0",
|
||||
"act_ordering": "0",
|
||||
"act_cancel_remaining_instances": "0",
|
||||
"act_protocol": "0",
|
||||
"act_method": "0",
|
||||
"act_is_global": "0",
|
||||
"act_referer": "0",
|
||||
"act_default_flow": "0",
|
||||
"act_master_diagram": "0",
|
||||
"bou_x": "618",
|
||||
"bou_y": "206",
|
||||
"bou_width": "150",
|
||||
"bou_height": "75",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"act_uid": "47452513353cfc4b015e855056634598",
|
||||
"act_name": "Task # 1",
|
||||
"act_type": "TASK",
|
||||
"act_is_for_compensation": "0",
|
||||
"act_start_quantity": "1",
|
||||
"act_completion_quantity": "0",
|
||||
"act_task_type": "EMPTY",
|
||||
"act_implementation": "",
|
||||
"act_instantiate": "0",
|
||||
"act_script_type": "",
|
||||
"act_script": "",
|
||||
"act_loop_type": "NONE",
|
||||
"act_test_before": "0",
|
||||
"act_loop_maximum": "0",
|
||||
"act_loop_condition": "0",
|
||||
"act_loop_cardinality": "0",
|
||||
"act_loop_behavior": "0",
|
||||
"act_is_adhoc": "0",
|
||||
"act_is_collapsed": "0",
|
||||
"act_completion_condition": "0",
|
||||
"act_ordering": "0",
|
||||
"act_cancel_remaining_instances": "0",
|
||||
"act_protocol": "0",
|
||||
"act_method": "0",
|
||||
"act_is_global": "0",
|
||||
"act_referer": "0",
|
||||
"act_default_flow": "0",
|
||||
"act_master_diagram": "0",
|
||||
"bou_x": "198",
|
||||
"bou_y": "146",
|
||||
"bou_width": "150",
|
||||
"bou_height": "75",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"act_uid": "63183340353cfc57778a499040015745",
|
||||
"act_name": "Task # 2",
|
||||
"act_type": "TASK",
|
||||
"act_is_for_compensation": "0",
|
||||
"act_start_quantity": "1",
|
||||
"act_completion_quantity": "0",
|
||||
"act_task_type": "EMPTY",
|
||||
"act_implementation": "",
|
||||
"act_instantiate": "0",
|
||||
"act_script_type": "",
|
||||
"act_script": "",
|
||||
"act_loop_type": "NONE",
|
||||
"act_test_before": "0",
|
||||
"act_loop_maximum": "0",
|
||||
"act_loop_condition": "0",
|
||||
"act_loop_cardinality": "0",
|
||||
"act_loop_behavior": "0",
|
||||
"act_is_adhoc": "0",
|
||||
"act_is_collapsed": "0",
|
||||
"act_completion_condition": "0",
|
||||
"act_ordering": "0",
|
||||
"act_cancel_remaining_instances": "0",
|
||||
"act_protocol": "0",
|
||||
"act_method": "0",
|
||||
"act_is_global": "0",
|
||||
"act_referer": "0",
|
||||
"act_default_flow": "0",
|
||||
"act_master_diagram": "0",
|
||||
"bou_x": "618",
|
||||
"bou_y": "74",
|
||||
"bou_width": "150",
|
||||
"bou_height": "75",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"evn_uid": "90282129153cfc4b0565a82000775606",
|
||||
"evn_name": "Start Event # 1",
|
||||
"evn_type": "START",
|
||||
"evn_marker": "EMPTY",
|
||||
"evn_is_interrupting": "1",
|
||||
"evn_cancel_activity": "0",
|
||||
"evn_activity_ref": "",
|
||||
"evn_wait_for_completion": "0",
|
||||
"evn_error_name": "",
|
||||
"evn_error_code": "",
|
||||
"evn_escalation_name": "",
|
||||
"evn_escalation_code": "",
|
||||
"evn_message": "LEAD",
|
||||
"evn_operation_implementation_ref": "",
|
||||
"evn_time_date": "",
|
||||
"evn_time_cycle": "",
|
||||
"evn_time_duration": "",
|
||||
"evn_behavior": "CATCH",
|
||||
"evn_operation_name": "",
|
||||
"bou_x": "57",
|
||||
"bou_y": "166",
|
||||
"bou_width": "33",
|
||||
"bou_height": "33",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"evn_uid": "98330162753cfc58a6e3282003840838",
|
||||
"evn_name": "End Event # 1",
|
||||
"evn_type": "END",
|
||||
"evn_marker": "EMPTY",
|
||||
"evn_is_interrupting": "1",
|
||||
"evn_cancel_activity": "0",
|
||||
"evn_activity_ref": "",
|
||||
"evn_wait_for_completion": "0",
|
||||
"evn_error_name": "",
|
||||
"evn_error_code": "",
|
||||
"evn_escalation_name": "",
|
||||
"evn_escalation_code": "",
|
||||
"evn_message": "",
|
||||
"evn_operation_implementation_ref": "",
|
||||
"evn_time_date": "",
|
||||
"evn_time_cycle": "",
|
||||
"evn_time_duration": "",
|
||||
"evn_behavior": "THROW",
|
||||
"evn_operation_name": "",
|
||||
"bou_x": "907",
|
||||
"bou_y": "149",
|
||||
"bou_width": "33",
|
||||
"bou_height": "33",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
],
|
||||
"gateways": [
|
||||
{
|
||||
"gat_uid": "10270112553cfc5779f0ec1019712071",
|
||||
"gat_name": "Exlusive Gateway # 1",
|
||||
"gat_type": "EXCLUSIVE",
|
||||
"gat_direction": "DIVERGING",
|
||||
"gat_instantiate": "0",
|
||||
"gat_activation_count": "0",
|
||||
"gat_waiting_for_start": "1",
|
||||
"gat_default_flow": "0",
|
||||
"gat_event_gateway_type": "NONE",
|
||||
"bou_x": "416",
|
||||
"bou_y": "162",
|
||||
"bou_width": "41",
|
||||
"bou_height": "41",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
],
|
||||
"flows": [
|
||||
{
|
||||
"flo_uid": "14108751053d00c1e327739055650441",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": "",
|
||||
"flo_element_origin": "47452513353cfc4b015e855056634598",
|
||||
"flo_element_origin_type": "bpmnActivity",
|
||||
"flo_element_dest": "10270112553cfc5779f0ec1019712071",
|
||||
"flo_element_dest_type": "bpmnGateway",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "345",
|
||||
"flo_y1": "178",
|
||||
"flo_x2": "411",
|
||||
"flo_y2": "178",
|
||||
"flo_state": [
|
||||
{
|
||||
"x": 350,
|
||||
"y": 183
|
||||
},
|
||||
{
|
||||
"x": 416,
|
||||
"y": 183
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flo_uid": "26171853453d00c1e327538080865741",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": "",
|
||||
"flo_element_origin": "10270112553cfc5779f0ec1019712071",
|
||||
"flo_element_origin_type": "bpmnGateway",
|
||||
"flo_element_dest": "63183340353cfc57778a499040015745",
|
||||
"flo_element_dest_type": "bpmnActivity",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "452",
|
||||
"flo_y1": "178",
|
||||
"flo_x2": "612",
|
||||
"flo_y2": "106",
|
||||
"flo_state": [
|
||||
{
|
||||
"x": 457,
|
||||
"y": 183
|
||||
},
|
||||
{
|
||||
"x": 537,
|
||||
"y": 183
|
||||
},
|
||||
{
|
||||
"x": 537,
|
||||
"y": 111
|
||||
},
|
||||
{
|
||||
"x": 617,
|
||||
"y": 111
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flo_uid": "35962716053d00c1e327923027081892",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": "",
|
||||
"flo_element_origin": "42039389753cfc58a2db023038551328",
|
||||
"flo_element_origin_type": "bpmnActivity",
|
||||
"flo_element_dest": "98330162753cfc58a6e3282003840838",
|
||||
"flo_element_dest_type": "bpmnEvent",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "765",
|
||||
"flo_y1": "238",
|
||||
"flo_x2": "902",
|
||||
"flo_y2": "161",
|
||||
"flo_state": [
|
||||
{
|
||||
"x": 770,
|
||||
"y": 243
|
||||
},
|
||||
{
|
||||
"x": 838,
|
||||
"y": 243
|
||||
},
|
||||
{
|
||||
"x": 838,
|
||||
"y": 166
|
||||
},
|
||||
{
|
||||
"x": 907,
|
||||
"y": 166
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flo_uid": "45234438053d00c1e327279046619951",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": "",
|
||||
"flo_element_origin": "90282129153cfc4b0565a82000775606",
|
||||
"flo_element_origin_type": "bpmnEvent",
|
||||
"flo_element_dest": "47452513353cfc4b015e855056634598",
|
||||
"flo_element_dest_type": "bpmnActivity",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "85",
|
||||
"flo_y1": "178",
|
||||
"flo_x2": "192",
|
||||
"flo_y2": "178",
|
||||
"flo_state": [
|
||||
{
|
||||
"x": 90,
|
||||
"y": 183
|
||||
},
|
||||
{
|
||||
"x": 197,
|
||||
"y": 183
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flo_uid": "85219507353d00c1e327b28058412058",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": "",
|
||||
"flo_element_origin": "63183340353cfc57778a499040015745",
|
||||
"flo_element_origin_type": "bpmnActivity",
|
||||
"flo_element_dest": "98330162753cfc58a6e3282003840838",
|
||||
"flo_element_dest_type": "bpmnEvent",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "765",
|
||||
"flo_y1": "106",
|
||||
"flo_x2": "902",
|
||||
"flo_y2": "161",
|
||||
"flo_state": [
|
||||
{
|
||||
"x": 770,
|
||||
"y": 111
|
||||
},
|
||||
{
|
||||
"x": 838,
|
||||
"y": 111
|
||||
},
|
||||
{
|
||||
"x": 838,
|
||||
"y": 166
|
||||
},
|
||||
{
|
||||
"x": 907,
|
||||
"y": 166
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flo_uid": "86729603453d00c1e327e23091238933",
|
||||
"flo_type": "SEQUENCE",
|
||||
"flo_name": "",
|
||||
"flo_element_origin": "10270112553cfc5779f0ec1019712071",
|
||||
"flo_element_origin_type": "bpmnGateway",
|
||||
"flo_element_dest": "42039389753cfc58a2db023038551328",
|
||||
"flo_element_dest_type": "bpmnActivity",
|
||||
"flo_is_inmediate": "1",
|
||||
"flo_condition": "",
|
||||
"flo_x1": "452",
|
||||
"flo_y1": "178",
|
||||
"flo_x2": "612",
|
||||
"flo_y2": "238",
|
||||
"flo_state": [
|
||||
{
|
||||
"x": 457,
|
||||
"y": 183
|
||||
},
|
||||
{
|
||||
"x": 537,
|
||||
"y": 183
|
||||
},
|
||||
{
|
||||
"x": 537,
|
||||
"y": 243
|
||||
},
|
||||
{
|
||||
"x": 617,
|
||||
"y": 243
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"art_uid": "59954519253d0052028c894036716690",
|
||||
"art_type": "V_LABEL",
|
||||
"art_name": "Vertical Text # 1",
|
||||
"art_category_ref": "",
|
||||
"bou_x": "57",
|
||||
"bou_y": "439",
|
||||
"bou_width": "30",
|
||||
"bou_height": "150",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"art_uid": "71566215953d0052023d2a8070976645",
|
||||
"art_type": "H_LABEL",
|
||||
"art_name": "Horizontal Text # 1",
|
||||
"art_category_ref": "",
|
||||
"bou_x": "27",
|
||||
"bou_y": "399",
|
||||
"bou_width": "100",
|
||||
"bou_height": "30",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"art_uid": "76936366253d005200fecf1072255540",
|
||||
"art_type": "VERTICAL_LINE",
|
||||
"art_name": "",
|
||||
"art_category_ref": "",
|
||||
"bou_x": "143",
|
||||
"bou_y": "-6666",
|
||||
"bou_width": "0",
|
||||
"bou_height": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"art_uid": "81251352753d005201445b3079328056",
|
||||
"art_type": "VERTICAL_LINE",
|
||||
"art_name": "",
|
||||
"art_category_ref": "",
|
||||
"bou_x": "492",
|
||||
"bou_y": "-6666",
|
||||
"bou_width": "0",
|
||||
"bou_height": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"art_uid": "83307143353d00520187cb7053341695",
|
||||
"art_type": "TEXT_ANNOTATION",
|
||||
"art_name": "Annotation # 1",
|
||||
"art_category_ref": "",
|
||||
"bou_x": "23",
|
||||
"bou_y": "321",
|
||||
"bou_width": "100",
|
||||
"bou_height": "30",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"art_uid": "83607134753d005200b7218057925307",
|
||||
"art_type": "VERTICAL_LINE",
|
||||
"art_name": "",
|
||||
"art_category_ref": "",
|
||||
"bou_x": "866",
|
||||
"bou_y": "-6668",
|
||||
"bou_width": "0",
|
||||
"bou_height": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"art_uid": "84367937053d0051fed9425007718074",
|
||||
"art_type": "HORIZONTAL_LINE",
|
||||
"art_name": "",
|
||||
"art_category_ref": "",
|
||||
"bou_x": "-6666",
|
||||
"bou_y": "297",
|
||||
"bou_width": "0",
|
||||
"bou_height": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
],
|
||||
"laneset": [],
|
||||
"lanes": [],
|
||||
"data": [
|
||||
{
|
||||
"dat_uid": "26571650353d005204769f0016803456",
|
||||
"pro_uid": "93177932753cfc0a8986c44089014824",
|
||||
"dat_name": "Data Store # 1",
|
||||
"dat_type": "DATASTORE",
|
||||
"dat_is_collection": "0",
|
||||
"dat_item_kind": "INFORMATION",
|
||||
"dat_capacity": "0",
|
||||
"dat_is_unlimited": "0",
|
||||
"dat_state": "",
|
||||
"dat_is_global": "0",
|
||||
"dat_object_ref": "",
|
||||
"bou_uid": "18632057653d00520498147014458357",
|
||||
"dia_uid": "44288077153cfc0a89424f9087061662",
|
||||
"element_uid": "26571650353d005204769f0016803456",
|
||||
"bou_element": "pm_canvas",
|
||||
"bou_element_type": "bpmnData",
|
||||
"bou_x": "653",
|
||||
"bou_y": "359",
|
||||
"bou_width": "41",
|
||||
"bou_height": "41",
|
||||
"bou_rel_position": "0",
|
||||
"bou_size_identical": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
},
|
||||
{
|
||||
"dat_uid": "78867843253d00520623a38020792926",
|
||||
"pro_uid": "93177932753cfc0a8986c44089014824",
|
||||
"dat_name": "Data Object # 1",
|
||||
"dat_type": "DATAOBJECT",
|
||||
"dat_is_collection": "0",
|
||||
"dat_item_kind": "INFORMATION",
|
||||
"dat_capacity": "0",
|
||||
"dat_is_unlimited": "0",
|
||||
"dat_state": "",
|
||||
"dat_is_global": "0",
|
||||
"dat_object_ref": "",
|
||||
"bou_uid": "69652140553d0052062ece8068466841",
|
||||
"dia_uid": "44288077153cfc0a89424f9087061662",
|
||||
"element_uid": "78867843253d00520623a38020792926",
|
||||
"bou_element": "pm_canvas",
|
||||
"bou_element_type": "bpmnData",
|
||||
"bou_x": "279",
|
||||
"bou_y": "359",
|
||||
"bou_width": "33",
|
||||
"bou_height": "41",
|
||||
"bou_rel_position": "0",
|
||||
"bou_size_identical": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
],
|
||||
"participants": [
|
||||
{
|
||||
"par_uid": "23138442753d004f65bfca9078520587",
|
||||
"pro_uid": "93177932753cfc0a8986c44089014824",
|
||||
"lns_uid": "",
|
||||
"par_name": "Participant # 1",
|
||||
"par_minimum": "0",
|
||||
"par_maximum": "1",
|
||||
"par_num_participants": "1",
|
||||
"par_is_horizontal": "1",
|
||||
"bou_uid": "69206715353d004f65c9bc3086768663",
|
||||
"dia_uid": "44288077153cfc0a89424f9087061662",
|
||||
"element_uid": "23138442753d004f65bfca9078520587",
|
||||
"bou_element": "pm_canvas",
|
||||
"bou_element_type": "bpmnParticipant",
|
||||
"bou_x": "885",
|
||||
"bou_y": "359",
|
||||
"bou_width": "500",
|
||||
"bou_height": "100",
|
||||
"bou_rel_position": "0",
|
||||
"bou_size_identical": "0",
|
||||
"bou_container": "bpmnDiagram"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
105
workflow/engine/classes/class.pmDynaform.php
Normal file
105
workflow/engine/classes/class.pmDynaform.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.pmDynaform.php
|
||||
* Implementing pmDynaform library in the running case.
|
||||
*
|
||||
* @author Roly Rudy Gutierrez Pinto
|
||||
* @package engine.classes
|
||||
*/
|
||||
class pmDynaform
|
||||
{
|
||||
|
||||
public static $instance = null;
|
||||
public $dyn_uid = null;
|
||||
public $record = null;
|
||||
public $app_data = null;
|
||||
|
||||
public function __construct($dyn_uid, $app_data)
|
||||
{
|
||||
$this->dyn_uid = $dyn_uid;
|
||||
$this->app_data = $app_data;
|
||||
|
||||
$this->getDynaform();
|
||||
}
|
||||
|
||||
public function getDynaform()
|
||||
{
|
||||
if ($this->record != null) {
|
||||
return $this->record;
|
||||
}
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->addSelectColumn(DynaformPeer::PRO_UID);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$a->add(DynaformPeer::DYN_UID, $this->dyn_uid, Criteria::EQUAL);
|
||||
$ds = ProcessPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
$this->record = isset($row) ? $row : null;
|
||||
|
||||
return $this->record;
|
||||
}
|
||||
|
||||
public function getMergeValues()
|
||||
{
|
||||
$dataJSON = G::json_decode($this->record["DYN_CONTENT"]);
|
||||
$dt = $dataJSON->items[0]->items;
|
||||
$n = count($dt);
|
||||
for ($i = 0; $i < $n; $i++) {
|
||||
$dr = $dt[$i];
|
||||
$n2 = count($dr);
|
||||
for ($j = 0; $j < $n2; $j++) {
|
||||
if ($dr[$j]->name) {
|
||||
$valueField = isset($this->app_data[$dr[$j]->name]) ? $this->app_data[$dr[$j]->name] : "";
|
||||
$dataJSON->items[0]->items[$i][$j]->defaultValue = $valueField;
|
||||
}
|
||||
}
|
||||
}
|
||||
return G::json_encode($dataJSON);
|
||||
}
|
||||
|
||||
public function mergeValues()
|
||||
{
|
||||
$this->record["DYN_CONTENT"] = $this->getMergeValues();
|
||||
}
|
||||
|
||||
public function isResponsive()
|
||||
{
|
||||
return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false;
|
||||
}
|
||||
|
||||
public function printView($pm_run_outside_main_app, $application)
|
||||
{
|
||||
ob_clean();
|
||||
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform_View.html');
|
||||
$file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file);
|
||||
$file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", $pm_run_outside_main_app, $file);
|
||||
$file = str_replace("{DYN_UID}", $this->dyn_uid, $file);
|
||||
$file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file);
|
||||
$file = str_replace("{APP_UID}", $application, $file);
|
||||
echo $file;
|
||||
exit();
|
||||
}
|
||||
|
||||
public function printEdit($pm_run_outside_main_app, $application, $headData)
|
||||
{
|
||||
ob_clean();
|
||||
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html');
|
||||
$file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file);
|
||||
$file = str_replace("{CASE}", $headData["CASE"], $file);
|
||||
$file = str_replace("{APP_NUMBER}", $headData["APP_NUMBER"], $file);
|
||||
$file = str_replace("{TITLE}", $headData["TITLE"], $file);
|
||||
$file = str_replace("{APP_TITLE}", $headData["APP_TITLE"], $file);
|
||||
$file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", $pm_run_outside_main_app, $file);
|
||||
$file = str_replace("{DYN_UID}", $this->dyn_uid, $file);
|
||||
$file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file);
|
||||
$file = str_replace("{APP_UID}", $application, $file);
|
||||
echo $file;
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -447,5 +447,27 @@ class ProcessProxy extends HttpProxyController
|
||||
}
|
||||
$this->rows = $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate BPMN (New record is generated)
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function generateBpmn()
|
||||
{
|
||||
try {
|
||||
$processUid = $_POST["processUid"];
|
||||
|
||||
$workflowBpmn = new \ProcessMaker\Project\Adapter\WorkflowBpmn();
|
||||
|
||||
$projectUid = $workflowBpmn->generateBpmn($processUid, "processUid", $_SESSION["USER_LOGGED"]);
|
||||
|
||||
$this->status = "OK";
|
||||
$this->projectUid = $projectUid;
|
||||
} catch (Exception $e) {
|
||||
$this->status = "ERROR";
|
||||
$this->message = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,23 +21,12 @@ function dynaFormChanged (frm) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function validateNameField (form, type) {
|
||||
var i, j = 0, dt, name;
|
||||
dt = form.getElementsByTagName(type);
|
||||
for (i = 0; i < dt.length; i++) {
|
||||
name = dt[i].name;
|
||||
if (!name)
|
||||
name = "field" + type + j;
|
||||
dt[i].name = "form[" + name + "]";
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
$(window).load(function () {
|
||||
var data = JSON.parse(jsondata);
|
||||
var modelPMDynaform = new PMDynaform.Model.Form(data);
|
||||
var viewPMDynaform = new PMDynaform.View.Form({tagName: "div", renderTo: $(".container"), model: modelPMDynaform});
|
||||
window.dynaform = new PMDynaform.core.Project({
|
||||
data: data,
|
||||
submitRest: false
|
||||
});
|
||||
|
||||
if (pm_run_outside_main_app === 'true') {
|
||||
if (parent.showCaseNavigatorPanel) {
|
||||
@@ -50,39 +39,49 @@ window.onload = function () {
|
||||
}
|
||||
|
||||
var form = document.getElementsByTagName("form")[0];
|
||||
validateNameField(form, "input");
|
||||
validateNameField(form, "textarea");
|
||||
validateNameField(form, "select");
|
||||
|
||||
var el = form.elements;
|
||||
var k = 0;
|
||||
var dt = data.items[0].items;
|
||||
for (var i = 0; i < dt.length; i++) {
|
||||
var dr = dt[i];
|
||||
for (var j = 0; j < dr.length; j++) {
|
||||
if (dr[j].name) {
|
||||
el[k].name = "form[" + dr[j].name + "]";
|
||||
k = k + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var type = document.createElement("input");
|
||||
type.type = "hidden";
|
||||
type.value = "ASSIGN_TASK";
|
||||
type.name = "TYPE";
|
||||
type.value = "ASSIGN_TASK";
|
||||
|
||||
var uid = document.createElement("input");
|
||||
uid.type = "hidden";
|
||||
uid.value = dyn_uid;
|
||||
uid.name = "UID";
|
||||
uid.value = dyn_uid;
|
||||
|
||||
var position = document.createElement("input");
|
||||
position.type = "hidden";
|
||||
position.value = "10000";
|
||||
position.name = "POSITION";
|
||||
position.value = "10000";
|
||||
|
||||
var action = document.createElement("input");
|
||||
action.type = "hidden";
|
||||
action.value = "ASSIGN";
|
||||
action.name = "ACTION";
|
||||
action.value = "ASSIGN";
|
||||
|
||||
var dynaformname = document.createElement("input");
|
||||
dynaformname.type = "hidden";
|
||||
dynaformname.value = __DynaformName__;
|
||||
dynaformname.name = "__DynaformName__";
|
||||
dynaformname.value = __DynaformName__;
|
||||
|
||||
var appuid = document.createElement("input");
|
||||
appuid.type = "hidden";
|
||||
appuid.value = app_uid;
|
||||
appuid.name = "APP_UID";
|
||||
appuid.value = app_uid;
|
||||
|
||||
form.action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid;
|
||||
form.method = "post";
|
||||
@@ -93,4 +92,9 @@ window.onload = function () {
|
||||
form.appendChild(dynaformname);
|
||||
form.appendChild(appuid);
|
||||
|
||||
};
|
||||
var dyn_forward = document.getElementById("dyn_forward");
|
||||
dyn_forward.onclick = function () {
|
||||
form.submit();
|
||||
return false;
|
||||
};
|
||||
});
|
||||
@@ -380,7 +380,14 @@ if ($actionAjax == 'dynaformChangeLogViewHistory') {
|
||||
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = '';
|
||||
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#';
|
||||
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'return false;';
|
||||
$G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' );
|
||||
G::LoadClass('pmDynaform');
|
||||
$a = new pmDynaform($_GET['DYN_UID'], $Fields['APP_DATA']);
|
||||
if ($a->isResponsive()) {
|
||||
$a->mergeValues();
|
||||
$a->printView((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION']);
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view');
|
||||
}
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
@@ -463,8 +470,14 @@ if ($actionAjax == 'historyDynaformGridPreview') {
|
||||
|
||||
$_SESSION['CURRENT_DYN_UID'] = $_POST['DYN_UID'];
|
||||
$_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID'];
|
||||
$G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view' );
|
||||
|
||||
G::LoadClass('pmDynaform');
|
||||
$a = new pmDynaform($_GET['DYN_UID'], $Fields['APP_DATA']);
|
||||
if ($a->isResponsive()) {
|
||||
$a->mergeValues();
|
||||
$a->printView((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION']);
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view');
|
||||
}
|
||||
?>
|
||||
<script language="javascript">
|
||||
|
||||
|
||||
@@ -41,6 +41,23 @@ try {
|
||||
throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>',G::LoadTranslation( 'ID_REOPEN' ) ) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* PMDynaform
|
||||
* DYN_VERSION is 1: classic Dynaform,
|
||||
* DYN_VERSION is 2: responsive form, Pmdynaform.
|
||||
*/
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
$a->add(DynaformPeer::DYN_UID, $_GET['UID'], Criteria::EQUAL);
|
||||
$a = ProcessPeer::doSelectRS($a);
|
||||
$a->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$a->next();
|
||||
$row = $a->getRow();
|
||||
$swpmdynaform = isset($row) && $row["DYN_VERSION"] == 2;
|
||||
if ($swpmdynaform) {
|
||||
$pmdynaform = $_POST["form"];
|
||||
}
|
||||
|
||||
$oForm = new Form( $_SESSION["PROCESS"] . "/" . $_GET["UID"], PATH_DYNAFORM );
|
||||
$oForm->validatePost();
|
||||
|
||||
@@ -167,6 +184,10 @@ try {
|
||||
//$aData['APP_STATUS'] = $Fields['APP_STATUS'];
|
||||
$aData['PRO_UID'] = $_SESSION['PROCESS'];
|
||||
|
||||
if ($swpmdynaform) {
|
||||
$aData['APP_DATA'] = array_merge($aData['APP_DATA'], $pmdynaform);
|
||||
}
|
||||
|
||||
$oCase->updateCase( $_SESSION['APPLICATION'], $aData );
|
||||
|
||||
// saving the data ina pm table in case that is a new record
|
||||
|
||||
@@ -257,52 +257,14 @@ try {
|
||||
$oDbConnections->loadAdditionalConnections();
|
||||
$_SESSION['CURRENT_DYN_UID'] = $_GET['UID'];
|
||||
|
||||
/*
|
||||
* PMDynaform
|
||||
* DYN_VERSION is 1: classic Dynaform,
|
||||
* DYN_VERSION is 2: responsive form, Pmdynaform.
|
||||
*/
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->addSelectColumn(DynaformPeer::PRO_UID);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$a->add(DynaformPeer::DYN_UID, $_GET['UID'], Criteria::EQUAL);
|
||||
$ds = ProcessPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
$file = "";
|
||||
if (isset($row) && $row["DYN_VERSION"] == 2) {
|
||||
/*$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step_Pmdynaform.html');
|
||||
$oTemplatePower = new TemplatePower(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html', T_BYVAR);
|
||||
$oTemplatePower->prepare();
|
||||
$oTemplatePower->assign("JSON_DATA", $row["DYN_CONTENT"]);
|
||||
$oTemplatePower->assign("CASE", $array["CASE"]);
|
||||
$oTemplatePower->assign("APP_NUMBER", $array["APP_NUMBER"]);
|
||||
$oTemplatePower->assign("TITLE", $array["TITLE"]);
|
||||
$oTemplatePower->assign("APP_TITLE", $array["APP_TITLE"]);
|
||||
$oTemplatePower->assign("PM_RUN_OUTSIDE_MAIN_APP", (!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false");
|
||||
$oTemplatePower->assign("DYN_UID", $_GET['UID']);
|
||||
$oTemplatePower->assign("DYNAFORMNAME", $row["PRO_UID"] . "_" . $row["DYN_UID"]);
|
||||
$oTemplatePower->assign("APP_UID", $_SESSION['APPLICATION']);
|
||||
$oTemplatePower->printToScreen();*/
|
||||
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html');
|
||||
$file = str_replace("{JSON_DATA}", $row["DYN_CONTENT"], $file);
|
||||
$file = str_replace("{CASE}", $array["CASE"], $file);
|
||||
$file = str_replace("{APP_NUMBER}", $array["APP_NUMBER"], $file);
|
||||
$file = str_replace("{TITLE}", $array["TITLE"], $file);
|
||||
$file = str_replace("{APP_TITLE}", $array["APP_TITLE"], $file);
|
||||
$file = str_replace("{PM_RUN_OUTSIDE_MAIN_APP}", (!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $file);
|
||||
$file = str_replace("{DYN_UID}", $_GET['UID'], $file);
|
||||
$file = str_replace("{DYNAFORMNAME}", $row["PRO_UID"] . "_" . $row["DYN_UID"], $file);
|
||||
$file = str_replace("{APP_UID}", $_SESSION['APPLICATION'], $file);
|
||||
echo $file;
|
||||
exit();
|
||||
G::LoadClass('pmDynaform');
|
||||
$a = new pmDynaform($_GET['UID'], $Fields['APP_DATA']);
|
||||
if ($a->isResponsive()) {
|
||||
$a->mergeValues();
|
||||
$a->printEdit((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION'], $array);
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));
|
||||
}
|
||||
|
||||
break;
|
||||
case 'INPUT_DOCUMENT':
|
||||
if ($noShowTitle == 0) {
|
||||
|
||||
@@ -162,6 +162,7 @@ class ProcessSupervisor
|
||||
try {
|
||||
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Roles.php");
|
||||
$aRespLi = array();
|
||||
$aRespLiGroups = array();
|
||||
$userRole = new \ProcessMaker\BusinessModel\User();
|
||||
// Groups
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
|
||||
@@ -34,7 +34,6 @@ class ProjectUser
|
||||
$oCriteria->addJoin(\TaskUserPeer::TAS_UID, \TaskPeer::TAS_UID, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(\TaskUserPeer::TU_TYPE, 1);
|
||||
$oCriteria->addGroupByColumn(\TaskUserPeer::USR_UID);
|
||||
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
@@ -148,7 +147,6 @@ class ProjectUser
|
||||
'act_uid' => $task['uid']);
|
||||
}
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
$new = array();
|
||||
$exclude = array("");
|
||||
|
||||
@@ -1399,6 +1399,7 @@ class Task
|
||||
$criteria->addSelectColumn( \GroupwfPeer::GRP_UID );
|
||||
$criteria->addSelectColumn( \GroupwfPeer::GRP_STATUS );
|
||||
$criteria->addSelectColumn( \GroupwfPeer::GRP_UX );
|
||||
$criteria->add(\GroupwfPeer::GRP_STATUS, "ACTIVE", \Criteria::EQUAL);
|
||||
$criteria->addAsColumn( 'GRP_TITLE', \ContentPeer::CON_VALUE );
|
||||
$criteria->addJoin( \GroupwfPeer::GRP_UID, \ContentPeer::CON_ID, \Criteria::LEFT_JOIN );
|
||||
$criteria->add( \ContentPeer::CON_CATEGORY, 'GRP_TITLE' );
|
||||
|
||||
@@ -73,9 +73,9 @@ class Variable
|
||||
$variable->setVarDefault($arrayData["VAR_DEFAULT"]);
|
||||
}
|
||||
if (isset($arrayData["VAR_ACCEPTED_VALUES"])) {
|
||||
$variable->setVarAcceptedValues($arrayData["VAR_ACCEPTED_VALUES"]);
|
||||
$encodeAcceptedValues = json_encode($arrayData["VAR_ACCEPTED_VALUES"]);
|
||||
$variable->setVarAcceptedValues($encodeAcceptedValues);
|
||||
}
|
||||
|
||||
$variable->save();
|
||||
$cnn->commit();
|
||||
} else {
|
||||
@@ -158,7 +158,8 @@ class Variable
|
||||
$variable->setVarDefault($arrayData["VAR_DEFAULT"]);
|
||||
}
|
||||
if (isset($arrayData["VAR_ACCEPTED_VALUES"])) {
|
||||
$variable->setVarAcceptedValues($arrayData["VAR_ACCEPTED_VALUES"]);
|
||||
$encodeAcceptedValues = json_encode($arrayData["VAR_ACCEPTED_VALUES"]);
|
||||
$variable->setVarAcceptedValues($encodeAcceptedValues);
|
||||
}
|
||||
$variable->save();
|
||||
$cnn->commit();
|
||||
@@ -198,6 +199,8 @@ class Variable
|
||||
Validator::proUid($processUid, '$prj_uid');
|
||||
|
||||
$this->throwExceptionIfNotExistsVariable($variableUid);
|
||||
|
||||
$this->verifyUse($processUid, $variableUid);
|
||||
//Delete
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
@@ -382,7 +385,6 @@ class Variable
|
||||
*
|
||||
* @param string $processUid Unique id of Process
|
||||
* @param string $variableName Name
|
||||
* @param string $variableUidExclude Unique id of Variable to exclude
|
||||
*
|
||||
*/
|
||||
public function existsName($processUid, $variableName)
|
||||
@@ -537,5 +539,53 @@ class Variable
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the variable is being used in a Dynaform
|
||||
*
|
||||
* @param string $processUid Unique id of Process
|
||||
* @param string $variableUid Unique id of Variable
|
||||
*
|
||||
*/
|
||||
public function verifyUse($processUid, $variableUid)
|
||||
{
|
||||
try {
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\DynaformPeer::DYN_CONTENT);
|
||||
$criteria->addSelectColumn(\DynaformPeer::DYN_UID);
|
||||
$criteria->add(\DynaformPeer::PRO_UID, $processUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \DynaformPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$contentDecode = json_decode($row["DYN_CONTENT"], true);
|
||||
$content = $contentDecode['items'][0]['items'];
|
||||
|
||||
foreach ($content as $key => $value) {
|
||||
if (isset($value[0]["variable"])) {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME);
|
||||
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $value[0]["variable"], \Criteria::EQUAL);
|
||||
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
|
||||
if ($rsCriteria->getRow()) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_VARIABLE_IN_USE", array($variableUid, $row["DYN_UID"])));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class WebEntry
|
||||
|
||||
$newName = str_replace($arraySpecialCharSearch, $arraySpecialCharReplace, $name);
|
||||
|
||||
$arraySpecialCharSearch = array("/[\!-\)\:-\@]/", "/[\{\}\[\]\¿\?\+]/");
|
||||
$arraySpecialCharSearch = array("/[\!-\)\:-\@]/", "/[\{\}\[\]\|\¿\?\+\*]/");
|
||||
$arraySpecialCharReplace = array("", "");
|
||||
|
||||
$newName = preg_replace($arraySpecialCharSearch, $arraySpecialCharReplace, $newName);
|
||||
|
||||
@@ -111,60 +111,13 @@ abstract class Exporter
|
||||
$bpmnStruct["PROCESS"] = \BpmnProcess::getAll($this->prjUid);
|
||||
$bpmnStruct["PROJECT"] = array(\BpmnProjectPeer::retrieveByPK($this->prjUid)->toArray());
|
||||
|
||||
$oProcess = new \Processes();
|
||||
$workflowData = (array) $oProcess->getWorkflowData($this->prjUid);
|
||||
$workflowData["process"]['PRO_DYNAFORMS'] = empty($workflowData["process"]['PRO_DYNAFORMS'])
|
||||
? "" : serialize($workflowData["process"]['PRO_DYNAFORMS']);
|
||||
|
||||
$workflowData["process"] = array($workflowData["process"]);
|
||||
$workflowData["processCategory"] = empty($workflowData["processCategory"]) ? array() : array($workflowData["processCategory"]);
|
||||
$workflow = new \ProcessMaker\Project\Workflow();
|
||||
|
||||
list($workflowData, $workflowFile) = $workflow->getData($this->prjUid);
|
||||
|
||||
$data["bpmn-definition"] = $bpmnStruct;
|
||||
$data["workflow-definition"] = $workflowData;
|
||||
$data["workflow-files"] = array();
|
||||
|
||||
// getting dynaforms
|
||||
foreach ($workflowData["dynaforms"] as $dynaform) {
|
||||
$dynFile = PATH_DYNAFORM . $dynaform['DYN_FILENAME'] . '.xml';
|
||||
$data["workflow-files"]["DYNAFORMS"][] = array(
|
||||
"filename" => $dynaform['DYN_TITLE'],
|
||||
"filepath" => $dynaform['DYN_FILENAME'] . '.xml',
|
||||
"file_content" => file_get_contents($dynFile)
|
||||
);
|
||||
|
||||
$htmlFile = PATH_DYNAFORM . $dynaform['DYN_FILENAME'] . '.html';
|
||||
|
||||
if (file_exists($htmlFile)) {
|
||||
$data["workflow-files"]["DYNAFORMS"][] = array(
|
||||
"filename" => $dynaform['DYN_FILENAME'] . '.html',
|
||||
"filepath" => $dynaform['DYN_FILENAME'] . '.html',
|
||||
"file_content" => file_get_contents($htmlFile)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// getting templates files
|
||||
$workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public");
|
||||
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
|
||||
|
||||
foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) {
|
||||
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $this->prjUid;
|
||||
$templatesFiles = Util\Common::rglob("$templatesDir/*", 0, true);
|
||||
|
||||
foreach ($templatesFiles as $templatesFile) {
|
||||
if (is_dir($templatesFile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filename = basename($templatesFile);
|
||||
$data["workflow-files"][$target][] = array(
|
||||
"filename" => $filename,
|
||||
"filepath" => $this->prjUid . PATH_SEP . $filename,
|
||||
"file_content" => file_get_contents($templatesFile)
|
||||
);
|
||||
}
|
||||
}
|
||||
$data["workflow-files"] = $workflowFile;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -315,8 +315,8 @@ abstract class Importer
|
||||
$diagram["events"] = $tables["event"];
|
||||
$diagram["flows"] = $tables["flow"];
|
||||
$diagram["gateways"] = $tables["gateway"];
|
||||
$diagram["data"] = $tables["data"];
|
||||
$diagram["participants"] = $tables["participant"];
|
||||
$diagram["data"] = (isset($tables["data"]))? $tables["data"] : array();
|
||||
$diagram["participants"] = (isset($tables["participant"]))? $tables["participant"] : array();
|
||||
$diagram["lanes"] = array();
|
||||
$diagram["laneset"] = array();
|
||||
$project["diagrams"] = array($diagram);
|
||||
@@ -328,46 +328,16 @@ abstract class Importer
|
||||
|
||||
protected function importWfTables(array $tables)
|
||||
{
|
||||
$tables = (object) $tables;
|
||||
$workflow = new \ProcessMaker\Project\Workflow();
|
||||
|
||||
$processes = new \Processes();
|
||||
|
||||
$processes->createProcessPropertiesFromData($tables);
|
||||
$workflow->createDataByArrayData($tables);
|
||||
}
|
||||
|
||||
protected function importWfFiles(array $workflowFiles)
|
||||
{
|
||||
foreach ($workflowFiles as $target => $files) {
|
||||
switch ($target) {
|
||||
case "dynaforms":
|
||||
$basePath = PATH_DYNAFORM;
|
||||
break;
|
||||
case "public":
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP;
|
||||
break;
|
||||
case "templates":
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "mailTemplates" . PATH_SEP;
|
||||
break;
|
||||
default:
|
||||
$basePath = "";
|
||||
}
|
||||
$workflow = new \ProcessMaker\Project\Workflow();
|
||||
|
||||
if (empty($basePath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
$filename = $basePath . $file["file_path"];
|
||||
$path = dirname($filename);
|
||||
|
||||
if (! is_dir($path)) {
|
||||
Util\Common::mk_dir($path, 0775);
|
||||
}
|
||||
|
||||
file_put_contents($filename, $file["file_content"]);
|
||||
chmod($filename, 0775);
|
||||
}
|
||||
}
|
||||
$workflow->createDataFileByArrayFile($workflowFiles);
|
||||
}
|
||||
|
||||
public function doImport($generateUid = true)
|
||||
@@ -384,63 +354,13 @@ abstract class Importer
|
||||
|
||||
//Import workflow tables
|
||||
if ($generateUid) {
|
||||
//Update TAS_UID
|
||||
foreach ($arrayWorkflowTables["tasks"] as $key1 => $value1) {
|
||||
$taskUid = $arrayWorkflowTables["tasks"][$key1]["TAS_UID"];
|
||||
$result[0]["object"] = "project";
|
||||
$result[0]["old_uid"] = $projectUidOld;
|
||||
$result[0]["new_uid"] = $projectUid;
|
||||
|
||||
foreach ($result as $value2) {
|
||||
$arrayItem = $value2;
|
||||
$workflow = new \ProcessMaker\Project\Workflow();
|
||||
|
||||
if ($arrayItem["old_uid"] == $taskUid) {
|
||||
$arrayWorkflowTables["tasks"][$key1]["TAS_UID_OLD"] = $taskUid;
|
||||
$arrayWorkflowTables["tasks"][$key1]["TAS_UID"] = $arrayItem["new_uid"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Workflow tables
|
||||
$workflowTables = (object)($arrayWorkflowTables);
|
||||
|
||||
$processes = new \Processes();
|
||||
$processes->setProcessGUID($workflowTables, $projectUid);
|
||||
$processes->renewAll($workflowTables);
|
||||
|
||||
$arrayWorkflowTables = (array)($workflowTables);
|
||||
|
||||
//Workflow files
|
||||
foreach ($arrayWorkflowFiles as $key1 => $value1) {
|
||||
$arrayFiles = $value1;
|
||||
|
||||
foreach ($arrayFiles as $key2 => $value2) {
|
||||
$file = $value2;
|
||||
|
||||
$arrayWorkflowFiles[$key1][$key2]["file_path"] = str_replace($projectUidOld, $projectUid, $file["file_path"]);
|
||||
$arrayWorkflowFiles[$key1][$key2]["file_content"] = str_replace($projectUidOld, $projectUid, $file["file_content"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayWorkflowTables["uid"])) {
|
||||
foreach ($arrayWorkflowTables["uid"] as $key1 => $value1) {
|
||||
$arrayT = $value1;
|
||||
|
||||
foreach ($arrayT as $key2 => $value2) {
|
||||
$uidOld = $key2;
|
||||
$uid = $value2;
|
||||
|
||||
foreach ($arrayWorkflowFiles as $key3 => $value3) {
|
||||
$arrayFiles = $value3;
|
||||
|
||||
foreach ($arrayFiles as $key4 => $value4) {
|
||||
$file = $value4;
|
||||
|
||||
$arrayWorkflowFiles[$key3][$key4]["file_path"] = str_replace($uidOld, $uid, $file["file_path"]);
|
||||
$arrayWorkflowFiles[$key3][$key4]["file_content"] = str_replace($uidOld, $uid, $file["file_content"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list($arrayWorkflowTables, $arrayWorkflowFiles) = $workflow->updateDataUidByArrayUid($arrayWorkflowTables, $arrayWorkflowFiles, $result);
|
||||
}
|
||||
|
||||
$this->importWfTables($arrayWorkflowTables);
|
||||
|
||||
@@ -826,11 +826,17 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
/*
|
||||
* Diagram's Gateways Handling
|
||||
*/
|
||||
$arrayUidGatewayParallel = array();
|
||||
$flagGatewayParallel = false;
|
||||
|
||||
$whiteList = array();
|
||||
|
||||
foreach ($diagram["gateways"] as $i => $gatewayData) {
|
||||
$gatewayData = array_change_key_case($gatewayData, CASE_UPPER);
|
||||
unset($gatewayData["_EXTENDED"]);
|
||||
|
||||
$flagAddOrUpdate = false;
|
||||
|
||||
$gateway = $bwp->getGateway($gatewayData["GAT_UID"]);
|
||||
|
||||
if ($forceInsert || is_null($gateway)) {
|
||||
@@ -849,12 +855,25 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
|
||||
$bwp->addGateway($gatewayData);
|
||||
|
||||
$flagAddOrUpdate = true;
|
||||
} elseif (! $bwp->isEquals($gateway, $gatewayData)) {
|
||||
$bwp->updateGateway($gatewayData["GAT_UID"], $gatewayData);
|
||||
|
||||
$flagAddOrUpdate = true;
|
||||
} else {
|
||||
Util\Logger::log("Update Gateway ({$gatewayData["GAT_UID"]}) Skipped - No changes required");
|
||||
}
|
||||
|
||||
if ($flagAddOrUpdate) {
|
||||
$arrayGatewayData = $bwp->getGateway($gatewayData["GAT_UID"]);
|
||||
|
||||
if ($arrayGatewayData["GAT_TYPE"] == "PARALLEL") {
|
||||
$arrayUidGatewayParallel[] = $gatewayData["GAT_UID"];
|
||||
$flagGatewayParallel = true;
|
||||
}
|
||||
}
|
||||
|
||||
$diagram["gateways"][$i] = $gatewayData;
|
||||
$whiteList[] = $gatewayData["GAT_UID"];
|
||||
}
|
||||
@@ -932,7 +951,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Event
|
||||
//Data
|
||||
unset($dataObjectData["BOU_UID"]);
|
||||
|
||||
$uidOld = $dataObjectData["DAT_UID"];
|
||||
@@ -979,7 +998,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Event
|
||||
//Participant
|
||||
unset($participantData["BOU_UID"]);
|
||||
|
||||
$uidOld = $participantData["PAR_UID"];
|
||||
@@ -1013,7 +1032,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Diagram's Flows Handling
|
||||
*/
|
||||
@@ -1050,6 +1068,11 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
//Update condition
|
||||
if ($flagGatewayParallel && $flowData["FLO_ELEMENT_ORIGIN_TYPE"] == "bpmnGateway" && in_array($flowData["FLO_ELEMENT_ORIGIN"], $arrayUidGatewayParallel)) {
|
||||
$flowData["FLO_CONDITION"] = "";
|
||||
}
|
||||
|
||||
$diagram["flows"][$i] = $flowData;
|
||||
$whiteList[] = $flowData["FLO_UID"];
|
||||
}
|
||||
|
||||
@@ -58,13 +58,12 @@ class WorkflowBpmn extends Project\Workflow
|
||||
$bpData["PRJ_AUTHOR"] = $data["USR_UID"];
|
||||
}
|
||||
|
||||
$bp = new Project\Bpmn();
|
||||
$bp->create($bpData);
|
||||
$this->bp = new Project\Bpmn();
|
||||
$this->bp->create($bpData);
|
||||
|
||||
// At this time we will add a default diagram and process
|
||||
$bp->addDiagram();
|
||||
$bp->addProcess();
|
||||
|
||||
$this->bp->addDiagram();
|
||||
$this->bp->addProcess();
|
||||
} catch (\Exception $e) {
|
||||
$prjUid = $this->getUid();
|
||||
$this->remove();
|
||||
@@ -87,11 +86,719 @@ class WorkflowBpmn extends Project\Workflow
|
||||
$this->bp->remove();
|
||||
}
|
||||
|
||||
public function addTask($taskData)
|
||||
{
|
||||
$tasUid = parent::addTask($taskData);
|
||||
public function startTaskEndProcessToBpmnEvent(
|
||||
$objectBpmnType,
|
||||
$objectUid,
|
||||
$objectBouX,
|
||||
$objectBouY,
|
||||
$objectBouWidth,
|
||||
$objectBouHeight,
|
||||
$eventName,
|
||||
$eventType,
|
||||
$condition = ""
|
||||
) {
|
||||
try {
|
||||
$eventBouWidth = 35;
|
||||
$eventBouHeight = $eventBouWidth;
|
||||
|
||||
// logica para bpmn
|
||||
$this->bp->addActivity(array('ACT_UID'=>$tasUid));
|
||||
$eventBouWidth2 = (int)($eventBouWidth / 2);
|
||||
$eventBouHeight2 = (int)($eventBouHeight / 2);
|
||||
|
||||
$eventBouHeight12 = (int)($eventBouWidth / 12);
|
||||
|
||||
//
|
||||
$objectBouWidth2 = (int)($objectBouWidth / 2);
|
||||
$objectBouWidth4 = (int)($objectBouWidth / 4);
|
||||
|
||||
//Event
|
||||
if ($objectBpmnType == "bpmnGateway" && $eventType == "END") {
|
||||
//Gateway
|
||||
$eventBouX = $objectBouX + $objectBouWidth + $objectBouWidth4;
|
||||
$eventBouY = $objectBouY + (int)($objectBouHeight / 2) - $eventBouHeight2;
|
||||
} else {
|
||||
//Activity
|
||||
$eventBouX = $objectBouX + $objectBouWidth2 - $eventBouWidth2;
|
||||
$eventBouY = ($eventType == "START")? $objectBouY - $eventBouHeight - $eventBouHeight2 : $objectBouY + $objectBouHeight + $eventBouHeight2 + $eventBouHeight12;
|
||||
}
|
||||
|
||||
$arrayData = array(
|
||||
"EVN_NAME" => $eventName,
|
||||
"EVN_TYPE" => $eventType,
|
||||
"EVN_MARKER" => "EMPTY",
|
||||
"BOU_X" => $eventBouX,
|
||||
"BOU_Y" => $eventBouY,
|
||||
"BOU_WIDTH" => $eventBouWidth,
|
||||
"BOU_HEIGHT" => $eventBouHeight
|
||||
);
|
||||
|
||||
$eventUid = $this->bp->addEvent($arrayData);
|
||||
|
||||
//Flow
|
||||
if ($objectBpmnType == "bpmnGateway" && $eventType == "END") {
|
||||
//Gateway
|
||||
$flowX1 = $objectBouX + $objectBouWidth;
|
||||
$flowY1 = $objectBouY + (int)($objectBouHeight / 2);
|
||||
$flowX2 = $eventBouX;
|
||||
$flowY2 = $eventBouY + $eventBouHeight2;
|
||||
} else {
|
||||
//Activity
|
||||
$flowX1 = $objectBouX + $objectBouWidth2;
|
||||
$flowY1 = ($eventType == "START")? $objectBouY - $eventBouHeight + $eventBouHeight2 : $objectBouY + $objectBouHeight;
|
||||
$flowX2 = $flowX1;
|
||||
$flowY2 = ($eventType == "START")? $objectBouY : $objectBouY + $objectBouHeight + $eventBouHeight2 + $eventBouHeight12;
|
||||
}
|
||||
|
||||
$arrayData = array(
|
||||
"FLO_TYPE" => "SEQUENCE",
|
||||
"FLO_ELEMENT_ORIGIN" => ($eventType == "START")? $eventUid : $objectUid,
|
||||
"FLO_ELEMENT_ORIGIN_TYPE" => ($eventType == "START")? "bpmnEvent" : $objectBpmnType,
|
||||
"FLO_ELEMENT_DEST" => ($eventType == "START")? $objectUid : $eventUid,
|
||||
"FLO_ELEMENT_DEST_TYPE" => ($eventType == "START")? $objectBpmnType : "bpmnEvent",
|
||||
"FLO_IS_INMEDIATE" => 1,
|
||||
"FLO_CONDITION" => $condition,
|
||||
"FLO_X1" => $flowX1,
|
||||
"FLO_Y1" => $flowY1,
|
||||
"FLO_X2" => $flowX2,
|
||||
"FLO_Y2" => $flowY2,
|
||||
"FLO_STATE" => json_encode(
|
||||
array(
|
||||
array("x" => $flowX1, "y" => $flowY1),
|
||||
array("x" => $flowX1, "y" => $flowY2 - 5),
|
||||
array("x" => $flowX2, "y" => $flowY2 - 5),
|
||||
array("x" => $flowX2, "y" => $flowY2)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$flowUid = $this->bp->addFlow($arrayData);
|
||||
|
||||
//Return
|
||||
return $eventUid;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addTask(array $arrayTaskData)
|
||||
{
|
||||
try {
|
||||
//Task
|
||||
$taskUid = parent::addTask($arrayTaskData);
|
||||
|
||||
//BPMN
|
||||
//Activity
|
||||
$arrayActivityType = array(
|
||||
"NORMAL" => "TASK",
|
||||
"ADHOC" => "TASK",
|
||||
"SUBPROCESS" => "SUB_PROCESS"
|
||||
);
|
||||
|
||||
$activityBouX = (int)($arrayTaskData["TAS_POSX"]);
|
||||
$activityBouY = (int)($arrayTaskData["TAS_POSY"]);
|
||||
$activityBouWidth = (int)($arrayTaskData["TAS_WIDTH"]);
|
||||
$activityBouHeight = (int)($arrayTaskData["TAS_HEIGHT"]);
|
||||
|
||||
$arrayData = array(
|
||||
"ACT_UID" => $taskUid,
|
||||
"ACT_NAME" => $arrayTaskData["TAS_TITLE"],
|
||||
"ACT_TYPE" => $arrayActivityType[$arrayTaskData["TAS_TYPE"]],
|
||||
"BOU_X" => $activityBouX,
|
||||
"BOU_Y" => $activityBouY,
|
||||
"BOU_WIDTH" => $activityBouWidth,
|
||||
"BOU_HEIGHT" => $activityBouHeight
|
||||
);
|
||||
|
||||
$activityUid = $this->bp->addActivity($arrayData);
|
||||
|
||||
if ($arrayTaskData["TAS_START"] == "TRUE") {
|
||||
$eventUid = $this->startTaskEndProcessToBpmnEvent(
|
||||
"bpmnActivity",
|
||||
$activityUid,
|
||||
$activityBouX,
|
||||
$activityBouY,
|
||||
$activityBouWidth,
|
||||
$activityBouHeight,
|
||||
"",
|
||||
"START"
|
||||
);
|
||||
}
|
||||
|
||||
//Return
|
||||
return $taskUid;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function routeToBpmnGateway(
|
||||
$objectBpmnType,
|
||||
$objectUid,
|
||||
$objectBouX,
|
||||
$objectBouY,
|
||||
$objectBouWidth,
|
||||
$objectBouHeight,
|
||||
$gatewayName,
|
||||
$gatewayType,
|
||||
$gatewayDirection
|
||||
) {
|
||||
try {
|
||||
$gatewayBouWidth = 45;
|
||||
$gatewayBouHeight = $gatewayBouWidth;
|
||||
|
||||
$gatewayBouWidth2 = (int)($gatewayBouWidth / 2);
|
||||
$gatewayBouHeight2 = (int)($gatewayBouHeight / 2);
|
||||
|
||||
//
|
||||
$objectBouWidth2 = (int)($objectBouWidth / 2);
|
||||
$objectBouHeight2 = (int)($objectBouHeight / 2);
|
||||
|
||||
//Gateway
|
||||
$gatewayBouX = $objectBouX + $objectBouWidth2 - $gatewayBouWidth2;
|
||||
$gatewayBouY = ($gatewayDirection == "DIVERGING")? $objectBouY + $objectBouHeight + $gatewayBouHeight2 : $objectBouY - $gatewayBouHeight - $gatewayBouHeight2;
|
||||
|
||||
$arrayData = array(
|
||||
"GAT_NAME" => $gatewayName,
|
||||
"GAT_TYPE" => $gatewayType,
|
||||
"GAT_DIRECTION" => $gatewayDirection,
|
||||
"GAT_DEFAULT_FLOW" => "0",
|
||||
"BOU_X" => $gatewayBouX,
|
||||
"BOU_Y" => $gatewayBouY,
|
||||
"BOU_WIDTH" => $gatewayBouWidth,
|
||||
"BOU_HEIGHT" => $gatewayBouHeight
|
||||
);
|
||||
|
||||
$gatewayUid = $this->bp->addGateway($arrayData);
|
||||
|
||||
//Flow
|
||||
if ($gatewayDirection == "DIVERGING") {
|
||||
$flowX1 = $objectBouX + $objectBouWidth2;
|
||||
$flowY1 = $objectBouY + $objectBouHeight;
|
||||
$flowX2 = $flowX1;
|
||||
$flowY2 = $gatewayBouY;
|
||||
} else {
|
||||
$flowX1 = $objectBouX + $objectBouWidth2;
|
||||
$flowY1 = $gatewayBouY + $gatewayBouHeight;
|
||||
$flowX2 = $flowX1;
|
||||
$flowY2 = $objectBouY;
|
||||
}
|
||||
|
||||
$arrayData = array(
|
||||
"FLO_TYPE" => "SEQUENCE",
|
||||
"FLO_ELEMENT_ORIGIN" => ($gatewayDirection == "DIVERGING")? $objectUid : $gatewayUid,
|
||||
"FLO_ELEMENT_ORIGIN_TYPE" => ($gatewayDirection == "DIVERGING")? $objectBpmnType : "bpmnGateway",
|
||||
"FLO_ELEMENT_DEST" => ($gatewayDirection == "DIVERGING")? $gatewayUid : $objectUid,
|
||||
"FLO_ELEMENT_DEST_TYPE" => ($gatewayDirection == "DIVERGING")? "bpmnGateway" : $objectBpmnType,
|
||||
"FLO_IS_INMEDIATE" => 1,
|
||||
"FLO_CONDITION" => "",
|
||||
"FLO_X1" => $flowX1,
|
||||
"FLO_Y1" => $flowY1,
|
||||
"FLO_X2" => $flowX2,
|
||||
"FLO_Y2" => $flowY2,
|
||||
"FLO_STATE" => json_encode(
|
||||
array(
|
||||
array("x" => $flowX1, "y" => $flowY1),
|
||||
array("x" => $flowX1, "y" => $flowY2 - 5),
|
||||
array("x" => $flowX2, "y" => $flowY2 - 5),
|
||||
array("x" => $flowX2, "y" => $flowY2)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$flowUid = $this->bp->addFlow($arrayData);
|
||||
|
||||
//Return
|
||||
return $gatewayUid;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function routeToBpmnFlow(
|
||||
$objectOriginBpmnType,
|
||||
$objectOriginUid,
|
||||
$objectOriginBouX,
|
||||
$objectOriginBouY,
|
||||
$objectOriginBouWidth,
|
||||
$objectOriginBouHeight,
|
||||
$objectDestBpmnType,
|
||||
$objectDestUid,
|
||||
$objectDestBouX,
|
||||
$objectDestBouY,
|
||||
$objectDestBouWidth,
|
||||
$objectDestBouHeight,
|
||||
$condition = ""
|
||||
) {
|
||||
try {
|
||||
$objectOriginBouWidth2 = (int)($objectOriginBouWidth / 2);
|
||||
$objectDestBouWidth2 = (int)($objectDestBouWidth / 2);
|
||||
|
||||
$flowX1 = $objectOriginBouX + $objectOriginBouWidth2;
|
||||
$flowY1 = $objectOriginBouY + $objectOriginBouHeight;
|
||||
$flowX2 = $objectDestBouX + $objectDestBouWidth2;
|
||||
$flowY2 = $objectDestBouY;
|
||||
|
||||
//Flow
|
||||
$arrayData = array(
|
||||
"FLO_TYPE" => "SEQUENCE",
|
||||
"FLO_ELEMENT_ORIGIN" => $objectOriginUid,
|
||||
"FLO_ELEMENT_ORIGIN_TYPE" => $objectOriginBpmnType,
|
||||
"FLO_ELEMENT_DEST" => $objectDestUid,
|
||||
"FLO_ELEMENT_DEST_TYPE" => $objectDestBpmnType,
|
||||
"FLO_IS_INMEDIATE" => 1,
|
||||
"FLO_CONDITION" => $condition,
|
||||
"FLO_X1" => $flowX1,
|
||||
"FLO_Y1" => $flowY1,
|
||||
"FLO_X2" => $flowX2,
|
||||
"FLO_Y2" => $flowY2,
|
||||
"FLO_STATE" => json_encode(array())
|
||||
);
|
||||
|
||||
$flowUid = $this->bp->addFlow($arrayData);
|
||||
|
||||
//Return
|
||||
return $flowUid;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addRouteSecJoin($taskUid, $nextTaskUid)
|
||||
{
|
||||
try {
|
||||
//Route
|
||||
$result = parent::addRoute($taskUid, $nextTaskUid, "SEC-JOIN");
|
||||
|
||||
//BPMN
|
||||
$arrayTaskData = $this->getTask($taskUid);
|
||||
|
||||
$activityUid = $arrayTaskData["TAS_UID"];
|
||||
$activityBouX = (int)($arrayTaskData["TAS_POSX"]);
|
||||
$activityBouY = (int)($arrayTaskData["TAS_POSY"]);
|
||||
$activityBouWidth = (int)($arrayTaskData["TAS_WIDTH"]);
|
||||
$activityBouHeight = (int)($arrayTaskData["TAS_HEIGHT"]);
|
||||
|
||||
$arrayTaskData = $this->getTask($nextTaskUid);
|
||||
|
||||
$nextActivityUid = $arrayTaskData["TAS_UID"];
|
||||
$nextActivityBouX = (int)($arrayTaskData["TAS_POSX"]);
|
||||
$nextActivityBouY = (int)($arrayTaskData["TAS_POSY"]);
|
||||
$nextActivityBouWidth = (int)($arrayTaskData["TAS_WIDTH"]);
|
||||
$nextActivityBouHeight = (int)($arrayTaskData["TAS_HEIGHT"]);
|
||||
|
||||
$result = $this->bp->getGatewayByDirectionActivityAndFlow("CONVERGING", $nextActivityUid);
|
||||
|
||||
if (!is_array($result)) {
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN . " AS GAT_UID");
|
||||
|
||||
$criteria->add(\BpmnFlowPeer::PRJ_UID, $this->bp->getUid(), \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_TYPE, "SEQUENCE", \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE, "bpmnGateway", \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_ELEMENT_DEST, $activityUid, \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE, "bpmnActivity", \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \BpmnFlowPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$gatewayParentUid = "";
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$gatewayParentUid = $row["GAT_UID"];
|
||||
} else {
|
||||
throw new \Exception(\G::LoadTranslation("ID_ROUTE_PARENT_DOES_NOT_EXIST_FOR_ROUTE_SECJOIN"));
|
||||
}
|
||||
|
||||
$arrayGatewayData = $this->bp->getGateway2($gatewayParentUid);
|
||||
|
||||
$gatewayParentType = $arrayGatewayData["GAT_TYPE"];
|
||||
|
||||
$gatewayUid = $this->routeToBpmnGateway(
|
||||
"bpmnActivity",
|
||||
$nextActivityUid,
|
||||
$nextActivityBouX,
|
||||
$nextActivityBouY,
|
||||
$nextActivityBouWidth,
|
||||
$nextActivityBouHeight,
|
||||
"",
|
||||
$gatewayParentType,
|
||||
"CONVERGING"
|
||||
);
|
||||
|
||||
$arrayGatewayData = $this->bp->getGateway2($gatewayUid);
|
||||
} else {
|
||||
$arrayGatewayData = $result;
|
||||
}
|
||||
|
||||
$gatewayUid = $arrayGatewayData["GAT_UID"];
|
||||
$gatewayType = $arrayGatewayData["GAT_TYPE"];
|
||||
$gatewayBouX = $arrayGatewayData["BOU_X"];
|
||||
$gatewayBouY = $arrayGatewayData["BOU_Y"];
|
||||
$gatewayBouWidth = $arrayGatewayData["BOU_WIDTH"];
|
||||
$gatewayBouHeight = $arrayGatewayData["BOU_HEIGHT"];
|
||||
|
||||
$flowUid = $this->routeToBpmnFlow(
|
||||
"bpmnActivity",
|
||||
$activityUid,
|
||||
$activityBouX,
|
||||
$activityBouY,
|
||||
$activityBouWidth,
|
||||
$activityBouHeight,
|
||||
"bpmnGateway",
|
||||
$gatewayUid,
|
||||
$gatewayBouX,
|
||||
$gatewayBouY,
|
||||
$gatewayBouWidth,
|
||||
$gatewayBouHeight
|
||||
);
|
||||
|
||||
//Return
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
$this->removeRouteFromTo($taskUid, $nextTaskUid);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addRoute($taskUid, $nextTaskUid, $type, $condition = "")
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
if ($type == "SEC-JOIN") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_ROUTE_IS_SECJOIN"));
|
||||
}
|
||||
|
||||
//Route
|
||||
$result = parent::addRoute($taskUid, $nextTaskUid, $type, $condition);
|
||||
|
||||
//BPMN
|
||||
$arrayBpmnGatewayType = array(
|
||||
"EVALUATE" => "EXCLUSIVE",
|
||||
"SELECT" => "COMPLEX",
|
||||
"PARALLEL" => "PARALLEL",
|
||||
"PARALLEL-BY-EVALUATION" => "INCLUSIVE"
|
||||
);
|
||||
|
||||
$arrayTaskData = $this->getTask($taskUid);
|
||||
|
||||
$activityUid = $arrayTaskData["TAS_UID"];
|
||||
$activityBouX = (int)($arrayTaskData["TAS_POSX"]);
|
||||
$activityBouY = (int)($arrayTaskData["TAS_POSY"]);
|
||||
$activityBouWidth = (int)($arrayTaskData["TAS_WIDTH"]);
|
||||
$activityBouHeight = (int)($arrayTaskData["TAS_HEIGHT"]);
|
||||
|
||||
switch ($type) {
|
||||
case "EVALUATE":
|
||||
case "SELECT":
|
||||
case "PARALLEL":
|
||||
case "PARALLEL-BY-EVALUATION":
|
||||
$result = $this->bp->getGatewayByDirectionActivityAndFlow("DIVERGING", $activityUid);
|
||||
|
||||
if (!is_array($result)) {
|
||||
$gatewayUid = $this->routeToBpmnGateway(
|
||||
"bpmnActivity",
|
||||
$activityUid,
|
||||
$activityBouX,
|
||||
$activityBouY,
|
||||
$activityBouWidth,
|
||||
$activityBouHeight,
|
||||
"",
|
||||
$arrayBpmnGatewayType[$type],
|
||||
"DIVERGING"
|
||||
);
|
||||
|
||||
$arrayGatewayData = $this->bp->getGateway2($gatewayUid);
|
||||
} else {
|
||||
$arrayGatewayData = $result;
|
||||
}
|
||||
|
||||
$gatewayUid = $arrayGatewayData["GAT_UID"];
|
||||
$gatewayType = $arrayGatewayData["GAT_TYPE"];
|
||||
$gatewayBouX = $arrayGatewayData["BOU_X"];
|
||||
$gatewayBouY = $arrayGatewayData["BOU_Y"];
|
||||
$gatewayBouWidth = $arrayGatewayData["BOU_WIDTH"];
|
||||
$gatewayBouHeight = $arrayGatewayData["BOU_HEIGHT"];
|
||||
|
||||
if ($nextTaskUid != "-1") {
|
||||
$arrayTaskData = $this->getTask($nextTaskUid);
|
||||
|
||||
$flowUid = $this->routeToBpmnFlow(
|
||||
"bpmnGateway",
|
||||
$gatewayUid,
|
||||
$gatewayBouX,
|
||||
$gatewayBouY,
|
||||
$gatewayBouWidth,
|
||||
$gatewayBouHeight,
|
||||
"bpmnActivity",
|
||||
$arrayTaskData["TAS_UID"],
|
||||
(int)($arrayTaskData["TAS_POSX"]),
|
||||
(int)($arrayTaskData["TAS_POSY"]),
|
||||
(int)($arrayTaskData["TAS_WIDTH"]),
|
||||
(int)($arrayTaskData["TAS_HEIGHT"]),
|
||||
$condition
|
||||
);
|
||||
} else {
|
||||
$eventUid = $this->startTaskEndProcessToBpmnEvent(
|
||||
"bpmnGateway",
|
||||
$gatewayUid,
|
||||
$gatewayBouX,
|
||||
$gatewayBouY,
|
||||
$gatewayBouWidth,
|
||||
$gatewayBouHeight,
|
||||
"",
|
||||
"END",
|
||||
$condition
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "SEQUENTIAL":
|
||||
if ($nextTaskUid != "-1") {
|
||||
$arrayTaskData = $this->getTask($nextTaskUid);
|
||||
|
||||
$flowUid = $this->routeToBpmnFlow(
|
||||
"bpmnActivity",
|
||||
$activityUid,
|
||||
$activityBouX,
|
||||
$activityBouY,
|
||||
$activityBouWidth,
|
||||
$activityBouHeight,
|
||||
"bpmnActivity",
|
||||
$arrayTaskData["TAS_UID"],
|
||||
(int)($arrayTaskData["TAS_POSX"]),
|
||||
(int)($arrayTaskData["TAS_POSY"]),
|
||||
(int)($arrayTaskData["TAS_WIDTH"]),
|
||||
(int)($arrayTaskData["TAS_HEIGHT"])
|
||||
);
|
||||
} else {
|
||||
$eventUid = $this->startTaskEndProcessToBpmnEvent(
|
||||
"bpmnActivity",
|
||||
$activityUid,
|
||||
$activityBouX,
|
||||
$activityBouY,
|
||||
$activityBouWidth,
|
||||
$activityBouHeight,
|
||||
"",
|
||||
"END"
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Return
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addLine($position, $direction = "HORIZONTAL")
|
||||
{
|
||||
try {
|
||||
//Line
|
||||
$swiUid = parent::addLine($position, $direction);
|
||||
|
||||
//BPMN
|
||||
//Artifact
|
||||
$arrayData = array(
|
||||
"ART_UID" => $swiUid,
|
||||
"ART_TYPE" => ($direction == "HORIZONTAL")? "HORIZONTAL_LINE" : "VERTICAL_LINE",
|
||||
"ART_NAME" => "",
|
||||
"BOU_X" => ($direction == "HORIZONTAL")? -6666 : $position,
|
||||
"BOU_Y" => ($direction == "HORIZONTAL")? $position : -6666,
|
||||
"BOU_WIDTH" => 0,
|
||||
"BOU_HEIGHT" => 0
|
||||
);
|
||||
|
||||
$artifactUid = $this->bp->addArtifact($arrayData);
|
||||
|
||||
//Return
|
||||
return $swiUid;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addText($text, $x, $y)
|
||||
{
|
||||
try {
|
||||
//Line
|
||||
$swiUid = parent::addText($text, $x, $y);
|
||||
|
||||
//BPMN
|
||||
//Artifact
|
||||
$arrayData = array(
|
||||
"ART_UID" => $swiUid,
|
||||
"ART_TYPE" => "TEXT_ANNOTATION",
|
||||
"ART_NAME" => $text,
|
||||
"BOU_X" => $x,
|
||||
"BOU_Y" => $y,
|
||||
"BOU_WIDTH" => 100,
|
||||
"BOU_HEIGHT" => 30
|
||||
);
|
||||
|
||||
$artifactUid = $this->bp->addArtifact($arrayData);
|
||||
|
||||
//Return
|
||||
return $swiUid;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function generateBpmn($processUid, $processUidFieldNameForException, $userUid = "")
|
||||
{
|
||||
$bpmnProjectUid = "";
|
||||
|
||||
try {
|
||||
//Verify data
|
||||
$obj = \ProcessPeer::retrieveByPK($processUid);
|
||||
|
||||
if (is_null($obj)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_PROCESS_DOES_NOT_EXIST", array($processUidFieldNameForException, $processUid)));
|
||||
}
|
||||
|
||||
//Verify data
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\BpmnProjectPeer::PRJ_UID);
|
||||
$criteria->add(\BpmnProjectPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \BpmnProjectPeer::doSelectRS($criteria);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_PROJECT_IS_BPMN", array($processUidFieldNameForException, $processUid)));
|
||||
}
|
||||
|
||||
//Set data
|
||||
$processUidBk = $processUid;
|
||||
|
||||
list($arrayWorkflowData, $arrayWorkflowFile) = $this->getData($processUid); //Get workflow data
|
||||
|
||||
$arrayWorkflowData["process"] = $arrayWorkflowData["process"][0];
|
||||
|
||||
$arrayWorkflowData["groupwfs"] = array();
|
||||
|
||||
//Create WorkflowBpmn
|
||||
$arrayUid = array();
|
||||
$arrayUid2 = array();
|
||||
|
||||
//Process
|
||||
$arrayProcessData = $arrayWorkflowData["process"];
|
||||
|
||||
unset(
|
||||
$arrayProcessData["PRO_UID"],
|
||||
$arrayProcessData["PRO_UPDATE_DATE"]
|
||||
);
|
||||
|
||||
$arrayProcessData["PRO_PARENT"] = $processUidBk;
|
||||
$arrayProcessData["PRO_TITLE"] = $arrayProcessData["PRO_TITLE"] . " - New version - " . date("M d, H:i:s");
|
||||
$arrayProcessData["PRO_CREATE_USER"] = ($userUid != "")? $userUid : "00000000000000000000000000000001";
|
||||
|
||||
$this->create($arrayProcessData);
|
||||
|
||||
$processUid = $this->getUid();
|
||||
|
||||
$bpmnProjectUid = $processUid;
|
||||
|
||||
//Task
|
||||
foreach ($arrayWorkflowData["tasks"] as $value) {
|
||||
$arrayTaskData = $value;
|
||||
|
||||
$taskUidOld = $arrayTaskData["TAS_UID"];
|
||||
|
||||
//Add
|
||||
unset($arrayTaskData["TAS_UID"]);
|
||||
|
||||
$taskUid = $this->addTask($arrayTaskData);
|
||||
|
||||
//Add new UID
|
||||
$arrayUid["task"][$taskUidOld] = $taskUid;
|
||||
|
||||
$arrayUid2[] = array(
|
||||
"old_uid" => $taskUidOld,
|
||||
"new_uid" => $taskUid
|
||||
);
|
||||
}
|
||||
|
||||
//$arrayWorkflowData["tasks"] = array();
|
||||
|
||||
//Route
|
||||
$arrayRouteSecJoin = array();
|
||||
|
||||
foreach ($arrayWorkflowData["routes"] as $value) {
|
||||
$arrayRouteData = $value;
|
||||
|
||||
$arrayRouteData["TAS_UID"] = $arrayUid["task"][$arrayRouteData["TAS_UID"]];
|
||||
$arrayRouteData["ROU_NEXT_TASK"] = ($arrayRouteData["ROU_NEXT_TASK"] != "-1")? $arrayUid["task"][$arrayRouteData["ROU_NEXT_TASK"]] : $arrayRouteData["ROU_NEXT_TASK"];
|
||||
|
||||
if ($arrayRouteData["ROU_TYPE"] != "SEC-JOIN") {
|
||||
//Add
|
||||
$result = $this->addRoute($arrayRouteData["TAS_UID"], $arrayRouteData["ROU_NEXT_TASK"], $arrayRouteData["ROU_TYPE"], $arrayRouteData["ROU_CONDITION"]);
|
||||
} else {
|
||||
$arrayRouteSecJoin[] = $arrayRouteData;
|
||||
}
|
||||
}
|
||||
|
||||
$arrayWorkflowData["routes"] = array();
|
||||
|
||||
//Route SEC-JOIN
|
||||
foreach ($arrayRouteSecJoin as $value) {
|
||||
$arrayRouteData = $value;
|
||||
|
||||
$result = $this->addRouteSecJoin($arrayRouteData["TAS_UID"], $arrayRouteData["ROU_NEXT_TASK"]);
|
||||
}
|
||||
|
||||
//Lane
|
||||
foreach ($arrayWorkflowData["lanes"] as $value) {
|
||||
$arrayLaneData = $value;
|
||||
|
||||
$swiX = (int)($arrayLaneData["SWI_X"]);
|
||||
$swiY = (int)($arrayLaneData["SWI_Y"]);
|
||||
|
||||
switch ($arrayLaneData["SWI_TYPE"]) {
|
||||
case "TEXT":
|
||||
$swiUid = $this->addText($arrayLaneData["SWI_TEXT"], $swiX, $swiY);
|
||||
break;
|
||||
case "LINE":
|
||||
$direction = (($swiX == 0)? "HORIZONTAL" : "VERTICAL");
|
||||
|
||||
$swiUid = $this->addLine(($direction == "HORIZONTAL")? $swiY : $swiX, $direction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$arrayWorkflowData["lanes"] = array();
|
||||
|
||||
//Data
|
||||
$arrayUid2 = array_merge(
|
||||
array(
|
||||
array(
|
||||
"old_uid" => $processUidBk,
|
||||
"new_uid" => $processUid
|
||||
)
|
||||
),
|
||||
$arrayUid2
|
||||
);
|
||||
|
||||
list($arrayWorkflowData, $arrayWorkflowFile) = $this->updateDataUidByArrayUid($arrayWorkflowData, $arrayWorkflowFile, $arrayUid2);
|
||||
|
||||
$arrayWorkflowData["tasks"] = array();
|
||||
|
||||
$this->createDataByArrayData($arrayWorkflowData);
|
||||
$this->createDataFileByArrayFile($arrayWorkflowFile);
|
||||
|
||||
//Return
|
||||
return $bpmnProjectUid;
|
||||
} catch (\Exception $e) {
|
||||
if ($bpmnProjectUid != "") {
|
||||
$this->remove();
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ use \BpmnParticipant as Participant;
|
||||
use \BpmnParticipantPeer as ParticipantPeer;
|
||||
|
||||
use \BasePeer;
|
||||
use \Criteria as Criteria;
|
||||
use \ResultSet as ResultSet;
|
||||
|
||||
use ProcessMaker\Util\Common;
|
||||
use ProcessMaker\Exception;
|
||||
@@ -557,6 +559,31 @@ class Bpmn extends Handler
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
public function getGateway2($gatewayUid)
|
||||
{
|
||||
try {
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(GatewayPeer::TABLE_NAME . ".*");
|
||||
$criteria->addSelectColumn(BoundPeer::TABLE_NAME . ".*");
|
||||
$criteria->addJoin(GatewayPeer::GAT_UID, BoundPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->add(GatewayPeer::GAT_UID, $gatewayUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = GatewayPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
//Return
|
||||
return $rsCriteria->getRow();
|
||||
}
|
||||
|
||||
//Return
|
||||
return false;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function getGateways($start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
if (is_array($start)) {
|
||||
@@ -724,7 +751,11 @@ class Bpmn extends Handler
|
||||
public function addArtifact($data)
|
||||
{
|
||||
// setting defaults
|
||||
$processUid = $this->getProcess("object")->getProUid();
|
||||
|
||||
$data['ART_UID'] = array_key_exists('ART_UID', $data) ? $data['ART_UID'] : Common::generateUID();
|
||||
$data["PRO_UID"] = $processUid;
|
||||
|
||||
try {
|
||||
self::log("Add Artifact with data: ", $data);
|
||||
$artifact = new Artifact();
|
||||
@@ -805,7 +836,11 @@ class Bpmn extends Handler
|
||||
public function addData($data)
|
||||
{
|
||||
// setting defaults
|
||||
$processUid = $this->getProcess("object")->getProUid();
|
||||
|
||||
$data['DATA_UID'] = array_key_exists('DAT_UID', $data) ? $data['DAT_UID'] : Common::generateUID();
|
||||
$data["PRO_UID"] = $processUid;
|
||||
|
||||
try {
|
||||
self::log("Add BpmnData with data: ", $data);
|
||||
$bpmnData = new \BpmnData();
|
||||
@@ -886,7 +921,11 @@ class Bpmn extends Handler
|
||||
public function addParticipant($data)
|
||||
{
|
||||
// setting defaults
|
||||
$processUid = $this->getProcess("object")->getProUid();
|
||||
|
||||
$data['PAR_UID'] = array_key_exists('PAR_UID', $data) ? $data['PAR_UID'] : Common::generateUID();
|
||||
$data["PRO_UID"] = $processUid;
|
||||
|
||||
try {
|
||||
self::log("Add Participant with data: ", $data);
|
||||
$participant = new Participant();
|
||||
@@ -1017,5 +1056,46 @@ class Bpmn extends Handler
|
||||
$status = $value ? "DISABLED" : "ACTIVE";
|
||||
$this->update(array("PRJ_STATUS" => $status));
|
||||
}
|
||||
|
||||
public function getGatewayByDirectionActivityAndFlow($gatewayDirection, $activityUid)
|
||||
{
|
||||
try {
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
if ($gatewayDirection == "DIVERGING") {
|
||||
$criteria->addSelectColumn(FlowPeer::FLO_ELEMENT_DEST . " AS GAT_UID");
|
||||
|
||||
$criteria->add(FlowPeer::FLO_ELEMENT_ORIGIN, $activityUid, Criteria::EQUAL);
|
||||
$criteria->add(FlowPeer::FLO_ELEMENT_ORIGIN_TYPE, "bpmnActivity", Criteria::EQUAL);
|
||||
$criteria->add(FlowPeer::FLO_ELEMENT_DEST_TYPE, "bpmnGateway", Criteria::EQUAL);
|
||||
} else {
|
||||
//CONVERGING
|
||||
$criteria->addSelectColumn(FlowPeer::FLO_ELEMENT_ORIGIN . " AS GAT_UID");
|
||||
|
||||
$criteria->add(FlowPeer::FLO_ELEMENT_ORIGIN_TYPE, "bpmnGateway", Criteria::EQUAL);
|
||||
$criteria->add(FlowPeer::FLO_ELEMENT_DEST, $activityUid, Criteria::EQUAL);
|
||||
$criteria->add(FlowPeer::FLO_ELEMENT_DEST_TYPE, "bpmnActivity", Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$criteria->add(FlowPeer::PRJ_UID, $this->prjUid, Criteria::EQUAL);
|
||||
$criteria->add(FlowPeer::FLO_TYPE, "SEQUENCE", Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = FlowPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$gatewayUid = "";
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$gatewayUid = $row["GAT_UID"];
|
||||
}
|
||||
|
||||
//Return
|
||||
return $this->getGateway2($gatewayUid);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -911,5 +911,253 @@ class Workflow extends Handler
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function addLine($position, $direction = "HORIZONTAL")
|
||||
{
|
||||
try {
|
||||
self::log("Add Line with data: position $position, direction $direction");
|
||||
|
||||
$swimlaneElement = new \SwimlanesElements();
|
||||
|
||||
$swiUid = $swimlaneElement->create(array(
|
||||
"PRO_UID" => $this->proUid,
|
||||
"SWI_TYPE" => "LINE",
|
||||
"SWI_X" => ($direction == "HORIZONTAL")? 0 : $position,
|
||||
"SWI_Y" => ($direction == "HORIZONTAL")? $position : 0
|
||||
));
|
||||
|
||||
self::log("Add Line Success!");
|
||||
|
||||
//Return
|
||||
return $swiUid;
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addText($text, $x, $y)
|
||||
{
|
||||
try {
|
||||
self::log("Add Text with data: text \"$text\"");
|
||||
|
||||
$swimlaneElement = new \SwimlanesElements();
|
||||
|
||||
$swiUid = $swimlaneElement->create(array(
|
||||
"PRO_UID" => $this->proUid,
|
||||
"SWI_TYPE" => "TEXT",
|
||||
"SWI_TEXT" => $text,
|
||||
"SWI_X" => $x,
|
||||
"SWI_Y" => $y
|
||||
));
|
||||
|
||||
self::log("Add Text Success!");
|
||||
|
||||
//Return
|
||||
return $swiUid;
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function createDataByArrayData(array $arrayData)
|
||||
{
|
||||
try {
|
||||
$processes = new \Processes();
|
||||
|
||||
$processes->createProcessPropertiesFromData((object)($arrayData));
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function createDataFileByArrayFile(array $arrayFile)
|
||||
{
|
||||
try {
|
||||
foreach ($arrayFile as $target => $files) {
|
||||
switch (strtoupper($target)) {
|
||||
case "DYNAFORMS":
|
||||
$basePath = PATH_DYNAFORM;
|
||||
break;
|
||||
case "PUBLIC":
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP;
|
||||
break;
|
||||
case "TEMPLATES":
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "mailTemplates" . PATH_SEP;
|
||||
break;
|
||||
default:
|
||||
$basePath = "";
|
||||
}
|
||||
|
||||
if (empty($basePath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
$filename = $basePath . ((isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
|
||||
$path = dirname($filename);
|
||||
|
||||
if (!is_dir($path)) {
|
||||
Util\Common::mk_dir($path, 0775);
|
||||
}
|
||||
|
||||
file_put_contents($filename, $file["file_content"]);
|
||||
chmod($filename, 0775);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function getData($processUid)
|
||||
{
|
||||
try {
|
||||
$process = new \Processes();
|
||||
|
||||
//Get data
|
||||
$workflowData = (array)($process->getWorkflowData($processUid));
|
||||
$workflowData["process"]["PRO_DYNAFORMS"] = (empty($workflowData["process"]["PRO_DYNAFORMS"]))? "" : serialize($workflowData["process"]["PRO_DYNAFORMS"]);
|
||||
|
||||
$workflowData["process"] = array($workflowData["process"]);
|
||||
$workflowData["processCategory"] = (empty($workflowData["processCategory"]))? array() : array($workflowData["processCategory"]);
|
||||
|
||||
//Get files
|
||||
$workflowFile = array();
|
||||
|
||||
//Getting DynaForms
|
||||
foreach ($workflowData["dynaforms"] as $dynaform) {
|
||||
$dynFile = PATH_DYNAFORM . $dynaform["DYN_FILENAME"] . ".xml";
|
||||
|
||||
$workflowFile["DYNAFORMS"][] = array(
|
||||
"filename" => $dynaform["DYN_TITLE"],
|
||||
"filepath" => $dynaform["DYN_FILENAME"] . ".xml",
|
||||
"file_content" => file_get_contents($dynFile)
|
||||
);
|
||||
|
||||
$htmlFile = PATH_DYNAFORM . $dynaform["DYN_FILENAME"] . ".html";
|
||||
|
||||
if (file_exists($htmlFile)) {
|
||||
$workflowFile["DYNAFORMS"][] = array(
|
||||
"filename" => $dynaform["DYN_FILENAME"] . ".html",
|
||||
"filepath" => $dynaform["DYN_FILENAME"] . ".html",
|
||||
"file_content" => file_get_contents($htmlFile)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//Getting templates files
|
||||
$workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public");
|
||||
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
|
||||
|
||||
foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) {
|
||||
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $processUid;
|
||||
$templatesFiles = Util\Common::rglob("$templatesDir/*", 0, true);
|
||||
|
||||
foreach ($templatesFiles as $templatesFile) {
|
||||
if (is_dir($templatesFile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filename = basename($templatesFile);
|
||||
|
||||
$workflowFile[$target][] = array(
|
||||
"filename" => $filename,
|
||||
"filepath" => $processUid . PATH_SEP . $filename,
|
||||
"file_content" => file_get_contents($templatesFile)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//Return
|
||||
self::log("Getting Workflow data Success!");
|
||||
|
||||
return array($workflowData, $workflowFile);
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDataUidByArrayUid(array $arrayWorkflowData, array $arrayWorkflowFile, array $arrayUid)
|
||||
{
|
||||
try {
|
||||
$processUidOld = $arrayUid[0]["old_uid"];
|
||||
$processUid = $arrayUid[0]["new_uid"];
|
||||
|
||||
//Update TAS_UID
|
||||
foreach ($arrayWorkflowData["tasks"] as $key => $value) {
|
||||
$taskUid = $arrayWorkflowData["tasks"][$key]["TAS_UID"];
|
||||
|
||||
foreach ($arrayUid as $value2) {
|
||||
$arrayItem = $value2;
|
||||
|
||||
if ($arrayItem["old_uid"] == $taskUid) {
|
||||
$arrayWorkflowData["tasks"][$key]["TAS_UID_OLD"] = $taskUid;
|
||||
$arrayWorkflowData["tasks"][$key]["TAS_UID"] = $arrayItem["new_uid"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Workflow tables
|
||||
$workflowData = (object)($arrayWorkflowData);
|
||||
|
||||
$processes = new \Processes();
|
||||
$processes->setProcessGUID($workflowData, $processUid);
|
||||
$processes->renewAll($workflowData);
|
||||
|
||||
$arrayWorkflowData = (array)($workflowData);
|
||||
|
||||
//Workflow files
|
||||
foreach ($arrayWorkflowFile as $key => $value) {
|
||||
$arrayFile = $value;
|
||||
|
||||
foreach ($arrayFile as $key2 => $value2) {
|
||||
$file = $value2;
|
||||
|
||||
$arrayWorkflowFile[$key][$key2]["file_path"] = str_replace($processUidOld, $processUid, (isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
|
||||
$arrayWorkflowFile[$key][$key2]["file_content"] = str_replace($processUidOld, $processUid, $file["file_content"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayWorkflowData["uid"])) {
|
||||
foreach ($arrayWorkflowData["uid"] as $key => $value) {
|
||||
$arrayT = $value;
|
||||
|
||||
foreach ($arrayT as $key2 => $value2) {
|
||||
$uidOld = $key2;
|
||||
$uid = $value2;
|
||||
|
||||
foreach ($arrayWorkflowFile as $key3 => $value3) {
|
||||
$arrayFile = $value3;
|
||||
|
||||
foreach ($arrayFile as $key4 => $value4) {
|
||||
$file = $value4;
|
||||
|
||||
$arrayWorkflowFile[$key3][$key4]["file_path"] = str_replace($uidOld, $uid, $file["file_path"]);
|
||||
$arrayWorkflowFile[$key3][$key4]["file_content"] = str_replace($uidOld, $uid, $file["file_content"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Return
|
||||
return array($arrayWorkflowData, $arrayWorkflowFile);
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,6 +193,44 @@ class Project extends Api
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /generate-bpmn
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostGenerateBpmn(array $request_data)
|
||||
{
|
||||
try {
|
||||
//Set data
|
||||
$request_data = array_change_key_case($request_data, CASE_UPPER);
|
||||
|
||||
//Verify data
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition(
|
||||
$request_data,
|
||||
array("PRO_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "processUid")),
|
||||
array("processUid" => "pro_uid"),
|
||||
true
|
||||
);
|
||||
|
||||
//Generate BPMN
|
||||
$workflowBpmn = new \ProcessMaker\Project\Adapter\WorkflowBpmn();
|
||||
|
||||
$projectUid = $workflowBpmn->generateBpmn($request_data["PRO_UID"], "pro_uid", $this->getUserId());
|
||||
|
||||
$arrayData = array_change_key_case(array_merge(array("PRJ_UID" => $projectUid), $request_data), CASE_LOWER);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/dynaforms
|
||||
*
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel='stylesheet' type='text/css' href='/css/neoclassic-blank.css' />
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/build/css/PMDynaform.css">
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/jquery/jquery-1.11.js"></script>
|
||||
@@ -14,6 +13,7 @@
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/bootstrap-3.1.1/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/underscore/underscore-1.6.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/restclient/restclient.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
@@ -33,7 +33,14 @@
|
||||
<td width="100%" align="center">{CASE} #: {APP_NUMBER} {TITLE}: {APP_TITLE}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a style="float: left; margin: 10px 2px 2px 10px; cursor: pointer; opacity: 1;"><img src="/lib/img/pager-previous-icon.png" style="padding-right:5px;width:25px;height:20px;">Previous Step</a>
|
||||
<a style="float: right; margin: 10px 10px 2px 2px; cursor: pointer; opacity: 1;">Next step<img src="/lib/img/pager-next-icon.png" style="padding-left:5px;width:25px;height:20px;"></a>
|
||||
<div style="width:100%;padding: 0px 10px 0px 10px">
|
||||
<img src="/images/bulletButtonLeft.gif" style="float:left;">
|
||||
<a id="dyn_backward" href="" style="float:left;">
|
||||
</a>
|
||||
<img src="/images/bulletButton.gif" style="float:right;">
|
||||
<a id="dyn_forward" href="" style="float:right;font-size:12px;line-height:1;margin:0px 5px 1px 0px;">
|
||||
Next Step
|
||||
</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel='stylesheet' type='text/css' href='/css/neoclassic-blank.css' />
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/build/css/PMDynaform.css">
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/jquery/jquery-1.11.js"></script>
|
||||
@@ -14,12 +13,11 @@
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/bootstrap-3.1.1/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/underscore/underscore-1.6.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/restclient/restclient.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
###TEMPLATES###
|
||||
<script type="text/javascript" src="/lib/pmdynaform/build/js/PMDynaform.js"></script>
|
||||
<a style="float: left; margin: 10px 2px 2px 10px; cursor: pointer; opacity: 1;"><img src="/lib/img/pager-previous-icon.png" style="padding-right:5px;width:25px;height:20px;">Previous Step</a>
|
||||
<a style="float: right; margin: 10px 10px 2px 2px; cursor: pointer; opacity: 1;">Next step<img src="/lib/img/pager-next-icon.png" style="padding-left:5px;width:25px;height:20px;"></a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>PMDynaform</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/build/css/PMDynaform.css">
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/jquery/jquery-1.11.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/jquery/jquery.inputmask.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/bootstrap-3.1.1/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/underscore/underscore-1.6.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/restclient/restclient.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
###TEMPLATES###
|
||||
<script type="text/javascript" src="/lib/pmdynaform/build/js/PMDynaform.js"></script>
|
||||
<script type="text/javascript">
|
||||
var jsondata = '{JSON_DATA}';
|
||||
var pm_run_outside_main_app = '{PM_RUN_OUTSIDE_MAIN_APP}';
|
||||
var dyn_uid = '{DYN_UID}';
|
||||
var __DynaformName__ = '{DYNAFORMNAME}';
|
||||
var app_uid = '{APP_UID}';
|
||||
$(window).load(function () {
|
||||
var data = JSON.parse(jsondata);
|
||||
window.dynaform = new PMDynaform.core.Project({
|
||||
data: data
|
||||
});
|
||||
$(document).find('form').submit(function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -342,7 +342,7 @@ accessTokenSetup.application = {
|
||||
sm.selectRow(rowIndex, true);
|
||||
|
||||
var record = grdpnlMain.getSelectionModel().getSelected();
|
||||
console.log(record);
|
||||
|
||||
if (typeof(record) != "undefined") {
|
||||
Ext.MessageBox.confirm(
|
||||
_("ID_CONFIRM"),
|
||||
|
||||
@@ -394,11 +394,10 @@ Ext.onReady(function(){
|
||||
}
|
||||
|
||||
if (rowSelected.data.PROJECT_TYPE == "bpmn"){
|
||||
Ext.getCmp('edit_with_classic_editor').setDisabled(false);
|
||||
Ext.getCmp("mnuGenerateBpmn").setDisabled(true);
|
||||
} else {
|
||||
Ext.getCmp('edit_with_classic_editor').setDisabled(true);
|
||||
Ext.getCmp("mnuGenerateBpmn").setDisabled(false);
|
||||
}
|
||||
|
||||
}, this);
|
||||
processesGrid.on('contextmenu', function (evt) {
|
||||
evt.preventDefault();
|
||||
@@ -435,6 +434,15 @@ Ext.onReady(function(){
|
||||
handler: function () {
|
||||
exportProcess();
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "mnuGenerateBpmn",
|
||||
text: _("ID_GENERATE_BPMN_PROJECT"),
|
||||
iconCls: "button_menu_ext ss_sprite ss_page_white_go",
|
||||
handler: function ()
|
||||
{
|
||||
generateBpmn();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -584,7 +592,7 @@ editProcess = function(typeParam)
|
||||
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
||||
if (!rowSelected) {
|
||||
Ext.Msg.show({
|
||||
title: '',
|
||||
title: _("ID_INFORMATION"),
|
||||
msg: _('ID_NO_SELECTION_WARNING'),
|
||||
buttons: Ext.Msg.INFO,
|
||||
fn: function () {
|
||||
@@ -617,7 +625,7 @@ editNewProcess = function(){
|
||||
location.href = '../designer?pro_uid='+rowSelected.data.PRO_UID
|
||||
} else {
|
||||
Ext.Msg.show({
|
||||
title:'',
|
||||
title: _("ID_INFORMATION"),
|
||||
msg: _('ID_NO_SELECTION_WARNING'),
|
||||
buttons: Ext.Msg.INFO,
|
||||
fn: function(){},
|
||||
@@ -701,7 +709,7 @@ deleteProcess = function(){
|
||||
}
|
||||
} else {
|
||||
Ext.Msg.show({
|
||||
title:'',
|
||||
title: _("ID_INFORMATION"),
|
||||
msg: _('ID_NO_SELECTION_WARNING'),
|
||||
buttons: Ext.Msg.INFO,
|
||||
fn: function(){},
|
||||
@@ -743,7 +751,7 @@ function exportProcess() {
|
||||
}
|
||||
else {
|
||||
Ext.Msg.show({
|
||||
title: "",
|
||||
title: _("ID_INFORMATION"),
|
||||
msg: _("ID_NO_SELECTION_WARNING"),
|
||||
icon: Ext.MessageBox.INFO,
|
||||
buttons: Ext.MessageBox.OK
|
||||
@@ -751,6 +759,60 @@ function exportProcess() {
|
||||
}
|
||||
}
|
||||
|
||||
function generateBpmn()
|
||||
{
|
||||
var record = processesGrid.getSelectionModel().getSelections();
|
||||
|
||||
if (typeof(record) != "undefined") {
|
||||
if (record.length == 1) {
|
||||
var loadMaskGenerateBpmn = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_PROCESSING")});
|
||||
var processUid = record[0].get("PRO_UID");
|
||||
|
||||
loadMaskGenerateBpmn.show();
|
||||
|
||||
Ext.Ajax.request({
|
||||
url: "../processProxy/generateBpmn",
|
||||
method: "POST",
|
||||
params: {
|
||||
processUid: processUid
|
||||
},
|
||||
|
||||
success: function (response, opts)
|
||||
{
|
||||
var dataResponse = Ext.util.JSON.decode(response.responseText);
|
||||
|
||||
if (dataResponse.status) {
|
||||
if (dataResponse.status == "OK") {
|
||||
//processesGrid.store.reload();
|
||||
location.assign("../designer?prj_uid=" + dataResponse.projectUid);
|
||||
} else {
|
||||
Ext.MessageBox.show({
|
||||
title: _("ID_ERROR"),
|
||||
icon: Ext.MessageBox.ERROR,
|
||||
buttons: Ext.MessageBox.OK,
|
||||
msg: dataResponse.message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
loadMaskGenerateBpmn.hide();
|
||||
},
|
||||
failure: function (response, opts)
|
||||
{
|
||||
loadMaskGenerateBpmn.hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Ext.MessageBox.show({
|
||||
title: _("ID_INFORMATION"),
|
||||
icon: Ext.MessageBox.INFO,
|
||||
buttons: Ext.MessageBox.OK,
|
||||
msg: _("ID_NO_SELECTION_WARNING")
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
importProcessExistGroup = function()
|
||||
{
|
||||
|
||||
@@ -1191,7 +1253,7 @@ function activeDeactive(){
|
||||
});
|
||||
} else {
|
||||
Ext.Msg.show({
|
||||
title:'',
|
||||
title: _("ID_INFORMATION"),
|
||||
msg: _('ID_NO_SELECTION_WARNING'),
|
||||
buttons: Ext.Msg.INFO,
|
||||
fn: function(){},
|
||||
@@ -1227,7 +1289,7 @@ function enableDisableDebug()
|
||||
});
|
||||
} else {
|
||||
Ext.Msg.show({
|
||||
title:'',
|
||||
title: _("ID_INFORMATION"),
|
||||
msg: _('ID_NO_SELECTION_WARNING'),
|
||||
buttons: Ext.Msg.INFO,
|
||||
fn: function(){},
|
||||
|
||||
Reference in New Issue
Block a user