Bug 28940 - IntranetUserJS is called twice on spinelable-print.tt
Summary: IntranetUserJS is called twice on spinelable-print.tt
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-01 18:59 UTC by Lucas Gass
Modified: 2022-06-06 20:25 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.05,20.11.11


Attachments
Bug 28940: In spinelabel-print.tt call IntranetUserJS only once (1.42 KB, patch)
2021-09-01 19:20 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 28940: In spinelabel-print.tt call IntranetUserJS only once (1.49 KB, patch)
2021-09-13 17:59 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28940: In spinelabel-print.tt call IntranetUserJS only once (1.55 KB, patch)
2021-09-26 11:48 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2021-09-01 18:59:24 UTC
TO recreate:

Add some IntranetUserJS that will target spinelabel-print.tt. I added this:

if ( $('#labels_spinelabel-print').length ) {
  $('#labels_spinelabel-print').append('<div>TEST</div>');
  console.log('TEST');
}

Try to do a quick spine label. Once you have entered a barcode the JS will go off 2x. With the jQuery added you will see 2 div's with the word 'TEST'.

Look at the console and you will also see TEST console logged 2x.
Comment 1 Lucas Gass 2021-09-01 19:20:25 UTC
Created attachment 124415 [details] [review]
Bug 28940: In spinelabel-print.tt call IntranetUserJS only once

1. In IntranetUser add some JS that will target spinelabel-print.tt, I used this:
    if ( $('#labels_spinelabel-print').length ) {
      $('#labels_spinelabel-print').append('<div>TEST</div>');
      console.log('TEST');
    }
2. Generate a quick spine label
3. Once you have entered a barcode the JS will go off 2x. With the jQuery added you will see 2 div's with the word 'TEST'. Look at the console and you will also see TEST console logged 2x.
4. Apply patch
5. Try seto 2 and 3 again, the JS should only be called once.
Comment 2 Andrew Fuerste-Henry 2021-09-13 17:59:20 UTC
Created attachment 124843 [details] [review]
Bug 28940: In spinelabel-print.tt call IntranetUserJS only once

1. In IntranetUser add some JS that will target spinelabel-print.tt, I used this:
    if ( $('#labels_spinelabel-print').length ) {
      $('#labels_spinelabel-print').append('<div>TEST</div>');
      console.log('TEST');
    }
2. Generate a quick spine label
3. Once you have entered a barcode the JS will go off 2x. With the jQuery added you will see 2 div's with the word 'TEST'. Look at the console and you will also see TEST console logged 2x.
4. Apply patch
5. Try seto 2 and 3 again, the JS should only be called once.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 3 Katrin Fischer 2021-09-26 11:48:53 UTC
Created attachment 125320 [details] [review]
Bug 28940: In spinelabel-print.tt call IntranetUserJS only once

1. In IntranetUser add some JS that will target spinelabel-print.tt, I used this:
    if ( $('#labels_spinelabel-print').length ) {
      $('#labels_spinelabel-print').append('<div>TEST</div>');
      console.log('TEST');
    }
2. Generate a quick spine label
3. Once you have entered a barcode the JS will go off 2x. With the jQuery added you will see 2 div's with the word 'TEST'. Look at the console and you will also see TEST console logged 2x.
4. Apply patch
5. Try seto 2 and 3 again, the JS should only be called once.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Jonathan Druart 2021-09-28 13:38:51 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 5 Kyle M Hall 2021-10-08 13:18:40 UTC
Pushed to 21.05.x for 21.05.05
Comment 6 Fridolin Somers 2021-10-21 03:19:49 UTC
Pushed to 20.11.x for 20.11.11
Comment 7 Victor Grousset/tuxayo 2021-10-26 00:37:34 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.