| Lines 98-104
          sub authorised_value {
      
      
        Link Here | 
        
          | 98 |             authorised_value => $self->attribute, | 98 |             authorised_value => $self->attribute, | 
        
          | 99 |         } | 99 |         } | 
        
          | 100 |     ); | 100 |     ); | 
          
            
              | 101 |     return unless $av->count; # Data inconsistency | 101 |     return unless $av->count;    # Data inconsistency | 
        
          | 102 |     return $av->next; | 102 |     return $av->next; | 
        
          | 103 | } | 103 | } | 
        
          | 104 |  | 104 |  | 
  
    | Lines 114-120
          displayed instead of the code.
      
      
        Link Here | 
        
          | 114 | =cut | 114 | =cut | 
        
          | 115 |  | 115 |  | 
        
          | 116 | sub description { | 116 | sub description { | 
          
            
              | 117 |     my ( $self) = @_; | 117 |     my ($self) = @_; | 
        
          | 118 |     if ( $self->type->authorised_value_category ) { | 118 |     if ( $self->type->authorised_value_category ) { | 
        
          | 119 |         my $av = $self->authorised_value; | 119 |         my $av = $self->authorised_value; | 
        
          | 120 |         return $av ? $av->lib : ""; | 120 |         return $av ? $av->lib : ""; | 
  
    | Lines 147-156
          whether storing the current object state would break the repeatable constraint.
      
      
        Link Here | 
        
          | 147 |  | 147 |  | 
        
          | 148 | sub repeatable_ok { | 148 | sub repeatable_ok { | 
        
          | 149 |  | 149 |  | 
          
            
              | 150 |     my ( $self ) = @_; | 150 |     my ($self) = @_; | 
        
          | 151 |  | 151 |  | 
        
          | 152 |     my $ok = 1; | 152 |     my $ok = 1; | 
          
            
              | 153 |     if ( ! $self->type->repeatable ) { | 153 |     if ( !$self->type->repeatable ) { | 
        
          | 154 |         my $params = { | 154 |         my $params = { | 
        
          | 155 |             borrowernumber => $self->borrowernumber, | 155 |             borrowernumber => $self->borrowernumber, | 
        
          | 156 |             code           => $self->code | 156 |             code           => $self->code | 
  
    | Lines 174-180
          whether storing the current object state would break the unique constraint.
      
      
        Link Here | 
        
          | 174 |  | 174 |  | 
        
          | 175 | sub unique_ok { | 175 | sub unique_ok { | 
        
          | 176 |  | 176 |  | 
          
            
              | 177 |     my ( $self ) = @_; | 177 |     my ($self) = @_; | 
        
          | 178 |  | 178 |  | 
        
          | 179 |     my $ok = 1; | 179 |     my $ok = 1; | 
        
          | 180 |     if ( $self->type->unique_id ) { | 180 |     if ( $self->type->unique_id ) { | 
  
    | Lines 183-191
          sub unique_ok {
      
      
        Link Here | 
        
          | 183 |         $params->{borrowernumber} = { '!=' => $self->borrowernumber } if $self->borrowernumber; | 183 |         $params->{borrowernumber} = { '!=' => $self->borrowernumber } if $self->borrowernumber; | 
        
          | 184 |         $params->{id}             = { '!=' => $self->id }             if $self->in_storage; | 184 |         $params->{id}             = { '!=' => $self->id }             if $self->in_storage; | 
        
          | 185 |  | 185 |  | 
          
            
              | 186 |         my $unique_count = Koha::Patron::Attributes | 186 |         my $unique_count = Koha::Patron::Attributes->search($params)->count; | 
            
              | 187 |             ->search( $params ) |  |  | 
            
              | 188 |             ->count; | 
        
          | 189 |  | 187 |  | 
        
          | 190 |         $ok = 0 if $unique_count > 0; | 188 |         $ok = 0 if $unique_count > 0; | 
        
          | 191 |     } | 189 |     } | 
  
    | Lines 201-211
          Checks if the value of the attribute is valid for the type
      
      
        Link Here | 
        
          | 201 |  | 199 |  | 
        
          | 202 | sub value_ok { | 200 | sub value_ok { | 
        
          | 203 |  | 201 |  | 
          
            
              | 204 |     my ( $self ) = @_; | 202 |     my ($self) = @_; | 
        
          | 205 |  | 203 |  | 
        
          | 206 |     my $ok = 1; | 204 |     my $ok = 1; | 
        
          | 207 |     if ( $self->type->is_date ) { | 205 |     if ( $self->type->is_date ) { | 
          
            
              | 208 |         eval { dt_from_string($self->attribute); }; | 206 |         eval { dt_from_string( $self->attribute ); }; | 
        
          | 209 |         if ($@) { | 207 |         if ($@) { | 
        
          | 210 |             $ok = 0; | 208 |             $ok = 0; | 
        
          | 211 |         } | 209 |         } | 
            
              | 212 | -  |  |  |