Bug 20629: (follow-up) fix reverse_col value
[koha.git] / members / member-flags.pl
index 04582ea..40ea583 100755 (executable)
@@ -84,18 +84,13 @@ if ($input->param('newflags')) {
     }
     
     $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?");
-    if( !C4::Context->preference('ProtectSuperlibrarianPrivileges') || C4::Context->IsSuperLibrarian ) {
-        $sth->execute($module_flags, $member);
-    } else {
-        my $old_flags = $patron->flags // 0;
-        if( ( $old_flags == 1 || $module_flags == 1 ) &&
-              $old_flags != $module_flags ) {
-           die "Non-superlibrarian is changing superlibrarian privileges"; # Interface should not allow this, so we can just die here
-        } else {
-            $sth->execute($module_flags, $member);
-        }
+    my $old_flags = $patron->flags // 0;
+    if( ( $old_flags == 1 || $module_flags == 1 ) &&
+      $old_flags != $module_flags ) {
+        die "Non-superlibrarian is changing superlibrarian privileges" if !C4::Context->IsSuperLibrarian && C4::Context->preference('ProtectSuperlibrarianPrivileges'); # Interface should not allow this, so we can just die here
     }
-    
+    $sth->execute($module_flags, $member);
+
     # deal with subpermissions
     $sth = $dbh->prepare("DELETE FROM user_permissions WHERE borrowernumber = ?");
     $sth->execute($member); 
@@ -187,12 +182,6 @@ if ($input->param('newflags')) {
         push @loop, \%row;
     }
 
-    if ( $patron->is_child ) {
-        my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
-        $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
-        $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
-    }
-
 if (C4::Context->preference('ExtendedPatronAttributes')) {
     my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'});
     $template->param(