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


PHP CRM_Contribute_BAO_Contribution::deleteContribution方法代码示例

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


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

示例1: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     $deletedContributions = 0;
     foreach ($this->_contributionIds as $contributionId) {
         if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionId)) {
             $deletedContributions++;
         }
     }
     $status = ts('Deleted Contribution(s): %1 (Total Selected: %2) ', array(1 => $deletedContributions, 2 => count($this->_contributionIds)));
     CRM_Core_Session::setStatus($status, '', 'info');
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:18,代码来源:Delete.php

示例2: testDeleteContribution

 /**
  * deleteContribution() method
  */
 function testDeleteContribution()
 {
     $this->markTestSkipped('throws fatals');
     $contactId = Contact::createIndividual();
     $ids = array('contribution' => null);
     $params = array('contact_id' => $contactId, 'currency' => 'USD', 'contribution_type_id' => 1, 'contribution_status_id' => 1, 'payment_instrument_id' => 1, 'source' => 'STUDENT', 'receive_date' => '20080522000000', 'receipt_date' => '20080522000000', 'id' => null, 'non_deductible_amount' => 0.0, 'total_amount' => 200.0, 'fee_amount' => 5, 'net_amount' => 195, 'trxn_id' => '33ereerwww322323', 'invoice_id' => '33ed39c9e9ee6ef6031621ce0eafe6da70', 'thankyou_date' => '20080522');
     require_once 'CRM/Contribute/BAO/Contribution.php';
     $contribution = CRM_Contribute_BAO_Contribution::create($params, $ids);
     $this->assertEquals($params['trxn_id'], $contribution->trxn_id, 'Check for transcation id creation.');
     $this->assertEquals($contactId, $contribution->contact_id, 'Check for contact id  creation.');
     $contributiondelete = CRM_Contribute_BAO_Contribution::deleteContribution($contribution->id);
     $this->assertDBNull('CRM_Contribute_DAO_Contribution', $contribution->trxn_id, 'id', 'trxn_id', 'Database check for deleted Contribution.');
     Contact::delete($contactId);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:17,代码来源:ContributionTest.php

示例3: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  */
 public function postProcess()
 {
     $deleted = $failed = 0;
     foreach ($this->_contributionIds as $contributionId) {
         if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionId)) {
             $deleted++;
         } else {
             $failed++;
         }
     }
     if ($deleted) {
         $msg = ts('%count contribution deleted.', array('plural' => '%count contributions deleted.', 'count' => $deleted));
         CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
     }
     if ($failed) {
         CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
     }
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:21,代码来源:Delete.php

示例4: deleteParticipantPayment

 /**                          
  * Delete the record that are associated with this Participation Payment
  * 
  * @param  array  $params   array in the format of $field => $value. 
  * 
  * @return boolean  true if deleted false otherwise
  * @access public 
  */
 static function deleteParticipantPayment($params)
 {
     require_once 'CRM/Event/DAO/ParticipantPayment.php';
     $participantPayment =& new CRM_Event_DAO_ParticipantPayment();
     $valid = false;
     foreach ($params as $field => $value) {
         if (!empty($value)) {
             $participantPayment->{$field} = $value;
             $valid = true;
         }
     }
     if (!$valid) {
         CRM_Core_Error::fatal();
     }
     if ($participantPayment->find(true)) {
         require_once 'CRM/Contribute/BAO/Contribution.php';
         CRM_Contribute_BAO_Contribution::deleteContribution($participantPayment->contribution_id);
         $participantPayment->delete();
         return $participantPayment;
     }
     return false;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:30,代码来源:ParticipantPayment.php

示例5: civicrm_api3_contribution_delete

/**
 * Delete a Contribution.
 *
 * @param array $params
 *   Input parameters.
 *
 * @return array
 */
function civicrm_api3_contribution_delete($params)
{
    $contributionID = !empty($params['contribution_id']) ? $params['contribution_id'] : $params['id'];
    if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionID)) {
        return civicrm_api3_create_success(array($contributionID => 1));
    } else {
        return civicrm_api3_create_error('Could not delete contribution');
    }
}
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:17,代码来源:Contribution.php

示例6: postProcess

 /** 
  * Function to process the form 
  * 
  * @access public 
  * @return None 
  */
 function postProcess()
 {
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         require_once 'CRM/Contribute/BAO/Contribution.php';
         CRM_Contribute_BAO_Contribution::deleteContribution($this->_id);
         return;
     }
     // get the submitted form values.
     $formValues = $this->controller->exportValues($this->_name);
     //print_r($formValues);
     $config =& CRM_Core_Config::singleton();
     $params = array();
     $ids = array();
     $params['contact_id'] = $this->_contactID;
     $params['currency'] = $config->defaultCurrency;
     $fields = array('contribution_type_id', 'payment_instrument_id', 'non_deductible_amount', 'total_amount', 'fee_amount', 'net_amount', 'trxn_id', 'invoice_id', 'cancel_reason', 'source', 'note');
     foreach ($fields as $f) {
         $params[$f] = CRM_Utils_Array::value($f, $formValues);
     }
     $dates = array('receive_date', 'receipt_date', 'thankyou_date', 'cancel_date');
     $currentTime = getDate();
     foreach ($dates as $d) {
         if (!CRM_Utils_System::isNull($formValues[$d])) {
             $formValues[$d]['H'] = $currentTime['hours'];
             $formValues[$d]['i'] = $currentTime['minutes'];
             $formValues[$d]['s'] = '00';
             $params[$d] = CRM_Utils_Date::format($formValues[$d]);
         }
     }
     $ids['contribution'] = $params['id'] = $this->_id;
     $contribution =& CRM_Contribute_BAO_Contribution::create($params, $ids);
     // do the updates/inserts
     CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $formValues);
     //process premium
     if ($formValues['product_name'][0]) {
         require_once 'CRM/Contribute/DAO/ContributionProduct.php';
         $dao =& new CRM_Contribute_DAO_ContributionProduct();
         $dao->contribution_id = $contribution->id;
         $dao->product_id = $formValues['product_name'][0];
         $dao->fulfilled_date = CRM_Utils_Date::format($formValues['fulfilled_date']);
         $dao->product_option = $this->_options[$formValues['product_name'][0]][$formValues['product_name'][1]];
         if ($this->_premiumId) {
             $premoumDAO =& new CRM_Contribute_DAO_ContributionProduct();
             $premoumDAO->id = $this->_premiumId;
             $premoumDAO->find(true);
             if ($premoumDAO->product_id == $formValues['product_name'][0]) {
                 $dao->id = $this->_premiumId;
                 $premium = $dao->save();
             } else {
                 $premoumDAO->delete();
                 $premium = $dao->save();
             }
         } else {
             $premium = $dao->save();
         }
     }
     CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Contribution', $contribution->id);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:64,代码来源:Contribution.php

示例7: deletePledge

 /**
  * Function to delete the pledge
  *
  * @param int $id  pledge id
  *
  * @access public
  * @static
  *
  */
 static function deletePledge($id)
 {
     CRM_Utils_Hook::pre('delete', 'Pledge', $id, CRM_Core_DAO::$_nullArray);
     //check for no Completed Payment records with the pledge
     require_once 'CRM/Pledge/DAO/Payment.php';
     $payment = new CRM_Pledge_DAO_Payment();
     $payment->pledge_id = $id;
     $payment->find();
     while ($payment->fetch()) {
         //also delete associated contribution.
         if ($payment->contribution_id) {
             require_once 'CRM/Contribute/BAO/Contribution.php';
             CRM_Contribute_BAO_Contribution::deleteContribution($payment->contribution_id);
         }
         $payment->delete();
     }
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $results = null;
     $dao = new CRM_Pledge_DAO_Pledge();
     $dao->id = $id;
     $results = $dao->delete();
     $transaction->commit();
     CRM_Utils_Hook::post('delete', 'Pledge', $dao->id, $dao);
     // delete the recently created Activity
     require_once 'CRM/Utils/Recent.php';
     CRM_Utils_Recent::del($id);
     return $results;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:38,代码来源:Pledge.php

示例8: postProcess


//.........这里部分代码省略.........
         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'])) {
             $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, TRUE, FALSE, $isTest, $lineItems);
             //create new soft-credit record, CRM-13981
             if ($softParams) {
                 $softParams['contribution_id'] = $contribution->id;
                 $softParams['currency'] = $contribution->currency;
                 $softParams['amount'] = $contribution->total_amount;
                 CRM_Contribute_BAO_ContributionSoft::add($softParams);
             }
             $paymentParams['contactID'] = $this->_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'];
         }
         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.
             if (!empty($paymentParams['contributionID'])) {
                 CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
             }
             if (!empty($paymentParams['contributionRecurID'])) {
                 CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
             }
             CRM_Core_Error::displaySessionError($result);
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=add&cid={$this->_contactID}&context=&mode={$this->_mode}"));
         }
         if ($result) {
             $this->_params = array_merge($this->_params, $result);
             //assign amount to template if payment was successful
             $this->assign('amount', $params['total_amount']);
         }
         // if the payment processor returns a contribution_status_id -> use it!
         if (isset($result['contribution_status_id'])) {
             $result['payment_status_id'] = $result['contribution_status_id'];
         }
         if (isset($result['payment_status_id'])) {
             // CRM-16737 $result['contribution_status_id'] is deprecated in favour
             // of payment_status_id as the payment processor only knows whether the payment is complete
             // not whether payment completes the contribution
             $params['contribution_status_id'] = $result['payment_status_id'];
         } else {
             $params['contribution_status_id'] = !empty($paymentParams['is_recur']) ? 2 : 1;
         }
         if ($params['contribution_status_id'] != array_search('Completed', $allContributionStatus)) {
             $params['status_id'] = array_search('Pending', $allMemberStatus);
             $params['skipStatusCal'] = TRUE;
             // unset send-receipt option, since receipt will be sent when ipn is received.
             unset($this->_params['send_receipt'], $formValues['send_receipt']);
             //as membership is pending set dates to null.
             $memberDates = array('join_date' => 'joinDate', 'start_date' => 'startDate', 'end_date' => 'endDate');
             foreach ($memberDates as $dp => $dv) {
开发者ID:indydas,项目名称:civi-demo,代码行数:67,代码来源:Membership.php

示例9: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Contribute_BAO_Contribution::deleteContribution($this->_id);
         CRM_Core_Session::singleton()->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactID}&selectedChild=contribute"));
         return;
     }
     // Get the submitted form values.
     $submittedValues = $this->controller->exportValues($this->_name);
     try {
         $contribution = $this->submit($submittedValues, $this->_action, $this->_ppID);
     } catch (PaymentProcessorException $e) {
         // Set the contribution mode.
         $urlParams = "action=add&cid={$this->_contactID}";
         if ($this->_mode) {
             $urlParams .= "&mode={$this->_mode}";
         }
         if (!empty($this->_ppID)) {
             $urlParams .= "&context=pledge&ppid={$this->_ppID}";
         }
         CRM_Core_Error::statusBounce($e->getMessage(), $urlParams, ts('Payment Processor Error'));
     }
     $session = CRM_Core_Session::singleton();
     $buttonName = $this->controller->getButtonName();
     if ($this->_context == 'standalone') {
         if ($buttonName == $this->getButtonName('upload', 'new')) {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/contribute/add', 'reset=1&action=add&context=standalone'));
         } else {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactID}&selectedChild=contribute"));
         }
     } elseif ($this->_context == 'contribution' && $this->_mode && $buttonName == $this->getButtonName('upload', 'new')) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&context={$this->_context}&cid={$this->_contactID}&mode={$this->_mode}"));
     } elseif ($buttonName == $this->getButtonName('upload', 'new')) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&context={$this->_context}&cid={$this->_contactID}"));
     }
     //store contribution ID if not yet set (on create)
     if (empty($this->_id) && !empty($contribution->id)) {
         $this->_id = $contribution->id;
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:43,代码来源:Contribution.php

示例10: postProcess

 /** 
  * Function to process the form 
  * 
  * @access public 
  * @return None 
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         require_once 'CRM/Contribute/BAO/Contribution.php';
         CRM_Contribute_BAO_Contribution::deleteContribution($this->_id);
         return;
     }
     // get the submitted form values.
     $submittedValues = $this->controller->exportValues($this->_name);
     // process price set and get total amount and line items.
     $lineItem = array();
     $priceSetId = null;
     if ($priceSetId = CRM_Utils_Array::value('price_set_id', $submittedValues)) {
         require_once 'CRM/Price/BAO/Set.php';
         CRM_Price_BAO_Set::processAmount($this->_priceSet['fields'], $submittedValues, $lineItem[$priceSetId]);
         $submittedValues['total_amount'] = $submittedValues['amount'];
     }
     if (!CRM_Utils_Array::value('total_amount', $submittedValues)) {
         $submittedValues['total_amount'] = $this->_values['total_amount'];
     }
     $this->assign('lineItem', !empty($lineItem) ? $lineItem : false);
     if (CRM_Utils_Array::value('soft_credit_to', $submittedValues)) {
         $submittedValues['soft_credit_to'] = $submittedValues['soft_contact_id'];
     }
     // set the contact, when contact is selected
     if (CRM_Utils_Array::value('contact_select_id', $submittedValues)) {
         $this->_contactID = CRM_Utils_Array::value('contact_select_id', $submittedValues);
     }
     $config =& CRM_Core_Config::singleton();
     $session =& CRM_Core_Session::singleton();
     //Credit Card Contribution.
     if ($this->_mode) {
         $unsetParams = array('trxn_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date', 'cancel_date', 'cancel_reason');
         foreach ($unsetParams as $key) {
             if (isset($submittedValues[$key])) {
                 unset($submittedValues[$key]);
             }
         }
         //Get the rquire fields value only.
         $params = $this->_params = $submittedValues;
         require_once 'CRM/Core/BAO/PaymentProcessor.php';
         $this->_paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($this->_params['payment_processor_id'], $this->_mode);
         require_once "CRM/Contact/BAO/Contact.php";
         $now = date('YmdHis');
         $fields = array();
         // we need to retrieve email address
         if ($this->_context == 'standalone' && CRM_Utils_Array::value('is_email_receipt', $submittedValues)) {
             require_once 'CRM/Contact/BAO/Contact/Location.php';
             list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
             $this->assign('displayName', $this->userDisplayName);
         }
         //set email for primary location.
         $fields["email-Primary"] = 1;
         $params["email-Primary"] = $this->userEmail;
         // now set the values for the billing location.
         foreach ($this->_fields as $name => $dontCare) {
             $fields[$name] = 1;
         }
         // also add location name to the array
         $params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $params) . ' ' . CRM_Utils_Array::value('billing_last_name', $params);
         $params["address_name-{$this->_bltID}"] = trim($params["address_name-{$this->_bltID}"]);
         $fields["address_name-{$this->_bltID}"] = 1;
         $ctype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type');
         $nameFields = array('first_name', 'middle_name', 'last_name');
         foreach ($nameFields as $name) {
             $fields[$name] = 1;
             if (array_key_exists("billing_{$name}", $params)) {
                 $params[$name] = $params["billing_{$name}"];
                 $params['preserveDBName'] = true;
             }
         }
         if (CRM_Utils_Array::value('source', $params)) {
             unset($params['source']);
         }
         $contactID = CRM_Contact_BAO_Contact::createProfileContact($params, $fields, $this->_contactID, null, null, $ctype);
         // add all the additioanl payment params we need
         $this->_params["state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
         $this->_params["country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
         if ($this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_CREDIT_CARD) {
             $this->_params['year'] = $this->_params['credit_card_exp_date']['Y'];
             $this->_params['month'] = $this->_params['credit_card_exp_date']['M'];
         }
         $this->_params['ip_address'] = CRM_Utils_System::ipAddress();
         $this->_params['amount'] = $this->_params['total_amount'];
         $this->_params['amount_level'] = 0;
         $this->_params['currencyID'] = $config->defaultCurrency;
         $this->_params['payment_action'] = 'Sale';
         if (CRM_Utils_Array::value('soft_credit_to', $params)) {
             $this->_params['soft_credit_to'] = $params['soft_credit_to'];
             $this->_params['pcp_made_through_id'] = $params['pcp_made_through_id'];
         }
         $this->_params['pcp_display_in_roll'] = $params['pcp_display_in_roll'];
         $this->_params['pcp_roll_nickname'] = $params['pcp_roll_nickname'];
         $this->_params['pcp_personal_note'] = $params['pcp_personal_note'];
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Contribution.php

示例11: civicrm_api3_contribution_delete

/**
 * Delete a Contribution.
 *
 * @param array $params
 *   Input parameters.
 *
 * @return array
 */
function civicrm_api3_contribution_delete($params)
{
    $contributionID = !empty($params['contribution_id']) ? $params['contribution_id'] : $params['id'];
    // First check contribution financial type
    $financialType = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionID, 'financial_type_id');
    // Now check permissioned lineitems & permissioned contribution
    if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('delete contributions of type ' . CRM_Contribute_PseudoConstant::financialType($financialType)) || !CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($contributionID, 'delete', FALSE)) {
        return civicrm_api3_create_error('You do not have permission to delete this contribution');
    }
    if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionID)) {
        return civicrm_api3_create_success(array($contributionID => 1));
    } else {
        return civicrm_api3_create_error('Could not delete contribution');
    }
}
开发者ID:scardinius,项目名称:civicrm-core,代码行数:23,代码来源:Contribution.php

示例12: processConfirm


//.........这里部分代码省略.........
                     $cachedParamValue = CRM_Utils_Array::value('is_recur', $paymentParams);
                     unset($form->_values['is_recur']);
                     unset($paymentParams['is_recur']);
                 } else {
                     $pending = TRUE;
                 }
             }
             $contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form, $paymentParams, NULL, $contactID, $contributionType, $pending, TRUE, $isTest, $lineItems);
             // restore cached values (part of fix for CRM-14354)
             if (!empty($cachedFormValue)) {
                 $form->_values['is_recur'] = $cachedFormValue;
                 $paymentParams['is_recur'] = $cachedParamValue;
             }
             $paymentParams['contributionID'] = $contribution->id;
             //CRM-15297 deprecate contributionTypeID
             $paymentParams['financialTypeID'] = $paymentParams['contributionTypeID'] = $contribution->financial_type_id;
             $paymentParams['contributionPageID'] = $contribution->contribution_page_id;
             if ($form->_values['is_recur'] && $contribution->contribution_recur_id) {
                 $paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
             }
         }
         if (is_object($payment)) {
             $result = $payment->doDirectPayment($paymentParams);
         } else {
             CRM_Core_Error::fatal($paymentObjError);
         }
     }
     if ($component == 'membership') {
         $membershipResult = array();
     }
     if (is_a($result, 'CRM_Core_Error')) {
         //make sure to cleanup db for recurring case.
         //@todo this clean up has always been controversial as many orgs prefer to see failed transactions.
         // most recent discussion has been that they should be retained and this could be altered
         if (!empty($paymentParams['contributionID'])) {
             CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
         }
         if (!empty($paymentParams['contributionRecurID'])) {
             CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
         }
         if ($component !== 'membership') {
             CRM_Core_Error::displaySessionError($result);
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=true&qfKey={$form->_params['qfKey']}"));
         }
         $membershipResult[1] = $result;
     } elseif ($result || $form->_amount == 0.0 && !$form->_params['is_pay_later']) {
         if ($result) {
             $form->_params = array_merge($form->_params, $result);
         }
         $form->set('params', $form->_params);
         $form->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $result));
         // result has all the stuff we need
         // lets archive it to a financial transaction
         //@todo - this is done in 2 places - can't we just do it once straight after retrieving contribution type -
         // when would this be a bad thing?
         if ($contributionType->is_deductible) {
             $form->assign('is_deductible', TRUE);
             $form->set('is_deductible', TRUE);
         }
         if (isset($paymentParams['contribution_source'])) {
             $form->_params['source'] = $paymentParams['contribution_source'];
         }
         // check if pending was set to true by payment processor
         $pending = FALSE;
         if (!empty($form->_params['contribution_status_pending'])) {
             $pending = TRUE;
         }
         if (!(!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct')) {
             $contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form, $form->_params, $result, $contactID, $contributionType, $pending, TRUE, $isTest, $lineItems);
         }
         $form->postProcessPremium($premiumParams, $contribution);
         if (is_array($result)) {
             if (!empty($result['trxn_id'])) {
                 $contribution->trxn_id = $result['trxn_id'];
             }
             if (!empty($result['payment_status_id'])) {
                 $contribution->payment_status_id = $result['payment_status_id'];
             }
         }
         $membershipResult[1] = $contribution;
     }
     if ($component == 'membership') {
         return $membershipResult;
     }
     //Do not send an email if Recurring contribution is done via Direct Mode
     //We will send email once the IPN is received.
     if (!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct') {
         return TRUE;
     }
     // get the price set values for receipt.
     if ($form->_priceSetId && $form->_lineItem) {
         $form->_values['lineItem'] = $form->_lineItem;
         $form->_values['priceSetID'] = $form->_priceSetId;
     }
     // finally send an email receipt
     if ($contribution) {
         $form->_values['contribution_id'] = $contribution->id;
         CRM_Contribute_BAO_ContributionPage::sendMail($contactID, $form->_values, $contribution->is_test, FALSE, $fieldTypes);
     }
 }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:101,代码来源:Utils.php

示例13: processCreditCard


//.........这里部分代码省略.........
     // if folks need to use it
     $paymentParams['contributionType_name'] = $this->_params['contributionType_name'] = $contributionType->name;
     $paymentParams['contributionPageID'] = NULL;
     if (!empty($this->_params['is_email_receipt'])) {
         $paymentParams['email'] = $this->userEmail;
         $paymentParams['is_email_receipt'] = 1;
     } else {
         $paymentParams['is_email_receipt'] = 0;
         $this->_params['is_email_receipt'] = 0;
     }
     if (!empty($this->_params['receive_date'])) {
         $paymentParams['receive_date'] = $this->_params['receive_date'];
     }
     // For recurring contribution, create Contribution Record first.
     // Contribution ID, Recurring ID and Contact ID needed
     // When we get a callback from the payment processor, CRM-7115
     if (!empty($paymentParams['is_recur'])) {
         $contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($this, $this->_params, NULL, $this->_contactID, $contributionType, TRUE, FALSE, $isTest, $this->_lineItem);
         $paymentParams['contributionID'] = $contribution->id;
         $paymentParams['contributionTypeID'] = $contribution->financial_type_id;
         $paymentParams['contributionPageID'] = $contribution->contribution_page_id;
         $paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
     }
     $result = NULL;
     if ($paymentParams['amount'] > 0.0) {
         // force a re-get of the payment processor in case the form changed it, CRM-7179
         $payment = CRM_Core_Payment::singleton($this->_mode, $this->_paymentProcessor, $this, TRUE);
         $result = $payment->doDirectPayment($paymentParams);
     }
     if (is_a($result, 'CRM_Core_Error')) {
         //make sure to cleanup db for recurring case.
         if (!empty($paymentParams['contributionID'])) {
             CRM_Core_Error::debug_log_message(CRM_Core_Error::getMessages($result) . "contact id={$this->_contactID} (deleting contribution {$paymentParams['contributionID']}");
             CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
         }
         if (!empty($paymentParams['contributionRecurID'])) {
             CRM_Core_Error::debug_log_message(CRM_Core_Error::getMessages($result) . "contact id={$this->_contactID} (deleting recurring contribution {$paymentParams['contributionRecurID']}");
             CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
         }
         //set the contribution mode.
         $urlParams = "action=add&cid={$this->_contactID}";
         if ($this->_mode) {
             $urlParams .= "&mode={$this->_mode}";
         }
         if (!empty($this->_ppID)) {
             $urlParams .= "&context=pledge&ppid={$this->_ppID}";
         }
         CRM_Core_Error::displaySessionError($result);
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/contribution', $urlParams));
     }
     if ($result) {
         $this->_params = array_merge($this->_params, $result);
     }
     $this->_params['receive_date'] = $now;
     if (!empty($this->_params['is_email_receipt'])) {
         $this->_params['receipt_date'] = $now;
     } else {
         $this->_params['receipt_date'] = CRM_Utils_Date::processDate($this->_params['receipt_date'], $params['receipt_date_time'], TRUE);
     }
     $this->set('params', $this->_params);
     $this->assign('trxn_id', $result['trxn_id']);
     $this->assign('receive_date', $this->_params['receive_date']);
     // result has all the stuff we need
     // lets archive it to a financial transaction
     if ($contributionType->is_deductible) {
         $this->assign('is_deductible', TRUE);
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:67,代码来源:Contribution.php

示例14: deletePayments

 /**
  * Function to delete all pledge payments
  *
  * @param int $id  pledge id
  *
  * @access public
  * @static
  *
  */
 static function deletePayments($id)
 {
     require_once 'CRM/Utils/Rule.php';
     if (!CRM_Utils_Rule::positiveInteger($id)) {
         return false;
     }
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $payment = new CRM_Pledge_DAO_Payment();
     $payment->pledge_id = $id;
     if ($payment->find(true)) {
         //also delete associated contribution.
         if ($payment->contribution_id) {
             require_once 'CRM/Contribute/BAO/Contribution.php';
             CRM_Contribute_BAO_Contribution::deleteContribution($payment->contribution_id);
         }
         $payment->delete();
     }
     $transaction->commit();
     return true;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:30,代码来源:Payment.php

示例15: processConfirm


//.........这里部分代码省略.........
     } elseif ($form->_contributeMode == 'express') {
         if ($form->_values['is_monetary'] && $form->_amount > 0.0) {
             // determine if express + recurring and direct accordingly
             if ($paymentParams['is_recur'] == 1) {
                 if (is_object($payment)) {
                     $result = $payment->createRecurringPayments($paymentParams);
                 } else {
                     CRM_Core_Error::fatal($paymentObjError);
                 }
             } else {
                 if (is_object($payment)) {
                     $result = $payment->doExpressCheckout($paymentParams);
                 } else {
                     CRM_Core_Error::fatal($paymentObjError);
                 }
             }
         }
     } elseif ($form->_values['is_monetary'] && $form->_amount > 0.0) {
         if (!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct') {
             // For recurring contribution, create Contribution Record first.
             // Contribution ID, Recurring ID and Contact ID needed
             // When we get a callback from the payment processor
             $paymentParams['contactID'] = $contactID;
             $contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form, $paymentParams, NULL, $contactID, $contributionType, TRUE, TRUE, TRUE);
             $paymentParams['contributionID'] = $contribution->id;
             $paymentParams['contributionTypeID'] = $contribution->financial_type_id;
             $paymentParams['contributionPageID'] = $contribution->contribution_page_id;
             if ($form->_values['is_recur'] && $contribution->contribution_recur_id) {
                 $paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
             }
         }
         if (is_object($payment)) {
             $result = $payment->doDirectPayment($paymentParams);
         } else {
             CRM_Core_Error::fatal($paymentObjError);
         }
     }
     if ($component == 'membership') {
         $membershipResult = array();
     }
     if (is_a($result, 'CRM_Core_Error')) {
         //make sure to cleanup db for recurring case.
         if (!empty($paymentParams['contributionID'])) {
             CRM_Contribute_BAO_Contribution::deleteContribution($paymentParams['contributionID']);
         }
         if (!empty($paymentParams['contributionRecurID'])) {
             CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
         }
         if ($component !== 'membership') {
             CRM_Core_Error::displaySessionError($result);
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=true&qfKey={$form->_params['qfKey']}"));
         }
         $membershipResult[1] = $result;
     } elseif ($result || $form->_amount == 0.0 && !$form->_params['is_pay_later']) {
         if ($result) {
             $form->_params = array_merge($form->_params, $result);
         }
         $form->_params['receive_date'] = $now;
         $form->set('params', $form->_params);
         $form->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $result));
         $form->assign('receive_date', CRM_Utils_Date::mysqlToIso($form->_params['receive_date']));
         // result has all the stuff we need
         // lets archive it to a financial transaction
         if ($contributionType->is_deductible) {
             $form->assign('is_deductible', TRUE);
             $form->set('is_deductible', TRUE);
         }
         if (isset($paymentParams['contribution_source'])) {
             $form->_params['source'] = $paymentParams['contribution_source'];
         }
         // check if pending was set to true by payment processor
         $pending = FALSE;
         if (!empty($form->_params['contribution_status_pending'])) {
             $pending = TRUE;
         }
         if (!(!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct')) {
             $contribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form, $form->_params, $result, $contactID, $contributionType, TRUE, $pending, TRUE);
         }
         $form->postProcessPremium($premiumParams, $contribution);
         $membershipResult[1] = $contribution;
     }
     if ($component == 'membership') {
         return $membershipResult;
     }
     //Do not send an email if Recurring contribution is done via Direct Mode
     //We will send email once the IPN is received.
     if (!empty($paymentParams['is_recur']) && $form->_contributeMode == 'direct') {
         return TRUE;
     }
     // get the price set values for receipt.
     if ($form->_priceSetId && $form->_lineItem) {
         $form->_values['lineItem'] = $form->_lineItem;
         $form->_values['priceSetID'] = $form->_priceSetId;
     }
     // finally send an email receipt
     if ($contribution) {
         $form->_values['contribution_id'] = $contribution->id;
         CRM_Contribute_BAO_ContributionPage::sendMail($contactID, $form->_values, $contribution->is_test, FALSE, $fieldTypes);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:101,代码来源:Utils.php


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