X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/5aacb82be45ed25864bff2ba15a97fbff4de7e11..9096031d4534a25bbd0573c23af1ce24f5ca5ba4:/SL/Controller/Part.pm diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index a05252c36..27a23daa8 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -20,6 +20,7 @@ use SL::CVar; use SL::MoreCommon qw(save_form); use Carp; use SL::Presenter::EscapedText qw(escape is_escaped); +use SL::Presenter::Tag qw(select_tag); use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(parts models part p warehouses multi_items_models @@ -227,6 +228,7 @@ sub render_form { %assembly_vars = %{ $self->prepare_assembly_render_vars } if $self->part->is_assembly; $params{CUSTOM_VARIABLES} = CVar->get_custom_variables(module => 'IC', trans_id => $self->part->id); + $_->{valid} = 1 for @{ $params{CUSTOM_VARIABLES} }; CVar->render_inputs('variables' => $params{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $self->part->partsgroup_id) if (scalar @{ $params{CUSTOM_VARIABLES} }); @@ -794,8 +796,9 @@ sub parse_form_makemodels { $position++; my $vendor = SL::DB::Manager::Vendor->find_by(id => $makemodel->{make}) || die "Can't find vendor from make"; + my $id = $makemodels_map->{$makemodel->{id}} ? $makemodels_map->{$makemodel->{id}}->id : undef; my $mm = SL::DB::MakeModel->new( # parts_id => $self->part->id, # will be assigned by row add_makemodels - id => $makemodel->{id}, + id => $id, make => $makemodel->{make}, model => $makemodel->{model} || '', lastcost => $::form->parse_amount(\%::myconfig, $makemodel->{lastcost_as_number}), @@ -834,8 +837,9 @@ sub parse_form_customerprices { $position++; my $customer = SL::DB::Manager::Customer->find_by(id => $customerprice->{customer_id}) || die "Can't find customer from id"; + my $id = $customerprices_map->{$customerprice->{id}} ? $customerprices_map->{$customerprice->{id}}->id : undef; my $cu = SL::DB::PartCustomerPrice->new( # parts_id => $self->part->id, # will be assigned by row add_customerprices - id => $customerprice->{id}, + id => $id, customer_id => $customerprice->{customer_id}, customer_partnumber => $customerprice->{customer_partnumber} || '', price => $::form->parse_amount(\%::myconfig, $customerprice->{price_as_number}), @@ -857,12 +861,13 @@ sub parse_form_customerprices { } sub build_bin_select { - $_[0]->p->select_tag('part.bin_id', [ $_[0]->warehouse->bins ], + select_tag('part.bin_id', [ $_[0]->warehouse->bins ], title_key => 'description', default => $_[0]->bin->id, ); } + # get_set_inits for partpicker sub init_parts { @@ -1020,7 +1025,7 @@ sub init_all_buchungsgruppen { if ( $self->part->orphaned ) { return SL::DB::Manager::Buchungsgruppe->get_all_sorted; } else { - return SL::DB::Manager::Buchungsgruppe->get_all(where => [ id => $self->part->buchungsgruppen_id ]); + return SL::DB::Manager::Buchungsgruppe->get_all_sorted(where => [ id => $self->part->buchungsgruppen_id ]); } }