array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') , 'contact_id'=>array('name' =>'contact_id', 'type' =>'char', 'len'=>'36', ) , 'opportunity_id'=>array('name' =>'opportunity_id', 'type' =>'char', 'len'=>'36',) , 'contact_role'=>array('name' =>'contact_role', 'type' =>'char', 'len'=>'50') , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) ); function ContactOpportunityRelationship() { $this->db = DBManagerFactory::getInstance(); $this->dbManager = DBManagerFactory::getInstance(); $this->disable_row_level_security =true; } function fill_in_additional_detail_fields() { global $locale; if(isset($this->contact_id) && $this->contact_id != "") { $query = "SELECT first_name, last_name from contacts where id='$this->contact_id' AND deleted=0"; $result =$this->db->query($query,true," Error filling in additional detail fields: "); // Get the id and the name. $row = $this->db->fetchByAssoc($result); if($row != null) { $this->contact_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']); } } if(isset($this->opportunity_id) && $this->opportunity_id != "") { $query = "SELECT name from opportunities where id='$this->opportunity_id' AND deleted=0"; $result =$this->db->query($query,true," Error filling in additional detail fields: "); // Get the id and the name. $row = $this->db->fetchByAssoc($result); if($row != null) { $this->opportunity_name = $row['name']; } } } } ?>