As a result of: [Mon Oct 01 15:28:59 2012] [error] [client 192.168.100.2] [Mon Oct 1 15:28:59 2012] marctagstructure.pl: Use of uninitialized value in numeric eq (==) at /usr/share/koha/intranet/cgi-bin/admin/marctagstructure.pl line 152. in Koha 3.8.5 this patch was generated. The line reads unless (C4::Context->config('demo') == 1) { which produces an error long entry while tweaking frameworks. It should read: unless (defined(C4::Context->config('demo')) && C4::Context->config('demo') == 1) { -- though this will still generate an error if the value isn't numeric. I'm going to assume that whoever does use it, will use it correctly. My understanding is that this value must be set to 1 in koha-conf.xml to prevent writing out MARC Framework changes (adds or modifies). However, since 'demo' is not defined in the default koha-conf.xml, this generates an error. This feature is not documented anywhere, as far as I know. Though 'demo' code does seem to exist in a couple places in Koha. Patch to follow.
It would seem that admin/auth_tag_structure.pl, admin/marc_subfields_structure.pl, admin/marctagstructure.pl, and admin/auth_subfields_structure.pl all need their condition revised. However, since I only found marctagstructure.pl in the error logs and since I can reproduce it, only marctagstructure.pl will be fixed. However, not with a ==1 or eq 1, but by removing the operator portion completely as is elsewhere. This is a grep from 3.8.x: $ grep "'demo'" `find .` ./admin/auth_tag_structure.pl: unless (C4::Context->config('demo') eq 1) { ./admin/auth_tag_structure.pl: unless (C4::Context->config('demo') eq 1) { ./admin/marc_subfields_structure.pl: unless ( C4::Context->config('de mo') eq 1 ) { ./admin/marc_subfields_structure.pl: unless ( C4::Context->config('demo') eq 1 ) { ./admin/preferences.pl: unless ( C4::Context->config( 'demo' ) ) { ./admin/marctagstructure.pl: unless (C4::Context->config('demo') == 1) { ./admin/marctagstructure.pl: unless (C4::Context->config('demo') == 1) { ./admin/auth_subfields_structure.pl: unless (C4::Context->con fig('demo') eq 1) { ./admin/auth_subfields_structure.pl: unless (C4::Context->config('demo') eq 1 ) { ./admin/systempreferences.pl: unless ( C4::Context->config('demo') ) { ./admin/systempreferences.pl: unless ( C4::Context->config('demo') ) { ./admin/systempreferences.pl: unless ( C4::Context->config('demo') ) { ./admin/systempreferences.pl: unless ( C4::Context->config('demo') ) { ./C4/Auth.pm: if ( $userid && $userid eq 'demo' ./C4/Auth.pm: && "$password" eq 'demo' ./C4/Auth.pm: && C4::Context->config('demo') ) ./C4/Auth.pm: elsif ( $userid eq 'demo' && C4::Context->config('demo') ) { ./debian/scripts/koha-run-backups:# - dump all sites, except one called 'demo' ./svc/config/systempreferences: unless ( C4::Context->config('demo') ) { ./svc/config/systempreferences: unless ( C4::Context->config( 'demo' ) ) { ./installer/InstallAuth.pm: && $userid eq 'demo' ./installer/InstallAuth.pm: && "$password" eq 'demo' ./installer/InstallAuth.pm: && C4::Context->config('demo') )
Created attachment 12616 [details] [review] Fix error logging triggered by adding/editing/deleting tags on framework Test ----- 1) Login 2) Administration 3) MARC bibliographic framework 4) Click 'MARC structure' for any framework. (May be a good idea to copy a frame work and choose the copy, since we will be deleting things!) 5) Click 'Edit' for any field. 6) Change values and then click 'Save Changes'. 7) Click 'Delete' for that field now. 8) click 'Yes, Delete this Tag' 9) Click 'OK' 10) click 'New Tag' 11) Let's enter the tag value of what we just deleted and put some dummy values in. 12) Check the error logs. There should be three errors. The first and last will be for the edit/add, and the middle will be for the delete. 13) Apply patch 14) repeat steps 3 through 12. 15) Error log entries those errors are no longer generated.
This bug applies to master, 3.8.x, and 3.6.x versions of koha. Patch was generated from master. Applied to all three. Let me know if there's a problem.
Created attachment 12674 [details] [review] Bug 8739 follow-up fixing perlcritic error This patch is not related nor introduced by bug 8739, but while qa-ing it, I found those 2 perlcritic violation this patch fixes it ! I also fixed a tiny indentation problem
Created attachment 12707 [details] [review] Bug 8849 - Error log generated when not a demo system Changed two lines similar to: unless (C4::Context->config('demo') == 1) { into lines similar to: unless (C4::Context->config('demo')) { By removing the == 1, undefined = false without an error. The value of demo is supposedly set by a koha-conf.xml variable, but there is very little documentation on this "demo mode" beyond the set it to 1 in koha conf for demo mode. Also, demo doesn't exist in the default koha-conf.xml file generated. So anyone who knows to create it, will likely create it the proper way and with the proper value. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment on attachment 12674 [details] [review] Bug 8739 follow-up fixing perlcritic error Fixes perl-critic errors unrelated to this bug, but found while QA-ing this bug, but this patch still needs sign off. Not sure how it got obsoleted in the first place. Making this not obsoleted.
Comment on attachment 12674 [details] [review] Bug 8739 follow-up fixing perlcritic error moved obsolete attachment to bug 7595 as per wajasu's suggestion.
Created attachment 12718 [details] [review] 0001-SIGNED-OFF-Bug-8849-Error-log-generated-when-not-a-demo.patch When testing as comment #2 enumerates, I just tailed the log, and saved the interaction. Then I did the same after the patch. I compared the two visually, and saw the error messages pertaining to the == error were gone. The editor functioned editing/saving just fine. Yes there is other uninitialized error noise from other places(in master only). I applied it to master, origin/3.8.x and origin/3.6.x as well, and they applied cleanly, and all passed testing. TEST PASSED. wajasu
Though targeted at 3.8, so don't lose track that it should also be applied to master.
QA comment: * tiny patch * koha-qa.pl OK, except for a problem that was here before the patch (a tab) passed QA
FYI : the "demo" mode has been introduced a long time ago -by me IIRC- If set to 1, there user ca log-in with demo/demo, whatever the database, and can't modify sysprefs & some other setups (not sure I remember exactly which ones) I agree it's deeply deprecated and could be completely removed from Koha In the meantime, patch pushed
Pushed to 3.8.x, will be in 3.8.7