Ahora se instalan los archivos de fuentes necesarios y se crea el ODBC de PosgreSQL
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 264 KiB |
|
@ -1,13 +1,12 @@
|
|||
|
||||
#define MyAppName "Verdnatura"
|
||||
#define MyAppVersion "1.0"
|
||||
#define MyAppVersion "1.1"
|
||||
#define MyAppPublisher "Verdnatura"
|
||||
#define MyAppURL "http://www.verdnatura.es/"
|
||||
#define MyAppExeName "setup.exe"
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application.
|
||||
AppId={{7615F2D0-AB26-4EB0-948C-BBB2CE1151D7}
|
||||
AppId={{1BFBC7A1-64B3-41E0-8A8E-0D29043EA8A3}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppVerName={#MyAppName} {#MyAppVersion}
|
||||
|
@ -19,7 +18,8 @@ CreateAppDir=yes
|
|||
DefaultDirName={pf}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
;LicenseFile=src\LICENSE.txt
|
||||
SetupIconFile=src\icon.ico
|
||||
SetupIconFile=src\logo.ico
|
||||
UninstallDisplayIcon={app}\logo.ico
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
PrivilegesRequired=admin
|
||||
|
@ -42,9 +42,11 @@ Name: "{sd}\fotos"; \
|
|||
[Files]
|
||||
Source: "src\*"; \
|
||||
DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "src\icons\*"; \
|
||||
Source: "icons\*"; \
|
||||
DestDir: "{app}\icons"; Flags: ignoreversion
|
||||
Source: "src\barcodex.ocx"; \
|
||||
Source: "fonts\*"; \
|
||||
DestDir: "{fonts}"; Flags: onlyifdoesntexist uninsneveruninstall
|
||||
Source: "ocx\*"; \
|
||||
DestDir: {sys}; Flags: onlyifdoesntexist regserver 32bit
|
||||
|
||||
[Tasks]
|
||||
|
@ -55,13 +57,13 @@ Name: "desktopicon"; \
|
|||
[Components]
|
||||
Name: "tpv"; \
|
||||
Description: "Terminal Punto Venta"; \
|
||||
Types: full compact custom
|
||||
Types: full compact
|
||||
Name: "ent"; \
|
||||
Description: "Entradas"; \
|
||||
Types: full compact custom
|
||||
Types: full compact
|
||||
Name: "com"; \
|
||||
Description: "Comparativa"; \
|
||||
Types: full compact custom
|
||||
Types: full compact
|
||||
Name: "enc"; \
|
||||
Description: "Encajado"; \
|
||||
Types: full
|
||||
|
|
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
66
src/main.js
|
@ -13,9 +13,10 @@ var App =
|
|||
{
|
||||
appName: 'Verdnatura',
|
||||
dsName: 'verdnatura',
|
||||
dsPath: 'HKCU\\Software\\ODBC\\ODBC.INI\\verdnatura',
|
||||
regPath: 'HKCU\\Software\\Verdnatura',
|
||||
odbcPath: 'HKCU\\Software\\ODBC\\ODBC.INI\\verdnatura',
|
||||
remoteUrl: 'https://www.verdnatura.es/download',
|
||||
dbHost: 'db.verdnatura.es',
|
||||
|
||||
shell: new ActiveXObject ('WScript.Shell'),
|
||||
fso: new ActiveXObject ('scripting.filesystemobject'),
|
||||
|
@ -68,30 +69,56 @@ var App =
|
|||
this.regWrite (path, 'Level', 1, 'REG_DWORD');
|
||||
|
||||
// Crea el ODBC de MySQL
|
||||
|
||||
var dsDriverPath = this.getEnv ('ProgramFiles')
|
||||
|
||||
var driverPath = this.getEnv ('ProgramFiles')
|
||||
+'\\MySQL\\Connector ODBC 5.1\\myodbc5.dll';
|
||||
|
||||
this.regWrites (this.odbcPath, 'REG_SZ', {
|
||||
'Driver' : dsDriverPath,
|
||||
|
||||
var params = {
|
||||
'Driver' : driverPath,
|
||||
'DESCRIPTION' : this.appName,
|
||||
'SERVER' : 'db.verdnatura.es',
|
||||
'SERVER' : this.dbHost,
|
||||
'DATABASE' : 'vn2008',
|
||||
'SSLCA' : this.appDir +'\\cacert.pem',
|
||||
'SSLVERIFY' : 1,
|
||||
'AUTO_RECONNECT' : 1
|
||||
});
|
||||
};
|
||||
|
||||
this.createOdbc (
|
||||
this.dsName,
|
||||
'Mysql ODBC 5.1 Driver',
|
||||
params
|
||||
);
|
||||
|
||||
// Crea el ODBC de PosgreSQL
|
||||
|
||||
var driverPath = this.getEnv ('ProgramFiles')
|
||||
+'\\psqlODBC\\0804\\bin\\psqlodbc35w.dll';
|
||||
|
||||
path = 'HKCU\\Software\\ODBC\\ODBC.INI\\ODBC Data Sources';
|
||||
this.regWrite (path, this.dsName, 'Mysql ODBC 5.1 Driver', 'REG_SZ');
|
||||
var params = {
|
||||
'Driver' : driverPath,
|
||||
'DESCRIPTION' : this.appName,
|
||||
'Servername' : this.dbHost,
|
||||
'DATABASE' : 'vn',
|
||||
'UID' : '',
|
||||
'USERNAME' : '',
|
||||
'PASSWORD' : ''
|
||||
};
|
||||
|
||||
this.createOdbc (
|
||||
'verdnaturapg',
|
||||
'PostgreSQL Unicode',
|
||||
params
|
||||
);
|
||||
|
||||
// Marca la aplicación como configurada
|
||||
|
||||
this.regWrite (this.regPath, 'configured', 1, 'REG_DWORD');
|
||||
}
|
||||
|
||||
// Carga los datos del formulario
|
||||
|
||||
var user = this.regRead (this.odbcPath, 'UID');
|
||||
var password = this.regRead (this.odbcPath, 'PWD');
|
||||
var user = this.regRead (this.dsPath, 'UID');
|
||||
var password = this.regRead (this.dsPath, 'PWD');
|
||||
var remember = this.regRead (this.regPath, 'remember');
|
||||
|
||||
if (user)
|
||||
|
@ -106,6 +133,15 @@ var App =
|
|||
else
|
||||
this.reset ();
|
||||
},
|
||||
|
||||
createOdbc: function (dsName, driverName, params)
|
||||
{
|
||||
var odbcPath = 'HKCU\\Software\\ODBC\\ODBC.INI\\';
|
||||
|
||||
this.regWrites (odbcPath + dsName, 'REG_SZ', params);
|
||||
this.regWrite (odbcPath + 'ODBC Data Sources',
|
||||
dsName, driverName, 'REG_SZ');
|
||||
},
|
||||
|
||||
reset: function ()
|
||||
{
|
||||
|
@ -163,8 +199,8 @@ var App =
|
|||
if (!password || password === '')
|
||||
throw new Error ('Introduce una contraseña');
|
||||
|
||||
this.regWrite (this.odbcPath, 'UID', user, 'REG_SZ');
|
||||
this.regWrite (this.odbcPath, 'PWD', password, 'REG_SZ');
|
||||
this.regWrite (this.dsPath, 'UID', user, 'REG_SZ');
|
||||
this.regWrite (this.dsPath, 'PWD', password, 'REG_SZ');
|
||||
|
||||
// Obtiene la última versión usando la conexión ODBC de MySQL
|
||||
|
||||
|
@ -216,7 +252,7 @@ var App =
|
|||
}
|
||||
catch (e)
|
||||
{
|
||||
//this.regWrite (this.odbcPath, 'PWD', '', 'REG_SZ');
|
||||
//this.regWrite (this.dsPath, 'PWD', '', 'REG_SZ');
|
||||
this._disableUi (false);
|
||||
this.reset ();
|
||||
this.showMessage (e.message);
|
||||
|
|