2016-01-13 22 views
1

問題:跟蹤字段數據源的最佳方式是什麼?字段引用了錯誤的數據

我一直在瀏覽大量文件,所有我能找到的參考文獻都是正確的。

問題是「姓氏」字段顯示聯繫人全名。

任何想法將不勝感激。

我正在使用SugarCRM CE 6.5.13
謝謝。

回答

1
  1. 字段在模塊/ SomeModules/vardefs.php定義,或者如果它是一個 custom_field在db表fields_meta_data在模塊豆模塊
  2. /SomeModules/SomeModule.php可以覆蓋默認行爲產生例如像這樣的FULL_NAME:

對於細節視圖:

function fill_in_additional_detail_fields() { 
     parent::fill_in_additional_detail_fields(); 
     $this->full_name = 'Something else'; 
    } 

對於列表視圖:

function fill_in_additional_list_fields() { 
     parent::fill_in_additional_list_fields(); 
     $this->full_name = 'Something else'; 
    } 

或者通過重寫標準功能_create_proper_name_field:

/** 
* This function helps generate the name and full_name member field 
* variables from the salutation, title, first_name and last_name fields. 
* It takes into account the locale format settings as well as ACL settings 
* if supported. 
*/ 
public function _create_proper_name_field() { 
    parent::_create_proper_name_field(); 

    $full_name = trim(trim($this->first_name) . ' ' . trim($this->last_name)); 

    if (!empty($full_name) && !empty($this->name)) { 
     $full_name .= ' - '; 
    } 
    if (!empty($this->name)) { 
     $full_name .= $this->name; 
    } 
    $this->full_name = $full_name; 
} 
+0

再次感謝你的非常有見地的和完整的答案。 – Damund

+0

有了您分享的信息,我可以找到錯誤,儘管我無法完全使用您的代碼示例來解決問題,但確實可以幫助您找到清楚解釋的問題。最後,我只是使用substr()來讀取字段值,然後刪除名字和尾部空格,然後將剩下的名字傳遞給字段。再次感謝你。 – Damund

相關問題