} else {
# normal rename
+ my $res;
+
eval {
- my $res = $file->rename($::form->{to});
+ $res = $file->rename($::form->{to});
$main::lxdebug->message(LXDebug->DEBUG2(), "rename result=".$res);
- if ($res > SL::File::RENAME_OK) {
- $self->js->flash('error',
- $res == SL::File::RENAME_EXISTS ? $::locale->text('File still exists !')
- : $res == SL::File::RENAME_SAME ? $::locale->text('Same Filename !')
- : $::locale->text('File not exists !'))->render;
- return 1;
- }
1;
} or do {
$self->js->flash( 'error', t8('internal error (see details)'))
->flash_detail('error', $@)->render;
return;
+ };
+
+ if ($res != SL::File::RENAME_OK) {
+ $self->js->flash('error',
+ $res == SL::File::RENAME_EXISTS ? $::locale->text('File still exists !')
+ : $res == SL::File::RENAME_SAME ? $::locale->text('Same Filename !')
+ : $::locale->text('File not exists !'))
+ ->render;
+ return;
}
}
$self->is_global($::form->{is_global});
sub check_object_params {
my ($self) = @_;
- my $id = $::form->{object_id} +0;
- my $draftid = $::form->{draft_id} +0;
+ my $id = ($::form->{object_id} // 0) * 1;
+ my $draftid = ($::form->{draft_id} // 0) * 1;
my $gldoc = 0;
my $type = undef;
=head1 DESCRIPTION
-This is a controller for handling files in a storage independant way.
+This is a controller for handling files in a storage independent way.
The storage may be a Filesystem,a WebDAV, a Database or DMS.
These backends must be configered in ClientConfig.
This Controller use as intermediate layer for storage C<SL::File>.
=head2 C<action_list>
This loads a list of files on a webpage. This can be done with a normal submit or via an ajax/json call.
-Dependant of file_type different sources are available.
+Dependent of file_type different sources are available.
For documents there are the 'created' source and the imports from scanners or email.
For attachments and images only the 'uploaded' source available.
=head2 C<action_ajax_unimport>
-Some files can be unimported, dependant of the source of the file. This means they are moved
+Some files can be unimported, dependent of the source of the file. This means they are moved
back to the directory of the source
Available C<FORM PARAMS>:
Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt>
=cut
-