Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3795-client_administraive
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
d27a45522b
|
@ -49,7 +49,6 @@ describe('Address updateAddress', () => {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error).toBeDefined();
|
|
||||||
expect(error.message).toEqual('Incoterms is required for a non UEE member');
|
expect(error.message).toEqual('Incoterms is required for a non UEE member');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -73,7 +72,6 @@ describe('Address updateAddress', () => {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error).toBeDefined();
|
|
||||||
expect(error.message).toEqual('Customs agent is required for a non UEE member');
|
expect(error.message).toEqual('Customs agent is required for a non UEE member');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -106,7 +104,9 @@ describe('Address updateAddress', () => {
|
||||||
|
|
||||||
it('should return an error for a user without enough privileges', async() => {
|
it('should return an error for a user without enough privileges', async() => {
|
||||||
const tx = await models.Client.beginTransaction({});
|
const tx = await models.Client.beginTransaction({});
|
||||||
const employeeId = 1;
|
|
||||||
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
ctx.req.accessToken.userId = employeeId;
|
ctx.req.accessToken.userId = employeeId;
|
||||||
|
@ -141,8 +141,10 @@ describe('Address updateAddress', () => {
|
||||||
expect(address.isLogifloraAllowed).toEqual(true);
|
expect(address.isLogifloraAllowed).toEqual(true);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
ctx.req.accessToken.userId = employeeId;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
ctx.req.accessToken.userId = employeeId;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -89,11 +89,12 @@ module.exports = function(Self) {
|
||||||
const args = ctx.args;
|
const args = ctx.args;
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions);
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions);
|
||||||
|
|
||||||
if (args.isLogifloraAllowed && !isSalesAssistant)
|
if (args.isLogifloraAllowed && !isSalesAssistant)
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('item lastEntriesFilter()', () => {
|
describe('item lastEntriesFilter()', () => {
|
||||||
const minDate = new Date(value);
|
it('should return one entry for the given item', async() => {
|
||||||
minHour.setHours(0, 0, 0, 0);
|
const minDate = new Date();
|
||||||
const maxDate = new Date(value);
|
minDate.setHours(0, 0, 0, 0);
|
||||||
maxHour.setHours(23, 59, 59, 59);
|
const maxDate = new Date();
|
||||||
|
maxDate.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
it('should return one entry for a given item', async() => {
|
|
||||||
const tx = await models.Item.beginTransaction({});
|
const tx = await models.Item.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
@ -23,13 +22,18 @@ describe('item lastEntriesFilter()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return five entries for a given item', async() => {
|
it('should return five entries for the given item', async() => {
|
||||||
|
const minDate = new Date();
|
||||||
|
minDate.setHours(0, 0, 0, 0);
|
||||||
|
minDate.setMonth(minDate.getMonth() - 2, 1);
|
||||||
|
|
||||||
|
const maxDate = new Date();
|
||||||
|
maxDate.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
const tx = await models.Item.beginTransaction({});
|
const tx = await models.Item.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
minDate.setMonth(minDate.getMonth() - 2, 1);
|
|
||||||
|
|
||||||
const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}};
|
const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}};
|
||||||
const result = await models.Item.lastEntriesFilter(filter, options);
|
const result = await models.Item.lastEntriesFilter(filter, options);
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ module.exports = Self => {
|
||||||
{'tp.hasTicketRequest': true},
|
{'tp.hasTicketRequest': true},
|
||||||
{'tp.hasComponentLack': true},
|
{'tp.hasComponentLack': true},
|
||||||
{'tp.isTaxDataChecked': false},
|
{'tp.isTaxDataChecked': false},
|
||||||
{'tp.isAvailable': false}
|
{'tp.itemShortage': {neq: null}}
|
||||||
]};
|
]};
|
||||||
} else if (hasProblems === false) {
|
} else if (hasProblems === false) {
|
||||||
whereProblems = {and: [
|
whereProblems = {and: [
|
||||||
|
@ -313,7 +313,7 @@ module.exports = Self => {
|
||||||
{'tp.hasTicketRequest': false},
|
{'tp.hasTicketRequest': false},
|
||||||
{'tp.hasComponentLack': false},
|
{'tp.hasComponentLack': false},
|
||||||
{'tp.isTaxDataChecked': true},
|
{'tp.isTaxDataChecked': true},
|
||||||
{'tp.isAvailable': true}
|
{'tp.itemShortage': null}
|
||||||
]};
|
]};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@
|
||||||
icon="icon-buyrequest">
|
icon="icon-buyrequest">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
ng-show="::ticket.isAvailable === 0"
|
ng-show="::ticket.itemShortage"
|
||||||
translate-attr="{title: 'Not available'}"
|
translate-attr="{title: 'Not visible'}"
|
||||||
class="bright"
|
class="bright"
|
||||||
icon="icon-unavailable">
|
icon="icon-unavailable">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
|
|
|
@ -59,6 +59,12 @@ module.exports = Self => {
|
||||||
fields: ['id', 'name']
|
fields: ['id', 'name']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
relation: 'agencyMode',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name']
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
relation: 'address',
|
relation: 'address',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Unlink zone: Unlink zone {{zoneName}} from agency {{agencyName}}
|
|
@ -2,3 +2,4 @@ Routes: Rutas
|
||||||
Search routes by id: Buscar rutas por identificador
|
Search routes by id: Buscar rutas por identificador
|
||||||
New route: Nueva ruta
|
New route: Nueva ruta
|
||||||
route: ruta
|
route: ruta
|
||||||
|
Unlink zone: Desvincular zona {{zoneName}} de agencia {{agencyName}}
|
|
@ -33,7 +33,7 @@
|
||||||
</vn-th>
|
</vn-th>
|
||||||
<vn-th expand>PC</vn-th>
|
<vn-th expand>PC</vn-th>
|
||||||
<vn-th>Address</vn-th>
|
<vn-th>Address</vn-th>
|
||||||
<vn-th shrink>Warehouse</vn-th>
|
<vn-th shrink>Zone</vn-th>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="link_off"
|
icon="link_off"
|
||||||
class="pointer"
|
class="pointer"
|
||||||
translate-attr="{title: 'Unlink zone: {{::ticket.zone.name}} from agency: {{::ticket.agencyMode.name}}'}"
|
title="{{'Unlink zone' | translate: {zoneName: ticket.zone.name, agencyName: ticket.agencyMode.name} }}"
|
||||||
ng-click="unlinkZoneConfirmation.show(ticket)">
|
ng-click="unlinkZoneConfirmation.show(ticket)">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -76,4 +76,9 @@
|
||||||
question="{{$ctrl.confirmationMessage}}"
|
question="{{$ctrl.confirmationMessage}}"
|
||||||
message="Unlink selected zone?">
|
message="Unlink selected zone?">
|
||||||
</vn-confirm>
|
</vn-confirm>
|
||||||
|
<vn-ticket-descriptor-popover vn-id="ticket-descriptor">
|
||||||
|
</vn-ticket-descriptor-popover>
|
||||||
|
<vn-client-descriptor-popover vn-id="client-descriptor">
|
||||||
|
</vn-client-descriptor-popover>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ module.exports = Self => {
|
||||||
case true:
|
case true:
|
||||||
condition = `or`;
|
condition = `or`;
|
||||||
hasProblem = true;
|
hasProblem = true;
|
||||||
range = 0;
|
range = {neq: null};
|
||||||
hasWhere = true;
|
hasWhere = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ module.exports = Self => {
|
||||||
{'tp.isFreezed': hasProblem},
|
{'tp.isFreezed': hasProblem},
|
||||||
{'tp.risk': hasProblem},
|
{'tp.risk': hasProblem},
|
||||||
{'tp.hasTicketRequest': hasProblem},
|
{'tp.hasTicketRequest': hasProblem},
|
||||||
{'tp.isAvailable': range}
|
{'tp.itemShortage': range}
|
||||||
]};
|
]};
|
||||||
|
|
||||||
if (hasWhere)
|
if (hasWhere)
|
||||||
|
|
|
@ -94,7 +94,7 @@ module.exports = Self => {
|
||||||
sale.visible = itemStock.visible;
|
sale.visible = itemStock.visible;
|
||||||
sale.claim = claimedSales.get(sale.id);
|
sale.claim = claimedSales.get(sale.id);
|
||||||
if (problems) {
|
if (problems) {
|
||||||
sale.isAvailable = problems.isAvailable;
|
sale.itemShortage = problems.itemShortage;
|
||||||
sale.hasTicketRequest = problems.hasTicketRequest;
|
sale.hasTicketRequest = problems.hasTicketRequest;
|
||||||
sale.hasComponentLack = problems.hasComponentLack;
|
sale.hasComponentLack = problems.hasComponentLack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ describe('ticket filter()', () => {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const result = await models.Ticket.filter(ctx, filter, options);
|
const result = await models.Ticket.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(4);
|
expect(result.length).toEqual(6);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -52,8 +52,8 @@
|
||||||
icon="icon-buyrequest">
|
icon="icon-buyrequest">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
ng-show="::ticket.isAvailable === 0"
|
ng-show="::ticket.itemShortage"
|
||||||
translate-attr="{title: 'Not available'}"
|
translate-attr="{title: 'Not visible'}"
|
||||||
class="bright"
|
class="bright"
|
||||||
icon="icon-unavailable">
|
icon="icon-unavailable">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
Weekly tickets: Tickets programados
|
Weekly tickets: Tickets programados
|
||||||
Go to lines: Ir a lineas
|
Go to lines: Ir a lineas
|
||||||
Not available: No disponible
|
Not available: No disponible
|
||||||
|
Not visible: No visible
|
||||||
Payment on account...: Pago a cuenta...
|
Payment on account...: Pago a cuenta...
|
||||||
Set as delivered and open delivery note(s): Marcar como servido/s y abrir albarán/es
|
Set as delivered and open delivery note(s): Marcar como servido/s y abrir albarán/es
|
||||||
Closure: Cierre
|
Closure: Cierre
|
||||||
|
|
|
@ -95,8 +95,8 @@
|
||||||
translate-attr="{title: 'Reserved'}">
|
translate-attr="{title: 'Reserved'}">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
ng-show="::sale.isAvailable === 0"
|
ng-show="::sale.itemShortage"
|
||||||
translate-attr="{title: 'Not available'}"
|
translate-attr="{title: 'Not visible'}"
|
||||||
class="bright"
|
class="bright"
|
||||||
icon="icon-unavailable">
|
icon="icon-unavailable">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
|
|
|
@ -157,8 +157,8 @@
|
||||||
translate-attr="{title: 'Reserved'}">
|
translate-attr="{title: 'Reserved'}">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
ng-show="::sale.isAvailable === 0"
|
ng-show="::sale.itemShortage"
|
||||||
translate-attr="{title: 'Not available'}"
|
translate-attr="{title: 'Not visible'}"
|
||||||
class="bright"
|
class="bright"
|
||||||
icon="icon-unavailable">
|
icon="icon-unavailable">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
|
|
Loading…
Reference in New Issue