Bugfix upload

This commit is contained in:
Thomas Zilio 2018-09-28 18:11:42 +02:00
parent 192961bf7a
commit 8795ca508e
2 changed files with 3 additions and 3 deletions

View File

@ -121,7 +121,7 @@ class FileManager implements ManagerInterface
if (!$options['readonly']) {
$result .= '
<a class="btn btn-xs btn-danger ask" data-backto="record-edit" data-msg="'.tr('Vuoi eliminare questo file?').'" data-op="unlink_file" data-id="'.$r['id'].'" data-filename="'.$r['filename'].'" data-callback="reload_'.$attachment_id.'">
<a class="btn btn-xs btn-danger ask" data-backto="record-edit" data-msg="'.tr('Vuoi eliminare questo file?').'" data-op="unlink_file" data-filename="'.$r['filename'].'" data-id_record="'.$r['id_record'].'" data-id_plugin="'.$options['id_plugin'].'" data-callback="reload_'.$attachment_id.'">
<i class="fa fa-trash"></i>
</a>';
}

View File

@ -196,7 +196,7 @@ class Uploads
$name = $database->selectOne('zz_files', ['name'], [
'filename' => $filename,
'id_module' => !empty($data['id_module']) ? $data['id_module'] : null,
'id_module' => !empty($data['id_module']) && empty($data['id_plugin']) ? $data['id_module'] : null,
'id_plugin' => !empty($data['id_plugin']) ? $data['id_plugin'] : null,
'id_record' => $data['id_record'],
])['name'];
@ -214,7 +214,7 @@ class Uploads
if (delete($files)) {
$database->delete('zz_files', [
'filename' => $fileinfo['basename'],
'id_module' => !empty($data['id_module']) ? $data['id_module'] : null,
'id_module' => !empty($data['id_module']) && empty($data['id_plugin']) ? $data['id_module'] : null,
'id_plugin' => !empty($data['id_plugin']) ? $data['id_plugin'] : null,
'id_record' => $data['id_record'],
]);