virtualshelves => C4::Context->preference("virtualshelves"),
StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"),
NoZebra => C4::Context->preference('NoZebra'),
+ EasyAnalyticalRecords => C4::Context->preference('EasyAnalyticalRecords'),
);
}
else {
&GetMarcBiblio
&GetMarcAuthors
&GetMarcSeries
+ &GetMarcHosts
GetMarcUrls
&GetUsedMarcStructure
&GetXmlBiblio
&GetMarcFromKohaField
&GetFrameworkCode
&TransformKohaToMarc
+ &PrepHostMarcField
&CountItemsIssued
);
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 )
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 );
GetItemsByBiblioitemnumber
GetItemsInfo
GetItemsLocationInfo
+ GetHostItemsInfo
get_itemnumbers_of
+ get_hostitemnumbers_of
GetItemnumberFromBarcode
GetBarcodeFromItemnumber
GetHiddenItemnumbers
MoveItemFromBiblio
GetLatestAcquisitions
CartToShelf
+
+ GetAnalyticsCount
);
}
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
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);
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;
}
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;
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});
}
# 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;
# 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,
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
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
$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);
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});
$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;
}
MARCSERIES => $marcseriesarray,
MARCURLS => $marcurlsarray,
MARCISBNS => $marcisbnsarray,
+ MARCHOSTS => $marchostsarray,
subtitle => $subtitle,
itemdata_ccode => $itemfields{ccode},
itemdata_enumchron => $itemfields{enumchron},
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,
);
$template->param(
itemloop => \@itemloop,
biblionumber => $biblionumber,
- detailview => 1,
+ ($analyze? 'analyze':'detailview') =>1,
subscriptions => \@subs,
subscriptionsnumber => $subscriptionsnumber,
subscriptiontitle => $dat->{title},
($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;
$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'};
$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} =
# 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,
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';
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;
biblioitemnumtagfield => $biblioitemnumtagfield,
biblioitemnumtagsubfield => $biblioitemnumtagsubfield,
biblioitemnumber => $biblioitemnumber,
+ hostbiblionumber => $hostbiblionumber,
+ hostitemnumber => $hostitemnumber
);
}
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);
$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,'');
}
#
# 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
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 );
}
}
$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);
$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)) {
--- /dev/null
+#!/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;
## 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
att 9520 Item
# Curriculum
att 9658 curriculum
-
#Accelerated Reader Point
arp 1=9013 r=r
+
# Curriculum
curriculum 1=9658
Item 1=9520
item Item
+Host-Item-Number 1=8911
+hi Host-Item-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
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
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
('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),
('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),
('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),
('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),
('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),
('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),
('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),
('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),
('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),
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 ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL);
+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 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);
+ }
+
+}
$DBversion = "3.05.00.012";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
[% IF ( CAN_user_reserveforothers ) %]
[% IF ( holdsview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% IF ( object ) %][% object %][% ELSE %][% biblionumber %][% END %]">Holds</a></li>
[% END %]
+ [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% IF ( object ) %][% object %]&analyze=1[% ELSE %][% biblionumber %]&analyze=1[% END %]">Analytics</a></li>[% END %]
[% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/serials/serials-home.pl?searched=1&biblionumber=[% biblionumber %]">Subscription(s)</a></li>[% END %]
</ul>
[% IF ( CAN_user_editcatalogue_edit_items ) %]{text: _("New Item"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]#additema" },[% END %]
[% IF ( CAN_user_serials_create_subscription ) %]
{text: _("New Subscription"), url: "/cgi-bin/koha/serials/subscription-add.pl?biblionumber_for_new_subscription=[% biblionumber %]"},[% END %]
+ [% IF ( EasyAnalyticalRecords ) %][% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{text: _("Analyze items"), url: "/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]&analyze=1" },[% END %][% END %]
];
if(newmenu.length){
new YAHOO.widget.Button({
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&frameworkcode=&op=" },[% END %]
[% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]" },[% END %]
[% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Attach Item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber %]" },[% END %]
+ [% IF ( EasyAnalyticalRecords ) %][% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Link to Host Item"), url: "/cgi-bin/koha/cataloguing/linkitem.pl?biblionumber=[% biblionumber %]" },[% END %][% END %]
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&frameworkcode=&op=duplicate" },[% END %]
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Replace Record via Z39.50"), onclick: {fn: PopupZ3950 } },[% END %]
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Delete Record"), onclick: {fn: confirm_deletion }[% IF ( count ) %],id:'disabled'[% END %] },[% END %]
yes: "Don't display"
no: Display
- descriptions of fields and subfields in the MARC editor.
+ -
+ - pref: EasyAnalyticalRecords
+ choices:
+ yes: Display
+ no: "Don't Display"
+ - easy ways to create analytical record relationships
Spine Labels:
-
- When using the quick spine label printer,
[% IF ( itemdata_copynumber ) %]<th>Copy No.</th>[% END %]
[% IF ( itemdata_itemnotes ) %]<th>Public notes</th>[% END %]
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th>Spine Label</th>[% END %]
+ [% IF ( hostrecords ) %]<th>Host Records</th>[% END %]
+ [% IF ( analyze ) %]<th>Used in</th>[% END %]
+ [% IF ( analyze ) %]<th></th>[% END %]
</tr>
[% FOREACH itemloo IN itemloop %]
<tr>
[% IF ( itemloo.enumchron ) %]
[% itemloo.enumchron %][% IF ( itemloo.serialseq ) %] -- [% END %]
[% END %]
- [% END %]
[% itemloo.serialseq %][% IF ( itemloo.publisheddate ) %] ([% itemloo.publisheddate %])[% END %]
+ [% END %]
</td>[% END %]
[% IF ( itemdata_uri ) %]
<td class="uri"><a href="[% itemloo.uri %]">[% itemloo.uri %]</a></td>
[% IF ( SpineLabelShowPrintOnBibDetails ) %]
<td><a href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=[% itemloo.barcode %]" >Print Label</a></td>
[% END %]
+ [% IF ( hostrecords ) %]
+ <td>[% IF ( itemloo.hostbiblionumber) %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itemloo.hostbiblionumber %]" >[% itemloo.hosttitle %]</a>[% END %]</td>
+ [% END %]
+ [% IF ( analyze ) %]<td>
+ [% IF ( itemloo.countanalytics ) %]
+ <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=[% itemloo.itemnumber %]">[% itemloo.countanalytics %] analytics</a>
+ [% END %]</td>
+ [% END %]
+ [% IF ( analyze ) %]
+ <td><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=[% itemloo.biblionumber %]&hostitemnumber=[% itemloo.itemnumber %]">Create Analytics</a></td>
+ [% END %]
</tr>
[% END %]
[% IF ( book_on_loan ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div>[% END %]
[% IF ( book_reserved ) %]<div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div>[% END %]
[% IF ( not_same_branch ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: The items do not belong to your branch.</div>[% END %]
+[% IF ( linked_analytics ) %]<div class="dialog alert"><strong>Cannot Delete</strong>: item has linked <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]&analyze=1">analytics.</a>.</div>[% END %]
<div id="cataloguing_additem_itemlist">
[% IF ( item_loop ) %]
</tr>
[% FOREACH item_loo IN item_loop %]
<tr id="row[% item_loo.itemnumber %]">
- [% IF ( item_loo.nomod ) %] <td colspan="2"> </td>[% ELSE %]<td><a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a></td>
- <td><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]" onclick="confirm_deletion([% biblionumber %],[% item_loo.itemnumber %]); return false;">Delete</a></td>[% END %]
+ [% IF ( item_loo.nomod ) %] <td colspan="2"> </td>[% ELSE %][% IF ( item_loo.hostitemflag ) %]<td><a href="additem.pl?op=edititem&biblionumber=[% item_loo.hostbiblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit in Host</a></td>
+<td><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&biblionumber=[% biblionumber %]&hostitemnumber=[% item_loo.itemnumber %]">Delink</a></td>
+[% ELSE %]<td><a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a></td>
+ <td>[% IF ( item_loo.countanalytics ) %]<a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=% item_loo.itemnumber %]">view analytics</a>[% ELSE %]<a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]" onclick="confirm_deletion([% biblionumber %],[% item_loo.itemnumber %]); return false;">Delete</a>[% END %]</td>[% END %][% END %]
[% FOREACH item_valu IN item_loo.item_value %]
<td>[% item_valu.field |html %]</td>
[% END %]
--- /dev/null
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Link to host item</title>
+[% INCLUDE 'doc-head-close.inc' %]
+</head>
+<body>
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'cat-search.inc' %]
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/cataloging/addbooks.pl">Cataloging</a> › Link a host item to <i>[% bibliotitle |html %]</i></div>
+<div id="doc3" class="yui-t2">
+
+[% IF ( error ) %]
+ <div class="dialog alert">
+ [% IF ( errornomodbiblio ) %]ERROR: Unable to modify the bibliographic record.[% END %]
+ [% IF ( errornohostbiblionumber ) %]ERROR: Unable to get the biblio number of host item.[% END %]
+ [% IF ( errornohostitemnumber ) %]ERROR: Unable to get the item number from this barcode.[% END %]
+ </div>
+ <form action="/cgi-bin/koha/catalogue/MARCdetail.pl" method="post">
+ <input type="submit" value="OK" />
+ <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
+ </form>
+[% ELSE %]
+ [% IF ( success ) %]
+ <div class="dialog">The item has successfully been linked to <i>[% bibliotitle |html %]</i>.</div>
+ <form action="/cgi-bin/koha/catalogue/MARCdetail.pl" method="post">
+ <input type="submit" value="OK" />
+ <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
+ </form>
+ [% ELSE %]
+ [% IF ( missingparameter ) %]
+ <form method="post" action="/cgi-bin/koha/cataloguing/linkitem.pl">
+ [% IF ( missingbiblionumber ) %]
+ <fieldset id="biblionumber_fieldset">
+ <label for="biblionumber_fieldset">Select the biblionumber to link the item to</label>
+ <div class="hint">Enter biblionumber:</div>
+ <input type="text" name="biblionumber" id="biblionumber" class="focus" size="14" />
+ </fieldset>
+ [% ELSE %]
+ <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber %]" />
+ [% END %]
+
+ [% IF ( missingbarcode ) %]
+ <fieldset id="barcode_fieldset">
+ <label for="barcode_fieldset">Select the host item to link[% IF ( bibliotitle ) %] to <i>[% bibliotitle |html %]</i>[% END %]</label>
+ <div class="hint">Enter item barcode:</div>
+ <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" />
+ </fieldset>
+ [% ELSE %]
+ <input type="hidden" name="barcode" id="barcode" value="[% barcode %]" />
+ [% END %]
+
+ <input type="submit" value="Select" />
+
+ </form>
+ [% END %]
+ [% END %]
+[% END %]
+[% INCLUDE 'intranet-bottom.inc' %]
</a>
<xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
</xsl:when>
+ <xsl:when test="marc:subfield[@code='0']">
+ <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
+ <xsl:value-of select="$f773"/>
+ </a>
+ </xsl:when>
<xsl:otherwise>
<a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
<xsl:value-of select="$f773"/>
</a>
<xsl:if test="marc:subfield[@code='g']"><xsl:text> </xsl:text><xsl:value-of select="marc:subfield[@code='g']"/></xsl:if>
</xsl:when>
+ <xsl:when test="marc:subfield[@code='0']">
+ <a><xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:subfield[@code='0']"/></xsl:attribute>
+ <xsl:value-of select="$f773"/>
+ </a>
+ </xsl:when>
<xsl:otherwise>
<a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate($f773, '()', '')"/></xsl:attribute>
<xsl:value-of select="$f773"/>
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+#use warnings; FIXME - Bug 2505
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
+
+use C4::Context;
+use C4::Biblio;
+use C4::Items;
+use Getopt::Long;
+
+$| = 1;
+
+# command-line parameters
+my $want_help = 0;
+my $do_update = 0;
+my $wherestrings;
+
+my $result = GetOptions(
+ 'run-update' => \$do_update,
+ 'where=s@' => \$wherestrings,
+ 'h|help' => \$want_help,
+);
+
+if (not $result or $want_help or not $do_update) {
+ print_usage();
+ exit 0;
+}
+
+my $num_bibs_processed = 0;
+my $num_bibs_modified = 0;
+my $num_nobib_foritemnumber = 0;
+my $num_noitem_forbarcode = 0;
+my $num_nobarcode_inhostfield =0;
+my $num_hostfields_unabletomodify =0;
+my $num_bad_bibs = 0;
+my $dbh = C4::Context->dbh;
+$dbh->{AutoCommit} = 0;
+
+process_bibs();
+$dbh->commit();
+
+exit 0;
+
+sub process_bibs {
+ my $sql = "SELECT biblionumber FROM biblio JOIN biblioitems USING (biblionumber)";
+ $sql.="WHERE ". join(" AND ",@$wherestrings) if ($wherestrings);
+ $sql.="ORDER BY biblionumber ASC";
+ my $sth = $dbh->prepare($sql);
+ eval{$sth->execute();};
+ if ($@){ die "error $@";};
+ while (my ($biblionumber) = $sth->fetchrow_array()) {
+ $num_bibs_processed++;
+ process_bib($biblionumber);
+
+ if (($num_bibs_processed % 100) == 0) {
+ print_progress_and_commit($num_bibs_processed);
+ }
+ }
+
+ $dbh->commit;
+
+ print <<_SUMMARY_;
+
+Create Analytical records relationships report
+-----------------------------------------------
+Number of bibs checked: $num_bibs_processed
+Number of bibs modified: $num_bibs_modified
+Number of hostfields with no barcodes: $num_nobarcode_inhostfield
+Number of barcodes not found: $num_noitem_forbarcode
+Number of hostfields unable to modify: $num_hostfields_unabletomodify
+Number of bibs with errors: $num_bad_bibs
+_SUMMARY_
+}
+
+sub process_bib {
+ my $biblionumber = shift;
+
+ my $bib = GetMarcBiblio($biblionumber);
+ unless (defined $bib) {
+ print "\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n";
+ $num_bad_bibs++;
+ return;
+ }
+ #loop through each host field and populate subfield 0 and 9
+ my $analyticfield = '773';
+ foreach my $hostfield ( $bib->field($analyticfield) ) {
+ if(my $barcode = $hostfield->subfield('o')){
+ my $itemnumber = GetItemnumberFromBarcode($barcode);
+ if ($itemnumber ne undef){
+ my $bibnumber = GetBiblionumberFromItemnumber($itemnumber);
+ if ($bibnumber ne undef){
+ my $modif;
+ if ($hostfield->subfield('0') ne $bibnumber){
+ $hostfield->update('0', $bibnumber);
+ $modif = 1;
+ }
+ if ($hostfield->subfield('9') ne $itemnumber){
+ $hostfield->update('9', $itemnumber);
+ $modif=1;
+ }
+ if ($modif){
+ $num_bibs_modified++;
+ my $modresult = ModBiblio($bib, $biblionumber, '');
+ warn "Modifying biblio $biblionumber";
+ if (!$modresult){
+ warn "Unable to modify biblio $biblionumber with update host field";
+ $num_hostfields_unabletomodify++;
+ }
+ }
+ } else {
+ warn "No biblio record found corressponding to itemnumber $itemnumber";
+ $num_nobib_foritemnumber++;
+ }
+ } else {
+ warn "No item record found for barcode $barcode";
+ $num_noitem_forbarcode++;
+ }
+ } else{
+ warn "No barcode in host field for biblionumber $biblionumber";
+ $num_nobarcode_inhostfield++;
+ }
+ }
+}
+
+sub print_progress_and_commit {
+ my $recs = shift;
+ $dbh->commit();
+ print "... processed $recs records\n";
+}
+
+sub print_usage {
+ print <<_USAGE_;
+$0: establish relationship to host items
+
+Based on barcode in host field populates subfield 0 with host biblionumber and subfield 9 with host itemnumber.
+
+Subfield 0 and 9 are used in Koha screns to display relationships between analytical records and host bibs and items.
+
+NOT usable with UNIMARC data. You can use it only if you have tag 461 with also an items id (like barcode or item numbers). In UNIMARC this situation is very rare. If you have data coded in this way, send a mail to koha-dev mailing list and ask for the feature.
+
+Parameters:
+ --run-update run the synchronization
+ --where condition selects the biblios on a criterium (Repeatable)
+ --help or -h show this message.
+_USAGE_
+}
$template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
# change back when ive fixed request.pl
my @all_items = GetItemsInfo( $biblionumber );
+
+# adding items linked via host biblios
+my $marcflavour = C4::Context->preference("marcflavour");
+
+my $analyticfield = '773';
+if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
+ $analyticfield = '773';
+} elsif ($marcflavour eq 'UNIMARC') {
+ $analyticfield = '461';
+}
+foreach my $hostfield ( $record->field($analyticfield)) {
+ my $hostbiblionumber = $hostfield->subfield("0");
+ my $linkeditemnumber = $hostfield->subfield("9");
+ my @hostitemInfos = GetItemsInfo($hostbiblionumber);
+ foreach my $hostitemInfo (@hostitemInfos){
+ if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
+ push(@all_items, $hostitemInfo);
+ }
+ }
+}
+
my @items;
# Getting items to be hidden
## get notes and subjects from MARC record
my $dbh = C4::Context->dbh;
-my $marcflavour = C4::Context->preference("marcflavour");
my $marcnotesarray = GetMarcNotes ($record,$marcflavour);
my $marcisbnsarray = GetMarcISBN ($record,$marcflavour);
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, GetFrameworkCode($biblionumber));
$template->param(
MARCAUTHORS => $marcauthorsarray,
MARCSERIES => $marcseriesarray,
MARCURLS => $marcurlsarray,
+ MARCHOSTS => $marchostsarray,
norequests => $norequests,
RequestOnOpac => C4::Context->preference("RequestOnOpac"),
itemdata_ccode => $itemfields{ccode},
$biblioDataHash{$biblioNumber} = $biblioData;
my @itemInfos = GetItemsInfo($biblioNumber);
+
+ my $marcrecord= GetMarcBiblio($biblioNumber);
+
+ # flag indicating existence of at least one item linked via a host record
+ my $hostitemsflag;
+ # adding items linked via host biblios
+ my @hostitemInfos = GetHostItemsInfo($marcrecord);
+ if (@hostitemInfos){
+ $hostitemsflag =1;
+ push (@itemInfos,@hostitemInfos);
+ }
+
+
+
$biblioData->{itemInfos} = \@itemInfos;
foreach my $itemInfo (@itemInfos) {
$itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo;
$branch = $borr->{'branchcode'};
}
+ #item may belong to a host biblio, if yes change biblioNum to hosts bilbionumber
+ if ($itemNum ne '') {
+ my $hostbiblioNum = GetBiblionumberFromItemnumber($itemNum);
+ if ($hostbiblioNum ne $biblioNum) {
+ $biblioNum = $hostbiblioNum;
+ }
+ }
+
my $biblioData = $biblioDataHash{$biblioNum};
my $found;
my ($reservedate,$reservedfor,$expectedAt) = GetReservesFromItemnumber($itemNum);
my $ItemBorrowerReserveInfo = GetMemberDetails( $reservedfor, 0);
+ # the item could be reserved for this borrower vi a host record, flag this
+ if ($reservedfor eq $borrowernumber){
+ $itemLoopIter->{already_reserved} = 1;
+ }
+
if ( defined $reservedate ) {
$itemLoopIter->{backgroundcolor} = 'reserved';
$itemLoopIter->{reservedate} = format_date($reservedate);
$itemLoopIter->{nocancel} = 1;
}
+ # if the items belongs to a host record, show link to host record
+ if ($itemInfo->{biblionumber} ne $biblioNum){
+ $biblioLoopIter{hostitemsflag} = 1;
+ $itemLoopIter->{hostbiblionumber} = $itemInfo->{biblionumber};
+ $itemLoopIter->{hosttitle} = GetBiblioData($itemInfo->{biblionumber})->{title};
+ }
+
# If there is no loan, return and transfer, we show a checkbox.
$itemLoopIter->{notforloan} = $itemLoopIter->{notforloan} || 0;
$policy_holdallowed = 0;
}
- if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum)) {
+ if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
$itemLoopIter->{available} = 1;
$numCopiesAvailable++;
}
}
my $const;
+ if ($checkitem ne ''){
+ my $item = GetItem($checkitem);
+ if ($item->{'biblionumber'} ne $biblionumber) {
+ $biblionumber = $item->{'biblionumber'};
+ }
+ }
+
+
+
if ($multi_hold) {
my $bibinfo = $bibinfos{$biblionumber};
AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',[$biblionumber],
if (my $items = get_itemnumbers_of($biblionumber)->{$biblionumber}){
@itemnumbers = @$items;
}
- else {
+ my @hostitems = get_hostitemnumbers_of($biblionumber);
+ if (@hostitems){
+ $template->param('hostitemsflag' => 1);
+ push(@itemnumbers, @hostitems);
+ }
+
+ if (!@itemnumbers) {
$template->param('noitems' => 1);
$biblioloopiter{noitems} = 1;
}
$biblioitem->{description} =
$itemtypes->{ $biblioitem->{itemtype} }{description};
+ if($biblioitem->{biblioitemnumber} ne $biblionumber){
+ $biblioitem->{hostitemsflag}=1;
+ }
$biblioloopiter{description} = $biblioitem->{description};
$biblioloopiter{itypename} = $biblioitem->{description};
$biblioloopiter{imageurl} =
$branches->{ $item->{holdingbranch} }{branchname};
}
+ if($item->{biblionumber} ne $biblionumber){
+ $item->{hostitemsflag}=1;
+ $item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title};
+ }
+
# add information
$item->{itemcallnumber} = $item->{itemcallnumber};