[4.0][Workflow] Add component specific workflow conditions#21585
[4.0][Workflow] Add component specific workflow conditions#21585wilsonge merged 19 commits intojoomla:4.0-devfrom
Conversation
|
|
||
| $query = $db->getQuery(true); | ||
|
|
||
| $query ->select($db->quoteName('condition')) |
|
OK can you fix conflicts here - then let's get this one tested |
ac1ea48 to
789aef1
Compare
|
@wilsonge rebase done, @bembelimen can you retest the pr? |
| $section = $parts[1]; | ||
| } | ||
|
|
||
| $join = $db->quoteName('#__content') . ' AS c ON ct.content_item_id=c.id'; |
There was a problem hiding this comment.
Use the quoteName second param here instead of hardcoding the AS
| * registering HTML services. | ||
| * | ||
| * @param ContainerInterface $container The container | ||
| * @param ContainerInterface $container The container |
There was a problem hiding this comment.
Code style is 3 spaces then TypeHint 2 spaces then variable name 2 spaces then description. You've broken it in every function of this file (hence the code style failure)
| elseif (!is_numeric($workflowStage)) | ||
| { | ||
| $query->where($db->quoteName('ws.condition') . ' IN (' . $query->quote(Workflow::PUBLISHED) . ',' . $query->quote(Workflow::UNPUBLISHED) . ')'); | ||
| $query->where($db->quoteName('ws.condition') . ' IN (' . |
There was a problem hiding this comment.
Use $query->whereIn function
| $query->where($db->quoteName('ws.condition') . ' = ' . $query->quote($condition)); | ||
| } | ||
| } | ||
| $query->where($db->quoteName('ws.condition') . ' = ' . (int) $condition); |
| <option value="">COM_WORKFLOW_SELECT_CONDITION</option> | ||
| </field> | ||
|
|
||
|
|
There was a problem hiding this comment.
remove the extra space here
| elseif (!is_numeric($workflowStage)) | ||
| { | ||
| $query->where($db->quoteName('ws.condition') . ' IN ("0","1")'); | ||
| $query->where($db->quoteName('ws.condition') . ' IN (' . |
There was a problem hiding this comment.
tabs here and use whereIn
libraries/src/Workflow/Workflow.php
Outdated
| ]; | ||
|
|
||
| /** | ||
| * @var oomla\Database\DatabaseDriver |
| elseif (!is_numeric($workflowStage)) | ||
| { | ||
| $query->where($db->quoteName('ws.condition') . ' IN (' . $query->quote(Workflow::PUBLISHED) . ',' . $query->quote(Workflow::UNPUBLISHED) . ')'); | ||
| $query->whereIn($db->quoteName('ws.condition'), [ |
There was a problem hiding this comment.
The parameters need to be on a new line. So
$query->whereIn(
$db->quoteName('ws.condition'),
[
and for the other 2 places
|
@wilsonge may could you describe it for an idiot? |
| name="condition" | ||
| type="list" | ||
| label="COM_CONTENT_STATES" | ||
| type="workflowcondition" |
There was a problem hiding this comment.
Reduce indentation by 1 from lines 24-28
| description="COM_WORKFLOW_CONDITION_DESC" | ||
| onchange="this.form.submit();" | ||
| extension="com_content" | ||
| > |
| elseif (!is_numeric($workflowStage)) | ||
| { | ||
| $query->whereIn($db->quoteName('ws.condition'), [ | ||
| $query->whereIn($db->quoteName('ws.condition'), |
There was a problem hiding this comment.
Nope :) Look at my example again :P
$query->whereIn(
$db->quoteName('ws.condition'),
[
| (2, 0, 2, 1, 1, 'Published', '', 1, 1), | ||
| (3, 0, 3, 1, 1, 'Trashed', '', -2, 0), | ||
| (4, 0, 4, 1, 1, 'Archived', '', 1, 0); | ||
| (4, 0, 4, 1, 1, 'Archived', '', 2, 0); |
There was a problem hiding this comment.
This needs to be done in the postgres files too
|
Now you can fix codestyle again :D |
|
YaY |
| ->from($db->quoteName('#__workflow_stages')) | ||
| ->where($db->quoteName('workflow_id') . ' IN(' . implode(',', $ids) . ')') | ||
| ->where($db->quoteName('published') . '>= 0') | ||
| ->group('workflow_id'); |
There was a problem hiding this comment.
please use $db->quoteName()
| ->from($db->quoteName('#__workflow_transitions')) | ||
| ->where($db->quoteName('workflow_id') . ' IN(' . implode(',', $ids) . ')') | ||
| ->where($db->quoteName('published') . '>= 0') | ||
| ->group('workflow_id'); |
There was a problem hiding this comment.
please use $db->quoteName()
|
|
||
| /** | ||
| * The extension where we're | ||
| * The component and section seperated by ".". |
There was a problem hiding this comment.
separated not seperated. twice
|
I have tested this item ✅ successfully on 887f57e This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21585. |
|
The module isn't part of this PR and should comeback when archive is restored. This PR is only the base that it is possible to do the archive behavior |
|
I have tested this item ✅ successfully on 887f57e This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21585. |
|
Ready to Commit after two successful tests. |


Pull Request for Issue # .
Summary of Changes
Introduce condition constants into com_content container used for the workflow. This provides the possibility to define conditions per component. This also reintroduce the archive condition in com_content.
Testing Instructions
Expected result
You should have a "archive" condition.
Additional
@alikon please check the db changes, you already did the enum change for postgresql