function get_Recurring_Record($contactID) { $cRecur = null; $aContributionRecur = CRM_Contribute_BAO_ContributionRecur::getRecurContributions($contactID); foreach ($aContributionRecur as $ContributionRecur) { $sql = " SELECT name FROM civicrm_payment_processor WHERE id = %1 "; $param = array(1 => array($ContributionRecur['payment_processor_id'], 'Integer')); $dao = CRM_Core_DAO::singleValueQuery($sql, $param); /*$acontribution = self::_get_ContributionId_By_ContributionRecurId( $ContributionRecur['id'] ); $cRecur[] = array( 'contribution_id' => $acontribution['id'], 'contribution_recur_id' => $ContributionRecur['id'], 'status' => $ContributionRecur['contribution_status'], 'amount' => $ContributionRecur['amount'], 'payment_processor' => $dao, );*/ $cRecur[$ContributionRecur['id']] = $dao . '/' . $ContributionRecur['contribution_status'] . '/' . $ContributionRecur['amount']; } $cRecur['new_recur'] = 'Create New Recurring'; return $cRecur; }
/** * This function is called when action is browse * * return null * @access public */ function browse() { CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js'); // add annual contribution $annual = array(); list($annual['count'], $annual['amount'], $annual['avg']) = CRM_Contribute_BAO_Contribution::annual($this->_contactId); $this->assign('annual', $annual); $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), $this->_action, FALSE, FALSE, TRUE); $controller->setEmbedded(TRUE); $controller->reset(); $controller->set('cid', $this->_contactId); $controller->set('crid', $this->_crid); $controller->set('context', 'Search'); $controller->set('limit', 50); $controller->process(); $controller->run(); // add recurring block $action = array_sum(array_keys($this->recurLinks())); $params = CRM_Contribute_BAO_ContributionRecur::getRecurContributions($this->_contactId); if (!empty($params)) { foreach ($params as $ids => $recur) { $action = array_sum(array_keys($this->recurLinks($ids))); // no action allowed if it's not active $params[$ids]['is_active'] = $recur['contribution_status_id'] != 3; if ($params[$ids]['is_active']) { $details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($params[$ids]['id'], 'recur'); $hideUpdate = $details->membership_id & $details->auto_renew; if ($hideUpdate) { $action -= CRM_Core_Action::UPDATE; } $params[$ids]['action'] = CRM_Core_Action::formLink(self::recurLinks($ids), $action, array('cid' => $this->_contactId, 'crid' => $ids, 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.selector.recurring', 'Contribution', $ids); } } // assign vars to templates $this->assign('action', $this->_action); $this->assign('recurRows', $params); $this->assign('recur', TRUE); } //enable/disable soft credit records for test contribution $isTest = 0; if (CRM_Utils_Request::retrieve('isTest', 'Positive', $this)) { $isTest = 1; } $this->assign('isTest', $isTest); $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, $isTest); if (!empty($softCreditList)) { $softCreditTotals = array(); list($softCreditTotals['amount'], $softCreditTotals['avg'], $softCreditTotals['currency']) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest); $this->assign('softCredit', TRUE); $this->assign('softCreditRows', $softCreditList); $this->assign('softCreditTotals', $softCreditTotals); } if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId); } }
/** * This function is called when action is browse * * return null * @access public */ function browse() { // add annual contribution $annual = array(); list($annual['count'], $annual['amount'], $annual['avg']) = CRM_Contribute_BAO_Contribution::annual($this->_contactId); $this->assign('annual', $annual); $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), $this->_action); $controller->setEmbedded(TRUE); $controller->reset(); $controller->set('cid', $this->_contactId); $controller->set('crid', $this->_crid); $controller->set('context', 'contribution'); $controller->process(); $controller->run(); // add recurring block $action = array_sum(array_keys($this->recurLinks())); $params = CRM_Contribute_BAO_ContributionRecur::getRecurContributions($this->_contactId); if (!empty($params)) { foreach ($params as $ids => $recur) { $action = array_sum(array_keys($this->recurLinks($ids))); // no action allowed if it's not active $params[$ids]['is_active'] = $recur['contribution_status_id'] != 3; if ($params[$ids]['is_active']) { $details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($params[$ids]['id'], 'recur'); $hideUpdate = $details->membership_id & $details->auto_renew; if ($hideUpdate) { $action -= CRM_Core_Action::UPDATE; } $params[$ids]['action'] = CRM_Core_Action::formLink(self::recurLinks($ids), $action, array('cid' => $this->_contactId, 'crid' => $ids, 'cxt' => 'contribution')); } } // assign vars to templates $this->assign('action', $this->_action); $this->assign('recurRows', $params); $this->assign('recur', TRUE); } //add honor block // form all action links $action = array_sum(array_keys($this->honorLinks())); $params = array(); $params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId); if (!empty($params)) { foreach ($params as $ids => $honorId) { $params[$ids]['action'] = CRM_Core_Action::formLink(self::honorLinks(), $action, array('cid' => $honorId['honorId'], 'id' => $ids, 'cxt' => 'contribution', 'contributionType' => $honorId['type_id'], 'honorId' => $this->_contactId)); } // assign vars to templates $this->assign('action', $this->_action); $this->assign('honorRows', $params); $this->assign('honor', TRUE); } //enable/disable soft credit records for test contribution $isTest = 0; if (CRM_Utils_Request::retrieve('isTest', 'Positive', $this)) { $isTest = 1; } $this->assign('isTest', $isTest); $softCreditList = CRM_Contribute_BAO_Contribution::getSoftContributionList($this->_contactId, $isTest); if (!empty($softCreditList)) { $softCreditTotals = array(); list($softCreditTotals['amount'], $softCreditTotals['avg'], $softCreditTotals['currency']) = CRM_Contribute_BAO_Contribution::getSoftContributionTotals($this->_contactId, $isTest); $this->assign('softCredit', TRUE); $this->assign('softCreditRows', $softCreditList); $this->assign('softCreditTotals', $softCreditTotals); } if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); } }
/** * called when action is browse. * */ public function browse() { // add annual contribution $annual = array(); list($annual['count'], $annual['amount'], $annual['avg']) = CRM_Contribute_BAO_Contribution::annual($this->_contactId); $this->assign('annual', $annual); $controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), $this->_action, FALSE, FALSE, TRUE); $controller->setEmbedded(TRUE); $controller->reset(); $controller->set('cid', $this->_contactId); $controller->set('crid', $this->_crid); $controller->set('context', 'contribution'); $controller->set('limit', 50); $controller->process(); $controller->run(); // add recurring block $action = array_sum(array_keys($this->recurLinks())); $params = CRM_Contribute_BAO_ContributionRecur::getRecurContributions($this->_contactId); // Get all backoffice payment processors $backOfficePaymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors(array('BackOffice')); if (!empty($params)) { foreach ($params as $ids => $recur) { $action = array_sum(array_keys($this->recurLinks($ids))); // no action allowed if it's not active $params[$ids]['is_active'] = $recur['contribution_status_id'] != 3; // Get payment processor name $paymentProcessorDetails = CRM_Financial_BAO_PaymentProcessor::getPayment($params[$ids]['payment_processor_id'], 'live'); $params[$ids]['payment_processor_name'] = $paymentProcessorDetails['name']; $details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($params[$ids]['id'], 'recur'); $hideUpdate = $details->membership_id & $details->auto_renew; if ($hideUpdate) { $action -= CRM_Core_Action::UPDATE; } $links = self::recurLinks($ids); // Disable Edit/Delete link if no back office support if (!array_key_exists($recur['payment_processor_id'], $backOfficePaymentProcessors)) { unset($links[2]); unset($links[8]); } // Remove cancel link for already cancelled recurring records if ($recur['contribution_status_id'] == 3) { unset($links[64]); } $params[$ids]['action'] = CRM_Core_Action::formLink($links, $action, array('cid' => $this->_contactId, 'crid' => $ids, 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.selector.recurring', 'Contribution', $ids); } // assign vars to templates $this->assign('action', $this->_action); $this->assign('recurRows', $params); $this->assign('recur', TRUE); } //enable/disable soft credit records for test contribution $isTest = 0; if (CRM_Utils_Request::retrieve('isTest', 'Positive', $this)) { $isTest = 1; } $this->assign('isTest', $isTest); $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, NULL, $isTest); if (!empty($softCreditList)) { $softCreditTotals = array(); list($softCreditTotals['amount'], $softCreditTotals['avg'], $softCreditTotals['currency']) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest); $this->assign('softCredit', TRUE); $this->assign('softCreditRows', $softCreditList); $this->assign('softCreditTotals', $softCreditTotals); } if ($this->_contactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('displayName', $displayName); $this->ajaxResponse['tabCount'] = CRM_Contribute_BAO_ContributionRecur::contributionRecurCount($this->_contactId); } }
/** * Build the form object. */ public function buildQuickForm() { // FIXME: This probably needs to be done in preprocess if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && $this->_action & CRM_Core_Action::UPDATE && CRM_Utils_Array::value('financial_type_id', $this->_values)) { $financialTypeID = CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']); CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($this->_id, 'edit'); if (!CRM_Core_Permission::check('edit contributions of type ' . $financialTypeID)) { CRM_Core_Error::fatal(ts('You do not have permission to access this page.')); } } $allPanes = array(); $recurJs = NULL; //tax rate from financialType $this->assign('taxRates', json_encode(CRM_Core_PseudoConstant::getTaxRates())); $this->assign('currencies', json_encode(CRM_Core_OptionGroup::values('currencies_enabled'))); // build price set form. $buildPriceSet = FALSE; $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $this->assign('invoicing', $invoicing); // display tax amount on edit contribution page if ($invoicing && $this->_action & CRM_Core_Action::UPDATE && isset($this->_values['tax_amount'])) { $this->assign('totalTaxAmount', $this->_values['tax_amount']); } if (empty($this->_lineItems) && ($this->_priceSetId || !empty($_POST['price_set_id']))) { $buildPriceSet = TRUE; $getOnlyPriceSetElements = TRUE; if (!$this->_priceSetId) { $this->_priceSetId = $_POST['price_set_id']; $getOnlyPriceSetElements = FALSE; } $this->set('priceSetId', $this->_priceSetId); CRM_Price_BAO_PriceSet::buildPriceSet($this); // get only price set form elements. if ($getOnlyPriceSetElements) { return; } } // use to build form during form rule. $this->assign('buildPriceSet', $buildPriceSet); $defaults = $this->_values; $additionalDetailFields = array('note', 'thankyou_date', 'invoice_id', 'non_deductible_amount', 'fee_amount', 'net_amount'); foreach ($additionalDetailFields as $key) { if (!empty($defaults[$key])) { $defaults['hidden_AdditionalDetail'] = 1; break; } } if ($this->_productDAO) { if ($this->_productDAO->product_id) { $defaults['hidden_Premium'] = 1; } } if ($this->_noteID && isset($this->_values['note'])) { $defaults['hidden_AdditionalDetail'] = 1; } $paneNames = array(ts('Additional Details') => 'AdditionalDetail'); //Add Premium pane only if Premium is exists. $dao = new CRM_Contribute_DAO_Product(); $dao->is_active = 1; if ($dao->find(TRUE)) { $paneNames[ts('Premium Information')] = 'Premium'; } if ($this->_mode) { if (CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE) == TRUE) { if (!empty($this->_recurPaymentProcessors)) { $buildRecurBlock = TRUE; if ($this->_ppID) { // ppID denotes a pledge payment. foreach ($this->_paymentProcessors as $processor) { if (!empty($processor['is_recur']) && !empty($processor['object']) && $processor['object']->supports('recurContributionsForPledges')) { $buildRecurBlock = TRUE; break; } $buildRecurBlock = FALSE; } } if ($buildRecurBlock) { CRM_Contribute_Form_Contribution_Main::buildRecur($this); $this->setDefaults(array('is_recur' => 0)); $this->assign('buildRecurBlock', TRUE); $recurJs = array('onChange' => "buildRecurBlock( this.value ); return false;"); } } } } foreach ($paneNames as $name => $type) { $allPanes[$name] = $this->generatePane($type, $defaults); } $qfKey = $this->controller->_key; $this->assign('qfKey', $qfKey); $this->assign('allPanes', $allPanes); $this->addFormRule(array('CRM_Contribute_Form_Contribution', 'formRule'), $this); if ($this->_formType) { $this->assign('formType', $this->_formType); return; } $this->applyFilter('__ALL__', 'trim'); if ($this->_action & CRM_Core_Action::DELETE) { $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')))); return; } //need to assign custom data type and subtype to the template $this->assign('customDataType', 'Contribution'); $this->assign('customDataSubType', $this->_contributionType); $this->assign('entityID', $this->_id); if ($this->_context == 'standalone') { $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE); } $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution'); // Check permissions for financial type first CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $this->_action); if (empty($financialTypes)) { CRM_Core_Error::statusBounce(ts('You do not have all the permissions needed for this page.')); } $financialType = $this->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + $financialTypes, TRUE, array('onChange' => "CRM.buildCustomData( 'Contribution', this.value );")); $paymentInstrument = FALSE; if (!$this->_mode) { $paymentInstrument = $this->add('select', 'payment_instrument_id', ts('Payment Method'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), TRUE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")); } $this->_paymentProcessors = $this->getValidProcessors(); $offlinePaymentProcessors = array(); foreach ($this->_paymentProcessors as $key => $value) { $offlinePaymentProcessors[$value['id']] = $value['name']; } if ($this->_context == 'standalone') { $this->assign('showRecurringField', 1); $this->assign('backOfficePaymentProcessors', json_encode($offlinePaymentProcessors)); $recurringContribution = $this->add('select', 'contribution_recur_id', ts('Recurring Contribution'), FALSE, NULL); } else { $recurContributions = array(); $existingRecurContributions = CRM_Contribute_BAO_ContributionRecur::getRecurContributions($this->_contactID); // Get all backoffice payment processors if (!empty($existingRecurContributions)) { foreach ($existingRecurContributions as $ids => $recur) { if (array_key_exists($recur['payment_processor_id'], $offlinePaymentProcessors)) { $recurContributions[$ids] = CRM_Utils_Money::format($recur['amount']) . ' / ' . $offlinePaymentProcessors[$recur['payment_processor_id']] . ' / ' . CRM_Contribute_PseudoConstant::contributionStatus($recur['contribution_status_id']) . ' / ' . CRM_Utils_Date::customFormat($recur['start_date']); } } } if (!empty($recurContributions)) { $this->assign('showRecurringField', 1); $recurringContribution = $this->add('select', 'contribution_recur_id', ts('Recurring Contribution'), array('' => ts('- select -')) + $recurContributions, FALSE, NULL); } } $trxnId = $this->add('text', 'trxn_id', ts('Transaction ID'), array('class' => 'twelve') + $attributes['trxn_id']); //add receipt for offline contribution $this->addElement('checkbox', 'is_email_receipt', ts('Send Receipt?')); $this->add('select', 'from_email_address', ts('Receipt From'), $this->_fromEmails); $status = CRM_Contribute_PseudoConstant::contributionStatus(); // suppressing contribution statuses that are NOT relevant to pledges (CRM-5169) $statusName = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); if ($this->_ppID) { foreach (array('Cancelled', 'Failed', 'In Progress') as $suppress) { unset($status[CRM_Utils_Array::key($suppress, $statusName)]); } } elseif (!$this->_ppID && $this->_id || !$this->_id) { $suppressFlag = FALSE; if ($this->_id) { $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); if (CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails)) { $suppressFlag = TRUE; } } if (!$suppressFlag) { foreach (array('Overdue', 'In Progress') as $suppress) { unset($status[CRM_Utils_Array::key($suppress, $statusName)]); } } else { unset($status[CRM_Utils_Array::key('Overdue', $statusName)]); } } // define the status IDs that show the cancellation info, see CRM-17589 $cancelInfo_show_ids = array(); foreach ($statusName as $status_id => $status_name) { if ($status_name == 'Cancelled' || $status_name == 'Refunded') { $cancelInfo_show_ids[] = "'{$status_id}'"; } } $this->assign('cancelInfo_show_ids', implode(',', $cancelInfo_show_ids)); if ($this->_id) { $contributionStatus = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->_id, 'contribution_status_id'); $name = CRM_Utils_Array::value($contributionStatus, $statusName); switch ($name) { case 'Completed': case 'Cancelled': 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)]); break; case 'Failed': foreach (array('Pending', 'Refunded', 'Completed', 'In Progress', 'Cancelled') as $suppress) { unset($status[CRM_Utils_Array::key($suppress, $statusName)]); } break; } } else { unset($status[CRM_Utils_Array::key('Refunded', $statusName)]); } $this->add('select', 'contribution_status_id', ts('Contribution Status'), $status, FALSE); // 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; } if ($participantID = CRM_Utils_Array::value('participant', $componentDetails)) { $participantLI = CRM_Price_BAO_LineItem::getLineItems($participantID); if (!CRM_Utils_System::isNull($participantLI)) { $buildPriceSet = FALSE; } } } $hasPriceSets = FALSE; if ($buildPriceSet) { $hasPriceSets = TRUE; // CRM-16451: set financial type of 'Price Set' in back office contribution // instead of selecting manually $financialTypeIds = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviContribute', 'financial_type_id'); $element = $this->add('select', 'price_set_id', ts('Choose price set'), array('' => ts('Choose price set')) + $priceSets, NULL, array('onchange' => "buildAmount( this.value, " . json_encode($financialTypeIds) . ");")); if ($this->_online && !($this->_action & CRM_Core_Action::UPDATE)) { $element->freeze(); } } $this->assign('hasPriceSets', $hasPriceSets); $currencyFreeze = FALSE; if (!($this->_action & CRM_Core_Action::UPDATE)) { if ($this->_online || $this->_ppID) { $attributes['total_amount'] = array_merge($attributes['total_amount'], array('READONLY' => TRUE, 'style' => "background-color:#EBECE4")); $optionTypes = array('1' => ts('Adjust Pledge Payment Schedule?'), '2' => ts('Adjust Total Pledge Amount?')); $this->addRadio('option_type', NULL, $optionTypes, array(), '<br/>'); $currencyFreeze = TRUE; } } $totalAmount = $this->addMoney('total_amount', ts('Total Amount'), $hasPriceSets ? FALSE : TRUE, $attributes['total_amount'], TRUE, 'currency', NULL, $currencyFreeze); } $this->add('text', 'source', ts('Source'), CRM_Utils_Array::value('source', $attributes)); // CRM-7362 --add campaigns. CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values)); CRM_Contribute_Form_SoftCredit::buildQuickForm($this); $js = NULL; if (!$this->_mode) { $js = array('onclick' => "return verify( );"); } $mailingInfo = Civi::settings()->get('mailing_backend'); $this->assign('outBound_option', $mailingInfo['outBound_option']); $this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'js' => $js, 'isDefault' => TRUE), array('type' => 'upload', 'name' => ts('Save and New'), 'js' => $js, 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel')))); // if status is Cancelled freeze Amount, Payment Instrument, Check #, Financial Type, // Net and Fee Amounts are frozen in AdditionalInfo::buildAdditionalDetail if ($this->_id && $this->_values['contribution_status_id'] == array_search('Cancelled', $statusName)) { if ($totalAmount) { $totalAmount->freeze(); } $checkNumber->freeze(); $paymentInstrument->freeze(); $trxnId->freeze(); $financialType->freeze(); } // if contribution is related to membership or participant freeze Financial Type, Amount if ($this->_id && isset($this->_values['tax_amount'])) { $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); if (CRM_Utils_Array::value('membership', $componentDetails) || CRM_Utils_Array::value('participant', $componentDetails)) { if ($totalAmount) { $totalAmount->freeze(); } $financialType->freeze(); $this->assign('freezeFinancialType', TRUE); } } if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); } }