Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 555 lines (464 sloc) 20.817 kb
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
1 #!/usr/bin/perl
2
3
4 #writen 2/1/00 by chris@katipo.oc.nz
5 # Copyright 2000-2002 Katipo Communications
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
13 #
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
21
fc1342f rel_3_0 moved to HEAD
tipaul authored
22 =head1 request.pl
23
24 script to place reserves/requests
25
26 =cut
27
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
28 use strict;
f823508 Adding warnings to request/ files
Joshua Ferraro authored
29 use warnings;
fc1342f rel_3_0 moved to HEAD
tipaul authored
30 use C4::Branch; # GetBranches get_branchinfos_of
31 use CGI;
32 use List::MoreUtils qw/uniq/;
a9f7993 fix errors with using today's date and format_date
Galen Charlton authored
33 use Date::Calc qw/Date_to_Days/;
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
34 use C4::Output;
35 use C4::Auth;
3ddec89 moving Reserves2.pm to Reserves.pm
tipaul authored
36 use C4::Reserves;
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
37 use C4::Biblio;
8e41022 item rework: moved various accessor functions
Galen Charlton authored
38 use C4::Items;
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
39 use C4::Koha;
c596d55 HUGE COMMIT : code cleaning circulation.
tipaul authored
40 use C4::Circulation;
1ff189e cleanup of admin/ after Dates integration
Joshua Ferraro authored
41 use C4::Dates qw/format_date/;
fc1342f rel_3_0 moved to HEAD
tipaul authored
42 use C4::Members;
17ab0a7 bug 3263: Staff Search Results Interface Changes
Galen Charlton authored
43 use C4::Search; # enabled_staff_search_views
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
44
fc1342f rel_3_0 moved to HEAD
tipaul authored
45 my $dbh = C4::Context->dbh;
46 my $sth;
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
47 my $input = new CGI;
fc1342f rel_3_0 moved to HEAD
tipaul authored
48 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
49 {
50 template_name => "reserve/request.tmpl",
51 query => $input,
52 type => "intranet",
53 authnotrequired => 0,
54 flagsrequired => { reserveforothers => 1 },
55 }
56 );
57
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
58 my $multihold = $input->param('multi_hold');
59 $template->param(multi_hold => $multihold);
60
43334b8 bugfixing request.pl
Joshua Ferraro authored
61 # get Branches and Itemtypes
62 my $branches = GetBranches();
63 my $itemtypes = GetItemTypes();
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
64
65 my $default = C4::Context->userenv->{branch};
66 my @values;
67 my %label_of;
68
69 foreach my $branchcode (sort keys %{$branches} ) {
70 push @values, $branchcode;
71 $label_of{$branchcode} = $branches->{$branchcode}->{branchname};
72 }
73 my $CGIbranch = CGI::scrolling_list(
74 -name => 'pickup',
75 -id => 'pickup',
76 -values => \@values,
77 -default => $default,
78 -labels => \%label_of,
79 -size => 1,
80 -multiple => 0,
81 );
fc1342f rel_3_0 moved to HEAD
tipaul authored
82
83 # Select borrowers infos
84 my $findborrower = $input->param('findborrower');
85 $findborrower =~ s|,| |g;
86 my $cardnumber = $input->param('cardnumber');
87 my $borrowerslist;
88 my $messageborrower;
9aadee2 @oleonard Some refinements to statuses and messages. Beginning to standardize call...
oleonard authored
89 my $warnings;
90 my $messages;
fc1342f rel_3_0 moved to HEAD
tipaul authored
91
a9f7993 fix errors with using today's date and format_date
Galen Charlton authored
92 my $date = C4::Dates->today('iso');
fc1342f rel_3_0 moved to HEAD
tipaul authored
93
94 if ($findborrower) {
95 my ( $count, $borrowers ) =
b642e68 Still Code Cleaning.
hdl authored
96 SearchMember($findborrower, 'cardnumber', 'web' );
fc1342f rel_3_0 moved to HEAD
tipaul authored
97
98 my @borrowers = @$borrowers;
99
100 if ( $#borrowers == -1 ) {
101 $input->param( 'findborrower', '' );
102 $messageborrower = "'$findborrower'";
103 }
104 elsif ( $#borrowers == 0 ) {
105 $input->param( 'cardnumber', $borrowers[0]->{'cardnumber'} );
106 $cardnumber = $borrowers[0]->{'cardnumber'};
107 }
108 else {
109 $borrowerslist = \@borrowers;
110 }
111 }
112
113 if ($cardnumber) {
c596d55 HUGE COMMIT : code cleaning circulation.
tipaul authored
114 my $borrowerinfo = GetMemberDetails( 0, $cardnumber );
fc1342f rel_3_0 moved to HEAD
tipaul authored
115 my $diffbranch;
116 my @getreservloop;
117 my $count_reserv = 0;
118 my $maxreserves;
119
200e44c WARNING: BIGFIXING 670
Joshua Ferraro authored
120 # we check the reserves of the borrower, and if he can reserv a document
fc1342f rel_3_0 moved to HEAD
tipaul authored
121 # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
122
123 my $number_reserves =
fb143b7 BIG COMMIT : cleaning of Reserves.pm. See detail on koha-devel
tipaul authored
124 GetReserveCount( $borrowerinfo->{'borrowernumber'} );
fc1342f rel_3_0 moved to HEAD
tipaul authored
125
126 if ( $number_reserves > C4::Context->preference('maxreserves') ) {
9aadee2 @oleonard Some refinements to statuses and messages. Beginning to standardize call...
oleonard authored
127 $warnings = 1;
fc1342f rel_3_0 moved to HEAD
tipaul authored
128 $maxreserves = 1;
129 }
130
2c9aba4 Fix to prevent crash on null dateexpiry.
Joe Atzberger authored
131 # we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn)
2450444 bug 2502: correctly check patron account expiration
Galen Charlton authored
132 my $expiry_date = $borrowerinfo->{dateexpiry};
133 my $expiry = 0; # flag set if patron account has expired
134 if ($expiry_date and $expiry_date ne '0000-00-00' and
135 Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
2c9aba4 Fix to prevent crash on null dateexpiry.
Joe Atzberger authored
136 $messages = $expiry = 1;
fc1342f rel_3_0 moved to HEAD
tipaul authored
137 }
f4339f5 #1445 checking that there is an expiry date
Paul POULAIN authored
138
fc1342f rel_3_0 moved to HEAD
tipaul authored
139
140 # check if the borrower make the reserv in a different branch
141 if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) {
9aadee2 @oleonard Some refinements to statuses and messages. Beginning to standardize call...
oleonard authored
142 $messages = 1;
fc1342f rel_3_0 moved to HEAD
tipaul authored
143 $diffbranch = 1;
144 }
145
146 $template->param(
f4339f5 #1445 checking that there is an expiry date
Paul POULAIN authored
147 borrowernumber => $borrowerinfo->{'borrowernumber'},
148 borrowersurname => $borrowerinfo->{'surname'},
149 borrowerfirstname => $borrowerinfo->{'firstname'},
150 borrowerstreetaddress => $borrowerinfo->{'address'},
151 borrowercity => $borrowerinfo->{'city'},
152 borrowerphone => $borrowerinfo->{'phone'},
200e44c WARNING: BIGFIXING 670
Joshua Ferraro authored
153 borrowermobile => $borrowerinfo->{'mobile'},
154 borrowerfax => $borrowerinfo->{'fax'},
155 borrowerphonepro => $borrowerinfo->{'phonepro'},
f4339f5 #1445 checking that there is an expiry date
Paul POULAIN authored
156 borroweremail => $borrowerinfo->{'email'},
157 borroweremailpro => $borrowerinfo->{'emailpro'},
158 borrowercategory => $borrowerinfo->{'category'},
159 borrowerreservs => $count_reserv,
160 maxreserves => $maxreserves,
161 expiry => $expiry,
9aadee2 @oleonard Some refinements to statuses and messages. Beginning to standardize call...
oleonard authored
162 diffbranch => $diffbranch,
163 messages => $messages,
164 warnings => $warnings
fc1342f rel_3_0 moved to HEAD
tipaul authored
165 );
166 }
167
168 $template->param( messageborrower => $messageborrower );
169
170 my $CGIselectborrower;
171 if ($borrowerslist) {
172 my @values;
173 my %labels;
174
175 foreach my $borrower (
176 sort {
177 $a->{surname}
178 . $a->{firstname} cmp $b->{surname}
179 . $b->{firstname}
180 } @{$borrowerslist}
181 )
182 {
183 push @values, $borrower->{cardnumber};
184
185 $labels{ $borrower->{cardnumber} } = sprintf(
186 '%s, %s ... (%s - %s) ... %s',
187 $borrower->{surname}, $borrower->{firstname},
188 $borrower->{cardnumber}, $borrower->{categorycode},
b70cd9f @oleonard Adding patron address to select patron form.
oleonard authored
189 $borrower->{address},
fc1342f rel_3_0 moved to HEAD
tipaul authored
190 );
191 }
192
193 $CGIselectborrower = CGI::scrolling_list(
194 -name => 'cardnumber',
195 -values => \@values,
196 -labels => \%labels,
197 -size => 7,
198 -multiple => 0,
199 );
200 }
201
c596d55 HUGE COMMIT : code cleaning circulation.
tipaul authored
202 # FIXME launch another time GetMemberDetails perhaps until
203 my $borrowerinfo = GetMemberDetails( 0, $cardnumber );
fc1342f rel_3_0 moved to HEAD
tipaul authored
204
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
205 my @biblionumbers = ();
206 my $biblionumbers = $input->param('biblionumbers');
207 if ($multihold) {
208 @biblionumbers = split '/', $biblionumbers;
209 } else {
210 push @biblionumbers, $input->param('biblionumber');
fc1342f rel_3_0 moved to HEAD
tipaul authored
211 }
212
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
213 my @biblioloop = ();
214 foreach my $biblionumber (@biblionumbers) {
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
215
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
216 my %biblioloopiter = ();
fc1342f rel_3_0 moved to HEAD
tipaul authored
217
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
218 my $dat = GetBiblioData($biblionumber);
fc1342f rel_3_0 moved to HEAD
tipaul authored
219
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
220 # get existing reserves .....
221 my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber);
222 my $totalcount = $count;
223 my $alreadyreserved;
1301705 Add holds policies
Jesse Weaver authored
224
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
225 foreach my $res (@$reserves) {
226 if ( ( $res->{found} eq 'W' ) ) {
227 $count--;
1301705 Add holds policies
Jesse Weaver authored
228 }
229
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
230 if ( $borrowerinfo->{borrowernumber} eq $res->{borrowernumber} ) {
231 $warnings = 1;
232 $alreadyreserved = 1;
233 $biblioloopiter{warn} = 1;
234 $biblioloopiter{alreadyres} = 1;
fc1342f rel_3_0 moved to HEAD
tipaul authored
235 }
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
236 }
fc1342f rel_3_0 moved to HEAD
tipaul authored
237
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
238 $template->param( alreadyreserved => $alreadyreserved,
239 messages => $messages,
240 warnings => $warnings );
241
242
243 # FIXME think @optionloop, is maybe obsolete, or must be switchable by a systeme preference fixed rank or not
244 # make priorities options
245
246 my @optionloop;
247 for ( 1 .. $count + 1 ) {
248 push(
249 @optionloop,
250 {
251 num => $_,
252 selected => ( $_ == $count + 1 ),
253 }
254 );
255 }
256 # adding a fixed value for priority options
257 my $fixedRank = $count+1;
fc1342f rel_3_0 moved to HEAD
tipaul authored
258
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
259 my @branchcodes;
260 my %itemnumbers_of_biblioitem;
261 my @itemnumbers;
200e44c WARNING: BIGFIXING 670
Joshua Ferraro authored
262
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
263 ## $items is array of 'item' table numbers
264 if (my $items = get_itemnumbers_of($biblionumber)->{$biblionumber}){
265 @itemnumbers = @$items;
266 }
267 else {
268 $template->param('noitems' => 1);
269 $biblioloopiter{noitems} = 1;
270 }
271
272 ## Hash of item number to 'item' table fields
273 my $iteminfos_of = GetItemInfosOf(@itemnumbers);
274
275 ## Here we go backwards again to create hash of biblioitemnumber to itemnumbers,
276 ## when by definition all of the itemnumber have the same biblioitemnumber
277 foreach my $itemnumber (@itemnumbers) {
278 my $biblioitemnumber = $iteminfos_of->{$itemnumber}->{biblioitemnumber};
279 push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber );
280 }
281
282 ## Should be same as biblionumber
283 my @biblioitemnumbers = keys %itemnumbers_of_biblioitem;
284
285 my $notforloan_label_of = get_notforloan_label_of();
286
287 ## Hash of biblioitemnumber to 'biblioitem' table records
288 my $biblioiteminfos_of = GetBiblioItemInfosOf(@biblioitemnumbers);
289
290 my @bibitemloop;
291
292 foreach my $biblioitemnumber (@biblioitemnumbers) {
293 my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber};
294 my $num_available;
295 my $num_override;
296
297 $biblioitem->{description} =
298 $itemtypes->{ $biblioitem->{itemtype} }{description};
299 $biblioloopiter{description} = $biblioitem->{description};
300 $biblioloopiter{itypename} = $biblioitem->{description};
301 $biblioloopiter{imageurl} =
302 getitemtypeimagelocation('intranet', $itemtypes->{$biblioitem->{itemtype}}{imageurl});
303
304 foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) {
305 my $item = $iteminfos_of->{$itemnumber};
306
307 unless (C4::Context->preference('item-level_itypes')) {
308 $item->{itype} = $biblioitem->{itemtype};
309 }
310
311 $item->{itypename} = $itemtypes->{ $item->{itype} }{description};
312 $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
313 $item->{homebranchname} = $branches->{ $item->{homebranch} }{branchname};
314
315 # if the holdingbranch is different than the homebranch, we show the
316 # holdingbranch of the document too
317 if ( $item->{homebranch} ne $item->{holdingbranch} ) {
318 $item->{holdingbranchname} =
319 $branches->{ $item->{holdingbranch} }{branchname};
320 }
321
322 # add information
323 $item->{itemcallnumber} = $item->{itemcallnumber};
324
325 # if the item is currently on loan, we display its return date and
326 # change the background color
327 my $issues= GetItemIssue($itemnumber);
328 if ( $issues->{'date_due'} ) {
329 $item->{date_due} = format_date($issues->{'date_due'});
330 $item->{backgroundcolor} = 'onloan';
331 }
332
333 # checking reserve
334 my ($reservedate,$reservedfor,$expectedAt) = GetReservesFromItemnumber($itemnumber);
335 my $ItemBorrowerReserveInfo = GetMemberDetails( $reservedfor, 0);
336
337 if ( defined $reservedate ) {
338 $item->{backgroundcolor} = 'reserved';
339 $item->{reservedate} = format_date($reservedate);
340 $item->{ReservedForBorrowernumber} = $reservedfor;
341 $item->{ReservedForSurname} = $ItemBorrowerReserveInfo->{'surname'};
342 $item->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'};
343 $item->{ExpectedAtLibrary} = $branches->{$expectedAt}{branchname};
344
345 }
346
347 # Management of the notforloan document
348 if ( $item->{notforloan} ) {
349 $item->{backgroundcolor} = 'other';
350 $item->{notforloanvalue} =
351 $notforloan_label_of->{ $item->{notforloan} };
352 }
353
354 # Management of lost or long overdue items
355 if ( $item->{itemlost} ) {
356
357 # FIXME localized strings should never be in Perl code
358 $item->{message} =
359 $item->{itemlost} == 1 ? "(lost)"
360 : $item->{itemlost} == 2 ? "(long overdue)"
361 : "";
362 $item->{backgroundcolor} = 'other';
363 }
364
365 # Check the transit status
366 my ( $transfertwhen, $transfertfrom, $transfertto ) =
367 GetTransfers($itemnumber);
368
369 if ( $transfertwhen ne '' ) {
370 $item->{transfertwhen} = format_date($transfertwhen);
371 $item->{transfertfrom} =
372 $branches->{$transfertfrom}{branchname};
373 $item->{transfertto} = $branches->{$transfertto}{branchname};
374 $item->{nocancel} = 1;
375 }
376
377 # If there is no loan, return and transfer, we show a checkbox.
378 $item->{notforloan} = $item->{notforloan} || 0;
379
380 # if independent branches is on we need to check if the person can reserve
381 # for branches they arent logged in to
382 if ( C4::Context->preference("IndependantBranches") ) {
383 if (! C4::Context->preference("canreservefromotherbranches")){
384 # cant reserve items so need to check if item homebranch and userenv branch match if not we cant reserve
385 my $userenv = C4::Context->userenv;
6924e7d @PaulPoulain fix for 2997 : superlibrarian's ability to edit item/patron home branch ...
PaulPoulain authored
386 if ( ($userenv) && ( $userenv->{flags} % 2 != 1 ) ) {
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
387 $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
388 }
1301705 Add holds policies
Jesse Weaver authored
389 }
390 }
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
391
392 my $branchitemrule = GetBranchItemRule( $item->{'homebranch'}, $item->{'itype'} );
393 my $policy_holdallowed = 1;
394
395 $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
396
397 if ( $branchitemrule->{'holdallowed'} == 0 ||
398 ( $branchitemrule->{'holdallowed'} == 1 && $borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) {
399 $policy_holdallowed = 0;
400 }
401
402 if (IsAvailableForItemLevelRequest($itemnumber) and not $item->{cantreserve}) {
403 if ( not $policy_holdallowed and C4::Context->preference( 'AllowHoldPolicyOverride' ) ) {
404 $item->{override} = 1;
405 $num_override++;
406 } elsif ( $policy_holdallowed ) {
407 $item->{available} = 1;
408 $num_available++;
409 }
410 }
411 # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked
412
413 # FIXME: move this to a pm
414 my $sth2 = $dbh->prepare("SELECT * FROM reserves WHERE borrowernumber=? AND itemnumber=? AND found='W'");
415 $sth2->execute($item->{ReservedForBorrowernumber},$item->{itemnumber});
416 while (my $wait_hashref = $sth2->fetchrow_hashref) {
417 $item->{waitingdate} = format_date($wait_hashref->{waitingdate});
1301705 Add holds policies
Jesse Weaver authored
418 }
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
419 push @{ $biblioitem->{itemloop} }, $item;
1301705 Add holds policies
Jesse Weaver authored
420 }
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
421
422 if ( $num_override == scalar( @{ $biblioitem->{itemloop} } ) ) { # That is, if all items require an override
423 $template->param( override_required => 1 );
424 } elsif ( $num_available == 0 ) {
425 $template->param( none_available => 1 );
426 $template->param( warnings => 1 );
427 $biblioloopiter{warn} = 1;
428 $biblioloopiter{none_avail} = 1;
1301705 Add holds policies
Jesse Weaver authored
429 }
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
430
431 push @bibitemloop, $biblioitem;
fc1342f rel_3_0 moved to HEAD
tipaul authored
432 }
5b41a8e New XML API
tgarip1957 authored
433
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
434 # existingreserves building
435 my @reserveloop;
436 ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber);
437 foreach my $res ( sort { $a->{found} cmp $b->{found} } @$reserves ) {
438 my %reserve;
439 my @optionloop;
440 for ( my $i = 1 ; $i <= $totalcount ; $i++ ) {
441 push(
442 @optionloop,
443 {
444 num => $i,
445 selected => ( $i == $res->{priority} ),
446 }
447 );
fc1342f rel_3_0 moved to HEAD
tipaul authored
448 }
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
449 my @branchloop;
450 foreach my $br ( keys %$branches ) {
451 my %abranch;
452 $abranch{'selected'} = ( $br eq $res->{'branchcode'} );
453 $abranch{'branch'} = $br;
454 $abranch{'branchname'} = $branches->{$br}->{'branchname'};
455 push( @branchloop, \%abranch );
456 }
457
458 if ( ( $res->{'found'} eq 'W' ) ) {
459 my $item = $res->{'itemnumber'};
460 $item = GetBiblioFromItemNumber($item,undef);
461 $reserve{'wait'}= 1;
462 $reserve{'holdingbranch'}=$item->{'holdingbranch'};
463 $reserve{'biblionumber'}=$item->{'biblionumber'};
26469d8 bug 2520: don't change item-level requests to bib-level
Galen Charlton authored
464 $reserve{'barcodenumber'} = $item->{'barcode'};
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
465 $reserve{'wbrcode'} = $res->{'branchcode'};
466 $reserve{'itemnumber'} = $res->{'itemnumber'};
467 $reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
468 if($reserve{'holdingbranch'} eq $reserve{'wbrcode'}){
469 $reserve{'atdestination'} = 1;
470 }
471 # set found to 1 if reserve is waiting for patron pickup
472 $reserve{'found'} = 1 if $res->{'found'} eq 'W';
473 } elsif ($res->{priority} > 0) {
474 if (defined($res->{itemnumber})) {
475 my $item = GetItem($res->{itemnumber});
476 $reserve{'itemnumber'} = $res->{'itemnumber'};
477 $reserve{'barcodenumber'} = $item->{'barcode'};
478 $reserve{'item_level_hold'} = 1;
479 }
26469d8 bug 2520: don't change item-level requests to bib-level
Galen Charlton authored
480 }
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
481
482 # get borrowers reserve info
483 my $reserveborrowerinfo = GetMemberDetails( $res->{'borrowernumber'}, 0);
484
485 $reserve{'date'} = format_date( $res->{'reservedate'} );
486 $reserve{'borrowernumber'} = $res->{'borrowernumber'};
487 $reserve{'biblionumber'} = $res->{'biblionumber'};
488 $reserve{'borrowernumber'} = $res->{'borrowernumber'};
489 $reserve{'firstname'} = $reserveborrowerinfo->{'firstname'};
490 $reserve{'surname'} = $reserveborrowerinfo->{'surname'};
491 $reserve{'notes'} = $res->{'reservenotes'};
492 $reserve{'wait'} =
493 ( ( $res->{'found'} eq 'W' ) or ( $res->{'priority'} eq '0' ) );
494 $reserve{'constrainttypea'} = ( $res->{'constrainttype'} eq 'a' );
495 $reserve{'constrainttypeo'} = ( $res->{'constrainttype'} eq 'o' );
496 $reserve{'voldesc'} = $res->{'volumeddesc'};
497 $reserve{'ccode'} = $res->{'ccode'};
498 $reserve{'barcode'} = $res->{'barcode'};
499 $reserve{'priority'} = $res->{'priority'};
500 $reserve{'branchloop'} = \@branchloop;
501 $reserve{'optionloop'} = \@optionloop;
502
503 push( @reserveloop, \%reserve );
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
504 }
fc1342f rel_3_0 moved to HEAD
tipaul authored
505
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
506 # get the time for the form name...
507 my $time = time();
508
509 $template->param(
510 CGIbranch => $CGIbranch,
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
511
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
512 time => $time,
513 fixedRank => $fixedRank,
514 );
515
516 # display infos
517 $template->param(
518 optionloop => \@optionloop,
519 bibitemloop => \@bibitemloop,
520 date => $date,
521 biblionumber => $biblionumber,
522 findborrower => $findborrower,
523 cardnumber => $cardnumber,
524 CGIselectborrower => $CGIselectborrower,
525 title => $dat->{title},
526 author => $dat->{author},
527 holdsview => 1,
528 borrower_branchname => $branches->{$borrowerinfo->{'branchcode'}}->{'branchname'},
529 borrower_branchcode => $borrowerinfo->{'branchcode'},
17ab0a7 bug 3263: Staff Search Results Interface Changes
Galen Charlton authored
530 C4::Search::enabled_staff_search_views,
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
531 );
532
533 $biblioloopiter{biblionumber} = $biblionumber;
534 $biblioloopiter{title} = $dat->{title};
535 $biblioloopiter{rank} = $fixedRank;
536 $biblioloopiter{reserveloop} = \@reserveloop;
537
538 if (@reserveloop) {
539 $template->param( reserveloop => \@reserveloop );
540 }
541
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
542
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
543 push @biblioloop, \%biblioloopiter;
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
544 }
fc1342f rel_3_0 moved to HEAD
tipaul authored
545
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
546 $template->param( biblioloop => \@biblioloop );
547 $template->param( biblionumbers => $biblionumbers );
fc1342f rel_3_0 moved to HEAD
tipaul authored
548
47690db bug 3093: Enhance placing of holds in the staff interface.
Stephen Edwards authored
549 if ($multihold) {
550 $template->param( multi_hold => 1 );
551 }
552
68924c5 New feature from SAN Ouest Provence: ability to reserve a specific item ...
plg authored
553 # printout the page
fc1342f rel_3_0 moved to HEAD
tipaul authored
554 output_html_with_http_headers $input, $cookie, $template->output;
Something went wrong with that request. Please try again.