Made changes in dearch by date logic.
Details
Preparation
- go to Website & Content → Labels & Phrases section
- modify some phrase, if all minutes or days in the "Modified On" column are equal
- confirm, that are visible records with different minutes and different days in the "Modified On" column
Date/Time configuration - for current language set:
- "Date Format" to Y-m-d
- "Time Format" to H:i:s
- "Input Date Format" to m/d/Y
- "Input Time Format" to g:i:s A
Testing "Modified On" column filter
- specify one from date only (no time)
- confirm, that records with other dates are filtered out
- specify one to date only (no time)
- confirm, that records with other dates are filtered out
- specify one to date only (with time)
- confirm, that records with other dates or minutes are filtered out (ignoring seconds)
- specify one from date only (with time)
- confirm, that records with other dates or minutes are filtered out (ignoring seconds)
- specify both from & to dates with time
- confirm, that records with dates between specified datetimes (ignoring seconds) are visible, but other are filtered out
- specify both from & to dates with time in output format (without seconds)
- confirm, that records with dates between specified datetimes (ignoring seconds) are visible, but other are filtered out
- specify both from & to dates with time in input format (with seconds)
- confirm, that records with dates between specified datetimes (ignoring seconds) are visible, but other are filtered out
- specify word "test" in place of from date and empty to date
- confirm, that no records found
- specify word "test" in place of to date and empty from date
- confirm, that no records found
- specify word "test" in place of from date and existing among records to date
- confirm, that no records found
- specify word "test" in place of to date and existing among records from date
- confirm, that no records found
- in search filter specify date using format from "Input Date Format" field without time (m/d/Y)
- confirm that right search results are shown
Diff Detail
- Repository
- rINP In-Portal
- Branch
- /in-portal/branches/5.2.x
- Lint
Lint Errors Excuse: Full file reformatting is not part of this task. Severity Location Code Message Error core/kernel/utility/formatters/date_formatter.php:375 PHPCS.E.CodingStandard.Commenting.DocComment.TagValueIndent CodingStandard.Commenting.DocComment.TagValueIndent Error core/kernel/utility/formatters/date_formatter.php:375 PHPCS.E.CodingStandard.Commenting.FunctionComment.MissingParamComment CodingStandard.Commenting.FunctionComment.MissingParamComment Error core/kernel/utility/formatters/date_formatter.php:376 PHPCS.E.CodingStandard.Commenting.DocComment.TagValueIndent CodingStandard.Commenting.DocComment.TagValueIndent Error core/kernel/utility/formatters/date_formatter.php:376 PHPCS.E.CodingStandard.Commenting.FunctionComment.SpacingAfterParamName CodingStandard.Commenting.FunctionComment.SpacingAfterParamName Error core/kernel/utility/formatters/date_formatter.php:377 PHPCS.E.CodingStandard.Commenting.DocComment.NonParamGroup CodingStandard.Commenting.DocComment.NonParamGroup Error core/kernel/utility/formatters/date_formatter.php:380 PHPCS.E.CodingStandard.Commenting.FunctionComment.TypeHintMissing CodingStandard.Commenting.FunctionComment.TypeHintMissing Error core/kernel/utility/formatters/date_formatter.php:393 PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace Error core/kernel/utility/formatters/date_formatter.php:393 PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace Error core/kernel/utility/formatters/date_formatter.php:393 PHPCS.E.Generic.ControlStructures.InlineControlStructure.NotAllowed Generic.ControlStructures.InlineControlStructure.NotAllowed Error core/units/helpers/search_helper.php:606 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:608 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:609 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:612 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:614 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:617 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:619 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter CodingStandard.Strings.ConcatenationSpacing.NoSpaceAfter Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore Error core/units/helpers/search_helper.php:622 PHPCS.E.CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore CodingStandard.Strings.ConcatenationSpacing.NoSpaceBefore - Unit
No Unit Test Coverage - Build Status
Buildable 886 Build 886: arc lint + arc unit
Event Timeline
core/units/helpers/search_helper.php | ||
---|---|---|
604–606 | NOTE: battle against malformed dates entered by user
change into: if ( is_numeric($from) && $to === null ) { this way to date entered in incorrect format won't be handled as to date not specified | |
607 |
$from == strtotime(date('Y-m-d', $from) . ' 00:00:00', $from) into date('H:i:s', $from) == '00:00:00'
| |
608–609 | NOTE: battle against malformed dates entered by user
change into: if ( $from === null && is_numeric($to) ) { this way from date entered in incorrect format won't be handled as from date not specified | |
609–616 |
$to == strtotime(date('Y-m-d', $to) . ' 00:00:00', $to) into date('H:i:s', $to) == '00:00:00'
| |
615–618 | NOTE: battle against malformed dates entered by user
change into: if ( is_numeric($from) && $to === null || $from === null && is_numeric($to) ) { $from = $from === null ? $to : $from; $to = $from; } this way we won't replace malformed from/to date entered by user with to/from date, that user entered correctly | |
619–621 | NOTE: battle against malformed dates entered by user
change into: if ( is_numeric($from) && is_numeric($to) ) { this way only correctly entered dates would be used in filter | |
619–626 | NOTE: battle against malformed dates entered by user
Please add else statement, that would set $filter_value variable value to FALSE (as string). this way if we've submitted filter with incorrectly formatted date, then we'll see 0 records instead of all records | |
686–689 | NOTE: battle against malformed dates entered by user
return null instead of false this way recipient would know if user haven't specified any value | |
719–721 | remove else statement, but keep the code inside it since code inside else statement is always executed it's pointless to wrap return ... statements with it |
The inline comments with NOTE: battle against malformed dates entered by user line above them are actually UX discovered issues, that weren't part of original task, but without fixing them user would be as confused as now thinking that date entered in incorrect format is actually working as filter, when it's not.
Please also update test plan to reflect handling of incorrectly entered dates.
core/units/helpers/search_helper.php | ||
---|---|---|
685–686 |
When performing recursive method call the altered $value argument (trimmed & time added, when specified by user) is given and that results in the parsing error. Test plan fragment to cover this:
|
core/units/helpers/search_helper.php | ||
---|---|---|
697–705 | With current test plan this code is never executed on recursive call to this method. I recommend debugging actual code to verify, that it works. |