? ? Pending

User tests: Successful: Unsuccessful:

avatar chmst
chmst
12 Aug 2018

Pull Request for Issue #21553 (comment)

Summary of Changes

Some more fixes in this renaming task.
Rename the Field WorkfileState to Workfilestage

Thank you for all hints and for testing.

avatar chmst chmst - open - 12 Aug 2018
avatar chmst chmst - change - 12 Aug 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Aug 2018
Category SQL Administration com_admin com_content com_workflow Libraries Modules Front End
avatar rdeutz rdeutz - change - 12 Aug 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 12 Aug 2018
Category SQL Administration com_admin com_content com_workflow Libraries Modules Front End Administration com_content com_workflow Libraries Modules Front End
avatar HLeithner
HLeithner - comment - 12 Aug 2018
avatar HLeithner
HLeithner - comment - 12 Aug 2018

Also there seams to be missing string translations/renamings in transition
image

avatar chmst chmst - change - 12 Aug 2018
Labels Added: ?
e1cc511 12 Aug 2018 avatar chmst oops
avatar HLeithner
HLeithner - comment - 12 Aug 2018

In the SQL update script you changed the last line

SELECT `id`, CASE WHEN `stage` = -2 THEN 3 WHEN `stage` = 0 THEN 1 WHEN `stage` = 2 THEN 4 ELSE 2 END, 'com_content' FROM `#__content`;

The stage column here references the state column in #__content so it have to stay state

avatar HLeithner
HLeithner - comment - 12 Aug 2018

JHtmlWorkflowStage is missing, file and class is in lib/cms/html/workflowstate.php

avatar HLeithner
HLeithner - comment - 12 Aug 2018

oh lib/cms/html/workflowstate.php only got converted partly.

In line 62 wrong name

		$workflowStates = array();

in line 70 the first variable is wrong

			if (!array_key_exists($workflowStateKey, $workflowStages))
avatar chmst
chmst - comment - 12 Aug 2018

This file should have been replaced already by workflowstage. I'll Repeating the changes. Thank you.

avatar joomla-cms-bot joomla-cms-bot - change - 12 Aug 2018
Category Administration com_content com_workflow Libraries Modules Front End SQL Administration com_admin com_content com_workflow Libraries Modules Front End
avatar HLeithner
HLeithner - comment - 12 Aug 2018

libraries/src/Form/Field/TransitionField.php

workflow_state is wrong, also in the query some lines later

$workflowState = $this->element['workflow_state'] ? (int) $this->element['workflow_state'] : (int) $jinput->getInt('id', 0);
avatar HLeithner
HLeithner - comment - 12 Aug 2018

administrator/components/com_content/Model/ArticleModel.php line 545 is crying Notice: Undefined property: stdClass::$state_id

also it sets 'workflow_state' not sure if this is correct but I don't think so.

avatar HLeithner
HLeithner - comment - 12 Aug 2018

administrator/components/com_content/Model/ArticleModel.php:827

					->where($db->quoteName('wt.to_state_id') . ' = ' . $db->quoteName('ws.id'))

is wrong

avatar HLeithner
HLeithner - comment - 12 Aug 2018

administrator/components/com_content/Model/ArticleModel.php:913

					$stateId = (int) $workflow->state_id;

some lines later:

			// If we have a new state, create the workflow association
			if (!empty($stateId))
			{
				$workflow->createAssociation($this->getState($this->getName() . '.id'), (int) $stateId);
			}

administrator/components/com_content/Model/ArticleModel.php:1222

					->select($db->quoteName('ws.id', 'state_id'))
avatar Quy Quy - change - 12 Aug 2018
Title
State to stage fixes
[4.0] State to stage fixes
avatar joomla-cms-bot joomla-cms-bot - edited - 12 Aug 2018
avatar wilsonge
wilsonge - comment - 13 Aug 2018

You still can't save an article with this PR on :) - that's due to this one #21566 (comment) i think

avatar infograf768
infograf768 - comment - 13 Aug 2018

Indeed
Call to undefined method stdClass::createAssociation()

avatar infograf768
infograf768 - comment - 13 Aug 2018

Checked: remain many occurences of $workflowState instead of $workflowStage, including the name of the file
/libraries/cms/html/workflowstate.php instead of workflowstage.php

EDIT: for the name of the file, it looks it is done in the PR. (Eclipse can't move files when applying patches.)

Also $stateId instead of $stageId

After correcting these I can save articles here.

avatar infograf768
infograf768 - comment - 13 Aug 2018

This may help correcting $workflowState

/administrator/components/com_content/Model/ArticlesModel.php:322: 		$workflowState = (string) $this->getState('filter.state');
/administrator/components/com_content/Model/ArticlesModel.php:324: 		if (is_numeric($workflowState))
/administrator/components/com_content/Model/ArticlesModel.php:326: 			$query->where('wa.stage_id = ' . (int) $workflowState);
/administrator/components/com_content/Model/ArticlesModel.php:341: 		elseif (!is_numeric($workflowState))
/administrator/components/com_content/Model/FeaturedModel.php:160: 		$workflowState = (string) $this->getState('filter.state');
/administrator/components/com_content/Model/FeaturedModel.php:162: 		if (is_numeric($workflowState))
/administrator/components/com_content/Model/FeaturedModel.php:164: 			$query->where('wa.stage_id = ' . (int) $workflowState);
/administrator/components/com_content/Model/FeaturedModel.php:173: 		elseif (!is_numeric($workflowState))

and for $stateId

/administrator/components/com_content/Model/ArticleModel.php:891: 			if (empty($stateId))
/administrator/components/com_content/Model/ArticleModel.php:924: 				$workflow->createAssociation($this->getState($this->getName() . '.id'), (int) $stateId);
avatar infograf768
infograf768 - comment - 13 Aug 2018

Are Default transitions supposed to be this?
screen shot 2018-08-13 at 17 16 47

If yes, this PR is fine for me (have not tested all possibilities, but no major error.)

avatar infograf768 infograf768 - test_item - 13 Aug 2018 - Tested successfully
avatar infograf768
infograf768 - comment - 13 Aug 2018

I have tested this item successfully on 9d4458c


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

avatar wilsonge wilsonge - change - 13 Aug 2018
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-08-13 15:30:24
Closed_By wilsonge
avatar wilsonge wilsonge - close - 13 Aug 2018
avatar wilsonge wilsonge - merge - 13 Aug 2018
avatar wilsonge
wilsonge - comment - 13 Aug 2018

Thanks for all the great collaboration here guys :) much appreciated!

avatar HLeithner HLeithner - test_item - 13 Aug 2018 - Tested successfully
avatar HLeithner
HLeithner - comment - 13 Aug 2018

I have tested this item successfully on 9d4458c

No errors found so far.


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

avatar HLeithner
HLeithner - comment - 13 Aug 2018

I have tested this item successfully on 9d4458c

No errors found so far.


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

avatar brianteeman
brianteeman - comment - 13 Aug 2018

complete failure for me with 500 error as soon as you save an article

avatar HLeithner
HLeithner - comment - 13 Aug 2018

do you have more debug information? for me this works perfectly :-(

avatar brianteeman
brianteeman - comment - 13 Aug 2018

As soon as you create an article you get this everytime you try to go to
administrator/index.php?option=com_content

Error 500: JHtml workflowstage not found.


# | Function | Location
-- | -- | --
1 | () | JROOT\libraries\src\HTML\HTMLHelper.php:164
2 | Joomla\CMS\HTML\HTMLHelper::_() | JROOT\layouts\joomla\html\batch\workflowstage.php:31
3 | include() | JROOT\libraries\src\Layout\FileLayout.php:127
4 | Joomla\CMS\Layout\FileLayout->render() | JROOT\libraries\src\Layout\LayoutHelper.php:73
5 | Joomla\CMS\Layout\LayoutHelper::render() | JROOT\administrator\components\com_content\tmpl\articles\default_batch_body.php:49
6 | include() | JROOT\libraries\src\MVC\View\HtmlView.php:386
7 | Joomla\CMS\MVC\View\HtmlView->loadTemplate() | JROOT\administrator\components\com_content\tmpl\articles\default.php:338
8 | include() | JROOT\libraries\src\MVC\View\HtmlView.php:386
9 | Joomla\CMS\MVC\View\HtmlView->loadTemplate() | JROOT\libraries\src\MVC\View\HtmlView.php:191
10 | Joomla\CMS\MVC\View\HtmlView->display() | JROOT\administrator\components\com_content\View\Articles\HtmlView.php:149
11 | Joomla\Component\Content\Administrator\View\Articles\HtmlView->display() | JROOT\libraries\src\MVC\Controller\BaseController.php:679
12 | Joomla\CMS\MVC\Controller\BaseController->display() | JROOT\administrator\components\com_content\Controller\DisplayController.php:59
13 | Joomla\Component\Content\Administrator\Controller\DisplayController->display() | JROOT\libraries\src\MVC\Controller\BaseController.php:717
14 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT\libraries\src\Dispatcher\Dispatcher.php:162
15 | Joomla\CMS\Dispatcher\Dispatcher->dispatch() | JROOT\libraries\src\Component\ComponentHelper.php:354
16 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT\libraries\src\Application\AdministratorApplication.php:111
17 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT\libraries\src\Application\AdministratorApplication.php:154
18 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT\libraries\src\Application\CMSApplication.php:242
19 | Joomla\CMS\Application\CMSApplication->execute() | JROOT\administrator\includes\app.php:63
20 | require_once() | JROOT\administrator\index.php:36


avatar mbabker
mbabker - comment - 13 Aug 2018

https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/cms/html/workflowstage.php

This is environmentally broken.

Because this uses the Joomla autoloader, which is based on camel casing of class names, the class name MUST be JHtmlWorkflowstage otherwise it will NOT work consistently across environments.

OR, to keep the class casing the way it is, you must place the file at libraries/cms/html/workflow/stage.php.

avatar HLeithner
HLeithner - comment - 13 Aug 2018

@mbabker but this doesn't seams to be the problem because the file called JHtml key is 'workflowstage.existing' and the file is also lowercase only the class is SnakeCase so whats the reason it works for me and not for brian?

avatar mbabker
mbabker - comment - 13 Aug 2018

And when (both of) you step through all the autoloaders and whatnot what path and class name are trying to be resolved? This is PHP here, it is very well possible for the right file to be loaded in but the class still be considered missing (which is basically what this error is) because the JHtml library is expecting to find JHtmlWorkflowstage and the class is declared JHtmlWorkflowStage.

avatar HLeithner
HLeithner - comment - 13 Aug 2018

So this should be fixed by this #21597 PR.

Add a Comment

Login with GitHub to post a comment