diff --git a/main/work/work.lib.php b/main/work/work.lib.php
index 9b81e74d8f..87ff35c31f 100644
--- a/main/work/work.lib.php
+++ b/main/work/work.lib.php
@@ -52,13 +52,11 @@ function display_action_links($id, $cur_dir_path, $show_tool_options, $display_u
}
}
-
- if ($display_upload_link && api_is_allowed_to_session_edit(false, true) && (isset($cur_dir_path) && (!empty($cur_dir_path) && $cur_dir_path != '/') )) {
- $display_output .= '';
+ if ($display_upload_link && api_is_allowed_to_session_edit(false, true) && !empty($id)) {
+ $display_output .= '';
$display_output .= Display::return_icon('upload_file.png', get_lang('UploadADocument'),'',ICON_SIZE_MEDIUM).'';
}
-
if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath' && api_is_allowed_to_session_edit(false, true)) {
// Delete all files
if (api_get_setting('permanently_remove_deleted_files') == 'true'){
diff --git a/main/work/work.php b/main/work/work.php
index 9a47ad79c1..1cd0cb0607 100644
--- a/main/work/work.php
+++ b/main/work/work.php
@@ -368,10 +368,9 @@ switch ($action) {
break;
case 'edit':
case 'upload_form': //can be add or edit work
- $is_author = false;
-
- if (empty($item_id)) {
- $parent_data = get_work_data_by_id($work_id);
+ $is_author = false;
+ if (empty($item_id)) {
+ $parent_data = get_work_data_by_id($work_id);
$parent_data['qualification'] = intval($parent_data['qualification']);
if (!empty($parent_data) && !empty($parent_data['qualification'])) {