Bug 30746

Summary: JS error on 'your personal details' in OPAC
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: minor    
Priority: P5 - low CC: arthur.suzuki, jonathan.druart, lucas, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.01, 21.11.07
Attachments: Bug 30746: Fix JS error on opac-memberentry
Bug 30746: Fix JS error on opac-memberentry
Bug 30746: Fix JS error on opac-memberentry

Description Katrin Fischer 2022-05-13 08:19:50 UTC
I am seeing this error in the console in master:

Uncaught TypeError: j is undefined

Not sure if that is a local issue, could someone try and confirm?
Comment 1 Owen Leonard 2022-05-13 11:14:49 UTC
I don't see anything in master.
Comment 2 Katrin Fischer 2022-05-13 11:15:50 UTC
Very strange, thx Owen.
Comment 3 Lucas Gass 2022-05-13 15:32:51 UTC
I see this error as well on current master!
Comment 4 Lucas Gass 2022-05-13 15:36:53 UTC
In Firefox I see the exact same error as Cait. In Chrome I see something a bit different:

jquery-3.6.0.min_21.1200055.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'form')
    at s.fn.init.rules (jquery.validate.min_21.1200055.js:4:1470)
    at HTMLDocument.<anonymous> (opac-memberentry.pl:1568:67)
    at e (jquery-3.6.0.min_21.1200055.js:2:30038)
    at t (jquery-3.6.0.min_21.1200055.js:2:30340)
Comment 5 Owen Leonard 2022-05-13 17:07:25 UTC
I was able to see it after emptying the  PatronSelfRegistrationBorrowerMandatoryField and PatronSelfRegistrationBorrowerUnwantedField system preferences and looking at the self-registration view.

An upgrade of the validation plugin seems to fix the error, so I suspect the problem is related to Bug 29155, "Upgrade jquery version to 3.6.0."

The error doesn't appear to affect the functionality of the page, so I don't think we need to rush a fix.
Comment 6 Jonathan Druart 2022-06-01 12:56:37 UTC
Created attachment 135541 [details] [review]
Bug 30746: Fix JS error on opac-memberentry

Empty PatronSelfRegistrationBorrowerMandatoryField and PatronSelfRegistrationBorrowerUnwantedField
Go to opac-memberentry.pl
Notice the JS error
  Uncaught TypeError: j is undefined
Apply this patch
Go to opac-memberentry.pl
=> no JS error
Fill the pref with some values
Go to opac-memberentry.pl
=> Confirm that the fields you marked as mandatory as flagged accordinly
on the UI
Comment 7 Lucas Gass 2022-06-01 14:47:09 UTC
Created attachment 135549 [details] [review]
Bug 30746: Fix JS error on opac-memberentry

Empty PatronSelfRegistrationBorrowerMandatoryField and PatronSelfRegistrationBorrowerUnwantedField
Go to opac-memberentry.pl
Notice the JS error
  Uncaught TypeError: j is undefined
Apply this patch
Go to opac-memberentry.pl
=> no JS error
Fill the pref with some values
Go to opac-memberentry.pl
=> Confirm that the fields you marked as mandatory as flagged accordinly
on the UI

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 8 Katrin Fischer 2022-06-06 11:34:31 UTC
Created attachment 135724 [details] [review]
Bug 30746: Fix JS error on opac-memberentry

Empty PatronSelfRegistrationBorrowerMandatoryField and PatronSelfRegistrationBorrowerUnwantedField
Go to opac-memberentry.pl
Notice the JS error
  Uncaught TypeError: j is undefined
Apply this patch
Go to opac-memberentry.pl
=> no JS error
Fill the pref with some values
Go to opac-memberentry.pl
=> Confirm that the fields you marked as mandatory as flagged accordinly
on the UI

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Tomás Cohen Arazi 2022-06-06 14:57:27 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 10 Lucas Gass 2022-06-17 20:12:38 UTC
Pushed to 22.05.x for 22.05.01
Comment 11 Arthur Suzuki 2022-06-21 14:01:20 UTC
thx! pushed to 21.11.x for 21.11.07
Comment 12 Victor Grousset/tuxayo 2022-06-26 00:13:43 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document, marking resolved.