https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8425
--- Comment #21 from Baptiste Wojtkowski (bwoj) <[email protected]> --- (In reply to Marcel de Rooy from comment #20) > get_barcode > my $scr = qq~ > let elt = \$("#"+id); > let homebranch = elt.parents('fieldset.rows:first') > > .find('input[name="kohafield"][value="items.homebranch"]') > .siblings("select") > .val(); > > if(typeof offset == 'undefined'){ > var offset = 0; > } > if ( \$(elt).val() == '' ) { > \$(elt).val(homebranch + ($nextnum + offset)); > } > ~; > TOGETHER WITH > +function set_barcode(id, force, offset=0) { > => Default is zero. Why are we checking the type then later? Seems useless? Tbh I'm very unsecure with this part of the code and I'm unable to prove that this body is not appended to any other function without this prototype, hence to secure the behavior I prefered adding this. If there is a way to be sure this function definition will not be appended to any other prototype, then this part of the code is useless. > +if(typeof autobarcodetype == 'undefined') { > + var autobarcodetype = "$autoBarcodeType"; > + var attempt = -1; > +} > => This does not look good either? Why are we conditionally declaring vars > here? The point here is that due to the way this works, the script is imported each time you click on "add item", hence this will reset the number of attempts and so one. This is also true if you put it in a document.ready. We might use attempts as condition and only do this for attempts, it might be more understandable. > Why are we fixing this only for a specific autobarcode type? Good question, I'm on it. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
