Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 23 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
WorkstationProcessParked | |
0.00% |
0 / 23 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
readResponse | |
0.00% |
0 / 23 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | /** |
4 | * @package ZMS API |
5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
6 | **/ |
7 | |
8 | namespace BO\Zmsapi; |
9 | |
10 | use BO\Slim\Render; |
11 | use BO\Mellon\Validator; |
12 | use BO\Zmsdb\Workstation; |
13 | use BO\Zmsdb\Process as Query; |
14 | |
15 | class WorkstationProcessParked extends BaseController |
16 | { |
17 | /** |
18 | * @SuppressWarnings(Param) |
19 | * @return String |
20 | */ |
21 | public function readResponse( |
22 | \Psr\Http\Message\RequestInterface $request, |
23 | \Psr\Http\Message\ResponseInterface $response, |
24 | array $args |
25 | ) { |
26 | \BO\Zmsdb\Connection\Select::getWriteConnection(); |
27 | $workstation = (new Helper\User($request, 2))->checkRights(); |
28 | if (! $workstation->process['id']) { |
29 | throw new Exception\Process\ProcessNotFound(); |
30 | } |
31 | $process = (new Query())->readEntity($workstation->process['id'], $workstation->process['authKey'], 1); |
32 | |
33 | (new \BO\Zmsdb\ExchangeWaitingscope())->updateWaitingStatistics($process, \App::$now); |
34 | |
35 | $previousStatus = $process->status; |
36 | $workstation->process->setStatus("parked"); |
37 | $workstation->process->setStatusBySettings(); |
38 | $process = (new Query())->updateEntity( |
39 | $process, |
40 | \App::$now, |
41 | 0, |
42 | $previousStatus, |
43 | $workstation->getUseraccount() |
44 | ); |
45 | (new Workstation())->writeRemovedProcess($workstation); |
46 | unset($workstation->process); |
47 | |
48 | $message = Response\Message::create($request); |
49 | $message->data = $workstation; |
50 | |
51 | $response = Render::withLastModified($response, time(), '0'); |
52 | $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode()); |
53 | return $response; |
54 | } |
55 | } |