Bugzilla – Attachment 62019 Details for
Bug 18403
Hide patron information if not part of the logged in user library group
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18403: Use patron-title.inc when hidepatronname is used
Bug-18403-Use-patron-titleinc-when-hidepatronname-.patch (text/plain), 14.98 KB, created by
Jonathan Druart
on 2017-04-10 21:33:08 UTC
(
hide
)
Description:
Bug 18403: Use patron-title.inc when hidepatronname is used
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-04-10 21:33:08 UTC
Size:
14.98 KB
patch
obsolete
>From 6a3e2ea41aced2ec194aafa07e922eaaeff4a48c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Apr 2017 16:43:41 -0300 >Subject: [PATCH] Bug 18403: Use patron-title.inc when hidepatronname is used > >There is already a HidePatronName syspref to hide patron's information >on bibliographic >record detail pages and the hold list. > >Test plan: >With the HidePatronName enabled, make sure the patron's information are >hidden from >the catalogue and hold list pages. If the logged in user is not allowed >to see the >patron's info, no link and no cardnumber will be displayed >With he HidePatronName disabled, make sure the patron's information are >displayed >if the logged in user is allowed to see the patron's info. > >Technical note: >This patch improves the existing patron-title.inc include file to >display patron's >information. Using it everywhere patron's details are displayed will >permit to >homogenise the way they are displayed. The file takes now a patron >object (what >should be, in the future, the only way to use it), that way we can call >the new >method on it to know if patron's information can be shown by the logged >in used. > >NOTE: I am not sure this syspref makes sense anymore. Should not we >remove it? >--- > Koha/Hold.pm | 1 + > catalogue/detail.pl | 13 +--- > catalogue/moredetail.pl | 13 +--- > .../prog/en/includes/patron-title.inc | 85 ++++++++++++++++------ > .../prog/en/modules/catalogue/detail.tt | 22 ++---- > .../prog/en/modules/reserve/request.tt | 8 +- > reserve/request.pl | 9 +-- > 7 files changed, 77 insertions(+), 74 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index ba75a52..3b6b804 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -252,6 +252,7 @@ Returns the related Koha::Patron object for this Hold > > =cut > >+# FIXME Should be renamed with ->patron > sub borrower { > my ($self) = @_; > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index c9f355b..486bddf 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -252,11 +252,6 @@ foreach my $item (@items) { > $itemfields{$_} = 1 if ( $item->{$_} ); > } > >- if (C4::Context->preference('HidePatronName')){ >- $item->{'hidepatronname'} = 1; >- } >- >- > # checking for holds > my $item_object = Koha::Items->find( $item->{itemnumber} ); > my $holds = $item_object->holds_placed_before_today; >@@ -264,15 +259,15 @@ foreach my $item (@items) { > my $patron = Koha::Patrons->find( $first_hold->borrowernumber ); > $item->{backgroundcolor} = 'reserved'; > $item->{reservedate} = $first_hold->reservedate; >- $item->{ReservedForBorrowernumber} = $first_hold->borrowernumber; >- $item->{ReservedForSurname} = $patron->surname; >- $item->{ReservedForFirstname} = $patron->firstname; >+ $item->{ReservedFor} = $patron, > $item->{ExpectedAtLibrary} = $first_hold->branchcode; >- $item->{Reservedcardnumber} = $patron->cardnumber; > # Check waiting status > $item->{waitingdate} = $first_hold->waitingdate; > } > >+ if ( my $checkout = $item_object->checkout ) { >+ $item->{CheckedOutFor} = $checkout->patron; >+ } > > # Check the transit status > my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($item->{itemnumber}); >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index 338c64b..9a472d4 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -61,8 +61,6 @@ if($query->cookie("holdfor")){ > ); > } > >-my $hidepatronname = C4::Context->preference("HidePatronName"); >- > # get variables > > my $biblionumber=$query->param('biblionumber'); >@@ -186,14 +184,10 @@ foreach my $item (@items){ > $item->{'issue'}= 0; > } > >- unless ($hidepatronname) { >- if ( $item->{'borrowernumber'} ) { >- my $curr_borrower = Koha::Patrons->find( $item->{borrowernumber} ); >- $item->{borrowerfirstname} = $curr_borrower->firstname; >- $item->{borrowersurname} = $curr_borrower->surname; >- } >+ if ( $item->{'borrowernumber'} ) { >+ my $curr_borrower = Koha::Patrons->find( $item->{borrowernumber} ); >+ $item->{patron} = $curr_borrower; > } >- > } > > my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => { not => undef } }); >@@ -224,7 +218,6 @@ $template->param( > itemnumber => $itemnumber, > z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)), > subtitle => $subtitle, >- hidepatronname => $hidepatronname, > ); > $template->param(ONLY_ONE => 1) if ( $itemnumber && $showncount != @items ); > $template->{'VARS'}->{'searchid'} = $query->param('searchid'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc >index caf45d6..89dfc81 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc >@@ -1,27 +1,64 @@ >-[%- IF ( borrower.borrowernumber ) %] >- [%- IF borrower.category_type == 'I' %] >- [%- borrower.surname | html %] [% IF borrower.othernames %] ([% borrower.othernames | html %]) [% END %] >- [%- ELSE %] >- [%- IF invert_name %] >- [%- borrower.surname | html %], [% borrower.firstname | html %] [% IF borrower.othernames %] ([% borrower.othernames | html %]) [% END %] >- [%- ELSE %] >- [%- borrower.firstname | html %] [% IF borrower.othernames %] ([% borrower.othernames | html %]) [% END %] [% borrower.surname | html %] >- [%- END -%] >+[%- USE Koha -%] >+[%- USE Branches -%] >+[%- SET data = {} -%] >+[%- IF patron -%] >+ [%- SET data.category_type = patron.category.category_type -%] >+ [%- SET data.surname = patron.surname -%] >+ [%- SET data.othernames = patron.othernames -%] >+ [%- SET data.surname = patron.surname -%] >+ [%- SET data.firstname = patron.firstname -%] >+ [%- SET data.cardnumber = patron.cardnumber -%] >+ [%- SET data.borrowernumber = patron.borrowernumber -%] >+[%- ELSIF ( borrower.borrowernumber ) -%] >+ [%- SET data.category_type = borrower.category_type -%] >+ [%- SET data.surname = borrower.surname -%] >+ [%- SET data.othernames = borrower.othernames -%] >+ [%- SET data.surname = borrower.surname -%] >+ [%- SET data.firstname = borrower.firstname -%] >+ [%- SET data.cardnumber = borrower.cardnumber -%] >+ [%- SET data.borrowernumber = borrower.borrowernumber -%] >+[%- ELSIF ( borrowernumber ) -%] >+ [%- SET data.category_type = category_type -%] >+ [%- SET data.surname = surname -%] >+ [%- SET data.othernames = othernames -%] >+ [%- SET data.surname = surname -%] >+ [%- SET data.firstname = firstname -%] >+ [%- SET data.cardnumber = cardnumber -%] >+ [%- SET data.borrowernumber = borrowernumber -%] >+[%- END -%] >+[%- SET display_patron_name = 1 -%] >+[%- SET display_cardnumber = 1 -%] >+[%- IF hide_patron_infos_if_needed %] [%# Should only be set if patron is set -%] >+ [%- SET can_see_patron_infos = logged_in_user.can_see_patron_infos( patron ) -%] >+ [%- UNLESS can_see_patron_infos -%] >+ [%- SET display_patron_name = 0 -%] >+ [%- SET display_cardnumber = 0 -%] >+ [%- ELSIF Koha.Preference('HidePatronName') -%] >+ [%- SET display_patron_name = 0 -%] >+ [%- END -%] >+[%- END -%] >+[%- IF hide_patron_infos_if_needed AND ( display_patron_name OR display_cardnumber ) -%] >+ [%- IF link_to == 'circulation_reserves' %]<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% data.borrowernumber %]#reserves"> >+ [%- ELSE %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber %]"> > [%- END -%] >- [%- IF ( borrower.cardnumber ) -%] >- ([% borrower.cardnumber | html %]) >- [%- END %] >-[%- ELSIF ( borrowernumber ) %] >- [%- IF category_type == 'I' %] >- [%- surname | html %] [% IF othernames %] ([% othernames | html %]) [% END %] >- [%- ELSE %] >- [%- IF invert_name %] >- [%- surname | html %], [% firstname | html %] [% IF othernames %] ([% othernames | html %]) [% END %] >- [%- ELSE %] >- [%- firstname | html %] [% IF othernames %] ([% othernames | html %]) [% END %] [% surname | html %] >- [%- END %] >+[%- END -%] >+[%- IF data.category_type == 'I' -%] >+ [%- UNLESS display_patron_name %][%- data.surname | html %] [% IF data.othernames %] [% END %]([% data.othernames | html %]) [% END -%] >+[%- ELSIF display_patron_name -%] >+ [%- IF invert_name -%] >+ [%- data.surname | html %], [% data.firstname | html %] [% IF data.othernames %] ([% data.othernames | html %]) [% END -%] >+ [%- ELSE -%] >+ [%- data.firstname | html %] [% IF data.othernames %] ([% data.othernames | html %]) [% END %] [% data.surname | html -%] >+ [%- END -%] >+ [%- IF display_cardnumber AND data.cardnumber %]([% data.cardnumber | html %])[% END -%] >+[%- ELSIF display_cardnumber -%] >+ [%- IF data.cardnumber -%][%# FIXME Cardnumber should always be defined, right? -%] >+ [%- data.cardnumber | html -%] > [%- END -%] >- [%- IF ( cardnumber ) -%] >- ([% cardnumber | html %]) >- [%- END %] >+[%- ELSE -%] >+ A patron from library [% Branches.GetName( patron.branchcode ) -%] >+[%- END -%] >+ >+[%- IF hide_patron_infos_if_needed AND ( display_patron_name OR display_cardnumber ) -%] >+ </a> > [%- END -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index b9bf9ed..96fe87f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -675,7 +675,7 @@ function verify_images() { > <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber %][% END %]</td> > <td class="status"> > >- [% IF ( item.datedue ) %] >+ [% IF item.CheckedOutFor %] > [% IF item.onsite_checkout %] > <span>Currently in local use > [% ELSE %] >@@ -683,16 +683,11 @@ function verify_images() { > [% END %] > [% UNLESS ( item.NOTSAMEBRANCH ) %] > [% IF item.onsite_checkout %] >- by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% item.borrowernumber %]"> >+ by > [% ELSE %] >- to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% item.borrowernumber %]"> >+ to > [% END %] >- [% IF ( item.hidepatronname ) %] >- [% item.cardnumber %] >- [% ELSE %] >- [% item.firstname %] [% item.surname %] >- [% END %] >- </a> >+ [% INCLUDE 'patron-title.inc' patron=item.CheckedOutFor hide_patron_infos_if_needed=1 %] > [% END %] > : due [% item.datedue %] > </span> >@@ -742,13 +737,8 @@ function verify_images() { > Item-level hold (placed [% item.reservedate | $KohaDates %]) for delivery at [% Branches.GetName( item.ExpectedAtLibrary ) %]. > [% END %] > [% IF ( canreservefromotherbranches ) %] >- Hold for: <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% item.ReservedForBorrowernumber %]"> >- [% IF ( item.hidepatronname ) %] >- [% item.Reservedcardnumber %] >- [% ELSE %] >- [% item.ReservedForFirstname _ " " _ item.ReservedForSurname _ " (" _ item.Reservedcardnumber _ ")" %] >- [% END %] >- </a> >+ Hold for: >+ [% INCLUDE 'patron-title.inc' patron=item.ReservedFor hide_patron_infos_if_needed=1 %] > [% END %] > [% END %] > [% UNLESS ( item.itemnotforloan || item.notforloan_per_itemtype || item.onloan || item.itemlost || item.withdrawn || item.damaged || item.transfertwhen || item.reservedate ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 34a7304..6e4a3f1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -773,13 +773,7 @@ function checkMultiHold() { > [% END %] > > <td> >- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.borrowernumber %]" > >- [% IF ( reserveloo.hidename ) %] >- [% reserveloo.cardnumber (reserveloo.borrowernumber) %] >- [% ELSE %] >- [% reserveloo.firstname %] [% reserveloo.surname %] >- [% END %] >- </a> >+ [% INCLUDE 'patron-title.inc' patron=reserveloo.patron hide_patron_infos_if_needed=1 %] > </td> > <td>[% reserveloo.notes %]</td> > <td>[% reserveloo.date %]</td> >diff --git a/reserve/request.pl b/reserve/request.pl >index b7e224c..782d0a9 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -566,19 +566,12 @@ foreach my $biblionumber (@biblionumbers) { > } > } > >- # get borrowers reserve info >- if ( C4::Context->preference('HidePatronName') ) { >- $reserve{'hidename'} = 1; >- $reserve{'cardnumber'} = $res->borrower()->cardnumber(); >- } > $reserve{'expirationdate'} = output_pref( { dt => dt_from_string( $res->expirationdate ), dateonly => 1 } ) > unless ( !defined( $res->expirationdate ) || $res->expirationdate eq '0000-00-00' ); > $reserve{'date'} = output_pref( { dt => dt_from_string( $res->reservedate ), dateonly => 1 } ); > $reserve{'borrowernumber'} = $res->borrowernumber(); > $reserve{'biblionumber'} = $res->biblionumber(); >- $reserve{'borrowernumber'} = $res->borrowernumber(); >- $reserve{'firstname'} = $res->borrower()->firstname(); >- $reserve{'surname'} = $res->borrower()->surname(); >+ $reserve{'patron'} = $res->borrower; > $reserve{'notes'} = $res->reservenotes(); > $reserve{'waiting_date'} = $res->waitingdate(); > $reserve{'waiting_until'} = $res->is_waiting() ? $res->waiting_expires_on() : undef; >-- >2.9.3
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 18403
:
62010
|
62011
|
62012
|
62013
|
62014
|
62015
|
62016
|
62017
|
62018
|
62019
|
62020
|
62021
|
62022
|
62023
|
62024
|
62025
|
62026
|
62027
|
62028
|
62029
|
62030
|
62031
|
62032
|
62033
|
62302
|
62303
|
62830
|
62831
|
62832
|
62833
|
62834
|
62835
|
62836
|
62837
|
62838
|
62839
|
62840
|
62841
|
62842
|
62843
|
62844
|
62845
|
62846
|
62847
|
62848
|
62849
|
62850
|
62851
|
62852
|
62853
|
62854
|
62855
|
71392
|
71394
|
71500
|
71501
|
71502
|
71503
|
71504
|
71505
|
71506
|
71507
|
71508
|
71509
|
71510
|
71511
|
71512
|
71513
|
71514
|
71515
|
71516
|
71517
|
71518
|
71519
|
71520
|
71521
|
71522
|
71523
|
71524
|
71525
|
71526
|
71527
|
71528
|
71529
|
71530
|
71767