From ab47e46ea0ade643b308a8b00708d57995c57050 Mon Sep 17 00:00:00 2001 From: Jonathan Druart 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 Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- circ/returns.pl | 50 ++----------- .../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 bd30f5cb64..162f8fdfc5 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 62878d64dd..6395eb5413 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 ) %]

- - [% borrower.firstname %] [% borrower.surname %] + + [% patron.firstname %] [% patron.surname %] is restricted. Please verify this patron should still be restricted.

@@ -125,13 +125,13 @@

[% itembarcode |html %]: [% title |html %]

-[% IF ( wborcnum ) %]
Hold for:
+[% IF ( patron.cardnumber ) %]
Hold for:
@@ -140,7 +140,7 @@ - + @@ -173,23 +173,23 @@

Hold for:

  • - [% borsurname %], [% borfirstname %] ([% borcnum %]) - - [% borcategory %] + [% patron.surname %], [% patron.firstname %] ([% patron.cardnumber %]) + - [% patron.category.description %]
  • [% INCLUDE display_holdpatron_address %] - [% IF ( borphone ) %] -
  • [% borphone %]
  • + [% IF ( patron.phone ) %] +
  • [% patron.phone %]
  • [% END %] - [% IF ( boremail ) %] -
  • [% boremail %]
  • + [% IF ( patron.email ) %] +
  • [% patron.email %]
  • [% END %] - [% IF ( debarred ) %] + [% IF ( patron.debarred ) %]
  • Patron is RESTRICTED
  • [% END %] - [% IF ( gonenoaddress ) %] + [% IF ( patron.gonenoaddress ) %]
  • Patron's address is in doubt
  • [% END %]
@@ -207,7 +207,7 @@ [% END %] - + @@ -248,12 +248,12 @@

[% itembarcode |html %]: [% title |html %]

Hold for:

    -
  • [% borsurname %], [% borfirstname %] ([% borcnum %]) - [% wborcategory %]
  • +
  • [% patron.surname %], [% patron.firstname %] ([% patron.cardnumber %]) - [% patron.category.description %]
  • [% INCLUDE display_holdpatron_address %] - [% IF ( borphone ) %]
  • [% borphone %]
  • [% END %] - [% IF ( boremail ) %]
  • [% IF ( transfertodo ) %][% boremail %][% ELSE %][% boremail %][% END %]
  • [% END %] -[% IF ( debarred ) %]
  • Patron is RESTRICTED
  • [% END %] -[% IF ( gonenoaddress ) %]
  • Patron's address is in doubt
  • [% END %] + [% IF ( patron.phone ) %]
  • [% patron.phone %]
  • [% END %] + [% IF ( patron.email ) %]
  • [% IF ( transfertodo ) %][% patron.email %][% ELSE %][% patron.email %][% END %]
  • [% END %] +[% IF ( patron.debarred ) %]
  • Patron is RESTRICTED
  • [% END %] +[% IF ( patron.gonenoaddress ) %]
  • Patron's address is in doubt
  • [% END %]
[% IF ( transfertodo ) %]

Transfer to: [% Branches.GetName( destbranch ) %]

@@ -264,7 +264,7 @@ - + [% FOREACH inputloo IN inputloop %] @@ -368,25 +368,25 @@ [% END %]
Hold for:
  • - - [% borsurname %], [% borfirstname %] + + [% patron.surname %], [% patron.firstname %] - ([% borcnum %]) - - [% borcategory %] + ([% patron.cardnumber %]) + - [% patron.category.description %]
  • [% INCLUDE display_holdpatron_address %] - [% IF ( borphone ) %] -
  • [% borphone %]
  • + [% IF ( patron.phone ) %] +
  • [% patron.phone %]
  • [% END %] - [% IF ( boremail ) %] + [% IF ( patron.email ) %]
  • [% IF ( transfertodo ) %] - [% boremail %] + [% patron.email %] [% ELSE %] - [% boremail %] + [% patron.email %] [% END %]
  • [% END %] @@ -395,11 +395,11 @@ [% INCLUDE display_bormessagepref %] [% END %] - [% IF ( debarred ) %] + [% IF ( patron.debarred ) %]
  • Patron is RESTRICTED
  • [% END %] - [% IF ( gonenoaddress ) %] + [% IF ( patron.gonenoaddress ) %]
  • Patron's address is in doubt
  • [% END %] @@ -419,7 +419,7 @@ [% END %] - + @@ -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.39.5