From b2656662134dd206c924f928e00e10034e2ec42c Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Mon, 5 Nov 2018 14:22:27 +0200 Subject: [PATCH] Bug 11529: Use new biblio fields whenever possible --- C4/HoldsQueue.pm | 14 +- C4/Overdues.pm | 4 + C4/ShelfBrowser.pm | 6 +- Koha/Biblio.pm | 11 +- Koha/Schema/Result/Holding.pm | 242 +++++++++++++++++++++++++++++++++ Koha/Schema/Result/HoldingsMetadata.pm | 138 +++++++++++++++++++ circ/branchoverdues.pl | 8 +- circ/reserveratios.pl | 10 +- circ/transferstoreceive.pl | 8 +- circ/waitingreserves.pl | 8 +- opac/opac-reserve.pl | 7 +- opac/opac-shelves.pl | 3 +- opac/opac-showreviews.pl | 5 +- opac/opac-tags.pl | 5 +- opac/opac-user.pl | 6 +- svc/checkouts | 14 +- svc/holds | 16 +-- tags/list.pl | 6 +- 18 files changed, 455 insertions(+), 56 deletions(-) create mode 100644 Koha/Schema/Result/Holding.pm create mode 100644 Koha/Schema/Result/HoldingsMetadata.pm diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index ce525ba..250da51 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -131,7 +131,12 @@ sub GetHoldsQueueItems { my $dbh = C4::Context->dbh; my @bind_params = (); - my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber + my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location, + items.enumchron, items.cn_sort, biblioitems.publishercode, + biblio.copyrightdate, biblio.subtitle, biblio.part_number as numbers, + biblio.part_name as parts, + biblioitems.publicationyear, biblioitems.pages, biblioitems.size, biblioitems.publicationyear, + biblioitems.isbn, items.copynumber FROM tmp_holdsqueue JOIN biblio USING (biblionumber) LEFT JOIN biblioitems USING (biblionumber) @@ -146,13 +151,6 @@ sub GetHoldsQueueItems { $sth->execute(@bind_params); my $items = []; while ( my $row = $sth->fetchrow_hashref ){ - my $record = GetMarcBiblio({ biblionumber => $row->{biblionumber} }); - if ($record){ - $row->{subtitle} = [ map { $_->{subfield} } @{ GetRecordValue( 'subtitle', $record, '' ) } ]; - $row->{parts} = GetRecordValue('parts',$record,'')->[0]->{subfield}; - $row->{numbers} = GetRecordValue('numbers',$record,'')->[0]->{subfield}; - } - # return the bib-level or item-level itype per syspref if (!C4::Context->preference('item-level_itypes')) { $row->{itype} = $row->{itemtype}; diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 1e67b7f..231944b 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -750,6 +750,10 @@ sub GetOverduesForBranch { borrowers.phone, borrowers.email, biblio.title, + biblio.subtitle, + biblio.medium, + biblio.part_number, + biblio.part_name, biblio.author, biblio.biblionumber, issues.date_due, diff --git a/C4/ShelfBrowser.pm b/C4/ShelfBrowser.pm index ee551d2..b818666 100644 --- a/C4/ShelfBrowser.pm +++ b/C4/ShelfBrowser.pm @@ -222,13 +222,17 @@ sub GetShelfInfo { for my $item ( @items ) { my $this_biblio = GetBibData($item->{biblionumber}); next unless defined $this_biblio; + my @subtitles = split(/ \| /, $this_biblio->{'subtitle'}); $item->{'title'} = $this_biblio->{'title'}; + $item->{'subtitle'} = \@subtitles, + $item->{'medium'} = $this_biblio->{'medium'}; + $item->{'part_number'} = $this_biblio->{'part_number'}; + $item->{'part_name'} = $this_biblio->{'part_name'}; my $this_record = GetMarcBiblio({ biblionumber => $this_biblio->{'biblionumber'} }); $item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour); $item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour); $item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour); $item->{'browser_normalized_ean'} = GetNormalizedEAN($this_record,$marcflavour); - $item->{'subtitle'} = GetRecordValue('subtitle', $this_record, GetFrameworkCode( $item->{biblionumber} )); push @valid_items, $item; } return @valid_items; diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 1dca4d9..a1bdec0 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -65,20 +65,15 @@ sub store { my @subtitles = $biblio->subtitles(); -Returns list of subtitles for a record. - -Keyword to MARC mapping for subtitle must be set for this method to return any possible values. +Returns list of subtitles for a record according to the framework. =cut sub subtitles { my ( $self ) = @_; - return map { $_->{subfield} } @{ - C4::Biblio::GetRecordValue( - 'subtitle', - C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }), - $self->frameworkcode ) }; + my @subtitles = split(/ \| /, $self->subtitle); + return \@subtitles; } =head3 can_article_request diff --git a/Koha/Schema/Result/Holding.pm b/Koha/Schema/Result/Holding.pm new file mode 100644 index 0000000..3f46441 --- /dev/null +++ b/Koha/Schema/Result/Holding.pm @@ -0,0 +1,242 @@ +use utf8; +package Koha::Schema::Result::Holding; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Holding + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("holdings"); + +=head1 ACCESSORS + +=head2 holding_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 biblionumber + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +=head2 biblioitemnumber + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +=head2 frameworkcode + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 4 + +=head2 holdingbranch + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 10 + +=head2 location + + data_type: 'varchar' + is_nullable: 1 + size: 80 + +=head2 callnumber + + data_type: 'varchar' + is_nullable: 1 + size: 255 + +=head2 suppress + + data_type: 'tinyint' + is_nullable: 1 + +=head2 timestamp + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: 'current_timestamp()' + is_nullable: 0 + +=head2 datecreated + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 0 + +=head2 deleted_on + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=cut + +__PACKAGE__->add_columns( + "holding_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "biblionumber", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "biblioitemnumber", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "frameworkcode", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 4 }, + "holdingbranch", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + "location", + { data_type => "varchar", is_nullable => 1, size => 80 }, + "callnumber", + { data_type => "varchar", is_nullable => 1, size => 255 }, + "suppress", + { data_type => "tinyint", is_nullable => 1 }, + "timestamp", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => "current_timestamp()", + is_nullable => 0, + }, + "datecreated", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, + "deleted_on", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("holding_id"); + +=head1 RELATIONS + +=head2 biblioitemnumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblioitemnumber", + "Koha::Schema::Result::Biblioitem", + { biblioitemnumber => "biblioitemnumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 biblionumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblionumber", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblionumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 holdingbranch + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "holdingbranch", + "Koha::Schema::Result::Branch", + { branchcode => "holdingbranch" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "RESTRICT", + on_update => "CASCADE", + }, +); + +=head2 holdings_metadatas + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "holdings_metadatas", + "Koha::Schema::Result::HoldingsMetadata", + { "foreign.holding_id" => "self.holding_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 items + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "items", + "Koha::Schema::Result::Item", + { "foreign.holding_id" => "self.holding_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2018-10-26 12:34:01 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iCl1nPLIbzMbSIHTDYHVcA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/HoldingsMetadata.pm b/Koha/Schema/Result/HoldingsMetadata.pm new file mode 100644 index 0000000..c999333 --- /dev/null +++ b/Koha/Schema/Result/HoldingsMetadata.pm @@ -0,0 +1,138 @@ +use utf8; +package Koha::Schema::Result::HoldingsMetadata; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::HoldingsMetadata + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("holdings_metadata"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 holding_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 format + + data_type: 'varchar' + is_nullable: 0 + size: 16 + +=head2 marcflavour + + data_type: 'varchar' + is_nullable: 0 + size: 16 + +=head2 metadata + + data_type: 'longtext' + is_nullable: 0 + +=head2 deleted_on + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "holding_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "format", + { data_type => "varchar", is_nullable => 0, size => 16 }, + "marcflavour", + { data_type => "varchar", is_nullable => 0, size => 16 }, + "metadata", + { data_type => "longtext", is_nullable => 0 }, + "deleted_on", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint( + "holdings_metadata_uniq_key", + ["holding_id", "format", "marcflavour"], +); + +=head1 RELATIONS + +=head2 holding + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "holding", + "Koha::Schema::Result::Holding", + { holding_id => "holding_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2018-10-26 12:34:01 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oUc/EZTrVGoRcM1885DOkw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index d4c20cb..06a36f9 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -74,13 +74,13 @@ if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { # now display infos foreach my $num (@getoverdues) { my %overdueforbranch; - my $record = GetMarcBiblio({ biblionumber => $num->{biblionumber} }); - if ($record){ - $overdueforbranch{'subtitle'} = GetRecordValue('subtitle',$record,'')->[0]->{subfield}; - } my $dt = dt_from_string($num->{date_due}, 'sql'); $overdueforbranch{'date_due'} = output_pref($dt); $overdueforbranch{'title'} = $num->{'title'}; + $overdueforbranch{'subtitle'} = $num->{'subtitle'}; + $overdueforbranch{'medium'} = $num->{'medium'}; + $overdueforbranch{'part_number'} = $num->{'part_number'}; + $overdueforbranch{'part_name'} = $num->{'part_name'}; $overdueforbranch{'description'} = $num->{'description'}; $overdueforbranch{'barcode'} = $num->{'barcode'}; $overdueforbranch{'biblionumber'} = $num->{'biblionumber'}; diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index 104928a..6aca984 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -27,7 +27,6 @@ use C4::Context; use C4::Output; use C4::Auth; use C4::Debug; -use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/; use C4::Acquisition qw/GetOrdersByBiblionumber/; use Koha::DateUtils; use Koha::Acquisition::Baskets; @@ -125,6 +124,10 @@ my $strsth = reserves.found, biblio.title, + biblio.subtitle, + biblio.medium, + biblio.part_number, + biblio.part_name, biblio.author, count(DISTINCT reserves.borrowernumber) as reservecount, count(DISTINCT items.itemnumber) $include_aqorders_qty as itemcount @@ -154,8 +157,7 @@ while ( my $data = $sth->fetchrow_hashref ) { my $thisratio = $data->{reservecount} / $data->{itemcount}; my $ratiocalc = ($thisratio / $ratio); ($thisratio / $ratio) >= 1 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause - my $record = GetMarcBiblio({ biblionumber => $data->{biblionumber} }); - $data->{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($data->{biblionumber})); + my @subtitles = split(/ \| /, $data->{'subtitle'}); push( @reservedata, { @@ -163,7 +165,7 @@ while ( my $data = $sth->fetchrow_hashref ) { priority => $data->{priority}, name => $data->{borrower}, title => $data->{title}, - subtitle => $data->{subtitle}, + subtitle => \@subtitles, author => $data->{author}, itemnum => $data->{itemnumber}, biblionumber => $data->{biblionumber}, diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index a727dda..9c82632 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -96,9 +96,14 @@ while ( my $library = $libraries->next ) { $getransf{'datetransfer'} = $num->{'datesent'}; $getransf{'itemtype'} = $itemtype->description; # FIXME Should not it be translated_description? + my @subtitles = split(/ \| /, $biblio->{'subtitle'}); %getransf = ( %getransf, title => $biblio->title, + subtitle => \@subtitles, + medium => $biblio->medium, + part_number => $biblio->part_number, + part_name => $biblio->part_name, author => $biblio->author, biblionumber => $biblio->biblionumber, itemnumber => $item->itemnumber, @@ -108,9 +113,6 @@ while ( my $library = $libraries->next ) { itemcallnumber => $item->itemcallnumber, ); - my $record = GetMarcBiblio({ biblionumber => $biblio->biblionumber }); - $getransf{'subtitle'} = GetRecordValue('subtitle', $record, $biblio->frameworkcode); - # we check if we have a reserv for this transfer my $holds = $item->current_holds; if ( my $first_hold = $holds->next ) { diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index aae9cbe..36b2409 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -101,6 +101,10 @@ while ( my $hold = $holds->next ) { my %getreserv = ( title => $biblio->title, + subtitle => $biblio->subtitles, + medium => $biblio->medium, + part_number => $biblio->part_number, + part_name => $biblio->part_name, itemnumber => $item->itemnumber, waitingdate => $hold->waitingdate, reservedate => $hold->reservedate, @@ -122,10 +126,6 @@ while ( my $hold = $holds->next ) { my $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day ); $getreserv{'itemtype'} = $itemtype->description; # FIXME Should not it be translated_description? - $getreserv{'subtitle'} = GetRecordValue( - 'subtitle', - GetMarcBiblio({ biblionumber => $biblio->biblionumber }), - $biblio->frameworkcode); if ( $homebranch ne $holdingbranch ) { $getreserv{'dotransfer'} = 1; } diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 67ac93a..1613046 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -390,7 +390,6 @@ $template->param('item_level_itypes' => $itemLevelTypes); foreach my $biblioNum (@biblionumbers) { my @not_available_at = (); - my $record = GetMarcBiblio({ biblionumber => $biblioNum }); # Init the bib item with the choices for branch pickup my %biblioLoopIter; @@ -402,9 +401,13 @@ foreach my $biblioNum (@biblionumbers) { } my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} ); + my @subtitles = split(/ \| /, $biblioData->{'subtitle'}); $biblioLoopIter{biblionumber} = $biblioData->{biblionumber}; $biblioLoopIter{title} = $biblioData->{title}; - $biblioLoopIter{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode); + $biblioLoopIter{subtitle} = \@subtitles; + $biblioLoopIter{medium} = $biblioData->{medium}; + $biblioLoopIter{part_number} = $biblioData->{part_number}; + $biblioLoopIter{part_name} = $biblioData->{part_name}; $biblioLoopIter{author} = $biblioData->{author}; $biblioLoopIter{rank} = $biblioData->{rank}; $biblioLoopIter{reservecount} = $biblioData->{reservecount}; diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 8da67e9..a3dea5a 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -295,7 +295,8 @@ if ( $op eq 'view' ) { $this_item->{notforloan} = $itemtype->notforloan; } $this_item->{'coins'} = GetCOinSBiblio($record); - $this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) ); + my @subtitles = split(/ \| /, $this_item->{'subtitle'}); + $this_item->{'subtitle'} = \@subtitles, $this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour ); $this_item->{'normalized_ean'} = GetNormalizedEAN( $record, $marcflavour ); $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour ); diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index fc6dc6c..150fbc8 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -97,7 +97,10 @@ for my $result (@$reviews){ $result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour); $result->{normalized_isbn} = GetNormalizedISBN(undef,$record,$marcflavour); $result->{title} = $biblio->title; - $result->{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode); + $result->{subtitle} = $biblio->subtitles; + $result->{medium} = $biblio->medium; + $result->{part_number} = $biblio->part_number; + $result->{part_name} = $biblio->part_name; $result->{author} = $biblio->author; $result->{place} = $biblioitem->place; $result->{publishercode} = $biblioitem->publishercode; diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index 267c3c0..beffe14 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -233,8 +233,11 @@ if ($loggedinuser) { foreach my $tag (@$my_tags) { my $biblio = Koha::Biblios->find( $tag->{biblionumber} ); my $record = &GetMarcBiblio({ biblionumber => $tag->{biblionumber} }); - $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) ); $tag->{title} = $biblio->title; + $tag->{subtitle} = $biblio->subtitles; + $tag->{medium} = $biblio->medium; + $tag->{part_number} = $biblio->part_number; + $tag->{part_name} = $biblio->part_name; $tag->{author} = $biblio->author; my $xslfile = C4::Context->preference('OPACXSLTResultsDisplay'); diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 500042d..e948e75 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -215,8 +215,9 @@ if ( $pending_checkouts->count ) { # Useless test ); $issue->{rentalfines} = $rental_fines->count ? $rental_fines->next->get_column('rental_fines') : 0; - my $marcrecord = GetMarcBiblio({ biblionumber => $issue->{'biblionumber'} }); - $issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'})); + my @subtitles = split(/ \| /, $issue->{'subtitle'}); + $issue->{'subtitle'} = \@subtitles< + # check if item is renewable my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} ); ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'}); @@ -266,6 +267,7 @@ if ( $pending_checkouts->count ) { # Useless test my $isbn = GetNormalizedISBN($issue->{'isbn'}); $issue->{normalized_isbn} = $isbn; + my $marcrecord = GetMarcBiblio({ biblionumber => $issue->{'biblionumber'} }); $issue->{normalized_upc} = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') ); # My Summary HTML diff --git a/svc/checkouts b/svc/checkouts index 9a1b3a5..370c68e 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -23,7 +23,6 @@ use CGI; use JSON qw(to_json); use C4::Auth qw(check_cookie_auth haspermission get_session); -use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue ); use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate); use C4::Overdues qw(GetFine); use C4::Context; @@ -74,6 +73,10 @@ my $sql = ' biblionumber, biblio.title, + biblio.subtitle, + biblio.medium, + biblio.part_number, + biblio.part_name, author, itemnumber, @@ -171,9 +174,14 @@ while ( my $c = $sth->fetchrow_hashref() ) { my $av = Koha::AuthorisedValues->search({ category => 'DAMAGED', authorised_value => $c->{damaged} }); $damaged = $av->count ? $av->next->lib : ''; } + my @subtitles = split(/ \| /, $c->{'subtitle'}); my $checkout = { DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber}, title => $c->{title}, + subtitle => \@subtitles, + medium => $c->{medium}, + part_number => $c->{part_number}, + part_name => $c->{part_name}, author => $c->{author}, barcode => $c->{barcode}, itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype}, @@ -216,10 +224,6 @@ while ( my $c = $sth->fetchrow_hashref() ) { as_due_date => 1 } ), - subtitle => GetRecordValue( - 'subtitle', - GetMarcBiblio({ biblionumber => $c->{biblionumber} }), - GetFrameworkCode( $c->{biblionumber} ) ), lost => $lost, damaged => $damaged, borrower => { diff --git a/svc/holds b/svc/holds index 062109d..340dc71 100755 --- a/svc/holds +++ b/svc/holds @@ -23,7 +23,6 @@ use CGI; use JSON qw(to_json); use C4::Auth qw(check_cookie_auth); -use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue ); use C4::Charset; use C4::Circulation qw(GetTransfers); use C4::Context; @@ -84,11 +83,17 @@ while ( my $h = $holds_rs->next() ) { for my $library ( @$libraries ) { $library->{selected} = 1 if $library->{branchcode} eq $h->branchcode(); } + + my $biblio = $h->biblio(); my $hold = { DT_RowId => $h->reserve_id(), biblionumber => $biblionumber, - title => $h->biblio()->title(), - author => $h->biblio()->author(), + title => $biblio->title(), + subtitle => $biblio->subtitles(), + medium => $biblio->medium(), + part_number => $biblio->part_number(), + part_name => $biblio->part_name(), + author => $biblio->author(), reserve_id => $h->reserve_id(), branchcode => $h->branch()->branchname(), branches => $libraries, @@ -102,11 +107,6 @@ while ( my $h = $holds_rs->next() ) { waiting_here => $h->branch()->branchcode() eq $branch, priority => $h->priority(), itemtype_limit => $itemtype_limit, - subtitle => GetRecordValue( - 'subtitle', - GetMarcBiblio({ biblionumber => $biblionumber }), - GetFrameworkCode($biblionumber) - ), reservedate_formatted => $h->reservedate() ? output_pref( { dt => dt_from_string( $h->reservedate() ), dateonly => 1 } ) diff --git a/tags/list.pl b/tags/list.pl index 8623278..a8e0905 100755 --- a/tags/list.pl +++ b/tags/list.pl @@ -61,10 +61,8 @@ else { my $taglist = get_tag_rows( { term => $tag } ); for ( @{$taglist} ) { my $dat = &GetBiblioData( $_->{biblionumber} ); - my $record = &GetMarcBiblio({ biblionumber => $_->{biblionumber} }); - $dat->{'subtitle'} = - GetRecordValue( 'subtitle', $record, - GetFrameworkCode( $_->{biblionumber} ) ); + my @subtitles = split(/ \| /, $dat->{'subtitle'}); + $dat->{'subtitle'} = \@subtitles, my @items = GetItemsInfo( $_->{biblionumber} ); $dat->{biblionumber} = $_->{biblionumber}; $dat->{tag_id} = $_->{tag_id}; -- 2.7.4