feat: refs #4734 Added viaexpress interdia #1938
|
@ -20,7 +20,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.internationalExpedition = async expeditionFk => {
|
||||
Self.internationalExpedition = async (expeditionFk) => {
|
||||
const models = Self.app.models;
|
||||
|
||||
const viaexpressConfig = await models.ViaexpressConfig.findOne({
|
||||
|
|
|
@ -20,11 +20,11 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.renderer = async expeditionFk => {
|
||||
Self.renderer = async (expeditionFk) => {
|
||||
const models = Self.app.models;
|
||||
|
||||
const viaexpressConfig = await models.ViaexpressConfig.findOne({
|
||||
fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType']
|
||||
fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType', 'agencyModeFk']
|
||||
});
|
||||
|
||||
const expedition = await models.Expedition.findOne({
|
||||
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'ticket',
|
||||
scope: {
|
||||
fields: ['shipped', 'addressFk', 'clientFk', 'companyFk'],
|
||||
fields: ['shipped', 'addressFk', 'clientFk', 'companyFk', 'agencyModeFk'],
|
||||
include: [
|
||||
{
|
||||
relation: 'client',
|
||||
|
@ -102,7 +102,6 @@ module.exports = Self => {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
});
|
||||
|
@ -110,13 +109,15 @@ module.exports = Self => {
|
|||
const ticket = expedition.ticket();
|
||||
const sender = ticket.company().client();
|
||||
const shipped = ticket.shipped.toISOString();
|
||||
const isInterdia = (ticket.agencyModeFk === viaexpressConfig.agencyModeFk)
|
||||
const data = {
|
||||
viaexpressConfig,
|
||||
sender,
|
||||
senderAddress: sender.defaultAddress(),
|
||||
client: ticket.client(),
|
||||
address: ticket.address(),
|
||||
shipped
|
||||
shipped,
|
||||
isInterdia
|
||||
};
|
||||
|
||||
const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8');
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<Asegurado>0</Asegurado>
|
||||
<Imprimir>0</Imprimir>
|
||||
<ConDevolucionAlbaran>0</ConDevolucionAlbaran>
|
||||
<Intradia>0</Intradia>
|
||||
<Intradia><%= isInterdia %></Intradia>
|
||||
<Observaciones></Observaciones>
|
||||
<AlbaranRemitente></AlbaranRemitente>
|
||||
<Modo>0</Modo>
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
},
|
||||
"deliveryType": {
|
||||
"type": "string"
|
||||
},
|
||||
"agencyModeFk": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn`.`viaexpressConfig` ADD agencyModeFk int DEFAULT NULL NULL COMMENT 'Indica el agencyMode que es interdia';
|
||||
ALTER TABLE `vn`.`viaexpressConfig` ADD CONSTRAINT viaexpressConfig_agencyMode_Fk FOREIGN KEY (agencyModeFK) REFERENCES vn.agencyMode(id) ON DELETE RESTRICT ON UPDATE RESTRICT;
|
|
@ -5,7 +5,7 @@ module.exports = Self => {
|
|||
accepts: [
|
||||
{
|
||||
arg: 'workerFk',
|
||||
type: 'int',
|
||||
type: 'number',
|
||||
required: true,
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue