@ISA = qw(Exporter);
@EXPORT = qw(
&GetPrinters &GetPrinter
- &GetItemTypes &getitemtypeinfo
&GetItemTypesCategorized
&getallthemes
&getFacets
=cut
-=head2 GetItemTypes
-
- $itemtypes = &GetItemTypes( style => $style );
-
-Returns information about existing itemtypes.
-
-Params:
- style: either 'array' or 'hash', defaults to 'hash'.
- 'array' returns an arrayref,
- 'hash' return a hashref with the itemtype value as the key
-
-build a HTML select with the following code :
-
-=head3 in PERL SCRIPT
-
- my $itemtypes = GetItemTypes;
- my @itemtypesloop;
- foreach my $thisitemtype (sort keys %$itemtypes) {
- my $selected = 1 if $thisitemtype eq $itemtype;
- my %row =(value => $thisitemtype,
- selected => $selected,
- description => $itemtypes->{$thisitemtype}->{'description'},
- );
- push @itemtypesloop, \%row;
- }
- $template->param(itemtypeloop => \@itemtypesloop);
-
-=head3 in TEMPLATE
-
- <form action='<!-- TMPL_VAR name="script_name" -->' method=post>
- <select name="itemtype">
- <option value="">Default</option>
- <!-- TMPL_LOOP name="itemtypeloop" -->
- <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="description" --></option>
- <!-- /TMPL_LOOP -->
- </select>
- <input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
- <input type="submit" value="OK" class="button">
- </form>
-
-=cut
-
-sub GetItemTypes {
- my ( %params ) = @_;
- my $style = defined( $params{'style'} ) ? $params{'style'} : 'hash';
-
- require C4::Languages;
- my $language = C4::Languages::getlanguage();
- # returns a reference to a hash of references to itemtypes...
- my $dbh = C4::Context->dbh;
- my $query = q|
- SELECT
- itemtypes.itemtype,
- itemtypes.description,
- itemtypes.rentalcharge,
- itemtypes.notforloan,
- itemtypes.imageurl,
- itemtypes.summary,
- itemtypes.checkinmsg,
- itemtypes.checkinmsgtype,
- itemtypes.sip_media_type,
- itemtypes.hideinopac,
- itemtypes.searchcategory,
- COALESCE( localization.translation, itemtypes.description ) AS translated_description
- FROM itemtypes
- LEFT JOIN localization ON itemtypes.itemtype = localization.code
- AND localization.entity = 'itemtypes'
- AND localization.lang = ?
- ORDER BY itemtype
- |;
- my $sth = $dbh->prepare($query);
- $sth->execute( $language );
-
- if ( $style eq 'hash' ) {
- my %itemtypes;
- while ( my $IT = $sth->fetchrow_hashref ) {
- $itemtypes{ $IT->{'itemtype'} } = $IT;
- }
- return ( \%itemtypes );
- } else {
- return [ sort { lc $a->{translated_description} cmp lc $b->{translated_description} } @{ $sth->fetchall_arrayref( {} ) } ];
- }
-}
-
=head2 GetItemTypesCategorized
$categories = GetItemTypesCategorized();
return ($dbh->selectall_hashref($query,'itemtype'));
}
-=head2 getitemtypeinfo
-
- $itemtype = &getitemtypeinfo($itemtype, [$interface]);
-
-Returns information about an itemtype. The optional $interface argument
-sets which interface ('opac' or 'intranet') to return the imageurl for.
-Defaults to intranet.
-
-=cut
-
-sub getitemtypeinfo {
- my ($itemtype, $interface) = @_;
- my $dbh = C4::Context->dbh;
- require C4::Languages;
- my $language = C4::Languages::getlanguage();
- my $it = $dbh->selectrow_hashref(q|
- SELECT
- itemtypes.itemtype,
- itemtypes.description,
- itemtypes.rentalcharge,
- itemtypes.notforloan,
- itemtypes.imageurl,
- itemtypes.summary,
- itemtypes.checkinmsg,
- itemtypes.checkinmsgtype,
- itemtypes.sip_media_type,
- COALESCE( localization.translation, itemtypes.description ) AS translated_description
- FROM itemtypes
- LEFT JOIN localization ON itemtypes.itemtype = localization.code
- AND localization.entity = 'itemtypes'
- AND localization.lang = ?
- WHERE itemtypes.itemtype = ?
- |, undef, $language, $itemtype );
-
- $it->{imageurl} = getitemtypeimagelocation( ( ( defined $interface && $interface eq 'opac' ) ? 'opac' : 'intranet' ), $it->{imageurl} );
-
- return $it;
-}
-
=head2 getitemtypeimagedir
my $directory = getitemtypeimagedir( 'opac' );
idx => 'location',
label => 'Location',
tags => [ qw/ 995e / ],
+ },
+ {
+ idx => 'ccode',
+ label => 'CollectionCodes',
+ tags => [ qw / 099t 955h / ],
}
];
label => 'Location',
tags => [ qw / 952c / ],
},
+ {
+ idx => 'ccode',
+ label => 'CollectionCodes',
+ tags => [ qw / 9528 / ],
+ }
];
unless ( Koha::Libraries->search->count == 1 )
return wantarray ? @issns : join( " | ", @issns );
}
-
-=head2 IsKohaFieldLinked
-
- my $is_linked = IsKohaFieldLinked({
- kohafield => $kohafield,
- frameworkcode => $frameworkcode,
- });
-
- Return 1 if the field is linked
-
-=cut
-
-sub IsKohaFieldLinked {
- my ( $params ) = @_;
- my $kohafield = $params->{kohafield};
- my $frameworkcode = $params->{frameworkcode} || '';
- my $dbh = C4::Context->dbh;
- my $is_linked = $dbh->selectcol_arrayref( q|
- SELECT COUNT(*)
- FROM marc_subfield_structure
- WHERE frameworkcode = ?
- AND kohafield = ?
- |,{}, $frameworkcode, $kohafield );
- return $is_linked->[0];
-}
-
1;
__END__