1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Symbiote\AdvancedWorkflow\Services; |
4
|
|
|
|
5
|
|
|
use Exception; |
6
|
|
|
use SilverStripe\Core\ClassInfo; |
7
|
|
|
use SilverStripe\ORM\ArrayList; |
8
|
|
|
use SilverStripe\ORM\DataList; |
9
|
|
|
use SilverStripe\ORM\DataObject; |
10
|
|
|
use SilverStripe\Security\Member; |
11
|
|
|
use SilverStripe\Security\Permission; |
12
|
|
|
use SilverStripe\Security\PermissionProvider; |
13
|
|
|
use Symbiote\AdvancedWorkflow\Admin\WorkflowDefinitionImporter; |
14
|
|
|
use Symbiote\AdvancedWorkflow\Extensions\FileWorkflowApplicable; |
15
|
|
|
use Symbiote\AdvancedWorkflow\Extensions\WorkflowApplicable; |
16
|
|
|
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowAction; |
17
|
|
|
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowDefinition; |
18
|
|
|
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowInstance; |
19
|
|
|
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowTransition; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* A central point for interacting with workflows |
23
|
|
|
* |
24
|
|
|
* @author [email protected] |
25
|
|
|
* @license BSD License (http://silverstripe.org/bsd-license/) |
26
|
|
|
* @package advancedworkflow |
27
|
|
|
*/ |
28
|
|
|
class WorkflowService implements PermissionProvider |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* An array of templates that we can create from |
32
|
|
|
* |
33
|
|
|
* @var array |
34
|
|
|
*/ |
35
|
|
|
protected $templates; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Set the list of templates that can be created |
39
|
|
|
* |
40
|
|
|
* @param array $templates |
41
|
|
|
*/ |
42
|
|
|
public function setTemplates($templates) |
43
|
|
|
{ |
44
|
|
|
$this->templates = $templates; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Return the list of available templates |
49
|
|
|
* @return array |
50
|
|
|
*/ |
51
|
|
|
public function getTemplates() |
52
|
|
|
{ |
53
|
|
|
return $this->templates; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Get a template by name |
58
|
|
|
* |
59
|
|
|
* @param string $name |
60
|
|
|
* @return WorkflowTemplate|null |
61
|
|
|
*/ |
62
|
|
|
public function getNamedTemplate($name) |
63
|
|
|
{ |
64
|
|
|
if ($importedTemplate = singleton(WorkflowDefinitionImporter::class)->getImportedWorkflows($name)) { |
65
|
|
|
return $importedTemplate; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
if (!is_array($this->templates)) { |
69
|
|
|
return; |
70
|
|
|
} |
71
|
|
|
foreach ($this->templates as $template) { |
72
|
|
|
if ($template->getName() == $name) { |
73
|
|
|
return $template; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Gets the workflow definition for a given dataobject, if there is one |
80
|
|
|
* |
81
|
|
|
* Will recursively query parent elements until it finds one, if available |
82
|
|
|
* |
83
|
|
|
* @param DataObject $dataObject |
84
|
|
|
*/ |
85
|
|
|
public function getDefinitionFor(DataObject $dataObject) |
86
|
|
|
{ |
87
|
|
|
if ($dataObject->hasExtension(WorkflowApplicable::class) || |
88
|
|
|
$dataObject->hasExtension(FileWorkflowApplicable::class) |
89
|
|
|
) { |
90
|
|
|
if ($dataObject->WorkflowDefinitionID) { |
91
|
|
|
return DataObject::get_by_id(WorkflowDefinition::class, $dataObject->WorkflowDefinitionID); |
92
|
|
|
} |
93
|
|
|
if ($dataObject->hasMethod('useInheritedWorkflow') && !$dataObject->useInheritedWorkflow()) { |
94
|
|
|
return null; |
95
|
|
|
} |
96
|
|
|
if ($dataObject->ParentID) { |
97
|
|
|
return $this->getDefinitionFor($dataObject->Parent()); |
98
|
|
|
} |
99
|
|
|
if ($dataObject->hasMethod('workflowParent')) { |
100
|
|
|
$obj = $dataObject->workflowParent(); |
101
|
|
|
if ($obj) { |
102
|
|
|
return $this->getDefinitionFor($obj); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
return null; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Retrieves a workflow definition by ID for a data object. |
111
|
|
|
* |
112
|
|
|
* @param DataObject $object |
113
|
|
|
* @param integer $workflowID |
114
|
|
|
* @return WorkflowDefinition|null |
115
|
|
|
*/ |
116
|
|
|
public function getDefinitionByID($object, $workflowID) |
117
|
|
|
{ |
118
|
|
|
// Make sure the correct extensions have been applied to the data object. |
119
|
|
|
|
120
|
|
|
$workflow = null; |
121
|
|
|
if ($object->hasExtension(WorkflowApplicable::class) || $object->hasExtension(FileWorkflowApplicable::class)) { |
122
|
|
|
// Validate the workflow ID against the data object. |
123
|
|
|
|
124
|
|
|
if (( |
125
|
|
|
$object->WorkflowDefinitionID == $workflowID) || |
126
|
|
|
($workflow = $object->AdditionalWorkflowDefinitions()->byID($workflowID)) |
127
|
|
|
) { |
128
|
|
|
if (is_null($workflow)) { |
129
|
|
|
$workflow = DataObject::get_by_id(WorkflowDefinition::class, $workflowID); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
return $workflow ? $workflow : null; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Retrieves and collates the workflow definitions for a data object, where the first element will be the main |
138
|
|
|
* workflow definition. |
139
|
|
|
* |
140
|
|
|
* @param DataObject object |
141
|
|
|
* @return array |
142
|
|
|
*/ |
143
|
|
|
|
144
|
|
|
public function getDefinitionsFor($object) |
145
|
|
|
{ |
146
|
|
|
|
147
|
|
|
// Retrieve the main workflow definition. |
148
|
|
|
|
149
|
|
|
$default = $this->getDefinitionFor($object); |
150
|
|
|
if ($default) { |
151
|
|
|
// Merge the additional workflow definitions. |
152
|
|
|
|
153
|
|
|
return array_merge(array( |
154
|
|
|
$default |
155
|
|
|
), $object->AdditionalWorkflowDefinitions()->toArray()); |
156
|
|
|
} |
157
|
|
|
return null; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Gets the workflow for the given item |
162
|
|
|
* |
163
|
|
|
* The item can be |
164
|
|
|
* |
165
|
|
|
* a data object in which case the ActiveWorkflow will be returned, |
166
|
|
|
* an action, in which case the Workflow will be returned |
167
|
|
|
* an integer, in which case the workflow with that ID will be returned |
168
|
|
|
* |
169
|
|
|
* @param mixed $item |
170
|
|
|
* @param bool $includeComplete |
171
|
|
|
* @return WorkflowInstance|null |
172
|
|
|
*/ |
173
|
|
|
public function getWorkflowFor($item, $includeComplete = false) |
174
|
|
|
{ |
175
|
|
|
$id = $item; |
|
|
|
|
176
|
|
|
|
177
|
|
|
if ($item instanceof WorkflowAction) { |
178
|
|
|
$id = $item->WorkflowID; |
|
|
|
|
179
|
|
|
return DataObject::get_by_id(WorkflowInstance::class, $id); |
180
|
|
|
} elseif (is_object($item) && ($item->hasExtension(WorkflowApplicable::class) || |
181
|
|
|
$item->hasExtension(FileWorkflowApplicable::class))) { |
182
|
|
|
$filter = sprintf('"TargetClass" = \'%s\' AND "TargetID" = %d', ClassInfo::baseDataClass($item), $item->ID); |
|
|
|
|
183
|
|
|
$complete = $includeComplete ? 'OR "WorkflowStatus" = \'Complete\' ' : ''; |
184
|
|
|
return DataObject::get_one( |
185
|
|
|
WorkflowInstance::class, |
186
|
|
|
$filter . ' AND ("WorkflowStatus" = \'Active\' OR "WorkflowStatus"=\'Paused\' ' . $complete . ')' |
187
|
|
|
); |
188
|
|
|
} |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Get all the workflow action instances for an item |
193
|
|
|
* |
194
|
|
|
* @return DataList|null |
195
|
|
|
*/ |
196
|
|
|
public function getWorkflowHistoryFor($item, $limit = null) |
197
|
|
|
{ |
198
|
|
|
if ($active = $this->getWorkflowFor($item, true)) { |
199
|
|
|
$limit = $limit ? "0,$limit" : ''; |
200
|
|
|
return $active->Actions('', 'ID DESC ', null, $limit); |
|
|
|
|
201
|
|
|
} |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* Get all the available workflow definitions |
206
|
|
|
* |
207
|
|
|
* @return DataList |
208
|
|
|
*/ |
209
|
|
|
public function getDefinitions() |
210
|
|
|
{ |
211
|
|
|
return DataList::create(WorkflowDefinition::class); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Given a transition ID, figure out what should happen to |
216
|
|
|
* the given $subject. |
217
|
|
|
* |
218
|
|
|
* In the normal case, this will load the current workflow instance for the object |
219
|
|
|
* and then transition as expected. However, in some cases (eg to start the workflow) |
220
|
|
|
* it is necessary to instead create a new instance. |
221
|
|
|
* |
222
|
|
|
* @param DataObject $target |
223
|
|
|
* @param int $transitionId |
224
|
|
|
* @throws Exception |
225
|
|
|
*/ |
226
|
|
|
public function executeTransition(DataObject $target, $transitionId) |
227
|
|
|
{ |
228
|
|
|
$workflow = $this->getWorkflowFor($target); |
229
|
|
|
$transition = DataObject::get_by_id(WorkflowTransition::class, $transitionId); |
230
|
|
|
|
231
|
|
|
if (!$transition) { |
232
|
|
|
throw new Exception(_t('WorkflowService.INVALID_TRANSITION_ID', "Invalid transition ID $transitionId")); |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
if (!$workflow) { |
236
|
|
|
throw new Exception(_t( |
237
|
|
|
'WorkflowService.INVALID_WORKFLOW_TARGET', |
238
|
|
|
"A transition was executed on a target that does not have a workflow." |
239
|
|
|
)); |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
if ($transition->Action()->WorkflowDefID != $workflow->DefinitionID) { |
|
|
|
|
243
|
|
|
throw new Exception(_t( |
244
|
|
|
'WorkflowService.INVALID_TRANSITION_WORKFLOW', |
245
|
|
|
"Transition #$transition->ID is not attached to workflow #$workflow->ID." |
246
|
|
|
)); |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
$workflow->performTransition($transition); |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* Starts the workflow for the given data object, assuming it or a parent has |
254
|
|
|
* a definition specified. |
255
|
|
|
* |
256
|
|
|
* @param DataObject $object |
257
|
|
|
* @param int $workflowID |
258
|
|
|
*/ |
259
|
|
|
public function startWorkflow(DataObject $object, $workflowID = null) |
260
|
|
|
{ |
261
|
|
|
$existing = $this->getWorkflowFor($object); |
262
|
|
|
if ($existing) { |
263
|
|
|
throw new ExistingWorkflowException(_t( |
264
|
|
|
'WorkflowService.EXISTING_WORKFLOW_ERROR', |
265
|
|
|
"That object already has a workflow running" |
266
|
|
|
)); |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
$definition = null; |
270
|
|
|
if ($workflowID) { |
|
|
|
|
271
|
|
|
// Retrieve the workflow definition that has been triggered. |
272
|
|
|
|
273
|
|
|
$definition = $this->getDefinitionByID($object, $workflowID); |
274
|
|
|
} |
275
|
|
|
if (is_null($definition)) { |
276
|
|
|
// Fall back to the main workflow definition. |
277
|
|
|
|
278
|
|
|
$definition = $this->getDefinitionFor($object); |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
if ($definition) { |
282
|
|
|
$instance = new WorkflowInstance(); |
283
|
|
|
$instance->beginWorkflow($definition, $object); |
284
|
|
|
$instance->execute(); |
285
|
|
|
} |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* Get all the workflows that this user is responsible for |
290
|
|
|
* |
291
|
|
|
* @param Member $user The user to get workflows for |
292
|
|
|
* @return ArrayList The list of workflow instances this user owns |
293
|
|
|
*/ |
294
|
|
|
public function usersWorkflows(Member $user) |
295
|
|
|
{ |
296
|
|
|
|
297
|
|
|
$groupIds = $user->Groups()->column('ID'); |
298
|
|
|
|
299
|
|
|
$groupInstances = null; |
300
|
|
|
|
301
|
|
|
$filter = array(''); |
|
|
|
|
302
|
|
|
|
303
|
|
|
if (is_array($groupIds)) { |
304
|
|
|
$groupInstances = DataList::create(WorkflowInstance::class) |
305
|
|
|
->filter(array('Group.ID:ExactMatchMulti' => $groupIds)) |
306
|
|
|
->where('"WorkflowStatus" != \'Complete\''); |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
$userInstances = DataList::create(WorkflowInstance::class) |
310
|
|
|
->filter(array('Users.ID:ExactMatch' => $user->ID)) |
311
|
|
|
->where('"WorkflowStatus" != \'Complete\''); |
312
|
|
|
|
313
|
|
|
if ($userInstances) { |
314
|
|
|
$userInstances = $userInstances->toArray(); |
315
|
|
|
} else { |
316
|
|
|
$userInstances = array(); |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
if ($groupInstances) { |
320
|
|
|
$groupInstances = $groupInstances->toArray(); |
321
|
|
|
} else { |
322
|
|
|
$groupInstances = array(); |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
$all = array_merge($groupInstances, $userInstances); |
326
|
|
|
|
327
|
|
|
return ArrayList::create($all); |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* Get items that the passed-in user has awaiting for them to action |
332
|
|
|
* |
333
|
|
|
* @param Member $member |
|
|
|
|
334
|
|
|
* @return DataList |
335
|
|
|
*/ |
336
|
|
|
public function userPendingItems(Member $user) |
337
|
|
|
{ |
338
|
|
|
// Don't restrict anything for ADMIN users |
339
|
|
|
$userInstances = DataList::create(WorkflowInstance::class) |
340
|
|
|
->where('"WorkflowStatus" != \'Complete\'') |
341
|
|
|
->sort('LastEdited DESC'); |
342
|
|
|
|
343
|
|
|
if (Permission::checkMember($user, 'ADMIN')) { |
344
|
|
|
return $userInstances; |
345
|
|
|
} |
346
|
|
|
$instances = new ArrayList(); |
347
|
|
|
foreach ($userInstances as $inst) { |
348
|
|
|
$instToArray = $inst->getAssignedMembers(); |
349
|
|
|
if (!count($instToArray) > 0 || !in_array($user->ID, $instToArray->column())) { |
350
|
|
|
continue; |
351
|
|
|
} |
352
|
|
|
$instances->push($inst); |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
return $instances; |
|
|
|
|
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* Get items that the passed-in user has submitted for workflow review |
360
|
|
|
* |
361
|
|
|
* @param Member $member |
|
|
|
|
362
|
|
|
* @return DataList |
363
|
|
|
*/ |
364
|
|
|
public function userSubmittedItems(Member $user) |
365
|
|
|
{ |
366
|
|
|
$userInstances = DataList::create(WorkflowInstance::class) |
367
|
|
|
->where('"WorkflowStatus" != \'Complete\'') |
368
|
|
|
->sort('LastEdited DESC'); |
369
|
|
|
|
370
|
|
|
// Restrict the user if they're not an ADMIN. |
371
|
|
|
if (!Permission::checkMember($user, 'ADMIN')) { |
372
|
|
|
$userInstances = $userInstances->filter('InitiatorID:ExactMatch', $user->ID); |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
return $userInstances; |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* Generate a workflow definition based on a template |
380
|
|
|
* |
381
|
|
|
* @param WorkflowDefinition $definition |
382
|
|
|
* @param string $templateName |
383
|
|
|
* @return WorkflowDefinition|null |
384
|
|
|
*/ |
385
|
|
|
public function defineFromTemplate(WorkflowDefinition $definition, $templateName) |
386
|
|
|
{ |
387
|
|
|
$template = null; |
|
|
|
|
388
|
|
|
/* @var $template WorkflowTemplate */ |
389
|
|
|
|
390
|
|
|
if (!is_array($this->templates)) { |
391
|
|
|
return; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
$template = $this->getNamedTemplate($templateName); |
395
|
|
|
|
396
|
|
|
if (!$template) { |
397
|
|
|
return; |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
$template->createRelations($definition); |
401
|
|
|
|
402
|
|
|
// Set the version and do the write at the end so that we don't trigger an infinite loop!! |
403
|
|
|
if (!$definition->Description) { |
|
|
|
|
404
|
|
|
$definition->Description = $template->getDescription(); |
|
|
|
|
405
|
|
|
} |
406
|
|
|
$definition->TemplateVersion = $template->getVersion(); |
|
|
|
|
407
|
|
|
$definition->RemindDays = $template->getRemindDays(); |
|
|
|
|
408
|
|
|
$definition->Sort = $template->getSort(); |
|
|
|
|
409
|
|
|
$definition->write(); |
410
|
|
|
return $definition; |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
/** |
414
|
|
|
* Reorders actions within a definition |
415
|
|
|
* |
416
|
|
|
* @param WorkflowDefinition|WorkflowAction $objects The objects to be reordered |
417
|
|
|
* @param array $newOrder An array of IDs of the actions in the order they should be. |
418
|
|
|
*/ |
419
|
|
|
public function reorder($objects, $newOrder) |
420
|
|
|
{ |
421
|
|
|
$sortVals = array_values($objects->map('ID', 'Sort')->toArray()); |
422
|
|
|
sort($sortVals); |
423
|
|
|
|
424
|
|
|
// save the new ID values - but only use existing sort values to prevent |
425
|
|
|
// conflicts with items not in the table |
426
|
|
|
foreach ($newOrder as $key => $id) { |
427
|
|
|
if (!$id) { |
428
|
|
|
continue; |
429
|
|
|
} |
430
|
|
|
$object = $objects->find('ID', $id); |
431
|
|
|
$object->Sort = $sortVals[$key]; |
432
|
|
|
$object->write(); |
433
|
|
|
} |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
/** |
437
|
|
|
* |
438
|
|
|
* @return array |
439
|
|
|
*/ |
440
|
|
|
public function providePermissions() |
441
|
|
|
{ |
442
|
|
|
return array( |
443
|
|
|
'CREATE_WORKFLOW' => array( |
444
|
|
|
'name' => _t('AdvancedWorkflow.CREATE_WORKFLOW', 'Create workflow'), |
445
|
|
|
'category' => _t('AdvancedWorkflow.ADVANCED_WORKFLOW', 'Advanced Workflow'), |
446
|
|
|
'help' => _t('AdvancedWorkflow.CREATE_WORKFLOW_HELP', 'Users can create workflow definitions'), |
447
|
|
|
'sort' => 0 |
448
|
|
|
), |
449
|
|
|
'DELETE_WORKFLOW' => array( |
450
|
|
|
'name' => _t('AdvancedWorkflow.DELETE_WORKFLOW', 'Delete workflow'), |
451
|
|
|
'category' => _t('AdvancedWorkflow.ADVANCED_WORKFLOW', 'Advanced Workflow'), |
452
|
|
|
'help' => _t( |
453
|
|
|
'AdvancedWorkflow.DELETE_WORKFLOW_HELP', |
454
|
|
|
'Users can delete workflow definitions and active workflows' |
455
|
|
|
), |
456
|
|
|
'sort' => 1 |
457
|
|
|
), |
458
|
|
|
'APPLY_WORKFLOW' => array( |
459
|
|
|
'name' => _t('AdvancedWorkflow.APPLY_WORKFLOW', 'Apply workflow'), |
460
|
|
|
'category' => _t('AdvancedWorkflow.ADVANCED_WORKFLOW', 'Advanced Workflow'), |
461
|
|
|
'help' => _t('AdvancedWorkflow.APPLY_WORKFLOW_HELP', 'Users can apply workflows to items'), |
462
|
|
|
'sort' => 2 |
463
|
|
|
), |
464
|
|
|
'VIEW_ACTIVE_WORKFLOWS' => array( |
465
|
|
|
'name' => _t('AdvancedWorkflow.VIEWACTIVE', 'View active workflows'), |
466
|
|
|
'category' => _t('AdvancedWorkflow.ADVANCED_WORKFLOW', 'Advanced Workflow'), |
467
|
|
|
'help' => _t( |
468
|
|
|
'AdvancedWorkflow.VIEWACTIVEHELP', |
469
|
|
|
'Users can view active workflows via the workflows admin panel' |
470
|
|
|
), |
471
|
|
|
'sort' => 3 |
472
|
|
|
), |
473
|
|
|
'REASSIGN_ACTIVE_WORKFLOWS' => array( |
474
|
|
|
'name' => _t('AdvancedWorkflow.REASSIGNACTIVE', 'Reassign active workflows'), |
475
|
|
|
'category' => _t('AdvancedWorkflow.ADVANCED_WORKFLOW', 'Advanced Workflow'), |
476
|
|
|
'help' => _t( |
477
|
|
|
'AdvancedWorkflow.REASSIGNACTIVEHELP', |
478
|
|
|
'Users can reassign active workflows to different users and groups' |
479
|
|
|
), |
480
|
|
|
'sort' => 4 |
481
|
|
|
), |
482
|
|
|
'EDIT_EMBARGOED_WORKFLOW' => array( |
483
|
|
|
'name' => _t('AdvancedWorkflow.EDITEMBARGO', 'Editable embargoed item in workflow'), |
484
|
|
|
'category' => _t('AdvancedWorkflow.ADVANCED_WORKFLOW', 'Advanced Workflow'), |
485
|
|
|
'help' => _t( |
486
|
|
|
'AdvancedWorkflow.EDITEMBARGOHELP', |
487
|
|
|
'Allow users to edit items that have been embargoed by a workflow' |
488
|
|
|
), |
489
|
|
|
'sort' => 5 |
490
|
|
|
), |
491
|
|
|
); |
492
|
|
|
} |
493
|
|
|
} |
494
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.