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

(-)a/C4/Circulation.pm (+16 lines)
Lines 1021-1026 sub CanBookBeIssued { Link Here
1021
                returndate => output_pref($returndate),
1021
                returndate => output_pref($returndate),
1022
            };
1022
            };
1023
        }
1023
        }
1024
1025
        # Decrease loan period for item if rule exist in smart-rules.pl
1026
        # Overrides decreaseLoanHighHoldsValue syspref
1027
        my $branch = _GetCircControlBranch($item,$borrower);
1028
        my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branch);
1029
        my $issuedate = DateTime->now( time_zone => C4::Context->tz() );
1030
        my $calendar = Koha::Calendar->new( branchcode => $branch );
1031
        my $reduced_datedue = $calendar->addDate( $issuedate, $issuingrule->{decreaseloanholds} );
1032
1033
        if ( defined($issuingrule->{decreaseloanholds}) ) {
1034
            $needsconfirmation{HIGHHOLDS} = {
1035
                num_holds  => $num,
1036
                duration   => $issuingrule->{decreaseloanholds},
1037
                returndate => output_pref($reduced_datedue),
1038
            }
1039
        }
1024
    }
1040
    }
1025
1041
1026
    if (
1042
    if (
(-)a/admin/smart-rules.pl (+2 lines)
Lines 128-133 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 $decreaseloanholds = $input->param('decreaseloanholds');
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();
Lines 156-161 elsif ($op eq 'add') { Link Here
156
        onshelfholds       => $onshelfholds,
157
        onshelfholds       => $onshelfholds,
157
        opacitemholds      => $opacitemholds,
158
        opacitemholds      => $opacitemholds,
158
        overduefinescap    => $overduefinescap,
159
        overduefinescap    => $overduefinescap,
160
        decreaseloanholds  => $decreaseloanholds,
159
    };
161
    };
160
162
161
    $rs->update_or_create($params);
163
    $rs->update_or_create($params);
(-)a/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE issuingrules ADD decreaseloanholds INTEGER;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-2 / +5 lines)
Lines 158-163 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
158
                <th>Holds allowed (count)</th>
158
                <th>Holds allowed (count)</th>
159
                <th>On shelf holds allowed</th>
159
                <th>On shelf holds allowed</th>
160
                <th>Item level holds</th>
160
                <th>Item level holds</th>
161
                <th>Decrease loan holds (day)</th>
161
                <th>Rental discount (%)</th>
162
                <th>Rental discount (%)</th>
162
                <th colspan="2">&nbsp;</th>
163
                <th colspan="2">&nbsp;</th>
163
            </tr>
164
            </tr>
Lines 222-228 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
222
							<td>[% rule.reservesallowed %]</td>
223
							<td>[% rule.reservesallowed %]</td>
223
                                                        <td>[% IF rule.onshelfholds %]Yes[% ELSE %]No[% END %]</td>
224
                                                        <td>[% IF rule.onshelfholds %]Yes[% ELSE %]No[% END %]</td>
224
                                                        <td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td>
225
                                                        <td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td>
225
							<td>[% rule.rentaldiscount %]</td>
226
			    <td>[% rule.decreaseloanholds %]</td>				
227
                            <td>[% rule.rentaldiscount %]</td>
226
                            <td><a href="#" class="editrule">Edit</a></td>
228
                            <td><a href="#" class="editrule">Edit</a></td>
227
							<td>
229
							<td>
228
								<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]">Delete</a>
230
								<a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]">Delete</a>
Lines 292-297 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
292
                            <option value="F">Force</option>
294
                            <option value="F">Force</option>
293
                        </select>
295
                        </select>
294
                    </td>
296
                    </td>
297
                    <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2"/></td>
295
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
298
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
296
                    <td colspan="2">
299
                    <td colspan="2">
297
                        <input type="hidden" name="branch" value="[% current_branch %]"/>
300
                        <input type="hidden" name="branch" value="[% current_branch %]"/>
Lines 320-325 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
320
                      <th>Holds allowed (count)</th>
323
                      <th>Holds allowed (count)</th>
321
                      <th>On shelf holds allowed</th>
324
                      <th>On shelf holds allowed</th>
322
                      <th>Item level holds</th>
325
                      <th>Item level holds</th>
326
                      <th>Decrease loan holds (day)</th>
323
                      <th>Rental discount (%)</th>
327
                      <th>Rental discount (%)</th>
324
                      <th colspan="2">&nbsp;</th>
328
                      <th colspan="2">&nbsp;</th>
325
                    </tr>
329
                    </tr>
326
- 

Return to bug 14866