@@ -, +, @@
some pl and pm
- Prerequisite: Be sure you have several patron categories created, with
different option enabled, and limit some to certain libraries.
- On the 'Circulation and fine rules' admin page (admin/smart-rules.pl),
all the patron categories should be displayed (even the ones limited to
another library), ordered by description. Try to add/update existing rules.
- On the overdue rules page (tools/overduerules.pl), all the patron
categories with overduenoticerequired set should be displayed.
Try to add/update existing rules.
- On the following reports:
reports/borrowers_stats.pl
reports/issues_avg_stats.pl
---
C4/Reports/Guided.pm | 4 +--
admin/smart-rules.pl | 13 +++------
.../prog/en/modules/admin/smart-rules.tt | 8 +++---
.../prog/en/modules/reports/borrowers_stats.tt | 15 ++++++-----
.../prog/en/modules/reports/issues_avg_stats.tt | 4 +--
reports/borrowers_stats.pl | 30 +++++++--------------
reports/guided_reports.pl | 13 ++++-----
reports/issues_avg_stats.pl | 24 ++++-------------
tools/overduerules.pl | 31 +++++++++++-----------
9 files changed, 54 insertions(+), 88 deletions(-)
--- a/C4/Reports/Guided.pm
+++ a/C4/Reports/Guided.pm
@@ -30,10 +30,10 @@ use C4::Output;
use XML::Simple;
use XML::Dumper;
use C4::Debug;
-# use Smart::Comments;
-# use Data::Dumper;
use C4::Log;
+use Koha::Patron::Categories;
+
BEGIN {
# set the version for version checking
$VERSION = 3.07.00.049;
--- a/admin/smart-rules.pl
+++ a/admin/smart-rules.pl
@@ -31,6 +31,7 @@ use Koha::Database;
use Koha::IssuingRule;
use Koha::IssuingRules;
use Koha::Libraries;
+use Koha::Patron::Categories;
my $input = CGI->new;
my $dbh = C4::Context->dbh;
@@ -430,14 +431,8 @@ for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{b
};
}
-my $sth=$dbh->prepare("SELECT description,categorycode FROM categories ORDER BY description");
-$sth->execute;
-my @category_loop;
-while (my $data=$sth->fetchrow_hashref){
- push @category_loop,$data;
-}
+my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
-$sth->finish;
my @row_loop;
my @itemtypes = @{ GetItemTypes( style => 'array' ) };
@itemtypes = sort { lc $a->{translated_description} cmp lc $b->{translated_description} } @itemtypes;
@@ -477,7 +472,6 @@ while (my $row = $sth2->fetchrow_hashref) {
}
push @row_loop, $row;
}
-$sth->finish;
my @sorted_row_loop = sort by_category_and_itemtype @row_loop;
@@ -585,7 +579,8 @@ if ($defaults) {
$template->param(default_rules => ($defaults ? 1 : 0));
-$template->param(categoryloop => \@category_loop,
+$template->param(
+ patron_categories => $patron_categories,
itemtypeloop => \@itemtypes,
rules => \@sorted_row_loop,
branchloop => \@branchloop,
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
@@ -261,8 +261,8 @@ for="tobranch">Clone these rules to:
- [% FOREACH categoryloo IN categoryloop %]
-
+ [% FOREACH patron_category IN patron_categories%]
+
[% END %]
@@ -497,8 +497,8 @@ for="tobranch">Clone these rules to:
- [% FOREACH categoryloo IN categoryloop %]
-
+ [% FOREACH patron_category IN patron_categories%]
+
[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
@@ -78,13 +78,14 @@