Skip to content

[4.0] fix Templates : Edit style - unsaved menu assignments#30183

Merged
Quy merged 6 commits intojoomla:4.0-devfrom
shim-sao:4.0-dev
Jul 27, 2020
Merged

[4.0] fix Templates : Edit style - unsaved menu assignments#30183
Quy merged 6 commits intojoomla:4.0-devfrom
shim-sao:4.0-dev

Conversation

@shim-sao
Copy link
Copy Markdown
Contributor

@shim-sao shim-sao commented Jul 24, 2020

Steps to reproduce the issue

Save a template style with menu assignments (4.0-beta-3-dev)

Expected result

Template style saved with menu assignments

Actual result

None of the menu assignments are saved

System information (as much as possible)

Joomla 4.0-beta-3-dev - Linux - PHP 7.4.8 - MySql 5.7.28

Additional comments

In the Administrator StyleModel.php function Save, replace in the 2 queries :

->whereIn($db->quoteName('checked_out'), [null, $userId])

by something like :

->where($db->quoteName('checked_out') .' IS NULL OR ' . $db->quoteName('checked_out') . ' = :userid')

->bind(':userid', $userid, ParameterType::INTEGER)

I think maybe there is something wrong in the query with whereIn php null and the mysql check IS NULL

= NULL or IN (NULL) may not work sometimes

->where($db->quoteName('checked_out') . '= NULL') => not work

->whereIn($db->quoteName('checked_out'), [null]) => not work

Copy link
Copy Markdown
Contributor Author

@shim-sao shim-sao left a comment

Choose a reason for hiding this comment

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

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Jul 24, 2020

@shim-sao did you close this by mistake ?

@shim-sao
Copy link
Copy Markdown
Contributor Author

It is my first PR with fork. I don't really know how it work :(

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Jul 24, 2020

no problem at all , all of us have started this way... 😃

but please write

  • Testing Instructions
  • Actual result BEFORE applying this Pull Request
  • Expected result AFTER applying this Pull Request

@shim-sao
Copy link
Copy Markdown
Contributor Author

shim-sao commented Jul 24, 2020

It is attached to an issues but I don't know where doing this.

shim-sao and others added 2 commits July 25, 2020 05:28
@richard67
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 26d4f96

1. Code-review: The change is correct.
2. Real test: Successful, i.e. without that patch, the menu assignments are not saved, and with the patch they are saved.


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

@richard67
Copy link
Copy Markdown
Member

@SharkyKZ If you have a bit time, could you test, too? Thanks in advance.

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Jul 26, 2020

I have tested this item ✅ successfully on 26d4f96


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

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Jul 26, 2020

rtc


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 26, 2020
@infograf768
Copy link
Copy Markdown
Member

Do we still have a cs?
We have
->where('(' . $db->quoteName('checked_out') .' IS NULL OR ' . $db->quoteName('checked_out') . ' = :userid)')
Should not we have
->where('(' . $db->quoteName('checked_out') . ' IS NULL OR ' . $db->quoteName('checked_out') . ' = :userid)')

i.e. a space missing between the period and the singlequote?

@richard67
Copy link
Copy Markdown
Member

Back to pending. @shim-sao please apply the suggested changes to fix PHP code style.

@infograf768 You are right. No idea though why the PHPCS check by drone didn't find it.


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

@richard67 richard67 removed the RTC This Pull Request is Ready To Commit label Jul 26, 2020
shim-sao and others added 2 commits July 27, 2020 11:33
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
@richard67
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 39e1640


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

@richard67
Copy link
Copy Markdown
Member

Changes after last 2 successful tests were only code style, so these tests are still valid => RTC.


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 27, 2020
@Quy Quy added this to the Joomla 4.0 milestone Jul 27, 2020
@Quy Quy merged commit 64e83ef into joomla:4.0-dev Jul 27, 2020
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jul 27, 2020
@Quy
Copy link
Copy Markdown
Contributor

Quy commented Jul 27, 2020

Thanks

sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
…0183)

* [4.0] fix Templates : Edit style - unsaved menu assignments

* Correct variable $userId not $userid in save function

* Update administrator/components/com_templates/src/Model/StyleModel.php

Co-authored-by: SharkyKZ <sharkykz@gmail.com>

* Update administrator/components/com_templates/src/Model/StyleModel.php

Co-authored-by: SharkyKZ <sharkykz@gmail.com>

* Update administrator/components/com_templates/src/Model/StyleModel.php

Co-authored-by: Richard Fath <richard67@users.noreply.github.com>

* Update administrator/components/com_templates/src/Model/StyleModel.php

Co-authored-by: Richard Fath <richard67@users.noreply.github.com>

Co-authored-by: SharkyKZ <sharkykz@gmail.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
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.

7 participants