diff --git a/Controller/ApiController.php b/Controller/ApiController.php index e0a40c9..0ac9bca 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -103,9 +103,10 @@ final class ApiController extends Controller */ public function apiUnitSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { - $unit = $this->updateUnitFromRequest($request); - $this->updateModel($request, $unit, $unit, UnitMapper::class, 'unit'); - $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit successfully updated.', $unit); + $old = clone UnitMapper::get((int) $request->getData('id')); + $new = $this->updateUnitFromRequest($request); + $this->updateModel($request, $old, $new, UnitMapper::class, 'unit'); + $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit successfully updated.', $new); } /** @@ -282,9 +283,10 @@ final class ApiController extends Controller */ public function apiPositionSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { - $position = $this->updatePositionFromRequest($request); - $this->updateModel($request, $position, $position, PositionMapper::class, 'position'); - $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Position', 'Position successfully updated.', $position); + $old = clone PositionMapper::get((int) $request->getData('id')); + $new = $this->updatePositionFromRequest($request); + $this->updateModel($request, $old, $new, PositionMapper::class, 'position'); + $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Position', 'Position successfully updated.', $new); } /** @@ -426,9 +428,10 @@ final class ApiController extends Controller */ public function apiDepartmentSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void { - $department = $this->updateDepartmentFromRequest($request); - $this->updateModel($request, $department, $department, DepartmentMapper::class, 'department'); - $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully updated.', $department); + $old = clone DepartmentMapper::get((int) $request->getData('id')); + $new = $this->updateDepartmentFromRequest($request); + $this->updateModel($request, $old, $new, DepartmentMapper::class, 'department'); + $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully updated.', $new); } /** diff --git a/Theme/Backend/department-create.tpl.php b/Theme/Backend/department-create.tpl.php index a25666f..31428bd 100644 --- a/Theme/Backend/department-create.tpl.php +++ b/Theme/Backend/department-create.tpl.php @@ -21,7 +21,7 @@ echo $this->getData('nav')->render(); ?>

getHtml('Department') ?>

-
+
diff --git a/Theme/Backend/department-profile.tpl.php b/Theme/Backend/department-profile.tpl.php index 74e3b00..5b45de1 100644 --- a/Theme/Backend/department-profile.tpl.php +++ b/Theme/Backend/department-profile.tpl.php @@ -23,7 +23,7 @@ echo $this->getData('nav')->render(); ?>

getHtml('Department') ?>

- +
diff --git a/Theme/Backend/position-profile.tpl.php b/Theme/Backend/position-profile.tpl.php index b305c7d..a31a6a6 100644 --- a/Theme/Backend/position-profile.tpl.php +++ b/Theme/Backend/position-profile.tpl.php @@ -23,7 +23,7 @@ echo $this->getData('nav')->render(); ?>

getHtml('Position') ?>

- +