Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5334-editDepartment
This commit is contained in:
commit
d8f5978284
|
@ -24,13 +24,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Added
|
### Added
|
||||||
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
|
- (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente
|
||||||
- (Artículos -> Histórico) Filtro para mostrar lo anterior al inventario
|
- (Artículos -> Histórico) Filtro para mostrar lo anterior al inventario
|
||||||
|
- (Trabajadores -> Nuevo trabajador) Permite elegir el método de pago
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
|
- (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador'
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket
|
- (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket
|
||||||
|
- (Tickets -> Cambiar estado) Ahora muestra la lista completa de todos los estados
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
LOAD DATA LOCAL INFILE ?
|
LOAD DATA LOCAL INFILE ?
|
||||||
INTO TABLE `edi`.`item`
|
INTO TABLE `edi`.`item`
|
||||||
|
CHARACTER SET ascii
|
||||||
FIELDS TERMINATED BY ';'
|
FIELDS TERMINATED BY ';'
|
||||||
LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12)
|
LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12)
|
||||||
SET
|
SET id = @col2,
|
||||||
id = @col2,
|
|
||||||
product_name = @col4,
|
product_name = @col4,
|
||||||
name = @col5,
|
name = @col5,
|
||||||
plant_id = @col7,
|
plant_id = @col7,
|
||||||
|
@ -11,3 +11,4 @@ LOAD DATA LOCAL INFILE ?
|
||||||
entry_date = STR_TO_DATE(@col10, '%Y%m%d'),
|
entry_date = STR_TO_DATE(@col10, '%Y%m%d'),
|
||||||
expiry_date = IFNULL(NULL,STR_TO_DATE(@col11, '%Y%m%d')),
|
expiry_date = IFNULL(NULL,STR_TO_DATE(@col11, '%Y%m%d')),
|
||||||
change_date_time = STR_TO_DATE(@col12, '%Y%m%d%H%i')
|
change_date_time = STR_TO_DATE(@col12, '%Y%m%d%H%i')
|
||||||
|
|
|
@ -3,236 +3,237 @@ const path = require('path');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('updateData', {
|
Self.remoteMethodCtx('updateData', {
|
||||||
description: 'Updates schema data from external provider',
|
description: 'Updates schema data from external provider',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
returns: {
|
returns: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/updateData`,
|
path: `/updateData`,
|
||||||
verb: 'POST'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.updateData = async() => {
|
Self.updateData = async() => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
||||||
// Get files checksum
|
// Get files checksum
|
||||||
const tx = await Self.beginTransaction({});
|
const tx = await Self.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options);
|
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options);
|
||||||
|
|
||||||
const updatableFiles = [];
|
const updatableFiles = [];
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const fileChecksum = await getChecksum(file);
|
const fileChecksum = await getChecksum(file);
|
||||||
|
|
||||||
if (file.checksum != fileChecksum) {
|
if (file.checksum != fileChecksum) {
|
||||||
updatableFiles.push({
|
updatableFiles.push({
|
||||||
name: file.name,
|
name: file.name,
|
||||||
checksum: fileChecksum
|
checksum: fileChecksum
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
console.debug(`File already updated, skipping...`);
|
console.debug(`File already updated, skipping...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updatableFiles.length === 0)
|
if (updatableFiles.length === 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Download files
|
// Download files
|
||||||
const container = await models.TempContainer.container('edi');
|
const container = await models.TempContainer.container('edi');
|
||||||
const tempPath = path.join(container.client.root, container.name);
|
const tempPath = path.join(container.client.root, container.name);
|
||||||
|
|
||||||
let remoteFile;
|
let remoteFile;
|
||||||
let tempDir;
|
let tempDir;
|
||||||
let tempFile;
|
let tempFile;
|
||||||
|
|
||||||
const fileNames = updatableFiles.map(file => file.name);
|
const fileNames = updatableFiles.map(file => file.name);
|
||||||
|
|
||||||
const tables = await Self.rawSql(`
|
const tables = await Self.rawSql(`
|
||||||
SELECT fileName, toTable, file
|
SELECT fileName, toTable, file
|
||||||
FROM edi.tableConfig
|
FROM edi.tableConfig
|
||||||
WHERE file IN (?)`, [fileNames], options);
|
WHERE file IN (?)`, [fileNames], options);
|
||||||
|
|
||||||
for (const table of tables) {
|
for (const table of tables) {
|
||||||
const fileName = table.file;
|
const fileName = table.file;
|
||||||
|
|
||||||
remoteFile = `codes/${fileName}.ZIP`;
|
remoteFile = `codes/${fileName}.ZIP`;
|
||||||
tempDir = `${tempPath}/${fileName}`;
|
tempDir = `${tempPath}/${fileName}`;
|
||||||
tempFile = `${tempPath}/${fileName}.zip`;
|
tempFile = `${tempPath}/${fileName}.zip`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.readFile(tempFile);
|
await fs.readFile(tempFile);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code === 'ENOENT') {
|
if (error.code === 'ENOENT') {
|
||||||
console.debug(`Downloading file ${fileName}...`);
|
console.debug(`Downloading file ${fileName}...`);
|
||||||
const downloadOutput = await downloadFile(remoteFile, tempFile);
|
const downloadOutput = await downloadFile(remoteFile, tempFile);
|
||||||
if (downloadOutput.error)
|
if (downloadOutput.error)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await extractFile(fileName, tempFile, tempDir);
|
await extractFile(fileName, tempFile, tempDir);
|
||||||
|
|
||||||
console.debug(`Updating table ${table.toTable}...`);
|
console.debug(`Updating table ${table.toTable}...`);
|
||||||
await dumpData(tempDir, table, options);
|
await dumpData(tempDir, table, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update files checksum
|
// Update files checksum
|
||||||
for (const file of updatableFiles) {
|
for (const file of updatableFiles) {
|
||||||
console.log(`Updating file ${file.name} checksum...`);
|
console.log(`Updating file ${file.name} checksum...`);
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE edi.fileConfig
|
UPDATE edi.fileConfig
|
||||||
SET checksum = ?
|
SET checksum = ?
|
||||||
WHERE name = ?`,
|
WHERE name = ?`,
|
||||||
[file.checksum, file.name], options);
|
[file.checksum, file.name], options);
|
||||||
}
|
}
|
||||||
|
|
||||||
await tx.commit();
|
await tx.commit();
|
||||||
|
|
||||||
// Clean files
|
// Clean files
|
||||||
try {
|
try {
|
||||||
console.debug(`Cleaning files...`);
|
console.debug(`Cleaning files...`);
|
||||||
await fs.remove(tempPath);
|
await fs.remove(tempPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code !== 'ENOENT')
|
if (error.code !== 'ENOENT')
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let ftpClient;
|
let ftpClient;
|
||||||
async function getFtpClient() {
|
async function getFtpClient() {
|
||||||
if (!ftpClient) {
|
if (!ftpClient) {
|
||||||
const [ftpConfig] = await Self.rawSql('SELECT host, user, password FROM edi.ftpConfig');
|
const [ftpConfig] = await Self.rawSql('SELECT host, user, password FROM edi.ftpConfig');
|
||||||
console.debug(`Openning FTP connection to ${ftpConfig.host}...\n`);
|
console.debug(`Openning FTP connection to ${ftpConfig.host}...\n`);
|
||||||
|
|
||||||
const FtpClient = require('ftps');
|
const FtpClient = require('ftps');
|
||||||
|
|
||||||
ftpClient = new FtpClient({
|
ftpClient = new FtpClient({
|
||||||
host: ftpConfig.host,
|
host: ftpConfig.host,
|
||||||
username: ftpConfig.user,
|
username: ftpConfig.user,
|
||||||
password: ftpConfig.password,
|
password: ftpConfig.password,
|
||||||
procotol: 'ftp'
|
procotol: 'ftp',
|
||||||
});
|
additionalLftpCommands: 'set ssl:verify-certificate no'
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return ftpClient;
|
return ftpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getChecksum(file) {
|
async function getChecksum(file) {
|
||||||
const ftpClient = await getFtpClient();
|
const ftpClient = await getFtpClient();
|
||||||
console.debug(`Checking checksum for file ${file.name}...`);
|
console.debug(`Checking checksum for file ${file.name}...`);
|
||||||
|
|
||||||
ftpClient.cat(`codes/${file.name}.txt`);
|
ftpClient.cat(`codes/${file.name}.TXT`);
|
||||||
|
|
||||||
const response = await new Promise((resolve, reject) => {
|
const response = await new Promise((resolve, reject) => {
|
||||||
ftpClient.exec((err, response) => {
|
ftpClient.exec((err, response) => {
|
||||||
if (err || response.error) {
|
if (err || response.error) {
|
||||||
console.debug(`Error downloading checksum file... ${response.error}`);
|
console.debug(`Error downloading checksum file... ${response.error}`);
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response && response.data) {
|
if (response && response.data) {
|
||||||
const fileContents = response.data;
|
const fileContents = response.data;
|
||||||
const rows = fileContents.split('\n');
|
const rows = fileContents.split('\n');
|
||||||
const row = rows[4];
|
const row = rows[4];
|
||||||
const columns = row.split(/\s+/);
|
const columns = row.split(/\s+/);
|
||||||
|
|
||||||
let fileChecksum;
|
let fileChecksum;
|
||||||
if (file.keyValue)
|
if (file.keyValue)
|
||||||
fileChecksum = columns[1];
|
fileChecksum = columns[1];
|
||||||
|
|
||||||
if (!file.keyValue)
|
if (!file.keyValue)
|
||||||
fileChecksum = columns[0];
|
fileChecksum = columns[0];
|
||||||
|
|
||||||
return fileChecksum;
|
return fileChecksum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadFile(remoteFile, tempFile) {
|
async function downloadFile(remoteFile, tempFile) {
|
||||||
const ftpClient = await getFtpClient();
|
const ftpClient = await getFtpClient();
|
||||||
|
|
||||||
ftpClient.get(remoteFile, tempFile);
|
ftpClient.get(remoteFile, tempFile);
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ftpClient.exec((err, response) => {
|
ftpClient.exec((err, response) => {
|
||||||
if (err || response.error) {
|
if (err || response.error) {
|
||||||
console.debug(`Error downloading file... ${response.error}`);
|
console.debug(`Error downloading file... ${response.error}`);
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function extractFile(fileName, tempFile, tempDir) {
|
async function extractFile(fileName, tempFile, tempDir) {
|
||||||
const JSZip = require('jszip');
|
const JSZip = require('jszip');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.mkdir(tempDir);
|
await fs.mkdir(tempDir);
|
||||||
console.debug(`Extracting file ${fileName}...`);
|
console.debug(`Extracting file ${fileName}...`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code !== 'EEXIST')
|
if (error.code !== 'EEXIST')
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileStream = await fs.readFile(tempFile);
|
const fileStream = await fs.readFile(tempFile);
|
||||||
if (fileStream) {
|
if (fileStream) {
|
||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
const zipContents = await zip.loadAsync(fileStream);
|
const zipContents = await zip.loadAsync(fileStream);
|
||||||
|
|
||||||
if (!zipContents) return;
|
if (!zipContents) return;
|
||||||
|
|
||||||
const fileNames = Object.keys(zipContents.files);
|
const fileNames = Object.keys(zipContents.files);
|
||||||
|
|
||||||
for (const fileName of fileNames) {
|
for (const fileName of fileNames) {
|
||||||
const fileContent = await zip.file(fileName).async('nodebuffer');
|
const fileContent = await zip.file(fileName).async('nodebuffer');
|
||||||
const dest = path.join(tempDir, fileName);
|
const dest = path.join(tempDir, fileName);
|
||||||
await fs.writeFile(dest, fileContent);
|
await fs.writeFile(dest, fileContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function dumpData(tempDir, table, options) {
|
async function dumpData(tempDir, table, options) {
|
||||||
const toTable = table.toTable;
|
const toTable = table.toTable;
|
||||||
const baseName = table.fileName;
|
const baseName = table.fileName;
|
||||||
|
|
||||||
console.log(`Emptying table ${toTable}...`);
|
console.log(`Emptying table ${toTable}...`);
|
||||||
const tableName = `edi.${toTable}`;
|
const tableName = `edi.${toTable}`;
|
||||||
await Self.rawSql(`DELETE FROM ??`, [tableName]);
|
await Self.rawSql(`DELETE FROM ??`, [tableName]);
|
||||||
|
|
||||||
const dirFiles = await fs.readdir(tempDir);
|
const dirFiles = await fs.readdir(tempDir);
|
||||||
const files = dirFiles.filter(file => file.startsWith(baseName));
|
const files = dirFiles.filter(file => file.startsWith(baseName));
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
console.log(`Dumping data from file ${file}...`);
|
console.log(`Dumping data from file ${file}...`);
|
||||||
|
|
||||||
const templatePath = path.join(__dirname, `./sql/${toTable}.sql`);
|
const templatePath = path.join(__dirname, `./sql/${toTable}.sql`);
|
||||||
const sqlTemplate = await fs.readFile(templatePath, 'utf8');
|
const sqlTemplate = await fs.readFile(templatePath, 'utf8');
|
||||||
const filePath = path.join(tempDir, file);
|
const filePath = path.join(tempDir, file);
|
||||||
|
|
||||||
await Self.rawSql(sqlTemplate, [filePath], options);
|
await Self.rawSql(sqlTemplate, [filePath], options);
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE edi.tableConfig
|
UPDATE edi.tableConfig
|
||||||
SET updated = ?
|
SET updated = ?
|
||||||
WHERE fileName = ?
|
WHERE fileName = ?
|
||||||
`, [Date.vnNew(), baseName], options);
|
`, [Date.vnNew(), baseName], options);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Updated table ${toTable}\n`);
|
console.log(`Updated table ${toTable}\n`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -56,8 +56,6 @@ CREATE TABLE `vn`.`collectionWagonTicket` (
|
||||||
|
|
||||||
ALTER TABLE `vn`.`wagon` ADD `typeFk` int(11) unsigned NOT NULL;
|
ALTER TABLE `vn`.`wagon` ADD `typeFk` int(11) unsigned NOT NULL;
|
||||||
ALTER TABLE `vn`.`wagon` ADD `label` int(11) unsigned NOT NULL;
|
ALTER TABLE `vn`.`wagon` ADD `label` int(11) unsigned NOT NULL;
|
||||||
ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
VALUES
|
VALUES
|
||||||
('WagonType', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'),
|
('WagonType', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'),
|
||||||
|
@ -70,3 +68,4 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri
|
||||||
('WagonType', 'createWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'),
|
('WagonType', 'createWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'),
|
||||||
('WagonType', 'deleteWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'),
|
('WagonType', 'deleteWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'),
|
||||||
('WagonType', 'editWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi');
|
('WagonType', 'editWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE;
|
|
@ -1,7 +1,7 @@
|
||||||
ALTER TABLE `vn`.`workerConfig` ADD payMethodFk tinyint(3) unsigned NULL;
|
ALTER TABLE `vn`.`workerConfig` ADD payMethodFk tinyint(3) unsigned NULL;
|
||||||
ALTER TABLE `vn`.`workerConfig` ADD CONSTRAINT workerConfig_FK FOREIGN KEY (roleFk) REFERENCES account.`role`(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
ALTER TABLE `vn`.`workerConfig` ADD CONSTRAINT workerConfig_FK FOREIGN KEY (roleFk) REFERENCES account.`role`(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
ALTER TABLE `vn`.`workerConfig` ADD CONSTRAINT workerConfig_FK_1 FOREIGN KEY (payMethodFk) REFERENCES `vn`.`payMethod`(id) ON DELETE SET NULL ON UPDATE CASCADE;
|
ALTER TABLE `vn`.`workerConfig` ADD CONSTRAINT workerConfig_FK_1 FOREIGN KEY (payMethodFk) REFERENCES `vn`.`payMethod`(id) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
-- Cuando se apruebe el PR quitar y poner en redmine para hacerse manualmente
|
|
||||||
UPDATE `vn`.`workerConfig`
|
UPDATE `vn`.`workerConfig`
|
||||||
SET payMethodFk = 4
|
SET payMethodFk = 4
|
||||||
WHERE id=1;
|
WHERE id=1;
|
||||||
|
|
|
@ -61950,7 +61950,6 @@ BEGIN
|
||||||
* @vWarehouseFk almacen donde buscar
|
* @vWarehouseFk almacen donde buscar
|
||||||
* @vDate Si la fecha es null, muestra el histórico desde el inventario. Si la fecha no es null, muestra histórico desde la fecha pasada.
|
* @vDate Si la fecha es null, muestra el histórico desde el inventario. Si la fecha no es null, muestra histórico desde la fecha pasada.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DECLARE vDateInventory DATETIME;
|
DECLARE vDateInventory DATETIME;
|
||||||
DECLARE vInvCalculated INT;
|
DECLARE vInvCalculated INT;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ services:
|
||||||
- node.role == worker
|
- node.role == worker
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 4G
|
memory: 8G
|
||||||
configs:
|
configs:
|
||||||
datasources:
|
datasources:
|
||||||
external: true
|
external: true
|
||||||
|
|
|
@ -150,10 +150,10 @@ export default class Controller extends Section {
|
||||||
if (value == null || value == '') return null;
|
if (value == null || value == '') return null;
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case 'search':
|
case 'search':
|
||||||
const or = [{changedModelId: value}];
|
if (/^[0-9]+$/.test(value))
|
||||||
if (!/^[0-9]+$/.test(value))
|
return {changedModelId: value};
|
||||||
or.push({changedModelValue: {like: `%${value}%`}});
|
else
|
||||||
return {or};
|
return {changedModelValue: {like: `%${value}%`}};
|
||||||
case 'changes':
|
case 'changes':
|
||||||
return {or: [
|
return {or: [
|
||||||
{oldInstance: {like: `%${value}%`}},
|
{oldInstance: {like: `%${value}%`}},
|
||||||
|
|
|
@ -15,3 +15,7 @@ columns:
|
||||||
image: image
|
image: image
|
||||||
hasGrant: has grant
|
hasGrant: has grant
|
||||||
userFk: user
|
userFk: user
|
||||||
|
recoverPass: recover password
|
||||||
|
role: role
|
||||||
|
sync: pending sync
|
||||||
|
lastPassChange: password changed
|
||||||
|
|
|
@ -15,3 +15,7 @@ columns:
|
||||||
image: imagen
|
image: imagen
|
||||||
hasGrant: puede delegar
|
hasGrant: puede delegar
|
||||||
userFk: usuario
|
userFk: usuario
|
||||||
|
recoverPass: recuperar contraseña
|
||||||
|
role: rol
|
||||||
|
sync: Pendiente de sincronizar
|
||||||
|
lastPassChange: contraseña modificada
|
||||||
|
|
|
@ -59,6 +59,12 @@ module.exports = function(Self) {
|
||||||
fields: ['id', 'name']
|
fields: ['id', 'name']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
relation: 'businessType',
|
||||||
|
scope: {
|
||||||
|
fields: ['description']
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
relation: 'account',
|
relation: 'account',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "payMethod"
|
"table": "payMethod"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -43,6 +43,10 @@
|
||||||
{{$ctrl.client.salesPersonUser.name}}
|
{{$ctrl.client.salesPersonUser.name}}
|
||||||
</span>
|
</span>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
|
<vn-label-value
|
||||||
|
label="Business type"
|
||||||
|
value="{{$ctrl.client.businessType.description}}">
|
||||||
|
</vn-label-value>
|
||||||
</div>
|
</div>
|
||||||
<div class="icons">
|
<div class="icons">
|
||||||
<vn-icon
|
<vn-icon
|
||||||
|
|
|
@ -8,3 +8,4 @@ Client invoices list: Listado de facturas del cliente
|
||||||
Pay method: Forma de pago
|
Pay method: Forma de pago
|
||||||
Unpaid Dated: "Fecha: {{dated | date:'dd/MM/yyyy'}}"
|
Unpaid Dated: "Fecha: {{dated | date:'dd/MM/yyyy'}}"
|
||||||
Unpaid Amount: "Importe: {{amount | currency: 'EUR':2}}"
|
Unpaid Amount: "Importe: {{amount | currency: 'EUR':2}}"
|
||||||
|
Business type: Tipo de negocio
|
|
@ -1,4 +1,4 @@
|
||||||
name: botanical
|
name: botanical data
|
||||||
columns:
|
columns:
|
||||||
itemFk: item
|
itemFk: item
|
||||||
genusFk: genus
|
genusFk: genus
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: botánico
|
name: datos botánicos
|
||||||
columns:
|
columns:
|
||||||
itemFk: artículo
|
itemFk: artículo
|
||||||
genusFk: género
|
genusFk: género
|
||||||
|
|
|
@ -35,7 +35,7 @@ columns:
|
||||||
packingOut: packing out
|
packingOut: packing out
|
||||||
hasMinPrice: has min price
|
hasMinPrice: has min price
|
||||||
isFragile: fragile
|
isFragile: fragile
|
||||||
isFloramondo: is floramondo
|
isFloramondo: floramondo
|
||||||
packingShelve: packing shelve
|
packingShelve: packing shelve
|
||||||
isLaid: laid
|
isLaid: laid
|
||||||
inkFk: ink
|
inkFk: ink
|
||||||
|
|
|
@ -35,7 +35,7 @@ columns:
|
||||||
packingOut: empaquetar
|
packingOut: empaquetar
|
||||||
hasMinPrice: tiene precio mínimo
|
hasMinPrice: tiene precio mínimo
|
||||||
isFragile: frágil
|
isFragile: frágil
|
||||||
isFloramondo: es floramondo
|
isFloramondo: floramondo
|
||||||
packingShelve: estantería embalaje
|
packingShelve: estantería embalaje
|
||||||
isLaid: puesto
|
isLaid: puesto
|
||||||
inkFk: tinta
|
inkFk: tinta
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
name: shelving
|
||||||
|
columns:
|
||||||
|
id: id
|
||||||
|
code: code
|
||||||
|
parkingFk: parking
|
||||||
|
isPrinted: printed
|
||||||
|
priority: priority
|
||||||
|
parked: parked
|
||||||
|
userFk: user
|
||||||
|
isSpam: SPAM
|
||||||
|
isRecyclable: recyclable
|
|
@ -0,0 +1,11 @@
|
||||||
|
name: estantería
|
||||||
|
columns:
|
||||||
|
id: id
|
||||||
|
code: código
|
||||||
|
parkingFk: parking
|
||||||
|
isPrinted: impreso
|
||||||
|
priority: prioridad
|
||||||
|
parked: aparcado
|
||||||
|
userFk: usuario
|
||||||
|
isSpam: SPAM
|
||||||
|
isRecyclable: reciclable
|
|
@ -12,3 +12,5 @@ columns:
|
||||||
hostFk: PC
|
hostFk: PC
|
||||||
isBox: box
|
isBox: box
|
||||||
itemPackingTypeFk: packing type
|
itemPackingTypeFk: packing type
|
||||||
|
externalId: external id
|
||||||
|
stateTypeFk: status
|
||||||
|
|
|
@ -12,3 +12,5 @@ columns:
|
||||||
hostFk: PC
|
hostFk: PC
|
||||||
isBox: caja
|
isBox: caja
|
||||||
itemPackingTypeFk: tipo empaquetado
|
itemPackingTypeFk: tipo empaquetado
|
||||||
|
externalId: id externo
|
||||||
|
stateTypeFk: estado
|
||||||
|
|
|
@ -4,9 +4,20 @@ columns:
|
||||||
companyCodeFk: company
|
companyCodeFk: company
|
||||||
started: started
|
started: started
|
||||||
ended: ended
|
ended: ended
|
||||||
|
workerBusiness: business
|
||||||
|
reasonEndFk: ending reason
|
||||||
payedHolidays: payed holidays
|
payedHolidays: payed holidays
|
||||||
|
occupationCodeFk: occupation
|
||||||
workerFk: worker
|
workerFk: worker
|
||||||
|
notes: notes
|
||||||
|
departmentFk: department
|
||||||
|
workerBusinessProfessionalCategoryFk: professional category
|
||||||
calendarTypeFk: calendar type
|
calendarTypeFk: calendar type
|
||||||
isHourlyLabor: hourly labor
|
isHourlyLabor: hourly labor
|
||||||
workcenterFk: workcenter
|
workcenterFk: workcenter
|
||||||
|
rate: rate
|
||||||
|
workerBusinessCategoryFk: category
|
||||||
|
workerBusinessTypeFk: type
|
||||||
amount: amount
|
amount: amount
|
||||||
|
workerBusinessAgreementFk: agreement
|
||||||
|
basicSalary: salary
|
||||||
|
|
|
@ -4,9 +4,20 @@ columns:
|
||||||
companyCodeFk: empresa
|
companyCodeFk: empresa
|
||||||
started: iniciado
|
started: iniciado
|
||||||
ended: finalizado
|
ended: finalizado
|
||||||
|
workerBusiness: negocio
|
||||||
|
reasonEndFk: motivo finalización
|
||||||
payedHolidays: vacaciones pagadas
|
payedHolidays: vacaciones pagadas
|
||||||
|
occupationCodeFk: ocupación
|
||||||
workerFk: trabajador
|
workerFk: trabajador
|
||||||
|
notes: notas
|
||||||
|
departmentFk: departamento
|
||||||
|
workerBusinessProfessionalCategoryFk: categoría profesional
|
||||||
calendarTypeFk: tipo calendario
|
calendarTypeFk: tipo calendario
|
||||||
isHourlyLabor: horario laboral
|
isHourlyLabor: horario laboral
|
||||||
workcenterFk: centro de trabajo
|
workcenterFk: centro de trabajo
|
||||||
|
rate: tarifa
|
||||||
|
workerBusinessCategoryFk: categoría
|
||||||
|
workerBusinessTypeFk: tipo
|
||||||
amount: salario
|
amount: salario
|
||||||
|
workerBusinessAgreementFk: acuerdo
|
||||||
|
basicSalary: salario base
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: document
|
name: document
|
||||||
columns:
|
columns:
|
||||||
id: id
|
id: id
|
||||||
dmsFk: dms
|
worker: worker
|
||||||
workerFk: worker
|
document: document
|
||||||
isReadableByWorker: readable by worker
|
isReadableByWorker: readable by worker
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: documento
|
name: documento
|
||||||
columns:
|
columns:
|
||||||
id: id
|
id: id
|
||||||
dmsFk: dms
|
worker: trabajador
|
||||||
workerFk: trabajador
|
document: documento
|
||||||
isReadableByWorker: legible por trabajador
|
isReadableByWorker: accesible por trabajador
|
||||||
|
|
|
@ -1,20 +1,32 @@
|
||||||
name: worker
|
name: worker
|
||||||
columns:
|
columns:
|
||||||
id: id
|
id: id
|
||||||
|
code: code
|
||||||
firstName: first name
|
firstName: first name
|
||||||
lastName: last name
|
lastName: last name
|
||||||
|
sub: buyer number
|
||||||
|
photo: photo
|
||||||
phone: phone
|
phone: phone
|
||||||
|
mobileExtension: mobile extension
|
||||||
userFk: user
|
userFk: user
|
||||||
bossFk: boss
|
bossFk: boss
|
||||||
|
fiDueDate: FI due date
|
||||||
|
hasMachineryAuthorized: machinery authorized
|
||||||
|
seniority: seniority
|
||||||
|
isTodayRelative: today relative
|
||||||
|
isF11Allowed: F11 allowed
|
||||||
|
sectorFk: sector
|
||||||
maritalStatus: marital status
|
maritalStatus: marital status
|
||||||
|
labelerFk: labeler
|
||||||
originCountryFk: origin country
|
originCountryFk: origin country
|
||||||
educationLevelFk: education level
|
educationLevelFk: education level
|
||||||
SSN: SSN
|
SSN: SSN
|
||||||
labelerFk: labeler
|
fi: fiscal identifier
|
||||||
mobileExtension: mobile extension
|
birth: birth date
|
||||||
code: code
|
isDisable: disabled
|
||||||
|
isFreelance: freelance
|
||||||
|
isSsDiscounted: SS discounted
|
||||||
|
sex: sex
|
||||||
|
businessFk: current contract
|
||||||
|
balance: balance
|
||||||
locker: locker
|
locker: locker
|
||||||
workerFk: worker
|
|
||||||
sectorFk: sector
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,32 @@
|
||||||
name: trabajador
|
name: trabajador
|
||||||
columns:
|
columns:
|
||||||
id: id
|
id: id
|
||||||
|
code: código
|
||||||
firstName: nombre
|
firstName: nombre
|
||||||
lastName: apellido
|
lastName: apellido
|
||||||
|
sub: número comprador
|
||||||
|
photo: foto
|
||||||
phone: teléfono
|
phone: teléfono
|
||||||
|
mobileExtension: extensión móvil
|
||||||
userFk: usuario
|
userFk: usuario
|
||||||
bossFk: jefe
|
bossFk: jefe
|
||||||
|
fiDueDate: caducidad DNI
|
||||||
|
hasMachineryAuthorized: maquinaria autorizada
|
||||||
|
seniority: antigüedad
|
||||||
|
isTodayRelative: relativo hoy
|
||||||
|
isF11Allowed: F11 autorizado
|
||||||
|
sectorFk: sector
|
||||||
maritalStatus: estado civil
|
maritalStatus: estado civil
|
||||||
|
labelerFk: etiquetadora
|
||||||
originCountryFk: país origen
|
originCountryFk: país origen
|
||||||
educationLevelFk: nivel educativo
|
educationLevelFk: nivel educativo
|
||||||
SSN: SSN
|
SSN: SSN
|
||||||
labelerFk: etiquetadora
|
fi: identificador fiscal
|
||||||
mobileExtension: extensión móvil
|
birth: nacimiento
|
||||||
code: código
|
isDisable: deshabilitado
|
||||||
locker: casillero
|
isFreelance: autónomo
|
||||||
workerFk: trabajador
|
isSsDiscounted: descuento SS
|
||||||
sectorFk: sector
|
sex: sexo
|
||||||
|
businessFk: contrato actual
|
||||||
|
balance: saldo
|
||||||
|
locker: taquilla
|
||||||
|
|
|
@ -230,21 +230,21 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
} else {
|
} else {
|
||||||
const weekDay = day.dated.getDay();
|
const weekDay = day.dated.getDay();
|
||||||
const journeys = await models.Journey.find({
|
const journeys = await models.BusinessSchedule.find({
|
||||||
where: {
|
where: {
|
||||||
business_id: day.businessFk,
|
businessFk: day.businessFk,
|
||||||
day_id: weekDay
|
weekday: weekDay
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
let timeTableDecimalInSeconds = 0;
|
let timeTableDecimalInSeconds = 0;
|
||||||
for (let journey of journeys) {
|
for (let journey of journeys) {
|
||||||
const start = Date.vnNew();
|
const start = Date.vnNew();
|
||||||
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
|
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
|
||||||
start.setHours(startHours, startMinutes, startSeconds, 0);
|
start.setHours(startHours, startMinutes, startSeconds, 0);
|
||||||
|
|
||||||
const end = Date.vnNew();
|
const end = Date.vnNew();
|
||||||
const [endHours, endMinutes, endSeconds] = getTime(journey.end);
|
const [endHours, endMinutes, endSeconds] = getTime(journey.ended);
|
||||||
end.setHours(endHours, endMinutes, endSeconds, 0);
|
end.setHours(endHours, endMinutes, endSeconds, 0);
|
||||||
|
|
||||||
const result = (end - start) / 1000;
|
const result = (end - start) / 1000;
|
||||||
|
@ -255,7 +255,7 @@ module.exports = Self => {
|
||||||
const timeTableDecimal = timeTableDecimalInSeconds / 3600;
|
const timeTableDecimal = timeTableDecimalInSeconds / 3600;
|
||||||
if (day.timeWorkDecimal == timeTableDecimal) {
|
if (day.timeWorkDecimal == timeTableDecimal) {
|
||||||
const timed = new Date(day.dated);
|
const timed = new Date(day.dated);
|
||||||
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
|
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
|
||||||
await models.WorkerTimeControl.create({
|
await models.WorkerTimeControl.create({
|
||||||
userFk: day.workerFk,
|
userFk: day.workerFk,
|
||||||
timed: timed.setHours(startHours, startMinutes, startSeconds),
|
timed: timed.setHours(startHours, startMinutes, startSeconds),
|
||||||
|
@ -263,7 +263,7 @@ module.exports = Self => {
|
||||||
isSendMail: true
|
isSendMail: true
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const [endHours, endMinutes, endSeconds] = getTime(journey.end);
|
const [endHours, endMinutes, endSeconds] = getTime(journey.ended);
|
||||||
await models.WorkerTimeControl.create({
|
await models.WorkerTimeControl.create({
|
||||||
userFk: day.workerFk,
|
userFk: day.workerFk,
|
||||||
timed: timed.setHours(endHours, endMinutes, endSeconds),
|
timed: timed.setHours(endHours, endMinutes, endSeconds),
|
||||||
|
@ -276,7 +276,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
if (journey == minStart) {
|
if (journey == minStart) {
|
||||||
const timed = new Date(day.dated);
|
const timed = new Date(day.dated);
|
||||||
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
|
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
|
||||||
await models.WorkerTimeControl.create({
|
await models.WorkerTimeControl.create({
|
||||||
userFk: day.workerFk,
|
userFk: day.workerFk,
|
||||||
timed: timed.setHours(startHours, startMinutes, startSeconds),
|
timed: timed.setHours(startHours, startMinutes, startSeconds),
|
||||||
|
@ -304,7 +304,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
if (journey == minStart) {
|
if (journey == minStart) {
|
||||||
const timed = new Date(day.dated);
|
const timed = new Date(day.dated);
|
||||||
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
|
const [startHours, startMinutes, startSeconds] = getTime(journey.started);
|
||||||
await models.WorkerTimeControl.create({
|
await models.WorkerTimeControl.create({
|
||||||
userFk: day.workerFk,
|
userFk: day.workerFk,
|
||||||
timed: timed.setHours(startHours + 1, startMinutes, startSeconds),
|
timed: timed.setHours(startHours + 1, startMinutes, startSeconds),
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
"AbsenceType": {
|
"AbsenceType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"BusinessSchedule": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Calendar": {
|
"Calendar": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -38,9 +41,6 @@
|
||||||
"EducationLevel": {
|
"EducationLevel": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Journey": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"ProfileType":{
|
"ProfileType":{
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
{
|
{
|
||||||
"name": "Journey",
|
"name": "BusinessSchedule",
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "postgresql.journey"
|
"table": "businessSchedule"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"journey_id": {
|
"id": {
|
||||||
"id": true,
|
"id": true,
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"day_id": {
|
"weekday": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"start": {
|
"started": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
"end": {
|
"ended": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
"business_id": {
|
"businessFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -75,7 +75,7 @@
|
||||||
"state": "worker.card.workerLog",
|
"state": "worker.card.workerLog",
|
||||||
"component": "vn-worker-log",
|
"component": "vn-worker-log",
|
||||||
"description": "Log",
|
"description": "Log",
|
||||||
"acl": ["salesAssistant"]
|
"acl": ["hr"]
|
||||||
}, {
|
}, {
|
||||||
"url": "/note",
|
"url": "/note",
|
||||||
"state": "worker.card.note",
|
"state": "worker.card.note",
|
||||||
|
|
Loading…
Reference in New Issue