From 453e8e723508463f57577bbbc21a4ea7cc4befb7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 11 Jul 2016 22:06:46 +0100 Subject: [PATCH] Bug 16908: Koha::Patrons - Remove GetSortDetails This subroutine was only used in one script and its job is the same as GetAuthorisedValueByCode. It's better to use the AuthorisedValues TT plugin to retrieve AV descriptions. Test plan: Edit a patron with sort1 and/or sort2 defined. On the patron details page (members/moremember.pl) you should see the sort1 and/or sort2 info displayed. Signed-off-by: Owen Leonard Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- C4/Members.pm | 27 +------------------ admin/aqbudgets.pl | 2 +- .../prog/en/modules/members/moremember.tt | 4 +-- members/moremember.pl | 4 --- t/db_dependent/Koha.t | 13 ++------- 5 files changed, 6 insertions(+), 44 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 63fe0c4c3f..6644c3afd4 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -71,7 +71,7 @@ BEGIN { &GetNoticeEmailAddress &GetAge - &GetSortDetails + &GetTitles &GetHideLostItemsPreference @@ -1353,31 +1353,6 @@ sub SetAge{ return $borrower; } # sub SetAge -=head2 GetSortDetails (OUEST-PROVENCE) - - ($lib) = &GetSortDetails($category,$sortvalue); - -Returns the authorized value details -C<&$lib>return value of authorized value details -C<&$sortvalue>this is the value of authorized value -C<&$category>this is the value of authorized value category - -=cut - -sub GetSortDetails { - my ( $category, $sortvalue ) = @_; - my $dbh = C4::Context->dbh; - my $query = qq|SELECT lib - FROM authorised_values - WHERE category=? - AND authorised_value=? |; - my $sth = $dbh->prepare($query); - $sth->execute( $category, $sortvalue ); - my $lib = $sth->fetchrow; - return ($lib) if ($lib); - return ($sortvalue) unless ($lib); -} - =head2 MoveMemberToDeleted $result = &MoveMemberToDeleted($borrowernumber); diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index e7dd2bbaf3..d8a1b576da 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -29,7 +29,7 @@ use C4::Auth qw/get_user_subpermissions/; use C4::Auth; use C4::Acquisition; use C4::Budgets; -use C4::Members; # calls GetSortDetails() +use C4::Members; use C4::Context; use C4::Output; use C4::Koha; 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 ce4377f1f4..7aa57be920 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -395,8 +395,8 @@ function validate1(date) { [% END %] - [% IF ( sort1 ) %]
  • Sort field 1:[% lib1 %]
  • [% END %] - [% IF ( sort2 ) %]
  • Sort field 2:[% lib2 %]
  • [% END %] + [% IF ( sort1 ) %]
  • Sort field 1:[% AuthorisedValues.GetByCode('Bsort1', sort1) %]
  • [% END %] + [% IF ( sort2 ) %]
  • Sort field 2:[% AuthorisedValues.GetByCode('Bsort2', sort2) %]
  • [% END %]
  • Username: [% userid %]
  • Password: [% IF ( password ) %] diff --git a/members/moremember.pl b/members/moremember.pl index 5c23f280c1..50a72f552e 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -207,10 +207,6 @@ my $library = Koha::Libraries->find( $data->{branchcode})->unblessed; @{$data}{keys %$library} = values %$library; # merge in all branch columns my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber ); -my $lib1 = &GetSortDetails( "Bsort1", $data->{'sort1'} ); -my $lib2 = &GetSortDetails( "Bsort2", $data->{'sort2'} ); -$template->param( lib1 => $lib1 ) if ($lib1); -$template->param( lib2 => $lib2 ) if ($lib2); # If printing a page, send the account informations to the template if ($print eq "page") { diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t index 82fdc5eca2..1fab9dbafa 100644 --- a/t/db_dependent/Koha.t +++ b/t/db_dependent/Koha.t @@ -21,7 +21,7 @@ $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; subtest 'Authorized Values Tests' => sub { - plan tests => 7; + plan tests => 4; my $data = { category => 'CATEGORY', @@ -46,18 +46,9 @@ subtest 'Authorized Values Tests' => sub { # Tests SKIP: { - skip "INSERT failed", 4 unless $insert_success; + skip "INSERT failed", 1 unless $insert_success; is ( GetAuthorisedValueByCode($data->{category}, $data->{authorised_value}), $data->{lib}, "GetAuthorisedValueByCode" ); - - my $sortdet=C4::Members::GetSortDetails("lost", "3"); - is ($sortdet, "Lost and Paid For", "lost and paid works"); - - my $sortdet2=C4::Members::GetSortDetails("loc", "child"); - is ($sortdet2, "Children's Area", "Child area works"); - - my $sortdet3=C4::Members::GetSortDetails("withdrawn", "1"); - is ($sortdet3, "Withdrawn", "Withdrawn works"); } # Clean up -- 2.39.5