@@ -, +, @@ the item barcode as input bibliographic record with field 773 (MARC21) populated analytical record and the host item identified by the barcode in the analytical record's 773$o (MARC21) them related perl scripts new routine C4 routines changes records and host items and bibs. The script looks for host field (MARC21 773) in records, and based on barcode in subfield 'o' populates host bibnumber in subfield '0' and host itemnumber in subfield '9'. The script can be run after an import of analytical records, it can also be run in the crontab to maintain the relationships prevent deletion of items that have linked analytics new way of displaying analytics), template displays linked analytics and allows creation of analytical records display links to analytical records from host records create_analytical_rel.pl relationships because GetMarcBiblio now needs a flag to add item records those with analytics --- C4/Auth.pm | 1 + C4/Biblio.pm | 124 +++++++++++++++ C4/Items.pm | 157 +++++++++++++++++--- C4/Reserves.pm | 8 + C4/Search.pm | 27 ++++ catalogue/detail.pl | 42 +++++- catalogue/moredetail.pl | 18 +++ cataloguing/addbiblio.pl | 18 ++- cataloguing/additem.pl | 57 +++++++ cataloguing/linkitem.pl | 98 ++++++++++++ etc/zebradb/biblios/etc/bib1.att | 2 +- etc/zebradb/ccl.properties | 3 + etc/zebradb/marc_defs/marc21/biblios/record.abs | 3 +- etc/zebradb/marc_defs/unimarc/biblios/record.abs | 3 + .../marc21/mandatory/marc21_framework_DEFAULT.sql | 2 + .../optional/marc21_simple_bib_frameworks.sql | 16 ++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 23 +++ .../prog/en/includes/biblio-view-menu.inc | 1 + .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 2 + .../en/modules/admin/preferences/cataloguing.pref | 6 + .../prog/en/modules/catalogue/detail.tt | 16 ++- .../prog/en/modules/cataloguing/additem.tt | 7 +- .../prog/en/modules/cataloguing/linkitem.tt | 57 +++++++ .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 5 + .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 5 + misc/migration_tools/create_analytical_rel.pl | 152 +++++++++++++++++++ opac/opac-detail.pl | 24 +++- opac/opac-reserve.pl | 36 +++++- reserve/placerequest.pl | 9 + reserve/request.pl | 16 ++- 31 files changed, 904 insertions(+), 35 deletions(-) create mode 100755 cataloguing/linkitem.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/linkitem.tt create mode 100755 misc/migration_tools/create_analytical_rel.pl --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -382,6 +382,7 @@ sub get_template_and_user { virtualshelves => C4::Context->preference("virtualshelves"), StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"), NoZebra => C4::Context->preference('NoZebra'), + EasyAnalyticalRecords => C4::Context->preference('EasyAnalyticalRecords'), ); } else { --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -78,6 +78,7 @@ BEGIN { &GetMarcBiblio &GetMarcAuthors &GetMarcSeries + &GetMarcHosts GetMarcUrls &GetUsedMarcStructure &GetXmlBiblio @@ -90,6 +91,7 @@ BEGIN { &GetMarcFromKohaField &GetFrameworkCode &TransformKohaToMarc + &PrepHostMarcField &CountItemsIssued ); @@ -1760,6 +1762,48 @@ sub GetMarcSeries { return $marcseriessarray; } #end getMARCseriess +=head2 GetMarcHosts + + $marchostsarray = GetMarcHosts($record,$marcflavour); + +Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns them in an array. + +=cut + +sub GetMarcHosts { + my ( $record, $marcflavour ) = @_; + my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf); + $marcflavour ||="MARC21"; + if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { + $tag = "773"; + $title_subf = "t"; + $bibnumber_subf ="0"; + $itemnumber_subf='9'; + } + elsif ($marcflavour eq "UNIMARC") { + $tag = "461"; + $title_subf = "t"; + $bibnumber_subf ="0"; + $itemnumber_subf='9'; + }; + + my @marchosts; + + foreach my $field ( $record->field($tag)) { + + my @fields_loop; + + my $hostbiblionumber = $field->subfield("$bibnumber_subf"); + my $hosttitle = $field->subfield($title_subf); + my $hostitemnumber=$field->subfield($itemnumber_subf); + push @fields_loop, { hostbiblionumber => $hostbiblionumber, hosttitle => $hosttitle, hostitemnumber => $hostitemnumber}; + push @marchosts, { MARCHOSTS_FIELDS_LOOP => \@fields_loop }; + + } + my $marchostsarray = \@marchosts; + return $marchostsarray; +} + =head2 GetFrameworkCode $frameworkcode = GetFrameworkCode( $biblionumber ) @@ -1797,6 +1841,86 @@ sub TransformKohaToMarc { return $record; } +=head2 PrepHostMarcField + + $hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$marcflavour ) + +This function returns a host field populated with data from the host record, the field can then be added to an analytical record + +=cut + +sub PrepHostMarcField { + my ($hostbiblionumber,$hostitemnumber, $marcflavour) = @_; + $marcflavour ||="MARC21"; + + my $hostrecord = GetMarcBiblio($hostbiblionumber); + my $item = C4::Items::GetItem($hostitemnumber); + + my $hostmarcfield; + if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) { + + #main entry + my $mainentry; + if ($hostrecord->subfield('100','a')){ + $mainentry = $hostrecord->subfield('100','a'); + } elsif ($hostrecord->subfield('110','a')){ + $mainentry = $hostrecord->subfield('110','a'); + } else { + $mainentry = $hostrecord->subfield('111','a'); + } + + # qualification info + my $qualinfo; + if (my $field260 = $hostrecord->field('260')){ + $qualinfo = $field260->as_string( 'abc' ); + } + + + #other fields + my $ed = $hostrecord->subfield('250','a'); + my $barcode = $item->{'barcode'}; + my $title = $hostrecord->subfield('245','a'); + + # record control number, 001 with 003 and prefix + my $recctrlno; + if ($hostrecord->field('001')){ + $recctrlno = $hostrecord->field('001')->data(); + if ($hostrecord->field('003')){ + $recctrlno = '('.$hostrecord->field('003')->data().')'.$recctrlno; + } + } + + # issn/isbn + my $issn = $hostrecord->subfield('022','a'); + my $isbn = $hostrecord->subfield('020','a'); + + + $hostmarcfield = MARC::Field->new( + 773, '0', '', + '0' => $hostbiblionumber, + '9' => $hostitemnumber, + 'a' => $mainentry, + 'b' => $ed, + 'd' => $qualinfo, + 'o' => $barcode, + 't' => $title, + 'w' => $recctrlno, + 'x' => $issn, + 'z' => $isbn + ); + } elsif ($marcflavour eq "UNIMARC") { + $hostmarcfield = MARC::Field->new( + 461, '', '', + '0' => $hostbiblionumber, + 't' => $hostrecord->subfield('200','a'), + '9' => $hostitemnumber + ); + }; + + return $hostmarcfield; +} + + =head2 TransformKohaToMarcOneField $record = TransformKohaToMarcOneField( $sth, $record, $kohafieldname, $value, $frameworkcode ); --- a/C4/Items.pm +++ a/C4/Items.pm @@ -69,7 +69,9 @@ BEGIN { GetItemsByBiblioitemnumber GetItemsInfo GetItemsLocationInfo + GetHostItemsInfo get_itemnumbers_of + get_hostitemnumbers_of GetItemnumberFromBarcode GetBarcodeFromItemnumber GetHiddenItemnumbers @@ -78,6 +80,8 @@ BEGIN { MoveItemFromBiblio GetLatestAcquisitions CartToShelf + + GetAnalyticsCount ); } @@ -1395,6 +1399,46 @@ sub GetItemsLocationInfo { return @results; } +=head2 GetHostItemsInfo + + $hostiteminfo = GetHostItemsInfo($hostfield); + Returns the iteminfo for items linked to records via a host field + +=cut + +sub GetHostItemsInfo { + my ($record) = @_; + my @returnitemsInfo; + + if (C4::Context->preference('marcflavour') eq 'MARC21' || + C4::Context->preference('marcflavour') eq 'NORMARC'){ + foreach my $hostfield ( $record->field('773') ) { + my $hostbiblionumber = $hostfield->subfield("0"); + my $linkeditemnumber = $hostfield->subfield("9"); + my @hostitemInfos = GetItemsInfo($hostbiblionumber); + foreach my $hostitemInfo (@hostitemInfos){ + if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){ + push (@returnitemsInfo,$hostitemInfo); + last; + } + } + } + } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC'){ + foreach my $hostfield ( $record->field('461') ) { + my $hostbiblionumber = $hostfield->subfield("0"); + my $linkeditemnumber = $hostfield->subfield("9"); + my @hostitemInfos = GetItemsInfo($hostbiblionumber); + foreach my $hostitemInfo (@hostitemInfos){ + if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){ + push (@returnitemsInfo,$hostitemInfo); + last; + } + } + } + } + return @returnitemsInfo; +} + =head2 GetLastAcquisitions @@ -1482,6 +1526,53 @@ sub get_itemnumbers_of { return \%itemnumbers_of; } +=head2 get_hostitemnumbers_of + + my @itemnumbers_of = get_hostitemnumbers_of($biblionumber); + +Given a biblionumber, return the list of corresponding itemnumbers that are linked to it via host fields + +Return a reference on a hash where key is a biblionumber and values are +references on array of itemnumbers. + +=cut + + +sub get_hostitemnumbers_of { + my ($biblionumber) = @_; + my $marcrecord = GetMarcBiblio($biblionumber); + my (@returnhostitemnumbers,$tag, $biblio_s, $item_s); + + my $marcflavor = C4::Context->preference('marcflavour'); + if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') { + $tag='773'; + $biblio_s='0'; + $item_s='9'; + } elsif ($marcflavor eq 'UNIMARC') { + $tag='461'; + $biblio_s='0'; + $item_s='9'; + } + + foreach my $hostfield ( $marcrecord->field($tag) ) { + my $hostbiblionumber = $hostfield->subfield($biblio_s); + my $linkeditemnumber = $hostfield->subfield($item_s); + my @itemnumbers; + if (my $itemnumbers = get_itemnumbers_of($hostbiblionumber)->{$hostbiblionumber}) + { + @itemnumbers = @$itemnumbers; + } + foreach my $itemnumber (@itemnumbers){ + if ($itemnumber eq $linkeditemnumber){ + push (@returnhostitemnumbers,$itemnumber); + last; + } + } + } + return @returnhostitemnumbers; +} + + =head2 GetItemnumberFromBarcode $result = GetItemnumberFromBarcode($barcode); @@ -2094,35 +2185,35 @@ sub DelItemCheck { my ( $dbh, $biblionumber, $itemnumber ) = @_; my $error; + my $countanalytics=GetAnalyticsCount($itemnumber); + + # check that there is no issue on this item before deletion. my $sth=$dbh->prepare("select * from issues i where i.itemnumber=?"); $sth->execute($itemnumber); my $item = GetItem($itemnumber); - my $onloan = $sth->fetchrow; - if ($onloan) { - $error = "book_on_loan"; + my $onloan=$sth->fetchrow; + + if ($onloan){ + $error = "book_on_loan" } elsif (C4::Context->preference("IndependantBranches") and (C4::Context->userenv->{branch} ne $item->{C4::Context->preference("HomeOrHoldingBranch")||'homebranch'})){ $error = "not_same_branch"; - } - else { - if ($onloan){ - $error = "book_on_loan" - } - else { - # check it doesnt have a waiting reserve - $sth=$dbh->prepare("SELECT * FROM reserves WHERE (found = 'W' or found = 'T') AND itemnumber = ?"); - $sth->execute($itemnumber); - my $reserve=$sth->fetchrow; - if ($reserve) { - $error = "book_reserved"; - } - else { - DelItem($dbh, $biblionumber, $itemnumber); - return 1; - } - } + } + else{ + # check it doesnt have a waiting reserve + $sth=$dbh->prepare("SELECT * FROM reserves WHERE (found = 'W' or found = 'T') AND itemnumber = ?"); + $sth->execute($itemnumber); + my $reserve=$sth->fetchrow; + if ($reserve){ + $error = "book_reserved"; + } elsif ($countanalytics > 0){ + $error = "linked_analytics"; + } else { + DelItem($dbh, $biblionumber, $itemnumber); + return 1; + } } return $error; } @@ -2339,4 +2430,28 @@ sub _parse_unlinked_item_subfields_from_xml { return $unlinked_subfields; } +=head2 GetAnalyticsCount + + $count= &GetAnalyticsCount($itemnumber) + +counts Usage of itemnumber in Analytical bibliorecords. + +=cut + +sub GetAnalyticsCount { + my ($itemnumber) = @_; + if (C4::Context->preference('NoZebra')) { + # Read the index Koha-Auth-Number for this authid and count the lines + my $result = C4::Search::NZanalyse("hi=$itemnumber"); + my @tab = split /;/,$result; + return scalar @tab; + } else { + ### ZOOM search here + my $query; + $query= "hi=".$itemnumber; + my ($err,$res,$result) = C4::Search::SimpleSearch($query,0,10); + return ($result); + } +} + 1; --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -383,6 +383,14 @@ sub CanBookBeReserved{ my ($borrowernumber, $biblionumber) = @_; my @items = GetItemsInfo($biblionumber); + + #get items linked via host records + my $marcrecord= GetMarcBiblio($biblionumber); + my @hostitemInfos = GetHostItemsInfo($marcrecord); + if (@hostitemInfos){ + push (@items,@hostitemInfos); + } + foreach my $item (@items){ return 1 if CanItemBeReserved($borrowernumber, $item->{itemnumber}); } --- a/C4/Search.pm +++ a/C4/Search.pm @@ -1559,6 +1559,33 @@ sub searchResults { # Pull out the items fields my @fields = $marcrecord->field($itemtag); + my $marcflavor = C4::Context->preference("marcflavour"); + # adding linked items that belong to host records + my $analyticsfield = '773'; + if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') { + $analyticsfield = '773'; + } elsif ($marcflavor eq 'UNIMARC') { + $analyticsfield = '461'; + } + foreach my $hostfield ( $marcrecord->field($analyticsfield)) { + my $hostbiblionumber = $hostfield->subfield("0"); + my $linkeditemnumber = $hostfield->subfield("9"); + if(!$hostbiblionumber eq undef){ + my $hostbiblio = GetMarcBiblio($hostbiblionumber, 1); + my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); + if(!$hostbiblio eq undef){ + my @hostitems = $hostbiblio->field($itemfield); + foreach my $hostitem (@hostitems){ + if ($hostitem->subfield("9") eq $linkeditemnumber){ + my $linkeditem =$hostitem; + # append linked items if they exist + if (!$linkeditem eq undef){ + push (@fields, $linkeditem);} + } + } + } + } + } # Setting item statuses for display my @available_items_loop; --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -41,9 +41,12 @@ use C4::XSLT; # use Smart::Comments; my $query = CGI->new(); + +my $analyze = $query->param('analyze'); + my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { - template_name => "catalogue/detail.tmpl", + template_name => 'catalogue/detail.tmpl', query => $query, type => "intranet", authnotrequired => 0, @@ -105,6 +108,7 @@ my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $marcseriesarray = GetMarcSeries($record,$marcflavour); my $marcurlsarray = GetMarcUrls ($record,$marcflavour); +my $marchostsarray = GetMarcHosts($record,$marcflavour); my $subtitle = GetRecordValue('subtitle', $record, $fw); # Get Branches, Itemtypes and Locations @@ -117,6 +121,16 @@ my @items; for my $itm (@all_items) { push @items, $itm unless ( $itm->{itemlost} && GetHideLostItemsPreference($borrowernumber) && !$showallitems); } + +# flag indicating existence of at least one item linked via a host record +my $hostrecords; +# adding items linked via host biblios +my @hostitems = GetHostItemsInfo($record); +if (@hostitems){ + $hostrecords =1; + push (@items,@hostitems); +} + my $dat = &GetBiblioData($biblionumber); # get count of holds @@ -148,9 +162,9 @@ if ( defined $dat->{'itemtype'} ) { $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }{imageurl} ); } -$dat->{'count'} = scalar @all_items; -$dat->{'showncount'} = scalar @items; -$dat->{'hiddencount'} = scalar @all_items - scalar @items; +$dat->{'count'} = scalar @all_items + @hostitems; +$dat->{'showncount'} = scalar @items + @hostitems; +$dat->{'hiddencount'} = scalar @all_items + @hostitems - scalar @items; my $shelflocations = GetKohaAuthorisedValues('items.location', $fw); my $collections = GetKohaAuthorisedValues('items.ccode' , $fw); @@ -158,6 +172,8 @@ my (@itemloop, %itemfields); my $norequests = 1; my $authvalcode_items_itemlost = GetAuthValCode('items.itemlost',$fw); my $authvalcode_items_damaged = GetAuthValCode('items.damaged', $fw); + +my $analytics_flag; foreach my $item (@items) { $item->{homebranch} = GetBranchName($item->{homebranch}); @@ -223,6 +239,19 @@ foreach my $item (@items) { $item->{waitingdate} = format_date($wait_hashref->{waitingdate}); } + # item has a host number if its biblio number does not match the current bib + if ($item->{biblionumber} ne $biblionumber){ + $item->{hostbiblionumber} = $item->{biblionumber}; + $item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title}; + } + + #count if item is used in analytical bibliorecords + my $countanalytics= GetAnalyticsCount($item->{itemnumber}); + if ($countanalytics > 0){ + $analytics_flag=1; + $item->{countanalytics} = $countanalytics; + } + push @itemloop, $item; } @@ -234,6 +263,7 @@ $template->param( MARCSERIES => $marcseriesarray, MARCURLS => $marcurlsarray, MARCISBNS => $marcisbnsarray, + MARCHOSTS => $marchostsarray, subtitle => $subtitle, itemdata_ccode => $itemfields{ccode}, itemdata_enumchron => $itemfields{enumchron}, @@ -243,6 +273,8 @@ $template->param( itemdata_itemnotes => $itemfields{itemnotes}, z3950_search_params => C4::Search::z3950_search_args($dat), holdcount => $holdcount, + hostrecords => $hostrecords, + analytics_flag => $analytics_flag, C4::Search::enabled_staff_search_views, ); @@ -284,7 +316,7 @@ foreach ( keys %{$dat} ) { $template->param( itemloop => \@itemloop, biblionumber => $biblionumber, - detailview => 1, + ($analyze? 'analyze':'detailview') =>1, subscriptions => \@subs, subscriptionsnumber => $subscriptionsnumber, subscriptiontitle => $dat->{title}, --- a/catalogue/moredetail.pl +++ a/catalogue/moredetail.pl @@ -97,6 +97,18 @@ for my $itm (@all_items) { ($itemnumber != $itm->{itemnumber})); } +my $record=GetMarcBiblio($biblionumber); + +my $hostrecords; +# adding items linked via host biblios +my @hostitems = GetHostItemsInfo($record); +if (@hostitems){ + $hostrecords =1; + push (@items,@hostitems); +} + + + my $totalcount=@all_items; my $showncount=@items; my $hiddencount = $totalcount - $showncount; @@ -121,6 +133,12 @@ foreach my $item (@items){ $item->{'datelastseen'} = format_date( $item->{'datelastseen'} ); $item->{'copyvol'} = $item->{'copynumber'}; + # item has a host number if its biblio number does not match the current bib + if ($item->{biblionumber} ne $biblionumber){ + $item->{hostbiblionumber} = $item->{biblionumber}; + $item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title}; + } + my $order = GetOrderFromItemnumber( $item->{'itemnumber'} ); $item->{'ordernumber'} = $order->{'ordernumber'}; $item->{'basketno'} = $order->{'basketno'}; --- a/cataloguing/addbiblio.pl +++ a/cataloguing/addbiblio.pl @@ -349,6 +349,10 @@ sub create_input { $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} = @@ -696,7 +700,7 @@ sub build_tabs ($$$$$) { # always include in the form regardless of the hidden setting - bug 2206 next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); - push( + push( @subfields_data, &create_input( $tag, $subfield, '', $index_tag, $tabloop, $record, @@ -834,6 +838,8 @@ my $mode = $input->param('mode'); my $frameworkcode = $input->param('frameworkcode'); my $redirect = $input->param('redirect'); my $dbh = C4::Context->dbh; +my $hostbiblionumber = $input->param('hostbiblionumber'); +my $hostitemnumber = $input->param('hostitemnumber'); my $userflags = 'edit_catalogue'; @@ -904,6 +910,14 @@ if (($biblionumber) && !($breedingid)){ if ($breedingid) { ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; } +#populate hostfield if hostbiblionumber is available +if ($hostbiblionumber){ + my $marcflavour = C4::Context->preference("marcflavour"); + $record=MARC::Record->new(); + $record->leader(''); + my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber,$marcflavour); + $record->append_fields($field); +} $is_a_modif = 0; @@ -1055,6 +1069,8 @@ elsif ( $op eq "delete" ) { biblioitemnumtagfield => $biblioitemnumtagfield, biblioitemnumtagsubfield => $biblioitemnumtagsubfield, biblioitemnumber => $biblioitemnumber, + hostbiblionumber => $hostbiblionumber, + hostitemnumber => $hostitemnumber ); } --- a/cataloguing/additem.pl +++ a/cataloguing/additem.pl @@ -276,6 +276,8 @@ my $error = $input->param('error'); my $biblionumber = $input->param('biblionumber'); my $itemnumber = $input->param('itemnumber'); my $op = $input->param('op'); +my $hostitemnumber = $input->param('hostitemnumber'); +my $marcflavour = C4::Context->preference("marcflavour"); my $frameworkcode = &GetFrameworkCode($biblionumber); @@ -502,6 +504,20 @@ if ($op eq "additem") { $itemnumber=""; } $nextop="additem"; +} elsif ($op eq "delinkitem"){ + my $analyticfield = '773'; + if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){ + $analyticfield = '773'; + } elsif ($marcflavour eq 'UNIMARC') { + $analyticfield = '461'; + } + foreach my $field ($record->field($analyticfield)){ + if ($field->subfield('9') eq $hostitemnumber){ + $record->delete_field($field); + last; + } + } + my $modbibresult = ModBiblio($record, $biblionumber,''); } # @@ -512,6 +528,8 @@ if ($op eq "additem") { # now, build existiing item list my $temp = GetMarcBiblio( $biblionumber ); #my @fields = $record->fields(); + + my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code my @big_array; #---- finds where items.itemnumber is stored @@ -520,6 +538,29 @@ my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebran C4::Biblio::EmbedItemsInMarcBiblio($temp, $biblionumber); my @fields = $temp->fields(); + +my @hostitemnumbers; +my $analyticfield = '773'; +if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') { + $analyticfield = '773'; +} elsif ($marcflavour eq 'UNIMARC') { + $analyticfield = '461'; +} +foreach my $hostfield ($temp->field($analyticfield)){ + if ($hostfield->subfield('0')){ + my $hostrecord = GetMarcBiblio($hostfield->subfield('0'), 1); + my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostfield->subfield('0')) ); + foreach my $hostitem ($hostrecord->field($itemfield)){ + if ($hostitem->subfield('9') eq $hostfield->subfield('9')){ + push (@fields, $hostitem); + push (@hostitemnumbers, $hostfield->subfield('9')); + } + } + } +} + + + foreach my $field (@fields) { next if ( $field->tag() < 10 ); @@ -550,6 +591,19 @@ foreach my $field (@fields) { } } $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield); + foreach my $hostitemnumber (@hostitemnumbers){ + if ($this_row{itemnumber} eq $hostitemnumber){ + $this_row{hostitemflag} = 1; + $this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber); + last; + } + } + +# my $countanalytics=GetAnalyticsCount($this_row{itemnumber}); +# if ($countanalytics > 0){ +# $this_row{countanalytics} = $countanalytics; +# } + } if (%this_row) { push(@big_array, \%this_row); @@ -570,6 +624,9 @@ for my $row ( @big_array ) { $row_data{itemnumber} = $row->{itemnumber}; #reporting this_row values $row_data{'nomod'} = $row->{'nomod'}; + $row_data{'hostitemflag'} = $row->{'hostitemflag'}; + $row_data{'hostbiblionumber'} = $row->{'hostbiblionumber'}; +# $row_data{'countanalytics'} = $row->{'countanalytics'}; push(@item_value_loop,\%row_data); } foreach my $subfield_code (sort keys(%witness)) { --- a/cataloguing/linkitem.pl +++ a/cataloguing/linkitem.pl @@ -0,0 +1,98 @@ +#!/usr/bin/perl + +# Link an item belonging to an analytical record, the item barcode needs to be provided +# +# Copyright 2009 BibLibre, 2010 Nucsoft OSS Labs +# +# 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 2 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 strict; +use CGI; +use C4::Auth; +use C4::Output; +use C4::Biblio; +use C4::Items; +use C4::Context; +use C4::Koha; +use C4::Branch; + + +my $query = CGI->new; + +my $biblionumber = $query->param('biblionumber'); +my $barcode = $query->param('barcode'); + +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "cataloguing/linkitem.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {editcatalogue => 'edit_catalogue'}, + debug => 1, + }); + +my $biblio = GetMarcBiblio($biblionumber); +my $marcflavour = C4::Context->preference("marcflavour"); +$marcflavour ||="MARC21"; +if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') { + $template->param(bibliotitle => $biblio->subfield('245','a')); +} elsif ($marcflavour eq 'UNIMARC') { + $template->param(bibliotitle => $biblio->subfield('200','a')); +} + +$template->param(biblionumber => $biblionumber); + +if ($barcode && $biblionumber) { + + # We get the host itemnumber + my $hostitemnumber = GetItemnumberFromBarcode($barcode); + + if ($hostitemnumber) { + my $hostbiblionumber = GetBiblionumberFromItemnumber($hostitemnumber); + + if ($hostbiblionumber) { + my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber,$marcflavour); + $biblio->append_fields($field); + + my $modresult = ModBiblio($biblio, $biblionumber, ''); + if ($modresult) { + $template->param(success => 1); + } else { + $template->param(error => 1, + errornomodbiblio => 1); + } + } else { + $template->param(error => 1, + errornohostbiblionumber => 1); + } + } else { + $template->param(error => 1, + errornohostitemnumber => 1); + + } + $template->param( + barcode => $barcode, + hostitemnumber => $hostitemnumber, + ); + +} else { + $template->param(missingparameter => 1); + if (!$barcode) { $template->param(missingbarcode => 1); } + if (!$biblionumber) { $template->param(missingbiblionumber => 1); } +} + + +output_html_with_http_headers $query, $cookie, $template->output; --- a/etc/zebradb/biblios/etc/bib1.att +++ a/etc/zebradb/biblios/etc/bib1.att @@ -257,6 +257,7 @@ att 8031 itype ## Fixed Fields and other special indexes att 9901 Extent att 8910 Koha-Auth-Number +att 8911 Host-Item-Number # record length according to the leader att 9905 llength att 9902 Summary @@ -290,4 +291,3 @@ att 9013 arp att 9520 Item # Curriculum att 9658 curriculum - --- a/etc/zebradb/ccl.properties +++ a/etc/zebradb/ccl.properties @@ -1064,6 +1064,7 @@ arl 1=9904 r=r #Accelerated Reader Point arp 1=9013 r=r + # Curriculum curriculum 1=9658 @@ -1169,3 +1170,5 @@ ElementSetName exp1,1=12 Item 1=9520 item Item +Host-Item-Number 1=8911 +hi Host-Item-Number --- a/etc/zebradb/marc_defs/marc21/biblios/record.abs +++ a/etc/zebradb/marc_defs/marc21/biblios/record.abs @@ -44,7 +44,7 @@ melm 001 Control-number melm 005 Date/time-last-modified melm 007 Microform-generation:n:range(data,11,1),Material-type,ff7-00:w:range(data,0,1),ff7-01:w:range(data,1,1),ff7-02:w:range(data,2,1),ff7-01-02:w:range(data,0,2) -melm 008 date-entered-on-file:n:range(data,0,5),date-entered-on-file:s:range(data,0,5),pubdate:w:range(data,7,4),pubdate:n:range(data,7,4),pubdate:y:range(data,7,4),pubdate:s:range(data,7,4),pl:w:range(data,15,3),ta:w:range(data,22,1),ff8-23:w:range(data,23,1),ff8-29:w:range(data,29,1),lf:w:range(data,33,1),bio:w:range(data,34,1),ln:w:range(data,35,3),ctype:w:range(data,24,4),Record-source:w:range(data,39,0) +melm 008 date-entered-on-file:n:range(data,0,5),date-entered-on-file:s:range(data,0,5),pubdate:w:range(data,7,4),pubdate:n:range(data,7,4),pubdate:y:range(data,7,4),pubdate:s:range(data,7,4),pl:w:range(data,15,3),ta:w:range(data,22,1),ff8-23:w:range(data,23,1),ff8-29:w:range(data,29,1),lf:w:range(data,33,1),bio:w:range(data,34,1),ln:n:range(data,35,3),ctype:w:range(data,24,4),Record-source:w:range(data,39,0) melm 010 LC-card-number,Identifier-standard melm 011 LC-card-number,Identifier-standard @@ -227,6 +227,7 @@ melm 751 Name-geographic melm 770$w Record-control-number melm 772$w Record-control-number melm 773$a Host-item +melm 773$9 Host-Item-Number melm 773$t Host-item melm 773$w Record-control-number melm 774$w Record-control-number --- a/etc/zebradb/marc_defs/unimarc/biblios/record.abs +++ a/etc/zebradb/marc_defs/unimarc/biblios/record.abs @@ -235,6 +235,9 @@ melm 441$d pubdate:n melm 445$d pubdate:n melm 461$d pubdate:n +#Linking ids +melm 461$9 Host-Item-Number + # Authorities Title melm 500$9 Koha-Auth-Number,Koha-Auth-Number:n melm 501$9 Koha-Auth-Number,Koha-Auth-Number:n --- a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql +++ a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql @@ -2358,10 +2358,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL), --- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql +++ a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql @@ -2376,10 +2376,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'BKS', '', '', NULL), @@ -6302,10 +6304,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'CF', '', '', NULL), @@ -10227,10 +10231,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SF', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SR', '', '', NULL), @@ -14152,10 +14158,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'VR', '', '', NULL), @@ -18075,10 +18083,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'AR', '', '', NULL), @@ -21998,10 +22008,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'KT', '', '', NULL), @@ -25922,10 +25934,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'IR', '', '', NULL), @@ -29842,10 +29856,12 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('772', 'x', 'International Standard Serial Number', 'International Standard Serial Number', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('772', 'y', 'CODEN designation', 'CODEN designation', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('772', 'z', 'International Standard Book Number', 'International Standard Book Number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), + ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('773', '3', 'Materials specified', 'Materials specified', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('773', '6', 'Linkage', 'Linkage', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('773', '7', 'Control subfield', 'Control subfield', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('773', '8', 'Field link and sequence number', 'Field link and sequence number', 1, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), + ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('773', 'a', 'Main entry heading', 'Main entry heading', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('773', 'b', 'Edition', 'Edition', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), ('773', 'd', 'Place, publisher, and date of publication', 'Place, publisher, and date of publication', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, 'SER', '', '', NULL), --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -318,3 +318,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn | a|a d', NULL, NULL, 'Textarea'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -4445,6 +4445,29 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (add OPACResultsSidebar syspref (enh 6165))\n"; SetVersion($DBversion); } + +$DBversion = '3.05.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');"); + print "Upgrade to $DBversion done (Add EasyAnalyticalRecords syspref)\n"; + SetVersion ($DBversion); +} + +$DBversion = '3.05.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + if (C4::Context->preference("marcflavour") eq 'MARC21' || + C4::Context->preference("marcflavour") eq 'NORMARC'){ + $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); + $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); + print "Upgrade to $DBversion done (Add 773 subfield 9 and 0 to default framework)\n"; + SetVersion ($DBversion); + } elsif (C4::Context->preference("marcflavour") eq 'UNIMARC'){ + $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('461', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); + print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n"; + SetVersion ($DBversion); + } + +} =head1 FUNCTIONS --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc @@ -23,6 +23,7 @@ [% IF ( CAN_user_reserveforothers ) %] [% IF ( holdsview ) %]