Skip to content
Snippets Groups Projects
Unverified Commit 7bbe5e3a authored by Seamus Lee's avatar Seamus Lee Committed by GitHub
Browse files

Merge pull request #17577 from seamuslee001/deprecated_checks_money_value_format

Add in deprecation notice and status check for a money value format co…
parents c2cc5b81 9a894bf1
Branches
Tags
No related merge requests found
......@@ -178,4 +178,19 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component {
return $messages;
}
public function checkMoneyValueFormatConfig() {
$messages = [];
if (CRM_Core_Config::singleton()->moneyvalueformat !== '%!i') {
$msg = new CRM_Utils_Check_Message(
__FUNCTION__,
ts('<p>The Money Value format stored is deprecated please report your configuration on <a href="https://lab.civicrm.org/dev/core/-/issues/1494">Gitlab Issue</a>'),
ts('Deprectad money value format configuration'),
\Psr\Log\LogLevel::WARNING,
'fa-server'
);
$messages[] = $msg;
}
return $messages;
}
}
......@@ -61,6 +61,10 @@ class CRM_Utils_Money {
$valueFormat = $config->moneyvalueformat;
}
if (!empty($valueFormat) && $valueFormat !== '%!i') {
CRM_Core_Error::deprecatedFunctionWarning('Having a Money Value format other than !%i is deprecated, please report this on the GitLab Issue https://lab.civicrm.org/dev/core/-/issues/1494 with the relevant moneyValueFormat you use.');
}
if ($onlyNumber) {
// money_format() exists only in certain PHP install (CRM-650)
if (is_numeric($amount) and function_exists('money_format')) {
......@@ -170,6 +174,9 @@ class CRM_Utils_Money {
* @return string
*/
protected static function formatLocaleNumeric($amount) {
if (CRM_Core_Config::singleton()->moneyvalueformat !== '%!i') {
CRM_Core_Error::deprecatedFunctionWarning('Having a Money Value format other than !%i is deprecated, please report this on GitLab with the relevant moneyValueFormat you use.');
}
return self::formatNumericByFormat($amount, CRM_Core_Config::singleton()->moneyvalueformat);
}
......
......@@ -71,7 +71,7 @@
</tr>
<tr class="crm-localization-form-block-moneyvalueformat">
<td class="label">{$form.moneyvalueformat.label} {help id='moneyvalueformat' title=$form.moneyvalueformat.label}</td>
<td>{$form.moneyvalueformat.html}</td>
<td>{$form.moneyvalueformat.html}<br> Note that this setting is proposed to be deprecated as per this <a href="https://lab.civicrm.org/dev/core/-/issues/1494">Gitlab Issue</a></td>
</tr>
<tr class="crm-localization-form-block-customTranslateFunction">
<td class="label">{$form.customTranslateFunction.label} {help id='customTranslateFunction' title=$form.customTranslateFunction.label}</td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment