Bug 28940 - IntranetUserJS is called twice on spinelable-print.tt
Summary: IntranetUserJS is called twice on spinelable-print.tt
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-01 18:59 UTC by Lucas Gass
Modified: 2021-09-13 17:59 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


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

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>