*/
public function buildQuickForm() {
parent::buildQuickForm();
+ $metadata = \Civi\Core\SettingsMetadata::getMetadata(['name' => ['invoice_prefix', 'tax_term', 'invoice_notes', 'invoice_due_date', 'invoice_is_email_pdf', 'invoice_due_date_period', 'tax_display_settings']], NULL, TRUE);
$this->invoiceSettings = [
- 'invoice_prefix' => [
- 'html_type' => 'text',
- 'title' => ts('Invoice Prefix'),
- 'weight' => 1,
- 'description' => ts('Enter prefix to be display on PDF for invoice'),
- ],
- 'due_date' => [
- 'html_type' => 'text',
- 'title' => ts('Due Date'),
- 'weight' => 3,
- 'description' => '',
- ],
- 'due_date_period' => [
- 'html_type' => 'select',
- 'title' => ts('For transmission'),
- 'weight' => 4,
- 'description' => ts('Select the interval for due date.'),
- 'option_values' => [
- 'select' => ts('- select -'),
- 'days' => ts('Days'),
- 'months' => ts('Months'),
- 'years' => ts('Years'),
- ],
- ],
- 'notes' => [
- 'html_type' => 'wysiwyg',
- 'title' => ts('Notes or Standard Terms'),
- 'weight' => 5,
- 'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '),
- 'attributes' => ['rows' => 2, 'cols' => 40],
- ],
- 'is_email_pdf' => [
- 'html_type' => 'checkbox',
- 'title' => ts('Automatically email invoice when user purchases online'),
- 'weight' => 6,
- 'description' => ts('Should a pdf invoice be emailed automatically?'),
- ],
- 'tax_term' => [
- 'html_type' => 'text',
- 'title' => ts('Tax Term'),
- 'weight' => 7,
- 'description' => '',
- ],
- 'tax_display_settings' => [
- 'html_type' => 'select',
- 'title' => ts('Tax Display Settings'),
- 'weight' => 8,
- 'description' => '',
- 'option_values' => [
- 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [
- 1 => CRM_Utils_Money::format(120),
- ]),
- 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [
- 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money::format(120), 2 => CRM_Utils_Money::format(20)]),
- ]),
- 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [
- 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money::format(120), 2 => CRM_Utils_Money::format(20)]),
- ]),
- ],
- ],
+ 'invoice_prefix' => $metadata['invoice_prefix'],
+ 'due_date' => $metadata['invoice_due_date'],
+ 'due_date_period' => $metadata['invoice_due_date_period'],
+ 'notes' => $metadata['invoice_notes'],
+ 'is_email_pdf' => $metadata['invoice_is_email_pdf'],
+ 'tax_term' => $metadata['tax_term'],
+ 'tax_display_settings' => $metadata['tax_display_settings'],
];
// @todo this is a faux metadata approach - we should be honest & add them correctly or find a way to make this
$this->addElement('select',
$fieldName,
$fieldValue['title'],
- $fieldValue['option_values'],
+ $fieldValue['options'],
CRM_Utils_Array::value('attributes', $fieldValue)
);
break;
'add' => '5.23',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Invoice Prefix'),
- 'description' => ts('Enter prefix to be be preprended when creating an invoice number'),
+ 'description' => ts('Enter prefix to be be pre-pended when creating an invoice number'),
'is_domain' => 1,
'is_contact' => 0,
],
'name' => 'invoice_due_date',
'html_type' => 'text',
'title' => ts('Due Date'),
+ 'description' => '',
'add' => '5.23',
'type' => CRM_Utils_Type::T_INT,
'is_domain' => 1,
'type' => CRM_Utils_Type::T_STRING,
'is_domain' => 1,
'is_contact' => 0,
+ 'description' => '',
],
'tax_display_settings' => [
'default' => 'Inclusive',
'title' => ts('Tax Display Settings'),
'is_domain' => 1,
'is_contact' => 0,
+ 'description' => '',
'pseudoconstant' => ['callback' => 'CRM_Core_SelectValues::taxDisplayOptions'],
],
'deferred_revenue_enabled' => [