Skip to content

Commit

Permalink
Fix nested positive ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmayer committed Oct 2, 2016
1 parent 97a4c6d commit e563437
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
13 changes: 5 additions & 8 deletions administrator/components/com_finder/models/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,13 @@ public function publish(&$pks, $value = 1)
{
$table->reset();

if ($table->load($pk))
if ($table->load($pk) && !$this->canEditState($table))
{
if (!$this->canEditState($table))
{
// Prune items that you can't change.
unset($pks[$i]);
$this->setError(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
// Prune items that you can't change.
unset($pks[$i]);
$this->setError(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));

return false;
}
return false;
}
}

Expand Down
5 changes: 1 addition & 4 deletions administrator/components/com_finder/models/maps.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,13 @@ public function publish(&$pks, $value = 1)
{
$table->reset();

if ($table->load($pk))
if ($table->load($pk) && !$this->canEditState($table))
{
if (!$this->canEditState($table))
{
// Prune items that you can't change.
unset($pks[$i]);
$this->setError(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));

return false;
}
}
}

Expand Down
19 changes: 8 additions & 11 deletions administrator/components/com_finder/views/filter/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,16 @@ protected function addToolbar()
else
{
// Can't save the record if it's checked out.
if (!$checkedOut)
// Since it's an existing record, check the edit permission.
if (!$checkedOut && $canDo->get('core.edit'))
{
// Since it's an existing record, check the edit permission.
if ($canDo->get('core.edit'))
JToolbarHelper::apply('filter.apply');
JToolbarHelper::save('filter.save');

// We can save this record, but check the create permission to see if we can return to make a new one.
if ($canDo->get('core.create'))
{
JToolbarHelper::apply('filter.apply');
JToolbarHelper::save('filter.save');

// We can save this record, but check the create permission to see if we can return to make a new one.
if ($canDo->get('core.create'))
{
JToolbarHelper::save2new('filter.save2new');
}
JToolbarHelper::save2new('filter.save2new');
}
}

Expand Down

0 comments on commit e563437

Please sign in to comment.