public/javascripts/erp_app/utility.js in erp_app-3.0.6 vs public/javascripts/erp_app/utility.js in erp_app-3.0.7
- old
+ new
@@ -44,10 +44,20 @@
case Ext.form.action.Action.SERVER_INVALID:
Ext.Msg.alert('Failure', action.result.msg);
}
};
+Compass.ErpApp.Utility.randomString = function(length) {
+ var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
+ var randomString = '';
+ for (var i=0; i<length; i++) {
+ var randomNumber = Math.floor(Math.random() * chars.length);
+ randomString += chars.substring(randomNumber,randomNumber+1);
+ }
+ return randomString
+};
+
Compass.ErpApp.Utility.roundNumber = function(num) {
var twoDPString = "0.00";
if(!Compass.ErpApp.Utility.isBlank(num) && !isNaN(num)){
var dnum = Math.round(num * 100)/100;
twoDPString = dnum + "";
@@ -126,16 +136,10 @@
}
return x1 + x2;
};
Compass.ErpApp.Utility.isBlank = function(value) {
- var result = false;
-
- if(value === 'undefined' || value === undefined || value === null || value === '' || value === ' '){
- result = true;
- }
-
- return result;
+ return Ext.isEmpty(value);
};
Compass.ErpApp.Utility.removeDublicates = function(arrayName) {
var newArray = new Array();
label:for (var i = 0; i < arrayName.length; i++)