Bug 21813

Summary: In-page JavaScript causes error on patron entry page
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: jesse, katrin.fischer, martin.renvoize, nick, pierre-marc.thibault
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22077
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 19641    
Bug Blocks: 21751    
Attachments: Bug 21813: In-page JavaScript causes error on patron entry page
Bug 21813: In-page JavaScript causes error on patron entry page
Bug 21813: In-page JavaScript causes error on patron entry page
Bug 21813: In-page JavaScript causes error on patron entry page
Bug 21813: In-page JavaScript causes error on patron entry page

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.