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


PHP CRM_Core_BAO_Location类代码示例

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


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

示例1: civicrm_api3_domain_get

/**
 * Get CiviCRM domain details
 * {@getfields domain_create}
 * @example DomainGet.php
 */
function civicrm_api3_domain_get($params)
{
    $params['version'] = CRM_Utils_Array::value('domain_version', $params);
    unset($params['version']);
    $bao = new CRM_Core_BAO_Domain();
    if (CRM_Utils_Array::value('current_domain', $params)) {
        $domainBAO = CRM_Core_Config::domainID();
        $params['id'] = $domainBAO;
    }
    _civicrm_api3_dao_set_filter($bao, $params, true, 'domain');
    $domains = _civicrm_api3_dao_to_array($bao, $params, true, 'domain');
    foreach ($domains as $domain) {
        if (!empty($domain['contact_id'])) {
            $values = array();
            $locparams = array('contact_id' => $domain['contact_id']);
            $values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
            $address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
            if (!empty($values['location']['email'])) {
                $domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
            }
            if (!empty($values['location']['phone'])) {
                $domain['domain_phone'] = array('phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]));
            }
            if (!empty($values['location']['address'])) {
                foreach ($address_array as $value) {
                    $domain['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
                }
            }
            list($domain['from_name'], $domain['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
            $domains[$domain['id']] = array_merge($domains[$domain['id']], $domain);
        }
    }
    return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao);
}
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:39,代码来源:Domain.php

示例2: civicrm_domain_get

/**
 * Generic file to retrieve all the constants and
 * pseudo constants used in CiviCRM
 *
 */
function civicrm_domain_get()
{
    require_once 'CRM/Core/BAO/Domain.php';
    $dao = CRM_Core_BAO_Domain::getDomain();
    $values = array();
    $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_domain');
    require_once 'CRM/Core/BAO/Location.php';
    $values['location'] = CRM_Core_BAO_Location::getValues($params, true);
    $address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
    require_once 'CRM/Core/OptionGroup.php';
    $domain[$dao->id] = array('id' => $dao->id, 'domain_name' => $dao->name, 'description' => $dao->description, 'domain_email' => CRM_Utils_Array::value('email', $values['location']['email'][1]), 'domain_phone' => array('phone_type' => CRM_Core_OptionGroup::getLabel('phone_type', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1])));
    foreach ($address_array as $value) {
        $domain[$dao->id]['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
    }
    list($domain[$dao->id]['from_name'], $domain[$dao->id]['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail();
    return $domain;
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:22,代码来源:Domain.php

示例3: array

 /**
  * Register a subscription event.  Create a new contact if one does not
  * already exist.
  *
  * @param int $domain_id        The domain id of the new subscription
  * @param int $group_id         The group id to subscribe to
  * @param string $email         The email address of the (new) contact
  * @return int|null $se_id      The id of the subscription event, null on failure
  * @access public
  * @static
  */
 function &subscribe($domain_id, $group_id, $email)
 {
     /* First, find out if the contact already exists */
     $params = array('email' => $email, 'domain_id' => $domain_id);
     require_once 'CRM/Core/BAO/UFGroup.php';
     $contact_id = CRM_Core_BAO_UFGroup::findContact($params);
     CRM_Core_DAO::transaction('BEGIN');
     if (is_a($contact_id, CRM_Core_Error)) {
         require_once 'CRM/Core/BAO/LocationType.php';
         /* If the contact does not exist, create one. */
         $formatted = array('contact_type' => 'Individual');
         $value = array('email' => $email, 'location_type' => CRM_Core_BAO_LocationType::getDefaultID());
         _crm_add_formatted_param($value, $formatted);
         $contact =& crm_create_contact_formatted($formatted, CRM_IMPORT_PARSER_DUPLICATE_SKIP);
         if (is_a($contact, CRM_Core_Error)) {
             return null;
         }
         $contact_id = $contact->id;
     }
     require_once 'CRM/Core/BAO/Email.php';
     require_once 'CRM/Core/BAO/Location.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     /* Get the primary email id from the contact to use as a hash input */
     $dao =& new CRM_Core_DAO();
     $emailTable = CRM_Core_BAO_Email::getTableName();
     $locTable = CRM_Core_BAO_Location::getTableName();
     $contactTable = CRM_Contact_BAO_Contact::getTableName();
     $dao->query("SELECT {$emailTable}.id as email_id\n                    FROM {$emailTable}\n                    INNER JOIN {$locTable}\n                        ON  {$emailTable}.location_id = {$locTable}.id\n                    WHERE   {$emailTable}.is_primary = 1\n                    AND     {$locTable}.is_primary = 1\n                    AND     {$locTable}.entity_table = '{$contactTable}'\n                    AND     {$locTable}.entity_id = " . CRM_Utils_Type::escape($contact_id, 'Integer'));
     $dao->fetch();
     $se =& new CRM_Mailing_Event_BAO_Subscribe();
     $se->group_id = $group_id;
     $se->contact_id = $contact_id;
     $se->time_stamp = date('YmdHis');
     $se->hash = sha1("{$group_id}:{$contact_id}:{$dao->email_id}");
     $se->save();
     $contacts = array($contact_id);
     require_once 'CRM/Contact/BAO/GroupContact.php';
     CRM_Contact_BAO_GroupContact::addContactsToGroup($contacts, $group_id, 'Email', 'Pending', $se->id);
     CRM_Core_DAO::transaction('COMMIT');
     return $se;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:52,代码来源:Subscribe.php

示例4: register

 static function register($extension)
 {
     if ($domain_id = CRM_Core_Config::domainID()) {
         // Gather information from domain settings
         $params = array('id' => $domain_id);
         CRM_Core_BAO_Domain::retrieve($params, $domain);
         unset($params['id']);
         $locParams = $params + array('entity_id' => $domain_id, 'entity_table' => 'civicrm_domain');
         $defaults = CRM_Core_BAO_Location::getValues($locParams);
         foreach (array('address', 'phone', 'email') as $info) {
             $domain[$info] = reset(CRM_Utils_Array::value($info, $defaults));
         }
         // Create registration parameters
         $registration = array('extension' => $extension, 'organization_name' => $domain['name'], 'description' => $domain['description']);
         foreach (array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'state_province_id', 'country_id') as $field) {
             $registration[$field] = CRM_Utils_Array::value($field, $domain['address']);
         }
         $registration['phone'] = $domain['phone']['phone'];
         $registration['email'] = $domain['email']['email'];
         return self::_rest_helper('http://my.cividesk.com/register.php', $registration, 'POST');
     }
     return false;
 }
开发者ID:progressivetech,项目名称:com.cividesk.normalize,代码行数:23,代码来源:Cividesk.php

示例5: array

/**
 *
 * @param <type> $contact
 * @param <type> $locationTypes = array( 'Home', 'Work' ) else empty.
 * @return <type>
 */
function &_civicrm_location_get($contact, $locationTypes = array())
{
    $params = array('contact_id' => $contact['contact_id'], 'entity_id' => $contact['contact_id']);
    require_once 'CRM/Core/BAO/Location.php';
    $locations = CRM_Core_BAO_Location::getValues($params);
    $locValues = array();
    // filter the blocks return only those from given loc type.
    if (is_array($locationTypes) && !empty($locationTypes)) {
        foreach ($locationTypes as $locName) {
            if (!$locName) {
                continue;
            }
            if ($locTypeId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $locName, 'id', 'name')) {
                foreach (array('email', 'im', 'phone', 'address', 'openid') as $name) {
                    if (!array_key_exists($name, $locations) || !is_array($locations[$name])) {
                        continue;
                    }
                    $blkCount = 0;
                    if (array_key_exists($name, $locValues)) {
                        $blkCount = count($locValues[$name]);
                    }
                    foreach ($locations[$name] as $count => $values) {
                        if ($locTypeId == $values['location_type_id']) {
                            $locValues[$name][++$blkCount] = $values;
                        }
                    }
                }
            }
        }
    } else {
        $locValues = $locations;
    }
    // CRM-4800
    if ('3.0' != CRM_Utils_Array::value('version', $contact)) {
        _civicrm_location_get_v3_to_v2($locValues);
    }
    return $locValues;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:44,代码来源:Location.php

示例6: run


//.........这里部分代码省略.........
                         $values['feeBlock']['label'][$fieldCnt] = $fieldValues['label'];
                         $values['feeBlock']['lClass'][$fieldCnt] = 'price_set_option_group-label';
                         $values['feeBlock']['isDisplayAmount'][$fieldCnt] = CRM_Utils_Array::value('is_display_amounts', $fieldValues);
                         $fieldCnt++;
                         $labelClass = 'price_set_option-label';
                     } else {
                         $labelClass = 'price_set_field-label';
                     }
                     // show tax rate with amount
                     $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
                     $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
                     $displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings);
                     $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
                     foreach ($fieldValues['options'] as $optionId => $optionVal) {
                         $values['feeBlock']['isDisplayAmount'][$fieldCnt] = CRM_Utils_Array::value('is_display_amounts', $fieldValues);
                         if ($invoicing && isset($optionVal['tax_amount'])) {
                             $values['feeBlock']['value'][$fieldCnt] = CRM_Price_BAO_PriceField::getTaxLabel($optionVal, 'amount', $displayOpt, $taxTerm);
                             $values['feeBlock']['tax_amount'][$fieldCnt] = $optionVal['tax_amount'];
                         } else {
                             $values['feeBlock']['value'][$fieldCnt] = $optionVal['amount'];
                         }
                         $values['feeBlock']['label'][$fieldCnt] = $optionVal['label'];
                         $values['feeBlock']['lClass'][$fieldCnt] = $labelClass;
                         $fieldCnt++;
                     }
                 }
             }
             // Tell tpl we have price set fee data and whether it's a quick_config price set
             $this->assign('isPriceSet', 1);
             $this->assign('isQuickConfig', $setDetails[$priceSetId]['is_quick_config']);
         }
     }
     $params = array('entity_id' => $this->_id, 'entity_table' => 'civicrm_event');
     $values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
     // fix phone type labels
     if (!empty($values['location']['phone'])) {
         $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
         foreach ($values['location']['phone'] as &$val) {
             if (!empty($val['phone_type_id'])) {
                 $val['phone_type_display'] = $phoneTypes[$val['phone_type_id']];
             }
         }
     }
     //retrieve custom field information
     $groupTree = CRM_Core_BAO_CustomGroup::getTree('Event', $this, $this->_id, 0, $values['event']['event_type_id']);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_id);
     $this->assign('action', CRM_Core_Action::VIEW);
     //To show the event location on maps directly on event info page
     $locations = CRM_Event_BAO_Event::getMapInfo($this->_id);
     if (!empty($locations) && !empty($values['event']['is_map'])) {
         $this->assign('locations', $locations);
         $this->assign('mapProvider', $config->mapProvider);
         $this->assign('mapKey', $config->mapAPIKey);
         $sumLat = $sumLng = 0;
         $maxLat = $maxLng = -400;
         $minLat = $minLng = 400;
         foreach ($locations as $location) {
             $sumLat += $location['lat'];
             $sumLng += $location['lng'];
             if ($location['lat'] > $maxLat) {
                 $maxLat = $location['lat'];
             }
             if ($location['lat'] < $minLat) {
                 $minLat = $location['lat'];
             }
             if ($location['lng'] > $maxLng) {
开发者ID:konadave,项目名称:civicrm-core,代码行数:67,代码来源:EventInfo.php

示例7: ON

 /**
  * function to get the information to map a event
  *
  * @param $id
  *
  * @internal param array $ids the list of ids for which we want map info
  *
  * @return null|string     title of the event
  * @static
  * @access public
  */
 static function &getMapInfo(&$id)
 {
     $sql = "\nSELECT\n   civicrm_event.id AS event_id,\n   civicrm_event.title AS display_name,\n   civicrm_address.street_address AS street_address,\n   civicrm_address.city AS city,\n   civicrm_address.postal_code AS postal_code,\n   civicrm_address.postal_code_suffix AS postal_code_suffix,\n   civicrm_address.geo_code_1 AS latitude,\n   civicrm_address.geo_code_2 AS longitude,\n   civicrm_state_province.abbreviation AS state,\n   civicrm_country.name AS country,\n   civicrm_location_type.name AS location_type\nFROM\n   civicrm_event\n   LEFT JOIN civicrm_loc_block ON ( civicrm_event.loc_block_id = civicrm_loc_block.id )\n   LEFT JOIN civicrm_address ON ( civicrm_loc_block.address_id = civicrm_address.id )\n   LEFT JOIN civicrm_state_province ON ( civicrm_address.state_province_id = civicrm_state_province.id )\n   LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id\n   LEFT JOIN civicrm_location_type ON ( civicrm_location_type.id = civicrm_address.location_type_id )\nWHERE civicrm_address.geo_code_1 IS NOT NULL\n  AND civicrm_address.geo_code_2 IS NOT NULL\n  AND civicrm_event.id = " . CRM_Utils_Type::escape($id, 'Integer');
     $dao = new CRM_Core_DAO();
     $dao->query($sql);
     $locations = array();
     $config = CRM_Core_Config::singleton();
     while ($dao->fetch()) {
         $location = array();
         $location['displayName'] = addslashes($dao->display_name);
         $location['lat'] = $dao->latitude;
         $location['marker_class'] = 'Event';
         $location['lng'] = $dao->longitude;
         $params = array('entity_id' => $id, 'entity_table' => 'civicrm_event');
         $addressValues = CRM_Core_BAO_Location::getValues($params, TRUE);
         $location['address'] = str_replace(array("\r", "\n"), '', addslashes(nl2br($addressValues['address'][1]['display_text'])));
         $location['url'] = CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $dao->event_id);
         $location['location_type'] = $dao->location_type;
         $eventImage = '<img src="' . $config->resourceBase . 'i/contact_org.gif" alt="Organization " height="20" width="15" />';
         $location['image'] = $eventImage;
         $location['displayAddress'] = str_replace('<br />', ', ', $location['address']);
         $locations[] = $location;
     }
     return $locations;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:36,代码来源:Event.php

示例8: transitionParticipants

 /**
  * Function takes participant ids and statuses
  * update status from $fromStatusId to $toStatusId
  * and send mail + create activities.
  *
  * @param array $participantIds
  *   Participant ids.
  * @param int $toStatusId
  *   Update status id.
  * @param int $fromStatusId
  *   From status id.
  * @param bool $returnResult
  * @param bool $skipCascadeRule
  *
  * @return array|NULL
  */
 public static function transitionParticipants($participantIds, $toStatusId, $fromStatusId = NULL, $returnResult = FALSE, $skipCascadeRule = FALSE)
 {
     if (!is_array($participantIds) || empty($participantIds) || !$toStatusId) {
         return NULL;
     }
     //thumb rule is if we triggering  primary participant need to triggered additional
     $allParticipantIds = $primaryANDAdditonalIds = array();
     foreach ($participantIds as $id) {
         $allParticipantIds[] = $id;
         if (self::isPrimaryParticipant($id)) {
             //filter additional as per status transition rules, CRM-5403
             if ($skipCascadeRule) {
                 $additionalIds = self::getAdditionalParticipantIds($id);
             } else {
                 $additionalIds = self::getValidAdditionalIds($id, $fromStatusId, $toStatusId);
             }
             if (!empty($additionalIds)) {
                 $allParticipantIds = array_merge($allParticipantIds, $additionalIds);
                 $primaryANDAdditonalIds[$id] = $additionalIds;
             }
         }
     }
     //get the unique participant ids,
     $allParticipantIds = array_unique($allParticipantIds);
     //pull required participants, contacts, events  data, if not in hand
     static $eventDetails = array();
     static $domainValues = array();
     static $contactDetails = array();
     $contactIds = $eventIds = $participantDetails = array();
     $statusTypes = CRM_Event_PseudoConstant::participantStatus();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
     //first thing is pull all necessory data from db.
     $participantIdClause = '(' . implode(',', $allParticipantIds) . ')';
     //get all participants data.
     $query = "SELECT * FROM civicrm_participant WHERE id IN {$participantIdClause}";
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
         $participantDetails[$dao->id] = array('id' => $dao->id, 'role' => $participantRoles[$dao->role_id], 'is_test' => $dao->is_test, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'fee_amount' => $dao->fee_amount, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id);
         if (!array_key_exists($dao->contact_id, $contactDetails)) {
             $contactIds[$dao->contact_id] = $dao->contact_id;
         }
         if (!array_key_exists($dao->event_id, $eventDetails)) {
             $eventIds[$dao->event_id] = $dao->event_id;
         }
     }
     //get the domain values.
     if (empty($domainValues)) {
         // making all tokens available to templates.
         $domain = CRM_Core_BAO_Domain::getDomain();
         $tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
         foreach ($tokens['domain'] as $token) {
             $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
         }
     }
     //get all required contacts detail.
     if (!empty($contactIds)) {
         // get the contact details.
         list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, array(), 'CRM_Event_BAO_Participant');
         foreach ($currentContactDetails as $contactId => $contactValues) {
             $contactDetails[$contactId] = $contactValues;
         }
     }
     //get all required events detail.
     if (!empty($eventIds)) {
         foreach ($eventIds as $eventId) {
             //retrieve event information
             $eventParams = array('id' => $eventId);
             CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$eventId]);
             //get default participant role.
             $eventDetails[$eventId]['participant_role'] = CRM_Utils_Array::value($eventDetails[$eventId]['default_role_id'], $participantRoles);
             //get the location info
             $locParams = array('entity_id' => $eventId, 'entity_table' => 'civicrm_event');
             $eventDetails[$eventId]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
         }
     }
     //now we are ready w/ all required data.
     //take a decision as per statuses.
     $emailType = NULL;
     $toStatus = $statusTypes[$toStatusId];
     $fromStatus = CRM_Utils_Array::value($fromStatusId, $statusTypes);
     switch ($toStatus) {
         case 'Pending from waitlist':
         case 'Pending from approval':
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:Participant.php

示例9: completeTransaction


//.........这里部分代码省略.........
                         $logStartDate = CRM_Utils_Date::isoToMysql($logStartDate);
                     }
                     $membershipLog['start_date'] = $logStartDate;
                     $membershipLog['membership_id'] = $membership->id;
                     $membershipLog['modified_id'] = $membership->contact_id;
                     $membershipLog['modified_date'] = date('Ymd');
                     $membershipLog['membership_type_id'] = $membership->membership_type_id;
                     CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
                     //update related Memberships.
                     CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $formatedParams);
                     //update the membership type key of membership relatedObjects array
                     //if it has changed after membership update
                     if ($membershipTypeIdKey != $membership->membership_type_id) {
                         $membershipsUpdate[$membership->membership_type_id] = $membership;
                         $contribution->_relatedObjects['membership'][$membership->membership_type_id] = $membership;
                         unset($contribution->_relatedObjects['membership'][$membershipTypeIdKey]);
                         unset($memberships[$membershipTypeIdKey]);
                     }
                 }
             }
             //update the memberships object with updated membershipTypeId data
             //if membershipTypeId has changed after membership update
             if (!empty($membershipsUpdate)) {
                 $memberships = $memberships + $membershipsUpdate;
             }
         }
     } else {
         // event
         $eventParams = array('id' => $objects['event']->id);
         $values['event'] = array();
         CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
         //get location details
         $locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
         $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
         $ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'module' => 'CiviEvent');
         list($custom_pre_id, $custom_post_ids) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
         $values['custom_pre_id'] = $custom_pre_id;
         $values['custom_post_id'] = $custom_post_ids;
         //for tasks 'Change Participant Status' and 'Batch Update Participants Via Profile' case
         //and cases involving status updation through ipn
         $values['totalAmount'] = $input['amount'];
         $contribution->source = ts('Online Event Registration') . ': ' . $values['event']['title'];
         if ($values['event']['is_email_confirm']) {
             $contribution->receipt_date = self::$_now;
             $values['is_email_receipt'] = 1;
         }
         if (!CRM_Utils_Array::value('skipComponentSync', $input)) {
             $participant->status_id = 1;
         }
         $participant->save();
     }
     if (CRM_Utils_Array::value('net_amount', $input, 0) == 0 && CRM_Utils_Array::value('fee_amount', $input, 0) != 0) {
         $input['net_amount'] = $input['amount'] - $input['fee_amount'];
     }
     // This complete transaction function is being overloaded to create new contributions too.
     // here we record if it is a new contribution.
     // @todo separate the 2 more appropriately.
     $isNewContribution = FALSE;
     if (empty($contribution->id)) {
         $isNewContribution = TRUE;
         if (!empty($input['amount']) && $input['amount'] != $contribution->total_amount) {
             $contribution->total_amount = $input['amount'];
             // The BAO does this stuff but we are actually kinda bypassing it here (bad code! go sit in the corner)
             // so we have to handle net_amount in this (naughty) code.
             if (isset($input['fee_amount']) && is_numeric($input['fee_amount'])) {
                 $contribution->fee_amount = $input['fee_amount'];
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:67,代码来源:BaseIPN.php

示例10: validateChainSelectFields

 /**
  * Validate country / state / county match and suppress unwanted "required" errors
  */
 private function validateChainSelectFields()
 {
     foreach ($this->_chainSelectFields as $control => $target) {
         if ($this->elementExists($control) && $this->elementExists($target)) {
             $controlValue = (array) $this->getElementValue($control);
             $targetField = $this->getElement($target);
             $controlType = $targetField->getAttribute('data-callback') == 'civicrm/ajax/jqCounty' ? 'stateProvince' : 'country';
             $targetValue = array_filter((array) $targetField->getValue());
             if ($targetValue || $this->getElementError($target)) {
                 $options = CRM_Core_BAO_Location::getChainSelectValues($controlValue, $controlType, TRUE);
                 if ($targetValue) {
                     if (!array_intersect($targetValue, array_keys($options))) {
                         $this->setElementError($target, $controlType == 'country' ? ts('State/Province does not match the selected Country') : ts('County does not match the selected State/Province'));
                     }
                 } elseif (!$options) {
                     $this->setElementError($target, NULL);
                 }
             }
         }
     }
 }
开发者ID:hoegrammer,项目名称:civicrm-core,代码行数:24,代码来源:Form.php

示例11: completeTransaction


//.........这里部分代码省略.........
                     if (CRM_Utils_Array::value('log_start_date', $dates)) {
                         $logStartDate = CRM_Utils_Date::customFormat($dates['log_start_date'], $format);
                         $logStartDate = CRM_Utils_Date::isoToMysql($logStartDate);
                     }
                     $membershipLog['start_date'] = $logStartDate;
                     $membershipLog['membership_id'] = $membership->id;
                     $membershipLog['modified_id'] = $membership->contact_id;
                     $membershipLog['modified_date'] = date('Ymd');
                     $membershipLog['membership_type_id'] = $membership->membership_type_id;
                     CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
                     //update related Memberships.
                     CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $formatedParams);
                     //update the membership type key of membership relatedObjects array
                     //if it has changed after membership update
                     if ($membershipTypeIdKey != $membership->membership_type_id) {
                         $memberships[$membership->membership_type_id] = $membership;
                         $contribution->_relatedObjects['membership'][$membership->membership_type_id] = $membership;
                         unset($contribution->_relatedObjects['membership'][$membershipTypeIdKey]);
                         unset($memberships[$membershipTypeIdKey]);
                     }
                 }
             }
         }
     } else {
         // event
         $eventParams = array('id' => $objects['event']->id);
         $values['event'] = array();
         CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
         $eventParams = array('id' => $objects['event']->id);
         $values['event'] = array();
         CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
         //get location details
         $locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
         $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
         $ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'module' => 'CiviEvent');
         list($custom_pre_id, $custom_post_ids) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
         $values['custom_pre_id'] = $custom_pre_id;
         $values['custom_post_id'] = $custom_post_ids;
         $contribution->source = ts('Online Event Registration') . ': ' . $values['event']['title'];
         if ($values['event']['is_email_confirm']) {
             $contribution->receipt_date = self::$_now;
             $values['is_email_receipt'] = 1;
         }
         $participant->status_id = 1;
         $participant->save();
     }
     if (CRM_Utils_Array::value('net_amount', $input, 0) == 0 && CRM_Utils_Array::value('fee_amount', $input, 0) != 0) {
         $input['net_amount'] = $input['amount'] - $input['fee_amount'];
     }
     $addLineItems = FALSE;
     if (empty($contribution->id)) {
         $addLineItems = TRUE;
     }
     $contribution->contribution_status_id = 1;
     $contribution->is_test = $input['is_test'];
     $contribution->fee_amount = CRM_Utils_Array::value('fee_amount', $input, 0);
     $contribution->net_amount = CRM_Utils_Array::value('net_amount', $input, 0);
     $contribution->trxn_id = $input['trxn_id'];
     $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
     $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date);
     $contribution->cancel_date = 'null';
     if (CRM_Utils_Array::value('check_number', $input)) {
         $contribution->check_number = $input['check_number'];
     }
     if (CRM_Utils_Array::value('payment_instrument_id', $input)) {
         $contribution->payment_instrument_id = $input['payment_instrument_id'];
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:67,代码来源:BaseIPN.php

示例12: cancelParticipant

 /**
  * Cancel this participant and finish, send cancellation email. At this point no
  * auto-cancellation of payment is handled, so payment needs to be manually cancelled
  *
  * return @void
  */
 public function cancelParticipant($params)
 {
     //set participant record status to Cancelled, refund payment if possible
     // send email to participant and admin, and log Activity
     $value = array();
     $value['id'] = $this->_participant_id;
     $cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'"));
     $value['status_id'] = $cancelledId;
     CRM_Event_BAO_Participant::create($value);
     $domainValues = array();
     $domain = CRM_Core_BAO_Domain::getDomain();
     $tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
     foreach ($tokens['domain'] as $token) {
         $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
     }
     $participantRoles = array();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $participantDetails = array();
     $query = "SELECT * FROM civicrm_participant WHERE id = {$this->_participant_id}";
     $dao = CRM_Core_DAO::executeQuery($query);
     while ($dao->fetch()) {
         $participantDetails[$dao->id] = array('id' => $dao->id, 'role' => $participantRoles[$dao->role_id], 'is_test' => $dao->is_test, 'event_id' => $dao->event_id, 'status_id' => $dao->status_id, 'fee_amount' => $dao->fee_amount, 'contact_id' => $dao->contact_id, 'register_date' => $dao->register_date, 'registered_by_id' => $dao->registered_by_id);
     }
     $eventDetails = array();
     $eventParams = array('id' => $this->_event_id);
     CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$this->_event_id]);
     //get default participant role.
     $eventDetails[$this->_event_id]['participant_role'] = CRM_Utils_Array::value($eventDetails[$this->_event_id]['default_role_id'], $participantRoles);
     //get the location info
     $locParams = array('entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event');
     $eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
     //get contact details
     $contactIds[$this->_contact_id] = $this->_contact_id;
     list($currentContactDetails) = CRM_Utils_Token::getTokenDetails($contactIds, NULL, FALSE, FALSE, NULL, array(), 'CRM_Event_BAO_Participant');
     foreach ($currentContactDetails as $contactId => $contactValues) {
         $contactDetails[$this->_contact_id] = $contactValues;
     }
     //send a 'cancelled' email to user, and cc the event's cc_confirm email
     $mail = CRM_Event_BAO_Participant::sendTransitionParticipantMail($this->_participant_id, $participantDetails[$this->_participant_id], $eventDetails[$this->_event_id], $contactDetails[$this->_contact_id], $domainValues, "Cancelled", "");
     $statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $this->_contact_name));
     $statusMsg .= ' ' . ts('A cancellation email has been sent to %1.', array(1 => $this->_contact_email));
     CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success');
     $url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_event_id}&noFullMsg=true");
     CRM_Utils_System::redirect($url);
 }
开发者ID:agileware,项目名称:civicrm-core,代码行数:51,代码来源:SelfSvcUpdate.php

示例13: getEventSummary

 /**
  * Function to get events Summary
  *
  * @static
  * @return array Array of event summary values
  */
 static function getEventSummary()
 {
     $eventSummary = $eventIds = array();
     require_once 'CRM/Core/Config.php';
     $config = CRM_Core_Config::singleton();
     // We're fetching recent and upcoming events (where start date is 7 days ago OR later)
     $query = "SELECT count(id) as total_events\n                  FROM   civicrm_event e\n                  WHERE  e.is_active=1 AND\n                        ( e.is_template IS NULL OR e.is_template = 0) AND\n                        e.start_date >= DATE_SUB( NOW(), INTERVAL 7 day );";
     $dao =& CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     if ($dao->fetch()) {
         $eventSummary['total_events'] = $dao->total_events;
     }
     if (empty($eventSummary) || $dao->total_events == 0) {
         return $eventSummary;
     }
     // Get the Id of Option Group for Event Types
     require_once 'CRM/Core/DAO/OptionGroup.php';
     $optionGroupDAO = new CRM_Core_DAO_OptionGroup();
     $optionGroupDAO->name = 'event_type';
     $optionGroupId = null;
     if ($optionGroupDAO->find(true)) {
         $optionGroupId = $optionGroupDAO->id;
     }
     $query = "\nSELECT     civicrm_event.id as id, civicrm_event.title as event_title, civicrm_event.is_public as is_public,\n           civicrm_event.max_participants as max_participants, civicrm_event.start_date as start_date,\n           civicrm_event.end_date as end_date, civicrm_event.is_online_registration, civicrm_event.is_monetary, civicrm_event.is_show_location,civicrm_event.is_map as is_map, civicrm_option_value.label as event_type, civicrm_tell_friend.is_active as is_friend_active,\n           civicrm_event.summary as summary\nFROM       civicrm_event\nLEFT JOIN  civicrm_option_value ON (\n           civicrm_event.event_type_id = civicrm_option_value.value AND\n           civicrm_option_value.option_group_id = %1 )\nLEFT JOIN  civicrm_tell_friend ON ( civicrm_tell_friend.entity_id = civicrm_event.id  AND civicrm_tell_friend.entity_table = 'civicrm_event' )\nWHERE      civicrm_event.is_active = 1 AND\n           ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0) AND\n           civicrm_event.start_date >= DATE_SUB( NOW(), INTERVAL 7 day )\nGROUP BY   civicrm_event.id\nORDER BY   civicrm_event.start_date ASC\nLIMIT      0, 10\n";
     $eventParticipant = array();
     $eventParticipant['participants'] = self::getParticipantCount();
     $eventParticipant['notCountedParticipants'] = self::getParticipantCount(true, false, true, false);
     $eventParticipant['notCountedDueToRole'] = self::getParticipantCount(false, false, true, false);
     $eventParticipant['notCountedDueToStatus'] = self::getParticipantCount(true, false, false, false);
     $properties = array('eventTitle' => 'event_title', 'isPublic' => 'is_public', 'maxParticipants' => 'max_participants', 'startDate' => 'start_date', 'endDate' => 'end_date', 'eventType' => 'event_type', 'isMap' => 'is_map', 'participants' => 'participants', 'notCountedDueToRole' => 'notCountedDueToRole', 'notCountedDueToStatus' => 'notCountedDueToStatus', 'notCountedParticipants' => 'notCountedParticipants');
     $permissions = CRM_Event_BAO_Event::checkPermission();
     $params = array(1 => array($optionGroupId, 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($query, $params);
     while ($dao->fetch()) {
         if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
             foreach ($properties as $property => $name) {
                 $set = null;
                 switch ($name) {
                     case 'is_public':
                         if ($dao->{$name}) {
                             $set = 'Yes';
                         } else {
                             $set = 'No';
                         }
                         $eventSummary['events'][$dao->id][$property] = $set;
                         break;
                     case 'is_map':
                         if ($dao->{$name} && $config->mapAPIKey) {
                             $params = array();
                             $values = array();
                             $ids = array();
                             $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event');
                             require_once 'CRM/Core/BAO/Location.php';
                             $values['location'] = CRM_Core_BAO_Location::getValues($params, true);
                             if (is_numeric(CRM_Utils_Array::value('geo_code_1', $values['location']['address'][1])) || $config->mapGeoCoding && $values['location']['address'][1]['city'] && $values['location']['address'][1]['state_province_id']) {
                                 $set = CRM_Utils_System::url('civicrm/contact/map/event', "reset=1&eid={$dao->id}");
                             }
                         }
                         $eventSummary['events'][$dao->id][$property] = $set;
                         if (in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
                             $eventSummary['events'][$dao->id]['configure'] = CRM_Utils_System::url("civicrm/admin/event", "action=update&id={$dao->id}&reset=1");
                         }
                         break;
                     case 'end_date':
                     case 'start_date':
                         $eventSummary['events'][$dao->id][$property] = CRM_Utils_Date::customFormat($dao->{$name}, null, array('d'));
                         break;
                     case 'participants':
                     case 'notCountedDueToRole':
                     case 'notCountedDueToStatus':
                     case 'notCountedParticipants':
                         $propertyCnt = 0;
                         if (CRM_Utils_Array::value($dao->id, $eventParticipant[$name])) {
                             $propertyCnt = $eventParticipant[$name][$dao->id];
                             if ($name == 'participants') {
                                 $set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=true&role=true");
                             } else {
                                 if ($name == 'notCountedParticipants') {
                                     // FIXME : selector fail to search w/ OR operator.
                                     // $set = CRM_Utils_System::url( 'civicrm/event/search',
                                     // "reset=1&force=1&event=$dao->id&status=false&role=false" );
                                 } else {
                                     if ($name == 'notCountedDueToStatus') {
                                         $set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=false");
                                     } else {
                                         $set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&role=false");
                                     }
                                 }
                             }
                         }
                         $eventSummary['events'][$dao->id][$property] = $propertyCnt;
                         $eventSummary['events'][$dao->id][$name . '_url'] = $set;
                         break;
                     default:
                         $eventSummary['events'][$dao->id][$property] = $dao->{$name};
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Event.php

示例14: browse

 /**
  * Browse all events.
  *
  * @return void
  */
 public function browse()
 {
     Civi::resources()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     $createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
     if (strtolower($this->_sortByCharacter) == 'all' || !empty($_POST)) {
         $this->_sortByCharacter = '';
         $this->set('sortByCharacter', '');
     }
     $this->_force = $this->_searchResult = NULL;
     $this->search();
     $params = array();
     $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
     $this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
     $whereClause = $this->whereClause($params, FALSE, $this->_force);
     $this->pagerAToZ($whereClause, $params);
     $params = array();
     $whereClause = $this->whereClause($params, TRUE, $this->_force);
     // because is_template != 1 would be to simple
     $whereClause .= ' AND (is_template = 0 OR is_template IS NULL)';
     $this->pager($whereClause, $params);
     list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
     // get all custom groups sorted by weight
     $manageEvent = array();
     $query = "\n  SELECT *\n    FROM civicrm_event\n   WHERE {$whereClause}\nORDER BY start_date desc\n   LIMIT {$offset}, {$rowCount}";
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
     $permissions = CRM_Event_BAO_Event::checkPermission();
     //get all campaigns.
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
     // get the list of active event pcps
     $eventPCPS = array();
     $pcpDao = new CRM_PCP_DAO_PCPBlock();
     $pcpDao->entity_table = 'civicrm_event';
     $pcpDao->find();
     while ($pcpDao->fetch()) {
         $eventPCPS[$pcpDao->entity_id] = $pcpDao->entity_id;
     }
     // check if we're in shopping cart mode for events
     $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
     $this->assign('eventCartEnabled', $enableCart);
     $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
     $eventType = CRM_Core_OptionGroup::values('event_type');
     while ($dao->fetch()) {
         if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
             $manageEvent[$dao->id] = array();
             $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($dao->id, 'civicrm_event');
             $manageEvent[$dao->id]['repeat'] = '';
             if ($repeat) {
                 $manageEvent[$dao->id]['repeat'] = ts('Repeating (%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
             }
             CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
             // form all action links
             $action = array_sum(array_keys($this->links()));
             if ($dao->is_active) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             if (!in_array($dao->id, $permissions[CRM_Core_Permission::DELETE])) {
                 $action -= CRM_Core_Action::DELETE;
             }
             if (!in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
                 $action -= CRM_Core_Action::UPDATE;
             }
             $manageEvent[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), TRUE, 'event.manage.list', 'Event', $dao->id);
             $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event', 'is_active' => 1);
             $defaults['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
             $manageEvent[$dao->id]['friend'] = CRM_Friend_BAO_Friend::getValues($params);
             if (isset($defaults['location']['address'][1]['city'])) {
                 $manageEvent[$dao->id]['city'] = $defaults['location']['address'][1]['city'];
             }
             if (isset($defaults['location']['address'][1]['state_province_id'])) {
                 $manageEvent[$dao->id]['state_province'] = CRM_Core_PseudoConstant::stateProvince($defaults['location']['address'][1]['state_province_id']);
             }
             //show campaigns on selector.
             $manageEvent[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
             $manageEvent[$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mapping->getId());
             $manageEvent[$dao->id]['is_pcp_enabled'] = CRM_Utils_Array::value($dao->id, $eventPCPS);
             $manageEvent[$dao->id]['event_type'] = CRM_Utils_Array::value($manageEvent[$dao->id]['event_type_id'], $eventType);
             $manageEvent[$dao->id]['is_repeating_event'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_RecurringEntity', $dao->id, 'parent_id', 'entity_id');
             // allow hooks to set 'field' value which allows configuration pop-up to show a tab as enabled/disabled
             CRM_Utils_Hook::tabset('civicrm/event/manage/rows', $manageEvent, array('event_id' => $dao->id));
         }
     }
     $manageEvent['tab'] = self::tabs($enableCart);
     $this->assign('rows', $manageEvent);
     $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
     $statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0');
     $findParticipants['statusCounted'] = implode(', ', array_values($statusTypes));
     $findParticipants['statusNotCounted'] = implode(', ', array_values($statusTypesPending));
     $this->assign('findParticipants', $findParticipants);
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:97,代码来源:ManageEvent.php

示例15: emailReceipt

 /**
  * @param array $params
  *
  * @return mixed
  */
 public function emailReceipt(&$params)
 {
     // email receipt sending
     // send message template
     if ($this->_component == 'event') {
         $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id');
         $returnProperties = array('fee_label', 'start_date', 'end_date', 'is_show_location', 'title');
         CRM_Core_DAO::commonRetrieveAll('CRM_Event_DAO_Event', 'id', $eventId, $events, $returnProperties);
         $event = $events[$eventId];
         unset($event['start_date']);
         unset($event['end_date']);
         $this->assign('event', $event);
         $this->assign('isShowLocation', $event['is_show_location']);
         if (CRM_Utils_Array::value('is_show_location', $event) == 1) {
             $locationParams = array('entity_id' => $eventId, 'entity_table' => 'civicrm_event');
             $location = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
             $this->assign('location', $location);
         }
     }
     // assign payment info here
     $paymentConfig['confirm_email_text'] = CRM_Utils_Array::value('confirm_email_text', $params);
     $this->assign('paymentConfig', $paymentConfig);
     $isRefund = $this->_paymentType == 'refund' ? TRUE : FALSE;
     $this->assign('isRefund', $isRefund);
     if ($isRefund) {
         $this->assign('totalPaid', $this->_amtPaid);
         $this->assign('totalAmount', $this->_amtTotal);
         $this->assign('refundAmount', $params['total_amount']);
     } else {
         $balance = $this->_amtTotal - ($this->_amtPaid + $params['total_amount']);
         $paymentsComplete = $balance == 0 ? 1 : 0;
         $this->assign('amountOwed', $balance);
         $this->assign('totalAmount', $this->_amtTotal);
         $this->assign('paymentAmount', $params['total_amount']);
         $this->assign('paymentsComplete', $paymentsComplete);
     }
     $this->assign('contactDisplayName', $this->_contributorDisplayName);
     // assign trxn details
     $this->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $params));
     $this->assign('receive_date', CRM_Utils_Array::value('trxn_date', $params));
     $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
     if (array_key_exists('payment_instrument_id', $params)) {
         $this->assign('paidBy', CRM_Utils_Array::value($params['payment_instrument_id'], $paymentInstrument));
     }
     $this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
     $sendTemplateParams = array('groupName' => 'msg_tpl_workflow_contribution', 'valueName' => 'payment_or_refund_notification', 'contactId' => $this->_contactId, 'PDFFilename' => ts('notification') . '.pdf');
     // try to send emails only if email id is present
     // and the do-not-email option is not checked for that contact
     if ($this->_contributorEmail && !$this->_toDoNotEmail) {
         if (array_key_exists($params['from_email_address'], $this->_fromEmails['from_email_id'])) {
             $receiptFrom = $params['from_email_address'];
         }
         $sendTemplateParams['from'] = $receiptFrom;
         $sendTemplateParams['toName'] = $this->_contributorDisplayName;
         $sendTemplateParams['toEmail'] = $this->_contributorEmail;
         $sendTemplateParams['cc'] = CRM_Utils_Array::value('cc', $this->_fromEmails);
         $sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc', $this->_fromEmails);
     }
     list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
     return $mailSent;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:66,代码来源:AdditionalPayment.php


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