Bug 16169: Change prototype for C4::Biblio::TransformMarcToKoha
subroutines should not take $dbh in parameter. C4::Biblio::TransformMarcToKoha has it and does not use it. Test plan: Look at the patch and confirm that all occurrences of TransformMarcToKoha have been modified. Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
parent
eb04d174d9
commit
c564f30155
|
|
@ -1555,7 +1555,7 @@ sub merge {
|
|||
# $update=1;
|
||||
# }#for each tag
|
||||
# }#foreach tagfield
|
||||
# my $authoritynumber = TransformMarcToKoha($dbh,$marcrecord,"") ;
|
||||
# my $authoritynumber = TransformMarcToKoha($marcrecord,"") ;
|
||||
# if ($update==1){
|
||||
# &ModAuthority($marcrecord,$authoritynumber,GetAuthTypeCode($authoritynumber)) ;
|
||||
# }
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ sub AddBiblio {
|
|||
|
||||
# transform the data into koha-table style data
|
||||
SetUTF8Flag($record);
|
||||
my $olddata = TransformMarcToKoha( $dbh, $record, $frameworkcode );
|
||||
my $olddata = TransformMarcToKoha( $record, $frameworkcode );
|
||||
( $biblionumber, $error ) = _koha_add_biblio( $dbh, $olddata, $frameworkcode );
|
||||
$olddata->{'biblionumber'} = $biblionumber;
|
||||
( $biblioitemnumber, $error ) = _koha_add_biblioitem( $dbh, $olddata );
|
||||
|
|
@ -340,7 +340,7 @@ sub ModBiblio {
|
|||
_koha_marc_update_bib_ids( $record, $frameworkcode, $biblionumber, $biblioitemnumber );
|
||||
|
||||
# load the koha-table data object
|
||||
my $oldbiblio = TransformMarcToKoha( $dbh, $record, $frameworkcode );
|
||||
my $oldbiblio = TransformMarcToKoha( $record, $frameworkcode );
|
||||
|
||||
# update MARC subfield that stores biblioitems.cn_sort
|
||||
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode );
|
||||
|
|
@ -2606,7 +2606,7 @@ our $inverted_field_map;
|
|||
|
||||
=head2 TransformMarcToKoha
|
||||
|
||||
$result = TransformMarcToKoha( $dbh, $record, $frameworkcode )
|
||||
$result = TransformMarcToKoha( $record, $frameworkcode )
|
||||
|
||||
Extract data from a MARC bib record into a hashref representing
|
||||
Koha biblio, biblioitems, and items fields.
|
||||
|
|
@ -2617,8 +2617,7 @@ hash_ref
|
|||
=cut
|
||||
|
||||
sub TransformMarcToKoha {
|
||||
my ( $dbh, $record, $frameworkcode, $limit_table ) = @_;
|
||||
## FIXME: $dbh parameter is never used inside this subroutine ???
|
||||
my ( $record, $frameworkcode, $limit_table ) = @_;
|
||||
|
||||
my $result = {};
|
||||
if (!defined $record) {
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@ sub BatchCommitItems {
|
|||
my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.onloan', GetFrameworkCode($biblionumber) );
|
||||
$item_marc->field($MARCfield)->delete_subfield( code => $MARCsubfield );
|
||||
|
||||
my $item = TransformMarcToKoha( $dbh, $item_marc );
|
||||
my $item = TransformMarcToKoha( $item_marc );
|
||||
|
||||
my $duplicate_barcode = exists( $item->{'barcode'} ) && GetItemnumberFromBarcode( $item->{'barcode'} );
|
||||
my $duplicate_itemnumber = exists( $item->{'itemnumber'} );
|
||||
|
|
@ -1545,7 +1545,7 @@ sub _parse_biblio_fields {
|
|||
my ($marc_record) = @_;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $bibliofields = TransformMarcToKoha($dbh, $marc_record, '');
|
||||
my $bibliofields = TransformMarcToKoha($marc_record, '');
|
||||
return ($bibliofields->{'title'}, $bibliofields->{'author'}, $bibliofields->{'isbn'}, $bibliofields->{'issn'});
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ sub AddItemFromMarc {
|
|||
|
||||
my $localitemmarc=MARC::Record->new;
|
||||
$localitemmarc->append_fields($source_item_marc->field($itemtag));
|
||||
my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode ,'items');
|
||||
my $item = &TransformMarcToKoha( $localitemmarc, $frameworkcode ,'items');
|
||||
my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode);
|
||||
return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields);
|
||||
}
|
||||
|
|
@ -383,7 +383,7 @@ sub AddItemBatchFromMarc {
|
|||
$temp_item_marc->append_fields($item_field);
|
||||
|
||||
# add biblionumber and biblioitemnumber
|
||||
my $item = TransformMarcToKoha( $dbh, $temp_item_marc, $frameworkcode, 'items' );
|
||||
my $item = TransformMarcToKoha( $temp_item_marc, $frameworkcode, 'items' );
|
||||
my $unlinked_item_subfields = _get_unlinked_item_subfields($temp_item_marc, $frameworkcode);
|
||||
$item->{'more_subfields_xml'} = _get_unlinked_subfields_xml($unlinked_item_subfields);
|
||||
$item->{'biblionumber'} = $biblionumber;
|
||||
|
|
@ -507,7 +507,7 @@ sub ModItemFromMarc {
|
|||
|
||||
my $localitemmarc = MARC::Record->new;
|
||||
$localitemmarc->append_fields( $item_marc->field($itemtag) );
|
||||
my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode, 'items' );
|
||||
my $item = &TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' );
|
||||
my $default_values = _build_default_values_for_mod_marc();
|
||||
foreach my $item_field ( keys %$default_values ) {
|
||||
$item->{$item_field} = $default_values->{$item_field}
|
||||
|
|
|
|||
|
|
@ -708,7 +708,7 @@ sub get_matches {
|
|||
foreach my $marcblob (keys %matches) {
|
||||
my $target_record = C4::Search::new_record_from_zebra('biblioserver',$marcblob);
|
||||
my $record_number;
|
||||
my $result = C4::Biblio::TransformMarcToKoha(C4::Context->dbh, $target_record, '');
|
||||
my $result = C4::Biblio::TransformMarcToKoha($target_record, '');
|
||||
$record_number = $result->{'biblionumber'};
|
||||
push @results, { 'record_id' => $record_number, 'score' => $matches{$marcblob} };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ This function attempts to find duplicate records using a hard-coded, fairly simp
|
|||
sub FindDuplicate {
|
||||
my ($record) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $result = TransformMarcToKoha( $dbh, $record, '' );
|
||||
my $result = TransformMarcToKoha( $record, '' );
|
||||
my $sth;
|
||||
my $query;
|
||||
my $search;
|
||||
|
|
@ -145,7 +145,7 @@ sub FindDuplicate {
|
|||
$possible_duplicate_record
|
||||
);
|
||||
|
||||
my $result = TransformMarcToKoha( $dbh, $marcrecord, '' );
|
||||
my $result = TransformMarcToKoha( $marcrecord, '' );
|
||||
|
||||
# FIXME :: why 2 $biblionumber ?
|
||||
if ($result) {
|
||||
|
|
@ -201,7 +201,7 @@ my @results;
|
|||
|
||||
for my $r ( @{$marcresults} ) {
|
||||
my $marcrecord = MARC::File::USMARC::decode($r);
|
||||
my $biblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,q{});
|
||||
my $biblio = TransformMarcToKoha($marcrecord,q{});
|
||||
|
||||
#build the iarray of hashs for the template.
|
||||
push @results, {
|
||||
|
|
@ -1889,7 +1889,7 @@ sub searchResults {
|
|||
: GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
|
||||
|
||||
SetUTF8Flag($marcrecord);
|
||||
my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, $fw );
|
||||
my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw );
|
||||
$oldbiblio->{subtitle} = GetRecordValue('subtitle', $marcrecord, $fw);
|
||||
$oldbiblio->{result_number} = $i + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ my @results;
|
|||
|
||||
foreach my $result ( @{$marcresults} ) {
|
||||
my $marcrecord = C4::Search::new_record_from_zebra( 'biblioserver', $result );
|
||||
my $biblio = TransformMarcToKoha( C4::Context->dbh, $marcrecord, '' );
|
||||
my $biblio = TransformMarcToKoha( $marcrecord, '' );
|
||||
|
||||
$biblio->{booksellerid} = $booksellerid;
|
||||
push @results, $biblio;
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ $restrictededition = 0 if ($restrictededition != 0 && $frameworkcode eq 'FA' &&
|
|||
|
||||
my $tagslib = &GetMarcStructure(1,$frameworkcode);
|
||||
my $record = GetMarcBiblio($biblionumber);
|
||||
my $oldrecord = TransformMarcToKoha($dbh,$record);
|
||||
my $oldrecord = TransformMarcToKoha($record);
|
||||
my $itemrecord;
|
||||
my $nextop="additem";
|
||||
my @errors; # store errors found while checking data BEFORE saving item.
|
||||
|
|
@ -457,7 +457,7 @@ if ($op eq "additem") {
|
|||
$record = _increment_barcode($record, $frameworkcode);
|
||||
}
|
||||
|
||||
my $addedolditem = TransformMarcToKoha( $dbh, $record );
|
||||
my $addedolditem = TransformMarcToKoha( $record );
|
||||
|
||||
# If we have to add or add & duplicate, we add the item
|
||||
if ( $add_submit || $add_duplicate_submit ) {
|
||||
|
|
@ -683,7 +683,7 @@ if ($op eq "additem") {
|
|||
# MARC::Record builded => now, record in DB
|
||||
# warn "R: ".$record->as_formatted;
|
||||
# check that the barcode don't exist already
|
||||
my $addedolditem = TransformMarcToKoha($dbh,$itemtosave);
|
||||
my $addedolditem = TransformMarcToKoha($itemtosave);
|
||||
my $exist_itemnumber = get_item_from_barcode($addedolditem->{'barcode'});
|
||||
if ($exist_itemnumber && $exist_itemnumber != $itemnumber) {
|
||||
push @errors,"barcode_not_unique";
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ my $launcher = sub {
|
|||
my @field_data = ($search);
|
||||
for ( my $i = 0 ; $i < $resultsperpage ; $i++ ) {
|
||||
my $record = C4::Search::new_record_from_zebra( 'biblioserver', $results->[$i] );
|
||||
my $rechash = TransformMarcToKoha( $dbh, $record );
|
||||
my $rechash = TransformMarcToKoha( $record );
|
||||
my $pos;
|
||||
my $countitems = $rechash->{itembumber} ? 1 : 0;
|
||||
while ( index( $rechash->{itemnumber}, '|', $pos ) > 0 ) {
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ sub plugin {
|
|||
{
|
||||
my $record = C4::Search::new_record_from_zebra( 'biblioserver', $results->[$i] );
|
||||
next unless $record;
|
||||
my $rechash = TransformMarcToKoha( $dbh, $record );
|
||||
my $rechash = TransformMarcToKoha( $record );
|
||||
if ( my $f = $record->field('200') ) {
|
||||
$rechash->{fulltitle} =
|
||||
join(', ', map { $_->[1] } grep { $_->[0] =~ /[aehi]/ } $f->subfields() );
|
||||
|
|
|
|||
|
|
@ -361,8 +361,7 @@ if (@$barcodes) {
|
|||
my @options = ();
|
||||
foreach my $hit ( @{$results} ) {
|
||||
my $chosen =
|
||||
TransformMarcToKoha( C4::Context->dbh,
|
||||
C4::Search::new_record_from_zebra('biblioserver',$hit) );
|
||||
TransformMarcToKoha( C4::Search::new_record_from_zebra('biblioserver',$hit) );
|
||||
|
||||
# offer all barcodes individually
|
||||
if ( $chosen->{barcode} ) {
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ if ($show_results) {
|
|||
#DEBUG Notes: Decode the MARC record from each resulting MARC record...
|
||||
my $marcrecord = C4::Search::new_record_from_zebra( 'biblioserver', $marcresults->[$i] );
|
||||
#DEBUG Notes: Transform it to Koha form...
|
||||
my $biblio = TransformMarcToKoha( C4::Context->dbh, $marcrecord, '' );
|
||||
my $biblio = TransformMarcToKoha( $marcrecord, '' );
|
||||
#DEBUG Notes: Stuff the bib into @biblio_data...
|
||||
push (@results_set, $biblio);
|
||||
my $biblionumber = $biblio->{'biblionumber'};
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ if (scalar(@errors) > 0) {
|
|||
sub localNEWmodbiblio {
|
||||
my ($dbh,$record,$biblionumber,$frameworkcode) =@_;
|
||||
$frameworkcode="" unless $frameworkcode;
|
||||
my $oldbiblio = TransformMarcToKoha($dbh,$record,$frameworkcode);
|
||||
my $oldbiblio = TransformMarcToKoha($record,$frameworkcode);
|
||||
C4::Biblio::_koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode );
|
||||
C4::Biblio::_koha_modify_biblioitem_nonmarc( $dbh, $oldbiblio );
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ $template->param(
|
|||
#coping with subscriptions
|
||||
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $dat = TransformMarcToKoha( $dbh, $record );
|
||||
my $dat = TransformMarcToKoha( $record );
|
||||
|
||||
my @subscriptions = SearchSubscriptions({ biblionumber => $biblionumber, orderby => 'title' });
|
||||
my @subs;
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ if(C4::Context->preference("ISBD")) {
|
|||
|
||||
#Search for title in links
|
||||
my $marcflavour = C4::Context->preference("marcflavour");
|
||||
my $dat = TransformMarcToKoha( $dbh, $record );
|
||||
my $dat = TransformMarcToKoha( $record );
|
||||
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
|
||||
my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour);
|
||||
my $marcissns = GetMarcISSN( $record, $marcflavour );
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ if ( $op eq "do_search" && $query ) {
|
|||
for ( my $i = 0 ; $i < $total ; $i++ ) {
|
||||
my %resultsloop;
|
||||
my $marcrecord = C4::Search::new_record_from_zebra( 'biblioserver', $marcrecords->[$i] );
|
||||
my $biblio = TransformMarcToKoha( C4::Context->dbh, $marcrecord, '' );
|
||||
my $biblio = TransformMarcToKoha( $marcrecord, '' );
|
||||
|
||||
#build the hash for the template.
|
||||
$resultsloop{highlight} = ( $i % 2 ) ? (1) : (0);
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ ok( !defined $ret, 'GetMarcHosts returns undef if not passed rec');
|
|||
|
||||
my $hash_ref;
|
||||
|
||||
warning_is { $hash_ref = TransformMarcToKoha(undef, undef) }
|
||||
warning_is { $hash_ref = TransformMarcToKoha( undef) }
|
||||
{ carped => 'TransformMarcToKoha called with undefined record'},
|
||||
"TransformMarcToKoha returns carped warning on undef record";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue