diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index 5dae33336..1103e95ff 100755 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -149,6 +149,13 @@ class Content extends BaseContent { */ function addContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) { try { + if ($ConLang != 'en') { + $baseLangContent = ContentPeer::retrieveByPk($ConCategory, $ConParent, $ConId, 'en'); + if ($baseLangContent === null) { + Content::addContent($ConCategory, $ConParent, $ConId, 'en', $ConValue); + } + } + $con = ContentPeer::retrieveByPK ( $ConCategory, $ConParent, $ConId, $ConLang ); if (is_null ( $con )) { @@ -325,21 +332,5 @@ class Content extends BaseContent { } return $aRoles; } - - /** - * Verify the if content on teh current language exists for the base language 'english - * if not copy for it. - * - * @autor Erik Amaru Ortiz - * @param $category - * @param $id - * @param $value - */ - function copyContentOnBaseLanguageIfNotExists($category, $id, $value) - { - $con = ContentPeer::retrieveByPk($category, '', $id, 'en'); - if ($con === null) { - Content::addContent($category, '', $id, 'en', $value); - } - } + } // Content diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index 05f50ed61..27b999f64 100755 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -81,10 +81,7 @@ class Dynaform extends BaseDynaform { if ($this->dyn_title !== $v || $v === '') { $this->dyn_title = $v; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('DYN_TITLE', $this->getDynUid(), $this->dyn_title); - + $res = Content::addContent( 'DYN_TITLE', '', $this->getDynUid(), $lang, $this->dyn_title ); } @@ -130,10 +127,7 @@ class Dynaform extends BaseDynaform { if ($this->dyn_description !== $v || $v === '') { $this->dyn_description = $v; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('DYN_DESCRIPTION', $this->getDynUid(), $this->dyn_description); - + $res = Content::addContent( 'DYN_DESCRIPTION', '', $this->getDynUid(), $lang, $this->dyn_description ); } diff --git a/workflow/engine/classes/model/Groupwf.php b/workflow/engine/classes/model/Groupwf.php index 719bc2195..5c8116768 100755 --- a/workflow/engine/classes/model/Groupwf.php +++ b/workflow/engine/classes/model/Groupwf.php @@ -43,6 +43,7 @@ class Groupwf extends BaseGroupwf { * This value goes in the content table * @var string */ + //protected $grp_title = ''; protected $grp_title = ''; /** @@ -312,4 +313,51 @@ class Groupwf extends BaseGroupwf { return $result; } + function filterGroup($filter,$start,$limit) + { + require_once 'classes/model/Groupwf.php'; + require_once 'classes/model/TaskUser.php'; + require_once 'classes/model/GroupUser.php'; + G::LoadClass('configuration'); + + $co = new Configurations(); + $config = $co->getConfiguration('groupList', 'pageSize','',$_SESSION['USER_LOGGED']); + $env = $co->getConfiguration('ENVIRONMENT_SETTINGS', ''); + $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; + $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; + $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; + $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; + + $oCriteria = new Criteria('workflow'); + $oCriteria->addSelectColumn(GroupwfPeer::GRP_UID); + $oCriteria->addJoin(GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN); + $oCriteria->add(ContentPeer::CON_CATEGORY,'GRP_TITLE'); + $oCriteria->add(ContentPeer::CON_LANG,SYS_LANG); + if ($filter != ''){ + $oCriteria->add(ContentPeer::CON_VALUE, '%'.$filter.'%', Criteria::LIKE); + } + $totalRows = GroupwfPeer::doCount($oCriteria); + + $oCriteria = new Criteria('workflow'); + $oCriteria->clearSelectColumns(); + $oCriteria->addSelectColumn(GroupwfPeer::GRP_UID); + $oCriteria->addSelectColumn(GroupwfPeer::GRP_STATUS); + $oCriteria->addSelectColumn(ContentPeer::CON_VALUE); + $oCriteria->addAsColumn('GRP_TASKS', 0); + $oCriteria->addAsColumn('GRP_USERS', 0); + $oCriteria->addJoin(GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN); + $oCriteria->add(ContentPeer::CON_CATEGORY,'GRP_TITLE'); + $oCriteria->add(ContentPeer::CON_LANG,SYS_LANG); + if ($filter != ''){ + $oCriteria->add(ContentPeer::CON_VALUE, '%'.$filter.'%', Criteria::LIKE); + } + $oCriteria->setOffset($start); + $oCriteria->setLimit($limit); + + $oDataset = GroupwfPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + } + + } // Groupwf diff --git a/workflow/engine/classes/model/InputDocument.php b/workflow/engine/classes/model/InputDocument.php index 4c81f0ae6..3339e739c 100755 --- a/workflow/engine/classes/model/InputDocument.php +++ b/workflow/engine/classes/model/InputDocument.php @@ -244,10 +244,7 @@ class InputDocument extends BaseInputDocument { if ($this->inp_doc_title !== $sValue || $sValue === '') { try { $this->inp_doc_title = $sValue; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('INP_DOC_TITLE', $this->getInpDocUid(), $this->inp_doc_title); - + $iResult = Content::addContent('INP_DOC_TITLE', '', $this->getInpDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->inp_doc_title); } catch (Exception $oError) { @@ -288,10 +285,7 @@ class InputDocument extends BaseInputDocument { if ($this->inp_doc_description !== $sValue || $sValue === '') { try { $this->inp_doc_description = $sValue; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('INP_DOC_DESCRIPTION', $this->getInpDocUid(), $this->inp_doc_description); - + $iResult = Content::addContent('INP_DOC_DESCRIPTION', '', $this->getInpDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->inp_doc_description); } catch (Exception $oError) { diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 54ebd53fe..9ff9b278f 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -290,10 +290,7 @@ class OutputDocument extends BaseOutputDocument { if ($this->out_doc_title !== $sValue || $sValue === '') { try { $this->out_doc_title = $sValue; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('OUT_DOC_TITLE', $this->getOutDocUid(), $this->out_doc_title); - + $iResult = Content::addContent('OUT_DOC_TITLE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_title); } catch (Exception $oError) { @@ -334,10 +331,7 @@ class OutputDocument extends BaseOutputDocument { if ($this->out_doc_description !== $sValue || $sValue === '') { try { $this->out_doc_description = $sValue; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('OUT_DOC_DESCRIPTION', $this->getOutDocUid(), $this->out_doc_description); - + $iResult = Content::addContent('OUT_DOC_DESCRIPTION', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_description); } catch (Exception $oError) { diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 9314590ba..fb6ce06de 100755 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -81,10 +81,7 @@ class Process extends BaseProcess { if ($this->pro_title !== $v || $v === '') { $this->pro_title = $v; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('PRO_TITLE', $this->getProUid(), $this->pro_title); - + $res = Content::addContent( 'PRO_TITLE', '', $this->getProUid(), $lang, $this->pro_title ); } @@ -131,9 +128,6 @@ class Process extends BaseProcess { $this->pro_description = $v; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('PRO_DESCRIPTION', $this->getProUid(), $this->pro_description); - $res = Content::addContent( 'PRO_DESCRIPTION', '', $this->getProUid(), $lang, $this->pro_description ); } diff --git a/workflow/engine/classes/model/SwimlanesElements.php b/workflow/engine/classes/model/SwimlanesElements.php index 18fb7bd3e..fb9b46b87 100755 --- a/workflow/engine/classes/model/SwimlanesElements.php +++ b/workflow/engine/classes/model/SwimlanesElements.php @@ -225,9 +225,6 @@ function swimlanesElementsExists ( $sSwiEleUid ) { try { $this->swi_text = $sValue; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('SWI_TEXT', $this->getSwiUid(), $this->swi_text); - $iResult = Content::addContent('SWI_TEXT', '', $this->getSwiUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->swi_text); } catch (Exception $oError) { diff --git a/workflow/engine/classes/model/Task.php b/workflow/engine/classes/model/Task.php index e388156b0..24f6a5642 100755 --- a/workflow/engine/classes/model/Task.php +++ b/workflow/engine/classes/model/Task.php @@ -73,9 +73,6 @@ class Task extends BaseTask { $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; if ($this->tas_title !== $v || $v==="") { $this->tas_title = $v; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TAS_TITLE', $this->getTasUid(), $this->tas_title); $res = Content::addContent( 'TAS_TITLE', '', $this->getTasUid(), $lang, $this->tas_title ); return $res; @@ -116,9 +113,6 @@ class Task extends BaseTask { if ($this->tas_description !== $v || $v==="") { $this->tas_description = $v; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TAS_DESCRIPTION', $this->getTasUid(), $this->tas_description); - $res = Content::addContent( 'TAS_DESCRIPTION', '', $this->getTasUid(), $lang, $this->tas_description ); return $res; } @@ -158,9 +152,6 @@ class Task extends BaseTask { if ($this->tas_def_title !== $v || $v==="") { $this->tas_def_title = $v; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TAS_DEF_TITLE', $this->getTasUid(), $this->tas_def_title); - $res = Content::addContent( 'TAS_DEF_TITLE', '', $this->getTasUid(), $lang, $this->tas_def_title ); return $res; } @@ -200,9 +191,6 @@ class Task extends BaseTask { if ($this->tas_def_description !== $v || $v==="") { $this->tas_def_description = $v; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TAS_DEF_DESCRIPTION', $this->getTasUid(), $this->tas_def_description); - $res = Content::addContent( 'TAS_DEF_DESCRIPTION', '', $this->getTasUid(), $lang, $this->tas_def_description ); return $res; } @@ -242,9 +230,6 @@ class Task extends BaseTask { if ($this->tas_def_proc_code !== $v || $v==="") { $this->tas_def_proc_code = $v; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TAS_DEF_PROC_CODE', $this->getTasUid(), $this->tas_def_proc_code); - $res = Content::addContent( 'TAS_DEF_PROC_CODE', '', $this->getTasUid(), $lang, $this->tas_def_proc_code ); return $res; } @@ -285,9 +270,6 @@ class Task extends BaseTask { if ($this->tas_def_message !== $v || $v==="") { $this->tas_def_message = $v; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TAS_DEF_MESSAGE', $this->getTasUid(), $this->tas_def_message); - $res = Content::addContent( 'TAS_DEF_MESSAGE', '', $this->getTasUid(), $lang, $this->tas_def_message ); return $res; } @@ -332,9 +314,6 @@ class Task extends BaseTask { if ($this->tas_def_subject_message !== $v || $v==="") { $this->tas_def_subject_message = $v; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TAS_DEF_SUBJECT_MESSAGE', $this->getTasUid(), $this->tas_def_subject_message); - $res = Content::addContent( 'TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang, $this->tas_def_subject_message ); return $res; diff --git a/workflow/engine/classes/model/Triggers.php b/workflow/engine/classes/model/Triggers.php index 6a05bf8ad..b80e1b843 100755 --- a/workflow/engine/classes/model/Triggers.php +++ b/workflow/engine/classes/model/Triggers.php @@ -74,9 +74,6 @@ class Triggers extends BaseTriggers { if ($this->tri_title !== $v || $v==="") { $this->tri_title = $v; - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TRI_TITLE', $this->getTriUid(), $this->tri_title); - $res = Content::addContent( 'TRI_TITLE', '', $this->getTriUid(), $lang, $this->tri_title ); return $res; } @@ -115,9 +112,6 @@ class Triggers extends BaseTriggers { $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; if ($this->tri_description !== $v || $v==="") { $this->tri_description = $v; - - //verify the content for base language - Content::copyContentOnBaseLanguageIfNotExists('TRI_DESCRIPTION', $this->getTriUid(), $this->tri_description); $res = Content::addContent( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang, $this->tri_description ); return $res; diff --git a/workflow/engine/methods/groups/groups_Ajax.php b/workflow/engine/methods/groups/groups_Ajax.php index 06f1e581c..f2dace908 100755 --- a/workflow/engine/methods/groups/groups_Ajax.php +++ b/workflow/engine/methods/groups/groups_Ajax.php @@ -127,7 +127,7 @@ switch ($_POST['action']) $oCriteria->addAsColumn('GRP_USERS', 0); $oCriteria->addJoin(GroupwfPeer::GRP_UID, ContentPeer::CON_ID, Criteria::LEFT_JOIN); $oCriteria->add(ContentPeer::CON_CATEGORY,'GRP_TITLE'); - $oCriteria->add(ContentPeer::CON_LANG,SYS_LANG); + $oCriteria->add(ContentPeer::CON_LANG,SYS_LANG); if ($filter != ''){ $oCriteria->add(ContentPeer::CON_VALUE, '%'.$filter.'%', Criteria::LIKE); } diff --git a/workflow/engine/templates/groups/groupsList.js b/workflow/engine/templates/groups/groupsList.js index dd9a64ea1..2ae247cbf 100755 --- a/workflow/engine/templates/groups/groupsList.js +++ b/workflow/engine/templates/groups/groupsList.js @@ -156,11 +156,18 @@ Ext.onReady(function(){ {xtype: 'textfield', fieldLabel: _('ID_GROUP_NAME'), name: 'name', width: 200, allowBlank: false}, { xtype: 'combo', + id : 'status', + name : 'status', fieldLabel: _('ID_STATUS'), hiddenName: 'status', typeAhead: true, mode: 'local', store: comboStatusStore, + listeners : { + beforerender: function(status){ + status.setValue('ACTIVE'); + } + }, displayField: 'value', valueField:'value', allowBlank: false, @@ -187,13 +194,13 @@ Ext.onReady(function(){ hiddenName: 'status', typeAhead: true, mode: 'local', - store: comboStatusStore, + store: comboStatusStore, displayField: 'value', valueField:'value', allowBlank: false, triggerAction: 'all', emptyText: _('ID_SELECT_STATUS'), - selectOnFocus:true + selectOnFocus:true } ], buttons: [