Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| OwnerAddOrganisation | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| readResponse | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package 115Mandant |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsadmin; |
| 9 | |
| 10 | use BO\Zmsentities\Organisation as Entity; |
| 11 | use BO\Mellon\Validator; |
| 12 | |
| 13 | class OwnerAddOrganisation extends BaseController |
| 14 | { |
| 15 | /** |
| 16 | * @return String |
| 17 | */ |
| 18 | public function readResponse( |
| 19 | \Psr\Http\Message\RequestInterface $request, |
| 20 | \Psr\Http\Message\ResponseInterface $response, |
| 21 | array $args |
| 22 | ) { |
| 23 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); |
| 24 | $input = $request->getParsedBody(); |
| 25 | $parentId = Validator::value($args['id'])->isNumber()->getValue(); |
| 26 | if (is_array($input) && array_key_exists('save', $input)) { |
| 27 | $entity = (new Entity($input))->withCleanedUpFormData(); |
| 28 | $entity = \App::$http->readPostResult('/owner/' . $parentId . '/organisation/', $entity) |
| 29 | ->getEntity(); |
| 30 | return \BO\Slim\Render::redirect( |
| 31 | 'organisation', |
| 32 | array( |
| 33 | 'id' => $entity->id |
| 34 | ), |
| 35 | array( |
| 36 | 'success' => 'organisation_created' |
| 37 | ) |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | return \BO\Slim\Render::withHtml($response, 'page/organisation.twig', array( |
| 42 | 'title' => 'Kunde', |
| 43 | 'action' => 'add', |
| 44 | 'menuActive' => 'organisation', |
| 45 | 'workstation' => $workstation |
| 46 | )); |
| 47 | } |
| 48 | } |