]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Presenter/Part.pm
ClientJS: automatisch Date- und Partpicker nach AJAX-Request initialisieren
[mfinanz.git] / SL / Presenter / Part.pm
index 599d0935656ebf4f15ee69fcfdaadea2714eb57e..332d5dbe79c59cc4f5710d76af0198235c40180f 100644 (file)
@@ -10,7 +10,7 @@ our @EXPORT = qw(part_picker);
 sub part_picker {
   my ($self, $name, $value, %params) = @_;
 
-  $value = SL::DB::Manager::Part->find_by(id => $value) if !ref $value;
+  $value = SL::DB::Manager::Part->find_by(id => $value) if $value && !ref $value;
   my $id = delete($params{id}) || $self->name_to_id($name);
 
   my $ret =
@@ -18,6 +18,8 @@ sub part_picker {
     join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(column type unit convertible_unit)) .
     $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params);
 
+  $::request->presenter->need_reinit_widgets($id);
+
   $self->html_tag('span', $ret, class => 'part_picker');
 }