Bugzilla – Attachment 75861 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: Make high holds work with different item types
Bug-14866-Make-high-holds-work-with-different-item.patch (text/plain), 6.50 KB, created by
Aleisha Amohia
on 2018-06-07 03:05:25 UTC
(
hide
)
Description:
Bug 14866: Make high holds work with different item types
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2018-06-07 03:05:25 UTC
Size:
6.50 KB
patch
obsolete
>From 2ccafb604601551094182b62deb62dfa88dab93a Mon Sep 17 00:00:00 2001 >From: Eivin Giske Skaaren <eivin@sysmystic.com> >Date: Mon, 21 Sep 2015 21:45:24 +0000 >Subject: [PATCH] Bug 14866: Make high holds work with different item types > >This patch adds the possibility to set decreased loan periods for >high holds items in issuingrules via smart-rules.pl. > >If a rule exist with a value set for a high holds item and the >decreaseLoanHighHolds syspref is active then the value of the rule >will be used instead of the syspref value. > >To test: > >1. Create testbranch, dump mysql as needed.. > >2. Apply patch > >3. Update database >perl installer/data/mysql/updatedatabase.pl >misc/devel/update_dbix_class_files.pl --db_name=koha_instance --db_user=koha_instance --db_passwd=thepassword > >4. Enable decreaseLoanHighHolds sysprefs if not already active > >5. Create rule for library/item in http://your_staff_client/cgi-bin/koha/admin/smart-rules.pl >Set Decrease loan holds to your wanted value. > >6. Check out an item with holds and see that the value from the rule is used instead of the syspref >--- > C4/Circulation.pm | 16 ++++++++++++++++ > admin/smart-rules.pl | 2 ++ > .../atomicupdate/bug_14866-add_decreaseloanholds.sql | 1 + > .../intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 5 ++++- > 4 files changed, 23 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 7bd789c..242d673 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1045,6 +1045,22 @@ 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 $calendar = Koha::Calendar->new( branchcode => $branch ); >+ my $reduced_datedue = $calendar->addDate( $issuedate, $issuingrule->{decreaseloanholds} ); >+ >+ if ( defined($issuingrule->{decreaseloanholds}) ) { >+ $needsconfirmation{HIGHHOLDS} = { >+ num_holds => $num, >+ duration => $issuingrule->{decreaseloanholds}, >+ returndate => output_pref($reduced_datedue), >+ } >+ } > } > > if ( >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index fe0c9c2..ebd255b 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -160,6 +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'); > $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price"; > > my $params = { >@@ -193,6 +194,7 @@ elsif ($op eq 'add') { > overduefinescap => $overduefinescap, > cap_fine_to_replacement_price => $cap_fine_to_replacement_price, > article_requests => $article_requests, >+ decreaseloanholds => $decreaseloanholds, > }; > > my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br}); >diff --git a/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql b/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql >new file mode 100644 >index 0000000..c041a1c >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14866-add_decreaseloanholds.sql >@@ -0,0 +1 @@ >+ALTER TABLE issuingrules ADD decreaseloanholds INTEGER; >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 86226cb..f4dd8bc 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 >@@ -91,6 +91,7 @@ > <th>On shelf holds allowed</th> > <th>Item level holds</th> > <th>Article requests</th> >+ <th>Decrease loan holds (day)</th> > <th>Rental discount (%)</th> > <th>Actions</th> > </tr> >@@ -200,6 +201,7 @@ > <span>Don't allow</span> > [% END %] > </td> >+ <td>[% rule.decreaseloanholds %]</td> > <td> > [% IF rule.article_requests == 'no' %] > <span>No</span> >@@ -216,7 +218,6 @@ > <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"> >@@ -311,6 +312,7 @@ > <option value="item_only">Item only</option> > </select> > </td> >+ <td><input type="text" name="decreaseloanholds" id="decreaseloanholds" size="2"/></td> > <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td> > <td class="actions"> > <input type="hidden" name="branch" value="[% current_branch %]"/> >@@ -348,6 +350,7 @@ > <th>On shelf holds allowed</th> > <th>Item level holds</th> > <th>Article requests</th> >+ <th>Decrease loan holds (day)</th> > <th>Rental discount (%)</th> > <th> </th> > </tr> >-- >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