Bugzilla – Attachment 167465 Details for
Bug 36453
BlockExpiredPatronOpacActions should allow multiple actions options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36453: Categories admin page:
Bug-36453-Categories-admin-page.patch (text/plain), 12.21 KB, created by
Martin Renvoize (ashimema)
on 2024-06-05 16:07:51 UTC
(
hide
)
Description:
Bug 36453: Categories admin page:
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-05 16:07:51 UTC
Size:
12.21 KB
patch
obsolete
>From 32a4ef27561889237edda2e7306692f1aa9f259f Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Tue, 26 Mar 2024 17:13:51 +0000 >Subject: [PATCH] Bug 36453: Categories admin page: > >Account for multiple values param >Input is now multipleselect select >JavaScript >Staff CSS updates to account for multiselect dropdown in categories admin page > >Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > admin/categories.pl | 2 +- > .../intranet-tmpl/prog/css/src/_forms.scss | 11 ++ > .../prog/en/modules/admin/categories.tt | 30 ++-- > koha-tmpl/intranet-tmpl/prog/js/categories.js | 132 ++++++++++++------ > 4 files changed, 119 insertions(+), 56 deletions(-) > >diff --git a/admin/categories.pl b/admin/categories.pl >index b928b0649cc..5495210b6db 100755 >--- a/admin/categories.pl >+++ b/admin/categories.pl >@@ -70,7 +70,7 @@ elsif ( $op eq 'cud-add_validate' ) { > my $hidelostitems = $input->param('hidelostitems'); > my $overduenoticerequired = $input->param('overduenoticerequired'); > my $category_type = $input->param('category_type'); >- my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions'); >+ my $BlockExpiredPatronOpacActions = join( ',', $input->multi_param('BlockExpiredPatronOpacActions') ); > my $checkPrevCheckout = $input->param('checkprevcheckout'); > my $can_place_ill_in_opac = $input->param('can_place_ill_in_opac') // 1; > my $default_privacy = $input->param('default_privacy'); >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/_forms.scss b/koha-tmpl/intranet-tmpl/prog/css/src/_forms.scss >index 99f8adfbca8..6a98f023e81 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/_forms.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/_forms.scss >@@ -169,6 +169,17 @@ fieldset { > padding-left: 0; > } > } >+ >+ div.ms-drop { >+ label { >+ text-align: left; >+ width:auto; >+ span{ >+ margin-left:5px; >+ width:auto; >+ } >+ } >+ } > } > > ol { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >index 2144484642a..4834ac4e773 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >@@ -28,6 +28,7 @@ > [% t("Koha") | html %] > [% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >+[% Asset.css("lib/jquery/plugins/multiple-select/multiple-select.min.css") | $raw %] > <style>#enrolmentmessage.hint { display : none; }</style> > </head> > >@@ -340,25 +341,27 @@ > [% END %] > </select> > </li> >- <li><label for="block_expired">Block expired patrons:</label> >- <select name="BlockExpiredPatronOpacActions" id="block_expired"> >- [% IF not category or category.BlockExpiredPatronOpacActions == -1%] >- <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option> >+ <li><label for="block_expired">Block expired patrons actions:</label> >+ <select name="BlockExpiredPatronOpacActions" id="block_expired" multiple="multiple"> >+ <optgroup label="Follow system preference"> >+ [% IF not category or category.BlockExpiredPatronOpacActions_contains('follow_syspref_BlockExpiredPatronOpacActions') %] >+ <option value="follow_syspref_BlockExpiredPatronOpacActions" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option> > [% ELSE %] >- <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option> >+ <option value="follow_syspref_BlockExpiredPatronOpacActions"> BlockExpiredPatronOpacActions </option> > [% END %] >- >- [% IF category and category.BlockExpiredPatronOpacActions == 1 %] >- <option value="1" selected="selected"> Block </option> >+ </optgroup> >+ <optgroup label="Specific actions"> >+ [% IF category and category.BlockExpiredPatronOpacActions_contains('hold') %] >+ <option value="hold" selected="selected"> Placing a hold on an item </option> > [% ELSE %] >- <option value="1"> Block </option> >+ <option value="hold"> Placing a hold on an item </option> > [% END %] >- >- [% IF category and category.BlockExpiredPatronOpacActions == 0 %] >- <option value="0" selected="selected"> Don't block </option> >+ [% IF category and category.BlockExpiredPatronOpacActions_contains('renew') %] >+ <option value="renew" selected="selected"> Renewing an item </option> > [% ELSE %] >- <option value="0"> Don't block </option> >+ <option value="renew"> Renewing an item </option> > [% END %] >+ </optgroup> > </select> > <div class="hint"> > Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired. >@@ -751,6 +754,7 @@ > </script> > [% Asset.js("js/admin-menu.js") | $raw %] > [% Asset.js("js/messaging-preference-form.js") | $raw %] >+ [% Asset.js("lib/jquery/plugins/multiple-select/multiple-select.min.js") | $raw %] > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/categories.js b/koha-tmpl/intranet-tmpl/prog/js/categories.js >index 50b19382d91..615e5554f74 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/categories.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/categories.js >@@ -1,45 +1,63 @@ > /* global __ */ > >-jQuery.validator.addMethod( "letters_numbers", function(value,element){ >- var patt = /^[a-zA-Z0-9\-_]+$/g; >- if (patt.test(element.value)) { >- return true; >- } else { >- return false; >- } >- }, __("Category code can only contain the following characters: letters, numbers, - and _.") >+jQuery.validator.addMethod( >+ "letters_numbers", >+ function (value, element) { >+ var patt = /^[a-zA-Z0-9\-_]+$/g; >+ if (patt.test(element.value)) { >+ return true; >+ } else { >+ return false; >+ } >+ }, >+ __( >+ "Category code can only contain the following characters: letters, numbers, - and _." >+ ) > ); > >-jQuery.validator.addMethod( "enrollment_period", function(){ >+jQuery.validator.addMethod( >+ "enrollment_period", >+ function () { > enrolmentperiod = $("#enrolmentperiod").val(); > enrolmentperioddate = $("#enrolmentperioddate").val(); >- if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) { >+ if ( >+ $("#enrolmentperiod").val() !== "" && >+ $("#enrolmentperioddate").val() !== "" >+ ) { > return false; > } else { > return true; > } >- }, __("Please choose an enrollment period in months OR by date.") >+ }, >+ __("Please choose an enrollment period in months OR by date.") > ); > >-$(document).ready(function() { >- KohaTable("patron_categories", { >- "columnDefs": [{ >- "targets": [-1], >- "orderable": false, >- "searchable": false >- }, { >- "targets": [3, 4, 5], >- "type": "natural" >- }, ], >- "pagingType": "full", >- "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12], >- }, table_settings); >+$(document).ready(function () { >+ KohaTable( >+ "patron_categories", >+ { >+ columnDefs: [ >+ { >+ targets: [-1], >+ orderable: false, >+ searchable: false, >+ }, >+ { >+ targets: [3, 4, 5], >+ type: "natural", >+ }, >+ ], >+ pagingType: "full", >+ exportColumns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], >+ }, >+ table_settings >+ ); > > if ($("#branches option:selected").length < 1) { > $("#branches option:first").attr("selected", "selected"); > } > >- $("#categorycode").on("blur",function(){ >+ $("#categorycode").on("blur", function () { > toUC(this); > }); > >@@ -47,53 +65,83 @@ $(document).ready(function() { > rules: { > categorycode: { > required: true, >- letters_numbers: true >+ letters_numbers: true, > }, > description: "required", > enrolmentperiod: { >- required: function(element){ >+ required: function (element) { > return $("#enrolmentperioddate").val() === ""; > }, > digits: true, > enrollment_period: true, >- min: 1 >+ min: 1, > }, > enrolmentperioddate: { >- required: function(element){ >+ required: function (element) { > return $("#enrolmentperiod").val() === ""; > }, >- enrollment_period: true >+ enrollment_period: true, > }, > password_expiry_days: { >- digits: true >+ digits: true, > }, > dateofbirthrequired: { >- digits: true >+ digits: true, > }, > upperagelimit: { >- digits: true >+ digits: true, > }, > enrolmentfee: { >- number: true >+ number: true, > }, > reservefee: { >- number: true >+ number: true, > }, > category_type: { >- required: true >+ required: true, > }, > min_password_length: { >- digits: true >- } >+ digits: true, >+ }, > }, > messages: { > enrolmentperiod: { >- required: __("Please choose an enrollment period in months OR by date.") >+ required: __( >+ "Please choose an enrollment period in months OR by date." >+ ), > }, > enrolmentperioddate: { >- required: __("Please choose an enrollment period in months OR by date.") >- } >- } >+ required: __( >+ "Please choose an enrollment period in months OR by date." >+ ), >+ }, >+ }, >+ }); > >+ let blocked_actions_select = $("select#block_expired[multiple='multiple']"); >+ blocked_actions_select.multipleSelect({ >+ placeholder: _("Please select ..."), >+ selectAll: false, >+ hideOptgroupCheckboxes: true, >+ allSelected: _("All selected"), >+ countSelected: _("# of % selected"), >+ noMatchesFound: _("No matches found"), >+ onClick: function (view) { >+ if ( >+ view.value == "follow_syspref_BlockExpiredPatronOpacActions" && >+ view.selected >+ ) { >+ blocked_actions_select.multipleSelect("uncheck", "hold"); >+ blocked_actions_select.multipleSelect("uncheck", "renew"); >+ } else if ( >+ view.value != "follow_syspref_BlockExpiredPatronOpacActions" && >+ view.selected >+ ) { >+ blocked_actions_select.multipleSelect( >+ "uncheck", >+ "follow_syspref_BlockExpiredPatronOpacActions" >+ ); >+ } >+ }, > }); > }); >-- >2.45.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 36453
:
164042
|
164043
|
164044
|
164045
|
164046
|
164047
|
164048
|
164762
|
164763
|
164764
|
164765
|
164766
|
164767
|
164768
|
165413
|
165414
|
165454
|
167461
|
167462
|
167463
|
167464
|
167465
|
167466
|
167467
|
167468
|
167469
|
167470
|
167471
|
167472
|
167473
|
167474
|
167475
|
167476
|
167477
|
167478
|
167479
|
167480
|
168435
|
168436