use SL::DB::Default;
use SL::DB::Unit;
use SL::DB::Price;
+use SL::DB::PriceFactor;
use SL::DB::Part;
use SL::DB::Printer;
use SL::DB::Language;
use Rose::Object::MakeMethods::Generic
(
scalar => [ qw(item_ids_to_delete) ],
- 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models) ],
+ 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models all_price_factors) ],
);
$self->_recalc();
my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
- my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id);
+ my $row_as_html = $self->p->render('order/tabs/_row',
+ ITEM => $item,
+ ID => $item_id,
+ ALL_PRICE_FACTORS => $self->all_price_factors
+ );
$self->js
->append('#row_table_id', $row_as_html)
foreach my $item (@items) {
my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
- my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id);
+ my $row_as_html = $self->p->render('order/tabs/_row',
+ ITEM => $item,
+ ID => $item_id,
+ ALL_PRICE_FACTORS => $self->all_price_factors
+ );
$self->js
->append('#row_table_id', $row_as_html)
);
}
+sub init_all_price_factors {
+ SL::DB::Manager::PriceFactor->get_all;
+}
+
sub _check_auth {
my ($self) = @_;
my %new_attr;
$new_attr{part} = $part;
- $new_attr{description} = $part->description if ! $item->description;
- $new_attr{qty} = 1.0 if ! $item->qty;
+ $new_attr{description} = $part->description if ! $item->description;
+ $new_attr{qty} = 1.0 if ! $item->qty;
+ $new_attr{price_factor_id} = $part->price_factor_id if ! $item->price_factor_id;
$new_attr{sellprice} = $price_src->price;
$new_attr{discount} = $discount_src->discount;
$new_attr{active_price_source} = $price_src;
class="recalc reformat_number numeric") %]
</td>
<td>
- [%- L.input_tag("order.orderitems[].price_factor",
- ITEM.price_factor,
- size = 5,
- class="recalc numeric") %]
+ [%- L.select_tag("order.orderitems[].price_factor_id",
+ ALL_PRICE_FACTORS,
+ default = ITEM.price_factor_id,
+ title_key = 'description',
+ with_empty = 1,
+ class="recalc") %]
</td>
<td nowrap>
[%- L.select_tag("order.orderitems[].unit",