/** * * @param PMSEObservable $subject * @return type */ public function update($subject) { if (method_exists($subject, 'getProcessDefinition')) { $this->logger->debug("Trigger update of a Related Relationship for a Process Definitions update"); $processDefinition = $subject->getProcessDefinition(); $processDefinitionData = $processDefinition->fetched_row; $fields = array('id', 'rel_element_type'); $relatedDependency = $this->getRelatedDependencyBean(); $this->sugarQuery->select($fields); $this->sugarQuery->from($relatedDependency); $this->sugarQuery->where()->queryAnd()->addRaw("pro_id='{$processDefinitionData['id']}' AND prj_id='{$processDefinitionData['prj_id']}' AND deleted=0"); $result = $this->sugarQuery->compileSql(); $this->logger->debug("Retrieve dependencies query: {$result}"); $rows = $this->sugarQuery->execute(); foreach ($rows as $row) { $bean = $this->getRelatedDependencyBean($row['id']); $bean->pro_status = $processDefinitionData['pro_status']; $bean->pro_locked_variables = $processDefinitionData['pro_locked_variables']; $bean->pro_terminate_variables = $processDefinitionData['pro_terminate_variables']; if ($bean->pro_module !== $processDefinitionData['pro_module'] && $row['rel_element_type'] == 'TERMINATE') { $bean->deleted = true; } $bean->save(); } $this->processRelatedDependencies($processDefinitionData); $depNumber = count($rows); $this->logger->debug("Updating {$depNumber} dependencies"); } return $result; }
/** * * @access public * @since unknown * @param type $value * @return type */ public function findByPrimaryKey($value) { $this->daoMetadata->select($this->getFields()); $this->daoMetadata->from($this->getTableName()); $this->daoMetadata->where('s_site', $value); $result = $this->daoMetadata->get(); if ($result == false) { return array(); } return $result->row(); }
/** * Method to validate whether a case been claimed * @param $casID * @param $casIndex * @return object */ public function validateReclaimCase($casID, $casIndex) { //TODO Review functionality $res = array(); //new stdClass(); $res['success'] = true; $res['result'] = false; //$caseBean = new BpmInbox(); $caseBean = $this->getInboxBean(); $this->sugarQueryObject->select(array('a.cas_id')); $this->sugarQueryObject->from($caseBean, array('alias' => 'a')); $this->sugarQueryObject->joinRaw("LEFT JOIN pmse_bpm_flow b ON (a.cas_id = b.cas_id)", array('alias' => 'b')); $this->sugarQueryObject->where()->queryAnd()->addRaw("b.cas_id = {$casID} and a.cas_index = {$casIndex}"); $rows = $this->sugarQueryObject->execute(); $caseData = $rows[0]; $res['message'] = translate('LBL_PMSE_LABEL_ERROR_INVALIDCLAIM', 'pmse_Project'); if ($caseData['cas_start_date'] == '') { $res['result'] = true; } return $res; }
/** * Pre-defined query scopes * * @param type $query */ public function scopeValid($query) { $query->where('start_at', '<=', Carbon::now())->where('end_at', '>=', Carbon::now()); }
/** * Process BOOLEAN type of search * @param type $query * @param type $key * @param array $values */ protected function setBooleanSearchQuery($query, $key, array $values) { $opertor = $values['operator']; if (isset(static::$searchParams[$key]['relation'])) { $relationKey = static::$searchParams[$key]['relation'][1]; $query->whereHas(static::$searchParams[$key]['relation'][0], function ($q) use($relationKey, $opertor) { $q->where($relationKey, $opertor == '!!1'); }); } else { $query->where($key, $opertor == '!!1'); } }
/** * Return primary Files * @param type $query * @return query */ public function scopeIsPrimary($query) { return $query->where('is_primary', '=', 1); }