? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
21 Oct 2019

Pull Request for Issue #26660

Summary of Changes

Null Date is now defined by null and no more by Factory::getDbo()->getNullDate()

Testing Instructions

Create a site or admin module and enter a date for the Start Publishing.
Although no Finish Publishing date is set, the tooltip will display a wrong finish date.

Before patch

Screen Shot 2019-10-21 at 11 17 21

After patch

Screen Shot 2019-10-21 at 11 16 05

Note:

Remains in core 3 files with instances of Factory::getDbo()->getNullDate()

/layouts/joomla/content/icons/edit.php:25: 		|| ((strtotime($article->publish_down) < strtotime(Factory::getDate())) && $article->publish_down != Factory::getDbo()->getNullDate()))
/layouts/joomla/content/icons/edit.php:35: 		|| ((strtotime($article->publish_down) < strtotime(Factory::getDate())) && $article->publish_down != Factory::getDbo()->getNullDate()))
/libraries/src/Form/Field/CalendarField.php:228: 				if ($this->value && $this->value != Factory::getDbo()->getNullDate())
/libraries/src/Form/Field/CalendarField.php:240: 				if ($this->value && $this->value != Factory::getDbo()->getNullDate())
/libraries/src/Form/Field/CalendarField.php:253: 		if ($this->value && $this->value != Factory::getDbo()->getNullDate() && strtotime($this->value) !== false)
/libraries/src/HTML/HTMLHelper.php:1115: 		if ($value && $value !== Factory::getDbo()->getNullDate() && strtotime($value) !== false)

I did not touch these as I was not sure where to test them.

avatar infograf768 infograf768 - open - 21 Oct 2019
avatar infograf768 infograf768 - change - 21 Oct 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Oct 2019
Category Libraries
avatar richard67
richard67 - comment - 21 Oct 2019

@infograf768 Was on my task list, but you were faster. Code looks good to me. Will test tonight after work.

avatar infograf768
infograf768 - comment - 21 Oct 2019

@richard67
There are many other variations of ->getNullDate ;)

avatar richard67
richard67 - comment - 21 Oct 2019

@infograf768 I know. Not all of them shall be thrown away, some of them we need to keep for 3rd party extensions. But a check for real NULL should be added. Maybe @wilsonge can check hf the changes here are ok. To me they seem to be ok.

avatar ChristineWk ChristineWk - test_item - 21 Oct 2019 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 21 Oct 2019

I have tested this item successfully on d5feaae

Confirm Before Patch & After Patch, but on both I hv this.
Info: Tested on beta-1 (nightly from yesterday)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26751.
avatar ChristineWk
ChristineWk - comment - 21 Oct 2019

see attached.screen shot 2019-10-21 at 10 09 38screen shot 2019-10-21 at 10 09 42


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

avatar infograf768
infograf768 - comment - 21 Oct 2019

@ChristineWk
The date is in the past.
Please try to also modify Factory::getDbo()->getNullDate() to null in

/layouts/joomla/content/icons/edit.php:25: 		|| ((strtotime($article->publish_down) < strtotime(Factory::getDate())) && $article->publish_down != Factory::getDbo()->getNullDate()))
/layouts/joomla/content/icons/edit.php:35: 		|| ((strtotime($article->publish_down) < strtotime(Factory::getDate())) && $article->publish_down != Factory::getDbo()->getNullDate()))
avatar HLeithner
HLeithner - comment - 21 Oct 2019

If we want to support 3rd party extensions with this layout which doesn't null as date type we have to keep getNullDate and just add a === NULL to the if-statement.

If we don't want to support this, you can remove the $nullDate variable completely. Since we still have getNullDate in the near future (4.x) we should support it in the layout too.

Please change
($publish_up != $nullDate)
to
($publish_up !== NULL &&$publish_up != $nullDate)

thx

avatar richard67
richard67 - comment - 21 Oct 2019

Please change
($publish_up != $nullDate)
to
($publish_up !== NULL &&$publish_up != $nullDate)

Should be lowercase nullfor PHP CS.

@infograf768 In PublishedButton.php the checks in lines 89 and 95 should also be corrected. They were wrong before nulldate changes, too, because in lines 63 and 64 the datetimes are set to null. If you want I can check tonight after work and send you a PR to your branch.

avatar infograf768
infograf768 - comment - 21 Oct 2019

@richard67

If you want I can check tonight after work and send you a PR to your branch.

Thanks, please do and correct all.

avatar richard67
richard67 - comment - 21 Oct 2019

@wilsonge Shall JGrid or the Published Buttons be usable by 3rd party extensions so we have to keep old nulldate checks here?

avatar ChristineWk
ChristineWk - comment - 21 Oct 2019

@infograf768

Trashed previous and made new with tomorrow date :-)

null_date_03
null_date_04
Hv also to read new comments. Should I delete successful?

avatar brianteeman
brianteeman - comment - 21 Oct 2019

@wilsonge Shall JGrid or the Published Buttons be usable by 3rd party extensions so we have to keep old nulldate checks here?

Of course they must be - they are part of the librarries

avatar wilsonge
wilsonge - comment - 21 Oct 2019

Yup we need to keep compat in the libraries please. but we can definitely mark as deprecated

avatar infograf768 infograf768 - change - 21 Oct 2019
Labels Added: ?
avatar infograf768
infograf768 - comment - 21 Oct 2019

I merged @richard67 patch into this. It works fine for me.

Do we also need to modify /layouts/joomla/content/icons/edit.php ?
It looks like it is only used for legacy:

$text = LayoutHelper::render('joomla.content.icons.edit', array('article' => $article, 'overlib' => $overlib, 'legacy' => $legacy));

@ChristineWk
Please test again.

avatar richard67
richard67 - comment - 21 Oct 2019

@wilsonge I don't know what exactly to mark as deprecated.

avatar brianteeman
brianteeman - comment - 21 Oct 2019

Do we also need to modify /layouts/joomla/content/icons/edit.php ?

That was for the icon on front end editing iirc

avatar ChristineWk
ChristineWk - comment - 21 Oct 2019

@infograf768

hv similar the same as before.
null_date_05

avatar richard67
richard67 - comment - 21 Oct 2019

@ChristineWk If I understand the functionality right, the above is correct. Pending means publish up is in future. Today is the 21st.

avatar richard67
richard67 - comment - 21 Oct 2019

Or do I maybe understand the issue wrong?

avatar richard67 richard67 - test_item - 21 Oct 2019 - Tested successfully
avatar richard67
richard67 - comment - 21 Oct 2019

I have tested this item successfully on d0128ab

Before patch: A publish down time is shown in the tool tip even if no publish down time was set.

After patch: Publish down time is only shown if really set.

The icon and tool tip is set according to the times (expired if publish down in past, pending if publish up in future, published if publish up in past and publish down in future or no publish down set).


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

avatar ChristineWk ChristineWk - test_item - 21 Oct 2019 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 21 Oct 2019

I have tested this item successfully on d0128ab


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

avatar Quy Quy - change - 21 Oct 2019
Status Pending Ready to Commit
avatar Quy
Quy - comment - 21 Oct 2019

RTC


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

avatar richard67
richard67 - comment - 21 Oct 2019

If nobody else wants to do that, I will make another PR for /layouts/joomla/content/icons/edit.php ... but it may take a while, not sure if I will get it finished otday with testing instructions.

avatar infograf768 infograf768 - change - 22 Oct 2019
Labels Added: ?
avatar infograf768
infograf768 - comment - 25 Oct 2019

@Quy @wilsonge
Please merge.

avatar wilsonge wilsonge - change - 25 Oct 2019
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-10-25 20:47:22
Closed_By wilsonge
avatar wilsonge wilsonge - close - 25 Oct 2019
avatar wilsonge wilsonge - merge - 25 Oct 2019
avatar wilsonge
wilsonge - comment - 25 Oct 2019

Thanks!

Add a Comment

Login with GitHub to post a comment