From 2477c49832de970bf90873f29a65abbbf5eddda3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 12 Jul 2013 09:54:25 +0200 Subject: [PATCH] Partpicker: Part manuell laden, wenn nur ID angegeben ist Ansonsten wird initial nichts angezeigt. --- SL/Presenter/Part.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SL/Presenter/Part.pm b/SL/Presenter/Part.pm index 3c1eecbb9..8ac847e3d 100644 --- a/SL/Presenter/Part.pm +++ b/SL/Presenter/Part.pm @@ -2,6 +2,8 @@ package SL::Presenter::Part; use strict; +use SL::DB::Part; + use Exporter qw(import); our @EXPORT = qw(part_picker); @@ -9,6 +11,8 @@ sub part_picker { my ($self, $name, $value, %params) = @_; my $name_e = $self->escape($name); + $value = SL::DB::Manager::Part->find_by(id => $value) if !ref $value; + my $ret = $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden') . $self->input_tag("", delete $params{type}, id => $self->name_to_id("$name_e\_type"), type => 'hidden') . -- 2.20.1