Merge branch 'dev' into 5088-clientBalance-ponerReceiptId
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
a52be50dad
|
@ -67,7 +67,7 @@
|
||||||
"Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
|
"Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
|
||||||
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
|
"Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
|
||||||
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
|
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
|
||||||
"Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
|
"Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
|
||||||
"Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*",
|
"Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*",
|
||||||
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
|
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
|
||||||
|
@ -137,15 +137,18 @@
|
||||||
"Password does not meet requirements": "Password does not meet requirements",
|
"Password does not meet requirements": "Password does not meet requirements",
|
||||||
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
|
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
|
||||||
"Not enough privileges to edit a client": "Not enough privileges to edit a client",
|
"Not enough privileges to edit a client": "Not enough privileges to edit a client",
|
||||||
"Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*",
|
"Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*",
|
||||||
"You don't have grant privilege": "You don't have grant privilege",
|
"You don't have grant privilege": "You don't have grant privilege",
|
||||||
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
|
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
|
||||||
"Email verify": "Email verify",
|
"Email verify": "Email verify",
|
||||||
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
|
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
|
||||||
"Sale(s) blocked, please contact production": "Sale(s) blocked, please contact production",
|
|
||||||
"App locked": "App locked by user {{userId}}",
|
"App locked": "App locked by user {{userId}}",
|
||||||
"The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified",
|
"The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified",
|
||||||
"Receipt's bank was not found": "Receipt's bank was not found",
|
"Receipt's bank was not found": "Receipt's bank was not found",
|
||||||
"This receipt was not compensated": "This receipt was not compensated",
|
"This receipt was not compensated": "This receipt was not compensated",
|
||||||
"Client's email was not found": "Client's email was not found"
|
"Client's email was not found": "Client's email was not found",
|
||||||
|
"It is not possible to modify tracked sales": "It is not possible to modify tracked sales",
|
||||||
|
"It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
|
||||||
|
"It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
|
||||||
|
"Valid priorities: 1,2,3": "Valid priorities: 1,2,3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
"The current ticket can't be modified": "El ticket actual no puede ser modificado",
|
"The current ticket can't be modified": "El ticket actual no puede ser modificado",
|
||||||
"The current claim can't be modified": "La reclamación actual no puede ser modificada",
|
"The current claim can't be modified": "La reclamación actual no puede ser modificada",
|
||||||
"The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
|
"The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
|
||||||
"Sale(s) blocked, contact production": "Linea(s) bloqueada(s), contacte con produccion",
|
|
||||||
"Please select at least one sale": "Por favor selecciona al menos una linea",
|
"Please select at least one sale": "Por favor selecciona al menos una linea",
|
||||||
"All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
|
"All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
|
||||||
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
||||||
|
@ -259,5 +258,8 @@
|
||||||
"Try again": "Vuelve a intentarlo",
|
"Try again": "Vuelve a intentarlo",
|
||||||
"Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
|
"Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
|
||||||
"Failed to upload file": "Error al subir archivo",
|
"Failed to upload file": "Error al subir archivo",
|
||||||
"The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists"
|
"The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
|
||||||
|
"It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
|
||||||
|
"It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
|
||||||
|
"It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas"
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,13 @@ module.exports = Self => {
|
||||||
const shouldEditCloned = canEditCloned || !hasSaleCloned;
|
const shouldEditCloned = canEditCloned || !hasSaleCloned;
|
||||||
const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo;
|
const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo;
|
||||||
|
|
||||||
return shouldEditTracked && shouldEditCloned && shouldEditFloramondo;
|
if (!shouldEditTracked)
|
||||||
|
throw new UserError('It is not possible to modify tracked sales');
|
||||||
|
if (!shouldEditCloned)
|
||||||
|
throw new UserError('It is not possible to modify cloned sales');
|
||||||
|
if (!shouldEditFloramondo)
|
||||||
|
throw new UserError('It is not possible to modify sales that their articles are from Floramondo');
|
||||||
|
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,9 +43,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
const saleIds = sales.map(sale => sale.id);
|
const saleIds = sales.map(sale => sale.id);
|
||||||
|
|
||||||
const canEditSales = await models.Sale.canEdit(ctx, saleIds, myOptions);
|
await models.Sale.canEdit(ctx, saleIds, myOptions);
|
||||||
if (!canEditSales)
|
|
||||||
throw new UserError(`Sale(s) blocked, please contact production`);
|
|
||||||
|
|
||||||
const ticket = await models.Ticket.findById(ticketId, {
|
const ticket = await models.Ticket.findById(ticketId, {
|
||||||
include: {
|
include: {
|
||||||
|
|
|
@ -37,9 +37,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
const salesIds = sales.map(sale => sale.id);
|
const salesIds = sales.map(sale => sale.id);
|
||||||
|
|
||||||
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
|
await models.Sale.canEdit(ctx, salesIds, myOptions);
|
||||||
if (!canEditSale)
|
|
||||||
throw new UserError(`Sale(s) blocked, please contact production`);
|
|
||||||
|
|
||||||
const query = `
|
const query = `
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
|
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
|
||||||
|
|
|
@ -51,9 +51,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
const salesIds = sales.map(sale => sale.id);
|
const salesIds = sales.map(sale => sale.id);
|
||||||
|
|
||||||
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
|
await models.Sale.canEdit(ctx, salesIds, myOptions);
|
||||||
if (!canEditSale)
|
|
||||||
throw new UserError(`Sale(s) blocked, please contact production`);
|
|
||||||
|
|
||||||
let changesMade = '';
|
let changesMade = '';
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
|
@ -50,7 +50,7 @@ describe('sale canEdit()', () => {
|
||||||
|
|
||||||
it('should return false if any of the sales has a saleTracking record', async() => {
|
it('should return false if any of the sales has a saleTracking record', async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
let error;
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ describe('sale canEdit()', () => {
|
||||||
|
|
||||||
const sales = [31];
|
const sales = [31];
|
||||||
|
|
||||||
const result = await models.Sale.canEdit(ctx, sales, options);
|
await models.Sale.canEdit(ctx, sales, options);
|
||||||
|
|
||||||
expect(result).toEqual(false);
|
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(error).toEqual(
|
||||||
|
new Error('It is not possible to modify tracked sales'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -75,22 +75,22 @@ describe('sale canEdit()', () => {
|
||||||
const saleCloned = [29];
|
const saleCloned = [29];
|
||||||
it('should return false if any of the sales is cloned', async() => {
|
it('should return false if any of the sales is cloned', async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
let error;
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const buyerId = 35;
|
const buyerId = 35;
|
||||||
const ctx = {req: {accessToken: {userId: buyerId}}};
|
const ctx = {req: {accessToken: {userId: buyerId}}};
|
||||||
|
|
||||||
const result = await models.Sale.canEdit(ctx, saleCloned, options);
|
await models.Sale.canEdit(ctx, saleCloned, options);
|
||||||
|
|
||||||
expect(result).toEqual(false);
|
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(error).toEqual(
|
||||||
|
new Error('It is not possible to modify cloned sales'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true if any of the sales is cloned and has the correct role', async() => {
|
it('should return true if any of the sales is cloned and has the correct role', async() => {
|
||||||
|
@ -130,7 +130,7 @@ describe('sale canEdit()', () => {
|
||||||
it('should return false if any of the sales isFloramondo', async() => {
|
it('should return false if any of the sales isFloramondo', async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
const sales = [26];
|
const sales = [26];
|
||||||
|
let error;
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
@ -140,15 +140,15 @@ describe('sale canEdit()', () => {
|
||||||
const saleToEdit = await models.Sale.findById(sales[0], null, options);
|
const saleToEdit = await models.Sale.findById(sales[0], null, options);
|
||||||
await saleToEdit.updateAttribute('itemFk', 9, options);
|
await saleToEdit.updateAttribute('itemFk', 9, options);
|
||||||
|
|
||||||
const result = await models.Sale.canEdit(ctx, sales, options);
|
await models.Sale.canEdit(ctx, sales, options);
|
||||||
|
|
||||||
expect(result).toEqual(false);
|
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect(error).toEqual(
|
||||||
|
new Error('It is not possible to modify sales that their articles are from Floramondo'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true if any of the sales is of isFloramondo and has the correct role', async() => {
|
it('should return true if any of the sales is of isFloramondo and has the correct role', async() => {
|
||||||
|
|
|
@ -40,10 +40,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
const currentLine = await models.Sale.findById(id, null, myOptions);
|
const currentLine = await models.Sale.findById(id, null, myOptions);
|
||||||
|
|
||||||
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
|
await models.Sale.canEdit(ctx, [id], myOptions);
|
||||||
|
|
||||||
if (!canEditSale)
|
|
||||||
throw new UserError(`Sale(s) blocked, please contact production`);
|
|
||||||
|
|
||||||
const line = await currentLine.updateAttributes({concept: newConcept}, myOptions);
|
const line = await currentLine.updateAttributes({concept: newConcept}, myOptions);
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const sale = await models.Sale.findById(id, filter, myOptions);
|
const sale = await models.Sale.findById(id, filter, myOptions);
|
||||||
|
|
||||||
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
|
await models.Sale.canEdit(ctx, [id], myOptions);
|
||||||
if (!canEditSale)
|
|
||||||
throw new UserError(`Sale(s) blocked, please contact production`);
|
|
||||||
|
|
||||||
const oldPrice = sale.price;
|
const oldPrice = sale.price;
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
|
|
@ -41,9 +41,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
|
await models.Sale.canEdit(ctx, [id], myOptions);
|
||||||
if (!canEditSale)
|
|
||||||
throw new UserError(`Sale(s) blocked, please contact production`);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: {
|
include: {
|
||||||
|
|
Loading…
Reference in New Issue