+ my (@files, @vc_files, @part_files, $has_document);
+
+ if ($::instance_conf->get_doc_storage) {
+ @files = SL::File->get_all_versions(object_id => $form->{id}, object_type => $form->{type}, file_type => 'document');
+ $has_document = 1 if scalar(@files) > 0;
+ @files = SL::File->get_all(object_id => $form->{id}, object_type => $form->{type}, file_type => 'attachment');
+ @vc_files = SL::File->get_all(object_id => $form->{"$form->{vc}_id"}, object_type => $form->{vc})
+ if $form->{vc} && $form->{"$form->{vc}_id"};
+
+ my %part_id_map = map { $_->{id} => $_ } grep { $_->{id} } map {
+ {
+ 'id' => $form->{"id_$_"},
+ 'partname' => $form->{"partnumber_$_"}
+ }
+ } (1 .. $form->{rowcount});
+
+ foreach my $partid (keys %part_id_map) {
+ my @pfiles = SL::File->get_all(object_id => $partid, object_type => 'part');
+ push @part_files, map { $_->{partname} = $part_id_map{$partid}->{partname}; $_ } @pfiles;
+ }
+ }
+