From 27ce1d1c238aabbd8685d52172aad740dcf5aec9 Mon Sep 17 00:00:00 2001 From: hdl Date: Fri, 17 Jun 2005 13:44:25 +0000 Subject: [PATCH] Detailing the three latest issues on OPAC for serials --- C4/Bull.pm | 19 ++++++++- koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl | 45 ++++++++++++++++++--- opac/opac-detail.pl | 18 ++++++++- 3 files changed, 72 insertions(+), 10 deletions(-) diff --git a/C4/Bull.pm b/C4/Bull.pm index 0307a6e926..2bbc0a9b91 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -50,7 +50,7 @@ Give all XYZ functions &getserials &serialchangestatus &Find_Next_Date, &Get_Next_Seq &hassubscriptionexpired &subscriptionexpirationdate &subscriptionrenew - &getSupplierListWithLateIssues &GetLateIssues &serialdelete); + &getSupplierListWithLateIssues &GetLateIssues &serialdelete &getlatestserials); sub getSupplierListWithLateIssues { my $dbh = C4::Context->dbh; @@ -287,6 +287,21 @@ sub getserials { my ($totalissues) = $sth->fetchrow; return ($totalissues,@serials); } +sub getlatestserials{ + my ($subscriptionid,$limit) =@_; + 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; + } + return \@serials; +} sub serialdelete { my ($serialid,$serialseq)=@_; @@ -316,7 +331,7 @@ sub serialchangestatus { my ($subscriptionid,$oldstatus) = $sth->fetchrow; # change status & update subscriptionhistory if ($status eq 6){ - delissue($serialseq, $subscriptionid) + delissue($serialseq, $subscriptionid); }else{ $sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=? where serialid = ?"); $sth->execute($serialseq,$planneddate,$status,$serialid); diff --git a/koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl b/koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl index 76b8970b53..546848b181 100644 --- a/koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/css/en/opac-detail.tmpl @@ -157,12 +157,45 @@ -

- This is a serial subscription (we have subscriptions). You can see which - " class="button catalogue" title="Serial issues"> - Issues - we have and don't have -

+
+

This is a serial subscription (There are subscriptions associated with this title).

+ + Subscription # +

+ +

Here comes a list of the three latest issues related to this subscription :

+ + + + + + + + +
+ + + + + Waited + + Arrived + + Late + + Missing + + Not Issued + + + + + +
+ + +

For more information : You can see " title="Serial issues"> for Issues we have and don't have

+
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 04335be099..feb377a58d 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -29,7 +29,6 @@ my $dat = &bibdata($biblionumber); my ($authorcount, $addauthor) = &addauthor($biblionumber); my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber); my ($websitecount, @websites) = &getwebsites($biblionumber); -my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber); $dat->{'count'}=@items; @@ -66,11 +65,26 @@ my $itemsarray=\@items; my $webarray=\@webbiblioitems; my $sitearray=\@websites; +#coping with subscriptions +my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber); +my @subscriptions = getsubscriptions($dat->{title},$dat->{issn},$biblionumber); +my @subs; +foreach my $subscription (@subscriptions){ + warn "subsid :".$subscription->{subscriptionid}; + my %cell; + $cell{subscriptionid}= $subscription->{subscriptionid}; + $cell{subscriptionnotes}= $subscription->{notes}; + #get the three latest serials. + $cell{latestserials}=getlatestserials($subscription->{subscriptionid},3); + push @subs, \%cell; +} + $template->param(BIBLIO_RESULTS => $resultsarray, ITEM_RESULTS => $itemsarray, WEB_RESULTS => $webarray, SITE_RESULTS => $sitearray, subscriptionsnumber => $subscriptionsnumber, + subscriptions => \@subs, LibraryName => C4::Context->preference("LibraryName"), suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), @@ -107,5 +121,5 @@ $template->param( REVIEWS => \@reviews ); =cut output_html_with_http_headers $query, $cookie, $template->output; -output_html_with_http_headers $query, $cookie, $template->output; +#output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5