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

(-)a/C4/Koha.pm (-54 lines)
Lines 47-53 BEGIN { Link Here
47
        &getFacets
47
        &getFacets
48
        &getnbpages
48
        &getnbpages
49
		&get_infos_of
49
		&get_infos_of
50
		&get_notforloan_label_of
51
		&getitemtypeimagedir
50
		&getitemtypeimagedir
52
		&getitemtypeimagesrc
51
		&getitemtypeimagesrc
53
		&getitemtypeimagelocation
52
		&getitemtypeimagelocation
Lines 704-761 sub get_infos_of { Link Here
704
    return \%infos_of;
703
    return \%infos_of;
705
}
704
}
706
705
707
=head2 get_notforloan_label_of
708
709
  my $notforloan_label_of = get_notforloan_label_of();
710
711
Each authorised value of notforloan (information available in items and
712
itemtypes) is link to a single label.
713
714
Returns a href where keys are authorised values and values are corresponding
715
labels.
716
717
  foreach my $authorised_value (keys %{$notforloan_label_of}) {
718
    printf(
719
        "authorised_value: %s => %s\n",
720
        $authorised_value,
721
        $notforloan_label_of->{$authorised_value}
722
    );
723
  }
724
725
=cut
726
727
# FIXME - why not use GetAuthorisedValues ??
728
#
729
sub get_notforloan_label_of {
730
    my $dbh = C4::Context->dbh;
731
732
    my $query = '
733
SELECT authorised_value
734
  FROM marc_subfield_structure
735
  WHERE kohafield = \'items.notforloan\'
736
  LIMIT 0, 1
737
';
738
    my $sth = $dbh->prepare($query);
739
    $sth->execute();
740
    my ($statuscode) = $sth->fetchrow_array();
741
742
    $query = '
743
SELECT lib,
744
       authorised_value
745
  FROM authorised_values
746
  WHERE category = ?
747
';
748
    $sth = $dbh->prepare($query);
749
    $sth->execute($statuscode);
750
    my %notforloan_label_of;
751
    while ( my $row = $sth->fetchrow_hashref ) {
752
        $notforloan_label_of{ $row->{authorised_value} } = $row->{lib};
753
    }
754
    $sth->finish;
755
756
    return \%notforloan_label_of;
757
}
758
759
=head2 GetAuthorisedValues
706
=head2 GetAuthorisedValues
760
707
761
  $authvalues = GetAuthorisedValues([$category]);
708
  $authvalues = GetAuthorisedValues([$category]);
762
- 

Return to bug 17844