User tests: Successful: Unsuccessful:
Pull Request for Issue #21553 (comment)
Some more fixes in this renaming task.
Rename the Field WorkfileState to Workfilestage
Thank you for all hints and for testing.
Status | New | ⇒ | Pending |
Category | ⇒ | SQL Administration com_admin com_content com_workflow Libraries Modules Front End |
Labels |
Added:
?
|
Category | SQL Administration com_admin com_content com_workflow Libraries Modules Front End | ⇒ | Administration com_content com_workflow Libraries Modules Front End |
Labels |
Added:
?
|
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
JHtmlWorkflowStage is missing, file and class is in lib/cms/html/workflowstate.php
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))
This file should have been replaced already by workflowstage. I'll Repeating the changes. Thank you.
Category | Administration com_content com_workflow Libraries Modules Front End | ⇒ | SQL Administration com_admin com_content com_workflow Libraries Modules Front End |
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);
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.
administrator/components/com_content/Model/ArticleModel.php:827
->where($db->quoteName('wt.to_state_id') . ' = ' . $db->quoteName('ws.id'))
is wrong
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'))
Title |
|
You still can't save an article with this PR on :) - that's due to this one #21566 (comment) i think
Indeed
Call to undefined method stdClass::createAssociation()
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.
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);
I have tested this item
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-08-13 15:30:24 |
Closed_By | ⇒ | wilsonge |
Thanks for all the great collaboration here guys :) much appreciated!
I have tested this item
No errors found so far.
I have tested this item
No errors found so far.
complete failure for me with 500 error as soon as you save an article
do you have more debug information? for me this works perfectly :-(
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
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
.
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
.
There is a typo at
https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_workflow/Model/TransitionsModel.php#L143-L144
The semicolon show be in the second line