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


PHP CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate方法代码示例

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


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

示例1: buildQuickForm


//.........这里部分代码省略.........
                 unset($status[CRM_Utils_Array::key('Pending refund', $statusName)]);
             case 'Cancelled':
             case 'Chargeback':
             case 'Refunded':
                 unset($status[CRM_Utils_Array::key('In Progress', $statusName)]);
                 unset($status[CRM_Utils_Array::key('Pending', $statusName)]);
                 unset($status[CRM_Utils_Array::key('Failed', $statusName)]);
                 break;
             case 'Pending':
             case 'In Progress':
                 unset($status[CRM_Utils_Array::key('Refunded', $statusName)]);
                 unset($status[CRM_Utils_Array::key('Chargeback', $statusName)]);
                 break;
             case 'Failed':
                 foreach (array('Pending', 'Refunded', 'Chargeback', 'Completed', 'In Progress', 'Cancelled') as $suppress) {
                     unset($status[CRM_Utils_Array::key($suppress, $statusName)]);
                 }
                 break;
         }
     } else {
         unset($status[CRM_Utils_Array::key('Refunded', $statusName)]);
         unset($status[CRM_Utils_Array::key('Chargeback', $statusName)]);
     }
     $statusElement = $this->add('select', 'contribution_status_id', ts('Contribution Status'), $status, FALSE);
     $currencyFreeze = FALSE;
     if (!empty($this->_payNow) && $this->_action & CRM_Core_Action::UPDATE) {
         $statusElement->freeze();
         $currencyFreeze = TRUE;
         $attributes['total_amount']['readonly'] = TRUE;
     }
     // CRM-16189, add Revenue Recognition Date
     if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
         $revenueDate = $this->add('date', 'revenue_recognition_date', ts('Revenue Recognition Date'), CRM_Core_SelectValues::date(NULL, 'M Y', NULL, 5));
         if ($this->_id && !CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($this->_id)) {
             $revenueDate->freeze();
         }
     }
     // add various dates
     $this->addDateTime('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDateTime'));
     if ($this->_online) {
         $this->assign('hideCalender', TRUE);
     }
     $checkNumber = $this->add('text', 'check_number', ts('Check Number'), $attributes['check_number']);
     $this->addDateTime('receipt_date', ts('Receipt Date'), FALSE, array('formatType' => 'activityDateTime'));
     $this->addDateTime('cancel_date', ts('Cancelled / Refunded Date'), FALSE, array('formatType' => 'activityDateTime'));
     $this->add('textarea', 'cancel_reason', ts('Cancellation / Refund Reason'), $attributes['cancel_reason']);
     $this->add('text', 'refund_trxn_id', ts('Transaction ID for the refund payment'));
     $element = $this->add('select', 'payment_processor_id', ts('Payment Processor'), $this->_processors, NULL, $recurJs);
     if ($this->_online) {
         $element->freeze();
     }
     $totalAmount = NULL;
     if (empty($this->_lineItems)) {
         $buildPriceSet = FALSE;
         $priceSets = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviContribute');
         if (!empty($priceSets) && !$this->_ppID) {
             $buildPriceSet = TRUE;
         }
         // don't allow price set for contribution if it is related to participant, or if it is a pledge payment
         // and if we already have line items for that participant. CRM-5095
         if ($buildPriceSet && $this->_id) {
             $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id);
             $pledgePaymentId = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $this->_id, 'id', 'contribution_id');
             if ($pledgePaymentId) {
                 $buildPriceSet = FALSE;
             }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:67,代码来源:Contribution.php

示例2: testAllowUpdateRevenueRecognitionDate

 /**
  * Test allowUpdateRevenueRecognitionDate.
  */
 public function testAllowUpdateRevenueRecognitionDate()
 {
     $contactId = $this->individualCreate();
     $params = array('contact_id' => $contactId, 'receive_date' => '2010-01-20', 'total_amount' => 100, 'financial_type_id' => 4);
     $order = $this->callAPISuccess('order', 'create', $params);
     $allowUpdate = CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($order['id']);
     $this->assertTrue($allowUpdate);
     $event = $this->eventCreate();
     $params = array('contact_id' => $contactId, 'receive_date' => '2010-01-20', 'total_amount' => 300, 'financial_type_id' => $this->getFinancialTypeId('Event Fee'), 'contribution_status_id' => 'Completed');
     $priceFields = $this->createPriceSet('event', $event['id']);
     foreach ($priceFields['values'] as $key => $priceField) {
         $lineItems[$key] = array('price_field_id' => $priceField['price_field_id'], 'price_field_value_id' => $priceField['id'], 'label' => $priceField['label'], 'field_title' => $priceField['label'], 'qty' => 1, 'unit_price' => $priceField['amount'], 'line_total' => $priceField['amount'], 'financial_type_id' => $priceField['financial_type_id'], 'entity_table' => 'civicrm_participant');
     }
     $params['line_items'][] = array('line_item' => $lineItems, 'params' => array('contact_id' => $contactId, 'event_id' => $event['id'], 'status_id' => 1, 'role_id' => 1, 'register_date' => '2007-07-21 00:00:00', 'source' => 'Online Event Registration: API Testing'));
     $order = $this->callAPISuccess('order', 'create', $params);
     $allowUpdate = CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($order['id']);
     $this->assertFalse($allowUpdate);
     $params = array('contact_id' => $contactId, 'receive_date' => '2010-01-20', 'total_amount' => 200, 'financial_type_id' => $this->getFinancialTypeId('Member Dues'), 'contribution_status_id' => 'Completed');
     $membershipType = $this->membershipTypeCreate();
     $priceFields = $this->createPriceSet();
     $lineItems = array();
     foreach ($priceFields['values'] as $key => $priceField) {
         $lineItems[$key] = array('price_field_id' => $priceField['price_field_id'], 'price_field_value_id' => $priceField['id'], 'label' => $priceField['label'], 'field_title' => $priceField['label'], 'qty' => 1, 'unit_price' => $priceField['amount'], 'line_total' => $priceField['amount'], 'financial_type_id' => $priceField['financial_type_id'], 'entity_table' => 'civicrm_membership', 'membership_type_id' => $membershipType);
     }
     $params['line_items'][] = array('line_item' => array(array_pop($lineItems)), 'params' => array('contact_id' => $contactId, 'membership_type_id' => $membershipType, 'join_date' => '2006-01-21', 'start_date' => '2006-01-21', 'end_date' => '2006-12-21', 'source' => 'Payment', 'is_override' => 1, 'status_id' => 1));
     $order = $this->callAPISuccess('order', 'create', $params);
     $allowUpdate = CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($order['id']);
     $this->assertFalse($allowUpdate);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:32,代码来源:ContributionTest.php


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