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