die 'Need exactly one argument, either id, object or arrayref of ids or objects.' unless 2 == @_;
- return $self if !$data || ('ARRAY' eq ref $data && !@$data);
-
$self->normalize_input($data);
return $self unless @{ $self->oe_ids };
sub write_to_objects {
my ($self) = @_;
+ return unless @{ $self->oe_ids };
+
die 'Can only use write_to_objects, when calculate was called with objects. Use write_to instead.' unless $self->objects_or_ids;
$self->write_to($self->objects);
$self->objects($data);
} else {
die 'object or reference in data while expecting ids' if any { ref($_) } @$data;
+ die 'ids need to be numbers' if any { ! ($_ * 1) } @$data;
$self->oe_ids($data);
}
C<delivered> is guaranteed only to be the correct boolean value, but not
any specific value.
+Note: C<write_to> will avoid loading unnecessary objects. This means if it is
+called with an Order object that has not loaded its orderitems yet, only
+C<delivered> will be set in the Order object. A subsequent C<<
+$order->orderitems->[0]->{delivered} >> will return C<undef>, and C<<
+$order->orderitems->[0]->shipped_qty >> will invoke another implicit
+calculation.
+
=item C<shipped_qty>
Valid after L</calculate>. Returns a hasref with shipped qtys by orderitems id.
=back
+=back
+
=head1 REPLACED FUNCTIONALITY
=head2 delivered mode