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 161-166 __PACKAGE__->table("issuingrules"); Link Here
161
  is_nullable: 1
161
  is_nullable: 1
162
  size: [28,6]
162
  size: [28,6]
163
163
164
=head2 cap_fine_to_replacement_price
165
166
  data_type: 'tinyint'
167
  default_value: 0
168
  is_nullable: 0
169
164
=head2 onshelfholds
170
=head2 onshelfholds
165
171
166
  data_type: 'tinyint'
172
  data_type: 'tinyint'
Lines 230-235 __PACKAGE__->add_columns( Link Here
230
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
236
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
231
  "overduefinescap",
237
  "overduefinescap",
232
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
238
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
239
  "cap_fine_to_replacement_price",
240
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
233
  "onshelfholds",
241
  "onshelfholds",
234
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
242
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
235
  "opacitemholds",
243
  "opacitemholds",
Lines 253-260 __PACKAGE__->add_columns( Link Here
253
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
261
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
254
262
255
263
256
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2014-12-19 07:00:40
264
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-10-08 06:50:50
257
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CE8yuYC5QgPHI2GOjiT28w
265
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:70kyHQNhdQwxADNKEFs3UA
258
266
259
267
260
# You can replace this text with custom content, and it will be preserved on regeneration
268
# You can replace this text with custom content, and it will be preserved on regeneration
(-)a/admin/smart-rules.pl (-22 / +24 lines)
Lines 128-161 elsif ($op eq 'add') { Link Here
128
    my $rentaldiscount = $input->param('rentaldiscount');
128
    my $rentaldiscount = $input->param('rentaldiscount');
129
    my $opacitemholds = $input->param('opacitemholds') || 0;
129
    my $opacitemholds = $input->param('opacitemholds') || 0;
130
    my $overduefinescap = $input->param('overduefinescap') || undef;
130
    my $overduefinescap = $input->param('overduefinescap') || undef;
131
    my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on';
131
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty";
132
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty";
132
133
133
    my $schema = Koha::Database->new()->schema();
134
    my $schema = Koha::Database->new()->schema();
134
    my $rs = $schema->resultset('Issuingrule');
135
    my $rs = $schema->resultset('Issuingrule');
135
136
136
    my $params = {
137
    my $params = {
137
        branchcode         => $br,
138
        branchcode                    => $br,
138
        categorycode       => $bor,
139
        categorycode                  => $bor,
139
        itemtype           => $itemtype,
140
        itemtype                      => $itemtype,
140
        fine               => $fine,
141
        fine                          => $fine,
141
        finedays           => $finedays,
142
        finedays                      => $finedays,
142
        maxsuspensiondays  => $maxsuspensiondays,
143
        maxsuspensiondays             => $maxsuspensiondays,
143
        firstremind        => $firstremind,
144
        firstremind                   => $firstremind,
144
        chargeperiod       => $chargeperiod,
145
        chargeperiod                  => $chargeperiod,
145
        maxissueqty        => $maxissueqty,
146
        maxissueqty                   => $maxissueqty,
146
        renewalsallowed    => $renewalsallowed,
147
        renewalsallowed               => $renewalsallowed,
147
        renewalperiod      => $renewalperiod,
148
        renewalperiod                 => $renewalperiod,
148
        norenewalbefore    => $norenewalbefore,
149
        norenewalbefore               => $norenewalbefore,
149
        auto_renew         => $auto_renew,
150
        auto_renew                    => $auto_renew,
150
        reservesallowed    => $reservesallowed,
151
        reservesallowed               => $reservesallowed,
151
        issuelength        => $issuelength,
152
        issuelength                   => $issuelength,
152
        lengthunit         => $lengthunit,
153
        lengthunit                    => $lengthunit,
153
        hardduedate        => $hardduedate,
154
        hardduedate                   => $hardduedate,
154
        hardduedatecompare => $hardduedatecompare,
155
        hardduedatecompare            => $hardduedatecompare,
155
        rentaldiscount     => $rentaldiscount,
156
        rentaldiscount                => $rentaldiscount,
156
        onshelfholds       => $onshelfholds,
157
        onshelfholds                  => $onshelfholds,
157
        opacitemholds      => $opacitemholds,
158
        opacitemholds                 => $opacitemholds,
158
        overduefinescap    => $overduefinescap,
159
        overduefinescap               => $overduefinescap,
160
        cap_fine_to_replacement_price => $cap_fine_to_replacement_price,
159
    };
161
    };
160
162
161
    $rs->update_or_create($params);
163
    $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 1182-1187 CREATE TABLE `issuingrules` ( -- circulation and fine rules Link Here
1182
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1182
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1183
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1183
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1184
  overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
1184
  overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine
1185
  cap_fine_to_replacement_price BOOLEAN NOT NULL DEFAULT  '0', -- cap the fine based on item's replacement price
1185
  onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
1186
  onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf
1186
  opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold
1187
  opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold
1187
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
1188
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-13 / +32 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 != 5 ) {
47
                if ( i == 5 ) {
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 == 10 ) {
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 149-154 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
149
                <th>Fine charging interval</th>
160
                <th>Fine charging interval</th>
150
                <th>Fine grace period (day)</th>
161
                <th>Fine grace period (day)</th>
151
                <th>Overdue fines cap (amount)</th>
162
                <th>Overdue fines cap (amount)</th>
163
                <th>Cap fine at replacement price</th>
152
                <th>Suspension in days (day)</th>
164
                <th>Suspension in days (day)</th>
153
                <th>Max. suspension duration (day)</th>
165
                <th>Max. suspension duration (day)</th>
154
                <th>Renewals allowed (count)</th>
166
                <th>Renewals allowed (count)</th>
Lines 207-212 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
207
							<td>[% rule.chargeperiod %]</td>
219
							<td>[% rule.chargeperiod %]</td>
208
							<td>[% rule.firstremind %]</td>
220
							<td>[% rule.firstremind %]</td>
209
                            <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
221
                            <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
222
                            <td>
223
                                [% IF rule.cap_fine_to_replacement_price %]
224
                                    <input type="checkbox" checked="checked" disabled="disabled" />
225
                                [% ELSE %]
226
                                    <input type="checkbox" disabled="disabled" />
227
                                [% END %]
228
                            </td>
210
							<td>[% rule.finedays %]</td>
229
							<td>[% rule.finedays %]</td>
211
                            <td>[% rule.maxsuspensiondays %]</td>
230
                            <td>[% rule.maxsuspensiondays %]</td>
212
							<td>[% rule.renewalsallowed %]</td>
231
							<td>[% rule.renewalsallowed %]</td>
Lines 267-272 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
267
                    <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
286
                    <td><input type="text" name="chargeperiod" id="chargeperiod" size="2" /></td>
268
                    <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
287
                    <td><input type="text" name="firstremind" id="firstremind" size="2" /> </td>
269
                    <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
288
                    <td><input type="text" name="overduefinescap" id="overduefinescap" size="6" /> </td>
289
                    <td><input type="checkbox" name="cap_fine_to_replacement_price" id="cap_fine_to_replacement_price" /></td>
270
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
290
                    <td><input type="text" name="finedays" id="fined" size="3" /> </td>
271
                    <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
291
                    <td><input type="text" name="maxsuspensiondays" id="maxsuspensiondays" size="3" /> </td>
272
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
292
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
273
- 

Return to bug 9129