Bug 5917 : Fixing messaging preferences
authorChris Cormack <chrisc@catalyst.net.nz>
Mon, 4 Apr 2011 01:53:25 +0000 (13:53 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 4 Apr 2011 02:15:14 +0000 (14:15 +1200)
C4/Form/MessagingPreferences.pm
installer/data/mysql/de-DE/optional/sample_notices_message_attributes.sql
installer/data/mysql/en/optional/sample_notices_message_attributes.sql
installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql
installer/data/mysql/nb-NO/2-Valgfritt/sample_notices_message_attributes.sql
installer/data/mysql/pl-PL/optional/sample_notices_message_attributes.sql
installer/data/mysql/ru-RU/optional/sample_notices_message_attributes.sql
installer/data/mysql/uk-UA/optional/sample_notices_message_attributes.sql
installer/data/mysql/updatedatabase.pl

index 86f09db..808719f 100644 (file)
@@ -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.
index 627b617..b505486 100644 (file)
@@ -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
index 6dab837..a7a6032 100644 (file)
@@ -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);
 
index 1834063..8e919e9 100644 (file)
@@ -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);
 
index 6dab837..a7a6032 100644 (file)
@@ -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);
 
index 1834063..8e919e9 100644 (file)
@@ -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);
 
index 7cf9a7a..c9d9bd1 100644 (file)
@@ -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);
 
index dd12938..75e2793 100644 (file)
@@ -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);
 
index 5c71849..e79f60f 100755 (executable)
@@ -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)