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

(-)a/C4/Circulation.pm (+35 lines)
Lines 3139-3144 sub CanBookBeRenewed { Link Here
3139
    my $auto_renew_code = $final_renewal ? 'auto_renew_final' : $final_unseen_renewal ? 'auto_unseen_final' : 'auto_renew';
3139
    my $auto_renew_code = $final_renewal ? 'auto_renew_final' : $final_unseen_renewal ? 'auto_unseen_final' : 'auto_renew';
3140
    return ( 1, $auto_renew_code ) if $auto_renew eq "ok" || $auto_renew eq "auto_too_soon" && !$override_limit;
3140
    return ( 1, $auto_renew_code ) if $auto_renew eq "ok" || $auto_renew eq "auto_too_soon" && !$override_limit;
3141
3141
3142
    if ( $item->itemlost ) {
3143
        my $branchcode = _GetCircControlBranch( $item, $patron );
3144
        my $renew_lost_allowed_rule = Koha::CirculationRules->get_effective_rule(
3145
            {
3146
                categorycode => $patron->categorycode,
3147
                itemtype     => undef,
3148
                branchcode   => $branchcode,
3149
                rule_name    => 'renew_lost_allowed',
3150
            }
3151
        );
3152
        return ( 0, "item_lost" ) unless $renew_lost_allowed_rule->rule_value;
3153
    }
3154
3142
    return ( 1, undef );
3155
    return ( 1, undef );
3143
}
3156
}
3144
3157
Lines 3260-3265 sub AddRenewal { Link Here
3260
            }
3273
            }
3261
        );
3274
        );
3262
3275
3276
        if ( $item_object->itemlost ) {
3277
            my $itemlost = 1;
3278
3279
            my $branchcode = _GetCircControlBranch( $item_object, $patron );
3280
            my $renew_lost_found_rule = Koha::CirculationRules->get_effective_rule(
3281
                {
3282
                    categorycode => $patron->categorycode,
3283
                    itemtype     => undef,
3284
                    branchcode   => $branchcode,
3285
                    rule_name    => 'renew_lost_found',
3286
                }
3287
            );
3288
3289
            if ( $renew_lost_found_rule->rule_value ) {
3290
                $itemlost = 0;
3291
                if ( C4::Context->preference('RefundLostItemFeeOnReturn') ) {
3292
                    _FixAccountForLostAndReturned( $item_object->id, undef, $item_object->barcode );
3293
                }
3294
            }
3295
            $item_object->itemlost($itemlost);
3296
        }
3297
3263
        # Increment the unseen renewals, if appropriate
3298
        # Increment the unseen renewals, if appropriate
3264
        # We only do so if the syspref is enabled and
3299
        # We only do so if the syspref is enabled and
3265
        # a maximum value has been set in the circ rules
3300
        # a maximum value has been set in the circ rules
(-)a/Koha/CirculationRules.pm (+6 lines)
Lines 65-70 our $RULE_KINDS = { Link Here
65
    max_holds => {
65
    max_holds => {
66
        scope => [ 'branchcode', 'categorycode' ],
66
        scope => [ 'branchcode', 'categorycode' ],
67
    },
67
    },
68
    renew_lost_allowed => {
69
        scope => [ 'branchcode', 'categorycode' ],
70
    },
71
    renew_lost_found => {
72
        scope => [ 'branchcode', 'categorycode' ],
73
    },
68
74
69
    holdallowed => {
75
    holdallowed => {
70
        scope => [ 'branchcode', 'itemtype' ],
76
        scope => [ 'branchcode', 'itemtype' ],
(-)a/admin/smart-rules.pl (-3 / +26 lines)
Lines 133-138 elsif ($op eq 'delete-branch-cat') { Link Here
133
                        max_holds                      => undef,
133
                        max_holds                      => undef,
134
                        patron_maxissueqty             => undef,
134
                        patron_maxissueqty             => undef,
135
                        patron_maxonsiteissueqty       => undef,
135
                        patron_maxonsiteissueqty       => undef,
136
                        renew_lost_allowed => undef,
137
                        renew_lost_found   => undef,
136
                    }
138
                    }
137
                }
139
                }
138
            );
140
            );
Lines 156-161 elsif ($op eq 'delete-branch-cat') { Link Here
156
                        max_holds                => undef,
158
                        max_holds                => undef,
157
                        patron_maxissueqty       => undef,
159
                        patron_maxissueqty       => undef,
158
                        patron_maxonsiteissueqty => undef,
160
                        patron_maxonsiteissueqty => undef,
161
                        renew_lost_allowed => undef,
162
                        renew_lost_found   => undef,
159
                    }
163
                    }
160
                }
164
                }
161
            );
165
            );
Lines 169-174 elsif ($op eq 'delete-branch-cat') { Link Here
169
                    max_holds                => undef,
173
                    max_holds                => undef,
170
                    patron_maxissueqty       => undef,
174
                    patron_maxissueqty       => undef,
171
                    patron_maxonsiteissueqty => undef,
175
                    patron_maxonsiteissueqty => undef,
176
                    renew_lost_allowed => undef,
177
                    renew_lost_found   => undef,
172
                }
178
                }
173
            }
179
            }
174
        );
180
        );
Lines 192-197 elsif ($op eq 'delete-branch-cat') { Link Here
192
                    max_holds         => undef,
198
                    max_holds         => undef,
193
                    patron_maxissueqty       => undef,
199
                    patron_maxissueqty       => undef,
194
                    patron_maxonsiteissueqty => undef,
200
                    patron_maxonsiteissueqty => undef,
201
                    renew_lost_allowed => undef,
202
                    renew_lost_found   => undef,
195
                }
203
                }
196
            }
204
            }
197
        );
205
        );
Lines 365-370 elsif ($op eq "set-branch-defaults") { Link Here
365
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
373
    my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
366
    my $returnbranch  = $input->param('returnbranch');
374
    my $returnbranch  = $input->param('returnbranch');
367
    my $max_holds = strip_non_numeric( scalar $input->param('max_holds') );
375
    my $max_holds = strip_non_numeric( scalar $input->param('max_holds') );
376
    my $renew_lost_allowed = $input->param('renew_lost_allowed');
377
    my $renew_lost_found   = $input->param('renew_lost_found');
368
378
369
    if ($branch eq "*") {
379
    if ($branch eq "*") {
370
        Koha::CirculationRules->set_rules(
380
        Koha::CirculationRules->set_rules(
Lines 411-422 elsif ($op eq "set-branch-defaults") { Link Here
411
            }
421
            }
412
        );
422
        );
413
    }
423
    }
414
    Koha::CirculationRules->set_rule(
424
    Koha::CirculationRules->set_rules(
415
        {
425
        {
416
            branchcode   => $branch,
426
            branchcode   => $branch,
417
            categorycode => undef,
427
            categorycode => undef,
418
            rule_name    => 'max_holds',
428
            rules        => {
419
            rule_value   => $max_holds,
429
                max_holds          => $max_holds,
430
                renew_lost_allowed => $renew_lost_allowed,
431
                renew_lost_found   => $renew_lost_found,
432
            },
420
        }
433
        }
421
    );
434
    );
422
}
435
}
Lines 427-432 elsif ($op eq "add-branch-cat") { Link Here
427
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
440
    $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
428
    my $max_holds = $input->param('max_holds');
441
    my $max_holds = $input->param('max_holds');
429
    $max_holds = strip_non_numeric($max_holds);
442
    $max_holds = strip_non_numeric($max_holds);
443
    my $renew_lost_allowed = $input->param('renew_lost_allowed');
444
    my $renew_lost_found   = $input->param('renew_lost_found');
430
445
431
    if ($branch eq "*") {
446
    if ($branch eq "*") {
432
        if ($categorycode eq "*") {
447
        if ($categorycode eq "*") {
Lines 438-443 elsif ($op eq "add-branch-cat") { Link Here
438
                        max_holds         => $max_holds,
453
                        max_holds         => $max_holds,
439
                        patron_maxissueqty       => $patron_maxissueqty,
454
                        patron_maxissueqty       => $patron_maxissueqty,
440
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
455
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
456
                        renew_lost_allowed => $renew_lost_allowed,
457
                        renew_lost_found   => $renew_lost_found,
441
                    }
458
                    }
442
                }
459
                }
443
            );
460
            );
Lines 450-455 elsif ($op eq "add-branch-cat") { Link Here
450
                        max_holds         => $max_holds,
467
                        max_holds         => $max_holds,
451
                        patron_maxissueqty       => $patron_maxissueqty,
468
                        patron_maxissueqty       => $patron_maxissueqty,
452
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
469
                        patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
470
                        renew_lost_allowed => $renew_lost_allowed,
471
                        renew_lost_found   => $renew_lost_found,
453
                    }
472
                    }
454
                }
473
                }
455
            );
474
            );
Lines 463-468 elsif ($op eq "add-branch-cat") { Link Here
463
                    max_holds         => $max_holds,
482
                    max_holds         => $max_holds,
464
                    patron_maxissueqty       => $patron_maxissueqty,
483
                    patron_maxissueqty       => $patron_maxissueqty,
465
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
484
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
485
                    renew_lost_allowed => $renew_lost_allowed,
486
                    renew_lost_found   => $renew_lost_found,
466
                }
487
                }
467
            }
488
            }
468
        );
489
        );
Lines 475-480 elsif ($op eq "add-branch-cat") { Link Here
475
                    max_holds         => $max_holds,
496
                    max_holds         => $max_holds,
476
                    patron_maxissueqty       => $patron_maxissueqty,
497
                    patron_maxissueqty       => $patron_maxissueqty,
477
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
498
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
499
                    renew_lost_allowed => $renew_lost_allowed,
500
                    renew_lost_found   => $renew_lost_found,
478
                }
501
                }
479
            }
502
            }
480
        );
503
        );
(-)a/installer/data/mysql/atomicupdate/bug_9805_-_add_renew_lost_circ_rules.pl (+22 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "9805",
5
    description => "Lost items are un-lost if returned, but not if renewed",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{ INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value) VALUES (NULL, NULL, NULL, 'renew_lost_allowed', 1) }
12
        );
13
14
        say $out "Added default checkout, hold and return policy renew_lost_allowed";
15
16
        $dbh->do(
17
            q{ INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value) VALUES (NULL, NULL, NULL, 'renew_lost_found', 0) }
18
        );
19
20
        say $out "Added default checkout, hold and return policy renew_lost_found";
21
    },
22
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (+38 lines)
Lines 632-637 Link Here
632
                                <th>Hold policy</th>
632
                                <th>Hold policy</th>
633
                                <th>Hold pickup library match</th>
633
                                <th>Hold pickup library match</th>
634
                                <th>Return policy</th>
634
                                <th>Return policy</th>
635
                                <th>Renew lost?</th>
636
                                <th>Renewal marks lost found</th>
635
                                <th class="noExport">Actions</th>
637
                                <th class="noExport">Actions</th>
636
                            </tr>
638
                            </tr>
637
                            [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
639
                            [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %]
Lines 794-799 Link Here
794
                                        </option>
796
                                        </option>
795
                                    </select>
797
                                    </select>
796
                                </td>
798
                                </td>
799
                                <td>
800
                                    <select name="renew_lost_allowed">
801
                                        [% IF ( default_renew_lost_allowed == '1' ) %]
802
                                        <option value="1" selected="selected">
803
                                        [% ELSE %]
804
                                        <option value="1">
805
                                        [% END %]
806
                                        Allow renewal
807
                                        </option>
808
                                        [% IF ( default_renew_lost_allowed == '0' ) %]
809
                                        <option value="0" selected="selected">
810
                                        [% ELSE %]
811
                                        <option value="0">
812
                                        [% END %]
813
                                        Disallow renewal
814
                                        </option>
815
                                    </select>
816
                                </td>
817
                                <td>
818
                                    <select name="renew_lost_found">
819
                                        [% IF ( default_renew_lost_found == '1' ) %]
820
                                        <option value="1" selected="selected">
821
                                        [% ELSE %]
822
                                        <option value="1">
823
                                        [% END %]
824
                                        marks item found
825
                                        </option>
826
                                        [% IF ( default_renew_lost_found == '0' ) %]
827
                                        <option value="0" selected="selected">
828
                                        [% ELSE %]
829
                                        <option value="0">
830
                                        [% END %]
831
                                        makes no change
832
                                        </option>
833
                                    </select>
834
                                </td>
797
                                <td class="actions">
835
                                <td class="actions">
798
                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
836
                                    <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
799
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
837
                                    [% IF ( default_checkout_hold_and_return_policy ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (+4 lines)
Lines 169-174 Link Here
169
                            [% ELSIF error == 'recalled' %]
169
                            [% ELSIF error == 'recalled' %]
170
                                <p>This item has been recalled.</p>
170
                                <p>This item has been recalled.</p>
171
171
172
                            [% ELSIF error == "item_lost" %]
173
174
                                <p>This item is lost.</p>
175
172
                            [% ELSE %]
176
                            [% ELSE %]
173
177
174
                                [% error | html %]
178
                                [% error | html %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-1 / +2 lines)
Lines 463-468 Link Here
463
                                                            )</span>
463
                                                            )</span>
464
                                                        [% ELSIF ( ISSUE.on_reserve ) %]
464
                                                        [% ELSIF ( ISSUE.on_reserve ) %]
465
                                                            <span class="usr-msg no-renew-hold">Not renewable <span class="renewals">(on hold)</span></span>
465
                                                            <span class="usr-msg no-renew-hold">Not renewable <span class="renewals">(on hold)</span></span>
466
                                                        [% ELSIF ( ISSUE.item_lost ) %]
467
                                                            <span class="usr-msg no-renew-hold">Not renewable <span class="renewals">(item is lost)</span></span>
466
                                                        [% ELSIF ( ISSUE.too_many ) %]
468
                                                        [% ELSIF ( ISSUE.too_many ) %]
467
                                                            <span class="usr-msg no-renew-too-many">Not renewable</span>
469
                                                            <span class="usr-msg no-renew-too-many">Not renewable</span>
468
                                                        [% ELSIF ( ISSUE.too_unseen ) %]
470
                                                        [% ELSIF ( ISSUE.too_unseen ) %]
469
- 

Return to bug 9805