Fix of Serial Flag in "Enter new Notes" Javascript

Concerns? Let us know by posting here.

Moderators: avij, Phaseolus, Fons, dserrano5

Post Reply
dirk81
Euro-Newbie
Euro-Newbie
Posts: 46
Joined: Thu Aug 23, 2012 3:39 pm

Fix of Serial Flag in "Enter new Notes" Javascript

Post 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.
dirk81
Euro-Newbie
Euro-Newbie
Posts: 46
Joined: Thu Aug 23, 2012 3:39 pm

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

Post 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)
Last edited by dirk81 on Thu Dec 18, 2014 9:35 am, edited 1 time in total.
portaonze
Euro-Master in Training
Euro-Master in Training
Posts: 830
Joined: Fri Sep 21, 2012 6:33 pm

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

Post 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.
dirk81
Euro-Newbie
Euro-Newbie
Posts: 46
Joined: Thu Aug 23, 2012 3:39 pm

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

Post 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.
User avatar
lmviterbo
Euro-Master
Euro-Master
Posts: 6518
Joined: Thu Aug 21, 2003 5:23 pm
Location: Lisboa, Portugal
Contact:

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

Post 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.
MDeen
Euro-Master
Euro-Master
Posts: 2038
Joined: Mon Jul 15, 2002 11:52 am
Location: Helden, The Netherlands
Contact:

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

Post 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".
User avatar
Vunono
Euro-Expert in Training
Euro-Expert in Training
Posts: 304
Joined: Thu Nov 05, 2015 2:08 pm
Location: Cádiz, España

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

Post 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:
User avatar
Fons
Forum Moderator
Forum Moderator
Posts: 14701
Joined: Sat Oct 19, 2002 12:14 am
Location: Netherlands

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

Post by Fons »

Is it possiblie to fix this issue by showing the flag after the first TWO digits of the serial number are typed?
User avatar
Vunono
Euro-Expert in Training
Euro-Expert in Training
Posts: 304
Joined: Thu Nov 05, 2015 2:08 pm
Location: Cádiz, España

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

Post 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!
User avatar
Vunono
Euro-Expert in Training
Euro-Expert in Training
Posts: 304
Joined: Thu Nov 05, 2015 2:08 pm
Location: Cádiz, España

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

Post 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!
User avatar
LArdennais
Euro-Master
Euro-Master
Posts: 13684
Joined: Sat Jun 12, 2010 11:58 am
Location: Quelque part en Ardenne profonde...

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

Post 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: ... :|
http://liste.eurobillets.free.fr/ : don't miss it every day ! à zieuter tous les jours ! kijk elke dag ! :D

https://play.google.com/store/apps/deta ... =fr&gl=US] : A utiliser sans modération ! :)
Post Reply

Return to “Feedback and Development”