Merge branch 'master' into test
This commit is contained in:
commit
208936f979
|
@ -23,6 +23,6 @@ module.exports = Self => {
|
||||||
SELECT * FROM tmp.agencyHourGetShipped`;
|
SELECT * FROM tmp.agencyHourGetShipped`;
|
||||||
let result = await Self.rawSql(query, [params.landed, params.addressFk, params.agencyModeFk]);
|
let result = await Self.rawSql(query, [params.landed, params.addressFk, params.agencyModeFk]);
|
||||||
|
|
||||||
return result[1][0].shipped;
|
return result[1][0].shipped || null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,7 @@ module.exports = Self => {
|
||||||
Self.new = async(ctx, params, transaction) => {
|
Self.new = async(ctx, params, transaction) => {
|
||||||
let address = await Self.app.models.Address.findOne({
|
let address = await Self.app.models.Address.findOne({
|
||||||
where: {id: params.addressFk},
|
where: {id: params.addressFk},
|
||||||
fields: ['clientFk'],
|
fields: ['id', 'clientFk'],
|
||||||
include: [
|
include: [
|
||||||
{relation: 'client',
|
{relation: 'client',
|
||||||
scope: {
|
scope: {
|
||||||
|
@ -54,11 +54,15 @@ module.exports = Self => {
|
||||||
throw new UserError(`You can't create a ticket for a client that has a debt`);
|
throw new UserError(`You can't create a ticket for a client that has a debt`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let agency;
|
||||||
|
if (params.agencyModeFk)
|
||||||
|
agency = await Self.app.models.AgencyMode.findById(params.agencyModeFk);
|
||||||
|
|
||||||
if (!params.shipped && params.landed) {
|
if (!params.shipped && params.landed) {
|
||||||
params.shipped = await Self.app.models.Agency.getShipped({
|
params.shipped = await Self.app.models.Agency.getShipped({
|
||||||
landed: params.landed,
|
landed: params.landed,
|
||||||
addressFk: address.id,
|
addressFk: address.id,
|
||||||
agencyModeFk: params.agencyModeFk
|
agencyModeFk: agency.agencyFk
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +70,7 @@ module.exports = Self => {
|
||||||
params.landed = await Self.app.models.Agency.getLanded({
|
params.landed = await Self.app.models.Agency.getLanded({
|
||||||
shipped: params.shipped,
|
shipped: params.shipped,
|
||||||
addressFk: address.id,
|
addressFk: address.id,
|
||||||
agencyModeFk: params.agencyModeFk,
|
agencyModeFk: agency.agencyFk,
|
||||||
warehouseFk: params.warehouseFk
|
warehouseFk: params.warehouseFk
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue