Bugzilla – Attachment 154508 Details for
Bug 34557
Add option to prevent loading a patron's checkouts on the SCO
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34557: Add SCOLoadCheckoutsByDefault system preference
Bug-34557-Add-SCOLoadCheckoutsByDefault-system-pre.patch (text/plain), 16.81 KB, created by
Nick Clemens (kidclamp)
on 2023-08-17 09:19:41 UTC
(
hide
)
Description:
Bug 34557: Add SCOLoadCheckoutsByDefault system preference
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-08-17 09:19:41 UTC
Size:
16.81 KB
patch
obsolete
>From a0b20e5cb23e1100f70747ed904cdeeba951ffe6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 17 Aug 2023 09:10:54 +0000 >Subject: [PATCH] Bug 34557: Add SCOLoadCheckoutsByDefault system preference > >This patch adds a enw system preference SCOLoadCheckoutsByDefault > >When enabled, a patron's list o fcurrent checkouts will be loaded when the sign in to the SCO >module. If disabled, they will see link to load their checkouts. In either case, a new section >is added to the SCO to show a brief display of the last checked out it > >To test: >1 - Enable WebBasedSelfCheck system preference >2 - Browse to: > http://localhost:8080/cgi-bin/koha/sco/sco-main.pl >3 - Sign in the SCO user (or enable AutoSelfCheck) >4 - Sign in as a user with several items checked out >5 - Confirm you see a list of items checked out >6 - Apply patches, updatedatabase, restart_all >7 - 'Finish' and login patron to SCO again >8 - Confirm you still see the list >9 - 'Finish' >10 - Chenge the system preference >11 - Sign in to SCO, confirm checkouts do not load >12 - Confirm you see 'Load your checkouts' link >13 - Check an item out >14 - Confirm you see the last checkout, but not a list >15 - Attempt to checkout an item that cannot be checked out >16 - Confirm "Return to account summary" does not load checkouts >17 - Click "Load your checkouts" >18 - Confirm they load >19 - Check out another item, confrim they remain and are updated >20 - Checkout an item that cannot be issued >21 - Confirm 'Return to account summary' loads the checkouts again >--- > .../data/mysql/atomicupdate/bug_34557.pl | 18 +++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/circulation.pref | 6 +++ > .../bootstrap/en/modules/sco/sco-main.tt | 27 +++++++++++++ > opac/sco/sco-main.pl | 40 ++++++++++--------- > 5 files changed, 74 insertions(+), 18 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_34557.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_34557.pl b/installer/data/mysql/atomicupdate/bug_34557.pl >new file mode 100755 >index 00000000000..213bc8484d6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_34557.pl >@@ -0,0 +1,18 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "34557", >+ description => "Add system preference SCOLoadCheckoutsByDefault", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Do you stuffs here >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo') >+ }); >+ >+ say $out "Added new system preference 'SCOLoadCheckoutsByDefault'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 30197591a8b..9d747b17023 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -640,6 +640,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'), > ('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'), > ('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'), >+('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'), > ('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'), > ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'), > ('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 55feb4d4442..f56d2466436 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -1128,6 +1128,12 @@ Circulation: > type: textarea > syntax: css > class: code >+ - >+ - pref: SCOLoadCheckoutsByDefault >+ choices: >+ 1: Show >+ 0: "Don't show" >+ - "the patron's list of current checkouts by default when they log in to the self checkout module." > - > - pref: ShowPatronImageInWebBasedSelfCheck > choices: >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >index 003c792402f..c0f34ab8e20 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >@@ -98,6 +98,7 @@ > <input type="hidden" name="op" value="returnbook" /> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> > <input type="hidden" name="barcode" value="[% barcode | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button> > </form> >@@ -108,6 +109,7 @@ > <input type="hidden" name="op" value="" /> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> > <input type="hidden" name="barcode" value="[% barcode | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > <input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" /> > </form> >@@ -127,6 +129,7 @@ > <input type="hidden" name="op" value="returnbook" /> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> > <input type="hidden" name="barcode" value="[% barcode | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="confirmed" value="" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button> >@@ -139,6 +142,7 @@ > <input type="hidden" name="op" value="renew" /> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> > <input type="hidden" name="barcode" value="[% barcode | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="confirmed" value="1" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > <button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button> >@@ -149,6 +153,7 @@ > <input type="hidden" name="op" value="renew" /> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> > <input type="hidden" name="barcode" value="[% barcode | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="confirmed" value="1" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > <button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button> >@@ -159,6 +164,7 @@ > <legend class="sr-only">Cancel</legend> > <input type="hidden" name="op" value="" /> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > <button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button> > </form> >@@ -263,6 +269,7 @@ > <button type="button" id="logout_form" class="btn btn-info"><i class="fa fa-check" aria-hidden="true"></i> Finish</button> > <input type="hidden" name="op" value="checkout" /> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > </div> > </div> <!-- /.row --> >@@ -299,7 +306,23 @@ > <div class="tab-content"> > <div id="checkouts-tab" class="tab-pane show active" aria-labelledby="checkouts"> > <div id="borrowerdetails"> >+ [% IF ( new_issue ) %] >+ <div class="lastchecked"> >+ <p> >+ <strong>Checked out: </strong> >+ [% new_issue.item.biblio.title | html %] ([% new_issue.item.barcode | html %]). >+ >+ [% IF new_issue.item.is_bundle %] >+ [% SET bundle_items_count = new_issue.item.bundle_items.count %] >+ [% tnx('Bundle of {count} item', 'Bundle of {count} items', bundle_items_count, { count = bundle_items_count }) | html %]. >+ [% END %] >+ >+ Due on [% new_issue.date_due | $KohaDates as_due_date => 1 %] >+ </p> >+ </div> >+ [% END %] > [% IF ( issues_count ) %] >+ [% IF ( Koha.Preference('SCOLoadCheckoutsByDefault') || load_checkouts ) %] > <table id="loanTable" class="table table-bordered table-striped"> > <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption> > <!-- ISSUES TABLE ROWS --> >@@ -345,6 +368,7 @@ > <form action="/cgi-bin/koha/sco/sco-main.pl" method="post"> > <legend class="sr-only">Issue renews</legend> > <input type="hidden" name="patronid" value="[% patronid | html %]" /> >+ <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" /> > <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" /> > <input type="hidden" name="newissues" value="[% newissues | html %]" /> > [% IF ISSUE.can_be_renewed %] >@@ -384,6 +408,9 @@ > [% END # / FOREACH ISSUE %] > </tbody> > </table> >+ [% ELSE %] >+ <a href="?load_checkouts=1">Load your checkouts</a> >+ [% END # / IF ( Koha.preference('SCOLoadCheckoutsByDefault') || load_checkouts ) %] > [% ELSE %] > <h3>You currently have nothing checked out.</h3> > [% END # / IF issues_count %] >diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl >index 9f70a415cc4..53b5d0e1549 100755 >--- a/opac/sco/sco-main.pl >+++ b/opac/sco/sco-main.pl >@@ -93,13 +93,14 @@ if (defined C4::Context->preference('SCOAllowCheckin')) { > } > > my $issuerid = $loggedinuser; >-my ($op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = ( >- $query->param("op") || '', >- $query->param("patronlogin")|| '', >- $query->param("patronpw") || '', >- $query->param("barcode") || '', >- $query->param("confirmed") || '', >- $query->param("newissues") || '', >+my ( $op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues, $load_checkouts ) = ( >+ $query->param("op") || '', >+ $query->param("patronlogin") || '', >+ $query->param("patronpw") || '', >+ $query->param("barcode") || '', >+ $query->param("confirmed") || '', >+ $query->param("newissues") || '', >+ $query->param("load_checkouts") || '', > ); > > my $jwt = $query->cookie('JWT'); >@@ -245,8 +246,8 @@ elsif ( $patron && ( $op eq 'checkout' ) ) { > )->count; > } > >- AddIssue( $patron->unblessed, $barcode ); >- $template->param( issued => 1 ); >+ my $new_issue = AddIssue( $patron->unblessed, $barcode ); >+ $template->param( issued => 1, new_issue => $new_issue ); > push @newissueslist, $barcode; > > if ( $hold_existed ) { >@@ -298,15 +299,17 @@ if ( $patron && ( $op eq 'renew' ) ) { > > if ( $patron) { > my $borrowername = sprintf "%s %s", ($patron->firstname || ''), ($patron->surname || ''); >- my $pending_checkouts = $patron->pending_checkouts; > my @checkouts; >- while ( my $c = $pending_checkouts->next ) { >- my $checkout = $c->unblessed_all_relateds; >- my ($can_be_renewed, $renew_error) = CanBookBeRenewed( $patron, $c ); >- $checkout->{can_be_renewed} = $can_be_renewed; # In the future this will be $checkout->can_be_renewed >- $checkout->{renew_error} = $renew_error; >- $checkout->{overdue} = $c->is_overdue; >- push @checkouts, $checkout; >+ my $pending_checkouts = $patron->pending_checkouts; >+ if ( C4::Context->preference('SCOLoadCheckoutsByDefault') || $load_checkouts ) { >+ while ( my $c = $pending_checkouts->next ) { >+ my $checkout = $c->unblessed_all_relateds; >+ my ( $can_be_renewed, $renew_error ) = CanBookBeRenewed( $patron, $c ); >+ $checkout->{can_be_renewed} = $can_be_renewed; # In the future this will be $checkout->can_be_renewed >+ $checkout->{renew_error} = $renew_error; >+ $checkout->{overdue} = $c->is_overdue; >+ push @checkouts, $checkout; >+ } > } > > my $show_priority; >@@ -328,7 +331,7 @@ if ( $patron) { > $template->param( > validuser => 1, > borrowername => $borrowername, >- issues_count => scalar(@checkouts), >+ issues_count => scalar(@checkouts) || $pending_checkouts->count(), > ISSUES => \@checkouts, > HOLDS => $holds, > newissues => join(',',@newissueslist), >@@ -336,6 +339,7 @@ if ( $patron) { > patronpw => $patronpw, > waiting_holds_count => $waiting_holds_count, > noitemlinks => 1 , >+ load_checkouts => $load_checkouts, > borrowernumber => $patron->borrowernumber, > SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), > AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), >-- >2.30.2
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 34557
:
154508
|
154544
|
154587
|
154590
|
154591
|
156570
|
156571
|
158368
|
158369
|
158370
|
158377
|
158378
|
158379