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

(-)a/C4/Circulation.pm (-13 / +31 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;
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 2546-2564 sub AddReturn { Link Here
2546
        }
2577
        }
2547
    }
2578
    }
2548
2579
2549
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2550
        my $claims = Koha::Checkouts::ReturnClaims->search(
2551
           {
2552
               itemnumber => $item->id,
2553
               resolution => undef,
2554
           }
2555
        );
2556
2557
        if ( $claims->count ) {
2558
            $messages->{ReturnClaims} = $claims;
2559
        }
2560
    }
2561
2562
    # Check for bundle status
2580
    # Check for bundle status
2563
    if ( $item->in_bundle ) {
2581
    if ( $item->in_bundle ) {
2564
        my $host = $item->bundle_host;
2582
        my $host = $item->bundle_host;
(-)a/circ/circulation.pl (+29 lines)
Lines 39-44 use C4::Members; Link Here
39
use C4::Biblio qw( TransformMarcToKoha );
39
use C4::Biblio qw( TransformMarcToKoha );
40
use C4::Search qw( new_record_from_zebra );
40
use C4::Search qw( new_record_from_zebra );
41
use C4::Reserves qw( ModReserveAffect );
41
use C4::Reserves qw( ModReserveAffect );
42
use Koha::Checkouts::ReturnClaims;
42
use Koha::Holds;
43
use Koha::Holds;
43
use C4::Context;
44
use C4::Context;
44
use CGI::Session;
45
use CGI::Session;
Lines 468-473 if (@$barcodes && $op eq 'cud-checkout') { Link Here
468
        }
469
        }
469
    }
470
    }
470
471
472
    if (C4::Context->preference('ClaimReturnedLostValue')) {
473
        my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout');
474
475
        my $claims = Koha::Checkouts::ReturnClaims->search(
476
            {
477
                itemnumber => $item->id,
478
            }
479
        );
480
    
481
     if ($claims->count) {
482
         if ($autoClaimReturnCheckout) {
483
            my $claim = $claims->next;
484
485
            my $patron_id = $patron->borrowernumber;
486
            my $resolution = $autoClaimReturnCheckout; 
487
488
             $claim->resolve(
489
                  {
490
                     resolution  => $resolution,
491
                     resolved_by => $patron_id,
492
                  }
493
            );
494
495
            $template_params->{CLAIM_RESOLUTION} = $claim; 
496
        }
497
    }
498
}
499
471
    if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){
500
    if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){
472
        $template->param(
501
        $template->param(
473
            reserveborrowernumber => $needsconfirmation->{'resborrowernumber'},
502
            reserveborrowernumber => $needsconfirmation->{'resborrowernumber'},
(-)a/circ/returns.pl (+3 lines)
Lines 739-744 foreach my $code ( keys %$messages ) { Link Here
739
    }
739
    }
740
    elsif ( $code eq 'ReturnClaims' ) {
740
    elsif ( $code eq 'ReturnClaims' ) {
741
        $template->param( ReturnClaims => $messages->{ReturnClaims} );
741
        $template->param( ReturnClaims => $messages->{ReturnClaims} );
742
    }
743
    elsif ( $code eq 'ClaimAutoResolved' ) {
744
        $template->param( ClaimAutoResolved => $messages->{ClaimAutoResolved} );
742
    } elsif ( $code eq 'RecallFound' ) {
745
    } elsif ( $code eq 'RecallFound' ) {
743
        ;
746
        ;
744
    } elsif ( $code eq 'RecallNeedsTransfer' ) {
747
    } 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 1334-1339 Circulation: Link Here
1334
                  charge: charge a lost fee
1334
                  charge: charge a lost fee
1335
                  no_charge: don't charge a lost fee
1335
                  no_charge: don't charge a lost fee
1336
            - .
1336
            - .
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.
1337
        -
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
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +4 lines)
Lines 78-84 Link Here
78
                            <span class="mats_spec_message">[% ADDITIONAL_MATERIALS | html %]</span>
78
                            <span class="mats_spec_message">[% ADDITIONAL_MATERIALS | html %]</span>
79
                        </div>
79
                        </div>
80
                    [% END %]
80
                    [% END %]
81
81
                   
82
                    [% IF CLAIM_RESOLUTION %]
83
                        <div class="dialog message">The previously claimed returned item has been located, automatically resolving the associated claim.</div>
84
                    [% END %]
82
                    [% IF ( alert.ITEM_LOST ) %]
85
                    [% IF ( alert.ITEM_LOST ) %]
83
                        <div class="dialog message">This item has been lost with a status of "[% alert.ITEM_LOST | html %]".</div>
86
                        <div class="dialog message">This item has been lost with a status of "[% alert.ITEM_LOST | html %]".</div>
84
                    [% END %]
87
                    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-2 / +5 lines)
Lines 191-197 Link Here
191
                            [% END %]
191
                            [% END %]
192
192
193
                            <!-- Item has return claim(s) -->
193
                            <!-- Item has return claim(s) -->
194
                            [% IF ( ReturnClaims ) %]
194
                            [% IF ( ClaimAutoResolved ) %]
195
                            <div class="dialog alert return-claim">
196
                            <p><strong>The previously claimed returned item has been found, automatically resolving the associated claim.</strong></p>
197
                             </div>
198
                            [% ELSIF ( ReturnClaims ) %]
195
                                <div class="dialog alert return-claim">
199
                                <div class="dialog alert return-claim">
196
                                    <h3>This item has been claimed as returned by:</h3>
200
                                    <h3>This item has been claimed as returned by:</h3>
197
                                    <ul>
201
                                    <ul>
198
- 

Return to bug 27753