Bugzilla – Attachment 189480 Details for
Bug 40445
Point of Sale reconciliation input during daily summaries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40445: Add cashup summary preview for in-progress cashups
Bug-40445-Add-cashup-summary-preview-for-in-progre.patch (text/plain), 8.97 KB, created by
Martin Renvoize (ashimema)
on 2025-11-11 07:40:04 UTC
(
hide
)
Description:
Bug 40445: Add cashup summary preview for in-progress cashups
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-11-11 07:40:04 UTC
Size:
8.97 KB
patch
obsolete
>From 2c173c6091c4a950787927fa01fdcdde90dc842b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Fri, 7 Nov 2025 16:48:08 +0000 >Subject: [PATCH] Bug 40445: Add cashup summary preview for in-progress cashups > >In two-phase workflow, staff start cashup then count cash while >continuing transactions. This adds preview capability to see what >will be included before completion. > >Features: >- "Preview cashup summary" link in cashup progress alert >- Modal shows expected amounts with "(preview)" indicator >- Alert explains this is preview and reconciliation may be added >- API endpoint supports preview by accepting CASHUP_START action IDs >- All strings properly wrapped for translation > >Test plan: >1. Start two-phase cashup on register >2. Verify "Cashup in progress" alert appears >3. Click "Preview cashup summary" link >4. Verify modal shows: > - Title: "Cashup summary preview" > - Info alert explaining preview status > - Correct period dates > - Current transaction totals >5. Add new cash transaction >6. Re-open preview - verify totals updated >7. Complete cashup normally >8. View completed cashup summary >9. Verify no preview notice, normal title shown >10. Check translations: Verify all strings wrapped with __() or t()/tx() >--- > Koha/REST/V1/CashRegisters/Cashups.pm | 16 ++++++ > .../prog/en/modules/pos/register.tt | 6 ++- > .../intranet-tmpl/prog/js/cashup_modal.js | 52 ++++++++++++++++--- > 3 files changed, 67 insertions(+), 7 deletions(-) > >diff --git a/Koha/REST/V1/CashRegisters/Cashups.pm b/Koha/REST/V1/CashRegisters/Cashups.pm >index 375eab431e0..ffb8e63b9f1 100644 >--- a/Koha/REST/V1/CashRegisters/Cashups.pm >+++ b/Koha/REST/V1/CashRegisters/Cashups.pm >@@ -63,8 +63,24 @@ sub get { > my $c = shift->openapi->valid_input or return; > > return try { >+ >+ # Try to find as a completed cashup first > my $cashup = Koha::Cash::Register::Cashups->find( $c->param('cashup_id') ); > >+ # If not found, try as a CASHUP_START action (for preview) >+ unless ($cashup) { >+ require Koha::Cash::Register::Actions; >+ my $action = Koha::Cash::Register::Actions->find( $c->param('cashup_id') ); >+ >+ # Only allow CASHUP_START actions for preview >+ if ( $action && $action->code eq 'CASHUP_START' ) { >+ >+ # Wrap as Cashup object for summary generation >+ require Koha::Cash::Register::Cashup; >+ $cashup = Koha::Cash::Register::Cashup->_new_from_dbic( $action->_result ); >+ } >+ } >+ > return $c->render_resource_not_found("Cashup") > unless $cashup; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >index a23383c01e0..3b91d2d1042 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -96,7 +96,11 @@ > [% IF cashup_in_progress %] > <div class="alert alert-warning"> > <i class="fa-solid fa-info-circle"></i> >- Cashup in progress - started [% cashup_in_progress.timestamp | $KohaDates with_hours => 1 %]. You can continue to make transactions while counting cash. >+ [% SET progress_timestamp = cashup_in_progress.timestamp | $KohaDates(with_hours => 1) %] >+ [% tx("Cashup in progress - started {timestamp}. You can continue to make transactions while counting cash.", { timestamp = progress_timestamp }) | html %] >+ (<a data-bs-toggle="modal" data-cashup="[% cashup_in_progress.id | html %]" data-register="[% register.description | html %]" data-in-progress="true" href="#cashupSummaryModal" class="button" >+ >[% t("Preview cashup summary") | html %]</a >+ >) > </div> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >index 306b82cb106..9f57c77e1a7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >@@ -3,7 +3,20 @@ $(document).ready(function () { > var button = $(e.relatedTarget); > var cashup = button.data("cashup"); > var description = button.data("register"); >+ var inProgress = button.data("in-progress") || false; > var summary_modal = $(this); >+ >+ // Update title based on whether this is a preview >+ if (inProgress) { >+ summary_modal >+ .find("#cashupSummaryLabel") >+ .text(__("Cashup summary preview")); >+ } else { >+ summary_modal >+ .find("#cashupSummaryLabel") >+ .text(__("Cashup summary")); >+ } >+ > summary_modal.find("#register_description").text(description); > $.ajax({ > url: "/api/v1/cashups/" + cashup, >@@ -17,6 +30,28 @@ $(document).ready(function () { > let to_date = $datetime(data.summary.to_date); > summary_modal.find("#to_date").text(to_date); > >+ // Add preview notice if this is an in-progress cashup >+ if (inProgress) { >+ var previewNotice = summary_modal.find(".preview-notice"); >+ if (previewNotice.length === 0) { >+ summary_modal >+ .find(".modal-body > ul") >+ .before( >+ '<div class="alert alert-info preview-notice">' + >+ '<i class="fa-solid fa-info-circle"></i> ' + >+ "<strong>" + >+ __("Preview:") + >+ "</strong> " + >+ __( >+ "This summary shows the expected cashup amounts. A reconciliation record may be added when you complete the cashup." >+ ) + >+ "</div>" >+ ); >+ } >+ } else { >+ summary_modal.find(".preview-notice").remove(); >+ } >+ > // Check for reconciliation (surplus or deficit) from dedicated fields > var surplus = data.summary.surplus_total; > var deficit = data.summary.deficit_total; >@@ -71,7 +106,9 @@ $(document).ready(function () { > > // 1. Total (sum of all transactions) > tfoot.append( >- "<tr class='total-row'><td><strong>Total</strong></td><td><strong>" + >+ "<tr class='total-row'><td><strong>" + >+ __("Total") + >+ "</strong></td><td><strong>" + > data.summary.total.format_price() + > "</strong></td></tr>" > ); >@@ -94,7 +131,9 @@ $(document).ready(function () { > } > if (cashCollected !== null) { > tfoot.append( >- "<tr><td><strong>Cash collected</strong></td><td><strong>" + >+ "<tr><td><strong>" + >+ __("Cash collected") + >+ "</strong></td><td><strong>" + > cashCollected.format_price() + > "</strong></td></tr>" > ); >@@ -109,8 +148,9 @@ $(document).ready(function () { > ) { > tfoot.append( > "<tr><td><strong>" + >- escape_str(type.payment_type) + >- " collected" + >+ __x("{payment_type} collected", { >+ payment_type: escape_str(type.payment_type), >+ }) + > "</strong></td><td><strong>" + > type.total.format_price() + > "</strong></td></tr>" >@@ -133,14 +173,14 @@ $(document).ready(function () { > if (surplus) { > reconciliationClass = > "reconciliation-result text-warning"; >- reconciliationLabel = "Cashup surplus"; >+ reconciliationLabel = __("Cashup surplus"); > reconciliationAmount = > "+" + Math.abs(surplus).format_price(); > reconciliationNote = data.summary.surplus_note; > } else if (deficit) { > reconciliationClass = > "reconciliation-result text-danger"; >- reconciliationLabel = "Cashup deficit"; >+ reconciliationLabel = __("Cashup deficit"); > reconciliationAmount = > "-" + Math.abs(deficit).format_price(); > reconciliationNote = data.summary.deficit_note; >-- >2.51.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 40445
:
185289
|
185290
|
185291
|
185292
|
185809
|
186636
|
186637
|
186638
|
186639
|
186640
|
186641
|
186642
|
186643
|
189333
|
189334
|
189335
|
189336
|
189337
|
189338
|
189339
|
189340
|
189341
|
189353
|
189354
|
189355
|
189356
|
189357
|
189358
|
189359
|
189360
|
189361
|
189362
|
189363
|
189364
|
189410
|
189411
|
189412
|
189413
|
189414
|
189415
|
189420
|
189421
|
189422
|
189423
|
189424
|
189425
|
189426
|
189427
|
189428
|
189429
|
189430
|
189476
|
189477
|
189478
|
189479
| 189480 |
189481
|
189482