Revision 37be6c33
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
sub action_customer_vendor_changed {
|
||
my ($self) = @_;
|
||
|
||
setup_order_from_cv($self->order);
|
||
$self->order(SL::Model::Record->update_after_customer_vendor_change($self->order));
|
||
|
||
my $cv_method = $self->cv;
|
||
|
||
... | ... | |
my $cv_id_method = $self->cv . '_id';
|
||
if (!$::form->{id} && $::form->{$cv_id_method}) {
|
||
$order->$cv_id_method($::form->{$cv_id_method});
|
||
setup_order_from_cv($order);
|
||
$order = SL::Model::Record->update_after_customer_vendor_change($order);
|
||
}
|
||
|
||
my $form_orderitems = delete $::form->{order}->{orderitems};
|
||
... | ... | |
return $item;
|
||
}
|
||
|
||
sub setup_order_from_cv {
|
||
my ($order) = @_;
|
||
|
||
$order->$_($order->customervendor->$_) for (qw(taxzone_id payment_id delivery_term_id currency_id));
|
||
|
||
$order->intnotes($order->customervendor->notes);
|
||
|
||
if ($order->is_sales) {
|
||
$order->salesman_id($order->customer->salesman_id || SL::DB::Manager::Employee->current->id);
|
||
$order->taxincluded(defined($order->customer->taxincluded_checked)
|
||
? $order->customer->taxincluded_checked
|
||
: $::myconfig{taxincluded_checked});
|
||
}
|
||
|
||
}
|
||
|
||
# setup custom shipto from form
|
||
#
|
||
# The dialog returns form variables starting with 'shipto' and cvars starting
|
SL/Controller/Order.pm | ||
---|---|---|
sub action_customer_vendor_changed {
|
||
my ($self) = @_;
|
||
|
||
setup_order_from_cv($self->order);
|
||
$self->order(SL::Model::Record->update_after_customer_vendor_change($self->order));
|
||
|
||
$self->recalc();
|
||
|
||
my $cv_method = $self->cv;
|
||
... | ... | |
my $cv_id_method = $self->cv . '_id';
|
||
if (!$::form->{id} && $::form->{$cv_id_method}) {
|
||
$order->$cv_id_method($::form->{$cv_id_method});
|
||
setup_order_from_cv($order);
|
||
$order = SL::Model::Record->update_after_customer_vendor_change($order);
|
||
}
|
||
|
||
my $form_orderitems = delete $::form->{order}->{orderitems};
|
||
... | ... | |
return $item;
|
||
}
|
||
|
||
sub setup_order_from_cv {
|
||
my ($order) = @_;
|
||
|
||
$order->$_($order->customervendor->$_) for (qw(taxzone_id payment_id delivery_term_id currency_id language_id));
|
||
|
||
$order->intnotes($order->customervendor->notes);
|
||
|
||
return if !$order->is_sales;
|
||
|
||
$order->salesman_id($order->customer->salesman_id || SL::DB::Manager::Employee->current->id);
|
||
$order->taxincluded(defined($order->customer->taxincluded_checked)
|
||
? $order->customer->taxincluded_checked
|
||
: $::myconfig{taxincluded_checked});
|
||
|
||
my $address = $order->customer->default_billing_address;;
|
||
$order->billing_address_id($address ? $address->id : undef);
|
||
}
|
||
|
||
# setup custom shipto from form
|
||
#
|
||
# The dialog returns form variables starting with 'shipto' and cvars starting
|
SL/Controller/Reclamation.pm | ||
---|---|---|
sub action_customer_vendor_changed {
|
||
my ($self) = @_;
|
||
|
||
$self->reclamation(
|
||
SL::Model::Record->update_after_customer_vendor_change($self->reclamation));
|
||
|
||
$self->recalc();
|
||
|
||
if ( $self->reclamation->customervendor->contacts
|
||
... | ... | |
);
|
||
}
|
||
|
||
my $cv_id_method = $self->cv . '_id';
|
||
if (!$::form->{id} && $::form->{$cv_id_method}) {
|
||
$reclamation->$cv_id_method($::form->{$cv_id_method});
|
||
$reclamation = SL::Model::Record->update_after_customer_vendor_change($reclamation);
|
||
}
|
||
|
||
my $form_reclamation_items = delete $::form->{reclamation}->{reclamation_items};
|
||
|
||
$reclamation->assign_attributes(%{$::form->{reclamation}});
|
SL/Model/Record.pm | ||
---|---|---|
return $new_record;
|
||
}
|
||
|
||
sub update_after_customer_vendor_change {
|
||
my ($class, $record) = @_;
|
||
my $new_customervendor = $record->customervendor;
|
||
|
||
$record->$_($new_customervendor->$_) for (qw(
|
||
taxzone_id payment_id delivery_term_id currency_id language_id
|
||
));
|
||
|
||
$record->intnotes($new_customervendor->notes);
|
||
|
||
return if !$record->is_sales;
|
||
if ($record->is_sales) {
|
||
my $new_customer = $new_customervendor;
|
||
$record->salesman_id($new_customer->salesman_id
|
||
|| SL::DB::Manager::Employee->current->id);
|
||
$record->taxincluded(defined($new_customer->taxincluded_checked)
|
||
? $new_customer->taxincluded_checked
|
||
: $::myconfig{taxincluded_checked});
|
||
if ($record->type_data->features('price_tax')) {
|
||
my $address = $new_customer->default_billing_address;;
|
||
$record->billing_address_id($address ? $address->id : undef);
|
||
}
|
||
}
|
||
|
||
return $record;
|
||
}
|
||
|
||
sub new_from_workflow {
|
||
my ($class, $source_object, $target_type, $target_subtype, %flags) = @_;
|
||
|
||
... | ... | |
|
||
Returns the record object.
|
||
|
||
=item C<update_after_customer_vendor_change>
|
||
|
||
Updates a record_object corresponding to customer/vendor and type_data.
|
||
Sets taxzone_id, payment_id, delivery_term_id, currency_id, language_id and
|
||
intnotes to customer/vendor. For sales records salesman and taxincluded is set.
|
||
Also for sales record with the feature 'price_tax' the billing address is updated.
|
||
|
||
Returns the record object.
|
||
|
||
=item C<new_from_workflow>
|
||
|
||
Expects source_object, target_type, target_subtype and can have flags.
|
||
... | ... | |
|
||
=item *
|
||
|
||
Handling of changed customer/vendor
|
||
|
||
=item *
|
||
|
||
sellprice changed handling
|
||
|
||
=back
|
Auch abrufbar als: Unified diff
Model::Record: Anpassen nach Kunden/Lieferanten-Änderung