Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-09-21 08:37:20 +02:00
commit 5d6459d565
14 changed files with 14010 additions and 14603 deletions

View File

@ -2,10 +2,10 @@ const models = require('vn-loopback/server/server').models;
describe('ticket getCollection()', () => {
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);
expect(response.length).toBeGreaterThan(0);
expect(response[0].collectionFk).toEqual(1);
expect(response[0].collectionFk).toEqual(3);
});
});

File diff suppressed because one or more lines are too long

View File

@ -1765,11 +1765,6 @@ INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`)
(4, 'Reclam.PRAG', 12),
(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`)
VALUES
(1, 1, 1, 21, 1, 1, 2, 5),
@ -1877,59 +1872,47 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
(5, 1102),
(9, 1201);
INSERT INTO `postgresql`.`profile`(`profile_id`, `workerFk`, `profile_type_id`)
SELECT w.id, w.id, 1
FROM `vn`.`worker` `w`;
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
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`;
INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `companyCodeFk`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
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
FROM `postgresql`.`profile` `p`;
INSERT INTO `vn`.`business`(`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`)
SELECT * FROM tmp.worker;
INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
SELECT b.business_id, NULL, 23, 1, 0, 1, 1, 1, 1
FROM `postgresql`.`business` `b`;
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
CREATE TEMPORARY TABLE tmp.worker
(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`)
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
FROM `postgresql`.`profile` `p`
WHERE `p`.`profile_id` = 1109;
INSERT INTO `vn`.`business` (`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`)
SELECT * FROM tmp.worker;
UPDATE `postgresql`.`business`
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
UPDATE `vn`.`business`
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`)
VALUES
(1111, NULL, 23, 1, 0.0, 1, 1, 1, 1);
UPDATE `vn`.`business` b
SET b.`workerBusinessProfessionalCategoryFk` = 31
WHERE b.`workerFk` = 1110;
UPDATE `postgresql`.`business_labour` bl
JOIN `postgresql`.`business` b ON b.business_id = bl.business_id
JOIN `postgresql`.`profile` pr ON pr.profile_id = b.client_id
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);
UPDATE `vn`.`business` b
SET b.`departmentFk` = 43
WHERE b.id IN(18, 19);
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
VALUES
('1', '27.5', YEAR(util.VN_CURDATE())),
('5', '22', YEAR(util.VN_CURDATE())),
('1', '24.5', 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`;
('1', '27.5', YEAR(util.VN_CURDATE())),
('5', '22', YEAR(util.VN_CURDATE())),
('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))),
('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)));
INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`, `hasHolidayEntitlement`)
VALUES
@ -1937,12 +1920,33 @@ INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`
(100, 'INDEFINIDO A TIEMPO 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`)
VALUES
(1, 7, 12, 100, 900.50),
(1106, 7, 12, 100, 1263.03),
(1107, 7, 12, 100, 2000),
(1108, 7, 12, 100, 1500);
UPDATE `vn`.`business` b
SET `rate` = 7,
`workerBusinessCategoryFk` = 12,
`workerBusinessTypeFk` = 100,
`amount` = 900.50
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`)
VALUES
@ -1953,7 +1957,7 @@ INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlement
(20, 'Furlough', '#97B92F', 'furlough', 1, 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
(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))),
@ -2448,18 +2452,18 @@ INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`)
INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`)
VALUES
(1, 99.99, '2000000000', null, null, null),
(2, 999.99, '2000000000', null, null, null),
(3, 1000.50, '2000000000', null, null, null),
(4, 0.50, '2000000000', null, null, null),
(5, 150.50, '2000000000', null, null, null),
(1, 252.25, '4751000000', NULL, 7, 61),
(2, 223.17, '6210000567', NULL, 8, 20),
(3, 95.60, '7001000000', NULL, 8, 35),
(4, 446.63, '7001000000', NULL, 6, 61),
(5, 64.23, '6210000567', NULL, 8, 20),
(6, 29.95, '7001000000', NULL, 7, 20),
(7, 58.64, '6210000567', NULL, 8, 20);
(1, 99.99, '2000000000', NULL, NULL, NULL),
(2, 999.99, '2000000000', NULL, NULL, NULL),
(3, 1000.50, '2000000000', NULL, NULL, NULL),
(4, 0.50, '2000000000', NULL, NULL, NULL),
(5, 150.50, '2000000000', NULL, NULL, NULL),
(1, 252.25, '4751000000', NULL, 7, 61),
(2, 223.17, '6210000567', NULL, 8, 20),
(3, 95.60, '7001000000', NULL, 8, 35),
(4, 446.63, '7001000000', NULL, 6, 61),
(5, 64.23, '6210000567', NULL, 8, 20),
(6, 29.95, '7001000000', NULL, 7, 20),
(7, 58.64, '6210000567', NULL, 8, 20);
INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`)
VALUES
@ -2635,3 +2639,15 @@ INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`,
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
VALUES
(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);

File diff suppressed because it is too large Load Diff

View File

@ -239,7 +239,7 @@ xdescribe('worker workerTimeControl_check()', () => {
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
(?,1,CURDATE())`, [
workerId
@ -282,7 +282,7 @@ xdescribe('worker workerTimeControl_check()', () => {
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
]);
stmts.push(stmt);

View File

@ -22,7 +22,7 @@ describe('InvoiceOut manual invoice path', () => {
});
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.manualInvoiceTaxArea, 'national');
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);

View File

@ -150,10 +150,12 @@ describe('Account create and basic data path', () => {
describe('Set password', () => {
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.setPassword);
await page.write(selectors.accountDescriptor.newPassword, 'quantum.crypt0graphy');
await page.write(selectors.accountDescriptor.repeatPassword, 'quantum.crypt0graphy');
await page.write(selectors.accountDescriptor.newPassword, newPassword);
await page.write(selectors.accountDescriptor.repeatPassword, newPassword);
await page.waitToClick(selectors.accountDescriptor.acceptButton);
const message = await page.waitForSnackbar();

View File

@ -130,5 +130,6 @@
"Descanso diario 12h.": "Daily rest 12h.",
"Fichadas impares": "Odd signs",
"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"
}

View File

@ -146,7 +146,7 @@
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
"ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED",
"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",
"Invalid role name": "Invalid role name",
"Role name must be written in camelCase": "Role name must be written in camelCase",

View File

@ -37,7 +37,7 @@ describe('Buy editLatestsBuys()', () => {
const options = {transaction: tx};
try {
const filter = {typeFk: 1};
const filter = {'i.typeFk': 1};
const ctx = {
args: {
filter: filter

View File

@ -1,7 +1,6 @@
const models = require('vn-loopback/server/server').models;
// 4376
xdescribe('ticket listPackaging()', () => {
describe('ticket listPackaging()', () => {
it('should return the packaging', async() => {
const tx = await models.Packaging.beginTransaction({});

View File

@ -82,6 +82,9 @@ describe('ticket setDeleted()', () => {
ctx.req.__ = value => {
return value;
};
const [ticketCollectionOld] = await models.Ticket.rawSql(
`SELECT COUNT(*) numberRows
FROM vn.ticketCollection`, [], options);
const ticketId = 23;
await models.Ticket.setDeleted(ctx, ticketId, options);
@ -90,7 +93,7 @@ describe('ticket setDeleted()', () => {
`SELECT COUNT(*) numberRows
FROM vn.ticketCollection`, [], options);
expect(ticketCollection.numberRows).toEqual(3);
expect(ticketCollection.numberRows).toBeLessThan(ticketCollectionOld.numberRows);
await tx.rollback();
} catch (e) {

View File

@ -33,7 +33,7 @@ describe('Worker absences()', () => {
const worker = await app.models.WorkerLabour.findById(businessId, null, options);
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);
const [absences] = await app.models.Calendar.absences(ctx, worker.id, businessId, year, options);
@ -98,7 +98,7 @@ describe('Worker absences()', () => {
startingContract.setDate(1);
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
);

View File

@ -86,10 +86,9 @@ module.exports = Self => {
const [result] = await Self.rawSql(
`SELECT COUNT(*) halfHolidayCounter
FROM vn.calendar c
JOIN postgresql.business b ON b.business_id = c.businessFk
JOIN postgresql.profile p ON p.profile_id = b.client_id
JOIN vn.business b ON b.id = c.businessFk
WHERE c.dayOffTypeFk = 6
AND p.workerFk = ?
AND b.workerFk = ?
AND c.dated BETWEEN util.firstDayOfYear(?)
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);