Auditor diff draft

This commit is contained in:
Dennis Eichhorn 2019-02-14 23:43:06 +01:00
parent f6c0394405
commit 265a4a0d5c
4 changed files with 15 additions and 12 deletions

View File

@ -103,9 +103,10 @@ final class ApiController extends Controller
*/ */
public function apiUnitSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void public function apiUnitSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{ {
$unit = $this->updateUnitFromRequest($request); $old = clone UnitMapper::get((int) $request->getData('id'));
$this->updateModel($request, $unit, $unit, UnitMapper::class, 'unit'); $new = $this->updateUnitFromRequest($request);
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Unit', 'Unit successfully updated.', $unit); $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 public function apiPositionSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{ {
$position = $this->updatePositionFromRequest($request); $old = clone PositionMapper::get((int) $request->getData('id'));
$this->updateModel($request, $position, $position, PositionMapper::class, 'position'); $new = $this->updatePositionFromRequest($request);
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Position', 'Position successfully updated.', $position); $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 public function apiDepartmentSet(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{ {
$department = $this->updateDepartmentFromRequest($request); $old = clone DepartmentMapper::get((int) $request->getData('id'));
$this->updateModel($request, $department, $department, DepartmentMapper::class, 'department'); $new = $this->updateDepartmentFromRequest($request);
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully updated.', $department); $this->updateModel($request, $old, $new, DepartmentMapper::class, 'department');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Department', 'Department successfully updated.', $new);
} }
/** /**

View File

@ -21,7 +21,7 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100"> <section class="box wf-100">
<header><h1><?= $this->getHtml('Department') ?></h1></header> <header><h1><?= $this->getHtml('Department') ?></h1></header>
<div class="inner"> <div class="inner">
<form id="fDepartmentCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/rootPath}{/lang}/api/organization/department'); ?>"> <form id="fDepartmentCreate" method="PUT" action="<?= \phpOMS\Uri\UriFactory::build('{/rootPath}{/lang}/api/organization/department'); ?>">
<table class="layout wf-100" style="table-layout: fixed"> <table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label> <tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
<tr><td><input type="text" name="name" id="iName" placeholder="&#xf040; R&D" required> <tr><td><input type="text" name="name" id="iName" placeholder="&#xf040; R&D" required>

View File

@ -23,7 +23,7 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100"> <section class="box wf-100">
<header><h1><?= $this->getHtml('Department') ?></h1></header> <header><h1><?= $this->getHtml('Department') ?></h1></header>
<div class="inner"> <div class="inner">
<form id="iDepartment" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/backend/organization/department?{?}') ?>" method="PUT"> <form id="iDepartment" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/api/organization/department?{?}') ?>" method="POST">
<table class="layout wf-100" style="table-layout: fixed"> <table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label> <tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
<tr><td><input type="text" name="name" id="iName" value="<?= $this->printHtml($department->getName()); ?>"> <tr><td><input type="text" name="name" id="iName" value="<?= $this->printHtml($department->getName()); ?>">

View File

@ -23,7 +23,7 @@ echo $this->getData('nav')->render(); ?>
<section class="box wf-100"> <section class="box wf-100">
<header><h1><?= $this->getHtml('Position') ?></h1></header> <header><h1><?= $this->getHtml('Position') ?></h1></header>
<div class="inner"> <div class="inner">
<form id="iPosition" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/backend/organization/position?{?}') ?>" method="PUT"> <form id="iPosition" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/api/organization/position?{?}') ?>" method="POST">
<table class="layout wf-100" style="table-layout: fixed"> <table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iName"><?= $this->getHtml('Name') ?></label> <tr><td><label for="iName"><?= $this->getHtml('Name') ?></label>
<tr><td><input type="text" name="name" id="iName" value="<?= $this->printHtml($position->getName()); ?>"> <tr><td><input type="text" name="name" id="iName" value="<?= $this->printHtml($position->getName()); ?>">