diff --git a/C4/Serials.pm b/C4/Serials.pm
index 3c47651bb4..c6372e4575 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -533,7 +533,7 @@ sub GetSubscriptionsFromBiblionumber {
while ( my $subs = $sth->fetchrow_hashref ) {
$subs->{startdate} = format_date( $subs->{startdate} );
$subs->{histstartdate} = format_date( $subs->{histstartdate} );
- $subs->{histenddate} = format_date( $subs->{histenddate} );
+ $subs->{enddate} = format_date( $subs->{enddate} );
$subs->{opacnote} =~ s/\n/\
/g;
$subs->{missinglist} =~ s/\n/\
/g;
$subs->{recievedlist} =~ s/\n/\
/g;
@@ -625,44 +625,45 @@ sub GetSubscriptions {
my $dbh = C4::Context->dbh;
my $sth;
my $sql = qq(
- SELECT subscription.*,biblio.title,biblioitems.issn,biblio.biblionumber
+ SELECT subscription.*, subscriptionhistory.*, biblio.title,biblioitems.issn,biblio.biblionumber
FROM subscription
+ LEFT JOIN subscriptionhistory USING(subscriptionid)
LEFT JOIN biblio ON biblio.biblionumber = subscription.biblionumber
LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber
);
- my @bind_params;
- my $sqlwhere;
+ my @bind_params;
+ my $sqlwhere;
if ($biblionumber) {
$sqlwhere=" WHERE biblio.biblionumber=?";
- push @bind_params,$biblionumber;
+ push @bind_params,$biblionumber;
}
if ($string){
- my @sqlstrings;
- my @strings_to_search;
- @strings_to_search=map {"%$_%"} split (/ /,$string);
- foreach my $index qw(biblio.title subscription.callnumber subscription.location subscription.notes subscription.internalnotes){
- push @bind_params,@strings_to_search;
- my $tmpstring= "AND $index LIKE ? "x scalar(@strings_to_search);
- $debug && warn "$tmpstring";
- $tmpstring=~s/^AND //;
- push @sqlstrings,$tmpstring;
- }
- $sqlwhere.= ($sqlwhere?" AND ":" WHERE ")."(".join(") OR (",@sqlstrings).")";
- }
+ my @sqlstrings;
+ my @strings_to_search;
+ @strings_to_search=map {"%$_%"} split (/ /,$string);
+ foreach my $index qw(biblio.title subscription.callnumber subscription.location subscription.notes subscription.internalnotes){
+ push @bind_params,@strings_to_search;
+ my $tmpstring= "AND $index LIKE ? "x scalar(@strings_to_search);
+ $debug && warn "$tmpstring";
+ $tmpstring=~s/^AND //;
+ push @sqlstrings,$tmpstring;
+ }
+ $sqlwhere.= ($sqlwhere?" AND ":" WHERE ")."(".join(") OR (",@sqlstrings).")";
+ }
if ($issn){
- my @sqlstrings;
- my @strings_to_search;
- @strings_to_search=map {"%$_%"} split (/ /,$issn);
- foreach my $index qw(biblioitems.issn subscription.callnumber){
- push @bind_params,@strings_to_search;
- my $tmpstring= "OR $index LIKE ? "x scalar(@strings_to_search);
- $debug && warn "$tmpstring";
- $tmpstring=~s/^OR //;
- push @sqlstrings,$tmpstring;
- }
- $sqlwhere.= ($sqlwhere?" AND ":" WHERE ")."(".join(") OR (",@sqlstrings).")";
- }
- $sql.="$sqlwhere ORDER BY title";
+ my @sqlstrings;
+ my @strings_to_search;
+ @strings_to_search=map {"%$_%"} split (/ /,$issn);
+ foreach my $index qw(biblioitems.issn subscription.callnumber){
+ push @bind_params,@strings_to_search;
+ my $tmpstring= "OR $index LIKE ? "x scalar(@strings_to_search);
+ $debug && warn "$tmpstring";
+ $tmpstring=~s/^OR //;
+ push @sqlstrings,$tmpstring;
+ }
+ $sqlwhere.= ($sqlwhere?" AND ":" WHERE ")."(".join(") OR (",@sqlstrings).")";
+ }
+ $sql.="$sqlwhere ORDER BY title";
$debug and warn "GetSubscriptions query: $sql params : ", join (" ",@bind_params);
$sth = $dbh->prepare($sql);
$sth->execute(@bind_params);
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index ba40e631eb..9f0c2c17be 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1704,7 +1704,7 @@ CREATE TABLE `subscriptionhistory` (
`biblionumber` int(11) NOT NULL default 0,
`subscriptionid` int(11) NOT NULL default 0,
`histstartdate` date default NULL,
- `enddate` date default NULL,
+ `histenddate` date default NULL,
`missinglist` longtext NOT NULL,
`recievedlist` longtext NOT NULL,
`opacnote` varchar(150) NOT NULL default '',
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
index 6795b17c4c..095463555e 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
@@ -569,13 +569,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
(There are subscriptions associated with this title).
+There are subscription(s) associated with this title.
- +
Issues between: and: now (current)
+Missing issues:
+()
+The latest issues for this subscription: