Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Victor Saisa Lopez
2014-01-24 09:57:25 -04:00
41 changed files with 1355 additions and 425 deletions

View File

@@ -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/",
);

View File

@@ -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",

View File

@@ -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

View File

@@ -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

View File

@@ -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"
@@ -18,7 +21,7 @@ Feature: Project Properties - Assignee Resources
| 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"
@@ -30,8 +33,11 @@ Scenario Outline: Get a list of available users and groups to be assigned to an
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 |
| 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:
@@ -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
@@ -86,6 +90,7 @@ Scenario Outline: List assignees of an activity using a 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
@@ -100,7 +105,8 @@ Scenario Outline: List assignees of an activity using a filter
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
@@ -115,7 +121,6 @@ Scenario Outline: List assignees of an activity using a filter
| Remove a user from activity | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 36775342552d5674146d9c2078497230 |
Scenario: List assignees of an activity
Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee"
Then the response status code should be 200

View File

@@ -1,5 +1,7 @@
@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
@@ -37,3 +39,34 @@ Scenario Outline: Assign a user or group to an activity (Field validation)
| 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|

View File

@@ -1111,8 +1111,13 @@ class RestContext extends BehatContext
{
$data = $this->_data;
if (!is_array($data)) {
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){
throw new Exception('Records quantity not match ' . $quantityOfRecords . ' (actual: ' . $currentRecordsCount . ")\n\n");

View File

@@ -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 );

View File

@@ -4409,8 +4409,8 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
} else {
$isRequired = '0';
}
if ($v == 'today') {
$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' );

View File

@@ -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' ) ? '\\' : '/');

View File

@@ -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');

View File

@@ -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");

View File

@@ -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');
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

View File

@@ -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) {

View File

@@ -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");

View File

@@ -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!");
return $this->bound;
}
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();
}*/
// OVERRIDES
public function fromArray($data)
public function setActUid($actUid)
{
parent::fromArray($data, BasePeer::TYPE_FIELDNAME);
// try resolve the related bound
if (array_key_exists('BOU_UID', $data)) {
//$bound = BpmnBound::findByElement('Activity', $this->getActUid());
$bound = BpmnBoundPeer::retrieveByPK($data['BOU_UID']);
if (is_object($bound)) {
$this->bound = $bound;
}
parent::setActUid($actUid);
$this->bound->setElementUid($this->getActUid());
}
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
public function setPrjUid($prjUid)
{
parent::setPrjUid($prjUid);
$this->bound->setPrjUid($this->getPrjUid());
}
public function setProUid($proUid)
{
parent::setProUid($proUid);
$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);

View File

@@ -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" ) );

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -37,14 +37,16 @@ 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 );
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
) )
@@ -81,12 +83,28 @@ class ProcessProxy extends HttpProxyController
$calendarObj->assignCalendarTo( $sProUid, $httpData->PRO_CALENDAR, 'PROCESS' );
}
// Creating BPMN Project Layer
if ($projectType == 'bpmnProject') {
$bpmnModel = new ProcessMaker\Adapter\Bpmn\Model();
$replaceUids = false;
$data = array(
'PRJ_UID' => $sProUid,
'PRJ_NAME' => $httpData->PRO_TITLE,
'PRJ_DESCRIPTION' => $httpData->PRO_DESCRIPTION,
'PRJ_CATEGORY' => $httpData->PRO_CATEGORY
);
$result = $bpmnModel->createProject($data, $replaceUids);
}
$this->success = true;
$this->PRO_UID = $sProUid;
$this->msg = G::LoadTranslation( 'ID_CREATE_PROCESS_SUCCESS' );
//TODO save bpmn project
} catch (Exception $e) {
$this->success = false;
$this->msg = $e->getMessage();
}
}
/**

View File

@@ -98,11 +98,13 @@ 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();

View File

@@ -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;

View File

@@ -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 {
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');
}

View 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");

View File

@@ -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;
}

View File

@@ -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)
{

View 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;
}
}

View File

@@ -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);
@@ -93,32 +89,21 @@ class ProjectUser
$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('act_name' => $taskValue[0],
'act_uid' => $task['uid']);
}
$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();
}
//$oDataset->next();
$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"]);
}
//die();
$oDataset->next();
}
return $aUsers;
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;
}
}
}

View File

@@ -143,9 +143,7 @@ class Trigger
}
$dataTrigger= (array)$dataTrigger;
if (isset($dataTrigger['TRI_TYPE']) && $dataTrigger['TRI_TYPE'] == '') {
$dataTrigger['TRI_TYPE'] = 'SCRIPT';
}
if (isset($dataTrigger['TRI_TITLE'])) {
if (!$this->verifyNameTrigger($sProcessUID, $dataTrigger['TRI_TITLE'], $sTriggerUid)) {

View File

@@ -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);
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();
if ($replaceUids) {
$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 (! isset($diagrams)) {
if ($replaceUids) {
return $uids;
} else {
return self::loadProject($prjUid);
}
}
$diagram = new Diagram();
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();
if ($replaceUids) {
$uids[] = array('old_uid' => $oldDiaUid, 'new_uid' => $diaUid, 'object' => 'diagram');
$mapId['diagram'][$oldDiaUid] = $diaUid;
}
$process = new Process();
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;
}
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,6 +371,10 @@ 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);
$project = array_change_key_case($project);
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);
@@ -321,29 +385,32 @@ class Model
// 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)
);
$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) {
$events[$i] = array_merge(
$events[$i],
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $event['evn_uid'], true)
);
$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) {
$gateways[$i] = array_merge(
$gateways[$i],
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $gateway['gat_uid'], true)
);
$bound = self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $gateway['gat_uid'], true);
if (is_object($bound)) {
$gateways[$i] = array_merge($gateways[$i], $bound);
}
}
$project = array_change_key_case($project);
$project['diagrams'] = array($diagram);
$project['diagrams'][0]['laneset'] = $lanesets;
$project['diagrams'][0]['lanes'] = $lanes;
@@ -352,6 +419,7 @@ class Model
$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;
}

View File

@@ -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());
}
}

View File

@@ -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()));
}
}
}

View File

@@ -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();

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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,7 +447,13 @@ Ext.onReady(function(){
});
function newProcess(){
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'),
@@ -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 : "&nbsp;",
timeout : 36000,
success : function(obj, resp) {
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:'',

View File

@@ -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>