Repository navigation
Mantis #47003: Fix learning sequence title & description not updated correctly - #10981
Conversation
|
Hey, thanks a lot for reporting the bug and for taking the time to provide a pull request — that’s really appreciated! I’ve reviewed the PR and would like to suggest a small change. The variable Instead, it should be sufficient to add the following two lines right before the Could you please adjust the PR accordingly? |
|
This is not correct. Please avoid using the setters in Best, |
|
I've dug a bit into this: So I see two possibilities: Override diff --git a/components/ILIAS/LearningSequence/classes/class.ilObjLearningSequence.php b/components/ILIAS/LearningSequence/classes/class.ilObjLearningSequence.php
index fd2b7d57f1c..5cd52e9902b 100755
--- a/components/ILIAS/LearningSequence/classes/class.ilObjLearningSequence.php
+++ b/components/ILIAS/LearningSequence/classes/class.ilObjLearningSequence.php
@@ -634,4 +634,16 @@ class ilObjLearningSequence extends ilContainer
$ret = $gui->showPage();
return $ret;
}
+
+ public function getTitle(): string
+ {
+ $props = $this->getObjectProperties();
+ return $props->getPropertyTitleAndDescription()->getTitle() ?? parent::getTitle();
+ }
+
+ public function getLongDescription(): string
+ {
+ $props = $this->getObjectProperties();
+ return $props->getPropertyTitleAndDescription()->getDescription() ?? parent::getLongDescription();
+ }
}Or 2., which does not seem very good: handle updating the translation again after diff --git a/components/ILIAS/LearningSequence/classes/Settings/class.ilObjLearningSequenceSettingsGUI.php b/components/ILIAS/LearningSequence/classes/Settings/class.ilObjLearningSequenceSettingsGUI.php
index f7f1dc021e0..dba0461c067 100755
--- a/components/ILIAS/LearningSequence/classes/Settings/class.ilObjLearningSequenceSettingsGUI.php
+++ b/components/ILIAS/LearningSequence/classes/Settings/class.ilObjLearningSequenceSettingsGUI.php
@@ -230,6 +230,11 @@ class ilObjLearningSequenceSettingsGUI
$lso->update();
+ $trans = $lso->getObjectTranslation();
+ $trans->setDefaultTitle($data['object']->getTitle());
+ $trans->setDefaultDescription($data['object']->getDescription());
+ $trans->save();
+
$this->tpl->setOnScreenMessage("success", $this->lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this);
return null;I've tested both and both work. What are your opinions, @kergomard and @mBeym, on this? |
|
I've opened #12403 with a simpler fix that works without the setters |
Fixes: https://mantis.ilias.de/view.php?id=47003
If accepted should be picked into release_11 & trunk