From cc3ff5e7df4d7fa180ff2da236765182d4644571 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Mon, 19 Mar 2018 15:11:05 +0200 Subject: [PATCH] Bug 20447: MARC Holdings support https://bugs.koha-community.org/show_bug.cgi?id=20447 Enable by setting "SummaryHoldings" option to "Use". --- C4/Biblio.pm | 17 + C4/Holdings.pm | 744 +++++++++++++++++++++ C4/Items.pm | 5 +- C4/Search.pm | 8 + C4/XSLT.pm | 33 +- Koha/Holding.pm | 72 ++ Koha/Holdings.pm | 64 ++ Koha/Holdings/Metadata.pm | 44 ++ Koha/Holdings/Metadatas.pm | 50 ++ Koha/Template/Plugin/Holdings.pm | 90 +++ admin/marc_subfields_structure.pl | 5 + catalogue/detail.pl | 10 +- cataloguing/addholding.pl | 729 ++++++++++++++++++++ cataloguing/additem.pl | 11 + .../value_builder/marc21_field_008_holdings.pl | 120 ++++ .../value_builder/marc21_leader_holdings.pl | 85 +++ .../atomicupdate/bug_20447-add_holdings_tables.sql | 398 +++++++++++ .../marc21/mandatory/marc21_framework_DEFAULT.sql | 326 ++++++++- installer/data/mysql/kohastructure.sql | 52 +- installer/data/mysql/mandatory/auth_val_cat.sql | 1 + koha-tmpl/intranet-tmpl/prog/css/addholding.css | 171 +++++ .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 4 + .../prog/en/modules/admin/biblio_framework.tt | 3 +- .../en/modules/admin/preferences/cataloguing.pref | 7 + .../prog/en/modules/catalogue/detail.tt | 59 +- .../prog/en/modules/catalogue/moredetail.tt | 2 + .../prog/en/modules/catalogue/results.tt | 14 + .../prog/en/modules/cataloguing/addholding.tt | 615 +++++++++++++++++ .../value_builder/marc21_field_008_holdings.tt | 193 ++++++ .../value_builder/marc21_leader_holdings.tt | 105 +++ .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 28 + .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 10 + .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 19 +- opac/opac-detail.pl | 7 + 34 files changed, 4090 insertions(+), 11 deletions(-) create mode 100644 C4/Holdings.pm create mode 100644 Koha/Holding.pm create mode 100644 Koha/Holdings.pm create mode 100644 Koha/Holdings/Metadata.pm create mode 100644 Koha/Holdings/Metadatas.pm create mode 100644 Koha/Template/Plugin/Holdings.pm create mode 100755 cataloguing/addholding.pl create mode 100755 cataloguing/value_builder/marc21_field_008_holdings.pl create mode 100755 cataloguing/value_builder/marc21_leader_holdings.pl create mode 100644 installer/data/mysql/atomicupdate/bug_20447-add_holdings_tables.sql create mode 100644 koha-tmpl/intranet-tmpl/prog/css/addholding.css create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addholding.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008_holdings.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_leader_holdings.tt diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 0c5a917..447ef96 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -44,6 +44,7 @@ use Koha::Authority::Types; use Koha::Acquisition::Currencies; use Koha::Biblio::Metadata; use Koha::Biblio::Metadatas; +use Koha::Holdings; use Koha::Holds; use Koha::ItemTypes; use Koha::SearchEngine; @@ -1561,6 +1562,22 @@ sub GetAuthorisedValueDesc { return $itemtype ? $itemtype->translated_description : q||; } + #---- holdings + if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "holdings" ) { + my $holding = Koha::Holdings->find( $value ); + if ( $holding ) { + my @parts; + + push @parts, $value; + push @parts, $holding->holdingbranch() if $holding->holdingbranch(); + push @parts, $holding->location() if $holding->location(); + push @parts, $holding->callnumber() if $holding->callnumber(); + + return join(' ', @parts); + } + return q||; + } + #---- "true" authorized value $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'}; } diff --git a/C4/Holdings.pm b/C4/Holdings.pm new file mode 100644 index 0000000..017fad8 --- /dev/null +++ b/C4/Holdings.pm @@ -0,0 +1,744 @@ +package C4::Holdings; + +# Copyright 2000-2002 Katipo Communications +# Copyright 2010 BibLibre +# Copyright 2011 Equinox Software, Inc. +# Copyright 2017-2018 University of Helsinki (The National Library Of Finland) +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; +use Carp; + +# TODO check which use's are really necessary + +use Encode qw( decode is_utf8 ); +use List::MoreUtils qw( uniq ); +use MARC::Record; +use MARC::File::USMARC; +use MARC::File::XML; +use POSIX qw(strftime); + +use C4::Koha; +use C4::Log; # logaction +use C4::ClassSource; +use C4::Charset; +use C4::Debug; + +use Koha::Caches; +use Koha::Holdings::Metadata; +use Koha::Holdings::Metadatas; +use Koha::Libraries; + +use vars qw(@ISA @EXPORT); +use vars qw($debug $cgi_debug); + +BEGIN { + + require Exporter; + @ISA = qw( Exporter ); + + # to add holdings + # EXPORTED FUNCTIONS. + push @EXPORT, qw( + &AddHolding + ); + + # to get something + push @EXPORT, qw( + GetHolding + ); + + # To modify something + push @EXPORT, qw( + &ModHolding + ); + + # To delete something + push @EXPORT, qw( + &DelHolding + ); +} + +=head1 NAME + +C4::Holding - cataloging management functions + +=head1 DESCRIPTION + +Holding.pm contains functions for managing storage and editing of holdings data within Koha. Most of the functions in this module are used for cataloging holdings records: adding, editing, or removing holdings. Koha stores holdings information in two places: + +=over 4 + +=item 1. in the holdings table which is limited to a one-to-one mapping to underlying MARC data + +=item 2. as MARC XML in holdings_metadata.metadata + +=back + +In the 3.0 version of Koha, the authoritative record-level information is in holdings_metadata.metadata + +Because the data isn't completely normalized there's a chance for information to get out of sync. The design choice to go with a un-normalized schema was driven by performance and stability concerns. However, if this occur, it can be considered as a bug : The API is (or should be) complete & the only entry point for all holdings management. + +=over 4 + +=item 1. Add*/Mod*/Del*/ - high-level external functions suitable for being called from external scripts to manage the collection + +=back + +The MARC record (in holdings_metadata.metadata) contains the MARC holdings record. It also contains the holding_id. That is the reason why it is not stored directly by AddHolding, with all other fields. To save a holding, we need to: + +=over 4 + +=item 1. save data in holdings table, that gives us a holding_id + +=item 2. add the holding_id into the MARC record + +=item 3. save the marc record + +=back + +=head1 EXPORTED FUNCTIONS + +=head2 AddHolding + + $holding_id = AddHolding($record, $frameworkcode, $biblionumber); + +Exported function (core API) for adding a new holding to koha. + +The first argument is a C object containing the +holding to add, while the second argument is the desired MARC +framework code and third the biblionumber to link to. + +=cut + +sub AddHolding { + my $record = shift; + my $frameworkcode = shift; + my $biblionumber = shift; + if (!$record) { + carp('AddHolding called with undefined record'); + return; + } + + my $dbh = C4::Context->dbh; + + my $biblio = Koha::Biblios->find( $biblionumber ); + my $biblioitemnumber = $biblio->biblioitem->biblioitemnumber; + + # transform the data into koha-table style data + SetUTF8Flag($record); + my $rowData = TransformMarcHoldingToKoha( $record ); + my ($holding_id) = _koha_add_holding( $dbh, $rowData, $frameworkcode, $biblionumber, $biblioitemnumber ); + + _koha_marc_update_ids( $record, $frameworkcode, $holding_id, $biblionumber, $biblioitemnumber ); + + # now add the record + ModHoldingMarc( $record, $holding_id, $frameworkcode ); + + logaction( "CATALOGUING", "ADD", $holding_id, "holding" ) if C4::Context->preference("CataloguingLog"); + return $holding_id; +} + +=head2 ModHolding + + ModHolding($record, $holding_id, $frameworkcode); + +Replace an existing holding record identified by C<$holding_id> +with one supplied by the MARC::Record object C<$record>. + +C<$frameworkcode> specifies the MARC framework to use +when storing the modified holdings record. + +Returns 1 on success 0 on failure + +=cut + +sub ModHolding { + my ( $record, $holding_id, $frameworkcode ) = @_; + if (!$record) { + carp 'No record passed to ModHolding'; + return 0; + } + + if ( C4::Context->preference("CataloguingLog") ) { + my $newrecord = GetMarcHolding($holding_id); + logaction( "CATALOGUING", "MODIFY", $holding_id, "holding BEFORE=>" . $newrecord->as_formatted ); + } + + # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to + # throw an exception which probably won't be handled. + foreach my $field ($record->fields()) { + if (! $field->is_control_field()) { + if (scalar($field->subfields()) == 0 || (scalar($field->subfields()) == 1 && $field->subfield('9'))) { + $record->delete_field($field); + } + } + } + + SetUTF8Flag($record); + my $dbh = C4::Context->dbh; + + $frameworkcode = 'HLD' if !$frameworkcode || $frameworkcode eq 'Default'; + + # update holding_id in MARC + _koha_marc_update_ids( $record, $frameworkcode, $holding_id ); + + # load the koha-table data object + my $rowData = TransformMarcHoldingToKoha( $record ); + # update the MARC record (that now contains biblio and items) with the new record data + &ModHoldingMarc( $record, $holding_id, $frameworkcode ); + + # modify the other koha tables + _koha_modify_holding( $dbh, $holding_id, $rowData, $frameworkcode ); + + return 1; +} + +=head2 DelHolding + + my $error = &DelHolding($holding_id); + +Exported function (core API) for deleting a holding in koha. +Deletes holding record from Koha tables (holdings, holdings_metadata) +Also backs it up to deleted* tables. +Checks to make sure that the holding has no items attached. +return: +C<$error> : undef unless an error occurs + +=cut + +sub DelHolding { + my ($holding_id) = @_; + my $dbh = C4::Context->dbh; + my $error; # for error handling + + # First make sure this holding has no items attached + my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE holding_id=?"); + $sth->execute($holding_id); + if ( my $itemnumber = $sth->fetchrow ) { + + # Fix this to use a status the template can understand + $error .= "This holding record has items attached, please delete them first before deleting this holding record "; + } + + return $error if $error; + + # delete holding + _koha_delete_holding( $dbh, $holding_id ); + + logaction( "CATALOGUING", "DELETE", $holding_id, "holding" ) if C4::Context->preference("CataloguingLog"); + + return; +} + +=head2 GetHolding + + my $holding = &GetHolding($holding_id); + +=cut + +sub GetHolding { + my ($holding_id) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("SELECT * FROM holding WHERE holding_id = ? AND deleted_on IS NULL"); + my $count = 0; + my @results; + $sth->execute($holding_id); + if ( my $data = $sth->fetchrow_hashref ) { + return $data; + } + return; +} + +=head2 GetHoldingsByBiblionumber + + GetHoldingsByBiblionumber($biblionumber); + +Returns an arrayref of hashrefs suitable for use in a TMPL_LOOP +Called by C + +=cut + +sub GetHoldingsByBiblionumber { + my ( $bib ) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("SELECT * FROM holdings WHERE holdings.biblionumber = ? AND deleted_on IS NULL") || die $dbh->errstr; + # Get all holdings attached to a biblioitem + my $i = 0; + my @results; + $sth->execute($bib) || die $sth->errstr; + while ( my $data = $sth->fetchrow_hashref ) { + push(@results, $data); + } + return (\@results); +} + +=head2 GetMarcHolding + + my $record = GetMarcHolding(holding_id, [$opac]); + +Returns MARC::Record representing a holding record, or C if the +record doesn't exist. + +=over 4 + +=item C<$holding_id> + +the holding_id + +=item C<$opac> + +set to true to make the result suited for OPAC view. This causes things like +OpacHiddenItems to be applied. + +=back + +=cut + +sub GetMarcHolding { + my $holding_id = shift; + my $opac = shift || 0; + + if (not defined $holding_id) { + carp 'GetMarcHolding called with undefined holding_id'; + return; + } + + my $marcflavour = C4::Context->preference('marcflavour'); + + my $marcxml = GetXmlHolding( $holding_id ); + $marcxml = StripNonXmlChars( $marcxml ); + my $frameworkcode = GetHoldingFrameworkCode( $holding_id ); + MARC::File::XML->default_record_format( $marcflavour ); + + if ($marcxml) { + my $record = eval { + MARC::Record::new_from_xml( $marcxml, "utf8", $marcflavour ); + }; + if ($@) { warn " problem with holding $holding_id : $@ \n$marcxml"; } + return unless $record; + + _koha_marc_update_ids( $record, $frameworkcode, $holding_id ); + + return $record; + } + return; +} + +=head2 GetXmlHolding + + my $marcxml = GetXmlHolding($holding_id); + +Returns holdings_metadata.metadata/marcxml of the holding_id passed in parameter. + +=cut + +sub GetXmlHolding { + my ($holding_id) = @_; + return unless $holding_id; + + my $marcflavour = C4::Context->preference('marcflavour'); + my $sth = C4::Context->dbh->prepare( + q| + SELECT metadata + FROM holdings_metadata + WHERE holding_id=? + AND format='marcxml' + AND marcflavour=? + | + ); + + $sth->execute( $holding_id, $marcflavour ); + my ($marcxml) = $sth->fetchrow(); + $sth->finish(); + return $marcxml; +} + +=head2 GetHoldingFrameworkCode + + $frameworkcode = GetFrameworkCode( $holding_id ) + +=cut + +sub GetHoldingFrameworkCode { + my ($holding_id) = @_; + my $sth = C4::Context->dbh->prepare("SELECT frameworkcode FROM holdings WHERE holding_id=?"); + $sth->execute($holding_id); + my ($frameworkcode) = $sth->fetchrow; + $sth->finish(); + return $frameworkcode; +} + +=head1 INTERNAL FUNCTIONS + +=head2 _koha_add_holding + + my ($holding_id,$error) = _koha_add_hodings($dbh, $holding, $frameworkcode, $biblionumber, $biblioitemnumber); + +Internal function to add a holding ($holding is a hash with the values) + +=cut + +sub _koha_add_holding { + my ( $dbh, $holding, $frameworkcode, $biblionumber, $biblioitemnumber ) = @_; + + my $error; + + my $query = "INSERT INTO holdings + SET biblionumber = ?, + biblioitemnumber = ?, + frameworkcode = ?, + holdingbranch = ?, + location = ?, + callnumber = ?, + suppress = ?, + datecreated = NOW() + "; + + my $sth = $dbh->prepare($query); + $sth->execute( + $biblionumber, $biblioitemnumber, $frameworkcode, + $holding->{holdingbranch}, $holding->{location}, $holding->{callnumber}, $holding->{suppress} + ); + + my $holding_id = $dbh->{'mysql_insertid'}; + if ( $dbh->errstr ) { + $error .= "ERROR in _koha_add_holding $query" . $dbh->errstr; + warn $error; + } + + $sth->finish(); + + return ( $holding_id, $error ); +} + +=head2 _koha_modify_holding + + my ($biblionumber,$error) == _koha_modify_holding($dbh, $holding, $frameworkcode); + +Internal function for updating the holdings table + +=cut + +sub _koha_modify_holding { + my ( $dbh, $holding_id, $holding, $frameworkcode ) = @_; + my $error; + + my $query = " + UPDATE holdings + SET frameworkcode = ?, + holdingbranch = ?, + location = ?, + callnumber = ?, + suppress = ? + WHERE holding_id = ? + " + ; + my $sth = $dbh->prepare($query); + + $sth->execute( + $frameworkcode, $holding->{holdingbranch}, $holding->{location}, $holding->{callnumber}, $holding->{suppress}, $holding_id + ) if $holding_id; + + if ( $dbh->errstr || !$holding_id ) { + die "ERROR in _koha_modify_holding for holding $holding_id: " . $dbh->errstr; + } + return ( $holding_id, $error ); +} + +=head2 _koha_delete_holding + + $error = _koha_delete_holding($dbh, $holding_id); + +Internal sub for deleting from holdings table + +C<$dbh> - the database handle + +C<$holding_id> - the holding_id of the holding to be deleted + +=cut + +sub _koha_delete_holding { + my ( $dbh, $holding_id ) = @_; + + my $schema = Koha::Database->new->schema; + $schema->txn_do( + sub { + $dbh->do('UPDATE holdings_metadata SET deleted_on = NOW() WHERE holding_id=?', undef, $holding_id); + $dbh->do('UPDATE holdings SET deleted_on = NOW() WHERE holding_id=?', undef, $holding_id); + } + ); + return; +} + +=head1 INTERNAL FUNCTIONS + +=head2 _koha_marc_update_ids + + + _koha_marc_update_ids($record, $frameworkcode, $holding_id[, $biblionumber, $biblioitemnumber]); + +Internal function to add or update holding_id, biblionumber and biblioitemnumber to +the MARC XML. + +=cut + +sub _koha_marc_update_ids { + my ( $record, $frameworkcode, $holding_id, $biblionumber, $biblioitemnumber ) = @_; + + my ( $holding_tag, $holding_subfield ) = GetMarcHoldingFromKohaField( "holdings.holding_id" ); + die qq{No holding_id tag for framework "$frameworkcode"} unless $holding_tag; + + if ( $holding_tag < 10 ) { + C4::Biblio::UpsertMarcControlField( $record, $holding_tag, $holding_id ); + } else { + C4::Biblio::UpsertMarcSubfield($record, $holding_tag, $holding_subfield, $holding_id); + } + + if ( defined $biblionumber ) { + my ( $biblio_tag, $biblio_subfield ) = GetMarcHoldingFromKohaField( "biblio.biblionumber" ); + die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag; + if ( $biblio_tag < 10 ) { + C4::Biblio::UpsertMarcControlField( $record, $biblio_tag, $biblionumber ); + } else { + C4::Biblio::UpsertMarcSubfield($record, $biblio_tag, $biblio_subfield, $biblionumber); + } + } + if ( defined $biblioitemnumber ) { + my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcHoldingFromKohaField( "biblioitems.biblioitemnumber" ); + die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; + if ( $biblioitem_tag < 10 ) { + C4::Biblio::UpsertMarcControlField( $record, $biblioitem_tag, $biblioitemnumber ); + } else { + C4::Biblio::UpsertMarcSubfield($record, $biblioitem_tag, $biblioitem_subfield, $biblioitemnumber); + } + } +} + +=head1 UNEXPORTED FUNCTIONS + +=head2 ModHoldingMarc + + &ModHoldingMarc($newrec,$holding_id,$frameworkcode); + +Add MARC XML data for a holding to koha + +Function exported, but should NOT be used, unless you really know what you're doing + +=cut + +sub ModHoldingMarc { + # pass the MARC::Record to this function, and it will create the records in + # the marcxml field + my ( $record, $holding_id, $frameworkcode ) = @_; + if ( !$record ) { + carp 'ModHoldingMarc passed an undefined record'; + return; + } + + # Clone record as it gets modified + $record = $record->clone(); + my $dbh = C4::Context->dbh; + my @fields = $record->fields(); + if ( !$frameworkcode ) { + $frameworkcode = ""; + } + my $sth = $dbh->prepare("UPDATE holdings SET frameworkcode=? WHERE holding_id=?"); + $sth->execute( $frameworkcode, $holding_id ); + $sth->finish; + my $encoding = C4::Context->preference("marcflavour"); + + # deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode + if ( $encoding eq "UNIMARC" ) { + my $defaultlanguage = C4::Context->preference("UNIMARCField100Language"); + $defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3); + my $string = $record->subfield( 100, "a" ); + if ( ($string) && ( length( $record->subfield( 100, "a" ) ) == 36 ) ) { + my $f100 = $record->field(100); + $record->delete_field($f100); + } else { + $string = POSIX::strftime( "%Y%m%d", localtime ); + $string =~ s/\-//g; + $string = sprintf( "%-*s", 35, $string ); + substr ( $string, 22, 3, $defaultlanguage); + } + substr( $string, 25, 3, "y50" ); + unless ( $record->subfield( 100, "a" ) ) { + $record->insert_fields_ordered( MARC::Field->new( 100, "", "", "a" => $string ) ); + } + } + + #enhancement 5374: update transaction date (005) for marc21/unimarc + if($encoding =~ /MARC21|UNIMARC/) { + my @a= (localtime) [5,4,3,2,1,0]; $a[0]+=1900; $a[1]++; + # YY MM DD HH MM SS (update year and month) + my $f005= $record->field('005'); + $f005->update(sprintf("%4d%02d%02d%02d%02d%04.1f",@a)) if $f005; + } + + my $metadata = { + holding_id => $holding_id, + format => 'marcxml', + marcflavour => C4::Context->preference('marcflavour'), + }; + # FIXME To replace with ->find_or_create? + if ( my $m_rs = Koha::Holdings::Metadatas->find($metadata) ) { + $m_rs->metadata( $record->as_xml_record($encoding) ); + $m_rs->store; + } else { + my $m_rs = Koha::Holdings::Metadata->new($metadata); + $m_rs->metadata( $record->as_xml_record($encoding) ); + $m_rs->store; + } + return $holding_id; +} + +=head2 GetMarcHoldingFromKohaField + + ( $field,$subfield ) = GetMarcHoldingFromKohaField( $kohafield ); + @fields = GetMarcHoldingFromKohaField( $kohafield ); + $field = GetMarcHoldingFromKohaField( $kohafield ); + + Returns the MARC fields & subfields mapped to $kohafield. + Uses the HLD framework that is considered as authoritative. + + In list context all mappings are returned; there can be multiple + mappings. Note that in the above example you could miss a second + mappings in the first call. + In scalar context only the field tag of the first mapping is returned. + +=cut + +sub GetMarcHoldingFromKohaField { + my ( $kohafield ) = @_; + return unless $kohafield; + # The next call uses the Default framework since it is AUTHORITATIVE + # for all Koha to MARC mappings. + my $mss = C4::Biblio::GetMarcSubfieldStructure( 'HLD' ); # Do not change framework + my @retval; + foreach( @{ $mss->{$kohafield} } ) { + push @retval, $_->{tagfield}, $_->{tagsubfield}; + } + return wantarray ? @retval : ( @retval ? $retval[0] : undef ); +} + +=head2 GetMarcHoldingSubfieldStructureFromKohaField + + my $str = GetMarcHoldingSubfieldStructureFromKohaField( $kohafield ); + + Returns marc subfield structure information for $kohafield. + Uses the HLD framework that is considered as authoritative. + + In list context returns a list of all hashrefs, since there may be + multiple mappings. In scalar context the first hashref is returned. + +=cut + +sub GetMarcHoldingSubfieldStructureFromKohaField { + my ( $kohafield ) = @_; + + return unless $kohafield; + + # The next call uses the Default framework since it is AUTHORITATIVE + # for all Koha to MARC mappings. + my $mss = C4::Biblio::GetMarcSubfieldStructure( 'HLD' ); # Do not change framework + return unless $mss->{$kohafield}; + return wantarray ? @{$mss->{$kohafield}} : $mss->{$kohafield}->[0]; +} + +=head2 TransformMarcHoldingToKoha + + $result = TransformMarcHoldingToKoha( $record, undef ) + +Extract data from a MARC holdings record into a hashref representing +Koha holdings fields. + +If passed an undefined record will log the error and return an empty +hash_ref. + +=cut + +sub TransformMarcHoldingToKoha { + my ( $record ) = @_; + + my $result = {}; + if (!defined $record) { + carp('TransformMarcToKoha called with undefined record'); + return $result; + } + + my %tables = ( holdings => 1 ); + + # The next call acknowledges HLD as the authoritative framework + # for holdings to MARC mappings. + my $mss = C4::Biblio::GetMarcSubfieldStructure( 'HLD' ); # Do not change framework + foreach my $kohafield ( keys %{ $mss } ) { + my ( $table, $column ) = split /[.]/, $kohafield, 2; + next unless $tables{$table}; + my $val = TransformMarcHoldingToKohaOneField( $kohafield, $record ); + next if !defined $val; + $result->{$column} = $val; + } + return $result; +} + +=head2 TransformMarcHoldingToKohaOneField + + $val = TransformMarcHoldingToKohaOneField( 'biblio.title', $marc ); + + Note: The authoritative Default framework is used implicitly. + +=cut + +sub TransformMarcHoldingToKohaOneField { + my ( $kohafield, $marc ) = @_; + + my ( @rv, $retval ); + my @mss = GetMarcHoldingSubfieldStructureFromKohaField($kohafield); + foreach my $fldhash ( @mss ) { + my $tag = $fldhash->{tagfield}; + my $sub = $fldhash->{tagsubfield}; + foreach my $fld ( $marc->field($tag) ) { + if( $sub eq '@' || $fld->is_control_field ) { + push @rv, $fld->data if $fld->data; + } else { + push @rv, grep { $_ } $fld->subfield($sub); + } + } + } + return unless @rv; + $retval = join ' | ', uniq(@rv); + + return $retval; +} + +1; + + +__END__ + +=head1 AUTHOR + +Koha Development Team + +Paul POULAIN paul.poulain@free.fr + +Joshua Ferraro jmf@liblime.com + +Ere Maijala ere.maijala@helsinki.fi + +=cut diff --git a/C4/Items.pm b/C4/Items.pm index 3f68375..9c4bcd4 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -475,6 +475,7 @@ sub _build_default_values_for_mod_marc { stocknumber => undef, uri => undef, withdrawn => 0, + holding_id => undef, }; my %default_values_for_mod_from_marc; while ( my ( $field, $default_value ) = each %$default_values ) { @@ -1689,7 +1690,8 @@ sub _koha_new_item { more_subfields_xml = ?, copynumber = ?, stocknumber = ?, - new_status = ? + new_status = ?, + holding_id = ? "; my $sth = $dbh->prepare($query); my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); @@ -1734,6 +1736,7 @@ sub _koha_new_item { $item->{'copynumber'}, $item->{'stocknumber'}, $item->{'new_status'}, + $item->{'holding_id'}, ); my $itemnumber; diff --git a/C4/Search.pm b/C4/Search.pm index 06e837d..44b06a5 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -20,6 +20,7 @@ use strict; require Exporter; use C4::Context; use C4::Biblio; # GetMarcFromKohaField, GetBiblioData +use C4::Holdings; # GetHoldingsByBiblionumber use C4::Koha; # getFacets use Koha::DateUtils; use Koha::Libraries; @@ -2057,6 +2058,7 @@ sub searchResults { my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref + my $summary_holdings; # loop through every item foreach my $field (@fields) { @@ -2240,6 +2242,11 @@ sub searchResults { push @available_items_loop, $available_items->{$key} } + # Fetch summary holdings + if (C4::Context->preference('SummaryHoldings')) { + $summary_holdings = C4::Holdings::GetHoldingsByBiblionumber($oldbiblio->{biblionumber}); + } + # XSLT processing of some stuff # we fetched the sysprefs already before the loop through all retrieved record! if (!$scan && $xslfile) { @@ -2272,6 +2279,7 @@ sub searchResults { $oldbiblio->{onholdcount} = $item_onhold_count; $oldbiblio->{orderedcount} = $ordered_count; $oldbiblio->{notforloancount} = $notforloan_count; + $oldbiblio->{summary_holdings} = $summary_holdings; if (C4::Context->preference("AlternateHoldingsField") && $items_count == 0) { my $fieldspec = C4::Context->preference("AlternateHoldingsField"); diff --git a/C4/XSLT.pm b/C4/XSLT.pm index bf2647a..22a0e6c 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -241,9 +241,10 @@ sub XSLTParse4Display { # grab the XML, run it through our stylesheet, push it out to the browser my $record = transformMARCXML4XSLT($biblionumber, $orig_record); my $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items); + my $holdingsxml = buildKohaHoldingsNamespace($biblionumber); my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); - $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/; + $xmlrecord =~ s/\<\/record\>/$itemsxml$holdingsxml$sysxml\<\/record\>/; if ($fixamps) { # We need to correct the HTML entities that Zebra outputs $xmlrecord =~ s/\&amp;/\&/g; $xmlrecord =~ s/\&\;lt\;/\<\;/g; @@ -342,6 +343,36 @@ sub buildKohaItemsNamespace { return $xml; } +sub buildKohaHoldingsNamespace { + my ($biblionumber) = @_; + + my $holdings = C4::Holdings::GetHoldingsByBiblionumber( $biblionumber ); + + my $shelflocations = + { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => 'HLD', kohafield => 'holdings.location' } ) }; + + my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); + + my $location = ""; + my $ccode = ""; + my $xml = ''; + for my $holding ( @{$holdings} ) { + my $holdingbranch = $holding->{holdingbranch} ? xml_escape($branches{$holding->{holdingbranch}}) : ''; + my $location = $holding->{location} ? xml_escape($shelflocations->{$holding->{location}} || $holding->{location}) : ''; + my $callnumber = xml_escape($holding->{callnumber}); + my $suppress = $holding->{suppress} || '0'; + $xml .= + "" + . "$holdingbranch" + . "$location" + . "$callnumber" + . "$suppress" + . ""; + } + $xml = "$xml"; + return $xml; +} + =head2 engine Returns reference to XSLT handler object. diff --git a/Koha/Holding.pm b/Koha/Holding.pm new file mode 100644 index 0000000..e937940 --- /dev/null +++ b/Koha/Holding.pm @@ -0,0 +1,72 @@ +package Koha::Holding; + +# Copyright ByWater Solutions 2014 +# Copyright 2017-2018 University of Helsinki (The National Library Of Finland) +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use base qw(Koha::Object); + +=head1 NAME + +Koha::Holding - Koha Holding Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 items + +my @items = $holding->items(); +my $items = $holding->items(); + +Returns the related Koha::Items object for this holding in scalar context, +or list of Koha::Item objects in list context. + +=cut + +sub items { + my ($self) = @_; + + $self->{_items} ||= Koha::Items->search( { holding_id => $self->holding_id() } ); + + return wantarray ? $self->{_items}->as_list : $self->{_items}; +} + +=head3 type + +=cut + +sub _type { + return 'Holding'; +} + +=head1 AUTHOR + +Kyle M Hall +Ere Maijala + +=cut + +1; diff --git a/Koha/Holdings.pm b/Koha/Holdings.pm new file mode 100644 index 0000000..1273413 --- /dev/null +++ b/Koha/Holdings.pm @@ -0,0 +1,64 @@ +package Koha::Holdings; + +# Copyright ByWater Solutions 2015 +# Copyright 2017-2018 University of Helsinki (The National Library Of Finland) +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use Koha::Holding; + +use base qw(Koha::Objects); + +=head1 NAME + +Koha::Holdings - Koha Holdings object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub _type { + return 'Holding'; +} + +=head3 object_class + +=cut + +sub object_class { + return 'Koha::Holding'; +} + +=head1 AUTHOR + +Kyle M Hall +Ere Maijala + +=cut + +1; diff --git a/Koha/Holdings/Metadata.pm b/Koha/Holdings/Metadata.pm new file mode 100644 index 0000000..e4ca5bd --- /dev/null +++ b/Koha/Holdings/Metadata.pm @@ -0,0 +1,44 @@ +package Koha::Holdings::Metadata; + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use base qw(Koha::Object); + +=head1 NAME + +Koha::Metadata - Koha Metadata Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub _type { + return 'HoldingsMetadata'; +} + +1; diff --git a/Koha/Holdings/Metadatas.pm b/Koha/Holdings/Metadatas.pm new file mode 100644 index 0000000..12c2c4b --- /dev/null +++ b/Koha/Holdings/Metadatas.pm @@ -0,0 +1,50 @@ +package Koha::Holdings::Metadatas; + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Carp; + +use Koha::Database; + +use Koha::Biblio::Metadata; + +use base qw(Koha::Objects); + +=head1 NAME + +Koha::Biblio::Metadatas - Koha Metadata Object set class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 type + +=cut + +sub _type { + return 'HoldingsMetadata'; +} + +sub object_class { + return 'Koha::Holdings::Metadata'; +} + +1; diff --git a/Koha/Template/Plugin/Holdings.pm b/Koha/Template/Plugin/Holdings.pm new file mode 100644 index 0000000..70a49e1 --- /dev/null +++ b/Koha/Template/Plugin/Holdings.pm @@ -0,0 +1,90 @@ +package Koha::Template::Plugin::Holdings; + +# Copyright ByWater Solutions 2012 +# Copyright BibLibre 2014 +# Copyright 2017-2018 University of Helsinki (The National Library Of Finland) + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use Template::Plugin; +use base qw( Template::Plugin ); + +use C4::Context; +use C4::Holdings; + +use Koha::Holdings; + +sub GetLocation { + my ( $self, $holding ) = @_; + my $opac = shift || 0; + + if ( !$holding ) { + return ''; + } + + if ( ref($holding) ne 'HASH' ) { + $holding = Koha::Holdings->find( $holding )->unblessed; + if ( !$holding ) { + return ''; + } + } + + my @parts; + + if ( $opac ) { + if ( $holding->{'holdingbranch'}) { + my $query = "SELECT branchname FROM branches WHERE branchcode = ?"; + my $sth = C4::Context->dbh->prepare( $query ); + $sth->execute( $holding->{'holdingbranch'} ); + my $b = $sth->fetchrow_hashref(); + push @parts, $b->{'branchname'} if $b; + $sth->finish(); + } + if ( $holding->{'location'} ) { + my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $holding->{'location'} }); + push @parts, $av->next->opac_description if $av->count; + } + push @parts, $holding->{'callnumber'} if $holding->{'callnumber'}; + return join(' - ', @parts); + } + + push @parts, $holding->{'holding_id'}; + push @parts, $holding->{'holdingbranch'} if $holding->{'holdingbranch'}; + push @parts, $holding->{'location'} if $holding->{'location'}; + push @parts, $holding->{'callnumber'} if $holding->{'callnumber'}; + return join(' ', @parts); +} + +sub GetDetails { + my ( $self, $holding ) = @_; + my $opac = shift || 0; + + if ( !$holding ) { + return ''; + } + + if ( ref($holding) eq 'HASH' ) { + $holding = $holding->{'holding_id'}; + } + + my $marcHolding = C4::Holdings::GetMarcHolding( $holding, $opac ); + + return C4::Holdings::TransformMarcHoldingToKoha( $marcHolding ); +} + +1; diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index eeef468..b6fcee0 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -125,6 +125,11 @@ if ( $op eq 'add_form' ) { while ( ( my $field ) = $sth2->fetchrow_array ) { push @kohafields, "items." . $field; } + $sth2 = $dbh->prepare("SHOW COLUMNS from holdings"); + $sth2->execute; + while ( ( my $field ) = $sth2->fetchrow_array ) { + push @kohafields, "holdings." . $field; + } # build authorised value list $sth2->finish; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index fe59fa1..ef8939b 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -25,6 +25,7 @@ use C4::Koha; use C4::Serials; #uses getsubscriptionfrom biblionumber use C4::Output; use C4::Biblio; +use C4::Holdings; use C4::Items; use C4::Circulation; use C4::Reserves; @@ -176,6 +177,11 @@ foreach my $subscription (@subscriptions) { push @subs, \%cell; } +# Summary holdings +my $summary_holdings; +if (C4::Context->preference('SummaryHoldings')) { + $summary_holdings = C4::Holdings::GetHoldingsByBiblionumber($biblionumber); +} # Get acquisition details if ( C4::Context->preference('AcquisitionDetails') ) { @@ -375,7 +381,9 @@ $template->param( hostrecords => $hostrecords, analytics_flag => $analytics_flag, C4::Search::enabled_staff_search_views, - materials => $materials_flag, + materials => $materials_flag, + show_summary_holdings => C4::Context->preference('SummaryHoldings') ? 1 : 0, + summary_holdings => $summary_holdings, ); if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) { diff --git a/cataloguing/addholding.pl b/cataloguing/addholding.pl new file mode 100755 index 0000000..9eca01f --- /dev/null +++ b/cataloguing/addholding.pl @@ -0,0 +1,729 @@ +#!/usr/bin/perl + + +# Copyright 2000-2002 Katipo Communications +# Copyright 2004-2010 BibLibre +# Copyright 2017-2018 University of Helsinki (The National Library Of Finland) +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +# TODO: refactor to avoid duplication from addbiblio + +use strict; +#use warnings; FIXME - Bug 2505 +use CGI q(-utf8); +use C4::Output; +use C4::Auth; +use C4::Holdings; +use C4::Search; +use C4::Biblio; +use C4::Context; +use MARC::Record; +use C4::Log; +use C4::Koha; +use C4::ClassSource; +use C4::ImportBatch; +use C4::Charset; +use Koha::BiblioFrameworks; +use Koha::DateUtils; +use C4::Matcher; + +use Koha::ItemTypes; +use Koha::Libraries; + +use Koha::BiblioFrameworks; + +use Date::Calc qw(Today); +use MARC::File::USMARC; +use MARC::File::XML; +use URI::Escape; + +if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { + MARC::File::XML->default_record_format('UNIMARC'); +} + +our($tagslib,$authorised_values_sth,$is_a_modif,$usedTagsLib,$mandatory_z3950); + +=head1 FUNCTIONS + +=head2 build_authorized_values_list + +=cut + +sub build_authorized_values_list { + my ( $tag, $subfield, $value, $dbh, $authorised_values_sth,$index_tag,$index_subfield ) = @_; + + my @authorised_values; + my %authorised_lib; + + # builds list, depending on authorised value... + + #---- branch + if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { + my $libraries = Koha::Libraries->search_filtered({}, {order_by => ['branchname']}); + while ( my $l = $libraries->next ) { + push @authorised_values, $l->branchcode; + $authorised_lib{$l->branchcode} = $l->branchname; + } + } + elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "LOC" ) { + push @authorised_values, "" + unless ( $tagslib->{$tag}->{$subfield}->{mandatory} + && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) ); + + + my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; + my $avs = Koha::AuthorisedValues->search( + { + branchcode => $branch_limit, + category => $tagslib->{$tag}->{$subfield}->{authorised_value}, + }, + { + order_by => [ 'category', 'lib', 'lib_opac' ], + } + ); + + while ( my $av = $avs->next ) { + push @authorised_values, $av->authorised_value; + $authorised_lib{$av->authorised_value} = $av->lib; + } + } + elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) { + push @authorised_values, "" + unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); + + my $class_sources = GetClassSources(); + + my $default_source = C4::Context->preference("DefaultClassificationSource"); + + foreach my $class_source (sort keys %$class_sources) { + next unless $class_sources->{$class_source}->{'used'} or + ($value and $class_source eq $value) or + ($class_source eq $default_source); + push @authorised_values, $class_source; + $authorised_lib{$class_source} = $class_sources->{$class_source}->{'description'}; + } + $value = $default_source unless $value; + } + else { + my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; + $authorised_values_sth->execute( + $tagslib->{$tag}->{$subfield}->{authorised_value}, + $branch_limit ? $branch_limit : (), + ); + + push @authorised_values, "" + unless ( $tagslib->{$tag}->{$subfield}->{mandatory} + && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) ); + + while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { + push @authorised_values, $value; + $authorised_lib{$value} = $lib; + } + } + $authorised_values_sth->finish; + return { + type => 'select', + id => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, + name => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield, + default => $value, + values => \@authorised_values, + labels => \%authorised_lib, + }; + +} + +=head2 CreateKey + + Create a random value to set it into the input name + +=cut + +sub CreateKey { + return int(rand(1000000)); +} + +=head2 create_input + + builds the entry for a subfield. + +=cut + +sub create_input { + my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; + + my $index_subfield = CreateKey(); # create a specific key for each subfield + + $value =~ s/"/"/g; + + # if there is no value provided but a default value in parameters, get it + if ( $value eq '' ) { + $value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; + + # get today date & replace <>, <>, <
> if provided in the default value + my $today_dt = dt_from_string; + my $year = $today_dt->strftime('%Y'); + my $month = $today_dt->strftime('%m'); + my $day = $today_dt->strftime('%d'); + $value =~ s/<>/$year/g; + $value =~ s/<>/$month/g; + $value =~ s/<
>/$day/g; + # And <> with surname (?) + my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); + $value=~s/<>/$username/g; + + } + my $dbh = C4::Context->dbh; + + # map '@' as "subfield" label for fixed fields + # to something that's allowed in a div id. + my $id_subfield = $subfield; + $id_subfield = "00" if $id_subfield eq "@"; + + my %subfield_data = ( + tag => $tag, + subfield => $id_subfield, + marc_lib => $tagslib->{$tag}->{$subfield}->{lib}, + tag_mandatory => $tagslib->{$tag}->{mandatory}, + mandatory => $tagslib->{$tag}->{$subfield}->{mandatory}, + repeatable => $tagslib->{$tag}->{$subfield}->{repeatable}, + kohafield => $tagslib->{$tag}->{$subfield}->{kohafield}, + index => $index_tag, + id => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield, + value => $value, + maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, + random => CreateKey(), + ); + + if(exists $mandatory_z3950->{$tag.$subfield}){ + $subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield}; + } + # Subfield is hidden depending of hidden and mandatory flag, and is always + # shown if it contains anything or if its field is mandatory. + my $tdef = $tagslib->{$tag}; + $subfield_data{visibility} = "display:none;" + if $tdef->{$subfield}->{hidden} % 2 == 1 && + $value eq '' && + !$tdef->{$subfield}->{mandatory} && + !$tdef->{mandatory}; + # expand all subfields of 773 if there is a host item provided in the input + $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber')); + + + # it's an authorised field + if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { + $subfield_data{marc_value} = + build_authorized_values_list( $tag, $subfield, $value, $dbh, + $authorised_values_sth,$index_tag,$index_subfield ); + + # it's a subfield $9 linking to an authority record - see bug 2206 + } + elsif ($subfield eq "9" and + exists($tagslib->{$tag}->{'a'}->{authtypecode}) and + defined($tagslib->{$tag}->{'a'}->{authtypecode}) and + $tagslib->{$tag}->{'a'}->{authtypecode} ne '') { + + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + size => 5, + maxlength => $subfield_data{maxlength}, + readonly => 1, + }; + + # it's a thesaurus / authority field + } + elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { + # when authorities auto-creation is allowed, do not set readonly + my $is_readonly = !C4::Context->preference("BiblioAddsAuthorities"); + + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + size => 67, + maxlength => $subfield_data{maxlength}, + readonly => ($is_readonly) ? 1 : 0, + authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, + }; + + # it's a plugin field + } elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { + require Koha::FrameworkPlugin; + my $plugin = Koha::FrameworkPlugin->new( { + name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, + }); + my $pars= { dbh => $dbh, record => $rec, tagslib => $tagslib, + id => $subfield_data{id}, tabloop => $tabloop }; + $plugin->build( $pars ); + if( !$plugin->errstr ) { + $subfield_data{marc_value} = { + type => 'text_complex', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + size => 67, + maxlength => $subfield_data{maxlength}, + javascript => $plugin->javascript, + noclick => $plugin->noclick, + }; + } else { + warn $plugin->errstr; + # supply default input form + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + size => 67, + maxlength => $subfield_data{maxlength}, + readonly => 0, + }; + } + + # it's an hidden field + } elsif ( $tag eq '' ) { + $subfield_data{marc_value} = { + type => 'hidden', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + size => 67, + maxlength => $subfield_data{maxlength}, + }; + + } + else { + # it's a standard field + if ( + length($value) > 100 + or + ( C4::Context->preference("marcflavour") eq "UNIMARC" && $tag >= 300 + and $tag < 400 && $subfield eq 'a' ) + or ( $tag >= 500 + and $tag < 600 + && C4::Context->preference("marcflavour") eq "MARC21" ) + ) + { + $subfield_data{marc_value} = { + type => 'textarea', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + }; + + } + else { + $subfield_data{marc_value} = { + type => 'text', + id => $subfield_data{id}, + name => $subfield_data{id}, + value => $value, + size => 67, + maxlength => $subfield_data{maxlength}, + readonly => 0, + }; + + } + } + $subfield_data{'index_subfield'} = $index_subfield; + return \%subfield_data; +} + + +=head2 format_indicator + +Translate indicator value for output form - specifically, map +indicator = ' ' to ''. This is for the convenience of a cataloger +using a mouse to select an indicator input. + +=cut + +sub format_indicator { + my $ind_value = shift; + return '' if not defined $ind_value; + return '' if $ind_value eq ' '; + return $ind_value; +} + +sub build_tabs { + my ( $template, $record, $dbh, $encoding,$input ) = @_; + + # fill arrays + my @loop_data = (); + my $tag; + + my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; + my $query = "SELECT authorised_value, lib + FROM authorised_values"; + $query .= qq{ LEFT JOIN authorised_values_branches ON ( id = av_id )} if $branch_limit; + $query .= " WHERE category = ?"; + $query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit; + $query .= " GROUP BY lib ORDER BY lib, lib_opac"; + my $authorised_values_sth = $dbh->prepare( $query ); + + # in this array, we will push all the 10 tabs + # to avoid having 10 tabs in the template : they will all be in the same BIG_LOOP + my @BIG_LOOP; + my %seen; + my @tab_data; # all tags to display + + foreach my $used ( @$usedTagsLib ){ + push @tab_data,$used->{tagfield} if not $seen{$used->{tagfield}}; + $seen{$used->{tagfield}}++; + } + + my $max_num_tab=-1; + foreach(@$usedTagsLib){ + if($_->{tab} > -1 && $_->{tab} >= $max_num_tab && $_->{tagfield} != '995'){ # FIXME : MARC21 ? + $max_num_tab = $_->{tab}; + } + } + if($max_num_tab >= 9){ + $max_num_tab = 9; + } + # loop through each tab 0 through 9 + for ( my $tabloop = 0 ; $tabloop <= $max_num_tab ; $tabloop++ ) { + my @loop_data = (); #innerloop in the template. + my $i = 0; + foreach my $tag (@tab_data) { + $i++; + next if ! $tag; + my ($indicator1, $indicator2); + my $index_tag = CreateKey; + + # if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab. + # if MARC::Record is empty => use tab as master loop. + if ( $record ne -1 && ( $record->field($tag) || $tag eq '000' ) ) { + my @fields; + if ( $tag ne '000' ) { + @fields = $record->field($tag); + } + else { + push @fields, $record->leader(); # if tag == 000 + } + # loop through each field + foreach my $field (@fields) { + + my @subfields_data; + if ( $tag < 10 ) { + my ( $value, $subfield ); + if ( $tag ne '000' ) { + $value = $field->data(); + $subfield = "@"; + } + else { + $value = $field; + $subfield = '@'; + } + next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); + next + if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq + 'biblio.biblionumber' ); + push( + @subfields_data, + &create_input( + $tag, $subfield, $value, $index_tag, $tabloop, $record, + $authorised_values_sth,$input + ) + ); + } + else { + my @subfields = $field->subfields(); + foreach my $subfieldcount ( 0 .. $#subfields ) { + my $subfield = $subfields[$subfieldcount][0]; + my $value = $subfields[$subfieldcount][1]; + next if ( length $subfield != 1 ); + next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); + push( + @subfields_data, + &create_input( + $tag, $subfield, $value, $index_tag, $tabloop, + $record, $authorised_values_sth,$input + ) + ); + } + } + + # now, loop again to add parameter subfield that are not in the MARC::Record + foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) ) + { + next if ( length $subfield != 1 ); + next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); + next if ( $tag < 10 ); + next + if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 ) + or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) ) + and not ( $subfield eq "9" and + exists($tagslib->{$tag}->{'a'}->{authtypecode}) and + defined($tagslib->{$tag}->{'a'}->{authtypecode}) and + $tagslib->{$tag}->{'a'}->{authtypecode} ne "" + ) + ; #check for visibility flag + # if subfield is $9 in a field whose $a is authority-controlled, + # always include in the form regardless of the hidden setting - bug 2206 + next if ( defined( $field->subfield($subfield) ) ); + push( + @subfields_data, + &create_input( + $tag, $subfield, '', $index_tag, $tabloop, $record, + $authorised_values_sth,$input + ) + ); + } + if ( $#subfields_data >= 0 ) { + # build the tag entry. + # note that the random() field is mandatory. Otherwise, on repeated fields, you'll + # have twice the same "name" value, and cgi->param() will return only one, making + # all subfields to be merged in a single field. + my %tag_data = ( + tag => $tag, + index => $index_tag, + tag_lib => $tagslib->{$tag}->{lib}, + repeatable => $tagslib->{$tag}->{repeatable}, + mandatory => $tagslib->{$tag}->{mandatory}, + subfield_loop => \@subfields_data, + fixedfield => $tag < 10?1:0, + random => CreateKey, + ); + if ($tag >= 10){ # no indicator for 00x tags + $tag_data{indicator1} = format_indicator($field->indicator(1)), + $tag_data{indicator2} = format_indicator($field->indicator(2)), + } + push( @loop_data, \%tag_data ); + } + } # foreach $field end + + # if breeding is empty + } + else { + my @subfields_data; + foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) ) { + next if ( length $subfield != 1 ); + next + if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 ) + or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) ) + and not ( $subfield eq "9" and + exists($tagslib->{$tag}->{'a'}->{authtypecode}) and + defined($tagslib->{$tag}->{'a'}->{authtypecode}) and + $tagslib->{$tag}->{'a'}->{authtypecode} ne "" + ) + ; #check for visibility flag + # if subfield is $9 in a field whose $a is authority-controlled, + # always include in the form regardless of the hidden setting - bug 2206 + next + if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); + push( + @subfields_data, + &create_input( + $tag, $subfield, '', $index_tag, $tabloop, $record, + $authorised_values_sth,$input + ) + ); + } + if ( $#subfields_data >= 0 ) { + my %tag_data = ( + tag => $tag, + index => $index_tag, + tag_lib => $tagslib->{$tag}->{lib}, + repeatable => $tagslib->{$tag}->{repeatable}, + mandatory => $tagslib->{$tag}->{mandatory}, + indicator1 => $indicator1, + indicator2 => $indicator2, + subfield_loop => \@subfields_data, + tagfirstsubfield => $subfields_data[0], + fixedfield => $tag < 10?1:0, + ); + + push @loop_data, \%tag_data ; + } + } + } + if ( $#loop_data >= 0 ) { + push @BIG_LOOP, { + number => $tabloop, + innerloop => \@loop_data, + }; + } + } + $authorised_values_sth->finish; + $template->param( BIG_LOOP => \@BIG_LOOP ); +} + +# ======================== +# MAIN +#========================= +my $input = new CGI; +my $error = $input->param('error'); +my $biblionumber = $input->param('biblionumber'); +my $holding_id = $input->param('holding_id'); # if holding_id exists, it's a modif, not a new holding. +my $op = $input->param('op'); +my $mode = $input->param('mode'); +my $frameworkcode = $input->param('frameworkcode'); +my $redirect = $input->param('redirect'); +my $searchid = $input->param('searchid'); +my $dbh = C4::Context->dbh; + +my $userflags = 'edit_items'; + +my $changed_framework = $input->param('changed_framework'); +$frameworkcode = &C4::Holdings::GetHoldingFrameworkCode($holding_id) + if ( $holding_id and not( defined $frameworkcode) and $op ne 'add' ); + +$frameworkcode = 'HLD' if ( !$frameworkcode || $frameworkcode eq 'Default' ); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "cataloguing/addholding.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { editcatalogue => $userflags }, + } +); + +# TODO: support in advanced editor? +#if ( $op ne "delete" && C4::Context->preference('EnableAdvancedCatalogingEditor') && $input->cookie( 'catalogue_editor_' . $loggedinuser ) eq 'advanced' ) { +# print $input->redirect( '/cgi-bin/koha/cataloguing/editor.pl#catalog/' . $biblionumber . '/holdings/' . ( $holding_id ? $holding_id : '' ) ); +# exit; +#} + +my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] }); +$template->param( + frameworks => $frameworks +); + +# ++ Global +$tagslib = &GetMarcStructure( 1, $frameworkcode ); +$usedTagsLib = &GetUsedMarcStructure( $frameworkcode ); +# -- Global + +my $record = -1; +my $encoding = ""; + +if ($holding_id){ + $record = C4::Holdings::GetMarcHolding($holding_id); +} + +$is_a_modif = 0; + +if ($holding_id) { + $is_a_modif = 1; + +} +my ( $biblionumbertagfield, $biblionumbertagsubfield ) = + &GetMarcFromKohaField( "biblio.biblionumber", $frameworkcode ); + +#------------------------------------------------------------------------------------- +if ( $op eq "add" ) { +#------------------------------------------------------------------------------------- + $template->param( + biblionumberdata => $biblionumber, + ); + # getting html input + my @params = $input->multi_param(); + $record = TransformHtmlToMarc( $input, 1 ); + if ( $is_a_modif ) { + ModHolding( $record, $holding_id, $frameworkcode ); + } + else { + $holding_id = AddHolding( $record, $frameworkcode, $biblionumber ); + } + if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ + print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); + exit; + } + elsif(($is_a_modif || $redirect eq "view") && $redirect ne "just_save"){ + print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); + exit; + } + elsif ($redirect eq "just_save"){ + my $tab = $input->param('current_tab'); + print $input->redirect("/cgi-bin/koha/cataloguing/addholding.pl?biblionumber=$biblionumber&holding_id=$holding_id&framework=$frameworkcode&tab=$tab&searchid=$searchid"); + } + else { + $template->param( + biblionumber => $biblionumber, + holding_id => $holding_id, + done =>1, + popup =>1 + ); + $template->param( + popup => $mode, + itemtype => $frameworkcode, + ); + output_html_with_http_headers $input, $cookie, $template->output; + exit; + } +} +elsif ( $op eq "delete" ) { + + my $error = &DelHolding($holding_id); + if ($error) { + warn "ERROR when DELETING HOLDING $holding_id : $error"; + print "Content-Type: text/html\n\n

ERROR when DELETING HOLDING $holding_id : $error

"; + exit; + } + + print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); + exit; + +} else { + #---------------------------------------------------------------------------- + # If we're in a duplication case, we have to set to "" the holding_id + # as we'll save the holding as a new one. + $template->param( + holding_iddata => $holding_id, + op => $op, + ); + if ( $op eq "duplicate" ) { + $holding_id = ""; + } + + if($changed_framework eq "changed"){ + $record = TransformHtmlToMarc( $input, 1 ); + } + elsif( $record ne -1 ) { +#FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML and then back again just to fix the encoding + eval { + my $uxml = $record->as_xml; + MARC::Record::default_record_format("UNIMARC") + if ( C4::Context->preference("marcflavour") eq "UNIMARC" ); + my $urecord = MARC::Record::new_from_xml( $uxml, 'UTF-8' ); + $record = $urecord; + }; + } + build_tabs( $template, $record, $dbh, $encoding,$input ); + $template->param( + holding_id => $holding_id, + biblionumber => $biblionumber, + biblionumbertagfield => $biblionumbertagfield, + biblionumbertagsubfield => $biblionumbertagsubfield, + ); +} + +$template->param( + popup => $mode, + frameworkcode => $frameworkcode, + itemtype => $frameworkcode, + borrowernumber => $loggedinuser, + tab => scalar $input->param('tab') +); +$template->{'VARS'}->{'searchid'} = $searchid; + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 6af351d..decd28f 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -31,6 +31,7 @@ use C4::Circulation; use C4::Koha; use C4::ClassSource; use Koha::DateUtils; +use Koha::Holdings; use Koha::Items; use Koha::ItemTypes; use Koha::Libraries; @@ -211,6 +212,16 @@ sub generate_subfield_form { #---- "true" authorised value } + elsif ( $subfieldlib->{authorised_value} eq "holdings" ) { + push @authorised_values, "" unless ( $subfieldlib->{mandatory} ); + my $holdings = Koha::Holdings->search({biblionumber => $biblionumber}, { order_by => ['holdingbranch'] })->unblessed; + for my $holding ( @$holdings ) { + push @authorised_values, $holding->{holding_id}; + $authorised_lib{$holding->{holding_id}} = $holding->{holding_id} . ' ' . $holding->{holdingbranch} . ' ' . $holding->{location} . ' ' . $holding->{callnumber}; + } + my $input = new CGI; + $value = $input->param('holding_id') unless ($value); + } else { push @authorised_values, qq{}; my $av = GetAuthorisedValues( $subfieldlib->{authorised_value} ); diff --git a/cataloguing/value_builder/marc21_field_008_holdings.pl b/cataloguing/value_builder/marc21_field_008_holdings.pl new file mode 100755 index 0000000..8db4cc2 --- /dev/null +++ b/cataloguing/value_builder/marc21_field_008_holdings.pl @@ -0,0 +1,120 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# Copyright 2017-2018 University of Helsinki (The National Library Of Finland) +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; +use C4::Auth; +use CGI qw ( -utf8 ); +use C4::Context; + +use C4::Search; +use C4::Output; + +use XML::LibXML; +use Koha::Util::FrameworkPlugin qw|date_entered|; + +my $builder = sub { + my ( $params ) = @_; + + my $lang = C4::Context->preference('DefaultLanguageField008' ); + $lang = "eng" unless $lang; + $lang = pack("A3", $lang); + + my $function_name = $params->{id}; + my $dateentered = date_entered(); + my $res = " + +"; + + return $res; +}; + +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; + my $index= $input->param('index'); + my $result= $input->param('result'); + + my $lang = C4::Context->preference('DefaultLanguageField008' ); + $lang = "eng" unless $lang; + $lang = pack("A3", $lang); + + my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "cataloguing/value_builder/marc21_field_008_holdings.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {editcatalogue => '*'}, + debug => 1, + }); + my $dateentered = date_entered(); + $result = $dateentered + '0u 0 0 uu' + $lang + '0' + $dateentered unless $result; + my @f; + for(0,6..8,12..17,20..22,25,26) { + my $len = 1; + if ($_ == 0 || $_ == 26) { + $len = 6; + } elsif ($_ == 8) { + $len = 4; + } elsif ($_ == 17 || $_ == 22) { + $len = 3; + } + warn ($_ . ': ' . $len); + $f[$_]=substr($result,$_,$len); + } + $template->param(index => $index); + + $f[0]= $dateentered if !$f[0] || $f[0]=~/\s/; + $template->param(f1 => $f[0]); + + for(6..8,12..17,20..22,25,26) { + $template->param( + "f$_" => $f[$_], + "f$_".($f[$_] eq '|'? 'pipe': $f[$_]) => $f[$_], + ); + } + output_html_with_http_headers $input, $cookie, $template->output; +}; + +return { builder => $builder, launcher => $launcher }; diff --git a/cataloguing/value_builder/marc21_leader_holdings.pl b/cataloguing/value_builder/marc21_leader_holdings.pl new file mode 100755 index 0000000..3fc08e5 --- /dev/null +++ b/cataloguing/value_builder/marc21_leader_holdings.pl @@ -0,0 +1,85 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# Copyright 2017-2018 University of Helsinki (The National Library Of Finland) +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; +use CGI qw ( -utf8 ); + +use C4::Auth; +use C4::Context; +use C4::Output; + +my $builder = sub { + my ( $params ) = @_; + my $function_name = $params->{id}; + my $res = " + +"; + + return $res; +}; + +my $launcher = sub { + my ( $params ) = @_; + my $input = $params->{cgi}; + my $index = $input->param('index'); + my $result = $input->param('result'); + + my $dbh = C4::Context->dbh; + + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { template_name => "cataloguing/value_builder/marc21_leader_holdings.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { editcatalogue => '*' }, + debug => 1, + } + ); + $result = " nu a22 ui 4500" unless $result; + my $f5 = substr( $result, 5, 1 ); + my $f6 = substr( $result, 6, 1 ); + my $f17 = substr( $result, 17, 1 ); + my $f18 = substr( $result, 18, 1 ); + $template->param( + index => $index, + "f5$f5" => 1, + "f6$f6" => 1, + "f17$f17" => 1, + "f18$f18" => 1, + ); + output_html_with_http_headers $input, $cookie, $template->output; +}; + +return { builder => $builder, launcher => $launcher }; diff --git a/installer/data/mysql/atomicupdate/bug_20447-add_holdings_tables.sql b/installer/data/mysql/atomicupdate/bug_20447-add_holdings_tables.sql new file mode 100644 index 0000000..a8f19a0 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_20447-add_holdings_tables.sql @@ -0,0 +1,398 @@ +-- +-- Table structure for table `holdings` +-- + +CREATE TABLE `holdings` ( -- table that stores summary holdings information + `holding_id` int(11) NOT NULL auto_increment, -- unique identifier assigned to each holdings record + `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this record to the right bib record + `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link record to additional information + `frameworkcode` varchar(4) NOT NULL default '', -- foreign key from the biblio_framework table to identify which framework was used in cataloging this record + `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this record (MARC21 852$a) + `location` varchar(80) default NULL, -- authorized value for the shelving location for this record (MARC21 852$b) + `callnumber` varchar(255) default NULL, -- call number (852$h+$i in MARC21) + `suppress` tinyint(1) default NULL, -- Boolean indicating whether the record is suppressed in OPAC + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched + `datecreated` DATE NOT NULL, -- the date this record was added to Koha + `deleted_on` DATETIME DEFAULT NULL, -- the date this record was deleted + PRIMARY KEY (`holding_id`), + KEY `hldnoidx` (`holding_id`), + KEY `hldbinoidx` (`biblioitemnumber`), + KEY `hldbibnoidx` (`biblionumber`), + CONSTRAINT `holdings_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `holdings_ibfk_2` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `holdings_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `holdings_metadata` +-- + +CREATE TABLE holdings_metadata ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `holding_id` INT(11) NOT NULL, + `format` VARCHAR(16) NOT NULL, + `marcflavour` VARCHAR(16) NOT NULL, + `metadata` LONGTEXT NOT NULL, + `deleted_on` DATETIME DEFAULT NULL, -- the date this record was deleted + PRIMARY KEY(id), + UNIQUE KEY `holdings_metadata_uniq_key` (`holding_id`,`format`,`marcflavour`), + KEY `hldnoidx` (`holding_id`), + CONSTRAINT `holdings_metadata_fk_1` FOREIGN KEY (`holding_id`) REFERENCES `holdings` (`holding_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Add holding_id to items table +-- + +ALTER TABLE `items` ADD COLUMN `holding_id` int(11) default NULL; +ALTER TABLE `items` ADD CONSTRAINT `items_ibfk_5` FOREIGN KEY (`holding_id`) REFERENCES `holdings` (`holding_id`) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `items` ADD KEY `hldid_idx` (`holding_id`); + +-- +-- Add holding_id to deleteditems table +-- + +ALTER TABLE `deleteditems` ADD COLUMN `holding_id` int(11) default NULL; + +-- +-- Insert a new category to authorised_value_categories table +-- + +INSERT INTO authorised_value_categories( category_name ) VALUES ('holdings'); + + +-- +-- Insert 999e to the default framework +-- + +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 + ('999', 'e', 'Koha holding_id', 'Koha holding_id', 0, 0, 'holdings.holding_id', -1, NULL, NULL, '', NULL, -5, '', '', '', NULL); + + +-- +-- Insert 952v to marc_subfield_structure table +-- + +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 + ('952', 'V', 'Holding record', 'Holding record', 0, 0, 'items.holding_id', 10, 'holdings', '', '', NULL, 0, '', '', '', NULL); + +-- HOLDINGS RECORD FRAMEWORK + +INSERT IGNORE INTO `biblio_framework` (`frameworkcode`, `frameworktext`) VALUES ('HLD', 'Default holdings framework'); +INSERT IGNORE INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES + ('999', 'SYSTEM CONTROL NUMBERS (KOHA)', 'SYSTEM CONTROL NUMBERS (KOHA)', 1, 0, '', 'HLD'); + +INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES + ('999', 'c', 'Koha biblionumber', 'Koha biblionumber', 0, 0, 'biblio.biblionumber', -1, NULL, NULL, '', NULL, -5, 'HLD', '', '', NULL), + ('999', 'd', 'Koha biblioitemnumber', 'Koha biblioitemnumber', 0, 0, 'biblioitems.biblioitemnumber', -1, NULL, NULL, '', NULL, -5, 'HLD', '', '', NULL), + ('999', 'e', 'Koha holding_id', 'Koha holding_id', 0, 0, 'holdings.holding_id', -1, NULL, NULL, '', NULL, -5, 'HLD', '', '', NULL); + + +INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES + ('942', 'n', 'Suppress in OPAC', 'Suppress in OPAC', 0, 0, 'holdings.suppress', 9, '', '', '', 0, 0, 'HLD', '', '', NULL); + +INSERT IGNORE INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES + ('000', 'LEADER', 'LEADER', 0, 1, '', 'HLD'), + ('001', 'CONTROL NUMBER', 'CONTROL NUMBER', 0, 0, '', 'HLD'), + ('003', 'CONTROL NUMBER IDENTIFIER', 'CONTROL NUMBER IDENTIFIER', 0, 1, '', 'HLD'), + ('005', 'DATE AND TIME OF LATEST TRANSACTION', 'DATE AND TIME OF LATEST TRANSACTION', 0, 1, '', 'HLD'), + ('006', 'FIXED-LENGTH DATA ELEMENTS--ADDITIONAL MATERIAL CHARACTERISTICS', 'FIXED-LENGTH DATA ELEMENTS--ADDITIONAL MATERIAL CHARACTERISTICS', 1, 0, '', 'HLD'), + ('007', 'PHYSICAL DESCRIPTION FIXED FIELD--GENERAL INFORMATION', 'PHYSICAL DESCRIPTION FIXED FIELD--GENERAL INFORMATION', 1, 0, '', 'HLD'), + ('008', 'FIXED-LENGTH DATA ELEMENTS--GENERAL INFORMATION', 'FIXED-LENGTH DATA ELEMENTS--GENERAL INFORMATION', 0, 1, '', 'HLD'); + +INSERT IGNORE INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES + ('850', 'HOLDING INSTITUTION', 'HOLDING INSTITUTION', 1, 0, NULL, 'HLD'), + ('852', 'LOCATION', 'LOCATION', 1, 0, NULL, 'HLD'), + ('853', 'CAPTIONS AND PATTERN--BASIC BIBLIOGRAPHIC UNIT', 'CAPTIONS AND PATTERN--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('854', 'CAPTIONS AND PATTERN--SUPPLEMENTARY MATERIAL', 'CAPTIONS AND PATTERN--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('855', 'CAPTIONS AND PATTERN--INDEXES', 'CAPTIONS AND PATTERN--INDEXES', 1, 0, NULL, 'HLD'), + ('856', 'ELECTRONIC LOCATION AND ACCESS', 'ELECTRONIC LOCATION AND ACCESS', 1, 0, NULL, 'HLD'), + ('863', 'ENUMERATION AND CHRONOLOGY--BASIC BIBLIOGRAPHIC UNIT', 'ENUMERATION AND CHRONOLOGY--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('864', 'ENUMERATION AND CHRONOLOGY--SUPPLEMENTARY MATERIAL', 'ENUMERATION AND CHRONOLOGY--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('865', 'ENUMERATION AND CHRONOLOGY--INDEXES', 'ENUMERATION AND CHRONOLOGY--INDEXES', 1, 0, NULL, 'HLD'), + ('866', 'TEXTUAL HOLDINGS--BASIC BIBLIOGRAPHIC UNIT', 'TEXTUAL HOLDINGS--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('867', 'TEXTUAL HOLDINGS--SUPPLEMENTARY MATERIAL', 'TEXTUAL HOLDINGS--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('868', 'TEXTUAL HOLDINGS--INDEXES', 'TEXTUAL HOLDINGS--INDEXES', 1, 0, NULL, 'HLD'), + ('876', 'ITEM INFORMATION--BASIC BIBLIOGRAPHIC UNIT', 'ITEM INFORMATION--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('877', 'ITEM INFORMATION--SUPPLEMENTARY MATERIAL', 'ITEM INFORMATION--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('878', 'ITEM INFORMATION--INDEXES', 'ITEM INFORMATION--INDEXES', 1, 0, NULL, 'HLD'); + +INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES + ('000', '@', 'fixed length control field', 'fixed length control field', 0, 1, '', 0, '', '', 'marc21_leader_holdings.pl', 0, 0, 'HLD', '', '', NULL), + ('001', '@', 'control field', 'control field', 0, 0, '', 0, '', '', '', 0, 0, 'HLD', '', '', NULL), + ('003', '@', 'control field', 'control field', 0, 1, '', 0, '', '', 'marc21_orgcode.pl', 0, 0, 'HLD', '', '', NULL), + ('005', '@', 'control field', 'control field', 0, 1, '', 0, '', '', 'marc21_field_005.pl', 0, 0, 'HLD', '', '', NULL), + ('006', '@', 'fixed length control field', 'fixed length control field', 0, 0, '', 0, '', '', 'marc21_field_006.pl', 0, -1, 'HLD', '', '', NULL), + ('007', '@', 'fixed length control field', 'fixed length control field', 0, 0, '', 0, '', '', 'marc21_field_007.pl', 0, 0, 'HLD', '', '', NULL), + ('008', '@', 'fixed length control field', 'fixed length control field', 0, 1, '', 0, '', '', 'marc21_field_008_holdings.pl', 0, 0, 'HLD', '', '', NULL), + ('850', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'a', 'Holding institution', 'Holding institution', 1, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'b', 'Holdings (NR) (MU VM SE) [OBSOLETE]', 'Holdings (NR) (MU VM SE) [OBSOLETE]', 0, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'd', 'Inclusive dates (NR) (MU VM SE) [OBSOLETE]', 'Inclusive dates (NR) (MU VM SE) [OBSOLETE]', 0, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'e', 'Retention statement (NR) (CF MU VM SE) [OBSOLETE]', 'Retention statement (NR) (CF MU VM SE) [OBSOLETE]', 0, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('852', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', '8', 'Sequence number', 'Sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'a', 'Location', 'Location', 0, 0, 'holdings.holdingbranch', 8, 'branches', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'b', 'Sublocation or collection', 'Sublocation or collection', 1, 0, 'holdings.location', 8, 'LOC', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'c', 'Shelving location', 'Shelving location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'd', 'Former shelving location', 'Former shelving location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'e', 'Address', 'Address', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'f', 'Coded location qualifier', 'Coded location qualifier', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'g', 'Non-coded location qualifier', 'Non-coded location qualifier', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'h', 'Classification part', 'Classification part', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'i', 'Item part', 'Item part', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'j', 'Shelving control number', 'Shelving control number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'k', 'Call number prefix', 'Call number prefix', 1, 0, 'holdings.callnumber', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'l', 'Shelving form of title', 'Shelving form of title', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'm', 'Call number suffix', 'Call number suffix', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'n', 'Country code', 'Country code', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 1, 0, '', 8, '', '', '', 1, 4, 'HLD', '', '', NULL), + ('852', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'z', 'Public note', 'Public note', 1, 0, 'holdings.public_note', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'n', 'Pattern note', 'Pattern note', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'p', 'Number of pieces per issuance', 'Number of pieces per issuance', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 't', 'Copy', 'Copy', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'u', 'Bibliographic units per next higher level', 'Bibliographic units per next higher level', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'v', 'Numbering continuity', 'Numbering continuity', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'w', 'Frequency', 'Frequency', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'x', 'Calendar change', 'Calendar change', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'y', 'Regularity pattern', 'Regularity pattern', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'z', 'Numbering scheme', 'Numbering scheme', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'n', 'Pattern note', 'Pattern note', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'p', 'Number of pieces per issuance', 'Number of pieces per issuance', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 't', 'Copy', 'Copy', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'u', 'Bibliographic units per next higher level', 'Bibliographic units per next higher level', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'v', 'Numbering continuity', 'Numbering continuity', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'w', 'Frequency', 'Frequency', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'x', 'Calendar change', 'Calendar change', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'y', 'Regularity pattern', 'Regularity pattern', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'z', 'Numbering scheme', 'Numbering scheme', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'n', 'Pattern note', 'Pattern note', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'p', 'Number of pieces per issuance', 'Number of pieces per issuance', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 't', 'Copy', 'Copy', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'u', 'Bibliographic units per next higher level', 'Bibliographic units per next higher level', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'v', 'Numbering continuity', 'Numbering continuity', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'w', 'Frequency', 'Frequency', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'x', 'Calendar change', 'Calendar change', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'y', 'Regularity pattern', 'Regularity pattern', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'z', 'Numbering scheme', 'Numbering scheme', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('856', '2', 'Access method', 'Access method', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'a', 'Host name', 'Host name', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'b', 'Access number', 'Access number', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'c', 'Compression information', 'Compression information', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'd', 'Path', 'Path', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'f', 'Electronic name', 'Electronic name', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'h', 'Processor of request', 'Processor of request', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'i', 'Instruction', 'Instruction', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'j', 'Bits per second', 'Bits per second', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'k', 'Password', 'Password', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'l', 'Logon', 'Logon', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'm', 'Contact for access assistance', 'Contact for access assistance', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'n', 'Name of location of host', 'Name of location of host', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'o', 'Operating system', 'Operating system', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'p', 'Port', 'Port', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'q', 'Electronic format type', 'Electronic format type', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'r', 'Settings', 'Settings', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 's', 'File size', 'File size', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 't', 'Terminal emulation', 'Terminal emulation', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 1, 0, 'biblioitems.url', 8, '', '', '', 1, 4, 'HLD', '', '', NULL), + ('856', 'v', 'Hours access method available', 'Hours access method available', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'w', 'Record control number', 'Record control number', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'y', 'Link text', 'Link text', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('863', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('863', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'i', 'First level of chronology', 'First level of chronology', 0, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'z', 'Public note', 'Public note', 1, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('864', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('864', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('865', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('865', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('866', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('866', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('866', 'a', 'Textual string', 'Textual string', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('866', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('866', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('867', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('867', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('867', 'a', 'Textual string', 'Textual string', 0, 0, 'holdings.supplements', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('867', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('867', 'z', 'Public note', 'Public note', 1, 0, 'holdings.supplements', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('868', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('868', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('868', 'a', 'Textual string', 'Textual string', 0, 0, 'holdings.indexes', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('868', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('868', 'z', 'Public note', 'Public note', 1, 0, 'holdings.indexes', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('876', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', '8', 'Sequence number', 'Sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'a', 'Internal item number', 'Internal item number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'b', 'Invalid or canceled internal item number', 'Invalid or canceled internal item number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'c', 'Cost', 'Cost', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'd', 'Date acquired', 'Date acquired', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'e', 'Source of acquisition', 'Source of acquisition', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'h', 'Use restrictions', 'Use restrictions', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'j', 'Item status', 'Item status', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'l', 'Temporary location', 'Temporary location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'p', 'Piece designation', 'Piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'r', 'Invalid or canceled piece designation', 'Invalid or canceled piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', '8', 'Sequence number', 'Sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'a', 'Internal item number', 'Internal item number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'b', 'Invalid or canceled internal item number', 'Invalid or canceled internal item number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'c', 'Cost', 'Cost', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'd', 'Date acquired', 'Date acquired', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'e', 'Source of acquisition', 'Source of acquisition', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'h', 'Use restrictions', 'Use restrictions', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'j', 'Item status', 'Item status', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'l', 'Temporary location', 'Temporary location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'p', 'Piece designation', 'Piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'r', 'Invalid or canceled piece designation', 'Invalid or canceled piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', '8', 'Sequence number', 'Sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'a', 'Internal item number', 'Internal item number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'b', 'Invalid or canceled internal item number', 'Invalid or canceled internal item number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'c', 'Cost', 'Cost', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'd', 'Date acquired', 'Date acquired', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'e', 'Source of acquisition', 'Source of acquisition', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'h', 'Use restrictions', 'Use restrictions', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'j', 'Item status', 'Item status', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'l', 'Temporary location', 'Temporary location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'p', 'Piece designation', 'Piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'r', 'Invalid or canceled piece designation', 'Invalid or canceled piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL); diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql index 4b77adf..5bd89ff 100644 --- a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql +++ b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql @@ -34,7 +34,8 @@ INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblib ('999', 'a', 'Item type [OBSOLETE]', 'Item type [OBSOLETE]', 0, 0, NULL, -1, NULL, NULL, '', NULL, -5, '', '', '', NULL), ('999', 'b', 'Koha Dewey Subclass [OBSOLETE]', 'Koha Dewey Subclass [OBSOLETE]', 0, 0, NULL, 0, NULL, NULL, '', NULL, -5, '', '', '', NULL), ('999', 'c', 'Koha biblionumber', 'Koha biblionumber', 0, 0, 'biblio.biblionumber', -1, NULL, NULL, '', NULL, -5, '', '', '', NULL), - ('999', 'd', 'Koha biblioitemnumber', 'Koha biblioitemnumber', 0, 0, 'biblioitems.biblioitemnumber', -1, NULL, NULL, '', NULL, -5, '', '', '', NULL); + ('999', 'd', 'Koha biblioitemnumber', 'Koha biblioitemnumber', 0, 0, 'biblioitems.biblioitemnumber', -1, NULL, NULL, '', NULL, -5, '', '', '', NULL), + ('999', 'e', 'Koha holding_id', 'Koha holding_id', 0, 0, 'holdings.holding_id', -1, NULL, NULL, '', NULL, -5, '', '', '', NULL); -- ****************************************************** @@ -97,6 +98,7 @@ INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblib ('952', '7', 'Not for loan', 'Not for loan', 0, 0, 'items.notforloan', 10, 'NOT_LOAN', '', '', 0, 0, '', '', '', NULL), ('952', '8', 'Collection code', 'Collection code', 0, 0, 'items.ccode', 10, 'CCODE', '', '', 0, 0, '', '', '', NULL), ('952', '9', 'Koha itemnumber (autogenerated)', 'Koha itemnumber', 0, 0, 'items.itemnumber', -1, '', '', '', 0, 7, '', '', '', NULL), + ('952', 'V', 'Holding record', 'Holding record', 0, 0, 'items.holding_id', 10, 'holdings', '', '', NULL, 0, '', '', '', NULL), ('952', 'a', 'Permanent location', 'Permanent Location', 0, 0, 'items.homebranch', 10, 'branches', '', '', 0, 0, '', '', '', NULL), ('952', 'b', 'Current location', 'Current Location', 0, 0, 'items.holdingbranch', 10, 'branches', '', '', 0, 0, '', '', '', NULL), ('952', 'c', 'Shelving location', 'Shelving location', 0, 0, 'items.location', 10, 'LOC', '', '', 0, 0, '', '', '', NULL), @@ -4621,3 +4623,325 @@ SELECT tagfield, tagsubfield, liblibrarian, libopac, repeatable, mandatory, koha FROM marc_subfield_structure WHERE frameworkcode="" AND kohafield IN ("biblio.title", "biblio.author", "biblioitems.publishercode", "biblioitems.editionstatement", "biblio.copyrightdate", "biblioitems.isbn", "biblio.seriestitle" ); + + +-- HOLDINGS RECORD FRAMEWORK + +INSERT IGNORE INTO `biblio_framework` VALUES ('HLD', 'Default holdings framework'); +INSERT IGNORE INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES + ('999', 'SYSTEM CONTROL NUMBERS (KOHA)', 'SYSTEM CONTROL NUMBERS (KOHA)', 1, 0, '', 'HLD'); + +INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES + ('999', 'c', 'Koha biblionumber', 'Koha biblionumber', 0, 0, 'biblio.biblionumber', -1, NULL, NULL, '', NULL, -5, 'HLD', '', '', NULL), + ('999', 'd', 'Koha biblioitemnumber', 'Koha biblioitemnumber', 0, 0, 'biblioitems.biblioitemnumber', -1, NULL, NULL, '', NULL, -5, 'HLD', '', '', NULL), + ('999', 'e', 'Koha holding_id', 'Koha holding_id', 0, 0, 'holdings.holding_id', -1, NULL, NULL, '', NULL, -5, 'HLD', '', '', NULL); + + +INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES + ('942', 'n', 'Suppress in OPAC', 'Suppress in OPAC', 0, 0, 'holdings.suppress', 9, '', '', '', 0, 0, 'HLD', '', '', NULL); + +INSERT IGNORE INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES + ('000', 'LEADER', 'LEADER', 0, 1, '', 'HLD'), + ('001', 'CONTROL NUMBER', 'CONTROL NUMBER', 0, 0, '', 'HLD'), + ('003', 'CONTROL NUMBER IDENTIFIER', 'CONTROL NUMBER IDENTIFIER', 0, 1, '', 'HLD'), + ('005', 'DATE AND TIME OF LATEST TRANSACTION', 'DATE AND TIME OF LATEST TRANSACTION', 0, 1, '', 'HLD'), + ('006', 'FIXED-LENGTH DATA ELEMENTS--ADDITIONAL MATERIAL CHARACTERISTICS', 'FIXED-LENGTH DATA ELEMENTS--ADDITIONAL MATERIAL CHARACTERISTICS', 1, 0, '', 'HLD'), + ('007', 'PHYSICAL DESCRIPTION FIXED FIELD--GENERAL INFORMATION', 'PHYSICAL DESCRIPTION FIXED FIELD--GENERAL INFORMATION', 1, 0, '', 'HLD'), + ('008', 'FIXED-LENGTH DATA ELEMENTS--GENERAL INFORMATION', 'FIXED-LENGTH DATA ELEMENTS--GENERAL INFORMATION', 0, 1, '', 'HLD'); + +INSERT IGNORE INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES + ('850', 'HOLDING INSTITUTION', 'HOLDING INSTITUTION', 1, 0, NULL, 'HLD'), + ('852', 'LOCATION', 'LOCATION', 1, 0, NULL, 'HLD'), + ('853', 'CAPTIONS AND PATTERN--BASIC BIBLIOGRAPHIC UNIT', 'CAPTIONS AND PATTERN--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('854', 'CAPTIONS AND PATTERN--SUPPLEMENTARY MATERIAL', 'CAPTIONS AND PATTERN--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('855', 'CAPTIONS AND PATTERN--INDEXES', 'CAPTIONS AND PATTERN--INDEXES', 1, 0, NULL, 'HLD'), + ('856', 'ELECTRONIC LOCATION AND ACCESS', 'ELECTRONIC LOCATION AND ACCESS', 1, 0, NULL, 'HLD'), + ('863', 'ENUMERATION AND CHRONOLOGY--BASIC BIBLIOGRAPHIC UNIT', 'ENUMERATION AND CHRONOLOGY--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('864', 'ENUMERATION AND CHRONOLOGY--SUPPLEMENTARY MATERIAL', 'ENUMERATION AND CHRONOLOGY--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('865', 'ENUMERATION AND CHRONOLOGY--INDEXES', 'ENUMERATION AND CHRONOLOGY--INDEXES', 1, 0, NULL, 'HLD'), + ('866', 'TEXTUAL HOLDINGS--BASIC BIBLIOGRAPHIC UNIT', 'TEXTUAL HOLDINGS--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('867', 'TEXTUAL HOLDINGS--SUPPLEMENTARY MATERIAL', 'TEXTUAL HOLDINGS--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('868', 'TEXTUAL HOLDINGS--INDEXES', 'TEXTUAL HOLDINGS--INDEXES', 1, 0, NULL, 'HLD'), + ('876', 'ITEM INFORMATION--BASIC BIBLIOGRAPHIC UNIT', 'ITEM INFORMATION--BASIC BIBLIOGRAPHIC UNIT', 1, 0, NULL, 'HLD'), + ('877', 'ITEM INFORMATION--SUPPLEMENTARY MATERIAL', 'ITEM INFORMATION--SUPPLEMENTARY MATERIAL', 1, 0, NULL, 'HLD'), + ('878', 'ITEM INFORMATION--INDEXES', 'ITEM INFORMATION--INDEXES', 1, 0, NULL, 'HLD'); + +INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES + ('000', '@', 'fixed length control field', 'fixed length control field', 0, 1, '', 0, '', '', 'marc21_leader_holdings.pl', 0, 0, 'HLD', '', '', NULL), + ('001', '@', 'control field', 'control field', 0, 0, '', 0, '', '', '', 0, 0, 'HLD', '', '', NULL), + ('003', '@', 'control field', 'control field', 0, 1, '', 0, '', '', 'marc21_orgcode.pl', 0, 0, 'HLD', '', '', NULL), + ('005', '@', 'control field', 'control field', 0, 1, '', 0, '', '', 'marc21_field_005.pl', 0, 0, 'HLD', '', '', NULL), + ('006', '@', 'fixed length control field', 'fixed length control field', 0, 0, '', 0, '', '', 'marc21_field_006.pl', 0, -1, 'HLD', '', '', NULL), + ('007', '@', 'fixed length control field', 'fixed length control field', 0, 0, '', 0, '', '', 'marc21_field_007.pl', 0, 0, 'HLD', '', '', NULL), + ('008', '@', 'fixed length control field', 'fixed length control field', 0, 1, '', 0, '', '', 'marc21_field_008_holdings.pl', 0, 0, 'HLD', '', '', NULL), + ('850', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'a', 'Holding institution', 'Holding institution', 1, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'b', 'Holdings (NR) (MU VM SE) [OBSOLETE]', 'Holdings (NR) (MU VM SE) [OBSOLETE]', 0, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'd', 'Inclusive dates (NR) (MU VM SE) [OBSOLETE]', 'Inclusive dates (NR) (MU VM SE) [OBSOLETE]', 0, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('850', 'e', 'Retention statement (NR) (CF MU VM SE) [OBSOLETE]', 'Retention statement (NR) (CF MU VM SE) [OBSOLETE]', 0, 0, NULL, 8, NULL, NULL, '', NULL, 4, 'HLD', '', '', NULL), + ('852', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', '8', 'Sequence number', 'Sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'a', 'Location', 'Location', 0, 0, 'holdings.holdingbranch', 8, 'branches', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'b', 'Sublocation or collection', 'Sublocation or collection', 1, 0, 'holdings.location', 8, 'LOC', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'c', 'Shelving location', 'Shelving location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'd', 'Former shelving location', 'Former shelving location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'e', 'Address', 'Address', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'f', 'Coded location qualifier', 'Coded location qualifier', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'g', 'Non-coded location qualifier', 'Non-coded location qualifier', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'h', 'Classification part', 'Classification part', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'i', 'Item part', 'Item part', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'j', 'Shelving control number', 'Shelving control number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'k', 'Call number prefix', 'Call number prefix', 1, 0, 'holdings.callnumber', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'l', 'Shelving form of title', 'Shelving form of title', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'm', 'Call number suffix', 'Call number suffix', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'n', 'Country code', 'Country code', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 1, 0, '', 8, '', '', '', 1, 4, 'HLD', '', '', NULL), + ('852', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('852', 'z', 'Public note', 'Public note', 1, 0, 'holdings.public_note', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'n', 'Pattern note', 'Pattern note', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'p', 'Number of pieces per issuance', 'Number of pieces per issuance', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 't', 'Copy', 'Copy', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'u', 'Bibliographic units per next higher level', 'Bibliographic units per next higher level', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'v', 'Numbering continuity', 'Numbering continuity', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'w', 'Frequency', 'Frequency', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'x', 'Calendar change', 'Calendar change', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'y', 'Regularity pattern', 'Regularity pattern', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('853', 'z', 'Numbering scheme', 'Numbering scheme', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'n', 'Pattern note', 'Pattern note', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'p', 'Number of pieces per issuance', 'Number of pieces per issuance', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 't', 'Copy', 'Copy', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'u', 'Bibliographic units per next higher level', 'Bibliographic units per next higher level', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'v', 'Numbering continuity', 'Numbering continuity', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'w', 'Frequency', 'Frequency', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'x', 'Calendar change', 'Calendar change', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'y', 'Regularity pattern', 'Regularity pattern', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('854', 'z', 'Numbering scheme', 'Numbering scheme', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'n', 'Pattern note', 'Pattern note', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'p', 'Number of pieces per issuance', 'Number of pieces per issuance', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 't', 'Copy', 'Copy', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'u', 'Bibliographic units per next higher level', 'Bibliographic units per next higher level', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'v', 'Numbering continuity', 'Numbering continuity', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'w', 'Frequency', 'Frequency', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'x', 'Calendar change', 'Calendar change', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'y', 'Regularity pattern', 'Regularity pattern', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('855', 'z', 'Numbering scheme', 'Numbering scheme', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('856', '2', 'Access method', 'Access method', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'a', 'Host name', 'Host name', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'b', 'Access number', 'Access number', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'c', 'Compression information', 'Compression information', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'd', 'Path', 'Path', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'f', 'Electronic name', 'Electronic name', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'h', 'Processor of request', 'Processor of request', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'i', 'Instruction', 'Instruction', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'j', 'Bits per second', 'Bits per second', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'k', 'Password', 'Password', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'l', 'Logon', 'Logon', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'm', 'Contact for access assistance', 'Contact for access assistance', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'n', 'Name of location of host', 'Name of location of host', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'o', 'Operating system', 'Operating system', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'p', 'Port', 'Port', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'q', 'Electronic format type', 'Electronic format type', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'r', 'Settings', 'Settings', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 's', 'File size', 'File size', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 't', 'Terminal emulation', 'Terminal emulation', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 1, 0, 'biblioitems.url', 8, '', '', '', 1, 4, 'HLD', '', '', NULL), + ('856', 'v', 'Hours access method available', 'Hours access method available', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'w', 'Record control number', 'Record control number', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'y', 'Link text', 'Link text', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('856', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('863', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('863', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'i', 'First level of chronology', 'First level of chronology', 0, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('863', 'z', 'Public note', 'Public note', 1, 0, 'holdings.summary', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('864', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('864', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('864', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('865', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('865', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('865', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('866', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('866', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('866', 'a', 'Textual string', 'Textual string', 0, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('866', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('866', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('867', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('867', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('867', 'a', 'Textual string', 'Textual string', 0, 0, 'holdings.supplements', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('867', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('867', 'z', 'Public note', 'Public note', 1, 0, 'holdings.supplements', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('868', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('868', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('868', 'a', 'Textual string', 'Textual string', 0, 0, 'holdings.indexes', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('868', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('868', 'z', 'Public note', 'Public note', 1, 0, 'holdings.indexes', 8, '', '', '', 0, 4, 'HLD', '', '', NULL), + ('876', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', '8', 'Sequence number', 'Sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'a', 'Internal item number', 'Internal item number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'b', 'Invalid or canceled internal item number', 'Invalid or canceled internal item number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'c', 'Cost', 'Cost', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'd', 'Date acquired', 'Date acquired', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'e', 'Source of acquisition', 'Source of acquisition', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'h', 'Use restrictions', 'Use restrictions', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'j', 'Item status', 'Item status', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'l', 'Temporary location', 'Temporary location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'p', 'Piece designation', 'Piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'r', 'Invalid or canceled piece designation', 'Invalid or canceled piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('876', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', '8', 'Sequence number', 'Sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'a', 'Internal item number', 'Internal item number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'b', 'Invalid or canceled internal item number', 'Invalid or canceled internal item number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'c', 'Cost', 'Cost', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'd', 'Date acquired', 'Date acquired', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'e', 'Source of acquisition', 'Source of acquisition', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'h', 'Use restrictions', 'Use restrictions', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'j', 'Item status', 'Item status', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'l', 'Temporary location', 'Temporary location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'p', 'Piece designation', 'Piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'r', 'Invalid or canceled piece designation', 'Invalid or canceled piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('877', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', '3', 'Materials specified', 'Materials specified', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', '8', 'Sequence number', 'Sequence number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'a', 'Internal item number', 'Internal item number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'b', 'Invalid or canceled internal item number', 'Invalid or canceled internal item number', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'c', 'Cost', 'Cost', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'd', 'Date acquired', 'Date acquired', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'e', 'Source of acquisition', 'Source of acquisition', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'h', 'Use restrictions', 'Use restrictions', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'j', 'Item status', 'Item status', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'l', 'Temporary location', 'Temporary location', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'p', 'Piece designation', 'Piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'r', 'Invalid or canceled piece designation', 'Invalid or canceled piece designation', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL), + ('878', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', NULL, 4, 'HLD', '', '', NULL); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 95c3617..65b8fc2 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -671,6 +671,7 @@ CREATE TABLE `deleteditems` ( `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) `new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. + `holding_id` int(11) default NULL, -- foreign key from holdings table used to link this item to the right holdings record PRIMARY KEY (`itemnumber`), KEY `delitembarcodeidx` (`barcode`), KEY `delitemstocknumberidx` (`stocknumber`), @@ -883,11 +884,55 @@ CREATE TABLE `refund_lost_item_fee_rules` ( -- refund lost item fee rules tbale ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- +-- Table structure for table `holdings` +-- + +DROP TABLE IF EXISTS `holdings`; +CREATE TABLE `holdings` ( -- table that stores summary holdings information + `holding_id` int(11) NOT NULL auto_increment, -- unique identifier assigned to each holdings record + `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this record to the right bib record + `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link record to additional information + `frameworkcode` varchar(4) NOT NULL default '', -- foreign key from the biblio_framework table to identify which framework was used in cataloging this record + `holdingbranch` varchar(10) default NULL, -- foreign key from the branches table for the library that owns this record (MARC21 852$a) + `location` varchar(80) default NULL, -- authorized value for the shelving location for this record (MARC21 852$b) + `callnumber` varchar(255) default NULL, -- call number (852$h+$i in MARC21) + `suppress` tinyint(1) default NULL, -- Boolean indicating whether the record is suppressed in OPAC + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched + `datecreated` DATE NOT NULL, -- the date this record was added to Koha + `deleted_on` DATETIME DEFAULT NULL, -- the date this record was deleted + PRIMARY KEY (`holding_id`), + KEY `hldnoidx` (`holding_id`), + KEY `hldbinoidx` (`biblioitemnumber`), + KEY `hldbibnoidx` (`biblionumber`), + CONSTRAINT `holdings_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `holdings_ibfk_2` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `holdings_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `holdings_metadata` +-- + +DROP TABLE IF EXISTS `holdings_metadata`; +CREATE TABLE holdings_metadata ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `holding_id` INT(11) NOT NULL, + `format` VARCHAR(16) NOT NULL, + `marcflavour` VARCHAR(16) NOT NULL, + `metadata` LONGTEXT NOT NULL, + `deleted_on` DATETIME DEFAULT NULL, -- the date this record was deleted + PRIMARY KEY(id), + UNIQUE KEY `holdings_metadata_uniq_key` (`holding_id`,`format`,`marcflavour`), + KEY `hldnoidx` (`holding_id`), + CONSTRAINT `holdings_metadata_fk_1` FOREIGN KEY (`holding_id`) REFERENCES `holdings` (`holding_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- -- Table structure for table `items` -- DROP TABLE IF EXISTS `items`; -CREATE TABLE `items` ( -- holdings/item information +CREATE TABLE `items` ( -- item information `itemnumber` int(11) NOT NULL auto_increment, -- primary key and unique identifier added by Koha `biblionumber` int(11) NOT NULL default 0, -- foreign key from biblio table used to link this item to the right bib record `biblioitemnumber` int(11) NOT NULL default 0, -- foreign key from the biblioitems table to link to item to additional information @@ -933,6 +978,7 @@ CREATE TABLE `items` ( -- holdings/item information `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) `new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. + `holding_id` int(11) default NULL, -- foreign key from holdings table used to link this item to the right holdings record PRIMARY KEY (`itemnumber`), UNIQUE KEY `itembarcodeidx` (`barcode`), KEY `itemstocknumberidx` (`stocknumber`), @@ -945,10 +991,12 @@ CREATE TABLE `items` ( -- holdings/item information KEY `items_ccode` (`ccode`), KEY `itype_idx` (`itype`), KEY `timestamp` (`timestamp`), + KEY `hldid_idx` (`holding_id`), CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE, CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE, - CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `items_ibfk_4` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `items_ibfk_5` FOREIGN KEY (`holding_id`) REFERENCES `holdings` (`holding_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index 6fff954..6a9ed8b 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -21,6 +21,7 @@ INSERT IGNORE INTO authorised_value_categories( category_name ) INSERT IGNORE INTO authorised_value_categories( category_name ) VALUES ('branches'), + ('holdings'), ('itemtypes'), ('cn_source'); diff --git a/koha-tmpl/intranet-tmpl/prog/css/addholding.css b/koha-tmpl/intranet-tmpl/prog/css/addholding.css new file mode 100644 index 0000000..6900e70 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/css/addholding.css @@ -0,0 +1,171 @@ +#addholdingtabs { + margin-top : 1em; +} + +#addholdingtabs .ui-tabs-panel { + float : left; +} + +.buttonPlus { + font-weight : bold; + text-decoration : none; +} + +.buttonMinus { + font-weight : bold; + text-decoration : none; +} + +a.expandfield { + text-decoration : none; +} + +#authoritytabs { + margin-top : 1em; + margin-bottom : 1em; +} + +.toptabs .ui-tabs-nav li a { + padding : .2em 1.2em; +} + +div.tag { + clear: both; +} + +div.subfield_line { + padding-bottom: .3em; + float: left; + clear: left; + width: 100%; +} + +div.subfield_line label { + font-size:89%; + float: left; + padding-right : .4em; + width: 16em; + text-align: left; + clear:left; +} + +.subfieldcode img { + cursor: pointer; +} + +.tag_title { + font-size : 90%; + padding : .2em 0; +} + +.tagnum { + font-size : 110%; + font-weight : bold; + color : #000; + padding : .1em .3em .1em 0; +} + +a.tagnum { + font-size : 110%; + font-weight : bold; + color : #000; + padding : .1em .3em .1em 0; + text-decoration : none; +} + +.subfield { + color : #00698a; + float: left; + width: 10em; + text-align:right; +} + +.subfieldcode { + display: block; + float: left; +} + +.labelsubfield { + float:left; +} + +.input_marceditor { + float:left; + width:30em; +} + +.indicator { + width: 1em; + box-sizing: content-box; +} + +*html .input_marceditor { + width : 15em; +} + +#cataloguing_additem_newitem fieldset.rows label, #cataloguing_additem_newitem fieldset.rows span.label { + font-size : 100%; + width : 25%; +} + +#cataloguing_additem_newitem fieldset.rows li { + padding-bottom : 3px; +} +#cataloguing_additem_newitem .input_marceditor { + width : auto; +} + +#cataloguing_additem_newitem textarea.input_marceditor { + width : 31em; +} + +.mandatory_marker { + color: red; +} +.linktools { display: block; white-space: nowrap; } +.linktools a { font-size : 75%; display:block;text-decoration:none;} +.linktools a {margin:0 2px;padding:2px;background-color:#FFF;text-align:center; } +.linktools a:first-child { border-bottom: 1px solid #DDD; } +.linktools a:hover { background-color: #FFC; } +.subfield_controls { margin : 0 .5em; } +.readonly { border-width : 1px; border-style: inset; padding-left : 15px; background: #EEE url(../img/locked.png) center left no-repeat; width:29em; } + +#cataloguing_additem_itemlist { + margin-bottom : 1em; +} +.yui-gf div.first { + width : 19%; +} + +.yui-gf .yui-u { + width: 79.2%; +} + +tbody tr.active:nth-child(2n+1) td, +tbody tr.active td { + background-color: #FFFFCC; +} + +#loading { + background-color: #FFF; + cursor: wait; + height: 100%; + left: 0; + opacity: .7; + position: fixed; + top: 0; + width: 100%; + z-index: 1000; +} +#loading div { + background : transparent url(../img/loading.gif) top left no-repeat; + font-size : 175%; + font-weight: bold; + height: 2em; + left: 50%; + margin: -1em 0 0 -2.5em; + padding-left : 50px; + position: absolute; + top: 50%; + width: 15em; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index d5191e3..022e72c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -10,6 +10,10 @@ CAN_user_serials_create_subscription ) %]
  • New record
  • [% END %] + [% IF ( show_summary_holdings && CAN_user_editcatalogue_edit_items ) %] +
  • New holding
  • + [% END %] + [% IF ( CAN_user_editcatalogue_edit_items ) %]
  • New item
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt index c2ae0e3..b4ddd2b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt @@ -133,7 +133,7 @@   - Default framework + Default bibliographic framework - [% FOREACH loo IN frameworks %] [% loo.frameworkcode | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index e0322df..671812b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -276,3 +276,10 @@ Cataloging: - "All values of repeating tags and subfields will be printed with the given RIS tag." - "
    " - "Use of TY ( record type ) as a key will replace the default TY with the field value of your choosing." + Holdings: + - + - pref: SummaryHoldings + choices: + yes: Use + no: "Don't use" + - summary holdings records. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index ce02cb6..4c60d1e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -5,6 +5,7 @@ [% USE AuthorisedValues %] [% USE Branches %] [% USE Biblio %] +[% USE Holdings %] [% IF Koha.Preference('AmazonAssocTag') %] [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') | html %] @@ -296,6 +297,9 @@
    +[% IF ( show_summary_holdings ) %] +
    + + [% IF ( summary_holdings ) %] +
    +
    + + + + + + + + [% IF ( CAN_user_editcatalogue_edit_items ) %][% END %] + + + + [% FOREACH holding IN summary_holdings %] + + + + + [% IF CAN_user_editcatalogue_edit_items %] + + [% END %] + + [% END %] + +
    LibraryLocationCall numberStatus 
    [% UNLESS ( singlebranchmode ) %][% Branches.GetName( holding.holdingbranch ) | html %] [% END %][% holding.location | html %][% IF ( holding.sub_location ) %] ([% holding.sub_location | html %])[% END %] + [% IF ( holding.callnumber ) %] [% holding.callnumber | html %][% END %] + [% IF ( holding.suppress ) %] + Suppressed in OPAC + [% END %] + + Edit + Delete + Add item +
    + [% ELSE %] +
    No holdings records
    + [% END %] + +
    +[% END %] + [% items_table_block_iter = 0 %] [% BLOCK items_table %] [% items_table_block_iter = items_table_block_iter + 1 %] @@ -348,6 +397,7 @@ [% IF (StaffDetailItemSelection) %][% END %] [% IF ( item_level_itypes ) %]Item type[% END %] + [% IF ( show_summary_holdings ) %]Holding[% END %] Current location Home library [% IF ( itemdata_ccode ) %]Collection[% END %] @@ -385,6 +435,9 @@ [% item.translated_description | html %] [% END %] + [% IF ( show_summary_holdings ) %] + [% Holdings.GetLocation(item.holding_id) | html %] + [% END %] [% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.branchcode ) | html %] [% END %] [% Branches.GetName(item.homebranch) | html %][% item.location | html %] [% IF ( itemdata_ccode ) %][% item.ccode | html %][% END %] @@ -1020,12 +1073,16 @@ $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false); itemSelectionBuildActionLinks(tab); }); + + $('a.delete').click(function() { + return confirm(_('Are you sure?')); + }); }); [% END %] $(document).ready(function() { $('#bibliodetails').tabs(); - [% IF count == 0 %] + [% IF count == 0 and not show_summary_holdings %] $('#bibliodetails').tabs("option", "active", 3); [% END %] $('#search-form').focus(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 119bd11..2512419 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -2,6 +2,7 @@ [% USE Asset %] [% USE Koha %] [% USE Branches %] +[% USE Holdings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Catalog › Item details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %] @@ -55,6 +56,7 @@ [% END %] [% END %][% END %]
      +
    1. Holding: [% Holdings.GetLocation( ITEM_DAT.holding_id ) | html %] 
    2. Home library: [% Branches.GetName( ITEM_DAT.homebranch ) | html %] 
    3. [% IF ( item_level_itypes ) %]
    4. Item type: [% ITEM_DAT.itype | html %] 
    5. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 7024546..737497b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -2,6 +2,7 @@ [% USE Asset %] [% USE Koha %] [% USE Biblio %] +[% USE Holdings %] [% USE KohaDates %] [% SET footerjs = 1 %] [% USE AuthorisedValues %] @@ -478,6 +479,19 @@
      + [% IF ( SEARCH_RESULT.summary_holdings ) %] +
      + Holdings +
        + [% FOREACH holding IN SEARCH_RESULT.summary_holdings %] +
      • + [% Holdings.GetLocation(holding) | html %] +
      • + [% END %] +
      +
      + [% END %] + [% IF ( SEARCH_RESULT.items_count ) %] [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addholding.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addholding.tt new file mode 100644 index 0000000..cfff160 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addholding.tt @@ -0,0 +1,615 @@ +[% USE Koha %] +[% SET KOHA_VERSION = Koha.Preference('Version') %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Cataloging › [% IF ( holding_id ) %]Editing record number [% holding_id %][% ELSE %]Add holding record[% END %] +[% INCLUDE 'doc-head-close.inc' %] + + +[% INCLUDE 'browser-strings.inc' %] + + + + + +[% INCLUDE 'select2.inc' %] + + +[% IF ( bidi ) %] + +[% END %] + + + +
      +
      Loading, please wait...
      +
      + +[% INCLUDE 'header.inc' %] + + + +
      + +
      +
      +
      + +

      +[% IF ( holding_id ) %]Editing record number [% holding_id %] +[% ELSE %]Add holdings record +[% END %] +

      + +[% IF ( done ) %] + +[% ELSE %] +
      + + +[% END %] + +
      + [% IF CAN_user_editcatalogue_edit_items %] + + [% END %] + +
      + + +
      +
      + Cancel +
      +
      + +[% IF ( popup ) %] + +[% END %] + + + + + + +
      + + +[% FOREACH BIG_LOO IN BIG_LOOP %] +
      + + [% FOREACH innerloo IN BIG_LOO.innerloop %] + [% IF ( innerloo.tag ) %] +
      +
      + [% IF advancedMARCEditor %] + [% innerloo.tag %] + [% ELSE %] + [% innerloo.tag %] + [% IF marcflavour != 'NORMARC' %] ?[% END %] + [% END %] + [% IF ( innerloo.fixedfield ) %] + + + [% ELSE %] + + + [% END %] - + + [% UNLESS advancedMARCEditor %] + [% innerloo.tag_lib %] + [% END %] + + [% IF ( innerloo.repeatable ) %] + + Repeat this Tag + + [% END %] + + Delete this Tag + + + +
      + + [% FOREACH subfield_loo IN innerloo.subfield_loop %] + +
      + + [% UNLESS advancedMARCEditor %] + [% IF ( subfield_loo.fixedfield ) %]
      + + [% END %] + +
      + [% END %] + [% END %] +
      +[% END %] + +
      + +
      + +
      +
      +
      + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008_holdings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008_holdings.tt new file mode 100644 index 0000000..6f2dade --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008_holdings.tt @@ -0,0 +1,193 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Holdings › 008 builder +[% INCLUDE 'doc-head-close.inc' %] + + +

      008 Fixed-length data elements

      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      00-05 - Date entered on file[% f1 %]
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      +
      Cancel
      +
      + + +[% INCLUDE 'popup-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_leader_holdings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_leader_holdings.tt new file mode 100644 index 0000000..db3a5df --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_leader_holdings.tt @@ -0,0 +1,105 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Holdings › 000 - Leader builder +[% INCLUDE 'doc-head-close.inc' %] + + +
      + +

      000 - Leader

      + + + + + + + + + + + + + + + 07-08 - Undefined + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      0-4 Record size(auto-filled)
      + +
      + +
      9 - Character coding schemea - UCS/Unicode (auto-filled)
      10-16 - indicator/subfields/size(auto-filled)
      + +
      + +
      19 - Undefined
      20-24 - entry map & lengths(auto-filled)
      +
      Cancel
      +
      + +[% INCLUDE 'popup-bottom.inc' %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index c451d8d..a035d2f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -6,6 +6,7 @@ [% USE Branches %] [% USE ColumnsSettings %] [% USE AuthorisedValues %] +[% USE Holdings %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %] [% IF Koha.Preference('AmazonAssocTag') %] @@ -675,6 +676,33 @@ [% END %] [% END %] [% END # IF itemloop.size %] + [% IF summary_holdings %] + [% FOREACH holding IN summary_holdings %] + [% UNLESS holding.suppress %] + [% holding_details = Holdings.GetDetails(holding) %] + [% IF holding_details.public_note || holding_details.summary || holding_details.supplements || holding_details.indexes %] + +
      + Additional information for [% Holdings.GetLocation(holding, 1) | html %] +
        + [% IF holding_details.public_note %] +
      • Public note: [% holding_details.public_note | html %]
      • + [% END %] + [% IF holding_details.summary %] +
      • Summary: [% holding_details.summary | html %]
      • + [% END %] + [% IF holding_details.supplements %] +
      • Supplements: [% holding_details.supplements | html %]
      • + [% END %] + [% IF holding_details.indexes %] +
      • Indexes: [% holding_details.indexes | html %]
      • + [% END %] +
      +
      + [% END %] + [% END %] + [% END %] + [% END %] [% PROCESS 'shelfbrowser.inc' %] [% INCLUDE shelfbrowser tab='holdings' %]
      diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index afaa775..764fcb2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE Koha %] +[% USE Holdings %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %] @@ -398,6 +399,15 @@ [% END %] [% ELSE %] No items available: + [% IF ( SEARCH_RESULT.summary_holdings ) %] + + [% FOREACH holding IN SEARCH_RESULT.summary_holdings %] + [% UNLESS holding.suppress %] + [% Holdings.GetLocation(holding, 1) | html %], + [% END %] + [% END %] + + [% END %] [% END %] [% END # / IF SEARCH_RESULT.available_items_loop.size %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index fd98cb1..5bf4304 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -4,9 +4,10 @@ + exclude-result-prefixes="marc items holdings"> @@ -1160,7 +1161,21 @@ () - No items available + + No items available + : + + , + + + - + + + - + + + + diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6f10c6b..17023d9 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -734,6 +734,13 @@ if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { } } +# Fetch summary holdings +if (C4::Context->preference('SummaryHoldings')) { + my $summary_holdings = C4::Holdings::GetHoldingsByBiblionumber($biblionumber); + $template->param( summary_holdings => $summary_holdings ); +} + + ## get notes and subjects from MARC record if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) { my $marcisbnsarray = GetMarcISBN ($record,$marcflavour); -- 2.7.4