Bugzilla – Attachment 180513 Details for
Bug 39540
Add a warning in the circ rules page if a plugin overrides rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39540: Add a warning to the circulation rules page if CalcFine is overwritten.
Bug-39540-Add-a-warning-to-the-circulation-rules-p.patch (text/plain), 2.72 KB, created by
Raphael Straub
on 2025-04-03 13:02:21 UTC
(
hide
)
Description:
Bug 39540: Add a warning to the circulation rules page if CalcFine is overwritten.
Filename:
MIME Type:
Creator:
Raphael Straub
Created:
2025-04-03 13:02:21 UTC
Size:
2.72 KB
patch
obsolete
>From b9ad84ef87c88dc6ebce1a63b687e0b1ac47e675 Mon Sep 17 00:00:00 2001 >From: Raphael Straub <raphael.straub@kit.edu> >Date: Thu, 3 Apr 2025 09:55:02 +0000 >Subject: [PATCH] Bug 39540: Add a warning to the circulation rules page if > CalcFine is overwritten. > >This patch adds a warning to the "Circulation and fine rules" page in >"Koha administration" if there is an enabled plugin that implements the >overwrite_calc_fine plugin hook. > >To test: >1) Apply the patch. >2) In your browser go to > /cgi-bin/koha/admin/smart-rules.pl > and check that there is no warning on the top of the page. >3) Install a plugin that implements overwrite_calc_fine. >4) Reload /cgi-bin/koha/admin/smart-rules.pl and check > that now there is a warning that displays the installed > plugin's name. > >Sponsored-by: Karlsruhe Institute of Technology (KIT) >--- > admin/smart-rules.pl | 11 +++++++++++ > .../prog/en/modules/admin/smart-rules.tt | 10 ++++++++++ > 2 files changed, 21 insertions(+) > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index f0f358ccb1..65d0c0b056 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -30,6 +30,7 @@ use Koha::CirculationRules; > use Koha::Patron::Categories; > use Koha::Caches; > use Koha::Patrons; >+use Koha::Plugins; > > my $input = CGI->new; > my $dbh = C4::Context->dbh; >@@ -791,6 +792,16 @@ while ( my $r = $all_rules->next ) { > $rules->{ $r->{categorycode} // q{} }->{ $r->{itemtype} // q{} }->{ $r->{rule_name} } = $r->{rule_value}; > } > >+if ( C4::Context->config("enable_plugins") ) { >+ $template->param( >+ overwrite_calc_fine_plugins => Koha::Plugins->new->GetPlugins( >+ { >+ method => 'overwrite_calc_fine', >+ } >+ ) >+ ); >+} >+ > $template->param( show_branch_cat_rule_form => 1 ); > > $template->param( >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 9ce8a43dbd..070b2e2835 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 >@@ -50,6 +50,16 @@ > [% END %] > </h1> > >+ [% IF overwrite_calc_fine_plugins.size %] >+ <div class="alert alert-warning"> >+ The standard fine calculation is overwritten by the following plugin(s): >+ [% FOREACH plugin IN overwrite_calc_fine_plugins %] >+ [%- ", " | html IF !loop.first -%] >+ [%- plugin.get_metadata.name | html -%] >+ [%- END -%] >+ </div> >+ [% END %] >+ > <div class="page-section bg-info"> > <p>The rules are applied from most specific to less specific, using the first found in this order:</p> > <ul> >-- >2.39.5
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 39540
:
180487
|
180503
|
180513
|
180518