From 992abfece1ac7693283ee96df1042629e0e5e0e1 Mon Sep 17 00:00:00 2001 From: Zeno Tajoli Date: Wed, 21 Sep 2011 15:43:39 +0200 Subject: [PATCH] [bug 5528] "Content-Type: text/plain Those are the last modifications to support Unimarc in this develop. In the others points, Unimarc support is present --- cataloguing/additem.pl | 36 ++++++++++++++++++++++++-------- installer/data/mysql/updatedatabase.pl | 16 ++++++++++--- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 804ff4a..f8ef672 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -544,20 +544,38 @@ my @fields = $temp->fields(); my @hostitemnumbers; -foreach my $hostfield ($temp->field('773')){ - if ($hostfield->subfield('0')){ - my $hostrecord = GetMarcBiblio($hostfield->subfield('0'), 1); - foreach my $hostitem ($hostrecord->field('952')){ - if ($hostitem->subfield('9') eq $hostfield->subfield('9')){ - push (@fields, $hostitem); - push (@hostitemnumbers, $hostfield->subfield('9')); - } +if ($marcflavour eq 'MARC21'){ + foreach my $hostfield ($temp->field('773')){ + if ($hostfield->subfield('0')){ + my $hostrecord = GetMarcBiblio($hostfield->subfield('0'), 1); + foreach my $hostitem ($hostrecord->field('952')){ + if ($hostitem->subfield('9') eq $hostfield->subfield('9')){ + push (@fields, $hostitem); + push (@hostitemnumbers, $hostfield->subfield('9')); } - } + } + } + } +} +if ($marcflavour eq 'UNIMARC'){ + foreach my $hostfield ($temp->field('461')){ + if ($hostfield->subfield('0')){ + my $hostrecord = GetMarcBiblio($hostfield->subfield('0'), 1); + foreach my $hostitem ($hostrecord->field('995')){ + if ($hostitem->subfield('9') eq $hostfield->subfield('9')){ + push (@fields, $hostitem); + push (@hostitemnumbers, $hostfield->subfield('9')); + } + } + } + } } + + + foreach my $field (@fields) { next if ( $field->tag() < 10 ); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f881cd8..aafb1b8 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4454,10 +4454,18 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = '3.05.00.012'; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); - $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); - print "Upgrade to $DBversion done (Add 773 subfield 9 and 0 to default framework)\n"; - SetVersion ($DBversion); + if (C4::Context->preference("marcflavour") eq 'MARC21'){ + $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); + $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); + print "Upgrade to $DBversion done (Add 773 subfield 9 and 0 to default framework)\n"; + SetVersion ($DBversion); + } + if (C4::Context->preference("marcflavour") eq 'UNIMARC'){ + $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('461', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); + print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n"; + SetVersion ($DBversion); + } + } -- 1.7.3.1.msysgit.0