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 <jmf@liblime.com>
This commit is contained in:
Joshua Ferraro 2007-12-24 02:59:17 -05:00
parent 80a37880ac
commit a8ba013e1e
6 changed files with 162 additions and 96 deletions

View File

@ -217,7 +217,7 @@
Not for loan
<!-- TMPL_ELSE -->
<!-- TMPL_IF name="datedue" -->
On issue
Checked out
<!-- TMPL_ELSE -->
<!-- TMPL_IF name="notforloan" -->
<!-- TMPL_VAR name="notforloan" -->

View File

@ -69,78 +69,8 @@
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->">
<h3>Place a hold on <span class="title"><!-- TMPL_VAR NAME="title" --><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --></h3>
<p><strong>For:</strong> <!-- TMPL_LOOP NAME="USER_INFO" --><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_LOOP --></p>
<!-- TMPL_LOOP name="bibitemloop" -->
<p><strong>Item type:</strong> <!-- TMPL_VAR NAME="description" --></p>
<!-- TMPL_IF NAME="publicationyear" --><p><strong>Publication year:</strong> <!-- TMPL_VAR NAME="publicationyear" --></p><!-- /TMPL_IF -->
<table>
<tr>
<th>Barcode</th>
<th>Home Library</th>
<th>Holding Library</th>
<th>Call number</th>
<th>Information</th>
<th>Cancel a Reserve</th>
</tr>
<!-- TMPL_LOOP Name="itemloop" -->
<tr class="<!-- TMPL_VAR NAME="backgroundcolor" -->">
<td>
<!-- TMPL_VAR NAME="barcode" -->
</td>
<td>
<!-- TMPL_VAR NAME="homebranch" -->
</td>
<td>
<!-- TMPL_VAR NAME="holdingbranch" -->
</td>
<td>
<!-- TMPL_VAR NAME="itemcallnumber" -->
</td>
<td>
<!-- TMPL_IF Name="date_due" -->
<span class="checkedout">Due <!-- TMPL_VAR NAME="date_due" --></span>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="available" -->
<label>Hold this item
<input type="checkbox" name="checkitem" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
</label>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="reservedate" -->
Item on hold since <!-- TMPL_VAR NAME="reservedate" -->
<!-- /TMPL_IF -->
<!-- TMPL_IF Name="message" -->
Cant' be selected (lost or long overdue)
<!-- /TMPL_IF -->
<!-- TMPL_IF Name="notforloan" -->
This item is not for loan (<!-- TMPL_VAR NAME="notforloanvalue" -->)
<!-- /TMPL_IF -->
<!-- TMPL_IF Name="transfertwhen" -->
Item in transit from <!-- TMPL_VAR NAME="transfertfrom" -->,
to <!-- TMPL_VAR NAME="transfertto" -->, on <!-- TMPL_VAR NAME="transfertwhen" -->
<!-- /TMPL_IF -->
</td>
<td>
<!-- TMPL_IF NAME="reservedate"-->
Item on hold
<!-- TMPL_ELSE -->
No holds
<!-- /TMPL_IF -->
</td>
</tr>
<!-- /TMPL_LOOP --> <!-- itemloop -->
</table>
<p> <label for="requestany" style="float: none; width: auto; padding-left : 1em;">Hold next available copy </label>
<input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
</p>
<input type="hidden" name="biblioitem" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
<!-- /TMPL_LOOP --> <!-- bibitemloop -->
<p>Pick up from:<select name="branch" id="branch">
<p><strong>Priority:</strong><!-- TMPL_VAR Name="fixedRank" --> out of ?</p>
<p>Pick up from:<select name="branch" id="branch">
<!-- TMPL_LOOP NAME="CGIbranch" -->
<!-- TMPL_IF name="selected" -->
<option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branch" --></option>
@ -149,10 +79,93 @@
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
</p>
</p>
<p> <label for="requestany">Place a hold on the next available copy </label>
<input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
</p>
<input type="hidden" name="biblioitem" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
<input type="submit" value="Place Hold" />
<input type="hidden" name="all" value="1"/></p>
<input type="hidden" name="place_reserve" value="1"/>
<!-- TMPL_LOOP name="bibitemloop" -->
<!-- TMPL_UNLESS NAME="item-level_itypes" -->
<p><strong>Item type:</strong> <!-- TMPL_VAR NAME="description" --></p>
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF NAME="publicationyear" --><p><strong>Publication year:</strong> <!-- TMPL_VAR NAME="publicationyear" --></p><!-- /TMPL_IF -->
<label for="requestspecific">Place a hold on a specific copy</label>
<table id="requestspecific">
<tr>
<!-- TMPL_IF NAME="item-level_itypes" -->
<th>Hold</th>
<th>Item type</th>
<!-- /TMPL_IF -->
<th>Barcode</th>
<th>Home Library</th>
<th>Last Location</th>
<th>Call number</th>
<th>Information</th>
</tr>
<!-- TMPL_LOOP Name="itemloop" -->
<tr class="<!-- TMPL_VAR NAME="backgroundcolor" -->">
<td>
<!-- TMPL_IF NAME="available" -->
<input type="checkbox" name="checkitem" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
<!-- TMPL_ELSE -->
<input DISABLED type="checkbox" name="checkitem" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
<!-- /TMPL_IF -->
</td>
<!-- TMPL_IF NAME="item-level_itypes" -->
<td>
<img src="<!-- TMPL_VAR name="imageurl" -->" alt="<!-- TMPL_VAR NAME="itypename" -->" title="<!-- TMPL_VAR NAME="itypename" -->"/>
</td>
<!-- /TMPL_IF -->
<td>
<!-- TMPL_VAR NAME="barcode" -->
</td>
<td>
<!-- TMPL_VAR NAME="homebranchname" -->
</td>
<td>
<!-- TMPL_VAR NAME="holdingbranchname" -->
</td>
<td>
<!-- TMPL_VAR NAME="itemcallnumber" -->
</td>
<td>
<!-- TMPL_IF Name="date_due" -->
<span class="checkedout">Due <!-- TMPL_VAR NAME="date_due" --></span>
<!-- /TMPL_IF -->
<!-- TMPL_IF Name="message" -->
Unavailable (lost or missing)
<!-- /TMPL_IF -->
<!-- TMPL_IF Name="notforloan" -->
Not for loan (<!-- TMPL_VAR NAME="notforloanvalue" -->)
<!-- /TMPL_IF -->
<!-- TMPL_IF Name="transfertwhen" -->
In transit from <!-- TMPL_VAR NAME="transfertfrom" -->,
to <!-- TMPL_VAR NAME="transfertto" -->, since <!-- TMPL_VAR NAME="transfertwhen" -->
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="reservedate"-->
<!-- TMPL_IF NAME="waitingdate" -->Waiting<!-- TMPL_ELSE -->On hold<!-- /TMPL_IF --> for patron
<!-- TMPL_IF NAME="waitingdate" -->at<!-- TMPL_ELSE -->expected at<!-- /TMPL_IF --> <!-- TMPL_VAR NAME="ExpectedAtLibrary" -->
since
<!-- TMPL_IF NAME="waitingdate" --><!-- TMPL_VAR NAME="waitingdate" --><!-- TMPL_ELSE --><!-- TMPL_IF name="reservedate" --><!-- TMPL_VAR NAME="reservedate" --><!-- /TMPL_IF --><!-- /TMPL_IF -->.
<!-- TMPL_ELSE -->
Not on hold
<!-- /TMPL_IF -->
</td>
</tr>
<!-- /TMPL_LOOP --> <!-- itemloop -->
</table>
<!-- /TMPL_LOOP --> <!-- bibitemloop -->
<input type="submit" value="Place Hold" />
<input type="hidden" name="all" value="1"/></p>
<input type="hidden" name="place_reserve" value="1"/>
</form>
<!-- end of the first form -->
<!-- /TMPL_IF -->

View File

@ -247,6 +247,7 @@ No renewals left
<th>Placed On</th>
<th>Pick Up Location</th>
<th>Status</th>
<th>Modify</th>
</tr>
<!-- TMPL_LOOP NAME="RESERVES" -->
<tr>
@ -266,12 +267,18 @@ No renewals left
Item waiting to be pulled from <b> <!-- TMPL_VAR NAME="wbrname" --></b>
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
Item being transfered to <b> <!-- TMPL_VAR NAME="wbrname" --></b> <input type="hidden" name="pickup" value="<!-- TMPL_VAR NAME="wbrcd" -->" />
Item in transit to <b> <!-- TMPL_VAR NAME="wbrname" --></b> <input type="hidden" name="pickup" value="<!-- TMPL_VAR NAME="wbrcd" -->" />
<!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
Item waiting to be pulled
<!-- /TMPL_IF -->
</td>
<td>
<form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
<input type="submit" name="submit" class="icon delete cancel" value="Cancel" onclick="return confirmDelete('Are you sure you want to cancel this hold?');" /></form>
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>

46
opac/opac-modrequest.pl Executable file
View File

@ -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");

View File

@ -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;
}

View File

@ -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) {