diff --git a/features/backend/projects/input_documents/main_tests_input.feature b/features/backend/projects/input_documents/main_tests_input.feature index a5872d1b2..553e4ba41 100644 --- a/features/backend/projects/input_documents/main_tests_input.feature +++ b/features/backend/projects/input_documents/main_tests_input.feature @@ -42,20 +42,20 @@ Feature: Input Documents Main Tests Examples: - | test_description | project | inp_doc_number | inp_doc_title | inp_doc_description | inp_doc_form_needed | inp_doc_original | inp_doc_published | inp_doc_versioning | inp_doc_destination_path | inp_doc_tags | - | Create with virtual with versioning | 14414793652a5d718b65590036026581 | 1 | My InputDocument1 | My InputDocument2 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | | INPUT | - | Create with virtual without versioning | 14414793652a5d718b65590036026581 | 2 | My InputDocument2 | My InputDocument2 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 0 | | INPUT | - | Create with real with versioning | 14414793652a5d718b65590036026581 | 3 | My InputDocument3 | My InputDocument3 DESCRIPTION | REAL | ORIGINAL | PRIVATE | 1 | | INPUT | - | Create with vreal with versioning | 14414793652a5d718b65590036026581 | 4 | My InputDocument4 | My InputDocument4 DESCRIPTION | VREAL | ORIGINAL | PRIVATE | 1 | | INPUT | - | Create with virtual, copy and versioning | 14414793652a5d718b65590036026581 | 5 | My InputDocument5 | My InputDocument5 DESCRIPTION | VIRTUAL | COPY | PRIVATE | 1 | | INPUT | - | Create with virtual, original and without versioning | 14414793652a5d718b65590036026581 | 6 | My InputDocument6 | My InputDocument6 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 0 | | INPUT | - | Create with virtual, versioning and destination path | 14414793652a5d718b65590036026581 | 7 | My InputDocument7 | My InputDocument7 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | /my/path | INPUT | - | Create with virtual, without versioning and destination path | 14414793652a5d718b65590036026581 | 8 | My InputDocument8 | My InputDocument8 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 0 | /my/path | INPUT | - | Create with real, without versioning and destination path | 14414793652a5d718b65590036026581 | 9 | My InputDocument9 | My InputDocument9 DESCRIPTION | REAL | ORIGINAL | PRIVATE | 0 | /my/path | INPUT | - | Create with special characters in inp doc title | 14414793652a5d718b65590036026581 | 10 | My InputDocument10 !@#$%^&*€¤½¼‘¾¡²¤³| My InputDocument10 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | | INPUT | - | Create with special characters in inp doc description | 14414793652a5d718b65590036026581 | 11 | My InputDocument11 | My InputDocument11 !@#$%^&*€¤½¼‘¾¡²¤³| REAL | ORIGINAL | PRIVATE | 1 | | INPUT | - | Create with special characters in inp doc destination path | 14414793652a5d718b65590036026581 | 12 | My InputDocument12 | My InputDocument12 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | /my#@$#%/path324@$@@ | INPUT | - | Create with special characters in inp doc tags | 14414793652a5d718b65590036026581 | 13 | My InputDocument13 | My InputDocument13 DESCRIPTION | REAL | ORIGINAL | PRIVATE | 1 | | INPU455 @##$$³¤¤ | + | test_description | project | inp_doc_number | inp_doc_title | inp_doc_description | inp_doc_form_needed | inp_doc_original | inp_doc_published | inp_doc_versioning | inp_doc_destination_path | inp_doc_tags | + | Create with virtual with versioning | 14414793652a5d718b65590036026581 | 1 | My InputDocument1 | My InputDocument2 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | | INPUT | + | Create with virtual without versioning | 14414793652a5d718b65590036026581 | 2 | My InputDocument2 | My InputDocument2 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 0 | | INPUT | + | Create with real with versioning | 14414793652a5d718b65590036026581 | 3 | My InputDocument3 | My InputDocument3 DESCRIPTION | REAL | ORIGINAL | PRIVATE | 1 | | INPUT | + | Create with vreal with versioning | 14414793652a5d718b65590036026581 | 4 | My InputDocument4 | My InputDocument4 DESCRIPTION | VREAL | ORIGINAL | PRIVATE | 1 | | INPUT | + | Create with virtual, copy and versioning | 14414793652a5d718b65590036026581 | 5 | My InputDocument5 | My InputDocument5 DESCRIPTION | VIRTUAL | COPY | PRIVATE | 1 | | INPUT | + | Create with virtual, original and without versioning | 14414793652a5d718b65590036026581 | 6 | My InputDocument6 | My InputDocument6 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 0 | | INPUT | + | Create with virtual, versioning and destination path | 14414793652a5d718b65590036026581 | 7 | My InputDocument7 | My InputDocument7 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | /my/path | INPUT | + | Create with virtual, without versioning and destination path | 14414793652a5d718b65590036026581 | 8 | My InputDocument8 | My InputDocument8 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 0 | /my/path | INPUT | + | Create with real, without versioning and destination path | 14414793652a5d718b65590036026581 | 9 | My InputDocument9 | My InputDocument9 DESCRIPTION | REAL | ORIGINAL | PRIVATE | 0 | /my/path | INPUT | + | Create with special characters in inp doc title | 14414793652a5d718b65590036026581 | 10 | My InputDocument10 !@#$%^&*€¤½¼‘¾¡²¤³| My InputDocument10 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | | INPUT | + | Create with special characters in inp doc description | 14414793652a5d718b65590036026581 | 11 | My InputDocument11 | My InputDocument11 !@#$%^&*€¤½¼‘¾¡²¤³| REAL | ORIGINAL | PRIVATE | 1 | | INPUT | + | Create with special characters in inp doc destination path | 14414793652a5d718b65590036026581 | 12 | My InputDocument12 | My InputDocument12 DESCRIPTION | VIRTUAL | ORIGINAL | PRIVATE | 1 | /my#@$#%/path324@$@@ | INPUT | + | Create with special characters in inp doc tags | 14414793652a5d718b65590036026581 | 13 | My InputDocument13 | My InputDocument13 DESCRIPTION | REAL | ORIGINAL | PRIVATE | 1 | | INPU455 @##$$³¤¤ | Scenario: Create new Input Documents with same name diff --git a/features/backend/projects/project/main_tests_generate_bpmn.feature b/features/backend/projects/project/main_tests_generate_bpmn.feature index f0c0027ce..143df0a74 100644 --- a/features/backend/projects/project/main_tests_generate_bpmn.feature +++ b/features/backend/projects/project/main_tests_generate_bpmn.feature @@ -166,4 +166,17 @@ Scenario Outline: Delete a Project activity created previously in this script Examples: | pro_uid_number | - | 1 | \ No newline at end of file + | 1 | + +#Negative test, to import an invalid project + +Scenario: Generate BPMN with wrong project + Given POST this data: + """ + { + "pro_uid": "22872259050000000000db7020830606" + } + """ + And I request "project/generate-bpmn" + Then the response status code should be 400 + And the response status message should have the following text "exist" \ No newline at end of file diff --git a/gulliver/thirdparty/propel/Propel.php b/gulliver/thirdparty/propel/Propel.php index 501dca3fe..62d87167d 100755 --- a/gulliver/thirdparty/propel/Propel.php +++ b/gulliver/thirdparty/propel/Propel.php @@ -31,7 +31,7 @@ include_once 'adapter/DBAdapter.php'; * * @author Hans Lellelid (Propel) * @author Daniel Rall (Torque) - * @author Magnús Þór Torfason (Torque) + * @author Magn�s ��r Torfason (Torque) * @author Jason van Zyl (Torque) * @author Rafal Krzewski (Torque) * @author Martin Poeschl (Torque) @@ -603,4 +603,27 @@ class Propel { } } + /** + * @param $name string The connection name + * @return Connection A database connection + * @throws PropelException + */ + public static function getDbConnection($name) + { + if (! empty(self::$configuration['datasources'][$name]['connection'])) { + return self::getConnection($name); + } + + // the connection names always should be have a underscore like: workflow_ro, rbac_rw + // on fallback, we will try found a connection named: "workflow" if "workflow_ro" does not exist. + // the name without the "_ro" part. + + $defaultDbName = substr($name, 0, strrpos($name, '_')); + + if (! empty(self::$configuration['datasources'][$defaultDbName]['connection'])) { + return self::getConnection($defaultDbName); + } + + throw new PropelException('Error, database connection named "'.$name.'" is not defined for Propel.'); + } } diff --git a/workflow/engine/methods/cases/ajaxListener.php b/workflow/engine/methods/cases/ajaxListener.php index 9b99f8e98..2491eeac8 100755 --- a/workflow/engine/methods/cases/ajaxListener.php +++ b/workflow/engine/methods/cases/ajaxListener.php @@ -350,6 +350,7 @@ class Ajax print G::json_encode( $response ); die(); } + G::LoadClass('tasks'); $task = new Task(); if ($_SESSION['TASK'] == '-1') { $_SESSION['TASK'] = $_SESSION['CURRENT_TASK']; diff --git a/workflow/engine/methods/cases/summary.php b/workflow/engine/methods/cases/summary.php index 8e7858379..8b1cd3e79 100755 --- a/workflow/engine/methods/cases/summary.php +++ b/workflow/engine/methods/cases/summary.php @@ -50,7 +50,11 @@ try { $respView = $case->getAllObjectsFrom( $applicationFields['PRO_UID'], $_REQUEST['APP_UID'], $applicationFields['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW' ); if ($respView['SUMMARY_FORM'] == 0) { - throw new Exception( G::LoadTranslation( 'ID_SUMMARY_FORM_NO_PERMISSIONS' ) ); + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => G::LoadTranslation( 'ID_SUMMARY_FORM_NO_PERMISSIONS' )) ); + G::RenderPage( 'publish', 'blank' ); + die(); } if (file_exists( PATH_DYNAFORM . $applicationFields['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'] . '.xml' )) { @@ -81,3 +85,13 @@ try { die(); } +?> + + $sValue) { - $aFields[] = array ('sName' => $sName,'sType' => 'system','sLabel' => G::LoadTranslation('ID_TINY_SYSTEM_VARIABLES'), 'sUid' => ''); + $aFields[] = array ('sName' => $sName,'sType' => 'system','sLabel' => G::LoadTranslation('ID_TINY_SYSTEM_VARIABLE'), 'sUid' => ''); } //we're adding the ping variable to the system list - $aFields[] = array ('sName' => 'PIN','sType' => 'system','sLabel' => G::LoadTranslation('ID_TINY_SYSTEM_VARIABLES'), 'sUid' => ''); + $aFields[] = array ('sName' => 'PIN','sType' => 'system','sLabel' => G::LoadTranslation('ID_TINY_SYSTEM_VARIABLE'), 'sUid' => ''); } $aInvalidTypes = array("title", "subtitle", "file", "button", "reset", "submit", "javascript"); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index b122cf23a..b2e1c9ff9 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -126,9 +126,7 @@ class Variable //Update $cnn = \Propel::getConnection("workflow"); try { - $variable = \ProcessVariablesPeer::retrieveByPK($variableUid); - $variable->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); if ($variable->validate()) { $cnn->begin(); @@ -351,10 +349,10 @@ class Variable if (isset($aData["VAR_FIELD_TYPE"])) { Validator::isString($aData['VAR_FIELD_TYPE'], '$var_field_type'); Validator::isNotEmpty($aData['VAR_FIELD_TYPE'], '$var_field_type'); - if ($aData["VAR_FIELD_TYPE"] != 'string' && $aData["VAR_FIELD_TYPE"] != 'integer' && $aData["VAR_FIELD_TYPE"] != 'boolean' && $aData["VAR_FIELD_TYPE"] != 'float' && + /*if ($aData["VAR_FIELD_TYPE"] != 'string' && $aData["VAR_FIELD_TYPE"] != 'integer' && $aData["VAR_FIELD_TYPE"] != 'boolean' && $aData["VAR_FIELD_TYPE"] != 'float' && $aData["VAR_FIELD_TYPE"] != 'datetime' && $aData["VAR_FIELD_TYPE"] != 'date_of_birth' && $aData["VAR_FIELD_TYPE"] != 'date') { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('$var_field_type'))); - } + }*/ } if (isset($aData["VAR_FIELD_SIZE"])) { Validator::isInteger($aData["VAR_FIELD_SIZE"], '$var_field_size'); @@ -564,20 +562,21 @@ class Variable $contentDecode = json_decode($row["DYN_CONTENT"], true); $content = $contentDecode['items'][0]['items']; + if (is_array($content)) { + foreach ($content as $key => $value) { + if (isset($value[0]["variable"])) { + $criteria = new \Criteria("workflow"); + $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME); + $criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL); + $criteria->add(\ProcessVariablesPeer::VAR_NAME, $value[0]["variable"], \Criteria::EQUAL); + $criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL); + $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria->next(); - foreach ($content as $key => $value) { - if (isset($value[0]["variable"])) { - $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME); - $criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL); - $criteria->add(\ProcessVariablesPeer::VAR_NAME, $value[0]["variable"], \Criteria::EQUAL); - $criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL); - $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - $rsCriteria->next(); - - if ($rsCriteria->getRow()) { - throw new \Exception(\G::LoadTranslation("ID_VARIABLE_IN_USE", array($variableUid, $row["DYN_UID"]))); + if ($rsCriteria->getRow()) { + throw new \Exception(\G::LoadTranslation("ID_VARIABLE_IN_USE", array($variableUid, $row["DYN_UID"]))); + } } } } diff --git a/workflow/engine/templates/app/main.js b/workflow/engine/templates/app/main.js index b34534df9..aa4f97b3d 100644 --- a/workflow/engine/templates/app/main.js +++ b/workflow/engine/templates/app/main.js @@ -497,15 +497,97 @@ var openSummaryWindow = function(appUid, delIndex, action) }); var tabs = new Array(); + var isMovil = { + Android: function() { + return navigator.userAgent.match(/Android/i); + }, + BlackBerry: function() { + return navigator.userAgent.match(/BlackBerry/i); + }, + iOS: function() { + return navigator.userAgent.match(/iPhone|iPad|iPod/i); + }, + Opera: function() { + return navigator.userAgent.match(/Opera Mini/i); + }, + Windows: function() { + return navigator.userAgent.match(/IEMobile/i); + }, + other: function() { + return navigator.userAgent.match(/Mobile/i); + }, + any: function() { + return isMovil.Android() || isMovil.BlackBerry() || isMovil.iOS() || isMovil.Opera() || isMovil.Windows() || isMovil.other(); + } + }; + tabs.push(sumaryInfPanel); if (response.dynUid != '') { - tabs.push({title: Ext.util.Format.capitalize(_('ID_MORE_INFORMATION')), bodyCfg: { - tag: 'iframe', - id: 'summaryIFrame', - src: '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid, - style: {border: '0px none', height: '300px'}, - onload: '' - }}); + if (isMovil.any()) { + var src = '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid; + + var windowOpen = function() { + window.open(src,'_blank'); + }; + + var openDynaform = new Ext.Action({ + text: _('ID_OPEN_DYNAFORM_TAB'), + id: 'buttonOpenDynaform', + handler: windowOpen + }); + + var fieldsAS = new Ext.form.FieldSet({ + bodyStyle:'align:center', + items: [ + { + xtype:'button', + id: 'buttonOpenDynaform', + name: 'buttonOpenDynaform', + hidden: true, + text: _('ID_OPEN_DYNAFORM_TAB'), + handler:function() { + window.open(src,'_blank'); + } + }, + { + html:'' + } + ] + }); + var panel = new Ext.FormPanel({ + labelAlign:'center', + autoScroll: true, + fileUpload: true, + width:'100%', + height: '50px', + bodyStyle:'padding:10px', + waitMsgTarget : true, + frame: true, + defaults: { + anchor: '100%', + allowBlank: false, + resizable: true, + msgTarget: 'side', + align:'center' + }, + items:[ + fieldsAS + ] + }); + tabs.push({ + title: Ext.util.Format.capitalize(_('ID_MORE_INFORMATION')), + layout: 'fit', + items: [panel] + }); + } else { + tabs.push({title: Ext.util.Format.capitalize(_('ID_MORE_INFORMATION')), bodyCfg: { + tag: 'iframe', + id: 'summaryIFrame', + src: '../cases/summary?APP_UID=' + appUid + '&DEL_INDEX=' + delIndex + '&DYN_UID=' + response.dynUid, + style: {border: '0px none', height: '300px', overflow: 'auto'}, + onload: '' + }}); + } } tabs.push({title: Ext.util.Format.capitalize(_('ID_UPLOADED_DOCUMENTS')), bodyCfg: { tag: 'iframe', diff --git a/workflow/engine/templates/pmTables/data.js b/workflow/engine/templates/pmTables/data.js index d9cfc1b19..85bae78ab 100755 --- a/workflow/engine/templates/pmTables/data.js +++ b/workflow/engine/templates/pmTables/data.js @@ -84,7 +84,7 @@ Ext.onReady(function(){ contextMenu = new Ext.menu.Menu({ items : [ editButton, deleteButton ] }); - + searchText = new Ext.form.TextField ({ id: 'searchTxt', ctCls:'pm_search_text_field', @@ -398,7 +398,7 @@ Ext.onReady(function(){ ]; } else - tbar = [genDataReportButton, + tbar = [genDataReportButton, '->', appUidSearch, searchText, @@ -473,7 +473,8 @@ onMessageContextMenu = function (grid, rowIndex, e) { //Do Search Function DoSearch = function(){ infoGrid.store.setBaseParam('textFilter', searchText.getValue()); - infoGrid.store.load({params: {start : 0 , limit : pageSize , appUid : appUidSearch.getValue() }}); + infoGrid.store.setBaseParam('appUid', appUidSearch.getValue() ); + infoGrid.store.load() }; //Load Grid By Default @@ -482,7 +483,7 @@ GridByDefault = function(){ appUidSearch.reset(); infoGrid.store.setBaseParam('textFilter', searchText.getValue()); infoGrid.store.load(); -}; +}; //Capitalize String Function capitalize = function(s){