refs #5843 userFk remove and vchange
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
91c6ab9e44
commit
0b9199688e
|
@ -34,7 +34,7 @@ BEGIN
|
|||
isAllowedToWork
|
||||
FROM(SELECT t.dated,
|
||||
b.id businessFk,
|
||||
w.userFk,
|
||||
w.id,
|
||||
b.departmentFk,
|
||||
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart ,
|
||||
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd,
|
||||
|
@ -48,14 +48,14 @@ BEGIN
|
|||
FROM time t
|
||||
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
||||
LEFT JOIN worker w ON w.id = b.workerFk
|
||||
JOIN tmp.`user` u ON u.userFK = w.userFK
|
||||
JOIN tmp.`user` u ON u.userFK = w.id
|
||||
LEFT JOIN workCenter wc ON wc.id = b.workcenterFK
|
||||
LEFT JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = b.calendarTypeFk
|
||||
LEFT JOIN postgresql.journey j ON j.business_id = b.id AND j.day_id = WEEKDAY(t.dated) + 1
|
||||
LEFT JOIN postgresql.calendar_employee ce ON ce.businessFk = b.id AND ce.date = t.dated
|
||||
LEFT JOIN absenceType at2 ON at2.id = ce.calendar_state_id
|
||||
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
|
||||
GROUP BY w.userFk, t.dated
|
||||
GROUP BY w.id, t.dated
|
||||
)sub;
|
||||
|
||||
UPDATE tmp.timeBusinessCalculate t
|
||||
|
|
|
@ -46,7 +46,7 @@ BEGIN
|
|||
CONCAT('Cliente ', NEW.id),
|
||||
CONCAT('Recibida la documentación: ', vText)
|
||||
FROM worker w
|
||||
LEFT JOIN account.user u ON w.userFk = u.id AND u.active
|
||||
LEFT JOIN account.user u ON w.id = u.id AND u.active
|
||||
LEFT JOIN account.account ac ON ac.id = u.id
|
||||
WHERE w.id = NEW.salesPersonFk;
|
||||
END IF;
|
||||
|
|
|
@ -73377,7 +73377,7 @@ BEGIN
|
|||
CREATE TEMPORARY TABLE tmp.`user`
|
||||
SELECT u.id userFk
|
||||
FROM account.user u
|
||||
JOIN vn.worker w ON w.userFk = u.id
|
||||
JOIN vn.worker w ON w.id = u.id
|
||||
WHERE w.id = vWorkerFk;
|
||||
|
||||
CALL vn.timeControl_calculate(vDatedFrom, vDatedTo);
|
||||
|
@ -75480,7 +75480,7 @@ BEGIN
|
|||
GROUP BY cont
|
||||
HAVING cont2 MOD 2 = 1
|
||||
)sub2;
|
||||
JOIN worker w ON w.userFk = sub2.userFk;
|
||||
JOIN worker w ON w.id = sub2.userFk;
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -81818,6 +81818,7 @@ USE `vn`;
|
|||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
/*!50001 SET collation_connection = @saved_col_connection */;
|
||||
|
||||
|
||||
--
|
||||
-- Final view structure for view `workerTimeJourneyNG`
|
||||
--
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
@ -109,7 +109,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||
const { mergeFilters, mergeWhere } = require('vn-loopback/util/filter');
|
||||
const {mergeFilters, mergeWhere} = require('vn-loopback/util/filter');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('logs', {
|
||||
|
@ -12,27 +12,27 @@ module.exports = Self => {
|
|||
arg: 'id',
|
||||
type: 'Number',
|
||||
description: 'The claim id',
|
||||
http: { source: 'path' }
|
||||
http: {source: 'path'}
|
||||
},
|
||||
{
|
||||
arg: 'filter',
|
||||
type: 'object',
|
||||
http: { source: 'query' }
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'search',
|
||||
type: 'string',
|
||||
http: { source: 'query' }
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'userFk',
|
||||
type: 'number',
|
||||
http: { source: 'query' }
|
||||
http: {source: 'query'}
|
||||
},
|
||||
{
|
||||
arg: 'created',
|
||||
type: 'date',
|
||||
http: { source: 'query' }
|
||||
http: {source: 'query'}
|
||||
},
|
||||
],
|
||||
returns: {
|
||||
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.logs = async (ctx, id, filter, options) => {
|
||||
Self.logs = async(ctx, id, filter, options) => {
|
||||
const conn = Self.dataSource.connector;
|
||||
const args = ctx.args;
|
||||
const myOptions = {};
|
||||
|
@ -59,22 +59,22 @@ module.exports = Self => {
|
|||
case 'search':
|
||||
return {
|
||||
or: [
|
||||
{ changedModel: { like: `%${value}%` } },
|
||||
{ oldInstance: { like: `%${value}%` } }
|
||||
{changedModel: {like: `%${value}%`}},
|
||||
{oldInstance: {like: `%${value}%`}}
|
||||
]
|
||||
};
|
||||
case 'userFk':
|
||||
return { 'cl.userFk': value };
|
||||
return {'cl.userFk': value};
|
||||
case 'created':
|
||||
value.setHours(0, 0, 0, 0);
|
||||
to = new Date(value);
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
return { creationDate: { between: [value, to] } };
|
||||
return {creationDate: {between: [value, to]}};
|
||||
}
|
||||
});
|
||||
where = mergeWhere(where, { ['cl.originFk']: id });
|
||||
filter = mergeFilters(args.filter, { where });
|
||||
where = mergeWhere(where, {['cl.originFk']: id});
|
||||
filter = mergeFilters(args.filter, {where});
|
||||
|
||||
const stmts = [];
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class Controller extends ModuleCard {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -9,7 +9,7 @@ export default class Controller extends Section {
|
|||
include: [{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -9,7 +9,7 @@ class Controller extends Section {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -28,7 +28,7 @@ class Controller extends Section {
|
|||
}, {
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
|||
include: [{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
|||
include: [{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = Self => {
|
|||
}, {
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id', 'userFk'],
|
||||
fields: ['id'],
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
|
|
|
@ -41,7 +41,7 @@ class Controller extends ModuleCard {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -79,7 +79,7 @@ class Controller extends Descriptor {
|
|||
}, {
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id', 'userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -7,7 +7,7 @@ class Controller extends ModuleCard {
|
|||
include: [
|
||||
{relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -12,7 +12,7 @@ class Controller extends Summary {
|
|||
include: [
|
||||
{relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -91,7 +91,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -29,7 +29,7 @@ class Controller extends Section {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -9,7 +9,7 @@ class Controller extends Section {
|
|||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['userFk'],
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
|
|
|
@ -102,7 +102,7 @@ module.exports = Self => {
|
|||
|
||||
stmt = new ParameterizedSQL('DROP TEMPORARY TABLE IF EXISTS tmp.`user`');
|
||||
stmts.push(stmt);
|
||||
stmt = new ParameterizedSQL('CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` SELECT userFk FROM vn.worker w JOIN account.`user` u ON u.id = w.userFk WHERE userFk IS NOT NULL');
|
||||
stmt = new ParameterizedSQL('CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` SELECT id as userFk FROM vn.worker w JOIN account.`user` u ON u.id = w.id WHERE id IS NOT NULL');
|
||||
stmts.push(stmt);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = Self => {
|
|||
const query =
|
||||
`SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname
|
||||
FROM worker w
|
||||
JOIN account.user u ON u.id = w.userFk
|
||||
JOIN account.user u ON u.id = w.id
|
||||
JOIN account.roleRole i ON i.role = u.role
|
||||
JOIN account.role r ON r.id = i.inheritsFrom`;
|
||||
|
||||
|
|
|
@ -94,9 +94,8 @@ module.exports = Self => {
|
|||
{'u.nickname': {like: `%${value}%`}}
|
||||
]};
|
||||
case 'id':
|
||||
return {'w.id': value};
|
||||
case 'userFk':
|
||||
return {'w.userFk': value};
|
||||
return {'w.id': value};
|
||||
case 'firstName':
|
||||
return {'w.firstName': {like: `%${value}%`}};
|
||||
case 'lastName':
|
||||
|
@ -123,8 +122,8 @@ module.exports = Self => {
|
|||
FROM worker w
|
||||
LEFT JOIN workerDepartment wd ON wd.workerFk = w.id
|
||||
LEFT JOIN department d ON d.id = wd.departmentFk
|
||||
LEFT JOIN client c ON c.id = w.userFk
|
||||
LEFT JOIN account.user u ON u.id = w.userFk
|
||||
LEFT JOIN client c ON c.id = w.id
|
||||
LEFT JOIN account.user u ON u.id = w.id
|
||||
LEFT JOIN pbx.sip p ON p.user_id = u.id
|
||||
LEFT JOIN account.emailUser mu ON mu.userFk = u.id`
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue