Passed
Push — master ( 93a413...032ee0 )
by Patrick
08:32
created

ShiftAPI::removeGroupLink()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 32
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 20
nc 6
nop 3
dl 0
loc 32
rs 8.9777
c 0
b 0
f 0
1
<?php
2
class ShiftAPI extends VolunteerAPI
3
{
4
    use Processor;
0 ignored issues
show
introduced by
The trait Processor requires some properties which are not provided by ShiftAPI: $startTime, $certs, $endTime, $mail, $uid, $title
Loading history...
5
6
    public function __construct()
7
    {
8
        parent::__construct('shifts');
9
    }
10
11
    public function setup($app)
12
    {
13
        parent::setup($app);
14
        $app->post('/Actions/CreateGroup', array($this, 'createGroup'));
15
        $app->post('/Actions/NewGroup', array($this, 'newGroup'));
16
        $app->post('/Actions/DeleteGroup', array($this, 'deleteGroup'));
17
        $app->post('/Actions/RemoveGroupSignupLink', array($this, 'removeGroupLink'));
18
        $app->post('/{shift}/Actions/Signup[/]', array($this, 'signup'));
19
        $app->post('/{shift}/Actions/Abandon[/]', array($this, 'abandon'));
20
        $app->post('/{shift}/Actions/Approve[/]', array($this, 'approvePending'));
21
        $app->post('/{shift}/Actions/Disapprove[/]', array($this, 'disapprovePending')); 
22
        $app->post('/{shift}/Actions/StartGroupSignup', array($this, 'startGroupSignup'));
23
        $app->post('/{shift}/Actions/GenerateGroupLink', array($this, 'generateGroupLink'));
24
        $app->post('/{shift}/Actions/EmptyShift[/]', array($this, 'emptyShift'));
25
        $app->post('/{shift}/Actions/ForceShiftEmpty[/]', array($this, 'forceEmpty'));
26
    }
27
28
    protected function canCreate($request)
29
    {
30
        //Check is handled by validateCreate...
31
        return true;
32
    }
33
34
    protected function canUpdate($request, $entity)
35
    {
36
        if($this->isVolunteerAdmin($request))
37
        {
38
            return true;
39
        }
40
        return $this->isUserDepartmentLead($entity['departmentID'], $this->user);
41
    }
42
43
    protected function canDelete($request, $entity)
44
    {
45
        return $this->canUpdate($request, $entity);
46
    }
47
48
    protected function validateCreate(&$obj, $request)
49
    {
50
        if($this->isVolunteerAdmin($request))
51
        {
52
            return true;
53
        }
54
        if(!isset($obj['departmentID']))
55
        {
56
             return false;
57
        }
58
        if(isset($obj['unbounded']) && $obj['unbounded'])
59
        {
60
            if(!isset($obj['minShifts']) || $obj['minShifts'] === 0 || $obj['minShifts'] === '')
61
            {
62
                 $obj['minShifts'] = '1';
63
            }
64
        }
65
        return $this->isUserDepartmentLead($obj['departmentID'], $this->user);
66
    }
67
68
    protected function processEntry($entry, $request)
69
    {
70
        return $this->processShift($entry, $request);
71
    }
72
73
    protected function postUpdateAction($newObj, $request, $oldObj)
74
    {
75
        $oldShift = new \VolunteerShift(false, $oldObj);
76
        if($oldShift->isFilled() && ($oldObj['startTime'] != $newObj['startTime'] || $oldObj['endTime'] != $newObj['endTime']))
77
        {
78
            $email = new \Emails\ShiftEmail($oldShift, 'shiftChangedSource');
79
            $this->sendEmail($email);
80
        }
81
        return true;
82
    }
83
84
    protected function postDeleteAction($entry)
85
    {
86
        if(empty($entry))
87
        {
88
            return true;
89
        }
90
        $shift = new \VolunteerShift(false, $entry[0]);
91
        if($shift->isFilled())
92
        {
93
            $email = new \Emails\ShiftEmail($shift, 'shiftCanceledSource');
94
            $this->sendEmail($email);
95
        }
96
        return true;
97
    }
98
99
    protected function genUUID()
100
    {
101
        return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
102
            // 32 bits for "time_low"
103
            mt_rand(0, 0xffff), mt_rand(0, 0xffff),
104
105
            // 16 bits for "time_mid"
106
            mt_rand(0, 0xffff),
107
108
            // 16 bits for "time_hi_and_version",
109
            // four most significant bits holds version number 4
110
            mt_rand(0, 0x0fff) | 0x4000,
111
112
            // 16 bits, 8 bits for "clk_seq_hi_res",
113
            // 8 bits for "clk_seq_low",
114
            // two most significant bits holds zero and one for variant DCE1.1
115
            mt_rand(0, 0x3fff) | 0x8000,
116
117
            // 48 bits for "node"
118
            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
119
        );
120
    }
121
122
    public function createGroup($request, $response)
123
    {
124
        $array = $request->getParsedBody();
125
        $count = count($array);
126
        $entArray = array();
127
        $uuid = $this->genUUID();
128
        $dataTable = $this->getDataTable();
129
        //User must be able to edit all shifts
130
        for($i = 0; $i < $count; $i++)
131
        {
132
            $filter = $this->getFilterForPrimaryKey($array[$i]);
133
            $entity = $dataTable->read($filter);
134
            if($entity === false || !isset($entity[0]))
135
            {
136
                return $response->withStatus(404);
137
            }
138
            $entity = $entity[0];
139
            if(!$this->canUpdate($request, $entity))
140
            {
141
                return $response->withStatus(401);
142
            }
143
            $entity['groupID'] = $uuid;
144
            array_push($entArray, $entity);
145
        }
146
        //If we got here we can update them all
147
        $myRet = true;
148
        $errors = array();
149
        for($i = 0; $i < $count; $i++)
150
        {
151
            $filter = $this->getFilterForPrimaryKey($array[$i]);
152
            $ret = $dataTable->update($filter, $entArray[$i]);
153
            if($ret === false)
154
            {
155
               $myRet = false;
156
               array_push($errors, $array[$i]);
157
            }
158
        }
159
        if($myRet)
0 ignored issues
show
introduced by
The condition $myRet is always true.
Loading history...
160
        {
161
            return $response->withJson($myRet);
162
        }
163
        else
164
        {
165
            return $response->withJson(array('res'=>$myRet, 'errors'=>$errors));
166
        }
167
    }
168
169
    public function newGroup($request, $response)
170
    {
171
        if(!$this->canCreate($request))
172
        {
173
            return $response->withStatus(401);
174
        }
175
        $data = $request->getParsedBody();
176
        $shift = array();
177
        $shift['groupID'] = $this->genUUID();
178
        $shift['departmentID'] = $data['groupDepartmentID'];
179
        $shift['earlyLate'] = $data['groupEarlyLate'];
180
        $shift['enabled'] = $data['groupEnabled'];
181
        $shift['approvalNeeded'] = $data['groupApprovalNeeded'];
182
        $shift['endTime'] = $data['groupEndTime'];
183
        $shift['eventID'] = $data['groupEvent'];
184
        $shift['name'] = $data['groupName'];
185
        $shift['startTime'] = $data['groupStartTime'];
186
        $dataTable = $this->getDataTable();
187
        $ret = true;
188
        foreach($data['roles'] as $role=>$count)
189
        {
190
            $count = intval($count);
191
            for($i = 0; $i < $count; $i++)
192
            {
193
                $shift['roleID'] = $role;
194
                if($dataTable->create($shift) === false)
195
                {
196
                    $ret = false;
197
                }
198
            }
199
        }
200
        return $response->withJSON($ret);
201
    }
202
203
    public function deleteGroup($request, $response)
204
    {
205
        $data = $request->getParsedBody();
206
        $dataTable = $this->getDataTable();
207
        $filter = new \Data\Filter('groupID eq '.$data['groupID']);
208
        $entities = $dataTable->read($filter);
209
        if(empty($entities))
210
        {
211
            return $response->withStatus(404);
212
        }
213
        if(!$this->canUpdate($request, $entities[0]))
214
        {
215
            return $response->withStatus(401);
216
        }
217
        $res = $dataTable->delete($filter);
218
        if($res)
219
        {
220
            return $response->withJSON($res);
221
        }
222
        return $response->withJSON($res, 500);
223
    }
224
225
    protected function doSignup($uid, $status, $entity, $filter, $dataTable)
226
    {
227
        if(isset($entity['earlyLate']) && $entity['earlyLate'] !== '-1')
228
        {
229
            $event = new \VolunteerEvent($entity['eventID']);
230
            if(!$event->hasVolOnEEList($uid, intval($entity['earlyLate'])))
231
            {
232
                $status = 'pending';
233
                $entity['needEEApproval'] = true;
234
                $event->addToEEList($uid, intval($entity['earlyLate']));
235
            }
236
        }
237
        else if(isset($entity['approvalNeeded']) && $entity['approvalNeeded'])
238
        {
239
            $status = 'pending';
240
        }
241
        $entity['participant'] = $uid;
242
        $entity['status'] = $status;
243
        return $dataTable->update($filter, $entity);
244
    }
245
246
    public function signup($request, $response, $args)
247
    {
248
        $this->validateLoggedIn($request);
249
        $shiftId = $args['shift'];
250
        $dataTable = $this->getDataTable();
251
        $filter = $this->getFilterForPrimaryKey($shiftId);
252
        $entity = $dataTable->read($filter);
253
        if(empty($entity))
254
        {
255
            return $response->withStatus(404);
256
        }
257
        $entity = $entity[0];
258
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
259
        {
260
            return $response->withStatus(401);
261
        }
262
        $shift = new \VolunteerShift($shiftId, $entity);
263
        $entity = $this->processShift($entity, $request);
264
        if(isset($entity['minShifts']) && $entity['minShifts'] > 0)
265
        {
266
          $shift->makeCopy($dataTable);
267
        }
268
        if(isset($entity['overlap']) && $entity['overlap'])
269
        {
270
            $overlaps = $shift->findOverlaps($this->user->uid);
271
            $count = count($overlaps);
0 ignored issues
show
Bug introduced by
It seems like $overlaps can also be of type true; however, parameter $var of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

271
            $count = count(/** @scrutinizer ignore-type */ $overlaps);
Loading history...
272
            $leads = array();
273
            for($i = 0; $i < $count; $i++)
274
            {
275
                $dept = new \VolunteerDepartment($overlaps[$i]->departmentID);
276
                $leads = array_merge($leads, $dept->getLeadEmails());
277
                $overlaps[$i]->status = 'pending';
278
                $tmp = new \Data\Filter('_id eq '.$overlaps[$i]->{'_id'});
279
                $res = $dataTable->update($tmp, $overlaps[$i]);
280
                if($res === false)
281
                {
282
                    return $response->withJSON(array('err'=>'Unable to update overlap with id '.$overlaps[$i]->{'_id'}));
283
                }
284
            }
285
            $dept = new \VolunteerDepartment($entity['departmentID']);
286
            $leads = array_merge($leads, $dept->getLeadEmails());
287
            $leads = array_unique($leads);
288
            $ret = $this->doSignup($this->user->uid, 'pending', $entity, $filter, $dataTable);
289
            $profile = new \VolunteerProfile($this->user->uid);
290
            $email = new \Emails\TwoShiftsAtOnceEmail($profile);
291
            $email->addLeads($leads);
292
            $emailProvider = \EmailProvider::getInstance();
293
            if($emailProvider->sendEmail($email) === false)
294
            {
295
                throw new \Exception('Unable to send duplicate email!');
296
            }
297
            return $response->withJSON($ret);
298
        }
299
        if(isset($entity['available']) && $entity['available'])
300
        {
301
            $ret = $this->doSignup($this->user->uid, 'filled', $entity, $filter, $dataTable);
302
            return $response->withJSON($ret);
303
        }
304
        if(isset($entity['status']) && $entity['status'] === 'groupPending')
305
        {
306
            $ret = $this->doSignup($this->user->uid, 'filled', $entity, $filter, $dataTable);
307
            return $response->withJSON($ret);
308
        }
309
        print_r($entity); die();
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
310
    }
311
312
    public function abandon($request, $response, $args)
313
    {
314
        $this->validateLoggedIn($request);
315
        $shiftId = $args['shift'];
316
        $dataTable = $this->getDataTable();
317
        $filter = $this->getFilterForPrimaryKey($shiftId);
318
        $entity = $dataTable->read($filter);
319
        if(empty($entity))
320
        {
321
            return $response->withStatus(404);
322
        }
323
        $entity = $entity[0];
324
        if(!isset($entity['participant']) || $entity['participant'] !== $this->user->uid)
325
        {
326
            return $response->withStatus(401);
327
        }
328
        $entity['participant'] = '';
329
        $entity['status'] = 'unfilled';
330
        if(isset($entity['needEEApproval']))
331
        {
332
          unset($entity['needEEApproval']);
333
        }
334
        return $response->withJSON($dataTable->update($filter, $entity));
335
    }
336
337
    public function approvePending($request, $response, $args)
338
    {
339
        if(!$this->canCreate($request))
340
        {
341
            return $response->withStatus(401);
342
        }
343
        $shiftId = $args['shift'];
344
        $dataTable = $this->getDataTable();
345
        $filter = $this->getFilterForPrimaryKey($shiftId);
346
        $entity = $dataTable->read($filter);
347
        if(empty($entity))
348
        {
349
            return $response->withStatus(404);
350
        }
351
        $entity = $entity[0];
352
        $entity['status'] = 'filled';
353
        return $response->withJSON($dataTable->update($filter, $entity));
354
    }
355
356
    public function disapprovePending($request, $response, $args)
357
    {
358
        if(!$this->canCreate($request))
359
        {
360
            return $response->withStatus(401);
361
        }
362
        $shiftId = $args['shift'];
363
        $dataTable = $this->getDataTable();
364
        $filter = $this->getFilterForPrimaryKey($shiftId);
365
        $entity = $dataTable->read($filter);
366
        if(empty($entity))
367
        {
368
            return $response->withStatus(404);
369
        }
370
        $entity['participant'] = '';
371
        $entity['status'] = 'unfilled';
372
        $profile = new \VolunteerProfile($this->user->uid);
373
        $email = new \Emails\PendingRejectedEmail($profile);
374
        $email->setShift($entity);
375
        $this->sendEmail($email);
376
        return $response->withJSON($dataTable->update($filter, $entity));
377
    }
378
379
    public function startGroupSignup($request, $response, $args)
380
    {
381
        $this->validateLoggedIn($request);
382
        $shiftId = $args['shift'];
383
        $dataTable = $this->getDataTable();
384
        $filter = $this->getFilterForPrimaryKey($shiftId);
385
        $entity = $dataTable->read($filter);
386
        if(empty($entity))
387
        {
388
            return $response->withStatus(404);
389
        }
390
        $entity = $entity[0];
391
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
392
        {
393
            return $response->withStatus(401);
394
        }
395
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
396
        $entities = $dataTable->read($filter);
397
        $count = count($entities);
0 ignored issues
show
Bug introduced by
It seems like $entities can also be of type boolean; however, parameter $var of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

397
        $count = count(/** @scrutinizer ignore-type */ $entities);
Loading history...
398
        $dept = new \VolunteerDepartment($entity['departmentID']);
399
        $res = array();
400
        $res['department'] = $dept->departmentName;
0 ignored issues
show
Bug Best Practice introduced by
The property departmentName does not exist on VolunteerDepartment. Since you implemented __get, consider adding a @property annotation.
Loading history...
401
        $res['earlyLate'] = $entity['earlyLate'];
402
        $res['endTime'] = $entity['endTime'];
403
        $res['eventID'] = $entity['eventID'];
404
        $res['name'] = $entity['name'];
405
        $res['startTime'] = $entity['startTime'];
406
        $res['groupID'] = $entity['groupID'];
407
        $res['shifts'] = array();
408
        $roles = array();
409
        for($i = 0; $i < $count; $i++)
410
        {
411
            if(isset($entities[$i]['status']) && ($entities[$i]['status'] === 'filled' || $entities[$i]['status'] === 'pending'))
412
            {
413
                continue;
414
            }
415
            if(!isset($roles[$entities[$i]['roleID']]))
416
            {
417
                $roles[$entities[$i]['roleID']] = new \VolunteerRole($entities[$i]['roleID']);
418
            }
419
            $role = $roles[$entities[$i]['roleID']];
420
            $entities[$i]['role'] = $role->display_name;
421
            array_push($res['shifts'], $entities[$i]);
422
        }
423
        return $response->withJSON($res);
424
    }
425
426
    public function generateGroupLink($request, $response, $args)
427
    {
428
        $this->validateLoggedIn($request);
429
        $shiftId = $args['shift'];
430
        $dataTable = $this->getDataTable();
431
        $filter = $this->getFilterForPrimaryKey($shiftId);
432
        $entity = $dataTable->read($filter);
433
        if(empty($entity))
434
        {
435
            return $response->withStatus(404);
436
        }
437
        $entity = $entity[0];
438
        if(isset($entity['participant']) && strlen($entity['participant']) > 0)
439
        {
440
            return $response->withStatus(401);
441
        }
442
        $data = $request->getParsedBody();
443
        $myShift = $data['myshift'];
444
        $roles = array();
445
        foreach($data as $key => $value)
446
        {
447
            if(substr($key, 0, 6) === "roles.")
448
            {
449
                $roles[substr($key, 6)] = $value;
450
            }
451
        }
452
        $filter = new \Data\Filter('groupID eq '.$entity['groupID'].' and enabled eq true');
453
        $entities = $dataTable->read($filter);
454
        $count = count($entities);
0 ignored issues
show
Bug introduced by
It seems like $entities can also be of type boolean; however, parameter $var of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

454
        $count = count(/** @scrutinizer ignore-type */ $entities);
Loading history...
455
        $uuid = $this->genUUID();
456
        $time = date('c');
457
        for($i = 0; $i < $count; $i++)
458
        {
459
            if(isset($entities[$i]['status']) && ($entities[$i]['status'] === 'filled' || $entities[$i]['status'] === 'pending'))
460
            {
461
                $entities[$i] = false;
462
                continue;
463
            }
464
            if((string)$entities[$i]['_id'] === (string)new \MongoDB\BSON\ObjectId($myShift))
465
            {
466
                $entities[$i]['participant'] = $this->user->uid;
467
                $entities[$i]['status'] = 'filled';
468
                $entities[$i]['signupLink'] = $uuid;
469
                $entities[$i]['groupLinkCreated'] = $time;
470
                $entities[$i]['signupOn'] = $time;
471
            }
472
            else if(isset($roles[$entities[$i]['roleID']]))
473
            {
474
                $entities[$i]['status'] = 'groupPending';
475
                $entities[$i]['signupLink'] = $uuid;
476
                $entities[$i]['groupLinkCreated'] = $time;
477
                $roles[$entities[$i]['roleID']]--;
478
                if($roles[$entities[$i]['roleID']] === 0)
479
                {
480
                    unset($roles[$entities[$i]['roleID']]);
481
                }
482
            }
483
            else
484
            {
485
                $entities[$i] = false;
486
            }
487
        }
488
        if(count($roles) !== 0)
489
        {
490
            throw new \Exception('Not enough shifts to fullfill requests');
491
        }
492
        for($i = 0; $i < $count; $i++)
493
        {
494
            if($entities[$i] === false)
495
            {
496
                continue;
497
            }
498
            $filter = new \Data\Filter('_id eq '.$entities[$i]['_id']);
499
            $res = $dataTable->update($filter, $entities[$i]);
500
            if($res === false)
501
            {
502
                throw new \Exception('Not able to save shift '.$entities[$i]['_id']);
503
            }
504
        }
505
        return $response->withJSON(array('uuid' => $uuid));
506
    }
507
508
    public function removeGroupLink($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

508
    public function removeGroupLink($request, $response, /** @scrutinizer ignore-unused */ $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
509
    {
510
        if(!$this->canCreate($request))
511
        {
512
            return $response->withStatus(401);
513
        }
514
        $data = $this->getParsedBody($request);
515
        if(!isset($data['groupID']))
516
        {
517
            return $response->withStatus(400);
518
        }
519
        $groupID = $data['groupID'];
520
        $dataTable = $this->getDataTable();
521
        $filter = new \Data\Filter("groupID eq '$groupID'");
522
        $entity = $dataTable->read($filter);
523
        if(empty($entity))
524
        {
525
            return $response->withStatus(404);
526
        }
527
        $count = count($entity);
0 ignored issues
show
Bug introduced by
It seems like $entity can also be of type boolean; however, parameter $var of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

527
        $count = count(/** @scrutinizer ignore-type */ $entity);
Loading history...
528
        $res = true;
529
        for($i = 0; $i < $count; $i++)
530
        {
531
            $entity[$i]['signupLink'] = '';
532
            $upFilter = new \Data\Filter('_id eq '.$entity[$i]['_id']);
533
            $tmp = $dataTable->update($upFilter, $entity[$i]);
534
            if($tmp === false)
535
            {
536
                $res = false;
537
            }
538
        }
539
        return $response->withJSON($res);
540
    }
541
542
    function emptyShift($request, $response, $args)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
543
    {
544
        $this->validateLoggedIn($request);
545
        $shiftId = $args['shift'];
546
        $dataTable = $this->getDataTable();
547
        $filter = $this->getFilterForPrimaryKey($shiftId);
548
        $entity = $dataTable->read($filter);
549
        if(empty($entity))
550
        {
551
            return $response->withStatus(404);
552
        }
553
        $entity = $entity[0];
554
        if(!$this->canUpdate($request, $entity))
555
        {
556
            return $response->withStatus(401);
557
        }
558
        $shift = new \VolunteerShift(false, $entity);
559
        $entity['participant'] = '';
560
        $entity['status'] = 'unfilled';
561
        if(isset($entity['needEEApproval']))
562
        {
563
          unset($entity['needEEApproval']);
564
        }
565
        $ret = $dataTable->update($filter, $entity);
566
        if($ret)
567
        {
568
            $email = new \Emails\ShiftEmail($shift, 'shiftEmptiedSource');
569
            $this->sendEmail($email);
570
        }
571
        return $response->withJSON($ret);
572
    }
573
574
    function forceEmpty($request, $response, $args)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
575
    {
576
        $this->validateLoggedIn($request);
577
        $shiftId = $args['shift'];
578
        $dataTable = $this->getDataTable();
579
        $filter = $this->getFilterForPrimaryKey($shiftId);
580
        $entity = $dataTable->read($filter);
581
        if(empty($entity))
582
        {
583
            return $response->withStatus(404);
584
        }
585
        $entity = $entity[0];
586
        if(!$this->canUpdate($request, $entity))
587
        {
588
            return $response->withStatus(401);
589
        }
590
        $entity['participant'] = '';
591
        $entity['status'] = 'unfilled';
592
        if(isset($entity['needEEApproval']))
593
        {
594
          unset($entity['needEEApproval']);
595
        }
596
        return $response->withJSON($dataTable->update($filter, $entity));
597
    }
598
}
599
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
600