Fix of Serial Flag in "Enter new Notes" Javascript
Posted: Wed Dec 17, 2014 11:17 am
When entering a Serialnumber in the "Enter new Notes" you get a little Flag left to the Serial Field. Its Javascript from insertbills_lib.js,
when you Entering a Europa E Note the Flag of Slovakia will loaded. But Europa Bills with E are from France.
The setSerialIMG() function of insertbills_lib.js is not updatet to europa-series. So I tried:
What it do: The new Letters of Europa Serials are merged in to the list. Maybe Poland and UK gifs are not the right filenames, couldn't check it. For the Letters D,E,H,R it will checked if the second Character in the Serial-String has an ASCII-Code above 57 (over the numberblock). When it is, its a europe note. When not, there is a check if there is a second Character, and then its the old system.
Example: type "F" get Malta, type "E" get nothing, type "E3" get Slovakia, type "EH" get France.
I hope someone find this helpfull and have the time to overwrite the old setSerialIMG.
Maybe I can fix the setShortcodeIMG too, but this need a lot more Changes in the Code. But not as Much, the trick maybe is that this function loads the Shortcode flag too. Because it's always the same row, it is easy to set it.
when you Entering a Europa E Note the Flag of Slovakia will loaded. But Europa Bills with E are from France.
The setSerialIMG() function of insertbills_lib.js is not updatet to europa-series. So I tried:
Code: Select all
function setSerialIMG(input, row) {
var serial = input.value.toUpperCase();
var flagURL;
var URL_prefix = '/img/flags/';
switch(serial.charAt(0)) {
case 'F': flagURL='Malta.gif'; break;
case 'G': flagURL='Cyprus.gif'; break;
case 'J': flagURL='UnitedKingdom.gif'; break;
case 'L': flagURL='Finland.gif'; break;
case 'M': flagURL='Portugal.gif'; break;
case 'N': flagURL='Austria.gif'; break;
case 'P': flagURL='Netherlands.gif'; break;
case 'S': flagURL='Italy.gif'; break;
case 'T': flagURL='Ireland.gif'; break;
case 'U': flagURL='France.gif'; break;
case 'V': flagURL='Spain.gif'; break;
case 'W': flagURL='Germany.gif'; break;
case 'X': flagURL='Germany.gif'; break;
case 'Y': flagURL='Greece.gif'; break;
case 'Z': flagURL='Belgium.gif'; break;
default: flagURL = '';
}
if (
(serial.charAt(0)=="D") ||
(serial.charAt(0)=="E") ||
(serial.charAt(0)=="H") ||
(serial.charAt(0)=="R")) {
if (serial.charCodeAt(1)>57){
switch(serial.charAt(0)){
case 'D': flagURL='Poland.gif'; break;
case 'E': flagURL='France.gif'; break;
case 'H': flagURL='UnitedKingdom.gif'; break;
case 'R': flagURL='Germany.gif'; break;
}
} else if (serial.length>1){
switch(serial.charAt(0)){
case 'D': flagURL='Estonia.gif'; break;
case 'E': flagURL='Slovakia.gif'; break;
case 'H': flagURL='Slovenia'; break;
case 'R': flagURL='Luxembourg.gif'; break;
}
}
}
if (flagURL != '') {
YAHOO.util.Dom.get('img_serial'+row).src = URL_prefix + flagURL;
YAHOO.util.Dom.get('img_serial'+row).style.visibility = 'visible';
}
else {
YAHOO.util.Dom.get('img_serial'+row).style.visibility = 'hidden';
}
}
Example: type "F" get Malta, type "E" get nothing, type "E3" get Slovakia, type "EH" get France.
I hope someone find this helpfull and have the time to overwrite the old setSerialIMG.
Maybe I can fix the setShortcodeIMG too, but this need a lot more Changes in the Code. But not as Much, the trick maybe is that this function loads the Shortcode flag too. Because it's always the same row, it is easy to set it.