Skip to content

Changes in Controller & Model files (messages & default state functionality)#13

Closed
priiish wants to merge 9 commits intobembelimen:publishing-workflowfrom
priiish:publishing-workflow-state-management
Closed

Changes in Controller & Model files (messages & default state functionality)#13
priiish wants to merge 9 commits intobembelimen:publishing-workflowfrom
priiish:publishing-workflow-state-management

Conversation

@priiish
Copy link
Copy Markdown

@priiish priiish commented Jul 26, 2018

Pull Request for Issue # .

Summary of Changes

Issue1:
While managing states and trying to delete a state that is set to default the user received an error message saying "Item must be published to set default state." (COM_WORKFLOW_ITEM_MUST_PUBLISHED) whereas it should be "You are trying to delete the default item." (COM_WORKFLOW_MSG_DELETE_DEFAULT).
=> StateModel.php JText

Furthermore the user received a confirmation message even if 0 items were deleted. Changed condition of last if statement in function publish(). Now a confirmation message is only sent if the number of deleted items is greater than 0.
=> AdminController.php

Issue2:
It was not possible to change the default status of the states via the star icon. Fixed this issue.
=> StateModel.php

Testing Instructions

-> Go to Content / Workflows / Workflows / Manage

  • Try to delete a default state and take a look at the (error) message concerning the process and the number of deleted items.
  • Try to change the default status of a state via the star icon (must be published).

Expected result

Appropriate (error) messages and functionality of the default option (star icon).

Actual result

Works as expected.

Documentation Changes Required

None.

priiish added 2 commits July 26, 2018 10:57
…g error was thrown. When trying to delete default state, user received message "Item must be published to set default state" whereas it must be "You are trying to delete the default item.".

StateModel.php: changed condition in first if statement in function setDefault().

AdminController.php: commented out else case due to it being unnecessary in the function publish().
…tion in last if statement. Now confirmation message is only sent in case of "real" deletion (>= 0).
@priiish priiish changed the title WIP: Changes in Controller & Model files Changes in Controller & Model files (messages & default state functionality) Jul 26, 2018
priiish added 4 commits July 26, 2018 11:49
…se otherwise the default selection via the star icon wont work #no mistake
either trashed oder unpublished and must be published first (before
default can be set).
}

if ($ntext !== null)
if (count($cid) != 0)
Copy link
Copy Markdown
Owner

@bembelimen bembelimen Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use if (count($cid)) because values larger to 0 equals to true

{
// Prune items that you can't change.
$app->enqueueMessage(\JText::_('COM_WORKFLOW_ITEM_MUST_PUBLISHED'), 'error');
$app->enqueueMessage(\JText::_('COM_WORKFLOW_MSG_DELETE_DEFAULT'), 'error');
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this language string exists?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ist does. Have a look at joomla-cms/administrator/language/en-GB/en-GB.com_workflow.ini line 51.

{
if ($table->published !== 1)
if ($table->published != 1)
{
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps !$table->published?

priiish added 3 commits July 31, 2018 09:21
table could not be accessed, therefore deletion was not possible
& error message was being thrown
…that

have items cannot be moved to trash anymore.
@priiish priiish closed this Aug 2, 2018
@priiish priiish deleted the publishing-workflow-state-management branch August 2, 2018 09:51
bembelimen pushed a commit that referenced this pull request Mar 16, 2019
bembelimen pushed a commit that referenced this pull request Dec 7, 2020
The menu class suffix is a menu class on J4, not a suffix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants