use strict;
-require Exporter;
use C4::Context;
use C4::Output;
-our ($VERSION,@ISA,@EXPORT);
-
-$VERSION = 3.00;
+use vars qw($VERSION @ISA @EXPORT $DEBUG);
+
+BEGIN {
+ $VERSION = 3.01;
+ require Exporter;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(
+ &slashifyDate
+ &DisplayISBN
+ &subfield_is_koha_internal_p
+ &GetPrinters &GetPrinter
+ &GetItemTypes &getitemtypeinfo
+ &GetCcodes
+ &get_itemtypeinfos_of
+ &getframeworks &getframeworkinfo
+ &getauthtypes &getauthtype
+ &getallthemes
+ &getFacets
+ &displayServers
+ &getnbpages
+ &getitemtypeimagesrcfromurl
+ &get_infos_of
+ &get_notforloan_label_of
+ &getitemtypeimagedir
+ &getitemtypeimagesrc
+ &GetAuthorisedValues
+ &GetKohaAuthorisedValues
+ &GetAuthValCode
+ &GetManagedTagSubfields
+
+ $DEBUG
+ );
+ $DEBUG = 0;
+}
=head1 NAME
=over 2
=cut
-
-@ISA = qw(Exporter);
-@EXPORT = qw(
- &slashifyDate
- &DisplayISBN
- &subfield_is_koha_internal_p
- &GetPrinters &GetPrinter
- &GetItemTypes &getitemtypeinfo
- &GetCcodes
- &get_itemtypeinfos_of
- &getframeworks &getframeworkinfo
- &getauthtypes &getauthtype
- &getallthemes
- &getFacets
- &displayServers
- &getnbpages
- &getitemtypeimagesrcfromurl
- &get_infos_of
- &get_notforloan_label_of
- &getitemtypeimagedir
- &getitemtypeimagesrc
- &GetAuthorisedValues
- &FixEncoding
- &GetKohaAuthorisedValues
- &GetAuthValCode
- &GetManagedTagSubfields
-
- $DEBUG
- );
-
-my $DEBUG = 0;
-
=head2 slashifyDate
$slash_date = &slashifyDate($dash_date);
}
sub getitemtypeimagedir {
- return C4::Context->opachtdocs . '/'
- . C4::Context->preference('template')
- . '/itemtypeimg';
+ my $src = shift;
+ if ($src eq 'intranet') {
+ return C4::Context->config('intrahtdocs') . '/' .C4::Context->preference('template') . '/img/itemtypeimg';
+ }
+ else {
+ return C4::Context->config('opachtdocs') . '/' . C4::Context->preference('template') . '/itemtypeimg';
+ }
}
sub getitemtypeimagesrc {
- return '/opac-tmpl' . '/'
- . C4::Context->preference('template')
- . '/itemtypeimg';
+ my $src = shift;
+ if ($src eq 'intranet') {
+ return '/intranet-tmpl' . '/' . C4::Context->preference('template') . '/img/itemtypeimg';
+ }
+ else {
+ return '/opac-tmpl' . '/' . C4::Context->preference('template') . '/itemtypeimg';
+ }
}
=head2 GetPrinters
value => $data->{host} . ":"
. $data->{port} . "/"
. $data->{database},
+ encoding => ($data->{encoding}?$data->{encoding}:"iso-5426"),
checked => "checked",
icon => $data->{icon},
zed => $data->{type} eq 'zed',
return \@results; #$data;
}
-=item fixEncoding
-
- $marcrecord = &fixEncoding($marcblob);
-
-Returns a well encoded marcrecord.
-
-=cut
-sub FixEncoding {
- my $marc=shift;
- my $record = MARC::Record->new_from_usmarc($marc);
- if (C4::Context->preference("MARCFLAVOUR") eq "UNIMARC"){
- use Encode::Guess;
- my $targetcharset="utf8" if (C4::Context->preference("TemplateEncoding") eq "utf-8");
- $targetcharset="latin1" if (C4::Context->preference("TemplateEncoding") eq "iso-8859-1");
- my $decoder = guess_encoding($marc, qw/utf8 latin1/);
-# die $decoder unless ref($decoder);
- if (ref($decoder)) {
- my $newRecord=MARC::Record->new();
- foreach my $field ($record->fields()){
- if ($field->tag()<'010'){
- $newRecord->insert_grouped_field($field);
- } else {
- my $newField;
- my $createdfield=0;
- foreach my $subfield ($field->subfields()){
- if ($createdfield){
- if (($newField->tag eq '100')) {
- substr($subfield->[1],26,2,"0103") if ($targetcharset eq "latin1");
- substr($subfield->[1],26,4,"5050") if ($targetcharset eq "utf8");
- }
- map {C4::Biblio::char_decode($_,"UNIMARC")} @$subfield;
- $newField->add_subfields($subfield->[0]=>$subfield->[1]);
- } else {
- map {C4::Biblio::char_decode($_,"UNIMARC")} @$subfield;
- $newField=MARC::Field->new($field->tag(),$field->indicator(1),$field->indicator(2),$subfield->[0]=>$subfield->[1]);
- $createdfield=1;
- }
- }
- $newRecord->insert_grouped_field($newField);
- }
- }
- # warn $newRecord->as_formatted();
- return $newRecord;
- } else {
- return $record;
- }
- } else {
- return $record;
- }
-}
-
=head2 GetKohaAuthorisedValues
Takes $dbh , $kohafield as parameters.
$res = GetManagedTagSubfields();
+=back
+
Returns a reference to a big hash of hash, with the Marc structure fro the given frameworkcode
-$forlibrarian :if set to 1, the MARC descriptions are the librarians ones, otherwise it's the public (OPAC) ones
-$frameworkcode : the framework code to read
-=back
+NOTE: This function is used only by the (incomplete) bulk editing feature. Since
+that feature currently does not deal with items and biblioitems changes
+correctly, those tags are specifically excluded from the list prepared
+by this function.
-=back
+For future reference, if a bulk item editing feature is implemented at some point, it
+needs some design thought -- for example, circulation status fields should not
+be changed willy-nilly.
=cut
ON marc_tag_structure.tagfield = marc_subfield_structure.tagfield
AND marc_tag_structure.frameworkcode = marc_subfield_structure.frameworkcode
WHERE marc_subfield_structure.tab>=0
-ORDER BY tagsubfield|);
+AND marc_tag_structure.tagfield NOT IN (SELECT tagfield FROM marc_subfield_structure WHERE kohafield like 'items.%')
+AND marc_tag_structure.tagfield NOT IN (SELECT tagfield FROM marc_subfield_structure WHERE kohafield = 'biblioitems.itemtype')
+AND marc_subfield_structure.kohafield <> 'biblio.biblionumber'
+AND marc_subfield_structure.kohafield <> 'biblioitems.biblioitemnumber'
+ORDER BY marc_subfield_structure.tagfield, tagsubfield|);
$rq->execute;
my $data=$rq->fetchall_arrayref({});
return $data;