diff --git a/workflow/engine/classes/model/BpmnFlow.php b/workflow/engine/classes/model/BpmnFlow.php old mode 100644 new mode 100755 index 56f1f83f3..b77317450 --- a/workflow/engine/classes/model/BpmnFlow.php +++ b/workflow/engine/classes/model/BpmnFlow.php @@ -72,7 +72,7 @@ class BpmnFlow extends BaseBpmnFlow if (! is_null($prjUid)) { $c->add(BpmnFlowPeer::PRJ_UID, $prjUid, Criteria::EQUAL); } - + $c->addAscendingOrderByColumn(BpmnFlowPeer::FLO_POSITION); $rs = BpmnFlowPeer::doSelectRS($c); $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC); diff --git a/workflow/engine/classes/model/map/BpmnFlowMapBuilder.php b/workflow/engine/classes/model/map/BpmnFlowMapBuilder.php old mode 100644 new mode 100755 index 53847538a..e3da078e9 --- a/workflow/engine/classes/model/map/BpmnFlowMapBuilder.php +++ b/workflow/engine/classes/model/map/BpmnFlowMapBuilder.php @@ -101,6 +101,8 @@ class BpmnFlowMapBuilder $tMap->addColumn('FLO_STATE', 'FloState', 'string', CreoleTypes::LONGVARCHAR, false, null); + $tMap->addColumn('FLO_POSITION', 'FloPosition', 'int', CreoleTypes::INTEGER, true, null); + } // doBuild() } // BpmnFlowMapBuilder diff --git a/workflow/engine/classes/model/om/BaseBpmnFlow.php b/workflow/engine/classes/model/om/BaseBpmnFlow.php old mode 100644 new mode 100755 index a1673c928..15f28a2ad --- a/workflow/engine/classes/model/om/BaseBpmnFlow.php +++ b/workflow/engine/classes/model/om/BaseBpmnFlow.php @@ -136,6 +136,12 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent protected $flo_state; /** + * The value for the flo_position field. + * @var int + */ + protected $flo_position = 0; + + /** * @var BpmnProject */ protected $aBpmnProject; @@ -358,6 +364,17 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent } /** + * Get the [flo_position] column value. + * + * @return int + */ + public function getFloPosition() + { + + return $this->flo_position; + } + + /* * Set the value of [flo_uid] column. * * @param string $v new value @@ -761,6 +778,28 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent } // setFloState() + /** + * Set the value of [flo_position] column. + * + * @param int $v new value + * @return void + */ + public function setFloPosition($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->flo_position !== $v || $v === 0) { + $this->flo_position = $v; + $this->modifiedColumns[] = BpmnFlowPeer::FLO_POSITION; + } + + } // setFloPosition() + /** * Hydrates (populates) the object variables with values from the database resultset. * @@ -814,12 +853,14 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent $this->flo_state = $rs->getString($startcol + 17); + $this->flo_position = $rs->getInt($startcol + 18); + $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 18; // 18 = BpmnFlowPeer::NUM_COLUMNS - BpmnFlowPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 19; // 19 = BpmnFlowPeer::NUM_COLUMNS - BpmnFlowPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating BpmnFlow object", $e); @@ -1115,6 +1156,9 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent case 17: return $this->getFloState(); break; + case 18: + return $this->getFloPosition(); + break; default: return null; break; @@ -1153,6 +1197,7 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent $keys[15] => $this->getFloX2(), $keys[16] => $this->getFloY2(), $keys[17] => $this->getFloState(), + $keys[18] => $this->getFloPosition(), ); return $result; } @@ -1238,6 +1283,9 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent case 17: $this->setFloState($value); break; + case 18: + $this->setFloPosition($value); + break; } // switch() } @@ -1333,6 +1381,10 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent $this->setFloState($arr[$keys[17]]); } + if (array_key_exists($keys[18], $arr)) { + $this->setFloPosition($arr[$keys[18]]); + } + } /** @@ -1416,6 +1468,10 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent $criteria->add(BpmnFlowPeer::FLO_STATE, $this->flo_state); } + if ($this->isColumnModified(BpmnFlowPeer::FLO_POSITION)) { + $criteria->add(BpmnFlowPeer::FLO_POSITION, $this->flo_position); + } + return $criteria; } @@ -1504,6 +1560,8 @@ abstract class BaseBpmnFlow extends BaseObject implements Persistent $copyObj->setFloState($this->flo_state); + $copyObj->setFloPosition($this->flo_position); + $copyObj->setNew(true); diff --git a/workflow/engine/classes/model/om/BaseBpmnFlowPeer.php b/workflow/engine/classes/model/om/BaseBpmnFlowPeer.php old mode 100644 new mode 100755 index 59e7900b3..80ef18163 --- a/workflow/engine/classes/model/om/BaseBpmnFlowPeer.php +++ b/workflow/engine/classes/model/om/BaseBpmnFlowPeer.php @@ -25,7 +25,7 @@ abstract class BaseBpmnFlowPeer const CLASS_DEFAULT = 'classes.model.BpmnFlow'; /** The total number of columns. */ - const NUM_COLUMNS = 18; + const NUM_COLUMNS = 19; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -85,6 +85,9 @@ abstract class BaseBpmnFlowPeer /** the column name for the FLO_STATE field */ const FLO_STATE = 'BPMN_FLOW.FLO_STATE'; + /** the column name for the FLO_POSITION field */ + const FLO_POSITION = 'BPMN_FLOW.FLO_POSITION'; + /** The PHP to DB Name Mapping */ private static $phpNameMap = null; @@ -96,10 +99,10 @@ abstract class BaseBpmnFlowPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('FloUid', 'PrjUid', 'DiaUid', 'FloType', 'FloName', 'FloElementOrigin', 'FloElementOriginType', 'FloElementOriginPort', 'FloElementDest', 'FloElementDestType', 'FloElementDestPort', 'FloIsInmediate', 'FloCondition', 'FloX1', 'FloY1', 'FloX2', 'FloY2', 'FloState', ), - BasePeer::TYPE_COLNAME => array (BpmnFlowPeer::FLO_UID, BpmnFlowPeer::PRJ_UID, BpmnFlowPeer::DIA_UID, BpmnFlowPeer::FLO_TYPE, BpmnFlowPeer::FLO_NAME, BpmnFlowPeer::FLO_ELEMENT_ORIGIN, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_PORT, BpmnFlowPeer::FLO_ELEMENT_DEST, BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE, BpmnFlowPeer::FLO_ELEMENT_DEST_PORT, BpmnFlowPeer::FLO_IS_INMEDIATE, BpmnFlowPeer::FLO_CONDITION, BpmnFlowPeer::FLO_X1, BpmnFlowPeer::FLO_Y1, BpmnFlowPeer::FLO_X2, BpmnFlowPeer::FLO_Y2, BpmnFlowPeer::FLO_STATE, ), - BasePeer::TYPE_FIELDNAME => array ('FLO_UID', 'PRJ_UID', 'DIA_UID', 'FLO_TYPE', 'FLO_NAME', 'FLO_ELEMENT_ORIGIN', 'FLO_ELEMENT_ORIGIN_TYPE', 'FLO_ELEMENT_ORIGIN_PORT', 'FLO_ELEMENT_DEST', 'FLO_ELEMENT_DEST_TYPE', 'FLO_ELEMENT_DEST_PORT', 'FLO_IS_INMEDIATE', 'FLO_CONDITION', 'FLO_X1', 'FLO_Y1', 'FLO_X2', 'FLO_Y2', 'FLO_STATE', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + BasePeer::TYPE_PHPNAME => array ('FloUid', 'PrjUid', 'DiaUid', 'FloType', 'FloName', 'FloElementOrigin', 'FloElementOriginType', 'FloElementOriginPort', 'FloElementDest', 'FloElementDestType', 'FloElementDestPort', 'FloIsInmediate', 'FloCondition', 'FloX1', 'FloY1', 'FloX2', 'FloY2', 'FloState', 'FloPosition', ), + BasePeer::TYPE_COLNAME => array (BpmnFlowPeer::FLO_UID, BpmnFlowPeer::PRJ_UID, BpmnFlowPeer::DIA_UID, BpmnFlowPeer::FLO_TYPE, BpmnFlowPeer::FLO_NAME, BpmnFlowPeer::FLO_ELEMENT_ORIGIN, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_PORT, BpmnFlowPeer::FLO_ELEMENT_DEST, BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE, BpmnFlowPeer::FLO_ELEMENT_DEST_PORT, BpmnFlowPeer::FLO_IS_INMEDIATE, BpmnFlowPeer::FLO_CONDITION, BpmnFlowPeer::FLO_X1, BpmnFlowPeer::FLO_Y1, BpmnFlowPeer::FLO_X2, BpmnFlowPeer::FLO_Y2, BpmnFlowPeer::FLO_STATE, BpmnFlowPeer::FLO_POSITION, ), + BasePeer::TYPE_FIELDNAME => array ('FLO_UID', 'PRJ_UID', 'DIA_UID', 'FLO_TYPE', 'FLO_NAME', 'FLO_ELEMENT_ORIGIN', 'FLO_ELEMENT_ORIGIN_TYPE', 'FLO_ELEMENT_ORIGIN_PORT', 'FLO_ELEMENT_DEST', 'FLO_ELEMENT_DEST_TYPE', 'FLO_ELEMENT_DEST_PORT', 'FLO_IS_INMEDIATE', 'FLO_CONDITION', 'FLO_X1', 'FLO_Y1', 'FLO_X2', 'FLO_Y2', 'FLO_STATE', 'FLO_POSITION', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -109,10 +112,10 @@ abstract class BaseBpmnFlowPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('FloUid' => 0, 'PrjUid' => 1, 'DiaUid' => 2, 'FloType' => 3, 'FloName' => 4, 'FloElementOrigin' => 5, 'FloElementOriginType' => 6, 'FloElementOriginPort' => 7, 'FloElementDest' => 8, 'FloElementDestType' => 9, 'FloElementDestPort' => 10, 'FloIsInmediate' => 11, 'FloCondition' => 12, 'FloX1' => 13, 'FloY1' => 14, 'FloX2' => 15, 'FloY2' => 16, 'FloState' => 17, ), - BasePeer::TYPE_COLNAME => array (BpmnFlowPeer::FLO_UID => 0, BpmnFlowPeer::PRJ_UID => 1, BpmnFlowPeer::DIA_UID => 2, BpmnFlowPeer::FLO_TYPE => 3, BpmnFlowPeer::FLO_NAME => 4, BpmnFlowPeer::FLO_ELEMENT_ORIGIN => 5, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => 6, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_PORT => 7, BpmnFlowPeer::FLO_ELEMENT_DEST => 8, BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => 9, BpmnFlowPeer::FLO_ELEMENT_DEST_PORT => 10, BpmnFlowPeer::FLO_IS_INMEDIATE => 11, BpmnFlowPeer::FLO_CONDITION => 12, BpmnFlowPeer::FLO_X1 => 13, BpmnFlowPeer::FLO_Y1 => 14, BpmnFlowPeer::FLO_X2 => 15, BpmnFlowPeer::FLO_Y2 => 16, BpmnFlowPeer::FLO_STATE => 17, ), - BasePeer::TYPE_FIELDNAME => array ('FLO_UID' => 0, 'PRJ_UID' => 1, 'DIA_UID' => 2, 'FLO_TYPE' => 3, 'FLO_NAME' => 4, 'FLO_ELEMENT_ORIGIN' => 5, 'FLO_ELEMENT_ORIGIN_TYPE' => 6, 'FLO_ELEMENT_ORIGIN_PORT' => 7, 'FLO_ELEMENT_DEST' => 8, 'FLO_ELEMENT_DEST_TYPE' => 9, 'FLO_ELEMENT_DEST_PORT' => 10, 'FLO_IS_INMEDIATE' => 11, 'FLO_CONDITION' => 12, 'FLO_X1' => 13, 'FLO_Y1' => 14, 'FLO_X2' => 15, 'FLO_Y2' => 16, 'FLO_STATE' => 17, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + BasePeer::TYPE_PHPNAME => array ('FloUid' => 0, 'PrjUid' => 1, 'DiaUid' => 2, 'FloType' => 3, 'FloName' => 4, 'FloElementOrigin' => 5, 'FloElementOriginType' => 6, 'FloElementOriginPort' => 7, 'FloElementDest' => 8, 'FloElementDestType' => 9, 'FloElementDestPort' => 10, 'FloIsInmediate' => 11, 'FloCondition' => 12, 'FloX1' => 13, 'FloY1' => 14, 'FloX2' => 15, 'FloY2' => 16, 'FloState' => 17, 'FloPosition' => 18, ), + BasePeer::TYPE_COLNAME => array (BpmnFlowPeer::FLO_UID => 0, BpmnFlowPeer::PRJ_UID => 1, BpmnFlowPeer::DIA_UID => 2, BpmnFlowPeer::FLO_TYPE => 3, BpmnFlowPeer::FLO_NAME => 4, BpmnFlowPeer::FLO_ELEMENT_ORIGIN => 5, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => 6, BpmnFlowPeer::FLO_ELEMENT_ORIGIN_PORT => 7, BpmnFlowPeer::FLO_ELEMENT_DEST => 8, BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => 9, BpmnFlowPeer::FLO_ELEMENT_DEST_PORT => 10, BpmnFlowPeer::FLO_IS_INMEDIATE => 11, BpmnFlowPeer::FLO_CONDITION => 12, BpmnFlowPeer::FLO_X1 => 13, BpmnFlowPeer::FLO_Y1 => 14, BpmnFlowPeer::FLO_X2 => 15, BpmnFlowPeer::FLO_Y2 => 16, BpmnFlowPeer::FLO_STATE => 17, BpmnFlowPeer::FLO_POSITION => 18, ), + BasePeer::TYPE_FIELDNAME => array ('FLO_UID' => 0, 'PRJ_UID' => 1, 'DIA_UID' => 2, 'FLO_TYPE' => 3, 'FLO_NAME' => 4, 'FLO_ELEMENT_ORIGIN' => 5, 'FLO_ELEMENT_ORIGIN_TYPE' => 6, 'FLO_ELEMENT_ORIGIN_PORT' => 7, 'FLO_ELEMENT_DEST' => 8, 'FLO_ELEMENT_DEST_TYPE' => 9, 'FLO_ELEMENT_DEST_PORT' => 10, 'FLO_IS_INMEDIATE' => 11, 'FLO_CONDITION' => 12, 'FLO_X1' => 13, 'FLO_Y1' => 14, 'FLO_X2' => 15, 'FLO_Y2' => 16, 'FLO_STATE' => 17, 'FLO_POSITION' => 18, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ) ); /** @@ -249,6 +252,8 @@ abstract class BaseBpmnFlowPeer $criteria->addSelectColumn(BpmnFlowPeer::FLO_STATE); + $criteria->addSelectColumn(BpmnFlowPeer::FLO_POSITION); + } const COUNT = 'COUNT(BPMN_FLOW.FLO_UID)'; diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index bf077b4ff..9c7d5fe43 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -3583,6 +3583,7 @@ + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 8e39891b3..b3e7c3ce6 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -1907,6 +1907,7 @@ CREATE TABLE `BPMN_FLOW` `FLO_X2` INTEGER default 0 NOT NULL, `FLO_Y2` INTEGER default 0 NOT NULL, `FLO_STATE` MEDIUMTEXT, + `FLO_POSITION` INTEGER default 0 NOT NULL, PRIMARY KEY (`FLO_UID`), KEY `BPMN_FLOW_I_1`(`FLO_UID`), KEY `BPMN_FLOW_I_2`(`PRJ_UID`), diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php old mode 100644 new mode 100755 index 3958810bf..125ff7d16 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -69,6 +69,10 @@ try { $oCase->thisIsTheCurrentUser( $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs" ); $Fields = $oCase->loadCase( $_SESSION["APPLICATION"] ); + if ($swpmdynaform) { + $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $pmdynaform ); + } + $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], G::getSystemConstants() ); $Fields["APP_DATA"] = array_merge( $Fields["APP_DATA"], $_POST["form"] ); @@ -123,27 +127,27 @@ try { $aAux = explode( '|', $oForm->fields[$oForm->fields[$sField]->pmconnection]->keys ); $i = 0; $aValues = array (); - if($aData == "" || count($aData['FIELDS']) < 1){ - $message = G::LoadTranslation( 'ID_PMTABLE_NOT_FOUNDED_SAVED_DATA' ); - G::SendMessageText( $message, "WARNING" ); - $aRow = false; + if ($aData == "" || count($aData['FIELDS']) < 1) { + $message = G::LoadTranslation( 'ID_PMTABLE_NOT_FOUNDED_SAVED_DATA' ); + G::SendMessageText( $message, "WARNING" ); + $aRow = false; } else { - foreach ($aData['FIELDS'] as $aField) { - if ($aField['FLD_KEY'] == '1') { - $aKeys[$aField['FLD_NAME']] = (isset( $aAux[$i] ) ? G::replaceDataField( $aAux[$i], $Fields['APP_DATA'] ) : ''); - $i ++; - } - if ($aField['FLD_NAME'] == $oForm->fields[$sField]->pmfield) { - $aValues[$aField['FLD_NAME']] = $Fields['APP_DATA'][$sField]; - } else { - $aValues[$aField['FLD_NAME']] = ''; - } - } - try { - $aRow = $oAdditionalTables->getDataTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aKeys ); - } catch (Exception $oError) { - $aRow = false; - } + foreach ($aData['FIELDS'] as $aField) { + if ($aField['FLD_KEY'] == '1') { + $aKeys[$aField['FLD_NAME']] = (isset( $aAux[$i] ) ? G::replaceDataField( $aAux[$i], $Fields['APP_DATA'] ) : ''); + $i ++; + } + if ($aField['FLD_NAME'] == $oForm->fields[$sField]->pmfield) { + $aValues[$aField['FLD_NAME']] = $Fields['APP_DATA'][$sField]; + } else { + $aValues[$aField['FLD_NAME']] = ''; + } + } + try { + $aRow = $oAdditionalTables->getDataTable( $oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aKeys ); + } catch (Exception $oError) { + $aRow = false; + } } if ($aRow) { diff --git a/workflow/engine/src/ProcessMaker/Project/Bpmn.php b/workflow/engine/src/ProcessMaker/Project/Bpmn.php old mode 100644 new mode 100755 index 7dbe05c37..fb06a0b64 --- a/workflow/engine/src/ProcessMaker/Project/Bpmn.php +++ b/workflow/engine/src/ProcessMaker/Project/Bpmn.php @@ -684,6 +684,7 @@ class Bpmn extends Handler $flow->fromArray($data, BasePeer::TYPE_FIELDNAME); $flow->setPrjUid($this->getUid()); $flow->setDiaUid($this->getDiagram("object")->getDiaUid()); + $flow->setFloPosition($this->getFlowNextPosition($data["FLO_UID"], $data["FLO_TYPE"], $data["FLO_ELEMENT_ORIGIN"])); $flow->save(); self::log("Add Flow Success!"); @@ -746,6 +747,8 @@ class Bpmn extends Handler self::log("Remove Flow: $floUid"); $flow = FlowPeer::retrieveByPK($floUid); + $this->reOrderFlowPosition($flow->getFloElementOrigin(), $flow->getFloPosition()); + $flow->delete(); self::log("Remove Flow Success!"); @@ -1242,5 +1245,48 @@ class Bpmn extends Handler throw $e; } } + + public function getFlowNextPosition ($sFloUid, $sFloType, $sFloElementOrigin) + { + try { + + $oCriteria = new Criteria('workflow'); + $oCriteria->addSelectColumn( '(COUNT(*) + 1) AS FLOW_POS' ); + $oCriteria->add(\BpmnFlowPeer::PRJ_UID, $this->getUid()); + $oCriteria->add(\BpmnFlowPeer::DIA_UID, $this->getDiagram("object")->getDiaUid()); + $oCriteria->add(\BpmnFlowPeer::FLO_UID, $sFloUid, \Criteria::NOT_EQUAL); + $oCriteria->add(\BpmnFlowPeer::FLO_TYPE, $sFloType); + $oCriteria->add(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $sFloElementOrigin); + $oDataset = \BpmnFlowPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + $aRow = $oDataset->getRow(); + return (int)($aRow["FLOW_POS"]); + + } catch (Exception $oException) { + throw $oException; + } + } + + public function reOrderFlowPosition ($sFloOrigin, $iPosition) + { + try { + $con = \Propel::getConnection('workflow'); + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->add( \BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $sFloOrigin ); + $oCriteria->add( \BpmnFlowPeer::FLO_POSITION, $iPosition, '>' ); + $oDataset = \BpmnFlowPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $aRow = $oDataset->getRow(); + $oCriteria2 = new Criteria('workflow'); + $oCriteria2->add( \BpmnFlowPeer::FLO_POSITION, $aRow['FLO_POSITION'] - 1); + BasePeer::doUpdate($oCriteria, $oCriteria2, $con); + $oDataset->next(); + + } catch (Exception $oException) { + throw $oException; + } + } } diff --git a/workflow/engine/templates/emailServer/emailServer.js b/workflow/engine/templates/emailServer/emailServer.js index 630549482..4feabbe8e 100644 --- a/workflow/engine/templates/emailServer/emailServer.js +++ b/workflow/engine/templates/emailServer/emailServer.js @@ -38,9 +38,21 @@ emailServer.application = { //Data var p; + /*----------------------------------********---------------------------------*/ + if (Ext.getCmp("chkEmailServerDefault").checked) { + /*----------------------------------********---------------------------------*/ + var emailDefault = 1; + /*----------------------------------********---------------------------------*/ + } else { + var emailDefault = 0; + } + /*----------------------------------********---------------------------------*/ + switch (option) { + case "INS": var typeEmailEngine = Ext.getCmp("cboEmailEngine").getValue(); + if (typeEmailEngine == "PHPMAILER") { var rdoGrpOption = Ext.getCmp("rdoGrpSmtpSecure").getValue(); @@ -60,7 +72,7 @@ emailServer.application = { smtpSecure: smtpSecure, sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0 + emailServerDefault: emailDefault }; } else { //MAIL @@ -72,7 +84,7 @@ emailServer.application = { fromName: Ext.getCmp("txtFromName").getValue(), sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0 + emailServerDefault: emailDefault }; } break; @@ -98,7 +110,7 @@ emailServer.application = { smtpSecure: smtpSecure, sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0 + emailServerDefault: emailDefault }; } else { //MAIL @@ -111,7 +123,7 @@ emailServer.application = { fromName: Ext.getCmp("txtFromName").getValue(), sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0 + emailServerDefault: emailDefault }; } break; @@ -144,7 +156,7 @@ emailServer.application = { smtpSecure: smtpSecure, sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0 + emailServerDefault: emailDefault }; } else { //MAIL @@ -156,7 +168,7 @@ emailServer.application = { fromName: Ext.getCmp("txtFromName").getValue(), sendTestMail: (Ext.getCmp("chkSendTestMail").checked)? 1 : 0, mailTo: Ext.getCmp("txtMailTo").getValue(), - emailServerDefault: (Ext.getCmp("chkEmailServerDefault").checked)? 1 : 0 + emailServerDefault: emailDefault }; } break; @@ -251,7 +263,9 @@ emailServer.application = { Ext.getCmp("txtMailTo").setValue(""); + /*----------------------------------********---------------------------------*/ Ext.getCmp("chkEmailServerDefault").setValue(false); + /*----------------------------------********---------------------------------*/ winData.setTitle(_("ID_EMAIL_SERVER_NEW")); winData.setDisabled(false); @@ -287,8 +301,17 @@ emailServer.application = { emailServerSetMailTo(Ext.getCmp("chkSendTestMail").checked); Ext.getCmp("txtMailTo").setValue(record.get("MAIL_TO")); - Ext.getCmp("chkEmailServerDefault").setValue((parseInt(record.get("MESS_DEFAULT")) == 1)? true : false); - + + /*----------------------------------********---------------------------------*/ + if (parseInt(record.get("MESS_DEFAULT")) == 1) { + /*----------------------------------********---------------------------------*/ + Ext.getCmp("chkEmailServerDefault").setValue(true); + /*----------------------------------********---------------------------------*/ + } else { + Ext.getCmp("chkEmailServerDefault").setValue(false); + } + /*----------------------------------********---------------------------------*/ + winData.setTitle(_("ID_EMAIL_SERVER_EDIT")); winData.setDisabled(false); winData.show(); @@ -591,6 +614,7 @@ emailServer.application = { } }); + var txtAccountFrom = new Ext.form.TextField({ id: "txtAccountFrom", name: "txtAccountFrom", @@ -599,7 +623,7 @@ emailServer.application = { vtype: "emailUrlValidation" }); - + var txtPassword = new Ext.form.TextField({ id: "txtPassword", name: "txtPassword", @@ -662,14 +686,14 @@ emailServer.application = { hidden: true }); - + /*----------------------------------********---------------------------------*/ var chkEmailServerDefault = new Ext.form.Checkbox({ id: "chkEmailServerDefault", name: "chkEmailServerDefault", boxLabel: _("ID_EMAIL_SERVER_THIS_CONFIGURATION_IS_DEFAULT") }); - + /*----------------------------------********---------------------------------*/ var btnTest = new Ext.Action({ id: "btnTest", text: _("ID_TEST"), @@ -760,8 +784,11 @@ emailServer.application = { txtFromName, rdoGrpSmtpSecure, chkSendTestMail, - txtMailTo, + txtMailTo + /*----------------------------------********---------------------------------*/ + , chkEmailServerDefault + /*----------------------------------********---------------------------------*/ ] }) ],