Merge branch 'dev' into 3332-item_search-panel
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
cae3322c6b
|
@ -2,8 +2,7 @@ DROP PROCEDURE IF EXISTS `vn`.`item_getBalance`;
|
||||||
|
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
$$
|
$$
|
||||||
CREATE
|
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`item_getBalance`(IN vItemId int, IN vWarehouse int)
|
||||||
definer = root@`%` procedure `vn`.`item_getBalance`(IN vItemId int, IN vWarehouse int)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vDateInventory DATETIME;
|
DECLARE vDateInventory DATETIME;
|
||||||
DECLARE vCurdate DATE DEFAULT CURDATE();
|
DECLARE vCurdate DATE DEFAULT CURDATE();
|
||||||
|
@ -116,7 +115,7 @@ BEGIN
|
||||||
s.id,
|
s.id,
|
||||||
st.`order`,
|
st.`order`,
|
||||||
ct.code,
|
ct.code,
|
||||||
cl.id
|
cb.claimFk
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
LEFT JOIN ticketState ts ON ts.ticket = t.id
|
LEFT JOIN ticketState ts ON ts.ticket = t.id
|
||||||
|
@ -132,6 +131,7 @@ BEGIN
|
||||||
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
|
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
|
||||||
LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id
|
LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id
|
||||||
LEFT JOIN claim cl ON cl.ticketFk = t.id
|
LEFT JOIN claim cl ON cl.ticketFk = t.id
|
||||||
|
LEFT JOIN claimBeginning cb ON cl.id = cb.claimFk AND s.id = cb.saleFk
|
||||||
WHERE t.shipped >= vDateInventory
|
WHERE t.shipped >= vDateInventory
|
||||||
AND s.itemFk = vItemId
|
AND s.itemFk = vItemId
|
||||||
AND vWarehouse =t.warehouseFk
|
AND vWarehouse =t.warehouseFk
|
||||||
|
@ -141,4 +141,3 @@ BEGIN
|
||||||
END;
|
END;
|
||||||
$$
|
$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.payMethod CHANGE ibanRequiredForClients isIbanRequiredForClients tinyint(3) DEFAULT 0 NULL;
|
||||||
|
ALTER TABLE vn.payMethod CHANGE ibanRequiredForSuppliers isIbanRequiredForSuppliers tinyint(3) DEFAULT 0 NULL;
|
|
@ -217,7 +217,7 @@ UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com'
|
||||||
|
|
||||||
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
||||||
|
|
||||||
INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `ibanRequiredForClients`, `ibanRequiredForSuppliers`)
|
INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `isIbanRequiredForClients`, `isIbanRequiredForSuppliers`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, NULL, 'PayMethod one', 0, 001, 0, 0),
|
(1, NULL, 'PayMethod one', 0, 001, 0, 0),
|
||||||
(2, NULL, 'PayMethod two', 10, 001, 0, 0),
|
(2, NULL, 'PayMethod two', 10, 001, 0, 0),
|
||||||
|
@ -1882,6 +1882,7 @@ INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
||||||
VALUES
|
VALUES
|
||||||
|
(1, 6, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))),
|
||||||
(1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))),
|
(1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL 10 DAY))),
|
||||||
(1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))),
|
(1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -11 DAY), DATE_ADD(CURDATE(), INTERVAL 11 DAY))),
|
||||||
(1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))),
|
(1106, 1, IF(MONTH(CURDATE()) = 12 AND DAY(CURDATE()) > 10, DATE_ADD(CURDATE(), INTERVAL -12 DAY), DATE_ADD(CURDATE(), INTERVAL 12 DAY))),
|
||||||
|
|
|
@ -193,6 +193,7 @@
|
||||||
"Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
|
"Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
|
||||||
"None": "Ninguno",
|
"None": "Ninguno",
|
||||||
"The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
|
"The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
|
||||||
|
"Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'",
|
||||||
"This document already exists on this ticket": "Este documento ya existe en el ticket",
|
"This document already exists on this ticket": "Este documento ya existe en el ticket",
|
||||||
"Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
|
"Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
|
||||||
"You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
|
"You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
|
||||||
|
|
|
@ -138,7 +138,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
function hasIban(err, done) {
|
function hasIban(err, done) {
|
||||||
Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => {
|
Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => {
|
||||||
if (instance && instance.ibanRequiredForClients && !this.iban)
|
const isMissingIban = instance && instance.isIbanRequiredForClients && !this.iban;
|
||||||
|
if (isMissingIban)
|
||||||
err();
|
err();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
"outstandingDebt": {
|
"outstandingDebt": {
|
||||||
"type": "Number"
|
"type": "Number"
|
||||||
},
|
},
|
||||||
"ibanRequiredForClients": {
|
"isIbanRequiredForClients": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"ibanRequiredForSuppliers": {
|
"isIbanRequiredForSuppliers": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
vn-acl="salesAssistant"
|
vn-acl="salesAssistant"
|
||||||
ng-model="$ctrl.client.payMethodFk"
|
ng-model="$ctrl.client.payMethodFk"
|
||||||
data="paymethods"
|
data="paymethods"
|
||||||
fields="['ibanRequiredForClients']"
|
fields="['isIbanRequiredForClients']"
|
||||||
initial-data="$ctrl.client.payMethod">
|
initial-data="$ctrl.client.payMethod">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
<slot-body>
|
<slot-body>
|
||||||
<div class="attributes">
|
<div class="attributes">
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Phone"
|
label="Pay method"
|
||||||
value="{{$ctrl.client.phone | phone}}">
|
value="{{$ctrl.client.payMethod.name}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Credit"
|
label="Credit"
|
||||||
|
|
|
@ -3,4 +3,5 @@ View consumer report: Ver informe de consumo
|
||||||
From date: Fecha desde
|
From date: Fecha desde
|
||||||
To date: Fecha hasta
|
To date: Fecha hasta
|
||||||
Go to user: Ir al usuario
|
Go to user: Ir al usuario
|
||||||
Client invoices list: Listado de facturas del cliente
|
Client invoices list: Listado de facturas del cliente
|
||||||
|
Pay method: Forma de pago
|
|
@ -117,8 +117,7 @@ module.exports = Self => {
|
||||||
case 'isActive':
|
case 'isActive':
|
||||||
case 'typeFk':
|
case 'typeFk':
|
||||||
case 'isFloramondo':
|
case 'isFloramondo':
|
||||||
param = `i.${param}`;
|
return {[`i.${param}`]: value};
|
||||||
return {[param]: value};
|
|
||||||
case 'multiplier':
|
case 'multiplier':
|
||||||
return {'i.stemMultiplier': value};
|
return {'i.stemMultiplier': value};
|
||||||
case 'categoryFk':
|
case 'categoryFk':
|
||||||
|
|
|
@ -36,4 +36,36 @@ describe('item getBalance()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show the claimFk only on the claimed item', async() => {
|
||||||
|
const tx = await models.Item.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const firstFilter = {
|
||||||
|
where: {
|
||||||
|
itemFk: 1,
|
||||||
|
warehouseFk: 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const secondFilter = {
|
||||||
|
where: {
|
||||||
|
itemFk: 2,
|
||||||
|
warehouseFk: 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const firstItemBalance = await models.Item.getBalance(firstFilter, options);
|
||||||
|
const secondItemBalance = await models.Item.getBalance(secondFilter, options);
|
||||||
|
|
||||||
|
expect(firstItemBalance[9].claimFk).toEqual(null);
|
||||||
|
expect(secondItemBalance[5].claimFk).toEqual(2);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,8 +79,9 @@ module.exports = Self => {
|
||||||
const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk);
|
const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk);
|
||||||
const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}});
|
const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}});
|
||||||
const hasIban = supplierAccount && supplierAccount.iban;
|
const hasIban = supplierAccount && supplierAccount.iban;
|
||||||
|
const isMissingIban = payMethod && payMethod.isIbanRequiredForSuppliers && !hasIban;
|
||||||
|
|
||||||
if (payMethod && payMethod.ibanRequiredForSuppliers && !hasIban)
|
if (isMissingIban)
|
||||||
err();
|
err();
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
vn-acl="salesAssistant"
|
vn-acl="salesAssistant"
|
||||||
ng-model="$ctrl.supplier.payMethodFk"
|
ng-model="$ctrl.supplier.payMethodFk"
|
||||||
data="paymethods"
|
data="paymethods"
|
||||||
fields="['ibanRequiredForSuppliers']"
|
fields="['isIbanRequiredForSuppliers']"
|
||||||
initial-data="$ctrl.supplier.payMethod">
|
initial-data="$ctrl.supplier.payMethod">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
|
|
|
@ -65,6 +65,23 @@ module.exports = Self => {
|
||||||
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
|
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
|
||||||
throw new UserError(`The contract was not active during the selected date`);
|
throw new UserError(`The contract was not active during the selected date`);
|
||||||
|
|
||||||
|
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.person pe ON pe.id = p.person_id
|
||||||
|
WHERE c.dayOffTypeFk = 6
|
||||||
|
AND pe.workerFk = ?
|
||||||
|
AND c.dated BETWEEN util.firstDayOfYear(CURDATE())
|
||||||
|
AND LAST_DAY(DATE_ADD(NOW(), INTERVAL 12-MONTH(NOW()) MONTH))`, [args.id]);
|
||||||
|
|
||||||
|
const hasHalfHoliday = result[0].halfHolidayCounter > 0;
|
||||||
|
const isHalfHoliday = args.absenceTypeId == 6;
|
||||||
|
|
||||||
|
if (isHalfHoliday && hasHalfHoliday)
|
||||||
|
throw new UserError(`Cannot add more than one '1/2 day vacation'`);
|
||||||
|
|
||||||
const absence = await models.Calendar.create({
|
const absence = await models.Calendar.create({
|
||||||
businessFk: labour.businessFk,
|
businessFk: labour.businessFk,
|
||||||
dayOffTypeFk: args.absenceTypeId,
|
dayOffTypeFk: args.absenceTypeId,
|
||||||
|
|
|
@ -74,4 +74,32 @@ describe('Worker createAbsence()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should throw an error when adding a "Half holiday" absence if there's already one`, async() => {
|
||||||
|
const ctx = {
|
||||||
|
req: {accessToken: {userId: 19}},
|
||||||
|
args: {
|
||||||
|
id: 1,
|
||||||
|
businessFk: 1,
|
||||||
|
absenceTypeId: 6,
|
||||||
|
dated: new Date()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const tx = await app.models.Calendar.beginTransaction({});
|
||||||
|
|
||||||
|
let error;
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
await app.models.Worker.createAbsence(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toEqual(`Cannot add more than one '1/2 day vacation'`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue