X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FManagePremiums.php;h=5672c81ff36e298937cb08a1a165e1e1613a31aa;hb=c156d4d6f1d69cfb9e578901f485b67e39f70cf3;hp=82d52b84b4bbab60e1cd76d9b0055b932fae04a6;hpb=3b67ab13d6b97f373f6d616afdb10600329c0c69;p=civicrm-core.git diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index 82d52b84b4..5672c81ff3 100644 --- a/CRM/Contribute/Form/ManagePremiums.php +++ b/CRM/Contribute/Form/ManagePremiums.php @@ -1,7 +1,7 @@ add('Select', 'frequency_unit', ts('Frequency Unit'), array('' => '- select period -', 'day' => 'Day', 'week' => 'Week', 'month' => 'Month', 'year' => 'Year')); $this->add('text', 'frequency_interval', ts('Frequency'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'frequency_interval')); - + //Financial Type CRM-11106 $financialType = CRM_Contribute_PseudoConstant::financialType( ); $premiumFinancialType = array(); CRM_Core_PseudoConstant::populate( $premiumFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', - $all = True, - $retrieve = 'entity_id', - $filter = null, - 'account_relationship = 8' + $all = True, + $retrieve = 'entity_id', + $filter = null, + 'account_relationship = 8' ); - + $costFinancialType = array(); CRM_Core_PseudoConstant::populate( $costFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', - $all = True, - $retrieve = 'entity_id', - $filter = null, - 'account_relationship = 7' + $all = True, + $retrieve = 'entity_id', + $filter = null, + 'account_relationship = 7' ); $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType); foreach( $financialType as $key => $financialTypeName ){ @@ -201,14 +201,14 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { } if( count( $financialType ) ){ $this->assign( 'financialType', $financialType ); - } + } $this->add( - 'select', - 'financial_type_id', - ts( 'Financial Type' ), + 'select', + 'financial_type_id', + ts( 'Financial Type' ), array(''=>ts('- select -')) + $financialType ); - + $this->add('checkbox', 'is_active', ts('Enabled?')); $this->addFormRule(array('CRM_Contribute_Form_ManagePremiums', 'formRule')); @@ -250,7 +250,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { } } // CRM-13231 financial type required if product has cost - if (CRM_Utils_Array::value('cost', $params)) { + if (CRM_Utils_Array::value('cost', $params) && !CRM_Utils_Array::value('financial_type_id', $params)) { $errors['financial_type_id'] = ts('Financial Type is required for product having cost.'); } $fileLocation = $files['uploadFile']['tmp_name'];