Ticket #1719: class.wf_instance.php.diff

File class.wf_instance.php.diff, 2.1 KB (added by viani, 13 years ago)

Arquivo com a implementação do método que resolve o ticket.

  • class.wf_instance.php

    old new  
    7676        private function getInstanceObject($instanceID) 
    7777        { 
    7878                $instanceID = (int) $instanceID; 
    79                 $instance = Factory::getInstance('workflow_instance'); 
     79                $instance = Factory::newInstance('workflow_instance'); 
    8080                if (!$instance->getInstance($instanceID)) 
    8181                        return false; 
    8282                else 
     
    242242        * @param array $activities Uma lista de atividades das quais se quer as instâncias (também pode ser um valor inteiro). 
    243243        * @return array As instâncias que satisfazem o critério de seleção. 
    244244        * @access public 
     245        * @deprecated 2.2.000 
    245246        */ 
    246247        public function getAll($activities = null) 
    247248        { 
     249                wf_warn_deprecated_method('wf_instances', 'getAllActive'); 
    248250                return $this->getIdle(0, $activities); 
    249251        } 
    250252 
    251253        /** 
     254        * Search and return all active instances. 
     255        * @param array $activities A list of activities codes to restrict instances from (may also be a single integer code). 
     256        * @return array The instaces which match the search criteria. 
     257        * @access public 
     258        */ 
     259        public function getAllActive($activities = null) 
     260        { 
     261                return $this->getIdle(0, $activities); 
     262        } 
     263 
     264        /** 
     265        * Retrieve all completed instances. 
     266        * @return array All completed instances from current process. Be careful this may be a long array. 
     267        * @access public 
     268        */ 
     269        public function getAllCompleted() 
     270        { 
     271                $output = array(); 
     272 
     273                // Build the SQL query 
     274                // Select all instances from the process that has a final date 
     275                $query = 'SELECT i.wf_instance_id, i.wf_started, i.wf_ended, i.wf_name, i.wf_status, i.wf_priority '; 
     276                $query .= 'FROM egw_wf_instances i '; 
     277                $query .= 'WHERE (i.wf_p_id = ?) AND (i.wf_ended > 0)'; 
     278                $resultSet = $this->db->query($query, array($this->processID)); 
     279 
     280                /* fetch the results */ 
     281                while ($row = $resultSet->fetchRow()) 
     282                { 
     283                        $output[] = $row; 
     284                } 
     285 
     286                return $output; 
     287        } 
     288 
     289        /** 
    252290        * This method gets all children instances of the given instance. 
    253291        * If there is no parameter, it gets the children instances of the current instance 
    254292        * @param int $instanceID Dad instance's identification.