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


PHP CRM_Contact_BAO_Contact_Utils::updateGreeting方法代码示例

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


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

示例1: civicrm_api3_job_update_greeting

/**
 *
 * This method allows to update Email Greetings, Postal Greetings and Addressee for a specific contact type.
 * IMPORTANT: You must first create valid option value before using via admin interface.
 * Check option lists for Email Greetings, Postal Greetings and Addressee
 *
 *                        id - Integer - greetings option group
 *
 * @param $params
 *
 * @return boolean        true if success, else false
 * @static
 * @access public
 */
function civicrm_api3_job_update_greeting($params)
{
    if (isset($params['ct']) && isset($params['gt'])) {
        $ct = $gt = array();
        $ct = explode(',', $params['ct']);
        $gt = explode(',', $params['gt']);
        foreach ($ct as $ctKey => $ctValue) {
            foreach ($gt as $gtKey => $gtValue) {
                $params['ct'] = trim($ctValue);
                $params['gt'] = trim($gtValue);
                $result[] = CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
            }
        }
    } else {
        $result = CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
    }
    foreach ($result as $resultKey => $resultValue) {
        if ($resultValue['is_error'] == 0) {
            //really we should rely on the exception mechanism here - but we need to test that before removing this line
            return civicrm_api3_create_success();
        } else {
            return civicrm_api3_create_error($resultValue['messages']);
        }
    }
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:39,代码来源:Job.php

示例2: civicrm_api3_job_update_greeting

/**
 * This method allows to update Email Greetings, Postal Greetings and Addressee for a specific contact type.
 *
 * IMPORTANT: You must first create valid option value before using via admin interface.
 * Check option lists for Email Greetings, Postal Greetings and Addressee
 *
 * @todo - is this here by mistake or should it be added to _spec function :id - Integer - greetings option group.
 *
 * @param array $params
 *
 * @return array
 */
function civicrm_api3_job_update_greeting($params)
{
    if (isset($params['ct']) && isset($params['gt'])) {
        $ct = explode(',', $params['ct']);
        $gt = explode(',', $params['gt']);
        foreach ($ct as $ctKey => $ctValue) {
            foreach ($gt as $gtKey => $gtValue) {
                $params['ct'] = trim($ctValue);
                $params['gt'] = trim($gtValue);
                CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
            }
        }
    } else {
        CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
    }
    return civicrm_api3_create_success();
}
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:29,代码来源:Job.php

示例3: civicrm_api3_job_update_greeting

/**
 *
 * This method allows to update Email Greetings, Postal Greetings and Addressee for a specific contact type.
 * IMPORTANT: You must first create valid option value before using via admin interface.
 * Check option lists for Email Greetings, Postal Greetings and Addressee
 *
 * @param  array   	  $params (reference ) input parameters
 *                        ct - String - ct=Individual or ct=Household or ct=Organization
 *                        gt - String - gt=email_greeting or gt=postal_greeting or gt=addressee
 *                        id - Integer - greetings option group
 *
 * @return boolean        true if success, else false
 * @static
 * @access public
 *
 */
function civicrm_api3_job_update_greeting($params)
{
    require_once 'CRM/Contact/BAO/Contact/Utils.php';
    civicrm_api3_verify_mandatory($params, NULL, array('ct', 'gt'));
    // fixme - use the wrapper & getfields to do this checking - advertise as an enum
    if (!in_array($params['ct'], array('Individual', 'Household', 'Organization'))) {
        return civicrm_api3_create_error(ts('Invalid contact type (ct) parameter value'));
    }
    if (!in_array($params['gt'], array('email_greeting', 'postal_greeting', 'addressee'))) {
        return civicrm_api3_create_error(ts('Invalid greeting type (gt) parameter value'));
    }
    $result = CRM_Contact_BAO_Contact_Utils::updateGreeting($params);
    if ($result['is_error'] == 0) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error($result['messages']);
    }
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:34,代码来源:Job.php


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