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

(-)a/C4/Koha.pm (-54 lines)
Lines 46-52 BEGIN { Link Here
46
        &getallthemes
46
        &getallthemes
47
        &getFacets
47
        &getFacets
48
        &getnbpages
48
        &getnbpages
49
		&get_notforloan_label_of
50
		&getitemtypeimagedir
49
		&getitemtypeimagedir
51
		&getitemtypeimagesrc
50
		&getitemtypeimagesrc
52
		&getitemtypeimagelocation
51
		&getitemtypeimagelocation
Lines 637-694 sub getFacets { Link Here
637
    return $facets;
636
    return $facets;
638
}
637
}
639
638
640
=head2 get_notforloan_label_of
641
642
  my $notforloan_label_of = get_notforloan_label_of();
643
644
Each authorised value of notforloan (information available in items and
645
itemtypes) is link to a single label.
646
647
Returns a href where keys are authorised values and values are corresponding
648
labels.
649
650
  foreach my $authorised_value (keys %{$notforloan_label_of}) {
651
    printf(
652
        "authorised_value: %s => %s\n",
653
        $authorised_value,
654
        $notforloan_label_of->{$authorised_value}
655
    );
656
  }
657
658
=cut
659
660
# FIXME - why not use GetAuthorisedValues ??
661
#
662
sub get_notforloan_label_of {
663
    my $dbh = C4::Context->dbh;
664
665
    my $query = '
666
SELECT authorised_value
667
  FROM marc_subfield_structure
668
  WHERE kohafield = \'items.notforloan\'
669
  LIMIT 0, 1
670
';
671
    my $sth = $dbh->prepare($query);
672
    $sth->execute();
673
    my ($statuscode) = $sth->fetchrow_array();
674
675
    $query = '
676
SELECT lib,
677
       authorised_value
678
  FROM authorised_values
679
  WHERE category = ?
680
';
681
    $sth = $dbh->prepare($query);
682
    $sth->execute($statuscode);
683
    my %notforloan_label_of;
684
    while ( my $row = $sth->fetchrow_hashref ) {
685
        $notforloan_label_of{ $row->{authorised_value} } = $row->{lib};
686
    }
687
    $sth->finish;
688
689
    return \%notforloan_label_of;
690
}
691
692
=head2 GetAuthorisedValues
639
=head2 GetAuthorisedValues
693
640
694
  $authvalues = GetAuthorisedValues([$category]);
641
  $authvalues = GetAuthorisedValues([$category]);
695
- 

Return to bug 17844