Remove Commas for Values held in Number Field Custom Field Type

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

このページの情報は、Jira アプリケーションのカスタマイズに関連しています。アトラシアン サポートの提供内容にカスタマイズは含まれていないため、アトラシアン サポートでは、このページで記載されている手順に対するサポートを保証できません。この資料は情報提供のみを目的としており、記載内容は自己責任の下で行っていただく必要があります。

また、ファイルの直接変更によって行われるカスタマイズは、アップグレード プロセスには含まれない点にご注意ください。このような変更は、アップグレード後のインスタンスで手動で再適用する必要があります。

Jira adds commas to numeric value stored in Number field, like 1,234. For further reference see JRA-7582 - Getting issue details... STATUS .

If you don't want commas to be added, edit /WEB-INF/classes/templates/plugins/fields/view/view-number.vm. Replace the following line:


$!numberTool.format($value)

with:

$value.longValue()


Make sure to back up the Velocity file before changing it.

Disable commas for a single custom field

It's possible that you would like to disable the commas for a single custom field instead of multiple custom fields in this case, we can add the customField.id value to filter for this custom field specifically.

This will require you to identify the custom field ID by inspecting the URL while editing the custom field.

For example, let's assume that we are editing a custom field called "Phone Number" by going to the page ⚙ > Issues > Custom Fields and clicking on ... > Edit next to the field. If we check the URL of the landing page, we can see "id=XXXXX" at the end of it. The value after id= is the ID of the custom field (10900 in the example of screenshot below):


Using the example of custom field ID shown above, the file /WEB-INF/classes/templates/plugins/fields/view/view-number.vm will need to be edited as follows:

#if ($customField.id == 'customfield_10900' && $value)
$value.longValue()
#elseif ($value)
$!numberTool.format($value)
#end

It's possible add multiple custom fields by adding multiple elseif statements.




最終更新日 2022 年 7 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.