Projekt

Allgemein

Profil

Herunterladen (919 Bytes) Statistiken
| Zweig: | Markierung: | Revision:
f97b0778 Sven Schöling
package SL::DB::Default;
4fd22b56 Sven Schöling
use strict;

63cb5b41 Moritz Bunkus
use Carp;
f97b0778 Sven Schöling
use SL::DB::MetaSetup::Default;
4fd22b56 Sven Schöling
2d7e4203 Sven Schöling
__PACKAGE__->meta->initialize;

4fd22b56 Sven Schöling
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
__PACKAGE__->meta->make_manager_class;

cf085911 Moritz Bunkus
sub get_default_currency {
b9dbc9e3 Moritz Bunkus
my $self = shift->get;
e770cd18 Moritz Bunkus
return $self->currency->name || '' if $self->currency_id;
return '';
cf085911 Moritz Bunkus
}

b9dbc9e3 Moritz Bunkus
sub get {
cf085911 Moritz Bunkus
my ($class_or_self) = @_;
return $class_or_self if ref($class_or_self);
return SL::DB::Manager::Default->get_all(limit => 1)->[0];
}

63cb5b41 Moritz Bunkus
sub address {
# Compatibility function: back in the day there was only a single
# address field.
my $self = shift;

croak("SL::DB::Default::address is a read-only accessor") if @_;

my $zipcode_city = join ' ', grep { $_ } ($self->address_zipcode, $self->address_city);

return join "\n", grep { $_ } ($self->address_street1, $self->address_street2, $zipcode_city, $self->address_country);
}

4fd22b56 Sven Schöling
1;