-my $sth_branch_cat;
-if ($branch eq "*") {
- $sth_branch_cat = $dbh->prepare("
- SELECT default_borrower_circ_rules.*, categories.description AS humancategorycode
- FROM default_borrower_circ_rules
- JOIN categories USING (categorycode)
-
- ");
- $sth_branch_cat->execute();
-} else {
- $sth_branch_cat = $dbh->prepare("
- SELECT branch_borrower_circ_rules.*, categories.description AS humancategorycode
- FROM branch_borrower_circ_rules
- JOIN categories USING (categorycode)
- WHERE branch_borrower_circ_rules.branchcode = ?
- ");
- $sth_branch_cat->execute($branch);
-}
-
-my @branch_cat_rules = ();
-while (my $row = $sth_branch_cat->fetchrow_hashref) {
- push @branch_cat_rules, $row;
-}
-my @sorted_branch_cat_rules = sort { $a->{'humancategorycode'} cmp $b->{'humancategorycode'} } @branch_cat_rules;
-
-# note undef maxissueqty so that template can deal with them
-foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) {
- $entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty});
- $entry->{unlimited_maxonsiteissueqty} = 1 unless defined($entry->{maxonsiteissueqty});
-}
-
-@sorted_row_loop = sort by_category_and_itemtype @row_loop;
-