From a8ba013e1e4afc9e3cfada1e15178bc1dce0cc59 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Mon, 24 Dec 2007 02:59:17 -0500 Subject: [PATCH] Synching opac with fixes to reserves adding back dev_week opac reserve cancel feature that was removed Could use some style improvements Signed-off-by: Joshua Ferraro --- .../prog/en/modules/opac-detail.tmpl | 2 +- .../prog/en/modules/opac-reserve.tmpl | 157 ++++++++++-------- .../opac-tmpl/prog/en/modules/opac-user.tmpl | 9 +- opac/opac-modrequest.pl | 46 +++++ opac/opac-reserve.pl | 35 ++-- reserve/request.pl | 3 +- 6 files changed, 159 insertions(+), 93 deletions(-) create mode 100755 opac/opac-modrequest.pl 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 44d82dd1d6..401cb02b7e 100755 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -217,7 +217,7 @@ Not for loan - On issue + Checked out diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl index 685d3c52d0..06f2ff5387 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl @@ -69,90 +69,103 @@ ">

Place a hold on , by

For: ()

- +

Priority: out of ?

+

Pick up from: +

+

+ +

+ " /> + +

+ + + +

Item type:

+

Publication year:

- + +
+ + + + - + - - - "> - - - - - - - - + + "> + + + + + + + + + + + + +
HoldItem type Barcode Home LibraryHolding LibraryLast Location Call number InformationCancel a Reserve
- - - - - - - - - - Due - - - - - - - - - Item on hold since - - - - Cant' be selected (lost or long overdue) - - - - This item is not for loan () - - - - Item in transit from , - to , on - - - - Item on hold - - No holds - -
+ + " /> + + " /> + + + " alt="" title=""/> + + + + + + + + + + + Due + + + + Unavailable (lost or missing) + + + + Not for loan () + + + In transit from , + to , since + + + + WaitingOn hold for patron + atexpected at + since + . + + Not on hold + +
-

- -

- " /> -

Pick up from: -

-

- diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl index 7e6a945b65..18b3af0c33 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl @@ -247,6 +247,7 @@ No renewals left Placed On Pick Up Location Status + Modify @@ -266,12 +267,18 @@ No renewals left Item waiting to be pulled from - Item being transfered to " /> + Item in transit to " /> Item waiting to be pulled + +
+ " /> +
+ + diff --git a/opac/opac-modrequest.pl b/opac/opac-modrequest.pl new file mode 100755 index 0000000000..45ab861b36 --- /dev/null +++ b/opac/opac-modrequest.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +#script to modify reserves/requests +#written 2/1/00 by chris@katipo.oc.nz +#last update 27/1/2000 by chris@katipo.co.nz + + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +use CGI; +use C4::Output; +use C4::Reserves; +use C4::Auth; +my $query = new CGI; +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-account.tmpl", + query => $query, + type => "opac", + authnotrequired => 0, + flagsrequired => { borrow => 1 }, + debug => 1, + } +); + +my $biblionumber = $query->param('biblionumber'); +if ($biblionumber and $borrowernumber) { + CancelReserve($biblionumber, '', $borrowernumber); +} +print $query->redirect("/cgi-bin/koha/opac-user.pl"); diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index bbd3dec325..bc2b60e9d9 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -47,6 +47,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( # get borrower information .... my ( $borr, $flags ) = GetMemberDetails( $borrowernumber ); +# get branches and itemtypes +my $branches = GetBranches(); +my $itemtypes = GetItemTypes(); + # get biblionumber..... my $biblionumber = $query->param('biblionumber'); @@ -71,8 +75,6 @@ $template->param( rank => $rank ); my $branch = $query->param('branch'); $template->param( branch => $branch ); -my $branches = GetBranches(); - # make sure it's a real branch if ( !$branches->{$branch} ) { $branch = ''; @@ -289,25 +291,17 @@ else { } -my @branchcodes; my %itemnumbers_of_biblioitem; my @itemnumbers = @{ get_itemnumbers_of($biblionumber)->{$biblionumber} }; my $iteminfos_of = GetItemInfosOf(@itemnumbers); foreach my $itemnumber (@itemnumbers) { - push( @branchcodes, - $iteminfos_of->{$itemnumber}->{homebranch}, - $iteminfos_of->{$itemnumber}->{holdingbranch} ); - my $biblioitemnumber = $iteminfos_of->{$itemnumber}->{biblioitemnumber}; push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber ); } -# @branchcodes = uniq @branchcodes; - my @biblioitemnumbers = keys %itemnumbers_of_biblioitem; -my $branchinfos_of = get_branchinfos_of(@branchcodes); my $notforloan_label_of = get_notforloan_label_of(); my $biblioiteminfos_of = GetBiblioItemInfosOf(@biblioitemnumbers); @@ -316,15 +310,13 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { push @itemtypes, $biblioiteminfos_of->{$biblioitemnumber}{itemtype}; } -my $itemtypeinfos_of = get_itemtypeinfos_of(@itemtypes); - my @bibitemloop; foreach my $biblioitemnumber (@biblioitemnumbers) { my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber}; $biblioitem->{description} = - $itemtypeinfos_of->{ $biblioitem->{itemtype} }{description}; + $itemtypes->{ $biblioitem->{itemtype} }{description}; foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) @@ -332,13 +324,13 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { my $item = $iteminfos_of->{$itemnumber}; $item->{homebranchname} = - $branchinfos_of->{ $item->{homebranch} }{branchname}; + $branches->{ $item->{homebranch} }{branchname}; # if the holdingbranch is different than the homebranch, we show the # holdingbranch of the document too if ( $item->{homebranch} ne $item->{holdingbranch} ) { $item->{holdingbranchname} = - $branchinfos_of->{ $item->{holdingbranch} }{branchname}; + $branches->{ $item->{holdingbranch} }{branchname}; } # add information @@ -391,14 +383,15 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { if ( $transfertwhen ne '' ) { $item->{transfertwhen} = format_date($transfertwhen); $item->{transfertfrom} = - $branchinfos_of->{$transfertfrom}{branchname}; - $item->{transfertto} = $branchinfos_of->{$transfertto}{branchname}; + $branches->{$transfertfrom}{branchname}; + $item->{transfertto} = $branches->{$transfertto}{branchname}; $item->{nocancel} = 1; } # If there is no loan, return and transfer, we show a checkbox. $item->{notforloan} = $item->{notforloan} || 0; + # FIXME: every library will define this differently # An item is available only if: if ( not defined $reservedate # not reserved yet @@ -411,6 +404,14 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { $item->{available} = 1; } + # FIXME: move this to a pm + my $dbh = C4::Context->dbh; + my $sth2 = $dbh->prepare("SELECT * FROM reserves WHERE borrowernumber=? AND itemnumber=? AND found='W' AND cancellationdate IS NULL"); + $sth2->execute($item->{ReservedForBorrowernumber},$item->{itemnumber}); + while (my $wait_hashref = $sth2->fetchrow_hashref) { + $item->{waitingdate} = format_date($wait_hashref->{waitingdate}); + } + push @{ $biblioitem->{itemloop} }, $item; } diff --git a/reserve/request.pl b/reserve/request.pl index e6f8d5f2ef..e98a3ac7a4 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -335,8 +335,7 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { $item->{available} = 1; } - # FIXME: need to indicate if the item is already waiting and if so, for whom and since when - my $dbh2 = C4::Context->dbh; + # FIXME: move this to a pm my $sth2 = $dbh->prepare("SELECT * FROM reserves WHERE borrowernumber=? AND itemnumber=? AND found='W' AND cancellationdate IS NULL"); $sth2->execute($item->{ReservedForBorrowernumber},$item->{itemnumber}); while (my $wait_hashref = $sth2->fetchrow_hashref) { -- 2.39.2