本文整理汇总了PHP中CRM_Contribute_DAO_Contribution::find方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_DAO_Contribution::find方法的具体用法?PHP CRM_Contribute_DAO_Contribution::find怎么用?PHP CRM_Contribute_DAO_Contribution::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_DAO_Contribution
的用法示例。
在下文中一共展示了CRM_Contribute_DAO_Contribution::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateData
function validateData(&$input, &$ids, &$objects, $required = true)
{
// make sure contact exists and is valid
require_once 'CRM/Contact/DAO/Contact.php';
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $ids['contact'];
if (!$contact->find(true)) {
CRM_Core_Error::debug_log_message("Could not find contact record: {$ids['contact']}");
echo "Failure: Could not find contact record: {$ids['contact']}<p>";
return false;
}
// make sure contribution exists and is valid
require_once 'CRM/Contribute/DAO/Contribution.php';
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $ids['contribution'];
if (!$contribution->find(true)) {
CRM_Core_Error::debug_log_message("Could not find contribution record: {$contributionID}");
echo "Failure: Could not find contribution record for {$contributionID}<p>";
return false;
}
$contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
$objects['contact'] =& $contact;
$objects['contribution'] =& $contribution;
if (!$this->loadObjects($input, $ids, $objects, $required)) {
return false;
}
return true;
}
示例2: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
//Check if there are contributions related to Contribution Page
parent::preProcess();
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
$dao = new CRM_Contribute_DAO_Contribution();
$dao->contribution_page_id = $this->_id;
if ($dao->find(TRUE)) {
$this->_relatedContributions = TRUE;
$this->assign('relatedContributions', TRUE);
}
}
示例3: preProcess
/**
* Set variables up before form is built.
*
* @param CRM_Core_Form $form
*
* @return void
*/
public static function preProcess(&$form)
{
$contriDAO = new CRM_Contribute_DAO_Contribution();
$contriDAO->id = $form->_id;
$contriDAO->find(TRUE);
if ($contriDAO->contribution_page_id) {
$ufJoinParams = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $contriDAO->contribution_page_id);
$profileId = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
//check if any honree profile is enabled if yes then assign its profile type to $_honoreeProfileType
// which will be used to constraint soft-credit contact type in formRule, CRM-13981
if ($profileId[0]) {
$form->_honoreeProfileType = CRM_Core_BAO_UFGroup::getContactType($profileId[0]);
}
}
}
示例4:
/**
* Checks to see if invoice_id already exists in db
* @param int $invoiceId The ID to check
* @return bool True if ID exists, else false
*/
function _checkDupe($invoiceId)
{
require_once 'CRM/Contribute/DAO/Contribution.php';
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
return $contribution->find();
}
示例5: getContext
/**
*
* /**
* The function returns the component(Event/Contribute..)and whether it is Test or not
*
* @param array $privateData
* Contains the name-value pairs of transaction related data.
* @param int $orderNo
* <order-total> send by google.
*
* @return array
* context of this call (test, component, payment processor id)
*/
public static function getContext($privateData, $orderNo)
{
$component = NULL;
$isTest = NULL;
$contributionID = $privateData['contributionID'];
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contributionID;
if (!$contribution->find(TRUE)) {
CRM_Core_Error::debug_log_message("Could not find contribution record: {$contributionID}");
echo "Failure: Could not find contribution record for {$contributionID}<p>";
exit;
}
if (stristr($contribution->source, 'Online Contribution')) {
$component = 'contribute';
} elseif (stristr($contribution->source, 'Online Event Registration')) {
$component = 'event';
}
$isTest = $contribution->is_test;
$duplicateTransaction = 0;
if ($contribution->contribution_status_id == 1) {
//contribution already handled. (some processors do two notifications so this could be valid)
$duplicateTransaction = 1;
}
if ($component == 'contribute') {
if (!$contribution->contribution_page_id) {
CRM_Core_Error::debug_log_message("Could not find contribution page for contribution record: {$contributionID}");
echo "Failure: Could not find contribution page for contribution record: {$contributionID}<p>";
exit;
}
} else {
$eventID = $privateData['eventID'];
if (!$eventID) {
CRM_Core_Error::debug_log_message("Could not find event ID");
echo "Failure: Could not find eventID<p>";
exit;
}
// we are in event mode
// make sure event exists and is valid
$event = new CRM_Event_DAO_Event();
$event->id = $eventID;
if (!$event->find(TRUE)) {
CRM_Core_Error::debug_log_message("Could not find event: {$eventID}");
echo "Failure: Could not find event: {$eventID}<p>";
exit;
}
}
return array($isTest, $component, $duplicateTransaction);
}
示例6: getHonorContacts
/**
* Function to get list of contribution In Honor of contact Ids
*
* @param int $honorId In Honor of Contact ID
*
* @return return the list of contribution fields
*
* @access public
* @static
*/
static function getHonorContacts($honorId)
{
$params = array();
require_once 'CRM/Contribute/DAO/Contribution.php';
$honorDAO = new CRM_Contribute_DAO_Contribution();
$honorDAO->honor_contact_id = $honorId;
$honorDAO->find();
require_once 'CRM/Contribute/PseudoConstant.php';
$status = CRM_Contribute_Pseudoconstant::contributionStatus($honorDAO->contribution_status_id);
$type = CRM_Contribute_Pseudoconstant::contributionType();
while ($honorDAO->fetch()) {
$params[$honorDAO->id]['honorId'] = $honorDAO->contact_id;
$params[$honorDAO->id]['display_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $honorDAO->contact_id, 'display_name');
$params[$honorDAO->id]['type'] = $type[$honorDAO->contribution_type_id];
$params[$honorDAO->id]['type_id'] = $honorDAO->contribution_type_id;
$params[$honorDAO->id]['amount'] = CRM_Utils_Money::format($honorDAO->total_amount, $honorDAO->currency);
$params[$honorDAO->id]['source'] = $honorDAO->source;
$params[$honorDAO->id]['receive_date'] = $honorDAO->receive_date;
$params[$honorDAO->id]['contribution_status'] = CRM_Utils_Array::value($honorDAO->contribution_status_id, $status);
}
return $params;
}
示例7: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, true);
if (!CRM_Core_Permission::check('edit memberships')) {
require_once 'CRM/Contact/BAO/Contact/Utils.php';
$userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, false);
$contactID = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $mid, "contact_id");
if (!CRM_Contact_BAO_Contact_Utils::validChecksum($contactID, $userChecksum)) {
CRM_Core_Error::fatal(ts('You do not have permission to cancel subscription.'));
}
}
$cid = CRM_Utils_Request::retrieve('cid', 'Integer', $this, false);
$context = CRM_Utils_Request::retrieve('context', 'String', $this, false);
$selectedChild = CRM_Utils_Request::retrieve('selectedChild', 'String', $this, false);
if (!$context) {
$context = CRM_Utils_Request::retrieve('compContext', 'String', $this, false);
}
$qfkey = CRM_Utils_Request::retrieve('key', 'String', $this, false);
if ($cid) {
$this->_userContext = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&selectedChild={$selectedChild}&cid={$cid}");
} else {
if ($mid) {
$this->_userContext = CRM_Utils_System::url('civicrm/member/search', "force=1&context={$context}&key={$qfkey}");
if ($context == 'dashboard') {
$this->_userContext = CRM_Utils_System::url('civicrm/member', "force=1&context={$context}&key={$qfkey}");
}
}
}
$session = CRM_Core_Session::singleton();
if ($session->get('userID')) {
$session->pushUserContext($this->_userContext);
}
if ($mid) {
$membershipTypes = CRM_Member_PseudoConstant::membershipType();
$membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $mid, 'membership_type_id');
$this->assign('membershipType', CRM_Utils_Array::value($membershipTypeId, $membershipTypes));
require_once 'CRM/Member/BAO/Membership.php';
if (CRM_Member_BAO_Membership::isSubscriptionCancelled($mid)) {
CRM_Core_Error::fatal(ts('The auto renew membership looks to have been cancelled already.'));
}
$isCancelSupported = CRM_Member_BAO_Membership::isCancelSubscriptionSupported($mid, false);
}
if ($isCancelSupported) {
$sql = " \n SELECT mp.contribution_id, rec.id as recur_id, rec.processor_id \n FROM civicrm_membership_payment mp \nINNER JOIN civicrm_membership mem ON ( mp.membership_id = mem.id ) \nINNER JOIN civicrm_contribution_recur rec ON ( mem.contribution_recur_id = rec.id )\nINNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id )\n WHERE mp.membership_id = {$mid}";
$dao = CRM_Core_DAO::executeQuery($sql);
if ($dao->fetch()) {
$this->_contributionRecurId = $dao->recur_id;
$this->_subscriptionId = $dao->processor_id;
$contributionId = $dao->contribution_id;
}
if ($contributionId) {
require_once 'CRM/Contribute/BAO/Contribution.php';
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contributionId;
$contribution->find(true);
$contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
$contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date);
$this->_objects['contribution'] = $contribution;
$this->_paymentObject = CRM_Core_BAO_PaymentProcessor::getProcessorForEntity($mid, 'membership', 'obj');
}
} else {
CRM_Core_Error::fatal(ts('Could not detect payment processor OR the processor does not support cancellation of auto renew.'));
}
}
示例8: moveRecurringRecord
public function moveRecurringRecord($submittedValues)
{
// Move recurring record to another contact
if (!empty($submittedValues['contact_id']) && $submittedValues['contact_id'] != $this->_contactID) {
$selected_cid = $submittedValues['contact_id'];
// FIXME: Not getting the below value in $submittedValues
// So taking the value from $_POST
if (isset($_POST['membership_record'])) {
$membership_record = $_POST['membership_record'];
}
// Update contact id in civicrm_contribution_recur table
$recurring = new CRM_Contribute_BAO_ContributionRecur();
$recurring->id = $this->_id;
if ($recurring->find(TRUE)) {
$recurParams = (array) $recurring;
$recurParams['contact_id'] = $selected_cid;
CRM_Contribute_BAO_ContributionRecur::create($recurParams);
}
// Update contact id in civicrm_contribution table, if 'Move Existing Contributions?' is ticked
if (isset($submittedValues['move_existing_contributions']) && $submittedValues['move_existing_contributions'] == 1) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->contribution_recur_id = $this->_id;
$contribution->find();
while ($contribution->fetch()) {
$contributionParams = (array) $contribution;
$contributionParams['contact_id'] = $selected_cid;
// Update contact_id of contributions
// related to the recurring contribution
CRM_Contribute_BAO_Contribution::create($contributionParams);
}
}
}
if (!empty($membership_record)) {
// Remove the contribution_recur_id from existing membership
if (!empty($this->_membershipID)) {
$membership = new CRM_Member_DAO_Membership();
$membership->id = $this->_membershipID;
if ($membership->find(TRUE)) {
$membershipParams = (array) $membership;
$membershipParams['contribution_recur_id'] = 'NULL';
CRM_Member_BAO_Membership::add($membershipParams);
}
}
// Update contribution_recur_id to the new membership
$membership = new CRM_Member_DAO_Membership();
$membership->id = $membership_record;
if ($membership->find(TRUE)) {
$membershipParams = (array) $membership;
$membershipParams['contribution_recur_id'] = $this->_id;
CRM_Member_BAO_Membership::add($membershipParams);
}
}
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.offlinerecurringcontributions,代码行数:53,代码来源:ContributionRecur.php
示例9: getContributionTokenDetails
/**
* Gives required details of contribuion in an indexed array format so we
* can iterate in a nice loop and do token evaluation
*
* @param array $contributionIDs
* @param array $returnProperties
* Of required properties.
* @param array $extraParams
* Extra params.
* @param array $tokens
* The list of tokens we've extracted from the content.
* @param string $className
*
* @return array
*/
public static function getContributionTokenDetails($contributionIDs, $returnProperties = NULL, $extraParams = NULL, $tokens = array(), $className = NULL)
{
// @todo this function basically replicates calling
// civicrm_api3('contribution', 'get', array('id' => array('IN' => array())
if (empty($contributionIDs)) {
// putting a fatal here so we can track if/when this happens
CRM_Core_Error::fatal();
}
$details = array();
// no apiQuery helper yet, so do a loop and find contribution by id
foreach ($contributionIDs as $contributionID) {
$dao = new CRM_Contribute_DAO_Contribution();
$dao->id = $contributionID;
if ($dao->find(TRUE)) {
$details[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $details[$dao->id]);
// do the necessary transformation
if (!empty($details[$dao->id]['payment_instrument_id'])) {
$piId = $details[$dao->id]['payment_instrument_id'];
$pis = CRM_Contribute_PseudoConstant::paymentInstrument();
$details[$dao->id]['payment_instrument'] = $pis[$piId];
}
if (!empty($details[$dao->id]['campaign_id'])) {
$campaignId = $details[$dao->id]['campaign_id'];
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
$details[$dao->id]['campaign'] = $campaigns[$campaignId];
}
if (!empty($details[$dao->id]['financial_type_id'])) {
$financialtypeId = $details[$dao->id]['financial_type_id'];
$ftis = CRM_Contribute_PseudoConstant::financialType();
$details[$dao->id]['financial_type'] = $ftis[$financialtypeId];
}
// @todo call a hook to get token contribution details
}
}
return $details;
}
示例10: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return None
*/
function postProcess()
{
// lets get around the time limit issue if possible
if (!ini_get('safe_mode')) {
set_time_limit(0);
}
// Issue 1895204: Turn off geocoding to avoid hitting Google API limits
$config =& CRM_Core_Config::singleton();
$oldGeocode = $config->geocodeMethod;
unset($config->geocodeMethod);
$params = $this->controller->exportValues($this->_name);
$originalOnly = FALSE;
if ($params['receipt_option'] == 'original_only') {
$originalOnly = TRUE;
}
$previewMode = FALSE;
if (isset($params['is_preview']) && $params['is_preview'] == 1) {
$previewMode = TRUE;
}
/**
* Drupal module include
*/
//module_load_include('.inc','civicrm_cdntaxreceipts','civicrm_cdntaxreceipts');
//module_load_include('.module','civicrm_cdntaxreceipts','civicrm_cdntaxreceipts');
// start a PDF to collect receipts that cannot be emailed
$receiptsForPrinting = cdntaxreceipts_openCollectedPDF();
$emailCount = 0;
$printCount = 0;
$failCount = 0;
foreach ($this->_contributionIds as $item => $contributionId) {
if ($emailCount + $printCount + $failCount >= self::MAX_RECEIPT_COUNT) {
$status = ts('Maximum of %1 tax receipt(s) were sent. Please repeat to continue processing.', array(1 => self::MAX_RECEIPT_COUNT, 'domain' => 'org.civicrm.cdntaxreceipts'));
CRM_Core_Session::setStatus($status, '', 'info');
break;
}
// 1. Load Contribution information
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contributionId;
if (!$contribution->find(TRUE)) {
CRM_Core_Error::fatal("CDNTaxReceipts: Could not find corresponding contribution id.");
}
// 2. If Contribution is eligible for receipting, issue the tax receipt. Otherwise ignore.
if (cdntaxreceipts_eligibleForReceipt($contribution->id)) {
list($issued_on, $receipt_id) = cdntaxreceipts_issued_on($contribution->id);
if (empty($issued_on) || !$originalOnly) {
list($ret, $method) = cdntaxreceipts_issueTaxReceipt($contribution, $receiptsForPrinting, $previewMode);
if ($ret == 0) {
$failCount++;
} elseif ($method == 'email') {
$emailCount++;
} else {
$printCount++;
}
}
}
}
// 3. Set session status
if ($previewMode) {
$status = ts('%1 tax receipt(s) have been previewed. No receipts have been issued.', array(1 => $printCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
CRM_Core_Session::setStatus($status, '', 'success');
} else {
$status = ts('%1 tax receipt(s) were sent by email.', array(1 => $emailCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
CRM_Core_Session::setStatus($status, '', 'success');
$status = ts('%1 tax receipt(s) need to be printed.', array(1 => $printCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
CRM_Core_Session::setStatus($status, '', 'success');
}
if ($failCount > 0) {
$status = ts('%1 tax receipt(s) failed to process.', array(1 => $failCount, 'domain' => 'org.civicrm.cdntaxreceipts'));
CRM_Core_Session::setStatus($status, '', 'error');
}
// Issue 1895204: Reset geocoding
$config->geocodeMethod = $oldGeocode;
// 4. send the collected PDF for download
// NB: This exits if a file is sent.
cdntaxreceipts_sendCollectedPDF($receiptsForPrinting, 'Receipts-To-Print-' . (int) $_SERVER['REQUEST_TIME'] . '.pdf');
// EXITS.
}
示例11: array
static function _fillCommonParams(&$params, $type = 'paypal')
{
if (array_key_exists('transaction', $params)) {
$transaction =& $params['transaction'];
} else {
$transaction =& $params;
}
$params['contact_type'] = 'Individual';
$billingLocTypeId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', 'Billing', 'id', 'name');
if (!$billingLocTypeId) {
$billingLocTypeId = 1;
}
if (!CRM_Utils_System::isNull($params['address'])) {
$params['address'][1]['is_primary'] = 1;
$params['address'][1]['location_type_id'] = $billingLocTypeId;
}
if (!CRM_Utils_System::isNull($params['email'])) {
$params['email'] = array(1 => array('email' => $params['email'], 'location_type_id' => $billingLocTypeId));
}
if (isset($transaction['trxn_id'])) {
// set error message if transaction has already been processed.
require_once 'CRM/Contribute/DAO/Contribution.php';
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->trxn_id = $transaction['trxn_id'];
if ($contribution->find(true)) {
$params['error'][] = ts('transaction already processed.');
}
} else {
// generate a new transaction id, if not already exist
$transaction['trxn_id'] = md5(uniqid(rand(), true));
}
if (!isset($transaction['contribution_type_id'])) {
require_once 'CRM/Contribute/PseudoConstant.php';
$contributionTypes = array_keys(CRM_Contribute_PseudoConstant::contributionType());
$transaction['contribution_type_id'] = $contributionTypes[0];
}
if ($type == 'paypal' && !isset($transaction['net_amount'])) {
$transaction['net_amount'] = $transaction['total_amount'] - CRM_Utils_Array::value('fee_amount', $transaction, 0);
}
if (!isset($transaction['invoice_id'])) {
$transaction['invoice_id'] = $transaction['trxn_id'];
}
$source = ts('ContributionProcessor: %1 API', array(1 => ucfirst($type)));
if (isset($transaction['source'])) {
$transaction['source'] = $source . ':: ' . $transaction['source'];
} else {
$transaction['source'] = $source;
}
return true;
}
示例12: postProcess
//.........这里部分代码省略.........
$this->_params["country-{$this->_bltID}"] = $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
$this->_params['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($this->_params);
$this->_params['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($this->_params);
$this->_params['ip_address'] = CRM_Utils_System::ipAddress();
$this->_params['amount'] = $params['total_amount'];
$this->_params['currencyID'] = $config->defaultCurrency;
$this->_params['payment_action'] = 'Sale';
$this->_params['invoiceID'] = md5(uniqid(rand(), TRUE));
$this->_params['financial_type_id'] = $params['financial_type_id'];
// at this point we've created a contact and stored its address etc
// all the payment processors expect the name and address to be in the
// so we copy stuff over to first_name etc.
$paymentParams = $this->_params;
$paymentParams['contactID'] = $this->_contributorContactID;
//CRM-10377 if payment is by an alternate contact then we need to set that person
// as the contact in the payment params
if ($this->_contributorContactID != $this->_contactID) {
if (!empty($this->_params['soft_credit_type_id'])) {
$softParams['contact_id'] = $params['contact_id'];
$softParams['soft_credit_type_id'] = $this->_params['soft_credit_type_id'];
}
}
if (!empty($this->_params['send_receipt'])) {
$paymentParams['email'] = $this->_contributorEmail;
}
CRM_Core_Payment_Form::mapParams($this->_bltID, $this->_params, $paymentParams, TRUE);
// CRM-7137 -for recurring membership,
// we do need contribution and recuring records.
$result = NULL;
if (!empty($paymentParams['is_recur'])) {
$allStatus = CRM_Member_PseudoConstant::membershipStatus();
$contributionType = new CRM_Financial_DAO_FinancialType();
$contributionType->id = $params['financial_type_id'];
if (!$contributionType->find(TRUE)) {
CRM_Core_Error::fatal('Could not find a system table');
}
$contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($this, $paymentParams, $result, $this->_contributorContactID, $contributionType, FALSE, TRUE, FALSE);
//create new soft-credit record, CRM-13981
$softParams['contribution_id'] = $contribution->id;
$softParams['currency'] = $contribution->currency;
$softParams['amount'] = $contribution->total_amount;
CRM_Contribute_BAO_ContributionSoft::add($softParams);
$paymentParams['contactID'] = $contactID;
$paymentParams['contributionID'] = $contribution->id;
$paymentParams['contributionTypeID'] = $contribution->financial_type_id;
$paymentParams['contributionPageID'] = $contribution->contribution_page_id;
$paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
$ids['contribution'] = $contribution->id;
$params['contribution_recur_id'] = $paymentParams['contributionRecurID'];
$params['status_id'] = array_search('Pending', $allStatus);
$params['skipStatusCal'] = TRUE;
//as membership is pending set dates to null.
$memberDates = array('join_date' => 'joinDate', 'start_date' => 'startDate', 'end_date' => 'endDate');
foreach ($memberDates as $dp => $dv) {
${$dv} = NULL;
foreach ($this->_memTypeSelected as $memType) {
$membershipTypeValues[$memType][$dv] = NULL;
}
}
}
if ($params['total_amount'] > 0.0) {
$payment = CRM_Core_Payment::singleton($this->_mode, $this->_paymentProcessor, $this);
$result =& $payment->doDirectPayment($paymentParams);
}
if (is_a($result, 'CRM_Core_Error')) {
//make sure to cleanup db for recurring case.
示例13: postProcess
/**
* @param $form
* @param array $params Parameters from the form.
*/
public static function postProcess($form, $params)
{
if (!empty($form->_honor_block_is_active) && !empty($params['soft_credit_type_id'])) {
$honorId = NULL;
//check if there is any duplicate contact
$profileContactType = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']);
$dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType);
$dedupeParams['check_permission'] = FALSE;
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType);
if (count($ids)) {
$honorId = CRM_Utils_Array::value(0, $ids);
}
$honorId = CRM_Contact_BAO_Contact::createProfileContact($params['honor'], CRM_Core_DAO::$_nullArray, $honorId, NULL, $params['honoree_profile_id']);
$softParams = array();
$softParams['contribution_id'] = $form->_contributionID;
$softParams['contact_id'] = $honorId;
$softParams['soft_credit_type_id'] = $params['soft_credit_type_id'];
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $form->_contributionID;
$contribution->find();
while ($contribution->fetch()) {
$softParams['currency'] = $contribution->currency;
$softParams['amount'] = $contribution->total_amount;
}
CRM_Contribute_BAO_ContributionSoft::add($softParams);
if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) {
$form->_values['honor'] = array('soft_credit_type' => CRM_Utils_Array::value($params['soft_credit_type_id'], CRM_Core_OptionGroup::values("soft_credit_type")), 'honor_id' => $honorId, 'honor_profile_id' => $params['honoree_profile_id'], 'honor_profile_values' => $params['honor']);
}
}
}
示例14: getContext
/**
/**
* The function returns the component(Event/Contribute..)and whether it is Test or not
*
* @param array $privateData contains the name-value pairs of transaction related data
* @param int $orderNo <order-total> send by google
*
* @return array context of this call (test, component, payment processor id)
* @static
*/
static function getContext($privateData, $orderNo)
{
require_once 'CRM/Contribute/DAO/Contribution.php';
$component = null;
$isTest = null;
$contributionID = $privateData['contributionID'];
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contributionID;
if (!$contribution->find(true)) {
CRM_Core_Error::debug_log_message("Could not find contribution record: {$contributionID}");
echo "Failure: Could not find contribution record for {$contributionID}<p>";
exit;
}
if (stristr($contribution->source, 'Online Contribution')) {
$component = 'contribute';
} elseif (stristr($contribution->source, 'Online Event Registration')) {
$component = 'event';
}
$isTest = $contribution->is_test;
$duplicateTransaction = 0;
if ($contribution->contribution_status_id == 1) {
//contribution already handled. (some processors do two notifications so this could be valid)
$duplicateTransaction = 1;
}
if ($component == 'contribute') {
if (!$contribution->contribution_page_id) {
CRM_Core_Error::debug_log_message("Could not find contribution page for contribution record: {$contributionID}");
echo "Failure: Could not find contribution page for contribution record: {$contributionID}<p>";
exit;
}
// get the payment processor id from contribution page
$paymentProcessorID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contribution->contribution_page_id, 'payment_processor_id');
} else {
$eventID = $privateData['eventID'];
if (!$eventID) {
CRM_Core_Error::debug_log_message("Could not find event ID");
echo "Failure: Could not find eventID<p>";
exit;
}
// we are in event mode
// make sure event exists and is valid
require_once 'CRM/Event/DAO/Event.php';
$event = new CRM_Event_DAO_Event();
$event->id = $eventID;
if (!$event->find(true)) {
CRM_Core_Error::debug_log_message("Could not find event: {$eventID}");
echo "Failure: Could not find event: {$eventID}<p>";
exit;
}
// get the payment processor id from contribution page
$paymentProcessorID = $event->payment_processor_id;
}
if (!$paymentProcessorID) {
CRM_Core_Error::debug_log_message("Could not find payment processor for contribution record: {$contributionID}");
echo "Failure: Could not find payment processor for contribution record: {$contributionID}<p>";
exit;
}
return array($isTest, $component, $paymentProcessorID, $duplicateTransaction);
}
示例15:
/**
* Checks to see if invoice_id already exists in db
*
* @param int $invoiceId The ID to check
*
* @return bool True if ID exists, else false
*/
function _checkDupe($invoiceId)
{
//copied from Eway but not working and not really sure it should!
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->invoice_id = $invoiceId;
return $contribution->find();
}