From 46f8bc47f2532ee751145d2415509d1e55fecd8d Mon Sep 17 00:00:00 2001 From: hdl Date: Thu, 2 Jun 2005 21:04:35 +0000 Subject: [PATCH] Adding full history support to opac serial Needs fixing --- C4/Bull.pm | 36 ++++++++++- .../css/en/opac-full-serial-issues.tmpl | 63 +++++++++++++++++++ opac/opac-serial-issues.pl | 38 ++++++++++- 3 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/css/en/opac-full-serial-issues.tmpl diff --git a/C4/Bull.pm b/C4/Bull.pm index 752e03847a..7231897dde 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -46,6 +46,7 @@ Give all XYZ functions @ISA = qw(Exporter); @EXPORT = qw(&newsubscription &modsubscription &delsubscription &getsubscriptions &getsubscription &getsubscriptionfrombiblionumber &get_subscription_list_from_biblionumber + &get_full_subscription_list_from_biblionumber &modsubscriptionhistory &newissue &getserials &serialchangestatus &Find_Next_Date, &Get_Next_Seq @@ -166,7 +167,7 @@ sub getsubscriptionfrombiblionumber { sub get_subscription_list_from_biblionumber { my ($biblionumber) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('select subscription.*,subscriptionhistory.*,aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle + my $sth = $dbh->prepare('select subscription.*,subscriptionhistory.*, aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle from subscription left join subscriptionhistory on subscription.subscriptionid=subscriptionhistory.subscriptionid left join aqbudget on subscription.aqbudgetid=aqbudget.aqbudgetid @@ -185,6 +186,39 @@ sub get_subscription_list_from_biblionumber { return \@res; } +sub get_full_subscription_list_from_biblionumber { + my ($biblionumber) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare('select year(subscription.startdate) as year,subscription.*, aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle + from subscription + left join aqbudget on subscription.aqbudgetid=aqbudget.aqbudgetid + left join aqbooksellers on subscription.aqbooksellerid=aqbooksellers.id + left join biblio on biblio.biblionumber=subscription.biblionumber + where subscription.biblionumber = ? order by subscription.startdate'); + $sth->execute($biblionumber); + my @res; + my $year; + my @loopissues; + while (my $subs = $sth->fetchrow_hashref) { + my $sth2 = $dbh->prepare('select serial.serialseq, serial.planneddate, year(serial.planneddate) as year, serial.status from serial where serial.biblionumber = ? and serial.subscriptionid=? order by serial.planneddate'); + $sth2->execute($biblionumber,$subs->{'subscriptionid'}); + while (my $issues = $sth2->fetchrow_hashref){ + push @loopissues, + {'planneddate' => $issues->{'planneddate'}, + 'serialseq' => $issues->{'serialseq'}, + 'status' => $issues->{'status'}}; +# warn "planneddate ".$issues->{'planneddate'}; +# warn "serialseq".$issues->{'serialseq'}; + } + my %cell; + $cell{'year'}=$subs->{year}; + $cell{'title'}=$subs->{title}; + $cell{'booksellername'}=$subs->{booksellername}; + $cell{'serials'}=\@loopissues; + push @res,\%cell; + } + return \@res; +} sub modsubscription { my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate, diff --git a/koha-tmpl/opac-tmpl/css/en/opac-full-serial-issues.tmpl b/koha-tmpl/opac-tmpl/css/en/opac-full-serial-issues.tmpl new file mode 100644 index 0000000000..11733d87fa --- /dev/null +++ b/koha-tmpl/opac-tmpl/css/en/opac-full-serial-issues.tmpl @@ -0,0 +1,63 @@ + + + + +
+

Issues for a subscription

+" class="button catalogue">Back to biblio +

Subscription information for biblio number : with title :

+ +
+ +
+ + +
">)">
+ + +
+ + +
XX" id="XX" class="tab" style="visibility:visible"> + + + + + + + + + + + + + + + + + + + diff --git a/opac/opac-serial-issues.pl b/opac/opac-serial-issues.pl index 62812d167c..1dcad7ff61 100755 --- a/opac/opac-serial-issues.pl +++ b/opac/opac-serial-issues.pl @@ -14,10 +14,46 @@ use HTML::Template; my $query = new CGI; my $op = $query->param('op'); my $dbh = C4::Context->dbh; +my $selectview = C4::Context->preference("SubscriptionHistory"); +warn "selectview : ".$selectview; + my $sth; # my $id; my ($template, $loggedinuser, $cookie); my $biblionumber = $query->param('biblionumber'); +if ($selectview eq "full"){ +my $subscriptions = get_full_subscription_list_from_biblionumber($biblionumber); + +my $year; +my $yearmin=$subscriptions->[1]{year}; +warn "yearmin".$yearmin; +my $yearmax; +my @loopissues; +my $yearmax=$subscriptions->[scalar(@$subscriptions)]{year}; +warn "yearmax".$yearmax; + + +($template, $loggedinuser, $cookie) += get_template_and_user({template_name => "opac-full-serial-issues.tmpl", + query => $query, + type => "opac", + authnotrequired => 1, + debug => 1, + }); + +# replace CR by
in librarian note +# $subscription->{opacnote} =~ s/\n/\/g; + +$template->param( + biblionumber => $query->param('biblionumber'), + years => $subscriptions, + yearmin => $yearmin, + yearmax =>$yearmax, + suggestion => C4::Context->preference("suggestion"), + virtualshelves => C4::Context->preference("virtualshelves"), + ); + +} else { my $subscriptions = get_subscription_list_from_biblionumber($biblionumber); ($template, $loggedinuser, $cookie) @@ -37,5 +73,5 @@ $template->param( suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), ); - +} output_html_with_http_headers $query, $cookie, $template->output;
Date + Number + Status +
+ + + + + +