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

(-)a/C4/Overdues.pm (-2 / +3 lines)
Lines 109-122 sub Getoverdues { Link Here
109
    my $statement;
109
    my $statement;
110
    if ( C4::Context->preference('item-level_itypes') ) {
110
    if ( C4::Context->preference('item-level_itypes') ) {
111
        $statement = "
111
        $statement = "
112
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost
112
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice
113
     FROM issues 
113
     FROM issues 
114
LEFT JOIN items       USING (itemnumber)
114
LEFT JOIN items       USING (itemnumber)
115
    WHERE date_due < NOW()
115
    WHERE date_due < NOW()
116
";
116
";
117
    } else {
117
    } else {
118
        $statement = "
118
        $statement = "
119
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost
119
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice
120
     FROM issues 
120
     FROM issues 
121
LEFT JOIN items       USING (itemnumber)
121
LEFT JOIN items       USING (itemnumber)
122
LEFT JOIN biblioitems USING (biblioitemnumber)
122
LEFT JOIN biblioitems USING (biblioitemnumber)
Lines 261-266 sub CalcFine { Link Here
261
        # a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
261
        # a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
262
    }
262
    }
263
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
263
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
264
    $amount = $item->{replacementprice} if ( $data->{cap_fine_to_replacement_price} && $item->{replacementprice} && $amount > $item->{replacementprice} );
264
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
265
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
265
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
266
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
266
    # FIXME: chargename is NEVER populated anywhere.
267
    # FIXME: chargename is NEVER populated anywhere.
(-)a/Koha/Schema/Result/Issuingrule.pm (-2 / +10 lines)
Lines 166-171 __PACKAGE__->table("issuingrules"); Link Here
166
  is_nullable: 1
166
  is_nullable: 1
167
  size: [28,6]
167
  size: [28,6]
168
168
169
=head2 cap_fine_to_replacement_price
170
171
  data_type: 'tinyint'
172
  default_value: 0
173
  is_nullable: 0
174
169
=head2 onshelfholds
175
=head2 onshelfholds
170
176
171
  data_type: 'tinyint'
177
  data_type: 'tinyint'
Lines 237-242 __PACKAGE__->add_columns( Link Here
237
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
243
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
238
  "overduefinescap",
244
  "overduefinescap",
239
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
245
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
246
  "cap_fine_to_replacement_price",
247
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
240
  "onshelfholds",
248
  "onshelfholds",
241
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
249
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
242
  "opacitemholds",
250
  "opacitemholds",
Lines 260-267 __PACKAGE__->add_columns( Link Here
260
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
268
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
261
269
262
270
263
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-05-13 17:48:39
271
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-10-08 06:50:50
264
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:H6LuTmUWdqmjCc5L4hsTQA
272
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:70kyHQNhdQwxADNKEFs3UA
265
273
266
274
267
# You can replace this text with custom content, and it will be preserved on regeneration
275
# You can replace this text with custom content, and it will be preserved on regeneration
(-)a/admin/smart-rules.pl (-24 / +26 lines)
Lines 131-165 elsif ($op eq 'add') { Link Here
131
    my $rentaldiscount = $input->param('rentaldiscount');
131
    my $rentaldiscount = $input->param('rentaldiscount');
132
    my $opacitemholds = $input->param('opacitemholds') || 0;
132
    my $opacitemholds = $input->param('opacitemholds') || 0;
133
    my $overduefinescap = $input->param('overduefinescap') || undef;
133
    my $overduefinescap = $input->param('overduefinescap') || undef;
134
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty";
134
    my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on';
135
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";
135
136
136
    my $schema = Koha::Database->new()->schema();
137
    my $schema = Koha::Database->new()->schema();
137
    my $rs = $schema->resultset('Issuingrule');
138
    my $rs = $schema->resultset('Issuingrule');
138
139
139
    my $params = {
140
    my $params = {
140
        branchcode         => $br,
141
        branchcode                    => $br,
141
        categorycode       => $bor,
142
        categorycode                  => $bor,
142
        itemtype           => $itemtype,
143
        itemtype                      => $itemtype,
143
        fine               => $fine,
144
        fine                          => $fine,
144
        finedays           => $finedays,
145
        finedays                      => $finedays,
145
        maxsuspensiondays  => $maxsuspensiondays,
146
        maxsuspensiondays             => $maxsuspensiondays,
146
        firstremind        => $firstremind,
147
        firstremind                   => $firstremind,
147
        chargeperiod       => $chargeperiod,
148
        chargeperiod                  => $chargeperiod,
148
        maxissueqty        => $maxissueqty,
149
        maxissueqty                   => $maxissueqty,
149
        maxonsiteissueqty  => $maxonsiteissueqty,
150
        maxonsiteissueqty             => $maxonsiteissueqty,
150
        renewalsallowed    => $renewalsallowed,
151
        renewalsallowed               => $renewalsallowed,
151
        renewalperiod      => $renewalperiod,
152
        renewalperiod                 => $renewalperiod,
152
        norenewalbefore    => $norenewalbefore,
153
        norenewalbefore               => $norenewalbefore,
153
        auto_renew         => $auto_renew,
154
        auto_renew                    => $auto_renew,
154
        reservesallowed    => $reservesallowed,
155
        reservesallowed               => $reservesallowed,
155
        issuelength        => $issuelength,
156
        issuelength                   => $issuelength,
156
        lengthunit         => $lengthunit,
157
        lengthunit                    => $lengthunit,
157
        hardduedate        => $hardduedate,
158
        hardduedate                   => $hardduedate,
158
        hardduedatecompare => $hardduedatecompare,
159
        hardduedatecompare            => $hardduedatecompare,
159
        rentaldiscount     => $rentaldiscount,
160
        rentaldiscount                => $rentaldiscount,
160
        onshelfholds       => $onshelfholds,
161
        onshelfholds                  => $onshelfholds,
161
        opacitemholds      => $opacitemholds,
162
        opacitemholds                 => $opacitemholds,
162
        overduefinescap    => $overduefinescap,
163
        overduefinescap               => $overduefinescap,
164
        cap_fine_to_replacement_price => $cap_fine_to_replacement_price,
163
    };
165
    };
164
166
165
    $rs->update_or_create($params);
167
    $rs->update_or_create($params);
(-)a/installer/data/mysql/atomicupdate/bug_9192.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE issuingrules ADD cap_fine_to_replacement_price BOOLEAN NOT NULL DEFAULT  '0' AFTER overduefinescap
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1187-1192 CREATE TABLE `issuingrules` ( -- circulation and fine rules Link Here
1187
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1187
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1188
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1188
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1189
  overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
1189
  overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
1190
  cap_fine_to_replacement_price BOOLEAN NOT NULL DEFAULT  '0', -- cap the fine based on item's replacement price
1190
  onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
1191
  onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
1191
  opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold
1192
  opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold
1192
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
1193
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-34 / +55 lines)
Lines 16-21 function clear_edit(){ Link Here
16
            $(this).val("");
16
            $(this).val("");
17
            $(this).removeAttr("disabled");
17
            $(this).removeAttr("disabled");
18
        }
18
        }
19
        if ( type == "checkbox" ) {
20
            $(this).attr('checked', false);
21
        }
19
    });
22
    });
20
    $(edit_row).find("select").removeAttr("disabled");
23
    $(edit_row).find("select").removeAttr("disabled");
21
    $(edit_row).find("select option:first").attr("selected", "selected");
24
    $(edit_row).find("select option:first").attr("selected", "selected");
Lines 23-28 function clear_edit(){ Link Here
23
}
26
}
24
27
25
$(document).ready(function() {
28
$(document).ready(function() {
29
        $('#cap_fine_to_replacement_price').on('change', function(){
30
            $('#overduefinescap').prop('disabled', $(this).is(':checked') );
31
        });
26
        $('#selectlibrary').find("input:submit").hide();
32
        $('#selectlibrary').find("input:submit").hide();
27
        $('#branch').change(function() {
33
        $('#branch').change(function() {
28
                $('#selectlibrary').submit();
34
                $('#selectlibrary').submit();
Lines 38-44 $(document).ready(function() { Link Here
38
                itm = $(this).text();
44
                itm = $(this).text();
39
                itm = itm.replace(/^\s*|\s*$/g,'');
45
                itm = itm.replace(/^\s*|\s*$/g,'');
40
                var current_column = $("#edit_row td:eq("+i+")");
46
                var current_column = $("#edit_row td:eq("+i+")");
41
                if ( i != 6 ) {
47
                if ( i == 6 ) {
48
                    // specific processing for the Hard due date column
49
                    var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
50
                    var input_value = '';
51
                    if (typeof select_value === 'undefined'){
52
                        select_value = '-1';
53
                    }else {
54
                        input_value = itm.split(' ')[1];
55
                    }
56
                    $(current_column).find("input[type='text']").val(input_value);
57
                    $(current_column).find("select").val(select_value);
58
                } else if ( i == 11 ) {
59
                    // specific processing for cap_fine_to_replacement_price
60
                    var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
61
                    $('#cap_fine_to_replacement_price').attr('checked', cap_fine_to_replacement_price.is(':checked') );
62
                    $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
63
                } else {
42
                    $(current_column).find("input[type='text']").val(itm);
64
                    $(current_column).find("input[type='text']").val(itm);
43
                    // select the corresponding option
65
                    // select the corresponding option
44
                    $(current_column).find("select option").each(function(){
66
                    $(current_column).find("select option").each(function(){
Lines 66-82 $(document).ready(function() { Link Here
66
                            $(current_column).find("input[type='text']").val("");
88
                            $(current_column).find("input[type='text']").val("");
67
                        }
89
                        }
68
                    }
90
                    }
69
                } else {
70
                    // specific processing for the Hard due date column
71
                    var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
72
                    var input_value = '';
73
                    if (typeof select_value === 'undefined'){
74
                        select_value = '-1';
75
                    }else {
76
                        input_value = itm.split(' ')[1];
77
                    }
78
                    $(current_column).find("input[type='text']").val(input_value);
79
                    $(current_column).find("select").val(select_value);
80
                }
91
                }
81
            });
92
            });
82
            $("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled');
93
            $("#default-circulation-rules tr:last td:eq(0) select").attr('disabled', 'disabled');
Lines 150-155 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
150
                <th>Fine charging interval</th>
161
                <th>Fine charging interval</th>
151
                <th>Fine grace period</th>
162
                <th>Fine grace period</th>
152
                <th>Overdue fines cap (amount)</th>
163
                <th>Overdue fines cap (amount)</th>
164
                <th>Cap fine at replacement price</th>
153
                <th>Suspension in days (day)</th>
165
                <th>Suspension in days (day)</th>
154
                <th>Max. suspension duration (day)</th>
166
                <th>Max. suspension duration (day)</th>
155
                <th>Renewals allowed (count)</th>
167
                <th>Renewals allowed (count)</th>
Lines 214-219 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
214
							<td>[% rule.chargeperiod %]</td>
226
							<td>[% rule.chargeperiod %]</td>
215
							<td>[% rule.firstremind %]</td>
227
							<td>[% rule.firstremind %]</td>
216
                            <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
228
                            <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
229
                            <td>
230
                                [% IF rule.cap_fine_to_replacement_price %]
231
                                    <input type="checkbox" checked="checked" disabled="disabled" />
232
                                [% ELSE %]
233
                                    <input type="checkbox" disabled="disabled" />
234
                                [% END %]
235
                            </td>
217
							<td>[% rule.finedays %]</td>
236
							<td>[% rule.finedays %]</td>
218
                            <td>[% rule.maxsuspensiondays %]</td>
237
                            <td>[% rule.maxsuspensiondays %]</td>
219
							<td>[% rule.renewalsallowed %]</td>
238
							<td>[% rule.renewalsallowed %]</td>
Lines 275-280 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
275
                    <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
294
                    <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
276
                    <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
295
                    <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
277
                    <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
296
                    <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
297
                    <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
278
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
298
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
279
                    <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
299
                    <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
280
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
300
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
Lines 309-335 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
309
                </tr>
329
                </tr>
310
                <tfoot>
330
                <tfoot>
311
                    <tr>
331
                    <tr>
312
                      <th>Patron category</th>
332
                        <th>Patron category</th>
313
                      <th>Item type</th>
333
                        <th>Item type</th>
314
                      <th>Current checkouts allowed</th>
334
                        <th>Current checkouts allowed</th>
315
                      <th>Loan period</th>
335
                        <th>Current on-site checkouts allowed</th>
316
                      <th>Unit</th>
336
                        <th>Loan period</th>
317
                      <th>Hard due date</th>
337
                        <th>Unit</th>
318
                      <th>Fine amount</th>
338
                        <th>Hard due date</th>
319
                      <th>Fine charging interval</th>
339
                        <th>Fine amount</th>
320
                      <th>Fine grace period</th>
340
                        <th>Fine charging interval</th>
321
                      <th>Overdue fines cap (amount)</th>
341
                        <th>Fine grace period</th>
322
                      <th>Suspension in days (day)</th>
342
                        <th>Overdue fines cap (amount)</th>
323
                      <th>Max. suspension duration (day)</th>
343
                        <th>Cap fine at replacement price</th>
324
                      <th>Renewals allowed (count)</th>
344
                        <th>Suspension in days (day)</th>
325
                      <th>Renewal period</th>
345
                        <th>Max. suspension duration (day)</th>
326
                      <th>No renewal before</th>
346
                        <th>Renewals allowed (count)</th>
327
                      <th>Automatic renewal</th>
347
                        <th>Renewal period</th>
328
                      <th>Holds allowed (count)</th>
348
                        <th>No renewal before</th>
329
                      <th>On shelf holds allowed</th>
349
                        <th>Automatic renewal</th>
330
                      <th>Item level holds</th>
350
                        <th>Holds allowed (count)</th>
331
                      <th>Rental discount (%)</th>
351
                        <th>On shelf holds allowed</th>
332
                      <th colspan="2">&nbsp;</th>
352
                        <th>Item level holds</th>
353
                        <th>Rental discount (%)</th>
354
                        <th colspan="2">&nbsp;</th>
333
                    </tr>
355
                    </tr>
334
                  </tfoot>
356
                  </tfoot>
335
                </tbody>
357
                </tbody>
336
- 

Return to bug 9129