Lines 255-264
elsif ($op eq "add-branch-cat") {
Link Here
|
255 |
my $categorycode = $input->param('categorycode'); |
255 |
my $categorycode = $input->param('categorycode'); |
256 |
my $maxissueqty = $input->param('maxissueqty'); |
256 |
my $maxissueqty = $input->param('maxissueqty'); |
257 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
257 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
|
|
258 |
my $max_holds = $input->param('max_holds'); |
258 |
$maxissueqty =~ s/\s//g; |
259 |
$maxissueqty =~ s/\s//g; |
259 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
260 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
260 |
$maxonsiteissueqty =~ s/\s//g; |
261 |
$maxonsiteissueqty =~ s/\s//g; |
261 |
$maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; |
262 |
$maxonsiteissueqty = undef if $maxonsiteissueqty !~ /^\d+/; |
|
|
263 |
$max_holds =~ s/\s//g; |
264 |
$max_holds = undef if $max_holds !~ /^\d+/; |
262 |
|
265 |
|
263 |
if ($branch eq "*") { |
266 |
if ($branch eq "*") { |
264 |
if ($categorycode eq "*") { |
267 |
if ($categorycode eq "*") { |
Lines 266-286
elsif ($op eq "add-branch-cat") {
Link Here
|
266 |
FROM default_circ_rules"); |
269 |
FROM default_circ_rules"); |
267 |
my $sth_insert = $dbh->prepare(q| |
270 |
my $sth_insert = $dbh->prepare(q| |
268 |
INSERT INTO default_circ_rules |
271 |
INSERT INTO default_circ_rules |
269 |
(maxissueqty, maxonsiteissueqty) |
272 |
(maxissueqty, maxonsiteissueqty, max_holds) |
270 |
VALUES (?, ?) |
273 |
VALUES (?, ?, ?) |
271 |
|); |
274 |
|); |
272 |
my $sth_update = $dbh->prepare(q| |
275 |
my $sth_update = $dbh->prepare(q| |
273 |
UPDATE default_circ_rules |
276 |
UPDATE default_circ_rules |
274 |
SET maxissueqty = ?, |
277 |
SET maxissueqty = ?, |
275 |
maxonsiteissueqty = ? |
278 |
maxonsiteissueqty = ?, |
|
|
279 |
max_holds = ? |
276 |
|); |
280 |
|); |
277 |
|
281 |
|
278 |
$sth_search->execute(); |
282 |
$sth_search->execute(); |
279 |
my $res = $sth_search->fetchrow_hashref(); |
283 |
my $res = $sth_search->fetchrow_hashref(); |
280 |
if ($res->{total}) { |
284 |
if ($res->{total}) { |
281 |
$sth_update->execute($maxissueqty, $maxonsiteissueqty); |
285 |
$sth_update->execute( $maxissueqty, $maxonsiteissueqty, $max_holds ); |
282 |
} else { |
286 |
} else { |
283 |
$sth_insert->execute($maxissueqty, $maxonsiteissueqty); |
287 |
$sth_insert->execute( $maxissueqty, $maxonsiteissueqty, $max_holds ); |
284 |
} |
288 |
} |
285 |
} else { |
289 |
} else { |
286 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
290 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
Lines 288-308
elsif ($op eq "add-branch-cat") {
Link Here
|
288 |
WHERE categorycode = ?"); |
292 |
WHERE categorycode = ?"); |
289 |
my $sth_insert = $dbh->prepare(q| |
293 |
my $sth_insert = $dbh->prepare(q| |
290 |
INSERT INTO default_borrower_circ_rules |
294 |
INSERT INTO default_borrower_circ_rules |
291 |
(categorycode, maxissueqty, maxonsiteissueqty) |
295 |
(categorycode, maxissueqty, maxonsiteissueqty, max_holds) |
292 |
VALUES (?, ?, ?) |
296 |
VALUES (?, ?, ?, ?) |
293 |
|); |
297 |
|); |
294 |
my $sth_update = $dbh->prepare(q| |
298 |
my $sth_update = $dbh->prepare(q| |
295 |
UPDATE default_borrower_circ_rules |
299 |
UPDATE default_borrower_circ_rules |
296 |
SET maxissueqty = ?, |
300 |
SET maxissueqty = ?, |
297 |
maxonsiteissueqty = ? |
301 |
maxonsiteissueqty = ?, |
|
|
302 |
max_holds = ? |
298 |
WHERE categorycode = ? |
303 |
WHERE categorycode = ? |
299 |
|); |
304 |
|); |
300 |
$sth_search->execute($branch); |
305 |
$sth_search->execute($branch); |
301 |
my $res = $sth_search->fetchrow_hashref(); |
306 |
my $res = $sth_search->fetchrow_hashref(); |
302 |
if ($res->{total}) { |
307 |
if ($res->{total}) { |
303 |
$sth_update->execute($maxissueqty, $maxonsiteissueqty, $categorycode); |
308 |
$sth_update->execute( $maxissueqty, $maxonsiteissueqty, $categorycode, $max_holds ); |
304 |
} else { |
309 |
} else { |
305 |
$sth_insert->execute($categorycode, $maxissueqty, $maxonsiteissueqty); |
310 |
$sth_insert->execute( $categorycode, $maxissueqty, $maxonsiteissueqty, $max_holds ); |
306 |
} |
311 |
} |
307 |
} |
312 |
} |
308 |
} elsif ($categorycode eq "*") { |
313 |
} elsif ($categorycode eq "*") { |
Lines 334-346
elsif ($op eq "add-branch-cat") {
Link Here
|
334 |
AND categorycode = ?"); |
339 |
AND categorycode = ?"); |
335 |
my $sth_insert = $dbh->prepare(q| |
340 |
my $sth_insert = $dbh->prepare(q| |
336 |
INSERT INTO branch_borrower_circ_rules |
341 |
INSERT INTO branch_borrower_circ_rules |
337 |
(branchcode, categorycode, maxissueqty, maxonsiteissueqty) |
342 |
(branchcode, categorycode, maxissueqty, maxonsiteissueqty, max_holds) |
338 |
VALUES (?, ?, ?, ?) |
343 |
VALUES (?, ?, ?, ?, ?) |
339 |
|); |
344 |
|); |
340 |
my $sth_update = $dbh->prepare(q| |
345 |
my $sth_update = $dbh->prepare(q| |
341 |
UPDATE branch_borrower_circ_rules |
346 |
UPDATE branch_borrower_circ_rules |
342 |
SET maxissueqty = ?, |
347 |
SET maxissueqty = ?, |
343 |
maxonsiteissueqty = ? |
348 |
maxonsiteissueqty = ? |
|
|
349 |
max_holds = ? |
344 |
WHERE branchcode = ? |
350 |
WHERE branchcode = ? |
345 |
AND categorycode = ? |
351 |
AND categorycode = ? |
346 |
|); |
352 |
|); |
Lines 348-356
elsif ($op eq "add-branch-cat") {
Link Here
|
348 |
$sth_search->execute($branch, $categorycode); |
354 |
$sth_search->execute($branch, $categorycode); |
349 |
my $res = $sth_search->fetchrow_hashref(); |
355 |
my $res = $sth_search->fetchrow_hashref(); |
350 |
if ($res->{total}) { |
356 |
if ($res->{total}) { |
351 |
$sth_update->execute($maxissueqty, $maxonsiteissueqty, $branch, $categorycode); |
357 |
$sth_update->execute($maxissueqty, $maxonsiteissueqty, $max_holds, $branch, $categorycode); |
352 |
} else { |
358 |
} else { |
353 |
$sth_insert->execute($branch, $categorycode, $maxissueqty, $maxonsiteissueqty); |
359 |
$sth_insert->execute($branch, $categorycode, $maxissueqty, $maxonsiteissueqty, $max_holds); |
354 |
} |
360 |
} |
355 |
} |
361 |
} |
356 |
} |
362 |
} |
Lines 546-551
my @sorted_branch_cat_rules = sort { $a->{'humancategorycode'} cmp $b->{'humanca
Link Here
|
546 |
foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) { |
552 |
foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) { |
547 |
$entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty}); |
553 |
$entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty}); |
548 |
$entry->{unlimited_maxonsiteissueqty} = 1 unless defined($entry->{maxonsiteissueqty}); |
554 |
$entry->{unlimited_maxonsiteissueqty} = 1 unless defined($entry->{maxonsiteissueqty}); |
|
|
555 |
$entry->{unlimited_max_holds} = 1 unless defined($entry->{max_holds}); |
549 |
} |
556 |
} |
550 |
|
557 |
|
551 |
@sorted_row_loop = sort by_category_and_itemtype @row_loop; |
558 |
@sorted_row_loop = sort by_category_and_itemtype @row_loop; |