3888-ticket.expedition_moveExpedition #1097
|
@ -236,5 +236,5 @@
|
||||||
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
||||||
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
||||||
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
||||||
"This route not exists": "Esta ruta no existe"
|
"This route does not exists": "Esta ruta no existe"
|
||||||
}
|
}
|
|
@ -33,9 +33,13 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const deletedExpeditions = await models.Expedition.destroyAll({
|
const promises = [];
|
||||||
id: {inq: expeditionIds}
|
for (let expeditionId of expeditionIds) {
|
||||||
}, myOptions);
|
const deletedExpedition = models.Expedition.destroyById(expeditionId, myOptions);
|
||||||
|
promises.push(deletedExpedition);
|
||||||
|
}
|
||||||
|
|
||||||
|
const deletedExpeditions = await Promise.all(promises);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
|
|
@ -70,12 +70,12 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
if (args.routeId) {
|
if (args.routeId) {
|
||||||
const route = await models.Route.findById(args.routeId, null, myOptions);
|
const route = await models.Route.findById(args.routeId, null, myOptions);
|
||||||
if (!route) throw new UserError('This route not exists');
|
if (!route) throw new UserError('This route does not exists');
|
||||||
}
|
}
|
||||||
const ticket = await models.Ticket.new(ctx, myOptions);
|
const ticket = await models.Ticket.new(ctx, myOptions);
|
||||||
const promises = [];
|
const promises = [];
|
||||||
for (let expeditionsId of args.expeditionIds) {
|
for (let expeditionsId of args.expeditionIds) {
|
||||||
const expeditionToUpdate = await models.Expedition.findById(expeditionsId);
|
const expeditionToUpdate = await models.Expedition.findById(expeditionsId, null, myOptions);
|
||||||
const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticket.id, myOptions);
|
const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticket.id, myOptions);
|
||||||
promises.push(expeditionUpdated);
|
promises.push(expeditionUpdated);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe('ticket deleteExpeditions()', () => {
|
||||||
const expeditionIds = [12, 13];
|
const expeditionIds = [12, 13];
|
||||||
const result = await models.Expedition.deleteExpeditions(expeditionIds, options);
|
const result = await models.Expedition.deleteExpeditions(expeditionIds, options);
|
||||||
|
|
||||||
expect(result.count).toEqual(2);
|
expect(result.length).toEqual(2);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -159,7 +159,7 @@
|
||||||
</vn-date-picker>
|
</vn-date-picker>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
ng-show="selectLanded.data == 'withRoute'"
|
ng-show="selectLanded.data == 'withRoute'"
|
||||||
label="Id route"
|
label="Route id"
|
||||||
ng-model="$ctrl.newRoute">
|
ng-model="$ctrl.newRoute">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
|
|
|
@ -3,4 +3,4 @@ Expedition removed: Expedición eliminada
|
||||||
Move: Mover
|
Move: Mover
|
||||||
New ticket without route: Nuevo ticket sin ruta
|
New ticket without route: Nuevo ticket sin ruta
|
||||||
New ticket with route: Nuevo ticket con ruta
|
New ticket with route: Nuevo ticket con ruta
|
||||||
Id route: Id ruta
|
Route id: Id ruta
|
Loading…
Reference in New Issue