Page 1 of 1

Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Wed Dec 17, 2014 11:17 am
by dirk81
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:

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';
	}
}
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.

Re: Fix of Serial Flag in "Enter new Notes" Javascript AND S

Posted: Wed Dec 17, 2014 11:54 am
by dirk81
Okay, I wanted to code. Here a Solution for a fix with shortcode Flag too:

Code: Select all

function setSerialIMG(input, row) {
	var serial = input.value.toUpperCase();
	var flagURL;
	var scflagURL;
	var europaseries=false;
	var URL_prefix = '/img/flags/';
	switch(serial.charAt(0)) {
		case 'F': flagURL='Malta.gif'; break;
		case 'G': flagURL='Cyprus.gif'; break;
		case 'J': flagURL='United Kingdom.gif';europaseries=true; 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';europaseries=true; break;
		case 'X': flagURL='Germany.gif'; break;		
		case 'Y': flagURL='Greece.gif'; break;
		case 'Z': flagURL='Belgium.gif'; break;
		default: flagURL = '';
		
	}

  
		if (serial.charCodeAt(1)>57){
europaseries=true; 
			switch(serial.charAt(0)){
				case 'D': flagURL='Poland.gif';break;
				case 'E': flagURL='France.gif'; break;
				case 'H': flagURL='United Kingdom.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';
	}
	//Shortcodeflag
	if (serial.length>1){
		var shortcode=YAHOO.util.Dom.get('my_shortcode'+row).value.toUpperCase();
		if (shortcode.length>0){
			shortcode=shortcode.charAt(0);
		}
		if (!europaseries){
			switch(shortcode.charAt(0)) {
				case 'D': scflagURL='Finland.gif'; break;
				case 'E': scflagURL='France.gif'; break;
				case 'L': scflagURL='France.gif'; break;
				case 'F': scflagURL='Austria.gif'; break;
				case 'G': scflagURL='Netherlands.gif'; break;
				case 'H': scflagURL='United Kingdom.gif'; break;
				case 'J': scflagURL='Italy.gif'; break;
				case 'K': scflagURL='Ireland.gif'; break;
				case 'M': scflagURL='Spain.gif'; break;
				case 'N': scflagURL='Greece.gif'; break;
				case 'P': scflagURL='Germany.gif'; break;
				case 'R': scflagURL='Germany.gif'; break;
				case 'T': scflagURL='Belgium.gif'; break;
				case 'U': scflagURL='Portugal.gif'; break;
			}
		} else{
			scflagURL=flagURL;
		}
	}
	if (scflagURL != '') {
		YAHOO.util.Dom.get('img_shortcode'+row).src = URL_prefix + scflagURL;
		YAHOO.util.Dom.get('img_shortcode'+row).style.visibility = 'visible';
	}
	else {
		YAHOO.util.Dom.get('img_shortcode'+row).style.visibility = 'hidden';
	}
}
Update: 18.12: Removed a if, because all notes must be checked if europe to get correct shortcode

Because I can't test, it need testing. what it is does:
Have a variable called europaseries, is false or get true if it is a new Letter or checked there is a second letter after the first.
Check serials lentghs longer then 1, loads the shortcode entered value. Check the lenght
When Europaseries is false, get the old shortcode table, else get the same flag from serial (because europaseries shortcode is the Letter the same as serial)

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Wed Dec 17, 2014 2:57 pm
by portaonze
I was just going to point out this same bug.
I have entered a few :note-10: E/E and noticed that the flag displayed is :flag-sk:, not :flag-fr: .
Also on my statistics page, :note-10: E/E :flag-fr: notes are counted as Slovakian notes.

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Wed Dec 17, 2014 3:49 pm
by dirk81
I can Confirm the Notes Statistics bug. On http://de.eurobilltracker.com/my_notes/?tab=1" onclick="window.open(this.href);return false; Ive got 10 :flag-sk: Notes, but in truth I found 2 :flag-sk: :note-20: and have 7 :note-10: :flag-fr:

Onfortunatly this has nothing to do with my javascript fixing.

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Sat Mar 07, 2015 2:44 am
by lmviterbo
I have just entered a few :note-10: E/E and the flag displayed is (again? / still?) :flag-sk: instead of :flag-fr: .

I believe I have seen the French flag this year. Have I been too inattentive and in fact this was never fixed, or did the problem return?

The notes reports state correctly that these are from Oberthur but the statistics keep counting them as Slovak.

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Tue Mar 10, 2015 8:39 am
by MDeen
I don't know if this is related, but I put in a support request to delete an U/U europa :note-5: and in support request it says "The printer code is Image U006I1".

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Tue Feb 16, 2016 7:11 pm
by Vunono
lmviterbo wrote:I have just entered a few :note-10: E/E and the flag displayed is (again? / still?) :flag-sk: instead of :flag-fr: .
I think it's "still". Anyone can fix that? That bug is so annoying that I stopped looking at the country statistics since the new :note-10: arrived :roll:

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Thu Apr 21, 2016 10:46 pm
by Fons
Is it possiblie to fix this issue by showing the flag after the first TWO digits of the serial number are typed?

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Sun Feb 26, 2017 11:19 pm
by Vunono
Como on, guys! It's more than two years since this bug was reported, I'm sure there's someone out there who's able to fix it!

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Tue Aug 08, 2017 1:08 am
by Vunono
The flag is still wrong when the note is inserted, but I've just noticed that First and Europa series are now separated in the statistics. Thank you, it's much better this way!

Re: Fix of Serial Flag in "Enter new Notes" Javascript

Posted: Tue Aug 08, 2017 11:17 am
by LArdennais
Vunono wrote:
lmviterbo wrote:I have just entered a few :note-10: E/E and the flag displayed is (again? / still?) :flag-sk: instead of :flag-fr: .
I think it's "still". Anyone can fix that? That bug is so annoying that I stopped looking at the country statistics since the new :note-10: arrived :roll:
It's again "still" ... :note-10: E/E = :flag-fr: and not :flag-sk: ... :|