Adding some more information on issuehistory.
Adding itemnumber to issuehistory.pl API so that one could search for issuehistory of a specific item. (Useful for IndependantBranches) Signed-off-by: Chris Cormack <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
aa38c487e9
commit
95d6452462
|
|
@ -1468,8 +1468,10 @@ sub GetItemIssues {
|
|||
|
||||
my $sth = $dbh->prepare(
|
||||
"SELECT * FROM issues
|
||||
LEFT JOIN borrowers ON borrowers.borrowernumber
|
||||
LEFT JOIN items ON items.itemnumber=issues.itemnumber
|
||||
WHERE
|
||||
itemnumber=?".($history?"":" AND returndate IS NULL ").
|
||||
issues.itemnumber=?".($history?"":" AND returndate IS NULL ").
|
||||
"ORDER BY issues.date_due DESC"
|
||||
);
|
||||
$sth->execute($itemnumber);
|
||||
|
|
@ -1480,7 +1482,6 @@ sub GetItemIssues {
|
|||
$data->{'overdue'} = 1;
|
||||
}
|
||||
my $itemnumber = $data->{'itemnumber'};
|
||||
|
||||
push @GetItemIssues, $data;
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -1504,7 +1505,7 @@ sub GetBiblioIssues {
|
|||
return undef unless $biblionumber;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
SELECT issues.*,biblio.biblionumber,biblio.title, biblio.author,borrowers.cardnumber,borrowers.surname,borrowers.firstname
|
||||
SELECT issues.*,items.barcode,biblio.biblionumber,biblio.title, biblio.author,borrowers.cardnumber,borrowers.surname,borrowers.firstname
|
||||
FROM issues
|
||||
LEFT JOIN borrowers ON borrowers.borrowernumber = issues.borrowernumber
|
||||
LEFT JOIN items ON issues.itemnumber = items.itemnumber
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ use C4::Auth;
|
|||
use C4::Output;
|
||||
|
||||
use C4::Circulation; # GetBiblioIssues
|
||||
use C4::Biblio; # GetBiblio GetBiblioFromItemNumber
|
||||
use C4::Date;
|
||||
|
||||
my $query = new CGI;
|
||||
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
||||
|
|
@ -39,22 +41,36 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|||
my $params = $query->Vars;
|
||||
|
||||
my $biblionumber = $params->{'biblionumber'};
|
||||
my $itemnumber = $params->{'itemnumber'};
|
||||
my $title = $params->{'title'};
|
||||
my $author = $params->{'author'};
|
||||
|
||||
my $issues = GetBiblioIssues($biblionumber);
|
||||
my $total = scalar @$issues;
|
||||
|
||||
if ( $total && !$title ) {
|
||||
$title = $issues->[0]->{'title'};
|
||||
$author = $issues->[0]->{'author'};
|
||||
}
|
||||
|
||||
my ($issues,$biblio,$title,$author,$barcode);
|
||||
if ($itemnumber){
|
||||
$issues=GetItemIssues($itemnumber);
|
||||
$biblio=GetBiblioFromItemNumber($itemnumber);
|
||||
$biblionumber=$biblio->{biblionumber};
|
||||
$barcode=$issues->[0]->{barcode};
|
||||
$template->param(
|
||||
%$biblio,
|
||||
barcode=> $barcode,
|
||||
);
|
||||
} else {
|
||||
my @biblio;
|
||||
$issues = GetBiblioIssues($biblionumber);
|
||||
my (undef,@biblio)=GetBiblio($biblionumber);
|
||||
my $total = scalar @$issues;
|
||||
$template->param(
|
||||
%{$biblio[0]},
|
||||
);
|
||||
}
|
||||
foreach (@$issues){
|
||||
$_->{date_due}=format_date($_->{date_due});
|
||||
$_->{issuedate}=format_date($_->{issuedate});
|
||||
$_->{returndate}=format_date($_->{returndate});
|
||||
}
|
||||
$template->param(
|
||||
biblionumber => $biblionumber,
|
||||
total => scalar @$issues,
|
||||
title => $title,
|
||||
author => $author,
|
||||
issues => $issues
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,16 @@
|
|||
<tr><th>Date</th>
|
||||
<th>Surname</th>
|
||||
<th>Firstname</th>
|
||||
<th>Barcode</th>
|
||||
<th>Branchcode</th>
|
||||
<th>Issuing branch</th>
|
||||
<th>Renew</th>
|
||||
<th>Date due</th>
|
||||
<th>Return date</th></tr>
|
||||
<!-- TMPL_LOOP NAME="issues" -->
|
||||
<tr>
|
||||
<td><!-- TMPL_IF NAME="timestamp" -->
|
||||
<!-- TMPL_VAR NAME="timestamp" -->
|
||||
<td><!-- TMPL_IF NAME="issuedate" -->
|
||||
<!-- TMPL_VAR NAME="issuedate" -->
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF --></td>
|
||||
|
|
@ -49,6 +51,16 @@
|
|||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF --></td>
|
||||
<td><!-- TMPL_IF NAME="barcode" -->
|
||||
<!-- TMPL_VAR NAME="barcode" -->
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF --></td>
|
||||
<td><!-- TMPL_IF NAME="branchcode" -->
|
||||
<!-- TMPL_VAR NAME="branchcode" -->
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<!-- /TMPL_IF --></td>
|
||||
<td><!-- TMPL_IF NAME="issuingbranch" -->
|
||||
<!-- TMPL_VAR NAME="issuingbranch" -->
|
||||
<!-- TMPL_ELSE -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue