From 24d1656ebd75cc1125b15b1c9727cae0fb4417d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 6 Apr 2022 12:09:16 +0200 Subject: [PATCH] =?utf8?q?SL::File:=20get=20auch=20mit=20dbfile=20als=20Pa?= =?utf8?q?rameter=20aufrufen=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/File.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SL/File.pm b/SL/File.pm index 81bc75597..ca065e0c7 100644 --- a/SL/File.pm +++ b/SL/File.pm @@ -21,11 +21,11 @@ use constant RENAME_NEW_VERSION => 4; sub get { my ($self, %params) = @_; - die 'no id' unless $params{id}; - my $dbfile = SL::DB::Manager::File->get_first(query => [id => $params{id}]); - die 'not found' unless $dbfile; - $main::lxdebug->message(LXDebug->DEBUG2(), "object_id=".$dbfile->object_id." object_type=".$dbfile->object_type." dbfile=".$dbfile); - SL::File::Object->new(db_file => $dbfile, id => $dbfile->id, loaded => 1); + die "no id or dbfile" unless $params{id} || $params{dbfile}; + $params{dbfile} = SL::DB::Manager::File->get_first(query => [id => $params{id}]) if !$params{dbfile}; + die 'not found' unless $params{dbfile}; + $main::lxdebug->message(LXDebug->DEBUG2(), "object_id=".$params{dbfile}->object_id." object_type=".$params{dbfile}->object_type." dbfile=".$params{dbfile}); + SL::File::Object->new(db_file => $params{dbfile}, id => $params{dbfile}->id, loaded => 1); } sub get_version_count { -- 2.20.1