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

(-)a/C4/Circulation.pm (+16 lines)
Lines 1045-1050 sub CanBookBeIssued { Link Here
1045
                };
1045
                };
1046
            }
1046
            }
1047
        }
1047
        }
1048
1049
        # Decrease loan period for item if rule exist in smart-rules.pl
1050
        # Overrides decreaseLoanHighHoldsValue syspref
1051
        my $branch = _GetCircControlBranch($item,$borrower);
1052
        my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branch);
1053
        my $issuedate = DateTime->now( time_zone => C4::Context->tz() );
1054
        my $calendar = Koha::Calendar->new( branchcode => $branch );
1055
        my $reduced_datedue = $calendar->addDate( $issuedate, $issuingrule->{decreaseloanholds} );
1056
1057
        if ( defined($issuingrule->{decreaseloanholds}) ) {
1058
            $needsconfirmation{HIGHHOLDS} = {
1059
                num_holds  => $num,
1060
                duration   => $issuingrule->{decreaseloanholds},
1061
                returndate => output_pref($reduced_datedue),
1062
            }
1063
        }
1048
    }
1064
    }
1049
1065
1050
    if (
1066
    if (
(-)a/admin/smart-rules.pl (+2 lines)
Lines 160-165 elsif ($op eq 'add') { Link Here
160
    my $article_requests = $input->param('article_requests') || 'no';
160
    my $article_requests = $input->param('article_requests') || 'no';
161
    my $overduefinescap = $input->param('overduefinescap') || undef;
161
    my $overduefinescap = $input->param('overduefinescap') || undef;
162
    my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on';
162
    my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on';
163
    my $decreaseloanholds = $input->param('decreaseloanholds');
163
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";
164
    $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";
164
165
165
    my $params = {
166
    my $params = {
Lines 193-198 elsif ($op eq 'add') { Link Here
193
        overduefinescap               => $overduefinescap,
194
        overduefinescap               => $overduefinescap,
194
        cap_fine_to_replacement_price => $cap_fine_to_replacement_price,
195
        cap_fine_to_replacement_price => $cap_fine_to_replacement_price,
195
        article_requests              => $article_requests,
196
        article_requests              => $article_requests,
197
        decreaseloanholds             => $decreaseloanholds,
196
    };
198
    };
197
199
198
    my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br});
200
    my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br});
(-)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 / +4 lines)
Lines 91-96 Link Here
91
                <th>On shelf holds allowed</th>
91
                <th>On shelf holds allowed</th>
92
                <th>Item level holds</th>
92
                <th>Item level holds</th>
93
                <th>Article requests</th>
93
                <th>Article requests</th>
94
                <th>Decrease loan holds (day)</th>
94
                <th>Rental discount (%)</th>
95
                <th>Rental discount (%)</th>
95
                <th>Actions</th>
96
                <th>Actions</th>
96
            </tr>
97
            </tr>
Lines 200-205 Link Here
200
                                                                <span>Don't allow</span>
201
                                                                <span>Don't allow</span>
201
                                                            [% END %]
202
                                                            [% END %]
202
                                                        </td>
203
                                                        </td>
204
                                                        <td>[% rule.decreaseloanholds %]</td>
203
                                                        <td>
205
                                                        <td>
204
                                                            [% IF rule.article_requests == 'no' %]
206
                                                            [% IF rule.article_requests == 'no' %]
205
                                                                <span>No</span>
207
                                                                <span>No</span>
Lines 216-222 Link Here
216
                                                          <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
218
                                                          <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
217
                                                          <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a>
219
                                                          <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&amp;itemtype=[% rule.itemtype %]&amp;categorycode=[% rule.categorycode %]&amp;branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a>
218
                                                        </td>
220
                                                        </td>
219
220
                	</tr>
221
                	</tr>
221
            	[% END %]
222
            	[% END %]
222
                <tr id="edit_row">
223
                <tr id="edit_row">
Lines 311-316 Link Here
311
                            <option value="item_only">Item only</option>
312
                            <option value="item_only">Item only</option>
312
                        </select>
313
                        </select>
313
                    </td>
314
                    </td>
315
                    <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2"/></td>
314
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
316
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
315
                    <td class="actions">
317
                    <td class="actions">
316
                        <input type="hidden" name="branch" value="[% current_branch %]"/>
318
                        <input type="hidden" name="branch" value="[% current_branch %]"/>
Lines 348-353 Link Here
348
                      <th>On shelf holds allowed</th>
350
                      <th>On shelf holds allowed</th>
349
                      <th>Item level holds</th>
351
                      <th>Item level holds</th>
350
                      <th>Article requests</th>
352
                      <th>Article requests</th>
353
                      <th>Decrease loan holds (day)</th>
351
                      <th>Rental discount (%)</th>
354
                      <th>Rental discount (%)</th>
352
                      <th>&nbsp;</th>
355
                      <th>&nbsp;</th>
353
                    </tr>
356
                    </tr>
354
- 

Return to bug 14866