From 95d6452462a560ba0c0ac859a2cfb7783c25c925 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Thu, 18 Oct 2007 18:37:02 -0500 Subject: [PATCH] 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 Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 7 ++-- catalogue/issuehistory.pl | 34 ++++++++++++++----- .../en/modules/catalogue/issuehistory.tmpl | 16 +++++++-- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index ed906326c0..758f99b36f 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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 diff --git a/catalogue/issuehistory.pl b/catalogue/issuehistory.pl index 113e77d699..2db1735574 100755 --- a/catalogue/issuehistory.pl +++ b/catalogue/issuehistory.pl @@ -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 ($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; - -if ( $total && !$title ) { - $title = $issues->[0]->{'title'}; - $author = $issues->[0]->{'author'}; +$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 ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tmpl index afb3f4d665..71b7ed2611 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tmpl @@ -26,14 +26,16 @@ Date Surname Firstname + Barcode + Branchcode Issuing branch Renew Date due Return date - - + +   @@ -49,6 +51,16 @@   + + + +   + + + + +   + -- 2.39.5