From: Moritz Bunkus Date: Fri, 12 Jul 2013 07:54:25 +0000 (+0200) Subject: Partpicker: Part manuell laden, wenn nur ID angegeben ist X-Git-Tag: release-3.1.0beta1~175^2~7 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2477c49832de970bf90873f29a65abbbf5eddda3;p=kivitendo-erp.git Partpicker: Part manuell laden, wenn nur ID angegeben ist Ansonsten wird initial nichts angezeigt. --- 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') .