Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a24773da

Von Werner Hahn vor etwa 2 Jahren hinzugefügt

  • ID a24773daf1832a25d826a8dd28a3311982e9ae4f
  • Vorgänger 58ae7e4d
  • Nachfolger d910a433

Beistelllieferschein/DeliveryOrder Lagerbuchungen mit in die Druckvariablen aufgenommen

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1351 1351
  # You need a custom shipto object to call cvars_by_config to get the cvars.
1352 1352
  $self->order->custom_shipto(SL::DB::Shipto->new(module => 'OE', custom_variables => [])) if !$self->order->custom_shipto;
1353 1353

  
1354
  $self->prepare_stock_info($_) for $self->order->items;
1354
  $self->order->prepare_stock_info($_) for $self->order->items;
1355 1355

  
1356 1356
  return $self->order;
1357 1357
}
......
1403 1403
    $pos++;
1404 1404
  }
1405 1405

  
1406
  $self->prepare_stock_info($_) for $order->items, @items;
1407

  
1408 1406
  $order->add_items(grep {!$_->id} @items);
1409 1407

  
1410 1408
  return $order;
......
1532 1530
  return $item;
1533 1531
}
1534 1532

  
1535
sub prepare_stock_info {
1536
  my ($self, $item) = @_;
1537

  
1538
  $item->{stock_info} = SL::YAML::Dump([
1539
    map +{
1540
      delivery_order_items_stock_id => $_->id,
1541
      qty                           => $_->qty,
1542
      warehouse_id                  => $_->warehouse_id,
1543
      bin_id                        => $_->bin_id,
1544
      chargenumber                  => $_->chargenumber,
1545
      unit                          => $_->unit,
1546
    }, $item->delivery_order_stock_entries
1547
  ]);
1548
}
1549

  
1550 1533
sub setup_order_from_cv {
1551 1534
  my ($order) = @_;
1552 1535

  
SL/DB/Helper/FlattenToForm.pm
3 3
use strict;
4 4

  
5 5
use parent qw(Exporter);
6
our @EXPORT = qw(flatten_to_form);
6
our @EXPORT = qw(flatten_to_form prepare_stock_info);
7 7

  
8 8
use List::MoreUtils qw(uniq any);
9 9

  
......
111 111
      $form->{"deliverydate_oe_${idx}"} = $date;
112 112
      $form->{"reqdate_${idx}"}         = $date;
113 113
    }
114
    if (ref($self) eq 'SL::DB::DeliveryOrder'){
115
      my $in_out   = $form->{type} =~ /^sales|^supplier/ ? 'out' : 'in';
116
      $form->{"stock_" . $in_out . "_" . ${idx}} = prepare_stock_info($self,$item);
117
    }
114 118
  }
115 119

  
116 120
  _copy_custom_variables($self, $form, 'vc_cvar_', '', $cvar_validity{vc});
......
119 123
  return $self;
120 124
}
121 125

  
126
sub prepare_stock_info {
127
  my ($self, $item) = @_;
128

  
129
  $item->{stock_info} = SL::YAML::Dump([
130
    map +{
131
      delivery_order_items_stock_id => $_->id,
132
      qty                           => $_->qty,
133
      warehouse_id                  => $_->warehouse_id,
134
      bin_id                        => $_->bin_id,
135
      chargenumber                  => $_->chargenumber,
136
      unit                          => $_->unit,
137
    }, $item->delivery_order_stock_entries
138
  ]);
139
}
140

  
122 141
sub _has {
123 142
  my ($obj, $column) = @_;
124 143
  return $obj->can($column) && $obj->$column;
SL/DO.pm
977 977
                           (SELECT description FROM warehouse WHERE id = ?) AS warehouse|;
978 978
  my $h_bin_wh = prepare_query($form, $dbh, $q_bin_wh);
979 979

  
980
  my $in_out   = $form->{type} =~ /^sales/ ? 'out' : 'in';
980
  my $in_out   = $form->{type} =~ /^sales|^supplier/ ? 'out' : 'in';
981 981

  
982 982
  my $num_si   = 0;
983 983

  

Auch abrufbar als: Unified diff