|
Lines 17-24
Link Here
|
| 17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
17 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
| 18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 |
|
19 |
|
| 20 |
use strict; |
20 |
use Modern::Perl; |
| 21 |
use warnings; |
|
|
| 22 |
use CGI; |
21 |
use CGI; |
| 23 |
use C4::Context; |
22 |
use C4::Context; |
| 24 |
use C4::Output; |
23 |
use C4::Output; |
|
Lines 56-101
if ($op eq 'delete') {
Link Here
|
| 56 |
} |
55 |
} |
| 57 |
elsif ($op eq 'delete-branch-cat') { |
56 |
elsif ($op eq 'delete-branch-cat') { |
| 58 |
my $categorycode = $input->param('categorycode'); |
57 |
my $categorycode = $input->param('categorycode'); |
| 59 |
if ($branch eq "*") { |
58 |
if ($categorycode eq "*") { |
| 60 |
if ($categorycode eq "*") { |
59 |
my $sth_delete = $dbh->prepare("DELETE FROM circ_rules WHERE branchcode = ?"); |
| 61 |
my $sth_delete = $dbh->prepare("DELETE FROM default_circ_rules"); |
60 |
$sth_delete->execute( $branch ); |
| 62 |
$sth_delete->execute(); |
|
|
| 63 |
} else { |
| 64 |
my $sth_delete = $dbh->prepare("DELETE FROM default_borrower_circ_rules |
| 65 |
WHERE categorycode = ?"); |
| 66 |
$sth_delete->execute($categorycode); |
| 67 |
} |
| 68 |
} elsif ($categorycode eq "*") { |
| 69 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_circ_rules |
| 70 |
WHERE branchcode = ?"); |
| 71 |
$sth_delete->execute($branch); |
| 72 |
} else { |
61 |
} else { |
| 73 |
my $sth_delete = $dbh->prepare("DELETE FROM branch_borrower_circ_rules |
62 |
my $sth_delete = $dbh->prepare("DELETE FROM borrower_circ_rules |
| 74 |
WHERE branchcode = ? |
63 |
WHERE branchcode = ? |
| 75 |
AND categorycode = ?"); |
64 |
AND categorycode = ?"); |
| 76 |
$sth_delete->execute($branch, $categorycode); |
65 |
$sth_delete->execute( $branch, $categorycode ); |
| 77 |
} |
66 |
} |
| 78 |
} |
67 |
} |
| 79 |
elsif ($op eq 'delete-branch-item') { |
68 |
elsif ($op eq 'delete-branch-item') { |
| 80 |
my $itemtype = $input->param('itemtype'); |
69 |
my $itemtype = $input->param('itemtype'); |
| 81 |
if ($branch eq "*") { |
70 |
if ($itemtype eq "*") { |
| 82 |
if ($itemtype eq "*") { |
71 |
my $sth_delete = $dbh->prepare("DELETE FROM circ_rules WHERE branchcode = ?"); |
| 83 |
my $sth_delete = $dbh->prepare("DELETE FROM default_circ_rules"); |
72 |
$sth_delete->execute( $branch); |
| 84 |
$sth_delete->execute(); |
|
|
| 85 |
} else { |
| 86 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_item_rules |
| 87 |
WHERE itemtype = ?"); |
| 88 |
$sth_delete->execute($itemtype); |
| 89 |
} |
| 90 |
} elsif ($itemtype eq "*") { |
| 91 |
my $sth_delete = $dbh->prepare("DELETE FROM default_branch_circ_rules |
| 92 |
WHERE branchcode = ?"); |
| 93 |
$sth_delete->execute($branch); |
| 94 |
} else { |
73 |
} else { |
| 95 |
my $sth_delete = $dbh->prepare("DELETE FROM branch_item_rules |
74 |
my $sth_delete = $dbh->prepare("DELETE FROM item_circ_rules |
| 96 |
WHERE branchcode = ? |
75 |
WHERE branchcode = ? |
| 97 |
AND itemtype = ?"); |
76 |
AND itemtype = ?"); |
| 98 |
$sth_delete->execute($branch, $itemtype); |
77 |
$sth_delete->execute( $branch, $itemtype ); |
| 99 |
} |
78 |
} |
| 100 |
} |
79 |
} |
| 101 |
# save the values entered |
80 |
# save the values entered |
|
Lines 143-182
elsif ($op eq "set-branch-defaults") {
Link Here
|
| 143 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
122 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
| 144 |
$holdallowed =~ s/\s//g; |
123 |
$holdallowed =~ s/\s//g; |
| 145 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
124 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
| 146 |
|
125 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 147 |
if ($branch eq "*") { |
126 |
FROM circ_rules |
| 148 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
127 |
WHERE branchcode = ?"); |
| 149 |
FROM default_circ_rules"); |
128 |
my $sth_insert = $dbh->prepare("INSERT INTO circ_rules |
| 150 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
129 |
(branchcode, maxissueqty, holdallowed, returnbranch) |
| 151 |
(maxissueqty, holdallowed, returnbranch) |
130 |
VALUES (?, ?, ?, ?)"); |
| 152 |
VALUES (?, ?, ?)"); |
131 |
my $sth_update = $dbh->prepare("UPDATE circ_rules |
| 153 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
132 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ? |
| 154 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ?"); |
133 |
WHERE branchcode = ?"); |
| 155 |
|
134 |
|
| 156 |
$sth_search->execute(); |
135 |
$sth_search->execute( $branch ); |
| 157 |
my $res = $sth_search->fetchrow_hashref(); |
136 |
my $res = $sth_search->fetchrow_hashref(); |
| 158 |
if ($res->{total}) { |
137 |
if ($res->{total}) { |
| 159 |
$sth_update->execute($maxissueqty, $holdallowed, $returnbranch); |
138 |
$sth_update->execute($maxissueqty, $holdallowed, $returnbranch, $branch); |
| 160 |
} else { |
|
|
| 161 |
$sth_insert->execute($maxissueqty, $holdallowed, $returnbranch); |
| 162 |
} |
| 163 |
} else { |
139 |
} else { |
| 164 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
140 |
$sth_insert->execute($branch, $maxissueqty, $holdallowed, $returnbranch); |
| 165 |
FROM default_branch_circ_rules |
|
|
| 166 |
WHERE branchcode = ?"); |
| 167 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules |
| 168 |
(branchcode, maxissueqty, holdallowed, returnbranch) |
| 169 |
VALUES (?, ?, ?, ?)"); |
| 170 |
my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules |
| 171 |
SET maxissueqty = ?, holdallowed = ?, returnbranch = ? |
| 172 |
WHERE branchcode = ?"); |
| 173 |
$sth_search->execute($branch); |
| 174 |
my $res = $sth_search->fetchrow_hashref(); |
| 175 |
if ($res->{total}) { |
| 176 |
$sth_update->execute($maxissueqty, $holdallowed, $returnbranch, $branch); |
| 177 |
} else { |
| 178 |
$sth_insert->execute($branch, $maxissueqty, $holdallowed, $returnbranch); |
| 179 |
} |
| 180 |
} |
141 |
} |
| 181 |
} |
142 |
} |
| 182 |
elsif ($op eq "add-branch-cat") { |
143 |
elsif ($op eq "add-branch-cat") { |
|
Lines 185-256
elsif ($op eq "add-branch-cat") {
Link Here
|
| 185 |
$maxissueqty =~ s/\s//g; |
146 |
$maxissueqty =~ s/\s//g; |
| 186 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
147 |
$maxissueqty = undef if $maxissueqty !~ /^\d+/; |
| 187 |
|
148 |
|
| 188 |
if ($branch eq "*") { |
149 |
if ($categorycode eq "*") { |
| 189 |
if ($categorycode eq "*") { |
|
|
| 190 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 191 |
FROM default_circ_rules"); |
| 192 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
| 193 |
(maxissueqty) |
| 194 |
VALUES (?)"); |
| 195 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
| 196 |
SET maxissueqty = ?"); |
| 197 |
|
| 198 |
$sth_search->execute(); |
| 199 |
my $res = $sth_search->fetchrow_hashref(); |
| 200 |
if ($res->{total}) { |
| 201 |
$sth_update->execute($maxissueqty); |
| 202 |
} else { |
| 203 |
$sth_insert->execute($maxissueqty); |
| 204 |
} |
| 205 |
} else { |
| 206 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 207 |
FROM default_borrower_circ_rules |
| 208 |
WHERE categorycode = ?"); |
| 209 |
my $sth_insert = $dbh->prepare("INSERT INTO default_borrower_circ_rules |
| 210 |
(categorycode, maxissueqty) |
| 211 |
VALUES (?, ?)"); |
| 212 |
my $sth_update = $dbh->prepare("UPDATE default_borrower_circ_rules |
| 213 |
SET maxissueqty = ? |
| 214 |
WHERE categorycode = ?"); |
| 215 |
$sth_search->execute($branch); |
| 216 |
my $res = $sth_search->fetchrow_hashref(); |
| 217 |
if ($res->{total}) { |
| 218 |
$sth_update->execute($maxissueqty, $categorycode); |
| 219 |
} else { |
| 220 |
$sth_insert->execute($categorycode, $maxissueqty); |
| 221 |
} |
| 222 |
} |
| 223 |
} elsif ($categorycode eq "*") { |
| 224 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
150 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 225 |
FROM default_branch_circ_rules |
151 |
FROM circ_rules |
| 226 |
WHERE branchcode = ?"); |
152 |
WHERE branchcode = ?"); |
| 227 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules |
153 |
my $sth_insert = $dbh->prepare("INSERT INTO circ_rules |
| 228 |
(branchcode, maxissueqty) |
154 |
(branchcode, maxissueqty) |
| 229 |
VALUES (?, ?)"); |
155 |
VALUES (?, ?)"); |
| 230 |
my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules |
156 |
my $sth_update = $dbh->prepare("UPDATE circ_rules |
| 231 |
SET maxissueqty = ? |
157 |
SET maxissueqty = ? |
| 232 |
WHERE branchcode = ?"); |
158 |
WHERE branchcode = ?"); |
| 233 |
$sth_search->execute($branch); |
159 |
|
|
|
160 |
$sth_search->execute( $branch ); |
| 234 |
my $res = $sth_search->fetchrow_hashref(); |
161 |
my $res = $sth_search->fetchrow_hashref(); |
| 235 |
if ($res->{total}) { |
162 |
if ($res->{total}) { |
| 236 |
$sth_update->execute($maxissueqty, $branch); |
163 |
$sth_update->execute( $branch, $maxissueqty ); |
| 237 |
} else { |
164 |
} else { |
| 238 |
$sth_insert->execute($branch, $maxissueqty); |
165 |
$sth_insert->execute( $maxissueqty, $branch ); |
| 239 |
} |
166 |
} |
| 240 |
} else { |
167 |
} else { |
| 241 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
168 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 242 |
FROM branch_borrower_circ_rules |
169 |
FROM borrower_circ_rules |
| 243 |
WHERE branchcode = ? |
170 |
WHERE branchcode = ? |
| 244 |
AND categorycode = ?"); |
171 |
AND categorycode = ?"); |
| 245 |
my $sth_insert = $dbh->prepare("INSERT INTO branch_borrower_circ_rules |
172 |
my $sth_insert = $dbh->prepare("INSERT INTO borrower_circ_rules |
| 246 |
(branchcode, categorycode, maxissueqty) |
173 |
(branchcode, categorycode, maxissueqty) |
| 247 |
VALUES (?, ?, ?)"); |
174 |
VALUES (?, ?, ?)"); |
| 248 |
my $sth_update = $dbh->prepare("UPDATE branch_borrower_circ_rules |
175 |
my $sth_update = $dbh->prepare("UPDATE borrower_circ_rules |
| 249 |
SET maxissueqty = ? |
176 |
SET maxissueqty = ? |
| 250 |
WHERE branchcode = ? |
177 |
WHERE branchcode = ? |
| 251 |
AND categorycode = ?"); |
178 |
AND categorycode = ?"); |
| 252 |
|
179 |
$sth_search->execute( $branch, $categorycode ); |
| 253 |
$sth_search->execute($branch, $categorycode); |
|
|
| 254 |
my $res = $sth_search->fetchrow_hashref(); |
180 |
my $res = $sth_search->fetchrow_hashref(); |
| 255 |
if ($res->{total}) { |
181 |
if ($res->{total}) { |
| 256 |
$sth_update->execute($maxissueqty, $branch, $categorycode); |
182 |
$sth_update->execute($maxissueqty, $branch, $categorycode); |
|
Lines 266-317
elsif ($op eq "add-branch-item") {
Link Here
|
| 266 |
$holdallowed =~ s/\s//g; |
192 |
$holdallowed =~ s/\s//g; |
| 267 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
193 |
$holdallowed = undef if $holdallowed !~ /^\d+/; |
| 268 |
|
194 |
|
| 269 |
if ($branch eq "*") { |
195 |
if ($itemtype eq "*") { |
| 270 |
if ($itemtype eq "*") { |
|
|
| 271 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 272 |
FROM default_circ_rules"); |
| 273 |
my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules |
| 274 |
(holdallowed, returnbranch) |
| 275 |
VALUES (?, ?)"); |
| 276 |
my $sth_update = $dbh->prepare("UPDATE default_circ_rules |
| 277 |
SET holdallowed = ?, returnbranch = ?"); |
| 278 |
|
| 279 |
$sth_search->execute(); |
| 280 |
my $res = $sth_search->fetchrow_hashref(); |
| 281 |
if ($res->{total}) { |
| 282 |
$sth_update->execute($holdallowed, $returnbranch); |
| 283 |
} else { |
| 284 |
$sth_insert->execute($holdallowed, $returnbranch); |
| 285 |
} |
| 286 |
} else { |
| 287 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 288 |
FROM default_branch_item_rules |
| 289 |
WHERE itemtype = ?"); |
| 290 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_item_rules |
| 291 |
(itemtype, holdallowed, returnbranch) |
| 292 |
VALUES (?, ?, ?)"); |
| 293 |
my $sth_update = $dbh->prepare("UPDATE default_branch_item_rules |
| 294 |
SET holdallowed = ?, returnbranch = ? |
| 295 |
WHERE itemtype = ?"); |
| 296 |
$sth_search->execute($itemtype); |
| 297 |
my $res = $sth_search->fetchrow_hashref(); |
| 298 |
if ($res->{total}) { |
| 299 |
$sth_update->execute($holdallowed, $returnbranch, $itemtype); |
| 300 |
} else { |
| 301 |
$sth_insert->execute($itemtype, $holdallowed, $returnbranch); |
| 302 |
} |
| 303 |
} |
| 304 |
} elsif ($itemtype eq "*") { |
| 305 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
196 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 306 |
FROM default_branch_circ_rules |
197 |
FROM circ_rules |
| 307 |
WHERE branchcode = ?"); |
198 |
WHERE branchcode = ?"); |
| 308 |
my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules |
199 |
my $sth_insert = $dbh->prepare("INSERT INTO circ_rules |
| 309 |
(branchcode, holdallowed, returnbranch) |
200 |
(branchcode, holdallowed, returnbranch) |
| 310 |
VALUES (?, ?, ?)"); |
201 |
VALUES (?, ?, ?)"); |
| 311 |
my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules |
202 |
my $sth_update = $dbh->prepare("UPDATE circ_rules |
| 312 |
SET holdallowed = ?, returnbranch = ? |
203 |
SET holdallowed = ?, returnbranch = ? |
| 313 |
WHERE branchcode = ?"); |
204 |
WHERE branchcode = ?"); |
| 314 |
$sth_search->execute($branch); |
205 |
|
|
|
206 |
$sth_search->execute( $branch ); |
| 315 |
my $res = $sth_search->fetchrow_hashref(); |
207 |
my $res = $sth_search->fetchrow_hashref(); |
| 316 |
if ($res->{total}) { |
208 |
if ($res->{total}) { |
| 317 |
$sth_update->execute($holdallowed, $returnbranch, $branch); |
209 |
$sth_update->execute($holdallowed, $returnbranch, $branch); |
|
Lines 320-337
elsif ($op eq "add-branch-item") {
Link Here
|
| 320 |
} |
212 |
} |
| 321 |
} else { |
213 |
} else { |
| 322 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
214 |
my $sth_search = $dbh->prepare("SELECT count(*) AS total |
| 323 |
FROM branch_item_rules |
215 |
FROM item_circ_rules |
| 324 |
WHERE branchcode = ? |
216 |
WHERE itemtype = ?"); |
| 325 |
AND itemtype = ?"); |
217 |
my $sth_insert = $dbh->prepare("INSERT INTO item_circ_rules |
| 326 |
my $sth_insert = $dbh->prepare("INSERT INTO branch_item_rules |
|
|
| 327 |
(branchcode, itemtype, holdallowed, returnbranch) |
218 |
(branchcode, itemtype, holdallowed, returnbranch) |
| 328 |
VALUES (?, ?, ?, ?)"); |
219 |
VALUES (?, ?, ?, ?)"); |
| 329 |
my $sth_update = $dbh->prepare("UPDATE branch_item_rules |
220 |
my $sth_update = $dbh->prepare("UPDATE item_circ_rules |
| 330 |
SET holdallowed = ?, returnbranch = ? |
221 |
SET holdallowed = ?, returnbranch = ? |
| 331 |
WHERE branchcode = ? |
222 |
WHERE branchcode = ? |
| 332 |
AND itemtype = ?"); |
223 |
AND itemtype = ?"); |
| 333 |
|
224 |
$sth_search->execute($itemtype); |
| 334 |
$sth_search->execute($branch, $itemtype); |
|
|
| 335 |
my $res = $sth_search->fetchrow_hashref(); |
225 |
my $res = $sth_search->fetchrow_hashref(); |
| 336 |
if ($res->{total}) { |
226 |
if ($res->{total}) { |
| 337 |
$sth_update->execute($holdallowed, $returnbranch, $branch, $itemtype); |
227 |
$sth_update->execute($holdallowed, $returnbranch, $branch, $itemtype); |
|
Lines 386-392
while (my $row = $sth2->fetchrow_hashref) {
Link Here
|
| 386 |
$row->{'humancategorycode'} ||= $row->{'categorycode'}; |
276 |
$row->{'humancategorycode'} ||= $row->{'categorycode'}; |
| 387 |
$row->{'default_humancategorycode'} = 1 if $row->{'humancategorycode'} eq '*'; |
277 |
$row->{'default_humancategorycode'} = 1 if $row->{'humancategorycode'} eq '*'; |
| 388 |
$row->{'fine'} = sprintf('%.2f', $row->{'fine'}); |
278 |
$row->{'fine'} = sprintf('%.2f', $row->{'fine'}); |
| 389 |
if ($row->{'hardduedate'} ne '0000-00-00') { |
279 |
if ($row->{hardduedate} and $row->{'hardduedate'} ne '0000-00-00') { |
| 390 |
$row->{'hardduedate'} = format_date( $row->{'hardduedate'}); |
280 |
$row->{'hardduedate'} = format_date( $row->{'hardduedate'}); |
| 391 |
$row->{'hardduedatebefore'} = 1 if ($row->{'hardduedatecompare'} == -1); |
281 |
$row->{'hardduedatebefore'} = 1 if ($row->{'hardduedatecompare'} == -1); |
| 392 |
$row->{'hardduedateexact'} = 1 if ($row->{'hardduedatecompare'} == 0); |
282 |
$row->{'hardduedateexact'} = 1 if ($row->{'hardduedatecompare'} == 0); |
|
Lines 401-423
$sth->finish;
Link Here
|
| 401 |
my @sorted_row_loop = sort by_category_and_itemtype @row_loop; |
291 |
my @sorted_row_loop = sort by_category_and_itemtype @row_loop; |
| 402 |
|
292 |
|
| 403 |
my $sth_branch_cat; |
293 |
my $sth_branch_cat; |
| 404 |
if ($branch eq "*") { |
294 |
$sth_branch_cat = $dbh->prepare(" |
| 405 |
$sth_branch_cat = $dbh->prepare(" |
295 |
SELECT borrower_circ_rules.*, categories.description AS humancategorycode |
| 406 |
SELECT default_borrower_circ_rules.*, categories.description AS humancategorycode |
296 |
FROM borrower_circ_rules |
| 407 |
FROM default_borrower_circ_rules |
297 |
JOIN categories USING (categorycode) |
| 408 |
JOIN categories USING (categorycode) |
298 |
WHERE borrower_circ_rules.branchcode = ? |
| 409 |
|
299 |
"); |
| 410 |
"); |
300 |
$sth_branch_cat->execute($branch); |
| 411 |
$sth_branch_cat->execute(); |
|
|
| 412 |
} else { |
| 413 |
$sth_branch_cat = $dbh->prepare(" |
| 414 |
SELECT branch_borrower_circ_rules.*, categories.description AS humancategorycode |
| 415 |
FROM branch_borrower_circ_rules |
| 416 |
JOIN categories USING (categorycode) |
| 417 |
WHERE branch_borrower_circ_rules.branchcode = ? |
| 418 |
"); |
| 419 |
$sth_branch_cat->execute($branch); |
| 420 |
} |
| 421 |
|
301 |
|
| 422 |
my @branch_cat_rules = (); |
302 |
my @branch_cat_rules = (); |
| 423 |
while (my $row = $sth_branch_cat->fetchrow_hashref) { |
303 |
while (my $row = $sth_branch_cat->fetchrow_hashref) { |
|
Lines 433-454
foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) {
Link Here
|
| 433 |
@sorted_row_loop = sort by_category_and_itemtype @row_loop; |
313 |
@sorted_row_loop = sort by_category_and_itemtype @row_loop; |
| 434 |
|
314 |
|
| 435 |
my $sth_branch_item; |
315 |
my $sth_branch_item; |
| 436 |
if ($branch eq "*") { |
316 |
$sth_branch_item = $dbh->prepare(" |
| 437 |
$sth_branch_item = $dbh->prepare(" |
317 |
SELECT item_circ_rules.*, itemtypes.description AS humanitemtype |
| 438 |
SELECT default_branch_item_rules.*, itemtypes.description AS humanitemtype |
318 |
FROM item_circ_rules |
| 439 |
FROM default_branch_item_rules |
319 |
JOIN itemtypes USING (itemtype) |
| 440 |
JOIN itemtypes USING (itemtype) |
320 |
WHERE item_circ_rules.branchcode = ? |
| 441 |
"); |
321 |
"); |
| 442 |
$sth_branch_item->execute(); |
322 |
$sth_branch_item->execute($branch); |
| 443 |
} else { |
|
|
| 444 |
$sth_branch_item = $dbh->prepare(" |
| 445 |
SELECT branch_item_rules.*, itemtypes.description AS humanitemtype |
| 446 |
FROM branch_item_rules |
| 447 |
JOIN itemtypes USING (itemtype) |
| 448 |
WHERE branch_item_rules.branchcode = ? |
| 449 |
"); |
| 450 |
$sth_branch_item->execute($branch); |
| 451 |
} |
| 452 |
|
323 |
|
| 453 |
my @branch_item_rules = (); |
324 |
my @branch_item_rules = (); |
| 454 |
while (my $row = $sth_branch_item->fetchrow_hashref) { |
325 |
while (my $row = $sth_branch_item->fetchrow_hashref) { |
|
Lines 467-486
$template->param(branch_item_rule_loop => \@sorted_branch_item_rules);
Link Here
|
| 467 |
$template->param(branch_cat_rule_loop => \@sorted_branch_cat_rules); |
338 |
$template->param(branch_cat_rule_loop => \@sorted_branch_cat_rules); |
| 468 |
|
339 |
|
| 469 |
my $sth_defaults; |
340 |
my $sth_defaults; |
| 470 |
if ($branch eq "*") { |
341 |
$sth_defaults = $dbh->prepare(" |
| 471 |
$sth_defaults = $dbh->prepare(" |
342 |
SELECT * |
| 472 |
SELECT * |
343 |
FROM circ_rules |
| 473 |
FROM default_circ_rules |
344 |
WHERE branchcode = ? |
| 474 |
"); |
345 |
"); |
| 475 |
$sth_defaults->execute(); |
346 |
$sth_defaults->execute($branch); |
| 476 |
} else { |
|
|
| 477 |
$sth_defaults = $dbh->prepare(" |
| 478 |
SELECT * |
| 479 |
FROM default_branch_circ_rules |
| 480 |
WHERE branchcode = ? |
| 481 |
"); |
| 482 |
$sth_defaults->execute($branch); |
| 483 |
} |
| 484 |
|
347 |
|
| 485 |
my $defaults = $sth_defaults->fetchrow_hashref; |
348 |
my $defaults = $sth_defaults->fetchrow_hashref; |
| 486 |
|
349 |
|
|
Lines 494-507
if ($defaults) {
Link Here
|
| 494 |
|
357 |
|
| 495 |
$template->param(default_rules => ($defaults ? 1 : 0)); |
358 |
$template->param(default_rules => ($defaults ? 1 : 0)); |
| 496 |
|
359 |
|
| 497 |
$template->param(categoryloop => \@category_loop, |
360 |
$template->param( |
| 498 |
itemtypeloop => \@itemtypes, |
361 |
categoryloop => \@category_loop, |
| 499 |
rules => \@sorted_row_loop, |
362 |
itemtypeloop => \@itemtypes, |
| 500 |
branchloop => \@branchloop, |
363 |
rules => \@sorted_row_loop, |
| 501 |
humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''), |
364 |
branchloop => \@branchloop, |
| 502 |
current_branch => $branch, |
365 |
humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''), |
| 503 |
definedbranch => scalar(@sorted_row_loop)>0 |
366 |
current_branch => $branch, |
| 504 |
); |
367 |
definedbranch => scalar(@sorted_row_loop)>0, |
|
|
368 |
); |
| 505 |
output_html_with_http_headers $input, $cookie, $template->output; |
369 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 506 |
|
370 |
|
| 507 |
exit 0; |
371 |
exit 0; |