Hi,
I have a custom modules and I have created a view.edit.php yo inherite the team_id of the record it was created under.
The custom mondule can only be created under contacts so this teh what I want to do.
The $_REQUEST[return_id] returns the ID of the Custom module and to get the team_id from the contact I need to run the following two queries.PHP Code:<?php
require_once('include/MVC/View/views/view.edit.php');
class fdc_dependentsViewEdit extends ViewEdit
{
function fdc_dependentsViewEdit()
{
parent::SugarView();
}
function display(){
//$this->ev->process();
$this->ev->process();
if (empty($this->ev->focus->id))
{
if (!empty($_REQUEST['return_id']))
{
$query="SELECT team_id FROM contacts WHERE id ='".$_REQUEST['return_id']."'";
$res=$this->bean->db->query($query);
$row=$this->bean->db->fetchByAssoc($res);
if (!empty($row))
{
$this->ev->fieldDefs['team_id']['value'] = $row['team_id'];
}
}
}
//echo $this->ev->display();
echo $this->ev->display();
}
}
I can then past the result of $query2 tothe team_id of teh custom module.PHP Code:$query1 = "SELECT contacts_idb FROM fdc_dependents_contacts WHERE fdc_dependents_ida ='".$_REQUEST['return_id']."'";
$query2 = "SELECT team_id FROM contacts WHERE id = RESULT OF $query1";
How can I do this
Rgds
Chris


LinkBack URL
About LinkBacks




Reply With Quote
Bookmarks