Bug 27457

Summary: Set focus for cursor to Debit type code field when creating new debit type
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: TemplatesAssignee: Mazen Khallaf <mazen.i.khallaf>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: andrewfh, barbara.johnson, caroline.cyr-la-rose, fridolin.somers, jonathan.druart, koha-bugs, martin.renvoize, mazen.i.khallaf, testopia, victor
Version: MainKeywords: Academy
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.03,20.05.09,19.11.15
Attachments: Bug 27457: Set focus for cursor to Debit type code field
Bug 27457: Set cursor focus to debit type code field when creating new debit type
Bug 27457: Set focus for cursor to Debit type code field
Bug 27457: Set focus for cursor to Debit type code field
Bug 27457: Set focus for cursor to Debit type code field
Bug 27457: Set focus for cursor to Debit type code field
Bug 27457: Set focus for cursor to Debit type code field
Bug 27457: Set focus for cursor to Debit type code field

Description Katrin Fischer 2021-01-17 16:14:14 UTC
When creating a new debit type in administration, it would be nice if the cursor was in the first form field "Debit typecode ".

See bug 27192 for a similar one.
Comment 1 Catherine 2021-01-19 01:17:46 UTC
Created attachment 115272 [details] [review]
Bug 27457: Set focus for cursor to Debit type code field

Test Plan:
1.Click administration
2.Click debit types
3.Click new debit type
4.Check if the cursor is in the first form field (it shouldn't)
5.Add patch
6.Repeat steps 1-3
7.Check if the cursor is in the first form field (it should)

Sponsored by Catalyst IT
Comment 2 Mazen Khallaf 2021-01-19 01:25:40 UTC
Created attachment 115273 [details] [review]
Bug 27457: Set cursor focus to debit type code field when creating new debit type

Test Plan:
1. Go to Administration
2. Go to Debit Types
3. Go to New Debit Type (Cursor shouldn't focus on 'Debit Type Code')
5. Apply Patch
6. Repeat steps 1-3 (Cursor should automatically focus on the 'Debit
        Type Code' field)
Comment 3 Jonathan Druart 2021-01-19 09:04:28 UTC
There are 2 patches here, obsoleting the second one.
Comment 4 Jonathan Druart 2021-01-19 09:05:26 UTC
Thanks for your patch Catherine.

A small note, try to not add unnecessary whitespace changes like:

-        $(document).ready(function() {
+        $(document).ready(function(){
Comment 5 Martin Renvoize 2021-01-19 16:58:01 UTC
Hi Mazen, 

A minor point about consistency, whilst your patch does indeed work, we actually have a class hooked up already to achieve this.. so; rather than requiring the addition of the javascript you've added, you could just add a 'focus' class to the input in question instead.. which is a little terser and the preferred option.
Comment 6 Mazen Khallaf 2021-01-19 20:13:12 UTC
(In reply to Martin Renvoize from comment #5)
> Hi Mazen, 
> 
> A minor point about consistency, whilst your patch does indeed work, we
> actually have a class hooked up already to achieve this.. so; rather than
> requiring the addition of the javascript you've added, you could just add a
> 'focus' class to the input in question instead.. which is a little terser
> and the preferred option.

I'll try to keep that in mind. Thanks, Martin!
Comment 7 Catherine 2021-01-19 20:21:27 UTC
Created attachment 115346 [details] [review]
Bug 27457: Set focus for cursor to Debit type code field

Test Plan:
1.Click administration
2.Click debit types
3.Click new debit type
4.Check if the cursor is in the first form field (it shouldn't)
5.Add patch
6.Repeat steps 1-3
7.Check if the cursor is in the first form field (it should)

Sponsored by Catalyst IT
Comment 8 Catherine 2021-01-19 20:40:14 UTC
Created attachment 115353 [details] [review]
Bug 27457: Set focus for cursor to Debit type code field

Test Plan:
1.Click administration
2.Click debit types
3.Click new debit type
4.Check if the cursor is in the first form field (it shouldn't)
5.Add patch
6.Repeat steps 1-3
7.Check if the cursor is in the first form field (it should)
Comment 9 Catherine 2021-01-19 20:42:36 UTC
Created attachment 115354 [details] [review]
Bug 27457: Set focus for cursor to Debit type code field

Test Plan:
1.Click administration
2.Click debit types
3.Click new debit type
4.Check if the cursor is in the first form field (it shouldn't)
5.Add patch
6.Repeat steps 1-3
7.Check if the cursor is in the first form field (it should)

Sponsored by Catalyst IT
Comment 10 Katrin Fischer 2021-01-19 23:05:27 UTC
Hi Catherine and Mazen,

could you please take a look at the solution from bug 27192 I posted in the first comment? I think this should work here too and will not require additional Javascript, just adding a class to the input element.
Comment 11 Catherine 2021-01-20 21:26:58 UTC
Created attachment 115461 [details] [review]
Bug 27457: Set focus for cursor to Debit type code field

Test Plan:
1.Click administration
2.Click debit types
3.Click new debit type
4.Check if the cursor is in the first form field (it shouldn't)
5.Add patch
6.Repeat steps 1-3
7.Check if the cursor is in the first form field (it should)

Sponsored by Catalyst IT
Comment 12 PTFS Europe Sandboxes 2021-01-20 23:24:51 UTC
Created attachment 115478 [details] [review]
Bug 27457: Set focus for cursor to Debit type code field

Test Plan:
1.Click administration
2.Click debit types
3.Click new debit type
4.Check if the cursor is in the first form field (it shouldn't)
5.Add patch
6.Repeat steps 1-3
7.Check if the cursor is in the first form field (it should)

Sponsored by Catalyst IT

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Comment 13 Martin Renvoize 2021-01-21 10:11:49 UTC
Created attachment 115518 [details] [review]
Bug 27457: Set focus for cursor to Debit type code field

Test Plan:
1.Click administration
2.Click debit types
3.Click new debit type
4.Check if the cursor is in the first form field (it shouldn't)
5.Add patch
6.Repeat steps 1-3
7.Check if the cursor is in the first form field (it should)

Sponsored by Catalyst IT
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2021-01-21 10:12:10 UTC
Excellent work everyone, thanks.

Passing QA
Comment 15 Jonathan Druart 2021-01-21 15:25:38 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 16 Fridolin Somers 2021-01-25 15:30:02 UTC
Pushed to 20.11.x for 20.11.03
Comment 17 Andrew Fuerste-Henry 2021-02-03 21:45:57 UTC
Pushed to 20.05.x for 20.05.09
Comment 18 Victor Grousset/tuxayo 2021-02-03 22:50:38 UTC
Backported: Pushed to 19.11.x branch for 19.11.15