[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/C4 Bull.pm,1.6.2.10,1.6.2.11
From: |
Henri-Damien LAURENT |
Subject: |
[Koha-cvs] CVS: koha/C4 Bull.pm,1.6.2.10,1.6.2.11 |
Date: |
Tue, 28 Jun 2005 00:35:51 -0700 |
Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20116/C4
Modified Files:
Tag: rel_2_2
Bull.pm
Log Message:
Adding not issued and delete state to state collection
And display the three latest numbers of every subscription received or lacked
in opac.
Index: Bull.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Bull.pm,v
retrieving revision 1.6.2.10
retrieving revision 1.6.2.11
diff -C2 -r1.6.2.10 -r1.6.2.11
*** Bull.pm 17 Jun 2005 15:51:54 -0000 1.6.2.10
--- Bull.pm 28 Jun 2005 07:35:49 -0000 1.6.2.11
***************
*** 49,53 ****
&get_full_subscription_list_from_biblionumber
&modsubscriptionhistory &newissue
! &getserials &serialchangestatus
&Find_Next_Date, &Get_Next_Seq
&hassubscriptionexpired &subscriptionexpirationdate
&subscriptionrenew
--- 49,53 ----
&get_full_subscription_list_from_biblionumber
&modsubscriptionhistory &newissue
! &getserials &getlatestserials &serialchangestatus
&Find_Next_Date, &Get_Next_Seq
&hassubscriptionexpired &subscriptionexpirationdate
&subscriptionrenew
***************
*** 348,352 ****
my $dbh = C4::Context->dbh;
# status = 2 is "arrived"
! my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate
from serial where subscriptionid = ? and status <>2 and status <>4");
$sth->execute($subscriptionid);
my @serials;
--- 348,352 ----
my $dbh = C4::Context->dbh;
# status = 2 is "arrived"
! my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate
from serial where subscriptionid = ? and status <>2 and status <>4 and status
<>5");
$sth->execute($subscriptionid);
my @serials;
***************
*** 362,365 ****
--- 362,385 ----
}
+ # get the $limit's latest serials arrived or missing for a given subscription
+ sub getlatestserials{
+ my ($subscriptionid,$limit) address@hidden;
+ my $dbh = C4::Context->dbh;
+ # status = 2 is "arrived"
+ my $strsth="select serialid,serialseq, status, planneddate from serial
where subscriptionid = ? and (status =2 or status=4) order by planneddate DESC
LIMIT 0,$limit";
+ my $sth=$dbh->prepare($strsth);
+ $sth->execute($subscriptionid);
+ my @serials;
+ while(my $line = $sth->fetchrow_hashref) {
+ $line->{"status".$line->{status}} = 1; # fills a "statusX"
value, used for template status select list
+ $line->{"planneddate"} = format_date($line->{"planneddate"});
+ push @serials,$line;
+ }
+ $sth=$dbh->prepare("select count(*) from serial where
subscriptionid=?");
+ $sth->execute($subscriptionid);
+ my ($totalissues) = $sth->fetchrow;
+ return address@hidden;
+ }
+
sub serialchangestatus {
my ($serialid,$serialseq,$planneddate,$status)address@hidden;
***************
*** 371,387 ****
my ($subscriptionid,$oldstatus) = $sth->fetchrow;
# change status & update subscriptionhistory
! $sth = $dbh->prepare("update serial set
serialseq=?,planneddate=?,status=? where serialid = ?");
! $sth->execute($serialseq,$planneddate,$status,$serialid);
! $sth = $dbh->prepare("select missinglist,recievedlist from
subscriptionhistory where subscriptionid=?");
! $sth->execute($subscriptionid);
! my ($missinglist,$recievedlist) = $sth->fetchrow;
! if ($status eq 2) {
! $recievedlist .= ",$serialseq";
! }
! if ($status eq 4) {
! $missinglist .= ",$serialseq";
}
- $sth=$dbh->prepare("update subscriptionhistory set recievedlist=?,
missinglist=? where subscriptionid=?");
- $sth->execute($recievedlist,$missinglist,$subscriptionid);
# create new waited entry if needed (ie : was a "waited" and has
changed)
if ($oldstatus eq 1 && $status ne 1) {
--- 391,410 ----
my ($subscriptionid,$oldstatus) = $sth->fetchrow;
# change status & update subscriptionhistory
! if ($status eq 6){
! delissue($serialseq, $subscriptionid)
! }else{
! $sth = $dbh->prepare("update serial set
serialseq=?,planneddate=?,status=? where serialid = ?");
! $sth->execute($serialseq,$planneddate,$status,$serialid);
! $sth = $dbh->prepare("select missinglist,recievedlist from
subscriptionhistory where subscriptionid=?");
! $sth->execute($subscriptionid);
! my ($missinglist,$recievedlist) = $sth->fetchrow;
! if ($status eq 2) {
! $recievedlist .= ",$serialseq";
! }
! $missinglist .= ",$serialseq" if ($status eq 4) ;
! $missinglist .= ",not issued $serialseq" if ($status eq 5);
! $sth=$dbh->prepare("update subscriptionhistory set
recievedlist=?, missinglist=? where subscriptionid=?");
! $sth->execute($recievedlist,$missinglist,$subscriptionid);
}
# create new waited entry if needed (ie : was a "waited" and has
changed)
if ($oldstatus eq 1 && $status ne 1) {
***************
*** 419,422 ****
--- 442,452 ----
}
+ sub delissue {
+ my ($serialseq,$subscriptionid) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("delete from serial where serialseq= ? and
subscriptionid= ? ");
+ $sth->execute($serialseq,$subscriptionid);
+ }
+
sub Get_Next_Date(@) {
my ($planneddate,$subscription) = @_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/C4 Bull.pm,1.6.2.10,1.6.2.11,
Henri-Damien LAURENT <=