|
Lines 33-38
use C4::Debug;
Link Here
|
| 33 |
# use Data::Dumper; |
33 |
# use Data::Dumper; |
| 34 |
|
34 |
|
| 35 |
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves"); |
35 |
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves"); |
|
|
36 |
my $MAX_SIMULTANEOUS_RESERVES = ($MAXIMUM_NUMBER_OF_RESERVES > 36) ? 36 : $MAXIMUM_NUMBER_OF_RESERVES; |
| 36 |
|
37 |
|
| 37 |
my $query = new CGI; |
38 |
my $query = new CGI; |
| 38 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
39 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
|
Lines 92-111
my $branch = $query->param('branch') || C4::Context->userenv->{branch} || '' ;
Link Here
|
| 92 |
($branches->{$branch}) or $branch = ""; # Confirm branch is real |
93 |
($branches->{$branch}) or $branch = ""; # Confirm branch is real |
| 93 |
$template->param( branch => $branch ); |
94 |
$template->param( branch => $branch ); |
| 94 |
|
95 |
|
|
|
96 |
my $singleBranchMode = C4::Context->preference('singleBranchMode'); |
| 97 |
|
| 95 |
# make branch selection options... |
98 |
# make branch selection options... |
| 96 |
my $CGIbranchloop = GetBranchesLoop($branch); |
99 |
my $CGIbranchloop = GetBranchesLoop($branch); |
| 97 |
$template->param( CGIbranch => $CGIbranchloop ); |
100 |
$template->param( CGIbranch => $CGIbranchloop ); |
| 98 |
|
101 |
|
| 99 |
#Debug |
|
|
| 100 |
#output_html_with_http_headers($query,$cookie,"<html><head></head><body> @biblionumbers </body></html>\n"); |
| 101 |
#exit; |
| 102 |
#my %bibdata; |
| 103 |
#my $rank; |
| 104 |
#my $biblionumber; |
| 105 |
#my $bibdata; |
| 106 |
#my %itemhash; |
| 107 |
#my $forloan; |
| 108 |
|
| 109 |
# |
102 |
# |
| 110 |
# |
103 |
# |
| 111 |
# Build hashes of the requested biblio(item)s and items. |
104 |
# Build hashes of the requested biblio(item)s and items. |
|
Lines 155-161
if ( $query->param('place_reserve') ) {
Link Here
|
| 155 |
|
148 |
|
| 156 |
# List is composed of alternating biblio/item/branch |
149 |
# List is composed of alternating biblio/item/branch |
| 157 |
my $selectedItems = $query->param('selecteditems'); |
150 |
my $selectedItems = $query->param('selecteditems'); |
| 158 |
|
|
|
| 159 |
if ($query->param('reserve_mode') eq 'single') { |
151 |
if ($query->param('reserve_mode') eq 'single') { |
| 160 |
# This indicates non-JavaScript mode, so there was |
152 |
# This indicates non-JavaScript mode, so there was |
| 161 |
# only a single biblio number selected. |
153 |
# only a single biblio number selected. |
|
Lines 165-179
if ( $query->param('place_reserve') ) {
Link Here
|
| 165 |
$item = ''; |
157 |
$item = ''; |
| 166 |
} |
158 |
} |
| 167 |
my $branch = $query->param('branch'); |
159 |
my $branch = $query->param('branch'); |
| 168 |
$selectedItems = "$bib/$item/$branch/"; |
160 |
$selectedItems = "$bib/$item/$branch"; |
| 169 |
} |
161 |
} |
| 170 |
|
162 |
my @selectedItems = split(/\//, $selectedItems, $MAX_SIMULTANEOUS_RESERVES); |
| 171 |
my @selectedItems = split /\//, $selectedItems; |
163 |
# split's limit param forces trailing empty strings to be included in array. |
| 172 |
|
164 |
|
| 173 |
# Make sure there is a biblionum/itemnum/branch triplet for each item. |
165 |
# Make sure there is a biblionum/itemnum/branch triplet for each item. |
| 174 |
# The itemnum can be 'any', meaning next available. |
166 |
# The itemnum can be '', meaning next available. |
| 175 |
my $selectionCount = @selectedItems; |
167 |
my $selectionCount = scalar @selectedItems; |
| 176 |
if (($selectionCount == 0) || (($selectionCount % 3) != 0)) { |
168 |
if (($selectionCount == 0) || ($selectionCount % 3)) { |
| 177 |
$template->param(message=>1, bad_data=>1); |
169 |
$template->param(message=>1, bad_data=>1); |
| 178 |
&get_out($query, $cookie, $template->output); |
170 |
&get_out($query, $cookie, $template->output); |
| 179 |
} |
171 |
} |
|
Lines 181-192
if ( $query->param('place_reserve') ) {
Link Here
|
| 181 |
while (@selectedItems) { |
173 |
while (@selectedItems) { |
| 182 |
my $biblioNum = shift(@selectedItems); |
174 |
my $biblioNum = shift(@selectedItems); |
| 183 |
my $itemNum = shift(@selectedItems); |
175 |
my $itemNum = shift(@selectedItems); |
| 184 |
my $branch = shift(@selectedItems); # i.e., branch code, not name |
176 |
my $branch = ($singleBranchMode) ? $borr->{'branchcode'} : shift(@selectedItems); |
| 185 |
|
|
|
| 186 |
my $singleBranchMode = $template->param('singleBranchMode'); |
| 187 |
if ($singleBranchMode) { |
| 188 |
$branch = $borr->{'branchcode'}; |
| 189 |
} |
| 190 |
|
177 |
|
| 191 |
my $biblioData = $biblioDataHash{$biblioNum}; |
178 |
my $biblioData = $biblioDataHash{$biblioNum}; |
| 192 |
my $found; |
179 |
my $found; |
|
Lines 454-466
if ( $numBibsAvailable == 0 ) {
Link Here
|
| 454 |
$template->param( none_available => 1, message => 1 ); |
441 |
$template->param( none_available => 1, message => 1 ); |
| 455 |
} |
442 |
} |
| 456 |
|
443 |
|
| 457 |
my $itemTableColspan = 5; |
444 |
my $itemTableColspan = ($template->param('OPACItemHolds')) ? 4 : 5 ; |
| 458 |
if (!$template->param('OPACItemHolds')) { |
445 |
$singleBranchMode and $itemTableColspan--; |
| 459 |
$itemTableColspan--; |
446 |
|
| 460 |
} |
|
|
| 461 |
if ($template->param('singleBranchMode')) { |
| 462 |
$itemTableColspan--; |
| 463 |
} |
| 464 |
$template->param(itemtable_colspan => $itemTableColspan); |
447 |
$template->param(itemtable_colspan => $itemTableColspan); |
| 465 |
|
448 |
|
| 466 |
# display infos |
449 |
# display infos |
| 467 |
- |
|
|