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 <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-07-11 22:06:46 +01:00 committed by Kyle M Hall
parent d8aae99a1c
commit 453e8e7235
5 changed files with 6 additions and 44 deletions

View File

@ -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);

View File

@ -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;

View File

@ -395,8 +395,8 @@ function validate1(date) {
[% END %]
</li>
[% IF ( sort1 ) %]<li><span class="label">Sort field 1:</span>[% lib1 %]</li>[% END %]
[% IF ( sort2 ) %]<li><span class="label">Sort field 2:</span>[% lib2 %]</li>[% END %]
[% IF ( sort1 ) %]<li><span class="label">Sort field 1:</span>[% AuthorisedValues.GetByCode('Bsort1', sort1) %]</li>[% END %]
[% IF ( sort2 ) %]<li><span class="label">Sort field 2:</span>[% AuthorisedValues.GetByCode('Bsort2', sort2) %]</li>[% END %]
<li><span class="label">Username: </span>[% userid %]</li>
<li><span class="label">Password: </span>
[% IF ( password ) %]

View File

@ -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") {

View File

@ -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