public function buildQuickForm() {
$htmlFields = array();
foreach ($this->_settings as $setting => $group) {
+ // @todo - remove this whole loop! The parent form does this - it's just because of the werid handling
+ // of $htmlFields for this form that needs to be unwound that we have it atm.
+ // The 'basicform' has been contaminated with processing $htlFields
+ // to cater to this form - probably due to the way invoicing settings were handled as
+ // an array not a bunch of keys.
$settingMetaData = civicrm_api3('setting', 'getfields', array('name' => $setting));
$props = $settingMetaData['values'][$setting];
if (isset($props['quick_form_type'])) {
$add = 'add' . $props['quick_form_type'];
if ($add == 'addElement') {
if (in_array($props['html_type'], array('checkbox', 'textarea'))) {
- $this->add($props['html_type'],
- $setting,
- $props['title']
- );
}
else {
if ($props['html_type'] == 'select') {
$props['option_values'] = array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::$functionName();
}
}
- $this->$add(
- $props['html_type'],
- $setting,
- ts($props['title']),
- CRM_Utils_Array::value($props['html_type'] == 'select' ? 'option_values' : 'html_attributes', $props, array()),
- $props['html_type'] == 'select' ? CRM_Utils_Array::value('html_attributes', $props) : NULL
- );
}
}
- elseif ($add == 'addMonthDay') {
- $this->add('date', $setting, ts($props['title']), CRM_Core_SelectValues::date(NULL, 'M d'));
- }
- elseif ($add == 'addDate') {
- $this->addDate($setting, ts($props['title']), FALSE, array('formatType' => $props['type']));
- }
- else {
- $this->$add($setting, ts($props['title']));
- }
}
$htmlFields[$setting] = ts($props['description']);
}
unset($params['qfKey']);
unset($params['entryURL']);
Civi::settings()->set('contribution_invoice_settings', $params);
- Civi::settings()->set('update_contribution_on_membership_type_change',
- CRM_Utils_Array::value('update_contribution_on_membership_type_change', $params)
- );
// to set default value for 'Invoices / Credit Notes' checkbox on display preferences
$values = CRM_Core_BAO_Setting::getItem("CiviCRM Preferences");
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'invoicing',
- 'type' => 'Integer',
+ 'type' => 'Boolean',
'html_type' => 'checkbox',
'quick_form_type' => 'Element',
'default' => 0,
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'acl_financial_type',
- 'type' => 'Integer',
+ 'type' => 'Boolean',
'html_type' => 'checkbox',
'quick_form_type' => 'Element',
'default' => 0,
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'deferred_revenue_enabled',
- 'type' => 'Integer',
+ 'type' => 'Boolean',
'html_type' => 'checkbox',
'quick_form_type' => 'Element',
'default' => 0,
'group' => 'contribute',
'name' => 'default_invoice_page',
'type' => 'Integer',
- 'quick_form_type' => 'Element',
+ 'quick_form_type' => 'Select',
'default' => NULL,
'pseudoconstant' => array(
// @todo - handle table style pseudoconstants for settings & avoid deprecated function.
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'always_post_to_accounts_receivable',
- 'type' => 'Integer',
+ 'type' => 'Boolean',
'html_type' => 'checkbox',
'quick_form_type' => 'Element',
'default' => 0,
'group_name' => 'Contribute Preferences',
'group' => 'contribute',
'name' => 'update_contribution_on_membership_type_change',
- 'type' => 'Integer',
+ 'type' => 'Boolean',
'html_type' => 'checkbox',
'quick_form_type' => 'Element',
'default' => 0,