Lines 162-171
elsif ($op eq 'add') {
Link Here
|
162 |
|
162 |
|
163 |
} |
163 |
} |
164 |
elsif ($op eq "set-branch-defaults") { |
164 |
elsif ($op eq "set-branch-defaults") { |
165 |
my $categorycode = $input->param('categorycode'); |
165 |
my $categorycode = $input->param('categorycode'); |
166 |
my $maxissueqty = $input->param('maxissueqty'); |
166 |
my $maxissueqty = $input->param('maxissueqty'); |
167 |
my $holdallowed = $input->param('holdallowed'); |
167 |
my $holdallowed = $input->param('holdallowed'); |
168 |
my $returnbranch = $input->param('returnbranch'); |
168 |
my $returnbranch = $input->param('returnbranch'); |
|
|
169 |
my $renew_lost_allowed = $input->param('renew_lost_allowed'); |
170 |
my $renew_lost_found = $input->param('renew_lost_found'); |
171 |
|
169 |
$maxissueqty =~ s/\s//g; |
172 |
$maxissueqty =~ s/\s//g; |
170 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
173 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
171 |
$holdallowed =~ s/\s//g; |
174 |
$holdallowed =~ s/\s//g; |
Lines 175-208
elsif ($op eq "set-branch-defaults") {
Link Here
|
175 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
178 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
176 |
FROM default_circ_rules"); |
179 |
FROM default_circ_rules"); |
177 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
180 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
178 |
(maxissueqty, holdallowed, returnbranch) |
181 |
(maxissueqty, holdallowed, returnbranch, renew_lost_allowed, renew_lost_found) |
179 |
VALUES (?, ?, ?)"); |
182 |
VALUES (?, ?, ?, ?, ?)"); |
180 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
183 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
181 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ?"); |
184 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ?, renew_lost_allowed = ?, renew_lost_found = ?"); |
182 |
|
185 |
|
183 |
$sth_search->execute(); |
186 |
$sth_search->execute(); |
184 |
my $res = $sth_search->fetchrow_hashref(); |
187 |
my $res = $sth_search->fetchrow_hashref(); |
185 |
if ($res->{total}) { |
188 |
if ($res->{total}) { |
186 |
$sth_update->execute($maxissueqty, $holdallowed, $returnbranch); |
189 |
$sth_update->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
187 |
} else { |
190 |
} else { |
188 |
$sth_insert->execute($maxissueqty, $holdallowed, $returnbranch); |
191 |
$sth_insert->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
189 |
} |
192 |
} |
190 |
} else { |
193 |
} else { |
191 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
194 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
192 |
FROM default_branch_circ_rules |
195 |
FROM default_branch_circ_rules |
193 |
WHERE branchcode = ?"); |
196 |
WHERE branchcode = ?"); |
194 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules |
197 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules |
195 |
(branchcode, maxissueqty, holdallowed, returnbranch) |
198 |
(branchcode, maxissueqty, holdallowed, returnbranch, renew_lost_allowed, renew_lost_found) |
196 |
VALUES (?, ?, ?, ?)"); |
199 |
VALUES (?, ?, ?, ?, ?, ?)"); |
197 |
my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules |
200 |
my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules |
198 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ? |
201 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ?, renew_lost_allowed = ?, renew_lost_found = ? |
199 |
WHERE branchcode = ?"); |
202 |
WHERE branchcode = ?"); |
200 |
$sth_search->execute($branch); |
203 |
$sth_search->execute($branch); |
201 |
my $res = $sth_search->fetchrow_hashref(); |
204 |
my $res = $sth_search->fetchrow_hashref(); |
202 |
if ($res->{total}) { |
205 |
if ($res->{total}) { |
203 |
$sth_update->execute($maxissueqty, $holdallowed, $returnbranch, $branch); |
206 |
$sth_update->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found, $branch ); |
204 |
} else { |
207 |
} else { |
205 |
$sth_insert->execute($branch, $maxissueqty, $holdallowed, $returnbranch); |
208 |
$sth_insert->execute( $branch, $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
206 |
} |
209 |
} |
207 |
} |
210 |
} |
208 |
} |
211 |
} |
Lines 512-522
if ($branch eq "*") {
Link Here
|
512 |
my $defaults = $sth_defaults->fetchrow_hashref; |
515 |
my $defaults = $sth_defaults->fetchrow_hashref; |
513 |
|
516 |
|
514 |
if ($defaults) { |
517 |
if ($defaults) { |
515 |
$template->param(default_holdallowed_none => 1) if($defaults->{holdallowed} == 0); |
518 |
$template->param( default_holdallowed_none => 1 ) if ( $defaults->{holdallowed} == 0 ); |
516 |
$template->param(default_holdallowed_same => 1) if($defaults->{holdallowed} == 1); |
519 |
$template->param( default_holdallowed_same => 1 ) if ( $defaults->{holdallowed} == 1 ); |
517 |
$template->param(default_holdallowed_any => 1) if($defaults->{holdallowed} == 2); |
520 |
$template->param( default_holdallowed_any => 1 ) if ( $defaults->{holdallowed} == 2 ); |
518 |
$template->param(default_maxissueqty => $defaults->{maxissueqty}); |
521 |
$template->param( default_maxissueqty => $defaults->{maxissueqty} ); |
519 |
$template->param(default_returnbranch => $defaults->{returnbranch}); |
522 |
$template->param( default_returnbranch => $defaults->{returnbranch} ); |
|
|
523 |
$template->param( default_renew_lost_allowed => $defaults->{renew_lost_allowed} ); |
524 |
$template->param( default_renew_lost_found => $defaults->{renew_lost_found} ); |
520 |
} |
525 |
} |
521 |
|
526 |
|
522 |
$template->param(default_rules => ($defaults ? 1 : 0)); |
527 |
$template->param(default_rules => ($defaults ? 1 : 0)); |