Bug 18426: Make sure the logged in user can edit the subscriptions
[koha.git] / admin / preferences.pl
index 24bffce..1e12b1e 100755 (executable)
@@ -186,6 +186,15 @@ sub TransformPrefsToHTML {
                         push @chunks, $piece;
                     }
                 } else {
+                    if ( $piece ) {
+                        my $version = Koha::version();
+                        my ( $major, $minor, $maintenance, $development ) = split( '\.', $version );
+                        if ( $minor % 2 ) {
+                            $piece =~ s|__VERSION__|${major}_${minor}|g;
+                        } else {
+                            $piece =~ s|__VERSION__|master|g;
+                        }
+                    }
                     push @chunks, { type_text => 1, contents => $piece };
                 }
             }
@@ -305,17 +314,14 @@ $tab ||= 'acquisitions'; # Ideally this should be "local-use" but preferences.pl
 my $highlighted;
 
 if ( $op eq 'save' ) {
-    unless ( C4::Context->config( 'demo' ) ) {
-        foreach my $param ( $input->param() ) {
-            my ( $pref ) = ( $param =~ /pref_(.*)/ );
+    foreach my $param ( $input->param() ) {
+        my ( $pref ) = ( $param =~ /pref_(.*)/ );
 
-            next if ( !defined( $pref ) );
+        next if ( !defined( $pref ) );
 
-            my $value = join( ',', $input->param( $param ) );
+        my $value = join( ',', $input->param( $param ) );
 
-            C4::Context->set_preference( $pref, $value );
-            logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value );
-        }
+        C4::Context->set_preference( $pref, $value );
     }
 
     print $input->redirect( '/cgi-bin/koha/admin/preferences.pl?tab=' . $tab );