Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 27bba4dc

Von Werner Hahn vor etwa 2 Jahren hinzugefügt

  • ID 27bba4dc37298ae5025de1c04e58902b8d0e41a7
  • Vorgänger 86ece8e2
  • Nachfolger 97982cd2

Beistelllieferschein/DeliveryOrder Lagerbuchungen mit in die Druckvariablen aufgenommen

Unterschiede anzeigen:

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

  
1316
  $self->prepare_stock_info($_) for $self->order->items;
1316
  $self->order->prepare_stock_info($_) for $self->order->items;
1317 1317

  
1318 1318
  return $self->order;
1319 1319
}
......
1365 1365
    $pos++;
1366 1366
  }
1367 1367

  
1368
  $self->prepare_stock_info($_) for $order->items, @items;
1369

  
1370 1368
  $order->add_items(grep {!$_->id} @items);
1371 1369

  
1372 1370
  return $order;
......
1494 1492
  return $item;
1495 1493
}
1496 1494

  
1497
sub prepare_stock_info {
1498
  my ($self, $item) = @_;
1499

  
1500
  $item->{stock_info} = SL::YAML::Dump([
1501
    map +{
1502
      delivery_order_items_stock_id => $_->id,
1503
      qty                           => $_->qty,
1504
      warehouse_id                  => $_->warehouse_id,
1505
      bin_id                        => $_->bin_id,
1506
      chargenumber                  => $_->chargenumber,
1507
      unit                          => $_->unit,
1508
    }, $item->delivery_order_stock_entries
1509
  ]);
1510
}
1511

  
1512 1495
sub setup_order_from_cv {
1513 1496
  my ($order) = @_;
1514 1497

  
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

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

  
115 119
  _copy_custom_variables($self, $form, 'vc_cvar_', '', $cvar_validity{vc});
......
118 122
  return $self;
119 123
}
120 124

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

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

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

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

  
968 968
  my $num_si   = 0;
969 969

  

Auch abrufbar als: Unified diff