View | Details | Raw Unified | Return to bug 15797
Collapse All | Expand All

(-)a/C4/Koha.pm (-20 lines)
Lines 65-71 BEGIN { Link Here
65
    &GetKohaAuthorisedValuesMapping
65
    &GetKohaAuthorisedValuesMapping
66
    &GetKohaAuthorisedValueLib
66
    &GetKohaAuthorisedValueLib
67
    &GetAuthorisedValueByCode
67
    &GetAuthorisedValueByCode
68
    &GetKohaImageurlFromAuthorisedValues
69
		&GetAuthValCode
68
		&GetAuthValCode
70
        &AddAuthorisedValue
69
        &AddAuthorisedValue
71
		&GetNormalizedUPC
70
		&GetNormalizedUPC
Lines 1077-1101 sub displayServers { Link Here
1077
    return \@primaryserverloop;
1076
    return \@primaryserverloop;
1078
}
1077
}
1079
1078
1080
1081
=head2 GetKohaImageurlFromAuthorisedValues
1082
1083
$authhorised_value = GetKohaImageurlFromAuthorisedValues( $category, $authvalcode );
1084
1085
Return the first url of the authorised value image represented by $lib.
1086
1087
=cut
1088
1089
sub GetKohaImageurlFromAuthorisedValues {
1090
    my ( $category, $lib ) = @_;
1091
    my $dbh = C4::Context->dbh;
1092
    my $sth = $dbh->prepare("SELECT imageurl FROM authorised_values WHERE category=? AND lib =?");
1093
    $sth->execute( $category, $lib );
1094
    while ( my $data = $sth->fetchrow_hashref ) {
1095
        return $data->{'imageurl'};
1096
    }
1097
}
1098
1099
=head2 GetAuthValCode
1079
=head2 GetAuthValCode
1100
1080
1101
  $authvalcode = GetAuthValCode($kohafield,$frameworkcode);
1081
  $authvalcode = GetAuthValCode($kohafield,$frameworkcode);
(-)a/t/db_dependent/Koha.t (-4 / +2 lines)
Lines 21-27 $dbh->{AutoCommit} = 0; Link Here
21
$dbh->{RaiseError} = 1;
21
$dbh->{RaiseError} = 1;
22
22
23
subtest 'Authorized Values Tests' => sub {
23
subtest 'Authorized Values Tests' => sub {
24
    plan tests => 8;
24
    plan tests => 7;
25
25
26
    my $data = {
26
    my $data = {
27
        category            => 'CATEGORY',
27
        category            => 'CATEGORY',
Lines 39-48 subtest 'Authorized Values Tests' => sub { Link Here
39
39
40
# Tests
40
# Tests
41
    SKIP: {
41
    SKIP: {
42
        skip "INSERT failed", 5 unless $insert_success;
42
        skip "INSERT failed", 4 unless $insert_success;
43
43
44
        is ( GetAuthorisedValueByCode($data->{category}, $data->{authorised_value}), $data->{lib}, "GetAuthorisedValueByCode" );
44
        is ( GetAuthorisedValueByCode($data->{category}, $data->{authorised_value}), $data->{lib}, "GetAuthorisedValueByCode" );
45
        is ( GetKohaImageurlFromAuthorisedValues($data->{category}, $data->{lib}), $data->{imageurl}, "GetKohaImageurlFromAuthorisedValues" );
46
45
47
        my $sortdet=C4::Members::GetSortDetails("lost", "3");
46
        my $sortdet=C4::Members::GetSortDetails("lost", "3");
48
        is ($sortdet, "Lost and Paid For", "lost and paid works");
47
        is ($sortdet, "Lost and Paid For", "lost and paid works");
49
- 

Return to bug 15797