function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     if (empty($this->id)) {
         return;
     }
     global $locale, $app_list_strings, $current_user;
     // retrieve the account information and the information about the person the contact reports to.
     $query = "SELECT acc.id, acc.name, con_reports_to.first_name, con_reports_to.last_name\n\t\tfrom contacts\n\t\tleft join accounts_contacts a_c on a_c.contact_id = '" . $this->id . "' and a_c.deleted=0\n\t\tleft join accounts acc on a_c.account_id = acc.id and acc.deleted=0\n\t\tleft join contacts con_reports_to on con_reports_to.id = contacts.reports_to_id\n\t\twhere contacts.id = '" . $this->id . "'";
     // Bug 43196 - If a contact is related to multiple accounts, make sure we pull the one we are looking for
     // Bug 44730  was introduced due to this, fix is to simply clear any whitespaces around the account_id first
     $clean_account_id = trim($this->account_id);
     if (!empty($clean_account_id)) {
         $query .= " and acc.id = '{$this->account_id}'";
     }
     $query .= " ORDER BY a_c.date_modified DESC";
     $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->account_name = $row['name'];
         $this->account_id = $row['id'];
         $this->report_to_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '', '', '', null, true);
     } else {
         $this->account_name = '';
         $this->account_id = '';
         $this->report_to_name = '';
     }
     $this->load_contacts_users_relationship();
     /** concating this here because newly created Contacts do not have a
      * 'name' attribute constructed to pass onto related items, such as Tasks
      * Notes, etc.
      */
     $this->name = $locale->getLocaleFormattedName($this->first_name, $this->last_name);
     if (!empty($this->contacts_users_id)) {
         $this->sync_contact = true;
     }
     if (!empty($this->portal_active) && $this->portal_active == 1) {
         $this->portal_active = true;
     }
     // Set campaign name if there is a campaign id
     if (!empty($this->campaign_id)) {
         $camp = new Campaign();
         $where = "campaigns.id='{$this->campaign_id}'";
         $campaign_list = $camp->get_full_list("campaigns.name", $where, true);
         $this->campaign_name = $campaign_list[0]->name;
     }
 }
Exemple #2
0
 function fill_in_additional_detail_fields()
 {
     //Fill in the assigned_user_name
     //if(!empty($this->status))
     //$this->status = translate('lead_status_dom', '', $this->status);
     parent::fill_in_additional_detail_fields();
     $this->_create_proper_name_field();
     $this->get_contact();
     $this->get_opportunity();
     $this->get_account();
     if (!empty($this->campaign_id)) {
         $camp = new Campaign();
         $where = "campaigns.id='{$this->campaign_id}'";
         $campaign_list = $camp->get_full_list("campaigns.name", $where, true);
         if (!empty($campaign_list)) {
             $this->campaign_name = $campaign_list[0]->name;
         }
     }
 }
Exemple #3
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     //rrs bug: 28184 - instead of removing this code altogether just adding this check to ensure that if the parent_name
     //is empty then go ahead and fill it.
     if (empty($this->parent_name) && !empty($this->id)) {
         $query = "SELECT a1.name from accounts a1, accounts a2 where a1.id = a2.parent_id and a2.id = '{$this->id}' and a1.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->parent_name = $row['name'];
         } else {
             $this->parent_name = '';
         }
     }
     // Set campaign name if there is a campaign id
     if (!empty($this->campaign_id)) {
         $camp = new Campaign();
         $where = "campaigns.id='{$this->campaign_id}'";
         $campaign_list = $camp->get_full_list("campaigns.name", $where, true);
         $this->campaign_name = $campaign_list[0]->name;
     }
 }
Exemple #4
0
 function fill_in_additional_detail_fields()
 {
     parent::fill_in_additional_detail_fields();
     global $locale, $app_list_strings, $current_user;
     // retrieve the account information and the information about the person the contact reports to.
     $query = "SELECT acc.id, acc.name, con_reports_to.first_name, con_reports_to.last_name\n\t\tfrom contacts\n\t\tleft join accounts_contacts a_c on a_c.contact_id = '" . $this->id . "' and a_c.deleted=0\n\t\tleft join accounts acc on a_c.account_id = acc.id and acc.deleted=0\n\t\tleft join contacts con_reports_to on con_reports_to.id = contacts.reports_to_id\n\t\twhere contacts.id = '" . $this->id . "'";
     $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->account_name = $row['name'];
         $this->account_id = $row['id'];
         $this->report_to_name = $row['first_name'] . ' ' . $row['last_name'];
     } else {
         $this->account_name = '';
         $this->account_id = '';
         $this->report_to_name = '';
     }
     $this->load_contacts_users_relationship();
     /** concating this here because newly created Contacts do not have a
      * 'name' attribute constructed to pass onto related items, such as Tasks
      * Notes, etc.
      */
     $this->name = $locale->getLocaleFormattedName($this->first_name, $this->last_name);
     if (!empty($this->contacts_users_id)) {
         $this->sync_contact = true;
     }
     if (!empty($this->portal_active) && $this->portal_active == 1) {
         $this->portal_active = true;
     }
     // Set campaign name if there is a campaign id
     if (!empty($this->campaign_id)) {
         $camp = new Campaign();
         $where = "campaigns.id='{$this->campaign_id}'";
         $campaign_list = $camp->get_full_list("campaigns.name", $where, true);
         $this->campaign_name = $campaign_list[0]->name;
     }
 }