Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 370f1355

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

  • ID 370f135530d197929969bec28c8178e7ad28ef3c
  • Vorgänger 34d35b6a
  • Nachfolger ca7dfd3e

Auftrags-Controller: Kunde/Lieferant vorbelegen, wenn deren id übergeben wird

Für die Workflow-Links aus den Kunden-/Lieferantenstammdaten heraus werden
die customer_id oder vendor_id berücksichtigt und die Kunden-/Lieferanten-
abhängigen Attribute im Order-Objekt entprechend gesetzt.

Unterschiede anzeigen:

SL/Controller/Order.pm
576 576
sub action_customer_vendor_changed {
577 577
  my ($self) = @_;
578 578

  
579
  _setup_order_from_cv($self->order);
580
  $self->_recalc();
581

  
579 582
  my $cv_method = $self->cv;
580 583

  
581 584
  if ($self->order->$cv_method->contacts && scalar @{ $self->order->$cv_method->contacts } > 0) {
......
590 593
    $self->js->hide('#shipto_row');
591 594
  }
592 595

  
593
  $self->order->taxzone_id($self->order->$cv_method->taxzone_id);
594

  
595
  if ($self->order->is_sales) {
596
    $self->order->taxincluded(defined($self->order->$cv_method->taxincluded_checked)
597
                              ? $self->order->$cv_method->taxincluded_checked
598
                              : $::myconfig{taxincluded_checked});
599
    $self->js->val('#order_salesman_id', $self->order->$cv_method->salesman_id);
600
  }
601

  
602
  $self->order->payment_id($self->order->$cv_method->payment_id);
603
  $self->order->delivery_term_id($self->order->$cv_method->delivery_term_id);
604

  
605
  $self->_recalc();
596
  $self->js->val( '#order_salesman_id',      $self->order->salesman_id)        if $self->order->is_sales;
606 597

  
607 598
  $self->js
608 599
    ->replaceWith('#order_cp_id',            $self->build_contact_select)
......
612 603
    ->val(        '#order_taxincluded',      $self->order->taxincluded)
613 604
    ->val(        '#order_payment_id',       $self->order->payment_id)
614 605
    ->val(        '#order_delivery_term_id', $self->order->delivery_term_id)
615
    ->val(        '#order_intnotes',         $self->order->$cv_method->notes)
606
    ->val(        '#order_intnotes',         $self->order->intnotes)
616 607
    ->focus(      '#order_' . $self->cv . '_id');
617 608

  
618 609
  $self->_js_redisplay_amounts_and_taxes;
......
1132 1123
  $order ||= SL::DB::Order->new(orderitems => [],
1133 1124
                                quotation  => (any { $self->type eq $_ } (_sales_quotation_type(), _request_quotation_type())));
1134 1125

  
1126
  my $cv_id_method = $self->cv . '_id';
1127
  if (!$::form->{id} && $::form->{$cv_id_method}) {
1128
    $order->$cv_id_method($::form->{$cv_id_method});
1129
    _setup_order_from_cv($order);
1130
  }
1131

  
1135 1132
  my $form_orderitems               = delete $::form->{order}->{orderitems};
1136 1133
  my $form_periodic_invoices_config = delete $::form->{order}->{periodic_invoices_config};
1137 1134

  
......
1251 1248
  return $item;
1252 1249
}
1253 1250

  
1251
sub _setup_order_from_cv {
1252
  my ($order) = @_;
1253

  
1254
  $order->$_($order->customervendor->$_) for (qw(taxzone_id payment_id delivery_term_id));
1255

  
1256
  $order->intnotes($order->customervendor->notes);
1257

  
1258
  if ($order->is_sales) {
1259
    $order->salesman_id($order->customer->salesman_id);
1260
    $order->taxincluded(defined($order->customer->taxincluded_checked)
1261
                        ? $order->customer->taxincluded_checked
1262
                        : $::myconfig{taxincluded_checked});
1263
  }
1264

  
1265
}
1266

  
1254 1267
# recalculate prices and taxes
1255 1268
#
1256 1269
# Using the PriceTaxCalculator. Store linetotals in the item objects.

Auch abrufbar als: Unified diff