Hi. i want to show 4 fields in listview but they come from querys. i made it with logic hook but is not working! can anyone point me the rigth direction?
/modules/custom/Cases/logic_hooks.php
/modules/Cases/CaseLogicHook.phpCode:<?php // Do not store anything in this file that is not part of the array or the hook version. This file will // be automatically rebuilt in the future. $hook_version = 2; $hook_array = Array(); // position, file, function //$hook_array['process_record'] = Array(); $hook_array['process_record'][] = Array(3,'dtvenc', 'modules/Cases/CaseLogicHook.php','CaseLogicHook', 'dtvenc'); ?>
Code:<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); class CaseLogicHook { function dtvenc(&$focus, $event, $arguments) { // $focus->sla_c = $focus->sup_contratosuporte_cases_sla_critico_resolucao_hw + $focus->sup_contratosuporte_cases_sla_critico_atendimento_hw; /*function action_ListView() {*/ //$focus->view = 'list'; //$GLOBALS['view'] = $focus->view; global $db; $query = "select (CASE WHEN c.priority='P0' THEN s.slacrireshw ELSE (CASE WHEN c.priority='P1' THEN s.slaaltreshw ELSE (CASE WHEN c.priority='P2' THEN s.slamedreshw ELSE s.slabaireshw END) END) END) as slareshw, " . "(CASE WHEN c.priority='P0' THEN s.slacriressw ELSE (CASE WHEN c.priority='P1' THEN s.slaaltressw ELSE (CASE WHEN c.priority='P2' THEN s.slamedressw ELSE s.slabairessw END) END) END) as slaressw, s.description, " . "ADDTIME(SUBTIME(c.date_entered,'03:00:00'), (CASE WHEN c.type='Software' THEN (CASE WHEN c.priority='P0' THEN s.slacriressw ELSE (CASE WHEN c.priority='P1' THEN s.slaaltressw ELSE (CASE WHEN c.priority='P2' THEN s.slamedressw ELSE s.slabairessw END) END) END) ELSE (CASE WHEN c.priority='P0' THEN s.slacrireshw ELSE (CASE WHEN c.priority='P1' THEN s.slaaltreshw ELSE (CASE WHEN c.priority='P2' THEN s.slamedreshw ELSE s.slabaireshw END) END) END) END)) as vencimento " . "from sup_contratosuporte s, sup_contratuporte_cases_c cstm, cases c where s.id=cstm.sup_contra8d4esuporte_ida and c.id=cstm.sup_contra20a5escases_idb and c.deleted=0 and cstm.deleted=0 and s.deleted=0 "; //and c.id= '" . $this->bean->id . "'"; $result = $db->query($query, true); while($row = $db->fetchByAssoc($result)) { $focus->bean->sup_contratosuporte_cases_sla_critico_resolucao_hw = $row['slareshw']; $focus->bean->sup_contratosuporte_cases_sla_critico_atendimento_hw = $row['slaressw']; $focus->bean->sup_contratosuporte_cases_descricao = $row['description']; $focus->bean->data_vencimento = $row['vencimento'] ; } } } //} ?>


LinkBack URL
About LinkBacks




Reply With Quote
Bookmarks