The error message given is:

You may only use the letters $date_letters for the date and $time_letters for the time. Remove the extra characters $extra

Using the % character instead of $ means the placeholders are replaced.

Comments

gmaxwelled created an issue. See original summary.

gmaxwelled’s picture

jonathan1055’s picture

Hi gmaxwelled,
Thanks for spotting this. Amazing that no-one has seen it yet, as entering an invalid letter also causes two runtime exceptions in addition to the incorrect message that Scheduler shows. Whoever converted this from 7.x could not have tested it very well ;-)

Thanks for the patch. I think we need test coverage for the admin form, so I will do that before committing this fix.

Cheers
Jonathan

jonathan1055’s picture

Title: Placeholders not being replaced on settings page » Date format placeholders not replaced in error message
Status: Active » Needs review
StatusFileSize
new2.32 KB

Here is a new test file SchedulerAdminSettingsTest which checks the messages when the settings are saved. This patch just has the new tests, so it should fail.

jonathan1055’s picture

As expected the tests failed - not a failed assertion but the more serious "Exception: User error: Invalid placeholder".

New patch with code fix (as from the patch by gmaxwelled) plus the new tests.

[odd, that the test failure did not set the issue status to 'needs review' and post an extra comment like it used to do]

jonathan1055’s picture

Priority: Minor » Normal
StatusFileSize
new4.89 KB

Tests pass, but there are three coding-standards problems (that's a nice new feature in d.o. test output) in SchedulerAdminForm.php. Not introduced by this patch, but in other places in the file altered by this patch. Hence might as well fix them here.

jonathan1055’s picture

StatusFileSize
new4.91 KB

  • jonathan1055 committed 79f4be8 on 8.x-1.x
    Issue #2831429 by jonathan1055, gmaxwelled: Date format placeholders not...
jonathan1055’s picture

Status: Needs review » Fixed

Committed.
Thanks gmaxwelled for raising the issue and providing the first patch.
Jonathan

jonathan1055’s picture

Status: Fixed » Needs review
StatusFileSize
new3.35 KB

When writing the new tests and checking against the actual admin settings validation, I realised that we do not validate against a missing date part. It makes no sense to allow this through, so I added validation and expanded the tests.

  • jonathan1055 committed 05451b5 on 8.x-1.x
    Issue #2831429 by jonathan1055: Validate that scheduler format contains...
jonathan1055’s picture

Status: Needs review » Fixed

Done.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.