Merged in darojas/processmaker (pull request #835)
Fix. Adicion de funcionalidad de lanes y lanesets para project. Adicion de endpoint para steps. Modificacion de queries para doble conexion. Adicion end point suggest field
This commit is contained in:
@@ -110,7 +110,7 @@ class processMap
|
||||
$aConditions[] = array(0 => ContentPeer::CON_LANG, 1 => DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter() );
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(TaskPeer::PRO_UID, $sProcessUID);
|
||||
$oDataset = TaskPeer::doSelectRS($oCriteria);
|
||||
$oDataset = TaskPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
|
||||
@@ -140,7 +140,7 @@ class processMap
|
||||
$tasTitleConds[] = array('C1.CON_LANG', $del . SYS_LANG . $del);
|
||||
$oCriteria->addJoinMC($tasTitleConds, Criteria::LEFT_JOIN);
|
||||
|
||||
$oDatasetX = SubProcessPeer::doSelectRS($oCriteria);
|
||||
$oDatasetX = SubProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDatasetX->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDatasetX->next();
|
||||
$aRowx = $oDatasetX->getRow();
|
||||
@@ -162,7 +162,7 @@ class processMap
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(RoutePeer::TAS_UID, $aRow1['TAS_UID']);
|
||||
$oDataset2 = RoutePeer::doSelectRS($oCriteria);
|
||||
$oDataset2 = RoutePeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset2->next();
|
||||
while ($aRow2 = $oDataset2->getRow()) {
|
||||
@@ -205,7 +205,7 @@ class processMap
|
||||
$oCriteria->addSelectColumn('MIN(DEL_FINISH_DATE) AS FINISH');
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);
|
||||
$oCriteria->add(AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset2->next();
|
||||
$aRow2 = $oDataset2->getRow();
|
||||
@@ -214,7 +214,7 @@ class processMap
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);
|
||||
$oCriteria->add(AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']);
|
||||
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset2->next();
|
||||
$aRow3 = $oDataset2->getRow();
|
||||
@@ -266,7 +266,7 @@ class processMap
|
||||
$oCriteria->addSelectColumn('MIN(DEL_FINISH_DATE) AS FINISH');
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);
|
||||
$oCriteria->add(AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset2->next();
|
||||
$aRow2 = $oDataset2->getRow();
|
||||
@@ -275,7 +275,7 @@ class processMap
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);
|
||||
$oCriteria->add(AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']);
|
||||
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oDataset2 = AppDelegationPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset2->next();
|
||||
$aRow3 = $oDataset2->getRow();
|
||||
@@ -391,7 +391,7 @@ class processMap
|
||||
$aConditions[] = array(0 => ContentPeer::CON_LANG, 1 => DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter() );
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(SwimlanesElementsPeer::PRO_UID, $sProcessUID);
|
||||
$oDataset = SwimlanesElementsPeer::doSelectRS($oCriteria);
|
||||
$oDataset = SwimlanesElementsPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
@@ -804,7 +804,7 @@ class processMap
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(StepPeer::TAS_UID, $sTaskUID);
|
||||
$oCriteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
|
||||
$oDataset = StepPeer::doSelectRS($oCriteria);
|
||||
$oDataset = StepPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
@@ -945,7 +945,7 @@ class processMap
|
||||
$oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(DynaformPeer::DYN_UID, $sUIDs, Criteria::NOT_IN);
|
||||
$oCriteria->add(DynaformPeer::DYN_TYPE, 'xmlform');
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$i = 0;
|
||||
@@ -973,7 +973,7 @@ class processMap
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(InputDocumentPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(InputDocumentPeer::INP_DOC_UID, $sUIDs, Criteria::NOT_IN);
|
||||
$oDataset = InputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset = InputDocumentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
@@ -996,7 +996,7 @@ class processMap
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(OutputDocumentPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(OutputDocumentPeer::OUT_DOC_UID, $sUIDs, Criteria::NOT_IN);
|
||||
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
@@ -1156,7 +1156,7 @@ class processMap
|
||||
$oCriteria->add(TaskUserPeer::TAS_UID, $sTaskUID);
|
||||
$oCriteria->add(TaskUserPeer::TU_TYPE, $iType);
|
||||
$oCriteria->add(TaskUserPeer::TU_RELATION, 2);
|
||||
$oDataset = TaskUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset = TaskUserPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$c = 0;
|
||||
@@ -1190,7 +1190,7 @@ class processMap
|
||||
$oCriteria->add(TaskUserPeer::TAS_UID, $sTaskUID);
|
||||
$oCriteria->add(TaskUserPeer::TU_TYPE, $iType);
|
||||
$oCriteria->add(TaskUserPeer::TU_RELATION, 1);
|
||||
$oDataset = TaskUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset = TaskUserPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
@@ -1918,7 +1918,7 @@ class processMap
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->addAscendingOrderByColumn('DYN_TITLE');
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$dynaformArray = array();
|
||||
@@ -1968,7 +1968,7 @@ class processMap
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
|
||||
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$dynaformArray = array();
|
||||
@@ -2038,7 +2038,7 @@ class processMap
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(OutputDocumentPeer::PRO_UID, $sProcessUID);
|
||||
|
||||
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset = OutputDocumentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$outputDocArray = array();
|
||||
@@ -2114,7 +2114,7 @@ class processMap
|
||||
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(InputDocumentPeer::PRO_UID, $sProcessUID);
|
||||
|
||||
$oDataset = InputDocumentPeer::doSelectRS($oCriteria);
|
||||
$oDataset = InputDocumentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$inputDocArray = "";
|
||||
|
||||
@@ -117,7 +117,7 @@ class Sessions
|
||||
$oCriteria->add( SessionPeer::SES_STATUS, 'ACTIVE' );
|
||||
$oCriteria->add( SessionPeer::SES_DUE_DATE, $date, Criteria::GREATER_EQUAL );
|
||||
|
||||
$oDataset = SessionPeer::doSelectRS( $oCriteria );
|
||||
$oDataset = SessionPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
@@ -32,8 +32,6 @@ class BpmnActivity extends BaseBpmnActivity
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getActUid());
|
||||
@@ -42,6 +40,13 @@ class BpmnActivity extends BaseBpmnActivity
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
if (isset($this->getLnsUid)) {
|
||||
$this->bound->setBouContainer('bpmnLane');
|
||||
$this->bound->setBouElement($this->getLnsUid());
|
||||
} else {
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
}
|
||||
$this->bound->setBouElement($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ class BpmnArtifact extends BaseBpmnArtifact
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getArtUid());
|
||||
@@ -42,6 +40,13 @@ class BpmnArtifact extends BaseBpmnArtifact
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
if (isset($this->getLnsUid)) {
|
||||
$this->bound->setBouContainer('bpmnLane');
|
||||
$this->bound->setBouElement($this->getLnsUid());
|
||||
} else {
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
}
|
||||
$this->bound->setBouElement($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ class BpmnData extends BaseBpmnData
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getDatUid());
|
||||
@@ -42,6 +40,13 @@ class BpmnData extends BaseBpmnData
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
if (isset($this->getLnsUid)) {
|
||||
$this->bound->setBouContainer('bpmnLane');
|
||||
$this->bound->setBouElement($this->getLnsUid());
|
||||
} else {
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
}
|
||||
$this->bound->setBouElement($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ class BpmnEvent extends BaseBpmnEvent
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getEvnUid());
|
||||
@@ -42,6 +40,13 @@ class BpmnEvent extends BaseBpmnEvent
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
if (isset($this->getLnsUid)) {
|
||||
$this->bound->setBouContainer('bpmnLane');
|
||||
$this->bound->setBouElement($this->getLnsUid());
|
||||
} else {
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
}
|
||||
$this->bound->setBouElement($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ class BpmnGateway extends BaseBpmnGateway
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getGatUid());
|
||||
@@ -42,6 +40,13 @@ class BpmnGateway extends BaseBpmnGateway
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
if (isset($this->getLnsUid)) {
|
||||
$this->bound->setBouContainer('bpmnLane');
|
||||
$this->bound->setBouElement($this->getLnsUid());
|
||||
} else {
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
}
|
||||
$this->bound->setBouElement($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,4 +16,162 @@ require_once 'classes/model/om/BaseBpmnLane.php';
|
||||
*/
|
||||
class BpmnLane extends BaseBpmnLane {
|
||||
|
||||
private $bound;
|
||||
|
||||
public function __construct($generateUid = true)
|
||||
{
|
||||
$this->bound = new BpmnBound();
|
||||
$this->setBoundDefaults();
|
||||
}
|
||||
|
||||
public function getBound()
|
||||
{
|
||||
return $this->bound;
|
||||
}
|
||||
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getLanUid());
|
||||
|
||||
$project = BpmnProjectPeer::retrieveByPK($this->getPrjUid());
|
||||
|
||||
if (is_object($project)) {
|
||||
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->addSelectColumn(BpmnProcessPeer::DIA_UID);
|
||||
$criteria->add(BpmnProcessPeer::PRJ_UID, $this->getPrjUid(), \Criteria::EQUAL);
|
||||
$rsCriteria = BpmnProcessPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
$row = $rsCriteria->getRow();
|
||||
$this->bound->setDiaUid($row["DIA_UID"]);
|
||||
$this->bound->setBouContainer('bpmnLane');
|
||||
$this->bound->setBouElement($this->getLnsUid());
|
||||
}
|
||||
}
|
||||
|
||||
public static function findOneBy($field, $value)
|
||||
{
|
||||
$rows = self::findAllBy($field, $value);
|
||||
|
||||
return empty($rows) ? null : $rows[0];
|
||||
}
|
||||
|
||||
public static function findAllBy($field, $value)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->add($field, $value, Criteria::EQUAL);
|
||||
|
||||
return BpmnLanePeer::doSelect($c);
|
||||
}
|
||||
|
||||
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn("BPMN_LANE.*");
|
||||
$c->addSelectColumn("BPMN_BOUND.*");
|
||||
$c->addJoin(BpmnLanePeer::LAN_UID, BpmnBoundPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
if (! is_null($prjUid)) {
|
||||
$c->add(BpmnLanePeer::PRJ_UID, $prjUid, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rs = BpmnLanePeer::doSelectRS($c);
|
||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$lanes = array();
|
||||
|
||||
while ($rs->next()) {
|
||||
$lanes[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
||||
}
|
||||
|
||||
return $lanes;
|
||||
}
|
||||
|
||||
// OVERRIDES
|
||||
|
||||
public function setLanUid($actUid)
|
||||
{
|
||||
parent::setLanUid($actUid);
|
||||
$this->bound->setElementUid($this->getLanUid());
|
||||
}
|
||||
|
||||
public function setPrjUid($prjUid)
|
||||
{
|
||||
parent::setPrjUid($prjUid);
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
}
|
||||
|
||||
public function save($con = null)
|
||||
{
|
||||
parent::save($con);
|
||||
|
||||
$this->setBoundDefaults();
|
||||
|
||||
if ($this->bound->getBouUid() == "") {
|
||||
$this->bound->setBouUid(\ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->save($con);
|
||||
}
|
||||
|
||||
public function delete($con = null)
|
||||
{
|
||||
// first, delete the related bound object
|
||||
if (! is_object($this->bound) || $this->bound->getBouUid() == "") {
|
||||
$this->bound = BpmnBound::findByElement('Lane', $this->getLanUid());
|
||||
}
|
||||
|
||||
if (is_object($this->bound)) {
|
||||
$this->bound->delete($con);
|
||||
}
|
||||
|
||||
parent::delete($con);
|
||||
}
|
||||
|
||||
public function fromArray($data, $type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
parent::fromArray($data, $type);
|
||||
|
||||
$bound = BpmnBound::findByElement('Lane', $this->getLanUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
} else {
|
||||
$this->bound = new BpmnBound();
|
||||
$this->bound->setBouUid(ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
|
||||
public function toArray($type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
$data = parent::toArray($type);
|
||||
$bouUid = $this->bound->getBouUid();
|
||||
|
||||
if (empty($bouUid)) {
|
||||
$bound = BpmnBound::findByElement('Lane', $this->getLanUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array_merge($data, $this->bound->toArray($type));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function exists($actUid)
|
||||
{
|
||||
$c = new Criteria("workflow");
|
||||
$c->add(BpmnlanesPeer::LAN_UID, $actUid);
|
||||
|
||||
return BpmnlanesPeer::doCount($c) > 0 ? true : false;
|
||||
}
|
||||
|
||||
} // BpmnLane
|
||||
|
||||
@@ -15,5 +15,164 @@ require_once 'classes/model/om/BaseBpmnLaneset.php';
|
||||
* @package classes.model
|
||||
*/
|
||||
class BpmnLaneset extends BaseBpmnLaneset {
|
||||
private $bound;
|
||||
|
||||
public function __construct($generateUid = true)
|
||||
{
|
||||
$this->bound = new BpmnBound();
|
||||
$this->setBoundDefaults();
|
||||
}
|
||||
|
||||
public function getBound()
|
||||
{
|
||||
return $this->bound;
|
||||
}
|
||||
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getLnsUid());
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
|
||||
|
||||
if (is_object($process)) {
|
||||
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
$this->bound->setBouElement($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
public static function findOneBy($field, $value)
|
||||
{
|
||||
$rows = self::findAllBy($field, $value);
|
||||
|
||||
return empty($rows) ? null : $rows[0];
|
||||
}
|
||||
|
||||
public static function findAllBy($field, $value)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->add($field, $value, Criteria::EQUAL);
|
||||
|
||||
return BpmnLanesetPeer::doSelect($c);
|
||||
}
|
||||
|
||||
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn("BPMN_LANESET.*");
|
||||
$c->addSelectColumn("BPMN_BOUND.*");
|
||||
$c->addJoin(BpmnLanesetPeer::LNS_UID, BpmnBoundPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
if (! is_null($prjUid)) {
|
||||
$c->add(BpmnLanesetPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rs = BpmnLanesetPeer::doSelectRS($c);
|
||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$laneSet = array();
|
||||
|
||||
while ($rs->next()) {
|
||||
$laneSet[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
||||
}
|
||||
|
||||
return $laneSet;
|
||||
}
|
||||
|
||||
// OVERRIDES
|
||||
|
||||
public function setLnsUid($actUid)
|
||||
{
|
||||
parent::setLnsUid($actUid);
|
||||
$this->bound->setElementUid($this->getLnsUid());
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
parent::save($con);
|
||||
|
||||
$this->setBoundDefaults();
|
||||
|
||||
if ($this->bound->getBouUid() == "") {
|
||||
$this->bound->setBouUid(\ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->save($con);
|
||||
}
|
||||
|
||||
public function delete($con = null)
|
||||
{
|
||||
// first, delete the related bound object
|
||||
if (! is_object($this->bound) || $this->bound->getBouUid() == "") {
|
||||
$this->bound = BpmnBound::findByElement('LaneSet', $this->getLnsUid());
|
||||
}
|
||||
|
||||
if (is_object($this->bound)) {
|
||||
$this->bound->delete($con);
|
||||
}
|
||||
|
||||
parent::delete($con);
|
||||
}
|
||||
|
||||
public function fromArray($data, $type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
parent::fromArray($data, $type);
|
||||
|
||||
$bound = BpmnBound::findByElement('LaneSet', $this->getLnsUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
} else {
|
||||
$this->bound = new BpmnBound();
|
||||
$this->bound->setBouUid(ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
|
||||
public function toArray($type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
$data = parent::toArray($type);
|
||||
$bouUid = $this->bound->getBouUid();
|
||||
|
||||
if (empty($bouUid)) {
|
||||
$bound = BpmnBound::findByElement('LaneSet', $this->getLnsUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array_merge($data, $this->bound->toArray($type));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function exists($actUid)
|
||||
{
|
||||
$c = new Criteria("workflow");
|
||||
$c->add(BpmnLanesetPeer::LNS_UID, $actUid);
|
||||
|
||||
return BpmnLanesetPeer::doCount($c) > 0 ? true : false;
|
||||
}
|
||||
|
||||
|
||||
} // BpmnLaneset
|
||||
|
||||
@@ -32,8 +32,6 @@ class BpmnParticipant extends BaseBpmnParticipant
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getParUid());
|
||||
@@ -42,6 +40,13 @@ class BpmnParticipant extends BaseBpmnParticipant
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
if (isset($this->getLnsUid)) {
|
||||
$this->bound->setBouContainer('bpmnLane');
|
||||
$this->bound->setBouElement($this->getLnsUid());
|
||||
} else {
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
}
|
||||
$this->bound->setBouElement($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ class Process extends BaseProcess
|
||||
if (! $getAllLang) {
|
||||
$c->add( ContentPeer::CON_LANG, $lang );
|
||||
}
|
||||
$rs = ProcessPeer::doSelectRS( $c );
|
||||
$rs = ProcessPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
@@ -352,7 +352,7 @@ class Process extends BaseProcess
|
||||
$oCriteria->add( ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL );
|
||||
|
||||
//execute the query
|
||||
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
|
||||
$oDataset = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$processes = Array ();
|
||||
$uids = array ();
|
||||
@@ -369,7 +369,7 @@ class Process extends BaseProcess
|
||||
$c->add( ContentPeer::CON_LANG, defined( 'SYS_LANG' ) ? SYS_LANG : 'en', Criteria::EQUAL );
|
||||
$c->add( ContentPeer::CON_ID, $uids, Criteria::IN );
|
||||
|
||||
$dt = ContentPeer::doSelectRS( $c );
|
||||
$dt = ContentPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
|
||||
$dt->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
while ($dt->next()) {
|
||||
@@ -484,7 +484,7 @@ class Process extends BaseProcess
|
||||
// validate if the category exists
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria->add( ProcessCategoryPeer::CATEGORY_UID, $aData['PRO_CATEGORY'] );
|
||||
$ds = ProcessCategoryPeer::doSelectRS( $criteria );
|
||||
$ds = ProcessCategoryPeer::doSelectRS( $criteria, Propel::getDbConnection('workflow_ro') );
|
||||
$ds->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$ds->next();
|
||||
// if it is not set, set value as empty "No Category"
|
||||
@@ -576,7 +576,7 @@ class Process extends BaseProcess
|
||||
$oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' );
|
||||
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
|
||||
$oCriteria->add( ContentPeer::CON_VALUE, $PRO_TITLE );
|
||||
$oDataset = ContentPeer::doSelectRS( $oCriteria );
|
||||
$oDataset = ContentPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
$oDataset->next();
|
||||
@@ -590,7 +590,7 @@ class Process extends BaseProcess
|
||||
$c = $this->tmpCriteria;
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( 'COUNT(*)' );
|
||||
$oDataset = ProcessPeer::doSelectRS( $c );
|
||||
$oDataset = ProcessPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
@@ -660,7 +660,7 @@ class Process extends BaseProcess
|
||||
// getting bpmn projects
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
|
||||
$ds = ProcessPeer::doSelectRS($c);
|
||||
$ds = ProcessPeer::doSelectRS($c, Propel::getDbConnection('workflow_ro') );
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$bpmnProjects = array();
|
||||
|
||||
@@ -690,7 +690,7 @@ class Process extends BaseProcess
|
||||
$c->add( ContentPeer::CON_LANG, defined( 'SYS_LANG' ) ? SYS_LANG : 'en', Criteria::EQUAL );
|
||||
$c->add( ContentPeer::CON_ID, $uids, Criteria::IN );
|
||||
|
||||
$dt = ContentPeer::doSelectRS( $c );
|
||||
$dt = ContentPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
|
||||
$dt->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
while ($dt->next()) {
|
||||
@@ -807,7 +807,7 @@ class Process extends BaseProcess
|
||||
$oCriteria->addGroupByColumn( ApplicationPeer::PRO_UID );
|
||||
$oCriteria->addGroupByColumn( ApplicationPeer::APP_STATUS );
|
||||
|
||||
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
|
||||
$oDataset = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
$aProcesses = Array ();
|
||||
@@ -825,7 +825,7 @@ class Process extends BaseProcess
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( 'COUNT(*) AS TOTAL_CASES' );
|
||||
$oCriteria->add( ApplicationPeer::PRO_UID, $pro_uid );
|
||||
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
|
||||
$oDataset = ApplicationPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
$oDataset->next();
|
||||
@@ -839,7 +839,7 @@ class Process extends BaseProcess
|
||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_CATEGORY );
|
||||
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
||||
$oCriteria->addGroupByColumn( ProcessPeer::PRO_CATEGORY );
|
||||
$oDataSet = ProcessPeer::doSelectRS( $oCriteria );
|
||||
$oDataSet = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$aProc = Array ();
|
||||
while ($oDataSet->next()) {
|
||||
@@ -883,7 +883,7 @@ class Process extends BaseProcess
|
||||
$oCriteria->addSelectColumn( TriggersPeer::TRI_WEBBOT );
|
||||
$oCriteria->addJoin( $var, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN );
|
||||
$oCriteria->add( ProcessPeer::PRO_UID, $proUid );
|
||||
$oDataSet = ProcessPeer::doSelectRS( $oCriteria );
|
||||
$oDataSet = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
|
||||
$oDataSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
if ($oDataSet->next()) {
|
||||
|
||||
@@ -212,7 +212,7 @@ class Users extends BaseUsers
|
||||
public function loadByUsernameInArray ($sUsername)
|
||||
{
|
||||
$c = $this->loadByUsername( $sUsername );
|
||||
$rs = UsersPeer::doSelectRS( $c );
|
||||
$rs = UsersPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
|
||||
@@ -188,7 +188,7 @@ class AppProxy extends HttpProxyController
|
||||
$criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||
$criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
if (AppDelegationPeer::doCount($criteria) > 0) {
|
||||
$dataset = AppDelegationPeer::doSelectRS($criteria);
|
||||
$dataset = AppDelegationPeer::doSelectRS($criteria, Propel::getDbConnection('workflow_ro'));
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$row = $dataset->getRow();
|
||||
@@ -243,7 +243,7 @@ class AppProxy extends HttpProxyController
|
||||
$criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||
$criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
if (AppDelegationPeer::doCount($criteria) > 0) {
|
||||
$dataset = AppDelegationPeer::doSelectRS($criteria);
|
||||
$dataset = AppDelegationPeer::doSelectRS($criteria, Propel::getDbConnection('workflow_ro') );
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$row = $dataset->getRow();
|
||||
|
||||
@@ -216,7 +216,7 @@ function getAllUsersArray ($action)
|
||||
}
|
||||
|
||||
$cUsers->addAscendingOrderByColumn( AppCacheViewPeer::APP_CURRENT_USER );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $cUsers );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $cUsers , Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
@@ -282,7 +282,7 @@ function getStatusArray ($action, $userUid)
|
||||
$cStatus->clearSelectColumns();
|
||||
$cStatus->setDistinct();
|
||||
$cStatus->addSelectColumn( AppCacheViewPeer::APP_STATUS );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $cStatus );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $cStatus, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
|
||||
@@ -178,7 +178,7 @@ if ($actionAjax == "processListExtJs") {
|
||||
|
||||
$cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE);
|
||||
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $cProcess );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $cProcess, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ try {
|
||||
$Criteria->addAscendingOrderByColumn( $sort );
|
||||
}
|
||||
}
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $Criteria );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $Criteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->next();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ if ($filter != '') {
|
||||
//echo $oCriteria->toString();
|
||||
}
|
||||
|
||||
$rs = UsersPeer::DoSelectRs( $oCriteria );
|
||||
$rs = UsersPeer::DoSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
$rows = Array ();
|
||||
|
||||
@@ -59,7 +59,7 @@ try {
|
||||
G::LoadClass('Users');
|
||||
$oUser = new Users();
|
||||
$oCriteria = $oUser->loadByUsername($_POST['sUsername']);
|
||||
$oDataset = UsersPeer::doSelectRS($oCriteria);
|
||||
$oDataset = UsersPeer::doSelectRs($oCriteria, Propel::getDbConnection('workflow_ro'));
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
@@ -450,6 +450,7 @@ class Step
|
||||
public function delete($stepUid)
|
||||
{
|
||||
try {
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsStep($stepUid);
|
||||
|
||||
@@ -916,5 +917,243 @@ class Step
|
||||
$oStep = new \Step();
|
||||
$oStep->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Steps for a Task
|
||||
*
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $processUid Unique id of Process
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new Steps created
|
||||
*/
|
||||
public function createAll($taskUid, $processUid, $arrayData)
|
||||
{
|
||||
try {
|
||||
$stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
unset($arrayData["STEP_UID"]);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsTask($taskUid);
|
||||
|
||||
$this->throwExceptionIfNotExistsProcess($processUid);
|
||||
|
||||
if (!isset($arrayData["STEP_TYPE_OBJ"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepTypeObj"])));
|
||||
}
|
||||
|
||||
$arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]);
|
||||
|
||||
if ($arrayData["STEP_TYPE_OBJ"] == "") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepTypeObj"])));
|
||||
}
|
||||
|
||||
if (!isset($arrayData["STEP_UID_OBJ"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepUidObj"])));
|
||||
}
|
||||
|
||||
$arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]);
|
||||
|
||||
if ($arrayData["STEP_UID_OBJ"] == "") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepUidObj"])));
|
||||
}
|
||||
|
||||
if (!isset($arrayData["STEP_MODE"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepMode"])));
|
||||
}
|
||||
|
||||
$arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]);
|
||||
|
||||
if ($arrayData["STEP_MODE"] == "") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepMode"])));
|
||||
}
|
||||
|
||||
$this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]);
|
||||
|
||||
$this->throwExceptionIfHaveInvalidValueInMode($arrayData["STEP_MODE"]);
|
||||
|
||||
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], $this->arrayParamException["stepUidObj"]);
|
||||
|
||||
if ($msg != "") {
|
||||
throw new \Exception($msg);
|
||||
}
|
||||
|
||||
if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP")));
|
||||
}
|
||||
|
||||
//Create
|
||||
$step = new \Step();
|
||||
|
||||
$stepUid = $step->create(array(
|
||||
"PRO_UID" => $processUid,
|
||||
"TAS_UID" => $taskUid,
|
||||
"STEP_POSITION" => $arrayData["STEP_POSITION"]
|
||||
));
|
||||
|
||||
if (!isset($arrayData["STEP_POSITION"]) || $arrayData["STEP_POSITION"] == "") {
|
||||
unset($arrayData["STEP_POSITION"]);
|
||||
}
|
||||
|
||||
$arrayData = $this->updateAll($stepUid, $arrayData);
|
||||
|
||||
//Return
|
||||
unset($arrayData["STEP_UID"]);
|
||||
|
||||
$arrayData = array_merge(array("STEP_UID" => $stepUid), $arrayData);
|
||||
|
||||
if (!$this->formatFieldNameInUppercase) {
|
||||
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||
}
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Steps of a Task
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the Steps updated
|
||||
*/
|
||||
public function updateAll($stepUid, $arrayData)
|
||||
{
|
||||
try {
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsStep($stepUid);
|
||||
|
||||
//Load Step
|
||||
$step = new \Step();
|
||||
$arrayStepData = $step->load($stepUid);
|
||||
|
||||
$taskUid = $arrayStepData["TAS_UID"];
|
||||
$proUid = $arrayStepData["PRO_UID"];
|
||||
|
||||
//Verify data
|
||||
if (isset($arrayData["STEP_TYPE_OBJ"]) && !isset($arrayData["STEP_UID_OBJ"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepUidObj"])));
|
||||
}
|
||||
|
||||
if (!isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->arrayParamException["stepTypeObj"])));
|
||||
}
|
||||
|
||||
if (isset($arrayData["STEP_TYPE_OBJ"])) {
|
||||
$arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]);
|
||||
|
||||
if ($arrayData["STEP_TYPE_OBJ"] == "") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepTypeObj"])));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["STEP_UID_OBJ"])) {
|
||||
$arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]);
|
||||
|
||||
if ($arrayData["STEP_UID_OBJ"] == "") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepUidObj"])));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["STEP_MODE"])) {
|
||||
$arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]);
|
||||
|
||||
if ($arrayData["STEP_MODE"] == "") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->arrayParamException["stepMode"])));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["STEP_TYPE_OBJ"])) {
|
||||
$this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]);
|
||||
}
|
||||
|
||||
if (isset($arrayData["STEP_MODE"])) {
|
||||
$this->throwExceptionIfHaveInvalidValueInMode($arrayData["STEP_MODE"]);
|
||||
}
|
||||
|
||||
if (isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) {
|
||||
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], $this->arrayParamException["stepUidObj"]);
|
||||
|
||||
if ($msg != "") {
|
||||
throw new \Exception($msg);
|
||||
}
|
||||
|
||||
if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], 0, $stepUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP")));
|
||||
}
|
||||
}
|
||||
|
||||
//Update
|
||||
$step = new \Step();
|
||||
|
||||
$arrayData["STEP_UID"] = $stepUid;
|
||||
$result = $step->update($arrayData);
|
||||
|
||||
//Return
|
||||
unset($arrayData["STEP_UID"]);
|
||||
|
||||
if (!$this->formatFieldNameInUppercase) {
|
||||
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||
}
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Steps and triggers of a Task
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $taskUid Unique id of Step
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function deleteAll($taskUid)
|
||||
{
|
||||
try {
|
||||
$step = new \Step();
|
||||
$stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$criteriaTrigger = new \Criteria("workflow");
|
||||
$criteriaTrigger->addSelectColumn(\StepTriggerPeer::STEP_UID);
|
||||
$criteriaTrigger->addSelectColumn(\StepTriggerPeer::ST_TYPE);
|
||||
$criteriaTrigger->addSelectColumn(\StepTriggerPeer::TRI_UID);
|
||||
$criteriaTrigger->add(\StepTriggerPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
|
||||
$rsCriteriaTrigger = \StepTriggerPeer::doSelectRS($criteriaTrigger);
|
||||
$rsCriteriaTrigger->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteriaTrigger->next();
|
||||
|
||||
while ($aRowTrigger = $rsCriteriaTrigger->getRow()) {
|
||||
|
||||
$stepTrigger->delete($aRowTrigger['STEP_UID'], $aRowTrigger['ST_TYPE'], $taskUid, $aRowTrigger['TRI_UID']);
|
||||
$rsCriteriaTrigger->next();
|
||||
}
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\StepPeer::STEP_UID);
|
||||
$criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \StepPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
|
||||
while ($aRow = $rsCriteria->getRow()) {
|
||||
$step->remove($aRow['STEP_UID']);
|
||||
$rsCriteria->next();
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -451,5 +451,161 @@ class Trigger
|
||||
$StepTrigger = new \StepTrigger();
|
||||
$StepTrigger->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign Trigger to a Step
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $triggerUid Unique id of Trigger
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Data of the Trigger assigned to a Step
|
||||
*/
|
||||
public function createAll($stepUid, $type, $taskUid, $triggerUid, $arrayData)
|
||||
{
|
||||
try {
|
||||
$stepUidIni = $stepUid;
|
||||
$typeIni = $type;
|
||||
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
if ($stepUid == "") {
|
||||
$flagStepAssignTask = 1;
|
||||
|
||||
switch ($type) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "AFTER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Verify data
|
||||
if ($flagStepAssignTask == 0) {
|
||||
$step = new \Step();
|
||||
|
||||
if (!$step->StepExists($stepUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array("step_uid", $stepUid)));
|
||||
}
|
||||
}
|
||||
|
||||
$task = new \Task();
|
||||
|
||||
if (!$task->taskExists($taskUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array("act_uid", $taskUid)));
|
||||
}
|
||||
|
||||
$trigger = new \Triggers();
|
||||
|
||||
if (!$trigger->TriggerExists($triggerUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array("tri_uid", $triggerUid)));
|
||||
}
|
||||
|
||||
if ($this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_EXISTS_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER")));
|
||||
}
|
||||
|
||||
//Create
|
||||
$stepTrigger = new \StepTrigger();
|
||||
// $posIni = $stepTrigger->getNextPosition($stepUid, $type, $taskUid);
|
||||
|
||||
$stepTrigger->createRow(array(
|
||||
"STEP_UID" => $stepUid,
|
||||
"TAS_UID" => $taskUid,
|
||||
"TRI_UID" => $triggerUid,
|
||||
"ST_TYPE" => $type,
|
||||
"ST_CONDITION" => (isset($arrayData['st_condition'])) ? $arrayData['st_condition'] : '',
|
||||
"ST_POSITION" => $arrayData['st_position']
|
||||
));
|
||||
|
||||
$arrayData = $this->updateAll($stepUid, $typeIni, $taskUid, $triggerUid, $arrayData);
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Trigger of a Step
|
||||
*
|
||||
* @param string $stepUid Unique id of Step
|
||||
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
|
||||
* @param string $taskUid Unique id of Task
|
||||
* @param string $triggerUid Unique id of Trigger
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Data updated of the Trigger assigned to a Step
|
||||
*/
|
||||
public function updateAll($stepUid, $type, $taskUid, $triggerUid, $arrayData)
|
||||
{
|
||||
try {
|
||||
$flagStepAssignTask = 0;
|
||||
|
||||
if (($stepUid == "") || ($stepUid == "-1") || ($stepUid == "-2")) {
|
||||
$flagStepAssignTask = 1;
|
||||
|
||||
switch ($type) {
|
||||
case "BEFORE_ASSIGNMENT":
|
||||
$stepUid = "-1";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "BEFORE_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "BEFORE";
|
||||
break;
|
||||
case "AFTER_ROUTING":
|
||||
$stepUid = "-2";
|
||||
$type = "AFTER";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Verify data
|
||||
if ($flagStepAssignTask == 0) {
|
||||
$step = new \Step();
|
||||
|
||||
if (!$step->StepExists($stepUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array("step_uid", $stepUid)));
|
||||
}
|
||||
}
|
||||
|
||||
$trigger = new \Triggers();
|
||||
|
||||
if (!$trigger->TriggerExists($triggerUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array("tri_uid", $triggerUid)));
|
||||
}
|
||||
|
||||
//Update
|
||||
$stepTrigger = new \StepTrigger();
|
||||
|
||||
$arrayUpdateData = array();
|
||||
|
||||
$arrayUpdateData["STEP_UID"] = $stepUid;
|
||||
$arrayUpdateData["TAS_UID"] = $taskUid;
|
||||
$arrayUpdateData["TRI_UID"] = $triggerUid;
|
||||
$arrayUpdateData["ST_TYPE"] = $type;
|
||||
|
||||
if (isset($arrayData["st_condition"])) {
|
||||
$arrayUpdateData["ST_CONDITION"] = $arrayData["st_condition"];
|
||||
}
|
||||
|
||||
$stepTrigger->update($arrayUpdateData);
|
||||
|
||||
return array_change_key_case($arrayUpdateData, CASE_LOWER);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -481,7 +481,6 @@ class Variable
|
||||
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
@@ -586,5 +585,98 @@ class Variable
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all records by execute SQL suggest
|
||||
*
|
||||
* @param string $processUid Unique id of Process
|
||||
* @param string $variableName Variable name
|
||||
* @param array $arrayVariable The variables
|
||||
*
|
||||
* return array Return an array with all records
|
||||
*/
|
||||
public function executeSqlSuggest($processUid, $variableName, array $arrayVariable = array())
|
||||
{
|
||||
try {
|
||||
$arrayRecord = array();
|
||||
|
||||
//Verify data
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, strtolower("PRJ_UID"));
|
||||
|
||||
//Set data
|
||||
$variableDbConnectionUid = "";
|
||||
$variableSql = "";
|
||||
$sqlLimit = "";
|
||||
$variableSqlLimit = "";
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DBCONNECTION);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_SQL);
|
||||
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$variableDbConnectionUid = $row["VAR_DBCONNECTION"];
|
||||
$variableSql = $row["VAR_SQL"];
|
||||
} else {
|
||||
throw new \Exception(\G::LoadTranslation("ID_PROCESS_VARIABLE_DOES_NOT_EXIST", array(strtolower("VAR_NAME"), $variableName)));
|
||||
}
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfSomeRequiredVariableSqlIsMissingInVariables($variableName, $variableSql, $arrayVariable);
|
||||
|
||||
//Get data
|
||||
$_SESSION["PROCESS"] = $processUid;
|
||||
|
||||
foreach ($arrayVariable as $keyRequest => $valueRequest) {
|
||||
$keyRequest = strtoupper($keyRequest);
|
||||
|
||||
if ($keyRequest == 'LIMIT') {
|
||||
if (strpos($variableSql, 'LIMIT')) {
|
||||
$variableSqlLimit = explode("LIMIT", $variableSql);
|
||||
$sqlLimit = " LIMIT " . $variableSqlLimit[1];
|
||||
$variableSql = $variableSqlLimit[0];
|
||||
} else {
|
||||
$sqlLimit = " LIMIT ". 0 . ", " . $valueRequest;
|
||||
}
|
||||
} else {
|
||||
if (strpos($variableSql, 'WHERE')) {
|
||||
$sqlConditionLike = " AND " . $keyRequest . " LIKE '%" . $valueRequest . "%'";
|
||||
} else {
|
||||
$sqlConditionLike = " WHERE " . $keyRequest . " LIKE '%" . $valueRequest . "%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sqlQuery = $variableSql . $sqlConditionLike . $sqlLimit;
|
||||
|
||||
$cnn = \Propel::getConnection(($variableDbConnectionUid . "" != "")? $variableDbConnectionUid : "workflow");
|
||||
$stmt = $cnn->createStatement();
|
||||
|
||||
$rs = $stmt->executeQuery(\G::replaceDataField($sqlQuery, $arrayVariable), \ResultSet::FETCHMODE_NUM);
|
||||
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
|
||||
$arrayRecord[] = array(
|
||||
strtolower("VALUE") => $row[0],
|
||||
strtolower("TEXT") => $row[1]
|
||||
);
|
||||
}
|
||||
|
||||
//Return
|
||||
return $arrayRecord;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -671,6 +671,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$diagram["lanes"] = $bwp->getLanes($configList);
|
||||
$diagram["data"] = $bwp->getDataCollection($configList);
|
||||
$diagram["participants"] = $bwp->getParticipants($configList);
|
||||
$diagram["lanesets"] = $bwp->getLanesets($configList);
|
||||
$diagram["lanes"] = $bwp->getLanes($configList);
|
||||
$project["diagrams"][] = $diagram;
|
||||
}
|
||||
|
||||
@@ -726,6 +728,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$diagram["events"] = isset($diagram["events"])? $diagram["events"]: array();
|
||||
$diagram["data"] = isset($diagram["data"])? $diagram["data"]: array();
|
||||
$diagram["participants"] = isset($diagram["participants"])? $diagram["participants"]: array();
|
||||
$diagram["lanesets"] = isset($diagram["lanesets"])? $diagram["lanesets"]: array();
|
||||
$diagram["lanes"] = isset($diagram["lanes"])? $diagram["lanes"]: array();
|
||||
$result = array();
|
||||
|
||||
$projectData['prj_uid'] = $prjUid;
|
||||
@@ -1032,6 +1036,97 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
/*
|
||||
* Diagram's Laneset Handling
|
||||
*/
|
||||
$whiteList = array();
|
||||
foreach ($diagram["laneset"] as $i => $lanesetData) {
|
||||
$lanesetData = array_change_key_case($lanesetData, CASE_UPPER);
|
||||
|
||||
$dataObject = $bwp->getLaneset($lanesetData["LNS_UID"]);
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Laneset
|
||||
unset($lanesetData["BOU_UID"]);
|
||||
|
||||
$uidOld = $lanesetData["LNS_UID"];
|
||||
$lanesetData["LNS_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "laneset",
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $lanesetData["LNS_UID"]
|
||||
);
|
||||
}
|
||||
$bwp->addLaneset($lanesetData);
|
||||
} elseif (! $bwp->isEquals($dataObject, $lanesetData)) {
|
||||
$bwp->updateLanseset($lanesetData["LNS_UID"], $lanesetData);
|
||||
} else {
|
||||
Util\Logger::log("Update Laneset ({$lanesetData["LNS_UID"]}) Skipped - No changes required");
|
||||
}
|
||||
|
||||
$diagram["laneset"][$i] = $lanesetData;
|
||||
$whiteList[] = $lanesetData["LNS_UID"];
|
||||
}
|
||||
|
||||
$dataCollection = $bwp->getLanesets();
|
||||
|
||||
// looking for removed elements
|
||||
foreach ($dataCollection as $lanesetData) {
|
||||
if (! in_array($lanesetData["LNS_UID"], $whiteList)) {
|
||||
// If it is not in the white list, then remove them
|
||||
$bwp->removeLaneset($lanesetData["LNS_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
/*
|
||||
* Diagram's Lane Handling
|
||||
*/
|
||||
$whiteList = array();
|
||||
foreach ($diagram["lanes"] as $i => $laneData) {
|
||||
$laneData = array_change_key_case($laneData, CASE_UPPER);
|
||||
|
||||
$dataObject = $bwp->getLane($laneData["LAN_UID"]);
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Laneset
|
||||
unset($laneData["BOU_UID"]);
|
||||
|
||||
$uidOld = $laneData["LAN_UID"];
|
||||
$laneData["LAN_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "lane",
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $laneData["LAN_UID"]
|
||||
);
|
||||
}
|
||||
$bwp->addLane($laneData);
|
||||
} elseif (! $bwp->isEquals($dataObject, $laneData)) {
|
||||
$bwp->updateLanse($laneData["LAN_UID"], $laneData);
|
||||
} else {
|
||||
Util\Logger::log("Update Lane ({$laneData["LAN_UID"]}) Skipped - No changes required");
|
||||
}
|
||||
|
||||
$diagram["lane"][$i] = $laneData;
|
||||
$whiteList[] = $laneData["LAN_UID"];
|
||||
}
|
||||
|
||||
$dataCollection = $bwp->getLanes();
|
||||
|
||||
// looking for removed elements
|
||||
foreach ($dataCollection as $laneData) {
|
||||
if (! in_array($laneData["LAN_UID"], $whiteList)) {
|
||||
// If it is not in the white list, then remove them
|
||||
$bwp->removeLane($laneData["LAN_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Diagram's Flows Handling
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,6 @@ namespace ProcessMaker\Project;
|
||||
use \BpmnProject as Project;
|
||||
use \BpmnProcess as Process;
|
||||
use \BpmnDiagram as Diagram;
|
||||
use \BpmnLaneset as Laneset;
|
||||
use \BpmnLane as Lane;
|
||||
use \BpmnActivity as Activity;
|
||||
use \BpmnBound as Bound;
|
||||
use \BpmnEvent as Event;
|
||||
@@ -16,8 +14,7 @@ use \BpmnArtifact as Artifact;
|
||||
use \BpmnProjectPeer as ProjectPeer;
|
||||
use \BpmnProcessPeer as ProcessPeer;
|
||||
use \BpmnDiagramPeer as DiagramPeer;
|
||||
use \BpmnLanesetPeer as LanesetPeer;
|
||||
use \BpmnLanePeer as LanePeer;
|
||||
|
||||
use \BpmnActivityPeer as ActivityPeer;
|
||||
use \BpmnBoundPeer as BoundPeer;
|
||||
use \BpmnEventPeer as EventPeer;
|
||||
@@ -26,6 +23,10 @@ use \BpmnFlowPeer as FlowPeer;
|
||||
use \BpmnArtifactPeer as ArtifactPeer;
|
||||
use \BpmnParticipant as Participant;
|
||||
use \BpmnParticipantPeer as ParticipantPeer;
|
||||
use \BpmnLaneset as Laneset;
|
||||
use \BpmnLanesetPeer as LanesetPeer;
|
||||
use \BpmnLane as Lane;
|
||||
use \BpmnLanePeer as LanePeer;
|
||||
|
||||
use \BasePeer;
|
||||
use \Criteria as Criteria;
|
||||
@@ -78,6 +79,8 @@ class Bpmn extends Handler
|
||||
"flow" => array("PRJ_UID", "DIA_UID", "FLO_ELEMENT_DEST_PORT", "FLO_ELEMENT_ORIGIN_PORT"),
|
||||
"data" => array("PRJ_UID"),
|
||||
"participant" => array("PRJ_UID"),
|
||||
"laneset" => array(),
|
||||
"lane" => array()
|
||||
);
|
||||
|
||||
|
||||
@@ -179,7 +182,12 @@ class Bpmn extends Handler
|
||||
foreach ($this->getParticipants() as $participant) {
|
||||
$this->removeParticipant($participant["PAR_UID"]);
|
||||
}
|
||||
|
||||
foreach ($this->getLanesets() as $laneset) {
|
||||
$this->removeLaneset($laneset["LNS_UID"]);
|
||||
}
|
||||
foreach ($this->getLanes() as $lane) {
|
||||
$this->removeLane($lane["LAN_UID"]);
|
||||
}
|
||||
if ($process = $this->getProcess("object")) {
|
||||
$process->delete();
|
||||
}
|
||||
@@ -635,6 +643,8 @@ class Bpmn extends Handler
|
||||
case "bpmnArtifact": $class = "BpmnArtifact"; break;
|
||||
case "bpmnData": $class = "BpmnData"; break;
|
||||
case "bpmnParticipant": $class = "BpmnParticipant"; break;
|
||||
case "bpmnLaneset": $class = "BpmnLaneset"; break;
|
||||
case "bpmnLane": $class = "BpmnLane"; break;
|
||||
default:
|
||||
throw new \RuntimeException(sprintf("Invalid Object type, accepted types: [%s|%s|%s|%s], given %s.",
|
||||
"BpmnActivity", "BpmnBpmnGateway", "BpmnEvent", "bpmnArtifact", $data["FLO_ELEMENT_ORIGIN_TYPE"]
|
||||
@@ -655,6 +665,8 @@ class Bpmn extends Handler
|
||||
case "bpmnArtifact": $class = "BpmnArtifact"; break;
|
||||
case "bpmnData": $class = "BpmnData"; break;
|
||||
case "bpmnParticipant": $class = "BpmnParticipant"; break;
|
||||
case "bpmnLaneset": $class = "BpmnLaneset"; break;
|
||||
case "bpmnLane": $class = "BpmnLane"; break;
|
||||
default:
|
||||
throw new \RuntimeException(sprintf("Invalid Object type, accepted types: [%s|%s|%s|%s], given %s.",
|
||||
"BpmnActivity", "BpmnBpmnGateway", "BpmnEvent", "bpmnArtifact", $data["FLO_ELEMENT_DEST_TYPE"]
|
||||
@@ -1005,36 +1017,136 @@ class Bpmn extends Handler
|
||||
|
||||
public function addLane($data)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
// setting defaults
|
||||
$processUid = $this->getProcess("object")->getProUid();
|
||||
|
||||
$data['LAN_UID'] = array_key_exists('LAN_UID', $data) ? $data['LAN_UID'] : Common::generateUID();
|
||||
$data["PRO_UID"] = $processUid;
|
||||
|
||||
try {
|
||||
self::log("Add Lane with data: ", $data);
|
||||
$lane = new Lane();
|
||||
$lane->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$lane->setPrjUid($this->getUid());
|
||||
//$lane->setProUid($this->getProcess("object")->getProUid());
|
||||
$lane->save();
|
||||
self::log("Add Lane Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $lane->getLanUid();
|
||||
}
|
||||
|
||||
public function getLane($lanUid)
|
||||
public function getLane($lanUid, $retType = 'array')
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
$lane = LanePeer::retrieveByPK($lanUid);
|
||||
|
||||
if ($retType != "object" && ! empty($lane)) {
|
||||
$lane = $lane->toArray();
|
||||
$lane = self::filterArrayKeys($lane, self::$excludeFields["lane"]);
|
||||
}
|
||||
|
||||
return $lane;
|
||||
}
|
||||
|
||||
public function getLanes()
|
||||
public function getLanes($start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
return array();
|
||||
if (is_array($start)) {
|
||||
extract($start);
|
||||
}
|
||||
|
||||
$filter = $changeCaseTo != CASE_UPPER ? array_map("strtolower", self::$excludeFields["lane"]) : self::$excludeFields["lane"];
|
||||
|
||||
return self::filterCollectionArrayKeys(
|
||||
Lane::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo),
|
||||
$filter
|
||||
);
|
||||
}
|
||||
|
||||
public function removeLane($lanUid)
|
||||
{
|
||||
try {
|
||||
self::log("Remove Lane: $lanUid");
|
||||
|
||||
$lane = LanePeer::retrieveByPK($lanUid);
|
||||
$lane->delete();
|
||||
|
||||
// remove related object (flows)
|
||||
Flow::removeAllRelated($lanUid);
|
||||
|
||||
self::log("Remove Lane Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addLaneset($data)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
// setting defaults
|
||||
$processUid = $this->getProcess("object")->getProUid();
|
||||
$data['LNS_UID'] = array_key_exists('LNS_UID', $data) ? $data['LNS_UID'] : Common::generateUID();
|
||||
$data["PRO_UID"] = $processUid;
|
||||
|
||||
try {
|
||||
self::log("Add Laneset with data: ", $data);
|
||||
$laneset = new Laneset();
|
||||
$laneset->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$laneset->setPrjUid($this->getUid());
|
||||
$laneset->setProUid($this->getProcess("object")->getProUid());
|
||||
$laneset->save();
|
||||
self::log("Add Laneset Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $laneset->getLnsUid();
|
||||
}
|
||||
|
||||
public function getLaneset($lnsUid)
|
||||
public function getLaneset($lnsUid, $retType = 'array')
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
$laneset = LanesetPeer::retrieveByPK($lnsUid);
|
||||
|
||||
if ($retType != "object" && ! empty($laneset)) {
|
||||
$laneset = $laneset->toArray();
|
||||
$laneset = self::filterArrayKeys($laneset, self::$excludeFields["laneset"]);
|
||||
}
|
||||
|
||||
return $laneset;
|
||||
}
|
||||
|
||||
public function getLanesets()
|
||||
public function getLanesets($start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
return array();
|
||||
if (is_array($start)) {
|
||||
extract($start);
|
||||
}
|
||||
$filter = $changeCaseTo != CASE_UPPER ? array_map("strtolower", self::$excludeFields["laneset"]) : self::$excludeFields["laneset"];
|
||||
return self::filterCollectionArrayKeys(
|
||||
Laneset::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo),
|
||||
$filter
|
||||
);
|
||||
}
|
||||
|
||||
public function removeLaneset($lnsUid)
|
||||
{
|
||||
try {
|
||||
self::log("Remove Laneset: $lnsUid");
|
||||
|
||||
$laneset = LanesetPeer::retrieveByPK($lnsUid);
|
||||
$laneset->delete();
|
||||
|
||||
// remove related object (flows)
|
||||
Flow::removeAllRelated($lnsUid);
|
||||
|
||||
self::log("Remove Laneset Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function isModified($element, $uid, $newData)
|
||||
{
|
||||
|
||||
@@ -216,5 +216,64 @@ class Step extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/activity/:act_uid/step/all
|
||||
*
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT,EXTERNAL}{@required true}
|
||||
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}{@required true}
|
||||
* @param string $step_condition {@from body}
|
||||
* @param int $step_position {@from body}{@min 1}
|
||||
* @param string $step_mode {@from body}{@choice EDIT,VIEW}{@required true}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostActivityStepAll(
|
||||
$act_uid,
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$step_type_obj = "DYNAFORM",
|
||||
$step_uid_obj = "00000000000000000000000000000000",
|
||||
$step_condition = "",
|
||||
$step_position = 1,
|
||||
$step_mode = "EDIT"
|
||||
) {
|
||||
try {
|
||||
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$step->deleteAll($act_uid);
|
||||
|
||||
foreach ($request_data as $key => $valueRequest) {
|
||||
if (array_key_exists('tri_uid', $valueRequest)) {
|
||||
|
||||
$response[] = $stepTrigger->createAll("", $valueRequest["st_type"], $act_uid, $valueRequest["tri_uid"], $valueRequest);
|
||||
|
||||
} else {
|
||||
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$arrayData[] = $step->createAll($act_uid, $prj_uid, $valueRequest);
|
||||
|
||||
if (array_key_exists('triggers', $valueRequest)) {
|
||||
|
||||
foreach ($valueRequest["triggers"] as $key => $valueTrigger) {
|
||||
$response["triggers"] = $stepTrigger->createAll($arrayData[0]["step_uid"], $valueTrigger["st_type"],
|
||||
$act_uid, $valueTrigger["tri_uid"], $valueTrigger);
|
||||
}
|
||||
}
|
||||
$response = $arrayData;
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,5 +129,27 @@ class Variable extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/process-variable/:var_name/execute-query-suggest
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $var_name
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPostVariableExecuteSqlSuggest($prj_uid, $var_name, $request_data)
|
||||
{
|
||||
try {
|
||||
$variable = new \ProcessMaker\BusinessModel\Variable();
|
||||
|
||||
$arrayData = ($request_data != null)? $variable->executeSqlSuggest($prj_uid, $var_name, $request_data) : $variable->executeSqlSuggest($prj_uid, $var_name);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user