Marcel de Rooy
92be11bbcf
Before bug 9788 the alldates parameter of GetReservesFromItemnumber was actually not used in the codebase. The first patch of bug 9788 did change that and passed true by default. But a closer look revealed that we do not really need it. The parameter is removed by this patch; the SQL statement is slightly adjusted: if reservedate<=now or a waitingdate is filled for the requested itemnumber, GetReservesFromItemnumber will return the reserve. This includes so-called future waits: a future hold that has been confirmed ahead of time with pref ConfirmFutureHolds > 0 days. Note that future item-level holds are not really interesting to return; this just corresponds to original behavior. Future next-available holds are not in view at all; they do not contain an item number. Test plan: Actually, the test plan of the first patch is valid. But for completeness I repeat it here: [1] Enable future holds and set ConfirmFutureHolds to 2 days. [2] Place a future next-available hold for 2 days ahead. [3] Check item status on catalogue detail. Available? That is fine. [4] Confirm the future hold by checking it in. ('future wait') [5] Look at item status again on catalogue detail. Must be Waiting now. [6] Switch to OPAC and login as another opac user. Goto Place a hold. [7] Check item status with item level hold info. Is it waiting? [8] Try to place hold in staff, check item level status again. Waiting? [9] Make a transfer for the item. Switch branch. Check hold status on Transfers to receive. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
128 lines
4.6 KiB
Perl
Executable file
128 lines
4.6 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
|
|
# 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.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
use strict;
|
|
use warnings;
|
|
use CGI;
|
|
use C4::Context;
|
|
use C4::Output;
|
|
use C4::Branch; # GetBranches
|
|
use C4::Auth;
|
|
use C4::Dates qw/format_date/;
|
|
use C4::Biblio;
|
|
use C4::Circulation;
|
|
use C4::Members;
|
|
use Date::Calc qw(
|
|
Today
|
|
Add_Delta_Days
|
|
Date_to_Days
|
|
);
|
|
|
|
use C4::Koha;
|
|
use C4::Reserves;
|
|
|
|
my $input = new CGI;
|
|
my $itemnumber = $input->param('itemnumber');
|
|
|
|
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|
{
|
|
template_name => "circ/transferstoreceive.tmpl",
|
|
query => $input,
|
|
type => "intranet",
|
|
authnotrequired => 0,
|
|
flagsrequired => { circulate => "circulate_remaining_permissions" },
|
|
debug => 1,
|
|
}
|
|
);
|
|
|
|
# set the userenv branch
|
|
my $default = C4::Context->userenv->{'branch'};
|
|
|
|
# get the all the branches for reference
|
|
my $branches = GetBranches();
|
|
my @branchesloop;
|
|
my $latetransfers;
|
|
foreach my $br ( keys %$branches ) {
|
|
my @transferloop;
|
|
my %branchloop;
|
|
my @gettransfers =
|
|
GetTransfersFromTo( $branches->{$br}->{'branchcode'}, $default );
|
|
|
|
if (@gettransfers) {
|
|
$branchloop{'branchname'} = $branches->{$br}->{'branchname'};
|
|
$branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
|
|
foreach my $num (@gettransfers) {
|
|
my %getransf;
|
|
|
|
my ( $sent_year, $sent_month, $sent_day ) = split "-",
|
|
$num->{'datesent'};
|
|
$sent_day = ( split " ", $sent_day )[0];
|
|
( $sent_year, $sent_month, $sent_day ) =
|
|
Add_Delta_Days( $sent_year, $sent_month, $sent_day,
|
|
C4::Context->preference('TransfersMaxDaysWarning'));
|
|
my $calcDate = Date_to_Days( $sent_year, $sent_month, $sent_day );
|
|
my $today = Date_to_Days(&Today);
|
|
my $diff = $today - $calcDate;
|
|
|
|
if ($today > $calcDate) {
|
|
$latetransfers = 1;
|
|
$getransf{'messcompa'} = 1;
|
|
$getransf{'diff'} = $diff;
|
|
}
|
|
my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} );
|
|
my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $gettitle->{'itype'} : $gettitle->{'itemtype'} );
|
|
|
|
$getransf{'datetransfer'} = $num->{'datesent'};
|
|
$getransf{'itemtype'} = $itemtypeinfo ->{'description'};
|
|
foreach (qw(title author biblionumber itemnumber barcode homebranch holdingbranch itemcallnumber)) {
|
|
$getransf{$_} = $gettitle->{$_};
|
|
}
|
|
|
|
my $record = GetMarcBiblio($gettitle->{'biblionumber'});
|
|
$getransf{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($gettitle->{'biblionumber'}));
|
|
|
|
# we check if we have a reserv for this transfer
|
|
my @checkreserv = GetReservesFromItemnumber($num->{'itemnumber'});
|
|
if ( $checkreserv[0] ) {
|
|
my $getborrower = GetMemberDetails( $checkreserv[1] );
|
|
$getransf{'borrowernum'} = $getborrower->{'borrowernumber'};
|
|
$getransf{'borrowername'} = $getborrower->{'surname'};
|
|
$getransf{'borrowerfirstname'} = $getborrower->{'firstname'};
|
|
$getransf{'borrowermail'} = $getborrower->{'emailaddress'} if $getborrower->{'emailaddress'};
|
|
$getransf{'borrowerphone'} = $getborrower->{'phone'};
|
|
}
|
|
push( @transferloop, \%getransf );
|
|
}
|
|
|
|
# If we have a return of reservloop we put it in the branchloop sequence
|
|
$branchloop{'reserv'} = \@transferloop;
|
|
}
|
|
push( @branchesloop, \%branchloop ) if %branchloop;
|
|
}
|
|
|
|
$template->param(
|
|
branchesloop => \@branchesloop,
|
|
show_date => format_date(C4::Dates->today('iso')),
|
|
TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'),
|
|
latetransfers => $latetransfers ? 1 : 0,
|
|
);
|
|
|
|
output_html_with_http_headers $input, $cookie, $template->output;
|
|
|