Skip to content

Commit 62439c5

Browse files
Gradebook: Fix user entity casting when saving category - refs BT#22564
1 parent 63a0447 commit 62439c5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

public/main/gradebook/lib/be/category.class.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,8 @@ public function add()
520520
$category = new GradebookCategory();
521521
$category->setTitle($this->name);
522522
$category->setDescription($this->description);
523+
$userId = is_numeric($this->user_id) ? (int) $this->user_id : api_get_user_id();
524+
$category->setUser(api_get_user_entity($userId));
523525
$category->setUser(api_get_user_entity($this->user_id));
524526
$category->setCourse($course);
525527
$category->setParent($parent);
@@ -613,7 +615,8 @@ public function save()
613615

614616
$category->setTitle($this->name);
615617
$category->setDescription($this->description);
616-
$category->setUser(api_get_user_entity($this->user_id));
618+
$userId = is_numeric($this->user_id) ? (int) $this->user_id : api_get_user_id();
619+
$category->setUser(api_get_user_entity($userId));
617620
$category->setCourse($course);
618621
$category->setParent($parent);
619622
$category->setWeight($this->weight);

0 commit comments

Comments
 (0)