From f4eefc05bd596bee0107c4230999e78439a83a02 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 --- 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 a7b741b..e7654a5 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -178,11 +178,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, ); } @@ -294,7 +290,6 @@ if ($barcode) { ccode => $item->ccode, itembiblionumber => $biblio->biblionumber, biblionumber => $biblio->biblionumber, - borrower => $borrower, additional_materials => $materials, issue => $checkout, ); @@ -405,23 +400,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( @@ -455,22 +435,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'}, @@ -581,13 +545,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 2d683e7..abdb99e 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.10.2