Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 844a541e

Von Moritz Bunkus vor etwa 3 Jahren hinzugefügt

  • ID 844a541e0d8f59644540413f675e8f07cd154cf6
  • Vorgänger ce73964f
  • Nachfolger 00177fae

Zusätzliche Rechnungsadressen: in Verkaufsbelegmasken auswählbar

Unterschiede anzeigen:

SL/Controller/Order.pm
13 13
use SL::MIME;
14 14
use SL::Util qw(trim);
15 15
use SL::YAML;
16
use SL::DB::AdditionalBillingAddress;
16 17
use SL::DB::History;
17 18
use SL::DB::Order;
18 19
use SL::DB::Default;
......
699 700
    $self->js->hide('#shipto_selection');
700 701
  }
701 702

  
703
  if ($cv_method eq 'customer') {
704
    my $show_hide = scalar @{ $self->order->customer->additional_billing_addresses } > 0 ? 'show' : 'hide';
705
    $self->js->$show_hide('#billing_address_row');
706
  }
707

  
702 708
  $self->js->val( '#order_salesman_id',      $self->order->salesman_id)        if $self->order->is_sales;
703 709

  
704 710
  $self->js
705
    ->replaceWith('#order_cp_id',            $self->build_contact_select)
706
    ->replaceWith('#order_shipto_id',        $self->build_shipto_select)
707
    ->replaceWith('#shipto_inputs  ',        $self->build_shipto_inputs)
708
    ->replaceWith('#business_info_row',      $self->build_business_info_row)
709
    ->val(        '#order_taxzone_id',       $self->order->taxzone_id)
710
    ->val(        '#order_taxincluded',      $self->order->taxincluded)
711
    ->val(        '#order_currency_id',      $self->order->currency_id)
712
    ->val(        '#order_payment_id',       $self->order->payment_id)
713
    ->val(        '#order_delivery_term_id', $self->order->delivery_term_id)
714
    ->val(        '#order_intnotes',         $self->order->intnotes)
715
    ->val(        '#order_language_id',      $self->order->$cv_method->language_id)
711
    ->replaceWith('#order_cp_id',              $self->build_contact_select)
712
    ->replaceWith('#order_shipto_id',          $self->build_shipto_select)
713
    ->replaceWith('#shipto_inputs  ',          $self->build_shipto_inputs)
714
    ->replaceWith('#order_billing_address_id', $self->build_billing_address_select)
715
    ->replaceWith('#business_info_row',        $self->build_business_info_row)
716
    ->val(        '#order_taxzone_id',         $self->order->taxzone_id)
717
    ->val(        '#order_taxincluded',        $self->order->taxincluded)
718
    ->val(        '#order_currency_id',        $self->order->currency_id)
719
    ->val(        '#order_payment_id',         $self->order->payment_id)
720
    ->val(        '#order_delivery_term_id',   $self->order->delivery_term_id)
721
    ->val(        '#order_intnotes',           $self->order->intnotes)
722
    ->val(        '#order_language_id',        $self->order->$cv_method->language_id)
716 723
    ->focus(      '#order_' . $self->cv . '_id')
717 724
    ->run('kivi.Order.update_exchangerate');
718 725

  
......
742 749
  $details{payment_terms}       = $cv->payment->description       if $cv->payment;
743 750
  $details{pricegroup}          = $cv->pricegroup->pricegroup     if $is_customer && $cv->pricegroup;
744 751

  
752
  foreach my $entry (@{ $cv->additional_billing_addresses }) {
753
    push @{ $details{ADDITIONAL_BILLING_ADDRESSES} },   { map { $_ => $entry->$_ } @{$entry->meta->columns} };
754
  }
745 755
  foreach my $entry (@{ $cv->shipto }) {
746 756
    push @{ $details{SHIPTO} },   { map { $_ => $entry->$_ } @{$entry->meta->columns} };
747 757
  }
......
1308 1318
  );
1309 1319
}
1310 1320

  
1321
# build the selection box for the additional billing address
1322
#
1323
# Needed, if customer/vendor changed.
1324
sub build_billing_address_select {
1325
  my ($self) = @_;
1326

  
1327
  select_tag('order.billing_address_id',
1328
             [ {displayable_id => '', id => ''}, $self->order->{$self->cv}->additional_billing_addresses ],
1329
             value_key  => 'id',
1330
             title_key  => 'displayable_id',
1331
             default    => $self->order->billing_address_id,
1332
             with_empty => 0,
1333
             style      => 'width: 300px',
1334
  );
1335
}
1336

  
1311 1337
# build the selection box for shiptos
1312 1338
#
1313 1339
# Needed, if customer/vendor changed.
......
1565 1591

  
1566 1592
  $order->intnotes($order->customervendor->notes);
1567 1593

  
1568
  if ($order->is_sales) {
1569
    $order->salesman_id($order->customer->salesman_id || SL::DB::Manager::Employee->current->id);
1570
    $order->taxincluded(defined($order->customer->taxincluded_checked)
1571
                        ? $order->customer->taxincluded_checked
1572
                        : $::myconfig{taxincluded_checked});
1573
  }
1594
  return if !$order->is_sales;
1595

  
1596
  $order->salesman_id($order->customer->salesman_id || SL::DB::Manager::Employee->current->id);
1597
  $order->taxincluded(defined($order->customer->taxincluded_checked)
1598
                      ? $order->customer->taxincluded_checked
1599
                      : $::myconfig{taxincluded_checked});
1574 1600

  
1601
  my $address = $order->customer->default_billing_address;;
1602
  $order->billing_address_id($address ? $address->id : undef);
1575 1603
}
1576 1604

  
1577 1605
# setup custom shipto from form

Auch abrufbar als: Unified diff