Bugzilla – Attachment 166128 Details for
Bug 27753
Automate resolution of return claim when checking in an item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27753: Added new system preferences for automatically resolving claims
Bug-27753-Added-new-system-preferences-for-automat.patch (text/plain), 12.40 KB, created by
Martin Renvoize (ashimema)
on 2024-05-03 14:16:30 UTC
(
hide
)
Description:
Bug 27753: Added new system preferences for automatically resolving claims
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-05-03 14:16:30 UTC
Size:
12.40 KB
patch
obsolete
>From b788228c6c47879fa8453c893fa4b3eb4dbd4165 Mon Sep 17 00:00:00 2001 >From: Laura Escamilla <laura.escamilla@bywatersolutions.com> >Date: Tue, 12 Mar 2024 02:44:05 +0000 >Subject: [PATCH] Bug 27753: Added new system preferences for automatically > resolving claims >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To test: >1. Configure Claims returned > 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 >2. Check out an item to a patron. > 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. >3. Check out the item to the patron again. > 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. >4. Apply the patch. > 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â >5. Redo step 2 > 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â >6. Redo step 3 > 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â. >7. Sign off and have a wonderful day! > >Sponsored-by: Altadena Library District >Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Circulation.pm | 31 ++++++++++++++----- > circ/circulation.pl | 26 ++++++++++++++++ > circ/returns.pl | 3 ++ > .../data/mysql/atomicupdate/bug_27753.pl | 24 ++++++++++++++ > 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 +++- > 8 files changed, 98 insertions(+), 9 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_27753.pl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index df148d92537..5f642c2f908 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2535,15 +2535,30 @@ sub AddReturn { > } > > if ( C4::Context->preference('ClaimReturnedLostValue') ) { >- my $claims = Koha::Checkouts::ReturnClaims->search( >- { >- itemnumber => $item->id, >- resolution => undef, >- } >- ); >+ my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin'); >+ >+ if ($autoClaimReturnCheckin) { >+ my $claim = Koha::Checkouts::ReturnClaims->find( >+ { >+ itemnumber => $item->id, >+ resolution => undef, >+ } >+ ); >+ >+ if ($claim) { >+ my $patron_id = $patron->borrowernumber; >+ my $resolution = $autoClaimReturnCheckin; > >- if ( $claims->count ) { >- $messages->{ReturnClaims} = $claims; >+ $claim->resolve( >+ { >+ resolution => $resolution, >+ resolved_by => $patron_id, >+ } >+ ); >+ $messages->{ClaimAutoResolved} = $claim; >+ } else { >+ $messages->{ReturnClaims} = $claim if $claim; >+ } > } > } > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 76b2fc99d9b..c76571b3fbb 100755 >--- a/circ/circulation.pl >+++ b/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 ); >@@ -496,6 +497,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'}, >diff --git a/circ/returns.pl b/circ/returns.pl >index 6614237e470..f94389cbc9b 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -747,6 +747,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' ) { >diff --git a/installer/data/mysql/atomicupdate/bug_27753.pl b/installer/data/mysql/atomicupdate/bug_27753.pl >new file mode 100755 >index 00000000000..ddfae2063ce >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_27753.pl >@@ -0,0 +1,24 @@ >+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 system preference 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 system preference will automatically resolve the claim return and will update the lost authorized value upon check out.','Free')} >+ ); >+ >+ say $out "Added new system preference 'AutoClaimReturnStatusOnCheckout'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index b55473fafa9..e703845c08e 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -83,6 +83,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 system preference will automatically resolve the claim return and will update the lost authorized value upon check in.','Free'), >+('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'), > ('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'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 9370a9b568e..90fa859b4f8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -1358,6 +1358,18 @@ Circulation: > charge: charge a lost fee > no_charge: don't charge a lost fee > - . >+ - >+ - 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 >+ - pref: AutoClaimReturnStatusOnCheckin >+ choices: authval >+ source: RETURN_CLAIM_RESOLUTION >+ - upon check in. >+ - >+ - 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 >+ - pref: AutoClaimReturnStatusOnCheckout >+ choices: authval >+ source: RETURN_CLAIM_RESOLUTION >+ - upon check out. > - > - Use the <a href="/cgi-bin/koha/admin/authorised_values.pl?searchfield=LOST">LOST</a> authorized value > - pref: ClaimReturnedLostValue >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index f51c70c1d27..75b034763d1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -79,6 +79,9 @@ > </div> > [% END %] > >+ [% IF CLAIM_RESOLUTION %] >+ <div class="dialog message">The previously claimed returned item has been found, automatically resolving the associated claim.</div> >+ [% END %] > [% IF ( alert.ITEM_LOST ) %] > <div class="dialog message">This item has been lost with a status of "[% alert.ITEM_LOST | html %]".</div> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 3106d821cd6..489400e3c7a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -191,7 +191,11 @@ > [% END %] > > <!-- Item has return claim(s) --> >- [% IF ( ReturnClaims ) %] >+ [% IF ( ClaimAutoResolved ) %] >+ <div class="dialog alert resolved-claim"> >+ <p><strong>The previously claimed returned item has been found, automatically resolving the associated claim.</strong></p> >+ </div> >+ [% ELSIF( ReturnClaims ) %] > <div class="dialog alert return-claim"> > <h3>This item has been claimed as returned by:</h3> > <ul> >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27753
:
162517
|
163058
|
163059
|
163060
|
163061
|
163084
|
163085
|
163090
|
163469
|
163470
|
163474
|
163475
|
163476
|
163477
|
163479
|
163480
|
165911
|
165912
|
165914
|
165915
|
165916
|
165917
|
165918
|
165919
|
165920
|
165952
|
165953
|
165958
|
165959
| 166128 |
166129
|
166130
|
166131
|
166132
|
166133
|
166134
|
166135
|
166136
|
166137