{{::address.phone}}
,
diff --git a/modules/client/front/create/index.html b/modules/client/front/create/index.html
index b5c23ecff..abd974cbf 100644
--- a/modules/client/front/create/index.html
+++ b/modules/client/front/create/index.html
@@ -66,7 +66,7 @@
rule>
{{code}} - {{town.name}} ({{town.province.name}},
- {{town.province.country.country}})
+ {{town.province.country.name}})
{{name}}, {{province.name}}
- ({{province.country.country}})
+ ({{province.country.name}})
@@ -101,14 +101,14 @@
url="Provinces/location"
fields="['id', 'name', 'countryFk']"
rule>
- {{name}} ({{country.country}})
+ {{name}} ({{country.name}})
+ show-field="name">
diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html
index c2bf86f70..c366c8ca3 100644
--- a/modules/client/front/fiscal-data/index.html
+++ b/modules/client/front/fiscal-data/index.html
@@ -16,7 +16,7 @@
auto-load="true"
url="Countries"
data="countries"
- order="country">
+ order="name">
{{code}} - {{town.name}} ({{town.province.name}},
- {{town.province.country.country}})
+ {{town.province.country.name}})
{{name}}, {{province.name}}
- ({{province.country.country}})
+ ({{province.country.name}})
@@ -126,14 +126,14 @@
show-field="name"
value-field="id"
rule>
- {{name}} ({{country.country}})
+ {{name}} ({{country.name}})
diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html
index a42e192d0..3a46a4959 100644
--- a/modules/client/front/summary/index.html
+++ b/modules/client/front/summary/index.html
@@ -104,7 +104,7 @@
value="{{$ctrl.summary.province.name}}">
+ value="{{$ctrl.summary.country.name}}">
diff --git a/modules/entry/back/methods/entry/addFromBuy.js b/modules/entry/back/methods/entry/addFromBuy.js
index 307c04b97..e5cc427a8 100644
--- a/modules/entry/back/methods/entry/addFromBuy.js
+++ b/modules/entry/back/methods/entry/addFromBuy.js
@@ -76,7 +76,6 @@ module.exports = Self => {
packing: buyUltimate.packing,
grouping: buyUltimate.grouping,
groupingMode: buyUltimate.groupingMode,
- containerFk: buyUltimate.containerFk,
comissionValue: buyUltimate.comissionValue,
packageValue: buyUltimate.packageValue,
location: buyUltimate.location,
diff --git a/modules/entry/back/models/buy.json b/modules/entry/back/models/buy.json
index 35861fd81..14cafde06 100644
--- a/modules/entry/back/models/buy.json
+++ b/modules/entry/back/models/buy.json
@@ -63,9 +63,6 @@
"isIgnored": {
"type": "boolean"
},
- "containerFk": {
- "type": "number"
- },
"location": {
"type": "number"
},
diff --git a/modules/invoiceIn/back/models/invoice-in-config.json b/modules/invoiceIn/back/models/invoice-in-config.json
index c0236e654..638a97fa3 100644
--- a/modules/invoiceIn/back/models/invoice-in-config.json
+++ b/modules/invoiceIn/back/models/invoice-in-config.json
@@ -26,7 +26,7 @@
"sageWithholding": {
"type": "belongsTo",
"model": "SageWithholding",
- "foreignKey": "sageWithholdingFk"
+ "foreignKey": "sageFarmerWithholdingFk"
}
},
"acls": [{
diff --git a/modules/invoiceIn/front/descriptor/index.html b/modules/invoiceIn/front/descriptor/index.html
index c4330fbf0..97eeaafb7 100644
--- a/modules/invoiceIn/front/descriptor/index.html
+++ b/modules/invoiceIn/front/descriptor/index.html
@@ -1,7 +1,7 @@
diff --git a/modules/invoiceIn/front/descriptor/index.js b/modules/invoiceIn/front/descriptor/index.js
index e005211a3..8fe270fa0 100644
--- a/modules/invoiceIn/front/descriptor/index.js
+++ b/modules/invoiceIn/front/descriptor/index.js
@@ -112,7 +112,7 @@ class Controller extends Descriptor {
}
isAgricultural() {
- return this.invoiceIn.supplier.sageWithholdingFk == this.config[0].sageWithholdingFk;
+ return this.invoiceIn.supplier.sageWithholdingFk == this.config[0].sageFarmerWithholdingFk;
}
}
diff --git a/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js b/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js
index 4bba2498f..e2dc15993 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/makePdfAndNotify.js
@@ -33,7 +33,6 @@ module.exports = Self => {
try {
await Self.makePdf(id, options);
} catch (err) {
- console.error(err);
throw new UserError('Error while generating PDF', 'pdfError');
}
diff --git a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js
index fc8830885..76ef29604 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js
@@ -59,7 +59,7 @@ module.exports = Self => {
`CREATE OR REPLACE TEMPORARY TABLE tmp.filter
ENGINE = MEMORY
SELECT co.code company,
- cou.country,
+ cou.name country,
c.id clientId,
c.socialName clientSocialName,
u.nickname workerSocialName,
diff --git a/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js
index 8e234d7cc..b5eb9bed5 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/transferInvoice.js
@@ -36,6 +36,11 @@ module.exports = Self => {
type: 'number',
required: true
},
+ {
+ arg: 'checked',
+ type: 'boolean',
+ required: true
+ },
],
returns: {
type: 'boolean',
@@ -51,6 +56,7 @@ module.exports = Self => {
const models = Self.app.models;
const myOptions = {userId: ctx.req.accessToken.userId};
const {id, refFk, newClientFk, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk} = ctx.args;
+ const checked = ctx.args.checked;
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
@@ -96,9 +102,10 @@ module.exports = Self => {
await models.Ticket.invoiceTickets(ctx, refundTicketIds, invoiceCorrection, myOptions);
- const [invoiceId] = await models.Ticket.invoiceTicketsAndPdf(ctx, clonedTicketIds, null, myOptions);
-
- return invoiceId;
+ if (!checked) {
+ const [invoiceId] = await models.Ticket.invoiceTicketsAndPdf(ctx, clonedTicketIds, null, myOptions);
+ return invoiceId;
+ }
} catch (e) {
if (tx) await tx.rollback();
throw e;
diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html
index 1bf34831e..da04c8e72 100644
--- a/modules/invoiceOut/front/descriptor-menu/index.html
+++ b/modules/invoiceOut/front/descriptor-menu/index.html
@@ -1,15 +1,3 @@
-
-
-
-
- {{::description}}
+ {{ ::description}}
@@ -226,7 +214,7 @@
+
+
+
+
diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js
index 5184c137e..0d7fb32dd 100644
--- a/modules/invoiceOut/front/descriptor-menu/index.js
+++ b/modules/invoiceOut/front/descriptor-menu/index.js
@@ -7,6 +7,7 @@ class Controller extends Section {
super($element, $);
this.vnReport = vnReport;
this.vnEmail = vnEmail;
+ this.checked = true;
}
get invoiceOut() {
@@ -23,6 +24,26 @@ class Controller extends Section {
return this.aclService.hasAny(['invoicing']);
}
+ get isChecked() {
+ return this.checked;
+ }
+
+ set isChecked(value) {
+ this.checked = value;
+ }
+
+ $onInit() {
+ this.$http.get(`CplusRectificationTypes`, {filter: {order: 'description'}})
+ .then(res => {
+ this.cplusRectificationTypes = res.data;
+ this.cplusRectificationType = res.data.filter(type => type.description == 'I – Por diferencias')[0].id;
+ });
+ this.$http.get(`SiiTypeInvoiceOuts`, {filter: {where: {code: {like: 'R%'}}}})
+ .then(res => {
+ this.siiTypeInvoiceOuts = res.data;
+ this.siiTypeInvoiceOut = res.data.filter(type => type.code == 'R4')[0].id;
+ });
+ }
loadData() {
const filter = {
include: [
@@ -34,7 +55,7 @@ class Controller extends Section {
}, {
relation: 'client',
scope: {
- fields: ['id', 'name', 'email']
+ fields: ['id', 'name', 'email', 'hasToInvoiceByAddress']
}
}
]
@@ -136,12 +157,24 @@ class Controller extends Section {
newClientFk: this.clientId,
cplusRectificationTypeFk: this.cplusRectificationType,
siiTypeInvoiceOutFk: this.siiTypeInvoiceOut,
- invoiceCorrectionTypeFk: this.invoiceCorrectionType
+ invoiceCorrectionTypeFk: this.invoiceCorrectionType,
+ checked: this.checked
};
- this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
- const invoiceId = res.data;
- this.vnApp.showSuccess(this.$t('Transferred invoice'));
- this.$state.go('invoiceOut.card.summary', {id: invoiceId});
+
+ this.$http.get(`Clients/${this.clientId}`).then(response => {
+ const clientData = response.data;
+ const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress;
+
+ if (this.checked && hasToInvoiceByAddress) {
+ if (!window.confirm(this.$t('confirmTransferInvoice')))
+ return;
+ }
+
+ this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
+ const invoiceId = res.data;
+ this.vnApp.showSuccess(this.$t('Transferred invoice'));
+ this.$state.go('invoiceOut.card.summary', {id: invoiceId});
+ });
});
}
}
diff --git a/modules/invoiceOut/front/descriptor-menu/locale/en.yml b/modules/invoiceOut/front/descriptor-menu/locale/en.yml
index 8fad5f25e..32ea03442 100644
--- a/modules/invoiceOut/front/descriptor-menu/locale/en.yml
+++ b/modules/invoiceOut/front/descriptor-menu/locale/en.yml
@@ -1,3 +1,7 @@
The following refund tickets have been created: "The following refund tickets have been created: {{ticketIds}}"
Transfer invoice to...: Transfer invoice to...
-Cplus Type: Cplus Type
\ No newline at end of file
+Cplus Type: Cplus Type
+transferInvoice: Transfer Invoice
+destinationClient: Bill destination client
+transferInvoiceInfo: New tickets from the destination customer will be generated in the default consignee.
+confirmTransferInvoice: Destination customer has marked to bill by consignee, do you want to continue?
\ No newline at end of file
diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml
index 9285fafa7..92c109878 100644
--- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml
+++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml
@@ -24,3 +24,7 @@ Refund...: Abono...
Transfer invoice to...: Transferir factura a...
Rectificative type: Tipo rectificativa
Transferred invoice: Factura transferida
+transferInvoice: Transferir factura
+destinationClient: Facturar cliente destino
+transferInvoiceInfo: Los nuevos tickets del cliente destino serán generados en el consignatario por defecto.
+confirmTransferInvoice: El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?
\ No newline at end of file
diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html
index 5fe84591f..13c671d29 100644
--- a/modules/item/front/summary/index.html
+++ b/modules/item/front/summary/index.html
@@ -181,7 +181,7 @@
ng-show="!$ctrl.isBuyer && !$ctrl.isAdministrative">
Tax
-
diff --git a/modules/item/front/tax/index.html b/modules/item/front/tax/index.html
index e993f974f..78858704f 100644
--- a/modules/item/front/tax/index.html
+++ b/modules/item/front/tax/index.html
@@ -15,7 +15,7 @@
{
const clone = await models.Roadmap.create(roadmap, options);
- const expeditionTrucks = roadmap.expeditionTruck();
- expeditionTrucks.map(expeditionTruck => {
- expeditionTruck.roadmapFk = clone.id;
- return expeditionTruck;
+ const roadmapStops = roadmap.roadmapStop();
+ roadmapStops.map(roadmapStop => {
+ roadmapStop.roadmapFk = clone.id;
+ return roadmapStop;
});
- await models.ExpeditionTruck.create(expeditionTrucks, options);
+ await models.RoadmapStop.create(roadmapStops, options);
}
await tx.commit();
diff --git a/modules/route/back/methods/route/getExternalCmrs.js b/modules/route/back/methods/route/getExternalCmrs.js
index b8cd1041a..89536f50a 100644
--- a/modules/route/back/methods/route/getExternalCmrs.js
+++ b/modules/route/back/methods/route/getExternalCmrs.js
@@ -103,7 +103,7 @@ module.exports = Self => {
SELECT t.cmrFk,
t.id ticketFk,
t.routeFk,
- co.country,
+ co.name country,
t.clientFk,
IF(sub.id, TRUE, FALSE) hasCmrDms,
DATE(t.shipped) shipped
diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json
index 6cf8da986..0cb48852f 100644
--- a/modules/route/back/model-config.json
+++ b/modules/route/back/model-config.json
@@ -8,7 +8,7 @@
"DeliveryPoint": {
"dataSource": "vn"
},
- "ExpeditionTruck": {
+ "RoadmapStop": {
"dataSource": "vn"
},
"Roadmap": {
@@ -25,5 +25,8 @@
},
"RoutesMonitor": {
"dataSource": "vn"
+ },
+ "ExpeditionTruck": {
+ "dataSource": "vn"
}
}
diff --git a/modules/route/back/models/expedition-truck.json b/modules/route/back/models/expedition-truck.json
index 8edc7347f..fc9cd90f0 100644
--- a/modules/route/back/models/expedition-truck.json
+++ b/modules/route/back/models/expedition-truck.json
@@ -1,43 +1,9 @@
{
"name": "ExpeditionTruck",
- "base": "VnModel",
+ "base": "RoadmapStop",
"options": {
"mysql": {
"table": "expeditionTruck"
}
- },
- "properties": {
- "id": {
- "type": "number",
- "id": true,
- "description": "Identifier"
- },
- "roadmapFk": {
- "type": "number"
- },
- "warehouseFk": {
- "type": "number"
- },
- "eta": {
- "type": "date"
- },
- "description": {
- "type": "string"
- },
- "userFk": {
- "type": "number"
- }
- },
- "relations": {
- "roadmap": {
- "type": "belongsTo",
- "model": "Roadmap",
- "foreignKey": "roadmapFk"
- },
- "warehouse": {
- "type": "belongsTo",
- "model": "Warehouse",
- "foreignKey": "warehouseFk"
- }
- }
+ }
}
diff --git a/modules/route/back/models/roadmap.json b/modules/route/back/models/roadmap.json
index 2f6bb8c02..01572d718 100644
--- a/modules/route/back/models/roadmap.json
+++ b/modules/route/back/models/roadmap.json
@@ -54,9 +54,9 @@
"model": "Supplier",
"foreignKey": "supplierFk"
},
- "expeditionTruck": {
+ "roadmapStop": {
"type": "hasMany",
- "model": "ExpeditionTruck",
+ "model": "RoadmapStop",
"foreignKey": "roadmapFk"
}
}
diff --git a/modules/route/back/models/roadmapStop.json b/modules/route/back/models/roadmapStop.json
new file mode 100644
index 000000000..51aa3a6db
--- /dev/null
+++ b/modules/route/back/models/roadmapStop.json
@@ -0,0 +1,43 @@
+{
+ "name": "RoadmapStop",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "roadmapStop"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "roadmapFk": {
+ "type": "number"
+ },
+ "warehouseFk": {
+ "type": "number"
+ },
+ "eta": {
+ "type": "date"
+ },
+ "description": {
+ "type": "string"
+ },
+ "userFk": {
+ "type": "number"
+ }
+ },
+ "relations": {
+ "roadmap": {
+ "type": "belongsTo",
+ "model": "Roadmap",
+ "foreignKey": "roadmapFk"
+ },
+ "warehouse": {
+ "type": "belongsTo",
+ "model": "Warehouse",
+ "foreignKey": "warehouseFk"
+ }
+ }
+}
diff --git a/modules/route/front/roadmap/stops/index.html b/modules/route/front/roadmap/stops/index.html
index b69492a21..82f30c326 100644
--- a/modules/route/front/roadmap/stops/index.html
+++ b/modules/route/front/roadmap/stops/index.html
@@ -1,22 +1,22 @@
@@ -61,9 +61,9 @@
-
- {{expeditionTruck.warehouse.name}}
- {{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}}
+
+ {{roadmapStop.warehouse.name}}
+ {{roadmapStop.eta | date:'dd/MM/yyyy HH:mm'}}
@@ -75,14 +75,14 @@
+ ng-model="$ctrl.roadmapStop.eta">
diff --git a/modules/route/front/roadmap/summary/index.js b/modules/route/front/roadmap/summary/index.js
index 041b43ce3..46abe5ca2 100644
--- a/modules/route/front/roadmap/summary/index.js
+++ b/modules/route/front/roadmap/summary/index.js
@@ -20,7 +20,7 @@ class Controller extends Component {
include: [
{relation: 'supplier'},
{relation: 'worker'},
- {relation: 'expeditionTruck',
+ {relation: 'roadmapStop',
scope: {
include: [
{relation: 'warehouse'}
@@ -36,19 +36,19 @@ class Controller extends Component {
const eta = new Date(this.roadmap.etd);
eta.setDate(eta.getDate() + 1);
- this.expeditionTruck = {eta: eta};
+ this.roadmapStop = {eta: eta};
}
onAddAccept() {
try {
const data = {
roadmapFk: this.roadmap.id,
- warehouseFk: this.expeditionTruck.warehouseFk,
- eta: this.expeditionTruck.eta,
- description: this.expeditionTruck.description
+ warehouseFk: this.roadmapStop.warehouseFk,
+ eta: this.roadmapStop.eta,
+ description: this.roadmapStop.description
};
- this.$http.post(`ExpeditionTrucks`, data)
+ this.$http.post(`RoadmapStops`, data)
.then(() => {
this.loadData();
this.vnApp.showSuccess(this.$t('Data saved!'));
diff --git a/modules/supplier/front/address/create/index.html b/modules/supplier/front/address/create/index.html
index e45539445..e3f883641 100644
--- a/modules/supplier/front/address/create/index.html
+++ b/modules/supplier/front/address/create/index.html
@@ -43,7 +43,7 @@
rule>
{{code}} - {{town.name}} ({{town.province.name}},
- {{town.province.country.country}})
+ {{town.province.country.name}})
{{name}}, {{province.name}}
- ({{province.country.country}})
+ ({{province.country.name}})
- {{name}} ({{country.country}})
+ {{name}} ({{country.name}})
diff --git a/modules/supplier/front/address/edit/index.html b/modules/supplier/front/address/edit/index.html
index b6f90134b..b966023da 100644
--- a/modules/supplier/front/address/edit/index.html
+++ b/modules/supplier/front/address/edit/index.html
@@ -41,7 +41,7 @@
rule>
{{code}} - {{town.name}} ({{town.province.name}},
- {{town.province.country.country}})
+ {{town.province.country.name}})
{{name}}, {{province.name}}
- ({{province.country.country}})
+ ({{province.country.name}})
- {{name}} ({{country.country}})
+ {{name}} ({{country.name}})
diff --git a/modules/supplier/front/fiscal-data/index.html b/modules/supplier/front/fiscal-data/index.html
index 3fe67762f..6455bf3fd 100644
--- a/modules/supplier/front/fiscal-data/index.html
+++ b/modules/supplier/front/fiscal-data/index.html
@@ -16,7 +16,7 @@
auto-load="true"
url="Countries"
data="countries"
- order="country">
+ order="name">
{{code}} - {{town.name}} ({{town.province.name}},
- {{town.province.country.country}})
+ {{town.province.country.name}})
{{name}}, {{province.name}}
- ({{province.country.country}})
+ ({{province.country.name}})
- {{name}} ({{country.country}})
+ {{name}} ({{country.name}})
@@ -198,7 +198,7 @@
vn-name="country"
ng-model="$ctrl.supplier.countryFk"
data="countries"
- show-field="country"
+ show-field="name"
value-field="id"
rule>
diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html
index d1b3ee20a..5ba713fcf 100644
--- a/modules/supplier/front/summary/index.html
+++ b/modules/supplier/front/summary/index.html
@@ -162,7 +162,7 @@
+ value="{{::$ctrl.summary.country.name}}">
diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js
index 00310f33c..7c17d0010 100644
--- a/modules/ticket/back/methods/ticket-request/confirm.js
+++ b/modules/ticket/back/methods/ticket-request/confirm.js
@@ -19,6 +19,9 @@ module.exports = Self => {
type: 'number',
required: true,
description: 'The requested item quantity',
+ }, {
+ arg: 'attenderFk',
+ type: 'number'
}],
returns: {
type: 'object',
@@ -73,12 +76,14 @@ module.exports = Self => {
ticketFk: request.ticketFk,
itemFk: ctx.args.itemFk,
quantity: ctx.args.quantity,
+ attenderFk: ctx.args.attenderFk,
concept: item.name
}, myOptions);
await request.updateAttributes({
saleFk: sale.id,
itemFk: sale.itemFk,
- isOk: true
+ isOk: true,
+ attenderFk: sale.attenderFk,
}, myOptions);
const query = `CALL vn.sale_calculateComponent(?, NULL)`;
diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js
index 8c59dc3b0..fba39f18f 100644
--- a/modules/ticket/back/methods/ticket/closure.js
+++ b/modules/ticket/back/methods/ticket/closure.js
@@ -13,8 +13,6 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
const failedtickets = [];
for (const ticket of tickets) {
try {
- await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], {userId});
-
await Self.app.models.InvoiceOut.getSerial(ticket.clientFk, ticket.companyFk, ticket.addressFk, 'M');
await Self.rawSql(
`CALL vn.ticket_closeByTicket(?)`,
diff --git a/modules/ticket/back/models/expeditionPallet.json b/modules/ticket/back/models/expeditionPallet.json
index cab3af6ec..64b3092ae 100644
--- a/modules/ticket/back/models/expeditionPallet.json
+++ b/modules/ticket/back/models/expeditionPallet.json
@@ -23,9 +23,9 @@
}
},
"relations": {
- "expeditionTruck": {
+ "roadmapStop": {
"type": "belongsTo",
- "model": "ExpeditionTruck",
+ "model": "RoadmapStop",
"foreignKey": "truckFk"
}
}
diff --git a/modules/worker/back/methods/worker-time-control/resendWeeklyHourEmail.js b/modules/worker/back/methods/worker-time-control/resendWeeklyHourEmail.js
index 896458455..885637118 100644
--- a/modules/worker/back/methods/worker-time-control/resendWeeklyHourEmail.js
+++ b/modules/worker/back/methods/worker-time-control/resendWeeklyHourEmail.js
@@ -1,3 +1,5 @@
+const moment = require('moment');
+
module.exports = Self => {
Self.remoteMethodCtx('resendWeeklyHourEmail', {
description: 'Send the records for the week of the date provided',
@@ -31,7 +33,8 @@ module.exports = Self => {
Object.assign(myOptions, options);
const yearNumber = dated.getFullYear();
- const weekNumber = getWeekNumber(dated);
+ const weekNumber = moment(dated).isoWeek();
+
const workerTimeControlMail = await models.WorkerTimeControlMail.findOne({
where: {
workerFk: workerId,
@@ -54,15 +57,4 @@ module.exports = Self => {
return false;
};
-
- function getWeekNumber(date) {
- const tempDate = new Date(date);
- let dayOfWeek = tempDate.getDay();
- dayOfWeek = (dayOfWeek === 0) ? 7 : dayOfWeek;
- const firstDayOfWeek = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() - (dayOfWeek - 1));
- const firstDayOfYear = new Date(tempDate.getFullYear(), 0, 1);
- const differenceInMilliseconds = firstDayOfWeek.getTime() - firstDayOfYear.getTime();
- const weekNumber = Math.floor(differenceInMilliseconds / (1000 * 60 * 60 * 24 * 7)) + 1;
- return weekNumber;
- }
};
diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js
index d628d0a2b..2de1d6e4d 100644
--- a/modules/worker/back/methods/worker/createAbsence.js
+++ b/modules/worker/back/methods/worker/createAbsence.js
@@ -98,6 +98,22 @@ module.exports = Self => {
if (isHalfHoliday && hasHalfHoliday)
throw new UserError(`Cannot add more than one '1/2 day vacation'`);
+ const isFestive = absenceType.isFestiveEligible;
+
+ const workCenter = await models.Business.findOne({
+ where: {id: args.businessFk}
+ },);
+
+ const [holiday] = await models.CalendarHoliday.find({
+ where: {
+ dated: args.dated,
+ workCenterFk: workCenter.workCenterFk
+ }
+ });
+
+ if (holiday && isFestive)
+ throw new UserError(`Cannot add holidays on this day`);
+
const absence = await models.Calendar.create({
businessFk: labour.businessFk,
dayOffTypeFk: args.absenceTypeId,
diff --git a/modules/worker/back/methods/worker/getAvailablePda.js b/modules/worker/back/methods/worker/getAvailablePda.js
new file mode 100644
index 000000000..65641a9e6
--- /dev/null
+++ b/modules/worker/back/methods/worker/getAvailablePda.js
@@ -0,0 +1,23 @@
+module.exports = Self => {
+ Self.remoteMethod('getAvailablePda', {
+ description: 'returns devices without user',
+ accessType: 'READ',
+ accepts: [],
+ returns: {
+ type: 'array',
+ root: true
+ },
+ http: {
+ path: `/getAvailablePda`,
+ verb: 'GET'
+ }
+ });
+ Self.getAvailablePda = async() => {
+ return Self.app.models.DeviceProduction.rawSql(
+ `SELECT d.*
+ FROM deviceProduction d
+ LEFT JOIN deviceProductionUser du ON du.deviceProductionFk = d.id
+ WHERE du.deviceProductionFk IS NULL`
+ );
+ };
+};
diff --git a/modules/worker/back/methods/worker/specs/createAbsence.spec.js b/modules/worker/back/methods/worker/specs/createAbsence.spec.js
index 346e43c51..aadaca99b 100644
--- a/modules/worker/back/methods/worker/specs/createAbsence.spec.js
+++ b/modules/worker/back/methods/worker/specs/createAbsence.spec.js
@@ -104,6 +104,35 @@ describe('Worker createAbsence()', () => {
expect(error.message).toEqual(`Cannot add more than one '1/2 day vacation'`);
});
+ it(`should throw an error when adding a "Holiday" absence if there's a festivity`, async() => {
+ const ctx = {
+ req: {accessToken: {userId: 9}},
+ args: {
+ id: 3,
+ businessFk: 3,
+ absenceTypeId: 1,
+ dated: '2001-12-08T23:00:00.000Z'
+ }
+ };
+ const workerId = 1;
+
+ const tx = await app.models.Calendar.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+
+ await app.models.Worker.createAbsence(ctx, workerId, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ error = e;
+ }
+
+ expect(error.message).toEqual(`Cannot add holidays on this day`);
+ });
+
it(`should throw an error when adding a absence if the worker has hours recorded that day and not is a half absence`, async() => {
const ctx = {
req: {accessToken: {userId: 19}},
diff --git a/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js b/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js
new file mode 100644
index 000000000..c7051f0b4
--- /dev/null
+++ b/modules/worker/back/methods/worker/specs/getAvailablePda.spec.js
@@ -0,0 +1,13 @@
+const models = require('vn-loopback/server/server').models;
+
+describe('worker getAvailablePda()', () => {
+ it('should return a Pda that has no user assigned', async() => {
+ const [{id}] = await models.Worker.getAvailablePda();
+
+ const deviceProductionUser = await models.DeviceProductionUser.findOne({
+ where: {deviceProductionFk: id}
+ });
+
+ expect(!deviceProductionUser).toBeTruthy();
+ });
+});
diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json
index e1a47b7e9..b7c355511 100644
--- a/modules/worker/back/model-config.json
+++ b/modules/worker/back/model-config.json
@@ -121,6 +121,9 @@
},
"Operator": {
"dataSource": "vn"
+ },
+ "Locker": {
+ "dataSource": "vn"
}
}
diff --git a/modules/worker/back/models/absence-type.json b/modules/worker/back/models/absence-type.json
index 7fc62f780..2f6103367 100644
--- a/modules/worker/back/models/absence-type.json
+++ b/modules/worker/back/models/absence-type.json
@@ -22,7 +22,10 @@
},
"holidayEntitlementRate": {
"type": "number"
- }
+ },
+ "isFestiveEligible": {
+ "type": "boolean"
+ }
},
"acls": [
{
@@ -32,4 +35,4 @@
"permission": "ALLOW"
}
]
-}
\ No newline at end of file
+}
diff --git a/modules/worker/back/models/device-production-user.js b/modules/worker/back/models/device-production-user.js
new file mode 100644
index 000000000..8eead58e0
--- /dev/null
+++ b/modules/worker/back/models/device-production-user.js
@@ -0,0 +1,11 @@
+const UserError = require('vn-loopback/util/user-error');
+module.exports = Self => {
+ Self.rewriteDbError(function(err) {
+ if (err.code === 'ER_DUP_ENTRY')
+ return new UserError(`This PDA is already assigned to another user`);
+
+ if (err.code === 'ER_SIGNAL_EXCEPTION' && err.sqlMessage === 'You can only have one active PDA')
+ return new UserError(err.sqlMessage);
+ return err;
+ });
+};
diff --git a/modules/worker/back/models/device-production-user.json b/modules/worker/back/models/device-production-user.json
index 35a90fb50..a024cc94c 100644
--- a/modules/worker/back/models/device-production-user.json
+++ b/modules/worker/back/models/device-production-user.json
@@ -14,6 +14,10 @@
}
},
"properties": {
+ "id": {
+ "type": "number",
+ "id": true
+ },
"deviceProductionFk": {
"type": "number",
"id": true
@@ -21,6 +25,9 @@
"userFk": {
"type": "number"
},
+ "simSerialNumber": {
+ "type": "string"
+ },
"created": {
"type": "date"
}
@@ -28,7 +35,7 @@
"relations": {
"deviceProduction": {
"type": "belongsTo",
- "model": "DeviceProduction",
+ "model": "DeviceProduction",
"foreignKey": "deviceProductionFk"
},
"user": {
@@ -36,5 +43,10 @@
"model": "User",
"foreignKey": "userFk"
}
+ },
+ "scope": {
+ "include":{
+ "relation": "deviceProduction"
+ }
}
}
diff --git a/modules/worker/back/models/locker.js b/modules/worker/back/models/locker.js
new file mode 100644
index 000000000..4475c2cd1
--- /dev/null
+++ b/modules/worker/back/models/locker.js
@@ -0,0 +1,21 @@
+module.exports = Self => {
+ Self.observe('before save', async ctx => {
+ const models = Self.app.models;
+ const changes = ctx.data || ctx.instance;
+ const instance = ctx.currentInstance;
+
+ const workerFk = changes?.workerFk || instance?.workerFk;
+ if (workerFk) {
+ const locker = await models.Locker.findOne({
+ where: {workerFk}
+ }, ctx.options);
+
+ if (locker) {
+ await Self.rawSql(
+ 'UPDATE locker SET workerFk = NULL where workerFk = ?',
+ [workerFk],
+ ctx.options);
+ }
+ }
+ });
+};
diff --git a/modules/worker/back/models/locker.json b/modules/worker/back/models/locker.json
new file mode 100644
index 000000000..335fca5a9
--- /dev/null
+++ b/modules/worker/back/models/locker.json
@@ -0,0 +1,23 @@
+{
+ "name": "Locker",
+ "base": "VnModel",
+ "description": "Worker's locker",
+ "options": {
+ "mysql": {
+ "table": "locker"
+ }
+ },
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "gender": {
+ "type": "string"
+ }
+ },
+ "scopes": {
+ "codes": {
+ "fields": ["id","code"]
+ }
+ }
+}
diff --git a/modules/worker/back/models/specs/locker.spec.js b/modules/worker/back/models/specs/locker.spec.js
new file mode 100644
index 000000000..32abb830e
--- /dev/null
+++ b/modules/worker/back/models/specs/locker.spec.js
@@ -0,0 +1,56 @@
+const {models} = require('vn-loopback/server/server');
+
+describe('locker model ', () => {
+ const productionBossId = 50;
+ const hrBuyerId = 124;
+ const hrId = 37;
+ const jessicaJonesId = 1110;
+ const bruceBannerId = 1109;
+ const lockerMaleId = 1;
+ const lockerFemaleId = 147;
+ let ctx;
+ let options;
+ let tx;
+
+ beforeEach(async() => {
+ ctx = {
+ req: {
+ accessToken: {userId: hrId},
+ headers: {origin: 'http://localhost'}
+ },
+ };
+ options = {transaction: tx};
+ tx = await models.Locker.beginTransaction({});
+ options.transaction = tx;
+ });
+
+ afterEach(async() => {
+ await tx.rollback();
+ });
+
+ it('should allocate a locker', async() => {
+ ctx.req.accessToken.userId = productionBossId;
+
+ const locker = await models.Locker.findById(lockerMaleId, null, options);
+ await locker.updateAttributes({workerFk: bruceBannerId}, options);
+
+ expect(locker.workerFk).toEqual(bruceBannerId);
+ });
+
+ it('should take away a locker', async() => {
+ ctx.req.accessToken.userId = hrBuyerId;
+ const locker = await models.Locker.findById(lockerFemaleId, null, options);
+ await locker.updateAttributes({workerFk: null}, options);
+
+ expect(locker.workerFk).toEqual(null);
+ });
+
+ it('should change a locker', async() => {
+ const locker = await models.Locker.findById(148, null, options);
+ await locker.updateAttributes({workerFk: jessicaJonesId}, options);
+ const oldLocker = await models.Locker.findById(lockerFemaleId, null, options);
+
+ expect(locker.workerFk).toEqual(jessicaJonesId);
+ expect(oldLocker.workerFk).toEqual(null);
+ });
+});
diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js
index b475bf26e..0b0e043f2 100644
--- a/modules/worker/back/models/worker.js
+++ b/modules/worker/back/models/worker.js
@@ -20,10 +20,7 @@ module.exports = Self => {
require('../methods/worker/search')(Self);
require('../methods/worker/isAuthorized')(Self);
require('../methods/worker/setPassword')(Self);
-
- Self.validatesUniquenessOf('locker', {
- message: 'This locker has already been assigned'
- });
+ require('../methods/worker/getAvailablePda')(Self);
Self.validateAsync('fi', tinIsValid, {
message: 'Invalid TIN'
diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json
index ed430f133..4e7617aab 100644
--- a/modules/worker/back/models/worker.json
+++ b/modules/worker/back/models/worker.json
@@ -48,9 +48,6 @@
"code": {
"type" : "string"
},
- "locker": {
- "type" : "number"
- },
"fi": {
"type" : "string"
},
@@ -59,7 +56,29 @@
},
"isF11Allowed": {
"type" : "boolean"
+ },
+ "sex": {
+ "type" : "string"
+ },
+ "isFreelance": {
+ "type" : "boolean"
+ },
+ "fiDueDate": {
+ "type": "date"
+ },
+ "hasMachineryAuthorized": {
+ "type": "boolean"
+ },
+ "seniority": {
+ "type": "date"
+ },
+ "isDisable": {
+ "type": "boolean"
+ },
+ "isSsDiscounted": {
+ "type": "boolean"
}
+
},
"relations": {
"user": {
@@ -91,6 +110,20 @@
"type": "hasMany",
"model": "WorkerTeamCollegues",
"foreignKey": "workerFk"
+ },
+ "locker": {
+ "type": "hasMany",
+ "model": "Locker",
+ "foreignKey": "workerFk"
}
- }
+ },
+ "acls":[
+ {
+ "property": "__get__locker",
+ "accessType": "READ",
+ "permission": "ALLOW",
+ "principalType": "ROLE",
+ "principalId": "$owner"
+ }
+ ]
}
diff --git a/modules/worker/front/basic-data/index.html b/modules/worker/front/basic-data/index.html
index 2d85d018d..aa3f6ca79 100644
--- a/modules/worker/front/basic-data/index.html
+++ b/modules/worker/front/basic-data/index.html
@@ -75,11 +75,6 @@
ng-model="$ctrl.worker.SSN"
rule>
-
-
diff --git a/modules/worker/front/create/index.html b/modules/worker/front/create/index.html
index 39b2dbf47..3030ffecd 100644
--- a/modules/worker/front/create/index.html
+++ b/modules/worker/front/create/index.html
@@ -65,7 +65,7 @@
rule>
{{code}} - {{town.name}} ({{town.province.name}},
- {{town.province.country.country}})
+ {{town.province.country.name}})
- {{name}} ({{country.country}})
+ {{name}} ({{country.name}})
@@ -99,7 +99,7 @@
value-field="name">
{{name}}, {{province.name}}
- ({{province.country.country}})
+ ({{province.country.name}})
-
-
-
-
-
-
-
-
-
-
-
-
- {{town.province.name}}, {{town.province.country.country}}
+ {{town.province.name}}, {{town.province.country.name}}
diff --git a/myt.config.yml b/myt.config.yml
index 17300aa37..56239ca3c 100755
--- a/myt.config.yml
+++ b/myt.config.yml
@@ -227,7 +227,7 @@ localFixtures:
- expeditionScan
- expeditionState
- expeditionStateType
- - expeditionTruck
+ - roadmapStop
- expense
- genus
- greuge
diff --git a/package.json b/package.json
index e0afe3d13..be3dcca04 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-back",
- "version": "24.20.1",
+ "version": "24.22.1",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",
@@ -39,6 +39,7 @@
"loopback-context": "^3.5.2",
"loopback-datasource-juggler": "3.36.1",
"md5": "^2.2.1",
+ "moment": "^2.30.1",
"mysql": "2.18.1",
"node-ssh": "^11.0.0",
"object.pick": "^1.3.0",
@@ -115,7 +116,8 @@
"test:e2e": "node e2e/tests.js",
"test:front": "jest --watch",
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
- "lint": "eslint ./ --cache --ignore-pattern .gitignore"
+ "lint": "eslint ./ --cache --ignore-pattern .gitignore",
+ "watch:db": "node ./db/dbWatcher.js"
},
"jest": {
"projects": [
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b6634196e..22d5b46f1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -83,6 +83,9 @@ dependencies:
md5:
specifier: ^2.2.1
version: 2.3.0
+ moment:
+ specifier: ^2.30.1
+ version: 2.30.1
mysql:
specifier: 2.18.1
version: 2.18.1
@@ -10248,6 +10251,10 @@ packages:
to-iso-string: 0.0.2
dev: false
+ /moment@2.30.1:
+ resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
+ dev: false
+
/ms@0.7.1:
resolution: {integrity: sha512-lRLiIR9fSNpnP6TC4v8+4OU7oStC01esuNowdQ34L+Gk8e5Puoc88IqJ+XAY/B3Mn2ZKis8l8HX90oU8ivzUHg==}
dev: false
diff --git a/print/templates/reports/campaign-metrics/sql/client.sql b/print/templates/reports/campaign-metrics/sql/client.sql
index 9f392c97e..38f9fffc6 100644
--- a/print/templates/reports/campaign-metrics/sql/client.sql
+++ b/print/templates/reports/campaign-metrics/sql/client.sql
@@ -6,7 +6,7 @@ SELECT
c.id,
c.name AS clientName,
p.name AS province,
- co.country
+ co.name country
FROM client c
JOIN province p ON c.provinceFk = p.id
JOIN country co ON c.countryFk = co.id
diff --git a/print/templates/reports/claim-pickup-order/sql/client.sql b/print/templates/reports/claim-pickup-order/sql/client.sql
index 640b0c8a7..47e89cf1b 100644
--- a/print/templates/reports/claim-pickup-order/sql/client.sql
+++ b/print/templates/reports/claim-pickup-order/sql/client.sql
@@ -8,7 +8,7 @@ SELECT
a.street,
a.nickname,
p.name AS province,
- ct.country,
+ ct.name country,
IFNULL(c.phone, cc.phone) AS phone
FROM claim cl
JOIN client c ON c.id = cl.clientFk
diff --git a/print/templates/reports/client-debt-statement/sql/client.sql b/print/templates/reports/client-debt-statement/sql/client.sql
index d675cf168..acc616131 100644
--- a/print/templates/reports/client-debt-statement/sql/client.sql
+++ b/print/templates/reports/client-debt-statement/sql/client.sql
@@ -6,7 +6,7 @@ SELECT
c.city,
c.fi,
p.name AS province,
- ct.country
+ ct.name country
FROM client c
JOIN country ct ON ct.id = c.countryFk
LEFT JOIN province p ON p.id = c.provinceFk
diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql
index e9500cc4b..42231709a 100644
--- a/print/templates/reports/cmr/sql/data.sql
+++ b/print/templates/reports/cmr/sql/data.sql
@@ -14,12 +14,12 @@ SELECT c.id cmrFk,
s.street carrierStreet,
s.postCode carrierPostCode,
s.city carrierCity,
- cou.country carrierCountry,
+ cou.name carrierCountry,
s2.name senderName,
s2.street senderStreet,
s2.postCode senderPostCode,
s2.city senderCity,
- cou2.country senderCountry,
+ cou2.name senderCountry,
a.street deliveryStreet,
a.id deliveryAddressFk,
a.postalCode deliveryPostalCode,
@@ -27,12 +27,12 @@ SELECT c.id cmrFk,
a.nickname deliveryName,
a.phone deliveryPhone,
a.mobile deliveryMobile,
- cou3.country deliveryCountry,
+ cou3.name deliveryCountry,
cl.phone clientPhone,
a2.street loadStreet,
a2.postalCode loadPostalCode,
a2.city loadCity,
- cou4.country loadCountry,
+ cou4.name loadCountry,
co.stamp senderStamp,
s.stamp deliveryStamp
FROM cmr c
diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql
index f0a9baf1f..2ffa6d8db 100644
--- a/print/templates/reports/collection-label/sql/labelsData.sql
+++ b/print/templates/reports/collection-label/sql/labelsData.sql
@@ -3,7 +3,7 @@ SELECT c.itemPackingTypeFk code,
SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon,
tc.`level`,
t.id ticketFk,
- COALESCE(et.description, zo.name, am.name) agencyDescription,
+ COALESCE(rs.description, zo.name, am.name) agencyDescription,
cc.code color,
t.clientFk,
CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume,
@@ -35,7 +35,7 @@ SELECT c.itemPackingTypeFk code,
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
- LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
+ LEFT JOIN vn.roadmapStop rs ON rs.id = rm.expeditionTruckFk
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
JOIN vn.productionConfig pc
WHERE t.id IN (?)
diff --git a/print/templates/reports/expedition-pallet-label/sql/labelData.sql b/print/templates/reports/expedition-pallet-label/sql/labelData.sql
index b2a805251..385614305 100644
--- a/print/templates/reports/expedition-pallet-label/sql/labelData.sql
+++ b/print/templates/reports/expedition-pallet-label/sql/labelData.sql
@@ -1,19 +1,19 @@
SELECT ep.id palletFk,
t.routeFk,
- et2.description truck,
+ rs2.description truck,
r.description `zone`,
COUNT(es.id) labels,
t.warehouseFk warehouseFk,
dayname(r.created) `dayName`,
- et.id <=> rm.expeditionTruckFk isMatch
- FROM vn.expeditionTruck et
- JOIN vn.expeditionPallet ep ON ep.truckFk = et.id
+ rs.id <=> rm.expeditionTruckFk isMatch
+ FROM vn.roadmapStop rs
+ JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id
JOIN vn.expeditionScan es ON es.palletFk = ep.id
JOIN vn.expedition e ON e.id = es.expeditionFk
JOIN vn.ticket t ON t.id = e.ticketFk
JOIN vn.route r ON r.id = t.routeFk
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id
- LEFT JOIN vn.expeditionTruck et2 ON et2.id = rm.expeditionTruckFk
+ LEFT JOIN vn.roadmapStop rs2 ON rs2.id = rm.expeditionTruckFk
WHERE ep.id = ?
GROUP BY ep.id, t.routeFk
ORDER BY t.routeFk
diff --git a/print/templates/reports/incoterms-authorization/sql/client.sql b/print/templates/reports/incoterms-authorization/sql/client.sql
index bb17afd1d..9eff1379c 100644
--- a/print/templates/reports/incoterms-authorization/sql/client.sql
+++ b/print/templates/reports/incoterms-authorization/sql/client.sql
@@ -4,7 +4,7 @@ SELECT
c.name,
c.fi,
c.street,
- cty.country
+ cty.name country
FROM client c
JOIN country cty ON cty.id = c.countryFk
WHERE c.id = ?
\ No newline at end of file
diff --git a/print/templates/reports/letter-debtor/sql/client.sql b/print/templates/reports/letter-debtor/sql/client.sql
index d675cf168..87fffb8b7 100644
--- a/print/templates/reports/letter-debtor/sql/client.sql
+++ b/print/templates/reports/letter-debtor/sql/client.sql
@@ -6,7 +6,7 @@ SELECT
c.city,
c.fi,
p.name AS province,
- ct.country
+ ct.name country
FROM client c
JOIN country ct ON ct.id = c.countryFk
LEFT JOIN province p ON p.id = c.provinceFk
diff --git a/print/templates/reports/sepa-core/sql/client.sql b/print/templates/reports/sepa-core/sql/client.sql
index c22e7f114..b3ba180b3 100644
--- a/print/templates/reports/sepa-core/sql/client.sql
+++ b/print/templates/reports/sepa-core/sql/client.sql
@@ -7,7 +7,7 @@ SELECT
c.city,
c.fi,
p.name AS province,
- ct.country,
+ ct.name country,
ct.code AS countryCode,
ct.ibanLength AS ibanLength
FROM client c
diff --git a/print/templates/reports/sepa-core/sql/supplier.sql b/print/templates/reports/sepa-core/sql/supplier.sql
index 80635ecf5..156fc71c0 100644
--- a/print/templates/reports/sepa-core/sql/supplier.sql
+++ b/print/templates/reports/sepa-core/sql/supplier.sql
@@ -2,7 +2,7 @@ SELECT
m.code mandateCode,
s.name,
s.street,
- sc.country,
+ sc.name country,
s.postCode,
s.city,
sp.name province,
diff --git a/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql b/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql
index 0c2fa12ed..d446ba6e6 100644
--- a/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql
+++ b/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql
@@ -5,7 +5,7 @@ SELECT
s.id,
s.name AS supplierName,
p.name AS province,
- co.country
+ co.name country
FROM supplier s
JOIN province p ON s.provinceFk = p.id
JOIN country co ON s.countryFk = co.id