From: Bernd Bleßmann Date: Tue, 22 Jan 2019 07:09:59 +0000 (+0100) Subject: DisplayableNamePrefs: SL::DB:xxx verwenden DB-Helper X-Git-Tag: release-3.5.4~157 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9e24ed15e592fec3d03fd24b1ffdd1e0f53072ac;p=kivitendo-erp.git DisplayableNamePrefs: SL::DB:xxx verwenden DB-Helper erstmal nur Customer/Vendor/Part --- diff --git a/SL/DB/Customer.pm b/SL/DB/Customer.pm index d15f5ecd0..cb51f90f6 100644 --- a/SL/DB/Customer.pm +++ b/SL/DB/Customer.pm @@ -4,6 +4,7 @@ use strict; 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; @@ -13,6 +14,16 @@ use SL::DB::Helper::CustomVariables ( 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; @@ -36,6 +47,7 @@ __PACKAGE__->meta->initialize; __PACKAGE__->before_save('_before_save_set_customernumber'); + sub _before_save_set_customernumber { my ($self) = @_; @@ -59,12 +71,6 @@ sub short_address { 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) = @_; diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm index 5b5b4a2f5..293713679 100644 --- a/SL/DB/Part.pm +++ b/SL/DB/Part.pm @@ -6,6 +6,7 @@ use Carp; 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; @@ -17,6 +18,14 @@ use SL::DB::Helper::CustomVariables ( 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( @@ -343,10 +352,6 @@ sub get_simple_stock { 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) = @_; diff --git a/SL/DB/Vendor.pm b/SL/DB/Vendor.pm index b1740147c..1c1bffda1 100644 --- a/SL/DB/Vendor.pm +++ b/SL/DB/Vendor.pm @@ -4,6 +4,7 @@ use strict; 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; @@ -13,6 +14,16 @@ use SL::DB::Helper::CustomVariables ( 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; @@ -53,12 +64,6 @@ sub validate { 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 }