Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0014422Openbravo ERPA. Platformpublic2010-09-03 13:142010-10-19 00:00
dbaz 
iperdomo 
highmajoralways
closedfixed 
20Kubuntu 8.10
 
 
Core
No
0014422: Strange code in F.getFormat in DynamicJS (related to number formatting)
At the end of DynamicJS.js (loaded in the menu) there are the mechanism to translate a maskName (of the ones defined in Format.xml) to its maskFormat

The function is

var F = {"formats":
  [
    {"name":"generalQtyEdition","output":"#0.######"},
    {"name":"qtyEdition","output":"#0.###"},
    {"name":"euroEdition","output":"#0.00"},
    {"name":"generalQtyRelation","output":"#,##0.######"},
    {"name":"priceEdition","output":"#0.00"},
    {"name":"priceExcel","output":"#,##0.##"},
    {"name":"euroRelation","output":"#,##0.00"},
    {"name":"generalQtyExcel","output":"#,##0.######"},
    {"name":"qtyExcel","output":"#,##0.###"},
    {"name":"amountInform","output":"#,##0.00"},
    {"name":"integerRelation","output":"#,##0"},
    {"name":"integerExcel","output":"#,##0"},
    {"name":"euroInform","output":"#,##0.00"},
    {"name":"integerEdition","output":"#0"},
    {"name":"priceRelation","output":"#,##0.00"},
    {"name":"qtyRelation","output":"#,##0.###"},
    {"name":"euroExcel","output":"#,##0.##"},
    {"name":"priceInform","output":"#,##0.##"},
    {"name":"integerInform","output":"#,##0"}
  ]
};
F.getFormat=function(name)
  if(typeof name==='undefined'||name==='') {
    return'qtyEdition';
  }
  for(var i=0;i<this.formats.length;i++){
    if(this.formats[i].name===name){
      return this.formats[i].output;
    }
  }
  return'qtyEdtion';
}


The strange points are the in the validation statements of the F.getFormat function:
* The return'qtyEdition'; -> an space is missing (but not crucial). Also it seems to be the wrong return (see third point).
* The return'qtyEdtion'; -> an space is missing (but not crucial) but also there is a typo and an "i" is missing. Also it seems to be the wrong return (see third point).
* This function pretends to return something like "#0.###" or whatever (depending of the name given as input)... and it seems that when name is not declared or it can not find anything, it is going to return the string "qtyEdition" or "qtyEdtion" respectively which it seems to be wrong... it should be something like:
return F.getFormat('qtyEdition');
in both cases
No tags attached.
Issue History
2010-09-03 13:14dbazNew Issue
2010-09-03 13:14dbazAssigned To => iperdomo
2010-09-06 08:10alostaleStatusnew => scheduled
2010-10-11 11:03hgbotCheckin
2010-10-11 11:03hgbotNote Added: 0031743
2010-10-11 11:03hgbotStatusscheduled => resolved
2010-10-11 11:03hgbotResolutionopen => fixed
2010-10-11 11:03hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/adbb4479b500e9f962765b80ac9874e25bcd987a [^]
2010-10-11 18:48hudsonbotCheckin
2010-10-11 18:48hudsonbotNote Added: 0031766
2010-10-18 17:57dbazStatusresolved => closed
2010-10-19 00:00anonymoussf_bug_id0 => 3090005

Notes
(0031743)
hgbot   
2010-10-11 11:03   
Repository: erp/devel/pi
Changeset: adbb4479b500e9f962765b80ac9874e25bcd987a
Author: Iván Perdomo <ivan.perdomo <at> openbravo.com>
Date: Thu Oct 07 12:06:37 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/adbb4479b500e9f962765b80ac9874e25bcd987a [^]

Fixes issue 14422: Fixed getFormat function when returning default values

---
M src/org/openbravo/erpCommon/utility/DynamicJS.java
---
(0031766)
hudsonbot   
2010-10-11 18:48   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/adbb4479b500 [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/0b4e4ae24456 [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.18512.obx [^]