Bug 21813 - In-page JavaScript causes error on patron entry page
Summary: In-page JavaScript causes error on patron entry page
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 19641
Blocks: 21751
  Show dependency treegraph
 
Reported: 2018-11-12 18:41 UTC by Owen Leonard
Modified: 2019-10-14 19:59 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 21813: In-page JavaScript causes error on patron entry page (6.36 KB, patch)
2018-11-12 18:58 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 21813: In-page JavaScript causes error on patron entry page (8.46 KB, patch)
2019-01-04 14:13 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 21813: In-page JavaScript causes error on patron entry page (8.53 KB, patch)
2019-01-04 21:03 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 21813: In-page JavaScript causes error on patron entry page (8.59 KB, patch)
2019-01-07 17:50 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21813: In-page JavaScript causes error on patron entry page (8.59 KB, patch)
2019-01-07 22:47 UTC, Lucas Gass
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2018-11-12 18:41:21 UTC
There is an in-page block of JavaScript which should have been dealt with when Bug 19641 moved the template's JavaScript to the footer. Its position on the page causes a JavaScript error because jQuery hasn't loaded yet.
Comment 1 Owen Leonard 2018-11-12 18:58:38 UTC Comment hidden (obsolete)
Comment 2 Pierre-Marc Thibault 2018-11-16 19:37:42 UTC
I no longer see the JS error, but when I choose a category with different settings, checkboxes don't change.
Comment 3 Katrin Fischer 2019-01-02 20:52:56 UTC
Hi Pierre, which checkboxes are you referring to?
Comment 4 Katrin Fischer 2019-01-02 21:28:11 UTC
Oh, should have read the test plan better!
Comment 5 Owen Leonard 2019-01-04 14:13:10 UTC Comment hidden (obsolete)
Comment 6 Pierre-Marc Thibault 2019-01-04 21:03:29 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize 2019-01-07 17:50:35 UTC Comment hidden (obsolete)
Comment 8 Martin Renvoize 2019-01-07 17:56:23 UTC
Works for me, no regressions found and the qa scripts all pass.

I'm going to go ahead and PQA this as it's a major.. but I think an accompanying regression test would be good to prevent future regressions.  I'll create a new bug for that to prevent holding this one up and discus whether we want a specific test or a more generic check for errors in the console anywhere.
Comment 9 Lucas Gass 2019-01-07 22:47:43 UTC
Created attachment 83703 [details] [review]
Bug 21813: In-page JavaScript causes error on patron entry page

This patch removes a block of JavaScript from memberentrygen.tt which
was being included in the page before jQuery is loaded. This causes a
JavaScript error.

To test, apply the patch, regenerate CSS, and clear your browser cache
if necessary.

 - In Administration -> Patron categories, confirm that you have two
    patron categories with different default messaging preferences
    defined.
 - Go to Patrons -> New patron
   - Create a new patron using one of the categories with messaging
     preferences.
   - Confirm that when you switch the category selection to the other
     patron category, the patron messaging preference checkboxes are
     changed to the default for that category.
     - A "Loading" indicator should appear above the checkboxes to show
      that an operation is in process. It should disappear when new
      default prefs are loaded.
   - Manually change one or more patron messaging preference checkboxes.
   - Switch the patron category again and confirm that you are prompted
     to confirm resetting the preferences to the default for that
     category.
 - Perform the same set of tests when editing a patron.
   - Defaults should not be loaded during the edit process.
 - Confirm that there are no other JavaScript errors in the console.
 - Test again with EnhancedMessagingPreferences disabled.

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 10 Nick Clemens 2019-01-08 15:55:49 UTC
Awesome work all!

Pushed to master for 19.05
Comment 11 Martin Renvoize 2019-01-10 14:02:09 UTC
Pushed to 18.11.x for 18.11.02
Comment 12 Jesse Maseto 2019-01-11 19:20:19 UTC
Merge conflicts with 18.05.x. Please rebase for 18.05.x if needed.