本文整理汇总了PHP中CRM_Contact_BAO_Contact_Location类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact_Location类的具体用法?PHP CRM_Contact_BAO_Contact_Location怎么用?PHP CRM_Contact_BAO_Contact_Location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Contact_BAO_Contact_Location类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: preProcess
public function preProcess()
{
$this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId);
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id');
if ($this->_contributionId) {
$this->_isPaidEvent = TRUE;
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE);
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->_contributorDisplayName);
$this->assign('email', $this->_contributorEmail);
$this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id');
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('contactId', $this->_contactId);
$this->assign('id', $this->_participantId);
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event');
$this->_paidAmount = $paymentInfo['paid'];
$this->assign('paymentInfo', $paymentInfo);
CRM_Core_Resources::singleton()->addSetting(array('feePaid' => $this->_paidAmount));
$title = "Change selections for {$this->_contributorDisplayName}";
if ($title) {
CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
}
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:28,代码来源:ParticipantFeeSelection.php
示例2: run
function run()
{
require_once 'CRM/Utils/Request.php';
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
$hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
$activity_id = CRM_Utils_Request::retrieve('a', 'String', CRM_Core_DAO::$_nullObject);
$petition_id = CRM_Utils_Request::retrieve('p', 'String', CRM_Core_DAO::$_nullObject);
if (!$contact_id || !$subscribe_id || !$hash) {
CRM_Core_Error::fatal(ts("Missing input parameters"));
}
require_once 'CRM/Mailing/Event/BAO/Confirm.php';
$result = $this->confirm($contact_id, $subscribe_id, $hash, $activity_id, $petition_id);
if ($result === false) {
$this->assign('success', $result);
} else {
$this->assign('success', true);
// $this->assign( 'group' , $result );
}
require_once 'CRM/Contact/BAO/Contact/Location.php';
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id);
$this->assign('display_name', $displayName);
$this->assign('email', $email);
$this->assign('petition_id', $petition_id);
$this->assign('survey_id', $petition_id);
// send thank you email
require_once 'CRM/Campaign/Form/Petition/Signature.php';
$params['contactId'] = $contact_id;
$params['email-Primary'] = $email;
$params['sid'] = $petition_id;
$params['activityId'] = $activity_id;
CRM_Campaign_BAO_Petition::sendEmail($params, CRM_Campaign_Form_Petition_Signature::EMAIL_THANK);
parent::run();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:34,代码来源:Confirm.php
示例3: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
// get the primary city, state and zip for the contact
$ids = array($this->_contactId);
$locations = CRM_Contact_BAO_Contact_Location::getMapInfo($ids);
$rows =& CRM_Utils_Sunlight::getInfo($locations[0]['city'], $locations[0]['state'], $locations[0]['postal_code']);
$this->assign('rowCount', count($rows));
$this->assign_by_ref('rows', $rows);
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:15,代码来源:Sunlight.php
示例4: confirm
/**
* Confirm a pending subscription
*
* @param int $contact_id The id of the contact
* @param int $subscribe_id The id of the subscription event
* @param string $hash The hash
*
* @return boolean True on success
* @access public
* @static
*/
public static function confirm($contact_id, $subscribe_id, $hash)
{
$se =& CRM_Mailing_Event_BAO_Subscribe::verify($contact_id, $subscribe_id, $hash);
if (!$se) {
return FALSE;
}
// before we proceed lets just check if this contact is already 'Added'
// if so, we should ignore this request and hence avoid sending multiple
// emails - CRM-11157
$details = CRM_Contact_BAO_GroupContact::getMembershipDetail($contact_id, $se->group_id);
if ($details && $details->status == 'Added') {
// This contact is already subscribed
// lets return the group title
return CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $se->group_id, 'title');
}
$transaction = new CRM_Core_Transaction();
$ce = new CRM_Mailing_Event_BAO_Confirm();
$ce->event_subscribe_id = $se->id;
$ce->time_stamp = date('YmdHis');
$ce->save();
CRM_Contact_BAO_GroupContact::addContactsToGroup(array($contact_id), $se->group_id, 'Email', 'Added', $ce->id);
$transaction->commit();
$config = CRM_Core_Config::singleton();
$domain = CRM_Core_BAO_Domain::getDomain();
list($domainEmailName, $_) = CRM_Core_BAO_Domain::getNameAndEmail();
list($display_name, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($se->contact_id);
$group = new CRM_Contact_DAO_Group();
$group->id = $se->group_id;
$group->find(TRUE);
$component = new CRM_Mailing_BAO_Component();
$component->is_default = 1;
$component->is_active = 1;
$component->component_type = 'Welcome';
$component->find(TRUE);
$emailDomain = CRM_Core_BAO_MailSettings::defaultDomain();
$html = $component->body_html;
if ($component->body_text) {
$text = $component->body_text;
} else {
$text = CRM_Utils_String::htmlToText($component->body_html);
}
$bao = new CRM_Mailing_BAO_Mailing();
$bao->body_text = $text;
$bao->body_html = $html;
$tokens = $bao->getTokens();
$html = CRM_Utils_Token::replaceDomainTokens($html, $domain, TRUE, $tokens['html']);
$html = CRM_Utils_Token::replaceWelcomeTokens($html, $group->title, TRUE);
$text = CRM_Utils_Token::replaceDomainTokens($text, $domain, FALSE, $tokens['text']);
$text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->title, FALSE);
$mailParams = array('groupName' => 'Mailing Event ' . $component->component_type, 'subject' => $component->subject, 'from' => "\"{$domainEmailName}\" <do-not-reply@{$emailDomain}>", 'toEmail' => $email, 'toName' => $display_name, 'replyTo' => "do-not-reply@{$emailDomain}", 'returnPath' => "do-not-reply@{$emailDomain}", 'html' => $html, 'text' => $text);
// send - ignore errors because the desired status change has already been successful
$unused_result = CRM_Utils_Mail::send($mailParams);
return $group->title;
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:65,代码来源:Confirm.php
示例5: commonBuildQuickForm
/**
* @param $self
*/
public static function commonBuildQuickForm($self)
{
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $self);
if (!$contactId) {
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST);
}
$urlParams = "action=add&reset=1&cid={$contactId}&selectedChild=activity&atype=";
$activityTypes = $urls = array();
$emailTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Email', 'name');
$letterTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Print PDF Letter', 'name');
$SMSId = CRM_Core_OptionGroup::getValue('activity_type', 'Text Message (SMS)', 'label');
if (CRM_Utils_Mail::validOutBoundMail() && $contactId) {
list($name, $email, $doNotEmail, $onHold, $isDeseased) = CRM_Contact_BAO_Contact::getContactDetails($contactId);
if (!$doNotEmail && $email && !$isDeseased) {
$activityTypes = array($emailTypeId => ts('Send an Email'));
}
}
if ($contactId && CRM_SMS_BAO_Provider::activeProviderCount()) {
// Check for existence of a mobile phone and ! do not SMS privacy setting
$mobileTypeID = CRM_Core_OptionGroup::getValue('phone_type', 'Mobile', 'name');
list($name, $phone, $doNotSMS) = CRM_Contact_BAO_Contact_Location::getPhoneDetails($contactId, $mobileTypeID);
if (!$doNotSMS && $phone) {
$sendSMS = array($SMSId => ts('Send SMS'));
$activityTypes += $sendSMS;
}
}
// this returns activity types sorted by weight
$otherTypes = CRM_Core_PseudoConstant::activityType(FALSE);
$activityTypes += $otherTypes;
foreach (array_keys($activityTypes) as $typeId) {
if ($typeId == $emailTypeId) {
$urls[$typeId] = CRM_Utils_System::url('civicrm/activity/email/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
} elseif ($typeId == $SMSId) {
$urls[$typeId] = CRM_Utils_System::url('civicrm/activity/sms/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
} elseif ($typeId == $letterTypeId) {
$urls[$typeId] = CRM_Utils_System::url('civicrm/activity/pdf/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
} else {
$urls[$typeId] = CRM_Utils_System::url('civicrm/activity/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
}
}
$self->assign('activityTypes', $activityTypes);
$self->assign('urls', $urls);
$self->assign('suppressForm', TRUE);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:47,代码来源:ActivityLinks.php
示例6: preProcess
public function preProcess()
{
$this->_participantId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->_eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_participantId, 'event_id');
$this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($this->_eventId);
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participantId, 'contribution_id', 'participant_id');
if (!$this->_contributionId) {
if ($primaryParticipantId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'registered_by_id')) {
$this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantPayment', $primaryParticipantId, 'contribution_id', 'participant_id');
}
}
if ($this->_contributionId) {
$this->_isPaidEvent = TRUE;
}
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, TRUE);
list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
$this->assign('displayName', $this->_contributorDisplayName);
$this->assign('email', $this->_contributorEmail);
$this->_participantStatus = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $this->_participantId, 'status_id');
//set the payment mode - _mode property is defined in parent class
$this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$this->assign('contactId', $this->_contactId);
$this->assign('id', $this->_participantId);
$paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_participantId, 'event');
$this->_paidAmount = $paymentInfo['paid'];
$this->assign('paymentInfo', $paymentInfo);
$this->assign('feePaid', $this->_paidAmount);
$ids = CRM_Event_BAO_Participant::getParticipantIds($this->_contributionId);
if (count($ids) > 1) {
$total = 0;
foreach ($ids as $val) {
$total += CRM_Price_BAO_LineItem::getLineTotal($val, 'civicrm_participant');
}
$this->assign('totalLineTotal', $total);
$lineItemTotal = CRM_Price_BAO_LineItem::getLineTotal($this->_participantId, 'civicrm_participant');
$this->assign('lineItemTotal', $lineItemTotal);
}
$title = "Change selections for {$this->_contributorDisplayName}";
if ($title) {
CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
}
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:43,代码来源:ParticipantFeeSelection.php
示例7: run
function run()
{
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
$hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
if (!$contact_id || !$subscribe_id || !$hash) {
CRM_Core_Error::fatal(ts("Missing input parameters"));
}
$result = CRM_Mailing_Event_BAO_Confirm::confirm($contact_id, $subscribe_id, $hash);
if ($result === FALSE) {
$this->assign('success', $result);
} else {
$this->assign('success', TRUE);
$this->assign('group', $result);
}
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id);
$this->assign('display_name', $displayName);
$this->assign('email', $email);
return parent::run();
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:20,代码来源:Confirm.php
示例8: run
/**
* @return string
* @throws Exception
*/
public function run()
{
CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
$hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
$activity_id = CRM_Utils_Request::retrieve('a', 'String', CRM_Core_DAO::$_nullObject);
$petition_id = CRM_Utils_Request::retrieve('pid', 'String', CRM_Core_DAO::$_nullObject);
if (!$petition_id) {
$petition_id = CRM_Utils_Request::retrieve('p', 'String', CRM_Core_DAO::$_nullObject);
}
if (!$contact_id || !$subscribe_id || !$hash) {
CRM_Core_Error::fatal(ts("Missing input parameters"));
}
$result = $this->confirm($contact_id, $subscribe_id, $hash, $activity_id, $petition_id);
if ($result === FALSE) {
$this->assign('success', $result);
} else {
$this->assign('success', TRUE);
// $this->assign( 'group' , $result );
}
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id);
$this->assign('display_name', $displayName);
$this->assign('email', $email);
$this->assign('petition_id', $petition_id);
$this->assign('survey_id', $petition_id);
$pparams['id'] = $petition_id;
$this->petition = array();
CRM_Campaign_BAO_Survey::retrieve($pparams, $this->petition);
$this->assign('is_share', CRM_Utils_Array::value('is_share', $this->petition));
$this->assign('thankyou_title', CRM_Utils_Array::value('thankyou_title', $this->petition));
$this->assign('thankyou_text', CRM_Utils_Array::value('thankyou_text', $this->petition));
CRM_Utils_System::setTitle(CRM_Utils_Array::value('thankyou_title', $this->petition));
// send thank you email
$params['contactId'] = $contact_id;
$params['email-Primary'] = $email;
$params['sid'] = $petition_id;
$params['activityId'] = $activity_id;
CRM_Campaign_BAO_Petition::sendEmail($params, CRM_Campaign_Form_Petition_Signature::EMAIL_THANK);
return parent::run();
}
开发者ID:kidaa30,项目名称:yes,代码行数:45,代码来源:Confirm.php
示例9: run
function run()
{
require_once 'CRM/Utils/Request.php';
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
$hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
if (!$contact_id || !$subscribe_id || !$hash) {
CRM_Core_Error::fatal(ts("Missing input parameters"));
}
require_once 'CRM/Mailing/Event/BAO/Confirm.php';
$result = CRM_Mailing_Event_BAO_Confirm::confirm($contact_id, $subscribe_id, $hash);
if ($result === false) {
$this->assign('success', $result);
} else {
$this->assign('success', true);
$this->assign('group', $result);
}
require_once 'CRM/Contact/BAO/Contact/Location.php';
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id);
$this->assign('display_name', $displayName);
$this->assign('email', $email);
parent::run();
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:23,代码来源:Confirm.php
示例10: sendStatusUpdate
/**
* Send notfication email to supporter
* 1. when their PCP status is changed by site admin.
* 2. when supporter initially creates a Personal Campaign Page ($isInitial set to true).
*
* @param int $pcpId
* Campaign page id.
* @param int $newStatus
* Pcp status id.
* @param bool|int $isInitial is it the first time, campaign page has been created by the user
*
* @param string $component
*
* @throws Exception
* @return null
*/
public static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE, $component = 'contribute')
{
$pcpStatusName = CRM_Core_OptionGroup::values("pcp_status", FALSE, FALSE, FALSE, NULL, 'name');
$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
$config = CRM_Core_Config::singleton();
if (!isset($pcpStatus[$newStatus])) {
return FALSE;
}
require_once 'Mail/mime.php';
//set loginUrl
$loginURL = $config->userSystem->getLoginURL();
// used in subject templates
$contribPageTitle = self::getPcpPageTitle($pcpId, $component);
$tplParams = array('loginUrl' => $loginURL, 'contribPageTitle' => $contribPageTitle, 'pcpId' => $pcpId);
//get the default domain email address.
list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail();
if (!$domainEmailAddress || $domainEmailAddress == '[email protected]') {
$fixUrl = CRM_Utils_System::url("civicrm/admin/domain", 'action=update&reset=1');
CRM_Core_Error::fatal(ts('The site administrator needs to enter a valid \'FROM Email Address\' in <a href="%1">Administer CiviCRM » Communications » FROM Email Addresses</a>. The email address used may need to be a valid mail account with your email service provider.', array(1 => $fixUrl)));
}
$receiptFrom = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>';
// get recipient (supporter) name and email
$params = array('id' => $pcpId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $params, $pcpInfo);
list($name, $address) = CRM_Contact_BAO_Contact_Location::getEmailDetails($pcpInfo['contact_id']);
// get pcp block info
list($blockId, $eid) = self::getPcpBlockEntityId($pcpId, $component);
$params = array('id' => $blockId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $params, $pcpBlockInfo);
// assign urls required in email template
if ($pcpStatusName[$newStatus] == 'Approved') {
$tplParams['isTellFriendEnabled'] = $pcpBlockInfo['is_tellfriend_enabled'];
if ($pcpBlockInfo['is_tellfriend_enabled']) {
$pcpTellFriendURL = CRM_Utils_System::url('civicrm/friend', "reset=1&eid={$pcpId}&blockId={$blockId}&pcomponent=pcp", TRUE, NULL, FALSE, TRUE);
$tplParams['pcpTellFriendURL'] = $pcpTellFriendURL;
}
}
$pcpInfoURL = CRM_Utils_System::url('civicrm/pcp/info', "reset=1&id={$pcpId}", TRUE, NULL, FALSE, TRUE);
$tplParams['pcpInfoURL'] = $pcpInfoURL;
$tplParams['contribPageTitle'] = $contribPageTitle;
if ($emails = CRM_Utils_Array::value('notify_email', $pcpBlockInfo)) {
$emailArray = explode(',', $emails);
$tplParams['pcpNotifyEmailAddress'] = $emailArray[0];
}
// get appropriate message based on status
$tplParams['pcpStatus'] = $pcpStatus[$newStatus];
$tplName = $isInitial ? 'pcp_supporter_notify' : 'pcp_status_change';
list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(array('groupName' => 'msg_tpl_workflow_contribution', 'valueName' => $tplName, 'contactId' => $pcpInfo['contact_id'], 'tplParams' => $tplParams, 'from' => $receiptFrom, 'toName' => $name, 'toEmail' => $address));
return $sent;
}
开发者ID:kidaa30,项目名称:yes,代码行数:66,代码来源:PCP.php
示例11: emailReceipt
//.........这里部分代码省略.........
if (property_exists($form, '_groupTree') && !empty($form->_groupTree)) {
foreach ($form->_groupTree as $groupID => $group) {
if ($groupID == 'info') {
continue;
}
foreach ($group['fields'] as $k => $field) {
$field['title'] = $field['label'];
$customFields["custom_{$k}"] = $field;
}
}
}
$members = array(array('member_id', '=', $membership->id, 0, 0));
// check whether its a test drive
if ($form->_mode == 'test') {
$members[] = array('member_test', '=', 1, 0, 0);
}
CRM_Core_BAO_UFGroup::getValues($formValues['contact_id'], $customFields, $customValues, FALSE, $members);
if ($form->_mode) {
if (!empty($form->_params['billing_first_name'])) {
$name = $form->_params['billing_first_name'];
}
if (!empty($form->_params['billing_middle_name'])) {
$name .= " {$form->_params['billing_middle_name']}";
}
if (!empty($form->_params['billing_last_name'])) {
$name .= " {$form->_params['billing_last_name']}";
}
$form->assign('billingName', $name);
// assign the address formatted up for display
$addressParts = array("street_address-{$form->_bltID}", "city-{$form->_bltID}", "postal_code-{$form->_bltID}", "state_province-{$form->_bltID}", "country-{$form->_bltID}");
$addressFields = array();
foreach ($addressParts as $part) {
list($n, $id) = explode('-', $part);
if (isset($form->_params['billing_' . $part])) {
$addressFields[$n] = $form->_params['billing_' . $part];
}
}
$form->assign('address', CRM_Utils_Address::format($addressFields));
$date = CRM_Utils_Date::format($form->_params['credit_card_exp_date']);
$date = CRM_Utils_Date::mysqlToIso($date);
$form->assign('credit_card_exp_date', $date);
$form->assign('credit_card_number', CRM_Utils_System::mungeCreditCard($form->_params['credit_card_number']));
$form->assign('credit_card_type', $form->_params['credit_card_type']);
$form->assign('contributeMode', 'direct');
$form->assign('isAmountzero', 0);
$form->assign('is_pay_later', 0);
$form->assign('isPrimary', 1);
}
$form->assign('module', 'Membership');
$form->assign('contactID', $formValues['contact_id']);
$form->assign('membershipID', CRM_Utils_Array::value('membership_id', $form->_params, CRM_Utils_Array::value('membership_id', $form->_defaultValues)));
if (!empty($formValues['contribution_id'])) {
$form->assign('contributionID', $formValues['contribution_id']);
} elseif (isset($form->_onlinePendingContributionId)) {
$form->assign('contributionID', $form->_onlinePendingContributionId);
}
if (!empty($formValues['contribution_status_id'])) {
$form->assign('contributionStatusID', $formValues['contribution_status_id']);
$form->assign('contributionStatus', CRM_Contribute_PseudoConstant::contributionStatus($formValues['contribution_status_id'], 'name'));
}
if (!empty($formValues['is_renew'])) {
$form->assign('receiptType', 'membership renewal');
} else {
$form->assign('receiptType', 'membership signup');
}
$form->assign('receive_date', CRM_Utils_Date::processDate(CRM_Utils_Array::value('receive_date', $formValues)));
$form->assign('formValues', $formValues);
if (empty($lineItem)) {
$form->assign('mem_start_date', CRM_Utils_Date::customFormat($membership->start_date, '%B %E%f, %Y'));
if (!CRM_Utils_System::isNull($membership->end_date)) {
$form->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date, '%B %E%f, %Y'));
}
$form->assign('membership_name', CRM_Member_PseudoConstant::membershipType($membership->membership_type_id));
}
$form->assign('customValues', $customValues);
$isBatchProcess = is_a($form, 'CRM_Batch_Form_Entry');
if (empty($form->_contributorDisplayName) || empty($form->_contributorEmail) || $isBatchProcess) {
// in this case the form is being called statically from the batch editing screen
// having one class in the form layer call another statically is not greate
// & we should aim to move this function to the BAO layer in future.
// however, we can assume that the contact_id passed in by the batch
// function will be the recipient
list($form->_contributorDisplayName, $form->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($formValues['contact_id']);
if (empty($form->_receiptContactId) || $isBatchProcess) {
$form->_receiptContactId = $formValues['contact_id'];
}
}
$template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('dataArray');
$eventTaxAmt = $template->get_template_vars('totalTaxAmount');
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
$isEmailPdf = TRUE;
} else {
$isEmailPdf = FALSE;
}
list($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(array('groupName' => 'msg_tpl_workflow_membership', 'valueName' => 'membership_offline_receipt', 'contactId' => $form->_receiptContactId, 'from' => $receiptFrom, 'toName' => $form->_contributorDisplayName, 'toEmail' => $form->_contributorEmail, 'PDFFilename' => ts('receipt') . '.pdf', 'isEmailPdf' => $isEmailPdf, 'contributionId' => $formValues['contribution_id'], 'isTest' => (bool) ($form->_action & CRM_Core_Action::PREVIEW)));
return TRUE;
}
开发者ID:indydas,项目名称:civi-demo,代码行数:101,代码来源:Membership.php
示例12: buildQuickForm
/**
* Build the form object.
*
* @param CRM_Core_Form $form
*
* @return void
*/
public static function buildQuickForm(&$form)
{
if ($form->_eventId) {
$form->_isPaidEvent = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_eventId, 'is_monetary');
if ($form->_isPaidEvent) {
$form->addElement('hidden', 'hidden_feeblock', 1);
}
// make sure this is for backoffice registration.
if ($form->getName() == 'Participant') {
$eventfullMsg = CRM_Event_BAO_Participant::eventFullMessage($form->_eventId, $form->_pId);
$form->addElement('hidden', 'hidden_eventFullMsg', $eventfullMsg, array('id' => 'hidden_eventFullMsg'));
}
}
if ($form->_pId) {
if (CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $form->_pId, 'contribution_id', 'participant_id')) {
$form->_online = TRUE;
}
}
if ($form->_isPaidEvent) {
$params = array('id' => $form->_eventId);
CRM_Event_BAO_Event::retrieve($params, $event);
//retrieve custom information
$form->_values = array();
CRM_Event_Form_Registration::initEventFee($form, $event['id']);
CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->_discountId);
$lineItem = array();
$invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
$totalTaxAmount = 0;
if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $form->_values))) {
$lineItem[] = $form->_values['line_items'];
foreach ($form->_values['line_items'] as $key => $value) {
$totalTaxAmount = $value['tax_amount'] + $totalTaxAmount;
}
}
if ($invoicing) {
$form->assign('totalTaxAmount', $totalTaxAmount);
}
$form->assign('lineItem', empty($lineItem) ? FALSE : $lineItem);
$discounts = array();
if (!empty($form->_values['discount'])) {
foreach ($form->_values['discount'] as $key => $value) {
$value = current($value);
$discounts[$key] = $value['name'];
}
$element = $form->add('select', 'discount_id', ts('Discount Set'), array(0 => ts('- select -')) + $discounts, FALSE, array('class' => "crm-select2"));
if ($form->_online) {
$element->freeze();
}
}
if ($form->_mode) {
CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, FALSE);
} elseif (!$form->_mode) {
$form->addElement('checkbox', 'record_contribution', ts('Record Payment?'), NULL, array('onclick' => "return showHideByValue('record_contribution','','payment_information','table-row','radio',false);"));
$form->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType());
$form->addDate('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDate'));
$form->add('select', 'payment_instrument_id', ts('Paid By'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);"));
// don't show transaction id in batch update mode
$path = CRM_Utils_System::currentPath();
$form->assign('showTransactionId', FALSE);
if ($path != 'civicrm/contact/search/basic') {
$form->add('text', 'trxn_id', ts('Transaction ID'));
$form->addRule('trxn_id', ts('Transaction ID already exists in Database.'), 'objectExists', array('CRM_Contribute_DAO_Contribution', $form->_eventId, 'trxn_id'));
$form->assign('showTransactionId', TRUE);
}
$status = CRM_Contribute_PseudoConstant::contributionStatus();
// CRM-14417 suppressing contribution statuses that are NOT relevant to new participant registrations
$statusName = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
foreach (array('Cancelled', 'Failed', 'In Progress', 'Overdue', 'Refunded', 'Pending refund') as $suppress) {
unset($status[CRM_Utils_Array::key($suppress, $statusName)]);
}
$form->add('select', 'contribution_status_id', ts('Payment Status'), $status);
$form->add('text', 'check_number', ts('Check Number'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'check_number'));
$form->add('text', 'total_amount', ts('Amount'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'total_amount'));
}
} else {
$form->add('text', 'amount', ts('Event Fee(s)'));
}
$form->assign('onlinePendingContributionId', $form->get('onlinePendingContributionId'));
$form->assign('paid', $form->_isPaidEvent);
$form->addElement('checkbox', 'send_receipt', ts('Send Confirmation?'), NULL, array('onclick' => "showHideByValue('send_receipt','','notice','table-row','radio',false); showHideByValue('send_receipt','','from-email','table-row','radio',false);"));
$form->add('select', 'from_email_address', ts('Receipt From'), $form->_fromEmails['from_email_id']);
$form->add('textarea', 'receipt_text', ts('Confirmation Message'));
// Retrieve the name and email of the contact - form will be the TO for receipt email ( only if context is not standalone)
if ($form->_context != 'standalone') {
if ($form->_contactId) {
list($form->_contributorDisplayName, $form->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($form->_contactId);
$form->assign('email', $form->_contributorEmail);
} else {
//show email block for batch update for event
$form->assign('batchEmail', TRUE);
}
}
//.........这里部分代码省略.........
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:101,代码来源:EventFees.php
示例13: sendAcknowledgment
/**
* Function to send Acknowledgment and create activity.
*
* @param object $form form object.
* @param array $params (reference ) an assoc array of name/value pairs.
* @access public
*
* @return None.
*/
function sendAcknowledgment(&$form, $params)
{
//handle Acknowledgment.
$allPayments = $payments = array();
//get All Payments status types.
$paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$returnProperties = array('status_id', 'scheduled_amount', 'scheduled_date', 'contribution_id');
//get all paymnets details.
CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'pledge_id', $params['id'], $allPayments, $returnProperties);
if (!empty($allPayments)) {
foreach ($allPayments as $payID => $values) {
$contributionValue = $contributionStatus = array();
if (isset($values['contribution_id'])) {
$contributionParams = array('id' => $values['contribution_id']);
$returnProperties = array('contribution_status_id', 'receive_date');
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_Contribution', $contributionParams, $contributionStatus, $returnProperties);
$contributionValue = array('status' => CRM_Utils_Array::value('contribution_status_id', $contributionStatus), 'receive_date' => CRM_Utils_Array::value('receive_date', $contributionStatus));
}
$payments[$payID] = array_merge($contributionValue, array('amount' => CRM_Utils_Array::value('scheduled_amount', $values), 'due_date' => CRM_Utils_Array::value('scheduled_date', $values)));
//get the first valid payment id.
if (!isset($form->paymentId) && ($paymentStatusTypes[$values['status_id']] == 'Pending' || $paymentStatusTypes[$values['status_id']] == 'Overdue')) {
$form->paymentId = $values['id'];
}
}
}
//end
//assign pledge fields value to template.
$pledgeFields = array('create_date', 'total_pledge_amount', 'frequency_interval', 'frequency_unit', 'installments', 'frequency_day', 'scheduled_amount', 'currency');
foreach ($pledgeFields as $field) {
if (CRM_Utils_Array::value($field, $params)) {
$form->assign($field, $params[$field]);
}
}
//assign all payments details.
if ($payments) {
$form->assign('payments', $payments);
}
//assign honor fields.
$honor_block_is_active = FALSE;
//make sure we have values for it
if (CRM_Utils_Array::value('honor_type_id', $params) && (!empty($params['honor_first_name']) && !empty($params['honor_last_name']) || !empty($params['honor_email']))) {
$honor_block_is_active = TRUE;
$prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
$honor = CRM_Core_PseudoConstant::get('CRM_Pledge_DAO_Pledge', 'honor_type_id');
$form->assign('honor_type', $honor[$params['honor_type_id']]);
$form->assign('honor_prefix', $prefix[$params['honor_prefix_id']]);
$form->assign('honor_first_name', $params['honor_first_name']);
$form->assign('honor_last_name', $params['honor_last_name']);
$form->assign('honor_email', $params['honor_email']);
}
$form->assign('honor_block_is_active', $honor_block_is_active);
//handle domain token values
$domain = CRM_Core_BAO_Domain::getDomain();
$tokens = array('domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens());
$domainValues = array();
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
$form->assign('domain', $domainValues);
//handle contact token values.
$ids = array($params['contact_id']);
$fields = array_merge(array_keys(CRM_Contact_BAO_Contact::importableFields()), array('display_name', 'checksum', 'contact_id'));
foreach ($fields as $key => $val) {
$returnProperties[$val] = TRUE;
}
$details = CRM_Utils_Token::getTokenDetails($ids, $returnProperties, TRUE, TRUE, NULL, $tokens, get_class($form));
$form->assign('contact', $details[0][$params['contact_id']]);
//handle custom data.
if (CRM_Utils_Array::value('hidden_custom', $params)) {
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', CRM_Core_DAO::$_nullObject, $params['id']);
$pledgeParams = array(array('pledge_id', '=', $params['id'], 0, 0));
$customGroup = array();
// retrieve custom data
foreach ($groupTree as $groupID => $group) {
$customFields = $customValues = array();
if ($groupID == 'info') {
continue;
}
foreach ($group['fields'] as $k => $field) {
$field['title'] = $field['label'];
$customFields["custom_{$k}"] = $field;
}
//to build array of customgroup & customfields in it
CRM_Core_BAO_UFGroup::getValues($params['contact_id'], $customFields, $customValues, FALSE, $pledgeParams);
$customGroup[$group['title']] = $customValues;
}
$form->assign('customGroup', $customGroup);
}
//handle acknowledgment email stuff.
list($pledgerDisplayName, $pledgerEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($params['contact_id']);
//check for online pledge.
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:Pledge.php
示例14: sendMail
/**
* Process that send e-mails
*
* @return void
* @access public
*/
static function sendMail($contactID, &$values, $participantId, $isTest = false, $returnMessageText = false)
{
require_once 'CRM/Core/BAO/UFGroup.php';
$template = CRM_Core_Smarty::singleton();
$gIds = array('custom_pre_id' => $values['custom_pre_id'], 'custom_post_id' => $values['custom_post_id']);
//get the params submitted by participant.
$participantParams = CRM_Utils_Array::value($participantId, $values['params'], array());
if (!$returnMessageText) {
//send notification email if field values are set (CRM-1941)
foreach ($gIds as $key => $gId) {
if ($gId) {
$email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify');
if ($email) {
//get values of corresponding profile fields for notification
list($profileValues) = self::buildCustomDisplay($gId, null, $contactID, $template, $participantId, $isTest, true, $participantParams);
$val = array('id' => $gId, 'values' => $profileValues, 'email' => $email);
CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val);
}
}
}
}
if ($values['event']['is_email_confirm'] || $returnMessageText) {
require_once 'CRM/Contact/BAO/Contact/Location.php';
//use primary email address, since we are not creating billing address for
//1. participant is pay later.
//2. participant might be additional participant.
//3. participant might be on waiting list.
//4. registration might require approval.
if (CRM_Utils_Array::value('is_pay_later', $values['params']) || CRM_Utils_Array::value('additionalParticipant', $values['params']) || CRM_Utils_Array::value('isOnWaitlist', $values['params']) || CRM_Utils_Array::value('isRequireApproval', $values['params']) || !CRM_Utils_Array::value('is_monetary', $values['event'])) {
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
} else {
// get the billing location type
$locationTypes =& CRM_Core_PseudoConstant::locationType();
$bltID = array_search('Billing', $locationTypes);
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID, false, $bltID);
}
//send email only when email is present
if (isset($email) || $returnMessageText) {
$preProfileID = $values['custom_pre_id'];
$postProfileID = $values['custom_post_id'];
if (CRM_Utils_Array::value('additionalParticipant', $values['params'])) {
$preProfileID = $values['additional_custom_pre_id'];
$postProfileID = $values['additional_custom_post_id'];
}
self::buildCustomDisplay($preProfileID, 'customPre', $contactID, $template, $participantId, $isTest, null, $participantParams);
self::buildCustomDisplay($postProfileID, 'customPost', $contactID, $template, $participantId, $isTest, null, $participantParams);
$sendTemplateParams = array('groupName' => 'msg_tpl_workflow_event', 'valueName' => 'event_online_receipt', 'contactId' => $contactID, 'isTest' => $isTest, 'tplParams' => array('email' => $email, 'confirm_email_text' => CRM_Utils_Array::value('confirm_email_text', $values['event']), 'isShowLocation' => CRM_Utils_Array::value('is_show_location', $values['event'])), 'PDFFilename' => 'civicrm.pdf');
// address required during receipt processing (pdf and email receipt)
if ($displayAddress = CRM_Utils_Array::value('address', $values)) {
$sendTemplateParams['tplParams']['address'] = $displayAddress;
$sendTemplateParams['tplParams']['contributeMode'] = null;
}
// set lineItem details
if ($lineItem = CRM_Utils_Array::value('lineItem', $values)) {
$sendTemplateParams['tplParams']['lineItem'] = $lineItem;
}
require_once 'CRM/Core/BAO/MessageTemplates.php';
if ($returnMessageText) {
list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams);
return array('subject' => $subject, 'body' => $message, 'to' => $displayName, 'html' => $html);
} else {
$sendTemplateParams['from'] = "{$values['event']['confirm_from_name']} <{$values['event']['confirm_from_email']}>";
$sendTemplateParams['toN
|
请发表评论