X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FPart.pm;h=0f855231e4bf63f119a5c3dcbf057eefbca9e6dd;hb=fc1e67b429bb959ab60bd50d144c0a51fbc4b292;hp=db3a26663a7d9cce8897d113ad8ccaa71f32c180;hpb=b877d63356e0e0df711e84223bd6832114a91f70;p=kivitendo-erp.git diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm index db3a26663..0f855231e 100644 --- a/SL/DB/Part.pm +++ b/SL/DB/Part.pm @@ -32,7 +32,7 @@ __PACKAGE__->meta->add_relationships( assemblies => { type => 'one to many', class => 'SL::DB::Assembly', - manager_args => { sort_by => 'position, oid' }, + manager_args => { sort_by => 'position' }, column_map => { id => 'id' }, }, prices => { @@ -61,6 +61,7 @@ __PACKAGE__->meta->add_relationships( type => 'one to many', class => 'SL::DB::AssortmentItem', column_map => { id => 'assortment_id' }, + manager_args => { sort_by => 'position' }, }, history_entries => { type => 'one to many', @@ -75,12 +76,19 @@ __PACKAGE__->meta->add_relationships( column_map => { id => 'part_id' }, manager_args => { with_objects => [ 'shop' ] }, }, + last_price_update => { + type => 'one to one', + class => 'SL::DB::PartsPriceHistory', + column_map => { id => 'part_id' }, + manager_args => { sort_by => 'valid_from DESC', limit => 1 }, + }, ); __PACKAGE__->meta->initialize; __PACKAGE__->attr_html('notes'); -__PACKAGE__->attr_sorted({ unsorted => 'makemodels', position => 'sortorder' }); +__PACKAGE__->attr_sorted({ unsorted => 'makemodels', position => 'sortorder' }); +__PACKAGE__->attr_sorted({ unsorted => 'customerprices', position => 'sortorder' }); __PACKAGE__->before_save('_before_save_set_partnumber');