BUG 8116 "Designer no todos los procesos muestran no category" SOLVED

- that was happening for imported process.
  on the workspace where it has been imported the process category didn't exists

- It is fixed now, the process category is being imported with the process,..
  so, when the process is being imported if the process category doesn't exist, it is created.
This commit is contained in:
Erik Amaru Ortiz
2011-11-29 18:51:30 -04:00
parent f5053045f3
commit e469b9dd79
3 changed files with 70 additions and 5 deletions

View File

@@ -48,6 +48,7 @@ require_once 'classes/model/TaskUser.php';
require_once 'classes/model/FieldCondition.php'; require_once 'classes/model/FieldCondition.php';
require_once 'classes/model/Event.php'; require_once 'classes/model/Event.php';
require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/CaseScheduler.php';
require_once 'classes/model/ProcessCategory.php';
G::LoadClass('tasks'); G::LoadClass('tasks');
G::LoadClass('reportTables'); G::LoadClass('reportTables');
@@ -1034,6 +1035,27 @@ class Processes {
} }
} }
/**
* Gets processCategory record, if the process had one
* @param $sProUid string for the process Uid
* @return $processCategory array
*/
public function getProcessCategoryRow($sProUid)
{
$process = ProcessPeer::retrieveByPK($sProUid);
if ($process->getProCategory() == '') {
return null;
}
$oCriteria = new Criteria('workflow');
$oCriteria->add(ProcessCategoryPeer::CATEGORY_UID, $process->getProCategory());
$oDataset = ProcessCategoryPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
return $oDataset->getRow();
}
/** /**
* Get all Swimlanes Elements for any Process * Get all Swimlanes Elements for any Process
@@ -1300,6 +1322,24 @@ class Processes {
return; return;
} }
/**
* Create ProcessCategory record
* @param $ProcessCategory array.
* @return void
*/
function createProcessCategoryRow ($row)
{
if ($row && is_array($row) && isset($row['CATEGORY_UID'])) {
$record = ProcessCategoryPeer::retrieveByPK($row['CATEGORY_UID']);
// create only if the category doesn't exists
if (!$record) {
$processCategory = new ProcessCategory();
$processCategory->fromArray($row, BasePeer::TYPE_FIELDNAME);
$processCategory->save();
}
}
}
/** /**
* Gets Input Documents Rows from aProcess. * Gets Input Documents Rows from aProcess.
* @param $sProUid string. * @param $sProUid string.
@@ -2311,6 +2351,8 @@ class Processes {
$oData->fieldCondition = $this->getFieldCondition($sProUid); $oData->fieldCondition = $this->getFieldCondition($sProUid);
$oData->event = $this->getEventRow ($sProUid); $oData->event = $this->getEventRow ($sProUid);
$oData->caseScheduler = $this->getCaseSchedulerRow ($sProUid); $oData->caseScheduler = $this->getCaseSchedulerRow ($sProUid);
$oData->processCategory = $this->getProcessCategoryRow ($sProUid);
//krumo ($oData);die; //krumo ($oData);die;
//$oJSON = new Services_JSON(); //$oJSON = new Services_JSON();
//krumo ( $oJSON->encode($oData) ); //krumo ( $oJSON->encode($oData) );
@@ -3158,7 +3200,14 @@ class Processes {
*/ */
function createProcessFromData ($oData, $pmFilename ) { function createProcessFromData ($oData, $pmFilename ) {
$this->removeProcessRows ($oData->process['PRO_UID'] ); $this->removeProcessRows ($oData->process['PRO_UID'] );
// (*) Creating process dependencies
// creating the process category
$this->createProcessCategoryRow(isset($oData->processCategory) ? $oData->processCategory : null);
// create the process
$this->createProcessRow($oData->process); $this->createProcessRow($oData->process);
$this->createTaskRows($oData->tasks); $this->createTaskRows($oData->tasks);
//it was commented becuase it seems to be working fine //it was commented becuase it seems to be working fine
//$this->createEventRows(isset($oData->event) ? $oData->event : array()); //$this->createEventRows(isset($oData->event) ? $oData->event : array());
@@ -3211,12 +3260,12 @@ class Processes {
$this->createFieldCondition(isset($oData->fieldCondition) ? $oData->fieldCondition : array(), $oData->dynaforms); $this->createFieldCondition(isset($oData->fieldCondition) ? $oData->fieldCondition : array(), $oData->dynaforms);
// Create before to createRouteRows for avoid duplicates // Create before to createRouteRows for avoid duplicates
$this->createEventRows(isset($oData->event) ? $oData->event : array()); $this->createEventRows(isset($oData->event) ? $oData->event : array());
$this->createCaseSchedulerRows(isset($oData->caseScheduler) ? $oData->caseScheduler : array()); $this->createCaseSchedulerRows(isset($oData->caseScheduler) ? $oData->caseScheduler : array());
//and finally create the files, dynaforms (xml and html), emailTemplates and Public files // and finally create the files, dynaforms (xml and html), emailTemplates and Public files
$this->createFiles($oData, $pmFilename); $this->createFiles($oData, $pmFilename);
} }
@@ -3251,6 +3300,7 @@ class Processes {
$this->createFieldCondition($oData->fieldCondition, $oData->dynaforms); $this->createFieldCondition($oData->fieldCondition, $oData->dynaforms);
$this->createEventRows( $oData->event); $this->createEventRows( $oData->event);
$this->createCaseSchedulerRows( $oData->caseScheduler ); $this->createCaseSchedulerRows( $oData->caseScheduler );
$this->createProcessCategoryRow(isset($oData->processCategory) ? $oData->processCategory : null);
} }
@@ -3260,7 +3310,7 @@ class Processes {
* @param $sUserUid user uid * @param $sUserUid user uid
* @return an array of tasks * @return an array of tasks
*/ */
function getStartingTaskForUser ($sProUid, $sUsrUid ){ function getStartingTaskForUser ($sProUid, $sUsrUid ){
$oTask = new Tasks( ); $oTask = new Tasks( );
return $oTask->getStartingTaskForUser( $sProUid, $sUsrUid ); return $oTask->getStartingTaskForUser( $sProUid, $sUsrUid );

View File

@@ -449,6 +449,18 @@ class Process extends BaseProcess {
$this->setProShowMessage ( $aData['PRO_SHOW_MESSAGE'] ); $this->setProShowMessage ( $aData['PRO_SHOW_MESSAGE'] );
$this->setProShowDelegate ( $aData['PRO_SHOW_DELEGATE'] ); $this->setProShowDelegate ( $aData['PRO_SHOW_DELEGATE'] );
$this->setProShowDynaform ( $aData['PRO_SHOW_DYNAFORM'] ); $this->setProShowDynaform ( $aData['PRO_SHOW_DYNAFORM'] );
// validate if the category exists
$criteria = new Criteria('workflow');
$criteria->add(ProcessCategoryPeer::CATEGORY_UID, $aData['PRO_CATEGORY']);
$ds = ProcessCategoryPeer::doSelectRS ($criteria);
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$ds->next();
// if it is not set, set value as empty "No Category"
if (!$ds->getRow()) {
$aData['PRO_CATEGORY'] = '';
}
$this->setProCategory ( $aData['PRO_CATEGORY'] ); $this->setProCategory ( $aData['PRO_CATEGORY'] );
$this->setProSubCategory ( $aData['PRO_SUB_CATEGORY'] ); $this->setProSubCategory ( $aData['PRO_SUB_CATEGORY'] );
$this->setProIndustry ( $aData['PRO_INDUSTRY'] ); $this->setProIndustry ( $aData['PRO_INDUSTRY'] );

View File

@@ -19,7 +19,9 @@ require_once 'classes/model/om/BaseProcessCategory.php';
* @package workflow.engine.classes.model * @package workflow.engine.classes.model
*/ */
class ProcessCategory extends BaseProcessCategory { class ProcessCategory extends BaseProcessCategory {
function getAll($type='criteria'){
function getAll($type='criteria')
{
$c = new Criteria('workflow'); $c = new Criteria('workflow');
$c->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID); $c->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID);
$c->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME); $c->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
@@ -32,7 +34,8 @@ class ProcessCategory extends BaseProcessCategory {
$result[] = $dataset->getRow(); $result[] = $dataset->getRow();
} }
return $result; return $result;
} else { }
else {
return $c; return $c;
} }
} }