Fix of Serial Flag in "Enter new Notes" Javascript

Concerns? Let us know by posting here.

Moderators: Fons, avij, Phaseolus, dserrano5

dirk81
Euro-Newbie
Euro-Newbie
Posts: 43
Joined: Thu Aug 23, 2012 3:39 pm

Fix of Serial Flag in "Enter new Notes" Javascript

Postby dirk81 » 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:

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: 43
Joined: Thu Aug 23, 2012 3:39 pm

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

Postby dirk81 » Wed Dec 17, 2014 11:54 am

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.

User avatar
portaonze
Euro-Expert
Euro-Expert
Posts: 743
Joined: Fri Sep 21, 2012 6:33 pm

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

Postby portaonze » Wed Dec 17, 2014 2:57 pm

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: 43
Joined: Thu Aug 23, 2012 3:39 pm

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

Postby dirk81 » Wed Dec 17, 2014 3:49 pm

I can Confirm the Notes Statistics bug. On http://de.eurobilltracker.com/my_notes/?tab=1 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: 4188
Joined: Thu Aug 21, 2003 5:23 pm
Location: Lisboa, Portugal
Contact:

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

Postby lmviterbo » Sat Mar 07, 2015 2:44 am

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: 1759
Joined: Mon Jul 15, 2002 11:52 am
Location: Helden, The Netherlands
Contact:

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

Postby MDeen » Tue Mar 10, 2015 8:39 am

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-Regular in Training
Euro-Regular in Training
Posts: 124
Joined: Thu Nov 05, 2015 2:08 pm
Location: Ceuta, España

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

Postby Vunono » Tue Feb 16, 2016 7:11 pm

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: 14530
Joined: Sat Oct 19, 2002 12:14 am
Location: Werkendam, Netherlands

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

Postby Fons » Thu Apr 21, 2016 10:46 pm

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-Regular in Training
Euro-Regular in Training
Posts: 124
Joined: Thu Nov 05, 2015 2:08 pm
Location: Ceuta, España

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

Postby Vunono » Sun Feb 26, 2017 11:19 pm

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-Regular in Training
Euro-Regular in Training
Posts: 124
Joined: Thu Nov 05, 2015 2:08 pm
Location: Ceuta, España

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

Postby Vunono » Tue Aug 08, 2017 1:08 am

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: 12130
Joined: Sat Jun 12, 2010 11:58 am
Location: perdu dans le Condroz belge

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

Postby LArdennais » Tue Aug 08, 2017 11:17 am

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


Return to “Feedback and Development”