Bugzilla – Attachment 53019 Details for
Bug 14048
Change RefundLostItemFeeOnReturn to be branch specific
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14048: Add a refund rules setting form in smart-rules
Bug-14048-Add-a-refund-rules-setting-form-in-smart.patch (text/plain), 7.59 KB, created by
Jonathan Druart
on 2016-07-01 14:47:38 UTC
(
hide
)
Description:
Bug 14048: Add a refund rules setting form in smart-rules
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-07-01 14:47:38 UTC
Size:
7.59 KB
patch
obsolete
>From 6638af2526b47ee7b606fb44b0f7ff2ffe438b5e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 3 Jun 2016 11:26:11 -0300 >Subject: [PATCH] Bug 14048: Add a refund rules setting form in smart-rules > >This patch introduces the CRUD UI for managing the refund lost item fee >rules on the general 'Circulation and fines rules' page. > >Verify that rules can be added and changed. > >Rules are correctly associated to the chosen branch (or the >general default rule). > >To test: >- Apply the patch >- Open smart-rules.pl >=> SUCCESS: The text and refund rules section correctly refers to default global rules. > The policy can be set to Yes and No, and works as expected. >- Pick a specific branch >=> SUCCESS: The rule refers to the specific branch >=> SUCCESS: It detects the default rule is picked >=> SUCCESS: On changing the rules values are correctly retrieved if entering > again to the page. >=> SUCCESS: The 'Use default' text is suffixed with the correct value set by the user > in the 'All libraries' scenario. >=> Sign off :-D > >Sponsored-by: DoverNet >Sponsored-by: South-East Kansas Library System >Sponsored-by: SWITCH Library Consortium > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Jason Robb <jrobb@sekls.org> >Signed-off-by: Jennifer Schmidt <jschmidt@switchinc.org> >Signed-off-by: Margaret Thrasher <p.thrasher@dover.nh.gov> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > admin/smart-rules.pl | 34 +++++++++ > .../prog/en/modules/admin/smart-rules.tt | 81 ++++++++++++++++++++++ > 2 files changed, 115 insertions(+) > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 11a5637..9d2d0fd 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -30,6 +30,9 @@ use Koha::DateUtils; > use Koha::Database; > use Koha::IssuingRule; > use Koha::IssuingRules; >+use Koha::Logger; >+use Koha::RefundLostItemFeeRule; >+use Koha::RefundLostItemFeeRules; > use Koha::Libraries; > > my $input = CGI->new; >@@ -423,6 +426,37 @@ elsif ($op eq "add-branch-item") { > } > } > } >+elsif ( $op eq 'mod-refund-lost-item-fee-rule' ) { >+ >+ my $refund = $input->param('refund'); >+ >+ if ( $refund eq '*' ) { >+ if ( $branch ne '*' ) { >+ # only do something for $refund eq '*' if branch-specific >+ eval { >+ # Delete it so it picks the default >+ Koha::RefundLostItemFeeRules->find({ >+ branchcode => $branch >+ })->delete; >+ }; >+ } >+ } else { >+ my $refundRule = >+ Koha::RefundLostItemFeeRules->find({ >+ branchcode => $branch >+ }) // Koha::RefundLostItemFeeRule->new; >+ $refundRule->set({ >+ branchcode => $branch, >+ refund => $refund >+ })->store; >+ } >+} >+ >+my $refundLostItemFeeRule = Koha::RefundLostItemFeeRules->find({ branchcode => $branch }); >+$template->param( >+ refundLostItemFeeRule => $refundLostItemFeeRule, >+ defaultRefundRule => Koha::RefundLostItemFeeRules->_default_rule >+); > > my $branches = GetBranches(); > my @branchloop; >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 fea01f3..8d197af 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 >@@ -2,6 +2,7 @@ > <title>Koha › Administration › Circulation and fine rules</title> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] >+[% USE Branches %] > <script type="text/javascript"> > //<![CDATA[ > >@@ -557,6 +558,86 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > </form> > </div> > [% END %] >+ >+ <div id="refund-lost-item-fee-on-return" class="container"> >+ [% IF current_branch == '*' %] >+ <h3>Default lost item fee refund on return policy</h3> >+ [% ELSE %] >+ <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) %]</h3> >+ [% END %] >+ <p>Specify the default policy for lost item fees on return. >+ </p> >+ <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl"> >+ <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" /> >+ <input type="hidden" name="branch" value="[% current_branch %]" /> >+ <table> >+ <tr> >+ <th>Refund lost item fee</th> >+ <th> </th> >+ </tr> >+ <tr> >+ <td> >+ <select name="refund"> >+ [#% Default branch %#] >+ [% IF ( current_branch == '*' ) %] >+ [% IF ( refundLostItemFeeRule.refund ) %] >+ <option value="1" selected="selected"> >+ [% ELSE %] >+ <option value="1"> >+ [% END %] >+ Yes >+ </option> >+ [% IF ( not refundLostItemFeeRule.refund ) %] >+ <option value="0" selected="selected"> >+ [% ELSE %] >+ <option value="0"> >+ [% END %] >+ No >+ </option> >+ [% ELSE %] >+ [#% Branch-specific %#] >+ [% IF ( not refundLostItemFeeRule ) %] >+ <option value="*" selected="selected"> >+ [% ELSE %] >+ <option value="*"> >+ [% END %] >+ [% IF defaultRefundRule %] >+ Use default (Yes) >+ [% ELSE %] >+ Use default (No) >+ [% END %] >+ </option> >+ [% IF ( not refundLostItemFeeRule ) %] >+ <option value="1">Yes</option> >+ <option value="0">No</option> >+ [% ELSE %] >+ [% IF ( refundLostItemFeeRule.refund ) %] >+ <option value="1" selected="selected"> >+ [% ELSE %] >+ <option value="1"> >+ [% END %] >+ Yes >+ </option> >+ [% IF ( not refundLostItemFeeRule.refund ) %] >+ <option value="0" selected="selected"> >+ [% ELSE %] >+ <option value="0"> >+ [% END %] >+ No >+ </option> >+ [% END %] >+ [% END %] >+ </select> >+ </td> >+ <td class="actions"> >+ <button type="submit" class="btn btn-mini"><i class="fa fa-save"></i> Save</button> >+ </td> >+ </td> >+ </tr> >+ </table> >+ </form> >+ </div> >+ > <div id="holds-policy-by-item-type" class="container"> > <h3>[% IF humanbranch %]Holds policy by item type for [% humanbranch %][% ELSE %]Default holds policy by item type[% END %]</h3> > <p> >-- >2.8.1
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 14048
:
52016
|
52017
|
52018
|
52019
|
52020
|
52169
|
52170
|
52202
|
52203
|
52286
|
52287
|
52288
|
52289
|
52290
|
52291
|
52292
|
52293
|
52306
|
52444
|
52445
|
52446
|
52447
|
52448
|
52449
|
52450
|
52451
|
52482
|
52658
|
52659
|
52660
|
52661
|
52662
|
52663
|
52664
|
52665
|
52666
|
52667
|
52668
|
52748
|
52749
|
52750
|
52751
|
52752
|
52753
|
52754
|
52755
|
52756
|
52757
|
52835
|
52836
|
52837
|
52838
|
52839
|
52840
|
52841
|
52842
|
52843
|
52844
|
52876
|
52883
|
52894
|
53017
|
53018
| 53019 |
53020
|
53021
|
53022
|
53023
|
53024
|
53025
|
53026
|
53027
|
53028
|
53029