Bugzilla – Attachment 162473 Details for
Bug 9805
Lost items are un-lost if returned, but not if renewed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9805: Lost items are un-lost if returned, but not if renewed.
Bug-9805-Lost-items-are-un-lost-if-returned-but-no.patch (text/plain), 14.93 KB, created by
Aleisha Amohia
on 2024-02-27 00:53:27 UTC
(
hide
)
Description:
Bug 9805: Lost items are un-lost if returned, but not if renewed.
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2024-02-27 00:53:27 UTC
Size:
14.93 KB
patch
obsolete
>From 3f8642c26da01c8606debee9c23ce798559cafd6 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 13 Mar 2013 08:36:57 -0400 >Subject: [PATCH] Bug 9805: Lost items are un-lost if returned, but not if > renewed. > >If an item has a lost status, that status is removed when the item >is returned. However, it is not removed if the item is renewed. > >Test Plan: >1) Apply this patch >2) Install database updates >3) Browse to the circ rules >4) Note the "Renew lost?" and "Renewal marks lost found" rules under default checkout hold and return policy >5) Set and test each of the rules both ways for the rules for all libraries > >Sponsored-by: Waikato Institute of Technology >--- > C4/Circulation.pm | 35 +++++++++++++++++ > Koha/CirculationRules.pm | 6 +++ > admin/smart-rules.pl | 29 ++++++++++++-- > .../bug_9805_-_add_renew_lost_circ_rules.pl | 22 +++++++++++ > .../prog/en/modules/admin/smart-rules.tt | 38 +++++++++++++++++++ > .../prog/en/modules/circ/renew.tt | 4 ++ > .../bootstrap/en/modules/opac-user.tt | 2 + > 7 files changed, 133 insertions(+), 3 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_9805_-_add_renew_lost_circ_rules.pl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 109809d4b99..ccf62bf2861 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3139,6 +3139,19 @@ sub CanBookBeRenewed { > my $auto_renew_code = $final_renewal ? 'auto_renew_final' : $final_unseen_renewal ? 'auto_unseen_final' : 'auto_renew'; > return ( 1, $auto_renew_code ) if $auto_renew eq "ok" || $auto_renew eq "auto_too_soon" && !$override_limit; > >+ if ( $item->itemlost ) { >+ my $branchcode = _GetCircControlBranch( $item, $patron ); >+ my $renew_lost_allowed_rule = Koha::CirculationRules->get_effective_rule( >+ { >+ categorycode => $patron->categorycode, >+ itemtype => undef, >+ branchcode => $branchcode, >+ rule_name => 'renew_lost_allowed', >+ } >+ ); >+ return ( 0, "item_lost" ) unless $renew_lost_allowed_rule->rule_value; >+ } >+ > return ( 1, undef ); > } > >@@ -3260,6 +3273,28 @@ sub AddRenewal { > } > ); > >+ if ( $item_object->itemlost ) { >+ my $itemlost = 1; >+ >+ my $branchcode = _GetCircControlBranch( $item_object, $patron ); >+ my $renew_lost_found_rule = Koha::CirculationRules->get_effective_rule( >+ { >+ categorycode => $patron->categorycode, >+ itemtype => undef, >+ branchcode => $branchcode, >+ rule_name => 'renew_lost_found', >+ } >+ ); >+ >+ if ( $renew_lost_found_rule->rule_value ) { >+ $itemlost = 0; >+ if ( C4::Context->preference('RefundLostItemFeeOnReturn') ) { >+ _FixAccountForLostAndReturned( $item_object->id, undef, $item_object->barcode ); >+ } >+ } >+ $item_object->itemlost($itemlost); >+ } >+ > # Increment the unseen renewals, if appropriate > # We only do so if the syspref is enabled and > # a maximum value has been set in the circ rules >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 1d074768754..55d2306e151 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -65,6 +65,12 @@ our $RULE_KINDS = { > max_holds => { > scope => [ 'branchcode', 'categorycode' ], > }, >+ renew_lost_allowed => { >+ scope => [ 'branchcode', 'categorycode' ], >+ }, >+ renew_lost_found => { >+ scope => [ 'branchcode', 'categorycode' ], >+ }, > > holdallowed => { > scope => [ 'branchcode', 'itemtype' ], >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index fd20484c9f6..99e8098c2b7 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -133,6 +133,8 @@ elsif ($op eq 'delete-branch-cat') { > max_holds => undef, > patron_maxissueqty => undef, > patron_maxonsiteissueqty => undef, >+ renew_lost_allowed => undef, >+ renew_lost_found => undef, > } > } > ); >@@ -156,6 +158,8 @@ elsif ($op eq 'delete-branch-cat') { > max_holds => undef, > patron_maxissueqty => undef, > patron_maxonsiteissueqty => undef, >+ renew_lost_allowed => undef, >+ renew_lost_found => undef, > } > } > ); >@@ -169,6 +173,8 @@ elsif ($op eq 'delete-branch-cat') { > max_holds => undef, > patron_maxissueqty => undef, > patron_maxonsiteissueqty => undef, >+ renew_lost_allowed => undef, >+ renew_lost_found => undef, > } > } > ); >@@ -192,6 +198,8 @@ elsif ($op eq 'delete-branch-cat') { > max_holds => undef, > patron_maxissueqty => undef, > patron_maxonsiteissueqty => undef, >+ renew_lost_allowed => undef, >+ renew_lost_found => undef, > } > } > ); >@@ -365,6 +373,8 @@ elsif ($op eq "set-branch-defaults") { > my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy'); > my $returnbranch = $input->param('returnbranch'); > my $max_holds = strip_non_numeric( scalar $input->param('max_holds') ); >+ my $renew_lost_allowed = $input->param('renew_lost_allowed'); >+ my $renew_lost_found = $input->param('renew_lost_found'); > > if ($branch eq "*") { > Koha::CirculationRules->set_rules( >@@ -411,12 +421,15 @@ elsif ($op eq "set-branch-defaults") { > } > ); > } >- Koha::CirculationRules->set_rule( >+ Koha::CirculationRules->set_rules( > { > branchcode => $branch, > categorycode => undef, >- rule_name => 'max_holds', >- rule_value => $max_holds, >+ rules => { >+ max_holds => $max_holds, >+ renew_lost_allowed => $renew_lost_allowed, >+ renew_lost_found => $renew_lost_found, >+ }, > } > ); > } >@@ -427,6 +440,8 @@ elsif ($op eq "add-branch-cat") { > $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty); > my $max_holds = $input->param('max_holds'); > $max_holds = strip_non_numeric($max_holds); >+ my $renew_lost_allowed = $input->param('renew_lost_allowed'); >+ my $renew_lost_found = $input->param('renew_lost_found'); > > if ($branch eq "*") { > if ($categorycode eq "*") { >@@ -438,6 +453,8 @@ elsif ($op eq "add-branch-cat") { > max_holds => $max_holds, > patron_maxissueqty => $patron_maxissueqty, > patron_maxonsiteissueqty => $patron_maxonsiteissueqty, >+ renew_lost_allowed => $renew_lost_allowed, >+ renew_lost_found => $renew_lost_found, > } > } > ); >@@ -450,6 +467,8 @@ elsif ($op eq "add-branch-cat") { > max_holds => $max_holds, > patron_maxissueqty => $patron_maxissueqty, > patron_maxonsiteissueqty => $patron_maxonsiteissueqty, >+ renew_lost_allowed => $renew_lost_allowed, >+ renew_lost_found => $renew_lost_found, > } > } > ); >@@ -463,6 +482,8 @@ elsif ($op eq "add-branch-cat") { > max_holds => $max_holds, > patron_maxissueqty => $patron_maxissueqty, > patron_maxonsiteissueqty => $patron_maxonsiteissueqty, >+ renew_lost_allowed => $renew_lost_allowed, >+ renew_lost_found => $renew_lost_found, > } > } > ); >@@ -475,6 +496,8 @@ elsif ($op eq "add-branch-cat") { > max_holds => $max_holds, > patron_maxissueqty => $patron_maxissueqty, > patron_maxonsiteissueqty => $patron_maxonsiteissueqty, >+ renew_lost_allowed => $renew_lost_allowed, >+ renew_lost_found => $renew_lost_found, > } > } > ); >diff --git a/installer/data/mysql/atomicupdate/bug_9805_-_add_renew_lost_circ_rules.pl b/installer/data/mysql/atomicupdate/bug_9805_-_add_renew_lost_circ_rules.pl >new file mode 100755 >index 00000000000..bf40229aa8a >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_9805_-_add_renew_lost_circ_rules.pl >@@ -0,0 +1,22 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "9805", >+ description => "Lost items are un-lost if returned, but not if renewed", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value) VALUES (NULL, NULL, NULL, 'renew_lost_allowed', 1) } >+ ); >+ >+ say $out "Added default checkout, hold and return policy renew_lost_allowed"; >+ >+ $dbh->do( >+ q{ INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value) VALUES (NULL, NULL, NULL, 'renew_lost_found', 0) } >+ ); >+ >+ say $out "Added default checkout, hold and return policy renew_lost_found"; >+ }, >+}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index d71e25ccaaf..b4d6968ee71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -632,6 +632,8 @@ > <th>Hold policy</th> > <th>Hold pickup library match</th> > <th>Return policy</th> >+ <th>Renew lost?</th> >+ <th>Renewal marks lost found</th> > <th class="noExport">Actions</th> > </tr> > [% SET patron_maxissueqty = CirculationRules.Search( current_branch, undef, undef, 'patron_maxissueqty', { want_rule => 1 } ) %] >@@ -794,6 +796,42 @@ > </option> > </select> > </td> >+ <td> >+ <select name="renew_lost_allowed"> >+ [% IF ( default_renew_lost_allowed == '1' ) %] >+ <option value="1" selected="selected"> >+ [% ELSE %] >+ <option value="1"> >+ [% END %] >+ Allow renewal >+ </option> >+ [% IF ( default_renew_lost_allowed == '0' ) %] >+ <option value="0" selected="selected"> >+ [% ELSE %] >+ <option value="0"> >+ [% END %] >+ Disallow renewal >+ </option> >+ </select> >+ </td> >+ <td> >+ <select name="renew_lost_found"> >+ [% IF ( default_renew_lost_found == '1' ) %] >+ <option value="1" selected="selected"> >+ [% ELSE %] >+ <option value="1"> >+ [% END %] >+ marks item found >+ </option> >+ [% IF ( default_renew_lost_found == '0' ) %] >+ <option value="0" selected="selected"> >+ [% ELSE %] >+ <option value="0"> >+ [% END %] >+ makes no change >+ </option> >+ </select> >+ </td> > <td class="actions"> > <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button> > [% IF ( default_checkout_hold_and_return_policy ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >index 606a11fb42e..328fe10996a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >@@ -169,6 +169,10 @@ > [% ELSIF error == 'recalled' %] > <p>This item has been recalled.</p> > >+ [% ELSIF error == "item_lost" %] >+ >+ <p>This item is lost.</p> >+ > [% ELSE %] > > [% error | html %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 996e466fc73..8b4a30c575f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -463,6 +463,8 @@ > )</span> > [% ELSIF ( ISSUE.on_reserve ) %] > <span class="usr-msg no-renew-hold">Not renewable <span class="renewals">(on hold)</span></span> >+ [% ELSIF ( ISSUE.item_lost ) %] >+ <span class="usr-msg no-renew-hold">Not renewable <span class="renewals">(item is lost)</span></span> > [% ELSIF ( ISSUE.too_many ) %] > <span class="usr-msg no-renew-too-many">Not renewable</span> > [% ELSIF ( ISSUE.too_unseen ) %] >-- >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 9805
:
16089
|
16090
|
16302
|
29214
|
37008
|
38430
|
38432
|
38433
|
45411
|
45412
|
45413
|
46539
|
46540
|
46541
|
47616
|
47617
|
47618
|
47619
|
48779
|
48780
|
48781
|
49091
|
49092
|
49093
|
49165
| 162473