@@ -, +, @@ resolving claims 1. Go to Administration > Authorized Values > LOST 2. Add a new authorized value with value:6 and description:Claims returned 3. Go to Administration > System Preferences 4. Set ClaimReturnedLostValue to 6 and save 1. Mark the item as claim returned 2. Check the item in. 3. A message stating that the item has been claimed as returned pops up with an option to resolve. 4. Resolve the claim. 1. Mark the item as claim returned. 2. Check out the item to a new patron. Select “Yes, check out” 3. Go back to the previous patron. Notice that their claim was not resolved. 1. Updatedatabase 2. restart_all 3. Go to the system preferences and set the system preference ‘AutoClaimReturnStatusOnCheckin’ to ‘Returned by patron’ 4. Set ‘AutoClaimReturnStatusOnCheckout’ to ‘Found in library’ 1. When checking the claim returned item in you will now see a message that says “The previously claimed returned item has been found, automatically resolving the associated claim.” 2. View the previous patron. Their claim has automatically been resolved with a status of ‘Returned by patron’ 1. Upon checking the item out to another patron you will see a message that says “The previously claimed returned item has been found, automatically resolving the associated claim.” 2. View the previous patron. Their claim has automatically been resolved with a status of ‘Found in library’. --- circ/circulation.pl | 26 +++++++++++++++++++ circ/returns.pl | 3 +++ .../data/mysql/atomicupdate/bug_27753.pl | 20 ++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 ++ .../admin/preferences/circulation.pref | 12 +++++++++ .../prog/en/modules/circ/circulation.tt | 3 +++ .../prog/en/modules/circ/returns.tt | 6 ++++- 7 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_27753.pl --- a/circ/circulation.pl +++ a/circ/circulation.pl @@ -43,6 +43,7 @@ use Koha::Holds; use C4::Context; use CGI::Session; use Koha::AuthorisedValues; +use Koha::Checkouts::ReturnClaims; use Koha::CsvProfiles; use Koha::Patrons; use Koha::DateUtils qw( dt_from_string ); @@ -468,6 +469,31 @@ if (@$barcodes && $op eq 'cud-checkout') { } } + if (C4::Context->preference('ClaimReturnedLostValue')) { + my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout'); + + my $claims = Koha::Checkouts::ReturnClaims->search( + { + itemnumber => $item->id, + } + ); + if ($claims->count) { + if ($autoClaimReturnCheckout) { + my $claim = $claims->next; + + my $patron_id = $patron->borrowernumber; + my $resolution = $autoClaimReturnCheckout; + + $claim->resolve( + { + resolution => $resolution, + resolved_by => $patron_id, + } + ); + $template_params->{CLAIM_RESOLUTION} = $claim; + } + } +} if ($needsconfirmation->{RESERVE_WAITING} or $needsconfirmation->{RESERVED} or $needsconfirmation->{TRANSFERRED} or $needsconfirmation->{PROCESSING}){ $template->param( reserveborrowernumber => $needsconfirmation->{'resborrowernumber'}, --- a/circ/returns.pl +++ a/circ/returns.pl @@ -739,6 +739,9 @@ foreach my $code ( keys %$messages ) { } elsif ( $code eq 'ReturnClaims' ) { $template->param( ReturnClaims => $messages->{ReturnClaims} ); + } + elsif ( $code eq 'ClaimAutoResolved' ) { + $template->param( ClaimAutoResolved => $messages->{ClaimAutoResolved} ); } elsif ( $code eq 'RecallFound' ) { ; } elsif ( $code eq 'RecallNeedsTransfer' ) { --- a/installer/data/mysql/atomicupdate/bug_27753.pl +++ a/installer/data/mysql/atomicupdate/bug_27753.pl @@ -0,0 +1,20 @@ +use Modern::Perl; + +return { + bug_number => "BUG_27753", + description => "Automate resolution of return claim when checking in an item", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('AutoClaimReturnStatusOnCheckin','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check in.','Free')}); + + say $out "Added new system preference 'AutoClaimReturnStatusOnCheckin'"; + + $dbh->do(q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('AutoClaimReturnStatusOnCheckout','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check out.','Free')}); + + say $out "Added new system preference 'AutoClaimReturnStatusOnCheckout'"; + }, +}; --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -82,6 +82,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'), ('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo'), ('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'), +('AutoClaimReturnStatusOnCheckin','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check in.','Free'), +('AutoClaimReturnStatusOnCheckout','','NULL','When in use this syspref will automatically resolve the claim return and will update the lost authorized value upon check out.','Free'), ('autoControlNumber','OFF','biblionumber|OFF','Used to autogenerate a Control Number: biblionumber will be as biblionumber, OFF will leave the field as it is;','Choice'), ('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'), ('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -1334,6 +1334,18 @@ Circulation: charge: charge a lost fee no_charge: don't charge a lost fee - . + - + - Automatically resolve the claim and change the status to the Return claim resolution authorized value + - pref: AutoClaimReturnStatusOnCheckin + choices: authval + source: RETURN_CLAIM_RESOLUTION + - upon check in. + - + - Automatically resolve the claim and change the status to the Return claim resolution authorized value + - pref: AutoClaimReturnStatusOnCheckout + choices: authval + source: RETURN_CLAIM_RESOLUTION + - upon check out. - - Use the LOST authorized value - pref: ClaimReturnedLostValue --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -79,6 +79,9 @@ [% END %] + [% IF CLAIM_RESOLUTION %] +
The previously claimed returned item has been located, automatically resolving the associated claim.
+ [% END %] [% IF ( alert.ITEM_LOST ) %]
This item has been lost with a status of "[% alert.ITEM_LOST | html %]".
[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -191,7 +191,11 @@ [% END %] - [% IF ( ReturnClaims ) %] + [% IF ( ClaimAutoResolved ) %] +
+

The previously claimed returned item has been found, automatically resolving the associated claim.

+
+ [% ELSIF( ReturnClaims ) %]

This item has been claimed as returned by: