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