|
Lines 185-195
elsif ($op eq 'add') {
Link Here
|
| 185 |
|
185 |
|
| 186 |
} |
186 |
} |
| 187 |
elsif ($op eq "set-branch-defaults") { |
187 |
elsif ($op eq "set-branch-defaults") { |
| 188 |
my $categorycode = $input->param('categorycode'); |
188 |
my $categorycode = $input->param('categorycode'); |
| 189 |
my $maxissueqty = $input->param('maxissueqty'); |
189 |
my $maxissueqty = $input->param('maxissueqty'); |
| 190 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
190 |
my $maxonsiteissueqty = $input->param('maxonsiteissueqty'); |
| 191 |
my $holdallowed = $input->param('holdallowed'); |
191 |
my $holdallowed = $input->param('holdallowed'); |
| 192 |
my $returnbranch = $input->param('returnbranch'); |
192 |
my $returnbranch = $input->param('returnbranch'); |
|
|
193 |
my $renew_lost_allowed = $input->param('renew_lost_allowed'); |
| 194 |
my $renew_lost_found = $input->param('renew_lost_found'); |
| 195 |
|
| 193 |
$maxissueqty =~ s/\s//g; |
196 |
$maxissueqty =~ s/\s//g; |
| 194 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
197 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
| 195 |
$maxonsiteissueqty =~ s/\s//g; |
198 |
$maxonsiteissueqty =~ s/\s//g; |
|
Lines 201-217
elsif ($op eq "set-branch-defaults") {
Link Here
|
| 201 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
204 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 202 |
FROM default_circ_rules"); |
205 |
FROM default_circ_rules"); |
| 203 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
206 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
| 204 |
(maxissueqty, maxonsiteissueqty, holdallowed, returnbranch) |
207 |
(maxissueqty, maxonsiteissueqty, holdallowed, returnbranch, renew_lost_allowed, renew_lost_found) |
| 205 |
VALUES (?, ?, ?, ?)"); |
208 |
VALUES (?, ?, ?, ?, ?, ?)"); |
| 206 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
209 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
| 207 |
SET maxissueqty = ?, maxonsiteissueqty = ?, holdallowed = ?, returnbranch = ?"); |
210 |
SET maxissueqty = ?, maxonsiteissueqty = ?, holdallowed = ?, returnbranch = ?, renew_lost_allowed = ?, renew_lost_found = ?"); |
| 208 |
|
211 |
|
| 209 |
$sth_search->execute(); |
212 |
$sth_search->execute(); |
| 210 |
my $res = $sth_search->fetchrow_hashref(); |
213 |
my $res = $sth_search->fetchrow_hashref(); |
| 211 |
if ($res->{total}) { |
214 |
if ($res->{total}) { |
| 212 |
$sth_update->execute($maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch); |
215 |
$sth_update->execute( $maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
| 213 |
} else { |
216 |
} else { |
| 214 |
$sth_insert->execute($maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch); |
217 |
$sth_insert->execute( $maxissueqty, $maxonsiteissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
| 215 |
} |
218 |
} |
| 216 |
} else { |
219 |
} else { |
| 217 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
220 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
|
Lines 563-574
if ($branch eq "*") {
Link Here
|
| 563 |
my $defaults = $sth_defaults->fetchrow_hashref; |
566 |
my $defaults = $sth_defaults->fetchrow_hashref; |
| 564 |
|
567 |
|
| 565 |
if ($defaults) { |
568 |
if ($defaults) { |
| 566 |
$template->param(default_holdallowed_none => 1) if($defaults->{holdallowed} == 0); |
569 |
$template->param( default_holdallowed_none => 1 ) if ( $defaults->{holdallowed} == 0 ); |
| 567 |
$template->param(default_holdallowed_same => 1) if($defaults->{holdallowed} == 1); |
570 |
$template->param( default_holdallowed_same => 1 ) if ( $defaults->{holdallowed} == 1 ); |
| 568 |
$template->param(default_holdallowed_any => 1) if($defaults->{holdallowed} == 2); |
571 |
$template->param( default_holdallowed_any => 1 ) if ( $defaults->{holdallowed} == 2 ); |
| 569 |
$template->param(default_maxissueqty => $defaults->{maxissueqty}); |
572 |
|
| 570 |
$template->param(default_maxonsiteissueqty => $defaults->{maxonsiteissueqty}); |
573 |
$template->param( default_maxissueqty => $defaults->{maxissueqty} ); |
| 571 |
$template->param(default_returnbranch => $defaults->{returnbranch}); |
574 |
$template->param( default_maxonsiteissueqty => $defaults->{maxonsiteissueqty} ); |
|
|
575 |
$template->param( default_returnbranch => $defaults->{returnbranch} ); |
| 576 |
$template->param( default_renew_lost_allowed => $defaults->{renew_lost_allowed} ); |
| 577 |
$template->param( default_renew_lost_found => $defaults->{renew_lost_found} ); |
| 572 |
} |
578 |
} |
| 573 |
|
579 |
|
| 574 |
$template->param(default_rules => ($defaults ? 1 : 0)); |
580 |
$template->param(default_rules => ($defaults ? 1 : 0)); |