Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0ff17226

Von Sven Schöling vor etwa 8 Jahren hinzugefügt

  • ID 0ff17226240249b036073f696ecc6e15017f98be
  • Vorgänger a8cba95a
  • Nachfolger 2a5c1eb3

LinkedRecords: with_objects erlauben für shipped_qty

Unterschiede anzeigen:

SL/DB/Helper/LinkedRecords.pm
85 85
      $_->{_record_link_direction} = $wanted;
86 86
      $_->{_record_link}           = $link;
87 87
      $_
88
    } @{ $manager_class->get_all(query => [ id => $link->$sub_wanted_id, @get_objects_query ]) };
88
    } @{
89
      $manager_class->get_all(
90
        query         => [ id => $link->$sub_wanted_id, @get_objects_query ],
91
        (with_objects => $params{with_objects}) x !!$params{with_objects},
92
      )
93
    };
89 94
  };
90 95

  
91 96
  # If no 'via' is given then use a simple(r) method for querying the wanted objects.
SL/DB/OrderItem.pm
33 33
sub shipped_qty {
34 34
  my ($self) = @_;
35 35

  
36
  my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder');
36
  my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder', with_objects => [ 'orderitems' ]);
37 37
  my @doi      = grep { $_->parts_id == $self->parts_id } map { $_->orderitems } @$d_orders;
38 38

  
39
  require SL::AM;
40 39
  return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi);
41 40
}
42 41

  

Auch abrufbar als: Unified diff