revamping a little opac-detail for subscription (adding more history information)
This commit is contained in:
parent
0157b46e13
commit
6c086454ff
|
|
@ -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/\<br\/\>/g;
|
||||
$subs->{missinglist} =~ s/\n/\<br\/\>/g;
|
||||
$subs->{recievedlist} =~ s/\n/\<br\/\>/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);
|
||||
|
|
|
|||
|
|
@ -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 '',
|
||||
|
|
|
|||
|
|
@ -569,13 +569,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
|
|||
|
||||
<!-- TMPL_IF name="subscriptionsnumber" -->
|
||||
<div id="subscriptions">
|
||||
<h2>This is a serial subscription</h2>
|
||||
<p> (There are <!-- TMPL_VAR NAME="subscriptionsnumber" --> subscriptions associated with this title).</p>
|
||||
<h2>This is a serial</h2>
|
||||
<p>There are <!-- TMPL_VAR NAME="subscriptionsnumber" --> subscription(s) associated with this title.</p>
|
||||
<!-- TMPL_LOOP Name="subscriptions" -->
|
||||
<!-- TMPL_IF name="branchname" --><h3>At library: <!-- TMPL_VAR NAME="branchname" --></h3><!-- TMPL_ELSE -->
|
||||
<!-- TMPL_IF name="branchcode" --><h3>At branch: <!-- TMPL_VAR NAME="branchcode" --></h3><!-- /TMPL_IF --><!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="subscriptionnotes" --><p><!--TMPL_VAR NAME="subscriptionnotes"--> </p><!-- /TMPL_IF -->
|
||||
<!--TMPL_IF NAME="latestserials"-->
|
||||
<p>Issues between: <!--TMPL_VAR NAME="histstartdate"--> and:<!-- TMPL_IF NAME="histenddate" --> <!--TMPL_VAR NAME="histenddate"--> <!-- TMPL_ELSE --> now (current)<!-- /TMPL_IF --></p>
|
||||
<!-- TMPL_IF NAME="missinglist" --><p>Missing issues: <!--TMPL_VAR NAME="missinglist"--> </p><!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF name="opacnote" --><p>(<!-- TMPL_VAR NAME="opacnote" -->)</p><!-- /TMPL_IF -->
|
||||
<!--TMPL_IF NAME="latestserials"-->
|
||||
<p> The <!-- TMPL_VAR NAME="opacdisplaycount" --> latest issues for this subscription:</p>
|
||||
<table>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ foreach my $subscription (@subscriptions) {
|
|||
my %cell;
|
||||
$cell{subscriptionid} = $subscription->{subscriptionid};
|
||||
$cell{subscriptionnotes} = $subscription->{notes};
|
||||
$cell{missinglist} = $subscription->{missinglist};
|
||||
$cell{opacnote} = $subscription->{opacnote};
|
||||
$cell{histstartdate} = format_date($subscription->{histstartdate});
|
||||
$cell{histenddate} = format_date($subscription->{histenddate});
|
||||
$cell{branchcode} = $subscription->{branchcode};
|
||||
$cell{branchname} = GetBranchName($subscription->{branchcode});
|
||||
$cell{hasalert} = $subscription->{hasalert};
|
||||
|
|
|
|||
Loading…
Reference in New Issue