From fc2d28545533a1893ca7b58aab50b99c60e4201a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 27 Oct 2016 11:51:44 -0300 Subject: [PATCH] Bug 13757: (followup) Rebase against master --- C4/Members/AttributeTypes.pm | 43 +++++++++++++++++++++++++++---------------- admin/patron-attr-types.pl | 19 ++++++++++--------- opac/opac-memberentry.pl | 5 +++-- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/C4/Members/AttributeTypes.pm b/C4/Members/AttributeTypes.pm index 487184e..77ba96c 100644 --- a/C4/Members/AttributeTypes.pm +++ b/C4/Members/AttributeTypes.pm @@ -215,23 +215,34 @@ sub store { WHERE code = ?"); } else { $sth = $dbh->prepare_cached("INSERT INTO borrower_attribute_types - (description, repeatable, unique_id, opac_display, opac_editable, - staff_searchable, authorised_value_category, display_checkout, category_code, class, code) - VALUES (?, ?, ?, ?, ?, - ?, ?, ?, ?, ?, ?)"); + ( description, + repeatable, + unique_id, + opac_display, + opac_editable, + staff_searchable, + authorised_value_category, + display_checkout, + category_code, + class, + code + ) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); } - $sth->bind_param(1, $self->{'description'}); - $sth->bind_param(2, $self->{'repeatable'}); - $sth->bind_param(3, $self->{'unique_id'}); - $sth->bind_param(4, $self->{'opac_display'}); - $sth->bind_param(5, $self->{'opac_editable'}); - $sth->bind_param(7, $self->{'staff_searchable'}); - $sth->bind_param(8, $self->{'authorised_value_category'}); - $sth->bind_param(9, $self->{'display_checkout'}); - $sth->bind_param(10, $self->{'category_code'} || undef); - $sth->bind_param(11, $self->{'class'}); - $sth->bind_param(12, $self->{'code'}); - $sth->execute; + + $sth->execute( + $self->{'description'}, + $self->{'repeatable'}, + $self->{'unique_id'}, + $self->{'opac_display'}, + $self->{'opac_editable'}, + $self->{'staff_searchable'} || 0, + $self->{'authorised_value_category'}, + $self->{'display_checkout'}, + $self->{'category_code'} || undef, + $self->{'class'}, + $self->{'code'} + ); if ( defined $$self{branches} ) { $sth = $dbh->prepare("DELETE FROM borrower_attribute_types_branches WHERE bat_code = ?"); diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index e7b39ce..1512145 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -36,18 +36,19 @@ use Koha::Patron::Categories; my $script_name = "/cgi-bin/koha/admin/patron-attr-types.pl"; -our $input = new CGI; +my $input = new CGI; my $op = $input->param('op') || ''; -our ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "admin/patron-attr-types.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => {parameters => 'parameters_remaining_permissions'}, - debug => 1, - }); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { template_name => "admin/patron-attr-types.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { parameters => 'parameters_remaining_permissions' } + } +); + $template->param(script_name => $script_name); diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 7962b38..07fcea0 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -23,7 +23,6 @@ use List::MoreUtils qw( each_array uniq ); use String::Random qw( random_string ); use C4::Auth; -use C4::Koha qw( GetAuthorisedValueByCode ); use C4::Output; use C4::Members; use C4::Form::MessagingPreferences; @@ -513,7 +512,9 @@ sub GeneratePatronAttributesForm { foreach my $class (@classes) { next unless ( $items_by_class{$class} ); - my $lib = GetAuthorisedValueByCode( 'PA_CLASS', $class, 1 ) || $class; + my $av = Koha::AuthorisedValues->search({ category => 'PA_CLASS', authorised_value => $class }); + my $lib = $av->count ? $av->next->opac_description : $class; + push @class_loop, { class => $class, items => $items_by_class{$class}, -- 2.10.1