Skip to content

Conversation

@richard67
Copy link
Member

@richard67 richard67 commented Oct 6, 2019

Pull Request for Issue #24535 (part).

Summary of Changes

This Pull Request (PR) changes com_checkin so that when you check in a checkout item not with the lock icon in the particular component's but with com_checkin, e.g. the "Checked out" view in backend, a real NULL value is written to the checked_out_time column of that component's database table if the table allows that (J4 core). If the table does not allow that (e.g. because belonging to a 3rd party extension which has not adapted yet to the null value support for datetimes in J4), the old (pseudo-)nulldates are written to the checked_out_time column of that component's database table like it was before.

Testing Instructions

Pre-conditions: Clean, new installation of current 4.0-dev branch or a nightly 4.0-alpha12-dev build (or 4.0 Alpha-12 if already out) not older than the one from this morning (UTC).

Test A: Item with nullable checked_out_time

  1. Make any item eg article, category, contact, ... be checked out, eg by editing and then going to some other url in the admin area by typing the other url into the browser's url field.
  2. Go to the sytem dashboard and then to "Global Check-in".
  3. Select the item and check it in using the button at the top.
  4. Check the checked_out_time column of the particular table (eg #__content, #__categories, #__contact_details ...) in database eg with PhpMyAdmin or PhpPgAdmin, depending on your database.
    Result: '0000-00-00 00:00:00' with MySQL, '1970-01-01 00:00:00' with PostgreSQL database.
  5. Apply the patch of this PR eg with patchtester.
    Repeat steps 1 to 4.
    Result: NULL.

Test B: Item with not nullable checked_out_time, e.g. old 3rd party extension

To be extecuted directly after the previous Test A.

  1. Using PhpMyAdmin or PhpPgAdmin (depending on your database), change in table structure eg of table #__content (if testing with an article) or #__categories (if testing with an article) ... the null property for column checked_out_time so null values are not allowed anymore, and enter a valid default value, e.g. '1999-01-01 00:00:00'. (You could also use eg '0000-00-00 00:00:00' on MySQL like an old 3rd party extension would do, but if strict mode is enabled this will not be allowed, so better test with some other default).
  2. Make any item eg article, category, contact, ... be checked out, eg by editing and then going to some other url in the admin area by typing the other url into the browser's url field.
  3. Go to the sytem dashboard and then to "Global Check-in".
  4. Select the item and check it in using the button at the top.
  5. Check the checked_out_time column of the particular table (eg #__content, #__categories, #__contact_details ...) in database eg with PhpMyAdmin or PhpPgAdmin, depending on your database.
    Result: '0000-00-00 00:00:00' with MySQL, '1970-01-01 00:00:00' with PostgreSQL database.

After test, don't forget to change back data structure to like it was before if you want to reuse the installation for other tests.

Expected result

Items being checked in with com_checkin will have column checked_out_time with real NULL value in their database table if the column allows NULL values. This is the case with Joomla 4 Core since this night.

If the database table does not allow NULL values for column checked_out_time, which might be the case for 3rd party extensions not being adapted to null value support for datetimes in J4, the old (pseduo-)nulldates ('0000-00-00 00:00:00' with MySQL, '1970-01-01 00:00:00' with PostgreSQL) are saved in that column.

Actual result

Items being checked in with com_checkin will have checked_out_time with value '0000-00-00 00:00:00' in a MySQL or '1970-01-01 00:00:00' in a PostgreSQL database in any case.

Documentation Changes Required

None.

@richard67 richard67 changed the title [4.0] [WiP] [com_checkin] Use NULL for checked_out_time columns when checking in items [4.0] [com_checkin] Use NULL for checked_out_time columns when checking in items Oct 16, 2019
@richard67 richard67 marked this pull request as ready for review October 16, 2019 23:08
@richard67
Copy link
Member Author

@wilsonge This one here does not depend on any other PR now because only users is left with datetime stuff, and users don't have a checked out time ;-)

@richard67
Copy link
Member Author

Please wait until I've reported back there that I have tested it myself.

@richard67
Copy link
Member Author

Ready for test.
@SharkyKZ @alikon @Quy Could you test this?
Ping @wilsonge for review.

@richard67
Copy link
Member Author

@roland-d Maybe you can test this one, too? Is an easy test I think.

@Quy
Copy link
Contributor

Quy commented Oct 19, 2019

I have tested this item ✅ successfully on 066cfde


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

@wilsonge wilsonge merged commit 1a21902 into joomla:4.0-dev Oct 19, 2019
@wilsonge
Copy link
Contributor

Thanks!

@wilsonge wilsonge added this to the Joomla 4.0 milestone Oct 19, 2019
@richard67 richard67 deleted the 4.0-dev-datetime-default-com-checkin branch October 19, 2019 22:07
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.

4 participants