X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FContributionPage%2FSettings.php;h=2af10e33e0197c66bd47ddea0524540845b04536;hb=7791c05ff3b621589d135f3a01189d7f0a563db9;hp=91bc8c0204984d236589d18186684fbe8f33aa58;hpb=3164a2fef326b5f39cf8463a7091a2a008e69506;p=civicrm-core.git diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index 91bc8c0204..2af10e33e0 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -1,7 +1,7 @@ addDateTime('start_date', ts('Start Date')); $this->addDateTime('end_date', ts('End Date')); - $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule'), $this->_id); + $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule'), $this); parent::buildQuickForm(); } @@ -193,9 +193,9 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ * @static * @access public */ - static function formRule($values, $files, $contributionPageId) { + static function formRule($values, $files, $self) { $errors = array(); - + $contributionPageId = $self->_id; //CRM-4286 if (strstr($values['title'], '/')) { $errors['title'] = ts("Please do not use '/' in Title"); @@ -213,7 +213,12 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ if (($end < $start) && ($end != 0)) { $errors['end_date'] = ts('End date should be after Start date.'); } - + + if (CRM_Utils_Array::value('payment_processor', $self->_values) + && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($values['financial_type_id'])) { + $errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType; + } + //dont allow on behalf of save when //pre or post profile consists of membership fields if ($contributionPageId && CRM_Utils_Array::value('is_organization', $values)) { @@ -234,7 +239,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $conProfileType = "'Includes Profile (top of page)'"; } } - + if ($contributionProfiles['custom_post_id']) { $postProfileType = CRM_Core_BAO_UFField::getProfileType($contributionProfiles['custom_post_id']); if ($postProfileType == 'Membership') {