Bugzilla – Attachment 179294 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.90 KB, created by
Aleisha Amohia
on 2025-03-13 23:36:42 UTC
(
hide
)
Description:
Bug 38184: Show due date on OpacTrustedCheckout modal
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2025-03-13 23:36:42 UTC
Size:
3.90 KB
patch
obsolete
>From 686b301b5f09e68b68f59e6455cb4a8f4883c927 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 >--- > Koha/Checkout.pm | 15 ++++++++++ > t/db_dependent/Koha/Checkout.t | 52 +++++++++++++++++++++++++++++++++- > 2 files changed, 66 insertions(+), 1 deletion(-) > >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index 31ec7a5d1a4..3c8218cea0f 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 0321906d30f..cc6149642ad 100755 >--- a/t/db_dependent/Koha/Checkout.t >+++ b/t/db_dependent/Koha/Checkout.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use t::lib::TestBuilder; > > use Koha::Database; >@@ -136,3 +136,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