Bug 33300

Summary: Wrong system preference name AutomaticWrongTransfer
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: CirculationAssignee: Fridolin Somers <fridolin.somers>
Status: RESOLVED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: david, dcook, gmcharlt, jonathan.druart, kyle.m.hall, lucas, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33297
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.06
Bug Depends on: 29792    
Bug Blocks: 34495    
Attachments: Bug 33300: Wrong system preference name AutomaticWrongTransfer
Bug 33300: Wrong system preference name AutomaticWrongTransfer
Bug 33300: Wrong system preference name AutomaticWrongTransfer
Bug 33300: (follow-up) DBRev for existing databases
Bug 33300: (follow-up) DBRev for existing databases
Bug 33300: Wrong system preference name AutomaticWrongTransfer
Bug 33300: (follow-up) DBRev for existing databases
Bug 33300: [22.05.x] (follow-up) DBRev for existing databases
Bug 33300: [22.05.x] Wrong system preference name AutomaticWrongTransfer
Bug 33300: [22.05.x] (follow-up) DBRev for existing databases

Description Fridolin Somers 2023-03-22 08:48:44 UTC
Bug 29792 added a DBRev with new system preference 'AutomaticConfirmTransfer'.

But value in installer/data/mysql/mandatory/sysprefs.sql is wrong :
+('AutomaticWrongTransfer','0',NULL,'Defines whether transfers should be automatically confirmed at checkin if modal dismissed','YesNo'),
Comment 1 Fridolin Somers 2023-03-22 08:50:02 UTC
Since it is 0 by default, I think we do not have to fix recently created databases that do not have this preference, it will be created if enabled.
Comment 2 Fridolin Somers 2023-03-22 08:58:22 UTC
Created attachment 148505 [details] [review]
Bug 33300: Wrong system preference name AutomaticWrongTransfer

Bug 29792 added a DBRev with new system preference 'AutomaticConfirmTransfer'.

But name in installer/data/mysql/mandatory/sysprefs.sql is wrong 'AutomaticWrongTransfer'

Test plan :
Create a new database and check there is in table systempreferences an
entry with variable='AutomaticConfirmTransfer'
Comment 3 David Nind 2023-03-22 09:29:48 UTC
Created attachment 148508 [details] [review]
Bug 33300: Wrong system preference name AutomaticWrongTransfer

Bug 29792 added a DBRev with new system preference 'AutomaticConfirmTransfer'.

But name in installer/data/mysql/mandatory/sysprefs.sql is wrong 'AutomaticWrongTransfer'

Test plan :
Create a new database and check there is in table systempreferences an
entry with variable='AutomaticConfirmTransfer'

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2023-03-22 09:30:15 UTC Comment hidden (obsolete)
Comment 5 David Nind 2023-03-22 09:40:42 UTC
Testing notes using KTD (take 2):

1. Searched system preferences installer file (installer/data/mysql/mandatory/sysprefs.sql)for AutomaticWrongTransfer and AutomaticConfirmTransfer - only AutomaticWrongTransfer is in the file.

2. In the staff interface > Administration > System preferences, search for AutomaticWrongTransfer and AutomaticConfirmTransfer - only AutomaticConfirmTransfer is found.

3. Search the database for the two system preferences - only AutomaticWrongTransfer is found - SQL queries:
   . select * from systempreferences where variable = "AutomaticWrongTransfer";
   . select * from systempreferences where variable = "AutomaticConfirmTransfer";

4. Edit the system preference AutomaticConfirmTransfer in the staff interface - change "Don't" to "Do".

5. Search the database again as in step 3 - both system preferences now exist found.

6. Apply the patch.

7. Run reset_all

8. Note that:
   . When searching installer/data/mysql/mandatory/sysprefs.sql (as per step 1), only AutomaticConfirmTransfer is now found.
   . When searching the database (as per step 3), only AutomaticConfirmTransfer is now found.
   . If you change AutomaticConfirmTransfer in the staff interface (as per step 2 and 3), the value is updated for AutomaticConfirmTransfer.
Comment 6 Jonathan Druart 2023-03-22 13:21:09 UTC
(In reply to Fridolin Somers from comment #1)
> Since it is 0 by default, I think we do not have to fix recently created
> databases that do not have this preference, it will be created if enabled.

I think we should remove the existing one and create the correct one.
Comment 7 Fridolin Somers 2023-03-22 19:55:52 UTC
OK, like for bug 33297 ?
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148504
Comment 8 Marcel de Rooy 2023-03-23 06:34:37 UTC
Created attachment 148581 [details] [review]
Bug 33300: Wrong system preference name AutomaticWrongTransfer

Bug 29792 added a DBRev with new system preference 'AutomaticConfirmTransfer'.

But name in installer/data/mysql/mandatory/sysprefs.sql is wrong 'AutomaticWrongTransfer'

Test plan :
Create a new database and check there is in table systempreferences an
entry with variable='AutomaticConfirmTransfer'

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Marcel de Rooy 2023-03-23 06:36:16 UTC
(In reply to Jonathan Druart from comment #6)
> (In reply to Fridolin Somers from comment #1)
> > Since it is 0 by default, I think we do not have to fix recently created
> > databases that do not have this preference, it will be created if enabled.
> 
> I think we should remove the existing one and create the correct one.

No blocker for me, but I would say yes, add a trivial dbrev too. Last word to RM.
Comment 10 Fridolin Somers 2023-03-23 07:17:28 UTC
Created attachment 148585 [details] [review]
Bug 33300: (follow-up) DBRev for existing databases

Test plan :
1.1) Start from a Koha 22.05
1.2) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' renamed 'AutomaticConfirmTransfer'
2.1) Start from a Koha 22.05
2.2) Upgrade to 22.11
2.3) Via interface change system preference 'AutomaticConfirmTransfer' and save
2.4) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' deleted
Comment 11 David Cook 2023-03-30 06:01:09 UTC
Hoping to look at these soon...
Comment 12 Katrin Fischer 2023-04-16 00:02:37 UTC
Created attachment 149721 [details] [review]
Bug 33300: (follow-up) DBRev for existing databases

Test plan :
1.1) Start from a Koha 22.05
1.2) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' renamed 'AutomaticConfirmTransfer'
2.1) Start from a Koha 22.05
2.2) Upgrade to 22.11
2.3) Via interface change system preference 'AutomaticConfirmTransfer' and save
2.4) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' deleted

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Marcel de Rooy 2023-04-18 11:48:19 UTC
What you actually need, is:
UPDATE systempreferences SET variable='AutomaticConfirmTransfer' WHERE variable='AutomaticWrongTransfer'
This works always. No need to count, delete, etc.
You could even catch the number of updated recs.
No blocker, just noting for next time :)
Comment 14 Marcel de Rooy 2023-04-18 11:49:00 UTC
Created attachment 149793 [details] [review]
Bug 33300: Wrong system preference name AutomaticWrongTransfer

Bug 29792 added a DBRev with new system preference 'AutomaticConfirmTransfer'.

But name in installer/data/mysql/mandatory/sysprefs.sql is wrong 'AutomaticWrongTransfer'

Test plan :
Create a new database and check there is in table systempreferences an
entry with variable='AutomaticConfirmTransfer'

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 15 Marcel de Rooy 2023-04-18 11:49:03 UTC
Created attachment 149794 [details] [review]
Bug 33300: (follow-up) DBRev for existing databases

Test plan :
1.1) Start from a Koha 22.05
1.2) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' renamed 'AutomaticConfirmTransfer'
2.1) Start from a Koha 22.05
2.2) Upgrade to 22.11
2.3) Via interface change system preference 'AutomaticConfirmTransfer' and save
2.4) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' deleted

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 16 Tomás Cohen Arazi 2023-04-24 13:50:02 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 17 Fridolin Somers 2023-05-04 20:45:16 UTC
Please backport this.
Comment 18 Jacob O'Mara 2023-05-10 12:54:38 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 19 Lucas Gass 2023-05-15 21:17:44 UTC
Doesn't apply cleanly to 22.05.x, if needed please rebase.
Comment 20 Fridolin Somers 2023-05-16 07:09:11 UTC
Created attachment 151246 [details] [review]
Bug 33300: [22.05.x] (follow-up) DBRev for existing databases

Test plan :
1.1) Start from a Koha 22.05
1.2) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' renamed 'AutomaticConfirmTransfer'
2.1) Start from a Koha 22.05
2.2) Upgrade to 22.11
2.3) Via interface change system preference 'AutomaticConfirmTransfer' and save
2.4) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' deleted

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 21 Fridolin Somers 2023-05-16 07:10:00 UTC
Created attachment 151247 [details] [review]
Bug 33300: [22.05.x] Wrong system preference name AutomaticWrongTransfer

Bug 29792 added a DBRev with new system preference 'AutomaticConfirmTransfer'.

But name in installer/data/mysql/mandatory/sysprefs.sql is wrong 'AutomaticWrongTransfer'

Test plan :
Create a new database and check there is in table systempreferences an
entry with variable='AutomaticConfirmTransfer'

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 22 Fridolin Somers 2023-05-16 07:10:03 UTC
Created attachment 151248 [details] [review]
Bug 33300: [22.05.x] (follow-up) DBRev for existing databases

Test plan :
1.1) Start from a Koha 22.05
1.2) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' renamed 'AutomaticConfirmTransfer'
2.1) Start from a Koha 22.05
2.2) Upgrade to 22.11
2.3) Via interface change system preference 'AutomaticConfirmTransfer' and save
2.4) Upgrade to master
=> Check the upgrade says :
   Wrong system preference 'AutomaticWrongTransfer' deleted

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 23 Fridolin Somers 2023-05-16 07:11:20 UTC
(In reply to Lucas Gass from comment #19)
> Doesn't apply cleanly to 22.05.x, if needed please rebase.

Here are the patches.
This is needed where Bug 29792 as been pushed : 22.11.00,22.05.10, 21.11.18