@@ -, +, @@
- Add a overduerules.fixed_fineX for the 3 levels
- Add a column "Fixed fines" in the tools/overduerules.pl page
---
installer/data/mysql/atomicupdate/BZ14666.sql | 3 +++
installer/data/mysql/kohastructure.sql | 3 +++
.../prog/en/modules/help/tools/overduerules.tt | 1 +
.../prog/en/modules/tools/overduerules.tt | 4 ++++
tools/overduerules.pl | 24 ++++++++++++++--------
5 files changed, 27 insertions(+), 8 deletions(-)
create mode 100644 installer/data/mysql/atomicupdate/BZ14666.sql
--- a/installer/data/mysql/atomicupdate/BZ14666.sql
+++ a/installer/data/mysql/atomicupdate/BZ14666.sql
@@ -0,0 +1,3 @@
+ALTER TABLE overduerules ADD COLUMN fixed_fine1 float NOT NULL DEFAULT 0 after debarred1;
+ALTER TABLE overduerules ADD COLUMN fixed_fine2 float NOT NULL DEFAULT 0 after debarred2;
+ALTER TABLE overduerules ADD COLUMN fixed_fine3 float NOT NULL DEFAULT 0 after debarred3;
--- a/installer/data/mysql/kohastructure.sql
+++ a/installer/data/mysql/kohastructure.sql
@@ -1711,12 +1711,15 @@ CREATE TABLE `overduerules` ( -- overdue notice status and triggers
`delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
`letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
`debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
+ `fixed_fine1` float NOT NULL default '0', -- fixed fine for the first notice
`delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
`debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
+ `fixed_fine2` float NOT NULL default '0', -- fixed fine for the second notice
`letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
`delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
`letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
`debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
+ `fixed_fine3` float NOT NULL default '0', -- fixed fine for the third notice
PRIMARY KEY (`branchcode`,`categorycode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/overduerules.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/overduerules.tt
@@ -14,6 +14,7 @@
Important: If you want Koha to trigger an action (send a letter or restrict member), a delay value is required.
+
Fixed fine is an amount added to the total amount (which is a sum of item's prices)
To send additional notices, click on the tabs for 'Second' and 'Third' notice
If you would like to prevent a patron from checking items out because of their overdue items, check the 'Restrict' box, this will put a notice on the patron's record at checkout informing the librarian that the patron cannot check out due to overdue items.
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt
@@ -110,6 +110,7 @@ $(document).ready(function() {
[% END %]
[% END %]
+
Fixed Fine
@@ -153,6 +154,9 @@ $(document).ready(function() {
[% END %]
[% END %]
+
+
+
[% END %]
--- a/tools/overduerules.pl
+++ a/tools/overduerules.pl
@@ -37,7 +37,7 @@ my @categories = @{$dbh->selectall_arrayref(
{ Slice => {} }
)};
my @category_codes = map { $_->{categorycode} } @categories;
-our @rule_params = qw(delay letter debarred);
+our @rule_params = qw(delay letter debarred fixed_fine);
# blank_row($category_code) - return true if the entire row is blank.
sub blank_row {
@@ -82,8 +82,8 @@ if ($op eq 'save') {
my @names=$input->param();
my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM overduerules WHERE branchcode=? AND categorycode=?");
- my $sth_insert = $dbh->prepare("INSERT INTO overduerules (branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
- my $sth_update=$dbh->prepare("UPDATE overduerules SET delay1=?, letter1=?, debarred1=?, delay2=?, letter2=?, debarred2=?, delay3=?, letter3=?, debarred3=? WHERE branchcode=? AND categorycode=?");
+ my $sth_insert = $dbh->prepare("INSERT INTO overduerules (branchcode,categorycode, delay1,letter1,debarred1,fixed_fine1, delay2,letter2,debarred2,fixed_fine1, delay3,letter3,debarred3,fixed_fine1) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+ my $sth_update=$dbh->prepare("UPDATE overduerules SET delay1=?, letter1=?, debarred1=?, fixed_fine1=?, delay2=?, letter2=?, debarred2=?, fixed_fine2=?, delay3=?, letter3=?, debarred3=?, fixed_fine3=? WHERE branchcode=? AND categorycode=?");
my $sth_delete=$dbh->prepare("DELETE FROM overduerules WHERE branchcode=? AND categorycode=?");
my $sth_insert_mtt = $dbh->prepare("
INSERT INTO overduerules_transport_types(
@@ -99,7 +99,7 @@ if ($op eq 'save') {
foreach my $key (@names){
# ISSUES
- if ($key =~ /(delay|letter|debarred)([1-3])-(.*)/) {
+ if ($key =~ /(delay|letter|debarred|fixed_fine)([1-3])-(.*)/) {
my $type = $1; # data type
my $num = $2; # From 1 to 3
my $bor = $3; # borrower category
@@ -148,9 +148,9 @@ if ($op eq 'save') {
$err=1;
}
unless ($err){
- if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"}))
- or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"}))
- or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"}))) {
+ if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"} or $temphash{$bor}->{"fixed_fine1"}))
+ or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"} or $temphash{$bor}->{"fixed_fine2"}))
+ or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"} or $temphash{$bor}->{"fixed_fine3"}))) {
$sth_search->execute($branch,$bor);
my $res = $sth_search->fetchrow_hashref();
if ($res->{'total'}>0) {
@@ -158,12 +158,15 @@ if ($op eq 'save') {
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef),
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""),
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0),
+ ($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0),
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef),
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""),
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0),
+ ($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0),
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef),
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""),
($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0),
+ ($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0),
$branch ,$bor
);
} else {
@@ -171,12 +174,15 @@ if ($op eq 'save') {
($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0),
($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""),
($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0),
+ ($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0),
($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0),
($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""),
($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0),
+ ($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0),
($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0),
($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""),
- ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0)
+ ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0),
+ ($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0)
);
}
@@ -225,6 +231,7 @@ for my $data (@categories) {
);
$row{delay}=$temphash{$data->{'categorycode'}}->{"delay$i"};
$row{debarred}=$temphash{$data->{'categorycode'}}->{"debarred$i"};
+ $row{fixed_fine}=$temphash{$data->{'categorycode'}}->{"fixed_fine$i"};
$row{selected_lettercode} = $temphash{ $data->{categorycode} }->{"letter$i"};
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) };
my @mtts;
@@ -258,6 +265,7 @@ for my $data (@categories) {
if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};}
if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};}
+ if ($dat->{"fixed_fine$i"}){$row{fixed_fine}=$dat->{"fixed_fine$i"};}
my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) };
my @mtts;
for my $mtt ( @$message_transport_types ) {
--