Bugzilla – Attachment 68034 Details for
Bug 10748
Add option to block return of lost items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10748: Add the ability to block return of lost items
Bug-10748-Add-the-ability-to-block-return-of-lost-.patch (text/plain), 9.27 KB, created by
Jonathan Druart
on 2017-10-12 16:41:07 UTC
(
hide
)
Description:
Bug 10748: Add the ability to block return of lost items
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-12 16:41:07 UTC
Size:
9.27 KB
patch
obsolete
>From d61ce35714b6c66837cefe3ef58942283dac3b3b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 Oct 2017 20:54:24 -0300 >Subject: [PATCH] Bug 10748: Add the ability to block return of lost items > >Mimicking what does BlockReturnOfWithdrawnItems we can easily add a new >syspref to block return of lost items. >This patch adds BlockReturnOfLostItems, if set to 'Block' a item marked >as lost cannot be checked in. > >Test plan: >1/ Set BlockReturnOfLostItems to 'Do not block' >2/ Check an item out to a patron >3/ Edit the item and mark it as lost (*) >4/ Check the item in >=> The item is checked in >5/ Edit the item and remove the lost status >6/ Check the item out again >7/ Edit the item and mark it as lost (*) >8/ Check the item in >=> The item is not checked in > >(*) There are 2 ways to mark an item lost: >- From the item list view (/catalogue/moredetail.pl?biblionumber=42) >If you set the lost status from this form, the issue will be returned >Maybe this should be optional (?) > >- From the edit items form (/cataloguing/additem.pl?biblionumber=42) >It is the form you must use to not mark the issue returned. >--- > C4/Circulation.pm | 10 +++++++--- > C4/UsageStats.pm | 1 + > circ/returns.pl | 2 +- > .../mysql/atomicupdate/bug_10748_BlockReturnOfLostItems.sql | 3 +++ > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ > koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt | 11 ++++++----- > t/db_dependent/UsageStats.t | 1 + > 8 files changed, 26 insertions(+), 9 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_10748_BlockReturnOfLostItems.sql > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b915b34007..ad4aa53b90 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1909,6 +1909,10 @@ sub AddReturn { > $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems"); > } > >+ if ( $item->{itemlost} and C4::Context->preference("BlockReturnOfLostItems") ) { >+ $doreturn = 0; >+ } >+ > # case of a return of document (deal with issues and holdingbranch) > my $today = DateTime->now( time_zone => C4::Context->tz() ); > >@@ -1986,8 +1990,7 @@ sub AddReturn { > # fix up the accounts..... > if ( $item->{'itemlost'} ) { > $messages->{'WasLost'} = 1; >- >- if ( $item->{'itemlost'} ) { >+ unless ( C4::Context->preference("BlockReturnOfLostItems") ) { > if ( > Koha::RefundLostItemFeeRules->should_refund( > { >@@ -1998,7 +2001,8 @@ sub AddReturn { > ) > ) > { >- _FixAccountForLostAndReturned( $item->{'itemnumber'}, $borrowernumber, $barcode ); >+ _FixAccountForLostAndReturned( $item->{'itemnumber'}, >+ $borrowernumber, $barcode ); > $messages->{'LostItemFeeRefunded'} = 1; > } > } >diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm >index 96e79fadbc..77442cea1f 100644 >--- a/C4/UsageStats.pm >+++ b/C4/UsageStats.pm >@@ -128,6 +128,7 @@ sub BuildReport { > z3950NormalizeAuthor > SpineLabelAutoPrint > SpineLabelShowPrintOnBibDetails >+ BlockReturnOfLostItems > BlockReturnOfWithdrawnItems > CalculateFinesOnReturn > AgeRestrictionOverride >diff --git a/circ/returns.pl b/circ/returns.pl >index c42e7504eb..a91b68b754 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -505,6 +505,7 @@ foreach my $code ( keys %$messages ) { > } > elsif ( $code eq 'WasLost' ) { > $err{waslost} = 1; >+ $exit_required_p = 1 if C4::Context->preference("BlockReturnOfLostItems"); > } > elsif ( $code eq 'LostItemFeeRefunded' ) { > $template->param( LostItemFeeRefunded => 1 ); >@@ -643,7 +644,6 @@ $template->param( > forgivemanualholdsexpire => $forgivemanualholdsexpire, > overduecharges => $overduecharges, > AudioAlerts => C4::Context->preference("AudioAlerts"), >- BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"), > ); > > $itemnumber = GetItemnumberFromBarcode( $barcode ); >diff --git a/installer/data/mysql/atomicupdate/bug_10748_BlockReturnOfLostItems.sql b/installer/data/mysql/atomicupdate/bug_10748_BlockReturnOfLostItems.sql >new file mode 100644 >index 0000000000..63a91b912a >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_10748_BlockReturnOfLostItems.sql >@@ -0,0 +1,3 @@ >+ >+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+('BlockReturnOfLostItems','0','0','If enabled, items that are marked as lost cannot be returned.','YesNo'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index fc4e560e54..938e64aa58 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -82,6 +82,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'), > ('BibtexExportAdditionalFields', '', NULL , 'Define additional BibTex tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea'), > ('BlockExpiredPatronOpacActions','1',NULL,'Set whether an expired patron can perform opac actions such as placing holds or renew books, can be overridden on a per patron-type basis','YesNo'), >+('BlockReturnOfLostItems','0','0','If enabled, items that are marked as lost cannot be returned.','YesNo'), > ('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'), > ('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'), > ('borrowerRelationship','father|mother','','Define valid relationships between a guarantor & a guarantee (separated by | or ,)','free'), >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 90b284456d..8b2196d442 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 >@@ -467,6 +467,12 @@ Circulation: > no: "Don't block" > - returning of items that have been withdrawn. > - >+ - pref: BlockReturnOfLostItems >+ choices: >+ yes: Block >+ no: "Don't block" >+ - returning of items that have been lost. >+ - > - pref: CalculateFinesOnReturn > choices: > yes: Do >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 b3b5910342..9f439b2b23 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -617,20 +617,21 @@ $(document).ready(function () { > [% END %] > [% IF ( errmsgloo.waslost ) %] > <p class="problem">Item was lost, now found.</p> >- [% IF ( LostItemFeeRefunded ) %] >+ [% IF LostItemFeeRefunded and not Koha.Preference('BlockReturnOfLostItems') %] > <p class="problem">A refund has been applied to the borrowing patron's account.</p> >+ [% ELSIF Koha.Preference('BlockReturnOfLostItems') %] >+ <h5>Cannot check in</h5> >+ <p><strong>NOT CHECKED IN</strong></p> > [% ELSE %] > <p class="problem">Any lost item fees for this item will remain on the patron's account.</p> > [% END %] > [% END %] > [% IF ( errmsgloo.withdrawn ) %] >- [% IF BlockReturnOfWithdrawnItems %] >+ [% IF Koha.Preference('BlockReturnOfWithdrawnItems') %] > <h5>Cannot check in</h5> > <p><strong>NOT CHECKED IN</strong></p> >- <p class="problem">Item is withdrawn.</p> >- [% ELSE %] >- <p class="problem">Item is withdrawn.</p> > [% END %] >+ <p class="problem">Item is withdrawn.</p> > [% END %] > [% IF ( errmsgloo.debarred ) %] > <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %].</p> >diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t >index 532bea91bf..d50e0306ef 100644 >--- a/t/db_dependent/UsageStats.t >+++ b/t/db_dependent/UsageStats.t >@@ -380,6 +380,7 @@ sub mocking_systempreferences_to_a_set_value { > z3950NormalizeAuthor > SpineLabelAutoPrint > SpineLabelShowPrintOnBibDetails >+ BlockReturnOfLostItems > BlockReturnOfWithdrawnItems > CalculateFinesOnReturn > AgeRestrictionOverride >-- >2.11.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 10748
:
68034
|
68112
|
68919
|
68950
|
68951
|
68952