Bugzilla – Attachment 37008 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 [QA Followup] - Control renewing and finding of list items via circ rules
Bug-9805-QA-Followup---Control-renewing-and-findin.patch (text/plain), 15.01 KB, created by
Kyle M Hall (khall)
on 2015-03-19 13:17:08 UTC
(
hide
)
Description:
Bug 9805 [QA Followup] - Control renewing and finding of list items via circ rules
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-03-19 13:17:08 UTC
Size:
15.01 KB
patch
obsolete
>From de89e290cf005909c2024f65af865cbd03e78802 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 19 Mar 2015 09:14:30 -0400 >Subject: [PATCH] Bug 9805 [QA Followup] - Control renewing and finding of list items via circ rules > >Test Plan: >1) Apply this patch >2) Run updatedatabase.pl >3) Browse to the circ rules >4) Note the "Renew lost?" and "Renewal marks lost found" rules >5) Set and test each of the rules both ways for the rules for all libraries >6) Repeat but for a specific branch this time >--- > C4/Circulation.pm | 25 ++++++++++-- > admin/smart-rules.pl | 43 +++++++++++--------- > installer/data/mysql/updatedatabase.pl | 18 ++++++++ > .../intranet-tmpl/prog/en/includes/strings.inc | 1 + > .../prog/en/modules/admin/smart-rules.tt | 42 +++++++++++++++++++- > .../intranet-tmpl/prog/en/modules/circ/renew.tt | 4 ++ > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 2 + > 7 files changed, 111 insertions(+), 24 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index e0cb5ec..b0cb4dc 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2743,6 +2743,14 @@ sub CanBookBeRenewed { > } > > return ( 0, "auto_renew" ) if $itemissue->{auto_renew}; >+ >+ if ( $item->{itemlost} ) { >+ my $schema = Koha::Database->new()->schema(); >+ my $rule = $schema->resultset('DefaultBranchCircRule')->single( { branchcode => $branchcode } ); >+ $rule ||= $schema->resultset('DefaultCircRule')->single(); >+ return ( 0, "item_lost" ) unless $rule->{renew_lost_allowed}; >+ } >+ > return ( 1, undef ); > } > >@@ -2824,10 +2832,19 @@ sub AddRenewal { > # Update the renewal count on the item, and tell zebra to reindex > $renews = $biblio->{'renewals'} + 1; > >+ my $schema = Koha::Database->new()->schema(); >+ my $rule = $schema->resultset('DefaultBranchCircRule')->single( { branchcode => _GetCircControlBranch( $item, $borrower ) } ); >+ $rule ||= $schema->resultset('DefaultCircRule')->single(); >+ > # If item was lost, it has now been found, reverse any list item charges if neccessary. >- if ( $item->{'itemlost'} ) { >- if ( C4::Context->preference('RefundLostItemFeeOnReturn') ) { >- _FixAccountForLostAndReturned( $item->{'itemnumber'}, undef, $item->{'barcode'} ); >+ my $itemlost = 0; >+ if ( $item->{itemlost} ) { >+ $itemlost = 1; >+ if ( $rule->renew_lost_found ) { >+ $itemlost = 0; >+ if ( C4::Context->preference('RefundLostItemFeeOnReturn') ) { >+ _FixAccountForLostAndReturned( $item->{itemnumber}, undef, $item->{barcode} ); >+ } > } > } > >@@ -2835,7 +2852,7 @@ sub AddRenewal { > { > renewals => $renews, > onloan => $datedue->strftime('%Y-%m-%d %H:%M'), >- itemlost => 0, >+ itemlost => $itemlost, > }, > $biblio->{'biblionumber'}, > $itemnumber >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 942e9bf..bf6a2d4 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -140,10 +140,13 @@ elsif ($op eq 'add') { > } > } > elsif ($op eq "set-branch-defaults") { >- my $categorycode = $input->param('categorycode'); >- my $maxissueqty = $input->param('maxissueqty'); >- my $holdallowed = $input->param('holdallowed'); >- my $returnbranch = $input->param('returnbranch'); >+ my $categorycode = $input->param('categorycode'); >+ my $maxissueqty = $input->param('maxissueqty'); >+ my $holdallowed = $input->param('holdallowed'); >+ my $returnbranch = $input->param('returnbranch'); >+ my $renew_lost_allowed = $input->param('renew_lost_allowed'); >+ my $renew_lost_found = $input->param('renew_lost_found'); >+ > $maxissueqty =~ s/\s//g; > $maxissueqty = undef if $maxissueqty !~ /^\d+/; > $holdallowed =~ s/\s//g; >@@ -153,34 +156,34 @@ elsif ($op eq "set-branch-defaults") { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM default_circ_rules"); > my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules >- (maxissueqty, holdallowed, returnbranch) >- VALUES (?, ?, ?)"); >+ (maxissueqty, holdallowed, returnbranch, renew_lost_allowed, renew_lost_found) >+ VALUES (?, ?, ?, ?, ?)"); > my $sth_update = $dbh->prepare("UPDATE default_circ_rules >- SET maxissueqty = ?, holdallowed = ?, returnbranch = ?"); >+ SET maxissueqty = ?, holdallowed = ?, returnbranch = ?, renew_lost_allowed = ?, renew_lost_found = ?"); > > $sth_search->execute(); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty, $holdallowed, $returnbranch); >+ $sth_update->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); > } else { >- $sth_insert->execute($maxissueqty, $holdallowed, $returnbranch); >+ $sth_insert->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); > } > } else { > my $sth_search = $dbh->prepare("SELECT count(*) AS total > FROM default_branch_circ_rules > WHERE branchcode = ?"); > my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules >- (branchcode, maxissueqty, holdallowed, returnbranch) >- VALUES (?, ?, ?, ?)"); >+ (branchcode, maxissueqty, holdallowed, returnbranch, renew_lost_allowed, renew_lost_found) >+ VALUES (?, ?, ?, ?, ?, ?)"); > my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules >- SET maxissueqty = ?, holdallowed = ?, returnbranch = ? >+ SET maxissueqty = ?, holdallowed = ?, returnbranch = ?, renew_lost_allowed = ?, renew_lost_found = ? > WHERE branchcode = ?"); > $sth_search->execute($branch); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($maxissueqty, $holdallowed, $returnbranch, $branch); >+ $sth_update->execute( $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found, $branch ); > } else { >- $sth_insert->execute($branch, $maxissueqty, $holdallowed, $returnbranch); >+ $sth_insert->execute( $branch, $maxissueqty, $holdallowed, $returnbranch, $renew_lost_allowed, $renew_lost_found ); > } > } > } >@@ -490,11 +493,13 @@ if ($branch eq "*") { > my $defaults = $sth_defaults->fetchrow_hashref; > > if ($defaults) { >- $template->param(default_holdallowed_none => 1) if($defaults->{holdallowed} == 0); >- $template->param(default_holdallowed_same => 1) if($defaults->{holdallowed} == 1); >- $template->param(default_holdallowed_any => 1) if($defaults->{holdallowed} == 2); >- $template->param(default_maxissueqty => $defaults->{maxissueqty}); >- $template->param(default_returnbranch => $defaults->{returnbranch}); >+ $template->param( default_holdallowed_none => 1 ) if ( $defaults->{holdallowed} == 0 ); >+ $template->param( default_holdallowed_same => 1 ) if ( $defaults->{holdallowed} == 1 ); >+ $template->param( default_holdallowed_any => 1 ) if ( $defaults->{holdallowed} == 2 ); >+ $template->param( default_maxissueqty => $defaults->{maxissueqty} ); >+ $template->param( default_returnbranch => $defaults->{returnbranch} ); >+ $template->param( default_renew_lost_allowed => $defaults->{renew_lost_allowed} ); >+ $template->param( default_renew_lost_found => $defaults->{renew_lost_found} ); > } > > $template->param(default_rules => ($defaults ? 1 : 0)); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index aa5bbbf..4ca4375 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9867,6 +9867,24 @@ if(CheckVersion($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q| >+ ALTER TABLE default_circ_rules >+ ADD renew_lost_allowed BOOLEAN NOT NULL DEFAULT '1', >+ ADD renew_lost_found BOOLEAN NOT NULL DEFAULT '0' >+ |); >+ >+ $dbh->do(q| >+ ALTER TABLE default_branch_circ_rules >+ ADD renew_lost_allowed BOOLEAN NOT NULL DEFAULT '1', >+ ADD renew_lost_found BOOLEAN NOT NULL DEFAULT '0' >+ |); >+ >+ print "Upgrade to $DBversion done (Bug 9805 - Lost items are un-lost if returned, but not if renewed.)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >index 20a0dad..9f4d64c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >@@ -16,6 +16,7 @@ > var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s"); > var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal"); > var NOT_RENEWABLE_AUTO_RENEW = _("Scheduled for automatic renewal"); >+ var ITEM_LOST = _("Item lost"); > var RENEWALS_REMAINING = _("%s of %s renewals remaining"); > var HOLD_IS_SUSPENDED = _("Hold is <strong>suspended</strong>"); > var UNTIL = _("until %s"); >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 8bc5809..da4916b 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 >@@ -287,7 +287,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > </form> > </div> > <div id="defaults-for-this-library" class="container"> >- <h3>Default checkout, hold and return policy[% IF ( humanbranch ) %] for [% humanbranch %][% END %]</h3> >+ <h3>Default checkout, hold, renewal and return policy[% IF ( humanbranch ) %] for [% humanbranch %][% END %]</h3> > <p>You can set a default maximum number of checkouts, hold policy and return policy that will be used if none is defined below for a particular item type or category.</p> > <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> > <input type="hidden" name="op" value="set-branch-defaults" /> >@@ -298,6 +298,8 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <th>Total current checkouts allowed</th> > <th>Hold policy</th> > <th>Return policy</th> >+ <th>Renew lost?</th> >+ <th>Renewal marks lost found</tH> > <th> </th> > <th> </th> > </tr> >@@ -354,6 +356,44 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > </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><input type="submit" value="Save" class="submit" /></td> > <td> > <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&categorycode=*&branch=[% current_branch %]">Unset</a> >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 e03247db..4e83f7c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >@@ -104,6 +104,10 @@ > > <p>[% borrower.firstname %] [% borrower.surname %] ( <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]"> [% borrower.cardnumber %] </a> ) is currently restricted.</p> > >+ [% ELSIF error == "item_lost" %] >+ >+ <p>This item is lost.</p> >+ > [% ELSE %] > > [% error %] >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 f4cbddb..ab70f7f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -238,6 +238,8 @@ > <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span> > [% ELSIF ( ISSUE.on_reserve ) %] > <span class="renewals">(On hold)</span> >+ [% ELSIF ( ISSUE.item_lost ) %] >+ <span class="renewals">(Item is lost)</span> > [% END %] > </td> > [% END %] >-- >1.7.2.5
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