X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=catalogue%2Fissuehistory.pl;h=fdb9fb12462d9e4dbc6bb2573d688ea168b80b2b;hb=fe00a94164fe3619943efcf29d8d3d294b7fcc9c;hp=aa2d3452bd8f501512dd27650307f4d7d4215c12;hpb=c596d553740ebb6299b133fc6b71ca47ed0ff2e7;p=koha_gimpoz diff --git a/catalogue/issuehistory.pl b/catalogue/issuehistory.pl index aa2d3452bd..fdb9fb1246 100755 --- a/catalogue/issuehistory.pl +++ b/catalogue/issuehistory.pl @@ -15,15 +15,16 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA -# $Id$ use strict; require Exporter; use CGI; use C4::Auth; -use C4::Interface::CGI::Output; +use C4::Output; use C4::Circulation; # GetBiblioIssues +use C4::Biblio; # GetBiblio GetBiblioFromItemNumber +use C4::Dates; my $query = new CGI; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( @@ -40,23 +41,37 @@ 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,$barcode); +if ($itemnumber){ + $issues=GetItemIssues($itemnumber); + $biblio=GetBiblioFromItemNumber($itemnumber); + $biblionumber=$biblio->{biblionumber}; + $barcode=$issues->[0]->{barcode}; + $template->param( + %$biblio, + barcode=> $barcode, + ); +} else { + $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 + issues => $issues, + issuehistoryview => 1, ); output_html_with_http_headers $query, $cookie, $template->output;