| Lines 448-461
          sub GetMember {
      
      
        Link Here | 
        
          | 448 |     $debug && warn $select, " ",values %information; | 448 |     $debug && warn $select, " ",values %information; | 
        
          | 449 |     my $sth = $dbh->prepare("$select"); | 449 |     my $sth = $dbh->prepare("$select"); | 
        
          | 450 |     $sth->execute(map{$information{$_}} keys %information); | 450 |     $sth->execute(map{$information{$_}} keys %information); | 
          
            
              | 451 |     my $data = $sth->fetchall_arrayref({}); | 451 |     my $data = $sth->fetchrow_hashref; | 
            
              | 452 |     #FIXME interface to this routine now allows generation of a result set | 452 |     return $data if $data | 
            
              | 453 |     #so whole array should be returned but bowhere in the current code expects this | 453 |     # FIXME this routine can now support generation of a resultset | 
            
              | 454 |     if (@{$data} ) { | 454 |     # but until that is needed only what is expected by current | 
            
              | 455 |         return $data->[0]; | 455 |     # routines will be generated and returned for the sake of | 
            
              | 456 |     } | 456 |     # perfomance. | 
            
              | 457 |  |  |  | 
            
              | 458 |     return; | 
        
          | 459 | } | 457 | } | 
        
          | 460 |  | 458 |  | 
        
          | 461 | =head2 GetMemberRelatives | 459 | =head2 GetMemberRelatives | 
  
    | Lines 738-749
          sub AddMember {
      
      
        Link Here | 
        
          | 738 |         $data{'dateenrolled'} = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); | 736 |         $data{'dateenrolled'} = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); | 
        
          | 739 |     } | 737 |     } | 
        
          | 740 |  | 738 |  | 
          
            
              | 741 |     my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} ); | 739 |     # Check the member category privacy level | 
            
              |  |  | 740 |     my $patron_privacy = GetCategoryPrivacy( $data{'categorycode'} ); | 
        
          | 742 |     $data{'privacy'} = | 741 |     $data{'privacy'} = | 
          
            
              | 743 |         $patron_category->default_privacy() eq 'default' ? 1 | 742 |         $patron_privacy eq 'default' ? 1 | 
            
              | 744 |       : $patron_category->default_privacy() eq 'never'   ? 2 | 743 |       : $patron_privacy eq 'never'   ? 2 | 
            
              | 745 |       : $patron_category->default_privacy() eq 'forever' ? 0 | 744 |       : $patron_privacy eq 'forever' ? 0 | 
            
              | 746 |       :                                                    undef; | 745 |       : undef; | 
        
          | 747 |     # Make a copy of the plain text password for later use | 746 |     # Make a copy of the plain text password for later use | 
        
          | 748 |     my $plain_text_password = $data{'password'}; | 747 |     my $plain_text_password = $data{'password'}; | 
        
          | 749 |  | 748 |  | 
  
    | Lines 801-817
          sub Check_Userid {
      
      
        Link Here | 
        
          | 801 |  | 800 |  | 
        
          | 802 |     return 0 unless ($uid); # userid is a unique column, we should assume NULL is not unique | 801 |     return 0 unless ($uid); # userid is a unique column, we should assume NULL is not unique | 
        
          | 803 |  | 802 |  | 
          
            
              | 804 |     return 0 if ( $uid eq C4::Context->config('user') ); | 803 |     my $sql = 'SELECT borrowernumber FROM borrowers WHERE userid=?'; | 
            
              | 805 |  | 804 |     $sql .= ' AND borrowernumber != ?' if $borrowernumber; | 
            
              | 806 |     my $rs = Koha::Database->new()->schema()->resultset('Borrower'); | 805 |     my $dbh = C4::Context->dbh; | 
            
              | 807 |  | 806 |     my $sth = $dbh->prepare($sql); | 
            
              | 808 |     my $params; | 807 |     if ($borrowernumber) { | 
            
              | 809 |     $params->{userid} = $uid; | 808 |         $sth->execute( $uid, $borrowernumber ); | 
            
              | 810 |     $params->{borrowernumber} = { '!=' => $borrowernumber } if ($borrowernumber); | 809 |     } | 
            
              | 811 |  | 810 |     else { | 
            
              | 812 |     my $count = $rs->count( $params ); | 811 |         $sth->execute($uid); | 
            
              | 813 |  | 812 |     } | 
            
              | 814 |     return $count ? 0 : 1; | 813 |     my $data = $sth->fetchrow; | 
            
              |  |  | 814 |     return $data ? 0 : 1; | 
        
          | 815 | } | 815 | } | 
        
          | 816 |  | 816 |  | 
        
          | 817 | =head2 Generate_Userid | 817 | =head2 Generate_Userid | 
  
    | Lines 1308-1314
          sub checkcardnumber {
      
      
        Link Here | 
        
          | 1308 |     return 0 unless defined $cardnumber; | 1308 |     return 0 unless defined $cardnumber; | 
        
          | 1309 |  | 1309 |  | 
        
          | 1310 |     my $dbh = C4::Context->dbh; | 1310 |     my $dbh = C4::Context->dbh; | 
          
            
              | 1311 |     my $query = "SELECT * FROM borrowers WHERE cardnumber=?"; | 1311 |     my $query = "SELECT borrowernumber FROM borrowers WHERE cardnumber=?"; | 
        
          | 1312 |     $query .= " AND borrowernumber <> ?" if ($borrowernumber); | 1312 |     $query .= " AND borrowernumber <> ?" if ($borrowernumber); | 
        
          | 1313 |     my $sth = $dbh->prepare($query); | 1313 |     my $sth = $dbh->prepare($query); | 
        
          | 1314 |     $sth->execute( | 1314 |     $sth->execute( | 
  
    | Lines 1316-1322
          sub checkcardnumber {
      
      
        Link Here | 
        
          | 1316 |         ( $borrowernumber ? $borrowernumber : () ) | 1316 |         ( $borrowernumber ? $borrowernumber : () ) | 
        
          | 1317 |     ); | 1317 |     ); | 
        
          | 1318 |  | 1318 |  | 
          
            
              | 1319 |     return 1 if $sth->fetchrow_hashref; | 1319 |     return 1 if $sth->fetchrow; | 
        
          | 1320 |  | 1320 |  | 
        
          | 1321 |     my ( $min_length, $max_length ) = get_cardnumber_length(); | 1321 |     my ( $min_length, $max_length ) = get_cardnumber_length(); | 
        
          | 1322 |     return 2 | 1322 |     return 2 | 
  
    | Lines 2559-2564
          WHERE categorycode = ? AND DATEDIFF( NOW(), dateenrolled ) > ? |;
      
      
        Link Here | 
        
          | 2559 |     return $cnt; | 2559 |     return $cnt; | 
        
          | 2560 | } | 2560 | } | 
        
          | 2561 |  | 2561 |  | 
            
              |  |  | 2562 | =head2 GetBorrowecategoryHash | 
            
              | 2563 |  | 
            
              | 2564 |     $arrayref_hashref = &GetBorrowercateforyHash; | 
            
              | 2565 |  | 
            
              | 2566 |     This function returns a hash of borrower categories where the keys are category | 
            
              | 2567 |     codes and values are category descriptions. | 
            
              | 2568 |  | 
            
              | 2569 | =cut | 
            
              | 2570 |  | 
            
              | 2571 | sub GetBorrowercategoryHash { | 
            
              | 2572 |     my $categories_list = GetBorrowercategoryList(); | 
            
              | 2573 |     my %categories_hash = map { $_->{categorycode} => $_->{description} } @{$categories_list}; | 
            
              | 2574 |     return %categories_hash; | 
            
              | 2575 | } | 
            
              | 2576 |  | 
            
              | 2577 | =head2 GetCategoryPrivacyHash | 
            
              | 2578 |  | 
            
              | 2579 |     $hashref = &GetCategoryPrivacyHash | 
            
              | 2580 |     Returns the default  privacy description of a patron's category given the category code. | 
            
              | 2581 |  | 
            
              | 2582 | =cut | 
            
              | 2583 |  | 
            
              | 2584 | sub GetCategoryPrivacy { | 
            
              | 2585 |     my ($categorycode) = @_; | 
            
              | 2586 |     my $dbh = C4::Context->dbh; | 
            
              | 2587 |     my $sth = $dbh->prepare( | 
            
              | 2588 |             qq{ | 
            
              | 2589 |                SELECT default_privacy | 
            
              | 2590 |                FROM categories | 
            
              | 2591 |                WHERE categorycode = ? | 
            
              | 2592 |             }); | 
            
              | 2593 |     $sth->execute($categorycode); | 
            
              | 2594 |     return $sth->fetchrow; | 
            
              | 2595 | } | 
            
              | 2596 |  | 
        
          | 2562 | =head2 DeleteUnverifiedOpacRegistrations | 2597 | =head2 DeleteUnverifiedOpacRegistrations | 
        
          | 2563 |  | 2598 |  | 
        
          | 2564 |     Delete all unverified self registrations in borrower_modifications, | 2599 |     Delete all unverified self registrations in borrower_modifications, |