revolution icon indicating copy to clipboard operation
revolution copied to clipboard

[MODX3] Fix saving the time for date TVs that were created in MODX 2.x

Open halftrainedharry opened this issue 2 years ago • 3 comments

What does it do?

Fixes the code in the "Resource/Create" and "Resource/Update" processors (that was added in #16398) to also work for date TVs that were created in MODX 2.x.

Why is it needed?

In MODX 2.x, the input property "hideTime" of a Date-TV is stored as the value "false" (or "true") -> s:8:"hideTime";s:5:"false"; In MODX 3, the same property is stored as the value "0" (or "1") -> s:8:"hideTime";s:1:"0";

In MODX installations, that were updated from MODX 2.x to MODX 3, the time part of the date-TV-value always gets deleted.

How to test

  • Create a TV of type "date".
  • Change the value of "hideTime" from s:1:"0"; to s:5:"false"; in the column "input_properties".
  • Make sure, that the time part of the TV value still gets saved correctly.

Related topic in the MODX forum

https://community.modx.com/t/date-tv-time-wont-save/7335

halftrainedharry avatar Dec 14 '23 20:12 halftrainedharry

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 21.68%. Comparing base (73bfd27) to head (68d3fb9). Report is 105 commits behind head on 3.x.

Files Patch % Lines
core/src/Revolution/Processors/Resource/Create.php 0.00% 1 Missing :warning:
core/src/Revolution/Processors/Resource/Update.php 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff            @@
##                3.x   #16505   +/-   ##
=========================================
  Coverage     21.68%   21.68%           
- Complexity    10496    10498    +2     
=========================================
  Files           561      561           
  Lines         31703    31703           
=========================================
  Hits           6875     6875           
  Misses        24828    24828           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Dec 14 '23 20:12 codecov[bot]

Maybe it is better to prepare an upgrade script that changes the value.

Jako avatar Jan 07 '24 20:01 Jako

I am also fine with that solution.

Jako avatar Feb 14 '24 14:02 Jako