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


PHP CRM_Contribute_BAO_Contribution::checkContributeSettings方法代码示例

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


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

示例1: setDefaultValues

 /**
  * Set default values.
  *
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = $period = array();
     $period = Civi::settings()->get('closing_date');
     if (empty($period)) {
         $prior = CRM_Contribute_BAO_Contribution::checkContributeSettings('prior_financial_period');
     } else {
         $defaults['closing_date'] = $period;
         return $defaults;
     }
     if (!empty($prior)) {
         $period = array('M' => date('n', strtotime($prior)), 'd' => date('j', strtotime($prior)));
         if ($period['M'] == 1) {
             $period['M'] = 12;
         } else {
             $period['M']--;
         }
         $defaults['closing_date'] = $period;
     } else {
         $defaults['closing_date'] = array('M' => date('n', strtotime("-1 month")), 'd' => date('j'));
     }
     return $defaults;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:28,代码来源:CloseAccPeriod.php

示例2: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             foreach ($additionalIds as $value) {
                 CRM_Event_BAO_Participant::deleteParticipant($value);
             }
         }
         CRM_Event_BAO_Participant::deleteParticipant($this->_id);
         CRM_Core_Session::setStatus(ts('Selected participant was deleted successfully.'), ts('Record Deleted'), 'success');
         if (!empty($participantLinks)) {
             $status = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br/>' . $participantLinks;
             CRM_Core_Session::setStatus($status, ts('Group Payment Deleted'));
         }
         return;
     }
     // When adding a single contact, the formRule prevents you from adding duplicates
     // (See above in formRule()). When adding more than one contact, the duplicates are
     // removed automatically and the user receives one notification.
     if ($this->_action & CRM_Core_Action::ADD) {
         $event_id = $this->_eventId;
         if (empty($event_id) && !empty($params['event_id'])) {
             $event_id = $params['event_id'];
         }
         if (!$this->_single && !empty($event_id)) {
             $duplicateContacts = 0;
             while (list($k, $dupeCheckContactId) = each($this->_contactIds)) {
                 // Eliminate contacts that have already been assigned to this event.
                 $dupeCheck = new CRM_Event_BAO_Participant();
                 $dupeCheck->contact_id = $dupeCheckContactId;
                 $dupeCheck->event_id = $event_id;
                 $dupeCheck->find(TRUE);
                 if (!empty($dupeCheck->id)) {
                     $duplicateContacts++;
                     unset($this->_contactIds[$k]);
                 }
             }
             if ($duplicateContacts > 0) {
                 $msg = ts("%1 contacts have already been assigned to this event. They were not added a second time.", array(1 => $duplicateContacts));
                 CRM_Core_Session::setStatus($msg);
             }
             if (count($this->_contactIds) == 0) {
                 CRM_Core_Session::setStatus(ts("No participants were added."));
                 return;
             }
             // We have to re-key $this->_contactIds so each contact has the same
             // key as their corresponding record in the $participants array that
             // will be created below.
             $this->_contactIds = array_values($this->_contactIds);
         }
     }
     $participantStatus = CRM_Event_PseudoConstant::participantStatus();
     // set the contact, when contact is selected
     if (!empty($params['contact_id'])) {
         $this->_contactId = $params['contact_id'];
     }
     if ($this->_priceSetId && ($isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'))) {
         $this->_quickConfig = $isQuickConfig;
     }
     if ($this->_id) {
         $params['id'] = $this->_id;
     }
     $config = CRM_Core_Config::singleton();
     if ($this->_isPaidEvent) {
         $contributionParams = array();
         $lineItem = array();
         $additionalParticipantDetails = array();
         if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
             $eventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'start_date');
             if ($eventStartDate) {
                 $contributionParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate));
             }
         }
         if ($this->_id && $this->_action & CRM_Core_Action::UPDATE && $this->_paymentId) {
             $participantBAO = new CRM_Event_BAO_Participant();
             $participantBAO->id = $this->_id;
             $participantBAO->find(TRUE);
             $contributionParams['total_amount'] = $participantBAO->fee_amount;
             $params['discount_id'] = NULL;
             //re-enter the values for UPDATE mode
             $params['fee_level'] = $params['amount_level'] = $participantBAO->fee_level;
             $params['fee_amount'] = $participantBAO->fee_amount;
             if (isset($params['priceSetId'])) {
                 $lineItem[0] = CRM_Price_BAO_LineItem::getLineItems($this->_id);
             }
             //also add additional participant's fee level/priceset
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($this->_id)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
                 $hasLineItems = CRM_Utils_Array::value('priceSetId', $params, FALSE);
                 $additionalParticipantDetails = CRM_Event_BAO_Participant::getFeeDetails($additionalIds, $hasLineItems);
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:Participant.php

示例3: buildQuickForm


//.........这里部分代码省略.........
                 unset($status[CRM_Utils_Array::key('Failed', $statusName)]);
                 unset($status[CRM_Utils_Array::key('Partially paid', $statusName)]);
                 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) {
开发者ID:nielosz,项目名称:civicrm-core,代码行数:67,代码来源:Contribution.php

示例4: processContribution

 /**
  * Process the contribution.
  *
  * @param CRM_Core_Form $form
  * @param array $params
  * @param array $result
  * @param int $contactID
  * @param bool $pending
  * @param bool $isAdditionalAmount
  *
  * @return \CRM_Contribute_BAO_Contribution
  */
 public static function processContribution(&$form, $params, $result, $contactID, $pending = FALSE, $isAdditionalAmount = FALSE)
 {
     $transaction = new CRM_Core_Transaction();
     $now = date('YmdHis');
     $receiptDate = NULL;
     if (!empty($form->_values['event']['is_email_confirm'])) {
         $receiptDate = $now;
     }
     //CRM-4196
     if ($isAdditionalAmount) {
         $params['amount_level'] = $params['amount_level'] . ts(' (multiple participants)') . CRM_Core_DAO::VALUE_SEPARATOR;
     }
     $contribParams = array('contact_id' => $contactID, 'financial_type_id' => !empty($form->_values['event']['financial_type_id']) ? $form->_values['event']['financial_type_id'] : $params['financial_type_id'], 'receive_date' => $now, 'total_amount' => $params['amount'], 'tax_amount' => $params['tax_amount'], 'amount_level' => $params['amount_level'], 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], 'source' => !empty($params['participant_source']) ? $params['participant_source'] : $params['description'], 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params));
     if (empty($params['is_pay_later'])) {
         $contribParams['payment_instrument_id'] = 1;
     }
     if (!$pending && $result) {
         $contribParams += array('fee_amount' => CRM_Utils_Array::value('fee_amount', $result), 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $params['amount']), 'trxn_id' => $result['trxn_id'], 'receipt_date' => $receiptDate);
     }
     $allStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     $contribParams['contribution_status_id'] = array_search('Completed', $allStatuses);
     if ($pending) {
         $contribParams['contribution_status_id'] = array_search('Pending', $allStatuses);
     }
     $contribParams['is_test'] = 0;
     if ($form->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') {
         $contribParams['is_test'] = 1;
     }
     $contribID = NULL;
     if (!empty($contribParams['invoice_id'])) {
         $contribID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contribParams['invoice_id'], 'id', 'invoice_id');
     }
     $ids = array();
     if ($contribID) {
         $ids['contribution'] = $contribID;
         $contribParams['id'] = $contribID;
     }
     if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
         $eventStartDate = CRM_Utils_Array::value('start_date', CRM_Utils_Array::value('event', $form->_values));
         if ($eventStartDate) {
             $contribParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate));
         }
     }
     //create an contribution address
     // The concept of contributeMode is deprecated. Elsewhere we use the function processBillingAddress() - although
     // currently that is only inherited by back-office forms.
     if ($form->_contributeMode != 'notify' && empty($params['is_pay_later'])) {
         $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID);
     }
     $contribParams['payment_processor'] = CRM_Utils_Array::value('payment_processor', $params);
     $contribParams['skipLineItem'] = 1;
     // create contribution record
     $contribution = CRM_Contribute_BAO_Contribution::add($contribParams, $ids);
     // CRM-11124
     CRM_Event_BAO_Participant::createDiscountTrxn($form->_eventId, $contribParams, NULL, CRM_Price_BAO_PriceSet::parseFirstPriceSetValueIDFromParams($params));
     // process soft credit / pcp pages
     if (!empty($params['pcp_made_through_id'])) {
         CRM_Contribute_BAO_ContributionSoft::formatSoftCreditParams($params, $form);
         CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution);
     }
     $transaction->commit();
     return $contribution;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:75,代码来源:Confirm.php

示例5: setDefaultValues

 /**
  * Set default values for the form.
  *
  * default values are retrieved from the database
  */
 public function setDefaultValues()
 {
     $defaults = Civi::settings()->get('contribution_invoice_settings');
     //CRM-16691: Changes made related to settings of 'CVV'.
     foreach (array('cvv_backoffice_required') as $setting) {
         $settingMetaData = civicrm_api3('setting', 'getfields', array('name' => $setting));
         $defaults[$setting] = civicrm_api3('setting', 'getvalue', array('name' => $setting, 'group' => CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'default_value' => CRM_Utils_Array::value('default', $settingMetaData['values'][$setting])));
     }
     $defaults['fiscalYearStart'] = Civi::settings()->get('fiscalYearStart');
     $period = CRM_Contribute_BAO_Contribution::checkContributeSettings('prior_financial_period');
     $this->assign('priorFinancialPeriod', $period);
     return $defaults;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:18,代码来源:Contribute.php

示例6: validateFinancialType

 /**
  * Check if financial type has Deferred Revenue Account is relationship
  * with Financial Account.
  *
  * @param int $financialTypeId
  *   Financial Type Id.
  *
  * @param int $entityID
  *   Holds id for PriceSet/PriceField/PriceFieldValue.
  *
  * @param string $entity
  *   Entity like PriceSet/PriceField/PriceFieldValue.
  *
  * @return bool
  *
  */
 public static function validateFinancialType($financialTypeId, $entityID = NULL, $entity = NULL)
 {
     if (!CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
         return FALSE;
     }
     if ($entityID) {
         $query = ' SELECT ps.extends FROM civicrm_price_set ps';
         $params = array(1 => array('ps', 'Text'), 2 => array($entityID, 'Integer'));
         if ($entity == 'PriceField') {
             $params[1] = array('pf', 'Text');
             $query .= ' INNER JOIN civicrm_price_field pf ON pf.price_set_id = ps.id ';
         }
         $query .= ' WHERE %1.id = %2';
         $extends = CRM_Core_DAO::singleValueQuery($query, $params);
         $extends = explode('', $extends);
         if (!(in_array(CRM_Core_Component::getComponentID('CiviEvent'), $extends) || in_array(CRM_Core_Component::getComponentID('CiviMember'), $extends))) {
             return FALSE;
         }
     }
     $deferredFinancialType = self::getDeferredFinancialType();
     if (!array_key_exists($financialTypeId, $deferredFinancialType)) {
         throw new CRM_Core_Exception(ts('Deferred revenue account is not configured for selected financial type. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts'));
     }
     return FALSE;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:41,代码来源:FinancialAccount.php

示例7: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Financial Account'));
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $attributes = CRM_Core_DAO::getAttribute('CRM_Financial_DAO_FinancialAccount');
     $this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
     $this->addRule('name', ts('A financial type with this name already exists. Please select another name.'), 'objectExists', array('CRM_Financial_DAO_FinancialAccount', $this->_id));
     $this->add('text', 'description', ts('Description'), $attributes['description']);
     $this->add('text', 'accounting_code', ts('Accounting Code'), $attributes['accounting_code']);
     $elementAccounting = $this->add('text', 'account_type_code', ts('Account Type Code'), $attributes['account_type_code']);
     $this->addEntityRef('contact_id', ts('Owner'), array('api' => array('params' => array('contact_type' => 'Organization')), 'create' => TRUE));
     $this->add('text', 'tax_rate', ts('Tax Rate'), $attributes['tax_rate']);
     $this->add('checkbox', 'is_deductible', ts('Tax-Deductible?'));
     $elementActive = $this->add('checkbox', 'is_active', ts('Enabled?'));
     $this->add('checkbox', 'is_tax', ts('Is Tax?'));
     $element = $this->add('checkbox', 'is_default', ts('Default?'));
     // CRM-12470 freeze is default if is_default is set
     if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $this->_id, 'is_default')) {
         $element->freeze();
     }
     //CRM-16189
     if (CRM_Contribute_BAO_Contribution::checkContributeSettings('financial_account_bal_enable')) {
         $this->add('text', 'opening_balance', ts('Opening Balance'), $attributes['opening_balance']);
         $this->add('text', 'current_period_opening_balance', ts('Current Period Opening Balance'), $attributes['current_period_opening_balance']);
         $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id', array('labelColumn' => 'name'));
         $limitedAccount = array(array_search('Asset', $financialAccountType), array_search('Liability', $financialAccountType));
         $this->assign('limitedAccount', json_encode($limitedAccount));
     }
     $financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id');
     if (!empty($financialAccountType)) {
         $element = $this->add('select', 'financial_account_type_id', ts('Financial Account Type'), array('' => '- select -') + $financialAccountType, TRUE, array('class' => 'crm-select2 huge'));
         if ($this->_isARFlag) {
             $element->freeze();
             $elementAccounting->freeze();
             $elementActive->freeze();
         } elseif ($this->_id && CRM_Financial_BAO_FinancialAccount::validateFinancialAccount($this->_id)) {
             $element->freeze();
         }
     }
     if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', $this->_id, 'is_reserved')) {
         $this->freeze(array('name', 'description', 'is_active'));
     }
     $this->addFormRule(array('CRM_Financial_Form_FinancialAccount', 'formRule'), $this);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:51,代码来源:FinancialAccount.php

示例8: testStandaloneContributeAdd

 public function testStandaloneContributeAdd()
 {
     $this->webtestLogin();
     // Create a contact to be used as soft creditor
     $softCreditFname = substr(sha1(rand()), 0, 7);
     $softCreditLname = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($softCreditFname, $softCreditLname, FALSE);
     //financial account for check
     $this->openCiviPage("admin/options/payment_instrument", "reset=1");
     $financialAccount = $this->getText("xpath=//div[@id='payment_instrument']/table/tbody//tr/td[1]/div[text()='Check']/../../td[3]");
     // Add new Financial Account
     $orgName = 'Alberta ' . substr(sha1(rand()), 0, 7);
     $financialAccountTitle = 'Financial Account ' . substr(sha1(rand()), 0, 4);
     $financialAccountDescription = "{$financialAccountTitle} Description";
     $accountingCode = 1033;
     $financialAccountType = 'Asset';
     $taxDeductible = FALSE;
     $isActive = FALSE;
     $isTax = TRUE;
     $taxRate = 9;
     $isDefault = FALSE;
     //Add new organisation
     if ($orgName) {
         $this->webtestAddOrganization($orgName);
     }
     $this->_testAddFinancialAccount($financialAccountTitle, $financialAccountDescription, $accountingCode, $orgName, $financialAccountType, $taxDeductible, $isActive, $isTax, $taxRate, $isDefault);
     $firstName = 'John' . substr(sha1(rand()), 0, 7);
     $lastName = 'Dsouza' . substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName, $lastName);
     $this->waitForElementPresent("css=li#tab_contribute a");
     $this->click("css=li#tab_contribute a");
     $this->waitForElementPresent("link=Record Contribution (Check, Cash, EFT ...)");
     $this->clickLink("link=Record Contribution (Check, Cash, EFT ...)", "_qf_Contribution_cancel-bottom", FALSE);
     // select financial type
     $this->select("financial_type_id", "value=1");
     // fill in Received Date
     $this->webtestFillDate('receive_date');
     // source
     $this->type("source", "Mailer 1");
     // total amount
     $this->type("total_amount", "100");
     // revenue recognition date (CRM-16189)
     if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
         $this->webtestFillDate('revenue_recognition_date', 'now+4');
     }
     // select payment instrument type = Check and enter chk number
     $this->select("payment_instrument_id", "value=4");
     $this->waitForElementPresent("check_number");
     $this->type("check_number", "check #1041");
     $this->type("trxn_id", "P20901X1" . rand(100, 10000));
     // create first soft credit
     $this->click("softCredit");
     $this->waitForElementPresent("soft_credit_amount_1");
     $this->webtestFillAutocomplete("{$softCreditLname}, {$softCreditFname}", 's2id_soft_credit_contact_id_1');
     $this->type("soft_credit_amount_1", "50");
     // add second soft credit field
     $this->click("addMoreSoftCredit");
     $this->waitForElementPresent("soft_credit_amount_2");
     // create new individual via soft credit
     $softCreditSecondFname = substr(sha1(rand()), 0, 7);
     $softCreditSecondLname = substr(sha1(rand()), 0, 7);
     $this->webtestNewDialogContact($softCreditSecondFname, $softCreditSecondLname, NULL, 4, 's2id_soft_credit_contact_id_2', 'soft_credit_1');
     // enter the second soft credit
     $this->verifyText("soft_credit_amount_2", "");
     // it should be blank cause first soft credit != total_amount
     $this->type("soft_credit_amount_2", "100");
     //the sum of the soft credit amounts can exceed total_amount
     $this->select("soft_credit_type[2]", "In Honor of");
     //Custom Data
     // $this->click('CIVICRM_QFID_3_6');
     //Additional Detail section
     $this->click("AdditionalDetail");
     $this->waitForElementPresent("thankyou_date");
     $this->type("note", "This is a test note.");
     $this->type("non_deductible_amount", "10.00");
     $this->type("fee_amount", "0");
     $this->type("net_amount", "0");
     $this->type("invoice_id", time());
     $this->webtestFillDate('thankyou_date');
     //Premium section
     $this->click("Premium");
     $this->waitForElementPresent("fulfilled_date");
     $this->select("product_name[0]", "label=Coffee Mug ( MUG-101 )");
     $this->select("product_name[1]", "label=Black");
     $this->webtestFillDate('fulfilled_date');
     // Clicking save.
     $this->click("_qf_Contribution_upload");
     // Is status message correct?
     //$this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!");
     // verify if Contribution is created
     $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
     //click through to the Contribution view screen
     $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
     $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
     $expected = array('Financial Type' => 'Donation', 'Total Amount' => '100.00', 'Contribution Status' => 'Completed', 'Payment Method' => 'Check', 'Check Number' => 'check #1041', 'Non-deductible Amount' => '10.00', 'Received Into' => $financialAccount);
     $this->waitForElementPresent("xpath=//*[@id='ContributionView']/div[2]");
     foreach ($expected as $value) {
         $this->assertElementContainsText("xpath=//*[@id='ContributionView']/div[2]", $value);
     }
     // verify if soft credit was created successfully
//.........这里部分代码省略.........
开发者ID:nielosz,项目名称:civicrm-core,代码行数:101,代码来源:OfflineContributionTest.php

示例9: testCheckContributeSettings

 /**
  * Test checkContributeSettings.
  */
 public function testCheckContributeSettings()
 {
     $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
     $this->assertNull($settings);
     $params = array('contribution_invoice_settings' => array('deferred_revenue_enabled' => '1'));
     $this->callAPISuccess('Setting', 'create', $params);
     $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
     $this->assertEquals($settings, 1, 'Check for settings has failed');
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:12,代码来源:ContributionTest.php


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