use strict;
use parent 'SL::DB::Object';
use Rose::Object::MakeMethods::Generic (
- scalar => [ qw(record_item record) ],
+ scalar => [ qw(record_item record fast) ],
'scalar --get_set_init' => [ qw(
best_price best_discount
) ],
return unless $class;
$self->{price_source_by_name}{$class} //=
- $class->new(record_item => $self->record_item, record => $self->record);
+ $class->new(record_item => $self->record_item, record => $self->record, fast => $self->fast);
}
sub price_from_source {
my $class = SL::PriceSource::ALL->price_source_class_by_name($source_name);
my $source_object = $self->price_source_by_class($class);
- $source_object
+ $source_object && $spec
? $source_object->price_from_source($source, $spec)
: empty_price();
}
A special empty discount that does not change the previously entered discount
and opens the discount field to manual changes.
+=item C<fast>
+
+If set to true, indicates that calls may skip doing intensive work and instead
+return a price or discount flagged as unknown. The caller must be prepared to
+deal with those.
+
+Typically this is intended to delay expensive calculations until they can be
+done in a second batch pass. If the information is already present, it is still
+encouraged that implementations return the correct values.
+
=back
+
=head1 SEE ALSO
L<SL::PriceSource::Base>,