Bug 25168 - mandatory field has been set in admin but purchase suggestion (in opac) allow to enter null value
Summary: mandatory field has been set in admin but purchase suggestion (in opac) allow...
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: 18.11
Hardware: All All
: P5 - low major (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-16 07:48 UTC by ciarebaha
Modified: 2021-06-14 21:28 UTC (History)
2 users (show)

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


Attachments
mandatory fields are set in admin module (224.38 KB, image/png)
2020-04-16 07:48 UTC, ciarebaha
Details
but in opac, fields not mandatory and can save a blank form (170.16 KB, image/png)
2020-04-16 07:49 UTC, ciarebaha
Details
Uncaught ReferenceError: ARRAY is not defined (65.02 KB, image/png)
2020-04-28 15:37 UTC, ciarebaha
Details
jQuery v1.7.2 (654.39 KB, image/png)
2020-04-28 15:41 UTC, ciarebaha
Details
opac-sugestions.pl only has 232 lines (but console state the error line is 1118) (726.76 KB, image/png)
2020-05-06 23:10 UTC, ciarebaha
Details
HTML Source code (58.30 KB, text/html)
2020-06-09 03:27 UTC, ciarebaha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ciarebaha 2020-04-16 07:48:33 UTC
Created attachment 103057 [details]
mandatory fields are set in admin module

Hi,

We have set the mandatory fields needed for purchase administration. However, when user open the purchase suggestions form in OPAC, user can leave the mandatory fields blank instead of prompt the fields should not be empty. Kindly refer attachment for details view.

Thank you.
Comment 1 ciarebaha 2020-04-16 07:49:19 UTC
Created attachment 103058 [details]
but in opac, fields not mandatory and can save a blank form
Comment 2 Owen Leonard 2020-04-16 11:23:50 UTC
I cannot reproduce this problem in 18.11.x using Firefox or Chrome. Can you confirm your Koha version and the browser you're using?
Comment 3 ciarebaha 2020-04-16 13:51:47 UTC
Thank you for your response.

I'm using Google Chrome - Version 81.0.4044.113 on macbook. I also tested on mozilla firefox & safari but still got the same problem.

The Koha version is 18.11.13.000
Comment 4 Jonathan Druart 2020-04-17 09:32:43 UTC
I have tested on 18.11.13 (and master) and it seems to work correctly, with the exact values you selected.
Could you open the console (ctrl+shift+c, then "console" tab) then refresh the page.
Maybe you have a JS error that prevents the validation of the form.
Comment 5 Katrin Fischer 2020-04-18 03:02:31 UTC
I first thought this could be Bug 22550 - OPAC suggestion form doesn't require mandatory fields, but this is in 18.11

I have also checked that it works on our 18.11.11.

I agree with Jonathan that a JS error is a likely candidate for causing this issue. If you have anything in OpacUserJS try emptying out the preference and see if that would fix your issue.
Comment 6 ciarebaha 2020-04-28 15:37:40 UTC
Created attachment 103869 [details]
Uncaught ReferenceError: ARRAY is not defined

Yes, it seems like the cause came from the JS/.pl script. I've been searching for the problem but unfortunately still could not find it. Actually this problem happen only on the production server. On the development server, it works perfectly fine even though the source code exactly the same.
Comment 7 ciarebaha 2020-04-28 15:39:31 UTC
(In reply to Katrin Fischer from comment #5)
> I first thought this could be Bug 22550 - OPAC suggestion form doesn't
> require mandatory fields, but this is in 18.11
> 
> I have also checked that it works on our 18.11.11.
> 
> I agree with Jonathan that a JS error is a likely candidate for causing this
> issue. If you have anything in OpacUserJS try emptying out the preference
> and see if that would fix your issue.

I already tried to empty the OpacUserJS but seems like its not the cause of the problem.
Comment 8 ciarebaha 2020-04-28 15:41:08 UTC
Created attachment 103872 [details]
jQuery v1.7.2

The jquery used in this koha version is jQuery v1.7.2. Is your koha using the same version?
Comment 9 Katrin Fischer 2020-04-28 19:11:24 UTC
We package the jQuery libraries - they should always be the same for everony on a specific Koha version. Which is your exact 18.11.x verson? (what's the x? you can find the information on the about page)
Comment 10 Jonathan Druart 2020-04-29 13:24:39 UTC
(In reply to ciarebaha from comment #6)
> Created attachment 103869 [details]
> Uncaught ReferenceError: ARRAY is not defined
> 
> Yes, it seems like the cause came from the JS/.pl script. I've been
> searching for the problem but unfortunately still could not find it.
> Actually this problem happen only on the production server. On the
> development server, it works perfectly fine even though the source code
> exactly the same.

What is line 1118 in the code source of the page?
Comment 11 ciarebaha 2020-05-06 23:09:04 UTC
(In reply to Jonathan Druart from comment #10)
> (In reply to ciarebaha from comment #6)
> > Created attachment 103869 [details]
> > Uncaught ReferenceError: ARRAY is not defined
> > 
> > Yes, it seems like the cause came from the JS/.pl script. I've been
> > searching for the problem but unfortunately still could not find it.
> > Actually this problem happen only on the production server. On the
> > development server, it works perfectly fine even though the source code
> > exactly the same.
> 
> What is line 1118 in the code source of the page?


line 1118 is not exist because in file opac-suggestions.pl only has 232 lines in the source code file. this is normal because opac-suggestions.pl include multiple files in it. hence to find the exactly line number 1118 is quite hard. :(

i will attach the opac-suggestions.pl screenshot on comment area below
Comment 12 ciarebaha 2020-05-06 23:10:31 UTC
Created attachment 104468 [details]
opac-sugestions.pl only has 232 lines (but console state the error line is 1118)
Comment 13 Jonathan Druart 2020-05-07 08:54:59 UTC
The HTML source of the page.
Comment 14 ciarebaha 2020-06-09 03:27:13 UTC
Created attachment 105653 [details]
HTML Source code
Comment 15 ciarebaha 2020-06-09 04:02:00 UTC
(In reply to Jonathan Druart from comment #13)
> The HTML source of the page.

I have attached the html code (downloaded directly from page). Please refer line 1118. It seems like the variable does not carry array value. What possibly is the cause? And how can i check?
Comment 16 Jonathan Druart 2020-06-09 08:59:50 UTC
The problematic line is:

1118             var FldsRequired = [ARRAY(0x66dd688)];

Can you open your file opac-suggestions.tt and copy what you have line 346 please?

It must be

346             var FldsRequired = ['[% mandatoryfields.join("','") | html %]'];
Comment 17 ciarebaha 2020-06-10 02:44:11 UTC
(In reply to Jonathan Druart from comment #16)
> The problematic line is:
> 
> 1118             var FldsRequired = [ARRAY(0x66dd688)];
> 
> Can you open your file opac-suggestions.tt and copy what you have line 346
> please?
> 
> It must be
> 
> 346             var FldsRequired = ['[% mandatoryfields.join("','") | html
> %]'];


The purchase suggestion already working now after we add .join (",") to opac.suggestion.tt. Thank you all.
Comment 18 Jonathan Druart 2020-06-10 07:01:44 UTC
This is the exact line that exists in 18.11.13

You should not edit your file manually, consider an upgrade instead.

And, next time you open a bug report, please make sure you report the correct Koha version number! You can find it on the about page.