Lines 140-149
elsif ($op eq 'add') {
Link Here
|
140 |
} |
140 |
} |
141 |
} |
141 |
} |
142 |
elsif ($op eq "set-branch-defaults") { |
142 |
elsif ($op eq "set-branch-defaults") { |
143 |
my $categorycode = $input->param('categorycode'); |
143 |
my $categorycode = $input->param('categorycode'); |
144 |
my $maxissueqty = $input->param('maxissueqty'); |
144 |
my $maxissueqty = $input->param('maxissueqty'); |
145 |
my $holdallowed = $input->param('holdallowed'); |
145 |
my $holdallowed = $input->param('holdallowed'); |
146 |
my $returnbranch = $input->param('returnbranch'); |
146 |
my $returnbranch = $input->param('returnbranch'); |
|
|
147 |
my $renew_lost_allowed = $input->param('renew_lost_allowed'); |
148 |
my $renew_lost_found = $input->param('renew_lost_found'); |
149 |
|
147 |
$maxissueqty =~ s/\s//g; |
150 |
$maxissueqty =~ s/\s//g; |
148 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
151 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
149 |
$holdallowed =~ s/\s//g; |
152 |
$holdallowed =~ s/\s//g; |
Lines 153-186
elsif ($op eq "set-branch-defaults") {
Link Here
|
153 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
156 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
154 |
FROM default_circ_rules"); |
157 |
FROM default_circ_rules"); |
155 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
158 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
156 |
(maxissueqty, holdallowed, returnbranch) |
159 |
(maxissueqty, holdallowed, returnbranch, renew_lost_allowed, renew_lost_found) |
157 |
VALUES (?, ?, ?)"); |
160 |
VALUES (?, ?, ?, ?, ?)"); |
158 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
161 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
159 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ?"); |
162 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ?, renew_lost_allowed = ?, renew_lost_found = ?"); |
160 |
|
163 |
|
161 |
$sth_search->execute(); |
164 |
$sth_search->execute(); |
162 |
my $res = $sth_search->fetchrow_hashref(); |
165 |
my $res = $sth_search->fetchrow_hashref(); |
163 |
if ($res->{total}) { |
166 |
if ($res->{total}) { |
164 |
$sth_update->execute($maxissueqty, $holdallowed, $returnbranch); |
167 |
$sth_update->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
165 |
} else { |
168 |
} else { |
166 |
$sth_insert->execute($maxissueqty, $holdallowed, $returnbranch); |
169 |
$sth_insert->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
167 |
} |
170 |
} |
168 |
} else { |
171 |
} else { |
169 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
172 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
170 |
FROM default_branch_circ_rules |
173 |
FROM default_branch_circ_rules |
171 |
WHERE branchcode = ?"); |
174 |
WHERE branchcode = ?"); |
172 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules |
175 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules |
173 |
(branchcode, maxissueqty, holdallowed, returnbranch) |
176 |
(branchcode, maxissueqty, holdallowed, returnbranch, renew_lost_allowed, renew_lost_found) |
174 |
VALUES (?, ?, ?, ?)"); |
177 |
VALUES (?, ?, ?, ?, ?, ?)"); |
175 |
my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules |
178 |
my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules |
176 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ? |
179 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ?, renew_lost_allowed = ?, renew_lost_found = ? |
177 |
WHERE branchcode = ?"); |
180 |
WHERE branchcode = ?"); |
178 |
$sth_search->execute($branch); |
181 |
$sth_search->execute($branch); |
179 |
my $res = $sth_search->fetchrow_hashref(); |
182 |
my $res = $sth_search->fetchrow_hashref(); |
180 |
if ($res->{total}) { |
183 |
if ($res->{total}) { |
181 |
$sth_update->execute($maxissueqty, $holdallowed, $returnbranch, $branch); |
184 |
$sth_update->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found, $branch ); |
182 |
} else { |
185 |
} else { |
183 |
$sth_insert->execute($branch, $maxissueqty, $holdallowed, $returnbranch); |
186 |
$sth_insert->execute( $branch, $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); |
184 |
} |
187 |
} |
185 |
} |
188 |
} |
186 |
} |
189 |
} |
Lines 490-500
if ($branch eq "*") {
Link Here
|
490 |
my $defaults = $sth_defaults->fetchrow_hashref; |
493 |
my $defaults = $sth_defaults->fetchrow_hashref; |
491 |
|
494 |
|
492 |
if ($defaults) { |
495 |
if ($defaults) { |
493 |
$template->param(default_holdallowed_none => 1) if($defaults->{holdallowed} == 0); |
496 |
$template->param( default_holdallowed_none => 1 ) if ( $defaults->{holdallowed} == 0 ); |
494 |
$template->param(default_holdallowed_same => 1) if($defaults->{holdallowed} == 1); |
497 |
$template->param( default_holdallowed_same => 1 ) if ( $defaults->{holdallowed} == 1 ); |
495 |
$template->param(default_holdallowed_any => 1) if($defaults->{holdallowed} == 2); |
498 |
$template->param( default_holdallowed_any => 1 ) if ( $defaults->{holdallowed} == 2 ); |
496 |
$template->param(default_maxissueqty => $defaults->{maxissueqty}); |
499 |
$template->param( default_maxissueqty => $defaults->{maxissueqty} ); |
497 |
$template->param(default_returnbranch => $defaults->{returnbranch}); |
500 |
$template->param( default_returnbranch => $defaults->{returnbranch} ); |
|
|
501 |
$template->param( default_renew_lost_allowed => $defaults->{renew_lost_allowed} ); |
502 |
$template->param( default_renew_lost_found => $defaults->{renew_lost_found} ); |
498 |
} |
503 |
} |
499 |
|
504 |
|
500 |
$template->param(default_rules => ($defaults ? 1 : 0)); |
505 |
$template->param(default_rules => ($defaults ? 1 : 0)); |