Revision 416

Date:
2014/02/15 23:17:33
Author:
ahitrov
Revision Log:
Adress as_string
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/lib/webshop/Address.pm

     
    55 55 return 'webshop::SQL::AddressTable';
    56 56 }
    57 57
    58 sub as_string
    59 {
    60 my ($self, %opts) = @_;
    61 my $areas = delete $opts{areas};
    62
    63 my @string;
    64 push @string, $self->name if $self->name;
    65 push @string, $self->zipcode if $self->zipcode;
    66 if ( $self->area ) {
    67 if ( ref $areas ) {
    68 push @string, $areas->{$self->area}->name if exists $areas->{$self->area};
    69 } else {
    70 my $area = $self->keeper->get_document_by_id( $self->area, class => 'webshop::Area' );
    71 push @string, $area->name if ref $area;
    72 }
    73 }
    74 push @string, $self->town if $self->town;
    75 push @string, $self->address if $self->address;
    76 push @string, $self->name if $self->name;
    77 return join(', ', @string);
    78 }
    79
    58 80 sub pre_store
    59 81 {
    60 82 my $self = shift;