Bug 6132: Update sysprefs cache in set_preference
authorJulian Maurice <julian.maurice@biblibre.com>
Mon, 2 Jan 2012 09:45:55 +0000 (10:45 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 16 Jan 2012 13:52:23 +0000 (14:52 +0100)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
C4/Context.pm

index 7581faa..659ba05 100644 (file)
@@ -514,7 +514,7 @@ the sysprefs cache.
 
 sub set_preference {
     my $self = shift;
-    my $var = shift;
+    my $var = lc(shift);
     my $value = shift;
 
     my $dbh = C4::Context->dbh or return 0;
@@ -530,7 +530,9 @@ sub set_preference {
         ON DUPLICATE KEY UPDATE value = VALUES(value)
     " );
 
-    $sth->execute( $var, $value );
+    if($sth->execute( $var, $value )) {
+        $sysprefs{$var} = $value;
+    }
     $sth->finish;
 }