diff --git a/build-vendor.php b/build-vendor.php index 571ff564c..bace7563b 100644 --- a/build-vendor.php +++ b/build-vendor.php @@ -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/", ); diff --git a/composer.json b/composer.json index d130d09fa..62eb78069 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/features/backend/database_connections/database_connections.feature b/features/backend/database_connections/database_connections.feature new file mode 100644 index 000000000..f6b895eb9 --- /dev/null +++ b/features/backend/database_connections/database_connections.feature @@ -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 \ No newline at end of file diff --git a/features/backend/output_documents_resources/main_tests.feature b/features/backend/output_documents_resources/main_tests.feature index ad3e67c0f..e00c39f62 100644 --- a/features/backend/output_documents_resources/main_tests.feature +++ b/features/backend/output_documents_resources/main_tests.feature @@ -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 diff --git a/features/backend/project_property_assignee_resources/activity_assignee.feature b/features/backend/project_property_assignee_resources/activity_assignee.feature index 28ec9b60b..2ffdea31d 100644 --- a/features/backend/project_property_assignee_resources/activity_assignee.feature +++ b/features/backend/project_property_assignee_resources/activity_assignee.feature @@ -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//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 And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + 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//activity//available-assignee?filter=&start=&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 And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + 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//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//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 And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + 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//activity//assignee?filter=" @@ -80,12 +84,13 @@ Scenario Outline: List assignees of an activity using a filter And the response has record And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + 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//activity//assignee/" 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 "" And the "aas_username" property equals "" And the "aas_type" property equals "" - + 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//activity//assignee/" 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 - \ No newline at end of file + diff --git a/features/backend/project_property_assignee_resources/negative_tests.feature b/features/backend/project_property_assignee_resources/negative_tests.feature index 725c91d60..84fb84235 100644 --- a/features/backend/project_property_assignee_resources/negative_tests.feature +++ b/features/backend/project_property_assignee_resources/negative_tests.feature @@ -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//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": "", - "ass_type": "" + "ass_uid": "", + "ass_type": "" } """ And I request "project//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=&start=&limit=" + Then the response status code should be + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "" + And the response has 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| + + diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index dcf4dc1f9..72280d612 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -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 } - - + + } diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 38f2de768..a3524d364 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -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 ); diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index d08f57f43..54e830d8c 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -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 = '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' ); diff --git a/workflow/engine/bin/cron.php b/workflow/engine/bin/cron.php index ec985c7a2..e9eb0eca7 100755 --- a/workflow/engine/bin/cron.php +++ b/workflow/engine/bin/cron.php @@ -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' ) ? '\\' : '/'); diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index 5d5ea8312..928eb67a0 100755 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -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, diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 0aa369cd9..0491ab691 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -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; + } + } } } \ No newline at end of file diff --git a/workflow/engine/classes/class.dynaformEditor.php b/workflow/engine/classes/class.dynaformEditor.php index d084fd112..4a41d8837 100755 --- a/workflow/engine/classes/class.dynaformEditor.php +++ b/workflow/engine/classes/class.dynaformEditor.php @@ -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 diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 21499df7a..3ef625110 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -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 * diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index d3fcd2eae..478172cd9 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -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"; diff --git a/workflow/engine/classes/model/BpmnActivity.php b/workflow/engine/classes/model/BpmnActivity.php index 8063107a8..770f30873 100644 --- a/workflow/engine/classes/model/BpmnActivity.php +++ b/workflow/engine/classes/model/BpmnActivity.php @@ -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); diff --git a/workflow/engine/classes/model/Event.php b/workflow/engine/classes/model/Event.php index 630463ff5..e06b8febb 100755 --- a/workflow/engine/classes/model/Event.php +++ b/workflow/engine/classes/model/Event.php @@ -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', '' ); $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') { diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 5c0b0c2e1..e2061789b 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -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); diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index b43b75062..0e791007e 100755 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -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; diff --git a/workflow/engine/controllers/appProxy.php b/workflow/engine/controllers/appProxy.php index b9e985a8a..59bd6fff6 100644 --- a/workflow/engine/controllers/appProxy.php +++ b/workflow/engine/controllers/appProxy.php @@ -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); diff --git a/workflow/engine/controllers/processProxy.php b/workflow/engine/controllers/processProxy.php index 734667724..eff94ca87 100755 --- a/workflow/engine/controllers/processProxy.php +++ b/workflow/engine/controllers/processProxy.php @@ -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 - } /** diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index 03a72afc0..88bfbadc6 100755 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -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 diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 7cdf58cfd..80eb5347a 100755 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -2,12 +2,12 @@ if (!isset($_SESSION['USER_LOGGED'])) { G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' ); die( '