From 57f150274e0dc0f89968bc59a8a7a997ae7c4a08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 7 May 2021 15:21:59 +0200 Subject: [PATCH] ImageUpload: resolve --- SL/Controller/ImageUpload.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/SL/Controller/ImageUpload.pm b/SL/Controller/ImageUpload.pm index a93c85347..952522a57 100644 --- a/SL/Controller/ImageUpload.pm +++ b/SL/Controller/ImageUpload.pm @@ -3,6 +3,8 @@ package SL::Controller::ImageUpload; use strict; use parent qw(SL::Controller::Base); +use JSON qw(to_json); + use SL::DB::Part; use SL::DB::Order; use SL::DB::DeliveryOrder; @@ -34,6 +36,17 @@ sub action_upload_image { $self->render('image_upload/local_list'); } +sub action_resolve_object_by_number { + my ($self) = @_; + + my $result = { + id => $self->object->id, + description => $self->object->displayable_name, + }; + + $self->render(\ to_json($result), { process => 0, type => 'json' }); +} + ################# internal ############### sub init_object_type { @@ -50,7 +63,7 @@ sub init_object { return $manager->find_by(id => $::form->{object_id}*1) if $::form->{object_id}; - return $manager->find_by(donumber => $::form->{object_number}, @{ $loader->[1] // [] }) if $::form->{object_number}; + return $manager->find_by(donumber => $::form->{object_number}, closed => 0, @{ $loader->[1] // [] }) if $::form->{object_number}; } -- 2.20.1