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:605 PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.NoLineBeforeOpen CodingStandard.WhiteSpace.ControlStructureSpacing.NoLineBeforeOpen Error core/units/helpers/search_helper.php:605 PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace Error core/units/helpers/search_helper.php:605 PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace Error core/units/helpers/search_helper.php:605 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact 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:610 PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace Error core/units/helpers/search_helper.php:610 PHPCS.E.CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace Error core/units/helpers/search_helper.php:610 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:611 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:615 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:620 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact Error core/units/helpers/search_helper.php:622 PHPCS.E.Generic.WhiteSpace.ScopeIndent.IncorrectExact Generic.WhiteSpace.ScopeIndent.IncorrectExact - Unit
No Unit Test Coverage - Build Status
Buildable 883 Build 883: arc lint + arc unit
Event Timeline
core/units/helpers/search_helper.php | ||
---|---|---|
605 | 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 | |
606 |
$from == strtotime(date('Y-m-d', $from) . ' 00:00:00', $from) into date('H:i:s', $from) == '00:00:00'
| |
610 | 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 | |
611 |
$to == strtotime(date('Y-m-d', $to) . ' 00:00:00', $to) into date('H:i:s', $to) == '00:00:00'
| |
617–620 | 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 | |
622 | 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 | |
622–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 | |
687 | 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 | |
717–719 | 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 | ||
---|---|---|
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 | ||
---|---|---|
695–703 | 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. |