From 2dbf08f5635e5af4f6a0e84e4aca7925e56e1b59 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 17 Apr 2019 06:02:59 +0000 Subject: [PATCH] Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls Test plan: Run tests, at least: t/db_dependent/Biblio.t t/db_dependent/Biblio/TransformHtmlToMarc.t t/db_dependent/Charset.t t/db_dependent/Circulation/GetTopIssues.t t/db_dependent/Filter_MARC_ViewPolicy.t t/db_dependent/ImportBatch.t t/db_dependent/Items.t t/db_dependent/Items/AutomaticItemModificationByAge.t t/db_dependent/Items/GetItemsForInventory.t t/db_dependent/Koha/Filter/EmbedItemsAvailability.t t/db_dependent/Serials.t t/db_dependent/XISBN.t t/db_dependent/FrameworkPlugin.t Signed-off-by: Josef Moravec --- C4/Acquisition.pm | 4 ++-- C4/Biblio.pm | 14 +++++++------- C4/Charset.pm | 2 +- C4/ImportBatch.pm | 8 ++++---- C4/Items.pm | 10 +++++----- C4/Labels/Label.pm | 2 +- C4/Matcher.pm | 2 +- C4/Search.pm | 8 ++++---- C4/Serials.pm | 2 +- Koha/Exporter/Record.pm | 2 +- Koha/Filter/MARC/EmbedItemsAvailability.pm | 2 +- Koha/Filter/MARC/EmbedSeeFromHeadings.pm | 2 +- Koha/FrameworkPlugin.pm | 1 - Koha/SearchEngine/Search.pm | 2 +- acqui/addorderiso2709.pl | 2 +- acqui/finishreceive.pl | 2 +- acqui/neworderempty.pl | 8 ++++---- catalogue/MARCdetail.pl | 2 +- cataloguing/addbiblio.pl | 20 ++++++++++---------- cataloguing/additem.pl | 20 ++++++++++---------- cataloguing/value_builder/barcode.pl | 5 +++-- cataloguing/value_builder/barcode_manual.pl | 4 ++-- circ/branchoverdues.pl | 2 +- misc/batchImportMARCWithBiblionumbers.pl | 2 +- misc/batchRebuildBiblioTables.pl | 2 +- misc/batchRebuildItemsTables.pl | 2 +- misc/migration_tools/22_to_30/missing090field.pl | 4 ++-- misc/migration_tools/bulkmarcimport.pl | 4 ++-- misc/migration_tools/rebuild_zebra.pl | 6 +++--- opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 6 +++--- serials/serials-edit.pl | 8 +------- svc/bib | 2 +- svc/new_bib | 2 +- t/db_dependent/Biblio.t | 2 +- t/db_dependent/Biblio/TransformHtmlToMarc.t | 2 +- t/db_dependent/Charset.t | 2 +- t/db_dependent/Circulation/GetTopIssues.t | 4 ++-- t/db_dependent/Filter_MARC_ViewPolicy.t | 6 +++--- t/db_dependent/ImportBatch.t | 2 +- t/db_dependent/Items.t | 4 ++-- .../Items/AutomaticItemModificationByAge.t | 2 +- t/db_dependent/Items/GetItemsForInventory.t | 2 +- t/db_dependent/Koha/Filter/EmbedItemsAvailability.t | 4 ++-- t/db_dependent/Serials.t | 4 ++-- t/db_dependent/XISBN.t | 4 ++-- tools/batchMod.pl | 8 ++++---- 47 files changed, 103 insertions(+), 109 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 6a8df0280a..50ca57e669 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1674,7 +1674,7 @@ sub CancelReceipt { for my $in ( @itemnumbers ) { my $item = Koha::Items->find( $in ); # FIXME We do not need that, we already have Koha::Items from $order_obj->items my $biblio = $item->biblio; - my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $biblio->frameworkcode ); + my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber' ); my $item_marc = C4::Items::GetMarcItem( $biblio->biblionumber, $in ); for my $affect ( @affects ) { my ( $sf, $v ) = split q{=}, $affect, 2; @@ -3238,7 +3238,7 @@ sub FillWithDefaultValues { my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } ); if ($tagslib) { my ($itemfield) = - C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' ); + C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' ); for my $tag ( sort keys %$tagslib ) { next unless $tag; next if $tag == $itemfield; diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 13926ef939..bf31ffecf7 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -336,7 +336,7 @@ sub _strip_item_fields { my $record = shift; my $frameworkcode = shift; # get the items before and append them to the biblio before updating the record, atm we just have the biblio - my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); + my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" ); # delete any item fields from incoming record to avoid # duplication or incorrect data - use AddItem() or ModItem() @@ -729,7 +729,7 @@ sub GetISBDView { my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd'; my $framework = $params->{framework}; my $itemtype = $framework; - my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype ); + my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch" ); my $tagslib = GetMarcStructure( 1, $itemtype, { unsafe => 1 } ); my $ISBD = C4::Context->preference($sysprefname); @@ -2811,7 +2811,7 @@ sub EmbedItemsInMarcBiblio { my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ?"); $sth->execute($biblionumber); - my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); + my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" ); my @item_fields; # Array holding the actual MARC data for items to be included. my @items; # Array holding items which are both in the list (sitenumbers) @@ -2863,9 +2863,9 @@ the MARC XML. sub _koha_marc_update_bib_ids { my ( $record, $frameworkcode, $biblionumber, $biblioitemnumber ) = @_; - my ( $biblio_tag, $biblio_subfield ) = GetMarcFromKohaField( "biblio.biblionumber", $frameworkcode ); + my ( $biblio_tag, $biblio_subfield ) = GetMarcFromKohaField( "biblio.biblionumber" ); die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag; - my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode ); + my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; if ( $biblio_tag < 10 ) { @@ -2894,7 +2894,7 @@ sub _koha_marc_update_biblioitem_cn_sort { my $biblioitem = shift; my $frameworkcode = shift; - my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.cn_sort", $frameworkcode ); + my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.cn_sort" ); return unless $biblioitem_tag; my ($cn_sort) = GetClassSort( $biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'} ); @@ -3531,7 +3531,7 @@ sub UpdateTotalIssues { return; } my $biblioitem = $biblio->biblioitem; - my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField('biblioitems.totalissues', $biblio->frameworkcode); + my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField( 'biblioitems.totalissues' ); unless ($totalissuestag) { return 1; # There is nothing to do } diff --git a/C4/Charset.pm b/C4/Charset.pm index 4dff14c9ba..c6e36a1307 100644 --- a/C4/Charset.pm +++ b/C4/Charset.pm @@ -440,7 +440,7 @@ sub SanitizeRecord { my $record_modified = 0; my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber); my ( $url_field, $url_subfield ) = - C4::Biblio::GetMarcFromKohaField( 'biblioitems.url', $frameworkcode ); + C4::Biblio::GetMarcFromKohaField( 'biblioitems.url' ); foreach my $field ( $record->fields() ) { if ( $field->is_control_field() ) { my $value = $field->data(); diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 99bc428701..8491e6baef 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -195,7 +195,7 @@ sub GetRecordFromImportBiblio { sub EmbedItemsInImportBiblio { my ( $record, $import_record_id ) = @_; - my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber", ''); + my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" ); my $dbh = C4::Context->dbh; my $import_items = $dbh->selectall_arrayref(q| SELECT import_items.marcxml @@ -459,7 +459,7 @@ sub AddItemsToImportBiblio { my @import_items_ids = (); my $dbh = C4::Context->dbh; - my ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",''); + my ($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" ); foreach my $item_field ($marc_record->field($item_tag)) { my $item_marc = MARC::Record->new(); $item_marc->leader("00000 a "); # must set Leader/09 to 'a' @@ -618,7 +618,7 @@ sub BatchCommitRecords { if ($record_type eq 'biblio') { # remove any item tags - rely on BatchCommitItems - ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",''); + ($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" ); foreach my $item_field ($marc_record->field($item_tag)) { $marc_record->delete_field($item_field); } @@ -743,7 +743,7 @@ sub BatchCommitItems { my $item_marc = MARC::Record->new_from_xml( StripNonXmlChars( $row->{'marcxml'} ), 'UTF-8', $row->{'encoding'} ); # Delete date_due subfield as to not accidentally delete item checkout due dates - my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.onloan', GetFrameworkCode($biblionumber) ); + my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.onloan' ); $item_marc->field($MARCfield)->delete_subfield( code => $MARCsubfield ); my $item = TransformMarcToKoha( $item_marc ); diff --git a/C4/Items.pm b/C4/Items.pm index fdf262f7ed..ee07aca13b 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -176,7 +176,7 @@ sub AddItemFromMarc { # parse item hash from MARC my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber); - my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); + my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); my $localitemmarc = MARC::Record->new; $localitemmarc->append_fields( $source_item_marc->field($itemtag) ); @@ -304,7 +304,7 @@ sub AddItemBatchFromMarc { $record = $record->clone(); # loop through the item tags and start creating items my @bad_item_fields = (); - my ($itemtag, $itemsubfield) = C4::Biblio::GetMarcFromKohaField("items.itemnumber",''); + my ($itemtag, $itemsubfield) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); my $item_sequence_num = 0; ITEMFIELD: foreach my $item_field ($record->field($itemtag)) { $item_sequence_num++; @@ -438,7 +438,7 @@ sub ModItemFromMarc { my $itemnumber = shift; my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber); - my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); + my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); my $localitemmarc = MARC::Record->new; $localitemmarc->append_fields( $item_marc->field($itemtag) ); @@ -1928,7 +1928,7 @@ sub _marc_from_item_hash { my $item_marc = MARC::Record->new(); foreach my $item_field ( keys %{$mungeditem} ) { - my ( $tag, $subfield ) = C4::Biblio::GetMarcFromKohaField( $item_field, $frameworkcode ); + my ( $tag, $subfield ) = C4::Biblio::GetMarcFromKohaField( $item_field ); next unless defined $tag and defined $subfield; # skip if not mapped to MARC field my @values = split(/\s?\|\s?/, $mungeditem->{$item_field}, -1); foreach my $value (@values){ @@ -2350,7 +2350,7 @@ sub PrepareItemrecordDisplay { my $dbh = C4::Context->dbh; $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum; - my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); + my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); # Note: $tagslib obtained from GetMarcStructure() in 'unsafe' mode is # a shared data structure. No plugin (including custom ones) should change diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm index cecf91fac1..9ce6c0e580 100644 --- a/C4/Labels/Label.pm +++ b/C4/Labels/Label.pm @@ -159,7 +159,7 @@ sub _get_barcode_data { elsif ( $f =~ /^([0-9a-z]{3})(\w)(\W?).*?/ ) { my ($field,$subf,$ws) = ($1,$2,$3); my $subf_data; - my ($itemtag, $itemsubfieldcode) = &GetMarcFromKohaField("items.itemnumber",''); + my ($itemtag, $itemsubfieldcode) = &GetMarcFromKohaField( "items.itemnumber" ); my @marcfield = $record->field($field); if(@marcfield) { if($field eq $itemtag) { # item-level data, we need to get the right item. diff --git a/C4/Matcher.pm b/C4/Matcher.pm index dc848048c1..014d19b6b1 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -677,7 +677,7 @@ sub get_matches { else { if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { foreach my $matched ( @{$searchresults} ) { - my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", $marcframework_used ); + my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" ); my $id = ( $biblionumber_tag > 10 ) ? $matched->field($biblionumber_tag)->subfield($biblionumber_subfield) : $matched->field($biblionumber_tag)->data(); diff --git a/C4/Search.pm b/C4/Search.pm index 1a9f51b4e1..b1c6193fa9 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1883,14 +1883,14 @@ sub searchResults { my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed }; #search item field code - my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" ); + my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber" ); ## find column names of items related to MARC my %subfieldstosearch; my @columns = Koha::Database->new()->schema()->resultset('Item')->result_source->columns; for my $column ( @columns ) { my ( $tagfield, $tagsubfield ) = - &GetMarcFromKohaField( "items." . $column, "" ); + &GetMarcFromKohaField( "items." . $column ); if ( defined $tagsubfield ) { $subfieldstosearch{$column} = $tagsubfield; } @@ -1907,7 +1907,7 @@ sub searchResults { my $marcflavour = C4::Context->preference("marcflavour"); # We get the biblionumber position in MARC - my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber',''); + my ($bibliotag,$bibliosubf)=GetMarcFromKohaField( 'biblio.biblionumber' ); # set stuff for XSLT processing here once, not later again for every record we retrieved my $xslfile; @@ -2030,7 +2030,7 @@ sub searchResults { my $hostbiblio = GetMarcBiblio({ biblionumber => $hostbiblionumber, embed_items => 1 }); - my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); + my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber' ); if( $hostbiblio ) { my @hostitems = $hostbiblio->field($itemfield); foreach my $hostitem (@hostitems){ diff --git a/C4/Serials.pm b/C4/Serials.pm index f8c17b9189..0735696a2e 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1446,7 +1446,7 @@ sub NewSubscription { my $biblio = Koha::Biblios->find( $biblionumber ); if ( $biblio and !$biblio->serial ) { my $record = GetMarcBiblio({ biblionumber => $biblionumber }); - my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $biblio->frameworkcode ); + my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial' ); if ($tag) { eval { $record->field($tag)->update( $subf => 1 ); }; } diff --git a/Koha/Exporter/Record.pm b/Koha/Exporter/Record.pm index 42ac002595..eaebe57639 100644 --- a/Koha/Exporter/Record.pm +++ b/Koha/Exporter/Record.pm @@ -131,7 +131,7 @@ sub _get_biblio_for_export { item_numbers => $itemnumbers }); if ($only_export_items_for_branches && @$only_export_items_for_branches) { my %export_items_for_branches = map { $_ => 1 } @$only_export_items_for_branches; - my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch', '' ); # Should be GetFrameworkCode( $biblionumber )? + my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch' ); for my $itemfield ( $record->field($homebranchfield) ) { my $homebranch = $itemfield->subfield($homebranchsubfield); diff --git a/Koha/Filter/MARC/EmbedItemsAvailability.pm b/Koha/Filter/MARC/EmbedItemsAvailability.pm index fed3aa2d11..c3bb4a3d16 100644 --- a/Koha/Filter/MARC/EmbedItemsAvailability.pm +++ b/Koha/Filter/MARC/EmbedItemsAvailability.pm @@ -71,7 +71,7 @@ sub _processrecord { my $record = shift; - my ($biblionumber_field, $biblionumber_subfield) = GetMarcFromKohaField("biblio.biblionumber", ''); + my ($biblionumber_field, $biblionumber_subfield) = GetMarcFromKohaField( "biblio.biblionumber" ); my $biblionumber = ( $biblionumber_field > 9 ) ? $record->field($biblionumber_field)->subfield($biblionumber_subfield) : $record->field($biblionumber_field)->data(); diff --git a/Koha/Filter/MARC/EmbedSeeFromHeadings.pm b/Koha/Filter/MARC/EmbedSeeFromHeadings.pm index 631a9d9095..fa8472022d 100644 --- a/Koha/Filter/MARC/EmbedSeeFromHeadings.pm +++ b/Koha/Filter/MARC/EmbedSeeFromHeadings.pm @@ -72,7 +72,7 @@ sub filter { sub _processrecord { my $record = shift; - my ($item_tag) = GetMarcFromKohaField("items.itemnumber", ''); + my ($item_tag) = GetMarcFromKohaField( "items.itemnumber" ); $item_tag ||= ''; foreach my $field ( $record->fields() ) { diff --git a/Koha/FrameworkPlugin.pm b/Koha/FrameworkPlugin.pm index 418c0a3ab3..2abe75ed15 100644 --- a/Koha/FrameworkPlugin.pm +++ b/Koha/FrameworkPlugin.pm @@ -115,7 +115,6 @@ use Modern::Perl; use base qw(Class::Accessor); use C4::Context; -use C4::Biblio qw/GetMarcFromKohaField/; __PACKAGE__->mk_ro_accessors( qw| name path errstr javascript noclick diff --git a/Koha/SearchEngine/Search.pm b/Koha/SearchEngine/Search.pm index fdaf7d373d..d65dd368d7 100644 --- a/Koha/SearchEngine/Search.pm +++ b/Koha/SearchEngine/Search.pm @@ -68,7 +68,7 @@ extract_biblionumber method of the specific search engine. sub extract_biblionumber { my ( $record ) = @_; return if ref($record) ne 'MARC::Record'; - my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( 'biblio.biblionumber', '' ); + my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( 'biblio.biblionumber' ); if( $biblionumbertagfield < 10 ) { my $controlfield = $record->field( $biblionumbertagfield ); return $controlfield ? $controlfield->data : undef; diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 1921a5af6e..d85680eb85 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -182,7 +182,7 @@ if ($op eq ""){ my $bibitemnum; # remove ISBN - - my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn', '' ); + my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn' ); if ( $marcrecord->field($isbnfield) ) { foreach my $field ( $marcrecord->field($isbnfield) ) { foreach my $subfield ( $field->subfield($isbnsubfield) ) { diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 90faed39e2..64aa9f5ad4 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -82,7 +82,7 @@ if ($quantityrec > $origquantityrec ) { my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived"); if ( @affects ) { my $frameworkcode = GetFrameworkCode($biblionumber); - my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $frameworkcode ); + my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber' ); for my $in ( @received_items ) { my $item = C4::Items::GetMarcItem( $biblionumber, $in ); for my $affect ( @affects ) { diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 9ca2b5b05a..86e7339194 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -177,7 +177,7 @@ if ( $ordernumber eq '' and defined $params->{'breedingid'}){ my ( @order_user_ids, @order_users, @catalog_details ); our $tagslib = GetMarcStructure(1, 'ACQ', { unsafe => 1 } ); -my ( $itemnumber_tag, $itemnumber_subtag ) = GetMarcFromKohaField( 'items.itemnumber', 'ACQ' ); +my ( $itemnumber_tag, $itemnumber_subtag ) = GetMarcFromKohaField( 'items.itemnumber' ); if ( not $ordernumber ) { # create order $new = 'yes'; @@ -388,7 +388,7 @@ if ( defined $from_subscriptionid ) { } # Find the items.barcode subfield for barcode validations -my (undef, $barcode_subfield) = GetMarcFromKohaField('items.barcode', ''); +my (undef, $barcode_subfield) = GetMarcFromKohaField( 'items.barcode' ); # fill template $template->param( @@ -491,7 +491,7 @@ sub MARCfindbreeding { # remove the - in isbn, koha store isbn without any - if ($marc) { my $record = MARC::Record->new_from_usmarc($marc); - my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField('biblioitems.isbn',''); + my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField( 'biblioitems.isbn' ); if ( $record->field($isbnfield) ) { foreach my $field ( $record->field($isbnfield) ) { foreach my $subfield ( $field->subfield($isbnsubfield) ) { @@ -523,7 +523,7 @@ sub MARCfindbreeding { if ( C4::Context->preference("z3950NormalizeAuthor") and C4::Context->preference("z3950AuthorAuthFields") ) { - my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author", ''); + my ( $tag, $subfield ) = GetMarcFromKohaField( "biblio.author" ); my $auth_fields = C4::Context->preference("z3950AuthorAuthFields"); diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 7e67b564e1..d2d935d23f 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -280,7 +280,7 @@ foreach my $field (@fields) { push @item_loop, $item if $item; } -my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$frameworkcode); +my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField( "items.holdingbranch" ); @item_loop = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @item_loop; @item_subfield_codes = uniq @item_subfield_codes; diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index c4ed49da87..6fc169c3cb 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -72,7 +72,7 @@ sub MARCfindbreeding { # remove the - in isbn, koha store isbn without any - if ($marc) { my $record = MARC::Record->new_from_usmarc($marc); - my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField('biblioitems.isbn',''); + my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField( 'biblioitems.isbn' ); if ( $record->field($isbnfield) ) { foreach my $field ( $record->field($isbnfield) ) { foreach my $subfield ( $field->subfield($isbnsubfield) ) { @@ -105,7 +105,7 @@ sub MARCfindbreeding { and C4::Context->preference("z3950AuthorAuthFields") and C4::Context->preference("marcflavour") eq 'UNIMARC' ) { - my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author", ''); + my ( $tag, $subfield ) = GetMarcFromKohaField( "biblio.author" ); my $auth_fields = C4::Context->preference("z3950AuthorAuthFields"); @@ -249,11 +249,11 @@ sub CreateKey { sub GetMandatoryFieldZ3950 { my $frameworkcode = shift; - my @isbn = GetMarcFromKohaField('biblioitems.isbn',$frameworkcode); - my @title = GetMarcFromKohaField('biblio.title',$frameworkcode); - my @author = GetMarcFromKohaField('biblio.author',$frameworkcode); - my @issn = GetMarcFromKohaField('biblioitems.issn',$frameworkcode); - my @lccn = GetMarcFromKohaField('biblioitems.lccn',$frameworkcode); + my @isbn = GetMarcFromKohaField( 'biblioitems.isbn' ); + my @title = GetMarcFromKohaField( 'biblio.title' ); + my @author = GetMarcFromKohaField( 'biblio.author' ); + my @issn = GetMarcFromKohaField( 'biblioitems.issn' ); + my @lccn = GetMarcFromKohaField( 'biblioitems.lccn' ); return { $isbn[0].$isbn[1] => 'isbn', @@ -801,10 +801,10 @@ if ($biblionumber) { # if it's a modif, retrieve bibli and biblioitem numbers for the future modification of old-DB. ( $biblionumbertagfield, $biblionumbertagsubfield ) = - &GetMarcFromKohaField( "biblio.biblionumber", $frameworkcode ); + &GetMarcFromKohaField( "biblio.biblionumber" ); ( $biblioitemnumtagfield, $biblioitemnumtagsubfield ) = - &GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode ); - + &GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); + # search biblioitems value my $sth = $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?"); $sth->execute($biblionumber); diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 48417aac5d..e4becd952b 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -95,7 +95,7 @@ sub set_item_default_location { # NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript sub _increment_barcode { my ($record, $frameworkcode) = @_; - my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); + my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" ); unless ($record->field($tagfield)->subfield($tagsubfield)) { my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items"); $sth_barcode->execute; @@ -353,7 +353,7 @@ sub removeFieldsForPrefill { my $item = shift; # Getting item tag - my ($tag, $subtag) = GetMarcFromKohaField("items.barcode", ''); + my ($tag, $subtag) = GetMarcFromKohaField( "items.barcode" ); # Getting list of subfields to keep my $subfieldsToUseWhenPrefill = C4::Context->preference('SubfieldsToUseWhenPrefill'); @@ -522,7 +522,7 @@ if ($op eq "additem") { } else { # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin - my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); + my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" ); my $fieldItem = $itemrecord->field($tagfield); $itemrecord->delete_field($fieldItem); $fieldItem->delete_subfields($tagsubfield); @@ -538,8 +538,8 @@ if ($op eq "additem") { my $barcodeobj = C4::Barcodes->new; my $copynumber = $addedolditem->{'copynumber'}; my $oldbarcode = $addedolditem->{'barcode'}; - my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); - my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField("items.copynumber",$frameworkcode); + my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" ); + my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField( "items.copynumber" ); # If there is a barcode and we can't find their new values, we can't add multiple copies my $testbarcode; @@ -625,7 +625,7 @@ if ($op eq "additem") { } else { # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin - my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); + my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" ); my $fieldItem = $itemrecord->field($tagfield); $itemrecord->delete_field($fieldItem); $fieldItem->delete_subfields($tagsubfield); @@ -744,8 +744,8 @@ my $temp = GetMarcBiblio({ biblionumber => $biblionumber }); 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 -my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", $frameworkcode); -my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", $frameworkcode); +my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); +my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); C4::Biblio::EmbedItemsInMarcBiblio({ marc_record => $temp, biblionumber => $biblionumber }); @@ -767,7 +767,7 @@ if ( C4::Context->preference('EasyAnalyticalRecords') ) { biblionumber => $hostbiblionumber, embed_items => 1 }); if ($hostrecord) { - my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); + my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber' ); foreach my $hostitem ($hostrecord->field($itemfield)){ if ($hostitem->subfield('9') eq $hostfield->subfield('9')){ push (@fields, $hostitem); @@ -827,7 +827,7 @@ foreach my $field (@fields) { } } -my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$frameworkcode); +my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField( "items.holdingbranch" ); @big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array; # now, construct template ! diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl index 3bd49f2280..4c7072631c 100755 --- a/cataloguing/value_builder/barcode.pl +++ b/cataloguing/value_builder/barcode.pl @@ -24,6 +24,7 @@ use Modern::Perl; use C4::Context; use C4::Barcodes::ValueBuilder; +use C4::Biblio qw/GetMarcFromKohaField/; use Koha::DateUtils; use Algorithm::CheckDigits; @@ -37,8 +38,8 @@ my $builder = sub { # find today's date ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 })); - ($args{tag},$args{subfield}) = GetMarcFromKohaField("items.barcode", ''); - ($args{loctag},$args{locsubfield}) = GetMarcFromKohaField("items.homebranch", ''); + ($args{tag},$args{subfield}) = GetMarcFromKohaField( "items.barcode" ); + ($args{loctag},$args{locsubfield}) = GetMarcFromKohaField( "items.homebranch" ); my $nextnum; my $scr; diff --git a/cataloguing/value_builder/barcode_manual.pl b/cataloguing/value_builder/barcode_manual.pl index a0357697b6..8399ecfb81 100755 --- a/cataloguing/value_builder/barcode_manual.pl +++ b/cataloguing/value_builder/barcode_manual.pl @@ -38,8 +38,8 @@ my $builder = sub { # find today's date ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 })); - ($args{tag},$args{subfield}) = GetMarcFromKohaField("items.barcode", ''); - ($args{loctag},$args{locsubfield}) = GetMarcFromKohaField("items.homebranch", ''); + ($args{tag},$args{subfield}) = GetMarcFromKohaField( "items.barcode" ); + ($args{loctag},$args{locsubfield}) = GetMarcFromKohaField( "items.homebranch" ); my $nextnum; my $scr; diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index d4c20cbb18..8a389f3009 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -64,7 +64,7 @@ my @overduesloop; my @getoverdues = GetOverduesForBranch( $default, $location ); $debug and warn "HERE : $default / $location" . Dumper(@getoverdues); # search for location authorised value -my ($tag,$subfield) = GetMarcFromKohaField('items.location',''); +my ($tag,$subfield) = GetMarcFromKohaField( 'items.location' ); my $tagslib = &GetMarcStructure(1,''); if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { my $values= GetAuthorisedValues($tagslib->{$tag}->{$subfield}->{authorised_value}); diff --git a/misc/batchImportMARCWithBiblionumbers.pl b/misc/batchImportMARCWithBiblionumbers.pl index 36781c201e..02f275d61d 100755 --- a/misc/batchImportMARCWithBiblionumbers.pl +++ b/misc/batchImportMARCWithBiblionumbers.pl @@ -53,7 +53,7 @@ my $fh = IO::File->new($input_marc_file); # don't let MARC::Batch open the file, my $batch = MARC::Batch->new( 'USMARC', $fh ); $batch->warnings_off(); $batch->strict_off(); -my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",""); +my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField( "biblio.biblionumber" ); my $i=0; while ( my $record = $batch->next() ) { diff --git a/misc/batchRebuildBiblioTables.pl b/misc/batchRebuildBiblioTables.pl index f9bd21800b..d66c4ce6db 100755 --- a/misc/batchRebuildBiblioTables.pl +++ b/misc/batchRebuildBiblioTables.pl @@ -53,7 +53,7 @@ $|=1; # flushes output $starttime = gettimeofday; #1st of all, find item MARC tag. -my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.itemnumber",''); +my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); # $dbh->do("lock tables biblio write, biblioitems write, items write, marc_biblio write, marc_subfield_table write, marc_blob_subfield write, marc_word write, marc_subfield_structure write"); my $sth = $dbh->prepare("SELECT biblionumber FROM biblio"); $sth->execute; diff --git a/misc/batchRebuildItemsTables.pl b/misc/batchRebuildItemsTables.pl index f1e13003ed..5bb40e5d35 100755 --- a/misc/batchRebuildItemsTables.pl +++ b/misc/batchRebuildItemsTables.pl @@ -57,7 +57,7 @@ my $mergelimit = C4::Context->preference('AuthorityMergeLimit'); $dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); $dbh->do("UPDATE systempreferences SET value=0 where variable='AuthorityMergeLimit'"); $dbh->commit() unless $test_parameter; -my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber", '' ); +my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber" ); #dbh query init my $query = diff --git a/misc/migration_tools/22_to_30/missing090field.pl b/misc/migration_tools/22_to_30/missing090field.pl index 5d386330ef..dd28111c69 100755 --- a/misc/migration_tools/22_to_30/missing090field.pl +++ b/misc/migration_tools/22_to_30/missing090field.pl @@ -37,8 +37,8 @@ sub MARCmodbiblionumber{ return unless $record; - my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",""); - my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField("biblio.biblioitemnumber",""); + my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField( "biblio.biblionumber" ); + my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField( "biblio.biblioitemnumber" ); my $update=0; if (defined $record) { diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 5e03ca1d73..bc438aac38 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -240,7 +240,7 @@ if ($authorities){ } else { ( $tagid, $subfieldid ) = - GetMarcFromKohaField( "biblio.biblionumber", $framework ); + GetMarcFromKohaField( "biblio.biblionumber" ); $tagid||="001"; } @@ -506,7 +506,7 @@ RECORD: while ( ) { } if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) { # Find the record called 'barcode' - my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField('items.barcode', $framework); + my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField( 'items.barcode' ); # Now remove any items that didn't have a duplicate_barcode error, # erase the barcodes on items that did, and re-add those items. my %dupes; diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 65ccff51b6..49cfc6687f 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -171,8 +171,8 @@ my $authorityserverdir = C4::Context->zebraconfig('authorityserver')->{directory my $kohadir = C4::Context->config('intranetdir'); -my ($biblionumbertagfield,$biblionumbertagsubfield) = C4::Biblio::GetMarcFromKohaField("biblio.biblionumber",""); -my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = C4::Biblio::GetMarcFromKohaField("biblioitems.biblioitemnumber",""); +my ($biblionumbertagfield,$biblionumbertagsubfield) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" ); +my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = C4::Biblio::GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); my $marcxml_open = q{ @@ -495,7 +495,7 @@ sub export_marc_records_from_sth { print {$fh} $marcxml_open; my $i = 0; - my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField("items.itemnumber",''); + my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" ); while (my ($record_number) = $sth->fetchrow_array) { print "." if ( $verbose_logging ); print "\r$i" unless ($i++ %100 or !$verbose_logging); diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index ed39f72ca0..07c2405371 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -97,7 +97,7 @@ if ( ! $record ) { my @all_items = GetItemsInfo($biblionumber); my $biblio = Koha::Biblios->find( $biblionumber ); my $framework = $biblio ? $biblio->frameworkcode : q{}; -my ($tag_itemnumber, $subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework); +my ($tag_itemnumber, $subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' ); my @nonhiddenitems = $record->field($tag_itemnumber); if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) { print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 4867eda860..d1f0eaf968 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -105,7 +105,7 @@ my @all_items = GetItemsInfo($biblionumber); my $biblio = Koha::Biblios->find( $biblionumber ); my $framework = $biblio ? $biblio->frameworkcode : q{}; my $tagslib = &GetMarcStructure( 0, $framework ); -my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework); +my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' ); my @nonhiddenitems = $record->field($tag_itemnumber); if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); @@ -129,7 +129,7 @@ if(my $cart_list = $query->cookie("bib_list")){ } } -my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$framework); +my ($bt_tag,$bt_subtag) = GetMarcFromKohaField( 'biblio.title' ); $template->param( bibliotitle => $biblio->title, ) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible. @@ -307,7 +307,7 @@ foreach my $field (@fields) { push @item_loop, $item if $item; } my ( $holdingbrtagf, $holdingbrtagsubf ) = - &GetMarcFromKohaField( "items.holdingbranch", $framework ); + &GetMarcFromKohaField( "items.holdingbranch" ); @item_loop = sort { ($a->{$holdingbrtagsubf}||'') cmp ($b->{$holdingbrtagsubf}||'') } @item_loop; diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index 33e11ad3bc..c35abab711 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -339,13 +339,7 @@ if ( $op and $op eq 'serialchangestatus' ) { #New Item # if autoBarcode is set to 'incremental', calculate barcode... - my ( $barcodetagfield, $barcodetagsubfield ) = - GetMarcFromKohaField( - 'items.barcode', - GetFrameworkCode( - $serialdatalist[0]->{'biblionumber'} - ) - ); + my ( $barcodetagfield, $barcodetagsubfield ) = GetMarcFromKohaField( 'items.barcode' ); if ( C4::Context->preference('autoBarcode') eq 'incremental' ) { diff --git a/svc/bib b/svc/bib index 1cb176e777..50580e820e 100755 --- a/svc/bib +++ b/svc/bib @@ -98,7 +98,7 @@ sub update_bib { } else { my $fullrecord = $record->clone(); my ( $itemtag, $itemsubfield ) = - GetMarcFromKohaField( "items.itemnumber", '' ); + GetMarcFromKohaField( "items.itemnumber" ); # delete any item tags foreach my $field ( $record->field($itemtag) ) { diff --git a/svc/new_bib b/svc/new_bib index 32e6fb10ae..d9586dd855 100755 --- a/svc/new_bib +++ b/svc/new_bib @@ -70,7 +70,7 @@ sub add_bib { # delete any item tags my ( $itemtag, $itemsubfield ) = - GetMarcFromKohaField( "items.itemnumber", '' ); + GetMarcFromKohaField( "items.itemnumber" ); foreach my $field ( $record->field($itemtag) ) { $record->delete_field($field); } diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t index 60ccde3a18..9a98c83ceb 100755 --- a/t/db_dependent/Biblio.t +++ b/t/db_dependent/Biblio.t @@ -319,7 +319,7 @@ sub run_tests { biblionumber => $biblionumber, embed_items => 0 }); my $frameworkcode = GetFrameworkCode($biblionumber); - my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode ); + my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; my $biblioitemnumbertotest; if ( $biblioitem_tag < 10 ) { diff --git a/t/db_dependent/Biblio/TransformHtmlToMarc.t b/t/db_dependent/Biblio/TransformHtmlToMarc.t index 93c33cf0d7..e3b3a06c2f 100644 --- a/t/db_dependent/Biblio/TransformHtmlToMarc.t +++ b/t/db_dependent/Biblio/TransformHtmlToMarc.t @@ -7,7 +7,7 @@ use Test::More tests => 2; use C4::Biblio; -my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", '' ); +my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" ); subtest 'Biblio record' => sub { plan tests => 10; my $leader = '00203nam a2200097 4500'; diff --git a/t/db_dependent/Charset.t b/t/db_dependent/Charset.t index 99837c2d97..b1542a3b82 100644 --- a/t/db_dependent/Charset.t +++ b/t/db_dependent/Charset.t @@ -21,7 +21,7 @@ $dbh->do(qq| INSERT INTO marc_subfield_structure(frameworkcode,kohafield,tagfield,tagsubfield) VALUES ('$frameworkcode', 'biblioitems.url', '856', 'u') |); -my ( $url_field, $url_subfield ) = C4::Biblio::GetMarcFromKohaField('biblioitems.url', $frameworkcode); +my ( $url_field, $url_subfield ) = C4::Biblio::GetMarcFromKohaField( 'biblioitems.url' ); my $title = q|My title & a word & another word|; my $url = q|http://www.example.org/index.pl?arg1=val1&arg2=val2|; diff --git a/t/db_dependent/Circulation/GetTopIssues.t b/t/db_dependent/Circulation/GetTopIssues.t index b35f35aba2..71a8cb319d 100644 --- a/t/db_dependent/Circulation/GetTopIssues.t +++ b/t/db_dependent/Circulation/GetTopIssues.t @@ -117,8 +117,8 @@ $schema->storage->txn_rollback(); sub create_biblio { my ($title, $itemtype) = @_; - my ($title_tag, $title_subfield) = GetMarcFromKohaField('biblio.title', ''); - my ($it_tag, $it_subfield) = GetMarcFromKohaField('biblioitems.itemtype', ''); + my ($title_tag, $title_subfield) = GetMarcFromKohaField( 'biblio.title' ); + my ($it_tag, $it_subfield) = GetMarcFromKohaField( 'biblioitems.itemtype' ); my $record = MARC::Record->new(); $record->append_fields( diff --git a/t/db_dependent/Filter_MARC_ViewPolicy.t b/t/db_dependent/Filter_MARC_ViewPolicy.t index 64759fa5bb..a873a5379a 100644 --- a/t/db_dependent/Filter_MARC_ViewPolicy.t +++ b/t/db_dependent/Filter_MARC_ViewPolicy.t @@ -59,7 +59,7 @@ sub run_hiding_tests { }; my ( $isbn_field, $isbn_subfield ) = - GetMarcFromKohaField( 'biblioitems.isbn', q{} ); + GetMarcFromKohaField( 'biblioitems.isbn' ); my $update_sql = q{UPDATE marc_subfield_structure SET hidden=? }; my $sth = $dbh->prepare($update_sql); foreach my $hidden_value (@valid_hidden_values) { @@ -170,9 +170,9 @@ sub run_hiding_tests { sub create_marc_record { my ( $title_field, $title_subfield ) = - GetMarcFromKohaField( 'biblio.title', q{} ); + GetMarcFromKohaField( 'biblio.title' ); my ( $isbn_field, $isbn_subfield ) = - GetMarcFromKohaField( 'biblioitems.isbn', q{} ); + GetMarcFromKohaField( 'biblioitems.isbn' ); my $isbn = '0590353403'; my $title = 'Foundation'; my $marc_record = MARC::Record->new; diff --git a/t/db_dependent/ImportBatch.t b/t/db_dependent/ImportBatch.t index f42e0d8822..ca1915e603 100644 --- a/t/db_dependent/ImportBatch.t +++ b/t/db_dependent/ImportBatch.t @@ -86,7 +86,7 @@ my $record = MARC::Record->new; my $original_record = MARC::Record->new; $record->leader('03174nam a2200445 a 4500'); $original_record->leader('03174nam a2200445 a 4500'); -my ($item_tag, $item_subfield) = C4::Biblio::GetMarcFromKohaField('items.itemnumber',''); +my ($item_tag, $item_subfield) = C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' ); my @fields = ( MARC::Field->new( 100, '1', ' ', diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index 4744cff4e5..3288222040 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -474,7 +474,7 @@ subtest 'SearchItems test' => sub { ok($found, "item1 found"); my $frameworkcode = q||; - my ($itemfield) = GetMarcFromKohaField('items.itemnumber', $frameworkcode); + my ($itemfield) = GetMarcFromKohaField( 'items.itemnumber' ); # Create item subfield 'z' without link $dbh->do('DELETE FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=?', undef, $itemfield, $frameworkcode); @@ -627,7 +627,7 @@ subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub { t::lib::Mocks::mock_preference( 'OpacHiddenItems', '' ); my ($itemfield) = - C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' ); + C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' ); my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber }); warning_is { C4::Biblio::EmbedItemsInMarcBiblio() } { carped => 'EmbedItemsInMarcBiblio: No MARC record passed' }, diff --git a/t/db_dependent/Items/AutomaticItemModificationByAge.t b/t/db_dependent/Items/AutomaticItemModificationByAge.t index d81c9e2e36..33f85ecbbb 100644 --- a/t/db_dependent/Items/AutomaticItemModificationByAge.t +++ b/t/db_dependent/Items/AutomaticItemModificationByAge.t @@ -66,7 +66,7 @@ my ($item_bibnum, $item_bibitemnum, $itemnumber) = C4::Items::AddItem( my $item = Koha::Items->find( $itemnumber ); is ( $item->new_status, 'new_value', q|AddItem insert the 'new_status' field| ); -my ( $tagfield, undef ) = GetMarcFromKohaField('items.itemnumber', $frameworkcode); +my ( $tagfield, undef ) = GetMarcFromKohaField( 'items.itemnumber' ); my $marc_item = C4::Items::GetMarcItem( $biblionumber, $itemnumber ); is( $marc_item->subfield($tagfield, $new_tagfield), 'new_value', q|Koha mapping is correct|); diff --git a/t/db_dependent/Items/GetItemsForInventory.t b/t/db_dependent/Items/GetItemsForInventory.t index d2bb43f77c..56ca417e92 100755 --- a/t/db_dependent/Items/GetItemsForInventory.t +++ b/t/db_dependent/Items/GetItemsForInventory.t @@ -287,7 +287,7 @@ sub OldWay { # FIXME Do we really still need so much code to check results ?? # Auth values foreach my $field (sort keys %$row) { # If the koha field is mapped to a marc field - my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'}); + my ($f, $sf) = C4::Biblio::GetMarcFromKohaField( "items.$field" ); if (defined($f) and defined($sf)) { # We replace the code with it's description my $avs; diff --git a/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t b/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t index 797ebb79c7..2cf381bd60 100755 --- a/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t +++ b/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t @@ -40,7 +40,7 @@ subtest 'EmbedItemsAvailability tests' => sub { my $biblio = Test::MockModule->new('C4::Biblio'); $biblio->mock( 'GetMarcFromKohaField', sub { - my ( $kohafield, $frameworkcode ) = @_; + my ( $kohafield ) = @_; if ( $kohafield eq 'biblio.biblionumber' ) { if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { return ( '001', '@' ); @@ -51,7 +51,7 @@ subtest 'EmbedItemsAvailability tests' => sub { } else { my $func_ref = $biblio->original( 'GetMarcFromKohaField' ); - &$func_ref( $kohafield, $frameworkcode ); + &$func_ref( $kohafield ); } }); diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t index 8956514bfd..138d3459da 100755 --- a/t/db_dependent/Serials.t +++ b/t/db_dependent/Serials.t @@ -145,8 +145,8 @@ subtest 'Values should not be erased on editing' => sub { my $biblio = $builder->build_sample_biblio(); my $biblionumber = $biblio->biblionumber; - my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' ); - my ( $it_tag, $it_sf ) = GetMarcFromKohaField( 'items.itype', '' ); + my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber' ); + my ( $it_tag, $it_sf ) = GetMarcFromKohaField( 'items.itype' ); my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype}; my $itemcallnumber = 'XXXmy itemcallnumberXXX'; diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t index 803743a787..e6e2f818c5 100755 --- a/t/db_dependent/XISBN.t +++ b/t/db_dependent/XISBN.t @@ -29,9 +29,9 @@ my $errors; my $context = C4::Context->new; my ( $biblionumber_tag, $biblionumber_subfield ) = - GetMarcFromKohaField( 'biblio.biblionumber', '' ); + GetMarcFromKohaField( 'biblio.biblionumber' ); my ( $isbn_tag, $isbn_subfield ) = - GetMarcFromKohaField( 'biblioitems.isbn', '' ); + GetMarcFromKohaField( 'biblioitems.isbn' ); # Harry Potter and the Sorcerer's Stone, 1st American ed. 1997 my $isbn1 = '0590353403'; diff --git a/tools/batchMod.pl b/tools/batchMod.pl index e5b6032900..2296ecdc60 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -160,7 +160,7 @@ if ($op eq "action") { } #initializing values for updates - my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", ""); + my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); if ($values_to_modify){ my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag, 'ITEM'); $marcitem = MARC::Record::new_from_xml($xml, 'UTF-8'); @@ -536,8 +536,8 @@ sub BuildItemsData{ 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 - my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", ""); - my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", ""); + my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); + my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" ); foreach my $itemnumber (@itemnumbers){ my $itemdata = Koha::Items->find($itemnumber); next unless $itemdata; # Should have been tested earlier, but just in case... @@ -622,7 +622,7 @@ sub BuildItemsData{ # And $tag>10 sub UpdateMarcWith { my ($marcfrom,$marcto)=@_; - my ( $itemtag, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", ""); + my ( $itemtag, $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" ); my $fieldfrom=$marcfrom->field($itemtag); my @fields_to=$marcto->field($itemtag); my $modified = 0; -- 2.11.0