Bugzilla – Attachment 89349 Details for
Bug 18928
Move `holdallowed`, `hold_fulfillment_policy` and `returnbranch` into the `circulation_rules` table.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18928: Add Branches.HasCirculationRules and set branchcode in CirculationRules.Search
Bug-18928-Add-BranchesHasCirculationRules-and-set-.patch (text/plain), 5.04 KB, created by
Agustín Moyano
on 2019-05-04 07:31:36 UTC
(
hide
)
Description:
Bug 18928: Add Branches.HasCirculationRules and set branchcode in CirculationRules.Search
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-05-04 07:31:36 UTC
Size:
5.04 KB
patch
obsolete
>From 117dcf4c0134f672eeb46faa4f9033c407d2096e Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Sat, 4 May 2019 04:03:20 -0300 >Subject: [PATCH] Bug 18928: Add Branches.HasCirculationRules and set > branchcode in CirculationRules.Search > >This patch tackles two issues: >1) Defaults row always says (not set) because "default_rules" param was deleted from smart-rules.pl. >2) When setting standard hold rules for all libraries, hold policy, pickup and return always says 'Not Set' even if you defined values. This is because "current_branch" variable was used in CirculationRules.Search, and current_branch value for default is "*". > >Solutions: >1) Add Koha::Template::Plugin::Branches->HasCirculationRules method that returns 1 if defined branch has circulation rules. >2) Switch "current_branch" for "branchcode" whose value is undef for default rules. > >To test: >1) Apply previous patches >2) set default values for all libraries >CHECK => hold policy, pickup and return remains in 'Not set' >3) select a library >4) set values for that library >CHECK => first column always says "Defaults (not set)" >5) Apply this patch >SUCCESS => Hold, pickup and return default values for all libraries are now shown > => First column of default rules, and of the library selected in step 3 only says "Defaults" >6) Sign off >--- > Koha/Template/Plugin/Branches.pm | 13 +++++++++++++ > .../intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 10 ++++++---- > 2 files changed, 19 insertions(+), 4 deletions(-) > >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index da615f5673..23c98441bf 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -105,4 +105,17 @@ sub pickup_locations { > return $libraries; > } > >+sub HasCirculationRules { >+ my ( $self, $branchcode) = @_; >+ >+ $branchcode = undef if $branchcode eq q{}; >+ >+ my @rules = Koha::CirculationRules->search( >+ { >+ branchcode => $branchcode >+ } >+ ); >+ >+ return scalar(@rules) > 1; >+} > 1; >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 fac20ae7fd..1a32c1b8cf 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 >@@ -397,6 +397,7 @@ > <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> > <input type="hidden" name="op" value="set-branch-defaults" /> > <input type="hidden" name="branch" value="[% current_branch | html %]"/> >+ > <table> > <tr> > <th> </th> >@@ -409,6 +410,7 @@ > <th>Actions</th> > </tr> > <tr> >+ [% SET default_rules = Branches.HasCirculationRules( branchcode ) %] > <td><em>Defaults[% UNLESS ( default_rules ) %] (not set)[% END %]</em></td> > <td> > [% SET patron_maxissueqty = CirculationRules.Get( branchcode, undef, undef, 'patron_maxissueqty' ) %] >@@ -419,12 +421,12 @@ > <input type="text" name="patron_maxonsiteissueqty" size="3" value="[% patron_maxonsiteissueqty | html %]"/> > </td> > <td> >- [% SET rule_value = CirculationRules.Get( current_branch, '*', undef, 'max_holds' ) %] >+ [% SET rule_value = CirculationRules.Get( branchcode, '*', undef, 'max_holds' ) %] > <input name="max_holds" size="3" value="[% rule_value | html %]" /> > </td> > <td> > <select name="holdallowed"> >- [% SET holdallowed = CirculationRules.Search( current_branch, undef, undef, 'holdallowed' ) %] >+ [% SET holdallowed = CirculationRules.Search( branchcode, undef, undef, 'holdallowed' ) %] > <option value=""> > Not set > </option> >@@ -456,7 +458,7 @@ > </td> > <td> > <select name="hold_fulfillment_policy"> >- [% SET hold_fulfillment_policy = CirculationRules.Search( current_branch, undef, undef, 'hold_fulfillment_policy' ) %] >+ [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, undef, 'hold_fulfillment_policy' ) %] > > <option value=""> > Not set >@@ -495,7 +497,7 @@ > </td> > <td> > <select name="returnbranch"> >- [% SET returnbranch = CirculationRules.Search( current_branch, undef, undef, 'returnbranch' ) %] >+ [% SET returnbranch = CirculationRules.Search( branchcode, undef, undef, 'returnbranch' ) %] > > <option value=""> > Not set >-- >2.11.0
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 18928
:
65241
|
65242
|
71005
|
71006
|
81096
|
81097
|
81098
|
81099
|
82933
|
82934
|
82935
|
82936
|
85487
|
85488
|
85489
|
85490
|
85491
|
86134
|
86135
|
86136
|
86137
|
86138
|
86139
|
88659
|
89017
|
89018
|
89019
|
89020
|
89021
|
89022
|
89023
|
89024
|
89333
|
89334
|
89336
|
89338
|
89339
|
89340
|
89341
|
89342
|
89343
|
89344
|
89345
|
89346
|
89347
|
89348
|
89349
|
89377
|
89402
|
89427
|
89428
|
89429
|
89430
|
89431
|
89432
|
89433
|
89434
|
89435
|
89436
|
89437
|
89438
|
89440
|
89441
|
89442
|
89443
|
89444
|
89445
|
89446
|
89447
|
89448
|
89449
|
89450
|
89451
|
89628
|
89629
|
89630
|
89631
|
89632
|
89633
|
89634
|
89635
|
89636
|
89637
|
89638
|
90501
|
91082
|
91083
|
91084
|
91085
|
91086
|
91087
|
91088
|
91089
|
91090
|
91091
|
91092
|
91093
|
91094