Bugzilla – Attachment 73367 Details for
Bug 19673
Patron batch modification tool cannot use authorised value "0"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19673: Allow to set patron attributes to 0 with batch patron modification
Bug-19673-Allow-to-set-patron-attributes-to-0-with.patch (text/plain), 4.76 KB, created by
Katrin Fischer
on 2018-03-28 05:46:35 UTC
(
hide
)
Description:
Bug 19673: Allow to set patron attributes to 0 with batch patron modification
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-03-28 05:46:35 UTC
Size:
4.76 KB
patch
obsolete
>From 06f912657aaffeaf1c8b4c7825ba43dcbffbb60c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Dec 2017 21:35:47 -0300 >Subject: [PATCH] Bug 19673: Allow to set patron attributes to 0 with batch > patron modification > >This patch will have to be tested deeply to make sure it will not >introduce regression! > >The idea is to display an empty option in the patron attributes select >and ignore it. That way we can deal with false values 0 and "" which >were skipped before. > >Test plan: >Add several patron attributes >Use the batch patron modification tool to add/update/remove them >Play with empty "" and 0 values, as well as other values >Modify several attributes in a row > >Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/tools/modborrowers.tt | 22 ++++++++++++++++------ > tools/modborrowers.pl | 3 --- > 2 files changed, 16 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >index 175c9c88b9..bbf39a0551 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -258,6 +258,7 @@ > <li class="attributes"> > <label style="width:auto;">Attribute: > <select name="patron_attributes"> >+ <option value=""></option> > [% FOREACH pac IN patron_attributes_codes %] > <option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option> > [% END %] >@@ -365,22 +366,31 @@ > > function updateAttrValues (select_attr) { > var attr_code = $(select_attr).val(); >- var type = $(select_attr).find("option:selected").attr('data-type'); >- var category = $(select_attr).find("option:selected").attr('data-category'); >- var span = $(select_attr).parent().parent().find('span.patron_attributes_value'); >- var information_category_node = $(select_attr).parent().parent().find('span.information_category'); >+ var selected_option = $(select_attr).find("option:selected"); >+ var type = $(selected_option).attr('data-type'); >+ var category = $(selected_option).attr('data-category'); >+ var li_node = $(select_attr).parent().parent(); >+ var span = $(li_node).find('span.patron_attributes_value'); >+ var information_category_node = $(li_node).find('span.information_category'); > information_category_node.html(""); >- if ( category.length > 0 ) { >+ >+ if ( category && category.length > 0 ) { > information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category)); > } >+ var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']"); > if ( type == 'select' ) { > var options = '<option value = ""></option>'; > for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) { > options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>'; > } > span.html('<select name="patron_attributes_value">' + options + '</select>'); >+ $(disable_input_node).show(); >+ } else if ( $(selected_option).val() != "" ) { >+ span.html('<input type="text" name="patron_attributes_value"/>'); >+ $(disable_input_node).show(); > } else { >- span.html('<input type="text" name="patron_attributes_value"/>') >+ span.html(''); >+ $(disable_input_node).hide(); > } > } > >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index 586ae53e53..e53e3a30d7 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -320,9 +320,6 @@ if ( $op eq 'do' ) { > }; > push @errors, { error => $@ } if $@; > } else { >- # Attribute's value is empty, we don't want to modify it >- ++$i and next if not $attribute->{attribute}; >- > eval { > C4::Members::Attributes::UpdateBorrowerAttribute( $borrowernumber, $attribute ); > }; >-- >2.14.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 19673
:
69984
|
73223
| 73367