Skip to content

Commit

Permalink
Fix undefined property when editing stages/transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonge committed Feb 9, 2020
1 parent 0143e95 commit a5bca08
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion administrator/components/com_workflow/Model/StageModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ protected function canEditState($record)
{
$user = Factory::getUser();
$app = Factory::getApplication();
$extension = $app->getUserStateFromRequest('com_workflow.state.filter.extension', 'extension', null, 'cmd');
$context = $this->option . '.' . $this->name;
$extension = $app->getUserStateFromRequest($context . '.filter.extension', 'extension', null, 'cmd');

if (!\property_exists($record, 'workflow_id'))
{
$workflowID = $app->getUserStateFromRequest($context . '.filter.workflow_id', 'workflow_id', 0, 'int');
$record->workflow_id = $workflowID;
}

$table = $this->getTable('Workflow', 'Administrator');

Expand Down
11 changes: 9 additions & 2 deletions administrator/components/com_workflow/Model/TransitionModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ protected function canEditState($record)
{
$user = Factory::getUser();
$app = Factory::getApplication();
$extension = $app->getUserStateFromRequest('com_workflow.transition.filter.extension', 'extension', null, 'cmd');
$context = $this->option . '.' . $this->name;
$extension = $app->getUserStateFromRequest($context . '.filter.extension', 'extension', null, 'cmd');

if (!\property_exists($record, 'workflow_id'))
{
$workflowID = $app->getUserStateFromRequest($context . '.filter.workflow_id', 'workflow_id', 0, 'int');
$record->workflow_id = $workflowID;
}

$table = $this->getTable('Workflow', 'Administrator');

Expand Down Expand Up @@ -234,7 +241,7 @@ public function getForm($data = array(), $loadData = true)
$data = (object) $this->loadFormData();
}

if (!$this->canEditState($data))
if (!$this->canEditState((object) $data))
{
// Disable fields for display.
$form->setFieldAttribute('published', 'disabled', 'true');
Expand Down

0 comments on commit a5bca08

Please sign in to comment.