$this->assign_by_ref('paymentProcessor', $this->_paymentProcessor);
}
-
- /**
- * Get the currency in use.
- *
- * This just defaults to getting the default currency
- * where the form does not have better currency support.
- *
- * @return string
- */
- public function getCurrency(): string {
- return (string) \Civi::settings()->get('defaultCurrency');
- }
-
/**
* @param array $submittedValues
*
return $defaults;
}
- /**
- * Get submitted currency, or use default.
- *
- * @return string
- */
- public function getCurrency(): string {
- return (string) $this->getSubmittedValue('currency') ?: CRM_Core_Config::singleton()->defaultCurrency;
- }
-
/**
* Build the form object.
*
}
}
+ /**
+ * Get the currency for the form.
+ *
+ * Rather historic - might have unneeded stuff
+ *
+ * @return string
+ */
+ public function getCurrency() {
+ $currency = $this->_values['currency'] ?? NULL;
+ // For event forms, currency is in a different spot
+ if (empty($currency)) {
+ $currency = CRM_Utils_Array::value('currency', CRM_Utils_Array::value('event', $this->_values));
+ }
+ if (empty($currency)) {
+ $currency = CRM_Utils_Request::retrieveValue('currency', 'String');
+ }
+ // @todo If empty there is a problem - we should probably put in a deprecation notice
+ // to warn if that seems to be happening.
+ return (string) $currency;
+ }
+
}
/**
* Get the currency for the form.
*
- * @todo this should be overriden on the forms rather than having this
- * historic, possible handling in here. As we clean that up we should
- * add deprecation notices into here.
- *
* @return string
*/
public function getCurrency() {
- $currency = $this->_values['currency'] ?? NULL;
- // For event forms, currency is in a different spot
- if (empty($currency)) {
- $currency = CRM_Utils_Array::value('currency', CRM_Utils_Array::value('event', $this->_values));
+ if ($this->getSubmittedValue('currency')) {
+ return $this->getSubmittedValue('currency');
}
- if (empty($currency)) {
- $currency = CRM_Utils_Request::retrieveValue('currency', 'String');
+ $currency = CRM_Utils_Request::retrieveValue('currency', 'String');
+ if ($currency) {
+ return $currency;
}
- // @todo If empty there is a problem - we should probably put in a deprecation notice
- // to warn if that seems to be happening.
- return $currency;
+ return \Civi::settings()->get('defaultCurrency');
}
/**
return $this->getPriceSetID() && CRM_Price_BAO_PriceSet::isQuickConfig($this->getPriceSetID());
}
+ /**
+ * Get the currency for the form.
+ *
+ * Rather historic - might have unneeded stuff
+ *
+ * @return string
+ */
+ public function getCurrency() {
+ $currency = $this->_values['currency'] ?? NULL;
+ // For event forms, currency is in a different spot
+ if (empty($currency)) {
+ $currency = CRM_Utils_Array::value('currency', CRM_Utils_Array::value('event', $this->_values));
+ }
+ if (empty($currency)) {
+ $currency = CRM_Utils_Request::retrieveValue('currency', 'String');
+ }
+ // @todo If empty there is a problem - we should probably put in a deprecation notice
+ // to warn if that seems to be happening.
+ return $currency;
+ }
+
}
/**
* Get currency
*
- * @param array $submittedValues
- * Required for consistency with other form methods.
- *
* @return string
*/
- public function getCurrency($submittedValues = []) {
- return $this->currency;
+ public function getCurrency(): string {
+ return (string) $this->currency;
}
/**