Bugzilla – Attachment 36764 Details for
Bug 13816
Set Overdue letter fine to the overduerules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13816 - Set Overdue letter fine to the overduerules
Bug-13816---Set-Overdue-letter-fine-to-the-overdue.patch (text/plain), 9.90 KB, created by
Olli-Antti Kivilahti
on 2015-03-10 13:13:00 UTC
(
hide
)
Description:
Bug 13816 - Set Overdue letter fine to the overduerules
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-03-10 13:13:00 UTC
Size:
9.90 KB
patch
obsolete
>From 24ea8a673374109e3cb4c4b17e322a8d358be6f1 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Tue, 10 Mar 2015 15:10:55 +0200 >Subject: [PATCH] Bug 13816 - Set Overdue letter fine to the overduerules > >This patch makes the necessary DB modifications to add the fines-columns >and CRUD them using the tools/overduerules.pl > >This is a good basis for defining a cost or a fine for sending the >notification, as sending them usually costs some money. > >TEST PLAN: >Modify the overduerules and fines-column. >Save changes. >Observe the changes persist on page reloads. > >Unit test cases are not broken and give no extra errors. >--- > installer/data/mysql/kohastructure.sql | 3 +++ > installer/data/mysql/updatedatabase.pl | 10 ++++++++++ > .../prog/en/modules/tools/overduerules.tt | 4 ++++ > tools/overduerules.pl | 16 ++++++++++++---- > 4 files changed, 29 insertions(+), 4 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 5827a10..e10f369 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1709,12 +1709,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) >+ `fine1` int(4) default NULL, -- How much a borrower is fined for each succesfully sent letter > `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) > `letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice >+ `fine2` int(4) default NULL, -- How much a borrower is fined for each succesfully sent letter > `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) >+ `fine3` int(4) default NULL, -- How much a borrower is fined for each succesfully sent letter > PRIMARY KEY (`branchcode`,`categorycode`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 009bb9c..c25dcd5 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8526,6 +8526,16 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.19.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("ALTER TABLE overduerules ADD COLUMN fine1 int(4) DEFAULT NULL AFTER debarred1;"); >+ $dbh->do("ALTER TABLE overduerules ADD COLUMN fine2 int(4) DEFAULT NULL AFTER debarred2;"); >+ $dbh->do("ALTER TABLE overduerules ADD COLUMN fine3 int(4) DEFAULT NULL AFTER debarred3;"); >+ >+ print "Upgrade to $DBversion done (Bug 13816 - Add Overdue letter fine to the overduerules)\n"; >+ SetVersion ($DBversion); >+} >+ > $DBversion = "3.15.00.051"; > if ( CheckVersion($DBversion) ) { > print "Upgrade to $DBversion done (Koha 3.16 beta)\n"; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt >index e561859..0c8de05 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt >@@ -92,6 +92,7 @@ $(document).ready(function() { > <th scope="col">Delay</th> > <th scope="col">Letter</th> > <th scope="col">Restrict</th> >+ <th scope="col">Fine</th> > [% FOREACH mtt IN message_transport_types %] > <th scpre="col"> > [% SWITCH mtt %] >@@ -138,6 +139,9 @@ $(document).ready(function() { > <input type="checkbox" name="debarred[% tab.number %]-[% value.overduename %]" value="1" /> > [% END %] > </td> >+ <td> >+ <input type="text" name="fine[% tab.number %]-[% value.overduename %]" size="4" value="[% value.fine %]" /> >+ </td> > [% FOREACH mtt IN value.message_transport_types %] > <td> > [% IF mtt.selected %] >diff --git a/tools/overduerules.pl b/tools/overduerules.pl >index 178a569..ba6dde6 100755 >--- a/tools/overduerules.pl >+++ b/tools/overduerules.pl >@@ -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,fine1, delay2,letter2,debarred2,fine2, delay3,letter3,debarred3,fine3) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); >+ my $sth_update=$dbh->prepare("UPDATE overduerules SET delay1=?, letter1=?, debarred1=?, fine1=?, delay2=?, letter2=?, debarred2=?, fine2=?, delay3=?, letter3=?, debarred3=?, 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|fine)([1-3])-(.*)/) { > my $type = $1; # data type > my $num = $2; # From 1 to 3 > my $bor = $3; # borrower category >@@ -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}->{"fine1"}?$temphash{$bor}->{"fine1"}:0), > ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef), > ($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), > ($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), >+ ($temphash{$bor}->{"fine2"}?$temphash{$bor}->{"fine2"}:0), > ($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef), > ($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""), > ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0), >+ ($temphash{$bor}->{"fine3"}?$temphash{$bor}->{"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}->{"fine1"}?$temphash{$bor}->{"fine1"}:0), > ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0), > ($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""), > ($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0), >+ ($temphash{$bor}->{"fine2"}?$temphash{$bor}->{"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}->{"fine3"}?$temphash{$bor}->{"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{fine}=$temphash{$data->{'categorycode'}}->{"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->{"fine$i"}){$row{fine}=$dat->{"fine$i"};} > my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) }; > my @mtts; > for my $mtt ( @$message_transport_types ) { >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13816
: 36764