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

(-)a/C4/Koha.pm (-20 lines)
Lines 64-70 BEGIN { Link Here
64
    &GetKohaAuthorisedValuesMapping
64
    &GetKohaAuthorisedValuesMapping
65
    &GetKohaAuthorisedValueLib
65
    &GetKohaAuthorisedValueLib
66
    &GetAuthorisedValueByCode
66
    &GetAuthorisedValueByCode
67
    &GetKohaImageurlFromAuthorisedValues
68
		&GetAuthValCode
67
		&GetAuthValCode
69
        &AddAuthorisedValue
68
        &AddAuthorisedValue
70
		&GetNormalizedUPC
69
		&GetNormalizedUPC
Lines 1060-1084 sub displayServers { Link Here
1060
    return \@primaryserverloop;
1059
    return \@primaryserverloop;
1061
}
1060
}
1062
1061
1063
1064
=head2 GetKohaImageurlFromAuthorisedValues
1065
1066
$authhorised_value = GetKohaImageurlFromAuthorisedValues( $category, $authvalcode );
1067
1068
Return the first url of the authorised value image represented by $lib.
1069
1070
=cut
1071
1072
sub GetKohaImageurlFromAuthorisedValues {
1073
    my ( $category, $lib ) = @_;
1074
    my $dbh = C4::Context->dbh;
1075
    my $sth = $dbh->prepare("SELECT imageurl FROM authorised_values WHERE category=? AND lib =?");
1076
    $sth->execute( $category, $lib );
1077
    while ( my $data = $sth->fetchrow_hashref ) {
1078
        return $data->{'imageurl'};
1079
    }
1080
}
1081
1082
=head2 GetAuthValCode
1062
=head2 GetAuthValCode
1083
1063
1084
  $authvalcode = GetAuthValCode($kohafield,$frameworkcode);
1064
  $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