[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Bull.pm [rel_2_2]
From: |
Ryan Higgins |
Subject: |
[Koha-cvs] koha/C4 Bull.pm [rel_2_2] |
Date: |
Mon, 23 Apr 2007 01:50:07 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Ryan Higgins <rych> 07/04/23 01:50:07
Modified files:
C4 : Bull.pm
Log message:
fixing planneddate, adding serial sequence string to
items.multivolumepart, and making biblioitem creation in serialsitemize only
happen if marc support is off
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Bull.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.6.2.42&r2=1.6.2.43
Patches:
Index: Bull.pm
===================================================================
RCS file: /sources/koha/koha/C4/Attic/Bull.pm,v
retrieving revision 1.6.2.42
retrieving revision 1.6.2.43
diff -u -b -r1.6.2.42 -r1.6.2.43
--- Bull.pm 16 Apr 2007 09:54:48 -0000 1.6.2.42
+++ Bull.pm 23 Apr 2007 01:50:07 -0000 1.6.2.43
@@ -737,16 +737,18 @@
my $sth=$dbh->prepare("SELECT * from serial WHERE serialid=?");
$sth->execute($serialid);
my $data=$sth->fetchrow_hashref;
- if ( C4::Context->preference("RoutingSerials") ) {
+ # if ( C4::Context->preference("RoutingSerials") ) {
+ if ( C4::Context->preference("marc") ) {
+ # use multivolumepart for serialseq (though it's also in notes).
+ $info->{multivolumepart} = $data->{serialseq} unless
$info->{multivolumepart};
+ } else {
# check for existing biblioitem relating to serial issue
- my ( $count, @results ) =
- getbiblioitembybiblionumber( $data->{'biblionumber'} );
+ my ( $count, @results ) =getbiblioitembybiblionumber(
$data->{'biblionumber'} );
my $bibitemno = 0;
for ( my $i = 0 ; $i < $count ; $i++ ) {
if ( $results[$i]->{'volumeddesc'} eq
$data->{'serialseq'} . ' ('
- . $data->{'planneddate'}
- . ')' )
+ . $data->{'planneddate'} . ')' )
{
$bibitemno =
$results[$i]->{'biblioitemnumber'};
last;
@@ -755,16 +757,13 @@
if ( $bibitemno == 0 ) {
# warn "need to add new biblioitem so copy last one and
make minor changes";
- my $sth =
- $dbh->prepare(
+ my $sth = $dbh->prepare(
"SELECT * FROM biblioitems WHERE
biblionumber = ? ORDER BY biblioitemnumber DESC"
);
$sth->execute( $data->{'biblionumber'} );
my $biblioitem = $sth->fetchrow_hashref;
- $biblioitem->{'volumedate'} =
- format_date_in_iso( $data->{planneddate} );
- $biblioitem->{'volumeddesc'} =
- $data->{serialseq} . ' ('
+ $biblioitem->{'volumedate'} =
format_date_in_iso( $data->{planneddate} );
+ $biblioitem->{'volumeddesc'} =
$data->{serialseq} . ' ('
. format_date( $data->{'planneddate'} ) .
')';
$biblioitem->{'dewey'} =
$info->{itemcallnumber};
@@ -775,7 +774,7 @@
}
}
-# warn "biblionumber : ".$data->{biblionumber};
+ # warn "biblionumber : ".$data->{biblionumber};
my
$bibid=MARCfind_MARCbibid_from_oldbiblionumber($dbh,$data->{biblionumber});
my $fwk=MARCfind_frameworkcode($dbh,$bibid);
my $exists;
@@ -789,100 +788,39 @@
my $marcrecord = MARC::Record->new();
if ($info->{barcode}){
my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.barcode",$fwk);
-# warn "items.barcode : $tag , $subfield";
+ warn "items.barcode : $tag , $subfield";
my $newField = MARC::Field->new(
"$tag",'','',
"$subfield" => $info->{barcode}
);
$marcrecord->insert_fields_ordered($newField);
}
- if ($info->{branch}){
- my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.homebranch",$fwk);
-# warn "items.homebranch : $tag , $subfield";
- if ($marcrecord->field($tag)) {
-
$marcrecord->field($tag)->add_subfields("$subfield" => $info->{branch})
- }else {
- my $newField = MARC::Field->new(
- "$tag",'','',
- "$subfield" => $info->{branch}
- );
-
$marcrecord->insert_fields_ordered($newField);
- }
- my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$fwk);
-# warn "items.holdingbranch : $tag , $subfield";
- if ($marcrecord->field($tag)) {
-
$marcrecord->field($tag)->add_subfields("$subfield" => $info->{branch})
- }else {
- my $newField = MARC::Field->new(
- "$tag",'','',
- "$subfield" => $info->{branch}
- );
-
$marcrecord->insert_fields_ordered($newField);
- }
- }
- if ($info->{itemcallnumber}){
- my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.itemcallnumber",$fwk);
-# warn "items.itemcallnumber : $tag , $subfield";
- if ($marcrecord->field($tag)) {
-
$marcrecord->field($tag)->add_subfields("$subfield" => $info->{itemcallnumber})
- }else {
- my $newField = MARC::Field->new(
- "$tag",'','',
- "$subfield" =>
$info->{itemcallnumber}
- );
-
$marcrecord->insert_fields_ordered($newField);
- }
- }
- if ($info->{notes}){
- my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.itemnotes",$fwk);
-# warn "items.itemnotes : $tag , $subfield";
+ # we'd like to just use keys %$info, but some fields
are renamed:
+ my %koha_items = ( homebranch => 'branch',
+ holdingbranch
=> 'branch',
+ itemcallnumber
=> 'itemcallnumber',
+ multivolumepart
=> 'multivolumepart',
+ itemnotes =>
'notes',
+ status =>
'notforloan',
+ location =>
'location',
+ dateaccessioned
=> 'dateaccessioned',
+ multivolumepart
=> 'multivolumepart',
+ );
+ for my $itemfield (keys %koha_items) {
+
+ if ($info->{$koha_items{$itemfield}}){
+ my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.$itemfield",$fwk);
+ # warn "items.$itemfield: $tag ,
$subfield";
if ($marcrecord->field($tag)) {
-
$marcrecord->field($tag)->add_subfields("$subfield" => $info->{notes})
+
$marcrecord->field($tag)->add_subfields("$subfield" =>
$info->{$koha_items{$itemfield}})
}else {
my $newField = MARC::Field->new(
"$tag",'','',
- "$subfield" => $info->{notes}
+ "$subfield" =>
$info->{$koha_items{$itemfield}}
);
$marcrecord->insert_fields_ordered($newField);
}
}
- if ($info->{location}){
- my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.location",$fwk);
-# warn "items.location : $tag , $subfield";
- if ($marcrecord->field($tag)) {
-
$marcrecord->field($tag)->add_subfields("$subfield" => $info->{location})
- }else {
- my $newField = MARC::Field->new(
- "$tag",'','',
- "$subfield" => $info->{location}
- );
-
$marcrecord->insert_fields_ordered($newField);
- }
- }
- if ($info->{status}){
- my
($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.notforloan",$fwk);
-# warn "items.notforloan : $tag , $subfield";
- if ($marcrecord->field($tag)) {
-
$marcrecord->field($tag)->add_subfields("$subfield" => $info->{status})
- }else {
- my $newField = MARC::Field->new(
- "$tag",'','',
- "$subfield" => $info->{status}
- );
-
$marcrecord->insert_fields_ordered($newField);
- }
- }
- if ( C4::Context->preference("RoutingSerials") ) {
- my ( $tag, $subfield ) =
- MARCfind_marc_from_kohafield( $dbh,
"items.dateaccessioned",
- $fwk );
- if ( $marcrecord->field($tag) ) {
-
$marcrecord->field($tag)->add_subfields( "$subfield" => $now );
- }
- else {
- my $newField =
MARC::Field->new( "$tag", '', '', "$subfield" => $now );
-
$marcrecord->insert_fields_ordered($newField);
- }
}
NEWnewitem($dbh,$marcrecord,$bibid);
return 1;
@@ -1441,7 +1379,6 @@
my ( $year, $month, $day ) = UnixDate( $planneddate, "%Y", "%m", "%d"
);
my $dayofweek = Date_DayOfWeek( $month, $day, $year );
my $resultdate;
-
# warn "DOW $dayofweek";
if ( $subscription->{periodicity} == 1 ) {
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
@@ -1563,7 +1500,8 @@
$resultdate = DateCalc( $planneddate, "2 years" );
}
- # warn "date: ".$resultdate;
+ $resultdate = UnixDate($resultdate,"%Y-%m-%d");
+
return format_date_in_iso($resultdate);
}
@@ -1604,6 +1542,7 @@
# next issue number
# my
($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3)
= Get_Next_Seq($val);
my
($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3) =
New_Get_Next_Seq($val,$nextplanneddate);
+
newissue($newserialseq, $subscriptionid,
$val->{'biblionumber'}, 1, '',$nextplanneddate);
# $sth = $dbh->prepare("update subscription set
lastvalue1=?, lastvalue2=?,lastvalue3=?,
#
innerloop1=?,innerloop2=?,innerloop3=?