From ec41514be6c608f1516652d6182d813add6a1f3a Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 4 Apr 2011 13:53:25 +1200 Subject: [PATCH] Bug 5917 : Fixing messaging preferences --- C4/Form/MessagingPreferences.pm | 2 -- .../optional/sample_notices_message_attributes.sql | 10 +++++----- .../optional/sample_notices_message_attributes.sql | 10 +++++----- .../sample_notices_message_attributes.sql | 10 +++++----- .../sample_notices_message_attributes.sql | 10 +++++----- .../optional/sample_notices_message_attributes.sql | 10 +++++----- .../optional/sample_notices_message_attributes.sql | 10 +++++----- .../optional/sample_notices_message_attributes.sql | 10 +++++----- installer/data/mysql/updatedatabase.pl | 14 +++++++++++++- 9 files changed, 48 insertions(+), 38 deletions(-) diff --git a/C4/Form/MessagingPreferences.pm b/C4/Form/MessagingPreferences.pm index 86f09dbf55..808719f1c4 100644 --- a/C4/Form/MessagingPreferences.pm +++ b/C4/Form/MessagingPreferences.pm @@ -121,8 +121,6 @@ sub set_form_values { # walk through the options and update them with these borrower_preferences my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); PREF: foreach my $option ( @$messaging_options ) { - $option=~ s/ /\_/g; - $option=~ s/\-/\_/g; my $pref = C4::Members::Messaging::GetMessagingPreferences( { %{ $target_params }, message_name => $option->{'message_name'} } ); $option->{ $option->{'message_name'} } = 1; # make a hashref of the days, selecting one. diff --git a/installer/data/mysql/de-DE/optional/sample_notices_message_attributes.sql b/installer/data/mysql/de-DE/optional/sample_notices_message_attributes.sql index 627b617c29..b505486d8f 100644 --- a/installer/data/mysql/de-DE/optional/sample_notices_message_attributes.sql +++ b/installer/data/mysql/de-DE/optional/sample_notices_message_attributes.sql @@ -1,8 +1,8 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item DUE', 0), -(2, 'Advance Notice', 1), -(4, 'Hold Filled', 0), -(5, 'Item Check-in', 0), -(6, 'Item Checkout', 0); \ No newline at end of file +(1, 'Item_DUE', 0), +(2, 'Advance_Notice', 1), +(4, 'Hold_Filled', 0), +(5, 'Item_Check_in', 0), +(6, 'Item_Checkout', 0); \ No newline at end of file diff --git a/installer/data/mysql/en/optional/sample_notices_message_attributes.sql b/installer/data/mysql/en/optional/sample_notices_message_attributes.sql index 6dab837258..a7a6032cc7 100644 --- a/installer/data/mysql/en/optional/sample_notices_message_attributes.sql +++ b/installer/data/mysql/en/optional/sample_notices_message_attributes.sql @@ -1,9 +1,9 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item Due', 0), -(2, 'Advance Notice', 1), -(4, 'Hold Filled', 0), -(5, 'Item Check-in', 0), -(6, 'Item Checkout', 0); +(1, 'Item_Due', 0), +(2, 'Advance_Notice', 1), +(4, 'Hold_Filled', 0), +(5, 'Item_Check_in', 0), +(6, 'Item_Checkout', 0); diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql index 1834063bec..8e919e9137 100644 --- a/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql +++ b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql @@ -1,9 +1,9 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item DUE', 0), -(2, 'Advance Notice', 1), -(4, 'Hold Filled', 0), -(5, 'Item Check-in', 0), -(6, 'Item Checkout', 0); +(1, 'Item_DUE', 0), +(2, 'Advance_Notice', 1), +(4, 'Hold_Filled', 0), +(5, 'Item_Check_in', 0), +(6, 'Item_Checkout', 0); diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/sample_notices_message_attributes.sql b/installer/data/mysql/nb-NO/2-Valgfritt/sample_notices_message_attributes.sql index 6dab837258..a7a6032cc7 100644 --- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_notices_message_attributes.sql +++ b/installer/data/mysql/nb-NO/2-Valgfritt/sample_notices_message_attributes.sql @@ -1,9 +1,9 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item Due', 0), -(2, 'Advance Notice', 1), -(4, 'Hold Filled', 0), -(5, 'Item Check-in', 0), -(6, 'Item Checkout', 0); +(1, 'Item_Due', 0), +(2, 'Advance_Notice', 1), +(4, 'Hold_Filled', 0), +(5, 'Item_Check_in', 0), +(6, 'Item_Checkout', 0); diff --git a/installer/data/mysql/pl-PL/optional/sample_notices_message_attributes.sql b/installer/data/mysql/pl-PL/optional/sample_notices_message_attributes.sql index 1834063bec..8e919e9137 100644 --- a/installer/data/mysql/pl-PL/optional/sample_notices_message_attributes.sql +++ b/installer/data/mysql/pl-PL/optional/sample_notices_message_attributes.sql @@ -1,9 +1,9 @@ insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item DUE', 0), -(2, 'Advance Notice', 1), -(4, 'Hold Filled', 0), -(5, 'Item Check-in', 0), -(6, 'Item Checkout', 0); +(1, 'Item_DUE', 0), +(2, 'Advance_Notice', 1), +(4, 'Hold_Filled', 0), +(5, 'Item_Check_in', 0), +(6, 'Item_Checkout', 0); diff --git a/installer/data/mysql/ru-RU/optional/sample_notices_message_attributes.sql b/installer/data/mysql/ru-RU/optional/sample_notices_message_attributes.sql index 7cf9a7aeed..c9d9bd181d 100644 --- a/installer/data/mysql/ru-RU/optional/sample_notices_message_attributes.sql +++ b/installer/data/mysql/ru-RU/optional/sample_notices_message_attributes.sql @@ -3,9 +3,9 @@ truncate message_attributes; insert into `message_attributes` (`message_attribute_id`, message_name, `takes_days`) values -(1, 'Item DUE', 0), -(2, 'Advance Notice', 1), -(4, 'Hold Filled', 0), -(5, 'Item Check-in', 0), -(6, 'Item Checkout', 0); +(1, 'Item_DUE', 0), +(2, 'Advance_Notice', 1), +(4, 'Hold_Filled', 0), +(5, 'Item_Check_in', 0), +(6, 'Item_Checkout', 0); diff --git a/installer/data/mysql/uk-UA/optional/sample_notices_message_attributes.sql b/installer/data/mysql/uk-UA/optional/sample_notices_message_attributes.sql index dd12938c70..75e27931a3 100644 --- a/installer/data/mysql/uk-UA/optional/sample_notices_message_attributes.sql +++ b/installer/data/mysql/uk-UA/optional/sample_notices_message_attributes.sql @@ -3,9 +3,9 @@ truncate message_attributes; insert into `message_attributes` (`message_attribute_id`, `message_name`, `takes_days`) values -(1, 'Item DUE' , 0), -(2, 'Advance Notice' , 1), -(4, 'Hold Filled' , 0), -(5, 'Item Check-in' , 0), -(6, 'Item Checkout' , 0); +(1, 'Item_DUE' , 0), +(2, 'Advance_Notice' , 1), +(4, 'Hold_Filled' , 0), +(5, 'Item_Check_in' , 0), +(6, 'Item_Checkout' , 0); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 5c71849207..e79f60fb63 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -864,7 +864,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } -$DBversion = "3.00.00.042"; +$DBversion = "3.00.00.04"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("ALTER TABLE aqbooksellers CHANGE name name mediumtext NOT NULL"); print "Upgrade to $DBversion done (disallow NULL in aqbooksellers.name; part of fix for bug 1251)\n"; @@ -4209,6 +4209,18 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.03.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + print "Upgrade to $DBversion done (Remove spaces and dashes from message_attribute names)\n"; + $dbh->do("UPDATE message_attributes SET message_name = 'Item_Due' WHERE message_name='Item Due'"); + $dbh->do("UPDATE message_attributes SET message_name = 'Advance_Notice' WHERE message_name='Advance_Notice'"); + $dbh->do("UPDATE message_attributes SET message_name = 'Hold_Filled' WHERE message_name='Hold Filled'"); + $dbh->do("UPDATE message_attributes SET message_name = 'Item_Check_in' WHERE message_name='Item Check-in'"); + $dbh->do("UPDATE message_attributes SET message_name = 'Item_Checkout' WHERE message_name='Item Checkout'"); + SetVersion ($DBversion); +} + + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) -- 2.39.5