From f22466d67079f9191f83c51135eee0761b24fee3 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 29 Mar 2012 16:57:07 +0200 Subject: [PATCH] Fixing bug when uploading works in groups --- main/work/work.lib.php | 6 ++---- main/work/work.php | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) 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'])) {