From 1af698acc37a0ac6bbe393c4be5236f9eb3686a6 Mon Sep 17 00:00:00 2001 From: gerard Date: Thu, 10 May 2018 13:36:26 +0200 Subject: [PATCH 1/2] Bug #290 Componentes de ticket muestra todos los componentes existentes. --- client/ticket/src/component/component.html | 2 +- client/ticket/src/component/component.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/ticket/src/component/component.html b/client/ticket/src/component/component.html index 679d42332..06bbfd932 100644 --- a/client/ticket/src/component/component.html +++ b/client/ticket/src/component/component.html @@ -1,4 +1,4 @@ - + diff --git a/client/ticket/src/component/component.js b/client/ticket/src/component/component.js index 7772ac694..92e20852e 100644 --- a/client/ticket/src/component/component.js +++ b/client/ticket/src/component/component.js @@ -1,7 +1,14 @@ import ngModule from '../module'; import './style.scss'; +import FilterTicketList from '../filter-ticket-list'; + +class Controller extends FilterTicketList { + constructor($scope, $timeout, $stateParams) { + super($scope, $timeout, $stateParams); + this.$scope = $scope; + this.onOrder('itemFk', 'ASC'); + } -class Controller { total() { let sum; if (this.sales) { @@ -36,6 +43,8 @@ class Controller { } } +Controller.$inject = ['$scope', '$timeout', '$state']; + ngModule.component('vnTicketComponents', { template: require('./component.html'), controller: Controller, From 4ebca3f3cbbd019420b7e5320440c6cc7742bd2c Mon Sep 17 00:00:00 2001 From: gerard Date: Thu, 10 May 2018 13:39:11 +0200 Subject: [PATCH 2/2] =?UTF-8?q?peque=C3=B1o=20refactor=20CR=20JOAN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/loopback/common/models/state.js | 2 +- services/ticket/common/models/ticket-tracking.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/loopback/common/models/state.js b/services/loopback/common/models/state.js index 400cf1dda..06e1ac92d 100644 --- a/services/loopback/common/models/state.js +++ b/services/loopback/common/models/state.js @@ -7,7 +7,7 @@ module.exports = Self => { * @param {Integer} stateId The user id * @return {Boolean} %true if user has the role, %false otherwise */ - Self.isAlertLevel0 = async function(stateId) { + Self.isAlertLevelZero = async function(stateId) { let result = await Self.rawSql( `SELECT alertLevel FROM vn.state diff --git a/services/ticket/common/models/ticket-tracking.js b/services/ticket/common/models/ticket-tracking.js index 7f9e9c94b..464436daa 100644 --- a/services/ticket/common/models/ticket-tracking.js +++ b/services/ticket/common/models/ticket-tracking.js @@ -10,10 +10,10 @@ module.exports = function(Self) { let isEmployee = await models.Account.hasRole(userId, 'employee'); let isProduction = await models.Account.hasRole(userId, 'production'); - let isAlertLevel0 = await models.State.isAlertLevel0(ctx.instance.stateFk); + let isAlertLevelZero = await models.State.isAlertLevelZero(ctx.instance.stateFk); let ticketAlertLevel = await models.TicketState.findOne({where: {id: ctx.instance.ticketFk}, fields: ["alertLevel"]}); - if ((!isProduction && !isAlertLevel0) || !isEmployee || (isEmployee && ticketAlertLevel != 0 && !isProduction)) + if ((!isProduction && !isAlertLevelZero) || !isEmployee || (isEmployee && ticketAlertLevel != 0 && !isProduction)) throw new Error("You don't have enough privileges to do that"); let user = await models.Worker.findOne({where: {userFk: userId}});