Bugzilla – Attachment 137515 Details for
Bug 31039
Rebase issues lead to duplicate JS for cash summary modal printing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31039: (follow-up) Wrap jQuery in $(document).ready()
Bug-31039-follow-up-Wrap-jQuery-in-documentready.patch (text/plain), 5.17 KB, created by
Martin Renvoize (ashimema)
on 2022-07-11 14:05:37 UTC
(
hide
)
Description:
Bug 31039: (follow-up) Wrap jQuery in $(document).ready()
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-07-11 14:05:37 UTC
Size:
5.17 KB
patch
obsolete
>From 0e47c93c1e972fd6c64c990055f6108603483bae Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 11 Jul 2022 15:03:44 +0100 >Subject: [PATCH] Bug 31039: (follow-up) Wrap jQuery in $(document).ready() > >cashup_modal.js consists only of jQuery code, so the whole thing should >be contained in a $(document).ready() function. This may or may not be >contributing to the behavior this bug is trying to fix. > >Please note that this patch contains whitespace changes, so diff >accordingly. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../intranet-tmpl/prog/js/cashup_modal.js | 88 ++++++++++--------- > 1 file changed, 45 insertions(+), 43 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >index 4df0403eea..e207c754f3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >@@ -1,52 +1,54 @@ >-$('#cashupSummaryModal').on('show.bs.modal', function(e) { >- var button = $(e.relatedTarget); >- var cashup = button.data('cashup'); >- var description = button.data('register'); >- var summary_modal = $(this); >- summary_modal.find('#register_description').text(description); >- $.ajax({ >- url: '/api/v1/cashups/' + cashup, >- headers: { >- 'x-koha-embed': 'summary' >- }, >- async: false, >- success: function(data) { >- summary_modal.find('#from_date').text(data.summary.from_date); >- summary_modal.find('#to_date').text(data.summary.to_date); >- var tbody = summary_modal.find('tbody') >- tbody.empty(); >- for (out of data.summary.payout_grouped) { >- tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total.format_price() + '</td></tr>'); >- } >+$(document).ready(function() { >+ $('#cashupSummaryModal').on('show.bs.modal', function(e) { >+ var button = $(e.relatedTarget); >+ var cashup = button.data('cashup'); >+ var description = button.data('register'); >+ var summary_modal = $(this); >+ summary_modal.find('#register_description').text(description); >+ $.ajax({ >+ url: '/api/v1/cashups/' + cashup, >+ headers: { >+ 'x-koha-embed': 'summary' >+ }, >+ async: false, >+ success: function(data) { >+ summary_modal.find('#from_date').text(data.summary.from_date); >+ summary_modal.find('#to_date').text(data.summary.to_date); >+ var tbody = summary_modal.find('tbody') >+ tbody.empty(); >+ for (out of data.summary.payout_grouped) { >+ tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total.format_price() + '</td></tr>'); >+ } > >- for (income of data.summary.income_grouped) { >- tbody.append('<tr><td>' + income.debit_type.description + '</td><td>' + income.total.format_price() + '</td></tr>'); >- } >+ for (income of data.summary.income_grouped) { >+ tbody.append('<tr><td>' + income.debit_type.description + '</td><td>' + income.total.format_price() + '</td></tr>'); >+ } > >- var tfoot = summary_modal.find('tfoot'); >- tfoot.empty(); >- tfoot.append('<tr><td>Total</td><td>' + data.summary.total.format_price() + '</td></tr>'); >- for (type of data.summary.total_grouped) { >- if (type.total !== 0) { >- tfoot.append('<tr><td>' + type.payment_type + '</td><td>' + type.total.format_price() + '</td></tr>'); >+ var tfoot = summary_modal.find('tfoot'); >+ tfoot.empty(); >+ tfoot.append('<tr><td>Total</td><td>' + data.summary.total.format_price() + '</td></tr>'); >+ for (type of data.summary.total_grouped) { >+ if (type.total !== 0) { >+ tfoot.append('<tr><td>' + type.payment_type + '</td><td>' + type.total.format_price() + '</td></tr>'); >+ } > } > } >- } >+ }); > }); >-}); > >-$('.modal.printable').on('shown.bs.modal', function() { >- $('.modal-dialog', this).addClass('focused'); >- $('body').addClass('modalprinter'); >+ $('.modal.printable').on('shown.bs.modal', function() { >+ $('.modal-dialog', this).addClass('focused'); >+ $('body').addClass('modalprinter'); > >- if ($(this).hasClass('autoprint')) { >- window.print(); >- } >-}).on('hidden.bs.modal', function() { >- $('.modal-dialog', this).removeClass('focused'); >- $('body').removeClass('modalprinter'); >-}); >+ if ($(this).hasClass('autoprint')) { >+ window.print(); >+ } >+ }).on('hidden.bs.modal', function() { >+ $('.modal-dialog', this).removeClass('focused'); >+ $('body').removeClass('modalprinter'); >+ }); > >-$('.printModal').click(function() { >- window.print(); >+ $('.printModal').click(function() { >+ window.print(); >+ }); > }); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31039
:
136488
|
136532
|
136533
|
137046
|
137367
|
137368
|
137514
| 137515