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

(-)a/C4/Circulation.pm (+50 lines)
Lines 2248-2253 sub AddReturn { Link Here
2248
        }
2248
        }
2249
    }
2249
    }
2250
2250
2251
if (C4::Context->preference('ClaimReturnedLostValue')) {
2252
    my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin');
2253
2254
    my $claims = Koha::Checkouts::ReturnClaims->search(
2255
        {
2256
            itemnumber => $item->id,
2257
            resolution => undef,
2258
        }
2259
    );
2260
2261
    if ($claims->count) {
2262
        if ($autoClaimReturnCheckin) {
2263
            my $claim = $claims->next;
2264
2265
            my $patron_id = $patron->borrowernumber;
2266
            my $resolution = $autoClaimReturnCheckin; # Use the preference value as the resolution
2267
2268
            $claim->resolve(
2269
                {
2270
                    resolution => $resolution,
2271
                    resolved_by => $patron_id,
2272
                }
2273
            );
2274
            
2275
            $messages->{ClaimAutoResolved} = $claim;
2276
        } else {
2277
            $messages->{ReturnClaims} = $claims;
2278
        }
2279
    }
2280
}
2281
2251
    # check if the return is allowed at this branch
2282
    # check if the return is allowed at this branch
2252
    my ($returnallowed, $message) = CanBookBeReturned($item->unblessed, $branch);
2283
    my ($returnallowed, $message) = CanBookBeReturned($item->unblessed, $branch);
2253
    unless ($returnallowed){
2284
    unless ($returnallowed){
Lines 2547-2552 sub AddReturn { Link Here
2547
    }
2578
    }
2548
2579
2549
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2580
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2581
         my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout');
2582
2550
        my $claims = Koha::Checkouts::ReturnClaims->search(
2583
        my $claims = Koha::Checkouts::ReturnClaims->search(
2551
           {
2584
           {
2552
               itemnumber => $item->id,
2585
               itemnumber => $item->id,
Lines 2555-2563 sub AddReturn { Link Here
2555
        );
2588
        );
2556
2589
2557
        if ( $claims->count ) {
2590
        if ( $claims->count ) {
2591
            if ( $autoClaimReturnCheckout ) {
2592
                my $claim = $claims->next;
2593
2594
                my $patron_id = $patron->borrowernumber; 
2595
2596
                my $resolution = $autoClaimReturnCheckout;
2597
2598
           $claim->resolve(
2599
                   {
2600
                   resolution => $resolution,
2601
                   resolved_by => $patron_id,
2602
                   }
2603
                   );
2604
2605
           $messages->{ClaimAutoResolved} = $claim;
2606
        } else {
2558
            $messages->{ReturnClaims} = $claims;
2607
            $messages->{ReturnClaims} = $claims;
2559
        }
2608
        }
2560
    }
2609
    }
2610
 }
2561
2611
2562
    # Check for bundle status
2612
    # Check for bundle status
2563
    if ( $item->in_bundle ) {
2613
    if ( $item->in_bundle ) {
(-)a/circ/returns.pl (+3 lines)
Lines 738-743 foreach my $code ( keys %$messages ) { Link Here
738
    }
738
    }
739
    elsif ( $code eq 'ReturnClaims' ) {
739
    elsif ( $code eq 'ReturnClaims' ) {
740
        $template->param( ReturnClaims => $messages->{ReturnClaims} );
740
        $template->param( ReturnClaims => $messages->{ReturnClaims} );
741
    }
742
    elsif ( $code eq 'ClaimAutoResolved' ) {
743
        $template->param( ClaimAutoResolved => $messages->{ClaimAutoResolved} );
741
    } elsif ( $code eq 'RecallFound' ) {
744
    } elsif ( $code eq 'RecallFound' ) {
742
        ;
745
        ;
743
    } elsif ( $code eq 'RecallNeedsTransfer' ) {
746
    } elsif ( $code eq 'RecallNeedsTransfer' ) {
(-)a/installer/data/mysql/atomicupdate/bug_27753.pl (+20 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "BUG_27753",
5
    description => "Automate the resoluton of a claim upon return",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
11
                ('AutoClaimReturnStatusOnCheckin','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check in.','Free')});
12
13
say $out "Added new system preference 'AutoClaimReturnStatusOnCheckin'";
14
15
        $dbh->do(q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
16
                ('AutoClaimReturnStatusOnCheckout','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check out.','Free')});
17
18
        say $out "Added new system preference 'AutoClaimReturnStatusOnCheckout'";
19
    },
20
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+2 lines)
Lines 82-87 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
82
('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'),
82
('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'),
83
('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo'),
83
('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo'),
84
('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'),
84
('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'),
85
('AutoClaimReturnStatusOnCheckin','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check in.','Free'),
86
('AutoClaimReturnStatusOnCheckout','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check out.','Free'),
85
('autoControlNumber','OFF','biblionumber|OFF','Used to autogenerate a Control Number: biblionumber will be as biblionumber, OFF will leave the field as it is;','Choice'),
87
('autoControlNumber','OFF','biblionumber|OFF','Used to autogenerate a Control Number: biblionumber will be as biblionumber, OFF will leave the field as it is;','Choice'),
86
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
88
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
87
('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'),
89
('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+12 lines)
Lines 1335-1340 Circulation: Link Here
1335
                  no_charge: don't charge a lost fee
1335
                  no_charge: don't charge a lost fee
1336
            - .
1336
            - .
1337
        -
1337
        -
1338
            - Automatically resolve the claim and change the status to the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=RETURN_CLAIM_RESOLUTION">Return claim resolution</a> authorized value
1339
            - pref: AutoClaimReturnStatusOnCheckin
1340
              choices: authval
1341
              source: RETURN_CLAIM_RESOLUTION
1342
            - upon check in.
1343
        -
1344
            - Automatically resolve the claim and change the status to the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=RETURN_CLAIM_RESOLUTION">Return claim resolution</a>      authorized value
1345
            - pref: AutoClaimReturnStatusOnCheckout
1346
              choices: authval
1347
              source: RETURN_CLAIM_RESOLUTION
1348
            - upon check out.
1349
        -     
1338
            - Use the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> authorized value
1350
            - Use the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> authorized value
1339
            - pref: ClaimReturnedLostValue
1351
            - pref: ClaimReturnedLostValue
1340
              choices: authval
1352
              choices: authval
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-3 / +13 lines)
Lines 190-196 Link Here
190
                            [% END %]
190
                            [% END %]
191
191
192
                            <!-- Item has return claim(s) -->
192
                            <!-- Item has return claim(s) -->
193
                            [% IF ( ReturnClaims ) %]
193
                            [% IF ( ClaimAutoResolved ) %]
194
                            <div class="dialog alert return-claim">
195
                            <h3>This item has been claimed as returned by:</h3>
196
                            <ul>
197
                            [% FOREACH rc IN ClaimAutoResolved %]
198
                            <li>
199
                            [% INCLUDE 'patron-title.inc' patron=rc.patron hide_patron_infos_if_needed=1 invert_name=1 %]
200
                            </li>
201
                            [% END %]
202
                            </ul>
203
                             </div>
204
                            [% ELSIF ( ReturnClaims ) %]
194
                                <div class="dialog alert return-claim">
205
                                <div class="dialog alert return-claim">
195
                                    <h3>This item has been claimed as returned by:</h3>
206
                                    <h3>This item has been claimed as returned by:</h3>
196
                                    <ul>
207
                                    <ul>
Lines 200-206 Link Here
200
                                            </li>
211
                                            </li>
201
                                        [% END %]
212
                                        [% END %]
202
                                    </ul>
213
                                    </ul>
203
                                </div>
214
                                </div>         
204
                            [% END %]
215
                            [% END %]
205
216
206
                            <!-- Patron has waiting holds -->
217
                            <!-- Patron has waiting holds -->
207
- 

Return to bug 27753