Skip to content
Snippets Groups Projects
Commit 29f69c7c authored by Erik Hommel's avatar Erik Hommel
Browse files

move financial type list to Utils

parent 172c6bba
Branches
Tags
No related merge requests found
......@@ -196,5 +196,18 @@ class CRM_Civirules_Utils {
}
return $statusId;
}
/**
* Method to get the financial types
* @return array
*/
public static function getFinancialTypes() {
$return = array();
$dao = CRM_Core_DAO::executeQuery("SELECT * FROM `civicrm_financial_type` where `is_active` = 1");
while($dao->fetch()) {
$return[$dao->id] = $dao->name;
}
return $return;
}
}
......@@ -8,19 +8,6 @@
class CRM_CivirulesConditions_Form_Contribution_FinancialType extends CRM_CivirulesConditions_Form_Form {
/**
* Method to get the financial types
* @return array
*/
protected function getFinancialTypes() {
$return = array('' => ts('-- please select --'));
$dao = CRM_Core_DAO::executeQuery("SELECT * FROM `civicrm_financial_type` where `is_active` = 1");
while($dao->fetch()) {
$return[$dao->id] = $dao->name;
}
return $return;
}
/**
* Overridden parent method to build form
*
......@@ -29,7 +16,10 @@ class CRM_CivirulesConditions_Form_Contribution_FinancialType extends CRM_Civiru
public function buildQuickForm() {
$this->add('hidden', 'rule_condition_id');
$this->add('select', 'financial_type_id', ts('Financial type'), $this->getFinancialTypes(), true);
$financialTypes = CRM_Civirules_Utils::getFinancialTypes();
$financialTypes[0] = ts('- select -');
asort($financialTypes);
$this->add('select', 'financial_type_id', ts('Financial type'), $financialTypes, true);
$this->add('select', 'operator', ts('Operator'), array('equals', 'is not equal to'), true);
$this->addButtons(array(
......
......@@ -5,7 +5,6 @@
<div class="content">{$form.operator.html}</div>
<div class="clear"></div>
</div>
</div>
<div class="crm-section">
<div class="label">{$form.financial_type_id.label}</div>
<div class="content">{$form.financial_type_id.html}</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment