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
|
||||
- (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
|
||||
- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
"worker": {
|
||||
"type": "hasOne",
|
||||
"model": "Worker",
|
||||
"foreignKey": "userFk"
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"userConfig": {
|
||||
"type": "hasOne",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
INSERT INTO `account`.`role` (name,description)
|
||||
INSERT INTO `account`.`role` (name, description)
|
||||
VALUES ('deliveryAssistant','Jefe auxiliar repartos');
|
||||
|
||||
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'),
|
||||
(2, 'ENSEÑANZAS DE BACHILLERATO');
|
||||
|
||||
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
|
||||
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
|
||||
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
|
||||
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, 9
|
||||
FROM `account`.`user`;
|
||||
|
||||
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;
|
||||
|
||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
|
||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`,`bossFk`, `phone`)
|
||||
VALUES
|
||||
(1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106),
|
||||
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107),
|
||||
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108),
|
||||
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109),
|
||||
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110);
|
||||
(1106, 'LGN', 'David Charles', 'Haller', 19, 432978106),
|
||||
(1107, 'ANT', 'Hank' , 'Pym' , 19, 432978107),
|
||||
(1108, 'DCX', 'Charles' , 'Xavier', 19, 432978108),
|
||||
(1109, 'HLK', 'Bruce' , 'Banner', 19, 432978109),
|
||||
(1110, 'JJJ', 'Jessica' , 'Jones' , 19, 432978110);
|
||||
|
||||
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
||||
VALUES
|
||||
|
|
|
@ -26556,6 +26556,7 @@ CREATE TABLE `deviceLog` (
|
|||
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`nameApp` varchar(45) DEFAULT NULL,
|
||||
`versionApp` varchar(45) DEFAULT NULL,
|
||||
`serialNumber` varchar(45) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `deviceLog_FK` (`userFk`),
|
||||
CONSTRAINT `deviceLog_FK` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE
|
||||
|
|
|
@ -75,7 +75,7 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
const worker = await models.Worker.findOne({
|
||||
where: {userFk: userId}
|
||||
where: {id: userId}
|
||||
}, myOptions);
|
||||
|
||||
const obsevationType = await models.ObservationType.findOne({
|
||||
|
|
|
@ -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 = {};
|
||||
|
@ -56,25 +56,25 @@ module.exports = Self => {
|
|||
|
||||
let where = buildFilter(args, (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return {
|
||||
or: [
|
||||
{ changedModel: { like: `%${value}%` } },
|
||||
{ oldInstance: { like: `%${value}%` } }
|
||||
]
|
||||
};
|
||||
case 'userFk':
|
||||
return { 'cl.userFk': value };
|
||||
case 'created':
|
||||
value.setHours(0, 0, 0, 0);
|
||||
to = new Date(value);
|
||||
to.setHours(23, 59, 59, 999);
|
||||
case 'search':
|
||||
return {
|
||||
or: [
|
||||
{changedModel: {like: `%${value}%`}},
|
||||
{oldInstance: {like: `%${value}%`}}
|
||||
]
|
||||
};
|
||||
case 'userFk':
|
||||
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: {
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<vn-label-value
|
||||
label="Attended by">
|
||||
<span
|
||||
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.userFk)"
|
||||
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.id)"
|
||||
class="link">
|
||||
{{$ctrl.claim.worker.user.name}}
|
||||
</span>
|
||||
|
|
|
@ -60,7 +60,7 @@ module.exports = Self => {
|
|||
at2.id IS NOT NULL as isCompensation
|
||||
FROM vn.receipt r
|
||||
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
|
||||
LEFT JOIN vn.accounting a ON a.id = r.bankFk
|
||||
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 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);
|
||||
ctx.instance.workerFk = user.id;
|
||||
next();
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
"include": {
|
||||
"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: {
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
<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>
|
||||
<span
|
||||
ng-click="workerDescriptor.show($event, credit.worker.userFk)"
|
||||
<span
|
||||
ng-click="workerDescriptor.show($event, credit.worker.id)"
|
||||
class="link">
|
||||
{{::credit.worker.user.name}}
|
||||
</span>
|
||||
|
@ -41,10 +41,10 @@
|
|||
ui-sref="client.card.credit.create"
|
||||
vn-acl="teamBoss"
|
||||
vn-acl-action="remove"
|
||||
vn-tooltip="New credit"
|
||||
vn-tooltip="New credit"
|
||||
vn-bind="+"
|
||||
fixed-bottom-right>
|
||||
</vn-float-button>
|
||||
<vn-worker-descriptor-popover
|
||||
<vn-worker-descriptor-popover
|
||||
vn-id="workerDescriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
</vn-worker-descriptor-popover>
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -180,7 +180,7 @@ module.exports = Self => {
|
|||
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
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 producer pr ON pr.id = i.producerFk
|
||||
LEFT JOIN origin ori ON ori.id = i.originFk
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
auto-load="true"
|
||||
url="Warehouses"
|
||||
auto-load="true"
|
||||
url="Warehouses"
|
||||
data="warehouses">
|
||||
</vn-crud-model>
|
||||
<vn-descriptor-content
|
||||
|
@ -58,7 +58,7 @@
|
|||
<vn-label-value
|
||||
label="Buyer">
|
||||
<span
|
||||
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)"
|
||||
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.id)"
|
||||
class="link">
|
||||
{{$ctrl.item.itemType.worker.user.name}}
|
||||
</span>
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
</vn-label-value>
|
||||
<vn-label-value label="Buyer">
|
||||
<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">
|
||||
{{$ctrl.summary.item.itemType.worker.user.name}}
|
||||
</span>
|
||||
|
|
|
@ -215,7 +215,7 @@ module.exports = Self => {
|
|||
LEFT JOIN state st ON st.id = ts.stateFk
|
||||
LEFT JOIN client c ON c.id = t.clientFk
|
||||
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`);
|
||||
|
||||
if (args.orderFk) {
|
||||
|
|
|
@ -169,7 +169,7 @@ module.exports = Self => {
|
|||
LEFT JOIN agencyMode am ON am.id = o.agency_id
|
||||
LEFT JOIN client c ON c.id = o.customer_id
|
||||
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 orderTicket ot ON ot.orderFk = o.id
|
||||
LEFT JOIN ticket t ON t.id = ot.ticketFk
|
||||
|
|
|
@ -111,7 +111,7 @@ module.exports = Self => {
|
|||
let stmt;
|
||||
|
||||
stmt = new ParameterizedSQL(
|
||||
`SELECT
|
||||
`SELECT
|
||||
r.id,
|
||||
r.workerFk,
|
||||
r.created,
|
||||
|
@ -134,7 +134,7 @@ module.exports = Self => {
|
|||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||
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));
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = Self => {
|
|||
}, {
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id', 'userFk'],
|
||||
fields: ['id'],
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "userFk"
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"supplier": {
|
||||
"type": "belongsTo",
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "userFk"
|
||||
"foreignKey": "id"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -41,7 +41,7 @@ module.exports = Self => {
|
|||
FROM saleTracking st
|
||||
JOIN sale s ON s.id = st.saleFk
|
||||
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`);
|
||||
|
||||
stmt.merge(Self.makeSuffix(filter));
|
||||
|
|
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
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 = {
|
||||
isOk: false,
|
||||
|
|
|
@ -153,9 +153,9 @@ module.exports = Self => {
|
|||
LEFT JOIN item i ON i.id = tr.itemFk
|
||||
LEFT JOIN sale s ON s.id = tr.saleFk
|
||||
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 account.user ua ON ua.id = wka.userFk`);
|
||||
LEFT JOIN account.user ua ON ua.id = wka.id`);
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
|
||||
return conn.executeStmt(stmt, myOptions);
|
||||
|
|
|
@ -53,7 +53,7 @@ module.exports = Self => {
|
|||
|
||||
if (!params.workerFk) {
|
||||
const worker = await models.Worker.findOne({
|
||||
where: {userFk: userId}
|
||||
where: {id: userId}
|
||||
}, myOptions);
|
||||
|
||||
params.workerFk = worker.id;
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
|||
fields: ['id', 'name', 'alertLevel', 'code']
|
||||
}, myOptions);
|
||||
|
||||
const worker = await models.Worker.findOne({where: {userFk: userId}}, myOptions);
|
||||
const worker = await models.Worker.findOne({where: {id: userId}}, myOptions);
|
||||
|
||||
const promises = [];
|
||||
for (const id of ticketIds) {
|
||||
|
|
|
@ -272,7 +272,7 @@ module.exports = Self => {
|
|||
LEFT JOIN state st ON st.id = ts.stateFk
|
||||
LEFT JOIN client c ON c.id = t.clientFk
|
||||
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`);
|
||||
|
||||
if (args.orderFk) {
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = function(Self) {
|
|||
Self.observe('before save', async function(ctx) {
|
||||
if (ctx.isNewInstance) {
|
||||
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 worker = await models.Worker.findOne(filter);
|
||||
|
||||
|
|
|
@ -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`;
|
||||
|
||||
|
|
|
@ -95,8 +95,6 @@ module.exports = Self => {
|
|||
]};
|
||||
case 'id':
|
||||
return {'w.id': value};
|
||||
case 'userFk':
|
||||
return {'w.userFk': value};
|
||||
case 'firstName':
|
||||
return {'w.firstName': {like: `%${value}%`}};
|
||||
case 'lastName':
|
||||
|
@ -123,8 +121,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`
|
||||
);
|
||||
|
|
|
@ -38,12 +38,12 @@ module.exports = Self => {
|
|||
const conn = Self.dataSource.connector;
|
||||
|
||||
const worker = await models.Worker.findById(id);
|
||||
const userId = worker.userFk;
|
||||
const userId = worker.id;
|
||||
|
||||
const stmts = [];
|
||||
|
||||
stmts.push(`
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
tmp.timeControlCalculate,
|
||||
tmp.timeBusinessCalculate
|
||||
`);
|
||||
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
|||
|
||||
const resultIndex = stmts.push(new ParameterizedSQL(`
|
||||
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
|
||||
WHERE tcc.dated BETWEEN DATE(?) AND DATE(?)
|
||||
`, [started, ended])) - 1;
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
},
|
||||
"deviceProductionFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"serialNumber": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
"worker": {
|
||||
"type": "hasOne",
|
||||
"model": "Worker",
|
||||
"foreignKey": "userFk"
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"warehouse": {
|
||||
"type": "belongsTo",
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
"phone": {
|
||||
"type" : "string"
|
||||
},
|
||||
"userFk": {
|
||||
"type" : "number"
|
||||
},
|
||||
"bossFk": {
|
||||
"type" : "number"
|
||||
},
|
||||
|
@ -66,12 +63,12 @@
|
|||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "userFk"
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"sip": {
|
||||
"type": "belongsTo",
|
||||
"model": "Sip",
|
||||
"foreignKey": "userFk"
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"department": {
|
||||
"type": "belongsTo",
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<vn-textfield
|
||||
vn-one
|
||||
label="User id"
|
||||
ng-model="filter.userFk">
|
||||
ng-model="filter.id">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
@ -64,4 +64,4 @@
|
|||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<vn-one>
|
||||
<h4 translate>User data</h4>
|
||||
<vn-label-value label="User id"
|
||||
value="{{worker.userFk}}">
|
||||
value="{{worker.id}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="User"
|
||||
value="{{worker.user.name}}">
|
||||
|
|
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
|||
const ticketList = await models.Ticket.find(filter, myOptions);
|
||||
const fixingState = await models.State.findOne({where: {code: 'FIXING'}}, myOptions);
|
||||
const worker = await models.Worker.findOne({
|
||||
where: {userFk: userId}
|
||||
where: {id: userId}
|
||||
}, myOptions);
|
||||
|
||||
await models.Ticket.rawSql('UPDATE ticket SET zoneFk = NULL WHERE zoneFk = ?', [id], myOptions);
|
||||
|
|
|
@ -7,5 +7,5 @@ SELECT
|
|||
FROM client c
|
||||
JOIN account.user u ON u.id = c.id
|
||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
||||
WHERE c.id = ?
|
||||
LEFT JOIN account.user wu ON wu.id = w.id
|
||||
WHERE c.id = ?
|
||||
|
|
|
@ -8,5 +8,5 @@ SELECT
|
|||
FROM client c
|
||||
JOIN account.user u ON u.id = c.id
|
||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
||||
WHERE c.id = ?
|
||||
LEFT JOIN account.user wu ON wu.id = w.id
|
||||
WHERE c.id = ?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SELECT
|
||||
SELECT
|
||||
r.id,
|
||||
r.m3,
|
||||
r.created,
|
||||
|
@ -11,9 +11,9 @@ SELECT
|
|||
FROM route r
|
||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||
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 agency a ON a.id = am.agencyFk
|
||||
LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id
|
||||
LEFT JOIN supplier s ON s.id = sa.supplierFk
|
||||
WHERE r.id IN(?)
|
||||
WHERE r.id IN(?)
|
||||
|
|
Loading…
Reference in New Issue