Bugzilla – Attachment 75863 Details for
Bug 14866
Make high holds work with different item types and number of open days
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14866: [FOLLOW-UP] Make high holds work with different item types
Bug-14866-FOLLOW-UP-Make-high-holds-work-with-diff.patch (text/plain), 22.14 KB, created by
Aleisha Amohia
on 2018-06-07 03:10:11 UTC
(
hide
)
Description:
Bug 14866: [FOLLOW-UP] Make high holds work with different item types
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2018-06-07 03:10:11 UTC
Size:
22.14 KB
patch
obsolete
>From 6e535354448a27ad29bfe6295d23d35ae70b05c3 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 21 Dec 2016 00:25:50 +0000 >Subject: [PATCH] Bug 14866: [FOLLOW-UP] Make high holds work with different > item types > >This patch fixes merge conflicts, fixes the indentation of the table in >smart-rules.tt and uses Koha::IssuingRules->get_effective_issuing_rule. > >Keep in mind - I am sure that when the original patch for this was >written (before get_effective_issuing_rule was used), it all worked >fine. I had to add an extra line of code in my patch to get this method >to work because it was fetching the WRONG circulation rule - one that >did not have decreaseloanholds defined. I don't know if it was my patch >that is broken or the get_effective_issuing_rule method that is not >fetching the 'most specific/relevant' rule. > >Sponsored-by: Region Halland >--- > C4/Circulation.pm | 13 +- > Koha/Schema/Result/Issuingrule.pm | 11 +- > admin/smart-rules.pl | 2 +- > .../bug_14866-add_decreaseloanholds.sql | 2 +- > installer/data/mysql/kohastructure.sql | 11 +- > .../prog/en/modules/admin/smart-rules.tt | 239 +++++++++++---------- > 6 files changed, 146 insertions(+), 132 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 242d673..bd50b91 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -23,7 +23,6 @@ use strict; > #use warnings; FIXME - Bug 2505 > use DateTime; > use POSIX qw( floor ); >-use Koha::DateUtils; > use C4::Context; > use C4::Stats; > use C4::Reserves; >@@ -1049,14 +1048,20 @@ sub CanBookBeIssued { > # Decrease loan period for item if rule exist in smart-rules.pl > # Overrides decreaseLoanHighHoldsValue syspref > my $branch = _GetCircControlBranch($item,$borrower); >- my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branch); >- my $issuedate = DateTime->now( time_zone => C4::Context->tz() ); >+ my $issuingrule = Koha::IssuingRules->get_effective_issuing_rule( >+ { categorycode => $borrower->{categorycode}, >+ itemtype => $item->{itype}, >+ branchcode => $branch >+ } >+ ); >+ my $issuedate = dt_from_string(); > my $calendar = Koha::Calendar->new( branchcode => $branch ); >+ $issuingrule->{decreaseloanholds} = 0 if not defined $issuingrule->{decreaseloanholds}; > my $reduced_datedue = $calendar->addDate( $issuedate, $issuingrule->{decreaseloanholds} ); > > if ( defined($issuingrule->{decreaseloanholds}) ) { > $needsconfirmation{HIGHHOLDS} = { >- num_holds => $num, >+ num_holds => $issuingrule->{outstanding}, > duration => $issuingrule->{decreaseloanholds}, > returndate => output_pref($reduced_datedue), > } >diff --git a/Koha/Schema/Result/Issuingrule.pm b/Koha/Schema/Result/Issuingrule.pm >index 5958055..ed683b5 100644 >--- a/Koha/Schema/Result/Issuingrule.pm >+++ b/Koha/Schema/Result/Issuingrule.pm >@@ -221,6 +221,11 @@ __PACKAGE__->table("issuingrules"); > extra: {list => ["no","yes","bib_only","item_only"]} > is_nullable: 0 > >+=head2 decreaseloanholds >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ > =cut > > __PACKAGE__->add_columns( >@@ -302,6 +307,8 @@ __PACKAGE__->add_columns( > extra => { list => ["no", "yes", "bib_only", "item_only"] }, > is_nullable => 0, > }, >+ "decreaseloanholds", >+ { data_type => "integer", is_nullable => 1 }, > ); > > =head1 PRIMARY KEY >@@ -321,8 +328,8 @@ __PACKAGE__->add_columns( > __PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype"); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-12-13 12:44:30 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VBD8atc/D/6rN0D+aTaSOQ >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-06-07 03:02:31 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wRqrq6dJHXE+ocOQKhnKnA > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index ebd255b..00cbfb4 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -160,7 +160,7 @@ elsif ($op eq 'add') { > my $article_requests = $input->param('article_requests') || 'no'; > my $overduefinescap = $input->param('overduefinescap') || undef; > my $cap_fine_to_replacement_price = $input->param('cap_fine_to_replacement_price') eq 'on'; >- my $decreaseloanholds = $input->param('decreaseloanholds'); >+ my $decreaseloanholds = $input->param('decreaseloanholds') || undef; > $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price"; > > my $params = { >diff --git a/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql b/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql >index c041a1c..f38c199 100644 >--- a/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql >+++ b/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql >@@ -1 +1 @@ >-ALTER TABLE issuingrules ADD decreaseloanholds INTEGER; >+ALTER IGNORE TABLE issuingrules ADD decreaseloanholds INTEGER(11) DEFAULT NULL AFTER `article_requests`; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 909eda2..c1d4de9 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -858,11 +858,12 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules > `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed > `holds_per_record` SMALLINT(6) NOT NULL DEFAULT 1, -- How many holds a patron can have on a given bib > `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode) >- overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine >- cap_fine_to_replacement_price BOOLEAN NOT NULL DEFAULT '0', -- cap the fine based on item's replacement price >- onshelfholds tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf >- opacitemholds char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold >- article_requests enum('no','yes','bib_only','item_only') NOT NULL DEFAULT 'no', -- allow article requests to be placed, >+ `overduefinescap` decimal(28,6) default NULL, -- the maximum amount of an overdue fine >+ `cap_fine_to_replacement_price` BOOLEAN NOT NULL DEFAULT '0', -- cap the fine based on item's replacement price >+ `onshelfholds` tinyint(1) NOT NULL default 0, -- allow holds for items that are on shelf >+ `opacitemholds` char(1) NOT NULL default 'N', -- allow opac users to place specific items on hold >+ `article_requests` enum('no','yes','bib_only','item_only') NOT NULL DEFAULT 'no', -- allow article requests to be placed, >+ `decreaseloanholds` int(11) default NULL, > PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`), > KEY `categorycode` (`categorycode`), > KEY `itemtype` (`itemtype`) >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 f4dd8bc..0b93236 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 >@@ -97,129 +97,130 @@ > </tr> > </thead> > <tbody> >- [% FOREACH rule IN rules %] >- <tr id="row_[% loop.count %]"> >- <td>[% IF ( rule.default_humancategorycode ) %] >- <em>All</em> >- [% ELSE %] >- [% rule.humancategorycode %] >- [% END %] >- </td> >- <td>[% IF rule.default_translated_description %] >- <em>All</em> >- [% ELSE %] >- [% rule.translated_description %] >- [% END %] >- </td> >- <td class="actions"> >- <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a> >- <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a> >- </td> >- >- <td>[% IF ( rule.unlimited_maxissueqty ) %] >- <span>Unlimited</span> >- [% ELSE %] >- [% rule.maxissueqty %] >- [% END %] >- </td> >- <td>[% IF rule.unlimited_maxonsiteissueqty %] >- <span>Unlimited</span> >- [% ELSE %] >- [% rule.maxonsiteissueqty %] >- [% END %] >- </td> >- <td>[% rule.issuelength %]</td> >- <td> >- [% rule.lengthunit %] >- </td> >- <td> >- [% IF ( rule.hardduedate ) %] >+ [% FOREACH rule IN rules %] >+ <tr id="row_[% loop.count %]"> >+ <td> >+ [% IF ( rule.default_humancategorycode ) %] >+ <em>All</em> >+ [% ELSE %] >+ [% rule.humancategorycode %] >+ [% END %] >+ </td> >+ <td> >+ [% IF rule.default_translated_description %] >+ <em>All</em> >+ [% ELSE %] >+ [% rule.translated_description %] >+ [% END %] >+ </td> >+ <td class="actions"> >+ <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a> >+ <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a> >+ </td> >+ <td> >+ [% IF ( rule.unlimited_maxissueqty ) %] >+ <span>Unlimited</span> >+ [% ELSE %] >+ [% rule.maxissueqty %] >+ [% END %] >+ </td> >+ <td> >+ [% IF rule.unlimited_maxonsiteissueqty %] >+ <span>Unlimited</span> >+ [% ELSE %] >+ [% rule.maxonsiteissueqty %] >+ [% END %] >+ </td> >+ <td>[% rule.issuelength %]</td> >+ <td>[% rule.lengthunit %]<td> >+ <td> >+ [% IF ( rule.hardduedate ) %] > [% IF ( rule.hardduedatebefore ) %] >- before [% rule.hardduedate %] >- <input type="hidden" name="hardduedatecomparebackup" value="-1" /> >+ before [% rule.hardduedate %] >+ <input type="hidden" name="hardduedatecomparebackup" value="-1" /> > [% ELSIF ( rule.hardduedateexact ) %] >- on [% rule.hardduedate %] >- <input type="hidden" name="hardduedatecomparebackup" value="0" /> >+ on [% rule.hardduedate %] >+ <input type="hidden" name="hardduedatecomparebackup" value="0" /> > [% ELSIF ( rule.hardduedateafter ) %] >- after [% rule.hardduedate %] >- <input type="hidden" name="hardduedatecomparebackup" value="1" /> >+ after [% rule.hardduedate %] >+ <input type="hidden" name="hardduedatecomparebackup" value="1" /> > [% END %] >- [% ELSE %] >+ [% ELSE %] > <span>None defined</span> >- [% END %] >- </td> >- <td>[% rule.fine %]</td> >- <td>[% rule.chargeperiod %]</td> >- <td> >- [% IF rule.chargeperiod_charge_at %] >- <span>Start of interval</span> >- [% ELSE %] >- <span>End of interval</span> >- [% END %] >- </td> >- <td>[% rule.firstremind %]</td> >- <td>[% rule.overduefinescap FILTER format("%.2f") %]</td> >- <td> >- [% IF rule.cap_fine_to_replacement_price %] >- <input type="checkbox" checked="checked" disabled="disabled" /> >- [% ELSE %] >- <input type="checkbox" disabled="disabled" /> >- [% END %] >- </td> >- <td>[% rule.finedays %]</td> >- <td>[% rule.maxsuspensiondays %]</td> >- <td>[% rule.suspension_chargeperiod %]</td> >- <td>[% rule.renewalsallowed %]</td> >- <td>[% rule.renewalperiod %]</td> >- <td>[% rule.norenewalbefore %]</td> >- <td> >- [% IF ( rule.auto_renew ) %] >- <span>Yes</span> >- [% ELSE %] >- <span>No</span> >- [% END %] >- </td> >- <td>[% rule.no_auto_renewal_after %]</td> >- <td>[% rule.no_auto_renewal_after_hard_limit %]</td> >- <td>[% rule.reservesallowed %]</td> >- <td>[% rule.holds_per_record %]</td> >- <td> >- [% IF rule.onshelfholds == 1 %] >- <span>Yes</span> >- [% ELSIF rule.onshelfholds == 2 %] >- <span>If all unavailable</span> >- [% ELSE %] >- <span>If any unavailable</span> >- [% END %] >- </td> >- <td> >- [% IF rule.opacitemholds == 'F'%] >- <span>Force</span> >- [% ELSIF rule.opacitemholds == 'Y'%] >- <span>Allow</span> >- [% ELSE %] >- <span>Don't allow</span> >- [% END %] >- </td> >- <td>[% rule.decreaseloanholds %]</td> >- <td> >- [% IF rule.article_requests == 'no' %] >- <span>No</span> >- [% ELSIF rule.article_requests == 'yes' %] >- <span>Yes</span> >- [% ELSIF rule.article_requests == 'bib_only' %] >- <span>Record only</span> >- [% ELSIF rule.article_requests == 'item_only' %] >- <span>Item only</span> >- [% END %] >- </td> >- <td>[% rule.rentaldiscount %]</td> >- <td class="actions"> >- <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a> >- <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a> >- </td> >- </tr> >- [% END %] >+ [% END %] >+ </td> >+ <td>[% rule.fine %]</td> >+ <td>[% rule.chargeperiod %]</td> >+ <td> >+ [% IF rule.chargeperiod_charge_at %] >+ <span>Start of interval</span> >+ [% ELSE %] >+ <span>End of interval</span> >+ [% END %] >+ </td> >+ <td>[% rule.firstremind %]</td> >+ <td>[% rule.overduefinescap FILTER format("%.2f") %]</td> >+ <td> >+ [% IF rule.cap_fine_to_replacement_price %] >+ <input type="checkbox" checked="checked" disabled="disabled" /> >+ [% ELSE %] >+ <input type="checkbox" disabled="disabled" /> >+ [% END %] >+ </td> >+ <td>[% rule.finedays %]</td> >+ <td>[% rule.maxsuspensiondays %]</td> >+ <td>[% rule.suspension_chargeperiod %]</td> >+ <td>[% rule.renewalsallowed %]</td> >+ <td>[% rule.renewalperiod %]</td> >+ <td>[% rule.norenewalbefore %]</td> >+ <td> >+ [% IF ( rule.auto_renew ) %] >+ <span>Yes</span> >+ [% ELSE %] >+ <span>No</span> >+ [% END %] >+ </td> >+ <td>[% rule.no_auto_renewal_after %]</td> >+ <td>[% rule.no_auto_renewal_after_hard_limit %]</td> >+ <td>[% rule.reservesallowed %]</td> >+ <td>[% rule.holds_per_record %]</td> >+ <td> >+ [% IF rule.onshelfholds == 1 %] >+ <span>Yes</span> >+ [% ELSIF rule.onshelfholds == 2 %] >+ <span>If all unavailable</span> >+ [% ELSE %] >+ <span>If any unavailable</span> >+ [% END %] >+ </td> >+ <td> >+ [% IF rule.opacitemholds == 'F'%] >+ <span>Force</span> >+ [% ELSIF rule.opacitemholds == 'Y'%] >+ <span>Allow</span> >+ [% ELSE %] >+ <span>Don't allow</span> >+ [% END %] >+ </td> >+ <td>[% rule.decreaseloanholds %]</td> >+ <td> >+ [% IF rule.article_requests == 'no' %] >+ <span>No</span> >+ [% ELSIF rule.article_requests == 'yes' %] >+ <span>Yes</span> >+ [% ELSIF rule.article_requests == 'bib_only' %] >+ <span>Record only</span> >+ [% ELSIF rule.article_requests == 'item_only' %] >+ <span>Item only</span> >+ [% END %] >+ </td> >+ <td>[% rule.rentaldiscount %]</td> >+ <td class="actions"> >+ <a href="#" class="editrule btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a> >+ <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]"><i class="fa fa-trash"></i> Delete</a> >+ </td> >+ </tr> >+ [% END %] > <tr id="edit_row"> > <td> > <select name="categorycode" id="categorycode"> >@@ -344,7 +345,7 @@ > <th>No renewal before</th> > <th>Automatic renewal</th> > <th>No automatic renewal after</th> >- <th>No automatic renewal after (hard limit)</th> >+ <th>No automatic renewal after (hard limit)</th> > <th>Holds allowed (count)</th> > <th>Holds per record (count)</th> > <th>On shelf holds allowed</th> >-- >2.1.4
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 14866
:
42751
|
58324
|
75861
|
75862
|
75863
|
103323
|
103427
|
110149
|
110224
|
110441
|
111937
|
111938
|
112225
|
112226
|
112936