Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f769991a

Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt

  • ID f769991a4bd3d207cece79bb2cb3fc96cec4602d
  • Vorgänger 349cde39
  • Nachfolger 45eb8765

FlattenToForm: individuelle Lieferadresse und CVars berücksichtigen.

Unterschiede anzeigen:

SL/DB/Helper/FlattenToForm.pm
46 46
  _copy($self->$vc,                     $form, '',              '', 0, @vc_fields);
47 47
  _copy($self->$vc,                     $form, $vc,             '', 0, @vc_prefixed_fields);
48 48
  _copy($self->contact,                 $form, '',              '', 0, grep { /^cp_/    } map { $_->name } SL::DB::Contact->meta->columns) if _has($self, 'cp_id');
49
  _copy($self->shipto,                  $form, '',              '', 0, grep { /^shipto/ } map { $_->name } SL::DB::Shipto->meta->columns)  if _has($self, 'shipto_id');
50 49
  _copy($self->globalproject,           $form, 'globalproject', '', 0, qw(number description))                                             if _has($self, 'globalproject_id');
51 50
  _copy($self->employee,                $form, 'employee_',     '', 0, map { $_->name } SL::DB::Employee->meta->columns)                   if _has($self, 'employee_id');
52 51
  _copy($self->salesman,                $form, 'salesman_',     '', 0, map { $_->name } SL::DB::Employee->meta->columns)                   if _has($self, 'salesman_id');
53 52
  _copy($self->acceptance_confirmed_by, $form, 'acceptance_confirmed_by_', '', 0, map { $_->name } SL::DB::Employee->meta->columns)        if _has($self, 'acceptance_confirmed_by_id');
54 53

  
54
  # Copy selected shipto to form, if set. Else, copy custom shipto, if set.
55
  my $shipto = _has($self, 'shipto_id')     ? $self->shipto
56
             : _has($self, 'custom_shipto') ? $self->custom_shipto
57
             : undef;
58
  if ($shipto) {
59
    _copy($shipto,                  $form, '',            '', 0, grep { m{^shipto(?!_id$)} } map { $_->name } SL::DB::Shipto->meta->columns);
60
    _copy_custom_variables($shipto, $form, 'shiptocvar_', '');
61
  }
62

  
55 63
  _handle_user_data($self, $form);
56 64

  
57 65
  # company is employee and login independent
......
132 140
sub _copy_custom_variables {
133 141
  my ($src, $form, $prefix, $postfix, $cvar_validity) = @_;
134 142

  
135
  my $obj = (any { ref($src) eq $_ } qw(SL::DB::OrderItem SL::DB::DeliveryOrderItem SL::DB::InvoiceItem SL::DB::Contact))
143
  my $obj = (any { ref($src) eq $_ } qw(SL::DB::OrderItem SL::DB::DeliveryOrderItem SL::DB::InvoiceItem SL::DB::Contact SL::DB::Shipto))
136 144
          ? $src
137 145
          : $src->customervendor;
138 146

  

Auch abrufbar als: Unified diff