[Bug 29138] New: LoadSearchHistoryToTheFirstLoggedUser should save 0 instead of "no"
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Bug ID: 29138 Summary: LoadSearchHistoryToTheFirstLoggedUser should save 0 instead of "no" Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Searching Assignee: koha-bugs@lists.koha-community.org Reporter: andrew@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org The syspref LoadSearchHistoryToTheFirstLoggedUser saves a 1 when turned on, but a "no" when turned off. It should be a 0 when turned off. When a "no" is saved, the syspref behaves as if it's turned on. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #1 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 125462 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125462&action=edit Bug 29138: Use zero instead of no in LoadSearchHistoryToTheFirstLoggedUser To test: - apply patch - set LoadSearchHistoryToTheFirstLoggedUser to 'Don't add' - confirm via sql that value=0 - confirm on OPAC that search history is not loaded to account on login -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |andrew@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125462|0 |1 is obsolete| | --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 125717 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125717&action=edit Bug 29138: Use zero instead of no in LoadSearchHistoryToTheFirstLoggedUser To test: - apply patch - set LoadSearchHistoryToTheFirstLoggedUser to 'Don't add' - confirm via sql that value=0 - confirm on OPAC that search history is not loaded to account on login Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- Testing notes (koha-testing-docker): 1. Check that LoadSearchHistoryToTheFirstLoggedUser is not working as expected when set to 'Don't add': a. Set LoadSearchHistoryToTheFirstLoggedUser to 'Add' b. In the OPAC make sure you are logged out c. Perform some searches d. Check search history is recorded by selecting "Search history" in the top-right navigation menu e. Log in as a user f. Check search history recorded (From the top-right navigation menu select Welcome, [username] > Search history) g. Search history should be populated with searches from when not logged in h. Select all then select 'Remove selected searches' i. Change LoadSearchHistoryToTheFirstLoggedUser to 'Don't add' j. Repeat from b-g k. Search history will still be shown, even though it should be empty 2. Check database to see what value is recorded: a. koha-mysql kohadev b. SQL query: select * from systempreferences where variable='LoadSearchHistoryToTheFirstLoggedUser'; c. When LoadSearchHistoryToTheFirstLoggedUser is set to 'Don't add' value = "no" 3. Apply the patch. 4. Update the database (updatedatabase) and restart services (restart_all) 5. Check value in database again from step 2 - value should now be 0 6. Repeat the steps from 1 - this time it should work as expected, that is: . When LoadSearchHistoryToTheFirstLoggedUser is set to 'Don't add' . Search history should be empty when you log in 7. Sign-off! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125717|0 |1 is obsolete| | --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 125856 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125856&action=edit Bug 29138: Use zero instead of no in LoadSearchHistoryToTheFirstLoggedUser To test: - apply patch - set LoadSearchHistoryToTheFirstLoggedUser to 'Don't add' - confirm via sql that value=0 - confirm on OPAC that search history is not loaded to account on login Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com Depends on| |22824 --- Comment #5 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Caused by commit 1fe1b704f9a81172f2a6b86367b314572a854d18 Bug 22824: Fix yes/no vs 1/0 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22824 [Bug 22824] Replace YAML::Syck with YAML::XS -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA --- Comment #6 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- UPDATE systempreferences SET value= IF(value='no',0,1) What if it's 0 already? :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #6)
UPDATE systempreferences SET value= IF(value='no',0,1)
What if it's 0 already? :)
Good catch! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125856|0 |1 is obsolete| | --- Comment #8 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 125886 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125886&action=edit Bug 29138: Use zero instead of no in LoadSearchHistoryToTheFirstLoggedUser To test: - apply patch - set LoadSearchHistoryToTheFirstLoggedUser to 'Don't add' - confirm via sql that value=0 - confirm on OPAC that search history is not loaded to account on login Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #9 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Updated to: UPDATE systempreferences SET value= IF(value in (0,'no'),0,1) WHERE variable = 'LoadSearchHistoryToTheFirstLoggedUser'; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #10 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Andrew Fuerste-Henry from comment #9)
Updated to: UPDATE systempreferences SET value= IF(value in (0,'no'),0,1) WHERE variable = 'LoadSearchHistoryToTheFirstLoggedUser';
Does it work? MariaDB [koha_kohadev]> select value from systempreferences where variable="LoadSearchHistoryToTheFirstLoggedUser"; +-------+ | value | +-------+ | no | +-------+ 1 row in set (0.001 sec) MariaDB [koha_kohadev]> UPDATE systempreferences SET value=IF(value in (0,'no'),0,1) WHERE variable = 'LoadSearchHistoryToTheFirstLoggedUser'; ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'no' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #11 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Huh, I didn't get that error: MariaDB [koha_kohadev]> select value from systempreferences where variable="LoadSearchHistoryToTheFirstLoggedUser"; +-------+ | value | +-------+ | no | +-------+ 1 row in set (0.000 sec) MariaDB [koha_kohadev]> UPDATE systempreferences SET value= IF(value in (0,'no'),0,1) WHERE variable = 'LoadSearchHistoryToTheFirstLoggedUser'; Query OK, 1 row affected, 1 warning (0.003 sec) Rows matched: 1 Changed: 1 Warnings: 1 MariaDB [koha_kohadev]> select value from systempreferences where variable="LoadSearchHistoryToTheFirstLoggedUser"; +-------+ | value | +-------+ | 0 | +-------+ 1 row in set (0.001 sec) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125886|0 |1 is obsolete| | --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 125922 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125922&action=edit Bug 29138: Use zero instead of no in LoadSearchHistoryToTheFirstLoggedUser To test: - apply patch - set LoadSearchHistoryToTheFirstLoggedUser to 'Don't add' - confirm via sql that value=0 - confirm on OPAC that search history is not loaded to account on login Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 125923 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125923&action=edit Bug 29138: (QA follow-up) Changes to UPDATE Move the condition to the WHERE clause. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested on NULL, 0, 1, 2, no, yes. (2 and yes become 0 too. Fine.) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125923|0 |1 is obsolete| | --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 125924 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125924&action=edit Bug 29138: (QA follow-up) Changes to UPDATE Move the condition to the WHERE clause. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested on NULL, 0, 1, 2, no, yes. (2 and yes become 0 too. Fine.) Replaced IFNULL by COALESCE. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125924|0 |1 is obsolete| | --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 125925 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125925&action=edit Bug 29138: (QA follow-up) Changes to UPDATE Move the condition to the WHERE clause. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested on NULL, 0, 1, 2, no, yes. (2 and yes become 0 too. Fine.) Replaced IFNULL by COALESCE. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA --- Comment #16 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Still not working for me ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Truncated incorrect DOUBLE value: 'no' at /kohadevbox/koha/C4/Installer.pm line 736 10.5.12-MariaDB-1 Why not simply: UPDATE systempreferences SET value=0 WHERE variable='LoadSearchHistoryToTheFirstLoggedUser' and value="no"; ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #125925|0 |1 is obsolete| | --- Comment #17 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 125992 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125992&action=edit Bug 29138: (QA follow-up) Changes to UPDATE Move the condition to the WHERE clause, using COALESCE to prevent mysqlism (IFNULL) and strings for strict SQL. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested on NULL, 0, 1, 2, no, yes. (2 and yes become 0 too. Fine.) Tested strict sql mode: no truncated incorrect DOUBLE value-error anymore. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #18 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #16)
Still not working for me
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Truncated incorrect DOUBLE value: 'no' at /kohadevbox/koha/C4/Installer.pm line 736
10.5.12-MariaDB-1
Obscure message, caused by strict SQL.
Why not simply:
UPDATE systempreferences SET value=0 WHERE variable='LoadSearchHistoryToTheFirstLoggedUser' and value="no";
Current condition catches everything outside '1' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #19 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Marcel de Rooy from comment #18)
(In reply to Jonathan Druart from comment #16)
Still not working for me
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Truncated incorrect DOUBLE value: 'no' at /kohadevbox/koha/C4/Installer.pm line 736
10.5.12-MariaDB-1
Obscure message, caused by strict SQL.
Why not simply:
UPDATE systempreferences SET value=0 WHERE variable='LoadSearchHistoryToTheFirstLoggedUser' and value="no";
Current condition catches everything outside '1'
Yes, and so it catches "yes". I won't block the patch because of that, but I don't understand how it can be more correct than setting to "0" when was "no". The problem was with "no": - no : "Don't add" + 0: "Don't add" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #20 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Changing my mind, the bug title and DBrev description are "Use a zero instead of a 'no' in LoadSearchHistoryToTheFirstLoggedUser". It's what we must do, nothing else. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #21 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- DB rev will be changed to: UPDATE systempreferences SET value='0' WHERE variable='LoadSearchHistoryToTheFirstLoggedUser' AND value='no'; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #22 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Pushed to master for 21.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 --- Comment #23 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Thanks, Jonathan and everybody! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29138 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Status|Pushed to master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org