[Koha-cvs] CVS: koha/C4 Bull.pm,1.4,1.5
Paul POULAIN
tipaul at users.sourceforge.net
Mon Sep 20 12:16:09 CEST 2004
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23646/C4
Modified Files:
Bull.pm
Log Message:
some changes in serial management :
* in subscription Add, the issue number & date is used to calculate the 1st issue (previously, a "next issue number & date" was applied, meaning you had to enter the number & date of a previous issue)
* the "inner loop" used for serials number ({XYZ}) is now shown & can be modified. The innerloop is used for numbering formulas saying "change the number once every 4 times".
Index: Bull.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Bull.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Bull.pm 12 Aug 2004 14:36:29 -0000 1.4
--- Bull.pm 20 Sep 2004 10:16:06 -0000 1.5
***************
*** 83,97 ****
$sth->execute($subscriptionid);
my $val = $sth->fetchrow_hashref;
# next issue number
! my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = Get_Next_Seq($val);
# next date (calculated from actual date & frequency parameters)
! my $nextplanneddate = Get_Next_Date($startdate,$val);
! $sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)");
! $sth->execute($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate);
! $sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?,
! innerloop1=?,innerloop2=?,innerloop3=?
! where subscriptionid = ?");
! $sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3,$subscriptionid);
! $sth->finish;
return $subscriptionid;
}
--- 83,101 ----
$sth->execute($subscriptionid);
my $val = $sth->fetchrow_hashref;
+
+ # calculate issue number
+ my $serialseq = Get_Seq($val);
+ $sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)");
+ $sth->execute($serialseq, $subscriptionid, $val->{'biblionumber'}, 1, format_date_in_iso($startdate));
+
# next issue number
! #my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = Get_Next_Seq($val);
# next date (calculated from actual date & frequency parameters)
! #my $nextplanneddate = Get_Next_Date($startdate,$val);
! # $sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?,
! # innerloop1=?,innerloop2=?,innerloop3=?
! # where subscriptionid = ?");
! # $sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3,$subscriptionid);
! # $sth->finish;
return $subscriptionid;
}
***************
*** 123,142 ****
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
! $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
! $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
! $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $status, $biblionumber, $notes, $subscriptionid)= @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("update subscription set librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
periodicity=?,dow=?,numberlength=?,weeklength=?,monthlength=?,
! add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,
! add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,
! add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,
numberingmethod=?, status=?, biblionumber=?, notes=? where subscriptionid = ?");
$sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
! $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
! $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
! $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $status, $biblionumber, $notes, $subscriptionid);
$sth->finish;
--- 127,146 ----
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
! $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
! $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
! $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
$numberingmethod, $status, $biblionumber, $notes, $subscriptionid)= @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("update subscription set librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
periodicity=?,dow=?,numberlength=?,weeklength=?,monthlength=?,
! add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
! add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
! add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
numberingmethod=?, status=?, biblionumber=?, notes=? where subscriptionid = ?");
$sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
! $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
! $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
! $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
$numberingmethod, $status, $biblionumber, $notes, $subscriptionid);
$sth->finish;
***************
*** 149,153 ****
my $sth;
$sth = $dbh->prepare("select subscription.subscriptionid,biblio.title,biblioitems.issn from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and (biblio.title like ? or biblioitems.issn = ? )");
! $sth->execute($title,$ISSN);
my @results;
while (my $line = $sth->fetchrow_hashref) {
--- 153,157 ----
my $sth;
$sth = $dbh->prepare("select subscription.subscriptionid,biblio.title,biblioitems.issn from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and (biblio.title like ? or biblioitems.issn = ? )");
! $sth->execute("%$title%",$ISSN);
my @results;
while (my $line = $sth->fetchrow_hashref) {
***************
*** 258,261 ****
--- 262,277 ----
}
+ sub Get_Seq {
+ my ($val) =@_;
+ my $calculated = $val->{numberingmethod};
+ my $x=$val->{'lastvalue1'};
+ $calculated =~ s/\{X\}/$x/g;
+ my $y=$val->{'lastvalue2'};
+ $calculated =~ s/\{Y\}/$y/g;
+ my $z=$val->{'lastvalue3'};
+ $calculated =~ s/\{Z\}/$z/g;
+ return $calculated;
+ }
+
sub Get_Next_Seq {
my ($val) =@_;
More information about the Koha-cvs
mailing list