Bug 12981 - Patron attribute type limit by patron category not working on patron entry form
Summary: Patron attribute type limit by patron category not working on patron entry form
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-23 18:17 UTC by Owen Leonard
Modified: 2015-06-04 23:33 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12981 - Patron attribute type limit by patron category not working on patron entry form (3.79 KB, patch)
2014-09-23 18:44 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 12981 - Patron attribute type limit by patron category not working on patron entry form (3.81 KB, patch)
2014-10-15 15:08 UTC, Chris Cormack
Details | Diff | Splinter Review
[PASSED QA] Bug 12981 - Patron attribute type limit by patron category not working on patron entry form (3.87 KB, patch)
2014-10-17 14:19 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2014-09-23 18:17:08 UTC
If you have a patron attribute type which is limited to a particular patron category the entry field will not appear on the patron entry form. The entry field for patron attribute types which have been limited by patron category are conditionally displayed based on the patron category. An error in the page's markup results in the patron category getting misreported, thus the JavaScript which shows and hides the entry fields incorrectly hides them.
Comment 1 Owen Leonard 2014-09-23 18:44:16 UTC Comment hidden (obsolete)
Comment 2 Nick Clemens 2014-10-05 01:11:11 UTC
I confirmed the behavior

The patch works as described.

Does it matter that I can change the category in order to make the attribute show, fill it in, change it again and hide the field, but still have the information save?  

It reuires a pretty deliberate staff action but you end up with an attribute showing that you can't edit
Comment 3 Chris Cormack 2014-10-15 15:08:02 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall 2014-10-17 14:19:47 UTC
Created attachment 32503 [details] [review]
[PASSED QA] Bug 12981 - Patron attribute type limit by patron category not working on patron entry form

To reproduce this bug:

- Create a patron attribute type and limit it by patron category
- Create a new patron with that category
- Observe that there is no entry field for the patron attribute type you
  created for that patron category. Inspecting the source should show
  that the entry field has been hidden.

The patron entry form tries to hide patron attribute type input fields
based on the currently selected patron category. It does this based on
the value of $("categorycode"). However, instead of pulling the data
from the categorycode input in the body of the entry form, it pulls it
from the patron search box at the top of the page. The value of that
input is always empty because no category is preselected.

This patch corrects the problem by changing the ID of the categorycode
<select> in the body of the entry form and making corresponding changes
to the JavaScript which depends on it.

To test, apply the patch and load the patron entry form for a patron
category to which a patron attribute type has been limited. That patron
attribute entry field should appear correctly.

Choose a different patron category from the "Category" dropdown. Confirm
that the patron attribute entry field has been hidden.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Tomás Cohen Arazi 2014-11-21 18:34:23 UTC
Patch pushed to master.

Thanks Owen!