From 79e8b928ab009b8ba81f0db8b3c0f45605a89621 Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Tue, 5 Mar 2013 11:39:54 +1300 Subject: [PATCH] Bug 9745 - don't nuke translated strings in permissions on DB upgrade To test: (this is best done by someone who has a database with translated strings for user permissions - I'm looking towards Katrin. :)) Get a 3.6-3.8 era database loaded as test data - also please use a low value test database. Translate or change the strings in the database for the user permissions that follow in mysql client (for those who didn't install with a different language that has translated files at install time) - update userflags set flagdesc="Translated text 1" where flag IN('catalogue','editauthorities','reports','management','serials', 'updatecharges','circulate','parameters','borrowers','tools', 'staffaccess','edit_patrons'); (you will notice that this changes all of the permission labels in the interface to "translated text 1" for the affected permission flags. This is why I don't want you to use a high value test database.) Update that to master + this patch - your "translations" should be intact. Blow that database away, and make a brand new one 3.6-3.8 era with the english database definitions. Run the update again with this patch, the strings should be updated correctly. Signed-off-by: Magnus Enger There was a typo in the patch, the first database update had to be changed from this: $dbh->do{(q{ to this: $dbh->do(q{ * Test 1: - git checkout v3.06.05 - Run through the web installer in Norwegian, installing all Norwegian sample data - git checkout - Run web installer/upgrade - Almost all of the permissions are still in Norwegian. The ones that are in English are not touched by the database update for 3.11.00.016, so they must have been introduced by other updates. * Test 2: - git checkout v3.06.05 - Run through the web installer in English, installing all English sample data - git checkout - Run web installer/upgrade - All permissions have been updated as expected, except "Perform batch modification of patrons" which is not in the 'userflags' table, but in the 'permissions' table. I have amended the patch to account for this. Two fixes to the original patch, please give a shout if this makes a second signoff necessary! Signed-off-by: Katrin Fischer I tested this on an English and a German sample base updating from 3.06.07 successfully. Signed-off-by: Jared Camins-Esakov Corrected incorrect field names in the last query (it's permissions.description not permissions.flagdesc). --- installer/data/mysql/updatedatabase.pl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1aee65924b..a3f31a738c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6347,43 +6347,43 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $DBversion = "3.11.00.016"; if ( CheckVersion($DBversion) ) { $dbh->do(q{ - UPDATE userflags SET flagdesc="Required for staff login. Staff access, allows viewing of catalogue in staff client." where flag="catalogue"; + UPDATE userflags SET flagdesc="Required for staff login. Staff access, allows viewing of catalogue in staff client." where flagdesc="Modify login / permissions for staff users"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Edit Authorities" where flag="editauthorities"; + UPDATE userflags SET flagdesc="Edit Authorities" where flagdesc="Allow to edit authorities"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Allow access to the reports module" where flag="reports"; + UPDATE userflags SET flagdesc="Allow access to the reports module" where flagdesc="Allow to access to the reports module"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Set library management parameters (deprecated)" where flag="management"; + UPDATE userflags SET flagdesc="Set library management parameters (deprecated)" where flagdesc="Set library management parameters"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Manage serial subscriptions" where flag="serials"; + UPDATE userflags SET flagdesc="Manage serial subscriptions" where flagdesc="Allow to manage serials subscriptions"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Manage patrons fines and fees" where flag="updatecharges"; + UPDATE userflags SET flagdesc="Manage patrons fines and fees" where flagdesc="Update borrower charges"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Check out and check in items" where flag="circulate"; + UPDATE userflags SET flagdesc="Check out and check in items" where flagdesc="Circulate books"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Manage Koha system settings (Administration panel)" where flag="parameters"; + UPDATE userflags SET flagdesc="Manage Koha system settings (Administration panel)" where flagdesc="Set Koha system parameters"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Add or modify patrons" where flag="borrowers"; + UPDATE userflags SET flagdesc="Add or modify patrons" where flagdesc="Add or modify borrowers"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Use all tools (expand for granular tools permissions)" where flag="tools"; + UPDATE userflags SET flagdesc="Use all tools (expand for granular tools permissions)" where flagdesc="Use tools (export, import, barcodes)"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Allow staff members to modify permissions for other staff members" where flag="staffaccess"; + UPDATE userflags SET flagdesc="Allow staff members to modify permissions for other staff members" where flagdesc="Set user permissions"; }); $dbh->do(q{ - UPDATE userflags SET flagdesc="Perform batch modification of patrons" where flag="edit_patrons"; + UPDATE permissions SET description="Perform batch modification of patrons" where description="Perform batch modifivation of patrons"; }); - print "Upgrade to $DBversion done (Bug 9382 - refresh permission descriptions to make more sense)\n"; + print "Upgrade to $DBversion done (Bug 9382 (updated with bug 9745) - refresh permission descriptions to make more sense)\n"; SetVersion ($DBversion); } -- 2.39.5