Lines 1-21
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
# Copyright 2014 ByWater Solutions |
|
|
4 |
# |
5 |
# This file is part of Koha. |
3 |
# This file is part of Koha. |
6 |
# |
4 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it under the |
5 |
# Copyright (C) 2015 Jiří Kozlovský |
8 |
# terms of the GNU General Public License as published by the Free Software |
6 |
# |
9 |
# Foundation; either version 3 of the License, or (at your option) any later |
7 |
# Koha is free software; you can redistribute it and/or modify it |
10 |
# version. |
8 |
# under the terms of the GNU General Public License as published by |
|
|
9 |
# the Free Software Foundation; either version 3 of the License, or |
10 |
# (at your option) any later version. |
11 |
# |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
12 |
# Koha is distributed in the hope that it will be useful, but |
13 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
15 |
# GNU General Public License for more details. |
15 |
# |
16 |
# |
16 |
# You should have received a copy of the GNU General Public License along |
17 |
# You should have received a copy of the GNU General Public License |
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
|
19 |
|
19 |
|
20 |
package C4::NCIP::RequestItem; |
20 |
package C4::NCIP::RequestItem; |
21 |
|
21 |
|
Lines 122-128
sub requestItem {
Link Here
|
122 |
{biblionumber => $bibId, itemnumber => $itemId, all_dates => 1}); |
122 |
{biblionumber => $bibId, itemnumber => $itemId, all_dates => 1}); |
123 |
|
123 |
|
124 |
foreach my $res (@$reserves) { |
124 |
foreach my $res (@$reserves) { |
125 |
C4::NCIP::NcipUtils::print403($query, |
125 |
C4::NCIP::NcipUtils::print409($query, |
126 |
"User already has item requested") |
126 |
"User already has item requested") |
127 |
if $res->{borrowernumber} eq $userId; |
127 |
if $res->{borrowernumber} eq $userId; |
128 |
} |
128 |
} |
Lines 133-144
sub requestItem {
Link Here
|
133 |
"Loan not possible .. holdqueuelength exists") |
133 |
"Loan not possible .. holdqueuelength exists") |
134 |
if $requestType ne 'Hold' and $rank != 0; |
134 |
if $requestType ne 'Hold' and $rank != 0; |
135 |
|
135 |
|
136 |
my $expirationdate = $query->param('pickupExpiryDate'); |
136 |
my $now = DateTime->now(time_zone => C4::Context->tz()); |
137 |
my $startdate = $query->param('earliestDateNeeded'); |
137 |
|
138 |
my $notes = $query->param('notes') || 'Placed by svc/ncip'; |
138 |
my $expirationdate |
|
|
139 |
= Koha::DateUtils::dt_from_string($query->param('pickupExpiryDate')); |
140 |
$expirationdate |
141 |
= $expirationdate < $now ? undef : $query->param('pickupExpiryDate'); |
142 |
|
143 |
my $startdate = Koha::DateUtils::dt_from_string( |
144 |
$query->param('earliestDateNeeded')); |
145 |
$startdate |
146 |
= $startdate < $now ? undef : $query->param('earliestDateNeeded'); |
147 |
|
148 |
my $notes = $query->param('notes') || 'Placed by svc/ncip'; |
139 |
my $pickupLocation = $query->param('pickupLocation') |
149 |
my $pickupLocation = $query->param('pickupLocation') |
140 |
|| C4::Context->userenv->{'branch'}; |
150 |
|| C4::Context->userenv->{'branch'}; |
141 |
|
151 |
|
|
|
152 |
my $branchExists = C4::Branch::GetBranchName($pickupLocation); |
153 |
C4::NCIP::NcipUtils::print409($query, |
154 |
"Specified pickup location doesn't exist") |
155 |
unless $branchExists; |
156 |
|
142 |
if ($itemLevelHold) { |
157 |
if ($itemLevelHold) { |
143 |
placeHold( |
158 |
placeHold( |
144 |
$query, $bibId, $itemId, $userId, |
159 |
$query, $bibId, $itemId, $userId, |