Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -35,8 +35,8 @@ if (! is_dir($vendorDir )) {
|
||||
}
|
||||
|
||||
$projects = array(
|
||||
'colosa/michelangelofe',
|
||||
'colosa/pmui'
|
||||
'colosa/MichelangeloFE',
|
||||
'colosa/pmUI'
|
||||
);
|
||||
|
||||
echo PHP_EOL;
|
||||
@@ -81,36 +81,31 @@ if (! is_dir($destinationDir.'/pmUI')) {
|
||||
|
||||
|
||||
$filesCollection = array(
|
||||
// Libs
|
||||
"jquery/jquery/jquery-1.10.2.min.js" => "js/jquery-1.10.2.min.js",
|
||||
"underscore/underscore/underscore-min.js" => "js/underscore-min.js",
|
||||
//libs
|
||||
/*"colosa/michelangelo-fe-libs/jQueryLayout/jquery.layout.min.js" => "js/jquery.layout.min.js",
|
||||
"colosa/michelangelo-fe-libs/jQueryUI/jquery-ui-1.10.3.custom.min.js" => "js/jquery-ui-1.10.3.custom.min.js",
|
||||
"colosa/michelangelo-fe-libs/jQueryUI/jquery-ui-1.10.3.custom.min.css" => "js/jquery-ui-1.10.3.custom.min.css",
|
||||
"colosa/michelangelo-fe-libs/wz_jsgraphics/wz_jsgraphics.js" => "js/wz_jsgraphics.js",*/
|
||||
|
||||
"colosa/pmui/libraries/restclient/restclient-min.js" => "js/restclient-min.js",
|
||||
"colosa/pmUI/libraries/restclient/restclient-min.js" => "js/restclient-min.js",
|
||||
|
||||
// michelangelofe
|
||||
"colosa/michelangelofe/lib/wz_jsgraphics/wz_jsgraphics.js" => "js/wz_jsgraphics.js",
|
||||
"colosa/michelangelofe/build/js/designer.js" => "mafe/designer.js",
|
||||
"colosa/michelangelofe/build/js/mafe.min.js" => "mafe/mafe.min.js",
|
||||
"colosa/michelangelofe/build/css/mafe.css" => "mafe/mafe.css",
|
||||
"colosa/michelangelofe/build/img/*" => "img/",
|
||||
// pmui
|
||||
"colosa/pmui/libraries/jquery.layout/LayoutPanel.css" => "css/jquery.layout.css",
|
||||
"colosa/pmui/libraries/jquery-ui/css/css-customized/jquery-ui-1.10.3.custom.css" => "css/jquery-ui-1.10.3.custom.min.css",
|
||||
"colosa/pmui/libraries/dataTables/css/jquery.dataTables.css" => "css/jquery.dataTables.css",
|
||||
"colosa/pmui/libraries/jquery.layout/jquery.layout.min.js" => "js/jquery.layout.min.js",
|
||||
"colosa/pmui/libraries/jquery-ui/js/jquery-ui-1.10.3.custom.min.js" => "js/jquery-ui-1.10.3.custom.min.js",
|
||||
"colosa/pmui/libraries/dataTables/js/jquery.dataTables.min.js" => "js/jquery.dataTables.min.js",
|
||||
// MichelangeloFE
|
||||
"colosa/MichelangeloFE/lib/wz_jsgraphics/wz_jsgraphics.js" => "js/wz_jsgraphics.js",
|
||||
"colosa/MichelangeloFE/build/js/designer.js" => "mafe/designer.js",
|
||||
"colosa/MichelangeloFE/build/js/mafe.min.js" => "mafe/mafe.min.js",
|
||||
"colosa/MichelangeloFE/build/css/mafe.css" => "mafe/mafe.css",
|
||||
"colosa/MichelangeloFE/build/img/*" => "img/",
|
||||
// pmUI
|
||||
"colosa/pmUI/libraries/jquery.layout/LayoutPanel.css" => "css/jquery.layout.css",
|
||||
"colosa/pmUI/libraries/jquery-ui/css/css-customized/jquery-ui-1.10.3.custom.css" => "css/jquery-ui-1.10.3.custom.min.css",
|
||||
"colosa/pmUI/libraries/dataTables/css/jquery.dataTables.css" => "css/jquery.dataTables.css",
|
||||
"colosa/pmUI/libraries/jquery.layout/jquery.layout.min.js" => "js/jquery.layout.min.js",
|
||||
"colosa/pmUI/libraries/jquery-ui/js/jquery-ui-1.10.3.custom.min.js" => "js/jquery-ui-1.10.3.custom.min.js",
|
||||
"colosa/pmUI/libraries/dataTables/js/jquery.dataTables.min.js" => "js/jquery.dataTables.min.js",
|
||||
|
||||
array(
|
||||
"try_files" => array("colosa/pmui/build/js/min/pmui-1.0.0.min.js", "colosa/pmui/build/js/pmui-1.0.0.js"),
|
||||
"to_file" => "pmUI/pmui-1.0.0.js"
|
||||
"try_files" => array("colosa/pmUI/build/js/min/pmUI-1.0.0.min.js", "colosa/pmUI/build/js/pmUI-1.0.0.js"),
|
||||
"to_file" => "pmUI/pmUI-1.0.0.js"
|
||||
),
|
||||
"colosa/pmui/build/css/pmui-1.0.0.css" => "pmUI/pmui-1.0.0.css",
|
||||
"colosa/pmui/build/img/*" => "img/",
|
||||
"colosa/pmUI/build/css/pmUI-1.0.0.css" => "pmUI/pmUI-1.0.0.css",
|
||||
"colosa/pmUI/build/img/*" => "img/",
|
||||
|
||||
);
|
||||
|
||||
|
||||
@@ -29,38 +29,22 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "colosa/pmui",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"url": "git@bitbucket.org:colosa/pmui.git",
|
||||
"type": "git",
|
||||
"reference": "origin/master"
|
||||
}
|
||||
}
|
||||
"type": "vcs",
|
||||
"url": "git@bitbucket.org:colosa/pmUI.git"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "colosa/michelangelofe",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"url": "git@bitbucket.org:colosa/michelangelofe.git",
|
||||
"type": "git",
|
||||
"reference": "origin/master"
|
||||
}
|
||||
}
|
||||
"type": "vcs",
|
||||
"url": "git@bitbucket.org:colosa/MichelangeloFE.git"
|
||||
}
|
||||
],
|
||||
|
||||
"require": {
|
||||
"luracast/restler" : "dev-master",
|
||||
"luracast/restler" : "v3.0.0",
|
||||
"bshaffer/oauth2-server-php": "v1.0",
|
||||
"jquery/jquery": "1.10.2",
|
||||
"colosa/pmui": "dev-master",
|
||||
"colosa/michelangelofe": "dev-master",
|
||||
"underscore/underscore": "1.5.2"
|
||||
"underscore/underscore": "1.5.2",
|
||||
"colosa/pmUI": "dev-master",
|
||||
"colosa/MichelangeloFE": "dev-master"
|
||||
},
|
||||
"require-dev":{
|
||||
"guzzle/guzzle":"~3.1.1",
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: DataBase Connections
|
||||
|
||||
Scenario: List all the database connections (result 0 database connections)
|
||||
Given that I have a valid access_token
|
||||
And I request "project/74737540052e1641ab88249082085472/database-connections"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 0 record
|
||||
|
||||
|
||||
Scenario: Create a new database connection
|
||||
Given that I have a valid access_token
|
||||
And POST this data:
|
||||
"""
|
||||
{
|
||||
"dbs_type": "mysql",
|
||||
"dbs_server": "192.168.11.71",
|
||||
"dbs_database_name": "rb_cochalo",
|
||||
"dbs_username": "root",
|
||||
"dbs_password": "atopml2005",
|
||||
"dbs_port": 3306,
|
||||
"dbs_encode": "utf8",
|
||||
"dbs_description": "conection correcta"
|
||||
}
|
||||
"""
|
||||
And I request "project/74737540052e1641ab88249082085472/database-connection"
|
||||
Then the response status code should be 201
|
||||
And store "dbs_uid" in session array
|
||||
|
||||
@3: TEST FOR GET DATABASE CONNECTIONS /----------------------------------------------------------------------
|
||||
Scenario: List all the database connections (result 1 database connection)
|
||||
Given that I have a valid access_token
|
||||
And I request "project/74737540052e1641ab88249082085472/database-connections"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 1 record
|
||||
|
||||
@4: TEST FOR PUT DATABASE CONNECTION /-----------------------------------------------------------------------
|
||||
Scenario: Update a database connection
|
||||
Given that I have a valid access_token
|
||||
And PUT this data:
|
||||
"""
|
||||
{
|
||||
"dbs_type": "mysql",
|
||||
"dbs_server": "192.168.11.71",
|
||||
"dbs_database_name": "wf_cochalo",
|
||||
"dbs_username": "root",
|
||||
"dbs_password": "atopml2005",
|
||||
"dbs_port": 3306,
|
||||
"dbs_encode": "utf8",
|
||||
"dbs_description": "conection correcta a workflow"
|
||||
}
|
||||
"""
|
||||
And that I want to update a resource with the key "dbs_uid" stored in session array
|
||||
And I request "project/74737540052e1641ab88249082085472/database-connection"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
|
||||
|
||||
Scenario: Get a database connection (with change in "dbs_description" and "dbs_database_name")
|
||||
Given that I have a valid access_token
|
||||
And that I want to get a resource with the key "dbs_uid" stored in session array
|
||||
And I request "project/74737540052e1641ab88249082085472/database-connection"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
And that "dbs_description" is set to "conection correcta a workflow"
|
||||
And that "dbs_database_name" is set to "wf_cochalo"
|
||||
|
||||
|
||||
Scenario: Delete a database connection
|
||||
Given that I have a valid access_token
|
||||
And that I want to delete a resource with the key "dbs_uid" stored in session array
|
||||
And I request "project/74737540052e1641ab88249082085472/database-connection"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
|
||||
@7: TEST FOR GET DATABASE CONNECTIONS /----------------------------------------------------------------------
|
||||
Scenario: List all the database connections (result 0 database connections)
|
||||
Given that I have a valid access_token
|
||||
And I request "project/74737540052e1641ab88249082085472/database-connections"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the response has 0 record
|
||||
@@ -1,8 +1,7 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Output Documents Main Tests
|
||||
Requirements:
|
||||
a workspace with the process 4224292655297723eb98691001100052 already loaded
|
||||
the process name is "Test Users-Step-Properties End Point"
|
||||
a workspace with the process 4224292655297723eb98691001100052 ("Test Users-Step-Properties End Point") already loaded
|
||||
there are two output documents in the process
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Project Properties - Assignee Resources
|
||||
Feature: Assignee Resources
|
||||
Requirements:
|
||||
a workspace with the process 4224292655297723eb98691001100052 ("Test Users-Step-Properties End Point") already loaded
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
Scenario Outline: Get a list of available users and groups to be assigned to an activity
|
||||
Scenario Outline: Get the list of available users and groups to be assigned to an activity
|
||||
Check that there are exactly 82 available users for task "Task 1"
|
||||
Given I request "project/<project>/activity/<activity>/available-assignee"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
@@ -13,12 +16,12 @@ Feature: Project Properties - Assignee Resources
|
||||
And the response has <records> records
|
||||
And the "aas_uid" property in row 0 equals "<aas_uid>"
|
||||
And the "aas_type" property in row 0 equals "<aas_type>"
|
||||
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | records | aas_uid | aas_type |
|
||||
| check if the list of possible users and groups to be assigned is correct | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 82 | 54731929352d56741de9d42002704749 | group |
|
||||
|
||||
Scenario Outline: Get a list of available users and groups to be assigned to an activity using filter
|
||||
Scenario Outline: Get the list of available users and groups to be assigned to an activity using filter
|
||||
Given I request "project/<project>/activity/<activity>/available-assignee?filter=<filter>&start=<start>&limit=<limit>"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
@@ -27,11 +30,14 @@ Scenario Outline: Get a list of available users and groups to be assigned to an
|
||||
And the response has <records> records
|
||||
And the "aas_uid" property in row 0 equals "<aas_uid>"
|
||||
And the "aas_type" property in row 0 equals "<aas_type>"
|
||||
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | filter | start | limit | records | aas_uid | aas_type|
|
||||
| Using filter get available users that match with "fin" | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 50 | 2 | 66623507552d56742865613066097298 | group |
|
||||
| Using filter get 1 available user that match with "fin" | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 1 | 1 | 66623507552d56742865613066097298 | group |
|
||||
| test_description | project | activity | filter | start | limit | records | aas_uid | aas_type|
|
||||
| Using filter="fin" with no limits should return 2 groups | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 50 | 2 | 66623507552d56742865613066097298 | group |
|
||||
| Using filter="fin", start="1", limit="1" should return 1 group | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 1 | 1 | 66623507552d56742865613066097298 | group |
|
||||
| Using filter="financial" should return 1 available group | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | financial | 0 | 1 | 1 | 62528621852cda436afe755036997717 | group |
|
||||
| Using filter="finance" should return 1 available group | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | finance | 0 | 1 | 1 | 17707415052cda432dd4774063621869 | group |
|
||||
|
||||
|
||||
Scenario Outline: Assign 2 users and 2 group to an activity
|
||||
Given POST this data:
|
||||
@@ -44,7 +50,7 @@ Scenario Outline: Get a list of available users and groups to be assigned to an
|
||||
And I request "project/<project>/activity/<activity>/assignee"
|
||||
Then the response status code should be 201
|
||||
And the type is "object"
|
||||
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | aas_uid | aas_type |
|
||||
| assign a user to the first task | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 | user |
|
||||
@@ -53,8 +59,6 @@ Scenario Outline: Get a list of available users and groups to be assigned to an
|
||||
| assign a group to the second task | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 36775342552d5674146d9c2078497230 | group |
|
||||
|
||||
|
||||
|
||||
|
||||
Scenario Outline: After assignation - List assignees of each activity
|
||||
Given I request "project/<project>/activity/<activity>/assignee"
|
||||
Then the response status code should be 200
|
||||
@@ -64,12 +68,12 @@ Scenario Outline: Get a list of available users and groups to be assigned to an
|
||||
And the response has <records> records
|
||||
And the "aas_uid" property in row 0 equals "<aas_uid>"
|
||||
And the "aas_type" property in row 0 equals "<aas_type>"
|
||||
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | records | aas_uid | aas_type |
|
||||
| Verify that the activity has expected quantity of asignees | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 7 | 54731929352d56741de9d42002704749 | group |
|
||||
| Verify that the activity has expected quantity of asignees | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 5 | 36775342552d5674146d9c2078497230 | group |
|
||||
|
||||
|
||||
|
||||
Scenario Outline: List assignees of an activity using a filter
|
||||
Given I request "project/<project>/activity/<activity>/assignee?filter=<filter>"
|
||||
@@ -80,12 +84,13 @@ Scenario Outline: List assignees of an activity using a filter
|
||||
And the response has <records> record
|
||||
And the "aas_uid" property in row 0 equals "<aas_uid>"
|
||||
And the "aas_type" property in row 0 equals "<aas_type>"
|
||||
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | records | aas_uid | aas_type | filter |
|
||||
| Filtered list should return 1 record | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 1 | 73005191052d56727901138030694610 | user | oli |
|
||||
| Filtered list should return 1 record | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 1 | 36775342552d5674146d9c2078497230 | group | emp |
|
||||
|
||||
|
||||
Scenario Outline: Get a single user or group of an activity
|
||||
Given I request "project/<project>/activity/<activity>/assignee/<aas_uid>"
|
||||
Then the response status code should be 200
|
||||
@@ -97,16 +102,17 @@ Scenario Outline: List assignees of an activity using a filter
|
||||
And the "aas_lastname" property equals "<aas_lastname>"
|
||||
And the "aas_username" property equals "<aas_username>"
|
||||
And the "aas_type" property equals "<aas_type>"
|
||||
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | aas_uid | aas_type | aas_name | aas_lastname | aas_username |
|
||||
| Obtain details of user assigend to an activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 | user | Olivia | Austin | olivia |
|
||||
|
||||
| Obtain details of user assigned to an activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 | user | Olivia | Austin | olivia |
|
||||
|
||||
|
||||
Scenario Outline: Remove assignee from an activity
|
||||
Given that I want to delete a resource with the key "aas_uid" stored in session array
|
||||
And I request "project/<project>/activity/<activity>/assignee/<aas_uid>"
|
||||
Then the response status code should be 200
|
||||
|
||||
|
||||
Examples:
|
||||
| test_description | project | activity | aas_uid |
|
||||
| Remove a user from activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 |
|
||||
@@ -114,7 +120,6 @@ Scenario Outline: List assignees of an activity using a filter
|
||||
| Remove a user from activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 54731929352d56741de9d42002704749 |
|
||||
| Remove a user from activity | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 36775342552d5674146d9c2078497230 |
|
||||
|
||||
|
||||
|
||||
Scenario: List assignees of an activity
|
||||
Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee"
|
||||
@@ -123,4 +128,4 @@ Scenario Outline: List assignees of an activity using a filter
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
And the response has 4 records
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
@ProcessMakerMichelangelo @RestAPI @assignee @negative
|
||||
Feature: Project Properties -Assignee Resources - Negative tests
|
||||
Requirements:
|
||||
a workspace with the process 4224292655297723eb98691001100052 ("Test Users-Step-Properties End Point") already loaded
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
|
||||
|
||||
Scenario Outline: List assignees of an activity with bad parameters
|
||||
Given I request "project/<project>/activity/<activity>/assignee"
|
||||
@@ -13,27 +15,58 @@ Scenario Outline: List assignees of an activity with bad parameters
|
||||
| test_description | project | activity |
|
||||
| Use an invalid project ID and empty activity | 4224292655297723eb98691001100052 | 1234556 |
|
||||
| Use an invalid project ID | 122134324 | 65496814252977243d57684076211485 |
|
||||
| Use an invalid activity ID | 345345345 | 345345345 |
|
||||
|
||||
| Use an invalid activity ID | 345345345 | 345345345 |
|
||||
|
||||
|
||||
Scenario Outline: Assign a user or group to an activity (Field validation)
|
||||
Given POST this data:
|
||||
"""
|
||||
{
|
||||
"ass_uid": "<aas_uid>",
|
||||
"ass_type": "<aas_type>"
|
||||
"ass_uid": "<aas_uid>",
|
||||
"ass_type": "<aas_type>"
|
||||
}
|
||||
"""
|
||||
And I request "project/<project>/activity/<activity>/assignee"
|
||||
Then the response status code should be 400
|
||||
And the type is "object"
|
||||
|
||||
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
| test_description | project | activity | aas_uid | aas_type |
|
||||
| Asignando un user inexistente | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | |
|
||||
| Asignando un user inexistente | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | |
|
||||
| Asignando un usuario Con tipo inexistente | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | !@#$%^&*()_+=-[]{};:~, | user |
|
||||
| Asignando un usuario como grupo | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | group |
|
||||
| Asignando un usuario como grupo | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | group |
|
||||
| Asignando un usuario con type inexistente | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | department |
|
||||
|
||||
|
||||
|
||||
Scenario Outline: List assignees of an activity using different filters
|
||||
Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee?filter=<filter>&start=<start>&limit=<limit>"
|
||||
Then the response status code should be <http_code>
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "<type>"
|
||||
And the response has <records> records
|
||||
|
||||
Examples:
|
||||
| test_description | filter | start | limit | records | http_code | type |
|
||||
| lowercase | admin | 0 | 1 | 1 | 200 | array |
|
||||
| uppercase | ADMIN | 0 | 1 | 1 | 200 | array |
|
||||
| limit=3 | a | 0 | 3 | 3 | 200 | array |
|
||||
| limit and start | a | 1 | 2 | 2 | 200 | array |
|
||||
| high number for start | a | 1000 | 1 | 0 | 200 | array |
|
||||
| high number for start | a | 1000 | 0 | 0 | 200 | array |
|
||||
| empty result | xyz | 0 | 0 | 0 | 200 | array |
|
||||
| empty string | | 0 | 10000 | 0 | 200 | array |
|
||||
| empty string | | 1 | 2 | 0 | 200 | array |
|
||||
| invalid start | a | b | c | 0 | 400 | string|
|
||||
| invalid limit | a | 0 | c | 0 | 400 | string|
|
||||
| search 0 | 0 | 0 | 0 | 0 | 200 | array |
|
||||
| search 0 | 0 | 0 | 100 | 0 | 200 | array |
|
||||
| negative numbers | a | -10 | -20 | 0 | 200 | array |
|
||||
| real numbers | a | 0.0 | 1.0 | 0 | 400 | string|
|
||||
| real numbers | a | 0.0 | 0.0 | 0 | 400 | string|
|
||||
| real numbers | a | 0.1 | 1.4599 | 0 | 400 | string|
|
||||
| real numbers | a | 1.5 | 1.4599 | 0 | 400 | string|
|
||||
|
||||
|
||||
|
||||
@@ -1111,7 +1111,12 @@ class RestContext extends BehatContext
|
||||
{
|
||||
$data = $this->_data;
|
||||
if (!is_array($data)) {
|
||||
throw new Exception("the Response data is not an array!\n\n" );
|
||||
if ($quantityOfRecords == 0) {
|
||||
//if we expect 0 records and the response in fact is not an array, just return as a valid test
|
||||
return;
|
||||
} else {
|
||||
throw new Exception("the Response data is not an array!\n\n" );
|
||||
}
|
||||
}
|
||||
$currentRecordsCount=count($data);
|
||||
if($currentRecordsCount!=$quantityOfRecords){
|
||||
@@ -1184,7 +1189,7 @@ class RestContext extends BehatContext
|
||||
*/
|
||||
public function theResponseStatusMessageShouldHaveTheFollowingText($arg1)
|
||||
{
|
||||
|
||||
|
||||
$message="";
|
||||
if($bodyResponse=json_decode($this->_response->getBody(true))){
|
||||
if(isset($bodyResponse->error->message)){
|
||||
@@ -1204,8 +1209,8 @@ class RestContext extends BehatContext
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1727,7 +1727,7 @@ class G
|
||||
* @param type Array $aFields
|
||||
* @return type String
|
||||
*/
|
||||
public function replaceDataGridField($sContent, $aFields)
|
||||
public function replaceDataGridField($sContent, $aFields, $nl2brRecursive = true)
|
||||
{
|
||||
$nrt = array("\n", "\r", "\t");
|
||||
$nrthtml = array("(n /)", "(r /)", "(t /)");
|
||||
@@ -1760,6 +1760,13 @@ class G
|
||||
|
||||
if (isset($aFields[$grdName]) && is_array($aFields[$grdName])) {
|
||||
foreach ($aFields[$grdName] as $aRow) {
|
||||
if ($nl2brRecursive) {
|
||||
foreach ($aRow as $sKey => $vValue) {
|
||||
if (!is_array($vValue)) {
|
||||
$aRow[$sKey] = nl2br($aRow[$sKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$strData = $strData . G::replaceDataField($arrayMatch2[2], $aRow);
|
||||
}
|
||||
}
|
||||
@@ -1778,6 +1785,14 @@ class G
|
||||
|
||||
$sContent = $strContentAux;
|
||||
|
||||
if ($nl2brRecursive) {
|
||||
foreach ($aFields as $sKey => $vValue) {
|
||||
if (!is_array($vValue)) {
|
||||
$aFields[$sKey] = nl2br($aFields[$sKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sContent = G::replaceDataField($sContent, $aFields);
|
||||
|
||||
return $sContent;
|
||||
@@ -2325,7 +2340,7 @@ class G
|
||||
* @param string $parameter
|
||||
* @return string
|
||||
*/
|
||||
public function header ($parameter)
|
||||
public static function header ($parameter)
|
||||
{
|
||||
if (defined( 'ENABLE_ENCRYPT' ) && (ENABLE_ENCRYPT == 'yes') && (substr( $parameter, 0, 9 ) == 'location:')) {
|
||||
$url = G::encryptUrl( substr( $parameter, 10 ), URL_KEY );
|
||||
|
||||
@@ -4409,8 +4409,8 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
|
||||
} else {
|
||||
$isRequired = '0';
|
||||
}
|
||||
if ($v == 'today') {
|
||||
$mask = str_replace( "%", "", $this->mask );
|
||||
$mask = str_replace( "%", "", $this->mask );
|
||||
if (trim($v) !== "") {
|
||||
$v = date( masktophp($mask, $v) );
|
||||
}
|
||||
$html = '<input ' . $this->NSRequiredValue() . ' class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '" pm:required="' . $isRequired . '" style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" ' . $this->NSGridType() . '/>' . htmlentities( $v, ENT_COMPAT, 'utf-8' );
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
* cron.php
|
||||
* @package workflow-engine-bin
|
||||
*/
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
ini_set('memory_limit', '300M'); // nore: this may need to be higher for many projects
|
||||
$mem_limit = (int) ini_get('memory_limit');
|
||||
|
||||
if ( !defined('PATH_SEP') ) {
|
||||
define('PATH_SEP', ( substr(PHP_OS, 0, 3) == 'WIN' ) ? '\\' : '/');
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
* cron_single.php
|
||||
* @package workflow-engine-bin
|
||||
*/
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
ini_set("memory_limit", "256M");
|
||||
|
||||
if (!defined('SYS_LANG')) {
|
||||
define('SYS_LANG', 'en');
|
||||
@@ -823,11 +819,11 @@ function executeCaseSelfService()
|
||||
$taskSelfServiceTimeUnit = $row["TAS_SELFSERVICE_TIME_UNIT"];
|
||||
$taskSelfServiceTriggerUid = $row["TAS_SELFSERVICE_TRIGGER_UID"];
|
||||
|
||||
if ($calendar->pmCalendarUid == '') {
|
||||
$calendar->getCalendar(null, $appcacheProUid, $taskUid);
|
||||
$calendar->getCalendarData();
|
||||
if ($calendar->pmCalendarUid == '') {
|
||||
$calendar->getCalendar(null, $appcacheProUid, $taskUid);
|
||||
$calendar->getCalendarData();
|
||||
}
|
||||
|
||||
|
||||
$dueDate = $calendar->calculateDate(
|
||||
$appcacheDelDelegateDate,
|
||||
$taskSelfServiceTime,
|
||||
|
||||
@@ -3906,12 +3906,12 @@ class Cases
|
||||
if (AppDelegationPeer::doCount($oCriteria) == 1) {
|
||||
$aFields['APP_STATUS'] = 'CANCELLED';
|
||||
$oApplication->update($aFields);
|
||||
|
||||
G::LoadClass('reportTables');
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
|
||||
G::LoadClass('reportTables');
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$oReportTables = new ReportTables();
|
||||
$addtionalTables = new additionalTables();
|
||||
$oReportTables->updateTables($aFields['PRO_UID'], $aFields['APP_UID'], $aFields['APP_NUMBER'], $aFields['APP_DATA']);
|
||||
$addtionalTables = new additionalTables();
|
||||
$oReportTables->updateTables($aFields['PRO_UID'], $aFields['APP_UID'], $aFields['APP_NUMBER'], $aFields['APP_DATA']);
|
||||
$addtionalTables->updateReportTables($aFields['PRO_UID'], $aFields['APP_UID'], $aFields['APP_NUMBER'], $aFields['APP_DATA'], $aFields['APP_STATUS']);
|
||||
}
|
||||
$this->CloseCurrentDelegation($sApplicationUID, $iIndex);
|
||||
@@ -4932,9 +4932,9 @@ class Cases
|
||||
throw (new Exception("Template file \"$fileTemplate\" does not exist."));
|
||||
}
|
||||
|
||||
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields);
|
||||
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields, false);
|
||||
} else {
|
||||
$sBody = nl2br(G::replaceDataGridField($aTaskInfo["TAS_DEF_MESSAGE"], $aFields));
|
||||
$sBody = nl2br(G::replaceDataGridField($aTaskInfo["TAS_DEF_MESSAGE"], $aFields, false));
|
||||
}
|
||||
|
||||
G::LoadClass("tasks");
|
||||
@@ -5910,7 +5910,7 @@ class Cases
|
||||
$oCriteria->add(AppMessagePeer::APP_MSG_SHOW_MESSAGE, 1);
|
||||
}
|
||||
$oCriteria->addAscendingOrderByColumn(AppMessagePeer::APP_MSG_DATE);
|
||||
|
||||
|
||||
$oDataset = AppMessagePeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
@@ -6759,27 +6759,27 @@ class Cases
|
||||
}
|
||||
}
|
||||
|
||||
public function ordProcess ($a, $b)
|
||||
public function ordProcess ($a, $b)
|
||||
{
|
||||
if ($this->sort == '') {
|
||||
$this->sort = 'APP_MSG_DATE';
|
||||
}
|
||||
if ($this->dir=='ASC') {
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
return 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
return - 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
return - 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->dir=='ASC') {
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
return 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
return - 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
return - 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,9 @@ class dynaformEditor extends WebResource
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView');
|
||||
}
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView');
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
|
||||
if ($Properties["DYN_TYPE"] != "grid") {
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
|
||||
}
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView');
|
||||
|
||||
//for showHide tab option @Neyek
|
||||
|
||||
@@ -970,7 +970,7 @@ class wsBase
|
||||
$Fields = array_merge( $oldFields['APP_DATA'], $appFields );
|
||||
}
|
||||
|
||||
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields);
|
||||
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields, false);
|
||||
$hasEmailFrom = preg_match( '/(.+)@(.+)\.(.+)/', $sFrom, $match );
|
||||
|
||||
if (!$hasEmailFrom || strpos($sFrom, $aSetup["MESS_ACCOUNT"]) === false) {
|
||||
@@ -3288,7 +3288,7 @@ class wsBase
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ClaimCase
|
||||
*
|
||||
|
||||
@@ -141,10 +141,10 @@ class workspaceTools
|
||||
$this->dbHost = $values["DB_HOST"];
|
||||
$this->dbUser = $values["DB_USER"];
|
||||
$this->dbPass = $values["DB_PASS"];
|
||||
|
||||
$this->dbRbacHost = $values["DB_RBAC_HOST"];
|
||||
$this->dbRbacName = $values["DB_RBAC_NAME"];
|
||||
$this->dbRbacUser = $values["DB_RBAC_USER"];
|
||||
|
||||
$this->dbRbacHost = $values["DB_RBAC_HOST"];
|
||||
$this->dbRbacName = $values["DB_RBAC_NAME"];
|
||||
$this->dbRbacUser = $values["DB_RBAC_USER"];
|
||||
$this->dbRbacPass = $values["DB_RBAC_PASS"];
|
||||
|
||||
return $this->dbInfo = $values;
|
||||
@@ -361,7 +361,7 @@ class workspaceTools
|
||||
}
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close any database opened with getDatabase
|
||||
*/
|
||||
@@ -690,7 +690,7 @@ class workspaceTools
|
||||
}
|
||||
|
||||
$oDataBase = $this->getDatabase($rbac);
|
||||
|
||||
|
||||
$oDataBase->iFetchType = MYSQL_NUM;
|
||||
|
||||
$oDataBase->logQuery(count($changes));
|
||||
@@ -1356,13 +1356,6 @@ class workspaceTools
|
||||
$stop = microtime(true);
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Database Upgrade Process took $final seconds.\n");
|
||||
|
||||
$start = microtime(true);
|
||||
CLI::logging("> Updating cases directories structure...\n");
|
||||
$workspace->upgradeCasesDirectoryStructure($workspaceName);
|
||||
$stop = microtime(true);
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Database Upgrade Structure Process took $final seconds.\n");
|
||||
}
|
||||
$start = microtime(true);
|
||||
CLI::logging("> Updating cache view...\n");
|
||||
@@ -1431,11 +1424,11 @@ class workspaceTools
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function backupLogFiles()
|
||||
{
|
||||
$config = System::getSystemConfiguration();
|
||||
|
||||
|
||||
clearstatcache();
|
||||
$path = PATH_DATA . "log" . PATH_SEP;
|
||||
$filePath = $path . "cron.log";
|
||||
|
||||
@@ -26,59 +26,32 @@ class BpmnActivity extends BaseBpmnActivity
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
}
|
||||
|
||||
/* DEPRECATED, IT WILL BE REMOVED SOON
|
||||
public function create($data, $generateUid = true)
|
||||
public function getBound()
|
||||
{
|
||||
// validate foreign keys, they must be present into data array
|
||||
|
||||
if (! array_key_exists('PRJ_UID', $data)) {
|
||||
throw new PropelException("Error, required param 'PRJ_UID' is missing!");
|
||||
}
|
||||
|
||||
if (! array_key_exists('PRO_UID', $data)) {
|
||||
throw new PropelException("Error, required param 'PRO_UID' is missing!");
|
||||
}
|
||||
|
||||
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
if ($generateUid) {
|
||||
$this->setActUid(\ProcessMaker\Util\Hash::generateUID());
|
||||
}
|
||||
|
||||
$this->save();
|
||||
$process = BpmnProcessPeer::retrieveByPK($data['PRO_UID']);
|
||||
|
||||
// create related bound
|
||||
$bound = new Bound();
|
||||
$bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$bound->setBouUid(\ProcessMaker\Util\Hash::generateUID());
|
||||
$bound->setPrjUid($this->getPrjUid());
|
||||
$bound->setDiaUid($process->getDiaUid());
|
||||
$bound->setElementUid($this->getActUid());
|
||||
$bound->setBouElementType('bpmnActivity');
|
||||
$bound->setBouElement('pm_canvas');
|
||||
$bound->setBouContainer('bpmnDiagram');
|
||||
$bound->save();
|
||||
}*/
|
||||
return $this->bound;
|
||||
}
|
||||
|
||||
|
||||
// OVERRIDES
|
||||
|
||||
public function fromArray($data)
|
||||
public function setActUid($actUid)
|
||||
{
|
||||
parent::fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
parent::setActUid($actUid);
|
||||
$this->bound->setElementUid($this->getActUid());
|
||||
}
|
||||
|
||||
// try resolve the related bound
|
||||
if (array_key_exists('BOU_UID', $data)) {
|
||||
//$bound = BpmnBound::findByElement('Activity', $this->getActUid());
|
||||
$bound = BpmnBoundPeer::retrieveByPK($data['BOU_UID']);
|
||||
public function setPrjUid($prjUid)
|
||||
{
|
||||
parent::setPrjUid($prjUid);
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
}
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
}
|
||||
}
|
||||
public function setProUid($proUid)
|
||||
{
|
||||
parent::setProUid($proUid);
|
||||
|
||||
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
}
|
||||
|
||||
public function save($con = null)
|
||||
@@ -90,6 +63,32 @@ class BpmnActivity extends BaseBpmnActivity
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($con = null)
|
||||
{
|
||||
// first, delete the related bound object
|
||||
if (is_object($this->bound) && get_class($this->bound) == 'BpmnBound') {
|
||||
$this->bound->delete($con);
|
||||
}
|
||||
|
||||
parent::delete($con);
|
||||
}
|
||||
|
||||
public function fromArray($data)
|
||||
{
|
||||
parent::fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
// try resolve the related bound
|
||||
$bound = BpmnBound::findByElement('Activity', $this->getActUid());
|
||||
|
||||
//if (array_key_exists('BOU_UID', $data)) {
|
||||
if (is_object($bound)) {
|
||||
//$bound = BpmnBoundPeer::retrieveByPK($data['BOU_UID']);
|
||||
$this->bound = $bound;
|
||||
}
|
||||
|
||||
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
|
||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
$data = parent::toArray($keyType);
|
||||
|
||||
@@ -303,7 +303,7 @@ class Event extends BaseEvent
|
||||
$oTP = new TemplatePower( PATH_TPL . 'events' . PATH_SEP . 'sendMessage.tpl' );
|
||||
$oTP->prepare();
|
||||
|
||||
$oTP->assign( 'from', 'info@processmaker.com' );
|
||||
$oTP->assign( 'from', '<info@processmaker.com>' );
|
||||
$oTP->assign( 'subject', addslashes( $aData['EVN_ACTION_PARAMETERS']['SUBJECT'] ) );
|
||||
$oTP->assign( 'template', $aData['EVN_ACTION_PARAMETERS']['TEMPLATE'] );
|
||||
$oTP->assign( 'timestamp', date( "l jS \of F Y h:i:s A" ) );
|
||||
@@ -504,9 +504,9 @@ class Event extends BaseEvent
|
||||
$when = (float) $aData['EVN_WHEN'];
|
||||
$whenOccurs = $aData['EVN_WHEN_OCCURS'];
|
||||
|
||||
if ($oCalendar->pmCalendarUid == '') {
|
||||
$oCalendar->getCalendar(null, $aData['PRO_UID'], $aData['TAS_UID']);
|
||||
$oCalendar->getCalendarData();
|
||||
if ($oCalendar->pmCalendarUid == '') {
|
||||
$oCalendar->getCalendar(null, $aData['PRO_UID'], $aData['TAS_UID']);
|
||||
$oCalendar->getCalendarData();
|
||||
}
|
||||
|
||||
if ($whenOccurs == 'AFTER_TIME') {
|
||||
@@ -620,9 +620,9 @@ class Event extends BaseEvent
|
||||
$when = (float) $aData['EVN_WHEN'];
|
||||
$whenOccurs = $aData['EVN_WHEN_OCCURS'];
|
||||
|
||||
if ($oCalendar->pmCalendarUid == '') {
|
||||
$oCalendar->getCalendar(null, $aData['PRO_UID'], $aData['TAS_UID']);
|
||||
$oCalendar->getCalendarData();
|
||||
if ($oCalendar->pmCalendarUid == '') {
|
||||
$oCalendar->getCalendar(null, $aData['PRO_UID'], $aData['TAS_UID']);
|
||||
$oCalendar->getCalendarData();
|
||||
}
|
||||
|
||||
if ($whenOccurs == 'AFTER_TIME') {
|
||||
@@ -880,9 +880,9 @@ class Event extends BaseEvent
|
||||
$when = $aData['EVN_WHEN']; //how many days
|
||||
$whenOccurs = $aData['EVN_WHEN_OCCURS']; //time on action (AFTER_TIME/TASK_STARTED)
|
||||
|
||||
if ($oCalendar->pmCalendarUid == '') {
|
||||
$oCalendar->getCalendar(null, $aData['PRO_UID'], $aData['TAS_UID']);
|
||||
$oCalendar->getCalendarData();
|
||||
if ($oCalendar->pmCalendarUid == '') {
|
||||
$oCalendar->getCalendar(null, $aData['PRO_UID'], $aData['TAS_UID']);
|
||||
$oCalendar->getCalendarData();
|
||||
}
|
||||
|
||||
if ($whenOccurs == 'TASK_STARTED') {
|
||||
|
||||
@@ -477,7 +477,7 @@ class OutputDocument extends BaseOutputDocument
|
||||
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array())
|
||||
{
|
||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||
$sContent = nl2br(G::replaceDataGridField($sContent, $aFields));
|
||||
$sContent = G::replaceDataGridField($sContent, $aFields);
|
||||
|
||||
G::verifyPath($sPath, true);
|
||||
|
||||
|
||||
@@ -645,13 +645,27 @@ class Process extends BaseProcess
|
||||
$casesCnt = $this->getCasesCountInAllProcesses();
|
||||
}
|
||||
|
||||
// getting bpmn projects
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
|
||||
$ds = ProcessPeer::doSelectRS($c);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$bpmnProjects = array();
|
||||
|
||||
while ($ds->next()) {
|
||||
$row = $ds->getRow();
|
||||
$bpmnProjects[] = $row['PRJ_UID'];
|
||||
}
|
||||
|
||||
//execute the query
|
||||
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$processes = Array ();
|
||||
$uids = array ();
|
||||
while ($oDataset->next()) {
|
||||
$processes[] = $oDataset->getRow();
|
||||
$row = $oDataset->getRow();
|
||||
$row['PROJECT_TYPE'] = in_array($row['PRO_UID'], $bpmnProjects) ? 'bpmn' : 'classic';
|
||||
$processes[] = $row;
|
||||
$uids[] = $processes[sizeof( $processes ) - 1]['PRO_UID'];
|
||||
}
|
||||
|
||||
@@ -725,7 +739,7 @@ class Process extends BaseProcess
|
||||
$process['PRO_CREATE_DATE'] = date( $creationDateMask, mktime( $h, $i, $s, $m, $d, $y ) );
|
||||
}
|
||||
|
||||
$process['PRO_CATEGORY_LABEL'] = trim( $process['PRO_CATEGORY'] ) != '' ? $process['CATEGORY_NAME'] : G::LoadTranslation( 'ID_PROCESS_NO_CATEGORY' );
|
||||
$process['PRO_CATEGORY_LABEL'] = trim( $process['PRO_CATEGORY'] ) != '' ? $process['CATEGORY_NAME'] : '- ' . G::LoadTranslation( 'ID_PROCESS_NO_CATEGORY' ) . ' -';
|
||||
$process['PRO_TITLE'] = $proTitle;
|
||||
$process['PRO_DESCRIPTION'] = $proDescription;
|
||||
$process['PRO_DEBUG'] = $process['PRO_DEBUG'];
|
||||
@@ -885,9 +899,9 @@ class Process extends BaseProcess
|
||||
if (($this->sort) == '') {
|
||||
$this->sort = 'PRO_TITLE';
|
||||
}
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
if (strtolower($a[$this->sort]) > strtolower($b[$this->sort])) {
|
||||
return 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
} elseif (strtolower($a[$this->sort]) < strtolower($b[$this->sort])) {
|
||||
return - 1;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -899,9 +913,9 @@ class Process extends BaseProcess
|
||||
if (($this->sort) == '') {
|
||||
$this->sort = 'PRO_TITLE';
|
||||
}
|
||||
if ($a[$this->sort] > $b[$this->sort]) {
|
||||
if (strtolower($a[$this->sort]) > strtolower($b[$this->sort])) {
|
||||
return - 1;
|
||||
} elseif ($a[$this->sort] < $b[$this->sort]) {
|
||||
} elseif (strtolower($a[$this->sort]) < strtolower($b[$this->sort])) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@@ -181,7 +181,7 @@ class AppProxy extends HttpProxyController
|
||||
throw new Exception( G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' ) );
|
||||
}
|
||||
|
||||
if ($httpData->action == 'sent') { // Get the last valid delegation for participated list
|
||||
if (($httpData->action == 'sent') || ($httpData->action == 'search')){ // Get the last valid delegation for participated list
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteria->add(AppDelegationPeer::APP_UID, $httpData->appUid);
|
||||
|
||||
@@ -37,56 +37,74 @@ class ProcessProxy extends HttpProxyController
|
||||
*/
|
||||
public function saveProcess ($httpData)
|
||||
{
|
||||
$projectType = empty($_GET['type']) ? 'classicProject' : $_GET['type'];
|
||||
|
||||
require_once 'classes/model/Task.php';
|
||||
G::LoadClass( 'processMap' );
|
||||
$oProcessMap = new ProcessMap();
|
||||
|
||||
$httpData->PRO_TITLE = trim( $httpData->PRO_TITLE );
|
||||
|
||||
if (! isset( $httpData->PRO_UID )) {
|
||||
try {
|
||||
if (! isset( $httpData->PRO_UID )) {
|
||||
if (Process::existsByProTitle( $httpData->PRO_TITLE )) {
|
||||
$result = array ('success' => false,'msg' => G::LoadTranslation( 'ID_SAVE_PROCESS_ERROR' ),'errors' => array ('PRO_TITLE' => G::LoadTranslation( 'ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, Array ('PRO_TITLE' => $httpData->PRO_TITLE
|
||||
) )
|
||||
)
|
||||
);
|
||||
print G::json_encode( $result );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
if (Process::existsByProTitle( $httpData->PRO_TITLE )) {
|
||||
$result = array ('success' => false,'msg' => G::LoadTranslation( 'ID_SAVE_PROCESS_ERROR' ),'errors' => array ('PRO_TITLE' => G::LoadTranslation( 'ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, Array ('PRO_TITLE' => $httpData->PRO_TITLE
|
||||
) )
|
||||
)
|
||||
);
|
||||
print G::json_encode( $result );
|
||||
exit( 0 );
|
||||
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||
$processData['PRO_TITLE'] = $httpData->PRO_TITLE;
|
||||
$processData['PRO_DESCRIPTION'] = $httpData->PRO_DESCRIPTION;
|
||||
$processData['PRO_CATEGORY'] = $httpData->PRO_CATEGORY;
|
||||
|
||||
$sProUid = $oProcessMap->createProcess( $processData );
|
||||
|
||||
//call plugins
|
||||
$oData['PRO_UID'] = $sProUid;
|
||||
$oData['PRO_TEMPLATE'] = isset( $httpData->PRO_TEMPLATE ) && $httpData->PRO_TEMPLATE != '' ? $httpData->PRO_TEMPLATE : '';
|
||||
$oData['PROCESSMAP'] = $oProcessMap;
|
||||
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData );
|
||||
|
||||
} else {
|
||||
//$oProcessMap->updateProcess($_POST['form']);
|
||||
$sProUid = $httpData->PRO_UID;
|
||||
}
|
||||
|
||||
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||
$processData['PRO_TITLE'] = $httpData->PRO_TITLE;
|
||||
$processData['PRO_DESCRIPTION'] = $httpData->PRO_DESCRIPTION;
|
||||
$processData['PRO_CATEGORY'] = $httpData->PRO_CATEGORY;
|
||||
//Save Calendar ID for this process
|
||||
if (isset( $httpData->PRO_CALENDAR )) {
|
||||
G::LoadClass( "calendar" );
|
||||
$calendarObj = new Calendar();
|
||||
$calendarObj->assignCalendarTo( $sProUid, $httpData->PRO_CALENDAR, 'PROCESS' );
|
||||
}
|
||||
|
||||
$sProUid = $oProcessMap->createProcess( $processData );
|
||||
// Creating BPMN Project Layer
|
||||
if ($projectType == 'bpmnProject') {
|
||||
$bpmnModel = new ProcessMaker\Adapter\Bpmn\Model();
|
||||
$replaceUids = false;
|
||||
|
||||
//call plugins
|
||||
$oData['PRO_UID'] = $sProUid;
|
||||
$oData['PRO_TEMPLATE'] = isset( $httpData->PRO_TEMPLATE ) && $httpData->PRO_TEMPLATE != '' ? $httpData->PRO_TEMPLATE : '';
|
||||
$oData['PROCESSMAP'] = $oProcessMap;
|
||||
$data = array(
|
||||
'PRJ_UID' => $sProUid,
|
||||
'PRJ_NAME' => $httpData->PRO_TITLE,
|
||||
'PRJ_DESCRIPTION' => $httpData->PRO_DESCRIPTION,
|
||||
'PRJ_CATEGORY' => $httpData->PRO_CATEGORY
|
||||
);
|
||||
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData );
|
||||
$result = $bpmnModel->createProject($data, $replaceUids);
|
||||
}
|
||||
|
||||
} else {
|
||||
//$oProcessMap->updateProcess($_POST['form']);
|
||||
$sProUid = $httpData->PRO_UID;
|
||||
$this->success = true;
|
||||
$this->PRO_UID = $sProUid;
|
||||
$this->msg = G::LoadTranslation( 'ID_CREATE_PROCESS_SUCCESS' );
|
||||
} catch (Exception $e) {
|
||||
$this->success = false;
|
||||
$this->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
//Save Calendar ID for this process
|
||||
if (isset( $httpData->PRO_CALENDAR )) {
|
||||
G::LoadClass( "calendar" );
|
||||
$calendarObj = new Calendar();
|
||||
$calendarObj->assignCalendarTo( $sProUid, $httpData->PRO_CALENDAR, 'PROCESS' );
|
||||
}
|
||||
|
||||
$this->success = true;
|
||||
$this->PRO_UID = $sProUid;
|
||||
$this->msg = G::LoadTranslation( 'ID_CREATE_PROCESS_SUCCESS' );
|
||||
|
||||
//TODO save bpmn project
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -98,16 +98,18 @@ try {
|
||||
/**
|
||||
* these routine is to verify if the case was acceded from advaced search list
|
||||
*/
|
||||
|
||||
if ($_action == 'search') {
|
||||
//verify if the case is with teh current user
|
||||
|
||||
$c = new Criteria( 'workflow' );
|
||||
$c->add( AppDelegationPeer::APP_UID, $sAppUid );
|
||||
$c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$c->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$oDataset = AppDelegationPeer::doSelectRs( $c );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
$aData = $oDataset->getRow();
|
||||
|
||||
|
||||
if ($aData['USR_UID'] != $_SESSION['USER_LOGGED'] && $aData['USR_UID'] != "") {
|
||||
//distinct "" for selfservice
|
||||
//so we show just the resume
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
|
||||
die( '<script type="text/javascript">
|
||||
try
|
||||
try
|
||||
{
|
||||
prnt = parent.parent;
|
||||
top.location = top.location;
|
||||
}
|
||||
catch (err)
|
||||
catch (err)
|
||||
{
|
||||
parent.location = parent.location;
|
||||
}
|
||||
@@ -842,6 +842,7 @@ try {
|
||||
}
|
||||
break;
|
||||
case '': //when this task is the Finish process
|
||||
case 'nobody':
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray( $aFields['TASK'][$sKey]['USER_UID'] );
|
||||
$aFields['TASK'][$sKey]['NEXT_TASK']['USR_UID'] = $userFields['USR_FULLNAME'];
|
||||
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_FINISH_FLAG'] = true;
|
||||
|
||||
@@ -11,7 +11,7 @@ $user = new Users();
|
||||
|
||||
$userData = $rbacUser->getByUsername($data['USR_USERNAME']);
|
||||
|
||||
if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL']) {
|
||||
if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'] && $userData['USR_AUTH_TYPE'] === '' ) {
|
||||
$aSetup = getEmailConfiguration();
|
||||
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
|
||||
G::SendTemporalMessage ('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
|
||||
@@ -27,7 +27,20 @@ if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'
|
||||
$rbacUser->update($aData);
|
||||
$user->update($aData);
|
||||
*/
|
||||
$sFrom = ($aSetup['MESS_ACCOUNT'] != '' ? $aSetup['MESS_ACCOUNT'] . ' ' : '') . '<' . $aSetup['MESS_ACCOUNT'] . '>';
|
||||
|
||||
if (trim($aSetup["MESS_FROM_NAME"]) === '') {
|
||||
$aSetup["MESS_FROM_NAME"] = 'PROCESSMAKER';
|
||||
}
|
||||
if ($aSetup['MESS_ENGINE'] === 'MAIL') {
|
||||
$sFrom = $aSetup["MESS_FROM_NAME"] . " <info@" . ((isset($_SERVER["HTTP_HOST"]) && $_SERVER["HTTP_HOST"] != "") ? $_SERVER["HTTP_HOST"] : "processmaker.com") . ">";
|
||||
} else {
|
||||
if (trim($aSetup["MESS_ACCOUNT"]) === '') {
|
||||
$sFrom = $aSetup["MESS_FROM_NAME"] . " <info@" . ((isset($_SERVER["HTTP_HOST"]) && $_SERVER["HTTP_HOST"] != "") ? $_SERVER["HTTP_HOST"] : "processmaker.com") . ">";
|
||||
} else {
|
||||
$sFrom = $aSetup["MESS_FROM_NAME"] . " <" . $aSetup["MESS_ACCOUNT"] . ">";
|
||||
}
|
||||
}
|
||||
|
||||
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD').' - ProcessMaker' ;
|
||||
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
|
||||
$msg .='<p>'.G::LoadTranslation('ID_YOUR_USERMANE_IS').' : <strong>'.$userData['USR_USERNAME'].'</strong></p>';
|
||||
@@ -115,7 +128,11 @@ if ($userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'
|
||||
G::SendTemporalMessage ($e->getMessage(), "warning", 'string');
|
||||
}
|
||||
} else {
|
||||
$msg = G::LoadTranslation('ID_USER') . ' ' . htmlentities($data['USR_USERNAME'], ENT_QUOTES, 'UTF-8') . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED');
|
||||
if ($userData['USR_AUTH_TYPE'] === '') {
|
||||
$msg = G::LoadTranslation('ID_USER') . ' ' . htmlentities($data['USR_USERNAME'], ENT_QUOTES, 'UTF-8') . ' '. G::LoadTranslation('ID_IS_NOT_REGISTERED');
|
||||
} else {
|
||||
$msg = G::LoadTranslation('ID_USER_NOT_FUNCTIONALITY');
|
||||
}
|
||||
G::SendTemporalMessage ($msg, "warning", 'string');
|
||||
G::header('location: forgotPassword');
|
||||
}
|
||||
|
||||
16
workflow/engine/methods/processes/openDesigner.php
Normal file
16
workflow/engine/methods/processes/openDesigner.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if (! array_key_exists('pro_uid', $_REQUEST)) {
|
||||
die('Bad Request: The param "pro_uid" is required!');
|
||||
}
|
||||
|
||||
$proUid = $_GET['pro_uid'];
|
||||
$bpmnProject = BpmnProjectPeer::retrieveByPK($proUid);
|
||||
|
||||
|
||||
if (is_object($bpmnProject)) {
|
||||
$url = '../designer?pro_uid=' . $proUid;
|
||||
} else {
|
||||
$url = 'processes_Map?PRO_UID=' . $proUid;
|
||||
}
|
||||
|
||||
G::header("location: $url");
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* processes_ImportFile.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -20,6 +21,7 @@
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
|
||||
global $RBAC;
|
||||
@@ -58,9 +60,9 @@ try {
|
||||
) ) ));
|
||||
}
|
||||
foreach ($aFiles as $key => $val) {
|
||||
if ($val['filename'] == $sClassName . '.php')
|
||||
if (trim($val['filename']) == $sClassName . '.php')
|
||||
$bMainFile = true;
|
||||
if ($val['filename'] == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php')
|
||||
if (trim($val['filename']) == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php')
|
||||
$bClassFile = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ class CaseScheduler
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
return $rsCriteria->getRow();
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class CaseScheduler
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
return $rsCriteria->getRow();
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ class CaseScheduler
|
||||
* @param string $userPass Password
|
||||
* @param string $sProcessUID Process
|
||||
*
|
||||
* return bool Return true if the user exists, false otherwise
|
||||
* return message if the authentication fail
|
||||
*/
|
||||
public function getUser($userName, $userPass, $sProcessUID)
|
||||
{
|
||||
@@ -225,7 +225,7 @@ class CaseScheduler
|
||||
}
|
||||
$message = $result->message;
|
||||
return $message;
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -264,23 +264,23 @@ class CaseScheduler
|
||||
$aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']);
|
||||
if ($sOption != '5') {
|
||||
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
|
||||
if(!preg_match($pattern, $aData['SCH_START_TIME'])) {
|
||||
if (!preg_match($pattern, $aData['SCH_START_TIME'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_start_time`. Expecting time in HH:MM format (The time can not be increased to 23:59)'));
|
||||
}
|
||||
}
|
||||
$patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/";
|
||||
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
|
||||
if(!preg_match($patternDate, $aData['SCH_START_DATE'])) {
|
||||
if (!preg_match($patternDate, $aData['SCH_START_DATE'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_start_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
|
||||
}
|
||||
}
|
||||
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
|
||||
if(!preg_match($patternDate, $aData['SCH_END_DATE'])) {
|
||||
if (!preg_match($patternDate, $aData['SCH_END_DATE'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_end_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
|
||||
}
|
||||
}
|
||||
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
|
||||
if($aData['SCH_START_DATE'] == "") {
|
||||
if ($aData['SCH_START_DATE'] == "") {
|
||||
throw (new \Exception( '`sch_start_date` can`t be null'));
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ class CaseScheduler
|
||||
}
|
||||
break;
|
||||
case '2': // If the option is zero, set by default 1
|
||||
if($aData['SCH_WEEK_DAYS'] == "") {
|
||||
if ($aData['SCH_WEEK_DAYS'] == "") {
|
||||
throw (new \Exception( '`sch_week_days` can`t be null'));
|
||||
} else {
|
||||
$weeks = $aData['SCH_WEEK_DAYS'];
|
||||
@@ -346,7 +346,7 @@ class CaseScheduler
|
||||
$sWeeks = '';
|
||||
if (! empty( $aData['SCH_WEEK_DAYS'] )) {
|
||||
$aWeekDays = $aData['SCH_WEEK_DAYS'];
|
||||
}
|
||||
}
|
||||
$sStartTime = $aData['SCH_START_TIME'];
|
||||
$sWeeks = $aData['SCH_WEEK_DAYS'] . '|';
|
||||
break;
|
||||
@@ -361,7 +361,7 @@ class CaseScheduler
|
||||
}
|
||||
$temp = $aData['SCH_START_DAY_OPT_1'];
|
||||
$temp = (int)$temp;
|
||||
if($temp >= 1 && $temp <= 31) {
|
||||
if ($temp >= 1 && $temp <= 31) {
|
||||
$aData['SCH_START_DAY_OPT_1'] = $aData['SCH_START_DAY_OPT_1'];
|
||||
} else {
|
||||
throw (new \Exception( 'invalid value specified for `sch_start_day_opt_1`. Must be between 1 and 31'));
|
||||
@@ -431,7 +431,7 @@ class CaseScheduler
|
||||
throw (new \Exception( '`sch_repeat_every` can`t be null'));
|
||||
}
|
||||
$patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/";
|
||||
if(!preg_match($patternHour, $aData['SCH_REPEAT_EVERY'])) {
|
||||
if (!preg_match($patternHour, $aData['SCH_REPEAT_EVERY'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_repeat_every`. Expecting time in HH.MM format (The time can not be increased to 23.59)'));
|
||||
}
|
||||
$nextRun = $aData['SCH_REPEAT_EVERY'] * 60 * 60;
|
||||
@@ -510,23 +510,23 @@ class CaseScheduler
|
||||
$aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']);
|
||||
if ($sOption != '5') {
|
||||
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
|
||||
if(!preg_match($pattern, $aData['SCH_START_TIME'])) {
|
||||
if (!preg_match($pattern, $aData['SCH_START_TIME'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_start_time`. Expecting time in HH:MM format (The time can not be increased to 23:59)'));
|
||||
}
|
||||
}
|
||||
$patternDate="/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/";
|
||||
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
|
||||
if(!preg_match($patternDate, $aData['SCH_START_DATE'])) {
|
||||
if (!preg_match($patternDate, $aData['SCH_START_DATE'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_start_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
|
||||
}
|
||||
}
|
||||
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
|
||||
if(!preg_match($patternDate, $aData['SCH_END_DATE'])) {
|
||||
if (!preg_match($patternDate, $aData['SCH_END_DATE'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_end_date`. Expecting date in `YYYY-MM-DD` format, such as `2014-01-01`'));
|
||||
}
|
||||
}
|
||||
if ($sOption == '1' || $sOption == '2' || $sOption == '3') {
|
||||
if($aData['SCH_START_DATE'] == "") {
|
||||
if ($aData['SCH_START_DATE'] == "") {
|
||||
throw (new \Exception( '`sch_start_date` can`t be null'));
|
||||
}
|
||||
}
|
||||
@@ -569,7 +569,7 @@ class CaseScheduler
|
||||
}
|
||||
break;
|
||||
case '2': // If the option is zero, set by default 1
|
||||
if($aData['SCH_WEEK_DAYS'] == "") {
|
||||
if ($aData['SCH_WEEK_DAYS'] == "") {
|
||||
throw (new \Exception( '`sch_week_days` can`t be null'));
|
||||
} else {
|
||||
$weeks = $aData['SCH_WEEK_DAYS'];
|
||||
@@ -607,7 +607,7 @@ class CaseScheduler
|
||||
}
|
||||
$temp = $aData['SCH_START_DAY_OPT_1'];
|
||||
$temp = (int)$temp;
|
||||
if($temp >= 1 && $temp <= 31) {
|
||||
if ($temp >= 1 && $temp <= 31) {
|
||||
$aData['SCH_START_DAY_OPT_1'] = $aData['SCH_START_DAY_OPT_1'];
|
||||
} else {
|
||||
throw (new \Exception( 'invalid value specified for `sch_start_day_opt_1`. Must be between 1 and 31'));
|
||||
@@ -670,14 +670,14 @@ class CaseScheduler
|
||||
$sDateTmp = date( 'Y-m-d' );
|
||||
$aData['SCH_START_DATE'] = $sDateTmp;
|
||||
}
|
||||
$aData['SCH_END_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
|
||||
$aData['SCH_END_DATE'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp));
|
||||
$aData['SCH_START_TIME'] = time();
|
||||
$aData['SCH_START_DATE'] = $aData['SCH_START_TIME'];
|
||||
if ($aData['SCH_REPEAT_EVERY'] == "") {
|
||||
throw (new \Exception( '`sch_repeat_every` can`t be null'));
|
||||
}
|
||||
$patternHour="/^([0-1][0-9]|[2][0-3])[\.]([0-5][0-9])$/";
|
||||
if(!preg_match($patternHour, $aData['SCH_REPEAT_EVERY'])) {
|
||||
if (!preg_match($patternHour, $aData['SCH_REPEAT_EVERY'])) {
|
||||
throw (new \Exception( 'invalid value specified for `sch_repeat_every`. Expecting time in HH.MM format (The time can not be increased to 23.59)'));
|
||||
}
|
||||
$nextRun = $aData['SCH_REPEAT_EVERY'] * 60 * 60;
|
||||
@@ -711,7 +711,7 @@ class CaseScheduler
|
||||
$oCriteria = $this->getCaseScheduler($sProcessUID, $sSchUID);
|
||||
return $oCriteria;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -724,16 +724,16 @@ class CaseScheduler
|
||||
* @access public
|
||||
*/
|
||||
public function deleteCaseScheduler($sProcessUID, $sSchUID)
|
||||
{
|
||||
{
|
||||
try {
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "CaseScheduler.php");
|
||||
$oCaseScheduler = new \CaseScheduler();
|
||||
if ( !isset($sSchUID ) ) {
|
||||
if (!isset($sSchUID)) {
|
||||
return;
|
||||
}
|
||||
$oCaseScheduler->remove($sSchUID);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
244
workflow/engine/src/BusinessModel/DataBaseConnection.php
Normal file
244
workflow/engine/src/BusinessModel/DataBaseConnection.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \DbSource;
|
||||
use \dbConnections;
|
||||
|
||||
class DataBaseConnection
|
||||
{
|
||||
/**
|
||||
* List of DataBaseConnections in process
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDataBaseConnections($sProcessUid)
|
||||
{
|
||||
$oDBSource = new DbSource();
|
||||
$oCriteria = $oDBSource->getCriteriaDBSList($sProcessUid);
|
||||
|
||||
$rs = \DbSourcePeer::doSelectRS($oCriteria);
|
||||
$rs->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
||||
$rs->next();
|
||||
|
||||
$dbConnecions = array();
|
||||
while ($row = $rs->getRow()) {
|
||||
$row = array_change_key_case($row, CASE_LOWER);
|
||||
$dataDb = $this->getDataBaseConnection($sProcessUid, $row['dbs_uid']);
|
||||
$dbConnecions[] = array_change_key_case($dataDb, CASE_LOWER);
|
||||
$rs->next();
|
||||
}
|
||||
return $dbConnecions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data for DataBaseConnection
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
* @var string $dbConnecionUid. Uid for Data Base Connection
|
||||
*
|
||||
* return object
|
||||
*/
|
||||
public function getDataBaseConnection($sProcessUid, $dbConnecionUid)
|
||||
{
|
||||
try {
|
||||
G::LoadClass( 'dbConnections' );
|
||||
$dbs = new dbConnections($sProcessUid);
|
||||
$oDBConnection = new DbSource();
|
||||
$aFields = $oDBConnection->load($dbConnecionUid, $sProcessUid);
|
||||
if ($aFields['DBS_PORT'] == '0') {
|
||||
$aFields['DBS_PORT'] = '';
|
||||
}
|
||||
$aFields['DBS_PASSWORD'] = $dbs->getPassWithoutEncrypt($aFields);
|
||||
|
||||
$response = array_change_key_case($aFields, CASE_LOWER);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Data for DataBaseConnection
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
* @var string $dataDataBaseConnection. Data for DataBaseConnection
|
||||
* @var string $create. Create o Update DataBaseConnection
|
||||
* @var string $sDataBaseConnectionUid. Uid for DataBaseConnection
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function saveDataBaseConnection($sProcessUid = '', $dataDBConnection = array(), $create = false)
|
||||
{
|
||||
G::LoadClass('dbConnections');
|
||||
$oDBSource = new DbSource();
|
||||
$oContent = new \Content();
|
||||
$dataDBConnection = array_change_key_case($dataDBConnection, CASE_UPPER);
|
||||
|
||||
$dataDBConnection['PRO_UID'] = $sProcessUid;
|
||||
|
||||
if (isset($dataDBConnection['DBS_TYPE'])) {
|
||||
$typesExists = array();
|
||||
G::LoadClass( 'dbConnections' );
|
||||
$dbs = new dbConnections($sProcessUid);;
|
||||
$dbServices = $dbs->getDbServicesAvailables();
|
||||
foreach ($dbServices as $value) {
|
||||
$typesExists[] = $value['id'];
|
||||
}
|
||||
if (!in_array($dataDBConnection['DBS_TYPE'], $typesExists)) {
|
||||
throw (new \Exception("This 'dbs_type' is invalid"));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($dataDBConnection['DBS_TYPE'])) {
|
||||
$typesExists = array();
|
||||
|
||||
$dbs = new dbConnections($sProcessUid);;
|
||||
$dbServices = $dbs->getDbServicesAvailables();
|
||||
foreach ($dbServices as $value) {
|
||||
$typesExists[] = $value['id'];
|
||||
}
|
||||
if (!in_array($dataDBConnection['DBS_TYPE'], $typesExists)) {
|
||||
throw (new \Exception("This 'dbs_type' is invalid"));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($dataDBConnection['DBS_ENCODE'])) {
|
||||
$encodesExists = array();
|
||||
$dbs = new dbConnections();
|
||||
$dbEncodes = $dbs->getEncondeList($dataDBConnection['DBS_TYPE']);
|
||||
foreach ($dbEncodes as $value) {
|
||||
$encodesExists[] = $value['0'];
|
||||
}
|
||||
if (!in_array($dataDBConnection['DBS_ENCODE'], $encodesExists)) {
|
||||
throw (new \Exception( "This 'dbs_encode' is invalid for '" . $dataDBConnection['DBS_TYPE'] . "'" ));
|
||||
}
|
||||
}
|
||||
|
||||
$passOrigin = '';
|
||||
if (isset($dataDBConnection['DBS_PASSWORD'])) {
|
||||
$passOrigin = $dataDBConnection['DBS_PASSWORD'];
|
||||
if ($dataDBConnection['DBS_PASSWORD'] == 'none') {
|
||||
$dataDBConnection['DBS_PASSWORD'] = '';
|
||||
} else {
|
||||
$pass = G::encrypt( $dataDBConnection['DBS_PASSWORD'], $dataDBConnection['DBS_DATABASE_NAME']) . "_2NnV3ujj3w";
|
||||
$dataDBConnection['DBS_PASSWORD'] = $pass;
|
||||
}
|
||||
}
|
||||
|
||||
if ($create) {
|
||||
unset($dataDBConnection['DBS_UID']);
|
||||
// TEST CONNECTION
|
||||
$dataTest = array_merge($dataDBConnection, array('DBS_PASSWORD' => $passOrigin));
|
||||
$resTest = $this->testConnection($dataTest);
|
||||
if (!$resTest['resp']) {
|
||||
throw (new \Exception($resTest['message']));
|
||||
}
|
||||
$newDBConnectionUid = $oDBSource->create($dataDBConnection);
|
||||
$oContent->addContent('DBS_DESCRIPTION', '', $newDBConnectionUid,
|
||||
SYS_LANG, $dataDBConnection['DBS_DESCRIPTION'] );
|
||||
$newDataDBConnection = $this->getDataBaseConnection($sProcessUid, $newDBConnectionUid);
|
||||
$newDataDBConnection = array_change_key_case($newDataDBConnection, CASE_LOWER);
|
||||
return $newDataDBConnection;
|
||||
} else {
|
||||
// TEST CONNECTION
|
||||
$allData = $this->getDataBaseConnection($sProcessUid, $dataDBConnection['DBS_UID']);
|
||||
$dataTest = array_merge($allData, $dataDBConnection);
|
||||
$resTest = $this->testConnection($dataTest);
|
||||
if (!$resTest['resp']) {
|
||||
throw (new \Exception($resTest['message']));
|
||||
}
|
||||
$oDBSource->update($dataDBConnection);
|
||||
if (isset($dataDBConnection['DBS_DESCRIPTION'])) {
|
||||
$oContent->addContent('DBS_DESCRIPTION', '', $dataDBConnection['DBS_UID'],
|
||||
SYS_LANG, $dataDBConnection['DBS_DESCRIPTION'] );
|
||||
}
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete DataBaseConnection
|
||||
* @var string $sDataBaseConnectionUID. Uid for DataBaseConnection
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteDataBaseConnection($sProcessUid, $dbConnecionUid)
|
||||
{
|
||||
$oDBSource = new DbSource();
|
||||
$oContent = new \Content();
|
||||
|
||||
$oDBSource->remove($dbConnecionUid, $sProcessUid);
|
||||
$oContent->removeContent( 'DBS_DESCRIPTION', "", $dbConnecionUid );
|
||||
}
|
||||
|
||||
|
||||
public function testConnection ($dataCon) {
|
||||
$resp = array();
|
||||
$resp['resp'] = false;
|
||||
|
||||
G::LoadClass( 'net' );
|
||||
$Server = new \NET($dataCon['DBS_SERVER']);
|
||||
|
||||
// STEP 1 : Resolving Host Name
|
||||
if ($Server->getErrno() != 0) {
|
||||
$resp['message'] = "Error Testting Connection: Resolving Host Name FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// STEP 2 : Checking port
|
||||
$Server->scannPort($dataCon['DBS_PORT']);
|
||||
if ($Server->getErrno() != 0) {
|
||||
$resp['message'] = "Error Testting Connection: Checking port FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// STEP 3 : Trying to connect to host
|
||||
$Server->loginDbServer($dataCon['DBS_USERNAME'], $dataCon['DBS_PASSWORD']);
|
||||
$Server->setDataBase($dataCon['DBS_DATABASE_NAME'], $dataCon['DBS_PORT']);
|
||||
if ($Server->errno == 0) {
|
||||
$response = $Server->tryConnectServer($dataCon['DBS_TYPE']);
|
||||
if ($response->status != 'SUCCESS') {
|
||||
$resp['message'] = "Error Testting Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
} else {
|
||||
$resp['message'] = "Error Testting Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// STEP 4 : Trying to open database
|
||||
$Server->loginDbServer($dataCon['DBS_USERNAME'], $dataCon['DBS_PASSWORD']);
|
||||
$Server->setDataBase($dataCon['DBS_DATABASE_NAME'], $dataCon['DBS_PORT']);
|
||||
if ($Server->errno == 0) {
|
||||
$response = $Server->tryConnectServer($dataCon['DBS_TYPE']);
|
||||
if ($response->status == 'SUCCESS') {
|
||||
$response = $Server->tryOpenDataBase($dataCon['DBS_TYPE']);
|
||||
if ($response->status != 'SUCCESS') {
|
||||
$resp['message'] = "Error Testting Connection: Trying to open database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
} else {
|
||||
$resp['message'] = "Error Testting Connection: Trying to open database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
} else {
|
||||
$resp['message'] = "Error Testting Connection: Trying to open database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// CORRECT CONNECTION
|
||||
$resp['resp'] = true;
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,14 +67,10 @@ class ProjectUser
|
||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->setDistinct();
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL);
|
||||
$oCriteria->addSelectColumn(\TaskUserPeer::TAS_UID);
|
||||
$oCriteria->addSelectColumn(\TaskUserPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
||||
$oCriteria->addJoin(\TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->addJoin(\TaskUserPeer::TAS_UID, \TaskPeer::TAS_UID, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
|
||||
@@ -89,36 +85,25 @@ class ProjectUser
|
||||
$oCase = new \Cases();
|
||||
$startTasks = $oCase->getStartCases( $aRow['USR_UID'] );
|
||||
foreach ($startTasks as $task) {
|
||||
if ((isset( $task['pro_uid'] )) && ($task['pro_uid'] == $sProcessUID)) {
|
||||
if ((isset( $task['pro_uid'] )) && ($task['pro_uid'] == $sProcessUID) ) {
|
||||
$taskValue = explode( '(', $task['value'] );
|
||||
$tasksLastIndex = count( $taskValue ) - 1;
|
||||
$taskValue = explode( ')', $taskValue[$tasksLastIndex] );
|
||||
//echo "<option value=\"" . $task['uid'] . "\">" . $taskValue[0] . "</option>";
|
||||
echo $task['uid'] ." ------ ".$aUsers." fin ";
|
||||
//var_dump($aUsers);
|
||||
if (in_array($task['uid'], $aUsers)) {
|
||||
echo "Es mac";
|
||||
}
|
||||
|
||||
$aUsers[] = array(/*'usr_uid' => $aRow['USR_UID'],
|
||||
'usr_username' => $aRow['USR_USERNAME'],
|
||||
'usr_firstname' => $aRow['USR_FIRSTNAME'],
|
||||
'usr_lastname' => $aRow['USR_LASTNAME'],*/
|
||||
'tas_name' => $taskValue[0],
|
||||
'tas_uid' => $task['uid']);
|
||||
if (in_array($task['uid'], $aUsers['tas_uid'] )) {
|
||||
echo "Es mac";
|
||||
}
|
||||
echo $task['uid'] . " ";
|
||||
$oDataset->next();
|
||||
$aUsers[] = array('act_name' => $taskValue[0],
|
||||
'act_uid' => $task['uid']);
|
||||
}
|
||||
//$oDataset->next();
|
||||
}
|
||||
//die();
|
||||
$oDataset->next();
|
||||
|
||||
$oDataset->next();
|
||||
}
|
||||
return $aUsers;
|
||||
$new = array();
|
||||
$exclude = array("");
|
||||
for ($i = 0; $i<=count($aUsers)-1; $i++) {
|
||||
if (!in_array(trim($aUsers[$i]["act_uid"]) ,$exclude)) {
|
||||
$new[] = $aUsers[$i];
|
||||
$exclude[] = trim($aUsers[$i]["act_uid"]);
|
||||
}
|
||||
}
|
||||
return $new;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -146,8 +131,8 @@ class ProjectUser
|
||||
$taskValue = explode( '(', $task['value'] );
|
||||
$tasksLastIndex = count( $taskValue ) - 1;
|
||||
$taskValue = explode( ')', $taskValue[$tasksLastIndex] );
|
||||
$aUsers[] = array('tas_uid' => $task['uid'],
|
||||
'tas_name' => $taskValue[0]);
|
||||
$aUsers[] = array('act_uid' => $task['uid'],
|
||||
'act_name' => $taskValue[0]);
|
||||
}
|
||||
}
|
||||
return $aUsers;
|
||||
@@ -156,5 +141,109 @@ class ProjectUser
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the users and users groups to assigned to a process
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
* @param array $oData
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function postProjectWsUserCanStartTask($sProcessUID, $oData)
|
||||
{
|
||||
try {
|
||||
/**
|
||||
* process_webEntryValidate
|
||||
* validates if the username and password are valid data and if the user assigned
|
||||
* to the webentry has the rights and persmissions required
|
||||
*/
|
||||
$sPRO_UID = $sProcessUID;
|
||||
$sTASKS = $oData['act_uid'];
|
||||
$sTASKS_SEL = $oData->TASKS_NAME;
|
||||
$sDYNAFORM = $oData->DYNAFORM;
|
||||
$sWE_TYPE = $oData->WE_TYPE;
|
||||
$sWS_USER = trim( $oData['username'] );
|
||||
$sWS_PASS = trim( $oData['password'] );
|
||||
$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN;
|
||||
$sWE_USR = $oData->WE_USR;
|
||||
if (\G::is_https())
|
||||
$http = 'https://';
|
||||
else
|
||||
$http = 'http://';
|
||||
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
|
||||
@$client = new \SoapClient( $endpoint );
|
||||
$user = $sWS_USER;
|
||||
$pass = $sWS_PASS;
|
||||
$params = array ('userid' => $user,'password' => $pass);
|
||||
$result = $client->__SoapCall('login', array ($params));
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = 'ProcessMaker WebService version: ' . $result->version . "\n" . $result->message;
|
||||
$fields['version'] = $result->version;
|
||||
$fields['time_stamp'] = $result->timestamp;
|
||||
$messageCode = 1;
|
||||
\G::LoadClass( 'Task' );
|
||||
\G::LoadClass( 'User' );
|
||||
\G::LoadClass( 'TaskUser' );
|
||||
\G::LoadClass( 'Groupwf' );
|
||||
/**
|
||||
* note added by gustavo cruz gustavo-at-colosa-dot-com
|
||||
* This is a little check to see if the GroupUser class has been declared or not.
|
||||
* Seems that the problem its present in a windows installation of PM however.
|
||||
* It's seems that could be replicated in a Linux server easily.
|
||||
* I recomend that in some way check already if a imported class is declared
|
||||
* somewhere else or maybe delegate the task to the G Class LoadClass method.
|
||||
*/
|
||||
if (! class_exists( 'GroupUser' )) {
|
||||
\G::LoadClass( 'GroupUser' );
|
||||
}
|
||||
// if the user has been authenticated, then check if has the rights or
|
||||
// permissions to create the webentry
|
||||
if ($result->status_code == 0) {
|
||||
$oCriteria = new \Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( \UsersPeer::USR_UID );
|
||||
$oCriteria->addSelectColumn( \TaskUserPeer::USR_UID );
|
||||
$oCriteria->addSelectColumn( \TaskUserPeer::TAS_UID );
|
||||
$oCriteria->addSelectColumn( \UsersPeer::USR_USERNAME );
|
||||
$oCriteria->addSelectColumn( \UsersPeer::USR_FIRSTNAME );
|
||||
$oCriteria->addSelectColumn( \UsersPeer::USR_LASTNAME );
|
||||
$oCriteria->addJoin( \TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN );
|
||||
$oCriteria->add( \TaskUserPeer::TAS_UID, $sTASKS );
|
||||
$oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER );
|
||||
//$oCriteria->add(TaskUserPeer::TU_RELATION,1);
|
||||
$userIsAssigned = \TaskUserPeer::doCount( $oCriteria );
|
||||
// if the user is not assigned directly, maybe a have the task a group with the user
|
||||
if ($userIsAssigned < 1) {
|
||||
$oCriteria = new \Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( \UsersPeer::USR_UID );
|
||||
$oCriteria->addJoin( \UsersPeer::USR_UID, \GroupUserPeer::USR_UID, \Criteria::LEFT_JOIN );
|
||||
$oCriteria->addJoin( \GroupUserPeer::GRP_UID, \TaskUserPeer::USR_UID, \Criteria::LEFT_JOIN );
|
||||
$oCriteria->add( \TaskUserPeer::TAS_UID, $sTASKS );
|
||||
$oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER );
|
||||
$userIsAssigned = \GroupUserPeer::doCount( $oCriteria );
|
||||
if (! ($userIsAssigned >= 1)) {
|
||||
$messageCode = "The User `" . $sWS_USER . "` doesn't have the activity `" . $sTASKS . "` assigned";
|
||||
}
|
||||
}
|
||||
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$messageCode = array('usr_uid' => $aRow['USR_UID'],
|
||||
'usr_username' => $aRow['USR_USERNAME'],
|
||||
'usr_firstname' => $aRow['USR_FIRSTNAME'],
|
||||
'usr_lastname' => $aRow['USR_LASTNAME']);
|
||||
$oDataset->next();
|
||||
}
|
||||
} else {
|
||||
$messageCode = $result->message;
|
||||
}
|
||||
return $messageCode;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -143,9 +143,7 @@ class Trigger
|
||||
}
|
||||
|
||||
$dataTrigger= (array)$dataTrigger;
|
||||
if (isset($dataTrigger['TRI_TYPE']) && $dataTrigger['TRI_TYPE'] == '') {
|
||||
$dataTrigger['TRI_TYPE'] = 'SCRIPT';
|
||||
}
|
||||
$dataTrigger['TRI_TYPE'] = 'SCRIPT';
|
||||
|
||||
if (isset($dataTrigger['TRI_TITLE'])) {
|
||||
if (!$this->verifyNameTrigger($sProcessUID, $dataTrigger['TRI_TITLE'], $sTriggerUid)) {
|
||||
|
||||
@@ -27,6 +27,7 @@ use \BpmnArtifactPeer as ArtifactPeer;
|
||||
|
||||
use \ProcessMaker\Util\Hash;
|
||||
use \BasePeer;
|
||||
use Symfony\Component\Yaml\Exception\RuntimeException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -37,16 +38,14 @@ use \BasePeer;
|
||||
*/
|
||||
class Model
|
||||
{
|
||||
public function createProject($data)
|
||||
public function createProject($data, $replaceUids = false)
|
||||
{
|
||||
$data = array_change_key_case($data, CASE_UPPER);
|
||||
$uids = array();
|
||||
$oldPrjUid = $data['PRJ_UID'];
|
||||
$diagrams = $data['DIAGRAMS'];
|
||||
$diagrams = array_key_exists('DIAGRAMS', $data) && is_array($data['DIAGRAMS'])
|
||||
&& count($data['DIAGRAMS']) > 0 ? $data['DIAGRAMS'] : null;
|
||||
$mapId = array();
|
||||
|
||||
unset($data['PRJ_UID']);
|
||||
|
||||
/*
|
||||
* 1. Create a project record
|
||||
* 2. Create a default diagram record
|
||||
@@ -55,38 +54,99 @@ class Model
|
||||
|
||||
$project = new Project();
|
||||
$project->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$project->setPrjUid(Hash::generateUID());
|
||||
|
||||
if (array_key_exists('PRJ_UID', $data)) {
|
||||
if ($replaceUids) {
|
||||
$oldPrjUid = $data['PRJ_UID'];
|
||||
$project->setPrjUid(Hash::generateUID());
|
||||
}
|
||||
} else {
|
||||
$project->setPrjUid(Hash::generateUID());
|
||||
}
|
||||
|
||||
$project->setPrjCreateDate(date("Y-m-d H:i:s"));
|
||||
$project->save();
|
||||
$prjUid = $project->getPrjUid();
|
||||
$prjName = $project->getPrjName();
|
||||
$uids[] = array('old_uid' => $oldPrjUid, 'new_uid' => $prjUid, 'object' => 'project');
|
||||
$mapId['project'][$oldPrjUid] = $prjUid;
|
||||
|
||||
// By now, is thought create only one diagram for each project (1:1)
|
||||
$diagramData = (array) $diagrams[0];
|
||||
$oldDiaUid = $diagramData['dia_uid'];
|
||||
if ($replaceUids) {
|
||||
$uids[] = array('old_uid' => $oldPrjUid, 'new_uid' => $prjUid, 'object' => 'project');
|
||||
$mapId['project'][$oldPrjUid] = $prjUid;
|
||||
}
|
||||
|
||||
if (! isset($diagrams)) {
|
||||
if ($replaceUids) {
|
||||
return $uids;
|
||||
} else {
|
||||
return self::loadProject($prjUid);
|
||||
}
|
||||
}
|
||||
|
||||
$diagram = new Diagram();
|
||||
$diagram->setDiaUid(Hash::generateUID());
|
||||
|
||||
if (isset($diagrams) && array_key_exists('dia_uid', $diagrams[0])) {
|
||||
if ($replaceUids) {
|
||||
$oldDiaUid = $diagrams[0]['dia_uid'];
|
||||
$diagram->setDiaUid(Hash::generateUID());
|
||||
} else {
|
||||
$diagram->setDiaUid($diagrams[0]['dia_uid']);
|
||||
}
|
||||
} else {
|
||||
$diagram->setDiaUid(Hash::generateUID());
|
||||
}
|
||||
|
||||
$diagram->setPrjUid($prjUid);
|
||||
$diagram->setDiaName($prjName);
|
||||
$diagram->save();
|
||||
$diaUid = $diagram->getDiaUid();
|
||||
$uids[] = array('old_uid' => $oldDiaUid, 'new_uid' => $diaUid, 'object' => 'diagram');
|
||||
$mapId['diagram'][$oldDiaUid] = $diaUid;
|
||||
|
||||
if ($replaceUids) {
|
||||
$uids[] = array('old_uid' => $oldDiaUid, 'new_uid' => $diaUid, 'object' => 'diagram');
|
||||
$mapId['diagram'][$oldDiaUid] = $diaUid;
|
||||
}
|
||||
|
||||
$process = new Process();
|
||||
$process->setProUid(Hash::generateUID());
|
||||
|
||||
if (isset($diagrams) && array_key_exists('pro_uid', $diagrams[0])) {
|
||||
if ($replaceUids) {
|
||||
$oldProUid = $data['pro_uid'];
|
||||
$process->setProUid(Hash::generateUID());
|
||||
} else {
|
||||
$process->setProUid($diagrams[0]['pro_uid']);
|
||||
}
|
||||
} else {
|
||||
$process->setProUid(Hash::generateUID());
|
||||
}
|
||||
|
||||
$process->setPrjUid($prjUid);
|
||||
$process->setDiaUid($diaUid);
|
||||
$process->setProName($prjName);
|
||||
$process->save();
|
||||
$proUid = $process->getProUid();
|
||||
|
||||
$uids = array_merge($uids, $this->createDiagram($prjUid, $proUid, $diaUid, $diagramData));
|
||||
if ($replaceUids) {
|
||||
$uids[] = array('old_uid' => $oldProUid, 'new_uid' => $proUid, 'object' => 'project');
|
||||
$mapId['process'][$oldProUid] = $proUid;
|
||||
}
|
||||
|
||||
return $uids;
|
||||
|
||||
if (isset($diagrams)) {
|
||||
// By now, is thought create only one diagram for each project (1:1)
|
||||
$diagramData = (array) $diagrams[0];
|
||||
|
||||
// there is not a defined diagram to save
|
||||
$diagramUids = $this->createDiagram($prjUid, $proUid, $diaUid, $diagramData, $replaceUids);
|
||||
|
||||
if ($replaceUids) {
|
||||
$uids = array_merge($uids, $diagramUids);
|
||||
}
|
||||
}
|
||||
|
||||
if ($replaceUids) {
|
||||
return $uids;
|
||||
} else {
|
||||
return self::loadProject($prjUid);
|
||||
}
|
||||
}
|
||||
|
||||
private function createDiagram($prjUid, $proUid, $diaUid, $diagramData)
|
||||
@@ -311,47 +371,55 @@ class Model
|
||||
$project = self::getBpmnObjectBy('Project', ProjectPeer::PRJ_UID, $prjUid, true);
|
||||
$process = self::getBpmnObjectBy('Process', ProcessPeer::PRJ_UID, $prjUid, true);
|
||||
$diagram = self::getBpmnObjectBy('Diagram', DiagramPeer::DIA_UID, $process['dia_uid'], true);
|
||||
$lanesets = self::getBpmnCollectionBy('Laneset', LanesetPeer::PRJ_UID, $prjUid, true);
|
||||
$lanes = self::getBpmnCollectionBy('Lane', LanePeer::PRJ_UID, $prjUid, true);
|
||||
$activities = self::getBpmnCollectionBy('Activity', ActivityPeer::PRJ_UID, $prjUid, true);
|
||||
$events = self::getBpmnCollectionBy('Event', EventPeer::PRJ_UID, $prjUid, true);
|
||||
$gateways = self::getBpmnCollectionBy('Gateway', GatewayPeer::PRJ_UID, $prjUid, true);
|
||||
$flows = self::getBpmnCollectionBy('Flow', FlowPeer::PRJ_UID, $prjUid, true);
|
||||
$artifacts = self::getBpmnCollectionBy('Artifact', ArtifactPeer::PRJ_UID, $prjUid, true);
|
||||
|
||||
// getting activity bound data
|
||||
foreach ($activities as $i => $activity) {
|
||||
$activities[$i] = array_merge(
|
||||
$activities[$i],
|
||||
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $activity['act_uid'], true)
|
||||
);
|
||||
}
|
||||
|
||||
// getting event bound data
|
||||
foreach ($events as $i => $event) {
|
||||
$events[$i] = array_merge(
|
||||
$events[$i],
|
||||
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $event['evn_uid'], true)
|
||||
);
|
||||
}
|
||||
|
||||
// getting gateway bound data
|
||||
foreach ($gateways as $i => $gateway) {
|
||||
$gateways[$i] = array_merge(
|
||||
$gateways[$i],
|
||||
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $gateway['gat_uid'], true)
|
||||
);
|
||||
}
|
||||
|
||||
$project = array_change_key_case($project);
|
||||
$project['diagrams'] = array($diagram);
|
||||
$project['diagrams'][0]['laneset'] = $lanesets;
|
||||
$project['diagrams'][0]['lanes'] = $lanes;
|
||||
$project['diagrams'][0]['activities'] = $activities;
|
||||
$project['diagrams'][0]['events'] = $events;
|
||||
$project['diagrams'][0]['gateways'] = $gateways;
|
||||
$project['diagrams'][0]['flows'] = $flows;
|
||||
$project['diagrams'][0]['artifacts'] = $artifacts;
|
||||
|
||||
if (! empty($diagram)) {
|
||||
$lanesets = self::getBpmnCollectionBy('Laneset', LanesetPeer::PRJ_UID, $prjUid, true);
|
||||
$lanes = self::getBpmnCollectionBy('Lane', LanePeer::PRJ_UID, $prjUid, true);
|
||||
$activities = self::getBpmnCollectionBy('Activity', ActivityPeer::PRJ_UID, $prjUid, true);
|
||||
$events = self::getBpmnCollectionBy('Event', EventPeer::PRJ_UID, $prjUid, true);
|
||||
$gateways = self::getBpmnCollectionBy('Gateway', GatewayPeer::PRJ_UID, $prjUid, true);
|
||||
$flows = self::getBpmnCollectionBy('Flow', FlowPeer::PRJ_UID, $prjUid, true);
|
||||
$artifacts = self::getBpmnCollectionBy('Artifact', ArtifactPeer::PRJ_UID, $prjUid, true);
|
||||
|
||||
// getting activity bound data
|
||||
foreach ($activities as $i => $activity) {
|
||||
$bound = self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $activity['act_uid'], true);
|
||||
|
||||
if (is_object($bound)) {
|
||||
$activities[$i] = array_merge($activities[$i], $bound);
|
||||
}
|
||||
}
|
||||
|
||||
// getting event bound data
|
||||
foreach ($events as $i => $event) {
|
||||
$bound = self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $event['evn_uid'], true);
|
||||
|
||||
if (is_object($bound)) {
|
||||
$events[$i] = array_merge($events[$i], $bound);
|
||||
}
|
||||
}
|
||||
|
||||
// getting gateway bound data
|
||||
foreach ($gateways as $i => $gateway) {
|
||||
$bound = self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $gateway['gat_uid'], true);
|
||||
|
||||
if (is_object($bound)) {
|
||||
$gateways[$i] = array_merge($gateways[$i], $bound);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$project['diagrams'] = array($diagram);
|
||||
$project['diagrams'][0]['laneset'] = $lanesets;
|
||||
$project['diagrams'][0]['lanes'] = $lanes;
|
||||
$project['diagrams'][0]['activities'] = $activities;
|
||||
$project['diagrams'][0]['events'] = $events;
|
||||
$project['diagrams'][0]['gateways'] = $gateways;
|
||||
$project['diagrams'][0]['flows'] = $flows;
|
||||
$project['diagrams'][0]['artifacts'] = $artifacts;
|
||||
}
|
||||
|
||||
return $project;
|
||||
}
|
||||
@@ -384,6 +452,11 @@ class Model
|
||||
//print_r($diagramData); die;
|
||||
|
||||
$diagram = DiagramPeer::retrieveByPK($diagramData['dia_uid']);
|
||||
|
||||
if (! is_object($diagram)) {
|
||||
throw new \RuntimeException("Related Diagram with id: {$diagramData['dia_uid']}, does not exist!");
|
||||
}
|
||||
|
||||
$diagram->setDiaName($diagramData['dia_name']);
|
||||
|
||||
if (!empty($diagramData['dia_is_closable'])) {
|
||||
@@ -406,17 +479,17 @@ class Model
|
||||
$savedProject = self::loadProject($prjUid);
|
||||
$diff = self::getDiffFromProjects($savedProject, $projectUpdated);
|
||||
|
||||
self::updateDiagram($diff);
|
||||
self::updateDiagram($prjUid, $process->getProUid(), $diff);
|
||||
}
|
||||
|
||||
public static function updateDiagram($diff)
|
||||
public static function updateDiagram($prjUid, $proUid, $diff)
|
||||
{
|
||||
echo 'DIFF'.PHP_EOL; print_r($diff);
|
||||
|
||||
//return false;
|
||||
$mapId = array();
|
||||
|
||||
// updating objects
|
||||
// Updating objects
|
||||
foreach ($diff['updated'] as $element => $items) {
|
||||
foreach ($items as $data) {
|
||||
$data = array_change_key_case((array) $data, CASE_UPPER);
|
||||
@@ -460,34 +533,87 @@ class Model
|
||||
}
|
||||
}
|
||||
|
||||
die;
|
||||
|
||||
// Creating new objects
|
||||
// Creating new records
|
||||
foreach ($diff['new'] as $element => $items) {
|
||||
foreach ($items as $data) {
|
||||
print_r($data); die;
|
||||
$data = array_change_key_case((array) $data, CASE_UPPER);
|
||||
|
||||
switch ($element) {
|
||||
case 'laneset':
|
||||
$lanesetData = array_change_key_case((array) $data, CASE_UPPER);
|
||||
break;
|
||||
|
||||
$laneset = new Laneset();
|
||||
$laneset->fromArray($lanesetData, BasePeer::TYPE_FIELDNAME);
|
||||
$laneset->setLnsUid(Hash::generateUID());
|
||||
$laneset->setPrjUid($prjUid);
|
||||
$laneset->setProUid($proUid);
|
||||
$laneset->save();
|
||||
$lnsUid = $laneset->getLnsUid();
|
||||
$oldLnsUid = $lanesetData['LNS_UID'];
|
||||
case 'lanes':
|
||||
break;
|
||||
|
||||
$uids[] = array('old_uid' => $oldLnsUid, 'new_uid' => $lnsUid, 'object' => 'laneset');
|
||||
$mapId['laneset'][$oldLnsUid] = $lnsUid;
|
||||
case 'activities':
|
||||
$uidData = array('old_uid' => $data['ACT_UID'], 'object' => 'Activity');
|
||||
|
||||
$activity = new Activity();
|
||||
$activity->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$activity->setActUid(Hash::generateUID());
|
||||
$activity->setPrjUid($prjUid);
|
||||
$activity->setProUid($proUid);
|
||||
$activity->getBound()->setBouUid(Hash::generateUID());
|
||||
$activity->save();
|
||||
|
||||
$uidData['new_uid'] = $activity->getActUid();
|
||||
$uids[] = $uidData;
|
||||
break;
|
||||
|
||||
case 'events':
|
||||
|
||||
break;
|
||||
|
||||
case 'gateways':
|
||||
|
||||
break;
|
||||
|
||||
case 'flows':
|
||||
break;
|
||||
|
||||
case 'artifacts':
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Creating new records
|
||||
foreach ($diff['deleted'] as $element => $items) {
|
||||
foreach ($items as $uid) {
|
||||
$data = array_change_key_case((array) $data, CASE_UPPER);
|
||||
|
||||
switch ($element) {
|
||||
case 'laneset':
|
||||
break;
|
||||
|
||||
case 'lanes':
|
||||
break;
|
||||
|
||||
case 'activities':
|
||||
$activity = ActivityPeer::retrieveByPK($uid);
|
||||
$activity->delete();
|
||||
|
||||
$uidData['new_uid'] = $activity->getActUid();
|
||||
$uids[] = $uidData;
|
||||
break;
|
||||
|
||||
case 'events':
|
||||
|
||||
break;
|
||||
|
||||
case 'gateways':
|
||||
|
||||
break;
|
||||
|
||||
case 'flows':
|
||||
break;
|
||||
|
||||
case 'artifacts':
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$activity = ActivityPeer::retrieveByPK($item);
|
||||
}
|
||||
|
||||
public static function getDiffFromProjects($savedProject, $updatedProject)
|
||||
@@ -504,11 +630,16 @@ class Model
|
||||
|
||||
// Getting Differences
|
||||
$newRecords = array();
|
||||
$newRecordsUids = array();
|
||||
$deletedRecords = array();
|
||||
$updatedRecords = array();
|
||||
|
||||
// Get new records
|
||||
foreach ($diagramElements as $key => $element) {
|
||||
if (! array_key_exists($element, $updatedProject['diagrams'][0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$arrayDiff = self::arrayDiff(
|
||||
$savedProject['diagrams'][0][$element],
|
||||
$updatedProject['diagrams'][0][$element],
|
||||
@@ -516,12 +647,22 @@ class Model
|
||||
);
|
||||
|
||||
if (! empty($arrayDiff)) {
|
||||
$newRecords[$element] = $arrayDiff;
|
||||
$newRecordsUids[$element] = $arrayDiff;
|
||||
|
||||
foreach ($updatedProject['diagrams'][0][$element] as $item) {
|
||||
if (in_array($item[$key], $newRecordsUids[$element])) {
|
||||
$newRecords[$element][] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get deleted records
|
||||
foreach ($diagramElements as $key => $element) {
|
||||
if (! array_key_exists($element, $updatedProject['diagrams'][0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$arrayDiff = self::arrayDiff(
|
||||
$updatedProject['diagrams'][0][$element],
|
||||
$savedProject['diagrams'][0][$element],
|
||||
@@ -541,8 +682,14 @@ class Model
|
||||
|
||||
|
||||
foreach ($diagramElements as $key => $element) {
|
||||
if (! array_key_exists($element, $updatedProject['diagrams'][0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($updatedProject['diagrams'][0][$element] as $item) {
|
||||
if (array_key_exists($element, $newRecords) && (in_array($item[$key], $newRecords[$element]) || in_array($item[$key], $deletedRecords[$element]))) {
|
||||
if ((array_key_exists($element, $newRecordsUids) && in_array($item[$key], $newRecordsUids[$element])) ||
|
||||
(array_key_exists($element, $deletedRecords) && in_array($item[$key], $deletedRecords[$element]))
|
||||
) {
|
||||
// skip new or deleted records
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -33,18 +33,31 @@ class Project extends Api
|
||||
function post($request_data)
|
||||
{
|
||||
try {
|
||||
$bpmnModel = new BpmnModel();
|
||||
$uids = $bpmnModel->createProject($request_data);
|
||||
$config = array();
|
||||
$config['project'] = array('replace_uids' => true);
|
||||
|
||||
$wfProcess = Workflow::loadFromBpmnProject($uids[0]['new_uid']);
|
||||
$bpmnModel = new BpmnModel();
|
||||
$result = $bpmnModel->createProject($request_data, $config['project']['replace_uids']);
|
||||
|
||||
if (array_key_exists('prj_uid', $result)) {
|
||||
$prjUid = $result['prj_uid'];
|
||||
} else {
|
||||
$prjUid = $result[0]['new_uid'];
|
||||
}
|
||||
|
||||
$wfProcess = Workflow::loadFromBpmnProject($prjUid);
|
||||
|
||||
$process = new \BusinessModel\Process();
|
||||
$userUid = $this->getUserId();
|
||||
$data = array('process' => $wfProcess);
|
||||
|
||||
$process->createProcess($userUid, $data);
|
||||
|
||||
return $uids;
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
// TODO in case that $process->createProcess($userUid, $data); fails maybe the BPMN project was created successfully
|
||||
// so, we need remove it or change the creation order.
|
||||
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\DataBaseConnection Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class DataBaseConnection extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:projectUid/database-connections
|
||||
*/
|
||||
public function doGetDataBaseConnections($projectUid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->getDataBaseConnections($projectUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $dbConnecionUid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:projectUid/database-connection/:dbConnecionUid
|
||||
*/
|
||||
public function doGetDataBaseConnection($projectUid, $dbConnecionUid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->getDataBaseConnection($projectUid, $dbConnecionUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body}
|
||||
* @param string $dbs_server {@from body}
|
||||
* @param string $dbs_database_name {@from body}
|
||||
* @param string $dbs_username {@from body}
|
||||
* @param string $dbs_port {@from body}
|
||||
* @param string $dbs_encode {@from body}
|
||||
* @param string $dbs_password {@from body}
|
||||
* @param string $dbs_description {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:projectUid/database-connection
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostDataBaseConnection($projectUid, $request_data, $dbs_type, $dbs_server,
|
||||
$dbs_database_name, $dbs_username, $dbs_port, $dbs_encode, $dbs_password = '', $dbs_description = '')
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->saveDataBaseConnection($projectUid, $request_data, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $dbConnecionUid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body}
|
||||
* @param string $dbs_server {@from body}
|
||||
* @param string $dbs_database_name {@from body}
|
||||
* @param string $dbs_username {@from body}
|
||||
* @param string $dbs_port {@from body}
|
||||
* @param string $dbs_encode {@from body}
|
||||
* @param string $dbs_password {@from body}
|
||||
* @param string $dbs_description {@from body}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:projectUid/database-connection/:dbConnecionUid
|
||||
*/
|
||||
public function doPutDataBaseConnection($projectUid, $dbConnecionUid, $request_data, $dbs_type, $dbs_server,
|
||||
$dbs_database_name, $dbs_username, $dbs_port, $dbs_encode, $dbs_password = '', $dbs_description = '')
|
||||
{
|
||||
try {
|
||||
$request_data['dbs_uid'] = $dbConnecionUid;
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->saveDataBaseConnection($projectUid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $dbConnecionUid {@min 1} {@max 32}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:projectUid/database-connection/:dbConnecionUid
|
||||
*/
|
||||
public function doDeleteDataBaseConnection($projectUid, $dbConnecionUid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->deleteDataBaseConnection($projectUid, $dbConnecionUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Activity\Step\Event Api Controller
|
||||
* Project\Event Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
@@ -104,10 +104,23 @@ class Event extends Api
|
||||
* @url POST /:projectUid/event
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostEvent($projectUid, $request_data, $evn_description, $evn_status, $evn_action,
|
||||
$evn_related_to, $tas_uid, $evn_tas_uid_from, $evn_tas_estimated_duration,
|
||||
$evn_time_unit, $evn_when, $evn_when_occurs, $tri_uid, $evn_tas_uid_to = '', $evn_conditions = '')
|
||||
{
|
||||
public function doPostEvent(
|
||||
$projectUid,
|
||||
$request_data,
|
||||
$evn_description,
|
||||
$evn_status,
|
||||
$evn_action,
|
||||
$evn_related_to,
|
||||
$tas_uid,
|
||||
$evn_tas_uid_from,
|
||||
$evn_tas_estimated_duration,
|
||||
$evn_time_unit,
|
||||
$evn_when,
|
||||
$evn_when_occurs,
|
||||
$tri_uid,
|
||||
$evn_tas_uid_to = '',
|
||||
$evn_conditions = ''
|
||||
) {
|
||||
try {
|
||||
$hiddenFields = array('pro_uid', 'evn_action_parameters',
|
||||
'evn_posx', 'evn_posy', 'evn_type', 'tas_evn_uid', 'evn_max_attempts'
|
||||
@@ -151,13 +164,33 @@ class Event extends Api
|
||||
*
|
||||
* @url PUT /:projectUid/event/:eventUid
|
||||
*/
|
||||
public function doPutEvent ($projectUid, $eventUid, $request_data, $evn_description, $evn_status, $evn_action,
|
||||
$evn_related_to, $tas_uid, $evn_tas_uid_from, $evn_tas_estimated_duration,
|
||||
$evn_time_unit, $evn_when, $evn_when_occurs, $tri_uid, $evn_tas_uid_to = '', $evn_conditions = '')
|
||||
{
|
||||
public function doPutEvent (
|
||||
$projectUid,
|
||||
$eventUid,
|
||||
$request_data,
|
||||
$evn_description,
|
||||
$evn_status,
|
||||
$evn_action,
|
||||
$evn_related_to,
|
||||
$tas_uid,
|
||||
$evn_tas_uid_from,
|
||||
$evn_tas_estimated_duration,
|
||||
$evn_time_unit,
|
||||
$evn_when,
|
||||
$evn_when_occurs,
|
||||
$tri_uid,
|
||||
$evn_tas_uid_to = '',
|
||||
$evn_conditions = ''
|
||||
) {
|
||||
try {
|
||||
$hiddenFields = array('pro_uid', 'evn_action_parameters',
|
||||
'evn_posx', 'evn_posy', 'evn_type', 'tas_evn_uid', 'evn_max_attempts'
|
||||
$hiddenFields = array(
|
||||
'pro_uid',
|
||||
'evn_action_parameters',
|
||||
'evn_posx',
|
||||
'evn_posy',
|
||||
'evn_type',
|
||||
'tas_evn_uid',
|
||||
'evn_max_attempts'
|
||||
);
|
||||
$request_data['evn_uid'] = $eventUid;
|
||||
$event = new \BusinessModel\Event();
|
||||
|
||||
@@ -5,7 +5,7 @@ use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Activity\Step\ProcessPermissions Api Controller
|
||||
* Project\ProcessPermissions Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
|
||||
@@ -69,7 +69,42 @@ class ProjectUsers extends Api
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param wsUserCanStartTaskStructure $request_data
|
||||
*
|
||||
* @url POST /:prjUid/ws/user/can-start-task
|
||||
*/
|
||||
public function doGetProjectWsUserCanStartTask($prjUid, wsUserCanStartTaskStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$user = new \BusinessModel\ProjectUser();
|
||||
$objectData = $user->postProjectWsUserCanStartTask($prjUid, $request_data);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class wsUserCanStartTaskStructure
|
||||
{ /**
|
||||
* @var string {@from body} {@min 32} {@max 32}
|
||||
*/
|
||||
public $act_uid;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $username;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $password;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Activity\Step\Trigger Api Controller
|
||||
* Project\Trigger Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
@@ -59,7 +59,7 @@ class Trigger extends Api
|
||||
* @param array $request_data
|
||||
* @param string $tri_title {@from body} {@min 1}
|
||||
* @param string $tri_description {@from body}
|
||||
* @param string $tri_type {@from body} {@choice SCRIPT}
|
||||
* @param string $tri_type {@from body}
|
||||
* @param string $tri_webbot {@from body}
|
||||
* @param string $tri_param {@from body}
|
||||
* @return array
|
||||
@@ -87,7 +87,7 @@ class Trigger extends Api
|
||||
* @param array $request_data
|
||||
* @param string $tri_title {@from body}
|
||||
* @param string $tri_description {@from body}
|
||||
* @param string $tri_type {@from body} {@choice SCRIPT}
|
||||
* @param string $tri_type {@from body}
|
||||
* @param string $tri_webbot {@from body}
|
||||
* @param string $tri_param {@from body}
|
||||
* @return void
|
||||
|
||||
@@ -30,6 +30,7 @@ debug = 1
|
||||
case-tracker-object = "Services\Api\ProcessMaker\Project\CaseTrackerObject"
|
||||
project-users = "Services\Api\ProcessMaker\Project\ProjectUsers"
|
||||
web-entry = "Services\Api\ProcessMaker\Project\WebEntry"
|
||||
data-base-connections = "Services\Api\ProcessMaker\Project\DataBaseConnection"
|
||||
|
||||
[alias: projects]
|
||||
project = "Services\Api\ProcessMaker\Project"
|
||||
|
||||
@@ -274,7 +274,7 @@
|
||||
} else {
|
||||
var selectId = "form[TASKS]["+optionSelect+"][USR_UID]";
|
||||
|
||||
if (typeof(document.getElementById(selectId)) != 'undefined' && document.getElementById(selectId) != null && userHidden == '') {
|
||||
if (typeof(document.getElementById(selectId)) != 'undefined' && document.getElementById(selectId) != null && (rouType == 'SELECT' || userHidden == '')) {
|
||||
var vtext = new input(document.getElementById(selectId));
|
||||
|
||||
// verify value select the option select
|
||||
|
||||
@@ -60,7 +60,8 @@ Ext.onReady(function(){
|
||||
{name : 'CASES_COUNT_DRAFT', type:'float'},
|
||||
{name : 'CASES_COUNT_TO_DO', type:'float'},
|
||||
{name : 'CASES_COUNT_COMPLETED', type:'float'},
|
||||
{name : 'CASES_COUNT_CANCELLED', type:'float'}
|
||||
{name : 'CASES_COUNT_CANCELLED', type:'float'},
|
||||
{name : 'PROJECT_TYPE', type:'string'}
|
||||
]
|
||||
}),
|
||||
|
||||
@@ -197,7 +198,13 @@ Ext.onReady(function(){
|
||||
{id:'PRO_UID', dataIndex: 'PRO_UID', hidden:true, hideable:false},
|
||||
{header: "", dataIndex: 'PRO_STATUS', width: 50, hidden:true, hideable:false},
|
||||
{header: _('ID_PRO_DESCRIPTION'), dataIndex: 'PRO_DESCRIPTION',hidden:true, hideable:false},
|
||||
{header: _('ID_PRO_TITLE'), dataIndex: 'PRO_TITLE', width: 300},
|
||||
{header: _('ID_PRO_TITLE'), dataIndex: 'PRO_TITLE', width: 300, renderer:function(v,p,r){
|
||||
// TODO Labels for var 'type' are hardcoded, they must be replaced on the future
|
||||
var color = r.get('PROJECT_TYPE') == 'bpmn'? 'green': 'blue';
|
||||
var type = r.get('PROJECT_TYPE') == 'bpmn'? ' (BPMN Project)': '';
|
||||
return v + ' ' + String.format("<font color='{0}'>{1}</font>", color, type);
|
||||
}},
|
||||
{header: _('ID_TYPE'), dataIndex: 'PROJECT_TYPE', width: 60, hidden:false},
|
||||
{header: _('ID_CATEGORY'), dataIndex: 'PRO_CATEGORY_LABEL', width: 100, hidden:false},
|
||||
{header: _('ID_STATUS'), dataIndex: 'PRO_STATUS_LABEL', width: 50, renderer:function(v,p,r){
|
||||
color = r.get('PRO_STATUS') == 'ACTIVE'? 'green': 'red';
|
||||
@@ -215,24 +222,52 @@ Ext.onReady(function(){
|
||||
}),
|
||||
store: store,
|
||||
tbar:[
|
||||
{
|
||||
xtype: 'tbsplit',
|
||||
text: _('ID_NEW'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||
menu: [
|
||||
{
|
||||
text: "New Project",
|
||||
iconCls: 'silk-add',
|
||||
icon: '',
|
||||
handler: function () {
|
||||
newProcess({type:"classicProject"});
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "New BPMN Project",
|
||||
iconCls: 'silk-add',
|
||||
icon: '',
|
||||
handler: function () {
|
||||
newProcess({type:"bpmnProject"});
|
||||
}
|
||||
}
|
||||
],
|
||||
listeners: {
|
||||
"click": function (obj, e) {
|
||||
obj.showMenu();
|
||||
}
|
||||
}
|
||||
},/*
|
||||
{
|
||||
text: _('ID_NEW'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||
//icon: '/images/addc.png',
|
||||
handler: newProcess
|
||||
},
|
||||
},*/
|
||||
'-'
|
||||
,{
|
||||
text: _('ID_EDIT'),
|
||||
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
||||
//icon: '/images/edit.gif',
|
||||
handler: editProcess
|
||||
},{
|
||||
},/*{
|
||||
text: 'Edit (New Editor)',
|
||||
iconCls: 'button_menu_ext',
|
||||
icon: '/images/pencil_beta.png',
|
||||
handler: editNewProcess
|
||||
},{
|
||||
},*/{
|
||||
text: _('ID_STATUS'),
|
||||
id:'activator',
|
||||
icon: '',
|
||||
@@ -412,8 +447,14 @@ Ext.onReady(function(){
|
||||
});
|
||||
|
||||
|
||||
function newProcess(){
|
||||
// window.location = 'processes_New';
|
||||
function newProcess(params)
|
||||
{
|
||||
params = typeof params == 'undefined' ? {type:'classicProject'} : params;
|
||||
|
||||
// TODO this variable have hardcoded labels, it must be changed on the future
|
||||
var formTitle = params.type == "classicProject" ? "New Project" : "New BPMN Project"
|
||||
|
||||
// window.location = 'processes_New';
|
||||
var ProcessCategories = new Ext.form.ComboBox({
|
||||
fieldLabel : _('ID_CATEGORY'),
|
||||
hiddenName : 'PRO_CATEGORY',
|
||||
@@ -445,7 +486,6 @@ function newProcess(){
|
||||
ProcessCategories.setValue(store.getAt(0).get('CATEGORY_UID'));
|
||||
});
|
||||
|
||||
|
||||
var frm = new Ext.FormPanel( {
|
||||
id: 'newProcessForm',
|
||||
labelAlign : 'right',
|
||||
@@ -487,27 +527,35 @@ function newProcess(){
|
||||
});
|
||||
|
||||
var win = new Ext.Window({
|
||||
title: _('ID_CREATE_PROCESS'),
|
||||
id: 'newProjectWin',
|
||||
title: formTitle, //_('ID_CREATE_PROCESS'),
|
||||
width: 470,
|
||||
height: 220,
|
||||
layout:'fit',
|
||||
autoScroll:true,
|
||||
modal: true,
|
||||
maximizable: false,
|
||||
items: [frm]
|
||||
items: [frm],
|
||||
_projectType: params.type
|
||||
});
|
||||
win.show();
|
||||
}
|
||||
|
||||
function saveProcess()
|
||||
{
|
||||
var projectType = Ext.getCmp('newProjectWin')._projectType;
|
||||
|
||||
Ext.getCmp('newProcessForm').getForm().submit( {
|
||||
url : '../processProxy/saveProcess',
|
||||
url : '../processProxy/saveProcess?type=' + projectType,
|
||||
waitMsg : _('ID_SAVING_PROCESS'),
|
||||
waitTitle : " ",
|
||||
timeout : 36000,
|
||||
success : function(obj, resp) {
|
||||
location.href = 'processes_Map?PRO_UID='+resp.result.PRO_UID;
|
||||
if (projectType == 'classicProject') {
|
||||
location.href = 'processes_Map?PRO_UID='+resp.result.PRO_UID;
|
||||
} else {
|
||||
location.href = '../designer?pro_uid='+resp.result.PRO_UID;
|
||||
}
|
||||
},
|
||||
failure: function(obj, resp) {
|
||||
PMExt.error( _('ID_ERROR'), resp.result.msg);
|
||||
@@ -527,7 +575,8 @@ function doSearch(){
|
||||
editProcess = function(){
|
||||
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
||||
if( rowSelected ) {
|
||||
location.href = 'processes_Map?PRO_UID='+rowSelected.data.PRO_UID+'&rand='+Math.random()
|
||||
//location.href = 'processes_Map?PRO_UID='+rowSelected.data.PRO_UID+'&rand='+Math.random()
|
||||
location.href = 'openDesigner?pro_uid='+rowSelected.data.PRO_UID+'&rand='+Math.random()
|
||||
} else {
|
||||
Ext.Msg.show({
|
||||
title:'',
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}"></td>
|
||||
<td>{$form.SEND_EMAIL}</td>
|
||||
<td>{$form.SEND_EMAIL} {$SEND_EMAIL}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$TAS_DEF_SUBJECT_MESSAGE}</td>
|
||||
|
||||
Reference in New Issue
Block a user