{{::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/invoiceIn/back/methods/invoice-in/invoiceInPdf.js b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js
index 681a19fc6..1e9da86a4 100644
--- a/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js
+++ b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js
@@ -29,7 +29,8 @@ module.exports = Self => {
http: {
path: '/:id/invoice-in-pdf',
verb: 'GET'
- }
+ },
+ accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.invoiceInPdf = (ctx, id) => Self.printReport(ctx, id, 'invoiceIn');
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 @@
{
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/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js
index 0e7c9fe20..c0b952b70 100644
--- a/modules/route/back/methods/route/getTickets.js
+++ b/modules/route/back/methods/route/getTickets.js
@@ -87,10 +87,6 @@ module.exports = Self => {
const where = filter.where;
where['r.id'] = filter.id;
- where.and = [{or: [
- {'t.packages': {gt: 0}},
- {and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]}
- ]}];
stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id'));
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/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/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/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..076f2eaab 100644
--- a/modules/worker/back/models/worker.js
+++ b/modules/worker/back/models/worker.js
@@ -21,10 +21,6 @@ module.exports = Self => {
require('../methods/worker/isAuthorized')(Self);
require('../methods/worker/setPassword')(Self);
- Self.validatesUniquenessOf('locker', {
- message: 'This locker has already been assigned'
- });
-
Self.validateAsync('fi', tinIsValid, {
message: 'Invalid TIN'
});
diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json
index 1f2b6be27..adfe2c58e 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"
},
@@ -60,6 +57,9 @@
"isF11Allowed": {
"type" : "boolean"
},
+ "sex": {
+ "type" : "string"
+ },
"isFreelance": {
"type" : "boolean"
}
@@ -94,6 +94,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/package.json b/package.json
index b4c70cf5b..906b86dff 100644
--- a/package.json
+++ b/package.json
@@ -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",
@@ -113,7 +114,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 d3959ac03..c4425d3dc 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
@@ -10202,6 +10205,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