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

(-)a/C4/Overdues.pm (-2 / +3 lines)
Lines 112-125 sub Getoverdues { Link Here
112
    my $statement;
112
    my $statement;
113
    if ( C4::Context->preference('item-level_itypes') ) {
113
    if ( C4::Context->preference('item-level_itypes') ) {
114
        $statement = "
114
        $statement = "
115
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost
115
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice
116
     FROM issues 
116
     FROM issues 
117
LEFT JOIN items       USING (itemnumber)
117
LEFT JOIN items       USING (itemnumber)
118
    WHERE date_due < NOW()
118
    WHERE date_due < NOW()
119
";
119
";
120
    } else {
120
    } else {
121
        $statement = "
121
        $statement = "
122
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost
122
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice
123
     FROM issues 
123
     FROM issues 
124
LEFT JOIN items       USING (itemnumber)
124
LEFT JOIN items       USING (itemnumber)
125
LEFT JOIN biblioitems USING (biblioitemnumber)
125
LEFT JOIN biblioitems USING (biblioitemnumber)
Lines 264-269 sub CalcFine { Link Here
264
    } # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. }
264
    } # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. }
265
265
266
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
266
    $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
267
    $amount = $item->{replacementprice} if ( $data->{cap_fine_to_replacement_price} && $item->{replacementprice} && $amount > $item->{replacementprice} );
267
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
268
    $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
268
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
269
    return ($amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
269
    # FIXME: chargename is NEVER populated anywhere.
270
    # FIXME: chargename is NEVER populated anywhere.
(-)a/Koha/Schema/Result/Issuingrule.pm (-2 / +10 lines)
Lines 172-177 __PACKAGE__->table("issuingrules"); Link Here
172
  is_nullable: 1
172
  is_nullable: 1
173
  size: [28,6]
173
  size: [28,6]
174
174
175
=head2 cap_fine_to_replacement_price
176
177
  data_type: 'tinyint'
178
  default_value: 0
179
  is_nullable: 0
180
175
=head2 onshelfholds
181
=head2 onshelfholds
176
182
177
  data_type: 'tinyint'
183
  data_type: 'tinyint'
Lines 245-250 __PACKAGE__->add_columns( Link Here
245
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
251
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
246
  "overduefinescap",
252
  "overduefinescap",
247
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
253
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
254
  "cap_fine_to_replacement_price",
255
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
248
  "onshelfholds",
256
  "onshelfholds",
249
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
257
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
250
  "opacitemholds",
258
  "opacitemholds",
Lines 268-275 __PACKAGE__->add_columns( Link Here
268
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
276
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
269
277
270
278
271
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-05-13 17:48:39
279
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-10-08 06:50:50
272
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:H6LuTmUWdqmjCc5L4hsTQA
280
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:70kyHQNhdQwxADNKEFs3UA
273
281
274
282
275
# You can replace this text with custom content, and it will be preserved on regeneration
283
# You can replace this text with custom content, and it will be preserved on regeneration
(-)a/admin/smart-rules.pl (-25 / +27 lines)
Lines 132-167 elsif ($op eq 'add') { Link Here
132
    my $rentaldiscount = $input->param('rentaldiscount');
132
    my $rentaldiscount = $input->param('rentaldiscount');
133
    my $opacitemholds = $input->param('opacitemholds') || 0;
133
    my $opacitemholds = $input->param('opacitemholds') || 0;
134
    my $overduefinescap = $input->param('overduefinescap') || undef;
134
    my $overduefinescap = $input->param('overduefinescap') || undef;
135
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty";
135
    my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on';
136
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";
136
137
137
    my $schema = Koha::Database->new()->schema();
138
    my $schema = Koha::Database->new()->schema();
138
    my $rs = $schema->resultset('Issuingrule');
139
    my $rs = $schema->resultset('Issuingrule');
139
140
140
    my $params = {
141
    my $params = {
141
        branchcode             => $br,
142
        branchcode                    => $br,
142
        categorycode           => $bor,
143
        categorycode                  => $bor,
143
        itemtype               => $itemtype,
144
        itemtype                      => $itemtype,
144
        fine                   => $fine,
145
        fine                          => $fine,
145
        finedays               => $finedays,
146
        finedays                      => $finedays,
146
        maxsuspensiondays      => $maxsuspensiondays,
147
        maxsuspensiondays             => $maxsuspensiondays,
147
        firstremind            => $firstremind,
148
        firstremind                   => $firstremind,
148
        chargeperiod           => $chargeperiod,
149
        chargeperiod                  => $chargeperiod,
149
        chargeperiod_charge_at => $chargeperiod_charge_at,
150
        chargeperiod_charge_at        => $chargeperiod_charge_at,
150
        maxissueqty            => $maxissueqty,
151
        maxissueqty                   => $maxissueqty,
151
        maxonsiteissueqty      => $maxonsiteissueqty,
152
        maxonsiteissueqty             => $maxonsiteissueqty,
152
        renewalsallowed        => $renewalsallowed,
153
        renewalsallowed               => $renewalsallowed,
153
        renewalperiod          => $renewalperiod,
154
        renewalperiod                 => $renewalperiod,
154
        norenewalbefore        => $norenewalbefore,
155
        norenewalbefore               => $norenewalbefore,
155
        auto_renew             => $auto_renew,
156
        auto_renew                    => $auto_renew,
156
        reservesallowed        => $reservesallowed,
157
        reservesallowed               => $reservesallowed,
157
        issuelength            => $issuelength,
158
        issuelength                   => $issuelength,
158
        lengthunit             => $lengthunit,
159
        lengthunit                    => $lengthunit,
159
        hardduedate            => $hardduedate,
160
        hardduedate                   => $hardduedate,
160
        hardduedatecompare     => $hardduedatecompare,
161
        hardduedatecompare            => $hardduedatecompare,
161
        rentaldiscount         => $rentaldiscount,
162
        rentaldiscount                => $rentaldiscount,
162
        onshelfholds           => $onshelfholds,
163
        onshelfholds                  => $onshelfholds,
163
        opacitemholds          => $opacitemholds,
164
        opacitemholds                 => $opacitemholds,
164
        overduefinescap        => $overduefinescap,
165
        overduefinescap               => $overduefinescap,
166
        cap_fine_to_replacement_price => $cap_fine_to_replacement_price,
165
    };
167
    };
166
168
167
    $rs->update_or_create($params);
169
    $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 1188-1193 CREATE TABLE `issuingrules` ( -- circulation and fine rules Link Here
1188
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1188
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1189
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1189
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1190
  overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
1190
  overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
1191
  cap_fine_to_replacement_price BOOLEAN NOT NULL DEFAULT  '0', -- cap the fine based on item's replacement price
1191
  onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
1192
  onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
1192
  opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold
1193
  opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold
1193
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
1194
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-13 / +33 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 == 12 ) {
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 151-156 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
151
                <th>Charge when?</th>
162
                <th>Charge when?</th>
152
                <th>Fine grace period</th>
163
                <th>Fine grace period</th>
153
                <th>Overdue fines cap (amount)</th>
164
                <th>Overdue fines cap (amount)</th>
165
                <th>Cap fine at replacement price</th>
154
                <th>Suspension in days (day)</th>
166
                <th>Suspension in days (day)</th>
155
                <th>Max. suspension duration (day)</th>
167
                <th>Max. suspension duration (day)</th>
156
                <th>Renewals allowed (count)</th>
168
                <th>Renewals allowed (count)</th>
Lines 216-221 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
216
                <td>[% IF rule.chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
228
                <td>[% IF rule.chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td>
217
							<td>[% rule.firstremind %]</td>
229
							<td>[% rule.firstremind %]</td>
218
                            <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
230
                            <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
231
                            <td>
232
                                [% IF rule.cap_fine_to_replacement_price %]
233
                                    <input type="checkbox" checked="checked" disabled="disabled" />
234
                                [% ELSE %]
235
                                    <input type="checkbox" disabled="disabled" />
236
                                [% END %]
237
                            </td>
219
							<td>[% rule.finedays %]</td>
238
							<td>[% rule.finedays %]</td>
220
                            <td>[% rule.maxsuspensiondays %]</td>
239
                            <td>[% rule.maxsuspensiondays %]</td>
221
							<td>[% rule.renewalsallowed %]</td>
240
							<td>[% rule.renewalsallowed %]</td>
Lines 283-288 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
283
                    </td>
302
                    </td>
284
                    <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
303
                    <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
285
                    <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
304
                    <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
305
                    <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
286
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
306
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
287
                    <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
307
                    <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
288
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
308
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
Lines 329-334 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
329
                      <th>Charge when?</th>
349
                      <th>Charge when?</th>
330
                      <th>Fine grace period</th>
350
                      <th>Fine grace period</th>
331
                      <th>Overdue fines cap (amount)</th>
351
                      <th>Overdue fines cap (amount)</th>
352
                      <th>Cap fine at replacement price</th>
332
                      <th>Suspension in days (day)</th>
353
                      <th>Suspension in days (day)</th>
333
                      <th>Max. suspension duration (day)</th>
354
                      <th>Max. suspension duration (day)</th>
334
                      <th>Renewals allowed (count)</th>
355
                      <th>Renewals allowed (count)</th>
335
- 

Return to bug 9129