? ? Pending

User tests: Successful: Unsuccessful:

avatar ggppdk
ggppdk
5 Mar 2018

Pull Request for Issue #19831

@dgt41 , your opinion, i think this change matches documentation

Summary of Changes

Minimum and Maximum (relative) year setting is not to added by the layout when its value is '0'
Change it so that it is, thus you can get
data-min-year="0"
data-max-year="0"

Testing Instructions

Create a calendar field in XML that has attributes
minyear="0"
maxyear="0"

Expected result

The selectable year in the calender is limited to current year

Actual result

No limit

Documentation Changes Required

None

avatar ggppdk ggppdk - open - 5 Mar 2018
avatar ggppdk ggppdk - change - 5 Mar 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 5 Mar 2018
Category Layout
avatar ggppdk ggppdk - change - 5 Mar 2018
Title
Allow limiting calendar field to min and / or max year to current year
Allow limiting calendar field to current year
avatar ggppdk ggppdk - edited - 5 Mar 2018
avatar brianteeman
brianteeman - comment - 5 Mar 2018

I have tested this item ? unsuccessfully on e216889

using the xml in the original issue to test with I find no change after this pr


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

avatar brianteeman brianteeman - test_item - 5 Mar 2018 - Tested unsuccessfully
avatar ggppdk ggppdk - change - 5 Mar 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 5 Mar 2018
Category Layout Layout Libraries
avatar ggppdk
ggppdk - comment - 5 Mar 2018

@brianteeman

It should be good now,

1st commit of this PR was only enough for JHtml::calendar , which currently completely ignores minYear, maxYear attributes
I will make a different PR for JHtml::calendar

avatar ggppdk
ggppdk - comment - 5 Mar 2018

Here is PR to add support for minYear, maxYear attributes to JHtml::calendar too
#19847

avatar brianteeman
brianteeman - comment - 5 Mar 2018

wondering why the layout needed the change. JUST using the library change seems enough

avatar ggppdk
ggppdk - comment - 5 Mar 2018

The layout uses code
empty(...) which cannot handle string value '0', without this change value '0' cannot be added

avatar brianteeman
brianteeman - comment - 5 Mar 2018

Sorry - forgot i was also testing the -1 etc at that time


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

avatar brianteeman
brianteeman - comment - 5 Mar 2018

I have tested this item successfully on f27cbd6


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

avatar brianteeman brianteeman - test_item - 5 Mar 2018 - Tested successfully
avatar brianteeman
brianteeman - comment - 5 Mar 2018

The unit tests will need updating

  1. JHtmlTest::testCalendar
    Undefined variable: minYear
    /home/travis/build/joomla/joomla-cms/tests/unit/core/helper.php:55
    /home/travis/build/joomla/joomla-cms/layouts/joomla/form/field/calendar.php:128
    /home/travis/build/joomla/joomla-cms/libraries/src/Layout/FileLayout.php:125
    /home/travis/build/joomla/joomla-cms/libraries/src/Layout/LayoutHelper.php:73
    /home/travis/build/joomla/joomla-cms/libraries/src/HTML/HTMLHelper.php:1086
    /home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/cms/html/JHtmlTest.php:1449

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19846.
avatar ggppdk
ggppdk - comment - 5 Mar 2018

The unit tests will need updating

I missed this, fixed it

The unit tests are still correct, just they caught the non-set variable PHP notices when the minyear and maxyear are not given for the calendar field, which is what unit tests test by default

added check for non set variables $minYear, $maxYear,
behaviour of PR was not changed by this last commit

avatar dgt41
dgt41 - comment - 6 Mar 2018

I have tested this item successfully on 243a1af


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

avatar dgt41 dgt41 - test_item - 6 Mar 2018 - Tested successfully
avatar Quy Quy - change - 6 Mar 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 6 Mar 2018

RTC


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

avatar mbabker mbabker - change - 17 Mar 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-03-17 15:30:23
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 17 Mar 2018
avatar mbabker mbabker - merge - 17 Mar 2018

Add a Comment

Login with GitHub to post a comment