From d7a56c856e659b2a6ee8abd6ce6322623e18ef7f Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 5 Aug 2008 16:27:14 +0200 Subject: [PATCH] Bug fixing : 2470 Serials forgetting library Using default values for PrepareItemrecordDisplay It changes Biblio.pm Adding a hash with default values to PrepareItemrecordDisplay Usunf that API in Serials.pm and serials-edit.pl Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 22 +++++++++++++++++++++- C4/Serials.pm | 4 ++-- serials/serials-edit.pl | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 4031cb205e..9c0bbaeeca 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1880,7 +1880,7 @@ Returns a hash with all the fields for Display a given item data in a template sub PrepareItemrecordDisplay { - my ( $bibnum, $itemnum ) = @_; + my ( $bibnum, $itemnum, $defaultvalues ) = @_; my $dbh = C4::Context->dbh; my $frameworkcode = &GetFrameworkCode( $bibnum ); @@ -1939,6 +1939,26 @@ sub PrepareItemrecordDisplay { $value = $temp->subfield($CNsubfield); } } + if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq + 'items.itemcallnumber' + && $defaultvalues->{'callnumber'} ) + { + my $temp = $itemrecord->field($subfield) if ($itemrecord); + unless ($temp) { + $value = $defaultvalues->{'callnumber'}; + } + } + if ( ($tagslib->{$tag}->{$subfield}->{kohafield} eq + 'items.holdingbranch' || + $tagslib->{$tag}->{$subfield}->{kohafield} eq + 'items.homebranch') + && $defaultvalues->{'branchcode'} ) + { + my $temp = $itemrecord->field($subfield) if ($itemrecord); + unless ($temp) { + $value = $defaultvalues->{branchcode}; + } + } if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { my @authorised_values; my %authorised_lib; diff --git a/C4/Serials.pm b/C4/Serials.pm index 7e6147bbe2..768aa7c69f 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -265,7 +265,7 @@ sub GetSerialInformation { #Maybe GetMarcItem should return values on failure $debug and warn "itemnumber :$itemnum->[0], bibnum :".$data->{'biblionumber'}; my $itemprocessed = - PrepareItemrecordDisplay( $data->{'biblionumber'}, $itemnum->[0] ); + PrepareItemrecordDisplay( $data->{'biblionumber'}, $itemnum->[0] , $data ); $itemprocessed->{'itemnumber'} = $itemnum->[0]; $itemprocessed->{'itemid'} = $itemnum->[0]; $itemprocessed->{'serialid'} = $serialid; @@ -275,7 +275,7 @@ sub GetSerialInformation { } else { my $itemprocessed = - PrepareItemrecordDisplay( $data->{'biblionumber'} ); + PrepareItemrecordDisplay( $data->{'biblionumber'}, '', $data ); $itemprocessed->{'itemid'} = "N$serialid"; $itemprocessed->{'serialid'} = $serialid; $itemprocessed->{'biblionumber'} = $data->{'biblionumber'}; diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index b70ef108f2..b5494cc230 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -145,7 +145,7 @@ foreach my $subscriptionid (@subscriptionids){ if ($serialdatalist[0]->{'serialsadditems'}){ #Create New empty item $cell = - PrepareItemrecordDisplay( $serialdatalist[0]->{'biblionumber'} ); + PrepareItemrecordDisplay( $serialdatalist[0]->{'biblionumber'},'', GetSubscription($subscriptionid)); $cell->{serialsadditems} = 1; } $cell->{'subscriptionid'}=$subscriptionid; -- 2.39.5