summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
790bab2)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
JD Amended patch:
-# FIXME Special case here
- print "Biblio not found\n,";
+ print "Biblio not found\n";
- my $biblio = Koha::Biblio->find($hostbiblionumber);
+ my $biblio = Koha::Biblios->find($hostbiblionumber);
Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
44 files changed:
use MARC::Field;
use C4::Context;
use MARC::Field;
use C4::Context;
-use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblio );
+use C4::Biblio qw( GetFrameworkCode ModBiblio );
use C4::Search qw( FindDuplicate new_record_from_zebra );
use C4::AuthoritiesMarc::MARC21;
use C4::AuthoritiesMarc::UNIMARC;
use C4::Search qw( FindDuplicate new_record_from_zebra );
use C4::AuthoritiesMarc::MARC21;
use C4::AuthoritiesMarc::UNIMARC;
my $counteditedbiblio = 0;
foreach my $biblionumber ( @biblionumbers ) {
my $counteditedbiblio = 0;
foreach my $biblionumber ( @biblionumbers ) {
- my $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber });
- next if !$marcrecord;
+ my $biblio = Koha::Biblios->find($biblionumber);
+ next unless $biblio;
+ my $marcrecord = $biblio->metadata->record;
my $update = 0;
foreach my $tagfield (@$tags_using_authtype) {
my $countfrom = 0; # used in strict mode to remove duplicates
my $update = 0;
foreach my $tagfield (@$tags_using_authtype) {
my $countfrom = 0; # used in strict mode to remove duplicates
}
if ( C4::Context->preference("CataloguingLog") ) {
}
if ( C4::Context->preference("CataloguingLog") ) {
- my $newrecord = GetMarcBiblio({ biblionumber => $biblionumber });
- logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio BEFORE=>" . $newrecord->as_formatted );
+ my $biblio = Koha::Biblios->find($biblionumber);
+ logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio BEFORE=>" . $biblio->metadata->record->as_formatted );
}
if ( !$options->{disable_autolink} && C4::Context->preference('BiblioAddsAuthorities') ) {
}
if ( !$options->{disable_autolink} && C4::Context->preference('BiblioAddsAuthorities') ) {
sub PrepHostMarcField {
my ($hostbiblionumber,$hostitemnumber, $marcflavour) = @_;
$marcflavour ||="MARC21";
sub PrepHostMarcField {
my ($hostbiblionumber,$hostitemnumber, $marcflavour) = @_;
$marcflavour ||="MARC21";
-
- my $hostrecord = GetMarcBiblio({ biblionumber => $hostbiblionumber });
+
+ my $biblio = Koha::Biblios->find($hostbiblionumber);
+ my $hostrecord = $biblio->metadata->record;
my $item = Koha::Items->find($hostitemnumber);
my $hostmarcfield;
my $item = Koha::Items->find($hostitemnumber);
my $hostmarcfield;
sub prepare_host_field {
my ( $hostbiblio, $marcflavour ) = @_;
$marcflavour ||= C4::Context->preference('marcflavour');
sub prepare_host_field {
my ( $hostbiblio, $marcflavour ) = @_;
$marcflavour ||= C4::Context->preference('marcflavour');
- my $host = GetMarcBiblio({ biblionumber => $hostbiblio });
+
+ my $biblio = Koha::Biblios->find($hostbiblio);
+ my $host = $biblio->metadata->record;
# unfortunately as_string does not 'do the right thing'
# if field returns undef
my %sfd;
# unfortunately as_string does not 'do the right thing'
# if field returns undef
my %sfd;
my ($biblionumber, $increase, $value, $skip_holds_queue) = @_;
my $totalissues;
my ($biblionumber, $increase, $value, $skip_holds_queue) = @_;
my $totalissues;
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
- unless ($record) {
- carp "UpdateTotalIssues could not get biblio record";
- return;
- }
- my $biblio = Koha::Biblios->find( $biblionumber );
+ my $biblio = Koha::Biblios->find($biblionumber);
unless ($biblio) {
carp "UpdateTotalIssues could not get datas of biblio";
return;
}
unless ($biblio) {
carp "UpdateTotalIssues could not get datas of biblio";
return;
}
+
+ my $record = $biblio->metadata->record;
+ unless ($record) {
+ carp "UpdateTotalIssues could not get biblio record";
+ return;
+ }
my $biblioitem = $biblio->biblioitem;
my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField( 'biblioitems.totalissues' );
unless ($totalissuestag) {
my $biblioitem = $biblio->biblioitem;
my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField( 'biblioitems.totalissues' );
unless ($totalissuestag) {
carp 'ApplyMarcOverlayRules called on undefined record';
return;
}
carp 'ApplyMarcOverlayRules called on undefined record';
return;
}
- my $old_record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $old_record = $biblio->metadata->record;
# Skip overlay rules if called with no context
if ($old_record && defined $params->{overlay_context}) {
# Skip overlay rules if called with no context
if ($old_record && defined $params->{overlay_context}) {
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Database;
use Koha::Biblioitems;
use Koha::Items;
use Koha::ItemTypes;
use Koha::Biblioitems;
use Koha::Items;
use Koha::ItemTypes;
- my $marcrecord = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $marcrecord = $biblio->metadata->record;
return unless $marcrecord;
my ( @returnhostitemnumbers, $tag, $biblio_s, $item_s );
return unless $marcrecord;
my ( @returnhostitemnumbers, $tag, $biblio_s, $item_s );
use Text::Bidi qw( log2vis );
use C4::Context;
use Text::Bidi qw( log2vis );
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio GetMarcFromKohaField );
+use C4::Biblio qw( GetMarcFromKohaField );
+use Koha::Biblios;
use Koha::ClassSources;
use Koha::ClassSortRules;
use Koha::ClassSplitRules;
use Koha::ClassSources;
use Koha::ClassSortRules;
use Koha::ClassSplitRules;
my $font = $self->{'font'};
my $item = _get_label_item($self->{'item_number'});
my $label_fields = _get_text_fields($self->{'format_string'});
my $font = $self->{'font'};
my $item = _get_label_item($self->{'item_number'});
my $label_fields = _get_text_fields($self->{'format_string'});
- my $record = GetMarcBiblio({ biblionumber => $item->{'biblionumber'} });
+ my $biblio = Koha::Biblios->find($item->{biblionumber});
+ my $record = $biblio->metadata->record;
# FIXME - returns all items, so you can't get data from an embedded holdings field.
# TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum).
my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource'));
# FIXME - returns all items, so you can't get data from an embedded holdings field.
# TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum).
my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource'));
my $self = shift;
my $label_fields = _get_text_fields($self->{'format_string'});
my $item = _get_label_item($self->{'item_number'});
my $self = shift;
my $label_fields = _get_text_fields($self->{'format_string'});
my $item = _get_label_item($self->{'item_number'});
- my $bib_record = GetMarcBiblio({ biblionumber => $item->{biblionumber} });
+ my $biblio = Koha::Biblios->find($item->{biblionumber});
+ my $bib_record = $biblio->metadata->record;
my @csv_data = (map { _get_barcode_data($_->{'code'},$item,$bib_record) } @$label_fields);
return \@csv_data;
}
my @csv_data = (map { _get_barcode_data($_->{'code'},$item,$bib_record) } @$label_fields);
return \@csv_data;
}
Today
);
use POSIX qw( strftime );
Today
);
use POSIX qw( strftime );
-use C4::Biblio qw( GetMarcBiblio GetMarcFromKohaField ModBiblio );
+use C4::Biblio qw( GetMarcFromKohaField ModBiblio );
use C4::Log qw( logaction ); # logaction
use C4::Serials::Frequency qw( GetSubscriptionFrequency );
use C4::Serials::Numberpattern;
use Koha::AdditionalFieldValues;
use C4::Log qw( logaction ); # logaction
use C4::Serials::Frequency qw( GetSubscriptionFrequency );
use C4::Serials::Numberpattern;
use Koha::AdditionalFieldValues;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Serial;
use Koha::Subscriptions;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Serial;
use Koha::Subscriptions;
#set serial flag on biblio if not already set.
my $biblio = Koha::Biblios->find( $biblionumber );
if ( $biblio and !$biblio->serial ) {
#set serial flag on biblio if not already set.
my $biblio = Koha::Biblios->find( $biblionumber );
if ( $biblio and !$biblio->serial ) {
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $record = $biblio->metadata->record;
my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial' );
if ($tag) {
eval { $record->field($tag)->update( $subf => 1 ); };
my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial' );
if ($tag) {
eval { $record->field($tag)->update( $subf => 1 ); };
use strict;
use warnings;
use strict;
use warnings;
-use C4::Biblio qw( GetAuthorisedValueDesc GetMarcBiblio );
+use C4::Biblio qw( GetAuthorisedValueDesc );
use C4::Context;
use C4::Koha qw( GetNormalizedUPC GetNormalizedOCLCNumber GetNormalizedISBN GetNormalizedEAN );
use Koha::Biblios;
use C4::Context;
use C4::Koha qw( GetNormalizedUPC GetNormalizedOCLCNumber GetNormalizedISBN GetNormalizedEAN );
use Koha::Biblios;
$item->{medium} = $biblio->medium;
$item->{part_number} = $biblio->part_number;
$item->{part_name} = $biblio->part_name;
$item->{medium} = $biblio->medium;
$item->{part_number} = $biblio->part_number;
$item->{part_name} = $biblio->part_name;
- my $this_record = GetMarcBiblio({ biblionumber => $biblio->biblionumber });
+ my $this_record = $biblio->metadata->record;
$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_upc'} = GetNormalizedUPC($this_record,$marcflavour);
$item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour);
$item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour);
use Modern::Perl;
use JSON qw( decode_json encode_json );
use Modern::Perl;
use JSON qw( decode_json encode_json );
use Koha::DateUtils qw( dt_from_string );
use Koha::Virtualshelves;
use Koha::SearchEngine;
use Koha::DateUtils qw( dt_from_string );
use Koha::Virtualshelves;
use Koha::SearchEngine;
# Modify the biblio
my $error = eval {
# Modify the biblio
my $error = eval {
- my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
C4::MarcModificationTemplates::ModifyRecordWithTemplate( $mmtid, $record );
my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode, {
use C4::AuthoritiesMarc;
use C4::Biblio qw( GetMarcFromKohaField );
use C4::Record;
use C4::AuthoritiesMarc;
use C4::Biblio qw( GetMarcFromKohaField );
use C4::Record;
use Koha::CsvProfiles;
use Koha::Logger;
use List::Util qw( all any );
use Koha::CsvProfiles;
use Koha::Logger;
use List::Util qw( all any );
my $export_items = $params->{export_items} // 1;
my $only_export_items_for_branches = $params->{only_export_items_for_branches};
my $export_items = $params->{export_items} // 1;
my $only_export_items_for_branches = $params->{only_export_items_for_branches};
- my $record = eval { C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); };
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = eval { $biblio->metadata->record };
return if $@ or not defined $record;
return if $@ or not defined $record;
use Modern::Perl;
use MARC::Record;
use C4::Context;
use Modern::Perl;
use MARC::Record;
use C4::Context;
-use C4::Biblio qw( GetFrameworkCode GetMarcBiblio GetMarcStructure IsMarcStructureInternal );
+use C4::Biblio qw( GetFrameworkCode GetMarcStructure IsMarcStructureInternal );
use C4::Koha qw( GetAuthorisedValues );
use C4::ClassSource qw( GetClassSources );
use C4::Koha qw( GetAuthorisedValues );
use C4::ClassSource qw( GetClassSources );
use Koha::DateUtils qw( dt_from_string );
use Koha::Libraries;
use Koha::DateUtils qw( dt_from_string );
use Koha::Libraries;
: undef;
my $biblionumber = $self->{biblionumber};
: undef;
my $biblionumber = $self->{biblionumber};
- my $frameworkcode = $biblionumber ? GetFrameworkCode($biblionumber) : q{};
- my $marc_record = $biblionumber ? GetMarcBiblio( { biblionumber => $biblionumber } ) : undef;
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $frameworkcode = $biblio ? GetFrameworkCode($biblionumber) : q{};
+ my $marc_record = $biblio ? $biblio->metadata->record : undef;
my @subfields;
my $tagslib = GetMarcStructure( 1, $frameworkcode );
foreach my $tag ( keys %{$tagslib} ) {
my @subfields;
my $tagslib = GetMarcStructure( 1, $frameworkcode );
foreach my $tag ( keys %{$tagslib} ) {
use C4::Biblio qw(
AddBiblio
GetBiblioData
use C4::Biblio qw(
AddBiblio
GetBiblioData
GetMarcFromKohaField
GetMarcPrice
GetMarcStructure
GetMarcFromKohaField
GetMarcPrice
GetMarcStructure
use Koha::Acquisition::Booksellers;
use Koha::Acquisition::Currencies qw( get_active );
use Koha::Acquisition::Booksellers;
use Koha::Acquisition::Currencies qw( get_active );
use Koha::BiblioFrameworks;
use Koha::DateUtils qw( dt_from_string );
use Koha::MarcSubfieldStructures;
use Koha::BiblioFrameworks;
use Koha::DateUtils qw( dt_from_string );
use Koha::MarcSubfieldStructures;
# - no ordernumber, no biblionumber: from a suggestion, from a new order
if ( not $ordernumber or $biblionumber ) {
if ( C4::Context->preference('UseACQFrameworkForBiblioRecords') ) {
# - no ordernumber, no biblionumber: from a suggestion, from a new order
if ( not $ordernumber or $biblionumber ) {
if ( C4::Context->preference('UseACQFrameworkForBiblioRecords') ) {
- my $record = $biblionumber ? GetMarcBiblio({ biblionumber => $biblionumber }) : undef;
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio ? $biblio->metadata->record : undef;
foreach my $tag ( sort keys %{$tagslib} ) {
next if $tag eq '';
next if $tag eq $itemnumber_tag; # skip items fields
foreach my $tag ( sort keys %{$tagslib} ) {
next if $tag eq '';
next if $tag eq $itemnumber_tag; # skip items fields
use CGI qw ( -utf8 );
use C4::Koha;
use C4::Biblio qw(
use CGI qw ( -utf8 );
use C4::Koha;
use C4::Biblio qw(
GetMarcSeries
GetMarcSubjects
GetMarcUrls
GetMarcSeries
GetMarcSubjects
GetMarcUrls
my $biblio = Koha::Biblios->find( $biblionumber ) or next;
my $dat = $biblio->unblessed;
my $biblio = Koha::Biblios->find( $biblionumber ) or next;
my $dat = $biblio->unblessed;
- my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
+ my $record = $biblio->metadata->record;
my $marcnotesarray = $biblio->get_marc_notes;
my $marcauthorsarray = $biblio->get_marc_authors;
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
my $marcnotesarray = $biblio->get_marc_notes;
my $marcauthorsarray = $biblio->get_marc_authors;
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
use C4::Biblio qw(
GetBiblioData
GetFrameworkCode
use C4::Biblio qw(
GetBiblioData
GetFrameworkCode
GetMarcStructure
);
use C4::Search qw( z3950_search_args enabled_staff_search_views );
GetMarcStructure
);
use C4::Search qw( z3950_search_args enabled_staff_search_views );
-my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+my $biblio_object = Koha::Biblios->find( $biblionumber ); # FIXME Should replace $biblio
+my $record = $biblio_object->metadata->record;
if ( not defined $record ) {
# biblionumber invalid -> report and exit
$template->param( unknownbiblionumber => 1,
if ( not defined $record ) {
# biblionumber invalid -> report and exit
$template->param( unknownbiblionumber => 1,
-my $biblio_object = Koha::Biblios->find( $biblionumber ); # FIXME Should replace $biblio
my $tagslib = GetMarcStructure(1,$frameworkcode);
my $biblio = GetBiblioData($biblionumber);
my $tagslib = GetMarcStructure(1,$frameworkcode);
my $biblio = GetBiblioData($biblionumber);
use C4::Koha qw( GetAuthorisedValues );
use CGI qw ( -utf8 );
use HTML::Entities;
use C4::Koha qw( GetAuthorisedValues );
use CGI qw ( -utf8 );
use HTML::Entities;
-use C4::Biblio qw( GetBiblioData GetFrameworkCode GetMarcBiblio );
+use C4::Biblio qw( GetBiblioData GetFrameworkCode );
use C4::Items qw( GetHostItemsInfo GetItemsInfo );
use C4::Acquisition qw( GetOrderFromItemnumber GetBasket GetInvoice );
use C4::Output qw( output_and_exit output_html_with_http_headers );
use C4::Items qw( GetHostItemsInfo GetItemsInfo );
use C4::Acquisition qw( GetOrderFromItemnumber GetBasket GetInvoice );
use C4::Output qw( output_and_exit output_html_with_http_headers );
($itemnumber != $itm->{itemnumber}));
}
($itemnumber != $itm->{itemnumber}));
}
-my $record=GetMarcBiblio({ biblionumber => $biblionumber });
+my $biblio = Koha::Biblios->find( $biblionumber );
+my $record = $biblio ? $biblio->metadata->record : undef;
output_and_exit( $query, $cookie, $template, 'unknown_biblio')
output_and_exit( $query, $cookie, $template, 'unknown_biblio')
+ unless $biblio && $record;
my $hostrecords;
# adding items linked via host biblios
my $hostrecords;
# adding items linked via host biblios
push (@items,@hostitems);
}
push (@items,@hostitems);
}
-my $biblio = Koha::Biblios->find( $biblionumber );
-
my $totalcount=@all_items;
my $showncount=@items;
my $hiddencount = $totalcount - $showncount;
my $totalcount=@all_items;
my $showncount=@items;
my $hiddencount = $totalcount - $showncount;
use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
-use C4::Biblio qw( GetMarcBiblio GetXmlBiblio );
+use C4::Biblio qw( GetXmlBiblio );
use Koha::Import::Records;
my $input= CGI->new;
use Koha::Import::Records;
my $input= CGI->new;
- $record =GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ $record = $biblio->metadata->record;
}
if(!ref $record) {
print $input->redirect("/cgi-bin/koha/errors/404.pl");
}
if(!ref $record) {
print $input->redirect("/cgi-bin/koha/errors/404.pl");
AddBiblio
DelBiblio
GetFrameworkCode
AddBiblio
DelBiblio
GetFrameworkCode
GetMarcFromKohaField
GetMarcStructure
GetUsedMarcStructure
GetMarcFromKohaField
GetMarcStructure
GetUsedMarcStructure
use Koha::BiblioFrameworks;
use Koha::DateUtils qw( dt_from_string );
use Koha::BiblioFrameworks;
use Koha::DateUtils qw( dt_from_string );
use Koha::ItemTypes;
use Koha::Libraries;
use Koha::ItemTypes;
use Koha::Libraries;
- my $does_bib_exist = Koha::Biblios->find($biblionumber);
- if (!defined $does_bib_exist){
+ $biblio = Koha::Biblios->find($biblionumber);
+ unless ( $biblio ) {
$biblionumber = undef;
$template->param( bib_doesnt_exist => 1 );
}
$biblionumber = undef;
$template->param( bib_doesnt_exist => 1 );
}
-if (($biblionumber) && !($breedingid)){
- $record = GetMarcBiblio({ biblionumber => $biblionumber });
+if ( $biblio && !$breedingid ) {
+ $record = $biblio->metadata->record;
}
if ($breedingid) {
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
}
if ($breedingid) {
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers );
use C4::Biblio qw(
GetFrameworkCode
use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_http_headers );
use C4::Biblio qw(
GetFrameworkCode
GetMarcFromKohaField
GetMarcStructure
IsMarcStructureInternal
GetMarcFromKohaField
GetMarcStructure
IsMarcStructureInternal
use C4::Barcodes;
use C4::Barcodes::ValueBuilder;
use Koha::DateUtils qw( dt_from_string );
use C4::Barcodes;
use C4::Barcodes::ValueBuilder;
use Koha::DateUtils qw( dt_from_string );
use Koha::Items;
use Koha::ItemTypes;
use Koha::Items;
use Koha::Items;
use Koha::ItemTypes;
use Koha::Items;
$restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'}));
our $tagslib = &GetMarcStructure(1,$frameworkcode);
$restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' && haspermission($uid, {'editcatalogue' => 'fast_cataloging'}));
our $tagslib = &GetMarcStructure(1,$frameworkcode);
-my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+my $record = $biblio->metadata->record;
output_and_exit_if_error( $input, $cookie, $template,
{ module => 'cataloguing', record => $record } );
output_and_exit_if_error( $input, $cookie, $template,
{ module => 'cataloguing', record => $record } );
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
-use C4::Biblio qw( GetMarcBiblio ModBiblio PrepHostMarcField );
+use C4::Biblio qw( ModBiblio PrepHostMarcField );
-my $biblio = GetMarcBiblio({ biblionumber => $biblionumber });
+my $biblio = Koha::Biblios->find($biblionumber);
+my $record = $biblio->metadata->record;
my $marcflavour = C4::Context->preference("marcflavour");
$marcflavour ||="MARC21";
if ($marcflavour eq 'MARC21') {
my $marcflavour = C4::Context->preference("marcflavour");
$marcflavour ||="MARC21";
if ($marcflavour eq 'MARC21') {
- $template->param(bibliotitle => $biblio->subfield('245','a'));
+ $template->param(bibliotitle => $record->subfield('245','a'));
} elsif ($marcflavour eq 'UNIMARC') {
} elsif ($marcflavour eq 'UNIMARC') {
- $template->param(bibliotitle => $biblio->subfield('200','a'));
+ $template->param(bibliotitle => $record->subfield('200','a'));
}
$template->param(biblionumber => $biblionumber);
}
$template->param(biblionumber => $biblionumber);
if ($item) {
my $field = PrepHostMarcField( $item->biblio->biblionumber, $item->itemnumber, $marcflavour );
if ($item) {
my $field = PrepHostMarcField( $item->biblio->biblionumber, $item->itemnumber, $marcflavour );
- $biblio->append_fields($field);
+ $record->append_fields($field);
- my $modresult = ModBiblio( $biblio, $biblionumber, '' );
+ my $modresult = ModBiblio( $record, $biblionumber, '' );
if ($modresult) {
$template->param( success => 1 );
}
if ($modresult) {
$template->param( success => 1 );
}
DelBiblio
GetBiblioData
GetFrameworkCode
DelBiblio
GetBiblioData
GetFrameworkCode
GetMarcFromKohaField
GetMarcStructure
ModBiblio
GetMarcFromKohaField
GetMarcStructure
ModBiblio
- $record->leader(GetMarcBiblio({ biblionumber => $ref_biblionumber })->leader());
+ my $biblio = Koha::Biblios->find($ref_biblionumber);
+ $record->leader($biblio->metadata->record->leader());
my $frameworkcode = $input->param('frameworkcode');
my $frameworkcode = $input->param('frameworkcode');
ModBiblio($record, $ref_biblionumber, $frameworkcode);
# Moving items and article requests from the other record to the reference record
ModBiblio($record, $ref_biblionumber, $frameworkcode);
# Moving items and article requests from the other record to the reference record
- my $biblio = Koha::Biblios->find($ref_biblionumber);
+ $biblio = $biblio->get_from_storage;
foreach my $biblionumber (@biblionumbers) {
my $from_biblio = Koha::Biblios->find($biblionumber);
$from_biblio->items->move_to_biblio($biblio);
foreach my $biblionumber (@biblionumbers) {
my $from_biblio = Koha::Biblios->find($biblionumber);
$from_biblio->items->move_to_biblio($biblio);
my $report_header = {};
foreach my $biblionumber ($ref_biblionumber, @biblionumbers) {
# build report
my $report_header = {};
foreach my $biblionumber ($ref_biblionumber, @biblionumbers) {
# build report
- my $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $marcrecord = $biblio->metadata->record;
my %report_record = (
biblionumber => $biblionumber,
fields => {},
my %report_record = (
biblionumber => $biblionumber,
fields => {},
# Creating a loop for display
my @records;
foreach my $biblionumber (@biblionumbers) {
# Creating a loop for display
my @records;
foreach my $biblionumber (@biblionumbers) {
- my $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $marcrecord = $biblio->metadata->record;
my $frameworkcode = GetFrameworkCode($biblionumber);
my $recordObj = Koha::MetadataRecord->new({'record' => $marcrecord, schema => $marcflavour});
my $record = {
my $frameworkcode = GetFrameworkCode($biblionumber);
my $recordObj = Koha::MetadataRecord->new({'record' => $marcrecord, schema => $marcflavour});
my $record = {
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
-use C4::Biblio qw( GetMarcBiblio TransformMarcToKoha );
+use C4::Biblio qw( TransformMarcToKoha );
use Koha::ItemTypes;
use Koha::SearchEngine;
use Koha::ItemTypes;
use Koha::SearchEngine;
- $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ $marcrecord = $biblio->metadata->record;
my $subfield_value_9 = $biblionumber;
my $subfield_value_0 = $biblionumber;
my $subfield_value_9 = $biblionumber;
my $subfield_value_0 = $biblionumber;
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
-use C4::Biblio qw( GetMarcBiblio TransformMarcToKoha );
+use C4::Biblio qw( TransformMarcToKoha );
use Koha::ItemTypes;
use Koha::SearchEngine;
use Koha::ItemTypes;
use Koha::SearchEngine;
- $marcrecord = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ $marcrecord = $biblio->metadata->record;
my $subfield_value_9 = $biblionumber;
my $subfield_value_0;
my $subfield_value_9 = $biblionumber;
my $subfield_value_0;
use MARC::Field;
use C4::Biblio;
use MARC::Field;
use C4::Biblio;
use Koha::DateUtils qw( dt_from_string );
my ( $verbose, $help, $confirm, $where, @fields, $unless_exists_field );
use Koha::DateUtils qw( dt_from_string );
my ( $verbose, $help, $confirm, $where, @fields, $unless_exists_field );
$sth->execute();
while ( my ( $biblionumber, $frameworkcode ) = $sth->fetchrow_array ) {
$sth->execute();
while ( my ( $biblionumber, $frameworkcode ) = $sth->fetchrow_array ) {
- my $marc_record =
- C4::Biblio::GetMarcBiblio( { biblionumber => $biblionumber } );
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $marc_record = $biblio->metadata->record;
next unless $marc_record;
if ( $unless_exists_field ) {
my ( $tag, $subfield ) = split '\$', $unless_exists_field;
next unless $marc_record;
if ( $unless_exists_field ) {
my ( $tag, $subfield ) = split '\$', $unless_exists_field;
# Koha modules used
use Koha::Script;
use C4::Context;
# Koha modules used
use Koha::Script;
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio ModBiblioMarc );
+use C4::Biblio qw( ModBiblioMarc );
+use Koha::Biblios;
my $dbh = C4::Context->dbh;
my $dbh = C4::Context->dbh;
$sth->execute();
while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){
$sth->execute();
while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber);
my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber )};
if($@){
C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber);
my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber )};
if($@){
use Koha::Script -cron;
use C4::Context;
use Koha::Script -cron;
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio );
use AnyEvent;
use AnyEvent::HTTP qw( http_request );
use Encode qw( encode_utf8 );
use AnyEvent;
use AnyEvent::HTTP qw( http_request );
use Encode qw( encode_utf8 );
cb => sub {
return if $count > $maxconn;
while ( my ($biblionumber) = $sth->fetchrow ) {
cb => sub {
return if $count > $maxconn;
while ( my ($biblionumber) = $sth->fetchrow ) {
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
for my $tag (@tags) {
foreach my $field ( $record->field($tag) ) {
my $url = $field->subfield('u');
for my $tag (@tags) {
foreach my $field ( $record->field($tag) ) {
my $url = $field->subfield('u');
use C4::Context;
use C4::Biblio qw(
GetFrameworkCode
use C4::Context;
use C4::Biblio qw(
GetFrameworkCode
LinkBibHeadingsToAuthorities
ModBiblio
);
LinkBibHeadingsToAuthorities
ModBiblio
);
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use Time::HiRes qw( time );
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use Time::HiRes qw( time );
my $args = shift;
my $tagtolink = $args->{tagtolink};
my $allowrelink = $args->{allowrelink};
my $args = shift;
my $tagtolink = $args->{tagtolink};
my $allowrelink = $args->{allowrelink};
- my $bib = GetMarcBiblio({ biblionumber => $biblionumber });
- unless ( defined $bib ) {
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
+ unless ( defined $record ) {
print
"\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n";
$num_bad_bibs++;
print
"\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n";
$num_bad_bibs++;
my $frameworkcode = GetFrameworkCode($biblionumber);
my ( $headings_changed, $results ) =
my $frameworkcode = GetFrameworkCode($biblionumber);
my ( $headings_changed, $results ) =
- LinkBibHeadingsToAuthorities( $linker, $bib, $frameworkcode, $allowrelink, $tagtolink );
+ LinkBibHeadingsToAuthorities( $linker, $record, $frameworkcode, $allowrelink, $tagtolink );
foreach my $key ( keys %{ $results->{'unlinked'} } ) {
$unlinked_headings{$key} += $results->{'unlinked'}->{$key};
}
foreach my $key ( keys %{ $results->{'unlinked'} } ) {
$unlinked_headings{$key} += $results->{'unlinked'}->{$key};
}
if ($headings_changed) {
if ($verbose) {
if ($headings_changed) {
if ($verbose) {
- my $title = substr( $bib->title, 0, 20 );
+ my $title = substr( $record->title, 0, 20 );
printf(
"Bib %12d (%-20s): %3d headings changed\n",
$biblionumber,
printf(
"Bib %12d (%-20s): %3d headings changed\n",
$biblionumber,
);
}
if ( not $test_only ) {
);
}
if ( not $test_only ) {
- ModBiblio( $bib, $biblionumber, $frameworkcode, { disable_autolink => 1 });
+ ModBiblio( $record, $biblionumber, $frameworkcode, { disable_autolink => 1 });
#Last param is to note ModBiblio was called from linking script and bib should not be linked again
$num_bibs_modified++;
}
#Last param is to note ModBiblio was called from linking script and bib should not be linked again
$num_bibs_modified++;
}
use warnings;
use Koha::Script;
use warnings;
use Koha::Script;
-use C4::Biblio qw( GetMarcBiblio ModBiblio );
+use C4::Biblio qw( ModBiblio );
+use Koha::Biblios;
use Getopt::Long qw( GetOptions );
sub _read_marc_code {
use Getopt::Long qw( GetOptions );
sub _read_marc_code {
sub updateMarc {
my $id = shift;
sub updateMarc {
my $id = shift;
- my $biblio = GetMarcBiblio({ biblionumber => $id });
+ my $biblio = Koha::Biblios->find($id);
+ $biblio &&= $biblio->metadata->record;
- $debug and warn '[ERROR] GetMarcBiblio did not return any biblio.';
+ $debug and warn '[ERROR] Biblio not found.';
use warnings;
use Koha::Script;
use warnings;
use Koha::Script;
use Koha::RecordProcessor;
use Koha::RecordProcessor;
-use C4::Biblio qw( GetMarcBiblio );
-my $record = GetMarcBiblio({ biblionumber => $ARGV[0] });
+my $biblio = Koha::Biblios->find($ARGV[0]);
+unless ( $biblio ) {
+ print "Biblio not found\n";
+ exit;
+}
+my $record = $biblio->metadata->record;
print "Before: " . $record->as_formatted() . "\n";
my $processor = Koha::RecordProcessor->new( { filters => ( $ARGV[1] ) });
print "Before: " . $record->as_formatted() . "\n";
my $processor = Koha::RecordProcessor->new( { filters => ( $ARGV[1] ) });
use Koha::Script;
use C4::Context;
use Koha::Script;
use C4::Context;
-use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblio );
+use C4::Biblio qw( GetFrameworkCode ModBiblio );
+use Koha::Biblios;
use Getopt::Long qw( GetOptions );
my ($wherestring, $run, $silent, $want_help);
use Getopt::Long qw( GetOptions );
my ($wherestring, $run, $silent, $want_help);
$count++;
print "." unless $silent;
print "\r$count" unless ($silent or ($count % 100));
$count++;
print "." unless $silent;
print "\r$count" unless ($silent or ($count % 100));
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
-
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
+
if ($record) {
ModBiblio($record, $biblionumber, GetFrameworkCode($biblionumber)) ;
}
if ($record) {
ModBiblio($record, $biblionumber, GetFrameworkCode($biblionumber)) ;
}
use C4::Charset;
use C4::Context;
use C4::Biblio;
use C4::Charset;
use C4::Context;
use C4::Biblio;
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
say " skipping. ERROR: Invalid biblionumber." if $verbose;
next;
}
say " skipping. ERROR: Invalid biblionumber." if $verbose;
next;
}
- my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ unless ( $biblio ) {
+ say " skipping. ERROR: biblionumber not found." if $verbose;
+ next;
+ }
+ my $record = $biblio->metadata->record;
unless ($record) {
say " skipping. ERROR: Invalid record." if $verbose;
next;
unless ($record) {
say " skipping. ERROR: Invalid record." if $verbose;
next;
use Koha::Script;
use C4::Context;
use Koha::Script;
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio ModBiblio );
+use C4::Biblio qw( ModBiblio );
+use Koha::Biblios;
use Pod::Usage qw( pod2usage );
use Pod::Usage qw( pod2usage );
# fetch info from the search
while (my ($biblionumber, $frameworkcode) = $sth1->fetchrow_array){
# fetch info from the search
while (my ($biblionumber, $frameworkcode) = $sth1->fetchrow_array){
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
-
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
+
my $modok = ModBiblio($record, $biblionumber, $frameworkcode);
if ($modok) {
my $modok = ModBiblio($record, $biblionumber, $frameworkcode);
if ($modok) {
# Koha modules used
use C4::Context;
# Koha modules used
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio GetMarcFromKohaField ModBiblioMarc );
+use C4::Biblio qw( GetMarcFromKohaField ModBiblioMarc );
+use Koha::Biblios;
use MARC::File::USMARC;
$|=1;
use MARC::File::USMARC;
$|=1;
my $i=1;
while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){
my $i=1;
while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
print ".";
print "\r$i" unless $i %100;
MARCmodbiblionumber($biblionumber,$biblioitemnumber,$record);
print ".";
print "\r$i" unless $i %100;
MARCmodbiblionumber($biblionumber,$biblioitemnumber,$record);
# Koha modules used
use C4::Context;
# Koha modules used
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio ModBiblioMarc );
+use C4::Biblio qw( ModBiblioMarc );
+use Koha::Biblios;
while (my ($biblionumber,$time)=$sth->fetchrow ){
# my $record;
# print "record : $biblionumber \n";
while (my ($biblionumber,$time)=$sth->fetchrow ){
# my $record;
# print "record : $biblionumber \n";
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio ? $biblio->metadata->record : undef;
# print "=> ".$record->as_formatted;
MARCmodrecord($biblionumber,$record,$time) if ($record);
#
# print "=> ".$record->as_formatted;
MARCmodrecord($biblionumber,$record,$time) if ($record);
#
use MARC::Batch;
use Koha::Script;
use C4::Context;
use MARC::Batch;
use Koha::Script;
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio );
use Time::HiRes qw( gettimeofday );
use Getopt::Long qw( GetOptions );
use Time::HiRes qw( gettimeofday );
use Getopt::Long qw( GetOptions );
my $counter;
my %hash;
while (my ($bibid) = $sth->fetchrow) {
my $counter;
my %hash;
while (my ($bibid) = $sth->fetchrow) {
- my $record = GetMarcBiblio({ biblionumber => $bibid });
+ my $biblio = Koha::Biblios->find($bibid);
+ my $record = $biblio->metadata->record;
my $isbnField = $record->field('010');
next unless $isbnField;
my $isbn=$isbnField->subfield('a');
my $isbnField = $record->field('010');
next unless $isbnField;
my $isbn=$isbnField->subfield('a');
use Koha::Script;
use C4::Context;
use Koha::Script;
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio ModBiblio );
+use C4::Biblio qw( ModBiblio );
use Getopt::Long qw( GetOptions );
$| = 1;
use Getopt::Long qw( GetOptions );
$| = 1;
sub process_bib {
my $biblionumber = shift;
sub process_bib {
my $biblionumber = shift;
- my $bib = GetMarcBiblio({ biblionumber => $biblionumber });
- unless (defined $bib) {
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
+ unless (defined $record) {
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';
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) ) {
+ foreach my $hostfield ( $record->field($analyticfield) ) {
if(my $barcode = $hostfield->subfield('o')){
my $item = Koha::Items->find({ barcode => $barcode });
if ($item) {
if(my $barcode = $hostfield->subfield('o')){
my $item = Koha::Items->find({ barcode => $barcode });
if ($item) {
}
if ($modif) {
$num_bibs_modified++;
}
if ($modif) {
$num_bibs_modified++;
- my $modresult = ModBiblio( $bib, $biblionumber, '' );
+ my $modresult = ModBiblio( $record, $biblionumber, '' );
warn "Modifying biblio $biblionumber";
if ( !$modresult ) {
warn "Unable to modify biblio $biblionumber with update host field";
warn "Modifying biblio $biblionumber";
if ( !$modresult ) {
warn "Unable to modify biblio $biblionumber with update host field";
use Koha::Script;
use C4::Context;
use Koha::Script;
use C4::Context;
-use C4::Biblio qw( GetMarcBiblio ModBiblio );
+use C4::Biblio qw( ModBiblio );
use C4::Koha qw( GetVariationsOfISBN );
use Koha::Biblios;
use C4::Koha qw( GetVariationsOfISBN );
use Koha::Biblios;
foreach my $biblionumber (@biblionumbers) {
$counter++;
foreach my $biblionumber (@biblionumbers) {
$counter++;
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
if ($verbose) {
say "Found matching record! Biblionumber: $biblionumber";
if ($verbose) {
say "Found matching record! Biblionumber: $biblionumber";
# Script to switch the MARC21 440$anv and 490$av information
use Koha::Script;
# Script to switch the MARC21 440$anv and 490$av information
use Koha::Script;
-use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblioMarc );
+use C4::Biblio qw( GetFrameworkCode ModBiblioMarc );
use Getopt::Long qw( GetOptions );
my $commit;
use Getopt::Long qw( GetOptions );
my $commit;
my ( @newfields );
# Get biblio marc
my ( @newfields );
# Get biblio marc
- my $biblio = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ $biblio &&= $biblio->metadata->record;
foreach my $field ( $biblio->field( '440' ) ) {
my @newsubfields;
foreach my $field ( $biblio->field( '440' ) ) {
my @newsubfields;
use Koha::Script;
use C4::Context;
use C4::Items qw( ModItemFromMarc );
use Koha::Script;
use C4::Context;
use C4::Items qw( ModItemFromMarc );
-use C4::Biblio qw( GetMarcBiblio );
my $dbh=C4::Context->dbh;
my $dbh=C4::Context->dbh;
$rqbiblios->execute;
$|=1;
while (my ($biblionumber)= $rqbiblios->fetchrow_array){
$rqbiblios->execute;
$|=1;
while (my ($biblionumber)= $rqbiblios->fetchrow_array){
- my $record=GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
foreach my $itemfield ($record->field('995')){
my $marcitem=MARC::Record->new();
$marcitem->encoding('UTF-8');
foreach my $itemfield ($record->field('995')){
my $marcitem=MARC::Record->new();
$marcitem->encoding('UTF-8');
use C4::Koha;
use C4::Biblio qw(
GetFrameworkCode
use C4::Koha;
use C4::Biblio qw(
GetFrameworkCode
GetMarcSeries
GetMarcSubjects
GetMarcUrls
GetMarcSeries
GetMarcSubjects
GetMarcUrls
# No filtering on the item records needed for the record itself
# since the only reason item information is grabbed is because of branchcodes.
# No filtering on the item records needed for the record itself
# since the only reason item information is grabbed is because of branchcodes.
- my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
+ my $record = $biblio->metadata->record;
my $framework = &GetFrameworkCode( $biblionumber );
$record_processor->options({
interface => 'opac',
my $framework = &GetFrameworkCode( $biblionumber );
$record_processor->options({
interface => 'opac',
use C4::Koha qw( getitemtypeimagelocation getitemtypeimagesrc );
use C4::Circulation qw( GetBranchItemRule GetTransfers );
use C4::Reserves qw( CanItemBeReserved CanBookBeReserved AddReserve GetReservesControlBranch ItemsAnyAvailableAndNotRestricted IsAvailableForItemLevelRequest );
use C4::Koha qw( getitemtypeimagelocation getitemtypeimagesrc );
use C4::Circulation qw( GetBranchItemRule GetTransfers );
use C4::Reserves qw( CanItemBeReserved CanBookBeReserved AddReserve GetReservesControlBranch ItemsAnyAvailableAndNotRestricted IsAvailableForItemLevelRequest );
-use C4::Biblio qw( GetBiblioData GetFrameworkCode GetMarcBiblio );
+use C4::Biblio qw( GetBiblioData GetFrameworkCode );
use C4::Items qw( GetHostItemsInfo GetItemsInfo );
use C4::Output qw( output_html_with_http_headers );
use C4::Context;
use C4::Items qw( GetHostItemsInfo GetItemsInfo );
use C4::Output qw( output_html_with_http_headers );
use C4::Context;
my @itemInfos = GetItemsInfo($biblioNumber);
my @itemInfos = GetItemsInfo($biblioNumber);
- my $marcrecord= GetMarcBiblio({ biblionumber => $biblioNumber });
+ my $biblio = Koha::Biblios->find( $biblioNumber );
+ next unless $biblio;
+
+ my $marcrecord = $biblio->metadata->record;
# flag indicating existence of at least one item linked via a host record
# adding items linked via host biblios
# flag indicating existence of at least one item linked via a host record
# adding items linked via host biblios
}
# Compute the priority rank.
}
# Compute the priority rank.
- my $biblio = Koha::Biblios->find( $biblioNumber );
- next unless $biblio;
-
$biblioData->{object} = $biblio;
my $holds = $biblio->holds;
my $rank = $holds->count;
$biblioData->{object} = $biblio;
my $holds = $biblio->holds;
my $rank = $holds->count;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
-use C4::Biblio qw( GetBiblioData GetFrameworkCode GetMarcBiblio );
+use C4::Biblio qw( GetBiblioData GetFrameworkCode );
use C4::External::BakerTaylor qw( image_url link_url );
use C4::Koha qw(
GetNormalizedEAN
use C4::External::BakerTaylor qw( image_url link_url );
use C4::Koha qw(
GetNormalizedEAN
while ( my $content = $contents->next ) {
my $biblionumber = $content->biblionumber;
my $this_item = GetBiblioData($biblionumber);
while ( my $content = $contents->next ) {
my $biblionumber = $content->biblionumber;
my $this_item = GetBiblioData($biblionumber);
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
- my $framework = GetFrameworkCode( $biblionumber );
- my $biblio = Koha::Biblios->find( $biblionumber );
- $record_processor->options({
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
+ my $framework = GetFrameworkCode($biblionumber);
+ $record_processor->options(
+ {
interface => 'opac',
frameworkcode => $framework
});
interface => 'opac',
frameworkcode => $framework
});
GetNormalizedUPC
);
use C4::Output qw( output_html_with_http_headers );
GetNormalizedUPC
);
use C4::Output qw( output_html_with_http_headers );
-use C4::Biblio qw( GetMarcBiblio );
use Koha::DateUtils qw( dt_from_string );
use Koha::DateUtils qw( dt_from_string );
use Koha::Patrons;
use Koha::Reviews;
use POSIX qw( ceil floor );
use Koha::Patrons;
use Koha::Reviews;
use POSIX qw( ceil floor );
my $biblionumber = $result->{biblionumber};
my $biblio = Koha::Biblios->find( $biblionumber );
my $biblioitem = $biblio->biblioitem;
my $biblionumber = $result->{biblionumber};
my $biblio = Koha::Biblios->find( $biblionumber );
my $biblioitem = $biblio->biblioitem;
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $record = $biblio->metadata->record;
$result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour);
$result->{normalized_ean} = GetNormalizedEAN($record,$marcflavour);
$result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour);
$result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour);
$result->{normalized_ean} = GetNormalizedEAN($record,$marcflavour);
$result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour);
use C4::Auth qw( checkauth );
use C4::Biblio;
use C4::Output qw( output_error );
use C4::Auth qw( checkauth );
use C4::Biblio;
use C4::Output qw( output_error );
use Koha::Items;
use Koha::Linktracker;
use CGI qw ( -utf8 );
use Koha::Items;
use Koha::Linktracker;
use CGI qw ( -utf8 );
- my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
my $marc_urls = $record ? C4::Biblio::GetMarcUrls($record, C4::Context->preference('marcflavour')) : [];
my $search_crit = { uri => { -like => "%$uri%" } };
if( $itemnumber ) { # itemnumber is leading over biblionumber
my $marc_urls = $record ? C4::Biblio::GetMarcUrls($record, C4::Context->preference('marcflavour')) : [];
my $search_crit = { uri => { -like => "%$uri%" } };
if( $itemnumber ) { # itemnumber is leading over biblionumber
use t::lib::Mocks;
use t::lib::TestBuilder;
use t::lib::Mocks;
use t::lib::TestBuilder;
-use C4::Biblio qw( AddBiblio GetMarcBiblio ModBiblio );
+use C4::Biblio qw( AddBiblio ModBiblio );
use Koha::Authorities;
use Koha::Authority::ControlledIndicators;
use Koha::Authority::MergeRequests;
use Koha::Authorities;
use Koha::Authority::ControlledIndicators;
use Koha::Authority::MergeRequests;
use Koha::Database;
BEGIN {
use Koha::Database;
BEGIN {
is( $rv, 1, 'We expect one biblio record (out of two) to be updated' );
# Check the results
is( $rv, 1, 'We expect one biblio record (out of two) to be updated' );
# Check the results
- my $newbiblio1 = GetMarcBiblio({ biblionumber => $biblionumber1 });
+ my $newbiblio1 = Koha::Biblios->find($biblionumber1)->metadata->record;
compare_fields( $biblio1, $newbiblio1, {}, 'count' );
compare_fields( $biblio1, $newbiblio1, {}, 'order' );
is( $newbiblio1->subfield('609', '9'), $authid1, 'Check biblio1 609$9' );
is( $newbiblio1->subfield('609', 'a'), 'George Orwell',
'Check biblio1 609$a' );
compare_fields( $biblio1, $newbiblio1, {}, 'count' );
compare_fields( $biblio1, $newbiblio1, {}, 'order' );
is( $newbiblio1->subfield('609', '9'), $authid1, 'Check biblio1 609$9' );
is( $newbiblio1->subfield('609', 'a'), 'George Orwell',
'Check biblio1 609$a' );
- my $newbiblio2 = GetMarcBiblio({ biblionumber => $biblionumber2 });
+ my $newbiblio2 = Koha::Biblios->find($biblionumber2)->metadata->record;
compare_fields( $biblio2, $newbiblio2, {}, 'count' );
compare_fields( $biblio2, $newbiblio2, {}, 'order' );
is( $newbiblio2->subfield('609', '9'), $authid1, 'Check biblio2 609$9' );
compare_fields( $biblio2, $newbiblio2, {}, 'count' );
compare_fields( $biblio2, $newbiblio2, {}, 'order' );
is( $newbiblio2->subfield('609', '9'), $authid1, 'Check biblio2 609$9' );
is( $rv, 2, 'Both records are updated now' );
#Check the results
is( $rv, 2, 'Both records are updated now' );
#Check the results
- my $biblio1 = GetMarcBiblio({ biblionumber => $biblionumber1 });
+ my $biblio1 = Koha::Biblios->find($biblionumber1)->metadata->record;
compare_fields( $MARC1, $biblio1, {}, 'count' );
compare_fields( $MARC1, $biblio1, {}, 'order' );
is( $auth1new->field(109)->subfield('a'), $biblio1->field(109)->subfield('a'), 'Record1 values updated correctly' );
compare_fields( $MARC1, $biblio1, {}, 'count' );
compare_fields( $MARC1, $biblio1, {}, 'order' );
is( $auth1new->field(109)->subfield('a'), $biblio1->field(109)->subfield('a'), 'Record1 values updated correctly' );
- my $biblio2 = GetMarcBiblio({ biblionumber => $biblionumber2 });
+ my $biblio2 = Koha::Biblios->find($biblionumber2)->metadata->record;
compare_fields( $MARC2, $biblio2, {}, 'count' );
compare_fields( $MARC2, $biblio2, {}, 'order' );
is( $auth1new->field(109)->subfield('a'), $biblio2->field(109)->subfield('a'), 'Record2 values updated correctly' );
compare_fields( $MARC2, $biblio2, {}, 'count' );
compare_fields( $MARC2, $biblio2, {}, 'order' );
is( $auth1new->field(109)->subfield('a'), $biblio2->field(109)->subfield('a'), 'Record2 values updated correctly' );
ModBiblio( $MARC1, $biblionumber1, '' );
@linkedrecords = ( $biblionumber1 );
$rv = C4::AuthoritiesMarc::merge({ mergefrom => $authid1, MARCfrom => $auth1old, mergeto => $authid1, MARCto => $auth1new });
ModBiblio( $MARC1, $biblionumber1, '' );
@linkedrecords = ( $biblionumber1 );
$rv = C4::AuthoritiesMarc::merge({ mergefrom => $authid1, MARCfrom => $auth1old, mergeto => $authid1, MARCto => $auth1new });
- $biblio1 = GetMarcBiblio({ biblionumber => $biblionumber1 });
+ $biblio1 = Koha::Biblios->find($biblionumber1)->metadata->record;
is( $biblio1->field(109)->subfield('b'), undef, 'Subfield overwritten in strict mode' );
compare_fields( $MARC1, $biblio1, { 609 => 1 }, 'count' );
my @old609 = $MARC1->field('609');
is( $biblio1->field(109)->subfield('b'), undef, 'Subfield overwritten in strict mode' );
compare_fields( $MARC1, $biblio1, { 609 => 1 }, 'count' );
my @old609 = $MARC1->field('609');
MARC::Field->new( '612', '', '', a => 'unrelated', 9 => 'other' ),
);
my ( $biblionumber ) = C4::Biblio::AddBiblio( $marc, '' );
MARC::Field->new( '612', '', '', a => 'unrelated', 9 => 'other' ),
);
my ( $biblionumber ) = C4::Biblio::AddBiblio( $marc, '' );
- my $oldbiblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $oldbiblio = Koha::Biblios->find($biblionumber)->metadata->record;
# Time to merge
@linkedrecords = ( $biblionumber );
# Time to merge
@linkedrecords = ( $biblionumber );
is( $retval, 1, 'We touched only one biblio' );
# Get new marc record for compares
is( $retval, 1, 'We touched only one biblio' );
# Get new marc record for compares
- my $newbiblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $newbiblio = Koha::Biblios->find($biblionumber)->metadata->record;
compare_fields( $oldbiblio, $newbiblio, {}, 'count' );
# Exclude 109/609 and 112/612 in comparing order
my $excl = { '109' => 1, '112' => 1, '609' => 1, '612' => 1 };
compare_fields( $oldbiblio, $newbiblio, {}, 'count' );
# Exclude 109/609 and 112/612 in comparing order
my $excl = { '109' => 1, '112' => 1, '609' => 1, '612' => 1 };
DelAuthority({ authid => $authid1 }); # this triggers a merge call
# See what happened in the biblio record
DelAuthority({ authid => $authid1 }); # this triggers a merge call
# See what happened in the biblio record
- my $marc1 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $marc1 = Koha::Biblios->find($biblionumber)->metadata->record;
is( $marc1->field('609'), undef, 'Field 609 should be gone too' );
# Now we simulate the delete as done in the cron job
is( $marc1->field('609'), undef, 'Field 609 should be gone too' );
# Now we simulate the delete as done in the cron job
$mocks->{auth_mod}->unmock_all;
merge({ mergefrom => $authid1, biblionumbers => [ $biblionumber ] });
# Final check
$mocks->{auth_mod}->unmock_all;
merge({ mergefrom => $authid1, biblionumbers => [ $biblionumber ] });
# Final check
- $marc1 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ $marc1 = Koha::Biblios->find($biblionumber)->metadata->record;
is( $marc1->field('609'), undef, 'Merge removed the 609 again even after deleting the authority record' );
};
is( $marc1->field('609'), undef, 'Merge removed the 609 again even after deleting the authority record' );
};
# This proves the !authtypefrom condition in sub merge
# Additionally, we test clearing subfield
merge({ mergefrom => $id + 1, MARCfrom => $oldauthmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
# This proves the !authtypefrom condition in sub merge
# Additionally, we test clearing subfield
merge({ mergefrom => $id + 1, MARCfrom => $oldauthmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
- $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ $biblio = Koha::Biblios->find($biblionumber)->metadata->record;
is( $biblio->subfield('609', '9'), $id, '612 moved to 609' );
is( $biblio->subfield('609', 'c'), undef, '609c cleared correctly' );
# Merge A to B postponed, delete B immediately (hits B < hits A)
# This proves the !@record_to test in sub merge
merge({ mergefrom => $id + 2, mergeto => $id + 1, MARCto => undef, biblionumbers => [ $biblionumber ] });
is( $biblio->subfield('609', '9'), $id, '612 moved to 609' );
is( $biblio->subfield('609', 'c'), undef, '609c cleared correctly' );
# Merge A to B postponed, delete B immediately (hits B < hits A)
# This proves the !@record_to test in sub merge
merge({ mergefrom => $id + 2, mergeto => $id + 1, MARCto => undef, biblionumbers => [ $biblionumber ] });
- $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ $biblio = Koha::Biblios->find($biblionumber)->metadata->record;
is( $biblio->field('612'), undef, 'Last 612 must be gone' );
# Show that we 'need' skip_merge; this example is far-fetched.
is( $biblio->field('612'), undef, 'Last 612 must be gone' );
# Show that we 'need' skip_merge; this example is far-fetched.
my $restored_mocks = set_mocks();
DelAuthority({ authid => $id, skip_merge => 1 }); # delete A
$restored_mocks->{auth_mod}->unmock_all;
my $restored_mocks = set_mocks();
DelAuthority({ authid => $id, skip_merge => 1 }); # delete A
$restored_mocks->{auth_mod}->unmock_all;
- $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ $biblio = Koha::Biblios->find($biblionumber)->metadata->record;
is( $biblio->subfield('109', '9'), $id, 'If the 109 is no longer present, another modify merge would not bring it back' );
# Bug 22437 now removes older postponed A->A merges in DelAuthority
is( $biblio->subfield('109', '9'), $id, 'If the 109 is no longer present, another modify merge would not bring it back' );
# Bug 22437 now removes older postponed A->A merges in DelAuthority
# Merge
merge({ mergefrom => $id1, MARCfrom => $authmarc, mergeto => $id2, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
# Merge
merge({ mergefrom => $id1, MARCfrom => $authmarc, mergeto => $id2, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
- $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ $biblio = Koha::Biblios->find($biblionumber)->metadata->record;
is( $biblio->subfield('612', '9'), $id2, 'id2 saved in $9' );
is( $biblio->subfield('612', 'a'), ' ', 'Kept an empty $a too' );
is( $biblio->subfield('612', '9'), $id2, 'id2 saved in $9' );
is( $biblio->subfield('612', 'a'), ' ', 'Kept an empty $a too' );
# Merge 109 and 609 and check order of subfields
merge({ mergefrom => $id, MARCfrom => $authmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
# Merge 109 and 609 and check order of subfields
merge({ mergefrom => $id, MARCfrom => $authmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
- my $biblio2 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio2 = Koha::Biblios->find($biblionumber)->metadata->record;
my $subfields = [ map { $_->[0] } $biblio2->field('109')->subfields ];
is_deeply( $subfields, [ 'i', 'a', 'b', 'c', '9' ], 'Merge only moved $9' );
$subfields = [ map { $_->[0] } $biblio2->field('609')->subfields ];
my $subfields = [ map { $_->[0] } $biblio2->field('109')->subfields ];
is_deeply( $subfields, [ 'i', 'a', 'b', 'c', '9' ], 'Merge only moved $9' );
$subfields = [ map { $_->[0] } $biblio2->field('609')->subfields ];
# Merge and check indicators and $2
merge({ mergefrom => $id, MARCfrom => $authmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
# Merge and check indicators and $2
merge({ mergefrom => $id, MARCfrom => $authmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
- my $biblio2 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio2 = Koha::Biblios->find($biblionumber)->metadata->record;
is( $biblio2->field('609')->indicator(1), '7', 'Indicator1 OK' );
is( $biblio2->field('609')->indicator(2), '7', 'Indicator2 OK' );
is( $biblio2->subfield('609', '2'), 'aat', 'Subfield $2 OK' );
is( $biblio2->field('609')->indicator(1), '7', 'Indicator1 OK' );
is( $biblio2->field('609')->indicator(2), '7', 'Indicator2 OK' );
is( $biblio2->subfield('609', '2'), 'aat', 'Subfield $2 OK' );
$authmarc->field('008')->update( (' 'x11).'a' ); # LOC, no $2 needed
AddAuthority( $authmarc, $id, $authtype1 ); # modify
merge({ mergefrom => $id, MARCfrom => $authmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
$authmarc->field('008')->update( (' 'x11).'a' ); # LOC, no $2 needed
AddAuthority( $authmarc, $id, $authtype1 ); # modify
merge({ mergefrom => $id, MARCfrom => $authmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] });
- $biblio2 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
+ $biblio2 = Koha::Biblios->find($biblionumber)->metadata->record;
is( $biblio2->subfield('609', '2'), undef, 'No subfield $2 left' );
};
is( $biblio2->subfield('609', '2'), undef, 'No subfield $2 left' );
};
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
-use C4::Biblio qw( GetMarcBiblio );
use C4::AuthoritiesMarc;
use Koha::Virtualshelves;
use C4::AuthoritiesMarc;
use Koha::Virtualshelves;
next;
}
my $biblio = $biblio_object->unblessed;
next;
}
my $biblio = $biblio_object->unblessed;
- my $record = &GetMarcBiblio({ biblionumber => $record_id });
+ my $record = $biblio_object->metadata->record;
$biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')];
$biblio->{holds_count} = $biblio_object->holds->count;
$biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );
$biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')];
$biblio->{holds_count} = $biblio_object->holds->count;
$biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id );
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user haspermission );
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user haspermission );
-use C4::Biblio qw( GetMarcBiblio );
use C4::Circulation qw( barcodedecode );
use C4::Context;
use C4::Koha qw(
use C4::Circulation qw( barcodedecode );
use C4::Context;
use C4::Koha qw(
while ( my $content = $contents->next ) {
my $this_item;
my $biblionumber = $content->biblionumber;
while ( my $content = $contents->next ) {
my $this_item;
my $biblionumber = $content->biblionumber;
- my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ my $record = $biblio->metadata->record;
$this_item->{XSLTBloc} = XSLTParse4Display(
{
$this_item->{XSLTBloc} = XSLTParse4Display(
{
my $marcflavour = C4::Context->preference("marcflavour");
my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
$itemtype = Koha::ItemTypes->find( $itemtype );
my $marcflavour = C4::Context->preference("marcflavour");
my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
$itemtype = Koha::ItemTypes->find( $itemtype );
- my $biblio = Koha::Biblios->find( $content->biblionumber );
$this_item->{title} = $biblio->title;
$this_item->{subtitle} = $biblio->subtitle;
$this_item->{medium} = $biblio->medium;
$this_item->{title} = $biblio->title;
$this_item->{subtitle} = $biblio->subtitle;
$this_item->{medium} = $biblio->medium;