Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5914-transferInvoiceOut
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
f64f7a975d
|
@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- (Ticket -> Servicios) Se pueden abonar servicios
|
- (Ticket -> Servicios) Se pueden abonar servicios
|
||||||
|
- (Facturas -> Datos básicos) Muestra valores por defecto
|
||||||
|
- (Facturas -> Borrado) Notificación al borrar un asiento ya enlazado en Sage
|
||||||
### Changed
|
### Changed
|
||||||
- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia
|
- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"userConfig": {
|
"userConfig": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
|
|
|
@ -34,7 +34,7 @@ BEGIN
|
||||||
isAllowedToWork
|
isAllowedToWork
|
||||||
FROM(SELECT t.dated,
|
FROM(SELECT t.dated,
|
||||||
b.id businessFk,
|
b.id businessFk,
|
||||||
w.userFk,
|
w.id,
|
||||||
b.departmentFk,
|
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.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,
|
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
|
FROM time t
|
||||||
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
||||||
LEFT JOIN worker w ON w.id = b.workerFk
|
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 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.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.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 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
|
LEFT JOIN absenceType at2 ON at2.id = ce.calendar_state_id
|
||||||
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
|
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
|
||||||
GROUP BY w.userFk, t.dated
|
GROUP BY w.id, t.dated
|
||||||
)sub;
|
)sub;
|
||||||
|
|
||||||
UPDATE tmp.timeBusinessCalculate t
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
|
|
@ -46,7 +46,7 @@ BEGIN
|
||||||
CONCAT('Cliente ', NEW.id),
|
CONCAT('Cliente ', NEW.id),
|
||||||
CONCAT('Recibida la documentación: ', vText)
|
CONCAT('Recibida la documentación: ', vText)
|
||||||
FROM worker w
|
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
|
LEFT JOIN account.account ac ON ac.id = u.id
|
||||||
WHERE w.id = NEW.salesPersonFk;
|
WHERE w.id = NEW.salesPersonFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE `vn`.`worker` DROP KEY `user_id_UNIQUE`;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`worker` DROP COLUMN `userFk`;
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Horas que debe trabajar un empleado según contrato y día.
|
||||||
|
* @param vDatedFrom workerTimeControl
|
||||||
|
* @param vDatedTo workerTimeControl
|
||||||
|
* @table tmp.user(userFk)
|
||||||
|
* @return tmp.timeBusinessCalculate
|
||||||
|
*/
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate;
|
||||||
|
CREATE TEMPORARY TABLE tmp.timeBusinessCalculate
|
||||||
|
(INDEX (departmentFk))
|
||||||
|
SELECT dated,
|
||||||
|
businessFk,
|
||||||
|
sub.id userFk,
|
||||||
|
departmentFk,
|
||||||
|
hourStart,
|
||||||
|
hourEnd,
|
||||||
|
timeTable,
|
||||||
|
timeWorkSeconds,
|
||||||
|
SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal,
|
||||||
|
timeWorkSeconds / 3600 timeWorkDecimal,
|
||||||
|
timeWorkSeconds timeBusinessSeconds,
|
||||||
|
SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal,
|
||||||
|
timeWorkSeconds / 3600 timeBusinessDecimal,
|
||||||
|
name type,
|
||||||
|
permissionRate,
|
||||||
|
hoursWeek,
|
||||||
|
discountRate,
|
||||||
|
isAllowedToWork
|
||||||
|
FROM(SELECT t.dated,
|
||||||
|
b.id businessFk,
|
||||||
|
w.id,
|
||||||
|
b.departmentFk,
|
||||||
|
IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.started,5) ORDER BY bs.started ASC SEPARATOR ' - ')) hourStart ,
|
||||||
|
IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.ended,5) ORDER BY bs.ended ASC SEPARATOR ' - ')) hourEnd,
|
||||||
|
IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.started,5), " - ", LEFT(bs.ended,5) ORDER BY bs.ended ASC SEPARATOR ' - ')) timeTable,
|
||||||
|
IF(bs.started = NULL, 0, IFNULL(SUM(TIME_TO_SEC(bs.ended)) - SUM(TIME_TO_SEC(bs.started)), 0)) timeWorkSeconds,
|
||||||
|
at2.name,
|
||||||
|
at2.permissionRate,
|
||||||
|
at2.discountRate,
|
||||||
|
ct.hoursWeek hoursWeek,
|
||||||
|
at2.isAllowedToWork
|
||||||
|
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.id
|
||||||
|
LEFT JOIN workCenter wc ON wc.id = b.workcenterFK
|
||||||
|
LEFT JOIN calendarType ct ON ct.id = b.calendarTypeFk
|
||||||
|
LEFT JOIN businessSchedule bs ON bs.businessFk = b.id AND bs.weekday = WEEKDAY(t.dated) + 1
|
||||||
|
LEFT JOIN calendar c ON c.businessFk = b.id AND c.dated = t.dated
|
||||||
|
LEFT JOIN absenceType at2 ON at2.id = c.dayOffTypeFk
|
||||||
|
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
|
||||||
|
GROUP BY w.id, t.dated
|
||||||
|
)sub;
|
||||||
|
|
||||||
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
LEFT JOIN businessSchedule bs ON bs.businessFk = t.businessFk
|
||||||
|
SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600,
|
||||||
|
t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600),
|
||||||
|
t.timeWorkDecimal = t.hoursWeek / 5,
|
||||||
|
t.timeBusinessSeconds = t.hoursWeek / 5 * 3600,
|
||||||
|
t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600),
|
||||||
|
t.timeBusinessDecimal = t.hoursWeek / 5
|
||||||
|
WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND bs.id IS NULL ;
|
||||||
|
|
||||||
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) ,
|
||||||
|
t.timeWorkSexagesimal = SEC_TO_TIME ((t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)) * 3600),
|
||||||
|
t.timeWorkDecimal = t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)
|
||||||
|
WHERE permissionRate <> 0;
|
||||||
|
|
||||||
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
JOIN calendarHolidays ch ON ch.dated = t.dated
|
||||||
|
JOIN business b ON b.id = t.businessFk
|
||||||
|
AND b.workcenterFk = ch.workcenterFk
|
||||||
|
SET t.timeWorkSeconds = 0,
|
||||||
|
t.timeWorkSexagesimal = 0,
|
||||||
|
t.timeWorkDecimal = 0,
|
||||||
|
t.permissionrate = 1,
|
||||||
|
t.type = 'Festivo'
|
||||||
|
WHERE t.type IS NULL;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,5 +1,5 @@
|
||||||
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
|
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
|
||||||
INSERT INTO `account`.`role` (name,description)
|
INSERT INTO `account`.`role` (name, description)
|
||||||
VALUES ('deliveryAssistant','Jefe auxiliar repartos');
|
VALUES ('deliveryAssistant','Jefe auxiliar repartos');
|
||||||
|
|
||||||
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerCreate`(
|
||||||
|
vFirstname VARCHAR(50),
|
||||||
|
vLastName VARCHAR(50),
|
||||||
|
vCode CHAR(3),
|
||||||
|
vBossFk INT,
|
||||||
|
vUserFk INT,
|
||||||
|
vFi VARCHAR(15) ,
|
||||||
|
vBirth DATE
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Create new worker
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
INSERT INTO worker(id, code, firstName, lastName, bossFk, fi, birth)
|
||||||
|
VALUES (vUserFk, vCode, vFirstname, vLastName, vBossFk, vFi, vBirth);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -87,8 +87,8 @@ INSERT INTO `vn`.`educationLevel` (`id`, `name`)
|
||||||
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
|
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
|
||||||
(2, 'ENSEÑANZAS DE BACHILLERATO');
|
(2, 'ENSEÑANZAS DE BACHILLERATO');
|
||||||
|
|
||||||
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
|
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
|
||||||
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
|
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, 9
|
||||||
FROM `account`.`user`;
|
FROM `account`.`user`;
|
||||||
|
|
||||||
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
||||||
|
@ -188,13 +188,13 @@ INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAd
|
||||||
|
|
||||||
UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1;
|
UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1;
|
||||||
|
|
||||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
|
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`,`bossFk`, `phone`)
|
||||||
VALUES
|
VALUES
|
||||||
(1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106),
|
(1106, 'LGN', 'David Charles', 'Haller', 19, 432978106),
|
||||||
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107),
|
(1107, 'ANT', 'Hank' , 'Pym' , 19, 432978107),
|
||||||
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108),
|
(1108, 'DCX', 'Charles' , 'Xavier', 19, 432978108),
|
||||||
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109),
|
(1109, 'HLK', 'Bruce' , 'Banner', 19, 432978109),
|
||||||
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110);
|
(1110, 'JJJ', 'Jessica' , 'Jones' , 19, 432978110);
|
||||||
|
|
||||||
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -26556,6 +26556,7 @@ CREATE TABLE `deviceLog` (
|
||||||
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||||
`nameApp` varchar(45) DEFAULT NULL,
|
`nameApp` varchar(45) DEFAULT NULL,
|
||||||
`versionApp` varchar(45) DEFAULT NULL,
|
`versionApp` varchar(45) DEFAULT NULL,
|
||||||
|
`serialNumber` varchar(45) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `deviceLog_FK` (`userFk`),
|
KEY `deviceLog_FK` (`userFk`),
|
||||||
CONSTRAINT `deviceLog_FK` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE
|
CONSTRAINT `deviceLog_FK` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE
|
||||||
|
|
|
@ -75,7 +75,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const worker = await models.Worker.findOne({
|
const worker = await models.Worker.findOne({
|
||||||
where: {userFk: userId}
|
where: {id: userId}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const obsevationType = await models.ObservationType.findOne({
|
const obsevationType = await models.ObservationType.findOne({
|
||||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
@ -109,7 +109,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
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 => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('logs', {
|
Self.remoteMethodCtx('logs', {
|
||||||
|
@ -12,27 +12,27 @@ module.exports = Self => {
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
description: 'The claim id',
|
description: 'The claim id',
|
||||||
http: { source: 'path' }
|
http: {source: 'path'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'filter',
|
arg: 'filter',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
http: { source: 'query' }
|
http: {source: 'query'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'search',
|
arg: 'search',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
http: { source: 'query' }
|
http: {source: 'query'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'userFk',
|
arg: 'userFk',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
http: { source: 'query' }
|
http: {source: 'query'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'created',
|
arg: 'created',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
http: { source: 'query' }
|
http: {source: 'query'}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
returns: {
|
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 conn = Self.dataSource.connector;
|
||||||
const args = ctx.args;
|
const args = ctx.args;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
@ -56,25 +56,25 @@ module.exports = Self => {
|
||||||
|
|
||||||
let where = buildFilter(args, (param, value) => {
|
let where = buildFilter(args, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
return {
|
return {
|
||||||
or: [
|
or: [
|
||||||
{ changedModel: { like: `%${value}%` } },
|
{changedModel: {like: `%${value}%`}},
|
||||||
{ oldInstance: { like: `%${value}%` } }
|
{oldInstance: {like: `%${value}%`}}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
case 'userFk':
|
case 'userFk':
|
||||||
return { 'cl.userFk': value };
|
return {'cl.userFk': value};
|
||||||
case 'created':
|
case 'created':
|
||||||
value.setHours(0, 0, 0, 0);
|
value.setHours(0, 0, 0, 0);
|
||||||
to = new Date(value);
|
to = new Date(value);
|
||||||
to.setHours(23, 59, 59, 999);
|
to.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
return { creationDate: { between: [value, to] } };
|
return {creationDate: {between: [value, to]}};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
where = mergeWhere(where, { ['cl.originFk']: id });
|
where = mergeWhere(where, {['cl.originFk']: id});
|
||||||
filter = mergeFilters(args.filter, { where });
|
filter = mergeFilters(args.filter, {where});
|
||||||
|
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Controller extends ModuleCard {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Attended by">
|
label="Attended by">
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.userFk)"
|
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{$ctrl.claim.worker.user.name}}
|
{{$ctrl.claim.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -60,7 +60,7 @@ module.exports = Self => {
|
||||||
at2.id IS NOT NULL as isCompensation
|
at2.id IS NOT NULL as isCompensation
|
||||||
FROM vn.receipt r
|
FROM vn.receipt r
|
||||||
LEFT JOIN vn.worker w ON w.id = r.workerFk
|
LEFT JOIN vn.worker w ON w.id = r.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
JOIN vn.company c ON c.id = r.companyFk
|
JOIN vn.company c ON c.id = r.companyFk
|
||||||
LEFT JOIN vn.accounting a ON a.id = r.bankFk
|
LEFT JOIN vn.accounting a ON a.id = r.bankFk
|
||||||
LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation'
|
LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation'
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = function(Self) {
|
||||||
let token = ctx.options.accessToken;
|
let token = ctx.options.accessToken;
|
||||||
let userId = token && token.userId;
|
let userId = token && token.userId;
|
||||||
|
|
||||||
Self.app.models.Worker.findOne({where: {userFk: userId}}, (err, user) => {
|
Self.app.models.Worker.findOne({where: {id: userId}}, (err, user) => {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
ctx.instance.workerFk = user.id;
|
ctx.instance.workerFk = user.id;
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "worker",
|
"relation": "worker",
|
||||||
"scope": {
|
"scope": {
|
||||||
"fields": ["userFk"],
|
"fields": ["id"],
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "user",
|
"relation": "user",
|
||||||
"scope": {
|
"scope": {
|
||||||
|
|
|
@ -9,7 +9,7 @@ export default class Controller extends Section {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
<vn-tr ng-repeat="credit in credits track by credit.id">
|
<vn-tr ng-repeat="credit in credits track by credit.id">
|
||||||
<vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
<vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, credit.worker.userFk)"
|
ng-click="workerDescriptor.show($event, credit.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::credit.worker.user.name}}
|
{{::credit.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -41,10 +41,10 @@
|
||||||
ui-sref="client.card.credit.create"
|
ui-sref="client.card.credit.create"
|
||||||
vn-acl="teamBoss"
|
vn-acl="teamBoss"
|
||||||
vn-acl-action="remove"
|
vn-acl-action="remove"
|
||||||
vn-tooltip="New credit"
|
vn-tooltip="New credit"
|
||||||
vn-bind="+"
|
vn-bind="+"
|
||||||
fixed-bottom-right>
|
fixed-bottom-right>
|
||||||
</vn-float-button>
|
</vn-float-button>
|
||||||
<vn-worker-descriptor-popover
|
<vn-worker-descriptor-popover
|
||||||
vn-id="workerDescriptor">
|
vn-id="workerDescriptor">
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Controller extends Section {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Controller extends Section {
|
||||||
}, {
|
}, {
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -180,7 +180,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN itemType it ON it.id = i.typeFk
|
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN worker w ON w.id = it.workerFk
|
LEFT JOIN worker w ON w.id = it.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
|
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
|
||||||
LEFT JOIN producer pr ON pr.id = i.producerFk
|
LEFT JOIN producer pr ON pr.id = i.producerFk
|
||||||
LEFT JOIN origin ori ON ori.id = i.originFk
|
LEFT JOIN origin ori ON ori.id = i.originFk
|
||||||
|
|
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
auto-load="true"
|
auto-load="true"
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
data="warehouses">
|
data="warehouses">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-descriptor-content
|
<vn-descriptor-content
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Buyer">
|
label="Buyer">
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)"
|
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{$ctrl.item.itemType.worker.user.name}}
|
{{$ctrl.item.itemType.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Buyer">
|
<vn-label-value label="Buyer">
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)"
|
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{$ctrl.summary.item.itemType.worker.user.name}}
|
{{$ctrl.summary.item.itemType.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -215,7 +215,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN state st ON st.id = ts.stateFk
|
LEFT JOIN state st ON st.id = ts.stateFk
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`);
|
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`);
|
||||||
|
|
||||||
if (args.orderFk) {
|
if (args.orderFk) {
|
||||||
|
|
|
@ -169,7 +169,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN agencyMode am ON am.id = o.agency_id
|
LEFT JOIN agencyMode am ON am.id = o.agency_id
|
||||||
LEFT JOIN client c ON c.id = o.customer_id
|
LEFT JOIN client c ON c.id = o.customer_id
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN company co ON co.id = o.company_id
|
LEFT JOIN company co ON co.id = o.company_id
|
||||||
LEFT JOIN orderTicket ot ON ot.orderFk = o.id
|
LEFT JOIN orderTicket ot ON ot.orderFk = o.id
|
||||||
LEFT JOIN ticket t ON t.id = ot.ticketFk
|
LEFT JOIN ticket t ON t.id = ot.ticketFk
|
||||||
|
|
|
@ -111,7 +111,7 @@ module.exports = Self => {
|
||||||
let stmt;
|
let stmt;
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(
|
stmt = new ParameterizedSQL(
|
||||||
`SELECT
|
`SELECT
|
||||||
r.id,
|
r.id,
|
||||||
r.workerFk,
|
r.workerFk,
|
||||||
r.created,
|
r.created,
|
||||||
|
@ -134,7 +134,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||||
LEFT JOIN worker w ON w.id = r.workerFk
|
LEFT JOIN worker w ON w.id = r.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk`
|
LEFT JOIN account.user u ON u.id = w.id`
|
||||||
);
|
);
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
|
|
@ -33,7 +33,7 @@ module.exports = Self => {
|
||||||
}, {
|
}, {
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'userFk'],
|
fields: ['id'],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"supplier": {
|
"supplier": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Controller extends ModuleCard {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Controller extends Descriptor {
|
||||||
}, {
|
}, {
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Controller extends ModuleCard {
|
||||||
include: [
|
include: [
|
||||||
{relation: 'worker',
|
{relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Controller extends Summary {
|
||||||
include: [
|
include: [
|
||||||
{relation: 'worker',
|
{relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -91,7 +91,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -41,7 +41,7 @@ module.exports = Self => {
|
||||||
FROM saleTracking st
|
FROM saleTracking st
|
||||||
JOIN sale s ON s.id = st.saleFk
|
JOIN sale s ON s.id = st.saleFk
|
||||||
JOIN worker w ON w.id = st.workerFk
|
JOIN worker w ON w.id = st.workerFk
|
||||||
JOIN account.user u ON u.id = w.userFk
|
JOIN account.user u ON u.id = w.id
|
||||||
JOIN state ste ON ste.id = st.stateFk`);
|
JOIN state ste ON ste.id = st.stateFk`);
|
||||||
|
|
||||||
stmt.merge(Self.makeSuffix(filter));
|
stmt.merge(Self.makeSuffix(filter));
|
||||||
|
|
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const worker = await Self.app.models.Worker.findOne({where: {userFk: userId}}, myOptions);
|
const worker = await Self.app.models.Worker.findOne({where: {id: userId}}, myOptions);
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
isOk: false,
|
isOk: false,
|
||||||
|
|
|
@ -153,9 +153,9 @@ module.exports = Self => {
|
||||||
LEFT JOIN item i ON i.id = tr.itemFk
|
LEFT JOIN item i ON i.id = tr.itemFk
|
||||||
LEFT JOIN sale s ON s.id = tr.saleFk
|
LEFT JOIN sale s ON s.id = tr.saleFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN worker wka ON wka.id = tr.attenderFk
|
LEFT JOIN worker wka ON wka.id = tr.attenderFk
|
||||||
LEFT JOIN account.user ua ON ua.id = wka.userFk`);
|
LEFT JOIN account.user ua ON ua.id = wka.id`);
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
|
||||||
return conn.executeStmt(stmt, myOptions);
|
return conn.executeStmt(stmt, myOptions);
|
||||||
|
|
|
@ -53,7 +53,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (!params.workerFk) {
|
if (!params.workerFk) {
|
||||||
const worker = await models.Worker.findOne({
|
const worker = await models.Worker.findOne({
|
||||||
where: {userFk: userId}
|
where: {id: userId}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
params.workerFk = worker.id;
|
params.workerFk = worker.id;
|
||||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
||||||
fields: ['id', 'name', 'alertLevel', 'code']
|
fields: ['id', 'name', 'alertLevel', 'code']
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const worker = await models.Worker.findOne({where: {userFk: userId}}, myOptions);
|
const worker = await models.Worker.findOne({where: {id: userId}}, myOptions);
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
for (const id of ticketIds) {
|
for (const id of ticketIds) {
|
||||||
|
|
|
@ -272,7 +272,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN state st ON st.id = ts.stateFk
|
LEFT JOIN state st ON st.id = ts.stateFk
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN route r ON r.id = t.routeFk`);
|
LEFT JOIN route r ON r.id = t.routeFk`);
|
||||||
|
|
||||||
if (args.orderFk) {
|
if (args.orderFk) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = function(Self) {
|
||||||
Self.observe('before save', async function(ctx) {
|
Self.observe('before save', async function(ctx) {
|
||||||
if (ctx.isNewInstance) {
|
if (ctx.isNewInstance) {
|
||||||
const loopBackContext = LoopBackContext.getCurrentContext();
|
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||||
const filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
|
const filter = {where: {id: loopBackContext.active.accessToken.userId}};
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const worker = await models.Worker.findOne(filter);
|
const worker = await models.Worker.findOne(filter);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Controller extends Section {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Controller extends Section {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -102,7 +102,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('DROP TEMPORARY TABLE IF EXISTS tmp.`user`');
|
stmt = new ParameterizedSQL('DROP TEMPORARY TABLE IF EXISTS tmp.`user`');
|
||||||
stmts.push(stmt);
|
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);
|
stmts.push(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ module.exports = Self => {
|
||||||
const query =
|
const query =
|
||||||
`SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname
|
`SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname
|
||||||
FROM worker w
|
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.roleRole i ON i.role = u.role
|
||||||
JOIN account.role r ON r.id = i.inheritsFrom`;
|
JOIN account.role r ON r.id = i.inheritsFrom`;
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,6 @@ module.exports = Self => {
|
||||||
]};
|
]};
|
||||||
case 'id':
|
case 'id':
|
||||||
return {'w.id': value};
|
return {'w.id': value};
|
||||||
case 'userFk':
|
|
||||||
return {'w.userFk': value};
|
|
||||||
case 'firstName':
|
case 'firstName':
|
||||||
return {'w.firstName': {like: `%${value}%`}};
|
return {'w.firstName': {like: `%${value}%`}};
|
||||||
case 'lastName':
|
case 'lastName':
|
||||||
|
@ -123,8 +121,8 @@ module.exports = Self => {
|
||||||
FROM worker w
|
FROM worker w
|
||||||
LEFT JOIN workerDepartment wd ON wd.workerFk = w.id
|
LEFT JOIN workerDepartment wd ON wd.workerFk = w.id
|
||||||
LEFT JOIN department d ON d.id = wd.departmentFk
|
LEFT JOIN department d ON d.id = wd.departmentFk
|
||||||
LEFT JOIN client c ON c.id = w.userFk
|
LEFT JOIN client c ON c.id = w.id
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
LEFT JOIN pbx.sip p ON p.user_id = u.id
|
LEFT JOIN pbx.sip p ON p.user_id = u.id
|
||||||
LEFT JOIN account.emailUser mu ON mu.userFk = u.id`
|
LEFT JOIN account.emailUser mu ON mu.userFk = u.id`
|
||||||
);
|
);
|
||||||
|
|
|
@ -38,12 +38,12 @@ module.exports = Self => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
|
|
||||||
const worker = await models.Worker.findById(id);
|
const worker = await models.Worker.findById(id);
|
||||||
const userId = worker.userFk;
|
const userId = worker.id;
|
||||||
|
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
|
|
||||||
stmts.push(`
|
stmts.push(`
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
DROP TEMPORARY TABLE IF EXISTS
|
||||||
tmp.timeControlCalculate,
|
tmp.timeControlCalculate,
|
||||||
tmp.timeBusinessCalculate
|
tmp.timeBusinessCalculate
|
||||||
`);
|
`);
|
||||||
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const resultIndex = stmts.push(new ParameterizedSQL(`
|
const resultIndex = stmts.push(new ParameterizedSQL(`
|
||||||
SELECT tcc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours
|
SELECT tcc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours
|
||||||
FROM tmp.timeControlCalculate tcc
|
FROM tmp.timeControlCalculate tcc
|
||||||
LEFT JOIN tmp.timeBusinessCalculate tbc ON tcc.dated = tbc.dated
|
LEFT JOIN tmp.timeBusinessCalculate tbc ON tcc.dated = tbc.dated
|
||||||
WHERE tcc.dated BETWEEN DATE(?) AND DATE(?)
|
WHERE tcc.dated BETWEEN DATE(?) AND DATE(?)
|
||||||
`, [started, ended])) - 1;
|
`, [started, ended])) - 1;
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
},
|
},
|
||||||
"deviceProductionFk": {
|
"deviceProductionFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"serialNumber": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"warehouse": {
|
"warehouse": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
"phone": {
|
"phone": {
|
||||||
"type" : "string"
|
"type" : "string"
|
||||||
},
|
},
|
||||||
"userFk": {
|
|
||||||
"type" : "number"
|
|
||||||
},
|
|
||||||
"bossFk": {
|
"bossFk": {
|
||||||
"type" : "number"
|
"type" : "number"
|
||||||
},
|
},
|
||||||
|
@ -66,12 +63,12 @@
|
||||||
"client": {
|
"client": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Client",
|
"model": "Client",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"sip": {
|
"sip": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Sip",
|
"model": "Sip",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"department": {
|
"department": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
vn-one
|
vn-one
|
||||||
label="User id"
|
label="User id"
|
||||||
ng-model="filter.userFk">
|
ng-model="filter.id">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -64,4 +64,4 @@
|
||||||
<vn-submit label="Search"></vn-submit>
|
<vn-submit label="Search"></vn-submit>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<h4 translate>User data</h4>
|
<h4 translate>User data</h4>
|
||||||
<vn-label-value label="User id"
|
<vn-label-value label="User id"
|
||||||
value="{{worker.userFk}}">
|
value="{{worker.id}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="User"
|
<vn-label-value label="User"
|
||||||
value="{{worker.user.name}}">
|
value="{{worker.user.name}}">
|
||||||
|
|
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
||||||
const ticketList = await models.Ticket.find(filter, myOptions);
|
const ticketList = await models.Ticket.find(filter, myOptions);
|
||||||
const fixingState = await models.State.findOne({where: {code: 'FIXING'}}, myOptions);
|
const fixingState = await models.State.findOne({where: {code: 'FIXING'}}, myOptions);
|
||||||
const worker = await models.Worker.findOne({
|
const worker = await models.Worker.findOne({
|
||||||
where: {userFk: userId}
|
where: {id: userId}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
await models.Ticket.rawSql('UPDATE ticket SET zoneFk = NULL WHERE zoneFk = ?', [id], myOptions);
|
await models.Ticket.rawSql('UPDATE ticket SET zoneFk = NULL WHERE zoneFk = ?', [id], myOptions);
|
||||||
|
|
|
@ -7,5 +7,5 @@ SELECT
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN account.user u ON u.id = c.id
|
JOIN account.user u ON u.id = c.id
|
||||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
LEFT JOIN account.user wu ON wu.id = w.id
|
||||||
WHERE c.id = ?
|
WHERE c.id = ?
|
||||||
|
|
|
@ -8,5 +8,5 @@ SELECT
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN account.user u ON u.id = c.id
|
JOIN account.user u ON u.id = c.id
|
||||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
LEFT JOIN account.user wu ON wu.id = w.id
|
||||||
WHERE c.id = ?
|
WHERE c.id = ?
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
SELECT
|
SELECT
|
||||||
r.id,
|
r.id,
|
||||||
r.m3,
|
r.m3,
|
||||||
r.created,
|
r.created,
|
||||||
|
@ -11,9 +11,9 @@ SELECT
|
||||||
FROM route r
|
FROM route r
|
||||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||||
LEFT JOIN worker w ON w.id = r.workerFk
|
LEFT JOIN worker w ON w.id = r.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN agency a ON a.id = am.agencyFk
|
LEFT JOIN agency a ON a.id = am.agencyFk
|
||||||
LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id
|
LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id
|
||||||
LEFT JOIN supplier s ON s.id = sa.supplierFk
|
LEFT JOIN supplier s ON s.id = sa.supplierFk
|
||||||
WHERE r.id IN(?)
|
WHERE r.id IN(?)
|
||||||
|
|
Loading…
Reference in New Issue