Bugzilla – Attachment 179374 Details for
Bug 38184
OpacTrustedCheckout module does not show due date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38184: Show due date on OpacTrustedCheckout modal
Bug-38184-Show-due-date-on-OpacTrustedCheckout-mod.patch (text/plain), 3.83 KB, created by
David Nind
on 2025-03-16 19:36:42 UTC
(
hide
)
Description:
Bug 38184: Show due date on OpacTrustedCheckout modal
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-03-16 19:36:42 UTC
Size:
3.83 KB
patch
obsolete
>From 5f359c5f0eaa97b94c1fbfbb990d297d9529fdf0 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 13 Mar 2025 23:34:23 +0000 >Subject: [PATCH] Bug 38184: Show due date on OpacTrustedCheckout modal > >This fixes checkout fields being made available to the public API. > >Note: This depends on the fix at Bug 39313, so make sure you apply that >first. > >To test: > >1. Enabled OpacTrustedCheckout system preference >2. Search for an item and get the barcode >3. Go to the OPAC >4. Click the Self-checkout button at the top >5. Enter the barcode and submit >6. Notice that the due date does not show in the modal, even though the > due date was correctly set > >7. Apply the patch and restart services > >8. Go to the staff interface and check in your barcode >9. Repeat steps 3-5 >10. Confirm the due date does show correctly in the modal > >11. Confirm tests pass t/db_dependent/Koha/Checkout.t > >Sponsored-by: Reserve Bank of New Zealand >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Checkout.pm | 15 ++++++++++ > t/db_dependent/Koha/Checkout.t | 50 ++++++++++++++++++++++++++++++++++ > 2 files changed, 65 insertions(+) > >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index 31ec7a5d1a..3c8218cea0 100644 >--- a/Koha/Checkout.pm >+++ b/Koha/Checkout.pm >@@ -237,6 +237,21 @@ sub to_api_mapping { > }; > } > >+=head3 public_read_list >+ >+This method returns the list of publicly readable database fields for both API and UI output purposes >+ >+=cut >+ >+sub public_read_list { >+ return [ >+ 'checkin_library', 'issue_id', 'borrowernumber', >+ 'itemnumber', 'date_due', 'branchcode', >+ 'returndate', 'lastreneweddate', 'issuedate', >+ 'notedate', 'noteseen' >+ ]; >+} >+ > =head3 claim_returned > > my $return_claim = $checkout->claim_returned(); >diff --git a/t/db_dependent/Koha/Checkout.t b/t/db_dependent/Koha/Checkout.t >index e535dea8ec..45f4f87017 100755 >--- a/t/db_dependent/Koha/Checkout.t >+++ b/t/db_dependent/Koha/Checkout.t >@@ -137,3 +137,53 @@ subtest 'renewals() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'public_read_list() tests' => sub { >+ >+ $schema->storage->txn_begin; >+ >+ my @all_attrs = Koha::Checkouts->columns(); >+ my $public_attrs = >+ { map { $_ => 1 } @{ Koha::Checkout->public_read_list() } }; >+ my $mapping = Koha::Checkout->to_api_mapping; >+ >+ plan tests => scalar @all_attrs * 2; >+ >+ # Create a sample checkout >+ my $checkout = $builder->build_object( { class => 'Koha::Checkouts' } ); >+ >+ my $unprivileged_representation = $checkout->to_api( { public => 1 } ); >+ my $privileged_representation = $checkout->to_api; >+ >+ foreach my $attr (@all_attrs) { >+ my $mapped = exists $mapping->{$attr} ? $mapping->{$attr} : $attr; >+ if ( defined($mapped) ) { >+ ok( >+ exists $privileged_representation->{$mapped}, >+ "Attribute '$attr' is present when privileged" >+ ); >+ if ( exists $public_attrs->{$attr} ) { >+ ok( >+ exists $unprivileged_representation->{$mapped}, >+ "Attribute '$attr' is present when public" >+ ); >+ } else { >+ ok( >+ !exists $unprivileged_representation->{$mapped}, >+ "Attribute '$attr' is not present when public" >+ ); >+ } >+ } else { >+ ok( >+ !exists $privileged_representation->{$attr}, >+ "Unmapped attribute '$attr' is not present when privileged" >+ ); >+ ok( >+ !exists $unprivileged_representation->{$attr}, >+ "Unmapped attribute '$attr' is not present when public" >+ ); >+ } >+ } >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.39.5
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 38184
:
179294
|
179325
|
179326
| 179374 |
179375