$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;
}
my ( $bntag, $bnsubf ) = GetMarcFromKohaField('biblio.biblionumber');
my ( $itemtag, $itemsubf ) = GetMarcFromKohaField('items.itemnumber');
+ if ($tag eq $itemtag) {
+ # do not allow the embedded item tag to be
+ # edited from here
+ warn "Attempting to edit item tag via C4::Search::ModBiblios -- not allowed";
+ return (0, []);
+ }
foreach my $usmarc (@$listbiblios) {
my $record;
$record = eval { MARC::Record->new_from_usmarc($usmarc) };
if ($@) {
# usmarc is not a valid usmarc May be a biblionumber
- if ( $tag eq $itemtag ) {
- my $bib = GetBiblioFromItemNumber($usmarc);
- $record = GetMarcItem( $bib->{'biblionumber'}, $usmarc );
- $biblionumber = $bib->{'biblionumber'};
- }
- else {
- $record = GetMarcBiblio($usmarc);
- $biblionumber = $usmarc;
- }
+ # FIXME - sorry, please let's figure out whether
+ # this function is to be passed a list of
+ # record numbers or a list of MARC::Record
+ # objects. The former is probably better
+ # because the MARC records supplied by Zebra
+ # may be not current.
+ $record = GetMarcBiblio($usmarc);
+ $biblionumber = $usmarc;
}
else {
if ( $bntag >= 010 ) {
if (C4::Context->userenv->{'flags'}==1 ||(C4::Context->userenv->{'flags'} & ( 2**9 ) )){
#Edit Catalogue Permissions
+ my $editable_subfields = GetManagedTagSubfields();
+ # change '--' to '—' to avoid escaping issues
+ for (my $i = 0; $i <= $#{$editable_subfields}; $i++) {
+ $editable_subfields->[$i]->{subfielddesc} =~ s/--/—/g;
+ $editable_subfields->[$i]->{tagdesc} =~ s/--/—/g;
+ }
$template->param(bulkedit => 1);
- $template->param(tagsubfields=>GetManagedTagSubfields());
+ $template->param(tagsubfields=>$editable_subfields);
}
}