Ignore:
Timestamp:
12/23/15 16:54:28 (9 years ago)
Author:
nanardon
Message:

Fix default value in new object form

Location:
trunk/LATMOS-Accounts/lib/LATMOS/Accounts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm

    r1503 r1530  
    417417} 
    418418 
     419=head2 defaultAttributeValue($otype, $attr) 
     420 
     421Return default static value for attribute C<$attr> 
     422 
     423=cut 
     424 
     425sub defaultAttributeValue { 
     426    my ($self, $otype, $attr) = @_; 
     427 
     428    warn "$otype, $attr"; 
     429    my %def = %{ $self->{defattr} || {}}; 
     430    return $def{"$otype.$attr"} || ''; 
     431} 
    419432 
    420433=head2 compute_default($otype, $id, %cdata) 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Attributes.pm

    r1456 r1530  
    451451} 
    452452 
     453=head2 defaultValue 
     454 
     455Return the default static value for this attribute. 
     456 
     457=cut 
     458 
     459sub defaultValue { 
     460    my ($self) = @_; 
     461 
     462    return $self->base->defaultAttributeValue($self->otype, $self->name) 
     463} 
     464 
    453465=head2 getValues 
    454466 
     
    499511sub default_value { 
    500512    my ($self) = @_; 
    501     return grep { $_ } (ref $self->{default} 
    502         ? @{ $self->{default} } 
    503         : $self->{default}); 
     513    $self->defaultValue; 
    504514} 
    505515 
Note: See TracChangeset for help on using the changeset viewer.