From d6934ca3974c118e0494b624e203e8307bb5ba96 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 20 Jun 2008 08:11:14 -0500 Subject: [PATCH] bug 2000 - alternate issuing rules - some form cleanup Improvements to smart-rules.pl to allow it to replace issuingrules.pl. * standardized "borrower type" to "patron category" * made default item type and patron category ('Any') translatable * regularized construction of parameters for rule deletion operatrion Signed-off-by: Joshua Ferraro --- admin/smart-rules.pl | 15 +++++-------- .../prog/en/modules/admin/smart-rules.tmpl | 22 ++++++++++++++----- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 01dbb60d55..bc9f9a756f 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -44,9 +44,9 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); -if ($op =~ /delete-(.+)-(.+)/) { - my $itemtype = $1; - my $categorycode = $2; +if ($op eq 'delete') { + my $itemtype = $input->param('itemtype'); + my $categorycode = $input->param('categorycode'); $debug and warn "deleting $1 $2 $branch"; my $sth_Idelete = $dbh->prepare("delete from issuingrules where branchcode=? and categorycode=? and itemtype=?"); @@ -94,9 +94,6 @@ while (my $data=$sth->fetchrow_hashref){ push @category_loop,$data; } -my %row = (categorycode => "*", description => 'Any'); -push @category_loop, \%row; - $sth->finish; $sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes ORDER BY description"); $sth->execute; @@ -107,8 +104,6 @@ my @itemtypes; while (my $row=$sth->fetchrow_hashref){ push @itemtypes,$row; } -my %row = (itemtype => '*', description => 'Any'); -push @itemtypes,\%row; my $sth2 = $dbh->prepare(" SELECT issuingrules.*, itemtypes.description AS humanitemtype, categories.description AS humancategorycode @@ -123,9 +118,9 @@ $sth2->execute($branch); while (my $row = $sth2->fetchrow_hashref) { $row->{'humanitemtype'} ||= $row->{'itemtype'}; - $row->{'humanitemtype'} = 'Any' if $row->{'humanitemtype'} eq '*'; + $row->{'default_humanitemtype'} = 1 if $row->{'humanitemtype'} eq '*'; $row->{'humancategorycode'} ||= $row->{'categorycode'}; - $row->{'humancategorycode'} = 'Any' if $row->{'humancategorycode'} eq '*'; + $row->{'default_humancategorycode'} = 1 if $row->{'humancategorycode'} eq '*'; $row->{'fine'} = sprintf('%.2f', $row->{'fine'}); push @row_loop, $row; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl index 63f4d7adac..a00c16ecab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl @@ -47,7 +47,7 @@ $(document).ready(function() {
Select a branch : - + - - + +
Item TypeBorrower TypeAmountGrace
Period
Charging
Interval
Amount
Loanable
Loan time Item TypePatron CategoryAmountGrace
Period
Charging
Interval
Amount
Loanable
Loan time 
+ Any + + + + + Any + + + + $ day(s) day(s) day(s) - -&branch=">Delete + &categorycode=&branch=">Delete