From 9093a3804d68bb07dbf2eea791175a693b05d32e Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Sun, 8 Dec 2024 08:30:32 +0100 Subject: [PATCH] Test: Fix Navigation on Empty FileQuestion See: https://mantis.ilias.de/view.php?id=42560 --- .../TestQuestionPool/classes/class.assFileUpload.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Modules/TestQuestionPool/classes/class.assFileUpload.php b/Modules/TestQuestionPool/classes/class.assFileUpload.php index a53ef3429753..1a23310ed520 100644 --- a/Modules/TestQuestionPool/classes/class.assFileUpload.php +++ b/Modules/TestQuestionPool/classes/class.assFileUpload.php @@ -44,6 +44,8 @@ class assFileUpload extends assQuestion implements ilObjQuestionScoringAdjustabl protected $allowedextensions; + private ?string $current_cmd; + /** @var boolean Indicates whether completion by submission is enabled or not */ protected $completion_by_submission = false; @@ -70,8 +72,10 @@ public function __construct( $question = "" ) { parent::__construct($title, $comment, $author, $owner, $question); + /** @var ILIAS\DI\Container $DIC */ global $DIC; - $this->file_upload = $DIC->upload(); + $this->file_upload = $DIC['upload']; + $this->current_cmd = $DIC['ilCtrl']->getCmd(); } /** @@ -687,7 +691,10 @@ public function saveWorkingData($active_id, $pass = null, $authorized = true): b $test_id = $this->lookupTestId($active_id); try { - $upload_handling_required = $this->isFileUploadAvailable() && $this->checkUpload(); + $upload_handling_required = $this->current_cmd !== 'submitSolution' + && !$this->isFileDeletionAction() + && $this->isFileUploadAvailable() + && $this->checkUpload(); } catch (IllegalStateException $e) { $this->tpl->setOnScreenMessage('failure', $e->getMessage(), true); return false;