Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4308-report_vehicleEventExpired
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
62d5514798
|
@ -2,10 +2,10 @@ const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('ticket getCollection()', () => {
|
describe('ticket getCollection()', () => {
|
||||||
it('should return a list of collections', async() => {
|
it('should return a list of collections', async() => {
|
||||||
let ctx = {req: {accessToken: {userId: 1106}}};
|
let ctx = {req: {accessToken: {userId: 1107}}};
|
||||||
let response = await models.Collection.getCollection(ctx);
|
let response = await models.Collection.getCollection(ctx);
|
||||||
|
|
||||||
expect(response.length).toBeGreaterThan(0);
|
expect(response.length).toBeGreaterThan(0);
|
||||||
expect(response[0].collectionFk).toEqual(1);
|
expect(response[0].collectionFk).toEqual(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
const jsdom = require('jsdom');
|
||||||
|
const mysql = require('mysql');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('closeTicket', {
|
||||||
|
description: 'Close tickets without response from the user',
|
||||||
|
accessType: 'READ',
|
||||||
|
returns: {
|
||||||
|
type: 'Object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/closeTicket`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.closeTicket = async ctx => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const config = await models.OsTicketConfig.findOne();
|
||||||
|
const ostUri = `${config.host}/login.php`;
|
||||||
|
|
||||||
|
if (!config.user || !config.password || !config.userDb || !config.passwordDb)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const con = mysql.createConnection({
|
||||||
|
host: `${config.hostDb}`,
|
||||||
|
user: `${config.userDb}`,
|
||||||
|
password: `${config.passwordDb}`,
|
||||||
|
port: `${config.portDb}`
|
||||||
|
});
|
||||||
|
|
||||||
|
const sql = `SELECT ot.ticket_id, ot.number
|
||||||
|
FROM osticket.ost_ticket ot
|
||||||
|
JOIN osticket.ost_ticket_status ots ON ots.id = ot.status_id
|
||||||
|
JOIN osticket.ost_thread ot2 ON ot2.object_id = ot.ticket_id AND ot2.object_type = 'T'
|
||||||
|
JOIN (
|
||||||
|
SELECT ote.thread_id, MAX(ote.created) created, MAX(ote.updated) updated
|
||||||
|
FROM osticket.ost_thread_entry ote
|
||||||
|
WHERE ote.staff_id != 0 AND ote.type = 'R'
|
||||||
|
GROUP BY ote.thread_id
|
||||||
|
) sub ON sub.thread_id = ot2.id
|
||||||
|
WHERE ot.isanswered = 1
|
||||||
|
AND ots.state = '${config.oldStatus}'
|
||||||
|
AND IF(sub.updated > sub.created, sub.updated, sub.created) < DATE_SUB(CURDATE(), INTERVAL ${config.day} DAY)`;
|
||||||
|
|
||||||
|
let ticketsId = [];
|
||||||
|
con.connect(err => {
|
||||||
|
if (err) throw err;
|
||||||
|
con.query(sql, (err, results) => {
|
||||||
|
if (err) throw err;
|
||||||
|
for (const result of results)
|
||||||
|
ticketsId.push(result.ticket_id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
await requestToken();
|
||||||
|
|
||||||
|
async function requestToken() {
|
||||||
|
const response = await fetch(ostUri);
|
||||||
|
|
||||||
|
const result = response.headers.get('set-cookie');
|
||||||
|
const [firtHeader] = result.split(' ');
|
||||||
|
const firtCookie = firtHeader.substring(0, firtHeader.length - 1);
|
||||||
|
const body = await response.text();
|
||||||
|
const dom = new jsdom.JSDOM(body);
|
||||||
|
const token = dom.window.document.querySelector('[name="__CSRFToken__"]').value;
|
||||||
|
|
||||||
|
await login(token, firtCookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function login(token, firtCookie) {
|
||||||
|
const data = {
|
||||||
|
__CSRFToken__: token,
|
||||||
|
do: 'scplogin',
|
||||||
|
userid: config.user,
|
||||||
|
passwd: config.password,
|
||||||
|
ajax: 1
|
||||||
|
};
|
||||||
|
const params = {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams(data),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
|
'Cookie': firtCookie
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const response = await fetch(ostUri, params);
|
||||||
|
const result = response.headers.get('set-cookie');
|
||||||
|
const [firtHeader] = result.split(' ');
|
||||||
|
const secondCookie = firtHeader.substring(0, firtHeader.length - 1);
|
||||||
|
|
||||||
|
await close(token, secondCookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function close(token, secondCookie) {
|
||||||
|
for (const ticketId of ticketsId) {
|
||||||
|
const ostUri = `${config.host}/ajax.php/tickets/${ticketId}/status`;
|
||||||
|
const data = {
|
||||||
|
status_id: config.newStatusId,
|
||||||
|
comments: config.comment,
|
||||||
|
undefined: config.action
|
||||||
|
};
|
||||||
|
const params = {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams(data),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
|
'X-CSRFToken': token,
|
||||||
|
'Cookie': secondCookie
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return fetch(ostUri, params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -116,6 +116,9 @@
|
||||||
"OsTicket": {
|
"OsTicket": {
|
||||||
"dataSource": "osticket"
|
"dataSource": "osticket"
|
||||||
},
|
},
|
||||||
|
"OsTicketConfig": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Edi": {
|
"Edi": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"name": "OsTicketConfig",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "osTicketConfig"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"host": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"oldStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"newStatusId": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"day": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"comment": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"hostDb": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"userDb": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passwordDb": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"portDb": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/osticket/closeTicket')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('OsTicket', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('OsTicketConfig', '*', '*', 'ALLOW', 'ROLE', 'it');
|
|
@ -0,0 +1,20 @@
|
||||||
|
CREATE TABLE `vn`.`osTicketConfig` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`host` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`user` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`password` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`oldStatus` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`newStatusId` int(11) DEFAULT NULL,
|
||||||
|
`action` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`day` int(11) DEFAULT NULL,
|
||||||
|
`comment` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`hostDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`userDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`passwordDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`portDb` int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`)
|
||||||
|
VALUES
|
||||||
|
(0, 'https://cau.verdnatura.es/scp', NULL, NULL, 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente', NULL, NULL, NULL, NULL);
|
File diff suppressed because one or more lines are too long
|
@ -1765,11 +1765,6 @@ INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`)
|
||||||
(4, 'Reclam.PRAG', 12),
|
(4, 'Reclam.PRAG', 12),
|
||||||
(5, 'Corregido', 11);
|
(5, 'Corregido', 11);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimResponsible`(`id`, `description`, `responsability`)
|
|
||||||
VALUES
|
|
||||||
(1, 'Buyers', 0),
|
|
||||||
(7, 'Quality', 0);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `workerFk`, `claimReasonFk`, `claimResultFk`, `claimRedeliveryFk`, `claimDestinationFk`)
|
INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `workerFk`, `claimReasonFk`, `claimResultFk`, `claimRedeliveryFk`, `claimDestinationFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 21, 1, 1, 2, 5),
|
(1, 1, 1, 21, 1, 1, 2, 5),
|
||||||
|
@ -1877,50 +1872,40 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
|
||||||
(5, 1102),
|
(5, 1102),
|
||||||
(9, 1201);
|
(9, 1201);
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`profile`(`profile_id`, `workerFk`, `profile_type_id`)
|
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
||||||
SELECT w.id, w.id, 1
|
CREATE TEMPORARY TABLE tmp.worker
|
||||||
|
(PRIMARY KEY (id))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT w.id, w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-12-25'), CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||||
FROM `vn`.`worker` `w`;
|
FROM `vn`.`worker` `w`;
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `companyCodeFk`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
|
INSERT INTO `vn`.`business`(`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`)
|
||||||
SELECT p.profile_id, p.profile_id, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL
|
SELECT * FROM tmp.worker;
|
||||||
FROM `postgresql`.`profile` `p`;
|
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
|
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
||||||
SELECT b.business_id, NULL, 23, 1, 0, 1, 1, 1, 1
|
CREATE TEMPORARY TABLE tmp.worker
|
||||||
FROM `postgresql`.`business` `b`;
|
(PRIMARY KEY (id))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT '1111' as 'id', w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||||
|
FROM `vn`.`worker` `w`
|
||||||
|
WHERE `w`.`id` = 1109;
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business` (`client_id`, `companyCodeFk`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
|
INSERT INTO `vn`.`business` (`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`)
|
||||||
SELECT p.profile_id, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL
|
SELECT * FROM tmp.worker;
|
||||||
FROM `postgresql`.`profile` `p`
|
|
||||||
WHERE `p`.`profile_id` = 1109;
|
|
||||||
|
|
||||||
UPDATE `postgresql`.`business`
|
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business`
|
||||||
SET `payedHolidays`= 8
|
SET `payedHolidays`= 8
|
||||||
WHERE `business_id`= 1106;
|
WHERE `id`= 1106;
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business_labour` (`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
|
UPDATE `vn`.`business` b
|
||||||
VALUES
|
SET b.`workerBusinessProfessionalCategoryFk` = 31
|
||||||
(1111, NULL, 23, 1, 0.0, 1, 1, 1, 1);
|
WHERE b.`workerFk` = 1110;
|
||||||
|
|
||||||
UPDATE `postgresql`.`business_labour` bl
|
UPDATE `vn`.`business` b
|
||||||
JOIN `postgresql`.`business` b ON b.business_id = bl.business_id
|
SET b.`departmentFk` = 43
|
||||||
JOIN `postgresql`.`profile` pr ON pr.profile_id = b.client_id
|
WHERE b.id IN(18, 19);
|
||||||
SET bl.`professional_category_id` = 31
|
|
||||||
WHERE pr.`workerFk` = 1110;
|
|
||||||
|
|
||||||
UPDATE `postgresql`.`business_labour` bl
|
|
||||||
SET bl.`department_id` = 43
|
|
||||||
WHERE business_id IN(18, 19);
|
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`media`(`media_id`, `media_type_id`, `value`, `sort`)
|
|
||||||
VALUES
|
|
||||||
(1, 10, 600123321, 0),
|
|
||||||
(2, 10, 700987987, 0);
|
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`profile_media`(`profile_media_id`, `profile_id`, `media_id`)
|
|
||||||
VALUES
|
|
||||||
(1, 1106, 1),
|
|
||||||
(2, 1107, 2);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1929,20 +1914,39 @@ INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||||
('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))),
|
('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))),
|
||||||
('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)));
|
('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)));
|
||||||
|
|
||||||
ALTER TABLE `postgresql`.`business_labour_payroll` DROP FOREIGN KEY `business_labour_payroll_cod_categoria`;
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`, `hasHolidayEntitlement`)
|
INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`, `hasHolidayEntitlement`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'CONTRATO HOLANDA', 1, 0, 1),
|
(1, 'CONTRATO HOLANDA', 1, 0, 1),
|
||||||
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
|
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
|
||||||
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
|
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business_labour_payroll` (`business_id`, `cod_tarifa`, `cod_categoria`, `cod_contrato`, `importepactado`)
|
UPDATE `vn`.`business` b
|
||||||
VALUES
|
SET `rate` = 7,
|
||||||
(1, 7, 12, 100, 900.50),
|
`workerBusinessCategoryFk` = 12,
|
||||||
(1106, 7, 12, 100, 1263.03),
|
`workerBusinessTypeFk` = 100,
|
||||||
(1107, 7, 12, 100, 2000),
|
`amount` = 900.50
|
||||||
(1108, 7, 12, 100, 1500);
|
WHERE b.id = 1;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business` b
|
||||||
|
SET `rate` = 7,
|
||||||
|
`workerBusinessCategoryFk` = 12,
|
||||||
|
`workerBusinessTypeFk` = 100,
|
||||||
|
`amount` = 1263.03
|
||||||
|
WHERE b.id = 1106;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business` b
|
||||||
|
SET `rate` = 7,
|
||||||
|
`workerBusinessCategoryFk` = 12,
|
||||||
|
`workerBusinessTypeFk` = 100,
|
||||||
|
`amount` = 2000
|
||||||
|
WHERE b.id = 1107;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business` b
|
||||||
|
SET `rate` = 7,
|
||||||
|
`workerBusinessCategoryFk` = 12,
|
||||||
|
`workerBusinessTypeFk` = 100,
|
||||||
|
`amount` = 1500
|
||||||
|
WHERE b.id = 1108;
|
||||||
|
|
||||||
INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`)
|
INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1953,7 +1957,7 @@ INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlement
|
||||||
(20, 'Furlough', '#97B92F', 'furlough', 1, 1),
|
(20, 'Furlough', '#97B92F', 'furlough', 1, 1),
|
||||||
(21, 'Furlough half day', '#778899', 'halfFurlough', 0.5, 1);
|
(21, 'Furlough half day', '#778899', 'halfFurlough', 0.5, 1);
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
INSERT INTO `postgresql`.`calendar_employee` (`businessFk`, `calendar_state_id`, `date`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
(1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
||||||
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
||||||
|
@ -2448,11 +2452,11 @@ INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`)
|
INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 99.99, '2000000000', null, null, null),
|
(1, 99.99, '2000000000', NULL, NULL, NULL),
|
||||||
(2, 999.99, '2000000000', null, null, null),
|
(2, 999.99, '2000000000', NULL, NULL, NULL),
|
||||||
(3, 1000.50, '2000000000', null, null, null),
|
(3, 1000.50, '2000000000', NULL, NULL, NULL),
|
||||||
(4, 0.50, '2000000000', null, null, null),
|
(4, 0.50, '2000000000', NULL, NULL, NULL),
|
||||||
(5, 150.50, '2000000000', null, null, null),
|
(5, 150.50, '2000000000', NULL, NULL, NULL),
|
||||||
(1, 252.25, '4751000000', NULL, 7, 61),
|
(1, 252.25, '4751000000', NULL, 7, 61),
|
||||||
(2, 223.17, '6210000567', NULL, 8, 20),
|
(2, 223.17, '6210000567', NULL, 8, 20),
|
||||||
(3, 95.60, '7001000000', NULL, 8, 35),
|
(3, 95.60, '7001000000', NULL, 8, 35),
|
||||||
|
@ -2635,3 +2639,15 @@ INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`,
|
||||||
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 9);
|
(1, 9);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`)
|
||||||
|
VALUES
|
||||||
|
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
||||||
|
VALUES
|
||||||
|
(3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
|
||||||
|
VALUES
|
||||||
|
(9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL);
|
||||||
|
|
16043
db/dump/structure.sql
16043
db/dump/structure.sql
File diff suppressed because it is too large
Load Diff
|
@ -239,7 +239,7 @@ xdescribe('worker workerTimeControl_check()', () => {
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
stmts.push('START TRANSACTION');
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`INSERT INTO postgresql.calendar_employee(business_id,calendar_state_id,date)
|
stmt = new ParameterizedSQL(`INSERT INTO postgresql.calendar_employee(businessFk,calendar_state_id,date)
|
||||||
VALUES
|
VALUES
|
||||||
(?,1,CURDATE())`, [
|
(?,1,CURDATE())`, [
|
||||||
workerId
|
workerId
|
||||||
|
@ -282,7 +282,7 @@ xdescribe('worker workerTimeControl_check()', () => {
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
stmts.push('START TRANSACTION');
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`UPDATE postgresql.business SET date_end=DATE_ADD(CURDATE(), INTERVAL -1 DAY) WHERE business_id=?`, [
|
stmt = new ParameterizedSQL(`UPDATE vn.business SET ended = DATE_ADD(CURDATE(), INTERVAL -1 DAY) WHERE id = ?`, [
|
||||||
workerId
|
workerId
|
||||||
]);
|
]);
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('InvoiceOut manual invoice path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create an invoice from a ticket', async() => {
|
it('should create an invoice from a ticket', async() => {
|
||||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '7');
|
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '15');
|
||||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
|
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
|
||||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
|
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
|
||||||
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
|
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
|
||||||
|
|
|
@ -150,10 +150,12 @@ describe('Account create and basic data path', () => {
|
||||||
|
|
||||||
describe('Set password', () => {
|
describe('Set password', () => {
|
||||||
it('should set the password using the descriptor menu', async() => {
|
it('should set the password using the descriptor menu', async() => {
|
||||||
|
const newPassword = 'quantum.12345';
|
||||||
|
|
||||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||||
await page.waitToClick(selectors.accountDescriptor.setPassword);
|
await page.waitToClick(selectors.accountDescriptor.setPassword);
|
||||||
await page.write(selectors.accountDescriptor.newPassword, 'quantum.crypt0graphy');
|
await page.write(selectors.accountDescriptor.newPassword, newPassword);
|
||||||
await page.write(selectors.accountDescriptor.repeatPassword, 'quantum.crypt0graphy');
|
await page.write(selectors.accountDescriptor.repeatPassword, newPassword);
|
||||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
|
|
@ -130,5 +130,6 @@
|
||||||
"Descanso diario 12h.": "Daily rest 12h.",
|
"Descanso diario 12h.": "Daily rest 12h.",
|
||||||
"Fichadas impares": "Odd signs",
|
"Fichadas impares": "Odd signs",
|
||||||
"Descanso diario 9h.": "Daily rest 9h.",
|
"Descanso diario 9h.": "Daily rest 9h.",
|
||||||
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h."
|
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.",
|
||||||
|
"Password does not meet requirements": "Password does not meet requirements"
|
||||||
}
|
}
|
|
@ -146,7 +146,7 @@
|
||||||
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
|
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
|
||||||
"ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED",
|
"ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED",
|
||||||
"Invalid password": "Invalid password",
|
"Invalid password": "Invalid password",
|
||||||
"Password does not meet requirements": "Password does not meet requirements",
|
"Password does not meet requirements": "La contraseña no cumple los requisitos",
|
||||||
"Role already assigned": "Role already assigned",
|
"Role already assigned": "Role already assigned",
|
||||||
"Invalid role name": "Invalid role name",
|
"Invalid role name": "Invalid role name",
|
||||||
"Role name must be written in camelCase": "Role name must be written in camelCase",
|
"Role name must be written in camelCase": "Role name must be written in camelCase",
|
||||||
|
@ -208,7 +208,7 @@
|
||||||
"Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
|
"Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
|
||||||
"Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
|
"Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
|
||||||
"You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
|
"You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
|
||||||
"You can't change the credit set to zero from a manager": "No puedes cambiar el cŕedito establecido a cero por un gerente",
|
"You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
|
||||||
"Amounts do not match": "Las cantidades no coinciden",
|
"Amounts do not match": "Las cantidades no coinciden",
|
||||||
"The PDF document does not exists": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
|
"The PDF document does not exists": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
|
||||||
"The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
|
"The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
|
||||||
|
|
|
@ -402,8 +402,8 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const userId = ctx.options.accessToken.userId;
|
const userId = ctx.options.accessToken.userId;
|
||||||
|
|
||||||
const isManager = await models.Account.hasRole(userId, 'manager', ctx.options);
|
const isFinancialBoss = await models.Account.hasRole(userId, 'financialBoss', ctx.options);
|
||||||
if (!isManager) {
|
if (!isFinancialBoss) {
|
||||||
const lastCredit = await models.ClientCredit.findOne({
|
const lastCredit = await models.ClientCredit.findOne({
|
||||||
where: {
|
where: {
|
||||||
clientFk: finalState.id
|
clientFk: finalState.id
|
||||||
|
@ -413,10 +413,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
const lastAmount = lastCredit && lastCredit.amount;
|
const lastAmount = lastCredit && lastCredit.amount;
|
||||||
const lastWorkerId = lastCredit && lastCredit.workerFk;
|
const lastWorkerId = lastCredit && lastCredit.workerFk;
|
||||||
const lastWorkerIsManager = await models.Account.hasRole(lastWorkerId, 'manager', ctx.options);
|
const lastWorkerIsFinancialBoss = await models.Account.hasRole(lastWorkerId, 'financialBoss', ctx.options);
|
||||||
|
|
||||||
if (lastAmount == 0 && lastWorkerIsManager)
|
if (lastAmount == 0 && lastWorkerIsFinancialBoss)
|
||||||
throw new UserError(`You can't change the credit set to zero from a manager`);
|
throw new UserError(`You can't change the credit set to zero from a financialBoss`);
|
||||||
|
|
||||||
const creditLimits = await models.ClientCreditLimit.find({
|
const creditLimits = await models.ClientCreditLimit.find({
|
||||||
fields: ['roleFk'],
|
fields: ['roleFk'],
|
||||||
|
|
|
@ -53,7 +53,7 @@ describe('Client Model', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('changeCredit()', () => {
|
describe('changeCredit()', () => {
|
||||||
it('should fail to change the credit as a salesAssistant set to zero by a manager', async() => {
|
it('should fail to change the credit as a salesAssistant set to zero by a financialBoss', async() => {
|
||||||
const tx = await models.Client.beginTransaction({});
|
const tx = await models.Client.beginTransaction({});
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
|
@ -62,7 +62,7 @@ describe('Client Model', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const context = {options};
|
const context = {options};
|
||||||
|
|
||||||
// Set credit to zero by a manager
|
// Set credit to zero by a financialBoss
|
||||||
const financialBoss = await models.Account.findOne({
|
const financialBoss = await models.Account.findOne({
|
||||||
where: {name: 'financialBoss'}
|
where: {name: 'financialBoss'}
|
||||||
}, options);
|
}, options);
|
||||||
|
@ -83,7 +83,7 @@ describe('Client Model', () => {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error.message).toEqual(`You can't change the credit set to zero from a manager`);
|
expect(error.message).toEqual(`You can't change the credit set to zero from a financialBoss`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail to change to a high credit amount as a salesAssistant', async() => {
|
it('should fail to change to a high credit amount as a salesAssistant', async() => {
|
||||||
|
|
|
@ -37,7 +37,7 @@ describe('Buy editLatestsBuys()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {typeFk: 1};
|
const filter = {'i.typeFk': 1};
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
filter: filter
|
filter: filter
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
order="itemFk DESC"
|
order="itemFk DESC"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="$ctrl.buys"
|
data="$ctrl.buys"
|
||||||
|
on-data-change="$ctrl.reCheck()"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-portal slot="topbar">
|
<vn-portal slot="topbar">
|
||||||
|
@ -129,6 +130,7 @@
|
||||||
<td>
|
<td>
|
||||||
<vn-check
|
<vn-check
|
||||||
ng-model="buy.checked"
|
ng-model="buy.checked"
|
||||||
|
on-change="$ctrl.saveChecked(buy.id)"
|
||||||
vn-click-stop>
|
vn-click-stop>
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default class Controller extends Section {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.editedColumn;
|
this.editedColumn;
|
||||||
this.checkAll = false;
|
this.checkAll = false;
|
||||||
|
this.checkedBuys = [];
|
||||||
|
|
||||||
this.smartTableOptions = {
|
this.smartTableOptions = {
|
||||||
activeButtons: {
|
activeButtons: {
|
||||||
|
@ -139,6 +140,7 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
uncheck() {
|
uncheck() {
|
||||||
this.checkAll = false;
|
this.checkAll = false;
|
||||||
|
this.checkedBuys = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
get totalChecked() {
|
get totalChecked() {
|
||||||
|
@ -148,6 +150,23 @@ export default class Controller extends Section {
|
||||||
return this.checked.length;
|
return this.checked.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveChecked(buyId) {
|
||||||
|
const index = this.checkedBuys.indexOf(buyId);
|
||||||
|
if (index !== -1)
|
||||||
|
return this.checkedBuys.splice(index, 1);
|
||||||
|
return this.checkedBuys.push(buyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
reCheck() {
|
||||||
|
if (!this.$.model.data) return;
|
||||||
|
if (!this.checkedBuys.length) return;
|
||||||
|
|
||||||
|
this.$.model.data.forEach(buy => {
|
||||||
|
if (this.checkedBuys.includes(buy.id))
|
||||||
|
buy.checked = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onEditAccept() {
|
onEditAccept() {
|
||||||
const rowsToEdit = [];
|
const rowsToEdit = [];
|
||||||
for (let row of this.checked)
|
for (let row of this.checked)
|
||||||
|
|
|
@ -57,5 +57,44 @@ describe('Entry', () => {
|
||||||
expect(result.length).toEqual(0);
|
expect(result.length).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('reCheck()', () => {
|
||||||
|
it(`should recheck buys`, () => {
|
||||||
|
controller.$.model.data = [
|
||||||
|
{checked: false, id: 1},
|
||||||
|
{checked: false, id: 2},
|
||||||
|
{checked: false, id: 3},
|
||||||
|
{checked: false, id: 4},
|
||||||
|
];
|
||||||
|
controller.checkedBuys = [1, 2];
|
||||||
|
|
||||||
|
controller.reCheck();
|
||||||
|
|
||||||
|
expect(controller.$.model.data[0].checked).toEqual(true);
|
||||||
|
expect(controller.$.model.data[1].checked).toEqual(true);
|
||||||
|
expect(controller.$.model.data[2].checked).toEqual(false);
|
||||||
|
expect(controller.$.model.data[3].checked).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('saveChecked()', () => {
|
||||||
|
it(`should check buy`, () => {
|
||||||
|
const buyCheck = 3;
|
||||||
|
controller.checkedBuys = [1, 2];
|
||||||
|
|
||||||
|
controller.saveChecked(buyCheck);
|
||||||
|
|
||||||
|
expect(controller.checkedBuys[2]).toEqual(buyCheck);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should uncheck buy`, () => {
|
||||||
|
const buyUncheck = 3;
|
||||||
|
controller.checkedBuys = [1, 2, 3];
|
||||||
|
|
||||||
|
controller.saveChecked(buyUncheck);
|
||||||
|
|
||||||
|
expect(controller.checkedBuys[2]).toEqual(undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
// 4376
|
describe('ticket listPackaging()', () => {
|
||||||
xdescribe('ticket listPackaging()', () => {
|
|
||||||
it('should return the packaging', async() => {
|
it('should return the packaging', async() => {
|
||||||
const tx = await models.Packaging.beginTransaction({});
|
const tx = await models.Packaging.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,9 @@ describe('ticket setDeleted()', () => {
|
||||||
ctx.req.__ = value => {
|
ctx.req.__ = value => {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
const [ticketCollectionOld] = await models.Ticket.rawSql(
|
||||||
|
`SELECT COUNT(*) numberRows
|
||||||
|
FROM vn.ticketCollection`, [], options);
|
||||||
const ticketId = 23;
|
const ticketId = 23;
|
||||||
|
|
||||||
await models.Ticket.setDeleted(ctx, ticketId, options);
|
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||||
|
@ -90,7 +93,7 @@ describe('ticket setDeleted()', () => {
|
||||||
`SELECT COUNT(*) numberRows
|
`SELECT COUNT(*) numberRows
|
||||||
FROM vn.ticketCollection`, [], options);
|
FROM vn.ticketCollection`, [], options);
|
||||||
|
|
||||||
expect(ticketCollection.numberRows).toEqual(3);
|
expect(ticketCollection.numberRows).toBeLessThan(ticketCollectionOld.numberRows);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ describe('Worker absences()', () => {
|
||||||
const worker = await app.models.WorkerLabour.findById(businessId, null, options);
|
const worker = await app.models.WorkerLabour.findById(businessId, null, options);
|
||||||
|
|
||||||
await app.models.WorkerLabour.rawSql(
|
await app.models.WorkerLabour.rawSql(
|
||||||
`UPDATE postgresql.business SET date_end = ? WHERE business_id = ?`,
|
`UPDATE vn.business SET ended = ? WHERE id = ?`,
|
||||||
[null, worker.businessFk], options);
|
[null, worker.businessFk], options);
|
||||||
|
|
||||||
const [absences] = await app.models.Calendar.absences(ctx, worker.id, businessId, year, options);
|
const [absences] = await app.models.Calendar.absences(ctx, worker.id, businessId, year, options);
|
||||||
|
@ -98,7 +98,7 @@ describe('Worker absences()', () => {
|
||||||
startingContract.setDate(1);
|
startingContract.setDate(1);
|
||||||
|
|
||||||
await app.models.WorkerLabour.rawSql(
|
await app.models.WorkerLabour.rawSql(
|
||||||
`UPDATE postgresql.business SET date_start = ?, date_end = ? WHERE business_id = ?`,
|
`UPDATE vn.business SET started = ?, ended = ? WHERE id = ?`,
|
||||||
[startingContract, yearEnd, contract.businessFk], options
|
[startingContract, yearEnd, contract.businessFk], options
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -86,10 +86,9 @@ module.exports = Self => {
|
||||||
const [result] = await Self.rawSql(
|
const [result] = await Self.rawSql(
|
||||||
`SELECT COUNT(*) halfHolidayCounter
|
`SELECT COUNT(*) halfHolidayCounter
|
||||||
FROM vn.calendar c
|
FROM vn.calendar c
|
||||||
JOIN postgresql.business b ON b.business_id = c.businessFk
|
JOIN vn.business b ON b.id = c.businessFk
|
||||||
JOIN postgresql.profile p ON p.profile_id = b.client_id
|
|
||||||
WHERE c.dayOffTypeFk = 6
|
WHERE c.dayOffTypeFk = 6
|
||||||
AND p.workerFk = ?
|
AND b.workerFk = ?
|
||||||
AND c.dated BETWEEN util.firstDayOfYear(?)
|
AND c.dated BETWEEN util.firstDayOfYear(?)
|
||||||
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
|
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"i18n": "^0.8.4",
|
"i18n": "^0.8.4",
|
||||||
"image-type": "^4.1.0",
|
"image-type": "^4.1.0",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
|
"jsdom": "^16.7.0",
|
||||||
"jszip": "^3.10.0",
|
"jszip": "^3.10.0",
|
||||||
"ldapjs": "^2.2.0",
|
"ldapjs": "^2.2.0",
|
||||||
"loopback": "^3.26.0",
|
"loopback": "^3.26.0",
|
||||||
|
|
Loading…
Reference in New Issue