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

(-)a/C4/Circulation.pm (-8 / +23 lines)
Lines 2530-2544 sub AddReturn { Link Here
2530
    }
2530
    }
2531
2531
2532
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2532
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2533
        my $claims = Koha::Checkouts::ReturnClaims->search(
2533
        my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin');
2534
           {
2534
2535
               itemnumber => $item->id,
2535
        if ($autoClaimReturnCheckin) {
2536
               resolution => undef,
2536
            my $claim = Koha::Checkouts::ReturnClaims->find(
2537
           }
2537
                {
2538
        );
2538
                    itemnumber => $item->id,
2539
                    resolution => undef,
2540
                }
2541
            );
2542
2543
            if ($claim) {
2544
                my $patron_id  = $patron->borrowernumber;
2545
                my $resolution = $autoClaimReturnCheckin;
2539
2546
2540
        if ( $claims->count ) {
2547
                $claim->resolve(
2541
            $messages->{ReturnClaims} = $claims;
2548
                    {
2549
                        resolution  => $resolution,
2550
                        resolved_by => $patron_id,
2551
                    }
2552
                );
2553
                $messages->{ClaimAutoResolved} = $claim;
2554
            } else {
2555
                $messages->{ReturnClaims} = $claim if $claim;
2556
            }
2542
        }
2557
        }
2543
    }
2558
    }
2544
2559
(-)a/circ/circulation.pl (+26 lines)
Lines 43-48 use Koha::Holds; Link Here
43
use C4::Context;
43
use C4::Context;
44
use CGI::Session;
44
use CGI::Session;
45
use Koha::AuthorisedValues;
45
use Koha::AuthorisedValues;
46
use Koha::Checkouts::ReturnClaims;
46
use Koha::CsvProfiles;
47
use Koha::CsvProfiles;
47
use Koha::Patrons;
48
use Koha::Patrons;
48
use Koha::DateUtils qw( dt_from_string );
49
use Koha::DateUtils qw( dt_from_string );
Lines 483-488 if (@$barcodes && $op eq 'cud-checkout') { Link Here
483
        }
484
        }
484
    }
485
    }
485
486
487
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
488
        my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout');
489
490
        my $claims = Koha::Checkouts::ReturnClaims->search(
491
            {
492
                itemnumber => $item->id,
493
            }
494
        );
495
        if ( $claims->count ) {
496
            if ($autoClaimReturnCheckout) {
497
                my $claim = $claims->next;
498
499
                my $patron_id  = $patron->borrowernumber;
500
                my $resolution = $autoClaimReturnCheckout;
501
502
                $claim->resolve(
503
                    {
504
                        resolution  => $resolution,
505
                        resolved_by => $patron_id,
506
                    }
507
                );
508
                $template_params->{CLAIM_RESOLUTION} = $claim;
509
            }
510
        }
511
    }
486
    if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){
512
    if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){
487
        $template->param(
513
        $template->param(
488
            reserveborrowernumber => $needsconfirmation->{'resborrowernumber'},
514
            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 resolution of return claim when checking in an item",
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 system preference 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 system preference 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 system preference will automatically resolve the claim return and will update the lost authorized value upon check in.','Free'),
86
('AutoClaimReturnStatusOnCheckout','','NULL','When in use this system preference 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 1340-1345 Circulation: Link Here
1340
                  charge: charge a lost fee
1340
                  charge: charge a lost fee
1341
                  no_charge: don't charge a lost fee
1341
                  no_charge: don't charge a lost fee
1342
            - .
1342
            - .
1343
        -
1344
            - Automatically resolve the claim and change the resolution to the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=RETURN_CLAIM_RESOLUTION">Return claim resolution</a> authorized value
1345
            - pref: AutoClaimReturnStatusOnCheckin
1346
              choices: authval
1347
              source: RETURN_CLAIM_RESOLUTION
1348
            - upon check in.
1349
        -
1350
            - Automatically resolve the claim and change the resolution to the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=RETURN_CLAIM_RESOLUTION">Return claim resolution</a> authorized value
1351
            - pref: AutoClaimReturnStatusOnCheckout
1352
              choices: authval
1353
              source: RETURN_CLAIM_RESOLUTION
1354
            - upon check out.
1343
        -
1355
        -
1344
            - Use the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> authorized value
1356
            - Use the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> authorized value
1345
            - pref: ClaimReturnedLostValue
1357
            - pref: ClaimReturnedLostValue
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+3 lines)
Lines 79-84 Link Here
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 found, 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 resolved-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