diff --git a/Dockerfile b/Dockerfile index c7565db0c..79831cf06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ COPY package.json package-lock.json ./ COPY loopback/package.json loopback/ COPY print/package.json print/ RUN npm install --only=prod +RUN npm --prefix ./print install --only=prod ./print COPY loopback loopback COPY back back diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 1f04c4339..bd850ef3f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -466,7 +466,7 @@ export default { secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimResponsibleFk"]', secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.workerFk"]', secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]', - saveDevelopmentButton: `${components.vnSubmit}`, + saveDevelopmentButton: `${components.vnSubmit}` }, claimAction: { importClaimButton: 'vn-claim-action vn-button[label="Import claim"]', diff --git a/front/Dockerfile b/front/Dockerfile index d6fe5d4f8..098ee161e 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -1,5 +1,6 @@ FROM debian:stretch-slim EXPOSE 80 +ENV TZ Europe/Madrid ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update \ diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js index fbc3932cf..cc90846f7 100644 --- a/front/core/components/calendar/index.js +++ b/front/core/components/calendar/index.js @@ -71,8 +71,6 @@ export default class Calendar extends Component { date.getFullYear(), date.getMonth(), 1); - this.applyOffset(newDate); - return newDate; } @@ -87,15 +85,9 @@ export default class Calendar extends Component { date.getFullYear(), date.getMonth() + 1, 0); - this.applyOffset(newDate); - return newDate; } - applyOffset(date) { - date.setTime(date.getTime() - date.getTimezoneOffset() * 60000); - } - repaint() { const firstWeekday = this.firstDay(this.currentMonth).getDay(); const previousLastDay = this.lastDay(this.previousMonth).getDate(); @@ -127,14 +119,10 @@ export default class Calendar extends Component { const curDate = new Date(); curDate.setHours(0, 0, 0, 0); - this.applyOffset(curDate); - const newDate = new Date( date.getFullYear(), date.getMonth(), day); - this.applyOffset(newDate); - let event = this.events.find(event => { return event.date >= newDate && event.date <= newDate; }); diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js index 3df0878c9..03418307b 100644 --- a/loopback/server/connectors/vn-mysql.js +++ b/loopback/server/connectors/vn-mysql.js @@ -1,4 +1,3 @@ - const mysql = require('mysql'); const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const MySQL = require('loopback-connector-mysql').MySQL; @@ -24,6 +23,23 @@ class VnMySQL extends MySQL { } } + fromColumnValue(prop, val) { + if (val == null || !prop || prop.type !== Date) + return MySQL.prototype.fromColumnValue.call(this, prop, val); + + let date = new Date(val); + let locale = new Date(val); + let offset = locale.getTimezoneOffset() * 60000; + date.setTime(date.getTime() + offset); + + return date; + } + + isIsoDate(dateString) { + let isoRegexp = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)?$/g; + return isoRegexp.test(dateString); + } + /** * Promisified version of execute(). * @@ -34,6 +50,18 @@ class VnMySQL extends MySQL { * @return {Promise} The operation promise */ executeP(query, params, options = {}, cb) { + if (params) { + for (let param of params) { + if (param && typeof param.getMonth === 'function' || this.isIsoDate(param)) { + if (this.isIsoDate(param)) param = new Date(param); + let locale = new Date(param); + let offset = locale.getTimezoneOffset() * 60000; + param.setTime(param.getTime() - offset); + console.log(param); + } + } + } + return new Promise((resolve, reject) => { this.execute(query, params, options, (error, response) => { if (cb) diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 3b1cc6d22..38bcde738 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -22,6 +22,8 @@ Id + Grouping + packing Description Stems Type @@ -53,6 +55,8 @@ {{::item.id | zeroFill:6}} + {{::item.grouping | dashIfEmpty}} + {{::item.packing | dashIfEmpty}}