use Rose::DB::Object::Helpers qw(as_tree);
+use SL::Locale::String qw(t8);
use SL::DBUtils ();
use SL::DB::MetaSetup::Customer;
use SL::DB::Manager::Customer;
module => 'CT',
cvars_alias => 1,
);
+use SL::DB::Helper::DisplayableNamePreferences (
+ title => t8('Customer'),
+ options => [ {name => 'customernumber', title => t8('Customer Number') },
+ {name => 'name', title => t8('Name') },
+ {name => 'street', title => t8('Street') },
+ {name => 'city', title => t8('City') },
+ {name => 'zipcode', title => t8('Zipcode')},
+ {name => 'email', title => t8('E-Mail') },
+ {name => 'phone', title => t8('Phone') }, ]
+);
use SL::DB::VC;
__PACKAGE__->before_save('_before_save_set_customernumber');
+
sub _before_save_set_customernumber {
my ($self) = @_;
return join ', ', grep { $_ } $self->street, $self->zipcode, $self->city;
}
-sub displayable_name {
- my $self = shift;
-
- return join ' ', grep $_, $self->customernumber, $self->name;
-}
-
sub last_used_ar_chart {
my ($self) = @_;
use List::MoreUtils qw(any);
use Rose::DB::Object::Helpers qw(as_tree);
+use SL::Locale::String qw(t8);
use SL::DBUtils;
use SL::DB::MetaSetup::Part;
use SL::DB::Manager::Part;
module => 'IC',
cvars_alias => 1,
);
+use SL::DB::Helper::DisplayableNamePreferences (
+ title => t8('Article'),
+ options => [ {name => 'partnumber', title => t8('Part Number') },
+ {name => 'description', title => t8('Description') },
+ {name => 'notes', title => t8('Notes')},
+ {name => 'ean', title => t8('EAN') }, ],
+);
+
use List::Util qw(sum);
__PACKAGE__->meta->add_relationships(
sub bin { require SL::DB::Bin; SL::DB::Manager::Bin ->find_by_or_create(id => $_[0]->{bin_id}) }
}
-sub displayable_name {
- join ' ', grep $_, map $_[0]->$_, qw(partnumber description);
-}
-
sub clone_and_reset_deep {
my ($self) = @_;
use Rose::DB::Object::Helpers qw(as_tree);
+use SL::Locale::String qw(t8);
use SL::DBUtils ();
use SL::DB::MetaSetup::Vendor;
use SL::DB::Manager::Vendor;
module => 'CT',
cvars_alias => 1,
);
+use SL::DB::Helper::DisplayableNamePreferences (
+ title => t8('Vendor'),
+ options => [ {name => 'vendornumber', title => t8('Vendor Number') },
+ {name => 'name', title => t8('Name') },
+ {name => 'street', title => t8('Street') },
+ {name => 'city', title => t8('City') },
+ {name => 'zipcode', title => t8('Zipcode')},
+ {name => 'email', title => t8('E-Mail') },
+ {name => 'phone', title => t8('Phone') }, ]
+);
use SL::DB::VC;
return @errors;
}
-sub displayable_name {
- my $self = shift;
-
- return join ' ', grep $_, $self->vendornumber, $self->name;
-}
-
sub is_customer { 0 };
sub is_vendor { 1 };
sub payment_terms { goto &payment }