@@ -, +, @@ --- cataloguing/additem.pl | 36 ++++++++++++++++++++++++-------- installer/data/mysql/updatedatabase.pl | 16 ++++++++++--- 2 files changed, 39 insertions(+), 13 deletions(-) --- a/cataloguing/additem.pl +++ a/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 ); --- a/installer/data/mysql/updatedatabase.pl +++ a/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); + } + } --