From 9a18d0bd8cffbe3e6a24461471a6f22f0383cb23 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 14 Jun 2019 08:15:14 +0200 Subject: [PATCH 1/2] fixed worker calendar --- modules/worker/back/methods/worker-calendar/absences.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/worker/back/methods/worker-calendar/absences.js b/modules/worker/back/methods/worker-calendar/absences.js index 7c1a74084..db7318024 100644 --- a/modules/worker/back/methods/worker-calendar/absences.js +++ b/modules/worker/back/methods/worker-calendar/absences.js @@ -1,4 +1,5 @@ const UserError = require('vn-loopback/util/user-error'); +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { Self.remoteMethodCtx('absences', { From da01d52756a05393f9ef8c1f5442c210ee96d728 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 17 Jun 2019 11:14:45 +0200 Subject: [PATCH 2/2] Secret removed from worker/pbx --- back/models/sip.js | 4 ---- back/models/sip.json | 3 --- e2e/helpers/selectors.js | 3 +-- e2e/paths/03-worker-module/01_pbx.spec.js | 4 +--- loopback/locale/es.json | 8 ++++---- .../invoiceOut/back/methods/invoiceOut/download.js | 2 +- modules/worker/front/locale/es.yml | 3 ++- modules/worker/front/pbx/index.html | 7 +------ modules/worker/front/pbx/index.js | 11 ++++++----- 9 files changed, 16 insertions(+), 29 deletions(-) diff --git a/back/models/sip.js b/back/models/sip.js index 62ae1eff9..86e06c9b6 100644 --- a/back/models/sip.js +++ b/back/models/sip.js @@ -4,8 +4,4 @@ module.exports = Self => { Self.validatesUniquenessOf('extension', { message: `The extension must be unique` }); - - Self.validatesPresenceOf('secret', { - message: `The secret can't be blank` - }); }; diff --git a/back/models/sip.json b/back/models/sip.json index 0864408e3..b64000be6 100644 --- a/back/models/sip.json +++ b/back/models/sip.json @@ -17,9 +17,6 @@ }, "extension": { "type": "Number" - }, - "secret": { - "type": "String" } }, "relations": { diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0c4bf2f41..224c44b73 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -552,8 +552,7 @@ export default { confirmButton: 'vn-order-line > vn-confirm button[response="ACCEPT"]', }, workerPbx: { - extensionInput: 'vn-worker-pbx vn-input-number[model="$ctrl.worker.sip.extension"] input', - passwordInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.secret"] input', + extensionInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.extension"] input', saveButton: 'vn-worker-pbx vn-submit[label="Save"] input' }, routeIndex: { diff --git a/e2e/paths/03-worker-module/01_pbx.spec.js b/e2e/paths/03-worker-module/01_pbx.spec.js index 4a3bc2c7e..8d9a531c3 100644 --- a/e2e/paths/03-worker-module/01_pbx.spec.js +++ b/e2e/paths/03-worker-module/01_pbx.spec.js @@ -25,11 +25,9 @@ describe('Worker pbx path', () => { const result = await nightmare .clearInput(selectors.workerPbx.extensionInput) .write(selectors.workerPbx.extensionInput, 4444) - .clearInput(selectors.workerPbx.passwordInput) - .write(selectors.workerPbx.passwordInput, 666666) .waitToClick(selectors.workerPbx.saveButton) .waitForLastSnackbar(); - expect(result).toEqual('Data saved!'); + expect(result).toEqual('Data saved! User must access web'); }); }); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 085561a4b..2f92c298f 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,5 +1,5 @@ { - "PHONE_INVALID_FORMAT": "El formato del teléfono no es correcto", + "Phone format is invalid": "El formato del teléfono no es correcto", "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", @@ -75,13 +75,13 @@ "You cannot remove this department": "No puedes eliminar este departamento", "The extension must be unique": "La extensión debe ser unica", "The secret can't be blank": "La contraseña no puede estar en blanco", - "EXTENSION_INVALID_FORMAT": "La extensión es invalida", "We weren't able to send this SMS": "No hemos podido enviar el SMS", "This client can't be invoiced": "Este cliente no puede ser facturado", "This ticket can't be invoiced": "Este ticket no puede ser facturado", "That item is not available on that day": "El item no esta disponible para esa fecha", - "That item doesn't exists": "That item doesn't exists", + "That item doesn't exists": "El artículo no existe", "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", "This ticket can not be modified": "Este ticket no puede ser modificado", - "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada" + "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", + "Extension format is invalid": "El formato de la extensión es inválido" } \ No newline at end of file diff --git a/modules/invoiceOut/back/methods/invoiceOut/download.js b/modules/invoiceOut/back/methods/invoiceOut/download.js index 1ffd10b0e..3c9924fc3 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/download.js +++ b/modules/invoiceOut/back/methods/invoiceOut/download.js @@ -36,7 +36,7 @@ module.exports = Self => { Self.download = async function(id) { let file; let env = process.env.NODE_ENV; - let [invoice] = await Self.rawSql(`SELECT hedera.invoiceGetPath(?) path`, [id]); + let [invoice] = await Self.rawSql(`SELECT invoiceOut_getPath(?) path`, [id]); if (env && env != 'development') { file = { diff --git a/modules/worker/front/locale/es.yml b/modules/worker/front/locale/es.yml index d13c1d831..e827b018d 100644 --- a/modules/worker/front/locale/es.yml +++ b/modules/worker/front/locale/es.yml @@ -15,4 +15,5 @@ Fiscal Identifier: NIF User name: Usuario Departments: Departamentos Calendar: Calendario -Search workers by id, firstName, lastName or user name: Buscar trabajadores por el identificador, nombre, apellidos o nombre de usuario \ No newline at end of file +Search workers by id, firstName, lastName or user name: Buscar trabajadores por el identificador, nombre, apellidos o nombre de usuario +Data saved! User must access web: ¡Datos guardados! El usuario deberá acceder con su contraseña a la web para que los cambios surtan efecto. \ No newline at end of file diff --git a/modules/worker/front/pbx/index.html b/modules/worker/front/pbx/index.html index 931cf70fc..32eedd377 100644 --- a/modules/worker/front/pbx/index.html +++ b/modules/worker/front/pbx/index.html @@ -6,14 +6,9 @@ - - - diff --git a/modules/worker/front/pbx/index.js b/modules/worker/front/pbx/index.js index 9e0cef8ec..28b4b24d0 100644 --- a/modules/worker/front/pbx/index.js +++ b/modules/worker/front/pbx/index.js @@ -1,27 +1,28 @@ import ngModule from '../module'; class Controller { - constructor($scope, $http) { + constructor($scope, $http, vnApp, $translate) { this.$scope = $scope; this.$http = $http; + this.vnApp = vnApp; + this._ = $translate; } onSubmit() { const sip = this.worker.sip; const params = { userFk: this.worker.userFk, - extension: sip.extension, - secret: sip.secret + extension: sip.extension }; this.$scope.watcher.check(); this.$http.patch('/api/Sips', params).then(() => { this.$scope.watcher.updateOriginalData(); - this.$scope.watcher.notifySaved(); + this.vnApp.showSuccess(this._.instant('Data saved! User must access web')); }); } } -Controller.$inject = ['$scope', '$http']; +Controller.$inject = ['$scope', '$http', 'vnApp', '$translate']; ngModule.component('vnWorkerPbx', { template: require('./index.html'),