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


PHP CRM_Pledge_BAO_PledgePayment::retrieve方法代码示例

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


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

示例1: setDefaultValues

 /**
  * Set default values for the form.
  * the default values are retrieved from the database
  *
  *
  * @return void
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if ($this->_id) {
         $params['id'] = $this->_id;
         CRM_Pledge_BAO_PledgePayment::retrieve($params, $defaults);
         list($defaults['scheduled_date']) = CRM_Utils_Date::setDateDefaults($defaults['scheduled_date']);
         if (isset($defaults['contribution_id'])) {
             $this->assign('pledgePayment', TRUE);
         }
         $status = CRM_Contribute_PseudoConstant::contributionStatus($defaults['status_id']);
         $this->assign('status', $status);
     }
     $defaults['option_type'] = 1;
     return $defaults;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:23,代码来源:Payment.php

示例2: preProcessPledge

 public function preProcessPledge()
 {
     //get the payment values associated with given pledge payment id OR check for payments due.
     $this->_pledgeValues = array();
     if ($this->_ppID) {
         $payParams = array('id' => $this->_ppID);
         CRM_Pledge_BAO_PledgePayment::retrieve($payParams, $this->_pledgeValues['pledgePayment']);
         $this->_pledgeID = CRM_Utils_Array::value('pledge_id', $this->_pledgeValues['pledgePayment']);
         $paymentStatusID = CRM_Utils_Array::value('status_id', $this->_pledgeValues['pledgePayment']);
         $this->_id = CRM_Utils_Array::value('contribution_id', $this->_pledgeValues['pledgePayment']);
         //get all status
         $allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
         if (!($paymentStatusID == array_search('Pending', $allStatus) || $paymentStatusID == array_search('Overdue', $allStatus))) {
             CRM_Core_Error::fatal(ts("Pledge payment status should be 'Pending' or  'Overdue'."));
         }
         //get the pledge values associated with given pledge payment.
         $ids = array();
         $pledgeParams = array('id' => $this->_pledgeID);
         CRM_Pledge_BAO_Pledge::getValues($pledgeParams, $this->_pledgeValues, $ids);
         $this->assign('ppID', $this->_ppID);
     } else {
         // Not making a pledge payment, so if adding a new contribution we should check if pledge payment(s) are due for this contact so we can alert the user. CRM-5206
         if (isset($this->_contactID)) {
             $contactPledges = CRM_Pledge_BAO_Pledge::getContactPledges($this->_contactID);
             if (!empty($contactPledges)) {
                 $payments = $paymentsDue = NULL;
                 $multipleDue = FALSE;
                 foreach ($contactPledges as $key => $pledgeId) {
                     $payments = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId);
                     if ($payments) {
                         if ($paymentsDue) {
                             $multipleDue = TRUE;
                             break;
                         } else {
                             $paymentsDue = $payments;
                         }
                     }
                 }
                 if ($multipleDue) {
                     // Show link to pledge tab since more than one pledge has a payment due
                     $pledgeTab = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=pledge");
                     CRM_Core_Session::setStatus(ts('This contact has pending or overdue pledge payments. <a href="%1">Click here to view their Pledges tab</a> and verify whether this contribution should be applied as a pledge payment.', array(1 => $pledgeTab)), ts('Notice'), 'alert');
                 } elseif ($paymentsDue) {
                     // Show user link to oldest Pending or Overdue pledge payment
                     $ppAmountDue = CRM_Utils_Money::format($payments['amount'], $payments['currency']);
                     $ppSchedDate = CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $payments['id'], 'scheduled_date'));
                     if ($this->_mode) {
                         $ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge&mode=live");
                     } else {
                         $ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge");
                     }
                     CRM_Core_Session::setStatus(ts('This contact has a pending or overdue pledge payment of %2 which is scheduled for %3. <a href="%1">Click here to enter a pledge payment</a>.', array(1 => $ppUrl, 2 => $ppAmountDue, 3 => $ppSchedDate)), ts('Notice'), 'alert');
                 }
             }
         }
     }
 }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:57,代码来源:AbstractEditPayment.php

示例3: testRetrieveKnownPledgeID

 /**
  *  Test that payment retrieve wrks based on known pledge id
  */
 function testRetrieveKnownPledgeID()
 {
     $payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment');
     $pledgeId = $payment->pledge_id;
     $params = array('pledge_id' => $pledgeId);
     $defaults = array();
     $paymentid = CRM_Pledge_BAO_PledgePayment::retrieve($params, $defaults);
     $this->assertEquals(count($paymentid), 1, "Pledge was retrieved");
     $result = CRM_Pledge_BAO_Pledge::deletePledge($pledgeId);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:13,代码来源:PaymentTest.php

示例4: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     //check permission for action.
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
     $this->assign('cdType', FALSE);
     if ($this->_cdType) {
         $this->assign('cdType', TRUE);
         return CRM_Custom_Form_CustomData::preProcess($this);
     }
     $this->_formType = CRM_Utils_Array::value('formType', $_GET);
     // get price set id.
     $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
     $this->set('priceSetId', $this->_priceSetId);
     $this->assign('priceSetId', $this->_priceSetId);
     //get the pledge payment id
     $this->_ppID = CRM_Utils_Request::retrieve('ppid', 'Positive', $this);
     //get the contact id
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     //get the action.
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->assign('action', $this->_action);
     //get the contribution id if update
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $this->_context);
     $this->_compId = CRM_Utils_Request::retrieve('compId', 'Positive', $this);
     //set the contribution mode.
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     $this->assign('contributionMode', $this->_mode);
     $this->_paymentProcessor = array('billing_mode' => 1);
     $this->assign('showCheckNumber', FALSE);
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     //ensure that processor has a valid config
     //only valid processors get display to user
     if ($this->_mode) {
         $validProcessors = array();
         $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )");
         foreach ($processors as $ppID => $label) {
             $paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
             // at this stage only Authorize.net has been tested to support future start dates so if it's enabled let the template know
             // to show receive date
             $processorsSupportingFutureStartDate = array('AuthNet');
             if (in_array($paymentProcessor['payment_processor_type'], $processorsSupportingFutureStartDate)) {
                 $this->assign('processorSupportsFutureStartDate', TRUE);
             }
             if ($paymentProcessor['payment_processor_type'] == 'PayPal' && !$paymentProcessor['user_name']) {
                 continue;
             } elseif ($paymentProcessor['payment_processor_type'] == 'Dummy' && $this->_mode == 'live') {
                 continue;
             } else {
                 $paymentObject = CRM_Core_Payment::singleton($this->_mode, $paymentProcessor, $this);
                 $error = $paymentObject->checkConfig();
                 if (empty($error)) {
                     $validProcessors[$ppID] = $label;
                 }
                 $paymentObject = NULL;
             }
         }
         if (empty($validProcessors)) {
             CRM_Core_Error::fatal(ts('You will need to configure the %1 settings for your Payment Processor before you can submit credit card transactions.', array(1 => $this->_mode)));
         } else {
             $this->_processors = $validProcessors;
         }
         //get the valid recurring processors.
         $recurring = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
         $this->_recurPaymentProcessors = array_intersect_assoc($this->_processors, $recurring);
     }
     $this->assign('recurringPaymentProcessorIds', empty($this->_recurPaymentProcessors) ? '' : implode(',', array_keys($this->_recurPaymentProcessors)));
     // this required to show billing block
     $this->assign_by_ref('paymentProcessor', $paymentProcessor);
     $this->assign('hidePayPalExpress', TRUE);
     if ($this->_contactID) {
         list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
         $this->assign('displayName', $this->userDisplayName);
     }
     // also check for billing information
     // get the billing location type
     $locationTypes = CRM_Core_PseudoConstant::locationType();
     $this->_bltID = array_search('Billing', $locationTypes);
     if (!$this->_bltID) {
         CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
     }
     $this->set('bltID', $this->_bltID);
     $this->assign('bltID', $this->_bltID);
     $this->_fields = array();
     // payment fields are depending on payment type
     if (CRM_Utils_Array::value('payment_type', $this->_processors) & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) {
         CRM_Core_Payment_Form::setDirectDebitFields($this);
     } else {
         CRM_Core_Payment_Form::setCreditCardFields($this);
     }
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Contribution.php


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