Bugzilla – Attachment 112057 Details for
Bug 15522
New interface for revamped circulation rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15522: (Vue alternative) Add policy template and scripts
Bug-15522-Vue-alternative-Add-policy-template-and-.patch (text/plain), 8.10 KB, created by
Agustín Moyano
on 2020-10-20 17:17:26 UTC
(
hide
)
Description:
Bug 15522: (Vue alternative) Add policy template and scripts
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-10-20 17:17:26 UTC
Size:
8.10 KB
patch
obsolete
>From aed1b4fbe6996f5bcdf569027adb44e231403e00 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Tue, 20 Oct 2020 13:31:59 -0300 >Subject: [PATCH] Bug 15522: (Vue alternative) Add policy template and scripts > >--- > Koha/Template/Plugin/Categories.pm | 4 ++ > Koha/Template/Plugin/To.pm | 2 +- > admin/policy.pl | 47 +++++++++++++ > .../prog/en/includes/admin-menu.inc | 2 +- > .../prog/en/modules/admin/admin-home.tt | 4 +- > .../prog/en/modules/admin/policy.tt | 70 +++++++++++++++++++ > 6 files changed, 125 insertions(+), 4 deletions(-) > create mode 100755 admin/policy.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/policy.tt > >diff --git a/Koha/Template/Plugin/Categories.pm b/Koha/Template/Plugin/Categories.pm >index 140f12a395..0ee967be8b 100644 >--- a/Koha/Template/Plugin/Categories.pm >+++ b/Koha/Template/Plugin/Categories.pm >@@ -25,7 +25,11 @@ use Koha::Patron::Categories; > > sub all { > my ( $self, $params ) = @_; >+ my $unfiltered = delete $params->{unfiltered} || 0; > return Koha::Patron::Categories->search_limited($params); >+ return $unfiltered >+ ? Koha::Patron::Categories->search( $params ) >+ : Koha::Patron::Categories->search_limited( $params ) > } > > sub GetName { >diff --git a/Koha/Template/Plugin/To.pm b/Koha/Template/Plugin/To.pm >index 67902e6ac0..d3e0f32bc1 100644 >--- a/Koha/Template/Plugin/To.pm >+++ b/Koha/Template/Plugin/To.pm >@@ -28,7 +28,7 @@ our $DYNAMIC = 1; > sub json { > my ( $self, $value ) = @_; > >- my $json = JSON->new->allow_nonref(1); >+ my $json = JSON->new->allow_nonref(1)->convert_blessed(1); > $json = $json->encode($value); > $json =~ s/^"|"$//g; # Remove quotes around the strings > $json =~ s/\\r/\\\\r/g; # Convert newlines to escaped newline characters >diff --git a/admin/policy.pl b/admin/policy.pl >new file mode 100755 >index 0000000000..f10a12296d >--- /dev/null >+++ b/admin/policy.pl >@@ -0,0 +1,47 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright (C) 2017 Jesse Weaver >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+ >+use Modern::Perl; >+ >+use C4::Auth; >+use C4::Context; >+use C4::Output; >+ >+use Koha::Patrons; >+ >+use CGI qw( -utf8 ); >+ >+my $query = new CGI; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { template_name => "admin/policy.tt", >+ authnotrequired => 0, >+ flagsrequired => { parameters => 'manage_circ_rules' }, >+ query => $query, >+ type => "intranet", >+ debug => 1, >+ } >+); >+ >+my $uid = Koha::Patrons->find( $borrowernumber )->userid; >+my $restricted_to_own_library = !( $uid && haspermission( $uid, { parameters => 'manage_circ_rules_from_any_libraries' } ) ); >+$template->param( restricted_to_library => $restricted_to_own_library ? C4::Context::mybranch() : "" ); >+ >+output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >index 44d1f4cc0e..709054c41e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc >@@ -36,7 +36,7 @@ > <li><a href="/cgi-bin/koha/admin/categories.pl">Patron categories</a></li> > [% END %] > [% IF ( CAN_user_parameters_manage_circ_rules ) %] >- <li><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fines rules</a></li> >+ <li><a href="/cgi-bin/koha/admin/policy.pl">Circulation, fines, and holds rules</a></li> > [% END %] > [% IF ( CAN_user_parameters_manage_patron_attributes ) %] > <li><a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute types</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >index 1f084358fb..66dd127d5e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt >@@ -83,8 +83,8 @@ > <dd>Define patron categories.</dd> > [% END %] > [% IF CAN_user_parameters_manage_circ_rules %] >- <dt><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fines rules</a></dt> >- <dd>Define circulation and fines rules for combinations of libraries, patron categories, and item types</dd> >+ <dt><a href="/cgi-bin/koha/admin/policy.pl">Circulation, fines, and holds rules</a></dt> >+ <dd>Define circulation, fines, and holds rules for combinations of libraries, patron categories, and item types</dd> > [% END %] > [% IF ( CAN_user_parameters_manage_patron_attributes ) %] > <dt><a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute types</a></dt> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/policy.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/policy.tt >new file mode 100644 >index 0000000000..37710bf090 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/policy.tt >@@ -0,0 +1,70 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Branches %] >+[% USE Categories %] >+[% USE ItemTypes %] >+[% USE Koha %] >+[% USE To %] >+[% SET footerjs = 1 %] >+ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Administration › Policy</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<link rel="stylesheet" href="[% interface %]/[% theme %]/css/admin/policy.css" /> >+</head> >+<body id="admin_policy" class="admin"> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'prefs-admin-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Circulation, fines, and holds rules</div> >+ >+<div class="main container-fluid"> >+ <div class="row"> >+ <div class="col-sm-10 col-sm-push-2"> >+ <main> >+ <div id="vue-base"> >+ <h1>Loading, please wait...</h1> >+ </div> >+ </main> >+ </div> >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> >+ [% INCLUDE 'admin-menu.inc' %] >+ </aside> >+ </div> <!-- /.col-sm-2.col-sm-pull-10 --> >+ </div> <!-- /.row --> >+ >+[% MACRO jsinclude BLOCK %] >+ [% Asset.js("js/admin-menu.js") | $raw %] >+ [% Asset.js("lib/hc-sticky.js") | $raw %] >+ [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] >+ [% INCLUDE 'calendar.inc' %] >+ >+ <script> >+ var restricted_to_library = "[% restricted_to_library %]"; >+ >+ Koha.Preferences = { >+ "dateformat": "[% Koha.Preference( 'dateformat' ) %]", >+ }; >+ >+ Koha.BRANCHES = { >+ [% FOREACH branch IN Branches.all( unfiltered => 1 ) %] >+ "[% branch.branchcode %]": [% To.json( branch ) %], >+ [% END %] >+ }; >+ // TODO: Account for branch category limits >+ Koha.PATRON_CATEGORIES = { >+ [% FOREACH category IN Categories.all( unfiltered => 1 ) %] >+ "[% category.categorycode %]": [% To.json( category ) %], >+ [% END %] >+ }; >+ Koha.ITEM_TYPES = { >+ [% FOREACH itemtype IN ItemTypes.Get() %] >+ "[% itemtype.itemtype %]": [% To.json( itemtype ) %], >+ [% END %] >+ }; >+ </script> >+ [% Asset.js("js/built/admin/policy/main.js") | $raw %] >+[% END %] >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/humanmsg.css" /> >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.25.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 15522
:
68231
|
68232
|
68233
|
68234
|
68235
|
71048
|
71049
|
71050
|
71051
|
71052
|
72239
|
72242
|
91977
|
91978
|
91979
|
91980
|
91981
|
91982
|
91983
|
91984
|
94201
|
94202
|
94203
|
94204
|
94205
|
94206
|
94207
|
94208
|
99148
|
99149
|
99150
|
99151
|
99152
|
99153
|
99154
|
99155
|
99156
|
99157
|
99199
|
99200
|
99201
|
99202
|
99203
|
99204
|
99205
|
99206
|
99207
|
99208
|
99209
|
99210
|
99211
|
99213
|
99214
|
99215
|
101918
|
101919
|
101920
|
101921
|
101922
|
101923
|
101924
|
101925
|
101926
|
101927
|
101934
|
101935
|
101936
|
101937
|
101938
|
101939
|
101940
|
101941
|
101942
|
101943
|
101944
|
101945
|
101946
|
101947
|
106913
|
106914
|
106915
|
106916
|
106917
|
106918
|
106919
|
106920
|
106921
|
106922
|
106923
|
106924
|
106925
|
106926
|
112056
| 112057 |
112058
|
112059
|
112060
|
112061