use Business::ISBN;
use autouse 'Data::cselectall_arrayref' => qw(Dumper);
use DBI qw(:sql_types);
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG);
+use vars qw(@ISA @EXPORT @EXPORT_OK $DEBUG);
BEGIN {
$VERSION = 3.07.00.049;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
- &slashifyDate
- &subfield_is_koha_internal_p
&GetPrinters &GetPrinter
&GetItemTypes &getitemtypeinfo
&GetItemTypesCategorized &GetItemTypesByCategory
&GetFrameworksLoop
&getallthemes
&getFacets
- &displayServers
&getnbpages
&get_infos_of
&get_notforloan_label_of
&getitemtypeimagelocation
&GetAuthorisedValues
&GetAuthorisedValueCategories
- &IsAuthorisedValueCategory
&GetKohaAuthorisedValues
&GetKohaAuthorisedValuesFromField
&GetKohaAuthorisedValuesMapping
&GetKohaAuthorisedValueLib
&GetAuthorisedValueByCode
&GetAuthValCode
- &AddAuthorisedValue
&GetNormalizedUPC
&GetNormalizedISBN
&GetNormalizedEAN
=cut
-=head2 slashifyDate
-
- $slash_date = &slashifyDate($dash_date);
-
-Takes a string of the form "DD-MM-YYYY" (or anything separated by
-dashes), converts it to the form "YYYY/MM/DD", and returns the result.
-
-=cut
-
-sub slashifyDate {
-
- # accepts a date of the form xx-xx-xx[xx] and returns it in the
- # form xx/xx/xx[xx]
- my @dateOut = split( '-', shift );
- return ("$dateOut[2]/$dateOut[1]/$dateOut[0]");
-}
-
-# FIXME.. this should be moved to a MARC-specific module
-sub subfield_is_koha_internal_p {
- my ($subfield) = @_;
-
- # We could match on 'lib' and 'tab' (and 'mandatory', & more to come!)
- # But real MARC subfields are always single-character
- # so it really is safer just to check the length
-
- return length $subfield != 1;
-}
-
=head2 GetSupportName
$itemtypename = &GetSupportName($codestring);
}
];
- unless ( C4::Context->preference("singleBranchMode")
- || Koha::Libraries->search->count == 1 )
+ unless ( Koha::Libraries->search->count == 1 )
{
my $DisplayLibraryFacets = C4::Context->preference('DisplayLibraryFacets');
if ( $DisplayLibraryFacets eq 'both'
},
];
- unless ( C4::Context->preference("singleBranchMode")
- || Koha::Libraries->search->count == 1 )
+ unless ( Koha::Libraries->search->count == 1 )
{
my $DisplayLibraryFacets = C4::Context->preference('DisplayLibraryFacets');
if ( $DisplayLibraryFacets eq 'both'
return \%notforloan_label_of;
}
-=head2 displayServers
-
- my $servers = displayServers();
- my $servers = displayServers( $position );
- my $servers = displayServers( $position, $type );
-
-displayServers returns a listref of hashrefs, each containing
-information about available z3950 servers. Each hashref has a format
-like:
-
- {
- 'checked' => 'checked',
- 'encoding' => 'utf8',
- 'icon' => undef,
- 'id' => 'LIBRARY OF CONGRESS',
- 'label' => '',
- 'name' => 'server',
- 'opensearch' => '',
- 'value' => 'lx2.loc.gov:210/',
- 'zed' => 1,
- },
-
-=cut
-
-sub displayServers {
- my ( $position, $type ) = @_;
- my $dbh = C4::Context->dbh;
-
- my $strsth = 'SELECT * FROM z3950servers';
- my @where_clauses;
- my @bind_params;
-
- if ($position) {
- push @bind_params, $position;
- push @where_clauses, ' position = ? ';
- }
-
- if ($type) {
- push @bind_params, $type;
- push @where_clauses, ' type = ? ';
- }
-
- # reassemble where clause from where clause pieces
- if (@where_clauses) {
- $strsth .= ' WHERE ' . join( ' AND ', @where_clauses );
- }
-
- my $rq = $dbh->prepare($strsth);
- $rq->execute(@bind_params);
- my @primaryserverloop;
-
- while ( my $data = $rq->fetchrow_hashref ) {
- push @primaryserverloop,
- { label => $data->{description},
- id => $data->{name},
- name => "server",
- value => $data->{host} . ":" . $data->{port} . "/" . $data->{database},
- encoding => ( $data->{encoding} ? $data->{encoding} : "iso-5426" ),
- checked => "checked",
- icon => $data->{icon},
- zed => $data->{type} eq 'zed',
- opensearch => $data->{type} eq 'opensearch'
- };
- }
- return \@primaryserverloop;
-}
-
=head2 GetAuthValCode
$authvalcode = GetAuthValCode($kohafield,$frameworkcode);
return \@results;
}
-=head2 IsAuthorisedValueCategory
-
- $is_auth_val_category = IsAuthorisedValueCategory($category);
-
-Returns whether a given category name is a valid one
-
-=cut
-
-sub IsAuthorisedValueCategory {
- my $category = shift;
- my $query = '
- SELECT category
- FROM authorised_values
- WHERE category=?
- LIMIT 1
- ';
- my $sth = C4::Context->dbh->prepare($query);
- $sth->execute($category);
- $sth->fetchrow ? return 1
- : return 0;
-}
-
=head2 GetAuthorisedValueByCode
$authorised_value = GetAuthorisedValueByCode( $category, $authvalcode, $opac );
return $value;
}
-=head2 AddAuthorisedValue
-
- AddAuthorisedValue($category, $authorised_value, $lib, $lib_opac, $imageurl);
-
-Create a new authorised value.
-
-=cut
-
-sub AddAuthorisedValue {
- my ($category, $authorised_value, $lib, $lib_opac, $imageurl) = @_;
-
- my $dbh = C4::Context->dbh;
- my $query = qq{
- INSERT INTO authorised_values (category, authorised_value, lib, lib_opac, imageurl)
- VALUES (?,?,?,?,?)
- };
- my $sth = $dbh->prepare($query);
- $sth->execute($category, $authorised_value, $lib, $lib_opac, $imageurl);
-}
-
=head2 display_marc_indicators
my $display_form = C4::Koha::display_marc_indicators($field);