Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
2f6a80a746
|
@ -55,7 +55,6 @@ BEGIN
|
|||
i.itemPackingTypeFk,
|
||||
isa.`size`,
|
||||
isa.Estado,
|
||||
isa.sectorProdPriority,
|
||||
isa.available,
|
||||
isa.sectorFk,
|
||||
isa.matricula,
|
||||
|
|
|
@ -10,7 +10,6 @@ AS SELECT `s`.`id` AS `saleFk`,
|
|||
`s`.`concept` AS `concept`,
|
||||
`i`.`size` AS `size`,
|
||||
`st`.`name` AS `Estado`,
|
||||
`st`.`sectorProdPriority` AS `sectorProdPriority`,
|
||||
`stock`.`visible` AS `available`,
|
||||
`stock`.`sectorFk` AS `sectorFk`,
|
||||
`stock`.`shelvingFk` AS `matricula`,
|
||||
|
|
|
@ -6,7 +6,6 @@ AS SELECT `s`.`id` AS `id`,
|
|||
`s`.`order` AS `order`,
|
||||
`s`.`alertLevel` AS `alert_level`,
|
||||
`s`.`code` AS `code`,
|
||||
`s`.`sectorProdPriority` AS `sectorProdPriority`,
|
||||
`s`.`nextStateFk` AS `nextStateFk`,
|
||||
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
|
||||
`s`.`isPicked` AS `isPicked`
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
ALTER TABLE IF EXISTS `vn`.`payrollWorker`
|
||||
MODIFY COLUMN IF EXISTS `nss__` varchar(23) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `codpuesto__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `codcontrato__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `FAntiguedad__` date NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `grupotarifa__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `codcategoria__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `ContratoTemporal__` tinyint(1) NOT NULL DEFAULT 0 COMMENT '@deprecated 2024-03-15';
|
||||
|
||||
ALTER TABLE IF EXISTS `vn`.`payrollWorkCenter`
|
||||
MODIFY COLUMN IF EXISTS `Centro__` varchar(255) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `nss_cotizacion__` varchar(15) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `domicilio__` varchar(255) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `poblacion__` varchar(45) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `cp__` varchar(5) NOT NULL COMMENT '@deprecated 2024-03-15',
|
||||
MODIFY COLUMN IF EXISTS `empresa_id__` int(10) NOT NULL COMMENT '@deprecated 2024-03-15';
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.state DROP COLUMN sectorProdPriority;
|
|
@ -8,19 +8,19 @@ module.exports = Self => {
|
|||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'Number',
|
||||
type: 'number',
|
||||
description: 'The worker id',
|
||||
http: {source: 'path'}
|
||||
},
|
||||
{
|
||||
arg: 'filter',
|
||||
type: 'Object',
|
||||
type: 'object',
|
||||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||
http: {source: 'query'}
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: ['Object'],
|
||||
type: ['object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
|
@ -36,6 +36,7 @@ module.exports = Self => {
|
|||
|
||||
// Get ids alloweds
|
||||
const account = await models.VnUser.findById(userId);
|
||||
|
||||
const stmt = new ParameterizedSQL(
|
||||
`SELECT d.id, d.id dmsFk
|
||||
FROM workerDms wd
|
||||
|
@ -45,30 +46,40 @@ module.exports = Self => {
|
|||
AND rr.role = ?
|
||||
`, [account.roleFk]
|
||||
);
|
||||
const yourOwnDms = {and: [{isReadableByWorker: true}, {worker: userId}]};
|
||||
const where = {
|
||||
or: [yourOwnDms, {
|
||||
role: {
|
||||
neq: null
|
||||
}
|
||||
}]
|
||||
const yourOwnDms = {
|
||||
or: [
|
||||
{and: [
|
||||
{isReadableByWorker: true},
|
||||
{worker: userId}
|
||||
]},
|
||||
{
|
||||
role: {
|
||||
neq: null
|
||||
}
|
||||
}]
|
||||
};
|
||||
stmt.merge(conn.makeSuffix(mergeWhere(filter.where, where)));
|
||||
|
||||
// Get workerDms alloweds
|
||||
const where = mergeWhere(filter.where, yourOwnDms);
|
||||
stmt.merge(conn.makeSuffix({where}));
|
||||
const dmsIds = await conn.executeStmt(stmt);
|
||||
|
||||
const allowedIds = dmsIds.map(dms => dms.id);
|
||||
const allowedFilter = mergeFilters(filter, {where: {dmsFk: {inq: allowedIds}, workerFk: id}});
|
||||
let workerDms = await models.WorkerDms.find(allowedFilter);
|
||||
|
||||
// Get docuware info
|
||||
const docuware = await models.Docuware.findOne({
|
||||
fields: ['dmsTypeFk'],
|
||||
where: {code: 'hr', action: 'find'}
|
||||
});
|
||||
const docuwareDmsType = docuware.dmsTypeFk;
|
||||
let workerDocuware = [];
|
||||
if (!filter.skip && (!docuwareDmsType || (docuwareDmsType && await models.DmsType.hasReadRole(ctx, docuwareDmsType)))) {
|
||||
const workerDms = await models.WorkerDms.find(allowedFilter);
|
||||
|
||||
const workerDocuware = filter.skip ? [] : await getDocuware(ctx, id);
|
||||
return workerDms.concat(workerDocuware);
|
||||
|
||||
async function getDocuware(ctx, id) {
|
||||
const {dmsTypeFk} = await models.Docuware.findOne({
|
||||
fields: ['dmsTypeFk'],
|
||||
where: {code: 'hr', action: 'find'}
|
||||
});
|
||||
|
||||
if (!await models.DmsType.hasReadRole(ctx, dmsTypeFk)) return [];
|
||||
|
||||
let workerDocuware = [];
|
||||
const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']});
|
||||
const docuwareParse = {
|
||||
'Filename': 'dmsFk',
|
||||
|
@ -81,7 +92,7 @@ module.exports = Self => {
|
|||
};
|
||||
|
||||
workerDocuware =
|
||||
await models.Docuware.getById('hr', worker.lastName + ' ' + worker.firstName, docuwareParse) ?? [];
|
||||
await models.Docuware.getById('hr', worker.lastName + ' ' + worker.firstName, docuwareParse) ?? [];
|
||||
const url = (await Self.app.models.Url.getUrl('docuware')) + 'WebClient';
|
||||
for (document of workerDocuware) {
|
||||
const docuwareId = document.id;
|
||||
|
@ -106,7 +117,7 @@ module.exports = Self => {
|
|||
};
|
||||
Object.assign(document, defaultData);
|
||||
}
|
||||
return workerDocuware;
|
||||
}
|
||||
return workerDms.concat(workerDocuware);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ code: vn-database
|
|||
versionSchema: util
|
||||
replace: true
|
||||
sumViews: false
|
||||
defaultDefiner: vn@localhost
|
||||
mockDate: '2001-01-01 12:00:00'
|
||||
subdir: db
|
||||
schemas:
|
||||
|
|
Loading…
Reference in New Issue