Bugzilla – Attachment 42751 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.29 KB, created by
Eivin Giske Skaaren
on 2015-09-21 21:55:14 UTC
(
hide
)
Description:
Bug 14866: Make high holds work with different item types
Filename:
MIME Type:
Creator:
Eivin Giske Skaaren
Created:
2015-09-21 21:55:14 UTC
Size:
6.29 KB
patch
obsolete
>From 9414c62415a7de4ce97ecb08546b4227c48808fa 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 | 6 +++++- > 4 files changed, 24 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 e5f95f3..5ec20e7 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1021,6 +1021,22 @@ sub CanBookBeIssued { > returndate => output_pref($returndate), > }; > } >+ >+ # 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 9ef6ef6..d1f3987 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -128,6 +128,7 @@ elsif ($op eq 'add') { > my $rentaldiscount = $input->param('rentaldiscount'); > my $opacitemholds = $input->param('opacitemholds') || 0; > my $overduefinescap = $input->param('overduefinescap') || undef; >+ my $decreaseloanholds = $input->param('decreaseloanholds'); > $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty"; > > my $schema = Koha::Database->new()->schema(); >@@ -156,6 +157,7 @@ elsif ($op eq 'add') { > onshelfholds => $onshelfholds, > opacitemholds => $opacitemholds, > overduefinescap => $overduefinescap, >+ decreaseloanholds => $decreaseloanholds, > }; > > $rs->update_or_create($params); >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 84ffcd8..5b79724 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 >@@ -158,6 +158,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <th>Holds allowed (count)</th> > <th>On shelf holds allowed</th> > <th>Item level holds</th> >+ <th>Decrease loan holds (day)</th> > <th>Rental discount (%)</th> > <th colspan="2"> </th> > </tr> >@@ -222,7 +223,8 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <td>[% rule.reservesallowed %]</td> > <td>[% IF rule.onshelfholds %]Yes[% ELSE %]No[% END %]</td> > <td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td> >- <td>[% rule.rentaldiscount %]</td> >+ <td>[% rule.decreaseloanholds %]</td> >+ <td>[% rule.rentaldiscount %]</td> > <td><a href="#" class="editrule">Edit</a></td> > <td> > <a class="button" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete&itemtype=[% rule.itemtype %]&categorycode=[% rule.categorycode %]&branch=[% rule.current_branch %]">Delete</a> >@@ -292,6 +294,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <option value="F">Force</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 colspan="2"> > <input type="hidden" name="branch" value="[% current_branch %]"/> >@@ -320,6 +323,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <th>Holds allowed (count)</th> > <th>On shelf holds allowed</th> > <th>Item level holds</th> >+ <th>Decrease loan holds (day)</th> > <th>Rental discount (%)</th> > <th colspan="2"> </th> > </tr> >-- >1.7.10.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