Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
17 / 17
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
PickupNotification
100.00% covered (success)
100.00%
17 / 17
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 readResponse
100.00% covered (success)
100.00%
17 / 17
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3/**
4 *
5 * @package Zmsadmin
6 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
7 *
8 */
9
10namespace BO\Zmsadmin;
11
12use BO\Mellon\Validator;
13use BO\Slim\Render;
14use BO\Zmsentities\Notification as Entity;
15
16/**
17 * Delete a process
18 */
19class PickupNotification extends BaseController
20{
21    /**
22     * @SuppressWarnings(Param)
23     * @return String
24     */
25    public function readResponse(
26        \Psr\Http\Message\RequestInterface $request,
27        \Psr\Http\Message\ResponseInterface $response,
28        array $args
29    ) {
30        $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity();
31        $validator = $request->getAttribute('validator');
32        $processId = $validator->getParameter('selectedprocess')->isNumber()->getValue();
33        $process = \App::$http->readGetResult('/process/' . $processId . '/')->getEntity();
34        // disabled 2021-01-20 by TK because in ZMS1 it is allowed to send pickup notifications
35        // to processes from another scope in department
36        //$workstation->testMatchingProcessScope($workstation->getScopeList(), $process);
37        $department = \App::$http->readGetResult('/scope/' . $workstation->scope['id'] . '/department/')->getEntity();
38        $config = \App::$http->readGetResult('/config/')->getEntity();
39
40        if ($process->scope->hasNotificationEnabled()) {
41            $notification = (new Entity())->toResolvedEntity($process, $config, $department, 'pickup');
42            $notification = \App::$http->readPostResult('/notification/', $notification)->getEntity();
43        }
44
45        return \BO\Slim\Render::withHtml(
46            $response,
47            'block/pickup/notificationSent.twig',
48            array(
49               'process' => $process,
50               'notification' => $notification ? $notification : null
51            )
52        );
53    }
54}