Bugzilla – Attachment 151363 Details for
Bug 30979
Add ability for OPAC users to checkout to themselves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30979: Always show self-checkout when preference enabled
Bug-30979-Always-show-self-checkout-when-preferenc.patch (text/plain), 4.25 KB, created by
Martin Renvoize (ashimema)
on 2023-05-17 17:12:26 UTC
(
hide
)
Description:
Bug 30979: Always show self-checkout when preference enabled
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-05-17 17:12:26 UTC
Size:
4.25 KB
patch
obsolete
>From 23ae5ffe2765591cda5563f6a7fa40743e3d0668 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 17 Jan 2023 14:14:36 +0000 >Subject: [PATCH] Bug 30979: Always show self-checkout when preference enabled > >This patch updates the display logic such that if the truested >self-checkout option is enabled we always show the checkout button and >prompt a login when no user is found. > >Signed-off-by: Silvia Meakins <smeakins@eso.org> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../bootstrap/en/includes/masthead.inc | 2 +- > .../bootstrap/en/includes/opac-bottom.inc | 4 ++-- > .../opac-tmpl/bootstrap/js/modals/checkout.js | 24 +++++++++++++++++++ > 3 files changed, 27 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 20b34bce95..685d72b499 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -81,7 +81,7 @@ > </div> <!-- / .dropdown-menu --> > </li> <!-- / .nav-item.dropdown --> > [% END # / IF virtualshelves %] >- [% IF ( Koha.Preference( 'OpacTrustedCheckout' ) && loggedinusername ) %] >+ [% IF Koha.Preference( 'OpacTrustedCheckout' ) %] > <li class="nav-item"> > <a href="#" class="nav-link" title="Self check out" id="comenulink" role="button" data-toggle="modal" data-target="#checkoutModal"> > <i id="checkout-icon" class="fa fa-barcode fa-icon-black" aria-hidden="true"></i> <span class="checkout-label">Self checkout</span> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 65360234cf..518aed4e24 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -117,7 +117,7 @@ > [% END # /IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %] > [% END # / UNLESS is_popup %] > >-[% IF ( Koha.Preference( 'OpacTrustedCheckout' ) && loggedinusername ) %] >+[% IF Koha.Preference( 'OpacTrustedCheckout' ) %] > [% INCLUDE 'modals/checkout.inc' %] > [% END %] > >@@ -311,7 +311,7 @@ $(document).ready(function() { > </script> > [% END %] > [% END %] >-[% IF ( Koha.Preference( 'OpacTrustedCheckout' ) && loggedinusername ) %] >+[% IF Koha.Preference( 'OpacTrustedCheckout' ) %] > [% Asset.js("js/modals/checkout.js") | $raw %] > [% END %] > [% KohaPlugins.get_plugins_opac_js | $raw %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js b/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js >index 0c666c55e7..6261803076 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js >@@ -61,6 +61,30 @@ $(document).ready(function() { > $('#checkoutConfirm').replaceWith('<button type="submit" id="checkoutSubmit" class="btn btn-primary">Submit</button>'); > }; > >+ // Before modal show, check login >+ $('#checkoutModal').on('show.bs.modal', function(e) { >+ // Redirect to login modal if not logged in >+ if (logged_in_user_id === "") { >+ let url = new URL(window.location.href); >+ url.searchParams.append('modal','checkout'); >+ $('#modalAuth').append('<input type="hidden" name="return" value="' + url.href +'" />'); >+ $('#loginModal').modal('show'); >+ return false; >+ } >+ }); >+ >+ // Detect that we were redirected here after login and re-open modal >+ let urlParams = new URLSearchParams(window.location.search); >+ if (urlParams.has('modal')) { >+ let modal = urlParams.get('modal'); >+ history.replaceState && history.replaceState( >+ null, '', location.pathname + location.search.replace(/[\?&]modal=[^&]+/, '').replace(/^&/, '?') >+ ); >+ if (modal == 'checkout') { >+ $("#checkoutModal").modal('show'); >+ } >+ } >+ > // On modal show, clear any prior results and set focus > $('#checkoutModal').on('shown.bs.modal', function(e) { > $('#checkoutResults').replaceWith('<div id="checkoutResults"></div>'); >-- >2.40.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 30979
:
139131
|
139132
|
139133
|
139134
|
141274
|
141275
|
141276
|
141277
|
141278
|
141279
|
141300
|
145264
|
145265
|
145266
|
145267
|
145268
|
145277
|
145280
|
145281
|
145282
|
145283
|
145284
|
145285
|
145620
|
145621
|
145622
|
145623
|
145624
|
145625
|
145626
|
145627
|
145628
|
145629
|
145630
|
150867
|
150868
|
150869
|
150870
|
150871
|
150872
|
150873
|
150874
|
150875
|
150876
|
150877
|
150878
|
150879
|
150880
|
150881
|
150882
|
150883
|
150884
|
150885
|
150886
|
150887
|
150888
|
150889
|
150967
|
150968
|
150969
|
150970
|
150971
|
150972
|
150973
|
150974
|
151254
|
151255
|
151256
|
151257
|
151258
|
151259
|
151260
|
151261
|
151358
|
151359
|
151360
|
151361
|
151362
|
151363
|
151364
|
151365
|
151368
|
151369
|
151370
|
151371
|
151372
|
151373
|
151374
|
151375
|
151376
|
152789
|
152790
|
152791
|
152792
|
152793
|
152794
|
152795
|
152796
|
152797
|
153459
|
153460
|
153461
|
153462
|
153463
|
153464
|
153465
|
153466
|
153467
|
153500
|
153501
|
153502
|
153503