X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FDB%2FPart.pm;h=29371367953b1343d95f6d40a3fcaba60d6be8fd;hb=c301c2b3be223fe384bea2d899c6a08de54c21de;hp=6ce6ed5b70447fce9662ca7b51916928c02dd921;hpb=266b388921a9d50b0d4c44b0f7d12245a86723e4;p=kivitendo-erp.git diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm index 6ce6ed5b7..293713679 100644 --- a/SL/DB/Part.pm +++ b/SL/DB/Part.pm @@ -6,16 +6,26 @@ 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; use SL::DB::Chart; use SL::DB::Helper::AttrHTML; +use SL::DB::Helper::AttrSorted; use SL::DB::Helper::TransNumberGenerator; 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( @@ -37,6 +47,11 @@ __PACKAGE__->meta->add_relationships( manager_args => { sort_by => 'sortorder' }, column_map => { id => 'parts_id' }, }, + customerprices => { + type => 'one to many', + class => 'SL::DB::PartCustomerPrice', + column_map => { id => 'parts_id' }, + }, translations => { type => 'one to many', class => 'SL::DB::Translation', @@ -54,11 +69,18 @@ __PACKAGE__->meta->add_relationships( query_args => [ what_done => 'part' ], manager_args => { sort_by => 'itime' }, }, + shop_parts => { + type => 'one to many', + class => 'SL::DB::ShopPart', + column_map => { id => 'part_id' }, + manager_args => { with_objects => [ 'shop' ] }, + }, ); __PACKAGE__->meta->initialize; __PACKAGE__->attr_html('notes'); +__PACKAGE__->attr_sorted({ unsorted => 'makemodels', position => 'sortorder' }); __PACKAGE__->before_save('_before_save_set_partnumber'); @@ -330,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) = @_; @@ -407,13 +425,6 @@ sub items_lastcost_sum { sum map { $_->linetotal_lastcost } @{$self->items}; }; -sub assortment_lastcost_sum { - my ($self) = @_; - - return unless $self->is_assortment; - sum map { $_->linetotal_lastcost } @{$self->assortment_items}; -}; - 1; __END__ @@ -556,21 +567,9 @@ Used to set the accounting information from a L object. Please note, that this is a write only accessor, the original Buchungsgruppe can not be retrieved from an article once set. -=item C - -Non-recursive sellprice sum of all the assembly item sellprices. - -=item C - -Non-recursive sellprice sum of all the assortment item sellprices. - -=item C - -Non-recursive lastcost sum of all the assembly item lastcosts. - -=item C +=item C -Non-recursive lastcost sum of all the assortment item lastcosts. +Non-recursive lastcost sum of all the items in an assembly or assortment. =item C