[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha C4/Biblio.pm C4/Serials.pm koha-tmpl/intra... [rel_3_0]
From: |
Henri-Damien LAURENT |
Subject: |
[Koha-cvs] koha C4/Biblio.pm C4/Serials.pm koha-tmpl/intra... [rel_3_0] |
Date: |
Mon, 15 Jan 2007 14:59:10 +0000 |
CVSROOT: /cvsroot/koha
Module name: koha
Branch: rel_3_0
Changes by: Henri-Damien LAURENT <hdl> 07/01/15 14:59:09
Modified files:
C4 : Biblio.pm Serials.pm
koha-tmpl/intranet-tmpl/prog/en/serials: serials-collection.tmpl
serials-edit.tmpl
serials : serials-edit.pl
Log message:
Adding creation of an unexpected serial any time.
+
USING Date::Calc and not Date::Manip.
WARNING : There are still some Bugs in next issue date management.
(Date::Calc donot wrap easily next year calculation.)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.178.2.49&r2=1.178.2.50
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.23&r2=1.5.2.24
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.7&r2=1.1.2.8
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.5&r2=1.1.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/serials/serials-edit.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.6&r2=1.1.2.7
Patches:
Index: C4/Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.178.2.49
retrieving revision 1.178.2.50
diff -u -b -r1.178.2.49 -r1.178.2.50
--- C4/Biblio.pm 12 Jan 2007 10:12:30 -0000 1.178.2.49
+++ C4/Biblio.pm 15 Jan 2007 14:59:09 -0000 1.178.2.50
@@ -33,7 +33,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.178.2.49 $' =~ /\d+/g;
shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.178.2.50 $' =~ /\d+/g;
shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
@ISA = qw( Exporter );
@@ -1395,6 +1395,7 @@
MARC::Field->new( 100, "", "", "a" => $string ) );
}
}
+# warn "biblionumber : ".$biblionumber;
$sth =
$dbh->prepare(
"update biblioitems set marc=?,marcxml=? where biblionumber=?");
@@ -1402,7 +1403,7 @@
$biblionumber );
# warn $record->as_xml_record();
$sth->finish;
- zebraop($dbh,$biblionumber,"specialUpdate","biblioserver");
+# zebraop($dbh,$biblionumber,"specialUpdate","biblioserver");
return $biblionumber;
}
@@ -1443,6 +1444,8 @@
$dbh->prepare("select marcxml from biblioitems where biblionumber=? ");
$sth->execute($biblionumber);
my ($marcxml) = $sth->fetchrow;
+# warn "marcxml : $marcxml";
+# MARC::File::XML->default_record_format('UNIMARC');
$marcxml =~ s/\x1e//g;
$marcxml =~ s/\x1f//g;
$marcxml =~ s/\x1d//g;
@@ -1484,8 +1487,9 @@
my $marcxml = GetXmlBiblio($biblionumber);
my $record = MARC::Record->new();
+# warn "marcxml :$marcxml";
$record = MARC::Record::new_from_xml( $marcxml, "utf8", $marcflavour );
-
+# warn "record :".$record->as_formatted;
# now, find where the itemnumber is stored & extract only the item
my ( $itemnumberfield, $itemnumbersubfield ) =
MARCfind_marc_from_kohafield( $dbh, 'items.itemnumber', '' );
@@ -3249,14 +3253,14 @@
sub PrepareItemrecordDisplay {
- my ( $itemnum, $bibnum ) = @_;
+ my ( $bibnum, $itemnum ) = @_;
my $dbh = C4::Context->dbh;
my $frameworkcode = &MARCfind_frameworkcode( $dbh, $bibnum );
my ( $itemtagfield, $itemtagsubfield ) =
&MARCfind_marc_from_kohafield( $dbh, "items.itemnumber", $frameworkcode
);
my $tagslib = &MARCgettagslib( $dbh, 1, $frameworkcode );
- my $itemrecord = MARCgetitem( $itemnum, $bibnum ) if ($itemnum);
+ my $itemrecord = MARCgetitem( $bibnum, $itemnum) if ($itemnum);
my @loop_data;
my $authorised_values_sth =
$dbh->prepare(
@@ -3673,8 +3677,14 @@
=cut
-# $Id: Biblio.pm,v 1.178.2.49 2007/01/12 10:12:30 toins Exp $
+# $Id: Biblio.pm,v 1.178.2.50 2007/01/15 14:59:09 hdl Exp $
# $Log: Biblio.pm,v $
+# Revision 1.178.2.50 2007/01/15 14:59:09 hdl
+# Adding creation of an unexpected serial any time.
+# +
+# USING Date::Calc and not Date::Manip.
+# WARNING : There are still some Bugs in next issue date management.
(Date::Calc donot wrap easily next year calculation.)
+#
# Revision 1.178.2.49 2007/01/12 10:12:30 toins
# writing $record->as_formatted in the log when Modifying an item.
#
Index: C4/Serials.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Serials.pm,v
retrieving revision 1.5.2.23
retrieving revision 1.5.2.24
diff -u -b -r1.5.2.23 -r1.5.2.24
--- C4/Serials.pm 12 Jan 2007 18:10:19 -0000 1.5.2.23
+++ C4/Serials.pm 15 Jan 2007 14:59:09 -0000 1.5.2.24
@@ -17,11 +17,11 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Serials.pm,v 1.5.2.23 2007/01/12 18:10:19 toins Exp $
+# $Id: Serials.pm,v 1.5.2.24 2007/01/15 14:59:09 hdl Exp $
use strict;
use C4::Date;
-use Date::Manip;
+use Date::Calc qw(Time_to_Date Date_to_Time check_date Add_Delta_YMD
Add_Delta_YM Add_Delta_Days Delta_Days Week_of_Year Monday_of_Week Day_of_Week);
use POSIX qw(strftime);
use C4::Suggestions;
use C4::Koha;
@@ -35,7 +35,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.5.2.23 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.5.2.24 $' =~ /\d+/g;
shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
};
@@ -243,7 +243,7 @@
my ($serialid) = @_;
my $dbh = C4::Context->dbh;
my $query = qq|
- SELECT serial.*, serial.status as
serstatus,subscription.*,subscription.subscriptionid as subsid
+ SELECT serial.*, serial.notes as sernotes, serial.status as
serstatus,subscription.*,subscription.subscriptionid as subsid
FROM serial LEFT JOIN subscription ON
subscription.subscriptionid=serial.subscriptionid
WHERE serialid = ?
|;
@@ -258,6 +258,7 @@
#It is ASSUMED that MARCgetitem ALWAYS WORK...
#Maybe MARCgetitem should return values on failure
+# warn "itemnumber :$itemnum, bibnum
:".$data->{'biblionumber'};
my $itemprocessed =
PrepareItemrecordDisplay( $data->{'biblionumber'}, $itemnum
);
$itemprocessed->{'itemnumber'} = $itemnum;
@@ -268,7 +269,6 @@
}
}
else {
- my $itemrecord;
my $itemprocessed =
PrepareItemrecordDisplay( $data->{'biblionumber'} );
$itemprocessed->{'itemid'} = "N$serialid";
@@ -366,8 +366,10 @@
if (C4::Context->preference('IndependantBranches') &&
C4::Context->userenv &&
C4::Context->userenv->{'flags'} != 1){
+# warn "flags: ".C4::Context->userenv->{'flags'};
$query.=" AND subscription.branchcode IN
('".C4::Context->userenv->{'branch'}."',\"''\")";
}
+# warn "query : $query";
my $sth = $dbh->prepare($query);
$sth->execute($subscriptionid);
my $subs = $sth->fetchrow_hashref;
@@ -551,7 +553,7 @@
$query.=" AND subscription.branchcode IN
('".C4::Context->userenv->{'branch'}."',\"''\")";
}
$query.=" ORDER BY title";
- warn "query :$query";
+# warn "query :$query";
$sth = $dbh->prepare($query);
$sth->execute($biblionumber);
}
@@ -588,7 +590,7 @@
$query.=" AND subscription.branchcode IN
('".C4::Context->userenv->{'branch'}."',\"''\")";
}
$query.=" ORDER BY title";
- warn "query :$query";
+# warn "query :$query";
$sth = $dbh->prepare($query);
$sth->execute( "%" . $ISSN . "%" );
}
@@ -953,22 +955,29 @@
my $enddate = $subscription->{startdate};
# we don't do the same test if the subscription is based on X numbers or on X
weeks/months
+ warn "SUBSCRIPTIONID :$subscriptionid";
+ use Data::Dumper; warn Dumper($subscription);
+
if ( $subscription->{numberlength} ) {
#calculate the date of the last issue.
my $length = $subscription->{numberlength};
+ warn "ENDDATE ".$enddate;
for ( my $i = 1 ; $i <= $length ; $i++ ) {
$enddate = GetNextDate( $enddate, $subscription );
+ warn "AFTER ENDDATE ".$enddate;
}
}
- else {
- $enddate = DateCalc(
- format_date_in_iso( $subscription->{startdate} ),
- $subscription->{monthlength} . " months"
- ) if ( $subscription->{monthlength} );
- $enddate = DateCalc(
- format_date_in_iso( $subscription->{startdate} ),
- $subscription->{weeklength} . " weeks"
- ) if ( $subscription->{weeklength} );
+ elsif ( $subscription->{monthlength} ){
+ warn "dateCHECKRESERV :".$subscription->{startdate};
+ my @date=split (/-/,$subscription->{startdate});
+ my @enddate =
Add_Delta_YM($date[0],$date[1],$date[2],0,$subscription->{monthlength}
+ );
+ $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]);
+ } elsif ( $subscription->{weeklength} ){
+ my @date=split (/-/,$subscription->{startdate});
+ warn "dateCHECKRESERV :".$subscription->{startdate};
+ my @enddate =
Add_Delta_Days($date[0],$date[1],$date[2],0,$subscription->{weeklength}*7);
+ $enddate=sprintf("%04d-%02d-%02d",$enddate[0],$enddate[1],$enddate[2]);
}
return $enddate;
@@ -1047,6 +1056,7 @@
my ( $serialid, $serialseq, $publisheddate, $planneddate, $status, $notes )
= @_;
+ #It is a usual serial
# 1st, get previous status :
my $dbh = C4::Context->dbh;
my $query = "SELECT subscriptionid,status FROM serial WHERE serialid=?";
@@ -1110,6 +1120,7 @@
) = GetNextSeq($val);
# next date (calculated from actual date & frequency parameters)
+# warn "publisheddate :$publisheddate ";
my $nextpublisheddate = GetNextDate( $publisheddate, $val );
NewIssue( $newserialseq, $subscriptionid, $val->{'biblionumber'},
1, $nextpublisheddate, $nextpublisheddate );
@@ -1363,17 +1374,20 @@
sub NewIssue {
my ( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate,
- $planneddate )
+ $planneddate, $notes )
= @_;
+ ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL
NEED IT ?
+
my $dbh = C4::Context->dbh;
my $query = qq|
INSERT INTO serial
-
(serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate)
- VALUES (?,?,?,?,?,?)
+
(serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
+ VALUES (?,?,?,?,?,?,?)
|;
my $sth = $dbh->prepare($query);
$sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
- $publisheddate, $planneddate );
+ $publisheddate, $planneddate,$notes );
+ my $serialid=$dbh->{'mysql_insertid'};
$query = qq|
SELECT missinglist,recievedlist
FROM subscriptionhistory
@@ -1384,10 +1398,13 @@
my ( $missinglist, $recievedlist ) = $sth->fetchrow;
if ( $status eq 2 ) {
- $recievedlist .= ",$serialseq";
+ ### TODO Add a feature that improves recognition and description.
+ ### As such count (serialseq) i.e. : N°18,2(N°19),N°20
+ ### Would use substr and index But be careful to previous presence of ()
+ $recievedlist .= ",$serialseq" unless
(index($recievedlist,$serialseq)>0);
}
if ( $status eq 4 ) {
- $missinglist .= ",$serialseq";
+ $missinglist .= ",$serialseq" unless
(index($missinglist,$serialseq)>0);
}
$query = qq|
UPDATE subscriptionhistory
@@ -1396,6 +1413,7 @@
|;
$sth = $dbh->prepare($query);
$sth->execute( $recievedlist, $missinglist, $subscriptionid );
+ return $serialid;
}
=head2 ItemizeSerials
@@ -1415,8 +1433,7 @@
sub ItemizeSerials {
my ( $serialid, $info ) = @_;
- my $now = ParseDate("today");
- $now = UnixDate( $now, "%Y-%m-%d" );
+ my $now = POSIX::strftime( "%Y-%m-%d",localtime );
my $dbh = C4::Context->dbh;
my $query = qq|
@@ -1616,7 +1633,7 @@
my ($subscriptionid) = @_;
my $dbh = C4::Context->dbh;
my $subscription = GetSubscription($subscriptionid);
-
+# warn "subscriptionid:$subscriptionid";
# we don't do the same test if the subscription is based on X numbers or on X
weeks/months
if ( $subscription->{numberlength} ) {
my $query = qq|
@@ -1644,20 +1661,26 @@
|;
my $sth = $dbh->prepare($query);
$sth->execute($subscriptionid);
- my $res = ParseDate( format_date_in_iso( $sth->fetchrow ) );
- my $endofsubscriptiondate;
-
- $endofsubscriptiondate = DateCalc(
- format_date_in_iso( $subscription->{startdate} ),
- $subscription->{monthlength} . " months"
- ) if ( $subscription->{monthlength} );
-
- $endofsubscriptiondate = DateCalc(
- format_date_in_iso( $subscription->{startdate} ),
- $subscription->{weeklength} . " weeks"
- ) if ( $subscription->{weeklength} );
-
- return 1 if ( $res >= $endofsubscriptiondate );
+ my ($res) = $sth->fetchrow ;
+# warn "res : $res";
+ my @res=split (/-/,$res);
+ my @endofsubscriptiondate;
+# use Data::Dumper; warn "subscription :".Dumper($subscription);
+# warn "subscription startdate : ".$subscription->{startdate};
+ my @startdate=split(/-/,$subscription->{startdate});
+ @endofsubscriptiondate = Add_Delta_YMD(
+ $startdate[0],$startdate[1],$startdate[2],
+ ,0,$subscription->{monthlength},0) if (
$subscription->{monthlength} );
+ if ( $subscription->{weeklength} ){
+ my ($year,$weeknb)=Week_of_Year(@startdate);
+ $weeknb += $subscription->{weeklength};
+ @endofsubscriptiondate=Monday_of_Week($year,$weeknb);
+ }
+# foreach (@endofsubscriptiondate){warn "endofsubscription :$_"}
+ my
$endofsubscriptiondate=Date_to_Time($endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2],0,0,0)
if (@endofsubscriptiondate);
+ return 1 if ( (@endofsubscriptiondate &&
Delta_Days($res[0],$res[1],$res[2],
+
$endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2])
>= 0)
+ || (!$res));
return 0;
}
}
@@ -1753,6 +1776,8 @@
$sth = $dbh->prepare($strsth);
$sth->execute($subscriptionid);
}
+ ### TODO Add itemdeletion. Should be in a pref ?
+
return $mainsth->rows;
}
@@ -2191,35 +2216,45 @@
$dbh->prepare(
"select max(planneddate) from serial where subscriptionid=?");
$sth->execute($subscriptionid);
- my $res = ParseDate( format_date_in_iso( $sth->fetchrow ) );
- my $endofsubscriptiondate;
- $endofsubscriptiondate = DateCalc(
- format_date_in_iso( $subscription->{startdate} ),
- $subscription->{monthlength} . " months"
- ) if ( $subscription->{monthlength} );
- $endofsubscriptiondate = DateCalc(
- format_date_in_iso( $subscription->{startdate} ),
- $subscription->{weeklength} . " weeks"
- ) if ( $subscription->{weeklength} );
+ my ($res) = $sth->fetchrow ;
+ my @res=split /-/,$res;
+ my @endofsubscriptiondate;
+ my @startdate=split /-/,$subscription->{startdate};
+ @endofsubscriptiondate = Add_Delta_YMD(
+ $startdate[0],$startdate[1],$startdate[2],
+ ,0,$subscription->{monthlength},0) if (
$subscription->{monthlength} );
+ if ( $subscription->{weeklength} ){
+ my ($year,$weeknb)=Week_of_Year(@startdate);
+ $weeknb += $subscription->{weeklength};
+ @endofsubscriptiondate=Monday_of_Week($year,$weeknb);
+ }
+ # defaulting hours to 0
+ my
$endofsubscriptiondate=Date_to_Time($endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2]
+ ,0,0,0) if (@endofsubscriptiondate);
# warn "last: ".$endofsubscriptiondate." vs currentdate: ".$res;
my $per = $subscription->{'periodicity'};
- my $x = 0;
- if ( $per == 1 ) { $x = '1 day'; }
- if ( $per == 2 ) { $x = '1 week'; }
- if ( $per == 3 ) { $x = '2 weeks'; }
- if ( $per == 4 ) { $x = '3 weeks'; }
- if ( $per == 5 ) { $x = '1 month'; }
- if ( $per == 6 ) { $x = '2 months'; }
- if ( $per == 7 || $per == 8 ) { $x = '3 months'; }
- if ( $per == 9 ) { $x = '6 months'; }
- if ( $per == 10 ) { $x = '1 year'; }
- if ( $per == 11 ) { $x = '2 years'; }
- my $datebeforeend =
- DateCalc( $endofsubscriptiondate, "- " . $x )
- ; # if ($subscription->{weeklength});
+ my $x;
+ if ( $per == 1 ) {$x=1;}
+ if ( $per == 2 ) {$x=7; }
+ if ( $per == 3 ) {$x=14;}
+ if ( $per == 4 ) { $x = 21; }
+ if ( $per == 5 ) { $x = 31; }
+ if ( $per == 6 ) { $x = 62; }
+ if ( $per == 7 || $per == 8 ) { $x = 93; }
+ if ( $per == 9 ) { $x = 190; }
+ if ( $per == 10 ) { $x = 365; }
+ if ( $per == 11 ) { $x = 730; }
+ my @datebeforeend=Add_Delta_Days(
$endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2],
+ - $x) if (@endofsubscriptiondate);
# warn "DATE BEFORE END: $datebeforeend";
- return 1 if ( $res >= $datebeforeend && $res < $endofsubscriptiondate
);
+ return 1 if ( @res &&
+ (@datebeforeend &&
+ Delta_Days($res[0],$res[1],$res[2],
+
$datebeforeend[0],$datebeforeend[1],$datebeforeend[2]) >= 0) &&
+ (@endofsubscriptiondate &&
+ Delta_Days($res[0],$res[1],$res[2],
+
$endofsubscriptiondate[0],$endofsubscriptiondate[1],$endofsubscriptiondate[2])
< 0) );
return 0;
}
}
@@ -2472,133 +2507,137 @@
my ( $planneddate, $subscription ) = @_;
my @irreg = split( /\|/, $subscription->{irregularity} );
- my ( $year, $month, $day ) = UnixDate( $planneddate, "%Y", "%m", "%d" );
- my $dayofweek = Date_DayOfWeek( $month, $day, $year );
- my $resultdate;
+ #date supposed to be in ISO.
+
+ my ( $year, $month, $day ) = split(/-/, $planneddate);
+ my @resultdate;
# warn "DOW $dayofweek";
if ( $subscription->{periodicity} == 1 ) {
+ my $dayofweek = Day_of_Week( $year,$month, $day );
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
if ( $dayofweek == 7 ) { $dayofweek = 0; }
if ( in_array( ( $dayofweek + 1 ), @irreg ) ) {
- $planneddate = DateCalc( $planneddate, "1 day" );
+ ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 1 );
$dayofweek++;
}
}
- $resultdate = DateCalc( $planneddate, "1 day" );
+ @resultdate = Add_Delta_Days($year,$month, $day , 1 );
}
if ( $subscription->{periodicity} == 2 ) {
- my $wkno = Date_WeekOfYear( $month, $day, $year, 1 );
+ my ($wkno,$year) = Week_of_Year( $year,$month, $day );
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
if ( $wkno > 52 ) { $wkno = 0; } # need to rollover at January
if ( $irreg[$i] == ( $wkno + 1 ) ) {
- $planneddate = DateCalc( $planneddate, "1 week" );
+ ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 7 );
$wkno++;
}
}
- $resultdate = DateCalc( $planneddate, "1 week" );
+ @resultdate = Add_Delta_Days( $year,$month, $day, 7);
}
if ( $subscription->{periodicity} == 3 ) {
- my $wkno = Date_WeekOfYear( $month, $day, $year, 1 );
+ my ($wkno,$year) = Week_of_Year( $year,$month, $day );
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
- if ( $wkno > 52 ) { $wkno = 0; } # need to rollover at January
- if ( $irreg[$i] == ( $wkno + 1 ) ) {
- $planneddate = DateCalc( $planneddate, "2 weeks" );
+ if ( $wkno > 52 ) { $wkno = 0; $year++; } # need to rollover at
January
+ if ( $irreg[$i] == ( $wkno + 2 ) ) {
+ ### BUGFIX was previously +1 ^
+ ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 14 );
$wkno++;
}
}
- $resultdate = DateCalc( $planneddate, "2 weeks" );
+ @resultdate = Add_Delta_Days($year,$month, $day , 14 );
}
if ( $subscription->{periodicity} == 4 ) {
- my $wkno = Date_WeekOfYear( $month, $day, $year, 1 );
+ my ($wkno,$year) = Week_of_Year( $year,$month, $day );
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
- if ( $wkno > 52 ) { $wkno = 0; } # need to rollover at January
- if ( $irreg[$i] == ( $wkno + 1 ) ) {
- $planneddate = DateCalc( $planneddate, "3 weeks" );
+ if ( $wkno > 52 ) { $wkno = 0;$year++; } # need to rollover at
January
+ if ( $irreg[$i] == ( $wkno + 3 ) ) {
+ ### BUGFIX was previously +1 ^
+ ($year,$month,$day) = Add_Delta_Days($year,$month, $day , 21 );
$wkno++;
}
}
- $resultdate = DateCalc( $planneddate, "3 weeks" );
+ @resultdate = Add_Delta_Days($year,$month, $day , 21 );
}
if ( $subscription->{periodicity} == 5 ) {
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
-
# warn $irreg[$i];
# warn $month;
if ( $month == 12 ) {
- $month = 0;
+ $month = 0;$year++;
} # need to rollover to check January
if ( $irreg[$i] == ( $month + 1 ) )
{ # check next one to see if is to be skipped
- $planneddate = DateCalc( $planneddate, "1 month" );
+ ($year,$month,$day) = Add_Delta_YMD($year,$month, $day ,0,1,0
);
$month++; # to check if following ones are to be skipped too
}
}
- $resultdate = DateCalc( $planneddate, "1 month" );
+ @resultdate = Add_Delta_YMD($year,$month, $day ,0,1,0 );
# warn "Planneddate2: $planneddate";
}
if ( $subscription->{periodicity} == 6 ) {
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
if ( $month == 12 ) {
- $month = 0;
+ $month = 0;$year++;
} # need to rollover to check January
if ( $irreg[$i] == ( $month + 1 ) )
{ # check next one to see if is to be skipped
- $planneddate = DateCalc( $planneddate, "2 months" );
+ ($year,$month,$day) = Add_Delta_YMD($year,$month, $day ,0,2,0
);
$month++; # to check if following ones are to be skipped too
}
}
- $resultdate = DateCalc( $planneddate, "2 months" );
+ @resultdate = Add_Delta_YMD($year,$month, $day, 0, 2,0 );
}
if ( $subscription->{periodicity} == 7 ) {
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
if ( $month == 12 ) {
- $month = 0;
+ $month = 0;$year++;
} # need to rollover to check January
if ( $irreg[$i] == ( $month + 1 ) )
{ # check next one to see if is to be skipped
- $planneddate = DateCalc( $planneddate, "3 months" );
+ ($year,$month,$day) = Add_Delta_YMD($year,$month, $day, 0, 3,0
);
$month++; # to check if following ones are to be skipped too
}
}
- $resultdate = DateCalc( $planneddate, "3 months" );
+ @resultdate = Add_Delta_YMD($year,$month, $day, 0, 3, 0);
}
if ( $subscription->{periodicity} == 8 ) {
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
if ( $month == 12 ) {
- $month = 0;
+ $month = 0;$year++;
} # need to rollover to check January
if ( $irreg[$i] == ( $month + 1 ) )
+ ### BUFIX Seems to need more Than One ?
{ # check next one to see if is to be skipped
- $planneddate = DateCalc( $planneddate, "3 months" );
+ ($year,$month,$day) = Add_Delta_YMD($year,$month, $day, 0, 3,
0 );
$month++; # to check if following ones are to be skipped too
}
}
- $resultdate = DateCalc( $planneddate, "3 months" );
+ @resultdate = Add_Delta_YM($year,$month, $day, 0, 3, 0);
}
if ( $subscription->{periodicity} == 9 ) {
for ( my $i = 0 ; $i < @irreg ; $i++ ) {
if ( $month == 12 ) {
- $month = 0;
+ $month = 0;$year++;
} # need to rollover to check January
if ( $irreg[$i] == ( $month + 1 ) )
{ # check next one to see if is to be skipped
- $planneddate = DateCalc( $planneddate, "6 months" );
+ ($year,$month,$day) = Add_Delta_YMD($year,$month, $day, 0, 6,
0 );
$month++; # to check if following ones are to be skipped too
}
}
- $resultdate = DateCalc( $planneddate, "6 months" );
+ @resultdate = Add_Delta_YM($year,$month, $day, 0, 6, 0 );
}
if ( $subscription->{periodicity} == 10 ) {
- $resultdate = DateCalc( $planneddate, "1 year" );
+ @resultdate = Add_Delta_YM($year,$month, $day, 1, 0 );
}
if ( $subscription->{periodicity} == 11 ) {
- $resultdate = DateCalc( $planneddate, "2 years" );
+ @resultdate = Add_Delta_YM($year,$month, $day, 2, 0 );
}
-
- # warn "date: ".$resultdate;
- return format_date_in_iso($resultdate);
+ my
$resultdate=sprintf("%04d-%02d-%02d",$resultdate[0],$resultdate[1],$resultdate[2]);
+# warn "dateNEXTSEQ : ".$resultdate;
+ return "$resultdate";
}
=head2 itemdata
Index: koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl
===================================================================
RCS file:
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/Attic/serials-collection.tmpl,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -b -r1.1.2.7 -r1.1.2.8
--- koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl 11 Jan
2007 15:30:52 -0000 1.1.2.7
+++ koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl 15 Jan
2007 14:59:09 -0000 1.1.2.8
@@ -97,7 +97,7 @@
<!-- TMPL_IF Name="status7" -->Claimed<!-- /TMPL_IF -->
</td>
<td>
- <!-- TMPL_VAR Name="Notes" -->
+ <!-- TMPL_VAR Name="notes" -->
</td>
<td>
<!-- TMPL_VAR Name="branchcode" -->
Index: koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl
===================================================================
RCS file:
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/Attic/serials-edit.tmpl,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -b -r1.1.2.5 -r1.1.2.6
--- koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl 12 Jan 2007
18:09:19 -0000 1.1.2.5
+++ koha-tmpl/intranet-tmpl/prog/en/serials/serials-edit.tmpl 15 Jan 2007
14:59:09 -0000 1.1.2.6
@@ -92,7 +92,7 @@
</td>
<td>
- <input type="text" name="notes" value="<!-- TMPL_VAR name="notes"
-->" size=20 maxlength=255>
+ <input type="text" name="notes" value="<!-- TMPL_VAR
name="sernotes" -->" size=20 maxlength=255>
</td>
</tr>
<!--TMPL_IF Name="serialsadditems"-->
@@ -133,6 +133,99 @@
</tr>
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
+ <tr>
+ <td>
+ <input type="hidden" name="serialid" value="NEW" />
+ <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR
name="subscriptionid" -->" />
+ <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR
NAME="biblionumber" -->" />
+ <input type="hidden" name="itemcount" value="<!-- TMPL_VAR
name="issuesatonce" -->" />
+ <input type="hidden" name="user" value="<!-- TMPL_VAR
name="librarian" -->" />
+ New Issue <input type="text" name="serialseq" value="" size="20"
maxlength="100" />
+ </td>
+ <td>
+ <input type="text" name="publisheddate" value="<!-- TMPL_VAR
name="publisheddate" -->" size=10 maxlength=15>
+ </td>
+ <td>
+ <input type="text" name="planneddate" value="<!-- TMPL_VAR
name="planneddate" -->" size=10 maxlength=15>
+ </td>
+ <td>
+ <select name="status" size="1" id="status<!-- TMPL_VAR NAME="num"
-->" OnChange="javascript:if (this.value==2){unHideItems('items'+<!-- TMPL_VAR
NAME="serialid" -->,'label<!--TMPL_VAR Name="serialid"-->')}">
+ <!--TMPL_IF name="status1" -->
+ <option value="1" selected>Waited</option>
+ <!-- /TMPL_IF -->
+ <!--TMPL_IF name="status2" -->
+ <option value="2" selected>Arrived</option>
+ <!--TMPL_ELSE -->
+ <option value="2">Arrived</option>
+ <!-- /TMPL_IF -->
+ <!--TMPL_IF name="status3" -->
+ <option value="3" selected>Late</option>
+ <!-- TMPL_ELSE -->
+ <option value="3">Late</option>
+ <!-- /TMPL_IF -->
+ <!--TMPL_IF name="status4" -->
+ <option value="4" selected>Missing</option>
+ <!-- TMPL_ELSE -->
+ <option value="4">Missing</option>
+ <!-- /TMPL_IF -->
+ <!--TMPL_IF name="status7" -->
+ <option value="7" selected>Claimed</option>
+ <!-- TMPL_ELSE -->
+ <option value="7">Claimed</option>
+ <!-- /TMPL_IF -->
+ <!--TMPL_IF name="status5" -->
+ <option value="5" selected>Not Available</option>
+ <!-- TMPL_ELSE -->
+ <option value="5">Not Available</option>
+ <!-- /TMPL_IF -->
+ <!--TMPL_IF name="status6" -->
+ <option value="6" selected>Delete</option>
+ <!-- TMPL_ELSE -->
+ <option value="6">Delete</option>
+ <!-- /TMPL_IF -->
+ </select>
+
+ </td>
+ <td>
+ <input type="text" name="notes" value="<!-- TMPL_VAR name="notes"
-->" size=20 maxlength=255>
+ </td>
+ </tr>
+ <!--TMPL_IF Name="serialsadditems"-->
+ <tr>
+ <td colspan="5">
+ <a id="label<!--TMPL_VAR Name="serialid"-->" style="color: grey;
font-size: 80%; cursor: se-resize;" onclick="unHideItems('items<!--TMPL_VAR
Name="serialid"-->','label<!--TMPL_VAR Name="serialid"-->')">
+ Items </a>
+ <fieldset style="display:none;" id="items<!--TMPL_VAR
Name="serialid"-->">
+ <legend><a style="cursor: se-resize;"
onclick="HideItems('items<!--TMPL_VAR Name="serialid"-->','label<!--TMPL_VAR
Name="serialid"-->')">
+ Items</a>
+ </legend>
+ <div id="cataloguing_additem_itemlist">
+ <div id="item<!-- TMPL_VAR NAME="serialid" --><!-- TMPL_VAR
NAME="countitems" -->" class="items">
+ <!-- TMPL_LOOP NAME="iteminformation" -->
+ <div id="subfield<!-- TMPL_VAR NAME="serialid" --><!-- TMPL_VAR
NAME="countitems" --><!-- TMPL_VAR NAME="countsubfield" -->" class="subfield">
<label><!-- TMPL_VAR NAME="subfield" --> - <!-- TMPL_IF
name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!--
TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label>
+ <!-- TMPL_VAR NAME="marc_value" -->
+ <input type="hidden" name="itemid" value="<!-- TMPL_VAR
NAME="itemid" -->" />
+ <input type="hidden" name="kohafield" value="<!-- TMPL_VAR
NAME="kohafield" -->" />
+ <input type="hidden" name="tag" value="<!-- TMPL_VAR
NAME="tag" -->" />
+ <input type="hidden" name="subfield" value="<!-- TMPL_VAR
NAME="subfield" -->" />
+ <input type="hidden" name="mandatory" value="<!-- TMPL_VAR
NAME="mandatory" -->" />
+ </div>
+ <!-- /tmpl_loop -->
+
+ <input type="hidden" name="moditem" value="" />
+ <input type="hidden" name="tag" value="<!-- TMPL_VAR
NAME="itemtagfield" -->" />
+ <input type="hidden" name="subfield" value="<!-- TMPL_VAR
NAME="itemtagsubfield" -->" />
+ <input type="hidden" name="serial" value="<!-- TMPL_VAR
NAME="serialid" -->" />
+ <input type="hidden" name="bibnum" value="<!-- TMPL_VAR
NAME="biblionumber" -->" />
+ <input type="hidden" name="itemid" value="<!-- TMPL_VAR NAME="itemid"
-->" />
+ <input type="hidden" name="field_value" value="<!-- TMPL_VAR
NAME="itemnumber" -->" />
+ </div>
+ </div>
+ </fieldset>
+ </td>
+ </tr>
+ <!-- /TMPL_IF -->
+
</table>
</div>
</form>
Index: serials/serials-edit.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/Attic/serials-edit.pl,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -b -r1.1.2.6 -r1.1.2.7
--- serials/serials-edit.pl 18 Dec 2006 17:44:07 -0000 1.1.2.6
+++ serials/serials-edit.pl 15 Jan 2007 14:59:09 -0000 1.1.2.7
@@ -17,7 +17,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: serials-edit.pl,v 1.1.2.6 2006/12/18 17:44:07 toins Exp $
+# $Id: serials-edit.pl,v 1.1.2.7 2007/01/15 14:59:09 hdl Exp $
=head1 NAME
@@ -110,15 +110,41 @@
my @serialdatalist;
foreach my $tmpserialid (@serialids){
my $data=GetSerialInformation($tmpserialid);
+ $data->{publisheddate}=format_date($data->{publisheddate});
+ $data->{planneddate}=format_date($data->{planneddate});
push @serialdatalist,$data;
}
+if (C4::Context->preference("serialsadditems")){
+#Create New empty item
+ my $itemprocessed =
+ PrepareItemrecordDisplay( $serialdatalist[0]->{'biblionumber'} );
+ $itemprocessed->{'itemid'} = "NNEW";
+ $itemprocessed->{'serialid'} = "NEW";
+ $itemprocessed->{'countitems'} = 1;
+ $template->param($itemprocessed);
+}
+
if ($op eq 'serialchangestatus') {
# my $sth = $dbh->prepare("select status from serial where serialid=?");
+ my $newserial;
for (my $i=0;$i<=$#serialids;$i++) {
# $sth->execute($serialids[$i]);
# my ($oldstatus) = $sth->fetchrow;
- if ($serialids[$i]) {
+ warn "serialid : \"$serialids[$i]\"";
+ if ($serialids[$i] && $serialids[$i] eq "NEW") {
+ warn "NEW";
+ if ($serialseqs[$i]){
+ warn "New issue";
+ #IF newserial was provided a name Then we have to create a
newSerial
+ ### FIXME if NewIssue is modified to use subscription
biblionumber, then biblionumber would not be useful.
+ $newserial = NewIssue(
$serialseqs[$i],$subscriptionids[$i],$serialdatalist[0]->{'biblionumber'},
+ $status[$i],
+ format_date_in_iso($planneddates[$i]),
+ format_date_in_iso($publisheddates[$i]),
+ $notes[$i]);
+ }
+ }elsif ($serialids[$i]){
ModSerialStatus($serialids[$i],
$serialseqs[$i],
format_date_in_iso($planneddates[$i]),
@@ -144,8 +170,12 @@
my $range=scalar(@itemid);
for (my $i=0; $i<$range; $i++){
unless ($itemhash{$itemid[$i]}){
- $itemhash{$itemid[$i]}->{'bibnum'}=$bibnums[$countdistinct];
+ if ($serials[$countdistinct] && $serials[$countdistinct] ne "NEW"){
$itemhash{$itemid[$i]}->{'serial'}=$serials[$countdistinct];
+ } else {
+ $itemhash{$itemid[$i]}->{'serial'}=$newserial;
+ }
+ $itemhash{$itemid[$i]}->{'bibnum'}=$bibnums[$countdistinct];
$countdistinct++;
}
push @{$itemhash{$itemid[$i]}->{'tags'}},$tags[$i];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha C4/Biblio.pm C4/Serials.pm koha-tmpl/intra... [rel_3_0],
Henri-Damien LAURENT <=