当前位置: 首页>>代码示例>>PHP>>正文


PHP SugarEmailAddress::getCountEmailAddressByBean方法代码示例

本文整理汇总了PHP中SugarEmailAddress::getCountEmailAddressByBean方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarEmailAddress::getCountEmailAddressByBean方法的具体用法?PHP SugarEmailAddress::getCountEmailAddressByBean怎么用?PHP SugarEmailAddress::getCountEmailAddressByBean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SugarEmailAddress的用法示例。


在下文中一共展示了SugarEmailAddress::getCountEmailAddressByBean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isADuplicateRecord

 /**
  * Checks to see if the given bean is a duplicate based off the given indexes
  *
  * @param  array $indexlist
  * @return bool true if this bean is a duplicate or false if it isn't
  */
 public function isADuplicateRecord($indexlist)
 {
     // Bug #51264 : Importing updates to rows prevented by duplicates check
     if (!empty($this->_focus) && $this->_focus instanceof SugarBean && !empty($this->_focus->id)) {
         $_focus = clone $this->_focus;
         $_focus->id = null;
         $_focus->retrieve($this->_focus->id);
         if (!empty($_focus->id)) {
             return false;
         }
         unset($_focus);
     }
     //lets strip the indexes of the name field in the value and leave only the index name
     $origIndexList = $indexlist;
     $indexlist = array();
     $fieldlist = array();
     $customIndexlist = array();
     foreach ($origIndexList as $iv) {
         if (empty($iv)) {
             continue;
         }
         $field_index_array = explode('::', $iv);
         if ($field_index_array[0] == 'customfield') {
             //this is a custom field, so place in custom array
             $customIndexlist[] = $field_index_array[1];
         } else {
             //this is not a custom field, so place in index list
             $indexlist[] = $field_index_array[0];
             if (isset($field_index_array[1])) {
                 $fieldlist[] = $field_index_array[1];
             }
         }
     }
     //if full_name is set, then manually search on the first and last name fields before iterating through rest of fields
     //this is a special handling of the name fields on people objects, the rest of the fields are checked individually
     if (in_array('full_name', $indexlist)) {
         $newfocus = loadBean($this->_focus->module_dir);
         $result = $newfocus->retrieve_by_string_fields(array('deleted' => '0', 'first_name' => $this->_focus->first_name, 'last_name' => $this->_focus->last_name), true);
         if (!is_null($result)) {
             //set dupe field to full_name and name fields
             $this->_dupedFields[] = 'full_name';
             $this->_dupedFields[] = 'first_name';
             $this->_dupedFields[] = 'last_name';
         }
     }
     // loop through var def indexes and compare with selected indexes
     foreach ($this->_getIndexVardefs() as $index) {
         // if we get an index not in the indexlist, loop
         if (!in_array($index['name'], $indexlist)) {
             continue;
         }
         // This handles the special case of duplicate email checking
         if ($index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2') {
             $emailAddress = new SugarEmailAddress();
             $email = $index['fields'][0];
             if ($emailAddress->getCountEmailAddressByBean($this->_focus->{$email}, $this->_focus, $index['name'] == 'special_idx_email1') > 0) {
                 foreach ($index['fields'] as $field) {
                     if ($field != 'deleted') {
                         $this->_dupedFields[] = $field;
                     }
                 }
             }
         } elseif (isset($index['dupeCheckFunction'])) {
             $functionName = substr_replace($index['dupeCheckFunction'], '', 0, 9);
             if (method_exists($this->_focus, $functionName) && $this->_focus->{$functionName}($index) === true) {
                 return $this->_focus->{$functionName}($index);
             }
         } else {
             $index_fields = array('deleted' => '0');
             //search only for the field we have selected
             foreach ($index['fields'] as $field) {
                 if ($field == 'deleted' || !in_array($field, $fieldlist)) {
                     continue;
                 }
                 if (!in_array($field, $index_fields)) {
                     if (isset($this->_focus->{$field}) && strlen($this->_focus->{$field}) > 0) {
                         $index_fields[$field] = $this->_focus->{$field};
                     }
                 }
             }
             // if there are no valid fields in the index field list, loop
             if (count($index_fields) <= 1) {
                 continue;
             }
             $newfocus = loadBean($this->_focus->module_dir);
             $result = $newfocus->retrieve_by_string_fields($index_fields, true);
             if (!is_null($result)) {
                 //remove deleted as a duped field
                 unset($index_fields['deleted']);
                 //create string based on array of dupe fields
                 $this->_dupedFields = array_merge(array_keys($index_fields), $this->_dupedFields);
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:101,代码来源:ImportDuplicateCheck.php

示例2: isADuplicateRecord

 /**
  * Checks to see if the given bean is a duplicate based off the given indexes
  *
  * @param  array $indexlist
  * @return bool true if this bean is a duplicate or false if it isn't
  */
 public function isADuplicateRecord($indexlist)
 {
     // loop through var def indexes and compare with selected indexes
     foreach ($this->_getIndexVardefs() as $index) {
         // if we get an index not in the indexlist, loop
         if (!in_array($index['name'], $indexlist)) {
             continue;
         }
         // This handles the special case of duplicate email checking
         if ($index['name'] == 'special_idx_email1' || $index['name'] == 'special_idx_email2') {
             $emailAddress = new SugarEmailAddress();
             $email = $index['fields'][0];
             if ($emailAddress->getCountEmailAddressByBean($this->_focus->{$email}, $this->_focus, $index['name'] == 'special_idx_email1') > 0) {
                 return true;
             }
         } else {
             $index_fields = array('deleted' => '0');
             foreach ($index['fields'] as $field) {
                 if ($field == 'deleted') {
                     continue;
                 }
                 if (!in_array($field, $index_fields)) {
                     if (strlen($this->_focus->{$field}) > 0) {
                         $index_fields[$field] = $this->_focus->{$field};
                     }
                 }
             }
             // if there are no valid fields in the index field list, loop
             if (count($index_fields) <= 1) {
                 continue;
             }
             $newfocus = loadBean($this->_focus->module_dir);
             $result = $newfocus->retrieve_by_string_fields($index_fields, true);
             if (!is_null($result)) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:46,代码来源:ImportDuplicateCheck.php


注:本文中的SugarEmailAddress::getCountEmailAddressByBean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。