Bugzilla – Attachment 71714 Details for
Bug 18789
Send a Koha::Patron object to the templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18789: Pass a Koha::Patron object from returns.pl
Bug-18789-Pass-a-KohaPatron-object-from-returnspl.patch (text/plain), 16.63 KB, created by
Josef Moravec
on 2018-02-16 11:12:37 UTC
(
hide
)
Description:
Bug 18789: Pass a Koha::Patron object from returns.pl
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-02-16 11:12:37 UTC
Size:
16.63 KB
patch
obsolete
>From 00c4c2cf4e250fdd18415ea5c6867f709a5f5394 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 1 Jun 2017 13:14:29 -0300 >Subject: [PATCH] Bug 18789: Pass a Koha::Patron object from returns.pl > >This is a specific patch for returns.pl > >Test plan: >Do some checkin for a patron and make sure the info are correctly >displayed (and info from someone that has placed a hold on this item) > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > circ/returns.pl | 50 ++------------- > .../intranet-tmpl/prog/en/modules/circ/returns.tt | 72 +++++++++++----------- > 2 files changed, 40 insertions(+), 82 deletions(-) > >diff --git a/circ/returns.pl b/circ/returns.pl >index bd30f5c..162f8fd 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -177,11 +177,7 @@ if ( $query->param('reserve_id') ) { > itembiblionumber => $biblio->biblionumber, > iteminfo => $biblio->author, > name => $name, >- borrowernumber => $borrowernumber, >- borcnum => $patron->cardnumber, >- borfirstname => $patron->firstname, >- borsurname => $patron->surname, >- borcategory => $patron->category->description, >+ patron => $patron, > diffbranch => 1, > ); > } >@@ -293,7 +289,6 @@ if ($barcode) { > ccode => $item->ccode, > itembiblionumber => $biblio->biblionumber, > biblionumber => $biblio->biblionumber, >- borrower => $borrower, > additional_materials => $materials, > issue => $checkout, > ); >@@ -404,23 +399,8 @@ if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) { > my $patron = Koha::Patrons->find( $reserve->{'borrowernumber'} ); > my $name = $patron->surname . ", " . $patron->title . " " . $patron->firstname; > $template->param( >- # FIXME The full patron object should be passed to the template >- wname => $name, >- wborfirstname => $patron->firstname, >- wborsurname => $patron->surname, >- wborcategory => $patron->category->description, >- wbortitle => $patron->title, >- wborphone => $patron->phone, >- wboremail => $patron->email, >- streetnumber => $patron->streetnumber, >- address => $patron->address, >- address2 => $patron->address2, >- city => $patron->city, >- zipcode => $patron->zipcode, >- state => $patron->state, >- country => $patron->country, >- wborrowernumber => $reserve->{'borrowernumber'}, >- wborcnum => $patron->cardnumber, >+ wname => $name, >+ patron => $patron, > ); > } > $template->param( >@@ -454,22 +434,6 @@ if ( $messages->{'ResFound'}) { > # FIXME The full patron object should be passed to the template > found => 1, > name => $patron->surname . ", " . $patron->title . " " . $patron->firstname, >- borfirstname => $patron->firstname, >- borsurname => $patron->surname, >- borcategory => $patron->category->description, >- bortitle => $patron->title, >- borphone => $patron->phone, >- boremail => $patron->email, >- boraddress => $patron->address, >- boraddress2 => $patron->address2, >- streetnumber => $patron->streetnumber, >- city => $patron->city, >- zipcode => $patron->zipcode, >- state => $patron->state, >- country => $patron->country, >- borcnum => $patron->cardnumber, >- debarred => $patron->debarred, >- gonenoaddress => $patron->gonenoaddress, > barcode => $barcode, > destbranch => $reserve->{'branchcode'}, > borrowernumber => $reserve->{'borrowernumber'}, >@@ -580,13 +544,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { > } else { > $ri{return_overdue} = 1 if (DateTime->compare($duedate, $dropboxdate) == -1); > } >- $ri{borrowernumber} = $patron->borrowernumber; >- $ri{borcnum} = $patron->cardnumber; >- $ri{borfirstname} = $patron->firstname; >- $ri{borsurname} = $patron->surname; >- $ri{bortitle} = $patron->title; >- $ri{bornote} = $patron->borrowernotes; >- $ri{borcategorycode}= $patron->categorycode; >+ $ri{patron} = $patron, > $ri{borissuescount} = $patron->checkouts->count; > } > else { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 62878d6..6395eb5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -101,8 +101,8 @@ > [% IF return_date_was_overriden && Borrowers.IsDebarred( borrower ) %] > <div id="restricted_backdated" class="dialog message"> > <h3> >- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]"> >- [% borrower.firstname %] [% borrower.surname %] >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]"> >+ [% patron.firstname %] [% patron.surname %] > </a> > is restricted. Please verify this patron should still be restricted. > </h3> >@@ -125,13 +125,13 @@ > <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p> > <button type="submit" class="openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber %]&&branchcode=[% TransferWaitingAt %]&op=slip"><i class="fa fa-print"></i> Print transfer slip</button> > <button class="deny" type="submit" onclick="window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&canceltransfer=1'"><i class="fa fa-times"></i> Cancel transfer</button> >-[% IF ( wborcnum ) %]<h5>Hold for:</h5> >+[% IF ( patron.cardnumber ) %]<h5>Hold for:</h5> > <ul> >- <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]"> >- [% borsurname %], [% borfirstname %]</a> ([% borcnum %]) <span class="patron-category"> - [% wborcategory %]</span> </li> >+ <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]"> >+ [% patron.surname %], [% patron.firstname %]</a> ([% patron.cardnumber %]) <span class="patron-category"> - [% patron.category.description %]</span> </li> > [% INCLUDE display_holdpatron_address %] >- [% IF ( wborphone ) %]<li>[% wborphone %]</li>[% END %] >- [% IF ( wboremail ) %]<li><a id="boremail" href="mailto:[% wboremail %]">[% wboremail %]</a></li>[% END %] >+ [% IF ( patron.phone ) %]<li>[% patron.phone %]</li>[% END %] >+ [% IF ( patron.email ) %]<li><a id="boremail" href="mailto:[% patron.email %]">[% patron.email %]</a></li>[% END %] > </ul> > > <form method="post" action="returns.pl" class="confirm"> >@@ -140,7 +140,7 @@ > <input type="hidden" name="WT-From" value="[% wtransfertFrom %]" /> > <button type="submit" class="approve"><i class="fa fa-check"></i> Confirm</button> > <input type="hidden" name="print_slip" value="0" /> >- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >+ <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" /> > <input type="hidden" name="biblionumber" value="[% biblionumber %]" /> > <button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit();"><i class="fa fa-print"></i> Print slip and confirm</button> > <input type="hidden" name="return_date_override" value="[% return_date_override %]" /> >@@ -173,23 +173,23 @@ > <h4>Hold for:</h4> > <ul> > <li> >- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borsurname %], [% borfirstname %]</a> ([% borcnum %]) >- <span class="patron-category"> - [% borcategory %]</span> >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]">[% patron.surname %], [% patron.firstname %]</a> ([% patron.cardnumber %]) >+ <span class="patron-category"> - [% patron.category.description %]</span> > </li> > [% INCLUDE display_holdpatron_address %] >- [% IF ( borphone ) %] >- <li> [% borphone %]</li> >+ [% IF ( patron.phone ) %] >+ <li> [% patron.phone %]</li> > [% END %] > >- [% IF ( boremail ) %] >- <li><a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a></li> >+ [% IF ( patron.email ) %] >+ <li><a id="boremail" href="mailto:[% patron.email %]">[% patron.email %]</a></li> > [% END %] > >- [% IF ( debarred ) %] >+ [% IF ( patron.debarred ) %] > <li class="error">Patron is RESTRICTED</li> > [% END %] > >- [% IF ( gonenoaddress ) %] >+ [% IF ( patron.gonenoaddress ) %] > <li class="error">Patron's address is in doubt</li> > [% END %] > </ul> >@@ -207,7 +207,7 @@ > [% END %] > > <input type="hidden" name="itemnumber" value="[% itemnumber %]" /> >- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >+ <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" /> > <input type="hidden" name="biblionumber" value="[% itembiblionumber %]" /> > <input type="hidden" name="reserve_id" value="[% reserve_id %]" /> > <input type="hidden" name="diffBranch" value="[% destbranch %]" /> >@@ -248,12 +248,12 @@ > <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p> > <h4>Hold for: </h4> > <ul> >- <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borsurname %], [% borfirstname %]</a> ([% borcnum %]) <span class="patron-category"> - [% wborcategory %]</span> </li> >+ <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]">[% patron.surname %], [% patron.firstname %]</a> ([% patron.cardnumber %]) <span class="patron-category"> - [% patron.category.description %]</span> </li> > [% INCLUDE display_holdpatron_address %] >- [% IF ( borphone ) %]<li>[% borphone %]</li>[% END %] >- [% IF ( boremail ) %]<li>[% IF ( transfertodo ) %][% boremail %][% ELSE %]<a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a>[% END %]</li>[% END %] >-[% IF ( debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %] >-[% IF ( gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %] >+ [% IF ( patron.phone ) %]<li>[% patron.phone %]</li>[% END %] >+ [% IF ( patron.email ) %]<li>[% IF ( transfertodo ) %][% patron.email %][% ELSE %]<a id="boremail" href="mailto:[% patron.email %]">[% patron.email %]</a>[% END %]</li>[% END %] >+[% IF ( patron.debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %] >+[% IF ( patron.gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %] > </ul> > [% IF ( transfertodo ) %] > <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) %]</h4> >@@ -264,7 +264,7 @@ > <form method="post" action="returns.pl" class="confirm"> > <button type="submit" class="approve"><i class="fa fa-check"></i> Confirm</button> > <input type="hidden" name="print_slip" value="0" /> >- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >+ <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" /> > <input type="hidden" name="biblionumber" value="[% itembiblionumber %]" /> > <button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit();"><i class="fa fa-print"></i> Print slip and continue</button> > [% FOREACH inputloo IN inputloop %] >@@ -368,25 +368,25 @@ > [% END %] > <h5>Hold for:</h5> > <li> >- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]"> >- [% borsurname %], [% borfirstname %] >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]"> >+ [% patron.surname %], [% patron.firstname %] > </a> >- ([% borcnum %]) >- <span class="patron-category"> - [% borcategory %]</span> >+ ([% patron.cardnumber %]) >+ <span class="patron-category"> - [% patron.category.description %]</span> > </li> > > [% INCLUDE display_holdpatron_address %] > >- [% IF ( borphone ) %] >- <li>[% borphone %]</li> >+ [% IF ( patron.phone ) %] >+ <li>[% patron.phone %]</li> > [% END %] > >- [% IF ( boremail ) %] >+ [% IF ( patron.email ) %] > <li> > [% IF ( transfertodo ) %] >- [% boremail %] >+ [% patron.email %] > [% ELSE %] >- <a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a> >+ <a id="boremail" href="mailto:[% patron.email %]">[% patron.email %]</a> > [% END %] > </li> > [% END %] >@@ -395,11 +395,11 @@ > [% INCLUDE display_bormessagepref %] > [% END %] > >- [% IF ( debarred ) %] >+ [% IF ( patron.debarred ) %] > <li class="error">Patron is RESTRICTED</li> > [% END %] > >- [% IF ( gonenoaddress ) %] >+ [% IF ( patron.gonenoaddress ) %] > <li class="error">Patron's address is in doubt</li> > [% END %] > >@@ -419,7 +419,7 @@ > [% END %] > > <input type="hidden" name="itemnumber" value="[% itemnumber %]" /> >- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >+ <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" /> > <input type="hidden" name="biblionumber" value="[% itembiblionumber %]" /> > <input type="hidden" name="reserve_id" value="[% reserve_id %]" /> > <input type="hidden" name="diffBranch" value="[% destbranch %]" /> >@@ -711,7 +711,7 @@ > $(".modal").on('hidden.bs.modal', function (e) { $("#barcode").focus(); }); > > [% IF print_slip %] >- Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&biblionumber=[% biblionumber %]'); >+ Dopop('hold-transfer-slip.pl?borrowernumber=[% patron.borrowernumber %]&biblionumber=[% biblionumber %]'); > [% END %] > > var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'returns', 'checkedintable', 'json' ) %] >-- >2.1.4
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 18789
:
64211
|
64212
|
64213
|
64214
|
64215
|
64216
|
64218
|
64219
|
64221
|
64229
|
71301
|
71302
|
71303
|
71304
|
71305
|
71306
|
71307
|
71308
|
71309
|
71310
|
71311
|
71485
|
71486
|
71487
|
71488
|
71489
|
71490
|
71491
|
71492
|
71493
|
71494
|
71495
|
71496
|
71679
|
71680
|
71681
|
71682
|
71683
|
71684
|
71685
|
71686
|
71687
|
71688
|
71689
|
71690
|
71691
|
71713
| 71714 |
71715
|
71716
|
71717
|
71718
|
71719
|
71720
|
71721
|
71722
|
71723
|
71724
|
71725
|
71726
|
71727
|
71728
|
71729
|
71730
|
71731
|
71732
|
71733
|
71734
|
71735
|
71736
|
71827
|
71838
|
71841
|
73293
|
73890
|
75237