? ? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
28 Mar 2017

Pull Request for Issue #14951 .

Summary of Changes

remove notice Undefined variable: ntext

Testing Instructions

Create a menu with a menu item.
Disable this menu.
Try to enable the menu item under this menu.

Expected result

no notice

Actual result

PHP Notice: Undefined variable: ntext in \administrator\components\com_menus\controllers\items.php on line 248

avatar alikon alikon - open - 28 Mar 2017
avatar alikon alikon - change - 28 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Mar 2017
Category Administration com_menus
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Mar 2017

Without PR there is an "Error"-Message, with PR there is a Message too:
bildschirmfoto 2017-03-28 um 08 06 32

avatar alikon alikon - change - 28 Mar 2017
Labels Added: ?
avatar alikon
alikon - comment - 28 Mar 2017

you are 2 fast 4 me ?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Mar 2017

Set Error reporting to Maximum but don't get a PHP-Notice, only "Error"-Message is shown.

avatar infograf768 infograf768 - test_item - 28 Mar 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 28 Mar 2017

I have tested this item successfully on 5055daa

@franz-wohlkoenig

after patching no more Notice in php logs.

We only get the Error message as should.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14955.

avatar infograf768
infograf768 - comment - 28 Mar 2017

@alikon
NOTE: I remarked something else that may be worth looking into. Unrelated to this PR.
Test:
Create a parent menu item and a few children.
Whether you publish or unpublish the parent, the Message states only 1 menu item is published/unpublished, although all children are also concerned and change status.

avatar alikon
alikon - comment - 28 Mar 2017

yes is unrelated to this pr, but @infograf768 you can look at #13242

avatar joomdonation
joomdonation - comment - 28 Mar 2017

Personal, I think we can simplify the code of the PR a bit:

try
{
	$model->publish($cid, $value);
	$errors      = $model->getErrors();
	$messageType = 'message';

	if ($value == 1)
	{
		if ($errors)
		{
			$messageType = 'error';
			$ntext       = $this->text_prefix . '_N_ITEMS_FAILED_PUBLISHING';
		}
		else
		{
			$ntext = $this->text_prefix . '_N_ITEMS_PUBLISHED';
		}
	}
	elseif ($value == 0)
	{
		$ntext = $this->text_prefix . '_N_ITEMS_UNPUBLISHED';
	}
	else
	{
		$ntext = $this->text_prefix . '_N_ITEMS_TRASHED';
	}

	$this->setMessage(JText::plural($ntext, count($cid)), $messageType);
}
catch (Exception $e)
{
	$this->setMessage($e->getMessage(), 'error');
}

Compare to the propose code;

  1. It doesn't have to call app->enqueueMessage to queue the message

  2. Doesn't have to call $this->setMessage, JText::plural on each part in if else if. I think the code is easier to read

It requires an extra variable to store $messageType, thought.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Mar 2017

@infograf768 thanks for Info.

avatar joomdonation joomdonation - test_item - 29 Mar 2017 - Tested successfully
avatar joomdonation
joomdonation - comment - 29 Mar 2017

I have tested this item successfully on e54c695


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14955.

avatar joomdonation
joomdonation - comment - 29 Mar 2017

@alikon Thanks for making the changes

@infograf768 Please re-test

avatar infograf768 infograf768 - test_item - 29 Mar 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 29 Mar 2017

I have tested this item successfully on e54c695


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14955.

avatar infograf768 infograf768 - change - 29 Mar 2017
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 29 Mar 2017

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14955.

avatar alikon
alikon - comment - 29 Mar 2017

@joomdonation i really like when we can simplify stuff
?

avatar rdeutz rdeutz - close - 30 Mar 2017
avatar rdeutz rdeutz - merge - 30 Mar 2017
avatar rdeutz rdeutz - change - 30 Mar 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-03-30 21:40:58
Closed_By rdeutz
Labels Added: ?
avatar steinsson
steinsson - comment - 26 Apr 2017

This still seems to be a problem after the official 3.7 release, at least in some cases. One of my grammar-school websites is facing this problem (http://grandaskoli.is). Any idea what couses this? Could an addon be interfearing in any way?

granda_error

avatar rdeutz
rdeutz - comment - 26 Apr 2017

You should open an issue if you think it is an error, but getting the message is not a problem when the error condition is met.

avatar zero-24
zero-24 - comment - 26 Apr 2017

Please open a new issue with the exact steps to reproduce this. Your error looks not realted to this PR.

Add a Comment

Login with GitHub to post a comment