X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ff159a4d47b9a2d10744dcfc23da2c63605c8a32..eeb5375ee7727c956cc357cc8f90b19d1bfe80b9:/SL/Controller/CsvImport/DeliveryOrder.pm diff --git a/SL/Controller/CsvImport/DeliveryOrder.pm b/SL/Controller/CsvImport/DeliveryOrder.pm index 2e5a9e9ab..209324997 100644 --- a/SL/Controller/CsvImport/DeliveryOrder.pm +++ b/SL/Controller/CsvImport/DeliveryOrder.pm @@ -16,7 +16,6 @@ use SL::DB::Part; use SL::DB::PaymentTerm; use SL::DB::Contact; use SL::DB::PriceFactor; -use SL::DB::Pricegroup; use SL::DB::Shipto; use SL::DB::Unit; use SL::DB::Inventory; @@ -34,7 +33,7 @@ use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(settings languages_by all_parts parts_by part_counts_by contacts_by ct_shiptos_by - price_factors_by pricegroups_by units_by + price_factors_by units_by warehouses_by bins_by transfer_types_by) ], ); @@ -219,7 +218,7 @@ sub setup_displayable_columns { { name => 'language', description => $::locale->text('Language (name)') }, { name => 'language_id', description => $::locale->text('Language (database ID)') }, { name => 'notes', description => $::locale->text('Notes') }, - { name => 'order_type', description => $::locale->text('Delivery Order Type') }, + { name => 'record_type', description => $::locale->text('Delivery Order Type') }, { name => 'ordnumber', description => $::locale->text('Order Number') }, { name => 'payment', description => $::locale->text('Payment terms (name)') }, { name => 'payment_id', description => $::locale->text('Payment terms (database ID)') }, @@ -347,13 +346,6 @@ sub init_price_factors_by { return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_price_factors } } ) } qw(id description) }; } -sub init_pricegroups_by { - my ($self) = @_; - - my $all_pricegroups = SL::DB::Manager::Pricegroup->get_all; - return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_pricegroups } } ) } qw(id pricegroup) }; -} - sub init_units_by { my ($self) = @_; @@ -672,7 +664,7 @@ sub handle_stock { parts_id => $item_obj->parts_id, warehouse_id => $object->warehouse_id, bin_id => $object->bin_id, - trans_type_id => $trans_type_id, + PURCHASE_DELIVERY_ORDER_TYPE() => $trans_type_id, qty => $qty, chargenumber => $object->chargenumber, employee_id => $order_obj->employee_id, @@ -689,11 +681,11 @@ sub handle_stock { sub handle_type { my ($self, $entry) = @_; - if (!exists $entry->{raw_data}->{order_type}) { + if (!exists $entry->{raw_data}->{record_type}) { # if no type is present - set to sales delivery order or purchase delivery # order depending on is_sales or customer/vendor - $entry->{object}->order_type( + $entry->{object}->record_type( $entry->{object}->customer_id ? SALES_DELIVERY_ORDER_TYPE : $entry->{object}->vendor_id ? PURCHASE_DELIVERY_ORDER_TYPE : $entry->{raw_data}->{is_sales} ? SALES_DELIVERY_ORDER_TYPE : @@ -1047,31 +1039,6 @@ sub check_price_factor { return 1; } -sub check_pricegroup { - my ($self, $entry) = @_; - - my $object = $entry->{object}; - - # Check whether or not pricegroup ID is valid. - if ($object->pricegroup_id && !$self->pricegroups_by->{id}->{ $object->pricegroup_id }) { - push @{ $entry->{errors} }, $::locale->text('Error: Invalid price group'); - return 0; - } - - # Map pricegroup to ID if given. - if (!$object->pricegroup_id && $entry->{raw_data}->{pricegroup}) { - my $pricegroup = $self->pricegroups_by->{pricegroup}->{ $entry->{raw_data}->{pricegroup} }; - if (!$pricegroup) { - push @{ $entry->{errors} }, $::locale->text('Error: Invalid price group'); - return 0; - } - - $object->pricegroup_id($pricegroup->id); - } - - return 1; -} - sub check_warehouse { my ($self, $entry) = @_;