From c36247ae9679e15e3eb402b1c20602d62d8e8f30 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Thu, 15 Mar 2018 13:12:55 +0000 Subject: [PATCH] Bug 12159: Fix getting extended patron attributes for circ-menu Changes: - Replace getting preference ExtendedPatronAttributes by Koha.Preference in templates - Add Koha::Patron->attributes for getting patrons extended attributes - Use this method in circ-menu.inc - Remove getting attributes from members perl scripts Test plan: 0) Apply the patch 1) Add some patron attributes type - with free text, authorised value, limited by libraries... 2) Add some values to this attributes for some patrons 3) Go through as many patron pages as you can and confirm that attributes are shown at side panel when they shoul and are not shown when they should not be shown --- Koha/Patron.pm | 17 +++++++ Koha/Patron/Attribute.pm | 52 ++++++++++++++++++++++ Koha/Patron/Attributes.pm | 32 +++++++++++++ Koha/Schema/Result/BorrowerAttribute.pm | 16 +++++++ circ/circulation.pl | 8 ---- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 10 ++--- .../prog/en/modules/members/memberentrygen.tt | 2 +- .../prog/en/modules/members/moremember.tt | 2 +- .../prog/en/modules/reports/borrowers_stats.tt | 3 +- .../prog/en/modules/tools/import_borrowers.tt | 2 +- members/boraccount.pl | 9 ---- members/files.pl | 9 ---- members/housebound.pl | 10 ----- members/mancredit.pl | 9 ---- members/maninvoice.pl | 9 ---- members/member-flags.pl | 9 ---- members/member-password.pl | 9 ---- members/memberentry.pl | 1 - members/moremember.pl | 1 - members/notices.pl | 9 ---- members/pay.pl | 29 +++--------- members/paycollect.pl | 26 +++-------- members/purchase-suggestions.pl | 9 ---- members/readingrec.pl | 9 ---- members/routing-lists.pl | 9 ---- members/statistics.pl | 9 ---- reports/borrowers_stats.pl | 1 - tools/viewlog.pl | 9 ---- 28 files changed, 137 insertions(+), 183 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 35cfce4..b2c4569 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -31,6 +31,7 @@ use Koha::Database; use Koha::DateUtils; use Koha::Holds; use Koha::Old::Checkouts; +use Koha::Patron::Attributes; use Koha::Patron::Categories; use Koha::Patron::HouseboundProfile; use Koha::Patron::HouseboundRole; @@ -1032,6 +1033,22 @@ sub generate_userid { } +=head3 attributes + +my $attributes = $patron->attributes + +Return object of Koha::Patron::Attributes type with all attributes set for this patron + +=cut + +sub attributes { + my ( $self ) = @_; + return Koha::Patron::Attributes->search({ + borrowernumber => $self->borrowernumber, + branchcode => $self->branchcode, + }); +} + =head2 Internal methods =head3 _type diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm index 906fc6d..f280360 100644 --- a/Koha/Patron/Attribute.pm +++ b/Koha/Patron/Attribute.pm @@ -20,6 +20,7 @@ use Modern::Perl; use Koha::Database; use Koha::Exceptions::Patron::Attribute; use Koha::Patron::Attribute::Types; +use Koha::AuthorisedValues; use base qw(Koha::Object); @@ -79,6 +80,57 @@ sub opac_editable { return Koha::Patron::Attribute::Types->find( $self->code )->opac_editable; } +=head3 display_checkout + + my $attribute = Koha::Patron::Attribute->new({ code => 'a_code', ... }); + if ( $attribute->display_checkout ) { ... } + +=cut + +sub display_checkout { + + my $self = shift; + + return $self->type->display_checkout; +} + +=head3 value_description + + my $description = $attribute->value_description + + Return authorised value description or free text based on attribute type settings + +=cut + +sub value_description { + + my $self = shift; + + if ( $self->type->authorised_value_category ) { + my $av = Koha::AuthorisedValues->search({ + category => $self->type->authorised_value_category, + authorised_value => $self->attribute, + }); + return $av->next->lib if $av->count + } + return $self->attribute; +} + +=head3 type_description + + my $description = $attribute->type_description + + Return description of attribute type + +=cut + +sub type_description { + + my $self = shift; + + return $self->type->description; +} + =head3 type my $attribute_type = $attribute->type; diff --git a/Koha/Patron/Attributes.pm b/Koha/Patron/Attributes.pm index 4264e06..1bbd35b 100644 --- a/Koha/Patron/Attributes.pm +++ b/Koha/Patron/Attributes.pm @@ -31,6 +31,38 @@ Koha::Patron::Attributes - Koha Patron Attributes Object set class =cut +=head3 search + +my $attributes-> Koha::Patron::Attributes->search( $params ); + +=cut + +sub search { + my ( $self, $params, $attributes ) = @_; + + my $branchcode = $params->{branchcode}; + delete( $params->{branchcode} ); + + my $or = + $branchcode + ? { + '-or' => [ + 'borrower_attribute_types_branches.b_branchcode' => undef, + 'borrower_attribute_types_branches.b_branchcode' => $branchcode, + ] + } : {}; + + my $join = + $branchcode + ? { + join => { + 'borrower_attribute_types' => 'borrower_attribute_types_branches' + }, + } : {}; + $attributes //= {}; + return $self->SUPER::search( { %$params, %$or }, { %$attributes, %$join } ); +} + =head3 _type =cut diff --git a/Koha/Schema/Result/BorrowerAttribute.pm b/Koha/Schema/Result/BorrowerAttribute.pm index 45ce0bf..af1f519 100644 --- a/Koha/Schema/Result/BorrowerAttribute.pm +++ b/Koha/Schema/Result/BorrowerAttribute.pm @@ -109,6 +109,22 @@ __PACKAGE__->belongs_to( # Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-08 04:41:27 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EarETnedFsmRmAAJAUrKGg +=head2 borrower_attribute_types + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrower_attribute_types", + "Koha::Schema::Result::BorrowerAttributeType", + { "foreign.code" => "self.code" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },); + + + # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/circ/circulation.pl b/circ/circulation.pl index 1617584..2d90809 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -43,7 +43,6 @@ use C4::Reserves; use Koha::Holds; use C4::Context; use CGI::Session; -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::AuthorisedValues; use Koha::CsvProfiles; use Koha::Patrons; @@ -559,13 +558,6 @@ if ( Koha::BiblioFrameworks->find('FA') ) { $fast_cataloging = 1 } -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} my $view = $batch ?'batch_checkout_view' : 'circview'; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index dcdf1cc..0ae0fbe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -56,13 +56,13 @@
  • No email stored.
  • [% END %] - [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN extendedattributes %] - [% IF ( extendedattribute.display_checkout ) %] - [% IF ( extendedattribute.value ) %] -
  • [% extendedattribute.description %] : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.value %][% END %]
  • + [% IF Koha.Preference('ExtendedPatronAttributes') %] + [% FOREACH extendedattribute IN patron.attributes %] + [% IF ( extendedattribute.display_checkout ) %] +
  • [% extendedattribute.type_description %] : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.attribute %][% END %]
  • [% END %] [% END %] - [% END %][% END %] + [% END %]
  • Category: [% patron.category.description %] ([% patron.categorycode %])
  • Home library: [% Branches.GetName( patron.branchcode ) %]
  • Borrowernumber: [% patron.borrowernumber %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index e3db7c9..98b396c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1018,7 +1018,7 @@ [% END # hide fieldset %] -[% IF ( ExtendedPatronAttributes ) %][% UNLESS ( no_patron_attribute_types ) %] +[% IF Koha.Preference('ExtendedPatronAttributes') %][% UNLESS ( no_patron_attribute_types ) %]
    Additional attributes and identifiers diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index edfee7e..a38ad81 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -248,7 +248,7 @@ [% END %] -[% IF ( ExtendedPatronAttributes ) %] +[% IF Koha.Preference('ExtendedPatronAttributes') %] [% UNLESS ( no_patron_attribute_types ) %]

    Additional attributes and identifiers

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt index 95c78f5..816ea74 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt @@ -1,4 +1,5 @@ [% USE Branches %] +[% USE Koha %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Reports [% IF ( do_it ) %]› Patrons statistics › Results[% ELSE %]› Patrons statistics[% END %] @@ -203,7 +204,7 @@ [% ELSE %] [% END %] - [% IF ( ExtendedPatronAttributes ) %] + [% IF Koha.Preference('ExtendedPatronAttributes') %] Patron attributes diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt index f2b5c3c..f10fa59 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt @@ -259,7 +259,7 @@ - [% IF ( ExtendedPatronAttributes ) %] + [% IF Koha.Preference('ExtendedPatronAttributes') %]
  • If loading patron attributes, the 'patron_attributes' field should contain a comma-separated list of attribute types and values. The attribute type code and a colon should precede each value. For example: INSTID:12345,LANG:fr or STARTDATE:January 1 2010,TRACK:Day. If an input record has more than one attribute, the fields should either be entered as an unquoted string (previous examples), or with each field wrapped in separate double quotes and delimited by a comma: "STARTDATE:January 1, 2010","TRACK:Day". The second syntax would be required if the data might have a comma in it, like a date string.
  • diff --git a/members/boraccount.pl b/members/boraccount.pl index b3d1431..63a6ca8 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -29,7 +29,6 @@ use C4::Output; use CGI qw ( -utf8 ); use C4::Members; use C4::Accounts; -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patrons; use Koha::Patron::Categories; @@ -116,14 +115,6 @@ while ( my $line = $accts->next ) { push @accountlines, $accountline; } -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - $template->param( patron => $patron, finesview => 1, diff --git a/members/files.pl b/members/files.pl index 7927eae..ef6804b 100755 --- a/members/files.pl +++ b/members/files.pl @@ -24,7 +24,6 @@ use CGI qw ( -utf8 ); use C4::Auth; use C4::Output; use C4::Members; -use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Debug; use Koha::DateUtils; @@ -106,14 +105,6 @@ else { $bf->DelFile( id => scalar $cgi->param('file_id') ); } - if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); - } - $template->param( files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(), diff --git a/members/housebound.pl b/members/housebound.pl index 574bacd..4b965d8 100755 --- a/members/housebound.pl +++ b/members/housebound.pl @@ -28,7 +28,6 @@ use Modern::Perl; use CGI; use C4::Auth; use C4::Context; -use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Output; use DateTime; use Koha::DateUtils; @@ -157,15 +156,6 @@ $method = 'update_or_create' if ( !$houseboundprofile ); # Ensure template has all patron details. $template->param( patron => $patron ); -# Load extended patron attributes if necessary (taken from members/files.pl). -if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) { - my $attributes = GetBorrowerAttributes($patron->borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - $template->param( housebound_profile => $houseboundprofile, visit => $houseboundvisit, diff --git a/members/mancredit.pl b/members/mancredit.pl index 557f517..79d208c 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -31,7 +31,6 @@ use CGI qw ( -utf8 ); use C4::Members; use C4::Accounts; use C4::Items; -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patrons; use Koha::Patron::Categories; @@ -85,14 +84,6 @@ if ($add){ $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } - if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); - } - $template->param( patron => $patron ); $template->param( diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 84ed122..a6915b8 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -30,7 +30,6 @@ use CGI qw ( -utf8 ); use C4::Members; use C4::Accounts; use C4::Items; -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patrons; @@ -113,14 +112,6 @@ if ($add){ $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } - if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); - } - $template->param( patron => $patron, finesview => 1, diff --git a/members/member-flags.pl b/members/member-flags.pl index 14fb50a..f9934ec 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -11,7 +11,6 @@ use C4::Output; use C4::Auth qw(:DEFAULT :EditPermissions); use C4::Context; use C4::Members; -use C4::Members::Attributes qw(GetBorrowerAttributes); #use C4::Acquisitions; use Koha::Patron::Categories; @@ -183,14 +182,6 @@ if ($input->param('newflags')) { $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - $template->param( patron => $patron, loop => \@loop, diff --git a/members/member-password.pl b/members/member-password.pl index 115f804..589f6ed 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -13,7 +13,6 @@ use C4::Context; use C4::Members; use C4::Circulation; use CGI qw ( -utf8 ); -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::AuthUtils; use Koha::Token; @@ -101,14 +100,6 @@ if ( $patron->is_child ) { $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } -if ( C4::Context->preference('ExtendedPatronAttributes') ) { - my $attributes = GetBorrowerAttributes( $bor->{'borrowernumber'} ); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - $template->param( patron => $patron, destination => $destination, diff --git a/members/memberentry.pl b/members/memberentry.pl index 0a5e81b..07f17e8c 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -734,7 +734,6 @@ foreach (qw(dateenrolled dateexpiry dateofbirth)) { } if (C4::Context->preference('ExtendedPatronAttributes')) { - $template->param(ExtendedPatronAttributes => 1); patron_attributes_form($template, $borrowernumber); } diff --git a/members/moremember.pl b/members/moremember.pl index dbe9896..760a477 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -287,7 +287,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { } $template->param( - ExtendedPatronAttributes => 1, attributes_loop => \@attributes_loop ); diff --git a/members/notices.pl b/members/notices.pl index f307393..1f9b0a5 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -25,7 +25,6 @@ use C4::Output; use CGI qw ( -utf8 ); use C4::Members; use C4::Letters; -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patrons; my $input=new CGI; @@ -66,14 +65,6 @@ if ( $op eq 'resend_notice' ) { # Getting the messages my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber}); -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - $template->param( patron => $patron, QUEUED_MESSAGES => $queued_messages, diff --git a/members/pay.pl b/members/pay.pl index 05b73e5..432295c 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -38,7 +38,6 @@ use C4::Accounts; use C4::Stats; use C4::Koha; use C4::Overdues; -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patrons; use Koha::Patron::Categories; @@ -138,7 +137,11 @@ sub add_accounts_to_template { } push @accounts, $account_line; } - borrower_add_additional_fields($patron->unblessed); + if ( $patron->is_child ) { + my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']} ); + $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; + $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; + } $template->param( patron => $patron, @@ -215,28 +218,6 @@ sub writeoff_all { return; } -sub borrower_add_additional_fields { - my $b_ref = shift; - -# some borrower info is not returned in the standard call despite being assumed -# in a number of templates. It should not be the business of this script but in lieu of -# a revised api here it is ... - if ( $b_ref->{category_type} eq 'C' ) { - my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); - $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; - $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; - } - - if (C4::Context->preference('ExtendedPatronAttributes')) { - $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - ); - } - - return; -} - sub payselected { my @params = @_; my $amt = 0; diff --git a/members/paycollect.pl b/members/paycollect.pl index 82b5d27..2941b5a 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -25,7 +25,6 @@ use C4::Context; use C4::Auth; use C4::Output; use C4::Members; -use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Accounts; use C4::Koha; @@ -178,7 +177,11 @@ if ( $total_paid and $total_paid ne '0.00' ) { $total_paid = '0.00'; #TODO not right with pay_individual } -borrower_add_additional_fields($borrower, $template); +if ( $patron->is_child ) { + my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']} ); + $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; + $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; +} $template->param(%$borrower); @@ -186,28 +189,9 @@ $template->param( borrowernumber => $borrowernumber, # some templates require global patron => $patron, total => $total_due, - ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'), csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }), ); output_html_with_http_headers $input, $cookie, $template->output; -sub borrower_add_additional_fields { - my ( $b_ref, $template ) = @_; - -# some borrower info is not returned in the standard call despite being assumed -# in a number of templates. It should not be the business of this script but in lieu of -# a revised api here it is ... - if ( $b_ref->{category_type} eq 'C' ) { - my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); - $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; - $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; - } - - if (C4::Context->preference('ExtendedPatronAttributes')) { - $b_ref->{extendedattributes} = GetBorrowerAttributes($b_ref->{borrowernumber}); - } - - return; -} diff --git a/members/purchase-suggestions.pl b/members/purchase-suggestions.pl index 026ab89..f240ab5 100755 --- a/members/purchase-suggestions.pl +++ b/members/purchase-suggestions.pl @@ -24,7 +24,6 @@ use C4::Auth; use C4::Context; use C4::Output; use C4::Members; -use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Suggestions; use Koha::Patrons; @@ -52,14 +51,6 @@ $template->param( suggestionsview => 1, ); -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } ); $template->param( suggestions => $suggestions ); diff --git a/members/readingrec.pl b/members/readingrec.pl index 015c56c..caa6d3c 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -29,7 +29,6 @@ use C4::Output; use C4::Members; use List::MoreUtils qw/any uniq/; use Koha::DateUtils; -use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patrons; use Koha::Patron::Categories; @@ -102,14 +101,6 @@ if (! $limit){ $limit = 'full'; } -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($patron->borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - $template->param( patron => $patron, readingrecordview => 1, diff --git a/members/routing-lists.pl b/members/routing-lists.pl index 793317d..17a898e 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -22,7 +22,6 @@ use CGI qw ( -utf8 ); use C4::Output; use C4::Auth qw/:DEFAULT/; use C4::Members; -use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Context; use C4::Serials; use Koha::Patrons; @@ -76,12 +75,4 @@ $template->param( branch => $branch, # FIXME This is confusing ); -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - output_html_with_http_headers $query, $cookie, $template->output; diff --git a/members/statistics.pl b/members/statistics.pl index 2e3087e..e3c802f 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -29,7 +29,6 @@ use C4::Auth; use C4::Context; use C4::Members; use C4::Members::Statistics; -use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Output; use Koha::Patrons; @@ -76,14 +75,6 @@ my $count_total_issues = $total->{count_total_issues_today} || 0; my $count_total_issues_returned = $total->{count_total_issues_returned_today} || 0; my $count_total_actual_state = ($count_total_precedent_state - $count_total_issues_returned + $count_total_issues); -if (C4::Context->preference('ExtendedPatronAttributes')) { - my $attributes = GetBorrowerAttributes($borrowernumber); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); -} - $template->param( patron => $patron, statisticsview => 1, diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl index 9bdf37d..bb27dfe 100755 --- a/reports/borrowers_stats.pl +++ b/reports/borrowers_stats.pl @@ -137,7 +137,6 @@ if ($do_it) { CGIsepChoice => $CGIsepChoice, ); if (C4::Context->preference('ExtendedPatronAttributes')) { - $template->param(ExtendedPatronAttributes => 1); patron_attributes_form($template); } } diff --git a/tools/viewlog.pl b/tools/viewlog.pl index e9e9f42..bac49fb 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -69,21 +69,12 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( if ( $src eq 'circ' ) { - # if we were called from circulation, use the circulation menu and get data to populate it -fbcit - use C4::Members::Attributes qw(GetBorrowerAttributes); my $borrowernumber = $object; my $patron = Koha::Patrons->find( $borrowernumber ); unless ( $patron ) { print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); exit; } - if ( C4::Context->preference('ExtendedPatronAttributes') ) { - my $attributes = GetBorrowerAttributes( $borrowernumber ); - $template->param( - ExtendedPatronAttributes => 1, - extendedattributes => $attributes - ); - } $template->param( patron => $patron, -- 2.1.4