bugs solved
This commit is contained in:
parent
706ca350ed
commit
510ca913da
|
@ -1,8 +1,8 @@
|
|||
|
||||
#define MyAppName "Verdnatura"
|
||||
#define MyAppVersion "3"
|
||||
#define MyAppVersion "4"
|
||||
#define MyAppPublisher "Verdnatura"
|
||||
#define MyAppURL "http://www.verdnatura.es/"
|
||||
#define MyAppURL "https://www.verdnatura.es/"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application.
|
||||
|
|
73
src/main.js
73
src/main.js
|
@ -129,6 +129,9 @@ var App = {
|
|||
var password = this.regRead(Conf.dsPath, 'PWD');
|
||||
var remember = this.regRead(Conf.regPath, 'remember');
|
||||
|
||||
this.$('branch').value = this.getBranch();
|
||||
this.onChangeBranchChange();
|
||||
|
||||
if (user)
|
||||
this.$('user').value = user;
|
||||
|
||||
|
@ -138,9 +141,6 @@ var App = {
|
|||
this.onEnterClick();
|
||||
} else
|
||||
this.resetForm(true);
|
||||
|
||||
this.$('branch').value = this.getBranch();
|
||||
this.onChangeBranchChange();
|
||||
},
|
||||
|
||||
resetForm: function(clearPassword) {
|
||||
|
@ -205,7 +205,6 @@ var App = {
|
|||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
this.showMessage(_('Cache files have been deleted'), 'notice');
|
||||
},
|
||||
|
||||
|
@ -361,23 +360,12 @@ var App = {
|
|||
|
||||
// Obtains the local version number from the MDB file
|
||||
|
||||
var localVersion;
|
||||
var localVersion = this.mdbGetValue(
|
||||
'SELECT Version FROM tblVariables',
|
||||
'Version', parseInt
|
||||
);
|
||||
if (!localVersion) localVersion = false;
|
||||
|
||||
try {
|
||||
var mdbConn = new ActiveXObject('ADODB.Connection');
|
||||
mdbConn.open(this.getOdbcString({
|
||||
'Provider': 'Microsoft.Jet.OLEDB.4.0',
|
||||
'Data Source': this.mdbFile
|
||||
}));
|
||||
|
||||
var oRs = new ActiveXObject('ADODB.Recordset');
|
||||
oRs.Open('SELECT Version FROM tblVariables', mdbConn);
|
||||
localVersion = oRs.EOF ? false : parseInt(oRs('Version'));
|
||||
|
||||
oRs.close();
|
||||
mdbConn.close();
|
||||
} catch (e) {}
|
||||
|
||||
// Determines if should download
|
||||
|
||||
return !localVersion || version === false || localVersion != version
|
||||
|
@ -385,6 +373,31 @@ var App = {
|
|||
: null;
|
||||
},
|
||||
|
||||
mdbGetValue: function(query, field, parseFn) {
|
||||
var value;
|
||||
|
||||
try {
|
||||
if (this.fso.fileExists(this.mdbFile)) {
|
||||
var mdbConn = new ActiveXObject('ADODB.Connection');
|
||||
mdbConn.open(this.getOdbcString({
|
||||
'Provider': 'Microsoft.Jet.OLEDB.4.0',
|
||||
'Data Source': this.mdbFile
|
||||
}));
|
||||
|
||||
try {
|
||||
var rs = new ActiveXObject('ADODB.Recordset');
|
||||
rs.Open(query, mdbConn);
|
||||
value = rs.EOF ? null : parseFn(rs(field));
|
||||
rs.close();
|
||||
} catch (e) {}
|
||||
|
||||
mdbConn.close();
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
getOdbcString: function(options) {
|
||||
var optionsArray = [];
|
||||
for (var option in options)
|
||||
|
@ -559,21 +572,11 @@ var App = {
|
|||
* @return {string} Branch name, master if cannot
|
||||
*/
|
||||
getBranch: function() {
|
||||
var branch = Conf.defaultBranch;
|
||||
try {
|
||||
var mdbConn = new ActiveXObject('ADODB.Connection');
|
||||
mdbConn.open(this.getOdbcString({
|
||||
'Provider': 'Microsoft.Jet.OLEDB.4.0',
|
||||
'Data Source': this.mdbFile
|
||||
}));
|
||||
|
||||
var rs = new ActiveXObject('ADODB.Recordset');
|
||||
rs.Open('SELECT branch FROM tblVariables', mdbConn);
|
||||
branch = String(rs('branch'));
|
||||
rs.close();
|
||||
mdbConn.close();
|
||||
} catch (e) {}
|
||||
return branch;
|
||||
var branch = this.mdbGetValue(
|
||||
'SELECT branch FROM tblVariables',
|
||||
'branch', String
|
||||
);
|
||||
return branch || Conf.defaultBranch;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue