Bugzilla – Attachment 87043 Details for
Bug 21772
Add holds and account information tab to the SCO module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21772: Add holds and account information to SCO
Bug-21772-Add-holds-and-account-information-to-SCO.patch (text/plain), 19.32 KB, created by
Josef Moravec
on 2019-03-27 08:48:23 UTC
(
hide
)
Description:
Bug 21772: Add holds and account information to SCO
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-27 08:48:23 UTC
Size:
19.32 KB
patch
obsolete
>From 70c76edacaeca23682c4794ef009dce57752d4ac Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Thu, 7 Mar 2019 15:58:41 -0300 >Subject: [PATCH] Bug 21772: Add holds and account information to SCO > >This patch introduces holds and account information to the SCO page. It >uses the introduced include files that are also used in OPAC >(opac-user.pl and opac-account.pl). > >To test: >1) Have a patron that has holds and account lines >2) Enable the SCO module >3) Use the patron's cardnumber to get to its details >=> SUCCESS: New tabs are presented, and they display holds and account >information as expected >4) Sign off :-D > >Sponsored-by: City of Portsmouth Public Library > >Signed-off-by: Sarah Cornell <sbcornell@cityofportsmouth.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 179 ++++++++++++--------- > opac/sco/sco-main.pl | 35 ++++ > 2 files changed, 135 insertions(+), 79 deletions(-) > >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 317a8d3683..68bbacf433 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 >@@ -251,87 +251,108 @@ > <div class="container-fluid"> > <div class="row-fluid"> > <div class="span12"> >- <div id="borrowerdetails"> >- [% IF ( issues_count ) %] >- <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 --> >- <thead> >- <tr> >- <th class="noshow">Checked out on</th> >- <th class="anti-the">Title</th> >- <th>Call no.</th> >- <th class="title-string">Due</th> >- <th class="nosort">Renew</th> >- [% UNLESS ( nofines ) %] >- <th>Fines</th> >- [% END %] >- </tr> >- </thead> >- <tbody> >- [% FOREACH ISSUE IN ISSUES %] >- <tr> >- <td>[% ISSUE.issuedate | html %]</td> >- <td> >- [% UNLESS ( noitemlinks ) %] >- <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE. biblionumber | uri %]">[% ISSUE.title | html %]</a> >- [% ELSE %] >- <strong>[% ISSUE.title | html %]</strong> >- [% END %] >- [% IF ( newissues.match(ISSUE.barcode)) %] >- <span class="label label-info">NEW</span> >- [% END %] >- <span class="item-details">[% ISSUE.author | html %]</span> >- ([% ISSUE.barcode | html %]) >- </td> >- <td>[% ISSUE.itemcallnumber | html %]</td> >- [% IF ( ISSUE.overdue ) %] >- <td class="overdue"><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td> >- [% ELSE %] >- <td><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td> >- [% END %] >- <td> >- <form action="/cgi-bin/koha/sco/sco-main.pl" method="post"> >- <input type="hidden" name="patronid" value="[% patronid | html %]" /> >- <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" /> >- <input type="hidden" name="newissues" value="[% newissues | html %]" /> >- [% IF ISSUE.can_be_renewed %] >- <input type="hidden" name="op" value="renew" /> >- <input type="hidden" name="confirmed" value="1" /> >- [% UNLESS ( ISSUE.renew ) %] >- <input type="submit" value="Renew item" name="confirm " class="btn renew" /> >- [% ELSE %] >- <input type="submit" value="Renew item" class="btn renew" /> >- [% END %] >- [% ELSE %] >- [% IF ISSUE.renew_error == 'auto_renew' OR ISSUE.renew_error == 'auto_too_soon' %] >- <span>This item has been scheduled for automatic renewal and cannot be renewed</span> >- [% ELSIF ISSUE.renew_error == 'onsite_checkout' %] >- <span>This is a on-site checkout, it cannot be renewed.</span> >- [% ELSE %] >- <span>No renewals allowed</span> >+ <div class="tabbable"> >+ <ul class="nav nav-tabs"> >+ <li class="active"><a href="#checkouts-tab" data-toggle="tab">Checkouts</a></li> >+ <li><a href="#holds-tab" data-toggle="tab">Holds</a></li> >+ <li><a href="#account-tab" data-toggle="tab">Fines and charges</a></li> >+ </ul> >+ <div class="tab-content"> >+ <div id="checkouts-tab" class="tab-pane active"> >+ <div id="borrowerdetails"> >+ [% IF ( issues_count ) %] >+ <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 --> >+ <thead> >+ <tr> >+ <th class="noshow">Checked out on</th> >+ <th class="anti-the">Title</th> >+ <th>Call no.</th> >+ <th class="title-string">Due</th> >+ <th class="nosort">Renew</th> >+ [% UNLESS ( nofines ) %] >+ <th>Fines</th> >+ [% END %] >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH ISSUE IN ISSUES %] >+ <tr> >+ <td>[% ISSUE.issuedate | html %]</td> >+ <td> >+ [% UNLESS ( noitemlinks ) %] >+ <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE. biblionumber | uri %]">[% ISSUE.title | html %]</a> >+ [% ELSE %] >+ <strong>[% ISSUE.title | html %]</strong> >+ [% END %] >+ [% IF ( newissues.match(ISSUE.barcode)) %] >+ <span class="label label-info">NEW</span> >+ [% END %] >+ <span class="item-details">[% ISSUE.author | html %]</span> >+ ([% ISSUE.barcode | html %]) >+ </td> >+ <td>[% ISSUE.itemcallnumber | html %]</td> >+ [% IF ( ISSUE.overdue ) %] >+ <td class="overdue"><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td> >+ [% ELSE %] >+ <td><span title="[% ISSUE.date_due | html %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td> > [% END %] >- [% IF Koha.Preference('AllowSelfCheckReturns') %] >- <input type="submit" value="Check in item" name="confirm" class="btn return" /> >- <input type="hidden" name="op" value="returnbook" /> >- <input type="hidden" name="confirmed" value="" /> >+ <td> >+ <form action="/cgi-bin/koha/sco/sco-main.pl" method="post"> >+ <input type="hidden" name="patronid" value="[% patronid | html %]" /> >+ <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" /> >+ <input type="hidden" name="newissues" value="[% newissues | html %]" /> >+ [% IF ISSUE.can_be_renewed %] >+ <input type="hidden" name="op" value="checkout" /> >+ <input type="hidden" name="confirmed" value="1" /> >+ [% UNLESS ( ISSUE.renew ) %] >+ <input type="submit" value="Renew item" name="confirm " class="btn renew" /> >+ [% ELSE %] >+ <input type="submit" value="Renew item" class="btn renew" /> >+ [% END %] >+ [% ELSE %] >+ [% IF ISSUE.renew_error == 'auto_renew' OR ISSUE.renew_error == 'auto_too_soon' %] >+ <span>This item has been scheduled for automatic renewal and cannot be renewed</span> >+ [% ELSIF ISSUE.renew_error == 'onsite_checkout' %] >+ <span>This is a on-site checkout, it cannot be renewed.</span> >+ [% ELSE %] >+ <span>No renewals allowed</span> >+ [% END %] >+ [% IF Koha.Preference('AllowSelfCheckReturns') %] >+ <input type="submit" value="Check in item" name="confirm" class="btn return" /> >+ <input type="hidden" name="op" value="returnbook" /> >+ <input type="hidden" name="confirmed" value="" /> >+ [% END %] >+ [% END %] >+ </form> >+ </td> >+ [% UNLESS ( nofines ) %] >+ <td> >+ [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %] >+ </td> > [% END %] >- [% END %] >- </form> >- </td> >- [% UNLESS ( nofines ) %] >- <td> >- [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %] >- </td> >- [% END %] >- </tr> >- [% END # / FOREACH ISSUE %] >- </tbody> >- </table> >- [% ELSE %] >- <h3>You currently have nothing checked out.</h3> >- [% END # / IF issues_count %] >- </div> <!-- / #borrowerdetails --> >+ </tr> >+ [% END # / FOREACH ISSUE %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <h3>You currently have nothing checked out.</h3> >+ [% END # / IF issues_count %] >+ </div> <!-- / #borrowerdetails --> >+ </div> >+ <div id="holds-tab" class="tab-pane"> >+ [% IF HOLDS.count > 0 %] >+ [% PROCESS 'holds-table.inc' HOLDS = HOLDS, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds, onlyinfo = 'true' %] >+ [% ELSE %] >+ <h3>You currently have no pending holds.</h3> >+ [% END %] >+ </div> >+ <div id="account-tab" class="tab-pane"> >+ [% PROCESS 'account-table.inc' %] >+ </div> >+ </div> >+ </div> > [% ELSE # IF validuser %] > <div class="sco_entry" > > <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post"> >diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl >index 9ec86422c0..458e52e57c 100755 >--- a/opac/sco/sco-main.pl >+++ b/opac/sco/sco-main.pl >@@ -272,17 +272,52 @@ if ($borrower) { > push @checkouts, $checkout; > } > >+ my $show_priority; >+ for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { >+ m/priority/ and $show_priority = 1; >+ } >+ >+ my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); >+ my $total = $patron->account->balance; >+ my $accts = Koha::Account::Lines->search( >+ { borrowernumber => $borrower->{borrowernumber} }, >+ { order_by => { -desc => 'accountlines_id' } } >+ ); >+ >+ my @accountlines; >+ while ( my $line = $accts->next ) { >+ my $accountline = $line->unblessed; >+ $accountline->{'amount'} = sprintf( "%.2f", $accountline->{'amount'} || '0.00'); >+ if ( $accountline->{'amount'} >= 0 ) { >+ $accountline->{'amountcredit'} = 1; >+ } >+ $accountline->{'amountoutstanding'} = >+ sprintf( "%.2f", $accountline->{'amountoutstanding'} || '0.00' ); >+ if ( $accountline->{'amountoutstanding'} >= 0 ) { >+ $accountline->{'amountoutstandingcredit'} = 1; >+ } >+ push @accountlines, $accountline; >+ } >+ >+ my $holds = $patron->holds; >+ > $template->param( > validuser => 1, > borrowername => $borrowername, > issues_count => scalar(@checkouts), > ISSUES => \@checkouts, >+ HOLDS => $holds, > newissues => join(',',@newissueslist), > patronid => $patronid, > patronlogin => $patronlogin, > patronpw => $patronpw, > noitemlinks => 1 , > borrowernumber => $borrower->{'borrowernumber'}, >+ SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), >+ AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), >+ showpriority => $show_priority, >+ ACCOUNT_LINES => \@accountlines, >+ total => sprintf( "%.2f", $total ), > ); > > my $patron_messages = Koha::Patron::Messages->search( >-- >2.11.0
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 21772
:
86331
|
86332
|
86333
|
86334
|
86495
|
87042
| 87043 |
87044
|
87045
|
87046
|
87047
|
87048
|
87064
|
87067