View | Details | Raw Unified | Return to bug 14666
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/BZ14666.sql (+3 lines)
Line 0 Link Here
1
ALTER TABLE overduerules ADD COLUMN fixed_fine1 float NOT NULL DEFAULT 0 after debarred1;
2
ALTER TABLE overduerules ADD COLUMN fixed_fine2 float NOT NULL DEFAULT 0 after debarred2;
3
ALTER TABLE overduerules ADD COLUMN fixed_fine3 float NOT NULL DEFAULT 0 after debarred3;
(-)a/installer/data/mysql/kohastructure.sql (+3 lines)
Lines 1711-1722 CREATE TABLE `overduerules` ( -- overdue notice status and triggers Link Here
1711
  `delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
1711
  `delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent
1712
  `letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
1712
  `letter1` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the first notice
1713
  `debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
1713
  `debarred1` varchar(1) default 0, -- is the patron restricted when the first notice is sent (1 for yes, 0 for no)
1714
  `fixed_fine1` float NOT NULL default '0', -- fixed fine for the first notice
1714
  `delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
1715
  `delay2` int(4) default NULL, -- number of days after the item is overdue that the second notice is sent
1715
  `debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
1716
  `debarred2` varchar(1) default 0, -- is the patron restricted when the second notice is sent (1 for yes, 0 for no)
1717
  `fixed_fine2` float NOT NULL default '0', -- fixed fine for the second notice
1716
  `letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
1718
  `letter2` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the second notice
1717
  `delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
1719
  `delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent
1718
  `letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
1720
  `letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice
1719
  `debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
1721
  `debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no)
1722
  `fixed_fine3` float NOT NULL default '0', -- fixed fine for the third notice
1720
  PRIMARY KEY  (`branchcode`,`categorycode`)
1723
  PRIMARY KEY  (`branchcode`,`categorycode`)
1721
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1724
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
1722
1725
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/overduerules.tt (+1 lines)
Lines 14-19 Link Here
14
    <li style="color: #990000;">Important: If you want Koha to trigger an action (send a letter or restrict member), a delay value is required.</li>
14
    <li style="color: #990000;">Important: If you want Koha to trigger an action (send a letter or restrict member), a delay value is required.</li>
15
</ul>
15
</ul>
16
</li>
16
</li>
17
    <li>Fixed fine is an amount added to the total amount (which is a sum of item's prices)</li>
17
    <li>To send additional notices, click on the tabs for 'Second' and 'Third' notice</li>
18
    <li>To send additional notices, click on the tabs for 'Second' and 'Third' notice</li>
18
    <li>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.
19
    <li>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.
19
    <ul>
20
    <ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt (+4 lines)
Lines 110-115 $(document).ready(function() { Link Here
110
                  [% END %]
110
                  [% END %]
111
                </th>
111
                </th>
112
              [% END %]
112
              [% END %]
113
              <th>Fixed Fine</th>
113
            </tr>
114
            </tr>
114
          </thead>
115
          </thead>
115
          <tbody>
116
          <tbody>
Lines 153-158 $(document).ready(function() { Link Here
153
                  [% END %]
154
                  [% END %]
154
                </td>
155
                </td>
155
              [% END %]
156
              [% END %]
157
              <td>
158
                <input name="fixed_fine[% tab.number %]-[% value.overduename %]" value="[% value.fixed_fine %]" size="5" />
159
              </td>
156
            </tr>
160
            </tr>
157
          [% END %]
161
          [% END %]
158
          </tbody>
162
          </tbody>
(-)a/tools/overduerules.pl (-9 / +16 lines)
Lines 37-43 my @categories = @{$dbh->selectall_arrayref( Link Here
37
    { Slice => {} }
37
    { Slice => {} }
38
)};
38
)};
39
my @category_codes  = map { $_->{categorycode} } @categories;
39
my @category_codes  = map { $_->{categorycode} } @categories;
40
our @rule_params     = qw(delay letter debarred);
40
our @rule_params     = qw(delay letter debarred fixed_fine);
41
41
42
# blank_row($category_code) - return true if the entire row is blank.
42
# blank_row($category_code) - return true if the entire row is blank.
43
sub blank_row {
43
sub blank_row {
Lines 82-89 if ($op eq 'save') { Link Here
82
    my @names=$input->param();
82
    my @names=$input->param();
83
    my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM overduerules WHERE branchcode=? AND categorycode=?");
83
    my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM overduerules WHERE branchcode=? AND categorycode=?");
84
84
85
    my $sth_insert = $dbh->prepare("INSERT INTO overduerules (branchcode,categorycode, delay1,letter1,debarred1, delay2,letter2,debarred2, delay3,letter3,debarred3) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
85
    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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
86
    my $sth_update=$dbh->prepare("UPDATE overduerules SET delay1=?, letter1=?, debarred1=?, delay2=?, letter2=?, debarred2=?, delay3=?, letter3=?, debarred3=? WHERE branchcode=? AND categorycode=?");
86
    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=?");
87
    my $sth_delete=$dbh->prepare("DELETE FROM overduerules WHERE branchcode=? AND categorycode=?");
87
    my $sth_delete=$dbh->prepare("DELETE FROM overduerules WHERE branchcode=? AND categorycode=?");
88
    my $sth_insert_mtt = $dbh->prepare("
88
    my $sth_insert_mtt = $dbh->prepare("
89
        INSERT INTO overduerules_transport_types(
89
        INSERT INTO overduerules_transport_types(
Lines 99-105 if ($op eq 'save') { Link Here
99
99
100
    foreach my $key (@names){
100
    foreach my $key (@names){
101
            # ISSUES
101
            # ISSUES
102
            if ($key =~ /(delay|letter|debarred)([1-3])-(.*)/) {
102
            if ($key =~ /(delay|letter|debarred|fixed_fine)([1-3])-(.*)/) {
103
                    my $type = $1; # data type
103
                    my $type = $1; # data type
104
                    my $num = $2; # From 1 to 3
104
                    my $num = $2; # From 1 to 3
105
                    my $bor = $3; # borrower category
105
                    my $bor = $3; # borrower category
Lines 148-156 if ($op eq 'save') { Link Here
148
                        $err=1;
148
                        $err=1;
149
        }
149
        }
150
        unless ($err){
150
        unless ($err){
151
            if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"}))
151
            if (($temphash{$bor}->{delay1} and ($temphash{$bor}->{"letter1"} or $temphash{$bor}->{"debarred1"} or $temphash{$bor}->{"fixed_fine1"}))
152
                or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"}))
152
                or ($temphash{$bor}->{delay2} and ($temphash{$bor}->{"letter2"} or $temphash{$bor}->{"debarred2"} or $temphash{$bor}->{"fixed_fine2"}))
153
                or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"}))) {
153
                or ($temphash{$bor}->{delay3} and ($temphash{$bor}->{"letter3"} or $temphash{$bor}->{"debarred3"} or $temphash{$bor}->{"fixed_fine3"}))) {
154
                    $sth_search->execute($branch,$bor);
154
                    $sth_search->execute($branch,$bor);
155
                    my $res = $sth_search->fetchrow_hashref();
155
                    my $res = $sth_search->fetchrow_hashref();
156
                    if ($res->{'total'}>0) {
156
                    if ($res->{'total'}>0) {
Lines 158-169 if ($op eq 'save') { Link Here
158
                            ($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef),
158
                            ($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:undef),
159
                            ($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""),
159
                            ($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""),
160
                            ($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0),
160
                            ($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0),
161
                            ($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0),
161
                            ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef),
162
                            ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:undef),
162
                            ($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""),
163
                            ($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""),
163
                            ($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0),
164
                            ($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0),
165
                            ($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0),
164
                            ($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef),
166
                            ($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:undef),
165
                            ($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""),
167
                            ($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""),
166
                            ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0),
168
                            ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0),
169
                            ($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0),
167
                            $branch ,$bor
170
                            $branch ,$bor
168
                            );
171
                            );
169
                    } else {
172
                    } else {
Lines 171-182 if ($op eq 'save') { Link Here
171
                            ($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0),
174
                            ($temphash{$bor}->{"delay1"}?$temphash{$bor}->{"delay1"}:0),
172
                            ($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""),
175
                            ($temphash{$bor}->{"letter1"}?$temphash{$bor}->{"letter1"}:""),
173
                            ($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0),
176
                            ($temphash{$bor}->{"debarred1"}?$temphash{$bor}->{"debarred1"}:0),
177
                            ($temphash{$bor}->{"fixed_fine1"}?$temphash{$bor}->{"fixed_fine1"}:0),
174
                            ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0),
178
                            ($temphash{$bor}->{"delay2"}?$temphash{$bor}->{"delay2"}:0),
175
                            ($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""),
179
                            ($temphash{$bor}->{"letter2"}?$temphash{$bor}->{"letter2"}:""),
176
                            ($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0),
180
                            ($temphash{$bor}->{"debarred2"}?$temphash{$bor}->{"debarred2"}:0),
181
                            ($temphash{$bor}->{"fixed_fine2"}?$temphash{$bor}->{"fixed_fine2"}:0),
177
                            ($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0),
182
                            ($temphash{$bor}->{"delay3"}?$temphash{$bor}->{"delay3"}:0),
178
                            ($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""),
183
                            ($temphash{$bor}->{"letter3"}?$temphash{$bor}->{"letter3"}:""),
179
                            ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0)
184
                            ($temphash{$bor}->{"debarred3"}?$temphash{$bor}->{"debarred3"}:0),
185
                            ($temphash{$bor}->{"fixed_fine3"}?$temphash{$bor}->{"fixed_fine3"}:0)
180
                            );
186
                            );
181
                    }
187
                    }
182
188
Lines 225-230 for my $data (@categories) { Link Here
225
            );
231
            );
226
            $row{delay}=$temphash{$data->{'categorycode'}}->{"delay$i"};
232
            $row{delay}=$temphash{$data->{'categorycode'}}->{"delay$i"};
227
            $row{debarred}=$temphash{$data->{'categorycode'}}->{"debarred$i"};
233
            $row{debarred}=$temphash{$data->{'categorycode'}}->{"debarred$i"};
234
            $row{fixed_fine}=$temphash{$data->{'categorycode'}}->{"fixed_fine$i"};
228
            $row{selected_lettercode} = $temphash{ $data->{categorycode} }->{"letter$i"};
235
            $row{selected_lettercode} = $temphash{ $data->{categorycode} }->{"letter$i"};
229
            my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) };
236
            my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) };
230
            my @mtts;
237
            my @mtts;
Lines 258-263 for my $data (@categories) { Link Here
258
265
259
            if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};}
266
            if ($dat->{"delay$i"}){$row{delay}=$dat->{"delay$i"};}
260
            if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};}
267
            if ($dat->{"debarred$i"}){$row{debarred}=$dat->{"debarred$i"};}
268
            if ($dat->{"fixed_fine$i"}){$row{fixed_fine}=$dat->{"fixed_fine$i"};}
261
            my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) };
269
            my @selected_mtts = @{ GetOverdueMessageTransportTypes( $branch, $data->{'categorycode'}, $i) };
262
            my @mtts;
270
            my @mtts;
263
            for my $mtt ( @$message_transport_types ) {
271
            for my $mtt ( @$message_transport_types ) {
264
- 

Return to bug 14666