From 2b03f656c83be7ba93fdffcee5b18bcb463eb34a Mon Sep 17 00:00:00 2001 From: Juan Date: Tue, 3 Jul 2018 13:24:42 +0200 Subject: [PATCH 1/8] Popover overflow bugs fixed --- client/core/src/components/drop-down/style.scss | 1 + client/core/src/components/popover/style.scss | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/core/src/components/drop-down/style.scss b/client/core/src/components/drop-down/style.scss index c668af096f..28fbaa4894 100755 --- a/client/core/src/components/drop-down/style.scss +++ b/client/core/src/components/drop-down/style.scss @@ -5,6 +5,7 @@ vn-drop-down { .dropdown { display: flex; flex-direction: column; + height: inherit; & > .filter { position: relative; diff --git a/client/core/src/components/popover/style.scss b/client/core/src/components/popover/style.scss index 458a47df91..b445544396 100644 --- a/client/core/src/components/popover/style.scss +++ b/client/core/src/components/popover/style.scss @@ -19,25 +19,24 @@ } & > .popover { position: absolute; - display: flex; box-shadow: 0 .1em .4em rgba(1, 1, 1, .4); + z-index: 0; & > .arrow { - width: 1em; + width: 1em; height: 1em; margin: -.5em; background-color: white; box-shadow: 0 .1em .4em rgba(1, 1, 1, .4); position: absolute; transform: rotate(45deg); - z-index: 0; + z-index: -1; } & > .content { - width: 100%; border-radius: .1em; - overflow: auto; background-color: white; - z-index: 1; + height: inherit; + overflow: auto; } } } \ No newline at end of file From cfce6188448a51c3bd4762a886e16c0df0e02c29 Mon Sep 17 00:00:00 2001 From: Juan Date: Tue, 3 Jul 2018 13:36:35 +0200 Subject: [PATCH 2/8] Popover horizontal alignment fixes --- client/core/src/components/popover/popover.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/core/src/components/popover/popover.js b/client/core/src/components/popover/popover.js index bfdaaaed66..197f7773a3 100644 --- a/client/core/src/components/popover/popover.js +++ b/client/core/src/components/popover/popover.js @@ -136,10 +136,10 @@ export default class Popover extends Component { let arrowHeight = Math.sqrt(Math.pow(arrowRect.height, 2) * 2) / 2; - let top = parentRect.top + parentRect.height + arrowHeight; - let left = parentRect.left; let height = popoverRect.height; let width = Math.max(popoverRect.width, parentRect.width); + let top = parentRect.top + parentRect.height + arrowHeight; + let left = parentRect.left + parentRect.width / 2 - width / 2; let margin = 10; let showTop = top + height + margin > window.innerHeight; From 98001b364eaab8782d0847f97ff1321b5b294773 Mon Sep 17 00:00:00 2001 From: Juan Date: Tue, 3 Jul 2018 13:45:25 +0200 Subject: [PATCH 3/8] vnAutoPaging renamed to vnPagination plus bugs fixed --- client/client/src/credit/index/index.html | 1 - client/client/src/greuge/index/index.html | 1 - client/client/src/invoice/index.html | 1 - client/client/src/mandate/index.html | 1 - client/client/src/recovery/index/index.html | 1 - .../components/auto-paging/auto-paging.html | 7 - .../src/components/auto-paging/auto-paging.js | 123 ------------------ .../auto-paging/auto-paging.spec.js | 61 --------- client/core/src/components/index.js | 1 - .../src/components/pagination/pagination.js | 2 +- client/item/src/diary/index.html | 1 - client/item/src/history/index.html | 1 - client/item/src/last-entries/index.html | 1 - client/ticket/src/component/index.html | 1 - client/ticket/src/expedition/index.html | 3 +- client/ticket/src/sale-checked/index.html | 3 +- client/ticket/src/tracking/index/index.html | 3 +- client/ticket/src/volume/index.html | 3 +- services/loopback/common/locale/en.json | 3 +- 19 files changed, 7 insertions(+), 211 deletions(-) delete mode 100644 client/core/src/components/auto-paging/auto-paging.html delete mode 100644 client/core/src/components/auto-paging/auto-paging.js delete mode 100644 client/core/src/components/auto-paging/auto-paging.spec.js diff --git a/client/client/src/credit/index/index.html b/client/client/src/credit/index/index.html index 4e1b0e03ff..06e87036ea 100644 --- a/client/client/src/credit/index/index.html +++ b/client/client/src/credit/index/index.html @@ -23,7 +23,6 @@ - diff --git a/client/client/src/greuge/index/index.html b/client/client/src/greuge/index/index.html index eafd04ef85..7a9f7dc2ea 100644 --- a/client/client/src/greuge/index/index.html +++ b/client/client/src/greuge/index/index.html @@ -31,7 +31,6 @@ - diff --git a/client/client/src/invoice/index.html b/client/client/src/invoice/index.html index 5650a193ae..5930e6ce8d 100644 --- a/client/client/src/invoice/index.html +++ b/client/client/src/invoice/index.html @@ -31,5 +31,4 @@ - \ No newline at end of file diff --git a/client/client/src/mandate/index.html b/client/client/src/mandate/index.html index 429d8eb93f..2feadb886f 100644 --- a/client/client/src/mandate/index.html +++ b/client/client/src/mandate/index.html @@ -27,5 +27,4 @@ - \ No newline at end of file diff --git a/client/client/src/recovery/index/index.html b/client/client/src/recovery/index/index.html index 985fd42a2b..cabbf4ce9a 100644 --- a/client/client/src/recovery/index/index.html +++ b/client/client/src/recovery/index/index.html @@ -31,7 +31,6 @@ - diff --git a/client/core/src/components/auto-paging/auto-paging.html b/client/core/src/components/auto-paging/auto-paging.html deleted file mode 100644 index eee5ec1f44..0000000000 --- a/client/core/src/components/auto-paging/auto-paging.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/client/core/src/components/auto-paging/auto-paging.js b/client/core/src/components/auto-paging/auto-paging.js deleted file mode 100644 index 3278e68691..0000000000 --- a/client/core/src/components/auto-paging/auto-paging.js +++ /dev/null @@ -1,123 +0,0 @@ -import ngModule from '../../module'; -import getWatchers from '../../lib/get-watchers'; - -class AutoPaging { - constructor($http, $window, $element, $timeout, vnApp, $translate, $scope) { - this.$http = $http; - this.$window = $window; - this.$element = $element; - this.$timeout = $timeout; - this.vnApp = vnApp; - this.$translate = $translate; - this.$scope = $scope; - - this.numPerPage = null; - this.maxItems = 0; - this.watchScroll = false; - this.waitingNewPage = false; - - this.handlerScroll = this.onScroll.bind(this); - } - - get numPages() { - return this.numPerPage ? Math.ceil(this.maxItems / this.numPerPage) : 0; - } - - loadNewPage() { - this.index.filter.page++; - this.waitingNewPage = true; - - this.index.accept().then(res => { - this.$timeout(() => { - res.instances.forEach(item => { - this.items.push(item); - }); - this.$scope.$apply(); - this.checkWatchers(); - }); - if (this.index.filter.page == this.numPages) { - this.cancelScroll(); - } - this.waitingNewPage = false; - }); - } - - checkPosition() { - let element = this.$element[0].querySelector('vn-spinner'); - let position = element.getBoundingClientRect(); - let isVisible = position.y < document.body.offsetHeight + 150; - if (this.currentPage < this.numPages && isVisible && !this.waitingNewPage) { - this.loadNewPage(); - } - } - - onScroll() { - this.checkPosition(); - } - - startScroll() { - this.watchScroll = true; - this.checkPosition(); - let mainView = this.$window.document.querySelector('.main-view > ui-view.ng-scope'); - angular.element(mainView).bind("scroll", this.handlerScroll); - } - - cancelScroll() { - this.watchScroll = false; - let mainView = this.$window.document.querySelector('.main-view > ui-view.ng-scope'); - angular.element(mainView).unbind("scroll", this.handlerScroll); - } - - checkScroll() { - if (this.numPages > this.currentPage && !this.watchScroll) { - this.startScroll(); - } else if (this.numPages <= this.currentPage && this.watchScroll) { - this.cancelScroll(); - } - } - - checkWatchers() { - let watchers = getWatchers(); - if (watchers > 3000 && this.watchScroll) { - this.cancelScroll(); - this.vnApp.showMessage( - this.$translate.instant('Auto-scroll interrupted, please adjust the search') - ); - } - } - - $onChanges(changes) { - if (!this.index) return; - - this.numPerPage = this.index.filter.size; - this.currentPage = this.index.filter.page; - this.currentInstances = this.items; - if (changes.total) - this.maxItems = changes.total.currentValue; - - this.checkScroll(); - } - - $postLink() { - this.checkScroll(); - } - - $doCheck() { - if (this.index && this.index.filter && this.index.filter.page && this.index.filter.page != this.currentPage) { - this.currentPage = this.index.filter.page; - this.checkScroll(); - } - } -} - -AutoPaging.$inject = ['$http', '$window', '$element', '$timeout', 'vnApp', '$translate', '$scope']; - -ngModule.component('vnAutoPaging', { - template: require('./auto-paging.html'), - bindings: { - index: '<', - total: '<', - items: '<' - }, - controller: AutoPaging -}); diff --git a/client/core/src/components/auto-paging/auto-paging.spec.js b/client/core/src/components/auto-paging/auto-paging.spec.js deleted file mode 100644 index e5070ffbb8..0000000000 --- a/client/core/src/components/auto-paging/auto-paging.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -import './auto-paging.js'; -import template from './auto-paging.html'; - -describe('Component vnAutoPaging', () => { - let $http; - let $window; - let $element; - let $timeout; - let controller; - - beforeEach(() => { - angular.mock.module('client'); - }); - - beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_, _$window_, _$timeout_) => { - $http = _$httpBackend_; - $window = _$window_; - $timeout = _$timeout_; - $element = angular.element(`
${template}
`); - - controller = _$componentController_('vnAutoPaging', {$http, $window, $element, $timeout}); - })); - - describe('onChanges: actions when index object changes', () => { - beforeEach(() => { - controller.index = { - filter: { - size: 5, - page: 1 - } - }; - controller.items = [1, 2, 3, 4, 5]; - }); - - it('call startScroll() if there are pages to load', () => { - let changes = { - total: { - currentValue: 20 - } - }; - spyOn(controller, 'startScroll'); - - controller.$onChanges(changes); - - expect(controller.startScroll).toHaveBeenCalled(); - }); - - it('call stopScroll() if there are not pages to load', () => { - let changes = { - total: { - currentValue: 5 - } - }; - controller.watchScroll = true; - spyOn(controller, 'cancelScroll'); - controller.$onChanges(changes); - - expect(controller.cancelScroll).toHaveBeenCalled(); - }); - }); -}); diff --git a/client/core/src/components/index.js b/client/core/src/components/index.js index 9bb7247731..b1e5ed252d 100644 --- a/client/core/src/components/index.js +++ b/client/core/src/components/index.js @@ -34,7 +34,6 @@ import './float-button/float-button'; import './step-control/step-control'; import './label-value/label-value'; import './paging/paging'; -import './auto-paging/auto-paging'; import './pagination/pagination'; import './searchbar/searchbar'; import './table'; diff --git a/client/core/src/components/pagination/pagination.js b/client/core/src/components/pagination/pagination.js index 604e37b01a..68c1b3d710 100644 --- a/client/core/src/components/pagination/pagination.js +++ b/client/core/src/components/pagination/pagination.js @@ -14,7 +14,7 @@ import './style.scss'; class Pagination extends Component { constructor($element, $scope) { super($element, $scope); - this.scrollOffset = 20; + this.scrollOffset = 150; this.scrollHandler = e => this.onScroll(e); } diff --git a/client/item/src/diary/index.html b/client/item/src/diary/index.html index 321082d403..3cb1a22da8 100644 --- a/client/item/src/diary/index.html +++ b/client/item/src/diary/index.html @@ -45,5 +45,4 @@ - diff --git a/client/item/src/history/index.html b/client/item/src/history/index.html index f6bdc9ae26..fe975966de 100644 --- a/client/item/src/history/index.html +++ b/client/item/src/history/index.html @@ -25,5 +25,4 @@ - diff --git a/client/item/src/last-entries/index.html b/client/item/src/last-entries/index.html index 1a2735a322..cabf821b33 100644 --- a/client/item/src/last-entries/index.html +++ b/client/item/src/last-entries/index.html @@ -64,5 +64,4 @@ - diff --git a/client/ticket/src/component/index.html b/client/ticket/src/component/index.html index 11d600bb7f..67af10bd97 100644 --- a/client/ticket/src/component/index.html +++ b/client/ticket/src/component/index.html @@ -67,7 +67,6 @@ - diff --git a/client/ticket/src/expedition/index.html b/client/ticket/src/expedition/index.html index 8da3bbfb53..a7908559aa 100644 --- a/client/ticket/src/expedition/index.html +++ b/client/ticket/src/expedition/index.html @@ -40,6 +40,5 @@ - - + diff --git a/client/ticket/src/sale-checked/index.html b/client/ticket/src/sale-checked/index.html index 00de7cec23..6d68a0d7dd 100644 --- a/client/ticket/src/sale-checked/index.html +++ b/client/ticket/src/sale-checked/index.html @@ -33,6 +33,5 @@ - - + diff --git a/client/ticket/src/tracking/index/index.html b/client/ticket/src/tracking/index/index.html index 0f7f4af2e8..4372c4ade8 100644 --- a/client/ticket/src/tracking/index/index.html +++ b/client/ticket/src/tracking/index/index.html @@ -23,8 +23,7 @@ - - +
\ No newline at end of file diff --git a/client/ticket/src/volume/index.html b/client/ticket/src/volume/index.html index 9bab229d60..011cd41aa8 100644 --- a/client/ticket/src/volume/index.html +++ b/client/ticket/src/volume/index.html @@ -37,7 +37,6 @@ - - + diff --git a/services/loopback/common/locale/en.json b/services/loopback/common/locale/en.json index be28c88109..99a93c53a0 100644 --- a/services/loopback/common/locale/en.json +++ b/services/loopback/common/locale/en.json @@ -22,5 +22,6 @@ "Name cannot be blank": "Name cannot be blank", "Phone cannot be blank": "Phone cannot be blank", "ValidationError: La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).": "ValidationError: La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).", - "La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).": "La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null)." + "La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).": "La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).", + "Observation type cannot be blank": "Observation type cannot be blank" } \ No newline at end of file From 3208cc78516a1ea21ec830aecb4e5d029aee27ba Mon Sep 17 00:00:00 2001 From: Juan Date: Tue, 3 Jul 2018 14:33:31 +0200 Subject: [PATCH 4/8] vnTextfield style fixes --- .../components/autocomplete/autocomplete.html | 5 -- .../core/src/components/textfield/style.scss | 69 +++++++++++-------- .../src/components/textfield/textfield.html | 37 ++++------ 3 files changed, 54 insertions(+), 57 deletions(-) diff --git a/client/core/src/components/autocomplete/autocomplete.html b/client/core/src/components/autocomplete/autocomplete.html index 22085f1a65..7e6580d781 100755 --- a/client/core/src/components/autocomplete/autocomplete.html +++ b/client/core/src/components/autocomplete/autocomplete.html @@ -17,11 +17,6 @@ - - clear - .container { width: 100%; position: relative; padding-bottom: 2px; + display: flex; + + & > .textField { + width: 100%; + display: flex; + align-items: center; + position: relative; + padding-top: 4px; + } } - .textField{ - width: 100%; - display: inline-flex; - position: relative; - padding: 4px 0; + .leftIcons, .rightIcons, .suffix { + display: flex; + color: $secondary-font-color; + + & .material-icons { + font-size: 20px !important + } } .infix { position: relative; @@ -31,8 +32,16 @@ vn-textfield { width: 100%; min-width: 0; } - i.pointer { + i.clear { visibility: hidden; + cursor: pointer; + + &:hover { + color: #222; + } + } + &:hover i.clear { + visibility: visible; } i.visible { visibility: visible; @@ -48,12 +57,14 @@ vn-textfield { input { outline: none; border: none; - font-family: "Helvetica","Arial",sans-serif; + font-family: "Helvetica", "Arial", sans-serif; display: block; font-size: 16px; width: 100%; background: 0 0; color: inherit; + padding: 4px; + box-sizing: border-box; &[type=number] { -moz-appearance: textfield; @@ -64,10 +75,10 @@ vn-textfield { } } &:invalid { - box-shadow:none; + box-shadow: none; } } - .underline{ + .underline { position: absolute; bottom: 0; height: 1px; @@ -76,11 +87,11 @@ vn-textfield { width: 100%; background-color: rgba(0,0,0,.12); } - .selected.underline{ + .selected.underline { background-color: rgb(255,152,0); height: 2px; left: 50%; - width: 0px!important; + width: 0px !important; transition-duration: 0.2s; transition-timing-function: cubic-bezier(.4,0,.2,1); } @@ -91,7 +102,7 @@ vn-textfield { font-size: 12px; } } - div.selected{ + div.selected { &.container{ border-bottom: 0px; } @@ -105,20 +116,18 @@ vn-textfield { width: 100%!important; } } - & > div.container > div.textField > div.infix.invalid{ + & > div.container > div.textField > div.infix.invalid { @extend div.selected; - & > span.mdl-textfield__error{ + & > span.mdl-textfield__error { visibility: visible; margin-top: 9px; } - & > label{ + & > label { color: #d50000; } } .infix.invalid + .underline { - &{ - background-color: #d50000; - } + background-color: #d50000; } } \ No newline at end of file diff --git a/client/core/src/components/textfield/textfield.html b/client/core/src/components/textfield/textfield.html index edd341b9c9..31d9d94094 100644 --- a/client/core/src/components/textfield/textfield.html +++ b/client/core/src/components/textfield/textfield.html @@ -1,36 +1,29 @@
+ ng-class="{selected: $ctrl.hasFocus}">
-
-
- +
- - +
- clear From b49bd3d9039e8e424b14f3d4fec1992f61356aeb Mon Sep 17 00:00:00 2001 From: Juan Date: Tue, 3 Jul 2018 17:41:41 +0200 Subject: [PATCH 5/8] Filters optimized for numeric values --- client/client/src/index/index.js | 9 +++------ client/item/src/index/index.js | 9 +++------ client/ticket/src/index/index.js | 9 +++------ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/client/client/src/index/index.js b/client/client/src/index/index.js index 175ddb7d27..2bcf770844 100644 --- a/client/client/src/index/index.js +++ b/client/client/src/index/index.js @@ -10,12 +10,9 @@ export default class Controller { exprBuilder(param, value) { switch (param) { case 'search': - return { - or: [ - {id: value}, - {name: {regexp: value}} - ] - }; + return /^\d+$/.test(value) + ? {id: value} + : {name: {regexp: value}}; case 'phone': return { or: [ diff --git a/client/item/src/index/index.js b/client/item/src/index/index.js index d772e810cb..0d8c44717f 100644 --- a/client/item/src/index/index.js +++ b/client/item/src/index/index.js @@ -28,12 +28,9 @@ class Controller { exprBuilder(param, value) { switch (param) { case 'search': - return { - or: [ - {id: value}, - {name: {regexp: value}} - ] - }; + return /^\d+$/.test(value) + ? {id: value} + : {name: {regexp: value}}; case 'name': case 'description': return {[param]: {regexp: value}}; diff --git a/client/ticket/src/index/index.js b/client/ticket/src/index/index.js index 813165403a..c9792cc9e3 100644 --- a/client/ticket/src/index/index.js +++ b/client/ticket/src/index/index.js @@ -59,12 +59,9 @@ export default class Controller { exprBuilder(param, value) { switch (param) { case 'search': - return { - or: [ - {id: value}, - {nickname: {regexp: value}} - ] - }; + return /^\d+$/.test(value) + ? {id: value} + : {nickname: {regexp: value}}; case 'from': return {shipped: {gte: value}}; case 'to': From dd1e1123bf489ca5982e6cb87094bc0437a78b94 Mon Sep 17 00:00:00 2001 From: Joan Date: Wed, 4 Jul 2018 11:28:29 +0200 Subject: [PATCH 6/8] Worker translation --- client/item/src/locale/es.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/item/src/locale/es.yml b/client/item/src/locale/es.yml index 89cffcc67e..75e27ff1f2 100644 --- a/client/item/src/locale/es.yml +++ b/client/item/src/locale/es.yml @@ -50,4 +50,5 @@ Add barcode: Añadir código de barras Remove barcode: Quitar código de barras Buyer: Comprador No results: Sin resultados -Tag: Etiqueta \ No newline at end of file +Tag: Etiqueta +Worker: Trabajador \ No newline at end of file From cdd477a8e5196e78e3fd4e3527d1d7bc1a68caff Mon Sep 17 00:00:00 2001 From: Joan Date: Wed, 4 Jul 2018 13:33:40 +0200 Subject: [PATCH 7/8] Recovery recovery on "grade" field #368 --- services/client/common/models/recovery.js | 2 ++ services/loopback/common/locale/es.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/services/client/common/models/recovery.js b/services/client/common/models/recovery.js index 1386b37549..c456cb9a4a 100644 --- a/services/client/common/models/recovery.js +++ b/services/client/common/models/recovery.js @@ -1,4 +1,6 @@ module.exports = function(Self) { require('../methods/recovery/filter')(Self); require('../methods/recovery/hasActiveRecovery')(Self); + + Self.validatesPresenceOf('period', {message: 'Period cannot be blank'}); }; diff --git a/services/loopback/common/locale/es.json b/services/loopback/common/locale/es.json index d267a3464a..e2f5766206 100644 --- a/services/loopback/common/locale/es.json +++ b/services/loopback/common/locale/es.json @@ -26,5 +26,6 @@ "NO_AGENCY_AVAILABLE": "NO_AGENCY_AVAILABLE", "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", "Name cannot be blank": "El nombre no puede estar en blanco", - "Phone cannot be blank": "El teléfono no puede estar en blanco" + "Phone cannot be blank": "El teléfono no puede estar en blanco", + "Period cannot be blank": "El periodo no puede estar en blanco" } \ No newline at end of file From c9ec2e53a8b7ecc9f1f9af6455d1996bfe327a12 Mon Sep 17 00:00:00 2001 From: Bernat Date: Wed, 4 Jul 2018 13:35:45 +0200 Subject: [PATCH 8/8] update structure DB --- services/db/install/changes/1.0.8/acl.sql | 2 -- .../1.0.8/ticketGetVisibleAvailable.sql | 29 +++++++++---------- 2 files changed, 13 insertions(+), 18 deletions(-) delete mode 100644 services/db/install/changes/1.0.8/acl.sql diff --git a/services/db/install/changes/1.0.8/acl.sql b/services/db/install/changes/1.0.8/acl.sql deleted file mode 100644 index 3f47da8faf..0000000000 --- a/services/db/install/changes/1.0.8/acl.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('89','Sale', 'moveToNewTicket', '*', 'ALLOW', 'ROLE', 'employee'); -INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (90, 'Sale', 'reserve', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/services/db/install/changes/1.0.8/ticketGetVisibleAvailable.sql b/services/db/install/changes/1.0.8/ticketGetVisibleAvailable.sql index 08095c992c..2ee2191c2e 100644 --- a/services/db/install/changes/1.0.8/ticketGetVisibleAvailable.sql +++ b/services/db/install/changes/1.0.8/ticketGetVisibleAvailable.sql @@ -1,38 +1,35 @@ USE `vn`; -DROP procedure IF EXISTS ` ticketGetVisibleAvailable`; +DROP procedure IF EXISTS `ticketGetVisibleAvailable`; DELIMITER $$ USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE ` ticketGetVisibleAvailable`( +CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetVisibleAvailable`( vTicket INT) BEGIN DECLARE vVisibleCalc INT; - DECLARE vAvailableCalc INT; - DECLARE vShipped DATE; - DECLARE vWarehouse TINYINT; + DECLARE vAvailableCalc INT; + DECLARE vShipped DATE; + DECLARE vWarehouse TINYINT; DECLARE vAlertLevel INT; - + SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel FROM ticket t LEFT JOIN ticketState ts ON ts.ticketFk = vTicket WHERE t.id = vTicket; - - IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN - IF vShipped > CURDATE() THEN + IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN + IF vShipped >= CURDATE() THEN CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); END IF; IF vShipped = CURDATE() THEN - CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse); END IF; END IF; - - SELECT s.itemFk, s.quantity, s.price, s.discount, i.val1 ,i.val2, i.val3, i.val4, i.val5, i.val6,v.visible, av.available - FROM vn.sale s - JOIN vn.itemTagArranged i ON i.itemFk = s.itemFk - LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc - LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc + + SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available + FROM sale s + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc + LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc WHERE s.ticketFk = vTicket; END$$