*/
public $_action;
+ /**
+ * Monetary fields that may be submitted.
+ *
+ * Any fields in this list will be converted to non-localised format
+ * if retrieved by `getSubmittedValue`
+ *
+ * @var array
+ */
+ protected $submittableMoneyFields = [];
+
/**
* Available payment processors.
*
'settingPath',
'autocomplete',
'validContact',
+ 'email',
];
foreach ($rules as $rule) {
// It's not clear why we set this on the form.
$this->set('paymentProcessors', $this->_paymentProcessors);
}
- else {
- throw new CRM_Core_Exception(ts('A payment processor configured for this page might be disabled (contact the site administrator for assistance).'));
- }
}
/**
public function setPageTitle($entityLabel) {
switch ($this->_action) {
case CRM_Core_Action::ADD:
- CRM_Utils_System::setTitle(ts('New %1', [1 => $entityLabel]));
+ $this->setTitle(ts('New %1', [1 => $entityLabel]));
break;
case CRM_Core_Action::UPDATE:
- CRM_Utils_System::setTitle(ts('Edit %1', [1 => $entityLabel]));
+ $this->setTitle(ts('Edit %1', [1 => $entityLabel]));
break;
case CRM_Core_Action::VIEW:
case CRM_Core_Action::PREVIEW:
- CRM_Utils_System::setTitle(ts('View %1', [1 => $entityLabel]));
+ $this->setTitle(ts('View %1', [1 => $entityLabel]));
break;
case CRM_Core_Action::DELETE:
- CRM_Utils_System::setTitle(ts('Delete %1', [1 => $entityLabel]));
+ $this->setTitle(ts('Delete %1', [1 => $entityLabel]));
break;
}
}
*
* @return mixed|null
*/
- protected function getSubmittedValue(string $fieldName) {
+ public function getSubmittedValue(string $fieldName) {
if (empty($this->exportedValues)) {
$this->exportedValues = $this->controller->exportValues($this->_name);
}
- return $this->exportedValues[$fieldName] ?? NULL;
+ $value = $this->exportedValues[$fieldName] ?? NULL;
+ if (in_array($fieldName, $this->submittableMoneyFields, TRUE)) {
+ return CRM_Utils_Rule::cleanMoney($value);
+ }
+ return $value;
}
/**