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

(-)a/C4/Circulation.pm (-8 / +23 lines)
Lines 2535-2549 sub AddReturn { Link Here
2535
    }
2535
    }
2536
2536
2537
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2537
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2538
        my $claims = Koha::Checkouts::ReturnClaims->search(
2538
        my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin');
2539
           {
2539
2540
               itemnumber => $item->id,
2540
        if ($autoClaimReturnCheckin) {
2541
               resolution => undef,
2541
            my $claim = Koha::Checkouts::ReturnClaims->find(
2542
           }
2542
                {
2543
        );
2543
                    itemnumber => $item->id,
2544
                    resolution => undef,
2545
                }
2546
            );
2547
2548
            if ($claim) {
2549
                my $patron_id  = $patron->borrowernumber;
2550
                my $resolution = $autoClaimReturnCheckin;
2544
2551
2545
        if ( $claims->count ) {
2552
                $claim->resolve(
2546
            $messages->{ReturnClaims} = $claims;
2553
                    {
2554
                        resolution  => $resolution,
2555
                        resolved_by => $patron_id,
2556
                    }
2557
                );
2558
                $messages->{ClaimAutoResolved} = $claim;
2559
            } else {
2560
                $messages->{ReturnClaims} = $claim if $claim;
2561
            }
2547
        }
2562
        }
2548
    }
2563
    }
2549
2564
(-)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 496-501 if (@$barcodes && $op eq 'cud-checkout') { Link Here
496
        }
497
        }
497
    }
498
    }
498
499
500
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
501
        my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout');
502
503
        my $claims = Koha::Checkouts::ReturnClaims->search(
504
            {
505
                itemnumber => $item->id,
506
            }
507
        );
508
        if ( $claims->count ) {
509
            if ($autoClaimReturnCheckout) {
510
                my $claim = $claims->next;
511
512
                my $patron_id  = $patron->borrowernumber;
513
                my $resolution = $autoClaimReturnCheckout;
514
515
                $claim->resolve(
516
                    {
517
                        resolution  => $resolution,
518
                        resolved_by => $patron_id,
519
                    }
520
                );
521
                $template_params->{CLAIM_RESOLUTION} = $claim;
522
            }
523
        }
524
    }
499
    if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){
525
    if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){
500
        $template->param(
526
        $template->param(
501
            reserveborrowernumber => $needsconfirmation->{'resborrowernumber'},
527
            reserveborrowernumber => $needsconfirmation->{'resborrowernumber'},
(-)a/circ/returns.pl (+3 lines)
Lines 747-752 foreach my $code ( keys %$messages ) { Link Here
747
    }
747
    }
748
    elsif ( $code eq 'ReturnClaims' ) {
748
    elsif ( $code eq 'ReturnClaims' ) {
749
        $template->param( ReturnClaims => $messages->{ReturnClaims} );
749
        $template->param( ReturnClaims => $messages->{ReturnClaims} );
750
    }
751
      elsif ( $code eq 'ClaimAutoResolved' ) {
752
          $template->param( ClaimAutoResolved => $messages->{ClaimAutoResolved} );
750
    } elsif ( $code eq 'RecallFound' ) {
753
    } elsif ( $code eq 'RecallFound' ) {
751
        ;
754
        ;
752
    } elsif ( $code eq 'RecallNeedsTransfer' ) {
755
    } 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 83-88 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
83
('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'),
83
('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'),
84
('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo'),
84
('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo'),
85
('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
('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'),
86
('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'),
87
('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'),
86
('autoControlNumber','OFF','biblionumber|OFF','Used to autogenerate a Control Number: biblionumber will be as biblionumber, OFF will leave the field as it is;','Choice'),
88
('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
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
89
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
88
('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'),
90
('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+12 lines)
Lines 1352-1357 Circulation: Link Here
1352
                  charge: charge a lost fee
1352
                  charge: charge a lost fee
1353
                  no_charge: don't charge a lost fee
1353
                  no_charge: don't charge a lost fee
1354
            - .
1354
            - .
1355
        -
1356
            - 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
1357
            - pref: AutoClaimReturnStatusOnCheckin
1358
              choices: authval
1359
              source: RETURN_CLAIM_RESOLUTION
1360
            - upon check in.
1361
        -
1362
            - 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
1363
            - pref: AutoClaimReturnStatusOnCheckout
1364
              choices: authval
1365
              source: RETURN_CLAIM_RESOLUTION
1366
            - upon check out.
1355
        -
1367
        -
1356
            - Use the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> authorized value
1368
            - Use the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> authorized value
1357
            - pref: ClaimReturnedLostValue
1369
            - 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