Bugzilla – Attachment 162517 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 two new system preferences for automatically resolving claims.
Bug-27753-Added-two-new-system-preferences-for-aut.patch (text/plain), 9.38 KB, created by
Laura Escamilla
on 2024-02-27 20:17:07 UTC
(
hide
)
Description:
Bug 27753: Added two new system preferences for automatically resolving claims.
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2024-02-27 20:17:07 UTC
Size:
9.38 KB
patch
obsolete
>From a3dc24b46d5341cca9b8c6d8a23f9ab00ad44a65 Mon Sep 17 00:00:00 2001 >From: Laura Escamilla <laura.escamilla@bywatersolutions.com> >Date: Tue, 27 Feb 2024 20:03:26 +0000 >Subject: [PATCH] Bug 27753: Added two new system preferences for automatically > resolving claims. > >--- > C4/Circulation.pm | 50 +++++++++++++++++++ > 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/returns.tt | 15 +++++- > 6 files changed, 100 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_27753.pl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 109809d4b9..fd1e58e444 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2248,6 +2248,37 @@ sub AddReturn { > } > } > >+if (C4::Context->preference('ClaimReturnedLostValue')) { >+ my $autoClaimReturnCheckin = C4::Context->preference('AutoClaimReturnStatusOnCheckin'); >+ >+ my $claims = Koha::Checkouts::ReturnClaims->search( >+ { >+ itemnumber => $item->id, >+ resolution => undef, >+ } >+ ); >+ >+ if ($claims->count) { >+ if ($autoClaimReturnCheckin) { >+ my $claim = $claims->next; >+ >+ my $patron_id = $patron->borrowernumber; >+ my $resolution = $autoClaimReturnCheckin; # Use the preference value as the resolution >+ >+ $claim->resolve( >+ { >+ resolution => $resolution, >+ resolved_by => $patron_id, >+ } >+ ); >+ >+ $messages->{ClaimAutoResolved} = $claim; >+ } else { >+ $messages->{ReturnClaims} = $claims; >+ } >+ } >+} >+ > # check if the return is allowed at this branch > my ($returnallowed, $message) = CanBookBeReturned($item->unblessed, $branch); > unless ($returnallowed){ >@@ -2547,6 +2578,8 @@ sub AddReturn { > } > > if ( C4::Context->preference('ClaimReturnedLostValue') ) { >+ my $autoClaimReturnCheckout = C4::Context->preference('AutoClaimReturnStatusOnCheckout'); >+ > my $claims = Koha::Checkouts::ReturnClaims->search( > { > itemnumber => $item->id, >@@ -2555,9 +2588,26 @@ sub AddReturn { > ); > > 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, >+ } >+ ); >+ >+ $messages->{ClaimAutoResolved} = $claim; >+ } else { > $messages->{ReturnClaims} = $claims; > } > } >+ } > > # Check for bundle status > if ( $item->in_bundle ) { >diff --git a/circ/returns.pl b/circ/returns.pl >index c0df061139..5453e1aa19 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -738,6 +738,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 100644 >index 0000000000..d2698df01d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_27753.pl >@@ -0,0 +1,20 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "BUG_27753", >+ description => "Automate the resoluton of a claim upon return", >+ 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'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 669074aa50..6ac6a44ce1 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/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'), >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 080e8fa494..30031fc468 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 >@@ -1335,6 +1335,18 @@ Circulation: > no_charge: don't charge a lost fee > - . > - >+ - 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 >+ - pref: AutoClaimReturnStatusOnCheckin >+ choices: authval >+ source: RETURN_CLAIM_RESOLUTION >+ - upon check in. >+ - >+ - 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 >+ - 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 > choices: authval >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 6fa85cbb23..7244dff86c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -190,7 +190,18 @@ > [% END %] > > <!-- Item has return claim(s) --> >- [% IF ( ReturnClaims ) %] >+ [% IF ( ClaimAutoResolved ) %] >+ <div class="dialog alert return-claim"> >+ <h3>This item has been claimed as returned by:</h3> >+ <ul> >+ [% FOREACH rc IN ClaimAutoResolved %] >+ <li> >+ [% INCLUDE 'patron-title.inc' patron=rc.patron hide_patron_infos_if_needed=1 invert_name=1 %] >+ </li> >+ [% END %] >+ </ul> >+ </div> >+ [% ELSIF ( ReturnClaims ) %] > <div class="dialog alert return-claim"> > <h3>This item has been claimed as returned by:</h3> > <ul> >@@ -200,7 +211,7 @@ > </li> > [% END %] > </ul> >- </div> >+ </div> > [% END %] > > <!-- Patron has waiting holds --> >-- >2.30.2
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