Have been seeing this various times, things like: File not found : default/js/locale_data.js at /usr/share/koha/Koha/Template/Plugin/Asset.pm line 84. File not found : ArticleRequestsDisclaimerText_en/js/locale_data.js at /usr/share/koha/Koha/Template/Plugin/Asset.pm line 84. Obviously these are not languages. Default might be a notice language?? And the Disclaimer is a html customization. Still need to find a way to reproduce.
it's reproducible on some pages: members/memberentry.pl members/paycollect.pl for example, edit some user: /cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=1&step=1 This happens because of mass-assignment of keys for template from DB where occasionally template's "lang" value replaced with trashy one. Petro has fix, will publish it. I still can't find direct reproduction for "ArticleRequestsDisclaimerText_en": (somewhere related to tools/additional-contents.pl or Koha::AdditionalContents probably) but that honeypot code added will help further find other paces where such tricks happen.
(In reply to Andrew Nugged from comment #1) > Petro has fix, will publish it. Great ! > I still can't find direct reproduction for > "ArticleRequestsDisclaimerText_en": > (somewhere related to tools/additional-contents.pl or > Koha::AdditionalContents probably) but that honeypot code added will help > further find other paces where such tricks happen. Yeah couldnt find it at first try. Note that additional_contents has a column *lang*.
Created attachment 128571 [details] [review] Bug 29684: fix warn about not found file js/locale_data.js Value of 'lang' unexpectedly was set to 'default', to prevent it, the feature was added to detect 'lang' getting overlaid in template and prevent + warn the developer about it. To reproduce (memberentry.pl): 1) Head over to the patron details page, press edit button to open the memberentry.pl page. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. To reproduce (paycollect.pl): 1) Prepare or use some existing patron with outstanding fines, go to the accounting section and open page where you make payment towards all fines. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear.
Created attachment 128675 [details] [review] Bug 29684: fix warn about not found file js/locale_data.js Value of 'lang' unexpectedly was set to 'default', to prevent it, the feature was added to detect 'lang' getting overlaid in template and prevent + warn the developer about it. To reproduce (memberentry.pl): 1) Head over to the patron details page, press edit button to open the memberentry.pl page. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. To reproduce (paycollect.pl): 1) Prepare or use some existing patron with outstanding fines, go to the accounting section and open page where you make payment towards all fines. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Is this not more a clash of variables where we should rename one? There is also the preferred language for notices stored in borrowers.lang and it has a "default" setting. It will be visible after activating the TranslateNotices system preferences on opac-messaging.pl, but also memeberenty.pl. With this patch in place, I can no longer set the preferred language to "Default" or any other installed language in the staff interface. It will always store the template language. 1) Activate TranslateNotices 2) Edit any existing patron, set language to Default 3) Save 4) Edit: Template language will show as selected. I haven't verified, but the patch possibly triggering printing slips/notices in the preferred language from paycollect as well. I believe we need to approach this differently.
(In reply to Katrin Fischer from comment #5) > Is this not more a clash of variables where we should rename one? > > There is also the preferred language for notices stored in borrowers.lang > and it has a "default" setting. > > It will be visible after activating the TranslateNotices system preferences > on opac-messaging.pl, but also memeberenty.pl. > > With this patch in place, I can no longer set the preferred language to > "Default" or any other installed language in the staff interface. It will > always store the template language. > > 1) Activate TranslateNotices > 2) Edit any existing patron, set language to Default > 3) Save > 4) Edit: Template language will show as selected. > > I haven't verified, but the patch possibly triggering printing slips/notices > in the preferred language from paycollect as well. > > I believe we need to approach this differently. Thx Katrin for verifying this. I only glanced at the patch and was already afraid for this side effect.
The only good way to fix this bug is to remove the ugly line 816 $template->param(%data); And pass the patron object to the template. Lot of changes are needed template-side however. I can do it if there are commitments for quick SO and QA.
Great note from Katrin, I agree that the best solution is to replace: in members/paycollect.pl: $template->param(%$borrower); with something like: $template->param(borrower_data => $borrower); and in members/memberentry.pl: $template->param(%data); with something like: $template->param(borrower_data => \%data ); and then we need to update .tt files accordingly with all keys which were used from those %data/%$borrower directly-mapped ones. Jonathan, I can toss this to Petro to do again, and Tomás can SO and you QA then...?
Created attachment 129532 [details] [review] Bug 29684: fix warn about not found file js/locale_data.js To reproduce (memberentry.pl): 1) Head over to the patron details page, press edit button to open the memberentry.pl page. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear.
Created attachment 129534 [details] [review] Bug 29684: fix warn about not found file js/locale_data.js To reproduce (paycollect.pl): 1) Prepare or use some existing patron with outstanding fines, go to the accounting section and open page where you make payment towards all fines. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear.
Created attachment 129536 [details] [review] Bug 29684: add honeypot to catch other warnings in the future
Created attachment 130184 [details] [review] Bug 29684: fix warn about not found file js/locale_data.js To reproduce (memberentry.pl): 1) Head over to the patron details page, press edit button to open the memberentry.pl page. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 130185 [details] [review] Bug 29684: fix warn about not found file js/locale_data.js To reproduce (paycollect.pl): 1) Prepare or use some existing patron with outstanding fines, go to the accounting section and open page where you make payment towards all fines. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 130186 [details] [review] Bug 29684: add honeypot to catch other warnings in the future Signed-off-by: David Nind <david@davidnind.com>
Created attachment 130210 [details] [review] Bug 29684: Fix warn about js/locale_data.js (memberentry.pl) To reproduce (memberentry.pl): 1) Head over to the patron details page, press edit button to open the memberentry.pl page. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 130211 [details] [review] Bug 29684: Fix warn about js/locale_data.js (paycollect.pl) To reproduce (paycollect.pl): 1) Prepare or use some existing patron with outstanding fines, go to the accounting section and open page where you make payment towards all fines. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 130212 [details] [review] Bug 29684: add honeypot to catch other warnings in the future Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Hi, - <span class="label">Relationship:</span> + <span class="label">borrower_data.Relationship:</span> Sure about this change (twice) ? It is a text.
(In reply to Fridolin Somers from comment #18) > Hi, > - <span class="label">Relationship:</span> > + <span class="label">borrower_data.Relationship:</span> > > Sure about this change (twice) ? > It is a text. Good catch Frido :)
Created attachment 130413 [details] [review] Bug 29684: (QA follow-up) Remove 2 extra 'borrower_data.' prefixes
Good catch! I also want to participate and add my part:
Created attachment 130417 [details] [review] Bug 29684: (QA follow-up) paycollect.pl don't needs borrower_data at all
I found that it looks that $borrower in /members/paycollect.pl: my $borrower = $patron->unblessed; used only once even in old code: $template->param(%$borrower); and there all around "patron." used in paycollect.tt like: <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /> but for some reason it was only ONE place (two times) where it was: <input type="hidden" name="title" id="title" value="[% title | html %]" /> how hell it can be so? :) So complicated solution to bring $borrower unblessed through a such number of code lines just to get ... title? :) I assume these are some oooold times refactoring remnants, but - ... so please mates check if my patch to paycollect part is the correct solution (and I see the strong hivemind we have here :) ).
Created attachment 130421 [details] [review] Bug 29684: (QA follow-up) paycollect.pl don't needs borrower_data at all Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
I agree it's a very messy and huge template so it's easy to lose variables :)... That's why hivemind is needed. switching the ticket to "Failed QA": I am adding some more lost fields.
Created attachment 130477 [details] [review] Bug 29684: (QA follow-up) add lost borrower_data. prefix in memberentrygen.tt for: - primary_contact_method - autorenew_checkouts - sort1 - sort2
umph! It's a complicated thing - we have interleaved usage of "patron." for some elements (for a reason?) in memberentrygen.tt, I at least re-checked once more all variables, might miss even, but found +4 more lost (patch above). I propose to re-do "Sign Off" once more, but Fridolin/Jonathan: you say?
Created attachment 131510 [details] [review] Bug 29684: Fix warn about js/locale_data.js (memberentry.pl) To reproduce (memberentry.pl): 1) Head over to the patron details page, press edit button to open the memberentry.pl page. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 131511 [details] [review] Bug 29684: Fix warn about js/locale_data.js (paycollect.pl) To reproduce (paycollect.pl): 1) Prepare or use some existing patron with outstanding fines, go to the accounting section and open page where you make payment towards all fines. 2) The error message should have appeared in your log file about "File not found : default/js/locale_data.js". 3) Apply the patch. 4) Open the edit page again, ensure that the new error massage like that didn't appear. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 131512 [details] [review] Bug 29684: add honeypot to catch other warnings in the future Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 131513 [details] [review] Bug 29684: (QA follow-up) Remove 2 extra 'borrower_data.' prefixes Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 131514 [details] [review] Bug 29684: (QA follow-up) paycollect.pl don't needs borrower_data at all Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 131515 [details] [review] Bug 29684: (QA follow-up) add lost borrower_data. prefix in memberentrygen.tt for: - primary_contact_method - autorenew_checkouts - sort1 - sort2 Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Pushed to 21.11.x for 21.11.05
I believe this might be linked to bug 30315 on 20.11, but as we are close to end of life there maybe a backport is too risky?
Saw this in 21.11: [WARN] Preventing $template->lang='-undef-' to be overwritten by template->{VARS}{lang}='-undef-' at /usr/share/koha/C4/Templates.pm line 118. It comes from the 'honeypot'. Undef overwritten by undef does not make me much wiser. Am I mistaken that this code looks like a bug itself? if(exists $self->{VARS}{lang}) { warn "Preventing \$template->lang='" . ($self->{vars}{lang}//'-undef-') . "' to be overwritten by template->{VARS}{lang}='" . ($self->{VARS}{lang}//'-undef-') . "'"; delete $self->{VARS}{lang}; } Should we replace $self->{vars}{lang} here by $vars->{lang}, which comes from $self->lang ??