[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Serials.pm
From: |
Henri-Damien LAURENT |
Subject: |
[Koha-cvs] koha/C4 Serials.pm |
Date: |
Wed, 27 Jun 2007 22:08:00 +0000 |
CVSROOT: /cvsroot/koha
Module name: koha
Changes by: Henri-Damien LAURENT <hdl> 07/06/27 22:08:00
Modified files:
C4 : Serials.pm
Log message:
Bug Fixing.
Problem in number calculation.
BEWARE... For old serial number calculation, the numbering_pattern
should be set to None of the above, that is 7 and not 1 or 2...
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&r1=1.22&r2=1.23
Patches:
Index: Serials.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Serials.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- Serials.pm 27 Jun 2007 15:10:44 -0000 1.22
+++ Serials.pm 27 Jun 2007 22:08:00 -0000 1.23
@@ -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.pm,v 1.22 2007/06/27 15:10:44 hdl Exp $
+# $Id: Serials.pm,v 1.23 2007/06/27 22:08:00 hdl Exp $
use strict;
use C4::Date;
@@ -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.22 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.23 $' =~ /\d+/g;
shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
};
@@ -927,6 +927,7 @@
$calculated, $newlastvalue1, $newlastvalue2, $newlastvalue3,
$newinnerloop1, $newinnerloop2, $newinnerloop3
);
+ use Data::Dumper; warn Dumper($val);
my $pattern = $val->{numberpattern};
my @seasons = ( 'nothing', 'Winter', 'Spring', 'Summer', 'Autumn' );
my @southern_seasons = ( '', 'Summer', 'Autumn', 'Winter', 'Spring' );
@@ -935,17 +936,20 @@
$newlastvalue2 = $val->{lastvalue2};
$newlastvalue3 = $val->{lastvalue3};
- if ( $newlastvalue3 > 0 ) { # if x y and z columns are used
- $newlastvalue3 = $newlastvalue3 + 1;
- if ( $newlastvalue3 > $val->{whenmorethan3} ) {
- $newlastvalue3 = $val->{setto3};
- $newlastvalue2++;
- if ( $newlastvalue2 > $val->{whenmorethan2} ) {
- $newlastvalue1++;
- $newlastvalue2 = $val->{setto2};
- }
- }
+ $newlastvalue1 = $val->{lastvalue1};
+ # check if we have to increase the new value.
+ $newinnerloop1 = $val->{innerloop1}+1;
+ $newinnerloop1=0 if ($newinnerloop1 >= $val->{every1});
+ $newlastvalue1 += $val->{add1} if ($newinnerloop1<1); # <1 to be true when 0
or empty.
+ $newlastvalue1=$val->{setto1} if ($newlastvalue1>$val->{whenmorethan1}); #
reset counter if needed.
$calculated =~ s/\{X\}/$newlastvalue1/g;
+
+ $newlastvalue2 = $val->{lastvalue2};
+ # check if we have to increase the new value.
+ $newinnerloop2 = $val->{innerloop2}+1;
+ $newinnerloop2=0 if ($newinnerloop2 >= $val->{every2});
+ $newlastvalue2 += $val->{add2} if ($newinnerloop2<1); # <1 to be true when 0
or empty.
+ $newlastvalue2=$val->{setto2} if ($newlastvalue2>$val->{whenmorethan2}); #
reset counter if needed.
if ( $pattern == 6 ) {
if ( $val->{hemisphere} == 2 ) {
my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
@@ -959,38 +963,16 @@
else {
$calculated =~ s/\{Y\}/$newlastvalue2/g;
}
+
+
+ $newlastvalue3 = $val->{lastvalue3};
+ # check if we have to increase the new value.
+ $newinnerloop3 = $val->{innerloop3}+1;
+ $newinnerloop3=0 if ($newinnerloop3 >= $val->{every3});
+ $newlastvalue3 += $val->{add3} if ($newinnerloop3<1); # <1 to be true when 0
or empty.
+ $newlastvalue3=$val->{setto3} if ($newlastvalue3>$val->{whenmorethan3}); #
reset counter if needed.
$calculated =~ s/\{Z\}/$newlastvalue3/g;
- }
- if ( $newlastvalue2 > 0 && $newlastvalue3 < 1 )
- { # if x and y columns are used
- $newlastvalue2 = $newlastvalue2 + 1;
- if ( $newlastvalue2 > $val->{whenmorethan2} ) {
- $newlastvalue2 = $val->{setto2};
- $newlastvalue1++;
- }
- $calculated =~ s/\{X\}/$newlastvalue1/g;
- if ( $pattern == 6 ) {
- if ( $val->{hemisphere} == 2 ) {
- my $newlastvalue2seq = $southern_seasons[$newlastvalue2];
- $calculated =~ s/\{Y\}/$newlastvalue2seq/g;
- }
- else {
- my $newlastvalue2seq = $seasons[$newlastvalue2];
- $calculated =~ s/\{Y\}/$newlastvalue2seq/g;
- }
- }
- else {
- $calculated =~ s/\{Y\}/$newlastvalue2/g;
- }
- }
- if ( $newlastvalue1 > 0 && $newlastvalue2 < 1 && $newlastvalue3 < 1 )
- { # if column x only
- $newlastvalue1 = $newlastvalue1 + 1;
- if ( $newlastvalue1 > $val->{whenmorethan1} ) {
- $newlastvalue1 = $val->{setto2};
- }
- $calculated =~ s/\{X\}/$newlastvalue1/g;
- }
+
return ( $calculated, $newlastvalue1, $newlastvalue2, $newlastvalue3 );
}
@@ -1224,10 +1206,12 @@
my $val = $sth->fetchrow_hashref;
# next issue number
+ warn "Next Seq";
my (
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3,
$newinnerloop1, $newinnerloop2, $newinnerloop3
) = GetNextSeq($val);
+ warn "Next Seq End";
# next date (calculated from actual date & frequency parameters)
# warn "publisheddate :$publisheddate ";
@@ -2320,7 +2304,7 @@
"select max(planneddate) from serial where subscriptionid=?");
$sth->execute($subscriptionid);
my ($res) = $sth->fetchrow ;
- warn "date expiration : ".$expirationdate." date courante ".$res;
+# warn "date expiration : ".$expirationdate." date courante ".$res;
my @res=split /-/,$res;
my @endofsubscriptiondate=split/-/,$expirationdate;
my $per = $subscription->{'periodicity'};