projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Auftrags-Controller: Option für "Steuer im Preis inbegriffen"
[kivitendo-erp.git]
/
SL
/
PriceSource
/
Price.pm
diff --git
a/SL/PriceSource/Price.pm
b/SL/PriceSource/Price.pm
index
23d3a9e
..
0ecc8b0
100644
(file)
--- a/
SL/PriceSource/Price.pm
+++ b/
SL/PriceSource/Price.pm
@@
-5,17
+5,17
@@
use strict;
use parent 'SL::DB::Object';
use Rose::Object::MakeMethods::Generic (
scalar => [ qw(price description spec price_source invalid missing) ],
use parent 'SL::DB::Object';
use Rose::Object::MakeMethods::Generic (
scalar => [ qw(price description spec price_source invalid missing) ],
- array => [ qw(depends_on) ]
+ 'scalar --get_set_init' => [ qw(priority) ],
);
);
-
us
e SL::DB::Helper::Attr;
+
requir
e SL::DB::Helper::Attr;
SL::DB::Helper::Attr::make(__PACKAGE__,
price => 'numeric(15,5)',
);
sub source {
$_[0]->price_source
SL::DB::Helper::Attr::make(__PACKAGE__,
price => 'numeric(15,5)',
);
sub source {
$_[0]->price_source
- ?
$_[0]->price_source->name . '/' . $_[0]->spec
+ ? $_[0]->price_source->name . '/' . $_[0]->spec
: '';
}
: '';
}
@@
-27,8
+27,20
@@
sub full_description {
: $self->description
}
: $self->description
}
+sub source_description {
+ my ($self) = @_;
+
+ $self->price_source
+ ? $self->price_source->description
+ : $self->description
+}
+
sub to_str {
sub to_str {
- "source: @{[ $_[0]->source ]}, price: @{[ $_[0]->price]}, description: @{[ $_[0]->description ]}"
+ "source: @{[ $_[0]->source ]}, price: @{[ $_[0]->price ]}, description: @{[ $_[0]->description ]}"
+}
+
+sub init_priority {
+ 3
}
1;
}
1;
@@
-39,42
+51,38
@@
__END__
=head1 NAME
=head1 NAME
-SL::PriceSource::Price - cont
r
ainer to pass calculated prices around
+SL::PriceSource::Price - container to pass calculated prices around
=head1 SYNOPSIS
# in PriceSource::Base implementation
$price = SL::PriceSource::Price->new(
price => 10.3,
=head1 SYNOPSIS
# in PriceSource::Base implementation
$price = SL::PriceSource::Price->new(
price => 10.3,
- spec => '
10.
3', # something you can easily parse later
- description => t8('Fix price 10.3'),
+ spec => '3', # something you can easily parse later
+ description => t8('Fix price 10.3
for customer 3
'),
price_source => $self,
)
price_source => $self,
)
- # special empty price in SL::PriceSource
+ # special empty price in SL::PriceSource
, for internal use.
SL::PriceSource::Price->new(
description => t8('None (PriceSource)'),
);
SL::PriceSource::Price->new(
description => t8('None (PriceSource)'),
);
- #
invalid price
+ #
price can't be restored
SL::PriceSource::Price->new(
SL::PriceSource::Price->new(
- price => $original_price,
- spec => $original_spec,
- description => $original_description,
- invalid => t8('Offer expired #1 weeks ago', $dt->delta_weeks),
+ missing => t8('Um, sorry, cannot find that one'),
price_source => $self,
);
price_source => $self,
);
- #
missing
price
+ #
invalid
price
SL::PriceSource::Price->new(
SL::PriceSource::Price->new(
- price => $original_price,
# will keep last entered price
+ price => $original_price,
spec => $original_spec,
spec => $original_spec,
- description =>
''
,
-
missing => t8('Um, sorry, cannot find that one'
),
+ description =>
$original_description
,
+
invalid => t8('Offer expired #1 weeks ago', $dt->delta_weeks
),
price_source => $self,
);
price_source => $self,
);
-
=head1 DESCRIPTION
See L<SL::PriceSource> for information about the mechanism.
=head1 DESCRIPTION
See L<SL::PriceSource> for information about the mechanism.
@@
-90,7
+98,7
@@
implementations.
The price. A price of 0 is special and is considered undesirable. If passed as
part of C<available_prices> it will be filtered out. If returned as
The price. A price of 0 is special and is considered undesirable. If passed as
part of C<available_prices> it will be filtered out. If returned as
-C<best_price> or C<price_from_source> it will
be warned about
.
+C<best_price> or C<price_from_source> it will
trigger a warning
.
=item C<spec>
=item C<spec>
@@
-106,16
+114,25
@@
A localized short description of the origins of this price.
A ref to the creating algorithm.
A ref to the creating algorithm.
+=item C<priority>
+
+OPTIONAL. Prices may supply a numerical priority. Higher will trump lower, even when
+supplying higher prices. Defaults to 3 (as in middle of 1-5).
+
=item C<missing>
OPTIONAL. Both indicator and localized message that the price with this spec
could not be reproduced and should be changed.
=item C<missing>
OPTIONAL. Both indicator and localized message that the price with this spec
could not be reproduced and should be changed.
+If price is missing, you do not need to supply anything except C<source>.
+
=item C<invalid>
OPTIONAL. Both indicator and localized message that the conditions for this
price are no longer valid, and that the price should be changed.
=item C<invalid>
OPTIONAL. Both indicator and localized message that the conditions for this
price are no longer valid, and that the price should be changed.
+If price is missing, you do not need to supply anything except C<source>.
+
=back
=head1 SEE ALSO
=back
=head1 SEE ALSO