4527-db_dump_MASTER #1057

Merged
joan merged 3 commits from 4527-db_dump into master 2022-09-20 10:04:04 +00:00
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()', () => { 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);
}); });
}); });

File diff suppressed because one or more lines are too long

View File

@ -1763,11 +1763,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),
@ -1875,59 +1870,47 @@ 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
FROM `vn`.`worker` `w`; (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`) 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
('1', '27.5', YEAR(util.VN_CURDATE())), ('1', '27.5', YEAR(util.VN_CURDATE())),
('5', '22', YEAR(util.VN_CURDATE())), ('5', '22', YEAR(util.VN_CURDATE())),
('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
@ -1935,12 +1918,33 @@ INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`
(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
@ -1951,7 +1955,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))),
@ -2446,18 +2450,18 @@ 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),
(4, 446.63, '7001000000', NULL, 6, 61), (4, 446.63, '7001000000', NULL, 6, 61),
(5, 64.23, '6210000567', NULL, 8, 20), (5, 64.23, '6210000567', NULL, 8, 20),
(6, 29.95, '7001000000', NULL, 7, 20), (6, 29.95, '7001000000', NULL, 7, 20),
(7, 58.64, '6210000567', NULL, 8, 20); (7, 58.64, '6210000567', NULL, 8, 20);
INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`) INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`)
VALUES VALUES
@ -2633,3 +2637,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);

File diff suppressed because it is too large Load Diff

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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"
} }

View File

@ -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",

View File

@ -36,7 +36,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

View File

@ -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({});

View File

@ -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) {

View File

@ -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
); );

View File

@ -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]);