Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

#825811
He arreglado el código para ejecutar las condiciones en el Case Tracker.

Puedes editar el archivo workflow/engine/classes/ProcessMap.php. En línea 3822, cambia el código de:
Code: Select all
    public function getCaseTrackerObjectsCriteria($sProcessUID)
    {
        $aObjects = array();
        $aObjects[] = array('CTO_TITLE' => 'char', 'CTO_UID' => 'char', 'CTO_TYPE_OBJ' => 'char', 'CTO_UID_OBJ' => 'char', 'CTO_CONDITION' => 'char', 'CTO_POSITION' => 'integer' );
        $oCriteria = new Criteria('workflow');
        $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
        $oCriteria->addAscendingOrderByColumn(CaseTrackerObjectPeer::CTO_POSITION);
        $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $oDataset->next();
        while ($aRow = $oDataset->getRow()) {
            try {        
                switch ($aRow['CTO_TYPE_OBJ']) {
a:
Code: Select all
    public function getCaseTrackerObjectsCriteria($sProcessUID)
    {
        $aObjects = array();
        $aObjects[] = array('CTO_TITLE' => 'char', 'CTO_UID' => 'char', 'CTO_TYPE_OBJ' => 'char', 'CTO_UID_OBJ' => 'char', 'CTO_CONDITION' => 'char', 'CTO_POSITION' => 'integer' );
        $oCriteria = new Criteria('workflow');
        $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
        $oCriteria->addAscendingOrderByColumn(CaseTrackerObjectPeer::CTO_POSITION);
        $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $oDataset->next();
        
        $oCase = new Cases(); //added by ABB
        $aCaseInfo = null;    //added by ABB
        
        while ($aRow = $oDataset->getRow()) {
            try {
                //Added by ABB to implement conditions:
                $condition = trim($aRow['CTO_CONDITION']);
                
                if ($condition and !empty($_SESSION['APPLICATION'])) {
                    //only load the case if a condition is present and it hasn't been loaded yet:
                    if (empty($aCaseInfo)) {
                        $aCaseInfo = $oCase->LoadCase($_SESSION['APPLICATION']);
                    }
                        
                    $pmScript = new PMScript();
                    $pmScript->setFields($aCaseInfo['APP_DATA']);
                    $pmScript->setScript($condition);
                    $pmScript->setExecutedOn(PMScript::CONDITION);
                    
                    if ($pmScript->evaluate() == false) {
                        $oDataset->next();
                        continue;
                    }
                }
                //end ABB's code    
                         
                switch ($aRow['CTO_TYPE_OBJ']) {
Lo he probado este código en la versión 3.3.10.
#825825
+- igual, esto lo tome de los triggers, me parecía que esto se les había ido o tenían algo bajo la manga.
Gracias por la respuesta... me encanta processmaker mucho futuro por delante tienen...
Code: Select all
 public function getCaseTrackerObjectsCriteria($sProcessUID)
    {
        $aObjects = array();
        $aObjects[] = array('CTO_TITLE' => 'char', 'CTO_UID' => 'char', 'CTO_TYPE_OBJ' => 'char', 'CTO_UID_OBJ' => 'char', 'CTO_CONDITION' => 'char', 'CTO_POSITION' => 'integer' );
        $oCriteria = new Criteria('workflow');
        $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
        $oCriteria->addAscendingOrderByColumn(CaseTrackerObjectPeer::CTO_POSITION);
        $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $oDataset->next();

        //New code: Load case vars
        $oCase = new \Cases();
        $caseData = $oCase->loadCase($_SESSION['APPLICATION']);
        $pmScript = new \PMScript();
        $pmScript->setFields( $caseData['APP_DATA'] );
        // End
        while ($aRow = $oDataset->getRow()) {
            try {
              // New code
                $condition =  $aRow['CTO_CONDITION'];
                if (trim($condition) != '') {
                    $pmScript->setScript( $condition );

                    if (! $pmScript->evaluate()) {
                        //evaluated false, jump & continue with the others object
                        $oDataset->next();
                        continue;
                    }
                }
                // End
                switch ($aRow['CTO_TYPE_OBJ']) {
                    case 'DYNAFORM':
                        $oDynaform = new Dynaform();

Hi, I want to have some of my workflows to be avai[…]

Hi Support, I think this is good. I too have fixe[…]

Hi, I'm facing the same error and when I run : […]

Routing Logic

Hi All I am doing a process, where i have 3 tasks […]