| 
      
            Lines 154-159
          sub search_patrons_to_anonymise {
      
      
        Link Here
      
     | 
  
        
          | 154 | 
                ( C4::Context->preference('IndependentBranches') && C4::Context->userenv && !C4::Context->IsSuperLibrarian() && C4::Context->userenv->{branch} ) | 
          154 | 
                ( C4::Context->preference('IndependentBranches') && C4::Context->userenv && !C4::Context->IsSuperLibrarian() && C4::Context->userenv->{branch} ) | 
        
        
          | 155 | 
                ? C4::Context->userenv->{branch} | 
          155 | 
                ? C4::Context->userenv->{branch} | 
        
        
          | 156 | 
                : undef;  | 
          156 | 
                : undef;  | 
        
            
               | 
               | 
              157 | 
                  my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; | 
            
        
          | 157 | 
           | 
          158 | 
           | 
        
        
          | 158 | 
              my $dtf = Koha::Database->new->schema->storage->datetime_parser;  | 
          159 | 
              my $dtf = Koha::Database->new->schema->storage->datetime_parser;  | 
        
        
          | 159 | 
              my $rs = $class->_resultset->search(  | 
          160 | 
              my $rs = $class->_resultset->search(  | 
        
  
    | 
      
            Lines 161-166
          sub search_patrons_to_anonymise {
      
      
        Link Here
      
     | 
  
        
          | 161 | 
                      'old_issues.borrowernumber' => { 'not' => undef }, | 
          162 | 
                      'old_issues.borrowernumber' => { 'not' => undef }, | 
        
        
          | 162 | 
                      privacy                     => { '<>'  => 0 },                  # Keep forever | 
          163 | 
                      privacy                     => { '<>'  => 0 },                  # Keep forever | 
        
        
          | 163 | 
                      ( $library ? ( 'old_issues.branchcode' => $library ) : () ),  | 
          164 | 
                      ( $library ? ( 'old_issues.branchcode' => $library ) : () ),  | 
        
            
               | 
               | 
              165 | 
                          ( $anonymous_patron ? ( 'old_issues.borrowernumber' => { '!=' => $anonymous_patron } ) : () ), | 
            
        
          | 164 | 
                  },  | 
          166 | 
                  },  | 
        
        
          | 165 | 
                  {   join     => ["old_issues"], | 
          167 | 
                  {   join     => ["old_issues"], | 
        
        
          | 166 | 
                      distinct => 1,  | 
          168 | 
                      distinct => 1,  | 
        
            
              | 167 | 
              -   | 
               | 
               |