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


PHP CRM_Contribute_BAO_ContributionSoft::add方法代码示例

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


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

示例1: postProcess


//.........这里部分代码省略.........
     }
     // process line items, until no previous line items.
     if (!empty($lineItem)) {
         $params['lineItems'] = $lineItem;
         $params['processPriceSet'] = TRUE;
     }
     $createdMemberships = array();
     if ($this->_mode) {
         if (empty($formValues['total_amount']) && !$priceSetId) {
             // if total amount not provided minimum for membership type is used
             $params['total_amount'] = $formValues['total_amount'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $formValues['membership_type_id'][1], 'minimum_fee');
         } else {
             $params['total_amount'] = CRM_Utils_Array::value('total_amount', $formValues, 0);
         }
         if ($priceSetId && !$isQuickConfig) {
             $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'financial_type_id');
         } else {
             $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $formValues);
         }
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($formValues['payment_processor_id'], $this->_mode);
         //get the payment processor id as per mode.
         $params['payment_processor_id'] = $this->_params['payment_processor_id'] = $formValues['payment_processor_id'] = $this->_paymentProcessor['id'];
         $now = date('YmdHis');
         $fields = array();
         // set email for primary location.
         $fields['email-Primary'] = 1;
         $formValues['email-5'] = $formValues['email-Primary'] = $this->_memberEmail;
         $params['register_date'] = $now;
         // now set the values for the billing location.
         foreach ($this->_fields as $name => $dontCare) {
             $fields[$name] = 1;
         }
         // also add location name to the array
         $formValues["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $formValues) . ' ' . CRM_Utils_Array::value('billing_middle_name', $formValues) . ' ' . CRM_Utils_Array::value('billing_last_name', $formValues);
         $formValues["address_name-{$this->_bltID}"] = trim($formValues["address_name-{$this->_bltID}"]);
         $fields["address_name-{$this->_bltID}"] = 1;
         //ensure we don't over-write the payer's email with the member's email
         if ($this->_contributorContactID == $this->_contactID) {
             $fields["email-{$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}", $formValues)) {
                 $formValues[$name] = $formValues["billing_{$name}"];
                 $formValues['preserveDBName'] = TRUE;
             }
         }
         if ($this->_contributorContactID == $this->_contactID) {
             //see CRM-12869 for discussion of why we don't do this for separate payee payments
             CRM_Contact_BAO_Contact::createProfileContact($formValues, $fields, $this->_contributorContactID, NULL, NULL, $ctype);
         }
         // add all the additional payment params we need
         $this->_params["state_province-{$this->_bltID}"] = $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
         $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['description'] = ts('Office Credit Card Membership Signup Contribution');
         $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
开发者ID:indydas,项目名称:civi-demo,代码行数:67,代码来源:Membership.php

示例2: recordMembershipContribution

 /**
  * Record contribution record associated with membership.
  *
  * @param array $params
  *   Array of submitted params.
  * @param array $ids
  *   (param in process of being removed - try to use params) array of ids.
  *
  * @return CRM_Contribute_BAO_Contribution
  */
 public static function recordMembershipContribution(&$params, $ids = array())
 {
     $membershipId = $params['membership_id'];
     $contributionParams = array();
     $config = CRM_Core_Config::singleton();
     $contributionParams['currency'] = $config->defaultCurrency;
     $contributionParams['receipt_date'] = CRM_Utils_Array::value('receipt_date', $params) ? $params['receipt_date'] : 'null';
     $contributionParams['source'] = CRM_Utils_Array::value('contribution_source', $params);
     $contributionParams['non_deductible_amount'] = 'null';
     $contributionParams['payment_processor'] = CRM_Utils_Array::value('payment_processor_id', $params);
     $contributionSoftParams = CRM_Utils_Array::value('soft_credit', $params);
     $recordContribution = array('contact_id', 'fee_amount', 'total_amount', 'receive_date', 'financial_type_id', 'payment_instrument_id', 'trxn_id', 'invoice_id', 'is_test', 'contribution_status_id', 'check_number', 'campaign_id', 'is_pay_later', 'membership_id', 'tax_amount', 'skipLineItem', 'contribution_recur_id');
     foreach ($recordContribution as $f) {
         $contributionParams[$f] = CRM_Utils_Array::value($f, $params);
     }
     // make entry in batch entity batch table
     if (!empty($params['batch_id'])) {
         $contributionParams['batch_id'] = $params['batch_id'];
     }
     if (!empty($params['contribution_contact_id'])) {
         // deal with possibility of a different person paying for contribution
         $contributionParams['contact_id'] = $params['contribution_contact_id'];
     }
     if (!empty($params['processPriceSet']) && !empty($params['lineItems'])) {
         $contributionParams['line_item'] = CRM_Utils_Array::value('lineItems', $params, NULL);
     }
     $contribution = CRM_Contribute_BAO_Contribution::create($contributionParams, $ids);
     //CRM-13981, create new soft-credit record as to record payment from different person for this membership
     if (!empty($contributionSoftParams)) {
         if (!empty($params['batch_id'])) {
             foreach ($contributionSoftParams as $contributionSoft) {
                 $contributionSoft['contribution_id'] = $contribution->id;
                 $contributionSoft['currency'] = $contribution->currency;
                 CRM_Contribute_BAO_ContributionSoft::add($contributionSoft);
             }
         } else {
             $contributionSoftParams['contribution_id'] = $contribution->id;
             $contributionSoftParams['currency'] = $contribution->currency;
             $contributionSoftParams['amount'] = $contribution->total_amount;
             CRM_Contribute_BAO_ContributionSoft::add($contributionSoftParams);
         }
     }
     // store contribution id
     $params['contribution_id'] = $contribution->id;
     //insert payment record for this membership
     if (empty($ids['contribution']) || !empty($params['is_recur'])) {
         CRM_Member_BAO_MembershipPayment::create(array('membership_id' => $membershipId, 'contribution_id' => $contribution->id));
     }
     return $contribution;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:60,代码来源:Membership.php

示例3: processPcpSoft

 /**
  * Function used to save pcp / soft credit entry
  * This is used by contribution and also event pcps
  *
  * @param array  $params         associated array
  * @param object $contribution   contribution object
  *
  * @static
  * @access public
  */
 static function processPcpSoft(&$params, &$contribution)
 {
     //add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
     if (!empty($params['soft_credit_to'])) {
         $contribSoftParams = array();
         foreach (array('pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note', 'amount') as $val) {
             if (!empty($params[$val])) {
                 $contribSoftParams[$val] = $params[$val];
             }
         }
         $contribSoftParams['contact_id'] = $params['soft_credit_to'];
         // add contribution id
         $contribSoftParams['contribution_id'] = $contribution->id;
         // add pcp id
         $contribSoftParams['pcp_id'] = $params['pcp_made_through_id'];
         $contribSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
         $softContribution = CRM_Contribute_BAO_ContributionSoft::add($contribSoftParams);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:29,代码来源:Confirm.php

示例4: create

 /**
  * Takes an associative array and creates a contribution object.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  * @param array $ids
  *   The array that holds all the db ids.
  *
  * @return CRM_Contribute_BAO_Contribution
  */
 public static function create(&$params, $ids = array())
 {
     $dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date');
     foreach ($dateFields as $df) {
         if (isset($params[$df])) {
             $params[$df] = CRM_Utils_Date::isoToMysql($params[$df]);
         }
     }
     $transaction = new CRM_Core_Transaction();
     $contribution = self::add($params, $ids);
     if (is_a($contribution, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $contribution;
     }
     $params['contribution_id'] = $contribution->id;
     if (!empty($params['custom']) && is_array($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contribution', $contribution->id);
     }
     $session = CRM_Core_Session::singleton();
     if (!empty($params['note'])) {
         $noteParams = array('entity_table' => 'civicrm_contribution', 'note' => $params['note'], 'entity_id' => $contribution->id, 'contact_id' => $session->get('userID'), 'modified_date' => date('Ymd'));
         if (!$noteParams['contact_id']) {
             $noteParams['contact_id'] = $params['contact_id'];
         }
         CRM_Core_BAO_Note::add($noteParams);
     }
     // make entry in batch entity batch table
     if (!empty($params['batch_id'])) {
         // in some update cases we need to get extra fields - ie an update that doesn't pass in all these params
         $titleFields = array('contact_id', 'total_amount', 'currency', 'financial_type_id');
         $retrieveRequired = 0;
         foreach ($titleFields as $titleField) {
             if (!isset($contribution->{$titleField})) {
                 $retrieveRequired = 1;
                 break;
             }
         }
         if ($retrieveRequired == 1) {
             $contribution->find(TRUE);
         }
     }
     // Handle soft credit and / or link to personal campaign page
     $softIDs = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id);
     $pcpId = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id, TRUE);
     if ($pcp = CRM_Utils_Array::value('pcp', $params)) {
         $softParams = array();
         $softParams['id'] = $pcpId ? $pcpId : NULL;
         $softParams['contribution_id'] = $contribution->id;
         $softParams['pcp_id'] = $pcp['pcp_made_through_id'];
         $softParams['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcp['pcp_made_through_id'], 'contact_id');
         $softParams['currency'] = $contribution->currency;
         $softParams['amount'] = $contribution->total_amount;
         $softParams['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcp);
         $softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
         $softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
         $softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
         $contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($softParams);
         //Send notification to owner for PCP
         if ($contributionSoft->pcp_id && empty($pcpId)) {
             CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
         }
     } elseif (array_key_exists('pcp', $params) && $pcpId) {
         $deleteParams = array('id' => $pcpId);
         CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
     }
     if (isset($params['soft_credit'])) {
         $softParams = $params['soft_credit'];
         foreach ($softParams as $softParam) {
             if (!empty($softIDs)) {
                 $key = key($softIDs);
                 $softParam['id'] = $softIDs[$key];
                 unset($softIDs[$key]);
             }
             $softParam['contribution_id'] = $contribution->id;
             $softParam['currency'] = $contribution->currency;
             //case during Contribution Import when we assign soft contribution amount as contribution's total_amount by default
             if (empty($softParam['amount'])) {
                 $softParam['amount'] = $contribution->total_amount;
             }
             CRM_Contribute_BAO_ContributionSoft::add($softParam);
         }
         if (!empty($softIDs)) {
             foreach ($softIDs as $softID) {
                 if (!in_array($softID, $params['soft_credit_ids'])) {
                     $deleteParams = array('id' => $softID);
                     CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:nganivet,项目名称:civicrm-core,代码行数:101,代码来源:Contribution.php

示例5: testcreateAndGetHonorContact

 /**
  * Create honor-contact method
  */
 public function testcreateAndGetHonorContact()
 {
     $firstName = 'John_' . substr(sha1(rand()), 0, 7);
     $lastName = 'Smith_' . substr(sha1(rand()), 0, 7);
     $email = "{$firstName}.{$lastName}@example.com";
     //Get profile id of name honoree_individual used to create profileContact
     $honoreeProfileId = NULL;
     $ufGroupDAO = new CRM_Core_DAO_UFGroup();
     $ufGroupDAO->name = 'honoree_individual';
     if ($ufGroupDAO->find(TRUE)) {
         $honoreeProfileId = $ufGroupDAO->id;
     }
     $params = array('prefix_id' => 3, 'first_name' => $firstName, 'last_name' => $lastName, 'email-1' => $email);
     $softParam = array('soft_credit_type_id' => 1);
     $honoreeContactId = CRM_Contact_BAO_Contact::createProfileContact($params, CRM_Core_DAO::$_nullArray, NULL, NULL, $honoreeProfileId);
     $this->assertDBCompareValue('CRM_Contact_DAO_Contact', $honoreeContactId, 'first_name', 'id', $firstName, 'Database check for created honor contact record.');
     //create contribution on behalf of honary.
     $contactId = Contact::createIndividual();
     $softParam['contact_id'] = $honoreeContactId;
     $ids = array('contribution' => NULL);
     $param = array('contact_id' => $contactId, 'currency' => 'USD', 'financial_type_id' => 4, 'contribution_status_id' => 1, 'receive_date' => date('Ymd'), 'total_amount' => 66);
     $contribution = CRM_Contribute_BAO_Contribution::create($param, $ids);
     $id = $contribution->id;
     $softParam['contribution_id'] = $id;
     $softParam['currency'] = $contribution->currency;
     $softParam['amount'] = $contribution->total_amount;
     //Create Soft Contribution for honoree contact
     CRM_Contribute_BAO_ContributionSoft::add($softParam);
     $this->assertDBCompareValue('CRM_Contribute_DAO_ContributionSoft', $id, 'contact_id', 'contribution_id', $honoreeContactId, 'Check DB for honor contact of the contribution');
     //get honorary information
     $getHonorContact = CRM_Contribute_BAO_Contribution::getHonorContacts($honoreeContactId);
     $this->assertEquals(array($id => array('honor_type' => 'In Honor of', 'honorId' => $id, 'display_name' => 'John Doe', 'type' => 'Event Fee', 'type_id' => '4', 'amount' => '$ 66.00', 'source' => NULL, 'receive_date' => date('Y-m-d 00:00:00'), 'contribution_status' => 'Completed')), $getHonorContact);
     $this->assertDBCompareValue('CRM_Contact_DAO_Contact', $honoreeContactId, 'first_name', 'id', $firstName, 'Database check for created honor contact record.');
     //get annual contribution information
     $annual = CRM_Contribute_BAO_Contribution::annual($contactId);
     $config = CRM_Core_Config::singleton();
     $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $config->defaultCurrency, 'symbol', 'name');
     $this->assertDBCompareValue('CRM_Contribute_DAO_Contribution', $id, 'total_amount', 'id', ltrim($annual[2], $currencySymbol), 'Check DB for total amount of the contribution');
     //Delete honor contact
     Contact::delete($honoreeContactId);
     //Delete Contribution record
     $this->contributionDelete($contribution->id);
     //Delete contributor contact
     Contact::delete($contactId);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:48,代码来源:ContributionTest.php

示例6: submit


//.........这里部分代码省略.........
         if (!empty($formValues['send_receipt'])) {
             $params['receipt_date'] = CRM_Utils_Array::value('receive_date', $formValues);
         }
         //insert financial type name in receipt.
         $formValues['contributionType_name'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $formValues['financial_type_id']);
     }
     // process line items, until no previous line items.
     if (!empty($lineItem)) {
         $params['lineItems'] = $lineItem;
         $params['processPriceSet'] = TRUE;
     }
     $createdMemberships = array();
     if ($this->_mode) {
         $params['total_amount'] = CRM_Utils_Array::value('total_amount', $formValues, 0);
         if (!$isQuickConfig) {
             $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'financial_type_id');
         } else {
             $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $formValues);
         }
         $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($formValues['payment_processor_id'], $this->_mode);
         //get the payment processor id as per mode.
         $params['payment_processor_id'] = $formValues['payment_processor_id'] = $this->_paymentProcessor['id'];
         $now = date('YmdHis');
         $fields = array();
         // set email for primary location.
         $fields['email-Primary'] = 1;
         $formValues['email-5'] = $formValues['email-Primary'] = $this->_memberEmail;
         $params['register_date'] = $now;
         // now set the values for the billing location.
         foreach ($this->_fields as $name => $dontCare) {
             $fields[$name] = 1;
         }
         // also add location name to the array
         $formValues["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $formValues) . ' ' . CRM_Utils_Array::value('billing_middle_name', $formValues) . ' ' . CRM_Utils_Array::value('billing_last_name', $formValues);
         $formValues["address_name-{$this->_bltID}"] = trim($formValues["address_name-{$this->_bltID}"]);
         $fields["address_name-{$this->_bltID}"] = 1;
         //ensure we don't over-write the payer's email with the member's email
         if ($this->_contributorContactID == $this->_contactID) {
             $fields["email-{$this->_bltID}"] = 1;
         }
         $nameFields = array('first_name', 'middle_name', 'last_name');
         foreach ($nameFields as $name) {
             $fields[$name] = 1;
             if (array_key_exists("billing_{$name}", $formValues)) {
                 $formValues[$name] = $formValues["billing_{$name}"];
                 $formValues['preserveDBName'] = TRUE;
             }
         }
         if ($this->_contributorContactID == $this->_contactID) {
             //see CRM-12869 for discussion of why we don't do this for separate payee payments
             CRM_Contact_BAO_Contact::createProfileContact($formValues, $fields, $this->_contributorContactID, NULL, NULL, CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type'));
         }
         // add all the additional payment params we need
         $formValues["state_province-{$this->_bltID}"] = $formValues["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($formValues["billing_state_province_id-{$this->_bltID}"]);
         $formValues["country-{$this->_bltID}"] = $formValues["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($formValues["billing_country_id-{$this->_bltID}"]);
         $formValues['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($formValues);
         $formValues['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($formValues);
         $formValues['ip_address'] = CRM_Utils_System::ipAddress();
         $formValues['amount'] = $params['total_amount'];
         $formValues['currencyID'] = $config->defaultCurrency;
         $formValues['description'] = ts("Contribution submitted by a staff person using member's credit card for signup");
         $formValues['invoiceID'] = md5(uniqid(rand(), TRUE));
         $formValues['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.
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:67,代码来源:Membership.php

示例7: processSoftContribution

 /**
  * Process the soft contribution and/or link to personal campaign page.
  *
  * @param array $params
  * @param object $contribution CRM_Contribute_DAO_Contribution
  *
  */
 public static function processSoftContribution($params, $contribution)
 {
     //retrieve existing soft-credit and pcp id(s) if any against $contribution
     $softIDs = self::getSoftCreditIds($contribution->id);
     $pcpId = self::getSoftCreditIds($contribution->id, TRUE);
     if ($pcp = CRM_Utils_Array::value('pcp', $params)) {
         $softParams = array();
         $softParams['id'] = $pcpId ? $pcpId : NULL;
         $softParams['contribution_id'] = $contribution->id;
         $softParams['pcp_id'] = $pcp['pcp_made_through_id'];
         $softParams['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcp['pcp_made_through_id'], 'contact_id');
         $softParams['currency'] = $contribution->currency;
         $softParams['amount'] = $contribution->total_amount;
         $softParams['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcp);
         $softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
         $softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
         $softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
         $contributionSoft = self::add($softParams);
         //Send notification to owner for PCP
         if ($contributionSoft->pcp_id && empty($pcpId)) {
             CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
         }
     } elseif (array_key_exists('pcp', $params) && $pcpId) {
         $deleteParams = array('id' => $pcpId);
         CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
     }
     if (isset($params['soft_credit'])) {
         $softParams = $params['soft_credit'];
         foreach ($softParams as $softParam) {
             if (!empty($softIDs)) {
                 $key = key($softIDs);
                 $softParam['id'] = $softIDs[$key];
                 unset($softIDs[$key]);
             }
             $softParam['contribution_id'] = $contribution->id;
             $softParam['currency'] = $contribution->currency;
             //case during Contribution Import when we assign soft contribution amount as contribution's total_amount by default
             if (empty($softParam['amount'])) {
                 $softParam['amount'] = $contribution->total_amount;
             }
             CRM_Contribute_BAO_ContributionSoft::add($softParam);
         }
         // delete any extra soft-credit while updating back-office contribution
         foreach ((array) $softIDs as $softID) {
             if (!in_array($softID, $params['soft_credit_ids'])) {
                 $deleteParams = array('id' => $softID);
                 CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
             }
         }
     }
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:58,代码来源:ContributionSoft.php

示例8: 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']);
         }
     }
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:34,代码来源:ProfileContact.php

示例9: processPcpSoft

 /**
  * Function used to save pcp / soft credit entry.
  *
  * This is used by contribution and also event pcps
  *
  * @param array $params
  * @param object $contribution
  *   Contribution object.
  */
 public static function processPcpSoft(&$params, &$contribution)
 {
     // Add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
     if (!empty($params['soft_credit_to'])) {
         $contributionSoftParams = array();
         foreach (array('pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note', 'amount') as $val) {
             if (!empty($params[$val])) {
                 $contributionSoftParams[$val] = $params[$val];
             }
         }
         $contributionSoftParams['contact_id'] = $params['soft_credit_to'];
         // add contribution id
         $contributionSoftParams['contribution_id'] = $contribution->id;
         // add pcp id
         $contributionSoftParams['pcp_id'] = $params['pcp_made_through_id'];
         $contributionSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
         $contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($contributionSoftParams);
         //Send notification to owner for PCP
         if ($contributionSoft->id && $contributionSoft->pcp_id) {
             CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
         }
     }
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:32,代码来源:Confirm.php


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