Bug 26273: (follow-up) Format dates and money correctly.

This patch adds the missing formatting for the Datetime and Amount
fields.

Test plan
1/ Apply patch and reload register page to re-display the cashups table
2/ Note that the 'Date' field now displays a nicely formatted date
without an offset.
3/ Note that the 'Amount' field now displays the number according to
your money formatting preferences (with 2 decimal places in most cases)
4/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2021-02-10 17:31:56 +00:00 committed by Jonathan Druart
parent 26419d5560
commit 45baee1aae

View file

@ -321,6 +321,7 @@
[% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
[% Asset.js("js/cashup_modal.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'js-date-format.inc' %]
<script>
var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
orderFixed: [ 0, 'asc'],
@ -421,18 +422,24 @@
{
"data": "timestamp",
"searchable": true,
"orderable": true
"orderable": true,
"render": function(data, type, row, meta) {
return $datetime(row.timestamp);
}
},
{
"data": "amount",
"searchable": true,
"orderable": true
"orderable": true,
"render": function(data, type, row, meta) {
var amt = row.amount * -1;
return (amt).format_price();
}
},
{
"data": function( row, type, val, meta ) {
var result = '<a class="btn btn-default btn-xs" role="button" data-toggle="modal" data-cashup="'+encodeURIComponent(row.cashup_id)+'" data-register="[% register.description | html %]" href="#cashupSummaryModal"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Summary")+'</a>\n';
return result;
},
"searchable": false,
"orderable": false