bugs solved

This commit is contained in:
Guillermo Bonet 2022-07-27 11:10:13 +02:00
parent 706ca350ed
commit 510ca913da
2 changed files with 40 additions and 37 deletions

View File

@ -1,8 +1,8 @@
#define MyAppName "Verdnatura" #define MyAppName "Verdnatura"
#define MyAppVersion "3" #define MyAppVersion "4"
#define MyAppPublisher "Verdnatura" #define MyAppPublisher "Verdnatura"
#define MyAppURL "http://www.verdnatura.es/" #define MyAppURL "https://www.verdnatura.es/"
[Setup] [Setup]
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.

View File

@ -129,6 +129,9 @@ var App = {
var password = this.regRead(Conf.dsPath, 'PWD'); var password = this.regRead(Conf.dsPath, 'PWD');
var remember = this.regRead(Conf.regPath, 'remember'); var remember = this.regRead(Conf.regPath, 'remember');
this.$('branch').value = this.getBranch();
this.onChangeBranchChange();
if (user) if (user)
this.$('user').value = user; this.$('user').value = user;
@ -138,9 +141,6 @@ var App = {
this.onEnterClick(); this.onEnterClick();
} else } else
this.resetForm(true); this.resetForm(true);
this.$('branch').value = this.getBranch();
this.onChangeBranchChange();
}, },
resetForm: function(clearPassword) { resetForm: function(clearPassword) {
@ -205,7 +205,6 @@ var App = {
} catch (e) {} } catch (e) {}
} }
} }
this.showMessage(_('Cache files have been deleted'), 'notice'); this.showMessage(_('Cache files have been deleted'), 'notice');
}, },
@ -361,22 +360,11 @@ var App = {
// Obtains the local version number from the MDB file // Obtains the local version number from the MDB file
var localVersion; var localVersion = this.mdbGetValue(
'SELECT Version FROM tblVariables',
try { 'Version', parseInt
var mdbConn = new ActiveXObject('ADODB.Connection'); );
mdbConn.open(this.getOdbcString({ if (!localVersion) localVersion = false;
'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 // Determines if should download
@ -385,6 +373,31 @@ var App = {
: null; : 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) { getOdbcString: function(options) {
var optionsArray = []; var optionsArray = [];
for (var option in options) for (var option in options)
@ -559,21 +572,11 @@ var App = {
* @return {string} Branch name, master if cannot * @return {string} Branch name, master if cannot
*/ */
getBranch: function() { getBranch: function() {
var branch = Conf.defaultBranch; var branch = this.mdbGetValue(
try { 'SELECT branch FROM tblVariables',
var mdbConn = new ActiveXObject('ADODB.Connection'); 'branch', String
mdbConn.open(this.getOdbcString({ );
'Provider': 'Microsoft.Jet.OLEDB.4.0', return branch || Conf.defaultBranch;
'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;
} }
}; };