Bugzilla – Attachment 189364 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), 7.13 KB, created by
Martin Renvoize (ashimema)
on 2025-11-07 17:07:49 UTC
(
hide
)
Description:
Bug 40445: Add cashup summary preview for in-progress cashups
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-11-07 17:07:49 UTC
Size:
7.13 KB
patch
obsolete
>From b19ec5f33e3b41039a66db1da6d01a9bf285ba4e 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 the two-phase cashup workflow, staff start a cashup and then count >cash while continuing to process transactions. There was no way to >preview what would be included in the cashup until it was completed. > >This patch adds a "Preview expected summary" link in the >"Cashup in progress" alert that allows staff to: >- See what transactions will be included in the cashup >- Review expected cash amounts before completing >- Verify the session period is correct >- Check for any unexpected transactions > >Changes: > >Backend (Koha/REST/V1/CashRegisters/Cashups.pm): >- Modified get() endpoint to handle CASHUP_START actions for preview >- Fallback lookup finds CASHUP_START by ID when not found as completed >- Wraps CASHUP_START as Cashup object to generate summary > >Frontend (pos/register.tt): >- Added "Preview expected summary" link in cashup-in-progress alert >- Link includes data-in-progress="true" attribute for JS handling >- Uses existing cashupSummaryModal for consistent UX > >JavaScript (cashup_modal.js): >- Detects in-progress flag from link data attribute >- Changes modal title to "Cashup summary preview (in progress)" >- Adds informational alert explaining this is a preview >- Note clarifies that transactions will update values until completion >- Removes preview notice for completed cashup summaries > >The preview uses the same summary generation logic as completed cashups, >showing accurate period boundaries and transaction totals. Staff can >open the preview multiple times to see updated values as they process >transactions. > >Test plan: >1. Start a cashup on a register (two-phase workflow) >2. Verify "Cashup in progress" alert appears >3. Click "Preview expected summary" link >4. Verify modal shows: > - Title includes "(in progress)" > - Blue info alert explaining this is a preview > - Correct period dates > - Current transaction totals >5. Add a new cash transaction >6. Re-open preview, verify totals updated >7. Complete the cashup normally >8. View completed cashup summary >9. Verify no preview notice shown, title is normal >--- > Koha/REST/V1/CashRegisters/Cashups.pm | 16 ++++++++++ > .../prog/en/modules/pos/register.tt | 10 ++++++- > .../intranet-tmpl/prog/js/cashup_modal.js | 29 +++++++++++++++++++ > 3 files changed, 54 insertions(+), 1 deletion(-) > >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..3e1179a0330 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,15 @@ > [% 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. >+ Cashup in progress - started [% cashup_in_progress.timestamp | $KohaDates with_hours => 1 %]. You can continue to make transactions while counting cash. (<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" >+ >Preview expected summary</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 667a8205890..67f4d89c626 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >@@ -3,7 +3,18 @@ $(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 (in progress)"); >+ } else { >+ summary_modal.find("#cashupSummaryLabel").text("Cashup summary"); >+ } >+ > summary_modal.find("#register_description").text(description); > $.ajax({ > url: "/api/v1/cashups/" + cashup, >@@ -17,6 +28,24 @@ $(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") >+ .after( >+ '<div class="alert alert-info preview-notice">' + >+ '<i class="fa-solid fa-info-circle"></i> ' + >+ "<strong>Preview:</strong> This summary shows the current expected cashup amounts. " + >+ "New transactions will update these values until 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; >-- >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