Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 32951b1f

Von Bernd Bleßmann vor fast 9 Jahren hinzugefügt

  • ID 32951b1fd055b51e0f8e4d5896f4cc98258eec50
  • Vorgänger 9fff4a29
  • Nachfolger d8a1906b

Auftrags-Controller: Preisfaktor berücksichtigen

Unterschiede anzeigen:

SL/Controller/Order.pm
21 21
use SL::DB::Default;
22 22
use SL::DB::Unit;
23 23
use SL::DB::Price;
24
use SL::DB::PriceFactor;
24 25
use SL::DB::Part;
25 26
use SL::DB::Printer;
26 27
use SL::DB::Language;
......
39 40
use Rose::Object::MakeMethods::Generic
40 41
(
41 42
 scalar => [ qw(item_ids_to_delete) ],
42
 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models) ],
43
 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models all_price_factors) ],
43 44
);
44 45

  
45 46

  
......
413 414
  $self->_recalc();
414 415

  
415 416
  my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
416
  my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id);
417
  my $row_as_html = $self->p->render('order/tabs/_row',
418
                                     ITEM              => $item,
419
                                     ID                => $item_id,
420
                                     ALL_PRICE_FACTORS => $self->all_price_factors
421
  );
417 422

  
418 423
  $self->js
419 424
    ->append('#row_table_id', $row_as_html)
......
472 477

  
473 478
  foreach my $item (@items) {
474 479
    my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
475
    my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id);
480
    my $row_as_html = $self->p->render('order/tabs/_row',
481
                                       ITEM              => $item,
482
                                       ID                => $item_id,
483
                                       ALL_PRICE_FACTORS => $self->all_price_factors
484
    );
476 485

  
477 486
    $self->js
478 487
        ->append('#row_table_id', $row_as_html)
......
629 638
  );
630 639
}
631 640

  
641
sub init_all_price_factors {
642
  SL::DB::Manager::PriceFactor->get_all;
643
}
644

  
632 645
sub _check_auth {
633 646
  my ($self) = @_;
634 647

  
......
797 810

  
798 811
  my %new_attr;
799 812
  $new_attr{part}                   = $part;
800
  $new_attr{description}            = $part->description if ! $item->description;
801
  $new_attr{qty}                    = 1.0                if ! $item->qty;
813
  $new_attr{description}            = $part->description     if ! $item->description;
814
  $new_attr{qty}                    = 1.0                    if ! $item->qty;
815
  $new_attr{price_factor_id}        = $part->price_factor_id if ! $item->price_factor_id;
802 816
  $new_attr{sellprice}              = $price_src->price;
803 817
  $new_attr{discount}               = $discount_src->discount;
804 818
  $new_attr{active_price_source}    = $price_src;
templates/webpages/order/tabs/_row.html
40 40
                      class="recalc reformat_number numeric") %]
41 41
    </td>
42 42
    <td>
43
      [%- L.input_tag("order.orderitems[].price_factor",
44
                      ITEM.price_factor,
45
                      size = 5,
46
                      class="recalc numeric") %]
43
      [%- L.select_tag("order.orderitems[].price_factor_id",
44
                       ALL_PRICE_FACTORS,
45
                       default = ITEM.price_factor_id,
46
                       title_key = 'description',
47
                       with_empty = 1,
48
                       class="recalc") %]
47 49
    </td>
48 50
    <td nowrap>
49 51
      [%- L.select_tag("order.orderitems[].unit",
templates/webpages/order/tabs/basic_data.html
172 172
            </thead>
173 173

  
174 174
            [%- FOREACH item = SELF.order.items_sorted %]
175
              [%- PROCESS order/tabs/_row.html ITEM=item ID=item.id %]
175
              [%- PROCESS order/tabs/_row.html ITEM=item ID=item.id ALL_PRICE_FACTORS=SELF.all_price_factors %]
176 176
            [%- END %]
177 177

  
178 178
          </table>

Auch abrufbar als: Unified diff