Bug 37402 - Task scheduling fails if you don't use the correct time format
Summary: Task scheduling fails if you don't use the correct time format
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Task Scheduler (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Adam Styles
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 33304
  Show dependency treegraph
 
Reported: 2024-07-18 13:17 UTC by Owen Leonard
Modified: 2025-11-26 14:32 UTC (History)
2 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 37402: Applying scheduler form UI changes to ensure correct form state fail and also adding form place holder and label update to better inform users (1.50 KB, patch)
2025-11-22 22:31 UTC, Adam Styles
Details | Diff | Splinter Review
Bug 37402: Applying scheduler form UI changes to ensure correct form state fail (2.24 KB, patch)
2025-11-26 14:32 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 37402: (follow-up) Add standard 'required' attributes and labels (3.04 KB, patch)
2025-11-26 14:32 UTC, Owen Leonard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2024-07-18 13:17:28 UTC
It looks like one must enter a time in the format 00:00 or you will be unable to save the task. The page reloads with the message "Failed to add scheduled task" and no other information about why it failed.
Comment 1 David Cook 2024-12-12 05:27:47 UTC
Just tried this out and I can confirm it.

Few different things could be done here.

1. Placeholder in the input to show 00:00
2. Error handling that retain submitted values and show a hint about the validation failure
3. Do client-side validation
Comment 2 Adam Styles 2025-11-19 10:15:48 UTC
Hi Owen and David,

I built a test plan for this reported error state:

Schedule report - enter no time value - operations test 1

1. login to koha instance
2. navigate to reports module
3. create a small quick test report or use an existing small test report
4. select 'schedule' from toolbar above main sql window
5. once redirected to task scheduler UI, choose 'tommorow' in drop down 'date' field.
6. enter 'test@local.com' in 'email' field
7. enter no value in the 'time' field
8. press 'save'.

Result - fail:
- as stated in ticket the form submission created an error state producing notification 'Failed to add scheduled task'
- no scheduled report action is set

Schedule report - enter simple int only time value - operations test 2

1. login to koha instance
2. navigate to reports module
3. create a small quick test report or use an existing small test report
4. select 'schedule' from toolbar above main sql window
5. once redirected to task scheduler UI, choose 'tommorow' in drop down 'date' field.
6. enter 'test@local.com' in 'email' field
7. enter '000' in 'time' field
8. press 'save'.

Result - pass:
- The form submission does not create an error state or produce a notification
- report is scheduled for midnight

Following on from David's suggestions, I suggest we add the following as a hotfix until a larger review of the form on this page can be done. 

- Add a 'required' attribute to time input field, which will natively block form submit if no value is present in this field. 
- Add a place holder attribute for the time input field to assist users in best time format approach
- Update label string for time input field 'Time (time in 24 hours e.g 00:00' to further inform user of the format needed.

e.g
from..
<li><label for="starttime">Time:</label> <input type="text" name="starttime" id="starttime" value="" maxlength="5" size="5"></li>

to...
<li>
<label for="starttime">Time (time in 24 hours e.g 00:00:</label> 
<input type="text" name="starttime" id="starttime" value="" maxlength="5" size="5" placeholder="hh:mm" required>
</li> 

This would create a nice 'hot fix' for the form, to mitigate user confusion on best time format.

The larger review of the task scheduler form could the be done to incorporate flat picker etc.

If this works for everyone, I will assign this bug to myself and put a quick patch together for testing.

Let me know.

Thanks.
Comment 3 Adam Styles 2025-11-19 10:17:33 UTC
opps typo in test 2...

here we go again...


Hi Owen and David,

I built a test plan for this reported error state:

Schedule report - enter no time value - operations test 1

1. login to koha instance
2. navigate to reports module
3. create a small quick test report or use an existing small test report
4. select 'schedule' from toolbar above main sql window
5. once redirected to task scheduler UI, choose 'tommorow' in drop down 'date' field.
6. enter 'test@local.com' in 'email' field
7. enter no value in the 'time' field
8. press 'save'.

Result - fail:
- as stated in ticket the form submission created an error state producing notification 'Failed to add scheduled task'
- no scheduled report action is set

Schedule report - enter simple int only time value - operations test 2

1. login to koha instance
2. navigate to reports module
3. create a small quick test report or use an existing small test report
4. select 'schedule' from toolbar above main sql window
5. once redirected to task scheduler UI, choose 'tommorow' in drop down 'date' field.
6. enter 'test@local.com' in 'email' field
7. enter '0000' in 'time' field
8. press 'save'.

Result - pass:
- The form submission does not create an error state or produce a notification
- report is scheduled for midnight

Following on from David's suggestions, I suggest we add the following as a hotfix until a larger review of the form on this page can be done. 

- Add a 'required' attribute to time input field, which will natively block form submit if no value is present in this field. 
- Add a place holder attribute for the time input field to assist users in best time format approach
- Update label string for time input field 'Time (time in 24 hours e.g 00:00' to further inform user of the format needed.

e.g
from..
<li><label for="starttime">Time:</label> <input type="text" name="starttime" id="starttime" value="" maxlength="5" size="5"></li>

to...
<li>
<label for="starttime">Time (time in 24 hours e.g 00:00:</label> 
<input type="text" name="starttime" id="starttime" value="" maxlength="5" size="5" placeholder="hh:mm" required>
</li> 

This would create a nice 'hot fix' for the form, to mitigate user confusion on best time format.

The larger review of the task scheduler form could the be done to incorporate flat picker etc.

If this works for everyone, I will assign this bug to myself and put a quick patch together for testing.

Let me know.

Thanks.
Comment 4 Adam Styles 2025-11-22 21:27:04 UTC
Hi All,
I will write the MVP patch for this.

Thanks.
Comment 5 Adam Styles 2025-11-22 22:31:36 UTC
Created attachment 189897 [details] [review]
Bug 37402: Applying scheduler form UI changes to ensure correct form state fail and also adding form place holder and label update to better inform users
Comment 6 Adam Styles 2025-11-22 22:33:57 UTC
Bug 37402: Task scheduling fails if you don't use the correct time format
    Applying scheduler form UI changes to ensure correct form state fail and also adding 
    form place holder and label update to better inform users    
    
Before patch applied...

Schedule report - enter no time value - operations test

1. login to koha instance
2. navigate to reports module
3. create a small quick test report or use an existing small test report
4. select 'schedule' from toolbar above main sql window
5. once redirected to task scheduler UI, choose 'tommorow' in drop down 'date' field.
6. enter 'test@local.com' in 'email' field
7. enter no value in the 'time' field
8. press 'save'.

Result - fail:
- Form submission creates an error state producing notification 'Failed to add scheduled task'
- Form submission error should relate to the time field requirement and not attempt submit action

After patch applied...

re-test - Schedule report - enter no time value - operations test

1. login to koha instance
2. navigate to reports module
3. create a small quick test report or use an existing small test report
4. select 'schedule' from toolbar above main sql window
5. once redirected to task scheduler UI, choose 'tommorow' in drop down 'date' field.
6. enter 'test@local.com' in 'email' field
7. enter no value in the 'time' field
8. press 'save'.

Result - PASS:
- No  'Failed to add scheduled task' error state occurs, and the correct time require error state does occur
- Form does not attempt submit as it identifies the required time field data is missing
- Addition time field place holder information is provided and time field label also offer time format information to user 
  
Ready for Sign off.
Comment 7 Adam Styles 2025-11-22 22:35:58 UTC
Hi All,
work done, patch added.
Happy for someone to test.

Thanks.
Comment 8 Owen Leonard 2025-11-26 14:32:26 UTC
Created attachment 189960 [details] [review]
Bug 37402: Applying scheduler form UI changes to ensure correct form state fail

Also adding form place holder and label update to better inform users

1. login to koha instance
2. navigate to reports module
3. create a small quick test report or use an existing small test report
4. select 'schedule' from toolbar above main sql window
5. once redirected to task scheduler UI, choose 'tommorow' in drop down
   'date' field.
6. enter 'test@local.com' in 'email' field
7. enter no value in the 'time' field
8. press 'save'.

Result - PASS:
- No  'Failed to add scheduled task' error state occurs, and the correct
  time require error state does occur
- Form does not attempt submit as it identifies the required time field
  data is missing
- Addition time field place holder information is provided and time
  field label also offer time format information to user

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 9 Owen Leonard 2025-11-26 14:32:29 UTC
Created attachment 189961 [details] [review]
Bug 37402: (follow-up) Add standard 'required' attributes and labels

This patch also moves time format hint into a standard <div
class="hint">. The hour format has been corrected from hhmm to HH:MM.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>