Skip to content

Commit 6a1ec96

Browse files
committed
Merge pull request civicrm#7 from Edzelopez/CIVI-28
CIVI-28 Modified functionality for offline contribution page
2 parents 59c626b + 87d2254 commit 6a1ec96

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

CRM/Contribute/Form/Contribution.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ public function setDefaultValues() {
491491
public function buildQuickForm() {
492492

493493
// FIXME: This probably needs to be done in preprocess
494-
if ($this->_action & CRM_Core_Action::UPDATE) {
494+
if ($this->_action & CRM_Core_Action::UPDATE && CRM_Utils_Array::value('financial_type_id', $this->_values)) {
495495
$financialTypeID = CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']);
496496
if (!CRM_Core_Permission::check('edit contributions of type ' . $financialTypeID)) {
497497
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
@@ -651,13 +651,7 @@ public function buildQuickForm() {
651651
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution');
652652

653653
// Check permissions for financial type first
654-
$financialTypes = CRM_Contribute_PseudoConstant::financialType();
655-
656-
foreach ($financialTypes as $finTypeId => $type) {
657-
if (!CRM_Core_Permission::check('add new contributions of type ' . $type)) {
658-
unset($financialTypes[$finTypeId]);
659-
}
660-
}
654+
CRM_Financial_BAO_FinancialType::addFinancialTypes($financialTypes);
661655

662656
$financialType = $this->add('select', 'financial_type_id',
663657
ts('Financial Type'),

0 commit comments

Comments
 (0)