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


PHP CRM_Contact_DAO_RelationshipType::save方法代码示例

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


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

示例1: add

 /**
  * Add the relationship type in the db.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  * @param array $ids
  *   The array that holds all the db ids.
  *
  * @return CRM_Contact_DAO_RelationshipType
  */
 public static function add(&$params, &$ids)
 {
     //to change name, CRM-3336
     if (empty($params['label_a_b']) && !empty($params['name_a_b'])) {
         $params['label_a_b'] = $params['name_a_b'];
     }
     if (empty($params['label_b_a']) && !empty($params['name_b_a'])) {
         $params['label_b_a'] = $params['name_b_a'];
     }
     // set label to name if it's not set - but *only* for
     // ADD action. CRM-3336 as part from (CRM-3522)
     if (empty($ids['relationshipType'])) {
         if (empty($params['name_a_b']) && !empty($params['label_a_b'])) {
             $params['name_a_b'] = $params['label_a_b'];
         }
         if (empty($params['name_b_a']) && !empty($params['label_b_a'])) {
             $params['name_b_a'] = $params['label_b_a'];
         }
     }
     // action is taken depending upon the mode
     $relationshipType = new CRM_Contact_DAO_RelationshipType();
     $relationshipType->copyValues($params);
     // if label B to A is blank, insert the value label A to B for it
     if (!strlen(trim($strName = CRM_Utils_Array::value('name_b_a', $params)))) {
         $relationshipType->name_b_a = CRM_Utils_Array::value('name_a_b', $params);
     }
     if (!strlen(trim($strName = CRM_Utils_Array::value('label_b_a', $params)))) {
         $relationshipType->label_b_a = CRM_Utils_Array::value('label_a_b', $params);
     }
     $relationshipType->id = CRM_Utils_Array::value('relationshipType', $ids);
     $result = $relationshipType->save();
     CRM_Core_PseudoConstant::relationshipType('label', TRUE);
     CRM_Core_PseudoConstant::relationshipType('name', TRUE);
     CRM_Case_XMLProcessor::flushStaticCaches();
     return $result;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:46,代码来源:RelationshipType.php

示例2: add

 /**
  * Function to add the relationship type in the db
  *
  * @param array $params (reference ) an assoc array of name/value pairs
  * @param array $ids    the array that holds all the db ids
  *
  * @return object CRM_Contact_DAO_RelationshipType
  * @access public
  * @static
  *
  */
 static function add(&$params, &$ids)
 {
     //to change name, CRM-3336
     if (!CRM_Utils_Array::value('label_a_b', $params) && CRM_Utils_Array::value('name_a_b', $params)) {
         $params['label_a_b'] = $params['name_a_b'];
     }
     if (!CRM_Utils_Array::value('label_b_a', $params) && CRM_Utils_Array::value('name_b_a', $params)) {
         $params['label_b_a'] = $params['name_b_a'];
     }
     // set label to name if it's not set - but *only* for
     // ADD action. CRM-3336 as part from (CRM-3522)
     if (!CRM_Utils_Array::value('relationshipType', $ids)) {
         if (!CRM_Utils_Array::value('name_a_b', $params) && CRM_Utils_Array::value('label_a_b', $params)) {
             $params['name_a_b'] = $params['label_a_b'];
         }
         if (!CRM_Utils_Array::value('name_b_a', $params) && CRM_Utils_Array::value('label_b_a', $params)) {
             $params['name_b_a'] = $params['label_b_a'];
         }
     }
     // action is taken depending upon the mode
     $relationshipType = new CRM_Contact_DAO_RelationshipType();
     $relationshipType->copyValues($params);
     // if label B to A is blank, insert the value label A to B for it
     if (!strlen(trim($strName = CRM_Utils_Array::value('name_b_a', $params)))) {
         $relationshipType->name_b_a = CRM_Utils_Array::value('name_a_b', $params);
     }
     if (!strlen(trim($strName = CRM_Utils_Array::value('label_b_a', $params)))) {
         $relationshipType->label_b_a = CRM_Utils_Array::value('label_a_b', $params);
     }
     $relationshipType->id = CRM_Utils_Array::value('relationshipType', $ids);
     return $relationshipType->save();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:43,代码来源:RelationshipType.php


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