From 8a192b4f57fa5d8f5b14869f2a50c6fb2e4e4d31 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 21 Feb 2019 13:09:14 +0100 Subject: [PATCH 01/60] updated fixture price for item 4 on ticket 11 --- e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js | 2 +- services/db/install/dump/fixtures.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js index d48b67c81..067cc55e4 100644 --- a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js +++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js @@ -73,7 +73,7 @@ describe('Ticket Edit basic data path', () => { .wait(1900) .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); - expect(result).toContain('-€187.75'); + expect(result).toContain('-€208.75'); }); it(`should then click next to move on to step three`, async() => { diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index b97fb8511..08ca8c5bc 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -547,7 +547,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric (5, 1, 2 , 'Object1 Gem1 5', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY)), (6, 1, 3 , 'Object1 Gem1 5', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY)), (7, 2, 11, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()), - (8, 4, 11, 'Object4 Armor2 2', 10, 3.26, 0, 0, 0, CURDATE()), + (8, 4, 11, 'Object4 Armor2 2', 10, 3.05, 0, 0, 0, CURDATE()), (9, 1, 16, 'Object1 Gem1 5', 5, 9.10, 0, 0, 0, CURDATE()), (10, 2, 16, 'Object2 Gem2 3', 10, 1.07, 0, 0, 0, CURDATE()), (11, 1, 16, 'Object1 Gem1 5', 2, 9.10, 0, 0, 0, CURDATE()), From 6364239d8a2efd41d2db44c0214e76d6e9960b6e Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 22 Feb 2019 12:27:56 +0100 Subject: [PATCH 02/60] #1152 updated td-editable --- front/core/components/td-editable/index.html | 4 +- front/core/components/td-editable/index.js | 28 +++++++++++-- front/core/components/td-editable/style.scss | 42 +++++++++++++++----- front/core/directives/focus.js | 37 ++++++++--------- 4 files changed, 77 insertions(+), 34 deletions(-) diff --git a/front/core/components/td-editable/index.html b/front/core/components/td-editable/index.html index 14336126d..8a1e33fe8 100644 --- a/front/core/components/td-editable/index.html +++ b/front/core/components/td-editable/index.html @@ -1,4 +1,2 @@ - - -
+ \ No newline at end of file diff --git a/front/core/components/td-editable/index.js b/front/core/components/td-editable/index.js index 49a4c3dcd..a6be8b9b8 100644 --- a/front/core/components/td-editable/index.js +++ b/front/core/components/td-editable/index.js @@ -1,38 +1,58 @@ import ngModule from '../../module'; import Component from '../../lib/component'; +import {focus} from '../../directives/focus'; import './style.scss'; export default class Controller extends Component { - constructor($element, $scope, $transclude) { + constructor($element, $scope, $transclude, $timeout) { super($element, $scope); + this.$timeout = $timeout; let element = $element[0]; element.tabIndex = 0; element.addEventListener('focus', () => { + if (this.field) return; $transclude((tClone, tScope) => { this.field = tClone; this.tScope = tScope; this.element.querySelector('.field').appendChild(this.field[0]); + element.tabIndex = -1; + this.timer = $timeout(() => { + this.timer = null; + focus(this.field[0]); + }); }, null, 'field'); element.classList.add('selected'); }); element.addEventListener('focusout', event => { + this.destroyTimer(); this.lastEvent = event; let target = event.relatedTarget; - while (target && target.parentNode != element) + while (target && target != element) target = target.parentNode; if (!target) { this.tScope.$destroy(); this.field.remove(); + this.field = null; element.classList.remove('selected'); + element.tabIndex = 0; } }); } -} + destroyTimer() { + if (this.timer) { + this.$timeout.cancel(this.timer); + this.timer = null; + } + } -Controller.$inject = ['$element', '$scope', '$transclude']; + $onDestroy() { + this.destroyTimer(); + } +} +Controller.$inject = ['$element', '$scope', '$transclude', '$timeout']; ngModule.component('vnTdEditable', { template: require('./index.html'), diff --git a/front/core/components/td-editable/style.scss b/front/core/components/td-editable/style.scss index 563590b3d..5101fecf6 100644 --- a/front/core/components/td-editable/style.scss +++ b/front/core/components/td-editable/style.scss @@ -1,16 +1,40 @@ +@import "variables"; + vn-td-editable { cursor: pointer; - & > div.text-container{ - width: 100%; - } + outline: none; + position: relative; - &.selected { - & > .text-container{ - display: none; + &.selected > .text { + visibility: hidden; + } + & > .field { + display: none; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + box-sizing: border-box; + align-items: center; + padding: .6em; + overflow: visible; + + & > field { + flex: 1; + background-color: $color-bg-panel; + padding: .5em; + box-shadow: 0 0 .4em rgba(0, 0, 0, .2); + border-radius: .1em; + min-width: 6em; + + & > * { + width: 100%; + max-width: initial; + } } } - - vn-icon { - font-size: 1em; + &.selected > .field { + display: flex; } } \ No newline at end of file diff --git a/front/core/directives/focus.js b/front/core/directives/focus.js index 26376a260..91fcffbb2 100644 --- a/front/core/directives/focus.js +++ b/front/core/directives/focus.js @@ -1,5 +1,22 @@ import ngModule from '../module'; +export function focus(input) { + let selector = 'input, textarea, button, submit'; + + if (!input.matches(selector)) + input = input.querySelector(selector); + + if (!input) { + console.warn(`vnFocus: Can't find a focusable element`); + return; + } + + input.focus(); + + if (input.select) + input.select(); +} + /** * Sets the focus and selects the text on the input. * @@ -8,24 +25,8 @@ import ngModule from '../module'; export function directive() { return { restrict: 'A', - link: function($scope, $element, $attrs) { - $scope.$watch('', function() { - let input = $element[0]; - let selector = 'input, textarea, button, submit'; - - if (!input.matches(selector)) - input = input.querySelector(selector); - - if (!input) { - console.warn(`vnFocus: Can't find a focusable element`); - return; - } - - input.focus(); - - if (input.select) - input.select(); - }); + link: function($scope, $element) { + $scope.$watch('', () => focus($element[0])); } }; } From b9dd605c7731487dcea8a87059349edf4a0e9db6 Mon Sep 17 00:00:00 2001 From: Bernat Date: Fri, 22 Feb 2019 12:38:27 +0100 Subject: [PATCH 03/60] udate structure db --- .../1.1NotInProduction/02-ticketGetTax.sql | 70 --------- .../1.2-CHECK/06-ticketGetProblems.sql | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+), 70 deletions(-) delete mode 100644 services/db/install/changes/1.1NotInProduction/02-ticketGetTax.sql create mode 100644 services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql diff --git a/services/db/install/changes/1.1NotInProduction/02-ticketGetTax.sql b/services/db/install/changes/1.1NotInProduction/02-ticketGetTax.sql deleted file mode 100644 index cd52b10f0..000000000 --- a/services/db/install/changes/1.1NotInProduction/02-ticketGetTax.sql +++ /dev/null @@ -1,70 +0,0 @@ -USE `vn`; -DROP procedure IF EXISTS `ticketGetTax`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`() - READS SQL DATA -BEGIN -/** - * Calcula la base imponible, el IVA y el recargo de equivalencia para - * un conjunto de tickets. - * - * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular - * @return tmp.ticketTax Impuesto desglosado para cada ticket - * @return tmp.ticketAmount - */ - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; - - - CALL addressTaxArea (); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; - CREATE TEMPORARY TABLE tmp.ticketTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tmpTicket.ticketFk, - bp.pgcFk, - ROUND(SUM(s.quantity * s.price * (100 - s.discount)/100 - ),2) AS taxableBase, - ROUND(SUM(s.quantity * s.price * (100 - s.discount)/100 - ) * pgc.rate / 100,2) AS tax, - tc.code - FROM tmp.ticket tmpTicket - JOIN sale s ON s.ticketFk = tmpTicket.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN ticket t ON t.id = tmpTicket.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN itemTaxCountry itc - ON itc.itemFk = i.id AND itc.countryFk = su.countryFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = itc.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tmpTicket.ticketFk, pgc.code - HAVING taxableBase != 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - CREATE TEMPORARY TABLE tmp.ticketAmount - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT ticketFk, taxableBase, SUM(tax) tax - FROM tmp.ticketTax - GROUP BY ticketFk, code; - - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; -END$$ - -DELIMITER ; - diff --git a/services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql b/services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql new file mode 100644 index 000000000..32d64b88f --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql @@ -0,0 +1,147 @@ +USE `vn`; +DROP procedure IF EXISTS `ticketGetProblems`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetProblems`() +BEGIN + + DECLARE vWarehouse INT; + DECLARE vDate DATE; + DECLARE vAvailableCache INT; + DECLARE vVisibleCache INT; + DECLARE vDone INT DEFAULT 0; + + DECLARE vCursor CURSOR FOR + SELECT DISTINCT tt.warehouseFk, date(tt.shipped) + FROM tmp.ticketGetProblems tt + WHERE DATE(tt.shipped) BETWEEN CURDATE() + AND TIMESTAMPADD(DAY, 1.9, CURDATE()); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketProblems; + CREATE TEMPORARY TABLE tmp.ticketProblems ( + ticketFk INT(11) PRIMARY KEY, + problem VARCHAR(50) + ) ENGINE = MEMORY; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketList; + CREATE TEMPORARY TABLE tmp.ticketList + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT tp.ticketFk, c.id clientFk + FROM tmp.ticketGetProblems tp + JOIN vn.client c ON c.id = tp.clientFk; + + INSERT INTO tmp.ticketProblems(ticketFk, problem) + SELECT DISTINCT tl.ticketFk, 'Freezed' + FROM tmp.ticketList tl + JOIN vn.client c ON c.id = tl.clientFk + WHERE c.isFreezed; + + DELETE tl FROM tmp.ticketList tl + JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + (PRIMARY KEY (clientFk)) + ENGINE = MEMORY + SELECT DISTINCT clientFk + FROM tmp.ticketList; + + CALL clientGetDebt(CURDATE()); + + INSERT INTO tmp.ticketProblems(ticketFk, problem) + SELECT DISTINCT tl.ticketFk, 'Risk' + FROM tmp.ticketList tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.agencyMode a ON t.agencyModeFk = a.id + JOIN tmp.risk r ON r.clientFk = t.clientFk + JOIN vn.client c ON c.id = t.clientFk + WHERE r.risk > c.credit + 10 + AND a.deliveryMethodFk != 3; + + + DELETE tl FROM tmp.ticketList tl + JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; + + + INSERT INTO tmp.ticketProblems(ticketFk, problem) + SELECT DISTINCT tl.ticketFk, 'Code 100' + FROM tmp.ticketList tl + JOIN vn.ticketRequest tr on tr.ticketFk = tl.ticketFk; + + DELETE tl FROM tmp.ticketList tl + JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; + + OPEN vCursor; + + WHILE NOT vDone + DO + FETCH vCursor INTO vWarehouse, vDate; + + CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouse); + CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate); + + + INSERT INTO tmp.ticketProblems(ticketFk, problem) + SELECT tl.ticketFk, i.name + FROM tmp.ticketList tl + JOIN vn.ticket t ON t.id = tl.ticketFk + LEFT JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN cache.visible v ON i.id = v.item_id + AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id + AND av.calc_id = vAvailableCache + WHERE date(t.shipped) = vDate + AND categoryFk != 6 + AND s.quantity > IFNULL(v.visible, 0) + AND IFNULL(av.available, 0) < 0 + AND s.isPicked = FALSE + AND NOT i.generic + AND vWarehouse = t.warehouseFk + GROUP BY tl.ticketFk; + + + DELETE tl FROM tmp.ticketList tl + JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; + + + INSERT INTO tmp.ticketProblems(ticketFk, problem) + SELECT tl.ticketFk, CONCAT('Delay', i.name) + FROM tmp.ticketList tl + JOIN vn.ticket t ON t.id = tl.ticketFk + LEFT JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN cache.visible v ON i.id = v.item_id AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + WHERE IFNULL(av.available, 0) >= 0 + AND s.quantity > IFNULL(v.visible, 0) + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND it.categoryFk != 6 + AND date(t.shipped) = vDate + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouse + GROUP BY tl.ticketFk; + + + DELETE tl FROM tmp.ticketList tl + JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; + + END WHILE; + + CLOSE vCursor; + + DROP TEMPORARY TABLE + tmp.clientGetDebt, + tmp.ticketList; +END$$ + +DELIMITER ; + From 45527a43da9fdd8785ec4d018b83e0cf1d819960 Mon Sep 17 00:00:00 2001 From: Bernat Date: Mon, 25 Feb 2019 08:25:53 +0100 Subject: [PATCH 04/60] cau 9939 refactor db/changes files and update structure db --- .../changes/1.0-OnlyLocal/01-localLog.sql | 4 - .../1.0-OnlyLocal/02-updateTriggerTickets.sql | 21 --- .../1.0-OnlyLocal/05-updateTriggerClient.sql | 58 ------- .../1.1NotInProduction/01-itemType.sql | 17 -- .../03-ticketComponentUpdateSale.sql | 154 ------------------ .../05-CompresAfterInsert.sql | 40 ----- .../06-CompresAfterUpdate.sql | 38 ----- services/db/install/dump/fixtures.sql | 8 +- 8 files changed, 4 insertions(+), 336 deletions(-) delete mode 100644 services/db/install/changes/1.0-OnlyLocal/01-localLog.sql delete mode 100644 services/db/install/changes/1.0-OnlyLocal/02-updateTriggerTickets.sql delete mode 100644 services/db/install/changes/1.0-OnlyLocal/05-updateTriggerClient.sql delete mode 100644 services/db/install/changes/1.1NotInProduction/01-itemType.sql delete mode 100644 services/db/install/changes/1.1NotInProduction/03-ticketComponentUpdateSale.sql delete mode 100644 services/db/install/changes/1.1NotInProduction/05-CompresAfterInsert.sql delete mode 100644 services/db/install/changes/1.1NotInProduction/06-CompresAfterUpdate.sql diff --git a/services/db/install/changes/1.0-OnlyLocal/01-localLog.sql b/services/db/install/changes/1.0-OnlyLocal/01-localLog.sql deleted file mode 100644 index 4d1c48a74..000000000 --- a/services/db/install/changes/1.0-OnlyLocal/01-localLog.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE `vn`.`localLog` ( - `id` INT NOT NULL AUTO_INCREMENT, - `ticketFk` VARCHAR(45) NULL, - PRIMARY KEY (`id`)); diff --git a/services/db/install/changes/1.0-OnlyLocal/02-updateTriggerTickets.sql b/services/db/install/changes/1.0-OnlyLocal/02-updateTriggerTickets.sql deleted file mode 100644 index 9594391cf..000000000 --- a/services/db/install/changes/1.0-OnlyLocal/02-updateTriggerTickets.sql +++ /dev/null @@ -1,21 +0,0 @@ -DROP TRIGGER IF EXISTS `vn2008`.`TicketsAfterUpdate`; - -DELIMITER $$ -USE `vn2008`$$ -CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`TicketsAfterUpdate` - AFTER UPDATE ON `Tickets` FOR EACH ROW -BEGIN - IF NEW.Id_Ruta IS NULL AND OLD.Id_Ruta IS NOT NULL THEN - INSERT INTO vn.routeLog(originFk, userFk, `action`, description) - VALUES (OLD.Id_Ruta, account.userGetId(), 'update', CONCAT('Saca el ticket ', OLD.Id_Ticket, ' de la ruta')); - ELSEIF NOT (NEW.Id_Ruta <=> OLD.Id_Ruta) THEN - INSERT INTO vn.routeLog(originFk, userFk, `action`, description) - VALUES (NEW.Id_Ruta, account.userGetId(), 'update', CONCAT('Añade el ticket ', OLD.Id_Ticket, ' a la ruta')); - END IF; - - CALL stock.queueAdd ('ticket', NEW.Id_Ticket, OLD.Id_Ticket); - - INSERT INTO vn.localLog(ticketFk) - VALUES(NEW.Id_Ticket); -END$$ -DELIMITER ; diff --git a/services/db/install/changes/1.0-OnlyLocal/05-updateTriggerClient.sql b/services/db/install/changes/1.0-OnlyLocal/05-updateTriggerClient.sql deleted file mode 100644 index bacbb9aa1..000000000 --- a/services/db/install/changes/1.0-OnlyLocal/05-updateTriggerClient.sql +++ /dev/null @@ -1,58 +0,0 @@ -DROP TRIGGER IF EXISTS `vn2008`.`ClientesBeforeUpdate`; - -DELIMITER $$ -USE `vn2008`$$ -CREATE DEFINER=`root`@`%` TRIGGER `ClientesBeforeUpdate` - BEFORE UPDATE ON `Clientes` - FOR EACH ROW -BEGIN - DECLARE vText VARCHAR(255) DEFAULT NULL; - DECLARE isAlreadyUsedIf BOOLEAN; - - SELECT (COUNT(*) > 1) INTO isAlreadyUsedIf - FROM Clientes - WHERE `IF` = TRIM(NEW.`IF`); - - IF isAlreadyUsedIf THEN - CALL util.throw ('Error. El NIF/CIF está repetido'); - END IF; - - -- Comprueba que el formato de los teléfonos es válido - - IF !(NEW.telefono <=> OLD.telefono) THEN - CALL pbx.phoneIsValid (NEW.telefono); - END IF; - - IF !(NEW.movil <=> OLD.movil) THEN - CALL pbx.phoneIsValid (NEW.movil); - END IF; - - IF !(NEW.fax <=> OLD.fax) THEN - CALL pbx.phoneIsValid (NEW.fax); - END IF; - - -- Avisar al comercial si ha llegado la documentación sepa/core - - IF NEW.sepavnl AND !OLD.sepavnl THEN - SET vText = 'Sepa de VNL'; - END IF; - - IF NEW.corevnl AND !OLD.corevnl THEN - SET vText = 'Core de VNL'; - END IF; - - IF vText IS NOT NULL - THEN - INSERT INTO mail(`to`, reply_to, subject, text) - SELECT - CONCAT(IF(ac.id,name, 'jgallego'), '@verdnatura.es'), - 'administracion@verdnatura.es', - CONCAT('Cliente ', NEW.Id_Cliente), - CONCAT('Recibida la documentación: ', vText) - FROM Trabajadores t - LEFT JOIN account.user u ON t.user_id = u.id AND active - LEFT JOIN account.account ac ON ac.id = u.id - WHERE t.Id_Trabajador = NEW.Id_Trabajador; - END IF; -END$$ -DELIMITER ; diff --git a/services/db/install/changes/1.1NotInProduction/01-itemType.sql b/services/db/install/changes/1.1NotInProduction/01-itemType.sql deleted file mode 100644 index 58bde4d2d..000000000 --- a/services/db/install/changes/1.1NotInProduction/01-itemType.sql +++ /dev/null @@ -1,17 +0,0 @@ -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `itemType` AS - SELECT - `t`.`tipo_id` AS `id`, - `t`.`Id_Tipo` AS `code`, - `t`.`Tipo` AS `name`, - `t`.`reino_id` AS `categoryFk`, - `t`.`life` AS `life`, - `t`.`Id_Trabajador` AS `workerFk`, - `t`.`warehouseFk` AS `warehouseFk`, - `t`.`isPackaging` AS `isPackaging` - FROM - `vn2008`.`Tipos` `t`; diff --git a/services/db/install/changes/1.1NotInProduction/03-ticketComponentUpdateSale.sql b/services/db/install/changes/1.1NotInProduction/03-ticketComponentUpdateSale.sql deleted file mode 100644 index 80da69009..000000000 --- a/services/db/install/changes/1.1NotInProduction/03-ticketComponentUpdateSale.sql +++ /dev/null @@ -1,154 +0,0 @@ -USE `vn`; -DROP procedure IF EXISTS `ticketComponentUpdateSale`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentUpdateSale`(vOption INT) -BEGIN -/** - * A partir de la tabla tmp.sale, crea los Movimientos_componentes - * y modifica el campo Preu de la tabla Movimientos - * - * @param i_option integer tipo de actualizacion - * @param table tmp.sale tabla memory con el campo Id_Movimiento, warehouse_id - **/ - DECLARE vComponentFk INT; - DECLARE vRenewComponents BOOLEAN; - DECLARE vKeepPrices BOOLEAN; - - CASE vOption - WHEN 1 THEN - SET vRenewComponents = TRUE; - SET vKeepPrices = FALSE; - WHEN 2 THEN - SET vComponentFk = 17; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 3 THEN - SET vComponentFk = 37; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 4 THEN - SET vComponentFk = 34; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 5 THEN - SET vComponentFk = 35; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 6 THEN - SET vComponentFk = 36; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 7 THEN - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk NOT IN (28, 29) - GROUP BY s.id; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk NOT IN (28, 29) - GROUP BY s.id; - - SET vRenewComponents = FALSE; - SET vKeepPrices = FALSE; - WHEN 8 THEN - DELETE sc.* - FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id; - - SET vRenewComponents = FALSE; - SET vKeepPrices = FALSE; - WHEN 9 THEN - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - END CASE; - - IF vRenewComponents THEN - DELETE sc.* - FROM tmp.sale tmps - JOIN saleComponent sc ON sc.saleFk = tmps.saleFk - JOIN componentRate cr ON cr.id = sc.componentFk - WHERE cr.isRenewable; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, tc.componentFk, ROUND(tc.cost,3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk = tc.componentFk - LEFT JOIN componentRate cr ON cr.id = tc.componentFk - WHERE IF(sc.componentFk IS NULL AND NOT cr.isRenewable, FALSE, TRUE); - END IF; - - IF vKeepPrices THEN - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - WHERE sc.saleFk <> vComponentFk - GROUP BY s.id - HAVING dif <> 0; - ELSE - UPDATE sale s - JOIN item i on i.id = s.itemFk - JOIN itemType it on it.id = i.typeFk - JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - GROUP BY sc.saleFk) sc ON sc.saleFk = s.id - SET s.price = sumValue - WHERE it.code != 'PRT'; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - sum(value),3) saleValue - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - WHERE sc.componentFk != 21 - GROUP BY s.id - HAVING ROUND(saleValue, 4) <> 0; - END IF; - - UPDATE sale s - JOIN ( - SELECT SUM(sc.value) sumValue, sc.saleFk - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN componentRate cr ON cr.id = sc.componentFk - JOIN componentTypeRate ctr on ctr.id = cr.componentTypeRate AND ctr.base - GROUP BY sc.saleFk) sc ON sc.saleFk = s.id - SET s.priceFixed = sumValue, s.isPriceFixed = 1; - - DELETE sc.* - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN sale s on s.id = sc.saleFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE it.code = 'PRT'; - - INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 15, ROUND(s.price,3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN item i ON i.id = s.itemFK - JOIN itemType it ON it.id = i.typeFk - WHERE it.code = 'PRT' AND s.price > 0; -END$$ - -DELIMITER ; - diff --git a/services/db/install/changes/1.1NotInProduction/05-CompresAfterInsert.sql b/services/db/install/changes/1.1NotInProduction/05-CompresAfterInsert.sql deleted file mode 100644 index 1e4e0a81a..000000000 --- a/services/db/install/changes/1.1NotInProduction/05-CompresAfterInsert.sql +++ /dev/null @@ -1,40 +0,0 @@ -DROP TRIGGER IF EXISTS `vn2008`.`CompresAfterInsert`; - -DELIMITER $$ -USE `vn2008`$$ -CREATE DEFINER=`root`@`%` TRIGGER `CompresAfterInsert` AFTER INSERT ON `Compres` FOR EACH ROW BEGIN - - DECLARE vWarehouse INT; - DECLARE vWarehouseOut INT; - DECLARE isMerchandise BOOLEAN; - - CALL stock.queueAdd ('buy', NEW.Id_Compra, NULL); - - SELECT warehouse_id, warehouse_id_out INTO vWarehouse, vWarehouseOut - FROM Entradas E - JOIN travel T ON T.id = E.travel_id - WHERE E.Id_Entrada = NEW.Id_Entrada; - - -- Actualiza el volumen unitario - SELECT k.merchandise INTO isMerchandise - FROM vn.itemCategory k - JOIN vn.itemType it ON it.categoryFk = k.id - JOIN vn.item i ON i.typeFk = it.id - WHERE i.id = NEW.Id_Article; - - If isMerchandise THEN - - REPLACE bi.rotacion(Id_Article, warehouse_id, cm3) - VALUES (NEW.Id_ARticle, vWarehouse, vn2008.cm3_unidad(NEW.Id_Compra)); - - END IF; - - IF (SELECT fuente FROM warehouse where id = vWarehouseOut AND id <> 13) AND - (SELECT has_notify_passport(NEW.Id_Article,NEW.Id_Compra)) - THEN - CALL notify_passport(NEW.Id_Article, NEW.Etiquetas, NEW.Packing,NEW.Id_Compra); - CALL insert_producer_plantpassport(NEW.Id_Compra); - END IF; - -END$$ -DELIMITER ; diff --git a/services/db/install/changes/1.1NotInProduction/06-CompresAfterUpdate.sql b/services/db/install/changes/1.1NotInProduction/06-CompresAfterUpdate.sql deleted file mode 100644 index da8ac400f..000000000 --- a/services/db/install/changes/1.1NotInProduction/06-CompresAfterUpdate.sql +++ /dev/null @@ -1,38 +0,0 @@ -DROP TRIGGER IF EXISTS `vn2008`.`CompresAfterUpdate`; - -DELIMITER $$ -USE `vn2008`$$ -CREATE DEFINER=`root`@`%` TRIGGER `CompresAfterUpdate` - AFTER UPDATE ON `Compres` FOR EACH ROW -BEGIN - DECLARE vWarehouse INT; - DECLARE vWarehouseOut INT; - DECLARE isMerchandise BOOLEAN; - - CALL stock.queueAdd ('buy', NEW.Id_Compra, OLD.Id_Compra); - - SELECT warehouse_id, warehouse_id_out INTO vWarehouse, vWarehouseOut - FROM Entradas E - JOIN travel T ON T.id = E.travel_id - WHERE E.Id_Entrada = NEW.Id_Entrada; - - SELECT k.merchandise INTO isMerchandise - FROM vn.itemCategory k - JOIN vn.itemType it ON it.categoryFk = k.id - JOIN vn.item i ON i.typeFk = it.id - WHERE i.id = NEW.Id_Article; - - IF isMerchandise AND NOT(NEW.Id_Cubo <=> OLD.Id_Cubo AND NEW.Id_Entrada <=> OLD.Id_Entrada) - THEN - REPLACE bi.rotacion(Id_Article, warehouse_id, cm3) - VALUES (NEW.Id_ARticle, vWarehouse, vn2008.cm3_unidad(NEW.Id_Compra)); - END IF; - - IF (SELECT fuente FROM warehouse where id = vWarehouseOut AND id <> 13) AND - (SELECT has_notify_passport(NEW.Id_Article,NEW.Id_Compra)) > 0 - THEN - CALL notify_passport(NEW.Id_Article, NEW.Etiquetas, NEW.Packing,NEW.Id_Compra); - CALL insert_producer_plantpassport(NEW.Id_Compra); - END IF; -END$$ -DELIMITER ; diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 08ca8c5bc..bf133a61d 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -593,11 +593,11 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (5, 29, -18.72), (5, 39, 0.02), (6, 23, 6.5), - (7, 15, 0.29), + (7, 15, 0.2899), (7, 28, 5.6), (7, 29, -4.6), (7, 39, 0.01), - (8, 15, 0.044), + (8, 15, 0.0435), (8, 21, -0.004), (8, 28, 20.72), (8, 29, -19.72), @@ -624,7 +624,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (12, 29, -19.72), (12, 37, 2), (12, 39, 0.01), - (13, 15, 0.29), + (13, 15, 0.2899), (13, 28, 5.6), (13, 29, -4.6), (13, 39, 0.01), @@ -927,7 +927,7 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) (5, 29, -18.72), (5, 39, 0.02), (6, 23, 6.5), - (7, 15, 0.29), + (7, 15, 0.2899), (7, 28, 5.6), (7, 29, -4.6), (7, 39, 0.01), From 6e23b5bcc06234419fbe3faaf04386d48b217ed8 Mon Sep 17 00:00:00 2001 From: Bernat Date: Mon, 25 Feb 2019 08:49:08 +0100 Subject: [PATCH 05/60] update structure db cau 9939 --- .../changes/1.2-CHECK/01-workerDepartment.sql | 18 - .../changes/1.2-CHECK/02-orderAddItem.sql | 108 -- .../db/install/changes/1.2-CHECK/03-acl.sql | 1 - .../changes/1.2-CHECK/04-ticketGetTax.sql | 99 -- .../changes/1.2-CHECK/05-ticketGetTaxAdd.sql | 34 - .../1.2-CHECK/06-ticketGetProblems.sql | 147 --- services/db/install/dump/dumpedFixtures.sql | 28 +- services/db/install/dump/structure.sql | 1115 +++++++++++------ 8 files changed, 740 insertions(+), 810 deletions(-) delete mode 100644 services/db/install/changes/1.2-CHECK/01-workerDepartment.sql delete mode 100644 services/db/install/changes/1.2-CHECK/02-orderAddItem.sql delete mode 100644 services/db/install/changes/1.2-CHECK/03-acl.sql delete mode 100644 services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql delete mode 100644 services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql delete mode 100644 services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql diff --git a/services/db/install/changes/1.2-CHECK/01-workerDepartment.sql b/services/db/install/changes/1.2-CHECK/01-workerDepartment.sql deleted file mode 100644 index b52f29182..000000000 --- a/services/db/install/changes/1.2-CHECK/01-workerDepartment.sql +++ /dev/null @@ -1,18 +0,0 @@ -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `vn`.`workerDepartment` AS - SELECT - `p`.`id_trabajador` AS `workerFk`, - `d`.`id` AS `departmentFk` - FROM - (((`postgresql`.`person` `p` - JOIN `postgresql`.`profile` `pr` ON ((`pr`.`person_id` = `p`.`person_id`))) - LEFT JOIN (`postgresql`.`business` `b` - LEFT JOIN `postgresql`.`business_labour` `bl` ON ((`b`.`business_id` = `bl`.`business_id`))) ON ((`pr`.`profile_id` = `b`.`client_id`))) - JOIN `vn`.`department` `d` ON ((`d`.`id` = `bl`.`department_id`))) - WHERE - (ISNULL(`b`.`date_end`) - OR (`b`.`date_end` > CURDATE())); diff --git a/services/db/install/changes/1.2-CHECK/02-orderAddItem.sql b/services/db/install/changes/1.2-CHECK/02-orderAddItem.sql deleted file mode 100644 index 35bee1117..000000000 --- a/services/db/install/changes/1.2-CHECK/02-orderAddItem.sql +++ /dev/null @@ -1,108 +0,0 @@ -USE `hedera`; -DROP procedure IF EXISTS `orderAddItem`; - -DELIMITER $$ -USE `hedera`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `orderAddItem`(IN `vOrder` INT, IN `vWarehouse` INT, IN `vItem` INT, IN `vAmount` INT) -BEGIN - DECLARE vRow INT; - DECLARE vAdd INT; - DECLARE vAvailable INT; - DECLARE vDone BOOL; - DECLARE vGrouping INT; - DECLARE vRate INT; - DECLARE vShipment DATE; - DECLARE vPrice DECIMAL(10,2); - DECLARE vDate DATE; - DECLARE vAddress INT; - DECLARE vAgencyMode INT; - DECLARE cur CURSOR FOR - SELECT grouping, price, rate - FROM tmp.bionic_price - WHERE warehouse_id = vWarehouse - AND item_id = vItem - ORDER BY grouping DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SELECT date_send, address_id, agency_id - INTO vDate, vAddress, vAgencyMode - FROM `order` - WHERE id = vOrder; - - CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem); - - START TRANSACTION; - - SELECT shipped INTO vShipment - FROM tmp.travel_tree - WHERE warehouseFk = vWarehouse; - - SELECT available INTO vAvailable - FROM tmp.bionic_lot - WHERE warehouse_id = vWarehouse - AND item_id = vItem; - - IF vAmount > IFNULL(vAvailable, 0) - THEN - CALL util.throw ('ORDER_ROW_UNAVAILABLE'); - END IF; - - OPEN cur; - - l: LOOP - SET vDone = FALSE; - FETCH cur INTO vGrouping, vPrice, vRate; - - IF vDone THEN - LEAVE l; - END IF; - - SET vAdd = vAmount - MOD(vAmount, vGrouping); - SET vAmount = vAmount - vAdd; - - IF vAdd = 0 THEN - ITERATE l; - END IF; - - INSERT INTO order_row SET - order_id = vOrder, - item_id = vItem, - warehouse_id = vWarehouse, - shipment = vShipment, - rate = vRate, - amount = vAdd, - price = vPrice; - - SET vRow = LAST_INSERT_ID(); - - INSERT INTO order_component (order_row_id, component_id, price) - SELECT vRow, c.component_id, c.cost - FROM tmp.bionic_component c - JOIN bi.tarifa_componentes t - ON t.Id_Componente = c.component_id - AND (t.tarifa_class IS NULL OR t.tarifa_class = vRate) - WHERE c.warehouse_id = vWarehouse - AND c.item_id = vItem; - END LOOP; - - CLOSE cur; - - IF vAmount > 0 - THEN - CALL util.throw ('AMOUNT_NOT_MATCH_GROUPING'); - END IF; - - COMMIT; - CALL vn2008.bionic_free (); -END$$ - -DELIMITER ; - diff --git a/services/db/install/changes/1.2-CHECK/03-acl.sql b/services/db/install/changes/1.2-CHECK/03-acl.sql deleted file mode 100644 index 32ec03b5c..000000000 --- a/services/db/install/changes/1.2-CHECK/03-acl.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO salix.ACL(id,model, property, accessType, permission, principalType, principalId)VALUES(147,'UserConfigView', '*', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql b/services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql deleted file mode 100644 index 6e2423faa..000000000 --- a/services/db/install/changes/1.2-CHECK/04-ticketGetTax.sql +++ /dev/null @@ -1,99 +0,0 @@ - USE `vn`; -DROP procedure IF EXISTS `ticketGetTax`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`() - READS SQL DATA -BEGIN -/** - * Calcula la base imponible, el IVA y el recargo de equivalencia para - * un conjunto de tickets. - * - * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular - * @return tmp.ticketAmount - * @return tmp.ticketTax Impuesto desglosado para cada ticket. - - */ - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; - - CALL addressTaxArea (); - - - /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente - * No se debería cambiar el sistema por problemas con los decimales - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; - CREATE TEMPORARY TABLE tmp.ticketTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tmpTicket.ticketFk, - bp.pgcFk, - SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, - pgc.rate, - tc.code - FROM tmp.ticket tmpTicket - JOIN sale s ON s.ticketFk = tmpTicket.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN ticket t ON t.id = tmpTicket.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN itemTaxCountry itc - ON itc.itemFk = i.id AND itc.countryFk = su.countryFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = itc.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tmpTicket.ticketFk, pgc.code,pgc.rate - HAVING taxableBase != 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; - CREATE TEMPORARY TABLE tmp.ticketServiceTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tt.ticketFk, - SUM(ts.quantity * ts.price) AS taxableBase, - pgc.rate, - tc.code - FROM tmp.ticketTax tt - JOIN ticketService ts ON ts.ticketFk = tt.ticketFk - JOIN ticket t ON t.id = tt.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = ts.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tt.ticketFk, tt.code,tt.rate - HAVING taxableBase != 0; - - UPDATE tmp.ticketTax tt - JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate - SET tt.taxableBase = tt.taxableBase + ts.taxableBase; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - CREATE TEMPORARY TABLE tmp.ticketAmount - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code - FROM tmp.ticketTax - GROUP BY ticketFk, code; - - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; -END$$ - -DELIMITER ; \ No newline at end of file diff --git a/services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql b/services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql deleted file mode 100644 index 3631a77e5..000000000 --- a/services/db/install/changes/1.2-CHECK/05-ticketGetTaxAdd.sql +++ /dev/null @@ -1,34 +0,0 @@ -DROP PROCEDURE IF EXISTS vn.ticketGetTaxAdd; - -DELIMITER $$ -$$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketGetTaxAdd`(vTicketFk INT) -BEGIN -/** - * Añade un ticket a la tabla tmp.ticket para calcular - * el IVA y el recargo de equivalencia y devuelve el resultado. - */ - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - ENGINE = MEMORY - SELECT vTicketFk ticketFk; - - CALL vn.ticketGetTax(); - - SELECT - tt.ticketFk, - CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase, - CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax, - pgc.*, - CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base, - pgc.rate / 100 as vatPercent - FROM tmp.ticketTax tt - JOIN vn.pgc ON pgc.code = tt.pgcFk - LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code; - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticketTax; - DROP TEMPORARY TABLE tmp.ticketAmount; - -END$$ -DELIMITER ; diff --git a/services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql b/services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql deleted file mode 100644 index 32d64b88f..000000000 --- a/services/db/install/changes/1.2-CHECK/06-ticketGetProblems.sql +++ /dev/null @@ -1,147 +0,0 @@ -USE `vn`; -DROP procedure IF EXISTS `ticketGetProblems`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetProblems`() -BEGIN - - DECLARE vWarehouse INT; - DECLARE vDate DATE; - DECLARE vAvailableCache INT; - DECLARE vVisibleCache INT; - DECLARE vDone INT DEFAULT 0; - - DECLARE vCursor CURSOR FOR - SELECT DISTINCT tt.warehouseFk, date(tt.shipped) - FROM tmp.ticketGetProblems tt - WHERE DATE(tt.shipped) BETWEEN CURDATE() - AND TIMESTAMPADD(DAY, 1.9, CURDATE()); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketProblems; - CREATE TEMPORARY TABLE tmp.ticketProblems ( - ticketFk INT(11) PRIMARY KEY, - problem VARCHAR(50) - ) ENGINE = MEMORY; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketList; - CREATE TEMPORARY TABLE tmp.ticketList - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT tp.ticketFk, c.id clientFk - FROM tmp.ticketGetProblems tp - JOIN vn.client c ON c.id = tp.clientFk; - - INSERT INTO tmp.ticketProblems(ticketFk, problem) - SELECT DISTINCT tl.ticketFk, 'Freezed' - FROM tmp.ticketList tl - JOIN vn.client c ON c.id = tl.clientFk - WHERE c.isFreezed; - - DELETE tl FROM tmp.ticketList tl - JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - (PRIMARY KEY (clientFk)) - ENGINE = MEMORY - SELECT DISTINCT clientFk - FROM tmp.ticketList; - - CALL clientGetDebt(CURDATE()); - - INSERT INTO tmp.ticketProblems(ticketFk, problem) - SELECT DISTINCT tl.ticketFk, 'Risk' - FROM tmp.ticketList tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode a ON t.agencyModeFk = a.id - JOIN tmp.risk r ON r.clientFk = t.clientFk - JOIN vn.client c ON c.id = t.clientFk - WHERE r.risk > c.credit + 10 - AND a.deliveryMethodFk != 3; - - - DELETE tl FROM tmp.ticketList tl - JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; - - - INSERT INTO tmp.ticketProblems(ticketFk, problem) - SELECT DISTINCT tl.ticketFk, 'Code 100' - FROM tmp.ticketList tl - JOIN vn.ticketRequest tr on tr.ticketFk = tl.ticketFk; - - DELETE tl FROM tmp.ticketList tl - JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; - - OPEN vCursor; - - WHILE NOT vDone - DO - FETCH vCursor INTO vWarehouse, vDate; - - CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouse); - CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate); - - - INSERT INTO tmp.ticketProblems(ticketFk, problem) - SELECT tl.ticketFk, i.name - FROM tmp.ticketList tl - JOIN vn.ticket t ON t.id = tl.ticketFk - LEFT JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN cache.visible v ON i.id = v.item_id - AND v.calc_id = vVisibleCache - LEFT JOIN cache.available av ON av.item_id = i.id - AND av.calc_id = vAvailableCache - WHERE date(t.shipped) = vDate - AND categoryFk != 6 - AND s.quantity > IFNULL(v.visible, 0) - AND IFNULL(av.available, 0) < 0 - AND s.isPicked = FALSE - AND NOT i.generic - AND vWarehouse = t.warehouseFk - GROUP BY tl.ticketFk; - - - DELETE tl FROM tmp.ticketList tl - JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; - - - INSERT INTO tmp.ticketProblems(ticketFk, problem) - SELECT tl.ticketFk, CONCAT('Delay', i.name) - FROM tmp.ticketList tl - JOIN vn.ticket t ON t.id = tl.ticketFk - LEFT JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN cache.visible v ON i.id = v.item_id AND v.calc_id = vVisibleCache - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - WHERE IFNULL(av.available, 0) >= 0 - AND s.quantity > IFNULL(v.visible, 0) - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND it.categoryFk != 6 - AND date(t.shipped) = vDate - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouse - GROUP BY tl.ticketFk; - - - DELETE tl FROM tmp.ticketList tl - JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; - - END WHILE; - - CLOSE vCursor; - - DROP TEMPORARY TABLE - tmp.clientGetDebt, - tmp.ticketList; -END$$ - -DELIMITER ; - diff --git a/services/db/install/dump/dumpedFixtures.sql b/services/db/install/dump/dumpedFixtures.sql index ca4e18e4e..0e3957b07 100644 --- a/services/db/install/dump/dumpedFixtures.sql +++ b/services/db/install/dump/dumpedFixtures.sql @@ -55,7 +55,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-02-25 8:31:26 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -80,7 +80,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','salesPerson'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','salesPerson'),(123,'Worker','*','READ','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(134,'Zone','*','READ','ALLOW','ROLE','employee'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','WRITE','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(48,'ItemNiche','*','READ','ALLOW','ROLE','employee'),(49,'ItemNiche','*','WRITE','ALLOW','ROLE','buyer'),(50,'ItemNiche','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','employee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','removes','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','*','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','salesAssistant'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','salesAssistant'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','salesAssistant'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','employee'),(111,'ClientLog','*','READ','ALLOW','ROLE','employee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','employee'),(114,'Receipt','*','READ','ALLOW','ROLE','employee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','salesPerson'),(123,'Worker','*','READ','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','employee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','employee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','WRITE','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -103,7 +103,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-02-25 8:31:26 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -178,7 +178,7 @@ UNLOCK TABLES; LOCK TABLES `tag` WRITE; /*!40000 ALTER TABLE `tag` DISABLE KEYS */; -INSERT INTO `tag` VALUES (1,'Color',0,0,'ink',NULL),(2,'Forma',1,0,NULL,NULL),(3,'Material',1,0,NULL,NULL),(4,'Longitud',1,1,NULL,NULL),(5,'Diámetro',1,1,NULL,'mm'),(6,'Perímetro',1,1,NULL,'mm'),(7,'Ancho de la base',1,1,NULL,'mm'),(8,'Altura',1,1,NULL,'mm'),(9,'Volumen',1,1,NULL,'ml'),(10,'Densidad',1,1,NULL,NULL),(11,'Calidad',1,0,NULL,NULL),(12,'Textura',1,0,NULL,NULL),(13,'Material del mango',1,0,NULL,NULL),(14,'Compra mínima',1,1,NULL,NULL),(15,'Nº pétalos',1,1,NULL,NULL),(16,'Ancho',1,1,NULL,'mm'),(17,'Alto',1,1,NULL,'mm'),(18,'Profundidad',1,1,NULL,'mm'),(19,'Largo',1,1,NULL,'mm'),(20,'Ancho superior',1,1,NULL,'mm'),(21,'Ancho inferior',1,1,NULL,'mm'),(22,'Gramaje',1,0,NULL,'g'),(23,'Tallos',1,1,NULL,NULL),(24,'Estado',0,0,NULL,NULL),(25,'Color principal',0,0,NULL,NULL),(26,'Color secundario',0,0,NULL,NULL),(27,'Longitud(cm)',1,1,NULL,'cm'),(28,'Diámetro base',1,1,NULL,NULL),(29,'Colección',1,0,NULL,NULL),(30,'Uds / caja',1,1,NULL,NULL),(31,'Contenido',1,0,NULL,NULL),(32,'Peso',1,1,NULL,'g'),(33,'Grosor',1,1,NULL,'mm'),(34,'Marca',1,0,NULL,NULL),(35,'Origen',0,0,'origin',NULL),(36,'Proveedor',1,0,NULL,NULL),(37,'Productor',1,0,'producer',NULL),(38,'Duración',1,1,NULL,'s'),(39,'Flor',1,0,NULL,NULL),(40,'Soporte',1,0,NULL,NULL),(41,'Tamaño flor',1,1,NULL,NULL),(42,'Apertura',1,1,NULL,NULL),(43,'Tallo',0,1,NULL,NULL),(44,'Numero hojas',1,1,NULL,NULL),(45,'Dimensiones',1,1,NULL,NULL),(46,'Diámetro boca',1,1,NULL,NULL),(47,'Nº flores',1,1,NULL,NULL),(48,'Uds / paquete',1,1,NULL,NULL),(49,'Maceta',1,1,NULL,NULL),(50,'Textura flor',1,1,NULL,NULL),(51,'Textura hoja',1,1,NULL,NULL),(52,'Tipo de iva',1,1,NULL,NULL),(53,'Tronco',1,1,NULL,NULL),(54,'Hoja',1,1,NULL,NULL),(55,'Formato',1,1,NULL,NULL),(56,'Genero',1,1,NULL,NULL),(57,'Especie',1,1,NULL,NULL),(58,'Variedad',1,1,NULL,NULL),(59,'Medida grande',1,0,NULL,NULL),(60,'Medida mediano',1,0,NULL,NULL),(61,'Medida pequeño',1,0,NULL,NULL),(62,'Medida pequeño',1,0,NULL,NULL),(63,'Recipiente interior',1,1,NULL,NULL),(64,'Material secundario',1,1,NULL,NULL),(65,'Colores',1,1,NULL,NULL),(66,'Referencia',1,1,NULL,NULL),(67,'Categoria',1,0,NULL,NULL),(68,'Amb',0,1,NULL,NULL),(69,'Anchura',1,1,NULL,'cm'),(70,'Hueco interior',-1,1,NULL,NULL),(71,'Tamaño',1,1,NULL,NULL),(72,'Color botón',1,1,NULL,NULL),(73,'Tamaño minimo del botón',1,1,NULL,NULL),(74,'Obtentor',1,1,NULL,NULL),(75,'Logitud del brote',1,1,NULL,NULL),(76,'Tallos / u.v.',1,1,NULL,NULL),(77,'Madera de',1,1,NULL,NULL),(78,'Unidad de venta',1,1,NULL,NULL),(79,'Temporal',1,1,NULL,NULL),(80,'Gramaje/tallo',1,1,NULL,NULL),(81,'Peso/paquete',1,1,NULL,NULL),(82,'Flexibilidad del tallo',1,1,NULL,NULL),(83,'Nº planchas',1,1,NULL,NULL),(84,'Nº páginas',1,1,NULL,NULL),(85,'Editorial',1,1,NULL,NULL),(86,'Idioma',1,1,NULL,NULL),(87,'Fecha publicación',1,1,NULL,NULL),(88,'Cubierta',1,1,NULL,NULL),(89,'Encuadernación',1,1,NULL,NULL),(90,'Autor',1,1,NULL,NULL),(91,'Envoltorio',1,1,NULL,NULL),(92,'Nombre temporal',1,1,NULL,NULL),(93,'Modelo',1,1,NULL,NULL),(94,'Producto',1,1,NULL,NULL),(95,'Título',1,1,NULL,NULL),(96,'Tomo',1,1,NULL,NULL),(97,'Articulo',1,1,NULL,NULL),(98,'Metodo de cultivo',1,1,NULL,NULL),(99,'Edad',1,1,NULL,NULL),(100,'Agotado',1,1,NULL,NULL); +INSERT INTO `tag` VALUES (1,'Color',0,0,'ink',NULL,NULL),(2,'Forma',1,0,NULL,NULL,NULL),(3,'Material',1,0,NULL,NULL,NULL),(4,'Longitud',1,1,NULL,NULL,NULL),(5,'Diámetro',1,1,NULL,'mm',NULL),(6,'Perímetro',1,1,NULL,'mm',NULL),(7,'Ancho de la base',1,1,NULL,'mm',NULL),(8,'Altura',1,1,NULL,'mm',NULL),(9,'Volumen',1,1,NULL,'ml',NULL),(10,'Densidad',1,1,NULL,NULL,NULL),(11,'Calidad',1,0,NULL,NULL,NULL),(12,'Textura',1,0,NULL,NULL,NULL),(13,'Material del mango',1,0,NULL,NULL,NULL),(14,'Compra mínima',1,1,NULL,NULL,NULL),(15,'Nº pétalos',1,1,NULL,NULL,NULL),(16,'Ancho',1,1,NULL,'mm',NULL),(17,'Alto',1,1,NULL,'mm',NULL),(18,'Profundidad',1,1,NULL,'mm',NULL),(19,'Largo',1,1,NULL,'mm',NULL),(20,'Ancho superior',1,1,NULL,'mm',NULL),(21,'Ancho inferior',1,1,NULL,'mm',NULL),(22,'Gramaje',1,0,NULL,'g',NULL),(23,'Tallos',1,1,NULL,NULL,NULL),(24,'Estado',0,0,NULL,NULL,NULL),(25,'Color principal',0,0,NULL,NULL,NULL),(26,'Color secundario',0,0,NULL,NULL,NULL),(27,'Longitud(cm)',1,1,NULL,'cm',NULL),(28,'Diámetro base',1,1,NULL,NULL,NULL),(29,'Colección',1,0,NULL,NULL,NULL),(30,'Uds / caja',1,1,NULL,NULL,NULL),(31,'Contenido',1,0,NULL,NULL,NULL),(32,'Peso',1,1,NULL,'g',NULL),(33,'Grosor',1,1,NULL,'mm',NULL),(34,'Marca',1,0,NULL,NULL,NULL),(35,'Origen',0,0,'origin',NULL,NULL),(36,'Proveedor',1,0,NULL,NULL,NULL),(37,'Productor',1,0,'producer',NULL,NULL),(38,'Duración',1,1,NULL,'s',NULL),(39,'Flor',1,0,NULL,NULL,NULL),(40,'Soporte',1,0,NULL,NULL,NULL),(41,'Tamaño flor',1,1,NULL,NULL,NULL),(42,'Apertura',1,1,NULL,NULL,NULL),(43,'Tallo',0,1,NULL,NULL,NULL),(44,'Numero hojas',1,1,NULL,NULL,NULL),(45,'Dimensiones',1,1,NULL,NULL,NULL),(46,'Diámetro boca',1,1,NULL,NULL,NULL),(47,'Nº flores',1,1,NULL,NULL,NULL),(48,'Uds / paquete',1,1,NULL,NULL,NULL),(49,'Maceta',1,1,NULL,NULL,NULL),(50,'Textura flor',1,1,NULL,NULL,NULL),(51,'Textura hoja',1,1,NULL,NULL,NULL),(52,'Tipo de iva',1,1,NULL,NULL,NULL),(53,'Tronco',1,1,NULL,NULL,NULL),(54,'Hoja',1,1,NULL,NULL,NULL),(55,'Formato',1,1,NULL,NULL,NULL),(56,'Genero',1,1,NULL,NULL,NULL),(57,'Especie',1,1,NULL,NULL,NULL),(58,'Variedad',1,1,NULL,NULL,NULL),(59,'Medida grande',1,0,NULL,NULL,NULL),(60,'Medida mediano',1,0,NULL,NULL,NULL),(61,'Medida pequeño',1,0,NULL,NULL,NULL),(62,'Medida pequeño',1,0,NULL,NULL,NULL),(63,'Recipiente interior',1,1,NULL,NULL,NULL),(64,'Material secundario',1,1,NULL,NULL,NULL),(65,'Colores',1,1,NULL,NULL,NULL),(66,'Referencia',1,1,NULL,NULL,NULL),(67,'Categoria',1,0,NULL,NULL,NULL),(68,'Amb',0,1,NULL,NULL,NULL),(69,'Anchura',1,1,NULL,'cm',NULL),(70,'Hueco interior',-1,1,NULL,NULL,NULL),(71,'Tamaño',1,1,NULL,NULL,NULL),(72,'Color botón',1,1,NULL,NULL,NULL),(73,'Tamaño minimo del botón',1,1,NULL,NULL,NULL),(74,'Obtentor',1,1,NULL,NULL,NULL),(75,'Logitud del brote',1,1,NULL,NULL,NULL),(76,'Tallos / u.v.',1,1,NULL,NULL,NULL),(77,'Madera de',1,1,NULL,NULL,NULL),(78,'Unidad de venta',1,1,NULL,NULL,NULL),(79,'Temporal',1,1,NULL,NULL,NULL),(80,'Gramaje/tallo',1,1,NULL,NULL,NULL),(81,'Peso/paquete',1,1,NULL,NULL,NULL),(82,'Flexibilidad del tallo',1,1,NULL,NULL,NULL),(83,'Nº planchas',1,1,NULL,NULL,NULL),(84,'Nº páginas',1,1,NULL,NULL,NULL),(85,'Editorial',1,1,NULL,NULL,NULL),(86,'Idioma',1,1,NULL,NULL,NULL),(87,'Fecha publicación',1,1,NULL,NULL,NULL),(88,'Cubierta',1,1,NULL,NULL,NULL),(89,'Encuadernación',1,1,NULL,NULL,NULL),(90,'Autor',1,1,NULL,NULL,NULL),(91,'Envoltorio',1,1,NULL,NULL,NULL),(92,'Nombre temporal',1,1,NULL,NULL,NULL),(93,'Modelo',1,1,NULL,NULL,NULL),(94,'Producto',1,1,NULL,NULL,NULL),(95,'Título',1,1,NULL,NULL,NULL),(96,'Tomo',1,1,NULL,NULL,NULL),(97,'Articulo',1,1,NULL,NULL,NULL),(98,'Metodo de cultivo',1,1,NULL,NULL,NULL),(99,'Edad',1,1,NULL,NULL,NULL),(100,'Agotado',1,1,NULL,NULL,NULL),(101,'Altura con asa',1,1,NULL,NULL,NULL); /*!40000 ALTER TABLE `tag` ENABLE KEYS */; UNLOCK TABLES; @@ -201,7 +201,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-02-25 8:31:26 USE `vn2008`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -236,7 +236,7 @@ UNLOCK TABLES; LOCK TABLES `Gastos` WRITE; /*!40000 ALTER TABLE `Gastos` DISABLE KEYS */; -INSERT INTO `Gastos` VALUES ('2000000000',1,'Inmovilizado pendiente',1,0,0),('2000000000',3,'Compra de bienes de inmovilizado',1,0,0),('2600000000',1,'Fianzas',0,0,0),('4600000000',1,'Anticipos de remuneraciones',1,0,0),('4600000001',1,'Anticpos de remuneración',1,0,0),('4751000000',0,'Retenciones',0,1,0),('4751000000',1,'Retenciones',0,1,0),('4751000000',6,'Retencion',0,0,0),('4759000000',1,'Embargos salariales',1,0,0),('5200000006',1,'Deudas a c/p CRA',1,0,0),('5200000008',0,'Prestamo CP Transolver IVECO 269',1,0,0),('5200000008',1,'Prestamo Transolver 201600269',1,0,0),('5200000009',0,'Prestamo CP Transolver IVECO 270',1,0,0),('5200000009',1,'Prestamo Transolver 201600270',1,0,0),('5200000010',0,'Prestamo CP Transolver IVECO 271',1,0,0),('5200000010',1,'Prestamo Transolver 201600271',1,0,0),('5200000011',1,'Prestamo Transolver 339',0,0,0),('5200000012',1,'Prestamo Transolver 340',1,0,0),('5200000013',1,'Prestamo Transolver 341',1,0,0),('5200000014',1,'Prestamo a c/p BBVA 600.000€',1,0,0),('5200000022',1,'Linea comercio exterior',1,0,0),('5240000001',1,'Leasing BBVA',1,0,0),('5240002032',1,'Leasing Iveco',1,0,0),('5240002066',1,'Leasing c/p Man',1,0,0),('5240002104',1,'Leasing c/p La caixa 3 vehículos',1,0,0),('5325000003',6,'Prestamo a partes vinculadas',0,0,0),('5420000001',1,'Prestamo concedido',1,0,0),('5650000001',1,'Fianza c/p vehiculo',0,0,0),('5660000001',1,'Suplidos',0,0,0),('5660000001',20,'Suplidos',1,0,0),('5660000002',0,'Suplidos',0,0,0),('5660000002',1,'Suplidos Transitarios nacionales',1,0,0),('5660000003',1,'Deposito c/p Ebury',1,0,0),('5660000003',4,'Deposito Ebury',0,0,0),('5660000004',4,'Deposito Global Reach',0,0,0),('6001000000',1,'Compras a terceros nacional',1,0,0),('6001000000',18,'Compras a terceros nacional',1,0,0),('6001000000',19,'Compras a terceros nacional',1,0,0),('6001000001',1,'Adquisiones en Europa',0,0,0),('6001000001',3,'Adquisición en Europa',1,0,0),('6002000000',1,'Transportes de compras',1,0,0),('6002000001',1,'Tranportes de compra Europa',1,0,0),('6002000001',4,'Transportes de compras Europa',1,0,0),('6002000567',0,'Transporte de compras VNH',1,0,0),('6003000000',1,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',5,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',6,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000567',0,'Compra de mercancia extracomunitaria VNH',1,0,0),('6004000000',1,'Transporte compras Sudamérica',1,0,0),('6004000000',4,'Transporte compras Sudamérica',1,0,0),('6004000000',6,'Transporte compras Sudamérica',1,0,0),('6010000000',1,'Materias primas',1,0,0),('6020000000',1,'Otros aprovisionamientos',1,0,0),('6020000001',1,'Embalajes',1,0,0),('6020000002',1,'Otros aprov. Taller artíficial',1,0,0),('6070000000',1,'Trabajos de produccion encargados a terceros',1,0,0),('6090000000',6,'Rappels por compras',1,0,0),('6100000000',0,'Variacion existencias',1,0,0),('6210000000',1,'Arrendamientos',1,0,0),('6210000001',1,'Arrendamiento vehículo',1,0,0),('6210000001',4,'Gastos de arrendamiento vehículos',1,0,0),('6210000002',1,'Arrendamiento nave',1,0,0),('6210000003',1,'Arrendamiento espacio virtual-informatic',1,0,0),('6210000004',1,'Arrendamiento elementos para el proceso de informa',1,0,0),('6210000005',1,'Arrendamiento CC y banddejas',1,0,0),('6210000567',0,'Alquiler VNH',1,0,0),('6220000000',1,'Reparaciones y conservacion',1,0,0),('6220000001',1,'Reparación-Informatica',1,0,0),('6220000001',4,'Reparacion y mantenimiento informatica',1,0,0),('6220000003',1,'Reparación-Vehiculos',1,0,0),('6220000004',1,'Reparación-Instalaciones',1,0,0),('6220000005',1,'Reparación y mantenimineto CCs',1,0,0),('6220000006',1,'Repracion y conser maquinaria',1,0,0),('6230000000',1,'Servicios de profesionales independientes',1,0,0),('6230000000',4,'Servicio de profesionales',0,0,0),('6230000000',6,'Servicios de profesionales',1,0,0),('6230000001',1,'Servicios por gestión de ventas',1,0,0),('6230000001',4,'Servicios por gestión de ventas',1,0,0),('6240000000',1,'Transportes de ventas rutas',1,0,0),('6240000000',4,'Transportes de ventas',1,0,0),('6240000001',1,'Transporte ventas agencias',1,0,0),('6240000002',1,'Transporte ventas reclamaciones',1,0,0),('6240000567',1,'Transporte ventas VNH',1,0,0),('6250000000',1,'Primas de seguros',1,0,0),('6250000000',4,'Prima de Seguros',1,0,0),('6250000001',1,'Primas de seguros-Personales',1,0,0),('6250000002',1,'Primas de seguros-Colectivos',1,0,0),('6250000003',1,'Primas de seguros-Vehiculos',1,0,0),('6250000004',1,'Primas de seguros-Inmuebles',1,0,0),('6250000567',0,'Seguros VNH',1,0,0),('6260000000',1,'Gastos bancarios',1,0,0),('6260000000',4,'Gastos bancarios',0,0,0),('6260000000',6,'Gastos bancarios',1,0,0),('6260000001',1,'Gastos bancarios datafono',1,0,0),('6260000002',1,'Gastos bancarios transferencia nacional',1,0,0),('6260000003',1,'Gastos bancarios transferencia Europa',1,0,0),('6260000004',1,'Gastos bancarios transferencia divisas',1,0,0),('6260000567',0,'Gastos bancarios VNH',1,0,0),('6270000000',1,'Publicidad y RRPP',1,0,0),('6270000000',3,'Publicidad, propaganda y RR PP',1,0,0),('6270000000',6,'Publicidad',1,0,0),('6270000000',14,'Publicidad, propaganda RRPP',1,0,0),('6270000001',1,'Patrocinio',0,0,0),('6280000000',1,'Suministros',1,0,0),('6280000001',1,'Telefonos',1,0,0),('6280000002',1,'Gasoil',1,0,0),('6280000003',1,'Suministros-Electricidad',1,0,0),('6280000004',1,'Internet',1,0,0),('6280000567',0,'Suministros VNH',1,0,0),('6280001567',0,'Suministros telefono VNH',1,0,0),('6280003567',0,'Suministro luz VNH',1,0,0),('6290000000',1,'Otros servicios',1,0,0),('6290000000',6,'Otros gastos varios',1,0,0),('6290000001',1,'Material de oficina',1,0,0),('6290000002',1,'Gastos en formacion',1,0,0),('6290000003',1,'Asesoria juridica',1,0,0),('6290000004',4,'Otros servicios UE',1,0,0),('6290000005',1,'Gastos varios-Correos',1,0,0),('6290000006',1,'Otros servicios extranjero',1,0,0),('6290000006',5,'Otros servicios extranjero',1,0,0),('6290000006',6,'Otros servicios extranjero',1,0,0),('6290000007',1,'Gastos pequeño material',1,0,0),('6290000007',3,'Compras pequeño material',1,0,0),('6290000007',6,'Pequeño material',1,0,0),('6290000008',1,'Gastos varios-uniformes personal',1,0,0),('6290000008',3,'Compra uniformes',1,0,0),('6290000009',1,'Gastos-CC Container',1,0,0),('6290000010',1,'Gastos formación clientes',1,0,0),('6290000012',1,'Gastos gestión contra-reembolsos',1,0,0),('6290000013',1,'Arrendamiento Vilassar',1,0,0),('6290000014',1,'Gasto laboral espresas ETT',1,0,0),('6290000015',1,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',3,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',6,'Gasto compra terminales moviles y similares',1,0,0),('6290000016',1,'Gasto gestión cobro ventas',1,0,0),('6290000553',1,'Gastos viaje administrador',1,0,0),('6290000553',4,'Gastos viaje administrador-gerente',1,0,0),('6290000553',6,'Gastos viaje administrador',1,0,0),('6290001000',1,'Gastos de viaje',1,0,0),('6290001000',4,'Gastos viajes otros departamentos',1,0,0),('6290001000',6,'Gastos viaje personal otros departamentos',1,0,0),('6290001001',1,'Gastos R.R.P.P. Gerente',1,0,0),('6290001002',1,'Gastos R.R.P.P. Comerciales',1,0,0),('6290001567',0,'Gastos material oficina',1,0,0),('6300000000',1,'Impuesto de sociedades',1,0,0),('6310000000',1,'Otros tributos',1,0,0),('6380000000',1,'Ajustes positivos s/b Bº',1,0,0),('6400000000',0,'Sueldos y salarios',1,0,0),('6400000000',1,'Salarios',0,0,0),('6400000001',0,'Productividad',1,0,0),('6400000567',0,'Salarios VNH',1,0,0),('6410000001',1,'Indemnizaciones',1,0,0),('6420000000',0,'Seguridad Social a cargo de la empresa',1,0,0),('6420000000',1,'Seguridad Social',0,0,0),('6490000000',1,'Otros gastos sociales',1,0,0),('6500000000',1,'Impagados definitivos',1,0,0),('6620000000',0,'Intereses Bancarios',1,0,0),('6620000001',1,'Intereses deudas a l/p',1,0,0),('6620000006',1,'Intereses deuda prestamo CRA',1,0,0),('6620000007',1,'Intereses La Caixa linea comercio exterior',1,0,0),('6620000007',16,'Intereses La Caixa Linea Comercio Exterior',0,0,0),('6620000008',1,'Intereses Prestamos Transolver 2016',1,0,0),('6620000011',1,'Intereses BBVA linea comercio exterior',1,0,0),('6620000014',1,'Intereses Prestamo BBVA',1,0,0),('6620000015',1,'Interés Póliza Deutsche Bank Comercio Exterior',0,0,0),('6620000023',1,'Intereses Bankinter Póliza Comercio Exterior',0,0,0),('6620002032',1,'Intereses Leaing Iveco',1,0,0),('6620002066',1,'Leasing Intereses Man',1,0,0),('6620002104',1,'Intereses Leasing La caixa 3 vehículos',1,0,0),('6660000000',1,'Perdidas en valores representativos de deuda a l/p',0,0,0),('6681000000',1,'Diferencia negativa tipo de cambio',1,0,0),('6681000000',4,'Diferencia negativa tipo de cambio',0,0,0),('6681000000',6,'Diferencia negativa tipo de cambio',1,0,0),('6681000567',0,'Diferencias de cambio VNH',1,0,0),('6690000000',1,'Otros gastos financieros',1,0,0),('6690000000',6,'Gastos financieros',1,0,0),('6720000000',16,'Perdidas procedentes de inversiones',0,0,0),('6780000000',1,'Gastos extraordinarios',1,0,0),('6780000001',1,'Gastos no deducibles',1,0,0),('6780000001',16,'Gasto no deducible',0,0,0),('6800000000',1,'Amortización inmovilizado intangible',1,0,0),('6800000001',0,'Amortizacion inmovilizado material',1,0,0),('6800000001',1,'Amortización del inmovilizado material',1,0,0),('6810000000',0,'Amortizaciones inmovilizado',1,0,0),('6810000000',1,'Amortizacion inmovilizado material',1,0,0),('7000000000',0,'Ventas',1,0,0),('7000000001',1,'Venta entre empresas',1,0,0),('7000010000',0,'Terceros Flor',1,0,0),('7000020000',0,'Terceros Planta',1,0,0),('7000030000',0,'Terceros Complementos',1,0,0),('7000040000',0,'Terceros Artificial',1,0,0),('7000050000',0,'Terceros Verdes',1,0,0),('7000060000',0,'Terceros Otros',1,0,0),('7000070000',0,'Terceros Confección',1,0,0),('7000080000',1,'Terceros Logística',1,0,0),('7001000000',1,'Mercaderia',1,0,1),('7001010000',0,'Grupo Flor',1,0,0),('7001020000',0,'Grupo Planta',1,0,0),('7001030000',0,'Grupo Complementos',1,0,0),('7001040000',0,'Grupo Artificial',1,0,0),('7001050000',0,'Grupo Verdes',1,0,0),('7001060000',0,'Grupo Otros',1,0,0),('7001070000',0,'Grupo Confección',1,0,0),('7001080000',1,'Grupo Logística',1,0,0),('7002010000',0,'Asociados Flor',1,0,0),('7002020000',0,'Asociados Planta',1,0,0),('7002030000',0,'Asociados Complementos',1,0,0),('7002040000',0,'Asociados Artificial',1,0,0),('7002050000',0,'Asociados Verdes',1,0,0),('7002060000',0,'Asociados Otros',1,0,0),('7002070000',0,'Asociados Confección',1,0,0),('7002080000',1,'Asociados Logística',1,0,0),('7040000000',1,'Embalajes',1,0,1),('7050000000',1,'Prestacion de servicios',1,0,1),('7400000000',1,'Subvenciones, donaciones a la explotacion',1,0,0),('7550000000',0,'Ingresos por serivicios al personal',1,0,0),('768,0',0,NULL,1,0,0),('7680000000',0,'Diferencias positivas de cambio',1,0,0),('7680000000',1,'Diferenica positiva tipo de cambio',1,0,0),('7680000000',4,'Diferenica positiva tipo de cambio',0,0,0),('7680000000',6,'Diferenica positiva tipo de cambio',1,0,0),('7690000000',1,'Otros ingresos financieros',1,0,0),('7710000000',20,'Beneficio procendente vta inm',1,0,0),('7780000000',1,'Ingresos excepcionales',1,0,0),('7780000000',16,'Ingreso extraordinario',0,0,0),('7780000001',1,'Indemnizaciones transporte',1,0,0),('7780000001',4,'Indemnizaciones agencias transporte',1,0,0),('7780000001',5,'Indemnizaciones agencias transporte',1,0,0),('7780000001',6,'Indemnizaciones transporte',1,0,0),('7940000000',1,'Reversión impagos',1,0,0),('7940000000',16,'Reversión impagos',0,0,0); +INSERT INTO `Gastos` VALUES ('2000000000',1,'Inmovilizado pendiente',1,0,0),('2000000000',3,'Compra de bienes de inmovilizado',1,0,0),('2600000000',1,'Fianzas',0,0,0),('4600000000',1,'Anticipos de remuneraciones',1,0,0),('4600000001',1,'Anticpos de remuneración',1,0,0),('4751000000',0,'Retenciones',0,1,0),('4751000000',1,'Retenciones',0,1,0),('4751000000',6,'Retencion',0,0,0),('4759000000',1,'Embargos salariales',1,0,0),('5200000006',1,'Deudas a c/p CRA',1,0,0),('5200000008',0,'Prestamo CP Transolver IVECO 269',1,0,0),('5200000008',1,'Prestamo Transolver 201600269',1,0,0),('5200000009',0,'Prestamo CP Transolver IVECO 270',1,0,0),('5200000009',1,'Prestamo Transolver 201600270',1,0,0),('5200000010',0,'Prestamo CP Transolver IVECO 271',1,0,0),('5200000010',1,'Prestamo Transolver 201600271',1,0,0),('5200000011',1,'Prestamo Transolver 339',0,0,0),('5200000012',1,'Prestamo Transolver 340',1,0,0),('5200000013',1,'Prestamo Transolver 341',1,0,0),('5200000014',1,'Prestamo a c/p BBVA 600.000€',1,0,0),('5200000022',1,'Linea comercio exterior',1,0,0),('5240000001',1,'Leasing BBVA',1,0,0),('5240002032',1,'Leasing Iveco',1,0,0),('5240002066',1,'Leasing c/p Man',1,0,0),('5240002104',1,'Leasing c/p La caixa 3 vehículos',1,0,0),('5325000003',6,'Prestamo a partes vinculadas',0,0,0),('5420000001',1,'Prestamo concedido',1,0,0),('5650000001',1,'Fianza c/p vehiculo',0,0,0),('5660000001',1,'Suplidos',0,0,0),('5660000001',20,'Suplidos',1,0,0),('5660000002',0,'Suplidos',0,0,0),('5660000002',1,'Suplidos Transitarios nacionales',1,0,0),('5660000003',1,'Deposito c/p Ebury',1,0,0),('5660000003',4,'Deposito Ebury',0,0,0),('5660000004',4,'Deposito Global Reach',0,0,0),('6001000000',1,'Compras a terceros nacional',1,0,0),('6001000000',18,'Compras a terceros nacional',1,0,0),('6001000000',19,'Compras a terceros nacional',1,0,0),('6001000001',1,'Adquisiones en Europa',0,0,0),('6001000001',3,'Adquisición en Europa',1,0,0),('6002000000',1,'Transportes de compras',1,0,0),('6002000001',1,'Tranportes de compra Europa',1,0,0),('6002000001',4,'Transportes de compras Europa',1,0,0),('6002000567',0,'Transporte de compras VNH',1,0,0),('6003000000',1,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',5,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000000',6,'Adquisición mercancia Extracomunitaria',1,0,0),('6003000567',0,'Compra de mercancia extracomunitaria VNH',1,0,0),('6004000000',1,'Transporte compras Sudamérica',1,0,0),('6004000000',4,'Transporte compras Sudamérica',1,0,0),('6004000000',6,'Transporte compras Sudamérica',1,0,0),('6010000000',1,'Materias primas',1,0,0),('6020000000',1,'Otros aprovisionamientos',1,0,0),('6020000001',1,'Embalajes',1,0,0),('6020000002',1,'Otros aprov. Taller artíficial',1,0,0),('6070000000',1,'Trabajos de produccion encargados a terceros',1,0,0),('6090000000',6,'Rappels por compras',1,0,0),('6100000000',0,'Variacion existencias',1,0,0),('6210000000',1,'Arrendamientos',1,0,0),('6210000001',1,'Arrendamiento vehículo',1,0,0),('6210000001',4,'Gastos de arrendamiento vehículos',1,0,0),('6210000002',1,'Arrendamiento nave',1,0,0),('6210000003',1,'Arrendamiento espacio virtual-informatic',1,0,0),('6210000004',1,'Arrendamiento elementos para el proceso de informa',1,0,0),('6210000005',1,'Arrendamiento CC y banddejas',1,0,0),('6210000567',0,'Alquiler VNH',1,0,0),('6220000000',1,'Reparaciones y conservacion',1,0,0),('6220000001',1,'Reparación-Informatica',1,0,0),('6220000001',4,'Reparacion y mantenimiento informatica',1,0,0),('6220000003',1,'Reparación-Vehiculos',1,0,0),('6220000004',1,'Reparación-Instalaciones',1,0,0),('6220000005',1,'Reparación y mantenimineto CCs',1,0,0),('6220000006',1,'Repracion y conser maquinaria',1,0,0),('6230000000',1,'Servicios de profesionales independientes',1,0,0),('6230000000',4,'Servicio de profesionales',0,0,0),('6230000000',6,'Servicios de profesionales',1,0,0),('6230000001',1,'Servicios por gestión de ventas',1,0,0),('6230000001',4,'Servicios por gestión de ventas',1,0,0),('6240000000',1,'Transportes de ventas rutas',1,0,0),('6240000000',4,'Transportes de ventas',1,0,0),('6240000001',1,'Transporte ventas agencias',1,0,0),('6240000002',1,'Transporte ventas reclamaciones',1,0,0),('6240000567',1,'Transporte ventas VNH',1,0,0),('6250000000',1,'Primas de seguros',1,0,0),('6250000000',4,'Prima de Seguros',1,0,0),('6250000001',1,'Primas de seguros-Personales',1,0,0),('6250000002',1,'Primas de seguros-Colectivos',1,0,0),('6250000003',1,'Primas de seguros-Vehiculos',1,0,0),('6250000004',1,'Primas de seguros-Inmuebles',1,0,0),('6250000567',0,'Seguros VNH',1,0,0),('6260000000',1,'Gastos bancarios',1,0,0),('6260000000',4,'Gastos bancarios',0,0,0),('6260000000',6,'Gastos bancarios',1,0,0),('6260000001',1,'Gastos bancarios datafono',1,0,0),('6260000002',1,'Gastos bancarios transferencia nacional',1,0,0),('6260000003',1,'Gastos bancarios transferencia Europa',1,0,0),('6260000004',1,'Gastos bancarios transferencia divisas',1,0,0),('6260000567',0,'Gastos bancarios VNH',1,0,0),('6270000000',1,'Publicidad y RRPP',1,0,0),('6270000000',3,'Publicidad, propaganda y RR PP',1,0,0),('6270000000',6,'Publicidad',1,0,0),('6270000000',14,'Publicidad, propaganda RRPP',1,0,0),('6270000001',1,'Patrocinio',0,0,0),('6280000000',1,'Suministros',1,0,0),('6280000001',1,'Telefonos',1,0,0),('6280000002',1,'Gasoil',1,0,0),('6280000003',1,'Suministros-Electricidad',1,0,0),('6280000004',1,'Internet',1,0,0),('6280000567',0,'Suministros VNH',1,0,0),('6280001567',0,'Suministros telefono VNH',1,0,0),('6280003567',0,'Suministro luz VNH',1,0,0),('6290000000',1,'Otros servicios',1,0,0),('6290000000',6,'Otros gastos varios',1,0,0),('6290000001',1,'Material de oficina',1,0,0),('6290000002',1,'Gastos en formacion',1,0,0),('6290000003',1,'Asesoria juridica',1,0,0),('6290000004',4,'Otros servicios UE',1,0,0),('6290000005',1,'Gastos varios-Correos',1,0,0),('6290000006',1,'Otros servicios extranjero',1,0,0),('6290000006',5,'Otros servicios extranjero',1,0,0),('6290000006',6,'Otros servicios extranjero',1,0,0),('6290000007',1,'Gastos pequeño material',1,0,0),('6290000007',3,'Compras pequeño material',1,0,0),('6290000007',6,'Pequeño material',1,0,0),('6290000008',1,'Gastos varios-uniformes personal',1,0,0),('6290000008',3,'Compra uniformes',1,0,0),('6290000009',1,'Gastos-CC Container',1,0,0),('6290000010',1,'Gastos formación clientes',1,0,0),('6290000012',1,'Gastos gestión contra-reembolsos',1,0,0),('6290000013',1,'Arrendamiento Vilassar',1,0,0),('6290000014',1,'Gasto laboral espresas ETT',1,0,0),('6290000015',1,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',3,'Gasto compra terminales moviles y similares',1,0,0),('6290000015',6,'Gasto compra terminales moviles y similares',1,0,0),('6290000016',1,'Gasto gestión cobro ventas',1,0,0),('6290000553',1,'Gastos viaje administrador',1,0,0),('6290000553',4,'Gastos viaje administrador-gerente',1,0,0),('6290000553',6,'Gastos viaje administrador',1,0,0),('6290001000',1,'Gastos de viaje',1,0,0),('6290001000',4,'Gastos viajes otros departamentos',1,0,0),('6290001000',6,'Gastos viaje personal otros departamentos',1,0,0),('6290001001',1,'Gastos R.R.P.P. Gerente',1,0,0),('6290001002',1,'Gastos R.R.P.P. Comerciales',1,0,0),('6290001567',0,'Gastos material oficina',1,0,0),('6300000000',1,'Impuesto de sociedades',1,0,0),('6310000000',1,'Otros tributos',1,0,0),('6380000000',1,'Ajustes positivos s/b Bº',1,0,0),('6400000000',0,'Sueldos y salarios',1,0,0),('6400000000',1,'Salarios',0,0,0),('6400000001',0,'Productividad',1,0,0),('6400000567',0,'Salarios VNH',1,0,0),('6410000001',1,'Indemnizaciones',1,0,0),('6420000000',0,'Seguridad Social a cargo de la empresa',1,0,0),('6420000000',1,'Seguridad Social',0,0,0),('6490000000',1,'Otros gastos sociales',1,0,0),('6500000000',1,'Impagados definitivos',1,0,0),('6620000000',0,'Intereses Bancarios',1,0,0),('6620000001',1,'Intereses deudas a l/p',1,0,0),('6620000006',1,'Intereses deuda prestamo CRA',1,0,0),('6620000007',1,'Intereses La Caixa linea comercio exterior',1,0,0),('6620000007',16,'Intereses La Caixa Linea Comercio Exterior',0,0,0),('6620000008',1,'Intereses Prestamos Transolver 2016',1,0,0),('6620000011',1,'Intereses BBVA linea comercio exterior',1,0,0),('6620000014',1,'Intereses Prestamo BBVA',1,0,0),('6620000015',1,'Interés Póliza Deutsche Bank Comercio Exterior',0,0,0),('6620000023',1,'Intereses Bankinter Póliza Comercio Exterior',0,0,0),('6620002032',1,'Intereses Leaing Iveco',1,0,0),('6620002066',1,'Leasing Intereses Man',1,0,0),('6620002104',1,'Intereses Leasing La caixa 3 vehículos',1,0,0),('6660000000',1,'Perdidas en valores representativos de deuda a l/p',0,0,0),('6681000000',1,'Diferencia negativa tipo de cambio',1,0,0),('6681000000',4,'Diferencia negativa tipo de cambio',0,0,0),('6681000000',6,'Diferencia negativa tipo de cambio',1,0,0),('6681000567',0,'Diferencias de cambio VNH',1,0,0),('6690000000',1,'Otros gastos financieros',1,0,0),('6690000000',6,'Gastos financieros',1,0,0),('6720000000',16,'Perdidas procedentes de inversiones',0,0,0),('6780000000',1,'Gastos extraordinarios',1,0,0),('6780000001',1,'Gastos no deducibles',1,0,0),('6780000001',16,'Gasto no deducible',0,0,0),('6800000000',1,'Amortización inmovilizado intangible',1,0,0),('6800000001',0,'Amortizacion inmovilizado material',1,0,0),('6800000001',1,'Amortización del inmovilizado material',1,0,0),('6810000000',0,'Amortizaciones inmovilizado',1,0,0),('6810000000',1,'Amortizacion inmovilizado material',1,0,0),('7000000000',0,'Ventas',1,0,0),('7000000001',1,'Venta entre empresas',1,0,0),('7000010000',0,'Terceros Flor',1,0,0),('7000020000',0,'Terceros Planta',1,0,0),('7000030000',0,'Terceros Complementos',1,0,0),('7000040000',0,'Terceros Artificial',1,0,0),('7000050000',0,'Terceros Verdes',1,0,0),('7000060000',0,'Terceros Otros',1,0,0),('7000070000',0,'Terceros Confección',1,0,0),('7000080000',1,'Terceros Logística',1,0,0),('7001000000',1,'Mercaderia',1,0,1),('7001010000',0,'Grupo Flor',1,0,0),('7001020000',0,'Grupo Planta',1,0,0),('7001030000',0,'Grupo Complementos',1,0,0),('7001040000',0,'Grupo Artificial',1,0,0),('7001050000',0,'Grupo Verdes',1,0,0),('7001060000',0,'Grupo Otros',1,0,0),('7001070000',0,'Grupo Confección',1,0,0),('7001080000',1,'Grupo Logística',1,0,0),('7002010000',0,'Asociados Flor',1,0,0),('7002020000',0,'Asociados Planta',1,0,0),('7002030000',0,'Asociados Complementos',1,0,0),('7002040000',0,'Asociados Artificial',1,0,0),('7002050000',0,'Asociados Verdes',1,0,0),('7002060000',0,'Asociados Otros',1,0,0),('7002070000',0,'Asociados Confección',1,0,0),('7002080000',1,'Asociados Logística',1,0,0),('7040000000',1,'Embalajes',1,0,1),('7050000000',1,'Prestacion de servicios',1,0,1),('7400000000',1,'Subvenciones, donaciones a la explotacion',1,0,0),('7550000000',0,'Ingresos por serivicios al personal',1,0,0),('7620000000',16,'Intereses de créditos a l/p',1,0,0),('768,0',0,NULL,1,0,0),('7680000000',0,'Diferencias positivas de cambio',1,0,0),('7680000000',1,'Diferenica positiva tipo de cambio',1,0,0),('7680000000',4,'Diferenica positiva tipo de cambio',0,0,0),('7680000000',6,'Diferenica positiva tipo de cambio',1,0,0),('7690000000',1,'Otros ingresos financieros',1,0,0),('7710000000',20,'Beneficio procendente vta inm',1,0,0),('7780000000',1,'Ingresos excepcionales',1,0,0),('7780000000',16,'Ingreso extraordinario',0,0,0),('7780000001',1,'Indemnizaciones transporte',1,0,0),('7780000001',4,'Indemnizaciones agencias transporte',1,0,0),('7780000001',5,'Indemnizaciones agencias transporte',1,0,0),('7780000001',6,'Indemnizaciones transporte',1,0,0),('7940000000',1,'Reversión impagos',1,0,0),('7940000000',16,'Reversión impagos',0,0,0); /*!40000 ALTER TABLE `Gastos` ENABLE KEYS */; UNLOCK TABLES; @@ -316,7 +316,7 @@ UNLOCK TABLES; LOCK TABLES `escritos` WRITE; /*!40000 ALTER TABLE `escritos` DISABLE KEYS */; -INSERT INTO `escritos` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',1,'0'),(2,'Carta_2','Reiteracion de aviso por saldo deudor',1,'0'),(3,'Cred_Up','Notificación de aumento de crédito',0,'0'),(4,'Cred_down','Notificación de reducción de crédito',0,'0'),(5,'Pet_CC','Petición de datos bancarios B2B',0,'0'),(6,'SolCredito','Solicitud de crédito',0,'0'),(7,'LeyPago','Ley de pagos',0,'0'),(8,'Pet_CC_Core','Petición de datos bancarios CORE',1,'0'),(9,'nueva_alta','Documento de nueva alta de cliente',0,'0'),(10,'client_welcome','Email de bienvenida para nuevo cliente',1,'0'),(11,'setup_printer','Email de instalación de impresora',1,'0'),(12,'client-welcome','Email de bienvenida como nuevo cliente.',0,'0'),(13,'printer-setup','Email de instalación y configuración de impresora de coronas.',0,'0'),(14,'sepa-core','Email de solicitud de datos bancarios core.',0,'1'),(15,'letter-debtor-st','Email de aviso inicial por saldo deudor',0,'1'),(16,'letter-debtor-nd','Email de aviso reiterado por saldo deudor',0,'1'); +INSERT INTO `escritos` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',0,'0'),(2,'Carta_2','Reiteracion de aviso por saldo deudor',0,'0'),(3,'Cred_Up','Notificación de aumento de crédito',0,'0'),(4,'Cred_down','Notificación de reducción de crédito',0,'0'),(5,'Pet_CC','Petición de datos bancarios B2B',0,'0'),(6,'SolCredito','Solicitud de crédito',0,'0'),(7,'LeyPago','Ley de pagos',0,'0'),(8,'Pet_CC_Core','Petición de datos bancarios CORE',0,'0'),(9,'nueva_alta','Documento de nueva alta de cliente',0,'0'),(10,'client_welcome','Email de bienvenida para nuevo cliente',0,'0'),(11,'setup_printer','Email de instalación de impresora',0,'0'),(12,'client-welcome','Email de bienvenida como nuevo cliente',1,'0'),(13,'printer-setup','Email de instalación y configuración de impresora de coronas',1,'0'),(14,'sepa-core','Email de solicitud de datos bancarios core',1,'1'),(15,'letter-debtor-st','Email de aviso inicial por saldo deudor',1,'1'),(16,'letter-debtor-nd','Email de aviso reiterado por saldo deudor',1,'1'); /*!40000 ALTER TABLE `escritos` ENABLE KEYS */; UNLOCK TABLES; @@ -376,7 +376,7 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,'VERDNATURA',1,52,1,0,NULL,NULL,NULL,NULL,0),(22,'COMPRAS',29,30,NULL,72,49,596,2,5,0),(23,'CAMARA',23,23,NULL,72,49,604,2,6,0),(31,'INFORMATICA',40,41,NULL,72,44,127,3,9,0),(34,'CONTABILIDAD',35,36,NULL,0,NULL,NULL,NULL,NULL,0),(35,'FINANZAS',33,34,NULL,0,NULL,NULL,NULL,NULL,0),(36,'LABORAL',37,38,NULL,0,NULL,NULL,NULL,NULL,0),(37,'PRODUCCION',42,49,NULL,72,44,230,3,11,0),(38,'SACADO',47,48,NULL,72,37,230,4,14,1),(39,'ENCAJADO',45,46,NULL,72,37,230,4,12,1),(40,'CONTROLADORES',43,44,NULL,72,37,619,4,13,0),(41,'ADMINISTRACION',32,39,NULL,72,44,599,3,8,0),(42,'COMERCIAL',26,31,NULL,72,49,1002,2,3,0),(43,'VENTAS',27,28,NULL,0,NULL,NULL,NULL,NULL,0),(44,'GERENCIA',24,25,NULL,72,49,300,2,7,0),(45,'LOGISTICA',18,45,NULL,72,44,596,3,19,0),(46,'REPARTO',21,22,NULL,72,44,659,3,10,0),(47,'CARGA',15,16,NULL,0,NULL,NULL,NULL,NULL,0),(48,'ALMACENAJE',12,17,NULL,0,NULL,NULL,NULL,NULL,0),(49,'PROPIEDAD',10,11,NULL,72,NULL,1008,1,1,0),(51,'DESCARGA',13,14,NULL,0,NULL,NULL,NULL,NULL,0),(52,'CARGA AEREA',19,20,NULL,72,66,163,4,28,0),(53,'MARKETING Y COMUNICACIÓN',50,51,NULL,72,44,1238,0,0,0),(54,'ORNAMENTALES',54,54,NULL,72,44,433,3,21,0),(55,'TALLER Y CONFECCION',4,9,NULL,72,49,695,2,23,0),(56,'TALLER ARTIFICIAL',7,8,NULL,72,49,1780,2,24,0),(57,'SECO',5,6,NULL,0,NULL,NULL,NULL,NULL,0),(58,'CAMPOS',2,3,NULL,72,49,225,2,2,0),(59,'MANTENIMIENTO',52,53,NULL,72,37,230,4,16,0),(60,'RECLAMACIONES',60,60,NULL,72,42,563,3,20,0),(61,'VNH',61,61,NULL,73,44,1297,3,17,0),(63,'VENTAS FRANCIA',63,63,NULL,72,49,277,2,27,0),(64,'PLANTAS',64,64,NULL,72,49,617,2,25,0),(66,'VERDNAMADRID',66,66,NULL,72,44,163,3,18,0),(68,'COMPLEMENTOS',68,68,NULL,72,64,617,3,26,0),(69,'VERDNABARNA',69,69,NULL,74,44,432,3,22,0),(77,'PALETIZADO',77,77,NULL,72,37,230,4,15,1),(80,'EQUIPO J VALLES',80,80,NULL,72,42,693,3,4,0),(86,'LIMPIEZA',86,86,NULL,72,44,599,0,0,0),(88,'CONTROL',88,88,NULL,0,NULL,NULL,NULL,NULL,0),(89,'COORDINACION',89,89,NULL,0,NULL,NULL,NULL,NULL,1); +INSERT INTO `department` VALUES (1,'VERDNATURA',1,52,1,0,NULL,NULL,NULL,NULL,0,0),(22,'COMPRAS',29,30,NULL,72,49,596,2,5,0,0),(23,'CAMARA',23,23,NULL,72,49,604,2,6,0,0),(31,'INFORMATICA',40,41,NULL,72,44,127,3,9,0,0),(34,'CONTABILIDAD',35,36,NULL,0,NULL,NULL,NULL,NULL,0,0),(35,'FINANZAS',33,34,NULL,0,NULL,NULL,NULL,NULL,0,0),(36,'LABORAL',37,38,NULL,0,NULL,NULL,NULL,NULL,0,0),(37,'PRODUCCION',42,49,NULL,72,44,230,3,11,0,0),(38,'SACADO',47,48,NULL,72,37,230,4,14,1,0),(39,'ENCAJADO',45,46,NULL,72,37,230,4,12,1,0),(40,'CONTROLADORES',43,44,NULL,72,37,619,4,13,0,0),(41,'ADMINISTRACION',32,39,NULL,72,44,599,3,8,0,0),(42,'COMERCIAL',26,31,NULL,72,49,1002,2,3,0,0),(43,'VENTAS',27,28,NULL,0,NULL,NULL,NULL,NULL,0,0),(44,'GERENCIA',24,25,NULL,72,49,300,2,7,0,0),(45,'LOGISTICA',18,45,NULL,72,44,596,3,19,0,0),(46,'REPARTO',21,22,NULL,72,44,659,3,10,0,0),(47,'CARGA',15,16,NULL,0,NULL,NULL,NULL,NULL,0,0),(48,'ALMACENAJE',12,17,NULL,0,NULL,NULL,NULL,NULL,0,0),(49,'PROPIEDAD',10,11,NULL,72,NULL,1008,1,1,0,0),(51,'DESCARGA',13,14,NULL,0,NULL,NULL,NULL,NULL,0,0),(52,'CARGA AEREA',19,20,NULL,72,66,163,4,28,0,0),(53,'MARKETING Y COMUNICACIÓN',50,51,NULL,72,44,1238,0,0,0,0),(54,'ORNAMENTALES',54,54,NULL,72,44,433,3,21,0,2),(55,'TALLER Y CONFECCION',4,9,NULL,72,49,695,2,23,0,0),(56,'TALLER ARTIFICIAL',7,8,NULL,72,49,1780,2,24,0,0),(57,'SECO',5,6,NULL,0,NULL,NULL,NULL,NULL,0,0),(58,'CAMPOS',2,3,NULL,72,49,225,2,2,0,0),(59,'MANTENIMIENTO',52,53,NULL,72,37,230,4,16,0,1),(60,'RECLAMACIONES',60,60,NULL,72,42,563,3,20,0,2),(61,'VNH',61,61,NULL,73,44,1297,3,17,0,2),(63,'VENTAS FRANCIA',63,63,NULL,72,49,277,2,27,0,2),(64,'PLANTAS',64,64,NULL,72,49,617,2,25,0,2),(66,'VERDNAMADRID',66,66,NULL,72,44,163,3,18,0,0),(68,'COMPLEMENTOS',68,68,NULL,72,64,617,3,26,0,0),(69,'VERDNABARNA',69,69,NULL,74,44,432,3,22,0,0),(77,'PALETIZADO',77,77,NULL,72,37,230,4,15,1,0),(80,'EQUIPO J VALLES',80,80,NULL,72,42,693,3,4,0,0),(86,'LIMPIEZA',86,86,NULL,72,44,599,0,0,0,0),(88,'CONTROL',88,88,NULL,0,NULL,NULL,NULL,NULL,0,0),(89,'COORDINACION',89,89,NULL,0,NULL,NULL,NULL,NULL,1,0); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; @@ -399,7 +399,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-02-25 8:31:27 USE `bi`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -447,7 +447,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:43 +-- Dump completed on 2019-02-25 8:31:27 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -485,7 +485,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:44 +-- Dump completed on 2019-02-25 8:31:27 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -543,7 +543,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:44 +-- Dump completed on 2019-02-25 8:31:27 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64) -- @@ -618,7 +618,7 @@ UNLOCK TABLES; LOCK TABLES `workcenter` WRITE; /*!40000 ALTER TABLE `workcenter` DISABLE KEYS */; -INSERT INTO `workcenter` VALUES (1,'Silla',20,860,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20006,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2843,5),(6,'Vilassar',88,88014,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,NULL,NULL); +INSERT INTO `workcenter` VALUES (1,'Silla',20,861,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20006,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2843,5),(6,'Vilassar',88,88014,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,NULL,NULL); /*!40000 ALTER TABLE `workcenter` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -631,4 +631,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:09:44 +-- Dump completed on 2019-02-25 8:31:27 diff --git a/services/db/install/dump/structure.sql b/services/db/install/dump/structure.sql index f6428ba5c..87eac7dd2 100644 --- a/services/db/install/dump/structure.sql +++ b/services/db/install/dump/structure.sql @@ -363,7 +363,7 @@ CREATE TABLE `user` ( KEY `nickname` (`nickname`), KEY `lang` (`lang`), CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=15171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; +) ENGINE=InnoDB AUTO_INCREMENT=15235 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2440,7 +2440,7 @@ CREATE TABLE `Agencias` ( PRIMARY KEY (`Id_Agencia`), KEY `Agencias` (`Agencia`), KEY `Vista` (`Vista`) -) ENGINE=InnoDB AUTO_INCREMENT=1220 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1221 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2459,7 +2459,7 @@ CREATE TABLE `Agencias_dits` ( `value_old` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `value_new` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`idAgencia_dits`) -) ENGINE=InnoDB AUTO_INCREMENT=33528 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=33842 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2577,7 +2577,7 @@ CREATE TABLE `Articles` ( CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE, CONSTRAINT `producer_id` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=337333 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=339073 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2759,7 +2759,7 @@ CREATE TABLE `Articles_dits` ( KEY `fgkey1_idx` (`idaccion_dits`), KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`) -) ENGINE=InnoDB AUTO_INCREMENT=21135 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=21234 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2782,7 +2782,7 @@ CREATE TABLE `Articles_nicho` ( KEY `Articles_nicho_wh_fk` (`warehouse_id`), CONSTRAINT `Articles_nicho_wh_fk` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Articles_nichos_fk` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=673960 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=684547 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2908,7 +2908,7 @@ CREATE TABLE `Cajas` ( KEY `warehouse_id` (`warehouse_id`), KEY `fk_Cajas_Proveedores_account1_idx` (`Proveedores_account_Id`), CONSTRAINT `Cajas_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=658894 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=662913 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3040,7 +3040,7 @@ CREATE TABLE `Clientes` ( CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`chanel_id`) REFERENCES `chanel` (`chanel_id`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientes_tipo_id`) REFERENCES `clientes_tipo` (`clientes_tipo_id`) ON UPDATE CASCADE, CONSTRAINT `typeFk` FOREIGN KEY (`typeFk`) REFERENCES `clientes_tipo` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=15171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15235 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3202,7 +3202,7 @@ CREATE TABLE `Clientes_cedidos` ( CONSTRAINT `cliente_cedido_fk` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `new_trabajador_fk` FOREIGN KEY (`Id_Trabajador_new`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `trabajador_fk` FOREIGN KEY (`Id_Trabajador_old`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Clientes que se han cambiado de comercial, pero durante un tiempo comisionan a los dos, al anterior y al actual'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Clientes que se han cambiado de comercial, pero durante un tiempo comisionan a los dos, al anterior y al actual'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3323,7 +3323,7 @@ CREATE TABLE `Colas` ( CONSTRAINT `Colas_ibfk_3` FOREIGN KEY (`Id_Prioridad`) REFERENCES `Prioridades` (`Id_Prioridad`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_4` FOREIGN KEY (`Id_Impresora`) REFERENCES `Impresoras` (`Id_Impresora`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_5` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=115904 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3405,7 +3405,7 @@ CREATE TABLE `Compres` ( CONSTRAINT `Compres_ibfk_2` FOREIGN KEY (`Id_Cubo`) REFERENCES `Cubos` (`Id_Cubo`) ON UPDATE CASCADE, CONSTRAINT `Compres_ibfk_3` FOREIGN KEY (`container_id`) REFERENCES `container` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_id` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=292012599 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=294584200 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3650,7 +3650,7 @@ CREATE TABLE `Compres_ok` ( KEY `Id_Movimiento` (`Id_Compra`), KEY `Id_Accion` (`Id_Accion`), CONSTRAINT `Compres_ok_ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=27726 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=27956 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3694,7 +3694,7 @@ CREATE TABLE `Consignatarios` ( CONSTRAINT `Consignatarios_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE, CONSTRAINT `Consignatarios_ibfk_4` FOREIGN KEY (`Id_Agencia`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `address_customer_id` FOREIGN KEY (`Id_cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=26728 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26827 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3878,7 +3878,7 @@ CREATE TABLE `Contactos` ( PRIMARY KEY (`Id_Contacto`), KEY `Telefono` (`Telefono`), KEY `Movil` (`Movil`) -) ENGINE=InnoDB AUTO_INCREMENT=2684 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2687 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4075,7 +4075,7 @@ CREATE TABLE `Entradas` ( CONSTRAINT `Entradas_ibfk_1` FOREIGN KEY (`Id_Proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_6` FOREIGN KEY (`travel_id`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_7` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=160393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; +) ENGINE=InnoDB AUTO_INCREMENT=161274 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4236,7 +4236,7 @@ CREATE TABLE `Entradas_dits` ( CONSTRAINT `Entradas_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgkey_entradas_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fgkey_entradas_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3329258 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3355095 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4254,7 +4254,7 @@ CREATE TABLE `Entradas_kop` ( PRIMARY KEY (`Id_Entradas_kop`), KEY `entradas_entradas_kop_idx` (`Id_Entrada`), CONSTRAINT `entradas_entradas_kop` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=857 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB AUTO_INCREMENT=949 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4342,7 +4342,7 @@ CREATE TABLE `Equipos` ( PRIMARY KEY (`id`), KEY `trabajador_id` (`trabajador_id`), CONSTRAINT `Equipos_ibfk_1` FOREIGN KEY (`trabajador_id`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=178 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=194 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4498,7 +4498,7 @@ CREATE TABLE `Facturas` ( CONSTRAINT `Facturas_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `vn`.`cplusTaxBreak` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_bank_id` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `invoice_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=486085 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=486326 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4677,7 +4677,7 @@ CREATE TABLE `Greuges` ( KEY `Id_Ticket_Greuge_Ticket_idx` (`Id_Ticket`), CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `greuges_type_fk` FOREIGN KEY (`Greuges_type_id`) REFERENCES `Greuges_type` (`Greuges_type_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2793071 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; +) ENGINE=InnoDB AUTO_INCREMENT=2812086 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4878,7 +4878,7 @@ CREATE TABLE `Movimientos` ( KEY `itemFk_ticketFk` (`Id_Article`,`Id_Ticket`), CONSTRAINT `Movimientos_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON UPDATE CASCADE, CONSTRAINT `movement_ticket_id` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=23629103 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23718595 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5036,7 +5036,7 @@ CREATE TABLE `Movimientos_mark` ( KEY `Id_Movimiento` (`Id_Movimiento`), KEY `fgnStateFk_idx` (`stateFk`), CONSTRAINT `fgnStateFk` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14455299 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14671117 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5141,7 +5141,7 @@ CREATE TABLE `Ordenes` ( CONSTRAINT `fgnAtender` FOREIGN KEY (`atenderFk`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `fgnRequester` FOREIGN KEY (`requesterFk`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `fgnTicket` FOREIGN KEY (`ticketFk`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=38997 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=39329 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5245,7 +5245,7 @@ CREATE TABLE `Pagares` ( KEY `empresa_id` (`kk_empresa_id`), KEY `pago_id` (`pago_id`), CONSTRAINT `Pagares_ibfk_2` FOREIGN KEY (`pago_id`) REFERENCES `pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2858 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2860 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5371,7 +5371,7 @@ CREATE TABLE `Proveedores` ( CONSTRAINT `pay_dem_id` FOREIGN KEY (`pay_dem_id`) REFERENCES `pay_dem` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_met_id` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `province_id` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2697 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2706 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5397,7 +5397,7 @@ CREATE TABLE `Proveedores_account` ( KEY `fk_Proveedores_account_entity1_idx` (`entity_id`), KEY `fk_banco_prov_account_idx` (`Id_Banco`), CONSTRAINT `fk_banco_prov_account` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=719 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=727 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5488,7 +5488,7 @@ CREATE TABLE `Recibos` ( CONSTRAINT `Recibos_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Recibos_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibo_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=539445 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=541888 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5579,7 +5579,7 @@ CREATE TABLE `Relaciones` ( KEY `Id_Contacto` (`Id_Contacto`), KEY `Id_Proveedor` (`Id_Proveedor`), KEY `Id_Cliente` (`Id_Cliente`) -) ENGINE=InnoDB AUTO_INCREMENT=2683 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2686 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5599,7 +5599,7 @@ CREATE TABLE `Remesas` ( KEY `empresa_id` (`empresa_id`), CONSTRAINT `Remesas_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Remesas_ibfk_2` FOREIGN KEY (`Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1209 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1215 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5624,7 +5624,7 @@ CREATE TABLE `Reservas` ( PRIMARY KEY (`Id_Reserva`), KEY `Id_1` (`Id_Ticket`), KEY `Id_Article` (`Id_Article`) -) ENGINE=InnoDB AUTO_INCREMENT=815 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5655,7 +5655,7 @@ CREATE TABLE `Rutas` ( KEY `Fecha` (`Fecha`), KEY `gestdoc_id` (`gestdoc_id`), CONSTRAINT `Rutas_ibfk_1` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=47759 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=48213 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5717,7 +5717,7 @@ CREATE TABLE `Rutas_Master` ( PRIMARY KEY (`id`), KEY `fk_rutas_warehouse_id_idx` (`warehouse_id`), CONSTRAINT `fk_rutas_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5843,7 +5843,7 @@ CREATE TABLE `Split_lines` ( KEY `Id_Compra` (`Id_Compra`), CONSTRAINT `Id_Compra` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Split_lines_ibfk_1` FOREIGN KEY (`Id_Split`) REFERENCES `Splits` (`Id_Split`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=346405 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=346779 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5861,7 +5861,7 @@ CREATE TABLE `Splits` ( `Notas` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`Id_Split`), KEY `Id_Entrada` (`Id_Entrada`) -) ENGINE=InnoDB AUTO_INCREMENT=36541 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=36555 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5889,7 +5889,7 @@ CREATE TABLE `Stockcontrol` ( CONSTRAINT `Stockcontrol_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_2` FOREIGN KEY (`Id_Remitente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_3` FOREIGN KEY (`Id_Solver`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=23999 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=24022 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5947,7 +5947,7 @@ CREATE TABLE `Tickets` ( CONSTRAINT `Tickets_ibfk_9` FOREIGN KEY (`Id_Ruta`) REFERENCES `Rutas` (`Id_Ruta`) ON UPDATE CASCADE, CONSTRAINT `ticket_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `tickets_fk10` FOREIGN KEY (`Factura`) REFERENCES `Facturas` (`Id_Factura`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2141408 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2154348 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6050,7 +6050,7 @@ BEGIN IF vEmployee IS NULL THEN SET vEmployee = 20; END IF; - + /* -- Comprobación de VIES IF NEW.empresa_id <> OLD.empresa_id AND vn.getUser() != 2 THEN @@ -6069,7 +6069,7 @@ BEGIN END IF; END IF; - + */ IF NEW.Fecha < '2001-01-01' THEN @@ -6143,7 +6143,7 @@ CREATE TABLE `Tickets_dits` ( CONSTRAINT `Tickets_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgkey1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fgkey3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=64352595 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=64383332 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6224,7 +6224,7 @@ CREATE TABLE `Tickets_turno` ( `weekDay` tinyint(1) DEFAULT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6', PRIMARY KEY (`Id_Ticket`), CONSTRAINT `Id_Ticket_fk` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2124280 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2149105 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6293,7 +6293,7 @@ CREATE TABLE `Tipos` ( CONSTRAINT `Tipos_ibfk_2` FOREIGN KEY (`roleCodeFk`) REFERENCES `account`.`role` (`name`) ON UPDATE CASCADE, CONSTRAINT `Trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `warehouseFk5` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=240 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; +) ENGINE=InnoDB AUTO_INCREMENT=243 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6381,7 +6381,7 @@ CREATE TABLE `Trabajadores` ( KEY `sub` (`sub`), CONSTRAINT `Clientes` FOREIGN KEY (`Id_Cliente_Interno`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1247 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1248 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6508,7 +6508,7 @@ CREATE TABLE `Vehiculos` ( KEY `provinceFk_idx` (`warehouseFk`), CONSTRAINT `Vehiculos_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=417 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=418 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6534,7 +6534,7 @@ CREATE TABLE `Vehiculos_consumo` ( PRIMARY KEY (`Vehiculos_consumo_id`,`Id_Vehiculo`), KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`Id_Vehiculo`), CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`Id_Vehiculo`) REFERENCES `Vehiculos` (`Id_Vehiculo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10360 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; +) ENGINE=InnoDB AUTO_INCREMENT=10505 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6648,7 +6648,7 @@ CREATE TABLE `XDiario` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3659468 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3667051 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6756,7 +6756,7 @@ CREATE TABLE `account_conciliacion` ( KEY `fg_accconciliacion_key1_idx` (`Id_Proveedores_account`), KEY `index_id_calculated` (`id_calculated`), CONSTRAINT `fg_key1_accountconc` FOREIGN KEY (`Id_Proveedores_account`) REFERENCES `Proveedores_account` (`Id_Proveedores_account`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=18747 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=19697 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6923,7 +6923,7 @@ CREATE TABLE `agency_hour` ( CONSTRAINT `agency_hour_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `agency` (`agency_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5225 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5229 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -7089,7 +7089,7 @@ CREATE TABLE `albaran` ( CONSTRAINT `fk_albaran_empresa1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2973 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3001 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7167,7 +7167,7 @@ CREATE TABLE `awb` ( CONSTRAINT `awbInvoiceIn` FOREIGN KEY (`invoiceInFk`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `awbTransitoryFk` FOREIGN KEY (`transitario_id`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2998 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3020 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -7365,7 +7365,7 @@ CREATE TABLE `awb_component_template` ( CONSTRAINT `Id_Moneda` FOREIGN KEY (`Id_Moneda`) REFERENCES `Monedas` (`Id_Moneda`) ON UPDATE CASCADE, CONSTRAINT `awb_unit_fk1` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE, CONSTRAINT `role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=737 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=738 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7446,7 +7446,7 @@ CREATE TABLE `awb_gestdoc` ( KEY `awb_gestdoc_gestdoc_fk` (`gestdoc_id`), CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awb_id`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2632 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2652 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7544,6 +7544,7 @@ CREATE TABLE `balance_nest_tree` ( `name` text COLLATE utf8_unicode_ci, `id` int(11) NOT NULL AUTO_INCREMENT, `Id_Gasto` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `isSelected` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=392 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -7564,7 +7565,7 @@ CREATE TABLE `barcodes` ( UNIQUE KEY `Id_Article_2` (`Id_Article`,`code`), KEY `Id_Article` (`Id_Article`), CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=38538 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=38974 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7708,7 +7709,7 @@ CREATE TABLE `buy_edi` ( KEY `barcode` (`barcode`), KEY `fec` (`fec`), KEY `putOrderFk` (`putOrderFk`) -) ENGINE=InnoDB AUTO_INCREMENT=839432 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=847565 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7941,7 +7942,7 @@ CREATE TABLE `cl_act` ( CONSTRAINT `cl_act_ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_4` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=100107 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=101012 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7975,7 +7976,7 @@ CREATE TABLE `cl_cau` ( CONSTRAINT `cl_cau_ibfk_7` FOREIGN KEY (`cl_mot_id`) REFERENCES `cl_mot` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_8` FOREIGN KEY (`cl_con_id`) REFERENCES `cl_con` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_9` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=52199 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=52682 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8025,7 +8026,7 @@ CREATE TABLE `cl_det` ( KEY `cl_main_id` (`cl_main_id`), CONSTRAINT `cl_det_ibfk_7` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_det_ibfk_8` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=135632 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=136361 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8113,7 +8114,7 @@ CREATE TABLE `cl_main` ( CONSTRAINT `cl_main_ibfk_4` FOREIGN KEY (`cl_dep_id`) REFERENCES `cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_main_ibfk_5` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_main_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `Tickets` (`Id_Ticket`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=58936 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDB AUTO_INCREMENT=59436 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8229,7 +8230,7 @@ CREATE TABLE `client_observation` ( KEY `Id_Cliente` (`Id_Cliente`), CONSTRAINT `client_observation_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `client_observation_ibfk_2` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=71643 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=72114 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8397,7 +8398,7 @@ CREATE TABLE `consignatarios_observation` ( `text` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`consignatarios_observation_id`), UNIQUE KEY `Id_Consigna` (`Id_Consigna`,`observation_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=3592 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDB AUTO_INCREMENT=3636 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8441,7 +8442,7 @@ CREATE TABLE `cooler_path_detail` ( `pasillo` varchar(3) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`cooler_path_id`,`pasillo`), UNIQUE KEY `cooler_path_detail_id_UNIQUE` (`cooler_path_detail_id`) -) ENGINE=InnoDB AUTO_INCREMENT=719 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=721 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8479,7 +8480,7 @@ CREATE TABLE `credit` ( KEY `credit_ClienteFk` (`Id_Cliente`), CONSTRAINT `credit_ClienteFk` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workers_fk` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=72326 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=72941 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8587,6 +8588,7 @@ CREATE TABLE `department` ( `x` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, `production` tinyint(4) NOT NULL DEFAULT '0', + `isSelected` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`department_id`), UNIQUE KEY `lft_UNIQUE` (`lft`), UNIQUE KEY `rgt_UNIQUE` (`rgt`), @@ -8614,7 +8616,7 @@ CREATE TABLE `device` ( PRIMARY KEY (`device_id`), UNIQUE KEY `device_id_UNIQUE` (`device_id`), UNIQUE KEY `sn_UNIQUE` (`sn`) -) ENGINE=InnoDB AUTO_INCREMENT=294 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=289 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9004,7 +9006,7 @@ CREATE TABLE `escritos_det` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `escritos_det_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16913 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16994 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9034,7 +9036,7 @@ CREATE TABLE `expeditions` ( KEY `index4` (`ticket_id`), CONSTRAINT `Id_Agencia` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `ticket_id` FOREIGN KEY (`ticket_id`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2850506 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2869719 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9182,7 +9184,7 @@ CREATE TABLE `filtros` ( `sql` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `Estanteria` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=142 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9278,7 +9280,7 @@ CREATE TABLE `gestdoc` ( UNIQUE KEY `emp_id` (`emp_id`,`orden`,`warehouse_id`), KEY `trabajador_id` (`trabajador_id`), KEY `warehouse_id` (`warehouse_id`) -) ENGINE=InnoDB AUTO_INCREMENT=1164728 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; +) ENGINE=InnoDB AUTO_INCREMENT=1173730 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9477,7 +9479,7 @@ CREATE TABLE `intrastat_data` ( KEY `recibida` (`recibida_id`), CONSTRAINT `intrastat_data_ibfk_1` FOREIGN KEY (`intrastat_id`) REFERENCES `Intrastat` (`Codintrastat`) ON UPDATE CASCADE, CONSTRAINT `intrastat_data_ibfk_2` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=73083 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=73362 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9816,7 +9818,7 @@ CREATE TABLE `mail` ( `recipientFk` int(11) DEFAULT NULL, `plainTextBody` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1600775 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=1613146 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9874,7 +9876,7 @@ CREATE TABLE `mandato` ( CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`idmandato_tipo`) REFERENCES `mandato_tipo` (`idmandato_tipo`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16102 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16144 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10083,7 +10085,7 @@ CREATE TABLE `pago` ( CONSTRAINT `pago_moneda` FOREIGN KEY (`id_moneda`) REFERENCES `Monedas` (`Id_Moneda`) ON UPDATE CASCADE, CONSTRAINT `pago_pay_met` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `proveedor_pago` FOREIGN KEY (`id_proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=46747 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=47066 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10580,7 +10582,7 @@ CREATE TABLE `price_fixed` ( KEY `date_end` (`date_end`), KEY `warehouse_id` (`warehouse_id`), CONSTRAINT `price_fixed_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=60224 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=60563 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10642,7 +10644,7 @@ CREATE TABLE `producer` ( `visible` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`producer_id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=6650 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6983 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10811,7 +10813,7 @@ CREATE TABLE `recibida` ( CONSTRAINT `recibida_ibfk_5` FOREIGN KEY (`cplusInvoiceType472Fk`) REFERENCES `vn`.`cplusInvoiceType472` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_6` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `vn`.`cplusRectificationType` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_7` FOREIGN KEY (`cplusTrascendency472Fk`) REFERENCES `vn`.`cplusTrascendency472` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=77340 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=77748 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11400,7 +11402,7 @@ CREATE TABLE `recibida_iva` ( CONSTRAINT `recibida_iva_ibfk_2` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_5` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_6` FOREIGN KEY (`gastos_id`) REFERENCES `Gastos` (`Id_Gasto`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=119299 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=120822 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11423,7 +11425,7 @@ CREATE TABLE `recibida_vencimiento` ( KEY `banco_id` (`banco_id`), CONSTRAINT `recibida_vencimiento_ibfk_6` FOREIGN KEY (`banco_id`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibida_vencimiento_ibfk_7` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=116632 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=118216 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11466,7 +11468,7 @@ CREATE TABLE `recovery` ( KEY `cliente_idx` (`Id_Cliente`), CONSTRAINT `cliente333` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `cliente_cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=287 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; +) ENGINE=InnoDB AUTO_INCREMENT=290 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11647,7 +11649,7 @@ CREATE TABLE `scan` ( `name` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=82098 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; +) ENGINE=InnoDB AUTO_INCREMENT=83299 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11687,7 +11689,7 @@ CREATE TABLE `scan_line` ( PRIMARY KEY (`scan_line_id`), KEY `id_scan_id_idx` (`scan_id`), CONSTRAINT `id_scan_id` FOREIGN KEY (`scan_id`) REFERENCES `scan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1019910 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1033735 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11709,7 +11711,7 @@ CREATE TABLE `sharingcart` ( KEY `Suplent` (`Id_Suplente`), CONSTRAINT `Suplent_key` FOREIGN KEY (`Id_Suplente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `Trabajador_key` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1976 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1982 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11787,7 +11789,7 @@ CREATE TABLE `sharingclient` ( KEY `Client` (`Id_Cliente`), CONSTRAINT `Clients_key` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_key` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12165,7 +12167,7 @@ CREATE TABLE `ticket_observation` ( KEY `observation_type_id` (`observation_type_id`), CONSTRAINT `ticket_observation_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticket_observation_ibfk_2` FOREIGN KEY (`observation_type_id`) REFERENCES `observation_type` (`observation_type_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1272076 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=1282191 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12289,7 +12291,7 @@ CREATE TABLE `travel` ( CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouse_id_out`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_4` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `Proveedores_cargueras` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=123135 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=123995 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12426,7 +12428,7 @@ CREATE TABLE `travel_dits` ( KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`), CONSTRAINT `travel_dits_ibfk_1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=205491 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=207305 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12456,7 +12458,7 @@ CREATE TABLE `travel_pattern` ( CONSTRAINT `travel_pattern_ibfk_4` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `travel_pattern_ibfk_5` FOREIGN KEY (`warehouse_in`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_pattern_ibfk_6` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `Proveedores` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=338 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=339 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12984,6 +12986,22 @@ SET character_set_client = utf8; 1 AS `Fecha`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `v_descuadre_portekk` +-- + +DROP TABLE IF EXISTS `v_descuadre_portekk`; +/*!50001 DROP VIEW IF EXISTS `v_descuadre_portekk`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `v_descuadre_portekk` AS SELECT + 1 AS `Id_Ticket`, + 1 AS `suma_componente`, + 1 AS `teorico_agencia`, + 1 AS `diferencia`, + 1 AS `Fecha`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `v_empresa` -- @@ -13083,6 +13101,20 @@ SET character_set_client = utf8; 1 AS `Id_Ruta`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `v_expeditions_shipping_chargekk` +-- + +DROP TABLE IF EXISTS `v_expeditions_shipping_chargekk`; +/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_chargekk`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `v_expeditions_shipping_chargekk` AS SELECT + 1 AS `Id_Ticket`, + 1 AS `shipping_charge`, + 1 AS `Fecha`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `v_fallo` -- @@ -13786,7 +13818,7 @@ CREATE TABLE `workerTeam` ( PRIMARY KEY (`id`), KEY `user_team_idx` (`user`), CONSTRAINT `user_team` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=200 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -15182,7 +15214,7 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `paymentday`(vDated DATE, vDayToPay INT) RETURNS date BEGIN - +/* OBSOLETO usar vn.getDueDate(vDated DATE, vDayToPay INT)*/ DECLARE vDued DATE; SET vDued = vn.getDueDate(vDated, vDayToPay); @@ -16404,16 +16436,11 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `agencia_descuadre`(datSince DATE, datTo DATE, intAgency INT, intWarehouseAlias INT) BEGIN - - DECLARE isFile boolean; + DECLARE isFile boolean; DECLARE datTo2359 DATETIME; SET datTo2359 = util.dayEnd(datTo); - - SELECT SUM(price) INTO isFile FROM agencia_descuadre; - - IF NOT IFNULL(isFile,0) THEN - + SELECT t.Id_Ticket,0 AS Total_Agencia,t.Id_Consigna,t.empresa_id,t.warehouse_id, v.suma_componente AS VN, v.suma_componente - shipping_charge AS Difer, e.shipping_charge AS teorico,t.Id_Agencia, t.Bultos,t.Id_Cliente, ap.zona @@ -16433,35 +16460,7 @@ BEGIN JOIN Agencias_province ap ON ap.agency_id = a.agency_id AND ap.warehouse_id = t.warehouse_id AND ap.province_id = c.province_id JOIN warehouse_group wg ON wg.warehouse_id =t.warehouse_id WHERE DATE(t.Fecha) BETWEEN datSince AND datTo2359 AND a.agency_id = intAgency and wg.warehouse_alias_id = intWarehouseAlias; - - ELSE - - SELECT t.Id_Ticket, Round(sum_price , 2) AS Total_Agencia,t.Id_Consigna,t.empresa_id,t.warehouse_id, - v.suma_componente AS VN, IF(isFile,Round(sum_price, 2) - v.suma_componente,v.diferencia) AS Difer, - v.teorico_agencia AS teorico,zd.Id_Agencia, t.Bultos,t.Id_Cliente - FROM - (SELECT - *, SUM(price) sum_price - FROM - (select - t.Id_Ticket, zd.price,t.Id_Consigna, zd.date,t.empresa_id,t.warehouse_id,c.Descuento,t.Id_Agencia - from - agencia_descuadre zd - LEFT JOIN Tickets t ON t.Id_Ticket = zd.Id_Ticket - LEFT JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente - ORDER BY t.Id_Cliente DESC) t - GROUP BY Id_Ticket,`date`) zd - LEFT JOIN - Tickets t ON zd.date = DATE(t.Fecha) - AND zd.Id_Consigna = t.Id_Consigna - AND zd.warehouse_id = t.warehouse_id - AND zd.Id_Agencia = t.Id_Agencia - LEFT JOIN - v_descuadre_porte v ON v.Id_Ticket = t.Id_Ticket - WHERE t.Id_Cliente <> 4712 AND t.Id_Cliente <> 450 - GROUP BY zd.date,Id_Consigna,warehouse_id,zd.Id_Agencia -- HAVING Difer > 0.5 OR Difer < -0.5 jgf 2015-08-18 - ORDER BY v.diferencia; - END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -20385,12 +20384,12 @@ UNION ALL UNION ALL -- Movimientos sin porte en tickets con agencia que SI que deberia de llevar - SELECT m.Id_Ticket, count(Id_Movimiento) as Lineas_totales, Lineas_conPorte + SELECT m.Id_Ticket, count(Id_Movimiento) as Lineas_totales, Lineas_conPorte FROM Movimientos m JOIN Articles a on a.Id_Article = m.Id_Article JOIN Tipos tp on tp.tipo_id = a.tipo_id JOIN Tickets t on m.Id_Ticket = t.Id_Ticket - JOIN v_expeditions_shipping_charge2 v on v.Id_ticket = t.Id_Ticket + JOIN (select Id_Ticket, SUM(shipping_charge) shipping_charge from v_expeditions_shipping_charge2 group by Id_Ticket) v on v.Id_ticket = t.Id_Ticket LEFT JOIN ( SELECT m.Id_Ticket, count(Id_Componente) Lineas_conPorte @@ -20407,9 +20406,6 @@ UNION ALL AND shipping_charge > 1 GROUP BY m.Id_Ticket HAVING Lineas_totales > IFNULL(Lineas_conPorte,0) - - - ) sub JOIN Tickets t ON t.Id_Ticket = sub.Id_Ticket JOIN warehouse w ON w.id = t.warehouse_id @@ -24418,7 +24414,7 @@ ADD KEY bp_Id_Ticket_ix (Id_Ticket); drop temporary table if exists tmp.shipping_porte; create temporary table tmp.shipping_porte -select Id_Ticket, shipping_charge from vn2008.v_expeditions_shipping_charge2 where Fecha >= datFEC group by Id_Ticket; +select Id_Ticket, SUM(shipping_charge) from vn2008.v_expeditions_shipping_charge2 where Fecha >= datFEC group by Id_Ticket; ALTER TABLE tmp.shipping_porte ADD KEY sp_Id_Ticket_ix (Id_Ticket); @@ -31663,12 +31659,17 @@ BEGIN -- Código 100 + INSERT INTO tmp.buffer_problems(Id_Ticket, problem) + SELECT DISTINCT tt.Id_Ticket, 'COD 100' + FROM tmp.ticket_list tt + JOIN vn.ticketRequest tr on tr.ticketFk = tt.Id_Ticket; + /* INSERT INTO tmp.buffer_problems(Id_Ticket, problem) SELECT DISTINCT tt.Id_Ticket, 'COD 100' FROM tmp.ticket_list tt JOIN Movimientos m on m.Id_Ticket = tt.Id_Ticket WHERE Id_Article = 100; - +*/ -- Congelado INSERT INTO tmp.buffer_problems(Id_Ticket, problem) @@ -31717,7 +31718,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `production_buffer_problemsOptimizado` */; +/*!50003 DROP PROCEDURE IF EXISTS `production_buffer_problemsOptimizadokk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -31727,7 +31728,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `production_buffer_problemsOptimizado`() +CREATE DEFINER=`root`@`%` PROCEDURE `production_buffer_problemsOptimizadokk`() BEGIN /* * Necesita la tabla tmp.ticket_list @@ -41104,7 +41105,7 @@ CREATE TABLE `autoRadioLogCall` ( PRIMARY KEY (`id`), KEY `ticket_idx` (`ticketFk`), CONSTRAINT `ticket` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=216 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=276 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41232,7 +41233,8 @@ SET character_set_client = utf8; 1 AS `ediSpecieFk`, 1 AS `countryFk`, 1 AS `restriction`, - 1 AS `description`*/; + 1 AS `description`, + 1 AS `isProtectedZone`*/; SET character_set_client = @saved_cs_client; -- @@ -41704,7 +41706,7 @@ CREATE TABLE `clientLog` ( KEY `userFk` (`userFk`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=191253 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=193436 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42144,7 +42146,7 @@ CREATE TABLE `creditClassification` ( KEY `creditClassifClientFk_idx` (`client`), KEY `creditClassifdateEnd_idx` (`dateEnd`), CONSTRAINT `creditClassifClientFk` FOREIGN KEY (`client`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3019 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3027 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -42189,7 +42191,7 @@ CREATE TABLE `creditInsurance` ( PRIMARY KEY (`id`), KEY `CreditInsurance_Fk1_idx` (`creditClassification`), CONSTRAINT `CreditInsurance_Fk1` FOREIGN KEY (`creditClassification`) REFERENCES `creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2447 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; +) ENGINE=InnoDB AUTO_INCREMENT=2476 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -42320,7 +42322,10 @@ SET character_set_client = utf8; 1 AS `id`, 1 AS `name`, 1 AS `fatherFk`, - 1 AS `isProduction`*/; + 1 AS `isProduction`, + 1 AS `lft`, + 1 AS `rgt`, + 1 AS `isSelected`*/; SET character_set_client = @saved_cs_client; -- @@ -42413,7 +42418,7 @@ CREATE TABLE `dua` ( CONSTRAINT `dua_fk1` FOREIGN KEY (`gestdocFk`) REFERENCES `vn2008`.`gestdoc` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `dua_fk2` FOREIGN KEY (`awbFk`) REFERENCES `vn2008`.`awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `dua_fk4` FOREIGN KEY (`companyFk`) REFERENCES `vn2008`.`empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3646 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3668 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42454,7 +42459,7 @@ CREATE TABLE `duaIntrastat` ( KEY `duaIntrastat_fk2_idx` (`duaFk`), CONSTRAINT `duaIntrastat_fk1` FOREIGN KEY (`intrastatFk`) REFERENCES `vn2008`.`Intrastat` (`Codintrastat`) ON UPDATE CASCADE, CONSTRAINT `duaIntrastat_fk2` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5519 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5596 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42474,7 +42479,7 @@ CREATE TABLE `duaInvoiceIn` ( KEY `duaInvoiceIn_fk2_idx` (`invoiceInFk`), CONSTRAINT `duaInvoiceIn_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaInvoiceIn_fk2` FOREIGN KEY (`invoiceInFk`) REFERENCES `vn2008`.`recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4545 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; +) ENGINE=InnoDB AUTO_INCREMENT=4571 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42499,7 +42504,7 @@ CREATE TABLE `duaTax` ( CONSTRAINT `duaTax_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaTax_fk2` FOREIGN KEY (`supplierFk`) REFERENCES `vn2008`.`Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3906 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4077 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42595,7 +42600,7 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=112587 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=115260 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42628,7 +42633,7 @@ CREATE TABLE `envialiaCity` ( PRIMARY KEY (`id`), KEY `agencyFk` (`agencyFk`), KEY `postalCode` (`postalCode`) -) ENGINE=InnoDB AUTO_INCREMENT=527660 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=568028 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42643,7 +42648,7 @@ CREATE TABLE `envialiaConfig` ( `numBox` varchar(3) COLLATE utf8_unicode_ci DEFAULT '001' COMMENT 'cajas por envio', `startRange` bigint(25) DEFAULT NULL COMMENT 'Principio del rango que nos proporciona enviaría', `endRange` bigint(25) DEFAULT NULL COMMENT 'limite del rango que nos proporciona enviaría', - `cargoAgency` bigint(25) DEFAULT '4666' COMMENT 'numero de verdnatura dado por enviaría', + `cargoAgency` varchar(25) COLLATE utf8_unicode_ci DEFAULT '004666' COMMENT 'numero de verdnatura dado por enviaría', `actualNumber` bigint(25) DEFAULT NULL COMMENT 'Numero actual de etiquetas imprimidas , comprimido entre startRange y endRange, ', `isAlreadyNotified` int(1) NOT NULL DEFAULT '0' COMMENT 'Booleano para que el evento vn.envialiaRangeChecker compruebe si se a enviado una notificación\n', `notificationThrehold` int(11) DEFAULT NULL COMMENT 'Umbral para avisar a enviaría de reseetar el startRange y endRange\nSe avisara a enviaría si el umbral + el actualNumber es superior a endRange\n', @@ -43040,7 +43045,7 @@ CREATE TABLE `inventoryFailure` ( CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5110 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5873 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43311,7 +43316,7 @@ CREATE TABLE `invoiceOutExpence` ( KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutExpence_FK_2` FOREIGN KEY (`expenceFk`) REFERENCES `vn2008`.`Gastos` (`Id_Gasto`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=97711 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; +) ENGINE=InnoDB AUTO_INCREMENT=97995 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43354,7 +43359,7 @@ CREATE TABLE `invoiceOutTax` ( KEY `pgcFk` (`pgcFk`), CONSTRAINT `invoiceOutFk` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutTax_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1036473 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1036811 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43592,7 +43597,7 @@ CREATE TABLE `itemPlacementSupply` ( CONSTRAINT `itemPlacementSupply_fk1` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk3` FOREIGN KEY (`repoUserFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=188 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; +) ENGINE=InnoDB AUTO_INCREMENT=304 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43663,7 +43668,7 @@ CREATE TABLE `itemShelving` ( CONSTRAINT `itemShelving_fk1` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk2` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk3` FOREIGN KEY (`packagingFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=53517 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; +) ENGINE=InnoDB AUTO_INCREMENT=56267 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43737,7 +43742,7 @@ CREATE TABLE `itemShelvingPlacementSupply` ( KEY `itemShelvingPlacementSupply_fk3_idx` (`userFk`), CONSTRAINT `itemShelvingPlacementSupply_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingPlacementSupply_fk2` FOREIGN KEY (`itemPlacementSupplyFk`) REFERENCES `itemPlacementSupply` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; +) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43868,7 +43873,7 @@ CREATE TABLE `itemTag` ( KEY `priorityItem` (`priority`,`itemFk`), KEY `value` (`value`), CONSTRAINT `itemFK` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1037266 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1056325 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43996,7 +44001,7 @@ CREATE TABLE `itemTaxCountry` ( CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `vn2008`.`Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=619499 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; +) ENGINE=InnoDB AUTO_INCREMENT=634049 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44087,7 +44092,7 @@ CREATE TABLE `itemTypeTag` ( KEY `itemTypeTagTag_idx` (`tagFk`), CONSTRAINT `itemTypeTagTag` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `itemTypeTagTipos` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn2008`.`Tipos` (`tipo_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=197 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=224 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44305,7 +44310,7 @@ CREATE TABLE `medicalReview` ( KEY `frgnkWorker_idx` (`workerFk`), CONSTRAINT `frgcenter` FOREIGN KEY (`centerFk`) REFERENCES `medicalCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnkWorker` FOREIGN KEY (`workerFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=134 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=135 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44326,7 +44331,7 @@ CREATE TABLE `message` ( KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB AUTO_INCREMENT=1749243 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1760701 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44348,7 +44353,7 @@ CREATE TABLE `messageInbox` ( PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB AUTO_INCREMENT=1912806 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1924670 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44582,7 +44587,7 @@ CREATE TABLE `parking` ( UNIQUE KEY `code_UNIQUE` (`code`), KEY `parking_fk1_idx` (`sectorFk`), CONSTRAINT `parking_fk1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=24667 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; +) ENGINE=InnoDB AUTO_INCREMENT=24703 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44891,7 +44896,7 @@ CREATE TABLE `priceBuilder` ( KEY `priceBuilder_fk2_idx` (`userFk`), CONSTRAINT `priceBuilder_fk1` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn2008`.`Tipos` (`tipo_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilder_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44924,7 +44929,7 @@ CREATE TABLE `priceBuilderTag` ( KEY `priceBuilderTag_fk2_idx` (`tagFk`), CONSTRAINT `priceBuilderTag_fk1` FOREIGN KEY (`priceBuilderFk`) REFERENCES `priceBuilder` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilderTag_fk2` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44943,7 +44948,7 @@ CREATE TABLE `priceBuilderWarehouse` ( KEY `priceBuilderWarehouse_fk2_idx` (`priceBuilderFk`), CONSTRAINT `priceBuilderWarehouse_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `priceBuilderWarehouse_fk2` FOREIGN KEY (`priceBuilderFk`) REFERENCES `priceBuilder` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45360,7 +45365,7 @@ CREATE TABLE `routeLog` ( `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `description` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=767859 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=782063 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45465,7 +45470,7 @@ CREATE TABLE `saleItemShelving` ( `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) -) ENGINE=InnoDB AUTO_INCREMENT=24370 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=25393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45598,7 +45603,7 @@ CREATE TABLE `sms` ( `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=121144 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=121987 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45763,7 +45768,7 @@ CREATE TABLE `stockBuyed` ( UNIQUE KEY `date_UNIQUE` (`date`,`user`), KEY `stockBuyed_user_idx` (`user`), CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=536997 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=551680 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45840,8 +45845,11 @@ CREATE TABLE `tag` ( `isQuantitatif` tinyint(4) NOT NULL DEFAULT '1', `sourceTable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `unit` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; + `ediTypeFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tagEdiTypeFkIdx` (`ediTypeFk`), + CONSTRAINT `fgnTag` FOREIGN KEY (`ediTypeFk`) REFERENCES `edi`.`type` (`type_id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46052,7 +46060,7 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4484104 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4598889 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46124,7 +46132,7 @@ CREATE TABLE `ticketPackaging` ( CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk3` FOREIGN KEY (`workerFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=52703 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=53567 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46212,7 +46220,7 @@ CREATE TABLE `ticketService` ( KEY `fgn_ticketFk_idx` (`ticketFk`), CONSTRAINT `fgn_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketServiceIvaGroup` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servicios asociadas a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servicios asociadas a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46772,7 +46780,7 @@ CREATE TABLE `workerDocument` ( KEY `workerDocument_ibfk_2` (`document`), CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `vn2008`.`Trabajadores` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `vn2008`.`gestdoc` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=9200 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9274 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46822,7 +46830,7 @@ CREATE TABLE `workerJourney` ( UNIQUE KEY `userFk_UNIQUE` (`userFk`,`dated`), KEY `fk_workerJourney_user_idx` (`userFk`), CONSTRAINT `fk_workerJourney_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=17980894 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=19389293 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46844,7 +46852,7 @@ CREATE TABLE `workerLog` ( KEY `userFk_idx` (`userFk`), CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=8262 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=8514 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46907,7 +46915,7 @@ CREATE TABLE `workerTimeControl` ( KEY `warehouseFkfk1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerTimeControl_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1950687 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; +) ENGINE=InnoDB AUTO_INCREMENT=2069015 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46924,7 +46932,7 @@ CREATE TABLE `workerTimeControlConfig` ( PRIMARY KEY (`id`), KEY `warehouseFk_1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -47040,7 +47048,7 @@ CREATE TABLE `zone` ( KEY `fk_zone2_idx` (`agencyModeFk`), CONSTRAINT `fk_zone_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -48430,6 +48438,52 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `isIntrastatEntry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `isIntrastatEntry`(vEntryFk INT) RETURNS int(11) +BEGIN + + DECLARE isIntrastatOperation BOOL DEFAULT FALSE; + DECLARE vSupplierCountry INT DEFAULT -1; + DECLARE vClientCountry INT DEFAULT -1; + + SELECT c.id INTO vSupplierCountry + FROM vn.country c + JOIN vn.supplier s ON s.countryFk = c.id + JOIN vn.entry e ON e.supplierFk = s.id + WHERE e.id = vEntryFk + AND c.isUeeMember = TRUE; + + SELECT c.id INTO vClientCountry + FROM vn.country c + JOIN vn.supplier s ON s.countryFk = c.id + JOIN vn.company co ON co.id = s.id + JOIN vn.entry e ON e.companyFk = co.id + WHERE e.id = vEntryFk + AND c.isUeeMember = TRUE; + + IF vSupplierCountry != vClientCountry AND vSupplierCountry * vClientCountry > 0 THEN + + SET isIntrastatOperation = TRUE; + + END IF; + + RETURN isIntrastatOperation; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP FUNCTION IF EXISTS `isPalletHomogeneus` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -50342,8 +50396,8 @@ BEGIN JOIN vn.invoiceOut io ON io.clientFk = c.id JOIN vn.address a ON a.clientFk = c.id JOIN vn.province p ON p.id = a.provinceFk - WHERE p.name = 'VALENCIA' - AND io.issued = '2018-11-30' + WHERE p.name = 'MADRID' + AND io.issued = '2019-01-31' AND a.isDefaultAddress AND c.name NOT LIKE 'TR %'; @@ -50869,7 +50923,7 @@ CREATE TEMPORARY TABLE tmp.dayMinuteWorker workerCode , firstName, name, - warehouseFk + IFNULL(warehouseFk,1) warehouseFk FROM vn.workerTimeControl wtc JOIN vn.worker w ON w.userFk = wtc.userFk WHERE timed BETWEEN vDateStart AND vDateEnd @@ -50889,7 +50943,7 @@ CREATE TEMPORARY TABLE tmp.dayMinuteWorker ) sub3 ON sub3.warehouseFk = w.id WHERE estado = 'presente' AND sub3.id BETWEEN HOUR(vDateFrom) *100 + MINUTE(vDateFrom) AND HOUR(vDateTo) *100 + MINUTE(vDateTo); --- SELECT * FROM tmp.dayMinuteWorker; +-- SELECT * FROM tmp.dayMinuteWorker; END ;; DELIMITER ; @@ -52028,6 +52082,39 @@ BEGIN END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `intrastat_data_neto_Update` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `intrastat_data_neto_Update`(IN vinvoiceInFk INT) +BEGIN + +UPDATE vn2008.intrastat_data id + JOIN ( + SELECT i.intrastatFk, + sum(r.cm3 * b.quantity) * i.density / 1000000 as neto + FROM vn.entry e + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.buy b ON b.entryFk = e.id + JOIN vn.item i ON i.id = b.itemFk + JOIN bi.rotacion r ON r.Id_Article = i.id AND tr.warehouseInFk = r.warehouse_id + WHERE e.invoiceInFk = vinvoiceInFk + GROUP BY i.intrastatFk) sub ON sub.intrastatFk = id.intrastat_id + SET id.neto = ROUND(sub.neto,1) + WHERE id.recibida_id = vInvoiceInFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -53823,14 +53910,15 @@ BEGIN SELECT vInvoice, pgcFk, SUM(taxableBase) as BASE, - SUM(tax) + CAST(SUM(taxableBase) * rate / 100 AS DECIMAL (10,2)) FROM tmp.ticketTax GROUP BY pgcFk HAVING BASE; - + DROP TEMPORARY TABLE tmp.ticket; DROP TEMPORARY TABLE tmp.ticketTax; DROP TEMPORARY TABLE tmp.ticketAmount; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55052,6 +55140,11 @@ BEGIN vItemPlacementSupplyFk, vQuantity, getUser()); + + UPDATE vn.itemShelving + SET quantity = quantity - vQuantity, visible = visible - vQuantity, available = available - vQuantity + WHERE id = vItemShelvingFk; + END ;; DELIMITER ; @@ -60103,13 +60196,17 @@ BEGIN DELETE tl FROM tmp.ticketList tl JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; - + INSERT INTO tmp.ticketProblems(ticketFk, problem) + SELECT DISTINCT tl.ticketFk, 'Code 100' + FROM tmp.ticketList tl + JOIN vn.ticketRequest tr on tr.ticketFk = tl.ticketFk; + /* INSERT INTO tmp.ticketProblems(ticketFk, problem) SELECT DISTINCT tl.ticketFk, 'Code 100' FROM tmp.ticketList tl JOIN sale s ON s.ticketFk = tl.ticketFk WHERE s.itemFk = 100; - + */ DELETE tl FROM tmp.ticketList tl JOIN tmp.ticketProblems tp ON tl.ticketFk = tp.ticketFk; @@ -60194,7 +60291,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTax`() READS SQL DATA @@ -60204,56 +60301,89 @@ BEGIN * un conjunto de tickets. * * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular - * @return tmp.ticketTax Impuesto desglosado para cada ticket * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + */ - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT t.addressFk, t.companyFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; - CALL addressTaxArea (); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; - CREATE TEMPORARY TABLE tmp.ticketTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tmpTicket.ticketFk, - bp.pgcFk, - SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, - ROUND(SUM(s.quantity * s.price * (100 - s.discount)/100) * pgc.rate / 100 , 2) AS tax, - tc.code - FROM tmp.ticket tmpTicket - JOIN sale s ON s.ticketFk = tmpTicket.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN ticket t ON t.id = tmpTicket.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN itemTaxCountry itc - ON itc.itemFk = i.id AND itc.countryFk = su.countryFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = itc.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tmpTicket.ticketFk, pgc.code - HAVING taxableBase != 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - CREATE TEMPORARY TABLE tmp.ticketAmount - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT ticketFk, taxableBase, SUM(tax) tax - FROM tmp.ticketTax - GROUP BY ticketFk, code; + CALL addressTaxArea (); + - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; + /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente + * No se debería cambiar el sistema por problemas con los decimales + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tmpTicket.ticketFk, + bp.pgcFk, + SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticket tmpTicket + JOIN sale s ON s.ticketFk = tmpTicket.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN ticket t ON t.id = tmpTicket.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = itc.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tmpTicket.ticketFk, pgc.code,pgc.rate + HAVING taxableBase != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; + CREATE TEMPORARY TABLE tmp.ticketServiceTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk, + SUM(ts.quantity * ts.price) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticketTax tt + JOIN ticketService ts ON ts.ticketFk = tt.ticketFk + JOIN ticket t ON t.id = tt.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = ts.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tt.ticketFk, tt.code,tt.rate + HAVING taxableBase != 0; + + UPDATE tmp.ticketTax tt + JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate + SET tt.taxableBase = tt.taxableBase + ts.taxableBase; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + CREATE TEMPORARY TABLE tmp.ticketAmount + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code + FROM tmp.ticketTax + GROUP BY ticketFk, code; + + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60268,7 +60398,7 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetTaxAdd`(vTicketFk INT) BEGIN @@ -60276,7 +60406,6 @@ BEGIN * Añade un ticket a la tabla tmp.ticket para calcular * el IVA y el recargo de equivalencia y devuelve el resultado. */ - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; CREATE TEMPORARY TABLE tmp.ticket ENGINE = MEMORY @@ -60287,7 +60416,7 @@ BEGIN SELECT tt.ticketFk, CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase, - CAST(tt.tax AS DECIMAL(10, 2)) AS tax, + CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax, pgc.*, CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base, pgc.rate / 100 as vatPercent @@ -60295,9 +60424,10 @@ BEGIN JOIN vn.pgc ON pgc.code = tt.pgcFk LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code; - DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticket; DROP TEMPORARY TABLE tmp.ticketTax; DROP TEMPORARY TABLE tmp.ticketAmount; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60684,12 +60814,13 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticketStatePrevious`(vTicketFk INT ) +CREATE DEFINER=`root`@`%` PROCEDURE `ticketStatePrevious`(vTicketFk INT) BEGIN DECLARE vControlFk INT; + DECLARE vLastWorkerFk INT; - SELECT MAX(inter_id) INTO vControlFk + SELECT MAX(inter_id) INTO vControlFk FROM vncontrol.inter WHERE Id_Ticket = vTicketFk; @@ -60699,26 +60830,28 @@ BEGIN WHERE i.inter_id = vControlFk) = 'PREVIOUS_PREPARATION' THEN - SELECT MAX(inter_id) INTO vControlFk + SELECT inter_id, Id_Trabajador + INTO vControlFk,vLastWorkerFk FROM vncontrol.inter i JOIN vn.state s ON i.state_id = s.id WHERE Id_Ticket = vTicketFk AND inter_id < vControlFk - AND s.code != 'PREVIOUS_PREPARATION'; + AND s.code != 'PREVIOUS_PREPARATION' + ORDER BY inter_id DESC + LIMIT 1; INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) - SELECT state_id , Id_Ticket, vn.getWorker(), vn.getWorker() + SELECT state_id , Id_Ticket, vLastWorkerFk, vn.getWorker() FROM vncontrol.inter WHERE inter_id = vControlFk; END IF; - SELECT name + SELECT `name` FROM vn.state WHERE id = (SELECT state_id - FROM vncontrol.inter - WHERE inter_id = vControlFk); + FROM vncontrol.inter + WHERE inter_id = vControlFk); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -62326,7 +62459,7 @@ CREATE TABLE `batch` ( KEY `buy_edi_id` (`buy_edi_id`), CONSTRAINT `batch_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `batch_ibfk_2` FOREIGN KEY (`buy_edi_id`) REFERENCES `vn2008`.`buy_edi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=424890 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=430639 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62427,7 +62560,7 @@ CREATE TABLE `deliveryInformation` ( KEY `fgbSupplyResponse_idx2` (`FirstOrderDateTime`), KEY `fgbSupplyResponse_idx3` (`LatestOrderDateTime`), CONSTRAINT `fgbSupplyResponse` FOREIGN KEY (`supplyResponseID`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14577393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15020505 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62730,7 +62863,7 @@ CREATE TABLE `message` ( UNIQUE KEY `mail_id` (`mail_id`), KEY `sender_id` (`sender_id`), CONSTRAINT `message_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `mail` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=447741 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=453393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -62953,7 +63086,7 @@ CREATE TABLE `supplyResponse` ( `MarketFormCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '"002" Standard Sales\n"005" Catalogue (optional)\n"001" Committed (optional)\n"003" Buffer (optional, Clock Pre Sales) ', PRIMARY KEY (`ID`), UNIQUE KEY `ID_UNIQUE` (`ID`) -) ENGINE=InnoDB AUTO_INCREMENT=4316751 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4537930 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -63561,7 +63694,7 @@ CREATE TABLE `indicators` ( `lastYearSales` int(11) DEFAULT NULL, `totalGreuge` int(11) DEFAULT NULL, `latePaymentRate` decimal(5,4) DEFAULT NULL, - `countEmployee` int(11) DEFAULT NULL, + `countEmployee` decimal(10,2) DEFAULT NULL, `averageMana` int(11) DEFAULT NULL, `bankingPool` int(11) DEFAULT NULL, `lastMonthActiveClients` int(11) DEFAULT NULL, @@ -63888,7 +64021,21 @@ CREATE TABLE `productivity` ( `numPaletizadores` int(11) NOT NULL DEFAULT '0', `costPaletizado` double NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=14751516 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=18555675 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `productivity_evolution` +-- + +DROP TABLE IF EXISTS `productivity_evolution`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `productivity_evolution` ( + `dated` date NOT NULL, + `m3productionCost` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -64870,10 +65017,18 @@ BEGIN -- Número de trabajadores activos UPDATE indicators SET countEmployee = - (SELECT count(*) - FROM account.user - WHERE role NOT IN (2, 6, 3, 31,32) - AND active + ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) + FROM + postgresql.business AS b + JOIN postgresql.profile p ON p.profile_id = b.provider_id + JOIN postgresql.person pe ON pe.person_id = p.person_id + LEFT JOIN + postgresql.business_labour AS bl ON bl.business_id = b.business_id + LEFT JOIN + postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + WHERE + (vDated BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDated)) + AND pe.name = 'VERDNATURA LEVANTE SL' ) WHERE updated = vDated; @@ -65062,7 +65217,6 @@ BEGIN JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk JOIN vn.address a ON a.id = t.addressFk WHERE v.fecha BETWEEN datSTART AND datEND - AND it.workerFk != 132 -- Miriam AND s.quantity > 0 -- evita abonos AND t.companyFk = 442 -- Verdnatura GROUP BY t.warehouseFk, v.fecha, a.provinceFk; @@ -65511,6 +65665,12 @@ BEGIN costPaletizado FROM tmp.productivity p; + -- Productivity Evolution + REPLACE bs.productivity_evolution(dated, m3productionCost) + SELECT CURDATE(), sum(wCost) / sum(m3) + FROM bs.productivity + WHERE dated BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND CURDATE(); + DROP TEMPORARY TABLE tmp.dayMinuteWorker; DROP TEMPORARY TABLE tmp.productivity; DROP TEMPORARY TABLE tmp.ticketBuiltTime; @@ -65539,11 +65699,9 @@ DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `productivityLauncher`() BEGIN - -- DECLARE vDateFrom DATE DEFAULT TIMESTAMPADD(MONTH, -3, CURDATE()); + DECLARE vDateFrom DATE DEFAULT TIMESTAMPADD(MONTH, -3, CURDATE()); - DECLARE vDateFrom DATE DEFAULT '2018-03-01'; - - WHILE '2018-03-31' >= vDateFrom DO + WHILE CURDATE() > vDateFrom DO CALL bs.productivityAdd(vDateFrom); @@ -65551,6 +65709,46 @@ BEGIN END WHILE; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `pruebas` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `pruebas`(IN vDateStart DATE, IN vDateEnd DATE) +BEGIN + +WHILE vDateStart <> vDateEnd +DO + UPDATE indicators + SET countEmployee = + ( SELECT CAST(SUM(hours_week) / 40 AS DECIMAL (10 , 2 )) + FROM + postgresql.business AS b + JOIN postgresql.profile p ON p.profile_id = b.provider_id + JOIN postgresql.person pe ON pe.person_id = p.person_id + LEFT JOIN + postgresql.business_labour AS bl ON bl.business_id = b.business_id + LEFT JOIN + postgresql.calendar_labour_type AS cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + WHERE + (vDateStart BETWEEN b.date_start AND b.date_end OR (b.date_end IS NULL AND b.date_start <= vDateStart)) + AND pe.name = 'VERDNATURA LEVANTE SL' + ) + WHERE updated = vDateStart; + SET vDateStart = DATE_ADD(vDateStart, INTERVAL 1 DAY); + +END WHILE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -66835,13 +67033,13 @@ CREATE TABLE `saldos_bancos_pordia` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `sales` +-- Table structure for table `salesKk` -- -DROP TABLE IF EXISTS `sales`; +DROP TABLE IF EXISTS `salesKk`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sales` ( +CREATE TABLE `salesKk` ( `Id_Trabajador` int(10) unsigned NOT NULL, `year` int(10) unsigned NOT NULL, `month` int(10) unsigned NOT NULL, @@ -67985,6 +68183,109 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `defaultingTest` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `defaultingTest`(IN vDate DATE) +BEGIN +/*JGF para usar el campo vencimiento de facturas*/ + DECLARE vDone BOOLEAN; + DECLARE vClient INT; + DECLARE vAmount INT; + DECLARE vDued DATE; + DECLARE vAmountInvoice DECIMAL(10,2); + DECLARE vGraceDays INT; + DECLARE defaulters CURSOR FOR + SELECT client, amount, graceDays FROM bi.defaulters d + JOIN vn2008.Clientes c ON c.Id_Cliente = d.client + JOIN vn2008.pay_met pm ON pm.id = c.pay_met_id + WHERE hasChanged AND date = vDate; + + DECLARE invoices CURSOR FOR + SELECT Fecha, importe FROM vn2008.Facturas f + WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + -- Control + + INSERT INTO vn2008.daily_task_log(consulta) VALUES('defaulting'); + + DELETE FROM bi.defaulters WHERE date = vDate; + + INSERT INTO bi.defaulters(client, date, amount) + SELECT customer_id, vDate, FLOOR(SUM(amount)) AS amount + FROM bi.customerRiskOverdue + GROUP BY customer_id; + + SELECT * FROM( + SELECT client, amount , defaulterSince FROM bi.defaulters + WHERE date <= TIMESTAMPADD(DAY,-1, vDate) + ORDER BY date DESC) t GROUP BY client; + SELECT * FROM bi.defaulters where client = 14669; + + -- marcamos si ha cambiado y heredamos la fecha defaulterSince + UPDATE bi.defaulters d + JOIN ( + SELECT * FROM( + SELECT client, amount , defaulterSince FROM bi.defaulters + WHERE date <= TIMESTAMPADD(DAY,-1, vDate) + ORDER BY date DESC) t GROUP BY client + ) yesterday using(client) + SET d.hasChanged = IF(d.amount <> yesterday.amount, 1, 0), + d.defaulterSince = yesterday.defaulterSince + WHERE d.date = vDate ; + + OPEN defaulters; + defaulters: LOOP + SET vDone = FALSE; + SET vAmount = 0; + FETCH defaulters INTO vClient,vAmount, vGraceDays; + IF vDone THEN + LEAVE defaulters; + END IF; + OPEN invoices; + invoices:LOOP + + FETCH invoices INTO vDued, vAmountInvoice; + IF vDone THEN + LEAVE invoices; + END IF; + + IF TIMESTAMPADD(DAY, vGraceDays, vDued) <= vDate THEN + SET vAmount = vAmount - vAmountInvoice; + IF vAmount <= 0 THEN + UPDATE defaulters SET defaulterSince = vDued + WHERE client = vClient and date = vDate; + + SET vAmount = 0; + LEAVE invoices; + END IF; + END IF; + END LOOP; + CLOSE invoices; + END LOOP; + CLOSE defaulters; + DELETE FROM bi.defaulting WHERE date = vDate; + + INSERT INTO bi.defaulting(date, amount) + SELECT vDate, SUM(amount) + FROM bi.defaulters + WHERE date = vDate and amount > 0; + + CALL vn.clientFreeze(); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `defaulting_launcher` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -69437,7 +69738,7 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=MyISAM AUTO_INCREMENT=250929 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=255264 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -70232,7 +70533,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDB AUTO_INCREMENT=269979 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=277039 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71866,7 +72167,7 @@ CREATE TABLE `ACL` ( `principalType` set('ROLE','USER') COLLATE utf8_unicode_ci DEFAULT 'ROLE', `principalId` varchar(512) CHARACTER SET utf8 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=146 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=149 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71986,7 +72287,7 @@ CREATE TABLE `userConfigView` ( `configuration` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`), UNIQUE KEY `uniqueUser_TableCode` (`userFk`,`tableCode`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -72142,7 +72443,7 @@ CREATE TABLE `inter` ( CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn2008`.`state` (`id`) ON UPDATE CASCADE, CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=15165431 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15382595 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -72486,7 +72787,7 @@ CREATE TABLE `imageCollectionSize` ( PRIMARY KEY (`id`), KEY `image_schema_id` (`collectionFk`), CONSTRAINT `imageCollectionSize_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -72963,7 +73264,7 @@ CREATE TABLE `news` ( KEY `tag` (`tag`), CONSTRAINT `news_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`account` (`id`) ON UPDATE CASCADE, CONSTRAINT `news_ibfk_2` FOREIGN KEY (`tag`) REFERENCES `newsTag` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=13051 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=13053 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73014,7 +73315,7 @@ CREATE TABLE `order` ( CONSTRAINT `order_ibfk_5` FOREIGN KEY (`address_id`) REFERENCES `vn2008`.`Consignatarios` (`id_consigna`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_8` FOREIGN KEY (`delivery_method_id`) REFERENCES `vn2008`.`Vistas` (`vista_id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_9` FOREIGN KEY (`agency_id`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1756946 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1773621 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73116,7 +73417,7 @@ CREATE TABLE `orderRow` ( KEY `warehouse_shipment` (`warehouseFk`,`shipment`), CONSTRAINT `orderRow_ibfk_2` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON UPDATE CASCADE, CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10676154 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10767677 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -73476,7 +73777,7 @@ CREATE TABLE `tpvTransaction` ( CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn2008`.`Recibos` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_2` FOREIGN KEY (`merchantFk`) REFERENCES `tpvMerchant` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=283173 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; +) ENGINE=InnoDB AUTO_INCREMENT=286513 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73511,7 +73812,7 @@ CREATE TABLE `visit` ( PRIMARY KEY (`id`), KEY `firstAgent` (`firstAgent`), CONSTRAINT `visit_ibfk_1` FOREIGN KEY (`firstAgent`) REFERENCES `visitAgent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1594561 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1617420 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73531,7 +73832,7 @@ CREATE TABLE `visitAccess` ( KEY `visit_access_idx_agent` (`agent`), KEY `stamp` (`stamp`), CONSTRAINT `visitAccess_ibfk_1` FOREIGN KEY (`agent`) REFERENCES `visitAgent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3504892 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3551171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73556,7 +73857,7 @@ CREATE TABLE `visitAgent` ( KEY `firstAccess` (`firstAccess`), CONSTRAINT `visitAgent_ibfk_1` FOREIGN KEY (`visit`) REFERENCES `visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `visitAgent_ibfk_2` FOREIGN KEY (`firstAccess`) REFERENCES `visitAccess` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2173739 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2200364 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -73576,7 +73877,7 @@ CREATE TABLE `visitUser` ( KEY `date_time` (`stamp`), KEY `user_id` (`user`), CONSTRAINT `visitUser_ibfk_1` FOREIGN KEY (`access`) REFERENCES `visitAccess` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3187466 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3216863 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -75001,111 +75302,111 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `orderAddItem`(IN `vOrder` INT, IN `vWarehouse` INT, IN `vItem` INT, IN `vAmount` INT) -BEGIN - DECLARE vRow INT; - DECLARE vAdd INT; - DECLARE vAvailable INT; - DECLARE vDone BOOL; - DECLARE vGrouping INT; - DECLARE vRate INT; - DECLARE vShipment DATE; - DECLARE vPrice DECIMAL(10,2); - DECLARE vDate DATE; - DECLARE vAddress INT; - DECLARE vAgencyMode INT; - DECLARE cur CURSOR FOR - SELECT grouping, price, rate - FROM tmp.bionic_price - WHERE warehouse_id = vWarehouse - AND item_id = vItem - ORDER BY grouping DESC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - SELECT date_send, address_id, agency_id - INTO vDate, vAddress, vAgencyMode - FROM `order` - WHERE id = vOrder; - - CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem); - - START TRANSACTION; - - SELECT shipped INTO vShipment - FROM tmp.travel_tree - WHERE warehouseFk = vWarehouse; - - SELECT available INTO vAvailable - FROM tmp.bionic_lot - WHERE warehouse_id = vWarehouse - AND item_id = vItem; - - IF vAmount > vAvailable - THEN - CALL util.throw ('ORDER_ROW_UNAVAILABLE'); - END IF; - - OPEN cur; - - l: LOOP - SET vDone = FALSE; - FETCH cur INTO vGrouping, vPrice, vRate; - - IF vDone THEN - LEAVE l; - END IF; - - SET vAdd = vAmount - MOD(vAmount, vGrouping); - SET vAmount = vAmount - vAdd; - - IF vAdd = 0 THEN - ITERATE l; - END IF; - - INSERT INTO order_row SET - order_id = vOrder, - item_id = vItem, - warehouse_id = vWarehouse, - shipment = vShipment, - rate = vRate, - amount = vAdd, - price = vPrice; - - SET vRow = LAST_INSERT_ID(); - - INSERT INTO order_component (order_row_id, component_id, price) - SELECT vRow, c.component_id, c.cost - FROM tmp.bionic_component c - JOIN bi.tarifa_componentes t - ON t.Id_Componente = c.component_id - AND (t.tarifa_class IS NULL OR t.tarifa_class = vRate) - WHERE c.warehouse_id = vWarehouse - AND c.item_id = vItem; - END LOOP; - - CLOSE cur; - - IF vAmount > 0 - THEN - CALL util.throw ('AMOUNT_NOT_MATCH_GROUPING'); - END IF; - - COMMIT; - CALL vn2008.bionic_free (); +BEGIN + DECLARE vRow INT; + DECLARE vAdd INT; + DECLARE vAvailable INT; + DECLARE vDone BOOL; + DECLARE vGrouping INT; + DECLARE vRate INT; + DECLARE vShipment DATE; + DECLARE vPrice DECIMAL(10,2); + DECLARE vDate DATE; + DECLARE vAddress INT; + DECLARE vAgencyMode INT; + DECLARE cur CURSOR FOR + SELECT grouping, price, rate + FROM tmp.bionic_price + WHERE warehouse_id = vWarehouse + AND item_id = vItem + ORDER BY grouping DESC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SELECT date_send, address_id, agency_id + INTO vDate, vAddress, vAgencyMode + FROM `order` + WHERE id = vOrder; + + CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem); + + START TRANSACTION; + + SELECT shipped INTO vShipment + FROM tmp.travel_tree + WHERE warehouseFk = vWarehouse; + + SELECT available INTO vAvailable + FROM tmp.bionic_lot + WHERE warehouse_id = vWarehouse + AND item_id = vItem; + + IF vAmount > IFNULL(vAvailable, 0) + THEN + CALL util.throw ('ORDER_ROW_UNAVAILABLE'); + END IF; + + OPEN cur; + + l: LOOP + SET vDone = FALSE; + FETCH cur INTO vGrouping, vPrice, vRate; + + IF vDone THEN + LEAVE l; + END IF; + + SET vAdd = vAmount - MOD(vAmount, vGrouping); + SET vAmount = vAmount - vAdd; + + IF vAdd = 0 THEN + ITERATE l; + END IF; + + INSERT INTO order_row SET + order_id = vOrder, + item_id = vItem, + warehouse_id = vWarehouse, + shipment = vShipment, + rate = vRate, + amount = vAdd, + price = vPrice; + + SET vRow = LAST_INSERT_ID(); + + INSERT INTO order_component (order_row_id, component_id, price) + SELECT vRow, c.component_id, c.cost + FROM tmp.bionic_component c + JOIN bi.tarifa_componentes t + ON t.Id_Componente = c.component_id + AND (t.tarifa_class IS NULL OR t.tarifa_class = vRate) + WHERE c.warehouse_id = vWarehouse + AND c.item_id = vItem; + END LOOP; + + CLOSE cur; + + IF vAmount > 0 + THEN + CALL util.throw ('AMOUNT_NOT_MATCH_GROUPING'); + END IF; + + COMMIT; + CALL vn2008.bionic_free (); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77099,7 +77400,7 @@ CREATE TABLE `bank_account` ( CONSTRAINT `bank_account_bank_account_type_id_fkey` FOREIGN KEY (`bank_account_type_id`) REFERENCES `bank_account_type` (`bank_account_type_id`) ON UPDATE CASCADE, CONSTRAINT `bank_account_nation_id_fkey` FOREIGN KEY (`nation_id`) REFERENCES `nation` (`nation_id`) ON UPDATE CASCADE, CONSTRAINT `bank_profile` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=740 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=742 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77242,7 +77543,7 @@ CREATE TABLE `business` ( KEY `bussiness_provider` (`provider_id`), CONSTRAINT `business_client` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `bussiness_provider` FOREIGN KEY (`provider_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2274 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=2283 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77481,7 +77782,7 @@ CREATE TABLE `calendar_labour` ( CONSTRAINT `fk_calendar_labour_calendar_free1` FOREIGN KEY (`calendar_free_id`) REFERENCES `calendar_free` (`calendar_free_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_calendar_labour_legend_id` FOREIGN KEY (`calendar_labour_legend_id`) REFERENCES `calendar_labour_legend` (`calendar_labour_legend_id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `workcenter_calendar` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=537 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=534 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77496,7 +77797,7 @@ CREATE TABLE `calendar_labour_legend` ( `descripcion` longtext, PRIMARY KEY (`calendar_labour_legend_id`), UNIQUE KEY `calendar_labour_legend_calendar_labour_legend_id_key` (`calendar_labour_legend_id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -77839,7 +78140,7 @@ CREATE TABLE `income_employee` ( KEY `fperson_id` (`person_id`), CONSTRAINT `fincometype_id` FOREIGN KEY (`id_incomeType`) REFERENCES `incometype_employee` (`id_incometype`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fperson_id` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=59389 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=60199 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78265,7 +78566,7 @@ CREATE TABLE `media` ( PRIMARY KEY (`media_id`), KEY `media_media_type_id_idx` (`media_type_id`), CONSTRAINT `media_ibfk_1` FOREIGN KEY (`media_type_id`) REFERENCES `media_type` (`media_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=927 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=928 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78707,7 +79008,7 @@ CREATE TABLE `profile_media` ( KEY `profile_media_profile_id_idx` (`profile_id`), CONSTRAINT `fk_profile_media_media1` FOREIGN KEY (`media_id`) REFERENCES `media` (`media_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `media_ibfk_20` FOREIGN KEY (`profile_id`) REFERENCES `profile` (`profile_id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1075 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=1076 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80276,6 +80577,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `v_descuadre_portekk` +-- + +/*!50001 DROP VIEW IF EXISTS `v_descuadre_portekk`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_descuadre_portekk` AS select `t`.`Id_Ticket` AS `Id_Ticket`,round(sum((`mc`.`Valor` * `m`.`Cantidad`)),2) AS `suma_componente`,round(`es`.`shipping_charge`,2) AS `teorico_agencia`,round((sum((`mc`.`Valor` * `m`.`Cantidad`)) - `es`.`shipping_charge`),2) AS `diferencia`,`t`.`Fecha` AS `Fecha` from ((((`vn2008`.`Movimientos` `m` left join `vn2008`.`Movimientos_componentes` `mc` on((`m`.`Id_Movimiento` = `mc`.`Id_Movimiento`))) join `vn2008`.`tarifa_componentes` `tc` on(((`tc`.`Id_Componente` = `mc`.`Id_Componente`) and (`tc`.`tarifa_componentes_series_id` = 6)))) join `vn2008`.`Tickets` `t` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) left join `vn2008`.`v_expeditions_shipping_charge2` `es` on((`es`.`Id_Ticket` = `t`.`Id_Ticket`))) where ((`t`.`Fecha` >= '2015-09-01') and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` having ((abs(`diferencia`) > 0.01) or isnull(`diferencia`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `v_empresa` -- @@ -80384,6 +80703,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `v_expeditions_shipping_chargekk` +-- + +/*!50001 DROP VIEW IF EXISTS `v_expeditions_shipping_chargekk`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_expeditions_shipping_chargekk` AS select `t`.`Id_Ticket` AS `Id_Ticket`,sum(`az`.`price`) AS `shipping_charge`,`t`.`Fecha` AS `Fecha` from ((((((`Tickets` `t` join `Clientes` `cli` on((`cli`.`id_cliente` = `t`.`Id_Cliente`))) left join `expeditions` `e` on((`e`.`ticket_id` = `t`.`Id_Ticket`))) join `Consignatarios` `c` on((`c`.`id_consigna` = `t`.`Id_Consigna`))) join `Agencias` `a` on((`a`.`Id_Agencia` = `t`.`Id_Agencia`))) join `Agencias_province` `ap` on(((`t`.`warehouse_id` = `ap`.`warehouse_id`) and (`ap`.`province_id` = `c`.`province_id`) and (`ap`.`agency_id` = `a`.`agency_id`)))) join `Agencias_zonas` `az` on(((`az`.`Id_Agencia` = `t`.`Id_Agencia`) and (`az`.`zona` = `ap`.`zona`) and (`t`.`warehouse_id` = `az`.`warehouse_id`) and (`az`.`Id_Article` = `e`.`EsBulto`)))) where ((`t`.`Fecha` >= '2015-10-01') and (`cli`.`real` <> 0) and (`t`.`empresa_id` in (442,791,567))) group by `t`.`Id_Ticket` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `v_fallo` -- @@ -81122,8 +81459,8 @@ USE `vn`; /*!50001 SET character_set_results = utf8 */; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `botanicExport` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description` from `vn2008`.`botanic_export` `be` */; +/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `botanicExport` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description`,`be`.`isProtectedZone` AS `isProtectedZone` from `vn2008`.`botanic_export` `be` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -81789,7 +82126,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `department` AS select `b`.`department_id` AS `id`,`b`.`name` AS `name`,`b`.`father_id` AS `fatherFk`,`b`.`production` AS `isProduction` from `vn2008`.`department` `b` */; +/*!50001 VIEW `department` AS select `b`.`department_id` AS `id`,`b`.`name` AS `name`,`b`.`father_id` AS `fatherFk`,`b`.`production` AS `isProduction`,`b`.`lft` AS `lft`,`b`.`rgt` AS `rgt`,`b`.`isSelected` AS `isSelected` from `vn2008`.`department` `b` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -84147,7 +84484,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`name` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where (isnull(`b`.`date_end`) or (`b`.`date_end` > curdate())) */; +/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` > curdate()) and (`b`.`date_start` <= curdate()))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -85109,4 +85446,4 @@ USE `postgresql`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-02-11 7:19:22 +-- Dump completed on 2019-02-25 8:32:00 From 69c5c8f1cd09355bf46d7fb325a23f8d89d972c2 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 25 Feb 2019 09:28:25 +0100 Subject: [PATCH 06/60] #485 --- .../components/searchbar/searchbar.spec.js | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 front/core/components/searchbar/searchbar.spec.js diff --git a/front/core/components/searchbar/searchbar.spec.js b/front/core/components/searchbar/searchbar.spec.js new file mode 100644 index 000000000..9e28d0a98 --- /dev/null +++ b/front/core/components/searchbar/searchbar.spec.js @@ -0,0 +1,84 @@ +import './searchbar.js'; + +describe('Component vnSearchbar', () => { + let controller; + let $element; + let $state; + + beforeEach(ngModule('vnCore')); + + beforeEach(angular.mock.inject(($componentController, _$state_) => { + $state = _$state_; + $element = angular.element(`
`); + controller = $componentController('vnSearchbar', {$element, $state}); + controller.panel = 'vn-client-search-panel'; + })); + + describe('$postLink()', () => { + it(`should not call onStateChange() if filter is defined`, () => { + spyOn(controller, 'onStateChange'); + controller.filter = {}; + + controller.$postLink(); + + expect(controller.onStateChange).not.toHaveBeenCalledWith(); + }); + + it(`should call onStateChange() if filter is null`, () => { + spyOn(controller, 'onStateChange'); + controller.filter = null; + + controller.$postLink(); + + expect(controller.onStateChange).toHaveBeenCalledWith(); + }); + }); + + describe('filter() setter', () => { + it(`should call $state.go()`, () => { + controller._filter = {}; + spyOn(controller.$state, 'go'); + controller.filter = {expected: 'filter'}; + + expect(controller._filter).toEqual(controller.filter); + expect(controller.$state.go).toHaveBeenCalledWith('.', Object({q: '{"expected":"filter"}'})); + }); + }); + + describe('openPanel()', () => { + it(`should do nothing if the event is prevented`, () => { + let event = { + defaultPrevented: true, + preventDefault: jasmine.createSpy('preventDefault') + }; + controller.openPanel(event); + + expect(event.preventDefault).not.toHaveBeenCalledWith(); + }); + }); + + describe('getObjectFromString()', () => { + it(`should return a formated object based on the string received for basic search`, () => { + let result = controller.getObjectFromString('Bruce Wayne'); + + expect(result).toEqual({search: 'Bruce Wayne'}); + }); + + it(`should return a formated object based on the string received for advanced search`, () => { + let result = controller.getObjectFromString('id:101 name:(Bruce Wayne)'); + + expect(result).toEqual({id: '101', name: 'Bruce Wayne'}); + }); + + it(`should format the object grouping any unmatched part of the instring of the string to the search property`, () => { + let string = 'I am the search id:101 name:(Bruce Wayne) concatenated value'; + let result = controller.getObjectFromString(string); + + expect(result).toEqual({ + id: '101', + name: 'Bruce Wayne', + search: 'I am the search concatenated value' + }); + }); + }); +}); From 54a835eefdfb1048ceb66ebf36befacade0122db Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 25 Feb 2019 09:50:51 +0100 Subject: [PATCH 07/60] added disabled property --- front/core/components/td-editable/index.js | 11 +++++++++-- front/core/components/td-editable/style.scss | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/front/core/components/td-editable/index.js b/front/core/components/td-editable/index.js index a6be8b9b8..502a5e87b 100644 --- a/front/core/components/td-editable/index.js +++ b/front/core/components/td-editable/index.js @@ -11,7 +11,11 @@ export default class Controller extends Component { element.tabIndex = 0; element.addEventListener('focus', () => { - if (this.field) return; + if (this.field || this.disabled) { + console.log(element.style.cursor); + // element.style.cursor = 'none!important'; + return; + } $transclude((tClone, tScope) => { this.field = tClone; this.tScope = tScope; @@ -26,7 +30,7 @@ export default class Controller extends Component { }); element.addEventListener('focusout', event => { - this.destroyTimer(); + if (this.field || this.disabled) return; this.lastEvent = event; let target = event.relatedTarget; while (target && target != element) @@ -57,6 +61,9 @@ Controller.$inject = ['$element', '$scope', '$transclude', '$timeout']; ngModule.component('vnTdEditable', { template: require('./index.html'), controller: Controller, + bindings: { + disabled: ' .text { visibility: hidden; } From 007139f2f68af588dc036c6c295fd8abb4019ae9 Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 25 Feb 2019 10:10:44 +0100 Subject: [PATCH 08/60] added disable property --- front/core/components/td-editable/index.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/front/core/components/td-editable/index.js b/front/core/components/td-editable/index.js index 502a5e87b..780e6160c 100644 --- a/front/core/components/td-editable/index.js +++ b/front/core/components/td-editable/index.js @@ -11,11 +11,8 @@ export default class Controller extends Component { element.tabIndex = 0; element.addEventListener('focus', () => { - if (this.field || this.disabled) { - console.log(element.style.cursor); - // element.style.cursor = 'none!important'; - return; - } + if (this.field || this.disabled) return; + $transclude((tClone, tScope) => { this.field = tClone; this.tScope = tScope; From 11a2be6ac4e89136da78588c38a4b187e3115231 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 25 Feb 2019 11:47:28 +0100 Subject: [PATCH 09/60] #882 e2e claim.action --- e2e/helpers/selectors.js | 11 ++++ .../claim-module/04_claim_action.spec.js | 63 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 e2e/paths/claim-module/04_claim_action.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 45a3d4e3e..bd850ef3f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -468,6 +468,17 @@ export default { secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]', saveDevelopmentButton: `${components.vnSubmit}` }, + claimAction: { + importClaimButton: 'vn-claim-action vn-button[label="Import claim"]', + importTicketButton: 'vn-claim-action vn-button[label="Import ticket"]', + secondImportableTicket: 'vn-claim-action > vn-vertical > vn-popover > div > div.content > div > vn-table > div > vn-tbody > vn-tr:nth-child(2)', + firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', + thirdLineDestination: 'vn-claim-action vn-tr:nth-child(3) vn-autocomplete[field="saleClaimed.claimDestinationFk"]', + firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]', + secondDeleteLine: 'vn-claim-action vn-tr:nth-child(2) vn-icon-button[icon="delete"]', + thirdDeleteLine: 'vn-claim-action vn-tr:nth-child(3) vn-icon-button[icon="delete"]' + + }, ordersIndex: { searchResult: `vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, searchResultDate: `vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`, diff --git a/e2e/paths/claim-module/04_claim_action.spec.js b/e2e/paths/claim-module/04_claim_action.spec.js new file mode 100644 index 000000000..2a61c088f --- /dev/null +++ b/e2e/paths/claim-module/04_claim_action.spec.js @@ -0,0 +1,63 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('Claim edit basic data path', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + nightmare + .loginAndModule('administrative', 'claim') + .accessToSearchResult('4') + .accessToSection('claim.card.action'); + }); + + it('should import the claim', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.importClaimButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should import the eighth ticket', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.importTicketButton) + .waitToClick(selectors.claimAction.secondImportableTicket) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should edit the fourth line destination field', async() => { + const result = await nightmare + .autocompleteSearch(selectors.claimAction.thirdLineDestination, 'Bueno') + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should delete two first lines', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.secondDeleteLine) + .waitToClick(selectors.claimAction.firstDeleteLine) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should refresh the view to check the remaining line is the expected one', async() => { + const result = await nightmare + .reloadSection('claim.card.action') + .waitToGetProperty(`${selectors.claimAction.firstLineDestination} input`, 'value'); + + expect(result).toEqual('Bueno'); + }); + + it('should delete the current first line', async() => { + const result = await nightmare + .waitToClick(selectors.claimAction.firstDeleteLine) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); +}); From 7ea20833e2c3c653eeccd22fe9a9f4620183e352 Mon Sep 17 00:00:00 2001 From: Bernat Date: Mon, 25 Feb 2019 12:03:47 +0100 Subject: [PATCH 10/60] testing gitea --- services/db/install/dump/fixtures.sql | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index bf133a61d..72a98e5b2 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -1061,10 +1061,10 @@ INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `amountUnpaid`, `payed`, `workerFk`, `bankFk`, `clientFk`, `created`, `companyFk`, `isConciliate`) VALUES - (1, 'Cobro web', 100.50, 0.00, CURDATE(), 9, 1, 101, CURDATE(), 442, 1), - (2, 'Cobro web', 200.50, 0.00, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 9, 1, 101, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 442, 1), - (3, 'Cobro en efectivo', 300.00, 100.00, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 9, 1, 102, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 442, 0), - (4, 'Cobro en efectivo', -400.00, -50.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0); + (1, 'Cobro web', 100.50, 0.00, CURDATE(), 9, 1, 101, CURDATE(), 442, 1), + (2, 'Cobro web', 200.50, 0.00, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 9, 1, 101, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 442, 1), + (3, 'Cobro en efectivo', 300.00, 100.00, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 9, 1, 102, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 442, 0), + (4, 'Cobro en efectivo', -400.00, -50.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0); INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`) VALUES @@ -1126,5 +1126,3 @@ INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_i VALUES (1, NULL, 22, 4, 0, 1, 1, 1, 1), (2, 'From las friday worker ownes the company 1 hour', 23, 1, 0, 1, 0, 1, 1); - - From 6d70a45f41e1b262d8c4377549f2cef989e1af20 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 25 Feb 2019 12:08:16 +0100 Subject: [PATCH 11/60] added a comma becouse becouse --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index bd850ef3f..1f04c4339 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"]', From 37e7ec5de196bd2d6cc880d1cb281e22ddcc5537 Mon Sep 17 00:00:00 2001 From: Bernat Date: Mon, 25 Feb 2019 12:13:42 +0100 Subject: [PATCH 12/60] Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index bd850ef3f..1f04c4339 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"]', From b5f29954ed22f5622c48802cd12622bf0da73528 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 25 Feb 2019 13:07:32 +0100 Subject: [PATCH 13/60] #796 Test front left-menu.js --- front/salix/components/left-menu/left-menu.spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/front/salix/components/left-menu/left-menu.spec.js b/front/salix/components/left-menu/left-menu.spec.js index 5eb5c8126..93bc96827 100644 --- a/front/salix/components/left-menu/left-menu.spec.js +++ b/front/salix/components/left-menu/left-menu.spec.js @@ -17,6 +17,11 @@ describe('Component vnLeftMenu', () => { ]; })); + it(`should set items in the controller for the left menu`, () => { + expect(controller.items.length).toEqual(3); + expect(controller.items[2].state).toEqual('client.card.summary'); + }); + describe('depth() setter', () => { it(`should set depth property and call activateItem()`, () => { spyOn(controller, 'activateItem'); From 8a137e7713d6394201af84851d7f039f109feb0f Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 25 Feb 2019 13:40:53 +0100 Subject: [PATCH 14/60] grouping and packing added --- modules/item/back/methods/item/filter.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index b6d4eff59..4f8cbd36e 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -75,7 +75,8 @@ module.exports = Self => { t.name type, u.id userId, intr.description AS intrastat, i.stems, ori.code AS origin, t.name AS type, - ic.name AS category, i.density, tc.description AS taxClass + ic.name AS category, i.density, tc.description AS taxClass, + b.grouping, b.packing FROM item i JOIN itemType t ON t.id = i.typeFk LEFT JOIN itemCategory ic ON ic.id = t.categoryFk @@ -84,7 +85,9 @@ module.exports = Self => { LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN producer pr ON pr.id = i.producerFk LEFT JOIN origin ori ON ori.id = i.originFk - LEFT JOIN taxClass tc ON tc.id = i.taxClassFk` + LEFT JOIN taxClass tc ON tc.id = i.taxClassFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id` ); if (ctx.args.tags) { From 65d844152c6faf44ebb4c7dc77324e30480f29d5 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 25 Feb 2019 14:11:16 +0100 Subject: [PATCH 15/60] removed a comma --- e2e/helpers/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"]', From 4b37b0fc1e5379f9818c7d097effa4b6be601a74 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 25 Feb 2019 14:55:06 +0100 Subject: [PATCH 16/60] =?UTF-8?q?#1155=20item.index=20a=C3=B1adir=20groupi?= =?UTF-8?q?ng=20y=20packing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/item/front/index/index.html | 4 ++++ 1 file changed, 4 insertions(+) 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}} Date: Tue, 26 Feb 2019 17:32:32 +0100 Subject: [PATCH 17/60] #1152 refactor ticket.sale --- e2e/helpers/extensions.js | 10 +++ e2e/helpers/selectors.js | 5 +- e2e/paths/ticket-module/07_edit_sale.spec.js | 15 ++-- modules/ticket/front/sale/editDiscount.html | 1 + modules/ticket/front/sale/index.html | 95 ++++++++++++-------- modules/ticket/front/sale/index.js | 18 +--- 6 files changed, 82 insertions(+), 62 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 958c92d02..8b4d21745 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -160,6 +160,16 @@ let actions = { .catch(done); }, + waitToFocus: function(selector, done) { + this.wait(selector) + .evaluate_now(selector => { + let element = document.querySelector(selector); + element.focus(); + }, done, selector) + .then(done) + .catch(done); + }, + isVisible: function(selector, done) { this.wait(selector) .evaluate_now(elementSelector => { diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index bd850ef3f..be035d0e5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -339,12 +339,13 @@ export default { firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img', firstSaleZoomedImage: 'body > div > div > img', firstSaleQuantity: `vn-textfield[model="sale.quantity"]:nth-child(1) input`, + firstSaleQuantityCell: `vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable`, firstSaleQuantityClearInput: `vn-textfield[model="sale.quantity"] div.suffix > i`, firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(4) > span', firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7) > span', - firstSalePriceInput: 'vn-ticket-sale:nth-child(1) > vn-vertical > vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown > div > div.content > div > vn-textfield', + firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-textfield input', firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8) > span', - firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount > div > vn-textfield > div > div > div.infix > input.ng-not-empty', + firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-textfield input', firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)', firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(1)`, diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 9a0a3f35d..cc3125f9b 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -2,7 +2,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; // #1152 refactor ticket.sale, update price no funciona correctamente. -xdescribe('Ticket Edit sale path', () => { +describe('Ticket Edit sale path', () => { const nightmare = createNightmare(); beforeAll(() => { @@ -138,7 +138,7 @@ xdescribe('Ticket Edit sale path', () => { it('should try to add a higher quantity value and then receive an error', async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) + .waitToFocus(selectors.ticketSales.firstSaleQuantityCell) .write(selectors.ticketSales.firstSaleQuantity, '9\u000d') .waitForLastSnackbar(); @@ -147,7 +147,7 @@ xdescribe('Ticket Edit sale path', () => { it('should remove 1 from quantity', async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) + .waitToFocus(selectors.ticketSales.firstSaleQuantityCell) .write(selectors.ticketSales.firstSaleQuantity, '4\u000d') .waitForLastSnackbar(); @@ -180,7 +180,6 @@ xdescribe('Ticket Edit sale path', () => { it('should update the discount', async() => { const result = await nightmare .waitToClick(selectors.ticketSales.firstSaleDiscount) - .wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded .write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d') // .write('body', '\u000d') // simulates enter .waitForLastSnackbar(); @@ -597,16 +596,16 @@ xdescribe('Ticket Edit sale path', () => { describe('when state is preparation and loged as salesPerson', () => { it(`shouldnt be able to edit the sale price`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSalePrice) - .exists(selectors.ticketSales.firstSalePriceInput); + .waitToClick(selectors.ticketSales.firstSaleID) + .exists(selectors.ticketSales.firstSalePrice); expect(result).toBeFalsy(); }); it(`shouldnt be able to edit the sale discount`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleDiscount) - .exists(selectors.ticketSales.firstSaleDiscountInput); + .waitToClick(selectors.ticketSales.firstSaleID) + .exists(selectors.ticketSales.firstSaleDiscount); expect(result).toBeFalsy(); }); diff --git a/modules/ticket/front/sale/editDiscount.html b/modules/ticket/front/sale/editDiscount.html index 9822ae802..cdc5f0839 100644 --- a/modules/ticket/front/sale/editDiscount.html +++ b/modules/ticket/front/sale/editDiscount.html @@ -3,6 +3,7 @@
- {{sale.quantity}} - - - - + + {{sale.quantity}} + + + + + - -
MANÁ: {{$ctrl.mana | currency: 'EUR':0}}
-
-
- - - - - -
-

New price

-

{{($ctrl.sale.quantity * $ctrl.editedPrice) - - (($ctrl.sale.discount * ($ctrl.sale.quantity * $ctrl.editedPrice))/100) - | currency: 'EUR':2}}

+ on-open="$ctrl.getManaSalespersonMana()" + on-close="$ctrl.mana = null"> + + +
+ +
MANÁ: {{$ctrl.mana | currency: 'EUR':0}}
+
+
+ + + + + +
+

New price

+

{{($ctrl.sale.quantity * $ctrl.editedPrice) + - (($ctrl.sale.discount * ($ctrl.sale.quantity * $ctrl.editedPrice))/100) + | currency: 'EUR':2}}

+
@@ -186,22 +197,36 @@ - - + on-open="$ctrl.getManaSalespersonMana()" + on-close="$ctrl.mana = null"> + + + + + on-open="$ctrl.getManaSalespersonMana()" + on-close="$ctrl.mana = null"> + + { - firstFocusable.select(); - }); - setTimeout(() => { - firstFocusable.focus(); - }, 200); - } - } - // Slesperson Mana getManaSalespersonMana() { this.$http.get(`/api/Tickets/${this.$state.params.id}/getSalesPersonMana`).then(res => { @@ -248,15 +235,14 @@ class Controller { }; this.$scope.editPricePopover.parent = event.target; this.$scope.editPricePopover.show(); - this.focusFirstInput(this.$scope.editPricePopover.$element[0]); } updatePrice() { if (this.editedPrice != this.sale.price) { this.$http.post(`/ticket/api/Sales/updatePrice`, {id: this.edit.id, price: this.editedPrice, ticketFk: this.ticket.id}).then(() => { this.sale.price = this.edit.price; - this.$scope.model.refresh(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.$scope.model.refresh(); }); } @@ -274,13 +260,11 @@ class Controller { }]; this.$scope.editPopover.parent = event.target; this.$scope.editPopover.show(); - this.focusFirstInput(this.$scope.editPopover.$element[0]); } showEditDialog() { this.edit = this.getCheckedLines(); this.$scope.editDialog.show(); - this.focusFirstInput(this.$scope.editDialog.$element[0]); } hideEditDialog() { From a37fdd1e332fa3b1f4c1893f437b0ada9d429a92 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 26 Feb 2019 17:32:58 +0100 Subject: [PATCH 18/60] EQTAX restriction deleted CR Javi --- .../client-module/03_edit_fiscal_data.spec.js | 29 ------------------- modules/client/back/models/client.js | 9 ------ 2 files changed, 38 deletions(-) diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js index e8b4ada00..e1ca583df 100644 --- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -58,35 +58,6 @@ describe('Client Edit fiscalData path', () => { .accessToSection('client.card.fiscalData'); }); - it('should receive an error if VIES and EQtax are being ticked together', async() => { - const result = await nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .clearInput(selectors.clientFiscalData.socialNameInput) - .write(selectors.clientFiscalData.socialNameInput, 'SMASH!') - .clearInput(selectors.clientFiscalData.fiscalIdInput) - .write(selectors.clientFiscalData.fiscalIdInput, '94980061C') - .clearInput(selectors.clientFiscalData.addressInput) - .write(selectors.clientFiscalData.addressInput, 'Somewhere edited') - .clearInput(selectors.clientFiscalData.postcodeInput) - .write(selectors.clientFiscalData.postcodeInput, '12345') - .clearInput(selectors.clientFiscalData.cityInput) - .write(selectors.clientFiscalData.cityInput, 'N/A') - .autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'Francia') - .autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province two') - .waitToClick(selectors.clientFiscalData.activeCheckbox) - .waitToClick(selectors.clientFiscalData.frozenCheckbox) - .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox) - .waitToClick(selectors.clientFiscalData.viesCheckbox) - .waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox) - .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox) - .waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox) - .waitToClick(selectors.clientFiscalData.verifiedDataCheckbox) - .waitToClick(selectors.clientFiscalData.saveButton) - .waitForLastSnackbar(); - - expect(result).toEqual('Cannot check VIES and Equalization Tax'); - }, 15000); - it('should receive an error if the fiscal id contains A or B at the beginning', async() => { const result = await nightmare .waitToClick(selectors.clientFiscalData.viesCheckbox) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 3de4a4a66..1fd44b9c8 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -90,15 +90,6 @@ module.exports = Self => { err(); } - Self.validate('isVies', hasEquTax, { - message: 'Cannot check VIES and Equalization Tax' - }); - - function hasEquTax(err) { - if (this.isVies && this.isEqualizated) - err(); - } - Self.validate('isEqualizated', cannotHaveET, { message: 'Cannot check Equalization Tax in this NIF/CIF' }); From 60ec49abbd81a532452dc7a850d6480ea182b35d Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 26 Feb 2019 17:33:51 +0100 Subject: [PATCH 19/60] #1103 vnTextfield doesnt blur anymore --- front/core/components/textfield/textfield.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/front/core/components/textfield/textfield.js b/front/core/components/textfield/textfield.js index f47b3de37..88a585eda 100644 --- a/front/core/components/textfield/textfield.js +++ b/front/core/components/textfield/textfield.js @@ -18,18 +18,15 @@ export default class Textfield extends Input { if (!this.oldValue) this.saveOldValue(); }); - this.input.addEventListener('keyup', e => { - if (e.key == 'Escape') { - this.value = this.oldValue; - this.cancelled = true; - e.stopPropagation(); - } - if (e.key == 'Escape' || e.key == 'Enter') - this.input.blur(); - }); + if (e.defaultPrevented || e.key != 'Escape') + return; - this.input.addEventListener('blur', () => { + this.value = this.oldValue; + this.cancelled = true; + e.preventDefault(); + }); + this.input.addEventListener('change', e => { if (this.onChange && !this.cancelled && (this.oldValue != this.value)) { this.onChange(); this.saveOldValue(); From fd1e380d7ac5b5c63278c6f426ed113c1516d51a Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 26 Feb 2019 17:34:25 +0100 Subject: [PATCH 20/60] wrong comparision fixed --- front/core/components/td-editable/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front/core/components/td-editable/index.js b/front/core/components/td-editable/index.js index 780e6160c..f88d9df33 100644 --- a/front/core/components/td-editable/index.js +++ b/front/core/components/td-editable/index.js @@ -27,7 +27,8 @@ export default class Controller extends Component { }); element.addEventListener('focusout', event => { - if (this.field || this.disabled) return; + if (!this.field || this.disabled) return; + // this.destroyTimer(); this.lastEvent = event; let target = event.relatedTarget; while (target && target != element) From c2277848774c0dbca96229c7ad3dc7ab44f2e327 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 27 Feb 2019 10:05:49 +0100 Subject: [PATCH 21/60] typoe fixed --- modules/item/front/index/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 38bcde738..5a2988537 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -23,7 +23,7 @@ Id Grouping - packing + Packing Description Stems Type @@ -55,8 +55,8 @@ {{::item.id | zeroFill:6}} - {{::item.grouping | dashIfEmpty}} - {{::item.packing | dashIfEmpty}} + {{::item.grouping | dashIfEmpty}} + {{::item.packing | dashIfEmpty}} Date: Wed, 27 Feb 2019 10:54:38 +0100 Subject: [PATCH 22/60] e2e fixed --- .../client-module/03_edit_fiscal_data.spec.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js index e1ca583df..d9a4b3f22 100644 --- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -58,6 +58,35 @@ describe('Client Edit fiscalData path', () => { .accessToSection('client.card.fiscalData'); }); + it('should receive an error if VIES and EQtax are being ticked together', async() => { + const result = await nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .clearInput(selectors.clientFiscalData.socialNameInput) + .write(selectors.clientFiscalData.socialNameInput, 'SMASH!') + .clearInput(selectors.clientFiscalData.fiscalIdInput) + .write(selectors.clientFiscalData.fiscalIdInput, '94980061C') + .clearInput(selectors.clientFiscalData.addressInput) + .write(selectors.clientFiscalData.addressInput, 'Somewhere edited') + .clearInput(selectors.clientFiscalData.postcodeInput) + .write(selectors.clientFiscalData.postcodeInput, '12345') + .clearInput(selectors.clientFiscalData.cityInput) + .write(selectors.clientFiscalData.cityInput, 'N/A') + .autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'Francia') + .autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province two') + .waitToClick(selectors.clientFiscalData.activeCheckbox) + .waitToClick(selectors.clientFiscalData.frozenCheckbox) + .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox) + .waitToClick(selectors.clientFiscalData.viesCheckbox) + .waitToClick(selectors.clientFiscalData.invoiceByMailCheckbox) + .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckbox) + .waitToClick(selectors.clientFiscalData.equalizationTaxCheckbox) + .waitToClick(selectors.clientFiscalData.verifiedDataCheckbox) + .waitToClick(selectors.clientFiscalData.saveButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }, 15000); + it('should receive an error if the fiscal id contains A or B at the beginning', async() => { const result = await nightmare .waitToClick(selectors.clientFiscalData.viesCheckbox) From 331b69963fc13d2b90dfa5ef5959b4cc62eb69e7 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 27 Feb 2019 10:56:31 +0100 Subject: [PATCH 23/60] loggable now works with transactions --- loopback/common/models/loggable.js | 48 ++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/loopback/common/models/loggable.js b/loopback/common/models/loggable.js index 8df5762fc..c37b9e85d 100644 --- a/loopback/common/models/loggable.js +++ b/loopback/common/models/loggable.js @@ -12,6 +12,10 @@ module.exports = function(Self) { }); Self.observe('before save', async function(ctx) { + let options = {}; + if (ctx.options && ctx.options.transaction) + options.transaction = ctx.options.transaction; + let oldInstance; let oldInstanceFk; let newInstance; @@ -22,7 +26,7 @@ module.exports = function(Self) { oldInstance = await fkToValue(oldInstanceFk, ctx); if (ctx.where && !ctx.currentInstance) { let fields = Object.keys(ctx.data); - ctx.oldInstances = await ctx.Model.app.models[ctx.Model.definition.name].find({where: ctx.where, fields: fields}); + ctx.oldInstances = await ctx.Model.app.models[ctx.Model.definition.name].find({where: ctx.where, fields: fields}, options); } } if (ctx.isNewInstance) @@ -33,10 +37,14 @@ module.exports = function(Self) { }); Self.observe('before delete', async function(ctx) { + let options = {}; + if (ctx.options && ctx.options.transaction) + options.transaction = ctx.options.transaction; + if (ctx.where) { let affectedModel = ctx.Model.definition.name; let definition = ctx.Model.definition; - let deletedInstances = await ctx.Model.app.models[affectedModel].find({where: ctx.where}); + let deletedInstances = await ctx.Model.app.models[affectedModel].find({where: ctx.where}, options); let relation = definition.settings.log.relation; if (relation) { @@ -61,6 +69,10 @@ module.exports = function(Self) { }); async function logDeletedInstances(ctx, loopBackContext) { + let options = {}; + if (ctx.options && ctx.options.transaction) + options.transaction = ctx.options.transaction; + ctx.hookState.oldInstance.forEach(async instance => { let userFk; if (loopBackContext) @@ -80,16 +92,16 @@ module.exports = function(Self) { newInstance: {} }; - let transaction = {}; - if (ctx.options && ctx.options.transaction) - transaction = ctx.options.transaction; - let logModel = definition.settings.log.model; - await ctx.Model.app.models[logModel].create(logRecord, transaction); + await ctx.Model.app.models[logModel].create(logRecord, options); }); } async function fkToValue(instance, ctx) { + let options = {}; + if (ctx.options && ctx.options.transaction) + options.transaction = ctx.options.transaction; + let cleanInstance = JSON.parse(JSON.stringify(instance)); let result = {}; for (let key in cleanInstance) { @@ -98,8 +110,11 @@ module.exports = function(Self) { for (let key1 in ctx.Model.relations) { let val1 = ctx.Model.relations[key1]; if (val1.keyFrom == key && key != 'id') { - let recordSet = await val1.modelTo.findById(val); - val = recordSet.name; // FIXME preparar todos los modelos con campo name + let recordSet = await ctx.Model.app.models[val1.modelTo.modelName].findById(val, options); + let definition = val1.modelTo.definition; + let changedModelValue = definition.settings.log && definition.settings.log.changedModelValue; + + val = (changedModelValue && recordSet && recordSet[changedModelValue]) || (recordSet && recordSet.id) || val; // FIXME preparar todos los modelos con campo name break; } } @@ -109,6 +124,10 @@ module.exports = function(Self) { } async function logInModel(ctx, loopBackContext) { + let options = {}; + if (ctx.options && ctx.options.transaction) + options.transaction = ctx.options.transaction; + let definition = ctx.Model.definition; let primaryKey; for (let property in definition.properties) { @@ -143,10 +162,11 @@ module.exports = function(Self) { // Sets the changedModelValue to save and the instances changed in case its an updateAll let changedModelValue = definition.settings.log.changedModelValue; + let where; if (changedModelValue && (!ctx.instance || !ctx.instance[changedModelValue])) { - var where = []; changedModelId = []; - let changedInstances = await ctx.Model.app.models[definition.name].find({where: ctx.where, fields: ['id', changedModelValue]}); + where = []; + let changedInstances = await ctx.Model.app.models[definition.name].find({where: ctx.where, fields: ['id', changedModelValue]}, options); changedInstances.forEach(element => { where.push(element[changedModelValue]); changedModelId.push(element.id); @@ -185,11 +205,7 @@ module.exports = function(Self) { let logModel = definition.settings.log.model; - let transaction = {}; - if (ctx.options && ctx.options.transaction) - transaction = ctx.options.transaction; - - await ctx.Model.app.models[logModel].create(logsToSave, transaction); + await ctx.Model.app.models[logModel].create(logsToSave, options); } // this function retuns all the instances changed in case this is an updateAll From 048c5c2ad854fbc19a92df3fac0d642c208301a3 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 27 Feb 2019 12:03:54 +0100 Subject: [PATCH 24/60] #1104 order.index mostar mas campos --- modules/order/back/methods/order/filter.js | 152 ++++++++++++++++++ modules/order/back/methods/order/getTaxes.js | 33 +++- .../back/methods/order/specs/filter.spec.js | 32 ++++ .../back/methods/order/specs/getTaxes.spec.js | 2 +- modules/order/back/models/order.js | 1 + modules/order/front/index/index.html | 26 +-- modules/order/front/index/index.js | 54 ++----- modules/order/front/search-panel/index.html | 6 +- services/db/install/boot.sh | 2 +- .../db/install/changes/1-orderGetTotal.sql | 29 ++++ .../db/install/changes/2-orderGetTotal.sql | 36 +++++ services/db/install/changes/3-orderGetTax.sql | 51 ++++++ 12 files changed, 358 insertions(+), 66 deletions(-) create mode 100644 modules/order/back/methods/order/filter.js create mode 100644 modules/order/back/methods/order/specs/filter.spec.js create mode 100644 services/db/install/changes/1-orderGetTotal.sql create mode 100644 services/db/install/changes/2-orderGetTotal.sql create mode 100644 services/db/install/changes/3-orderGetTax.sql diff --git a/modules/order/back/methods/order/filter.js b/modules/order/back/methods/order/filter.js new file mode 100644 index 000000000..00b4eec96 --- /dev/null +++ b/modules/order/back/methods/order/filter.js @@ -0,0 +1,152 @@ + +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; + +module.exports = Self => { + Self.remoteMethod('filter', { + description: 'Find all instances of the model matched by filter from the data source.', + accepts: [ + { + arg: 'ctx', + type: 'Object', + http: {source: 'context'} + }, { + arg: 'filter', + type: 'Object', + description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string` + }, { + arg: 'search', + type: 'String', + description: `If it's and integer searchs by id, otherwise it searchs by nickname` + }, { + arg: 'from', + type: 'Date', + description: `The from date` + }, { + arg: 'to', + type: 'Date', + description: `The to date` + }, { + arg: 'id', + type: 'Integer', + description: `The ticket id` + }, { + arg: 'clientFk', + type: 'Integer', + description: `The client id` + }, { + arg: 'agencyModeFk', + type: 'Integer', + description: `The agency mode id` + }, { + arg: 'workerFk', + type: 'Integer', + description: `The salesperson id` + }, { + arg: 'isConfirmed', + type: 'Boolean', + description: `Order is confirmed` + } + ], + returns: { + type: ['Object'], + root: true + }, + http: { + path: '/filter', + verb: 'GET' + } + }); + + Self.filter = async(ctx, filter) => { + let conn = Self.dataSource.connector; + + let where = buildFilter(ctx.args, (param, value) => { + switch (param) { + case 'search': + return {'o.id': value}; + case 'from': + return {'o.date_send': {gte: value}}; + case 'to': + return {'o.date_send': {lte: value}}; + case 'workerFk': + return {'c.salesPersonFk': value}; + case 'clientFk': + return {'o.customer_id': value}; + case 'agencyModeFk': + return {'o.agency_id': value}; + case 'sourceApp': + return {'o.source_app': value}; + case 'isConfirmed': + return {'o.confirmed': value ? 1 : 0}; + case 'id': + param = `o.${param}`; + return {[param]: value}; + } + }); + + filter = mergeFilters(filter, {where}); + + let stmts = []; + let stmt; + + stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter'); + + stmt = new ParameterizedSQL( + `CREATE TEMPORARY TABLE tmp.filter + (INDEX (id)) + ENGINE = MEMORY + SELECT + o.id, + o.date_send landed, + o.date_make created, + o.customer_id clientFk, + o.agency_id agencyModeFk, + o.address_id addressFk, + o.company_id companyFk, + o.source_app sourceApp, + o.confirmed isConfirmed, + c.name clientName, + u.nickname workerNickname, + u.id userId, + co.code companyCode + FROM hedera.order o + LEFT JOIN address a ON a.id = o.address_id + LEFT JOIN agencyMode am ON am.id = o.agency_id + LEFT JOIN client c ON c.id = o.customer_id + LEFT JOIN worker wk ON wk.id = c.salesPersonFk + LEFT JOIN account.user u ON u.id = wk.userFk + LEFT JOIN company co ON co.id = o.company_id`); + stmt.merge(conn.makeSuffix(filter)); + stmts.push(stmt); + + stmts.push(` + CREATE TEMPORARY TABLE tmp.order + (INDEX (orderFk)) + ENGINE = MEMORY + SELECT id AS orderFk + FROM tmp.filter`); + + stmts.push('CALL hedera.orderGetTotal()'); + + let orderIndex = stmts.push(` + SELECT f.*, ot.* + FROM tmp.filter f + LEFT JOIN tmp.orderTotal ot ON ot.orderFk = f.id`) - 1; + + stmts.push(` + DROP TEMPORARY TABLE + tmp.order, + tmp.orderTotal`); + + stmts.push( + `DROP TEMPORARY TABLE + tmp.filter`); + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + + return result[orderIndex]; + }; +}; diff --git a/modules/order/back/methods/order/getTaxes.js b/modules/order/back/methods/order/getTaxes.js index 71bcb2da6..84101acd8 100644 --- a/modules/order/back/methods/order/getTaxes.js +++ b/modules/order/back/methods/order/getTaxes.js @@ -1,3 +1,5 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + module.exports = Self => { Self.remoteMethod('getTaxes', { description: 'Gets the taxes of a given order', @@ -20,11 +22,32 @@ module.exports = Self => { }); Self.getTaxes = async orderFk => { - let query = `CALL hedera.orderGetTax(?); - SELECT * FROM tmp.orderTax;`; - let res = await Self.rawSql(query, [orderFk]); - let taxes = res[1]; + let conn = Self.dataSource.connector; + let stmts = []; + let stmt; - return taxes; + stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.order'); + + + stmt = new ParameterizedSQL(` + CREATE TEMPORARY TABLE tmp.order + (INDEX (orderFk)) + ENGINE = MEMORY + SELECT ? AS orderFk`, [orderFk]); + stmts.push(stmt); + + stmts.push('CALL hedera.orderGetTax()'); + + let orderTaxIndex = stmts.push('SELECT * FROM tmp.orderTax') - 1; + + stmts.push(` + DROP TEMPORARY TABLE + tmp.order, + tmp.orderTax`); + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + + return result[orderTaxIndex]; }; }; diff --git a/modules/order/back/methods/order/specs/filter.spec.js b/modules/order/back/methods/order/specs/filter.spec.js new file mode 100644 index 000000000..a64ecb17f --- /dev/null +++ b/modules/order/back/methods/order/specs/filter.spec.js @@ -0,0 +1,32 @@ +const app = require('vn-loopback/server/server'); + +describe('order filter()', () => { + it('should call the filter method with a basic search', async() => { + let ctx = {params: {}}; + + let filter = {where: {'o.id': 2}}; + let result = await app.models.Order.filter(ctx, filter); + let orderId = result[0].id; + + expect(orderId).toEqual(2); + }); + + it('should call the filter method with a single advanced search', async() => { + let ctx = {params: {}}; + + let filter = {where: {'o.confirmed': false}}; + let result = await app.models.Order.filter(ctx, filter); + + expect(result.length).toEqual(6); + }); + + it('should call the filter method with a complex advanced search', async() => { + let ctx = {params: {}}; + + let filter = {where: {'o.confirmed': false, 'c.salesPersonFk': 18}}; + let result = await app.models.Order.filter(ctx, filter); + + expect(result.length).toEqual(1); + expect(result[0].id).toEqual(16); + }); +}); diff --git a/modules/order/back/methods/order/specs/getTaxes.spec.js b/modules/order/back/methods/order/specs/getTaxes.spec.js index 5a14d3bdd..b41183c98 100644 --- a/modules/order/back/methods/order/specs/getTaxes.spec.js +++ b/modules/order/back/methods/order/specs/getTaxes.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); describe('order getTaxes()', () => { it('should call the getTaxes method and return undefined if its called with a string', async() => { - let result = await app.models.Order.getTaxes('pepinillos'); + let result = await app.models.Order.getTaxes('string'); expect(result.length).toEqual(0); }); diff --git a/modules/order/back/models/order.js b/modules/order/back/models/order.js index 1b07222f3..dc8b7c352 100644 --- a/modules/order/back/models/order.js +++ b/modules/order/back/models/order.js @@ -12,4 +12,5 @@ module.exports = Self => { require('../methods/order/newFromTicket')(Self); require('../methods/order/updateBasicData')(Self); require('../methods/order/confirm')(Self); + require('../methods/order/filter')(Self); }; diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index b2d934ce4..705fb5c7a 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -1,24 +1,24 @@ + data="orders" + auto-load="false">
-
- + Id @@ -29,6 +29,7 @@ Created Landed Company + Total @@ -37,14 +38,14 @@ {{::order.id}} - {{::order.client.name}} + {{::order.clientName}} - {{::order.client.salesPerson.user.nickname | dashIfEmpty}} + ng-click="$ctrl.showWorkerDescriptor($event, order.userId)"> + {{::order.workerNickname | dashIfEmpty}} @@ -56,7 +57,8 @@ {{::order.sourceApp}} {{::order.created | date:'dd/MM/yyyy HH:mm'}} {{::order.landed | date:'dd/MM/yyyy'}} - {{::order.company.code}} + {{::order.companyCode}} + {{::order.total | currency: 'EUR': 2 | dashIfEmpty}} - - diff --git a/services/db/install/boot.sh b/services/db/install/boot.sh index 70704c48e..02727e089 100755 --- a/services/db/install/boot.sh +++ b/services/db/install/boot.sh @@ -10,7 +10,7 @@ echo "[INFO] -> Imported ./dump/mysqlPlugins.sql" mysql -u root -f < ./dump/mysqlPlugins.sql # Import changes -for file in changes/*/*.sql; do +for file in changes/*.sql; do echo "[INFO] -> Imported ./$file" mysql -u root -fc < $file done diff --git a/services/db/install/changes/1-orderGetTotal.sql b/services/db/install/changes/1-orderGetTotal.sql new file mode 100644 index 000000000..1e15741c6 --- /dev/null +++ b/services/db/install/changes/1-orderGetTotal.sql @@ -0,0 +1,29 @@ +USE `hedera`; +DROP procedure IF EXISTS `orderGetTotal`; + +DELIMITER $$ +USE `hedera`$$ + +CREATE DEFINER=`root`@`%` PROCEDURE `orderGetTotal`() +BEGIN +/** +* Calcula el total con IVA para un conjunto de orders. +* +* @table tmp.order(orderFk) Identificadores de las ordenes a calcular +* @return tmp.orderTotal Total para cada order +*/ +CALL orderGetTax; + +DROP TEMPORARY TABLE IF EXISTS tmp.orderTotal; +CREATE TEMPORARY TABLE tmp.orderTotal +(INDEX (orderFk)) +ENGINE = MEMORY +SELECT o.orderFk, IFNULL(SUM(ot.taxBase + ot.tax + ot.equalizationTax), 0.0) AS total +FROM tmp.order o +LEFT JOIN tmp.orderTax ot ON o.orderFk = ot.orderFk +GROUP BY orderFk; + +DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; +END$$ + +DELIMITER ; diff --git a/services/db/install/changes/2-orderGetTotal.sql b/services/db/install/changes/2-orderGetTotal.sql new file mode 100644 index 000000000..dac65bbca --- /dev/null +++ b/services/db/install/changes/2-orderGetTotal.sql @@ -0,0 +1,36 @@ +USE `hedera`; +DROP FUNCTION IF EXISTS `orderGetTotal`; + +DELIMITER $$ +USE `hedera`$$ + +CREATE DEFINER=`root`@`%` FUNCTION `orderGetTotal`(vOrder INT) RETURNS decimal(10,2) +READS SQL DATA +DETERMINISTIC +BEGIN +/** +* Obtiene el total de un pedido con el IVA y el recargo de +* equivalencia incluidos. +* +* @param vOrder El identificador del pedido +* @return El total del pedido +*/ +DECLARE vTotal DECIMAL(10,2); + +DROP TEMPORARY TABLE IF EXISTS tmp.order; +CREATE TEMPORARY TABLE tmp.order +ENGINE = MEMORY +SELECT vOrder orderFk; + +CALL orderGetTotal; + +SELECT total INTO vTotal FROM tmp.orderTotal; + +DROP TEMPORARY TABLE +tmp.order, +tmp.orderTotal; + +RETURN vTotal; +END$$ + +DELIMITER ; diff --git a/services/db/install/changes/3-orderGetTax.sql b/services/db/install/changes/3-orderGetTax.sql new file mode 100644 index 000000000..73cb7c42e --- /dev/null +++ b/services/db/install/changes/3-orderGetTax.sql @@ -0,0 +1,51 @@ +USE `hedera`; +DROP procedure IF EXISTS `orderGetTax`; + +DELIMITER $$ +USE `hedera`$$ + +CREATE DEFINER=`root`@`%` PROCEDURE `orderGetTax`() +READS SQL DATA +BEGIN +/** +* Calcula el IVA, y el recargo de equivalencia de un pedido +* desglosados por tipos. +* +* @tabla tmp.order Contiene los identificadores de los pedidos +* @treturn tmp.orderTax Bases imponibles, IVA y recargo de equivalencia +*/ +CALL vn.taxGetRates (NULL); + +-- Calcula el IVA y el recargo desglosado. + +DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; +CREATE TEMPORARY TABLE tmp.orderTax +(INDEX (orderFk)) +ENGINE = MEMORY +SELECT id orderFk, t.type, t.taxBase, +CAST(IF(t.hasTax, t.taxBase * x.rate, 0) AS DECIMAL(10,2)) tax, +CAST(IF(t.hasEqualizationTax, t.taxBase * x.equalizationTax, 0) AS DECIMAL(10,2)) equalizationTax +FROM ( +SELECT o.id, g.countryFk, g.type +,SUM(CAST(m.amount * m.price AS DECIMAL(10,2))) taxBase +,NOT(c.isVies AND p.countryFk <> c.countryFk) hasTax +,c.isEqualizated != FALSE AS hasEqualizationTax +FROM `order` o +JOIN tmp.order tmpo ON tmpo.orderFk = o.id +JOIN orderRow m ON m.orderFk = o.id +JOIN vn.item a ON a.id = m.itemFk +JOIN vn.client c ON c.id = o.customer_id +JOIN vn.supplier p ON p.id = o.company_id +JOIN tmp.taxClass g +ON g.countryFk = p.countryFk AND g.taxClassFk = a.taxClassFk +GROUP BY o.id, g.type +) t +JOIN tmp.taxType x +ON x.countryFk = t.countryFk AND x.type = t.type; + +DROP TEMPORARY TABLE +tmp.taxClass, +tmp.taxType; +END$$ + +DELIMITER; \ No newline at end of file From 1e89b6977a870807f9a3350b2a612cd4897c7237 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 27 Feb 2019 13:10:26 +0100 Subject: [PATCH 25/60] #1070 Renombrar columnas de la vista vn.worker --- back/models/account.json | 142 +++++++++++---------- modules/worker/back/models/worker.json | 7 +- modules/worker/front/basic-data/index.html | 2 +- modules/worker/front/descriptor/index.html | 6 +- modules/worker/front/index/index.html | 2 +- modules/worker/front/summary/index.html | 5 +- 6 files changed, 84 insertions(+), 80 deletions(-) diff --git a/back/models/account.json b/back/models/account.json index 89b1f42c5..c3b8c38d7 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -1,72 +1,74 @@ { - "name": "Account", - "base": "VnModel", - "options": { - "mysql": { - "table": "account.user" - } - }, - "properties": { - "id": { - "type": "number", - "required": true - }, - "name": { - "type": "string", - "required": true - }, - "roleFk": { - "type": "number", - "mysql": { - "columnName": "role" - } - }, - "nickname": { - "type": "string" - }, - "password": { - "type": "string", - "required": true - }, - "active": { - "type": "boolean" - }, - "email": { - "type": "string" - }, - "created": { - "type": "date" - }, - "updated": { - "type": "date" - } - }, - "relations": { - "role": { - "type": "belongsTo", - "model": "Role", - "foreignKey": "roleFk" - } - }, - "acls": [ - { - "property": "login", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - }, { - "property": "logout", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$authenticated", - "permission": "ALLOW" - }, { - "property": "validateToken", - "accessType": "EXECUTE", - "principalType": "ROLE", - "principalId": "$authenticated", - "permission": "ALLOW" - } - ] + "name": "Account", + "base": "VnModel", + "options": { + "mysql": { + "table": "account.user" + } + }, + "properties": { + "id": { + "type": "number", + "required": true + }, + "name": { + "type": "string", + "required": true + }, + "roleFk": { + "type": "number", + "mysql": { + "columnName": "role" + } + }, + "nickname": { + "type": "string" + }, + "password": { + "type": "string", + "required": true + }, + "active": { + "type": "boolean" + }, + "email": { + "type": "string" + }, + "created": { + "type": "date" + }, + "updated": { + "type": "date" + } + }, + "relations": { + "role": { + "type": "belongsTo", + "model": "Role", + "foreignKey": "roleFk" + } + }, + "acls": [ + { + "property": "login", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }, + { + "property": "logout", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$authenticated", + "permission": "ALLOW" + }, + { + "property": "validateToken", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$authenticated", + "permission": "ALLOW" + } + ] } diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index c61f90031..4196036a6 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -17,9 +17,12 @@ "type": "string", "required": true }, - "name": { + "lastName": { "type": "string", - "required": true + "required": true, + "mysql": { + "columnName": "name" + } }, "phone": { "type" : "String" diff --git a/modules/worker/front/basic-data/index.html b/modules/worker/front/basic-data/index.html index 2ac898b59..b12689c1d 100644 --- a/modules/worker/front/basic-data/index.html +++ b/modules/worker/front/basic-data/index.html @@ -18,7 +18,7 @@ + field="$ctrl.worker.lastName"> diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 5b6bdaa6b..37c70fb5a 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -10,15 +10,15 @@
-
- {{$ctrl.worker.firstName}} {{$ctrl.worker.name}} +
+ {{$ctrl.worker.firstName}} {{$ctrl.worker.lastName}}
+ title="{{$ctrl.worker.firstName}} {{$ctrl.worker.lastName}}"> diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index 54bcda982..7debfc728 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -27,7 +27,7 @@ value="{{::worker.id}}"> + value="{{::worker.user.nickname}}"> diff --git a/modules/worker/front/summary/index.html b/modules/worker/front/summary/index.html index bc58e7bf1..d5c423fab 100644 --- a/modules/worker/front/summary/index.html +++ b/modules/worker/front/summary/index.html @@ -1,5 +1,5 @@ -
{{worker.firstName}} {{worker.name}}
+
{{worker.firstName}} {{worker.lastName}}

Basic data

@@ -22,8 +22,7 @@ value="{{worker.userFk}}">
+ value="{{worker.user.name}}"> From ac6851bf4a2e9a36bd75bad52b1cf91d5b71d252 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 27 Feb 2019 16:50:14 +0100 Subject: [PATCH 26/60] eslint rules passed --- modules/claim/back/methods/claim/regularizeClaim.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index a565820f8..ee37fdf7d 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -17,7 +17,7 @@ module.exports = Self => { } }); - Self.regularizeClaim = async (ctx, params) => { + Self.regularizeClaim = async(ctx, params) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; const resolvedState = 3; From 4729dda5f697d4e99747e469ef469ce8084ebe06 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 28 Feb 2019 08:55:34 +0100 Subject: [PATCH 27/60] isDefaultAddress to defaultAddressFk migration #1108 --- e2e/helpers/selectors.js | 2 + .../client-module/01_create_client.spec.js | 2 + loopback/locale/en.json | 4 +- loopback/locale/es.json | 6 +- loopback/server/datasources.json | 4 +- .../methods/address/createDefaultAddress.js | 42 +++++++++ .../specs/createDefaultAddress.spec.js | 35 ++++++++ .../back/methods/client/createWithUser.js | 30 +++++-- .../client/specs/createWithUser.spec.js | 8 -- modules/client/back/methods/client/summary.js | 3 +- modules/client/back/models/address.js | 42 ++++----- modules/client/back/models/address.json | 3 - modules/client/back/models/client.js | 21 +++++ modules/client/back/models/client.json | 8 +- .../client/front/address/create/index.html | 8 +- modules/client/front/address/create/index.js | 31 +++++-- .../client/front/address/create/index.spec.js | 34 ++++++- modules/client/front/address/index/index.html | 13 +-- modules/client/front/address/index/index.js | 54 +++++++++-- .../client/front/address/index/index.spec.js | 61 ++++++++++--- modules/client/front/routes.json | 5 +- modules/client/front/summary/index.html | 6 +- modules/order/front/create/card.js | 18 +++- modules/ticket/back/models/ticket.json | 6 +- modules/ticket/front/create/card.js | 18 +++- .../install/changes/4-addressAfterUpdate.sql | 32 +++++++ .../install/changes/5-addressBeforeInsert.sql | 25 ++++++ .../install/changes/6-addressBeforeUpdate.sql | 14 +++ .../install/changes/7-clientAfterInsert.sql | 1 + .../install/changes/8-clientAfterUpdate.sql | 19 ++++ .../changes/9-migrateDefaultAddress.sql | 9 ++ services/db/install/dump/fixtures.sql | 89 ++++++++++++------- 32 files changed, 517 insertions(+), 136 deletions(-) create mode 100644 modules/client/back/methods/address/createDefaultAddress.js create mode 100644 modules/client/back/methods/address/specs/createDefaultAddress.spec.js create mode 100644 services/db/install/changes/4-addressAfterUpdate.sql create mode 100644 services/db/install/changes/5-addressBeforeInsert.sql create mode 100644 services/db/install/changes/6-addressBeforeUpdate.sql create mode 100644 services/db/install/changes/7-clientAfterInsert.sql create mode 100644 services/db/install/changes/8-clientAfterUpdate.sql create mode 100644 services/db/install/changes/9-migrateDefaultAddress.sql diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index be035d0e5..f81460d35 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -31,6 +31,8 @@ export default { name: `${components.vnTextfield}[name="name"]`, taxNumber: `${components.vnTextfield}[name="fi"]`, socialName: `${components.vnTextfield}[name="socialName"]`, + street: `${components.vnTextfield}[name="street"]`, + city: `${components.vnTextfield}[name="city"]`, userName: `${components.vnTextfield}[name="userName"]`, email: `${components.vnTextfield}[name="email"]`, salesPersonAutocomplete: `vn-autocomplete[field="$ctrl.client.salesPersonFk"]`, diff --git a/e2e/paths/client-module/01_create_client.spec.js b/e2e/paths/client-module/01_create_client.spec.js index 467603d70..0a8396edc 100644 --- a/e2e/paths/client-module/01_create_client.spec.js +++ b/e2e/paths/client-module/01_create_client.spec.js @@ -52,6 +52,8 @@ describe('Client create path', () => { const result = await nightmare .write(selectors.createClientView.name, 'Carol Danvers') .write(selectors.createClientView.socialName, 'AVG tax') + .write(selectors.createClientView.street, 'Many places') + .write(selectors.createClientView.city, 'Silla') .clearInput(selectors.createClientView.email) .write(selectors.createClientView.email, 'incorrect email format') .waitToClick(selectors.createClientView.createButton) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index ac9e6b132..84c2bba4c 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -37,5 +37,7 @@ "Barcode must be unique": "Barcode must be unique", "You don't have enough privileges to do that": "You don't have enough privileges to do that", "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client", - "can't be blank": "can't be blank" + "can't be blank": "can't be blank", + "Street cannot be empty": "Street cannot be empty", + "City cannot be empty": "City cannot be empty" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e1a06c078..05e100fb7 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -68,5 +68,9 @@ "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", "ORDER_EMPTY": "Cesta vacía", "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", - "You can't create a ticket for a client that has a debt": "No puedes crear un ticket para un client con deuda" + "You can't create a ticket for a client that has a debt": "No puedes crear un ticket para un client con deuda", + "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", + "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", + "Street cannot be empty": "Street cannot be empty", + "City cannot be empty": "City cannot be empty" } \ No newline at end of file diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 6540c0de2..7fd1c48a7 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -4,7 +4,6 @@ }, "vn": { "connector": "vn-mysql", - "timezone": "local", "database": "vn", "debug": false, "host": "localhost", @@ -13,6 +12,7 @@ "password": "root", "multipleStatements": true, "connectTimeout": 20000, - "acquireTimeout": 20000 + "acquireTimeout": 20000, + "dateStrings": true } } diff --git a/modules/client/back/methods/address/createDefaultAddress.js b/modules/client/back/methods/address/createDefaultAddress.js new file mode 100644 index 000000000..46691717c --- /dev/null +++ b/modules/client/back/methods/address/createDefaultAddress.js @@ -0,0 +1,42 @@ +module.exports = function(Self) { + Self.remoteMethod('createDefaultAddress', { + description: 'Creates both client and its web account', + accepts: { + arg: 'data', + type: 'object', + http: {source: 'body'} + }, + returns: { + root: true, + type: 'Object' + }, + http: { + verb: 'post', + path: '/createDefaultAddress' + } + }); + + Self.createDefaultAddress = async data => { + const Address = Self.app.models.Address; + const Client = Self.app.models.Client; + const transaction = await Address.beginTransaction({}); + + try { + let address = data.address; + let newAddress = await Address.create(address, {transaction}); + let client = await Client.findById(address.clientFk, {transaction}); + + if (data.isDefaultAddress) { + await client.updateAttributes({ + defaultAddressFk: newAddress.id + }, {transaction}); + } + + await transaction.commit(); + return newAddress; + } catch (e) { + await transaction.rollback(); + throw e; + } + }; +}; diff --git a/modules/client/back/methods/address/specs/createDefaultAddress.spec.js b/modules/client/back/methods/address/specs/createDefaultAddress.spec.js new file mode 100644 index 000000000..8d1319607 --- /dev/null +++ b/modules/client/back/methods/address/specs/createDefaultAddress.spec.js @@ -0,0 +1,35 @@ +const app = require('vn-loopback/server/server'); + +fdescribe('Address createDefaultAddress', () => { + let address; + let client; + + afterAll(async() => { + await client.updateAttributes({defaultAddressFk: 1}); + await address.destroy(); + }); + + it('should verify that client defaultAddressFk is untainted', async() => { + client = await app.models.Client.findById(101); + + expect(client.defaultAddressFk).toEqual(1); + }); + + it('should create a new address and set as a client default address', async() => { + let data = { + address: { + clientFk: 101, + nickname: 'My address', + street: 'Wall Street', + city: 'New York', + + }, + isDefaultAddress: true + }; + + address = await app.models.Address.createDefaultAddress(data); + client = await app.models.Client.findById(101); + + expect(client.defaultAddressFk).toEqual(address.id); + }); +}); diff --git a/modules/client/back/methods/client/createWithUser.js b/modules/client/back/methods/client/createWithUser.js index 9b56d7c29..de18d4f4d 100644 --- a/modules/client/back/methods/client/createWithUser.js +++ b/modules/client/back/methods/client/createWithUser.js @@ -23,13 +23,13 @@ module.exports = function(Self) { email: firstEmail, password: parseInt(Math.random() * 100000000000000) }; - let Account = Self.app.models.Account; - - let transaction = await Account.beginTransaction({}); + const Account = Self.app.models.Account; + const Address = Self.app.models.Address; + const transaction = await Account.beginTransaction({}); try { let account = await Account.create(user, {transaction}); - let client = { + let client = await Self.create({ id: account.id, name: data.name, fi: data.fi, @@ -42,10 +42,26 @@ module.exports = function(Self) { provinceFk: data.provinceFk, countryFk: data.countryFk, isEqualizated: data.isEqualizated - }; - newClient = await Self.create(client); + }, {transaction}); + + + let address = await Address.create({ + clientFk: client.id, + nickname: client.name, + city: client.city, + street: client.street, + postalCode: client.postcode, + provinceFk: client.provinceFk, + isEqualizated: client.isEqualizated, + isActive: true + }, {transaction}); + + await client.updateAttributes({ + defaultAddressFk: address.id + }, {transaction}); + await transaction.commit(); - return newClient; + return client; } catch (e) { await transaction.rollback(); throw e; diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index be69ce515..0399606c4 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -3,14 +3,6 @@ const app = require('vn-loopback/server/server'); describe('Client Create', () => { const clientName = 'Wade'; const AccountName = 'Deadpool'; - /* beforeAll(async() => { - let address = await app.models.Address.findOne({where: {nickname: clientName}}); - let client = await app.models.Client.findOne({where: {name: clientName}}); - let account = await app.models.Account.findOne({where: {name: AccountName}}); - await app.models.Address.destroyById(address.id); - await app.models.Client.destroyById(client.id); - await app.models.Account.destroyById(account.id); - }); */ afterAll(async() => { let address = await app.models.Address.findOne({where: {nickname: clientName}}); diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 08d5011cb..155d95d9e 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -78,9 +78,8 @@ module.exports = Self => { } }, { - relation: 'addresses', + relation: 'defaultAddress', scope: { - where: {isDefaultAddress: true}, fields: ['nickname', 'street', 'city', 'postalCode'] } }, diff --git a/modules/client/back/models/address.js b/modules/client/back/models/address.js index 7dd84a556..d0cfd0900 100644 --- a/modules/client/back/models/address.js +++ b/modules/client/back/models/address.js @@ -3,13 +3,8 @@ let getFinalState = require('vn-loopback/util/hook').getFinalState; let isMultiple = require('vn-loopback/util/hook').isMultiple; module.exports = Self => { - Self.validate('isDefaultAddress', isActive, - {message: 'Unable to default a disabled consignee'} - ); - - function isActive(err) { - if (!this.isActive && this.isDefaultAddress) err(); - } + // Methods + require('../methods/address/createDefaultAddress')(Self); Self.validateAsync('isEqualizated', cannotHaveET, { message: 'Cannot check Equalization Tax in this NIF/CIF' @@ -50,31 +45,26 @@ module.exports = Self => { // Helpers Self.observe('before save', async function(ctx) { + const Client = Self.app.models.Client; + if (isMultiple(ctx)) return; + let transaction = {}; + if (ctx.options && ctx.options.transaction) + transaction = ctx.options.transaction; + let changes = ctx.data || ctx.instance; let finalState = getFinalState(ctx); - if (changes.isActive == false && finalState.isDefaultAddress) + const client = await Client.findById(finalState.clientFk, { + fields: ['isEqualizated', 'defaultAddressFk'] + }, {transaction}); + + if (changes.isActive == false && client.defaultAddressFk === finalState.id) throw new UserError('The default consignee can not be unchecked'); - if (changes.isDefaultAddress == true && finalState.isActive != false) { - let filter = { - clientFk: finalState.clientFk, - isDefaultAddress: {neq: false} - }; - await Self.updateAll(filter, {isDefaultAddress: false}); - } - - if (ctx.isNewInstance == true) { - let filter = { - where: { - id: ctx.instance.clientFk - }, - fields: ['isEqualizated'] - }; - let findOneResponse = await Self.app.models.Client.findOne(filter); - ctx.instance.isEqualizated = findOneResponse.isEqualizated; - } + // Propagate client isEqualizated to all addresses + if (ctx.isNewInstance == true) + ctx.instance.isEqualizated = client.isEqualizated; }); }; diff --git a/modules/client/back/models/address.json b/modules/client/back/models/address.json index 283fc140c..26a8a0487 100644 --- a/modules/client/back/models/address.json +++ b/modules/client/back/models/address.json @@ -42,9 +42,6 @@ "isActive": { "type": "boolean" }, - "isDefaultAddress": { - "type": "boolean" - }, "longitude": { "type": "Number" }, diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 1fd44b9c8..5470d1c94 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -21,6 +21,14 @@ module.exports = Self => { // Validations + Self.validatesPresenceOf('street', { + message: 'Street cannot be empty' + }); + + Self.validatesPresenceOf('city', { + message: 'City cannot be empty' + }); + Self.validatesUniquenessOf('fi', { message: 'TIN must be unique' }); @@ -124,6 +132,19 @@ module.exports = Self => { done(); } + Self.validateAsync('defaultAddressFk', isActive, + {message: 'Unable to default a disabled consignee'} + ); + + async function isActive(err, done) { + if (!this.defaultAddressFk) + return done(); + + const address = await Self.app.models.Address.findById(this.defaultAddressFk); + if (address && !address.isActive) err(); + done(); + } + Self.observe('before save', async function(ctx) { let changes = ctx.data || ctx.instance; let orgData = ctx.currentInstance; diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index 926c9cde9..fbc41ee2d 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -31,10 +31,12 @@ "type": "string" }, "street": { - "type": "string" + "type": "string", + "required": true }, "city": { - "type": "string" + "type": "string", + "required": true }, "postcode": { "type": "string" @@ -114,7 +116,7 @@ "type": "string" }, "created": { - "type": "date" + "type": "Date" } }, "relations": { diff --git a/modules/client/front/address/create/index.html b/modules/client/front/address/create/index.html index 5091f85fb..344d56be7 100644 --- a/modules/client/front/address/create/index.html +++ b/modules/client/front/address/create/index.html @@ -1,15 +1,15 @@ -
+ - + diff --git a/modules/client/front/address/create/index.js b/modules/client/front/address/create/index.js index 8b9448f3c..1334e6714 100644 --- a/modules/client/front/address/create/index.js +++ b/modules/client/front/address/create/index.js @@ -1,16 +1,35 @@ import ngModule from '../../module'; export default class Controller { - constructor($state) { - this.address = { - clientFk: parseInt($state.params.id), - isActive: true + constructor($scope, $state) { + this.$scope = $scope; + this.$state = $state; + this.data = { + address: { + clientFk: parseInt($state.params.id), + isActive: true + }, + isDefaultAddress: false }; + this.address = this.data.address; + } + + onSubmit() { + this.$scope.watcher.submit().then(res => { + if (res.data && this.data.isDefaultAddress) + this.client.defaultAddressFk = res.data.id; + + this.$state.go('client.card.address.index'); + }); } } -Controller.$inject = ['$state']; + +Controller.$inject = ['$scope', '$state']; ngModule.component('vnClientAddressCreate', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + client: '<' + } }); diff --git a/modules/client/front/address/create/index.spec.js b/modules/client/front/address/create/index.spec.js index 77e361389..cd1651b4b 100644 --- a/modules/client/front/address/create/index.spec.js +++ b/modules/client/front/address/create/index.spec.js @@ -1,4 +1,5 @@ import './index'; +import watcher from 'core/mocks/watcher'; describe('Client', () => { describe('Component vnClientAddressCreate', () => { @@ -13,11 +14,40 @@ describe('Client', () => { $state = _$state_; $state.params.id = '1234'; controller = $componentController('vnClientAddressCreate', {$state}); + controller.$scope.watcher = watcher; + controller.$scope.watcher.submit = () => { + return { + then: callback => { + callback({data: {id: 124}}); + } + }; + }; + controller.client = {id: 101, defaultAddressFk: 121}; })); it('should define and set address property', () => { - expect(controller.address.clientFk).toBe(1234); - expect(controller.address.isActive).toBe(true); + expect(controller.data.address.clientFk).toBe(1234); + expect(controller.data.address.isActive).toBe(true); + }); + + describe('onSubmit()', () => { + it('should perform a PATCH and not set value to defaultAddressFk property', () => { + spyOn(controller.$state, 'go'); + controller.data.isDefaultAddress = false; + controller.onSubmit(); + + expect(controller.client.defaultAddressFk).toEqual(121); + expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index'); + }); + + it('should perform a PATCH and set a value to defaultAddressFk property', () => { + spyOn(controller.$state, 'go'); + controller.data.isDefaultAddress = true; + controller.onSubmit(); + + expect(controller.client.defaultAddressFk).toEqual(124); + expect(controller.$state.go).toHaveBeenCalledWith('client.card.address.index'); + }); }); }); }); diff --git a/modules/client/front/address/index/index.html b/modules/client/front/address/index/index.html index 77ebcf32e..d8971cd35 100644 --- a/modules/client/front/address/index/index.html +++ b/modules/client/front/address/index/index.html @@ -3,24 +3,27 @@ url="/client/api/Addresses" filter="::$ctrl.filter" link="{clientFk: $ctrl.$stateParams.id}" - data="addresses" + data="$ctrl.addresses" auto-load="true">
+ ng-class="{ + 'item-hightlight': $ctrl.isDefaultAddress(address), + 'item-disabled': !address.isActive && !$ctrl.isDefaultAddress(address) + }"> + ng-if="$ctrl.isDefaultAddress(address)"> diff --git a/modules/client/front/address/index/index.js b/modules/client/front/address/index/index.js index cb81c51f2..eeabaf5d8 100644 --- a/modules/client/front/address/index/index.js +++ b/modules/client/front/address/index/index.js @@ -9,22 +9,60 @@ class Controller { include: { observations: 'observationType' }, - order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'] + order: ['isActive DESC', 'nickname ASC'] }; } + get client() { + return this._client; + } + + set client(value) { + this._client = value; + this.sortAddresses(); + } + + get addresses() { + return this._addresses; + } + + set addresses(value) { + this._addresses = value; + this.sortAddresses(); + } + setDefault(address) { - if (address.isActive) { - let params = {isDefaultAddress: true}; - this.$http.patch(`/client/api/Addresses/${address.id}`, params).then( - () => this.$scope.model.refresh() - ); - } + let query = `/client/api/Clients/${this.$stateParams.id}`; + let params = {defaultAddressFk: address.id}; + this.$http.patch(query, params).then(res => { + if (res.data) { + this.client.defaultAddressFk = res.data.defaultAddressFk; + this.sortAddresses(); + } + }); + } + + isDefaultAddress(address) { + if (!this.client) return; + return this.client.defaultAddressFk === address.id; + } + + /** + * Sort address by default address + */ + sortAddresses() { + if (!this.client || !this.addresses) return; + this.$scope.model.data = this.addresses.sort((a, b) => { + return this.isDefaultAddress(b) - this.isDefaultAddress(a); + }); } } Controller.$inject = ['$http', '$scope', '$stateParams']; ngModule.component('vnClientAddressIndex', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + client: '<' + } }); diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js index 26f71084b..c1ed195d8 100644 --- a/modules/client/front/address/index/index.spec.js +++ b/modules/client/front/address/index/index.spec.js @@ -1,36 +1,69 @@ import './index'; +import crudModel from 'core/mocks/crud-model'; describe('Client', () => { describe('Component vnClientAddressIndex', () => { let controller; let $scope; - let $state; + let $stateParams; let $httpBackend; beforeEach(ngModule('client')); - beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_, _$httpBackend_) => { - $state = _$state_; + beforeEach(angular.mock.inject(($componentController, $rootScope, _$stateParams_, _$httpBackend_) => { + $stateParams = _$stateParams_; + $stateParams.id = 1; $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); - $scope.model = { - refresh: () => {} - }; - controller = $componentController('vnClientAddressIndex', {$state, $scope}); + controller = $componentController('vnClientAddressIndex', {$stateParams, $scope}); + controller.client = {id: 101, defaultAddressFk: 121}; + controller.$scope.model = crudModel; })); describe('setDefault()', () => { - it('should perform a PATCH if the address is active and call the refresh method', () => { - spyOn($scope.model, 'refresh'); + it('should perform a PATCH and set a value to defaultAddressFk property', () => { + spyOn(controller, 'sortAddresses'); + let address = {id: 1}; + let data = {defaultAddressFk: address.id}; + let expectedResult = {defaultAddressFk: address.id}; - let address = {id: 1, isActive: true}; - - $httpBackend.when('PATCH', `/client/api/Addresses/1`).respond(200); - $httpBackend.expect('PATCH', `/client/api/Addresses/1`); + $httpBackend.when('PATCH', `/client/api/Clients/1`, data).respond(200, expectedResult); + $httpBackend.expect('PATCH', `/client/api/Clients/1`, data); controller.setDefault(address); $httpBackend.flush(); - expect($scope.model.refresh).toHaveBeenCalledWith(); + expect(controller.client.defaultAddressFk).toEqual(1); + expect(controller.sortAddresses).toHaveBeenCalledWith(); + }); + }); + + describe('isDefaultAddress()', () => { + it('should return true if a passed address is the current default one', () => { + let address = {id: 121}; + let result = controller.isDefaultAddress(address); + + expect(result).toBeTruthy(); + }); + + it('should return false if a passed address is the current default one', () => { + let address = {id: 1}; + let result = controller.isDefaultAddress(address); + + expect(result).toBeFalsy(); + }); + }); + + describe('sortAddresses()', () => { + it('should return an array of addresses sorted by client defaultAddressFk', () => { + controller.client.defaultAddressFk = 123; + controller.addresses = [ + {id: 121, nickname: 'My address one'}, + {id: 122, nickname: 'My address two'}, + {id: 123, nickname: 'My address three'}]; + + controller.sortAddresses(); + + expect(controller.addresses[0].id).toEqual(123); }); }); }); diff --git a/modules/client/front/routes.json b/modules/client/front/routes.json index 9c64fdaea..177d90e38 100644 --- a/modules/client/front/routes.json +++ b/modules/client/front/routes.json @@ -102,7 +102,10 @@ "url": "/create", "state": "client.card.address.create", "component": "vn-client-address-create", - "description": "New address" + "description": "New address", + "params": { + "client": "$ctrl.client" + } }, { "url": "/:addressId/edit", "state": "client.card.address.edit", diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index 80c576ac6..ad50b628b 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -124,13 +124,13 @@

Default address

+ value="{{$ctrl.summary.defaultAddress.nickname}}"> + value="{{$ctrl.summary.defaultAddress.street}}"> + value="{{$ctrl.summary.defaultAddress.city}}">
diff --git a/modules/order/front/create/card.js b/modules/order/front/create/card.js index 42907f83b..ad6317f02 100644 --- a/modules/order/front/create/card.js +++ b/modules/order/front/create/card.js @@ -29,11 +29,23 @@ class Controller { this.order.clientFk = value; if (value) { - let filter = {where: {clientFk: value, isDefaultAddress: true}}; + let filter = { + include: { + relation: 'defaultAddress', + scope: { + fields: 'id' + } + }, + where: {id: value} + }; filter = encodeURIComponent(JSON.stringify(filter)); - let query = `/api/Addresses?filter=${filter}`; + let query = `/api/Clients?filter=${filter}`; this.$http.get(query).then(res => { - this.addressFk = res.data[0].id; + if (res.data) { + let client = res.data[0]; + let defaultAddress = client.defaultAddress; + this.addressFk = defaultAddress.id; + } }); } else this.addressFk = null; diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index bd8917f8d..1b44745b9 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -13,11 +13,11 @@ "description": "Identifier" }, "shipped": { - "type": "date", + "type": "Date", "required": true }, "landed": { - "type": "date" + "type": "Date" }, "nickname": { "type": "String" @@ -32,7 +32,7 @@ "type": "Number" }, "created": { - "type": "date" + "type": "Date" }, "isDeleted": { "type": "boolean" diff --git a/modules/ticket/front/create/card.js b/modules/ticket/front/create/card.js index b7b5c4711..c0321e3d5 100644 --- a/modules/ticket/front/create/card.js +++ b/modules/ticket/front/create/card.js @@ -32,11 +32,23 @@ class Controller { this.ticket.clientFk = value; if (value) { - let filter = {where: {clientFk: value, isDefaultAddress: true}}; + let filter = { + include: { + relation: 'defaultAddress', + scope: { + fields: 'id' + } + }, + where: {id: value} + }; filter = encodeURIComponent(JSON.stringify(filter)); - let query = `/api/Addresses?filter=${filter}`; + let query = `/api/Clients?filter=${filter}`; this.$http.get(query).then(res => { - this.addressFk = res.data[0].id; + if (res.data) { + let client = res.data[0]; + let defaultAddress = client.defaultAddress; + this.addressFk = defaultAddress.id; + } }); } else this.addressFk = null; diff --git a/services/db/install/changes/4-addressAfterUpdate.sql b/services/db/install/changes/4-addressAfterUpdate.sql new file mode 100644 index 000000000..288875454 --- /dev/null +++ b/services/db/install/changes/4-addressAfterUpdate.sql @@ -0,0 +1,32 @@ +DROP TRIGGER IF EXISTS vn2008.ConsignatariosAfterUpdate; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosAfterUpdate` AFTER UPDATE ON `Consignatarios` FOR EACH ROW +BEGIN + + -- Recargos de equivalencia distintos implican facturacion por consignatario + IF NEW.isEqualizated != OLD.isEqualizated THEN + + IF + (SELECT COUNT(*) FROM + ( + SELECT DISTINCT (isEqualizated = FALSE) as Equ + FROM Consignatarios + WHERE Id_Cliente = NEW.Id_Cliente + ) t1 + ) > 1 + + THEN + + UPDATE Clientes + SET invoiceByAddress = TRUE + WHERE Id_Cliente = NEW.Id_Cliente; + + END IF; + + END IF; +END$$ +DELIMITER ; +USE vn; diff --git a/services/db/install/changes/5-addressBeforeInsert.sql b/services/db/install/changes/5-addressBeforeInsert.sql new file mode 100644 index 000000000..cd42e554a --- /dev/null +++ b/services/db/install/changes/5-addressBeforeInsert.sql @@ -0,0 +1,25 @@ +DROP TRIGGER IF EXISTS vn2008.ConsignatariosBeforeInsert; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosBeforeInsert` +BEFORE INSERT ON `vn2008`.`Consignatarios` +FOR EACH ROW +BEGIN + DECLARE vIsEqualizated BOOLEAN; + + CALL pbx.phoneIsValid (NEW.telefono); + CALL pbx.phoneIsValid (NEW.movil); + + IF NEW.isEqualizated IS NULL THEN + SELECT RE + INTO vIsEqualizated + FROM Clientes + WHERE Id_Cliente = NEW.Id_Cliente; + + SET NEW.isEqualizated = vIsEqualizated; + END IF; +END$$ +DELIMITER ; +USE vn; diff --git a/services/db/install/changes/6-addressBeforeUpdate.sql b/services/db/install/changes/6-addressBeforeUpdate.sql new file mode 100644 index 000000000..84037f044 --- /dev/null +++ b/services/db/install/changes/6-addressBeforeUpdate.sql @@ -0,0 +1,14 @@ +DROP TRIGGER IF EXISTS vn2008.ConsignatariosBeforeUpdate; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosBeforeUpdate` +BEFORE UPDATE ON `vn2008`.`Consignatarios` +FOR EACH ROW +BEGIN + CALL pbx.phoneIsValid (NEW.telefono); + CALL pbx.phoneIsValid (NEW.movil); +END$$ +DELIMITER ; +USE vn; diff --git a/services/db/install/changes/7-clientAfterInsert.sql b/services/db/install/changes/7-clientAfterInsert.sql new file mode 100644 index 000000000..f12401f49 --- /dev/null +++ b/services/db/install/changes/7-clientAfterInsert.sql @@ -0,0 +1 @@ +DROP TRIGGER vn2008.ClientesAfterInsert; diff --git a/services/db/install/changes/8-clientAfterUpdate.sql b/services/db/install/changes/8-clientAfterUpdate.sql new file mode 100644 index 000000000..914b7c4d0 --- /dev/null +++ b/services/db/install/changes/8-clientAfterUpdate.sql @@ -0,0 +1,19 @@ +DROP TRIGGER IF EXISTS vn2008.ClientesAfterUpdate; +USE vn2008; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ClientesAfterUpdate` +AFTER UPDATE ON `Clientes` +FOR EACH ROW +BEGIN + IF NEW.default_address AND (NEW.default_address != OLD.default_address) THEN + UPDATE Consignatarios SET predeterminada = FALSE + WHERE Id_cliente = NEW.Id_cliente; + + UPDATE Consignatarios SET predeterminada = TRUE + WHERE Id_consigna = NEW.default_address; + END IF; +END$$ +DELIMITER ; +USE vn; diff --git a/services/db/install/changes/9-migrateDefaultAddress.sql b/services/db/install/changes/9-migrateDefaultAddress.sql new file mode 100644 index 000000000..7d287e793 --- /dev/null +++ b/services/db/install/changes/9-migrateDefaultAddress.sql @@ -0,0 +1,9 @@ +/* Script de migración consignatarios. + Ejecución únicamente en producción */ + +/* USE vn; + +UPDATE vn.client c + JOIN vn.address a ON a.clientFk = c.id AND a.isDefaultAddress +SET c.defaultAddressFk = a.id +WHERE c.defaultAddressFk IS NULL */ \ No newline at end of file diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 72a98e5b2..001de209c 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -209,38 +209,65 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`) ( 103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), ( 104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)); -INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`) +INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`) VALUES - (101, 'address 01', 'Somewhere in Thailand', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (102, 'address 02', 'Somewhere in Poland', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0), - (103, 'address 03', 'Somewhere in Japan', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0), - (104, 'address 04', 'Somewhere in Spain', 'Silla', 46460, 1, 3333333333, 444444444, 1, 0, 109, 2, NULL, NULL, 0), - (105, 'address 05', 'Somewhere in Potugal', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (106, 'address 06', 'Somewhere in UK', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (107, 'address 07', 'Somewhere in Valencia', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (108, 'address 08', 'Somewhere in Silla', 'Silla', 46460, 1, 5555555555, 666666666, 1, 0, 109, 2, NULL, NULL, 0), - (109, 'address 09', 'Somewhere in London', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (110, 'address 10', 'Somewhere in Algemesi', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (111, 'address 11', 'Somewhere in Carlet', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (112, 'address 12', 'Somewhere in Campanar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (113, 'address 13', 'Somewhere in Malilla', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (114, 'address 14', 'Somewhere in France', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (115, 'address 15', 'Somewhere in Birmingham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (116, 'address 16', 'Somewhere in Scotland', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (117, 'address 17', 'Somewhere in nowhere', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (118, 'address 18', 'Somewhere over the rainbow', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (119, 'address 19', 'Somewhere in Alberic', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (120, 'address 20', 'Somewhere in Montortal', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 109, 2, NULL, NULL, 0), - (121, 'address 21', 'the bat cave', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 101, 2, NULL, NULL, 0), - (122, 'address 22', 'NY roofs', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 102, 2, NULL, NULL, 0), - (123, 'address 23', 'The phone box', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 103, 2, NULL, NULL, 0), - (124, 'address 24', 'Stark tower', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 104, 2, NULL, NULL, 0), - (125, 'address 25', 'The plastic cell', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 105, 2, NULL, NULL, 0), - (126, 'address 26', 'Many places', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 106, 2, NULL, NULL, 0), - (127, 'address 27', 'Your pocket', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 107, 2, NULL, NULL, 0), - (128, 'address 28', 'Cerebro', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 108, 2, NULL, NULL, 0), - (129, 'address 29', 'Luke Cages Bar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 0, 110, 2, NULL, NULL, 0), - (130, 'address 30', 'Non valid address', 'Silla', 46460, 1, 1111111111, 222222222, 0, 0, 101, 2, NULL, NULL, 0); + (1, 'Bruce Wayne', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0), + (2, 'Petter Parker', '20 Ingram Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 102, 2, NULL, NULL, 0), + (3, 'Clark Kent', '344 Clinton Street', 'Silla', 46460, 1, 1111111111, 222222222, 1, 103, 2, NULL, NULL, 0), + (4, 'Tony Stark', '10880 Malibu Point', 'Silla', 46460, 1, 1111111111, 222222222, 1, 104, 2, NULL, NULL, 0), + (5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Silla', 46460, 1, 1111111111, 222222222, 1, 105, 2, NULL, NULL, 0), + (6, 'DavidCharlesHaller', 'Evil hideout', 'Silla', 46460, 1, 1111111111, 222222222, 1, 106, 2, NULL, NULL, 0), + (7, 'Hank Pym', 'Anthill', 'Silla', 46460, 1, 1111111111, 222222222, 1, 107, 2, NULL, NULL, 0), + (8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1, 1111111111, 222222222, 1, 108, 2, NULL, NULL, 0), + (9, 'Bruce Banner', 'Somewhere in New York', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (10, 'Jessica Jones', 'NYCC 2015 Poster', 'Silla', 46460, 1, 1111111111, 222222222, 1, 110, 2, NULL, NULL, 0), + (11, 'Missing', 'The space', 'Silla', 46460, 1, 1111111111, 222222222, 1, 200, 2, NULL, NULL, 0), + (12, 'Trash', 'New York city', 'Silla', 46460, 1, 1111111111, 222222222, 1, 400, 2, NULL, NULL, 0), + (101, 'address 01', 'Somewhere in Thailand', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (102, 'address 02', 'Somewhere in Poland', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0), + (103, 'address 03', 'Somewhere in Japan', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0), + (104, 'address 04', 'Somewhere in Spain', 'Silla', 46460, 1, 3333333333, 444444444, 1, 109, 2, NULL, NULL, 0), + (105, 'address 05', 'Somewhere in Potugal', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0), + (106, 'address 06', 'Somewhere in UK', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0), + (107, 'address 07', 'Somewhere in Valencia', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0), + (108, 'address 08', 'Somewhere in Silla', 'Silla', 46460, 1, 5555555555, 666666666, 1, 109, 2, NULL, NULL, 0), + (109, 'address 09', 'Somewhere in London', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (110, 'address 10', 'Somewhere in Algemesi', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (111, 'address 11', 'Somewhere in Carlet', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (112, 'address 12', 'Somewhere in Campanar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (113, 'address 13', 'Somewhere in Malilla', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (114, 'address 14', 'Somewhere in France', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (115, 'address 15', 'Somewhere in Birmingham', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (116, 'address 16', 'Somewhere in Scotland', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (117, 'address 17', 'Somewhere in nowhere', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (118, 'address 18', 'Somewhere over the rainbow', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (119, 'address 19', 'Somewhere in Alberic', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (120, 'address 20', 'Somewhere in Montortal', 'Silla', 46460, 1, 1111111111, 222222222, 1, 109, 2, NULL, NULL, 0), + (121, 'address 21', 'the bat cave', 'Silla', 46460, 1, 1111111111, 222222222, 1, 101, 2, NULL, NULL, 0), + (122, 'address 22', 'NY roofs', 'Silla', 46460, 1, 1111111111, 222222222, 1, 102, 2, NULL, NULL, 0), + (123, 'address 23', 'The phone box', 'Silla', 46460, 1, 1111111111, 222222222, 1, 103, 2, NULL, NULL, 0), + (124, 'address 24', 'Stark tower', 'Silla', 46460, 1, 1111111111, 222222222, 1, 104, 2, NULL, NULL, 0), + (125, 'address 25', 'The plastic cell', 'Silla', 46460, 1, 1111111111, 222222222, 1, 105, 2, NULL, NULL, 0), + (126, 'address 26', 'Many places', 'Silla', 46460, 1, 1111111111, 222222222, 1, 106, 2, NULL, NULL, 0), + (127, 'address 27', 'Your pocket', 'Silla', 46460, 1, 1111111111, 222222222, 1, 107, 2, NULL, NULL, 0), + (128, 'address 28', 'Cerebro', 'Silla', 46460, 1, 1111111111, 222222222, 1, 108, 2, NULL, NULL, 0), + (129, 'address 29', 'Luke Cages Bar', 'Silla', 46460, 1, 1111111111, 222222222, 1, 110, 2, NULL, NULL, 0), + (130, 'address 30', 'Non valid address', 'Silla', 46460, 1, 1111111111, 222222222, 0, 101, 2, NULL, NULL, 0), + (131, 'Missing', 'The space', 'Silla', 46460, 1, 1111111111, 222222222, 1, 200, 2, NULL, NULL, 0), + (132, 'Trash', 'New York city', 'Silla', 46460, 1, 1111111111, 222222222, 1, 400, 2, NULL, NULL, 0); + +UPDATE `vn`.`client` SET defaultAddressFk = 1 WHERE id = 101; +UPDATE `vn`.`client` SET defaultAddressFk = 2 WHERE id = 102; +UPDATE `vn`.`client` SET defaultAddressFk = 3 WHERE id = 103; +UPDATE `vn`.`client` SET defaultAddressFk = 4 WHERE id = 104; +UPDATE `vn`.`client` SET defaultAddressFk = 5 WHERE id = 105; +UPDATE `vn`.`client` SET defaultAddressFk = 6 WHERE id = 106; +UPDATE `vn`.`client` SET defaultAddressFk = 7 WHERE id = 107; +UPDATE `vn`.`client` SET defaultAddressFk = 8 WHERE id = 108; +UPDATE `vn`.`client` SET defaultAddressFk = 9 WHERE id = 109; +UPDATE `vn`.`client` SET defaultAddressFk = 10 WHERE id = 110; +UPDATE `vn`.`client` SET defaultAddressFk = 11 WHERE id = 200; +UPDATE `vn`.`client` SET defaultAddressFk = 12 WHERE id = 400; INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`) VALUES From c2b95b093ac48f9eef6fa4ff5a03cd6d6fd0b7fd Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 28 Feb 2019 09:37:42 +0100 Subject: [PATCH 28/60] removed focus describe --- .../back/methods/address/specs/createDefaultAddress.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/back/methods/address/specs/createDefaultAddress.spec.js b/modules/client/back/methods/address/specs/createDefaultAddress.spec.js index 8d1319607..a6625390f 100644 --- a/modules/client/back/methods/address/specs/createDefaultAddress.spec.js +++ b/modules/client/back/methods/address/specs/createDefaultAddress.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -fdescribe('Address createDefaultAddress', () => { +describe('Address createDefaultAddress', () => { let address; let client; From 624733dcfbfb039b9b1402db891c4ddc73cc2c1a Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 28 Feb 2019 10:01:54 +0100 Subject: [PATCH 29/60] changed order of ticket index --- modules/ticket/front/index/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index fe6c85b20..42d5ad3fe 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -3,7 +3,7 @@ url="/ticket/api/Tickets/filter" limit="20" data="tickets" - order="shipped DESC" + order="shipped DESC, clientFk" auto-load="false">
From d336fd0eb195b1bf061265436bd12e390a26fb51 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 28 Feb 2019 10:17:09 +0100 Subject: [PATCH 30/60] fixed address --- .../client/specs/createWithUser.spec.js | 4 ++- .../client/back/models/specs/address.spec.js | 26 +++---------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index 0399606c4..7c3f80f44 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -18,7 +18,9 @@ describe('Client Create', () => { email: 'Deadpool@marvel.com', fi: '16195279J', name: 'Wade', - socialName: 'Deadpool Marvel' + socialName: 'Deadpool Marvel', + street: 'Wall Street', + city: 'New York' }; it(`should not find Deadpool as he's not created yet`, async() => { diff --git a/modules/client/back/models/specs/address.spec.js b/modules/client/back/models/specs/address.spec.js index 67e0e8e50..16beaa10f 100644 --- a/modules/client/back/models/specs/address.spec.js +++ b/modules/client/back/models/specs/address.spec.js @@ -3,14 +3,13 @@ const app = require('vn-loopback/server/server'); describe('loopback model address', () => { let createdAddressId; - afterAll(async() => { - let address = await app.models.Address.findById(1); + afterAll(async done => { let client = await app.models.Client.findById(101); - await address.updateAttribute('isDefaultAddress', true); await app.models.Address.destroyById(createdAddressId); - await client.updateAttribute('isEqualizated', false); + + done(); }); describe('observe()', () => { @@ -28,24 +27,6 @@ describe('loopback model address', () => { expect(error).toBeDefined(); }); - it('should set isDefaultAddress to false of all the addresses for a given client', async() => { - let previousDefaultAddress = await app.models.Address.findById(1); - - expect(previousDefaultAddress.isDefaultAddress).toBeTruthy(); - - let address = await app.models.Address.findById(121); - - expect(address.isDefaultAddress).toBeFalsy(); - - let defaultAddress = await address.updateAttribute('isDefaultAddress', true); - - expect(defaultAddress.isDefaultAddress).toBeTruthy(); - - let noLongerDefaultAddress = await app.models.Address.findById(1); - - expect(noLongerDefaultAddress.isDefaultAddress).toBeFalsy(); - }); - it('should set isEqualizated to true of a given Client to trigger any new address to have it', async() => { let client = await app.models.Client.findById(101); @@ -58,7 +39,6 @@ describe('loopback model address', () => { agencyModeFk: 5, city: 'here', isActive: true, - isDefaultAddress: false, mobile: '555555555', nickname: 'Test address', phone: '555555555', From 9ef3eac480920f92ca8d89eb0e9a66512b211b61 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 28 Feb 2019 13:50:39 +0100 Subject: [PATCH 31/60] =?UTF-8?q?#1136=20item.buscador=20Avanzado=20a?= =?UTF-8?q?=C3=B1adir=20campo=20visible=20y=20isActive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/item/back/methods/item/filter.js | 38 +++++++++++++++++-- modules/item/front/fetched-tags/index.html | 37 ++++++++++++++++-- modules/item/front/fetched-tags/index.js | 44 ---------------------- modules/item/front/index/index.js | 12 +++++- modules/item/front/search-panel/index.html | 13 +++++++ 5 files changed, 90 insertions(+), 54 deletions(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 4f8cbd36e..6a8eac680 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -33,6 +33,16 @@ module.exports = Self => { type: 'Integer', description: 'Type id', http: {source: 'query'} + }, { + arg: 'hasVisible', + type: 'Boolean', + description: 'Whether the the item has o not visible', + http: {source: 'query'} + }, { + arg: 'isActive', + type: 'Boolean', + description: 'Whether the the item is o not active', + http: {source: 'query'} } ], returns: { @@ -45,7 +55,7 @@ module.exports = Self => { } }); - Self.filter = async(ctx, filter, tags) => { + Self.filter = async(ctx, filter) => { let conn = Self.dataSource.connector; let where = buildFilter(ctx.args, (param, value) => { @@ -62,15 +72,23 @@ module.exports = Self => { return {'ic.id': value}; case 'typeFk': return {'t.id': value}; + case 'isActive': + return {'i.isActive': value}; } }); filter = mergeFilters(ctx.args.filter, {where}); - let stmt = new ParameterizedSQL( + let stmts = []; + let stmt; + if (ctx.args.hasVisible === true) + stmts.push('CALL cache.visible_refresh(@visibleCalc, true, 1)'); + + stmt = new ParameterizedSQL( `SELECT i.id, i.image, i.name, i.description, i.size, i.tag5, i.value5, i.tag6, i.value6, - i.tag7, i.value7, i.tag8, i.value8, i.isActive, + i.tag7, i.value7, i.tag8, i.value8, + i.tag9, i.value9, i.tag10, i.value10, i.isActive, t.name type, u.nickname userNickname, t.name type, u.id userId, intr.description AS intrastat, i.stems, @@ -90,6 +108,14 @@ module.exports = Self => { LEFT JOIN vn.buy b ON b.id = lb.buy_id` ); + if (ctx.args.hasVisible === true) { + let joinAvailable = new ParameterizedSQL( + `JOIN cache.visible v + ON v.item_id = i.id AND v.calc_id = @visibleCalc` + ); + stmt.merge(joinAvailable); + } + if (ctx.args.tags) { let i = 1; for (let tag of ctx.args.tags) { @@ -104,6 +130,10 @@ module.exports = Self => { } } stmt.merge(conn.makeSuffix(filter)); - return Self.rawStmt(stmt); + let itemsIndex = stmts.push(stmt) - 1; + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + return itemsIndex === 0 ? result : result[itemsIndex]; }; }; diff --git a/modules/item/front/fetched-tags/index.html b/modules/item/front/fetched-tags/index.html index 546e5d67d..818296a80 100644 --- a/modules/item/front/fetched-tags/index.html +++ b/modules/item/front/fetched-tags/index.html @@ -3,10 +3,39 @@
- {{::fetchedTag.value}} + ng-class="::{empty: !$ctrl.item.value5}" + title="{{::$ctrl.item.tag5}}: {{::$ctrl.item.value5}}"> + {{::$ctrl.item.value5}} +
+
+ {{::$ctrl.item.value6}} +
+
+ {{::$ctrl.item.value7}} +
+
+ {{::$ctrl.item.value8}} +
+
+ {{::$ctrl.item.value9}} +
+
+ {{::$ctrl.item.value10}}
\ No newline at end of file diff --git a/modules/item/front/fetched-tags/index.js b/modules/item/front/fetched-tags/index.js index 508764c9e..8774fc4b0 100644 --- a/modules/item/front/fetched-tags/index.js +++ b/modules/item/front/fetched-tags/index.js @@ -1,52 +1,8 @@ import ngModule from '../module'; import './style.scss'; -export default class FetchedTags { - set item(value) { - if (value) { - let tags = []; - for (let i = 5; i < 5 + this.maxLength; i++) { - if (value['tag' + i]) { - let tagValue = value['value' + i]; - let tagKey = value['tag' + i]; - tags.push({name: tagKey, value: tagValue, position: i - 5}); - } - } - this.tags = tags; - } - this._item = value; - } - - get item() { - return this._item; - } - - set tags(value) { - if (value) { - let organizedTags = new Array(parseInt(this.maxLength)); - for (let i = 0; i < this.maxLength; i++) { - let organizedTag = {}; - for (let j = 0; j < value.length; j++) { - if (value[j].position === i) { - organizedTag.name = value[j].name; - organizedTag.value = value[j].value; - } - organizedTags[i] = JSON.parse(JSON.stringify(organizedTag)); - } - } - this._tags = organizedTags; - } - } - - get tags() { - return this._tags; - } -} - - ngModule.component('vnFetchedTags', { template: require('./index.html'), - controller: FetchedTags, bindings: { maxLength: '<', item: '<', diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index 7a5adc600..e31cbaa08 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -2,7 +2,7 @@ import ngModule from '../module'; import './style.scss'; class Controller { - constructor($http, $state, $scope) { + constructor($http, $state, $scope, $stateParams) { this.$http = $http; this.$state = $state; this.$ = $scope; @@ -13,6 +13,14 @@ class Controller { id: false, actions: false }; + + if (!$stateParams.q) + this.filter = {hasVisible: true, isActive: true}; + } + + $postLink() { + if (this.filter) + this.onSearch(this.filter); } stopEvent(event) { @@ -83,7 +91,7 @@ class Controller { this.$.preview.show(); } } -Controller.$inject = ['$http', '$state', '$scope']; +Controller.$inject = ['$http', '$state', '$scope', '$stateParams']; ngModule.component('vnItemIndex', { template: require('./index.html'), diff --git a/modules/item/front/search-panel/index.html b/modules/item/front/search-panel/index.html index abbb56627..e3cb1f3d2 100644 --- a/modules/item/front/search-panel/index.html +++ b/modules/item/front/search-panel/index.html @@ -47,6 +47,19 @@ model="filter.description"> + + + + + + Date: Thu, 28 Feb 2019 14:30:29 +0100 Subject: [PATCH 32/60] #987 client.billing-data ALPHA --- back/methods/message/send.js | 2 +- modules/client/back/models/client.js | 36 +++ modules/client/front/billing-data/index.js | 8 +- .../client/front/billing-data/index.spec.js | 20 -- package-lock.json | 225 ++++++++++-------- package.json | 1 + 6 files changed, 171 insertions(+), 121 deletions(-) diff --git a/back/methods/message/send.js b/back/methods/message/send.js index 3b2ab1f16..dfdf1e8dc 100644 --- a/back/methods/message/send.js +++ b/back/methods/message/send.js @@ -26,7 +26,7 @@ module.exports = Self => { }); Self.send = async(ctx, data, transaction) => { - const userId = ctx.req.accessToken.userId; + const userId = ctx.options && ctx.options.accessToken.userId || ctx.req && ctx.req.accessToken.userId; const models = Self.app.models; const sender = await models.Account.findById(userId, transaction); const recipient = await models.Account.findById(data.recipientFk, transaction); diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 5470d1c94..ad548cb4a 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -1,3 +1,4 @@ +let request = require('request-promise-native'); let UserError = require('vn-loopback/util/user-error'); let getFinalState = require('vn-loopback/util/hook').getFinalState; let isMultiple = require('vn-loopback/util/hook').isMultiple; @@ -179,6 +180,41 @@ module.exports = Self => { } }); + Self.observe('after save', async ctx => { + if (ctx.isNewInstance) return; + + const hookState = ctx.hookState; + const newInstance = hookState.newInstance; + const oldInstance = hookState.oldInstance; + const instance = ctx.instance; + + const payMethodChanged = oldInstance.payMethodFk != newInstance.payMethodFk; + const ibanChanged = oldInstance.iban != newInstance.iban; + const dueDayChanged = oldInstance.dueDay != newInstance.dueDay; + + if (payMethodChanged || ibanChanged || dueDayChanged) { + const message = `La forma de pago del client con id ${instance.id} ha cambiado`; + const salesPersonFk = instance.salesPersonFk; + + if (salesPersonFk) { + await Self.app.models.Message.send(ctx, { + recipientFk: salesPersonFk, + message: message + }); + } + + const options = { + method: 'POST', + uri: 'http://127.0.0.1:3000/api/email/payment-update', + body: { + clientFk: instance.id + }, + json: true + }; + await request(options); + } + }); + async function validateCreditChange(ctx, finalState) { let models = Self.app.models; let userId = ctx.options.accessToken.userId; diff --git a/modules/client/front/billing-data/index.js b/modules/client/front/billing-data/index.js index a23f5fa9e..06a1fa121 100644 --- a/modules/client/front/billing-data/index.js +++ b/modules/client/front/billing-data/index.js @@ -33,16 +33,10 @@ export default class Controller { this.$scope.watcher.submit().then(() => { if (shouldNotify) - this.notifyChanges(); + this.vnApp.showMessage(this.$translate.instant('Notification sent!')); }); } - notifyChanges() { - this.$http.post(`/api/email/payment-update`, {clientFk: this.client.id}).then( - () => this.vnApp.showMessage(this.$translate.instant('Notification sent!')) - ); - } - hasPaymethodChanges() { let orgData = this.$scope.watcher.orgData; diff --git a/modules/client/front/billing-data/index.spec.js b/modules/client/front/billing-data/index.spec.js index 1463d031d..277ff7a2d 100644 --- a/modules/client/front/billing-data/index.spec.js +++ b/modules/client/front/billing-data/index.spec.js @@ -21,26 +21,6 @@ describe('Client', () => { $scope.watcher.orgData = {id: 101, name: 'Client name', payMethodFk: 4}; })); - describe('onSubmit()', () => { - it(`should call notifyChanges() if there are changes on payMethod data`, () => { - spyOn(controller, 'notifyChanges'); - controller.client.payMethodFk = 5; - controller.onSubmit(); - - expect(controller.notifyChanges).toHaveBeenCalledWith(); - }); - }); - - describe('notifyChanges()', () => { - it(`should perform a GET query`, () => { - let params = {clientFk: 101}; - $httpBackend.when('POST', `/api/email/payment-update`, params).respond(true); - $httpBackend.expect('POST', `/api/email/payment-update`, params); - controller.notifyChanges(); - $httpBackend.flush(); - }); - }); - describe('hasPaymethodChanges()', () => { it(`should return true if there are changes on payMethod data`, () => { controller.client.payMethodFk = 5; diff --git a/package-lock.json b/package-lock.json index 7d81c13c7..8b04fbf96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1505,7 +1505,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1733,7 +1733,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -2052,7 +2052,7 @@ }, "browserify-aes": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -2097,7 +2097,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -2147,7 +2147,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { @@ -2322,7 +2322,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -2366,7 +2366,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -2497,7 +2497,7 @@ "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -2657,7 +2657,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2731,7 +2731,7 @@ }, "colors": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.1.2.tgz", "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", "dev": true }, @@ -2924,7 +2924,7 @@ }, "content-disposition": { "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "resolved": "http://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" }, "content-security-policy-builder": { @@ -3017,7 +3017,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -3030,7 +3030,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -3193,13 +3193,13 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true }, "regexpu-core": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", "dev": true, "requires": { @@ -3210,13 +3210,13 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, "regjsparser": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { @@ -3565,7 +3565,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { @@ -3686,7 +3686,7 @@ "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", "dev": true, "requires": { "is-obj": "^1.0.0" @@ -3694,12 +3694,12 @@ }, "duplex": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/duplex/-/duplex-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/duplex/-/duplex-1.0.0.tgz", "integrity": "sha1-arxcFuwX5MV4V4cnEmcAWQ06Ldo=" }, "duplexer": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.0.4.tgz", "integrity": "sha1-r8t/H4uNdPggcmFx1dZKyeSo/yA=" }, "duplexer2": { @@ -3719,7 +3719,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -3846,7 +3846,7 @@ "dependencies": { "fs-extra": { "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { @@ -4123,7 +4123,7 @@ }, "es6-promisify": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "requires": { "es6-promise": "^4.0.3" @@ -4901,7 +4901,7 @@ }, "file-loader": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "dev": true, "requires": { @@ -5139,7 +5139,7 @@ }, "fs-access": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", "dev": true, "requires": { @@ -5938,7 +5938,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -5975,7 +5975,7 @@ }, "globby": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz", "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { @@ -6020,7 +6020,7 @@ }, "got": { "version": "6.7.1", - "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -6197,7 +6197,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -6381,7 +6381,7 @@ "dependencies": { "es6-promise": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", "dev": true }, @@ -7144,7 +7144,7 @@ "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { "is-relative": "^1.0.0", @@ -7193,7 +7193,7 @@ }, "is-builtin-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { @@ -7340,7 +7340,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -7371,7 +7371,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -7407,7 +7407,7 @@ "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { "is-unc-path": "^1.0.0" @@ -7441,7 +7441,7 @@ "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { "unc-path-regex": "^0.1.2" @@ -7487,7 +7487,7 @@ }, "isemail": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", "integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY=" }, "isexe": { @@ -7542,7 +7542,7 @@ }, "jasmine-core": { "version": "2.99.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -7559,7 +7559,7 @@ "jasmine-spec-reporter": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", - "integrity": "sha1-HWMq7ANBZwrTJPkrqEtLMrNeniI=", + "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", "dev": true, "requires": { "colors": "1.1.2" @@ -7647,7 +7647,7 @@ }, "json-buffer": { "version": "2.0.11", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-2.0.11.tgz", + "resolved": "http://registry.npmjs.org/json-buffer/-/json-buffer-2.0.11.tgz", "integrity": "sha1-PkQf2jCYvo0eMXGtWRvGKjPi1V8=" }, "json-loader": { @@ -7840,7 +7840,7 @@ "karma-chrome-launcher": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", - "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", + "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", "dev": true, "requires": { "fs-access": "^1.0.0", @@ -8030,7 +8030,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -9510,7 +9510,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "mem": { @@ -9533,7 +9533,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -9656,7 +9656,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "minstache": { @@ -9670,7 +9670,7 @@ "dependencies": { "commander": { "version": "1.0.4", - "resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz", "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", "dev": true, "requires": { @@ -9738,7 +9738,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -9746,7 +9746,7 @@ "dependencies": { "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" } } @@ -9821,7 +9821,7 @@ "dependencies": { "through": { "version": "2.3.4", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.4.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.4.tgz", "integrity": "sha1-SV5A6Nio6uvHwnXqiMK4/BTFZFU=" } } @@ -9898,7 +9898,7 @@ }, "multipipe": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "resolved": "http://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", "dev": true, "requires": { @@ -9924,7 +9924,7 @@ }, "mux-demux": { "version": "3.7.9", - "resolved": "https://registry.npmjs.org/mux-demux/-/mux-demux-3.7.9.tgz", + "resolved": "http://registry.npmjs.org/mux-demux/-/mux-demux-3.7.9.tgz", "integrity": "sha1-NTZ3GP02AcgLzi63YlMVdtekrO8=", "requires": { "duplex": "~1.0.0", @@ -10128,7 +10128,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -10758,7 +10758,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -10801,7 +10802,8 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -10812,7 +10814,8 @@ "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -10929,7 +10932,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -10941,6 +10945,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -10970,6 +10975,7 @@ "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -10988,6 +10994,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -11081,6 +11088,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -11166,7 +11174,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -11202,6 +11211,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -11221,6 +11231,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -11264,12 +11275,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -11568,7 +11581,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, @@ -11630,7 +11643,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, @@ -11646,7 +11659,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -11835,7 +11848,7 @@ }, "path-browserify": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "resolved": "http://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", "dev": true }, @@ -12124,7 +12137,7 @@ }, "pretty-bytes": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", + "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", "dev": true, "requires": { @@ -12195,7 +12208,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -12207,13 +12220,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", "dev": true, "requires": { @@ -12680,7 +12693,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -12901,6 +12914,26 @@ } } }, + "request-promise-core": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", + "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "dev": true, + "requires": { + "lodash": "^4.17.11" + } + }, + "request-promise-native": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", + "integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==", + "dev": true, + "requires": { + "request-promise-core": "1.1.2", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -13086,7 +13119,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -13211,7 +13244,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -13351,7 +13384,7 @@ "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -13384,7 +13417,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -13462,7 +13495,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -13538,7 +13571,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -13589,7 +13622,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -13925,7 +13958,7 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { "extend-shallow": "^3.0.0" @@ -13934,7 +13967,7 @@ "split2": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha1-GGsldbz4PoW30YRldWI47k7kJJM=", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", "dev": true, "requires": { "through2": "^2.0.2" @@ -14034,6 +14067,12 @@ "readable-stream": "^2.0.1" } }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true + }, "stream-browserify": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", @@ -14046,7 +14085,7 @@ }, "stream-combiner": { "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.2.tgz", + "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.2.tgz", "integrity": "sha1-3+DnRnV0JWXnbGBWeI6lwjvZfbQ=", "requires": { "duplexer": "~0.0.3" @@ -14089,7 +14128,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -14104,7 +14143,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -14115,7 +14154,7 @@ }, "stream-serializer": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/stream-serializer/-/stream-serializer-1.1.2.tgz", + "resolved": "http://registry.npmjs.org/stream-serializer/-/stream-serializer-1.1.2.tgz", "integrity": "sha1-wfl9FdolH1lK4n1B7IraCahG408=" }, "stream-shift": { @@ -14190,7 +14229,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -14606,7 +14645,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -14776,7 +14815,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { @@ -14959,7 +14998,7 @@ "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", "dev": true, "requires": { "nopt": "~1.0.10" @@ -15048,7 +15087,7 @@ }, "tty-browserify": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, @@ -15161,7 +15200,7 @@ }, "underscore": { "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" }, "underscore.string": { @@ -15446,7 +15485,7 @@ "useragent": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.3.0.tgz", - "integrity": "sha1-IX+UOtVAyyEoZYqyP8lg9qiMmXI=", + "integrity": "sha512-4AoH4pxuSvHCjqLO04sU6U/uE65BYza8l/KKBS0b0hnUPWi+cQ2BpeTEwejCSx9SPV5/U03nniDTrWx5NrmKdw==", "dev": true, "requires": { "lru-cache": "4.1.x", @@ -15674,7 +15713,7 @@ }, "vm-browserify": { "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "resolved": "http://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", "dev": true, "requires": { @@ -16177,7 +16216,7 @@ }, "globby": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { @@ -16190,7 +16229,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -16607,7 +16646,7 @@ }, "xmlbuilder": { "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" }, "xmlcreate": { diff --git a/package.json b/package.json index 301d3f43c..9e1e045b9 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "object-diff": "0.0.4", "object.pick": "^1.3.0", "request": "^2.88.0", + "request-promise-native": "^1.0.7", "require-yaml": "0.0.1", "strong-error-handler": "^2.3.2", "uuid": "^3.3.2", From 6e0c3423110687b87717e963fa17582c4a4b0fa3 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 28 Feb 2019 15:39:12 +0100 Subject: [PATCH 33/60] regularize test fixed --- e2e/paths/item-module/09_regularize_item.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/item-module/09_regularize_item.spec.js b/e2e/paths/item-module/09_regularize_item.spec.js index 1294abf1e..e7702cb14 100644 --- a/e2e/paths/item-module/09_regularize_item.spec.js +++ b/e2e/paths/item-module/09_regularize_item.spec.js @@ -176,7 +176,7 @@ describe('Item regularize path', () => { it('should search for the ticket with id 23 once again', async() => { const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 'id:23') + .write(selectors.ticketsIndex.searchTicketInput, 'id:24') .waitToClick(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); From 6a706b3e22f6e3bbf5563bbee902b35ca6b9af29 Mon Sep 17 00:00:00 2001 From: Gerard Date: Thu, 28 Feb 2019 16:25:09 +0100 Subject: [PATCH 34/60] e2e now navigates to the right ticket --- e2e/paths/item-module/09_regularize_item.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/item-module/09_regularize_item.spec.js b/e2e/paths/item-module/09_regularize_item.spec.js index e7702cb14..98fe0859a 100644 --- a/e2e/paths/item-module/09_regularize_item.spec.js +++ b/e2e/paths/item-module/09_regularize_item.spec.js @@ -186,7 +186,7 @@ describe('Item regularize path', () => { it(`should now click on the search result to access to the ticket summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, '23') + .waitForTextInElement(selectors.ticketsIndex.searchResult, '24') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') .parsedUrl(); From 73c4e75ef88f34a8759e4dfee39ce0b255b127b7 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 1 Mar 2019 07:30:41 +0100 Subject: [PATCH 35/60] tests excluded due wrong ticket searchs --- e2e/paths/item-module/09_regularize_item.spec.js | 3 ++- e2e/paths/ticket-module/07_edit_sale.spec.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/e2e/paths/item-module/09_regularize_item.spec.js b/e2e/paths/item-module/09_regularize_item.spec.js index 98fe0859a..50d5d2f68 100644 --- a/e2e/paths/item-module/09_regularize_item.spec.js +++ b/e2e/paths/item-module/09_regularize_item.spec.js @@ -1,7 +1,8 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Item regularize path', () => { +// #1186 repearar e2e ticket.sale, item.regularize. +xdescribe('Item regularize path', () => { const nightmare = createNightmare(); beforeAll(() => { nightmare diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index cc3125f9b..0edba8750 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -1,8 +1,8 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// #1152 refactor ticket.sale, update price no funciona correctamente. -describe('Ticket Edit sale path', () => { +// #1186 repearar e2e ticket.sale, item.regularize. +xdescribe('Ticket Edit sale path', () => { const nightmare = createNightmare(); beforeAll(() => { @@ -466,7 +466,7 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketSales.moreMenuButton) .waitToClick(selectors.ticketSales.moreMenuUpdateDiscount) .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) - .write('body', '\u000d') // simulates enter + .write('body', '\u000d') .waitForTextInElement(selectors.ticketSales.totalImport, '0.00') .waitToGetProperty(selectors.ticketSales.totalImport, 'innerText'); From b2a84ab82c0c54d3df502193488925f47b221e76 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 1 Mar 2019 07:31:11 +0100 Subject: [PATCH 36/60] datestrings deleted --- loopback/server/datasources.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 3be007b90..401b9483d 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -13,7 +13,6 @@ "password": "root", "multipleStatements": true, "connectTimeout": 20000, - "acquireTimeout": 20000, - "dateStrings": true + "acquireTimeout": 20000 } } From a5b60a901692ddf43e42e74de73c723f1104cb04 Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 1 Mar 2019 09:07:44 +0100 Subject: [PATCH 37/60] instalacion impresora revisado --- .../back/methods/sale/priceDifference.js | 2 +- print/report/printer-setup/locale.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/ticket/back/methods/sale/priceDifference.js b/modules/ticket/back/methods/sale/priceDifference.js index 33958d2f4..58af82527 100644 --- a/modules/ticket/back/methods/sale/priceDifference.js +++ b/modules/ticket/back/methods/sale/priceDifference.js @@ -25,7 +25,7 @@ module.exports = Self => { } }); - Self.priceDifference = async (ticketFk, data) => { + Self.priceDifference = async(ticketFk, data) => { let filter = { where: { ticketFk: ticketFk diff --git a/print/report/printer-setup/locale.js b/print/report/printer-setup/locale.js index 44d0ba7c9..34365cca7 100644 --- a/print/report/printer-setup/locale.js +++ b/print/report/printer-setup/locale.js @@ -20,20 +20,20 @@ module.exports = { steps: [ 'Abre el programa QLabel', 'Haz clic en el icono de la barra superior con forma de "carpeta"', - 'Selecciona el archivo llamado "model.ezp" adjunto en este correo', - 'Haz clic encima del texto con el boton secundario del ratón', - 'Elige la primera opcion "setup"', + 'Selecciona el archivo llamado "model.ezp" adjunto en este correo, y haz click en abrir', + 'Haz clic encima del texto con el botón secundario del ratón', + 'Elige la primera opción "setup"', 'Cambia el texto para imprimir', 'Haz clic en el boton "Ok"', - 'Desplázate con el raton para ver la medida máxima', + 'Desplázate con el ratón para ver la medida máxima que ocupa el texto', 'Haz clic encima del texto con el botón secundario del ratón', - 'Elige la primera opcion "Setup printer"', - 'Haz clic en la primera pestalla "Label Setup"', - 'Modifica la propidad "Paper Height"', - `Comprueba el puerto de la impresora, botón de le la derecha + 'Elige la segunda opción "Setup printer"', + 'Haz clic en la primera pestaña "Label Setup"', + 'Modifica la propiedad "Paper Height" con la medida máxima consultada anteriormente', + `Comprueba el puerto de la impresora, botón de de la derecha "SETUP PRINTER" y en la parte derecha, igual como la imagen que adjuntamos, seleccionar la que ponga "USB00x: GODEX"`, - 'Haz clic en el boton "Ok"', + 'Haz clic en el botón "Ok"', 'Haz clic sobre el icono de la impresora', 'Haz clic en "Print"', ], From fc5cf465fc68c17aa701356404af41a2c19e7a1f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 1 Mar 2019 09:31:24 +0100 Subject: [PATCH 38/60] bug fixes for travel dates --- services/db/install/dump/fixtures.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 001de209c..51928eb7c 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -820,14 +820,14 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO (1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000), (2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000), (3, CURDATE(), CURDATE(), 1, 2, 1, 0.00, 0.00), - (4, DATE_ADD(CURDATE(), INTERVAL -30 DAY), DATE_ADD(CURDATE(), INTERVAL -30 DAY), 1, 2, 1, 50.00, 500); + (4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500); INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`,`ref`) VALUES - ( 1, 1, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 1, 442, 'Movimiento 1'), - ( 2, 2, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 2, 442, 'Movimiento 2'), - ( 3, 1, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 3, 442, 'Movimiento 3'), - ( 4, 2, DATE_ADD(CURDATE(), INTERVAL -30 DAY), 4, 69, 'Movimiento 4'); + ( 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 442, 'Movimiento 1'), + ( 2, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 442, 'Movimiento 2'), + ( 3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 442, 'Movimiento 3'), + ( 4, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 69, 'Movimiento 4'); INSERT INTO `vn`.`agencyProvince`(`provinceFk`, `agencyFk`, `zone`, `warehouseFk`) VALUES From 39116d51f458a86dce7354c7da5714118dfbddc4 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 1 Mar 2019 11:08:31 +0100 Subject: [PATCH 39/60] added wait 100ms to accessToSearchResult extension --- e2e/helpers/extensions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 8b4d21745..b62bbf4a7 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -361,6 +361,7 @@ let actions = { accessToSearchResult: function(searchValue, done) { this.write(`vn-searchbar input`, searchValue) .click(`vn-searchbar vn-icon[icon="search"]`) + .wait(100) .waitForNumberOfElements('.searchResult', 1) .evaluate(() => { return document.querySelector('ui-view vn-card vn-table') != null; From daa65e967f10ee0ff714dc0dd9bd26841a3793f9 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 1 Mar 2019 11:09:20 +0100 Subject: [PATCH 40/60] typo corrected --- modules/client/back/models/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index ad548cb4a..aa5f5cc0b 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -193,7 +193,7 @@ module.exports = Self => { const dueDayChanged = oldInstance.dueDay != newInstance.dueDay; if (payMethodChanged || ibanChanged || dueDayChanged) { - const message = `La forma de pago del client con id ${instance.id} ha cambiado`; + const message = `La forma de pago del cliente con id ${instance.id} ha cambiado`; const salesPersonFk = instance.salesPersonFk; if (salesPersonFk) { From d5ac428cb7efd04f19db8a190fc933dbd39922cb Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 1 Mar 2019 11:30:59 +0100 Subject: [PATCH 41/60] #860 E2E client/client/src/web-payment/index.js --- e2e/helpers/selectors.js | 2 +- e2e/paths/client-module/16_web_payment.spec.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index f81460d35..e653eb641 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -167,7 +167,7 @@ export default { }, webPayment: { confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]', - firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"]' + firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"][aria-hidden="false"]' }, itemsIndex: { goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`, diff --git a/e2e/paths/client-module/16_web_payment.spec.js b/e2e/paths/client-module/16_web_payment.spec.js index d7f8e88f3..7f8ed5997 100644 --- a/e2e/paths/client-module/16_web_payment.spec.js +++ b/e2e/paths/client-module/16_web_payment.spec.js @@ -2,14 +2,14 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; // #860 E2E client/client/src/web-payment/index.js missing fixtures for another client -xdescribe('Client web Payment', () => { +describe('Client web Payment', () => { const nightmare = createNightmare(); describe('as employee', () => { beforeAll(() => { nightmare .loginAndModule('employee', 'client') - .accessToSearchResult('Bruce Wayne') + .accessToSearchResult('Tony Stark') .accessToSection('client.card.webPayment'); }); @@ -25,13 +25,14 @@ xdescribe('Client web Payment', () => { beforeAll(() => { nightmare .loginAndModule('administrative', 'client') - .accessToSearchResult('Bruce Wayne') + .accessToSearchResult('Tony Stark') .accessToSection('client.card.webPayment'); }); it('should be able to confirm payments', async() => { let exists = await nightmare .waitToClick(selectors.webPayment.confirmFirstPaymentButton) + .wait(selectors.webPayment.firstPaymentConfirmed) .exists(selectors.webPayment.firstPaymentConfirmed); expect(exists).toBeTruthy(); From ec6364490ab76865d5c4241a0a3ba550096d7d12 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 1 Mar 2019 11:31:40 +0100 Subject: [PATCH 42/60] removed a task comment for completed #860 --- e2e/paths/client-module/16_web_payment.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/paths/client-module/16_web_payment.spec.js b/e2e/paths/client-module/16_web_payment.spec.js index 7f8ed5997..3e9a26b75 100644 --- a/e2e/paths/client-module/16_web_payment.spec.js +++ b/e2e/paths/client-module/16_web_payment.spec.js @@ -1,7 +1,6 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// #860 E2E client/client/src/web-payment/index.js missing fixtures for another client describe('Client web Payment', () => { const nightmare = createNightmare(); From acbe9b848861859b900896f1538705b7ebcf5e39 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 1 Mar 2019 11:50:26 +0100 Subject: [PATCH 43/60] #1184 Propagar done en afterAll() de los test back --- loopback/common/methods/vn-model/specs/crud.spec.js | 6 +++--- .../claim-beginning/importToNewRefundTicket.spec.js | 4 ++-- .../claim-end/specs/importTicketSales.spec.js | 6 ++++-- .../back/methods/claim/specs/createFromSales.spec.js | 8 +++++--- .../back/methods/claim/specs/regularizeClaim.spec.js | 6 ++++-- .../back/methods/claim/specs/updateClaim.spec.js | 8 ++++++-- .../address/specs/createDefaultAddress.spec.js | 4 +++- .../client/specs/addressesPropagateRe.spec.js | 4 +++- .../methods/client/specs/confirmTransaction.spec.js | 6 ++++-- .../back/methods/client/specs/createWithUser.spec.js | 4 +++- .../methods/client/specs/updateFiscalData.spec.js | 4 +++- .../createWithInsurance.spec.js | 12 +++++++----- modules/item/back/methods/item/specs/new.spec.js | 4 +++- .../item/back/methods/item/specs/regularize.spec.js | 6 ++++-- .../item/back/methods/item/specs/updateTaxes.spec.js | 4 +++- .../back/methods/order-row/specs/addToOrder.spec.js | 4 +++- .../back/methods/order-row/specs/removes.spec.js | 4 +++- modules/order/back/methods/order/specs/new.spec.js | 4 +++- .../back/methods/order/specs/updateBasicData.spec.js | 12 +++++++----- .../ticket/back/methods/sale/specs/removes.spec.js | 4 +++- .../ticket/back/methods/sale/specs/reserve.spec.js | 4 +++- .../ticket-tracking/specs/changeState.spec.js | 8 ++++++-- .../methods/ticket/specs/componentUpdate.spec.js | 4 +++- .../ticket/back/methods/ticket/specs/deleted.spec.js | 8 ++++++-- modules/ticket/back/methods/ticket/specs/new.spec.js | 4 +++- .../back/models/specs/ticket-packaging.spec.js | 4 +++- 26 files changed, 100 insertions(+), 46 deletions(-) diff --git a/loopback/common/methods/vn-model/specs/crud.spec.js b/loopback/common/methods/vn-model/specs/crud.spec.js index f4db987f3..e2d261f98 100644 --- a/loopback/common/methods/vn-model/specs/crud.spec.js +++ b/loopback/common/methods/vn-model/specs/crud.spec.js @@ -8,7 +8,7 @@ describe('Model crud()', () => { expect(ItemBarcode.crud).toBeDefined(); }); - it('should create a new instance', async () => { + it('should create a new instance', async() => { let data = {code: '500', itemFk: '1'}; let creates = [data]; @@ -20,7 +20,7 @@ describe('Model crud()', () => { expect(instance.code).toEqual('500'); }); - it('should update the instance', async () => { + it('should update the instance', async() => { let updates = [{ where: {id: insertId}, data: {code: '501', itemFk: 1} @@ -32,7 +32,7 @@ describe('Model crud()', () => { expect(instance.code).toEqual('501'); }); - it('should delete the created instance', async () => { + it('should delete the created instance', async() => { let deletes = [insertId]; await ItemBarcode.crud(deletes); let instance = await ItemBarcode.findById(insertId); diff --git a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js index da5d82480..e76bf608a 100644 --- a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js +++ b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js @@ -6,7 +6,7 @@ xdescribe('claimBeginning', () => { let refundTicketSales; let salesInsertedInClaimEnd; - afterAll(async () => { + afterAll(async() => { let promises = []; promises.push(app.models.Ticket.destroyById(ticket.id)); @@ -16,7 +16,7 @@ xdescribe('claimBeginning', () => { }); describe('importToNewRefundTicket()', () => { - it('should create a new ticket with negative sales, save an observation, update the state and insert the negative sales into claimEnd', async () => { + it('should create a new ticket with negative sales, save an observation, update the state and insert the negative sales into claimEnd', async() => { let ctxOfSalesAssistant = {req: {accessToken: {userId: 21}}}; let claimId = 1; ticket = await app.models.ClaimBeginning.importToNewRefundTicket(ctxOfSalesAssistant, claimId); diff --git a/modules/claim/back/methods/claim-end/specs/importTicketSales.spec.js b/modules/claim/back/methods/claim-end/specs/importTicketSales.spec.js index 37ad9f95f..3c2a3e0a6 100644 --- a/modules/claim/back/methods/claim-end/specs/importTicketSales.spec.js +++ b/modules/claim/back/methods/claim-end/specs/importTicketSales.spec.js @@ -3,13 +3,15 @@ const app = require('vn-loopback/server/server'); describe('Claim importTicketSales()', () => { let claimEnds; - afterAll(async () => { + afterAll(async done => { claimEnds.forEach(async line => { await line.destroy(); }); + + done(); }); - it('should import sales to a claim actions from an specific ticket', async () => { + it('should import sales to a claim actions from an specific ticket', async() => { let ctx = {req: {accessToken: {userId: 5}}}; claimEnds = await app.models.ClaimEnd.importTicketSales(ctx, { claimFk: 1, diff --git a/modules/claim/back/methods/claim/specs/createFromSales.spec.js b/modules/claim/back/methods/claim/specs/createFromSales.spec.js index 3fd305a0b..6e414e88c 100644 --- a/modules/claim/back/methods/claim/specs/createFromSales.spec.js +++ b/modules/claim/back/methods/claim/specs/createFromSales.spec.js @@ -4,8 +4,10 @@ describe('Claim Create', () => { let newDate = new Date(); let createdClaimFk; - afterAll(async () => { + afterAll(async done => { await app.models.Claim.destroyById(createdClaimFk); + + done(); }); let newClaim = { @@ -23,7 +25,7 @@ describe('Claim Create', () => { let params = {claim: newClaim, sales: newSale}; - it('should create a new claim', async () => { + it('should create a new claim', async() => { let claim = await app.models.Claim.createFromSales(params); expect(claim.ticketFk).toEqual(newClaim.ticketFk); @@ -39,7 +41,7 @@ describe('Claim Create', () => { createdClaimFk = claim.id; }); - it('should not be able to create a claim if exists that sale', async () => { + it('should not be able to create a claim if exists that sale', async() => { let error; await app.models.Claim.createFromSales(params) diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index 0054c5697..84b9113ac 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -9,7 +9,7 @@ xdescribe('regularizeClaim()', () => { let claimEnds = []; let trashTicket; - afterAll(async () => { + afterAll(async done => { let claim = await app.models.Claim.findById(claimFk); await claim.updateAttributes({claimStateFk: pendentState}); await app.models.Ticket.destroyById(trashTicket.id); @@ -17,9 +17,11 @@ xdescribe('regularizeClaim()', () => { claimEnds.forEach(async line => { await line.destroy(); }); + + done(); }); - it('should change claim state to resolved', async () => { + it('should change claim state to resolved', async() => { let ctx = {req: {accessToken: {userId: 18}}}; let params = {claimFk: claimFk}; diff --git a/modules/claim/back/methods/claim/specs/updateClaim.spec.js b/modules/claim/back/methods/claim/specs/updateClaim.spec.js index 610de5b4a..5c95c6cb8 100644 --- a/modules/claim/back/methods/claim/specs/updateClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaim.spec.js @@ -14,12 +14,16 @@ describe('Update Claim', () => { observation: 'observation' }; - beforeAll(async() => { + beforeAll(async done => { newInstance = await app.models.Claim.create(original); + + done(); }); - afterAll(async() => { + afterAll(async done => { await app.models.Claim.destroyById(newInstance.id); + + done(); }); it('should throw error if isSaleAssistant is false and try to modify a forbidden field', async() => { diff --git a/modules/client/back/methods/address/specs/createDefaultAddress.spec.js b/modules/client/back/methods/address/specs/createDefaultAddress.spec.js index a6625390f..452d9c9b7 100644 --- a/modules/client/back/methods/address/specs/createDefaultAddress.spec.js +++ b/modules/client/back/methods/address/specs/createDefaultAddress.spec.js @@ -4,9 +4,11 @@ describe('Address createDefaultAddress', () => { let address; let client; - afterAll(async() => { + afterAll(async done => { await client.updateAttributes({defaultAddressFk: 1}); await address.destroy(); + + done(); }); it('should verify that client defaultAddressFk is untainted', async() => { diff --git a/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js b/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js index 007d5ef0f..2ec91125d 100644 --- a/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js +++ b/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js @@ -8,9 +8,11 @@ describe('Client addressesPropagateRe', () => { await client.updateAttributes({hasToInvoiceByAddress: true}); }); - afterAll(async() => { + afterAll(async done => { await app.models.Address.update({clientFk: 101}, {isEqualizated: false}); await client.updateAttributes({hasToInvoiceByAddress: true}); + + done(); }); it('should propagate the isEqualizated on both addresses of Mr Wayne and set hasToInvoiceByAddress to false', async() => { diff --git a/modules/client/back/methods/client/specs/confirmTransaction.spec.js b/modules/client/back/methods/client/specs/confirmTransaction.spec.js index ec06e9b5c..797ceab4d 100644 --- a/modules/client/back/methods/client/specs/confirmTransaction.spec.js +++ b/modules/client/back/methods/client/specs/confirmTransaction.spec.js @@ -3,9 +3,11 @@ const app = require('vn-loopback/server/server'); describe('Client confirmTransaction', () => { const transactionId = 2; - afterAll(async() => { + afterAll(async done => { await app.models.Client.rawSql(` - CALL hedera.tpvTransactionUndo(?)`, [transactionId]); + CALL hedera.tpvTransactionUndo(?)`, [transactionId]); + + done(); }); it('should call confirmTransaction() method to mark transaction as confirmed', async() => { diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index 7c3f80f44..2404628e5 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -4,13 +4,15 @@ describe('Client Create', () => { const clientName = 'Wade'; const AccountName = 'Deadpool'; - afterAll(async() => { + afterAll(async done => { let address = await app.models.Address.findOne({where: {nickname: clientName}}); let client = await app.models.Client.findOne({where: {name: clientName}}); let account = await app.models.Account.findOne({where: {name: AccountName}}); await app.models.Address.destroyById(address.id); await app.models.Client.destroyById(client.id); await app.models.Account.destroyById(account.id); + + done(); }); let newAccount = { diff --git a/modules/client/back/methods/client/specs/updateFiscalData.spec.js b/modules/client/back/methods/client/specs/updateFiscalData.spec.js index 84d6b9bad..b4af51c79 100644 --- a/modules/client/back/methods/client/specs/updateFiscalData.spec.js +++ b/modules/client/back/methods/client/specs/updateFiscalData.spec.js @@ -1,12 +1,14 @@ const app = require('vn-loopback/server/server'); describe('Client updateFiscalData', () => { - afterAll(async() => { + afterAll(async done => { let ctxOfAdmin = {req: {accessToken: {userId: 5}}}; let validparams = {postcode: 46460}; let idWithDataChecked = 101; await app.models.Client.updateFiscalData(ctxOfAdmin, validparams, idWithDataChecked); + + done(); }); it('should return an error if the user is not administrative and the isTaxDataChecked value is true', async() => { diff --git a/modules/client/back/methods/credit-classification/createWithInsurance.spec.js b/modules/client/back/methods/credit-classification/createWithInsurance.spec.js index 7fcbdb668..4e5b5127e 100644 --- a/modules/client/back/methods/credit-classification/createWithInsurance.spec.js +++ b/modules/client/back/methods/credit-classification/createWithInsurance.spec.js @@ -3,8 +3,10 @@ const app = require('vn-loopback/server/server'); describe('Client createWithInsurance', () => { let classificationId; - afterAll(async() => { + afterAll(async done => { await app.models.CreditClassification.destroyById(classificationId); + + done(); }); it('should verify the classifications and insurances are untainted', async() => { @@ -20,11 +22,11 @@ describe('Client createWithInsurance', () => { let data = {clientFk: null, started: Date.now(), credit: 999, grade: 255}; let ctx = {req: {accessToken: {userId: 101}}}; await app.models.CreditClassification.createWithInsurance(data, ctx) - .catch(e => { - error = e; - }); + .catch(e => { + error = e; + }); - expect(error.toString()).toBe("Error: ER_BAD_NULL_ERROR: Column 'client' cannot be null"); + expect(error.toString()).toBe('Error: ER_BAD_NULL_ERROR: Column \'client\' cannot be null'); let classifications = await app.models.CreditClassification.find(); let insurances = await app.models.CreditInsurance.find(); diff --git a/modules/item/back/methods/item/specs/new.spec.js b/modules/item/back/methods/item/specs/new.spec.js index 27a459f12..793120514 100644 --- a/modules/item/back/methods/item/specs/new.spec.js +++ b/modules/item/back/methods/item/specs/new.spec.js @@ -3,8 +3,10 @@ const app = require('vn-loopback/server/server'); describe('item new()', () => { let item; - afterAll(async() => { + afterAll(async done => { await app.models.Item.destroyById(item.id); + + done(); }); it('should create a new item, adding the name as a tag', async() => { diff --git a/modules/item/back/methods/item/specs/regularize.spec.js b/modules/item/back/methods/item/specs/regularize.spec.js index ce31f6d80..e0ea4d874 100644 --- a/modules/item/back/methods/item/specs/regularize.spec.js +++ b/modules/item/back/methods/item/specs/regularize.spec.js @@ -6,11 +6,13 @@ describe('regularize()', () => { const trashAddress = 11; let trashTicket; - afterAll(async () => { + afterAll(async done => { await app.models.Ticket.destroyById(trashTicket.id); + + done(); }); - it('should create a new ticket and add a line', async () => { + it('should create a new ticket and add a line', async() => { let ctx = {req: {accessToken: {userId: 18}}}; diff --git a/modules/item/back/methods/item/specs/updateTaxes.spec.js b/modules/item/back/methods/item/specs/updateTaxes.spec.js index 5176302ae..c488cbc5f 100644 --- a/modules/item/back/methods/item/specs/updateTaxes.spec.js +++ b/modules/item/back/methods/item/specs/updateTaxes.spec.js @@ -1,10 +1,12 @@ const app = require('vn-loopback/server/server'); describe('item updateTaxes()', () => { - afterAll(async() => { + afterAll(async done => { let taxesInFixtures = [{id: 3, taxClassFk: 1}]; await app.models.Item.updateTaxes(taxesInFixtures); + + done(); }); it('should throw an error if the taxClassFk is blank', async() => { diff --git a/modules/order/back/methods/order-row/specs/addToOrder.spec.js b/modules/order/back/methods/order-row/specs/addToOrder.spec.js index e96798c95..c38cb2a8c 100644 --- a/modules/order/back/methods/order-row/specs/addToOrder.spec.js +++ b/modules/order/back/methods/order-row/specs/addToOrder.spec.js @@ -2,8 +2,10 @@ const app = require('vn-loopback/server/server'); describe('order addToOrder()', () => { let rowToDelete; - afterAll(async() => { + afterAll(async done => { await app.models.OrderRow.removes({rows: [rowToDelete], actualOrderId: 20}); + + done(); }); it('should add a row to a given order', async() => { diff --git a/modules/order/back/methods/order-row/specs/removes.spec.js b/modules/order/back/methods/order-row/specs/removes.spec.js index 510676aa0..1c68c6052 100644 --- a/modules/order/back/methods/order-row/specs/removes.spec.js +++ b/modules/order/back/methods/order-row/specs/removes.spec.js @@ -4,10 +4,12 @@ describe('order removes()', () => { let row; let newRow; - beforeAll(async() => { + beforeAll(async done => { row = await app.models.OrderRow.findOne({where: {id: 12}}); row.id = null; newRow = await app.models.OrderRow.create(row); + + done(); }); it('should throw an error if rows property is empty', async() => { diff --git a/modules/order/back/methods/order/specs/new.spec.js b/modules/order/back/methods/order/specs/new.spec.js index 746818ee6..88f5776b6 100644 --- a/modules/order/back/methods/order/specs/new.spec.js +++ b/modules/order/back/methods/order/specs/new.spec.js @@ -4,8 +4,10 @@ let UserError = require('vn-loopback/util/user-error'); describe('order new()', () => { let orderId; - afterAll(async() => { + afterAll(async done => { await app.models.Order.destroyById(orderId); + + done(); }); it('should throw an error if the client is frozen', async() => { diff --git a/modules/order/back/methods/order/specs/updateBasicData.spec.js b/modules/order/back/methods/order/specs/updateBasicData.spec.js index 0ef73f887..dc9e6b7e6 100644 --- a/modules/order/back/methods/order/specs/updateBasicData.spec.js +++ b/modules/order/back/methods/order/specs/updateBasicData.spec.js @@ -1,14 +1,16 @@ const app = require('vn-loopback/server/server'); describe('Order updateBasicData', () => { - afterAll(async () => { + afterAll(async done => { let validparams = {note: null}; let orderId = 21; await app.models.Order.updateBasicData(validparams, orderId); + + done(); }); - it('should return an error if the order is confirmed', async () => { + it('should return an error if the order is confirmed', async() => { let error; let params = []; @@ -22,7 +24,7 @@ describe('Order updateBasicData', () => { expect(error.toString()).toContain(`You can't make changes on the basic data of an confirmed order or with rows`); }); - it('should return an error if the order has rows', async () => { + it('should return an error if the order has rows', async() => { let error; let params = []; @@ -36,7 +38,7 @@ describe('Order updateBasicData', () => { expect(error.toString()).toContain(`You can't make changes on the basic data of an confirmed order or with rows`); }); - it('should return an error if the user is administrative and the isTaxDataChecked value is true BUT the params aint valid', async () => { + it('should return an error if the user is administrative and the isTaxDataChecked value is true BUT the params aint valid', async() => { let error; let invalidparams = {invalid: 'param for update'}; @@ -50,7 +52,7 @@ describe('Order updateBasicData', () => { expect(error.toString()).toContain(`You don't have enough privileges to do that`); }); - it('should update the client fiscal data and return the count if changes made', async () => { + it('should update the client fiscal data and return the count if changes made', async() => { let validparams = {note: 'test note'}; let orderId = 21; diff --git a/modules/ticket/back/methods/sale/specs/removes.spec.js b/modules/ticket/back/methods/sale/specs/removes.spec.js index fad607107..ca2aabaeb 100644 --- a/modules/ticket/back/methods/sale/specs/removes.spec.js +++ b/modules/ticket/back/methods/sale/specs/removes.spec.js @@ -4,10 +4,12 @@ describe('sale removes()', () => { let sale; let newsale; - beforeAll(async() => { + beforeAll(async done => { sale = await app.models.Sale.findOne({where: {id: 9}}); sale.id = null; newsale = await app.models.Sale.create(sale); + + done(); }); it('should throw an error if the ticket of the given sales is not editable', async() => { diff --git a/modules/ticket/back/methods/sale/specs/reserve.spec.js b/modules/ticket/back/methods/sale/specs/reserve.spec.js index 076c09303..8f856fba8 100644 --- a/modules/ticket/back/methods/sale/specs/reserve.spec.js +++ b/modules/ticket/back/methods/sale/specs/reserve.spec.js @@ -1,7 +1,7 @@ const app = require('vn-loopback/server/server'); describe('sale reserve()', () => { - afterAll(async() => { + afterAll(async done => { let params = { sales: [ {id: 7}, @@ -11,6 +11,8 @@ describe('sale reserve()', () => { }; await app.models.Sale.reserve(params); + + done(); }); it('should throw an error if the ticket can not be modified', async() => { diff --git a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js index ad8f45a47..07f76ce01 100644 --- a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js +++ b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js @@ -3,14 +3,18 @@ const app = require('vn-loopback/server/server'); describe('ticket changeState()', () => { let ticket; - beforeAll(async() => { + beforeAll(async done => { let originalTicket = await app.models.Ticket.findOne({where: {id: 16}}); originalTicket.id = null; ticket = await app.models.Ticket.create(originalTicket); + + done(); }); - afterAll(async() => { + afterAll(async done => { await app.models.Ticket.destroyById(ticket.id); + + done(); }); it('should throw an error if the ticket is not editable and the user isnt production', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js index e997a260d..48d4cc968 100644 --- a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js +++ b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js @@ -11,12 +11,14 @@ describe('ticket componentUpdate()', () => { const today = new Date(); let ticketId = 11; - beforeAll(async() => { + beforeAll(async done => { [componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven); firstvalueBeforeChange = componentValue.value; [componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleEight); secondvalueBeforeChange = componentValue.value; + + done(); }); it('should change the agencyMode to modify the sale components value', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/deleted.spec.js b/modules/ticket/back/methods/ticket/specs/deleted.spec.js index e5a0906a2..4127a56b7 100644 --- a/modules/ticket/back/methods/ticket/specs/deleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/deleted.spec.js @@ -3,14 +3,18 @@ const app = require('vn-loopback/server/server'); describe('ticket deleted()', () => { let ticket; - beforeAll(async() => { + beforeAll(async done => { let originalTicket = await app.models.Ticket.findOne({where: {id: 16}}); originalTicket.id = null; ticket = await app.models.Ticket.create(originalTicket); + + done(); }); - afterAll(async() => { + afterAll(async done => { await app.models.Ticket.destroyById(ticket.id); + + done(); }); it('should make sure the ticket is not deleted yet', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/new.spec.js b/modules/ticket/back/methods/ticket/specs/new.spec.js index 607094874..9b1c43c57 100644 --- a/modules/ticket/back/methods/ticket/specs/new.spec.js +++ b/modules/ticket/back/methods/ticket/specs/new.spec.js @@ -7,8 +7,10 @@ describe('ticket new()', () => { let today = new Date(); let ctx = {req: {accessToken: {userId: 1}}}; - afterAll(async() => { + afterAll(async done => { await app.models.Ticket.destroyById(ticket.id); + + done(); }); it('should throw an error if the client is frozen', async() => { diff --git a/modules/ticket/back/models/specs/ticket-packaging.spec.js b/modules/ticket/back/models/specs/ticket-packaging.spec.js index f2834643d..893e0fb96 100644 --- a/modules/ticket/back/models/specs/ticket-packaging.spec.js +++ b/modules/ticket/back/models/specs/ticket-packaging.spec.js @@ -3,8 +3,10 @@ const app = require('vn-loopback/server/server'); describe('ticket model TicketTracking', () => { let ticketTrackingId; - afterAll(async() => { + afterAll(async done => { await app.models.TicketPackaging.destroyById(ticketTrackingId); + + done(); }); it('should save a ticketTraing as the quantity is greater than 0', async() => { From 11c6fd2da7045a8543b737a7f3071cdb3cfe0b5e Mon Sep 17 00:00:00 2001 From: Bernat Date: Fri, 1 Mar 2019 12:19:12 +0100 Subject: [PATCH 44/60] Cau 8402 fix test and update structure --- modules/order/back/methods/order/getTaxes.js | 2 +- .../back/methods/order/specs/getTaxes.spec.js | 13 ++- .../back/methods/order/specs/getTotal.spec.js | 4 +- .../back/methods/order/specs/getVAT.spec.js | 7 +- .../back/methods/order/specs/summary.spec.js | 2 +- modules/order/back/methods/order/summary.js | 1 - .../db/install/changes/1-orderGetTotal.sql | 4 +- services/db/install/changes/3-orderGetTax.sql | 90 +++++++++++-------- 8 files changed, 72 insertions(+), 51 deletions(-) diff --git a/modules/order/back/methods/order/getTaxes.js b/modules/order/back/methods/order/getTaxes.js index 84101acd8..72d91d23a 100644 --- a/modules/order/back/methods/order/getTaxes.js +++ b/modules/order/back/methods/order/getTaxes.js @@ -38,7 +38,7 @@ module.exports = Self => { stmts.push('CALL hedera.orderGetTax()'); - let orderTaxIndex = stmts.push('SELECT * FROM tmp.orderTax') - 1; + let orderTaxIndex = stmts.push('SELECT * FROM tmp.orderAmount') - 1; stmts.push(` DROP TEMPORARY TABLE diff --git a/modules/order/back/methods/order/specs/getTaxes.spec.js b/modules/order/back/methods/order/specs/getTaxes.spec.js index b41183c98..303b72050 100644 --- a/modules/order/back/methods/order/specs/getTaxes.spec.js +++ b/modules/order/back/methods/order/specs/getTaxes.spec.js @@ -13,10 +13,19 @@ describe('order getTaxes()', () => { expect(result.length).toEqual(0); }); - it('should call the getTaxes method and return the taxes if its called with a known id', async() => { + it('should call the getTaxes method and return the taxes splited if different type of taxes', async() => { let result = await app.models.Order.getTaxes(1); - expect(result[0].tax).toEqual(9.49); + const expectedResult = result[0].tax + result[1].tax; + + expect(expectedResult).toEqual(20.29); + expect(result.length).toEqual(2); + }); + + it('should call the getTaxes method and return the taxes for them same type', async() => { + let result = await app.models.Order.getTaxes(2); + + expect(result[0].tax).toEqual(9.1); expect(result.length).toEqual(1); }); }); diff --git a/modules/order/back/methods/order/specs/getTotal.spec.js b/modules/order/back/methods/order/specs/getTotal.spec.js index b5a942024..613f00241 100644 --- a/modules/order/back/methods/order/specs/getTotal.spec.js +++ b/modules/order/back/methods/order/specs/getTotal.spec.js @@ -1,9 +1,9 @@ const app = require('vn-loopback/server/server'); describe('order getTotal()', () => { - it('should return the total', async() => { + it('should return the order total', async() => { let result = await app.models.Order.getTotal(1); - expect(result).toEqual(145.09); + expect(result).toEqual(155.89); }); }); diff --git a/modules/order/back/methods/order/specs/getVAT.spec.js b/modules/order/back/methods/order/specs/getVAT.spec.js index 6f9b3d55d..bc0abd9af 100644 --- a/modules/order/back/methods/order/specs/getVAT.spec.js +++ b/modules/order/back/methods/order/specs/getVAT.spec.js @@ -2,10 +2,9 @@ const app = require('vn-loopback/server/server'); describe('order getVAT()', () => { it('should call the getVAT method and return the response', async() => { - await app.models.Order.getVAT(1) - .then(response => { - expect(response).toEqual(9.49); - }); + const result = await app.models.Order.getVAT(1); + + expect(result).toEqual(20.29); }); it(`should call the getVAT method and return zero if doesn't have lines`, async() => { diff --git a/modules/order/back/methods/order/specs/summary.spec.js b/modules/order/back/methods/order/specs/summary.spec.js index b0b142a89..f6f917ede 100644 --- a/modules/order/back/methods/order/specs/summary.spec.js +++ b/modules/order/back/methods/order/specs/summary.spec.js @@ -23,7 +23,7 @@ describe('order summary()', () => { it('should return a summary object containing VAT for 1 order', async() => { let result = await app.models.Order.summary(1); - expect(Math.round(result.VAT * 100) / 100).toEqual(9.49); + expect(Math.round(result.VAT * 100) / 100).toEqual(20.29); }); it('should return a summary object containing total for 1 order', async() => { diff --git a/modules/order/back/methods/order/summary.js b/modules/order/back/methods/order/summary.js index e860209b4..5acc5fb2e 100644 --- a/modules/order/back/methods/order/summary.js +++ b/modules/order/back/methods/order/summary.js @@ -25,7 +25,6 @@ module.exports = Self => { summary.subTotal = getSubTotal(summary.rows); summary.VAT = await models.Order.getVAT(orderId); summary.total = await models.Order.getTotal(orderId); - return summary; }; diff --git a/services/db/install/changes/1-orderGetTotal.sql b/services/db/install/changes/1-orderGetTotal.sql index 1e15741c6..dbbc990f2 100644 --- a/services/db/install/changes/1-orderGetTotal.sql +++ b/services/db/install/changes/1-orderGetTotal.sql @@ -18,9 +18,9 @@ DROP TEMPORARY TABLE IF EXISTS tmp.orderTotal; CREATE TEMPORARY TABLE tmp.orderTotal (INDEX (orderFk)) ENGINE = MEMORY -SELECT o.orderFk, IFNULL(SUM(ot.taxBase + ot.tax + ot.equalizationTax), 0.0) AS total +SELECT o.orderFk, IFNULL(SUM(ot.taxableBase + ot.tax), 0.0) AS total FROM tmp.order o -LEFT JOIN tmp.orderTax ot ON o.orderFk = ot.orderFk +LEFT JOIN tmp.orderAmount ot ON o.orderFk = ot.orderFk GROUP BY orderFk; DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; diff --git a/services/db/install/changes/3-orderGetTax.sql b/services/db/install/changes/3-orderGetTax.sql index 73cb7c42e..e9ed5a339 100644 --- a/services/db/install/changes/3-orderGetTax.sql +++ b/services/db/install/changes/3-orderGetTax.sql @@ -3,49 +3,63 @@ DROP procedure IF EXISTS `orderGetTax`; DELIMITER $$ USE `hedera`$$ - CREATE DEFINER=`root`@`%` PROCEDURE `orderGetTax`() -READS SQL DATA + READS SQL DATA BEGIN /** -* Calcula el IVA, y el recargo de equivalencia de un pedido -* desglosados por tipos. -* -* @tabla tmp.order Contiene los identificadores de los pedidos -* @treturn tmp.orderTax Bases imponibles, IVA y recargo de equivalencia -*/ -CALL vn.taxGetRates (NULL); + * Calcula el IVA, y el recargo de equivalencia de un pedido + * desglosados por tipos. + * + * @param vOrder El identificador del pedido + * @treturn tmp.orderTax Bases imponibles, IVA y recargo de equivalencia + */ + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT o.address_id addressFk, o.company_id companyFk + FROM tmp.order tmpOrder + JOIN hedera.order o ON o.id = tmpOrder.orderFk; --- Calcula el IVA y el recargo desglosado. + CALL vn.addressTaxArea (); -DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; -CREATE TEMPORARY TABLE tmp.orderTax -(INDEX (orderFk)) -ENGINE = MEMORY -SELECT id orderFk, t.type, t.taxBase, -CAST(IF(t.hasTax, t.taxBase * x.rate, 0) AS DECIMAL(10,2)) tax, -CAST(IF(t.hasEqualizationTax, t.taxBase * x.equalizationTax, 0) AS DECIMAL(10,2)) equalizationTax -FROM ( -SELECT o.id, g.countryFk, g.type -,SUM(CAST(m.amount * m.price AS DECIMAL(10,2))) taxBase -,NOT(c.isVies AND p.countryFk <> c.countryFk) hasTax -,c.isEqualizated != FALSE AS hasEqualizationTax -FROM `order` o -JOIN tmp.order tmpo ON tmpo.orderFk = o.id -JOIN orderRow m ON m.orderFk = o.id -JOIN vn.item a ON a.id = m.itemFk -JOIN vn.client c ON c.id = o.customer_id -JOIN vn.supplier p ON p.id = o.company_id -JOIN tmp.taxClass g -ON g.countryFk = p.countryFk AND g.taxClassFk = a.taxClassFk -GROUP BY o.id, g.type -) t -JOIN tmp.taxType x -ON x.countryFk = t.countryFk AND x.type = t.type; + -- Calcula el IVA y el recargo desglosado. + DROP TEMPORARY TABLE IF EXISTS tmp.orderTax; + CREATE TEMPORARY TABLE tmp.orderTax + (INDEX (orderFk)) + ENGINE = MEMORY + SELECT o.id orderFk, + tc.code, + SUM(m.amount * m.price) taxableBase, + pgc.rate + FROM tmp.order tmpOrder + JOIN `order` o ON o.id = tmpOrder.orderFk + JOIN orderRow m ON m.orderFk = o.id + JOIN vn.item i ON i.id = m.itemFk + JOIN vn.client c ON c.id = o.customer_id + JOIN vn.supplier s ON s.id = o.company_id + JOIN tmp.addressTaxArea ata + ON ata.addressFk = o.address_id AND ata.companyFk = o.company_id + JOIN vn.itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = s.countryFk + JOIN vn.bookingPlanner bp + ON bp.countryFk = s.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = itc.taxClassFk + JOIN vn.pgc ON pgc.code = bp.pgcFk + JOIN vn.taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tmpOrder.orderFk, pgc.code,pgc.rate + HAVING taxableBase != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.orderAmount; + CREATE TEMPORARY TABLE tmp.orderAmount + (INDEX (orderFk)) + ENGINE = MEMORY + SELECT orderFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code + FROM tmp.orderTax + GROUP BY orderFk, code; -DROP TEMPORARY TABLE -tmp.taxClass, -tmp.taxType; END$$ -DELIMITER; \ No newline at end of file +DELIMITER ; + From ea3328756b47a961787a27873583aee79e9e7c21 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 1 Mar 2019 13:56:17 +0100 Subject: [PATCH 45/60] #1185 cambiar e2e client log --- e2e/helpers/selectors.js | 1 + e2e/paths/client-module/13_log.spec.js | 29 +++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index e653eb641..a37d63854 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -151,6 +151,7 @@ export default { }, clientLog: { logButton: `vn-left-menu a[ui-sref="client.card.log"]`, + lastModificationDate: 'vn-client-log > vn-log vn-table vn-tbody > vn-tr > vn-td:nth-child(1)', lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before', lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after' diff --git a/e2e/paths/client-module/13_log.spec.js b/e2e/paths/client-module/13_log.spec.js index 2a82744ff..54303599f 100644 --- a/e2e/paths/client-module/13_log.spec.js +++ b/e2e/paths/client-module/13_log.spec.js @@ -4,6 +4,8 @@ import createNightmare from '../../helpers/nightmare'; describe('Client log path', () => { const nightmare = createNightmare(); + let date; + beforeAll(() => { nightmare .loginAndModule('employee', 'client') @@ -17,6 +19,7 @@ describe('Client log path', () => { .write(selectors.clientBasicData.nameInput, 'this is a test') .waitToClick(selectors.clientBasicData.saveButton) .waitForLastSnackbar(); + date = new Date(); expect(result).toEqual('Data saved!'); }); @@ -38,9 +41,33 @@ describe('Client log path', () => { }); it('should check the current value of the last logged change', async() => { + let lastModificationDate = await nightmare + .waitToGetProperty(selectors.clientLog.lastModificationDate, 'innerText'); + + let lastModificationPreviousValue = await nightmare + .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); + let lastModificationCurrentValue = await nightmare .waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); - expect(lastModificationCurrentValue).toContain('this is a test'); + let month = date.getMonth() + 1; + let day = date.getDate(); + let year = date.getFullYear(); + let hours = date.getHours(); + let minutes = date.getMinutes(); + + if (month.toString().length < 2) month = '0' + month; + if (day.toString().length < 2) day = `0${day}`; + if (hours.toString().length < 2) month = '0' + hours; + if (minutes.toString().length < 2) day = `0${minutes}`; + + let today = [day, month, year].join('/'); + let time = [hours, minutes].join(':'); + + let now = [today, time].join(' '); + + expect(lastModificationDate).toContain(now); + expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller'); + expect(lastModificationCurrentValue).toEqual('name: this is a test'); }); }); From 269a2576b2239e69813395b0206bb62d52b34bde Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 4 Mar 2019 19:47:10 +0100 Subject: [PATCH 46/60] fonts updated --- front/core/styles/salixfont.css | 316 +++++++++++++++---------------- front/core/styles/salixfont.eot | Bin 21860 -> 24264 bytes front/core/styles/salixfont.svg | 160 ++++++++-------- front/core/styles/salixfont.ttf | Bin 23724 -> 24088 bytes front/core/styles/salixfont.woff | Bin 23800 -> 24164 bytes 5 files changed, 238 insertions(+), 238 deletions(-) diff --git a/front/core/styles/salixfont.css b/front/core/styles/salixfont.css index 8e9a02963..67ff48cb5 100644 --- a/front/core/styles/salixfont.css +++ b/front/core/styles/salixfont.css @@ -23,240 +23,240 @@ -moz-osx-font-smoothing: grayscale; } -.icon-pets:before { - content: "\e94e"; -} -.icon-100:before { - content: "\e940"; -} -.icon-accessory:before { - content: "\e90a"; -} -.icon-actions:before { - content: "\e900"; -} -.icon-addperson:before { +.icon-tax:before { content: "\e901"; } -.icon-albaran:before { +.icon-notes:before { content: "\e902"; } -.icon-apps:before { - content: "\e948"; -} -.icon-artificial:before { +.icon-lineas:before { content: "\e903"; } -.icon-barcode:before { +.icon-languaje:before { content: "\e904"; } -.icon-basket:before { - content: "\e942"; -} -.icon-bin:before { +.icon-greuge:before { content: "\e905"; } -.icon-botanical:before { +.icon-100:before { content: "\e906"; } -.icon-bucket:before { +.icon-History:before { content: "\e907"; } -.icon-claims:before { +.icon-Inactivo:before { content: "\e908"; } -.icon-clone:before { +.icon-person:before { content: "\e909"; } -.icon-columnadd:before { - content: "\e944"; +.icon-actions:before { + content: "\e90a"; } -.icon-columndelete:before { - content: "\e90f"; -} -.icon-components:before { +.icon-addperson:before { content: "\e90b"; } -.icon-consignatarios:before { - content: "\e90d"; -} -.icon-control:before { - content: "\e93f"; -} -.icon-credit:before { - content: "\e90e"; -} -.icon-delivery:before { - content: "\e910"; -} -.icon-details:before { - content: "\e911"; -} -.icon-disabled:before { - content: "\e91b"; -} -.icon-doc:before { - content: "\e913"; -} -.icon-entry:before { - content: "\e914"; -} -.icon-exit:before { - content: "\e947"; -} -.icon-eye:before { - content: "\e915"; -} -.icon-fiscal:before { - content: "\e912"; -} -.icon-flower:before { - content: "\e916"; -} -.icon-frozen:before { - content: "\e917"; -} -.icon-greenery:before { - content: "\e93c"; -} -.icon-greuge:before { - content: "\e918"; -} -.icon-grid:before { - content: "\e919"; -} -.icon-handmade:before { +.icon-albaran:before { content: "\e90c"; } -.icon-history:before { +.icon-apps:before { + content: "\e90d"; +} +.icon-artificial:before { + content: "\e90e"; +} +.icon-barcode:before { + content: "\e90f"; +} +.icon-basket:before { + content: "\e910"; +} +.icon-bin:before { + content: "\e911"; +} +.icon-botanical:before { + content: "\e912"; +} +.icon-claims:before { + content: "\e913"; +} +.icon-clone:before { + content: "\e914"; +} +.icon-columnadd:before { + content: "\e915"; +} +.icon-columndelete:before { + content: "\e916"; +} +.icon-complementos:before { + content: "\e917"; +} +.icon-components:before { + content: "\e918"; +} +.icon-confeccion:before { + content: "\e919"; +} +.icon-consignatarios:before { content: "\e91a"; } -.icon-info:before { - content: "\e949"; +.icon-control:before { + content: "\e91b"; } -.icon-invoices1:before { - content: "\e94a"; -} -.icon-invoices:before { +.icon-credit:before { content: "\e91c"; } -.icon-item:before { - content: "\e941"; -} -.icon-languaje:before { +.icon-deleteline:before { content: "\e91d"; } -.icon-linedelete:before { - content: "\e946"; -} -.icon-lines:before { +.icon-delivery:before { content: "\e91e"; } -.icon-linesplit:before { - content: "\e945"; +.icon-details:before { + content: "\e900"; } -.icon-linesprepaired:before { - content: "\e94b"; -} -.icon-logout:before { +.icon-dfiscales:before { content: "\e91f"; } -.icon-mana:before { +.icon-doc:before { content: "\e920"; } -.icon-mandatory:before { +.icon-entrada:before { content: "\e921"; } -.icon-niche:before { +.icon-eye:before { content: "\e922"; } -.icon-no036:before { +.icon-flor:before { content: "\e923"; } -.icon-notes:before { +.icon-frozen:before { content: "\e924"; } -.icon-noweb:before { +.icon-grid:before { content: "\e925"; } -.icon-onlinepayment:before { +.icon-headercol:before { content: "\e926"; } -.icon-package:before { +.icon-info:before { content: "\e927"; } -.icon-payment:before { +.icon-item:before { content: "\e928"; } -.icon-person:before { +.icon-linesprepaired:before { content: "\e929"; } -.icon-photo:before { +.icon-logout:before { content: "\e92a"; } -.icon-plant:before { +.icon-mana:before { content: "\e92b"; } -.icon-recovery:before { - content: "\e92d"; -} -.icon-regentry:before { - content: "\e92e"; -} -.icon-reserve:before { - content: "\e92f"; -} -.icon-revision:before { - content: "\e94c"; -} -.icon-risk:before { - content: "\e930"; -} -.icon-services:before { - content: "\e94d"; -} -.icon-settings:before { - content: "\e931"; -} -.icon-sms:before { - content: "\e932"; -} -.icon-solclaim:before { - content: "\e933"; -} -.icon-solunion:before { - content: "\e934"; -} -.icon-splur:before { - content: "\e935"; -} -.icon-stowaway:before { +.icon-mandatory:before { content: "\e92c"; } -.icon-supplier:before { +.icon-newalbaran:before { + content: "\e92d"; +} +.icon-newinvoices:before { + content: "\e92e"; +} +.icon-niche:before { + content: "\e92f"; +} +.icon-no036:before { + content: "\e930"; +} +.icon-noweb:before { + content: "\e931"; +} +.icon-onlinepayment:before { + content: "\e932"; +} +.icon-package:before { + content: "\e933"; +} +.icon-payment:before { + content: "\e934"; +} +.icon-pets:before { + content: "\e935"; +} +.icon-photo:before { content: "\e936"; } -.icon-tags:before { +.icon-planta:before { content: "\e937"; } -.icon-tax:before { +.icon-recovery:before { content: "\e938"; } -.icon-ticket:before { +.icon-regentry:before { content: "\e939"; } -.icon-traceability:before { +.icon-reserva:before { content: "\e93a"; } -.icon-transaction:before { +.icon-revision:before { content: "\e93b"; } -.icon-volume:before { +.icon-riesgo:before { + content: "\e93c"; +} +.icon-services:before { content: "\e93d"; } -.icon-web:before { +.icon-settings:before { content: "\e93e"; } -.icon-worker:before { +.icon-sign:before { + content: "\e93f"; +} +.icon-sms:before { + content: "\e940"; +} +.icon-solclaim:before { + content: "\e941"; +} +.icon-solunion:before { + content: "\e942"; +} +.icon-splitline:before { content: "\e943"; +} +.icon-stowaway:before { + content: "\e944"; +} +.icon-supplier:before { + content: "\e945"; +} +.icon-tags:before { + content: "\e946"; +} +.icon-ticket:before { + content: "\e947"; +} +.icon-traceability:before { + content: "\e948"; +} +.icon-transaction:before { + content: "\e949"; +} +.icon-unavailable:before { + content: "\e94a"; +} +.icon-verde:before { + content: "\e94b"; +} +.icon-volume:before { + content: "\e94c"; +} +.icon-web:before { + content: "\e94d"; +} +.icon-worker:before { + content: "\e94e"; } \ No newline at end of file diff --git a/front/core/styles/salixfont.eot b/front/core/styles/salixfont.eot index c816a300f8c5eb846a2d4a47a1b1e85788584243..d02e74ae49946c4f2ca7f092fdb97ebd37b890e4 100644 GIT binary patch delta 4737 zcmZ`-4Qw07m7dvI?usj}xYUxn;)-0*pyTM>BqKQTd|zji7Edn zPENk7+Zv^DXB?8IE@CfSB)Uc|ieB1_+olDZrntC(4s`(^U;)?QTm(VU;Ce-Jxb)|6 zY3p83V(tw|If~m`?%RFy_h#nJd*6G@U%ZTO{Qz^fjv&-^`TM$25@g?2!7ck}q(4&vdAAM3i@W!1h{}QPFYTuW~5yIyYI{5gB<3}I& z9&!FVLWh0|{qiTEg1^a12+eq*+g$G|7f4V58!e88+aEy z|A0@9w;}YwGKnq) zIp4j9{i-tRS$KD0;pYnr_@5VAoPD_D$2I$}O0QzePCj@Qv-S@jT(pn(?y`T;ldjE& z&S8;(b-V@ZcnN7px3_eMnIW(JNOwQ3*k9Q7dMz3#W80UyT6>K7BepMhKVO?=_cOIm z?)fgReTVxmTs!K#jqUl#{q`R3qqS7~RXjX_{t?IUCt)8QIEami8A}(o;8@m-4M2(G zJFw5I^xz0*qzz9Pcopstwyug%J0^ydO&Gdc8CvJ_((WK)5ZjN6qxO=h*sqCw_P>cK zTk25kct@Hwh9c?O;f{|pwO6GwsdC8rV42(ny*f}EilQ{ip;1^1?}SC=3Wg(AFmmC7 zn#-C=+*}YWs;TN2&L}V?%$LjNdC)a1BVWWAf8`=Z_|C=p^+>t?&gK`&`1Em zkRuG{5(k^1@94$?K8*+KKdxV+Pv*yXaP7WwiFs*lrb#8N)!%6nHQknFcB3A!N`xbD z2)unYq?p9;SUDqSG3eCn?6dK{zWB4Vv!^!jg$i8ue2>PhA#BZ6YLmO;xaw#e$_gBc zf+EO72{Zs=jr-K!wDj**W^3(AyaOs-p>wb-%weLZ5Q>7%wqUS4cvk6-d?O7L2P-u0 zO+A2P4iz-ruy}A5dc%lOoP)b50A#HDhRQe92Lk{G0@w#PFdH5}~Q4R(Rs-g?CQ&Y2ouBcgEf6$0+)pbjr z4(^Hv2Ng9ezVYt6Z-`-484SihroU3rEUltj-pVj9{Fdr~Y9jIJox@Z9m`jAqWh&~h zUS`{Q&PB?4-mgZX(iIRzQ=2lvq6=h|iHqag*|HLb0bv8x62@j+`)2QnwuZg`43Oy> zfc;;i=h1i2+vtDbs2Yml!Rs4{LX~7vlmK9Sx103q$tz`hvZp_y;a2G7>~_XYsq$xRce(vA&zg$5R?S%n8}gcNO4z<~)D4$7va zBt(5!ks|WYsf4U?0?)g6eOOf#h&iN3Q#R?WgB98ob-zX0iLqHD91%5e>omIk%q7gJ65(%l_<=rmT3Yz_d1Y)9Jlr(1|B)y<@ zNlsmrqY}>(v6Ju)LVEqdoWy)W*{121uJ);ck)Yfs>bxZ8bWxYRN!6cG71Jg4h+>x@ zvZBD>;Q9<`(vuu72=PFmNAe4jyGjUQMva`R$b{<<%(5cMgmn2oEfj9|jwXCIa)mT1q8U^{kmOKE8Oo-!`6j9~Kn2VQ z2LDN1qmege#^jC2+Q4*Xm&I_jQ|Ly2`&RxTZI@64g*+)E0rmivvS=$ zxv74cK_e#?0|S>Utd>zLX4W-#gfoL!T#u7mX`m#MC)XQIGArxhvVO|#E=0{#ziH;( zaOF+2KV?P>Zg>6q#HNvny@mYVw=%k(PV0Kc_7`rtNduE<$~B1&ql@4#8ickh}EB=2G3D5uF-+klFw_S1p~R|yg!_N>Ah;>bq- z0B{CpMp2>x74!i&q(*S8O&n^x^M!2QYT^RLlXWaH0OsHxz>uy0>@-0Q#^strGfGQd z0|XoLstttNLgA^|rYfz8RK-hcII{rw78~-WhcfBb3IK;1%VX{o=JViQ+sfPi7Kl@w z#m^K0zcG}WhgIabtA?R@(v45D0FbV zOOm?<#Y4z)e!c)vZdc(n1R&el99L=fL zP{v9R<#PouO$NMa4|MPu4`9^+Kp|p}I;2=>tKcg*Vo`Mv7t|Q}O?@>4+vdsA@tsr) zWQxX#v0zmS3W6qU+YHuu0QSt0oyRW|*eL6(zXv$q&K;W~fRED-7FXKv9B~{V5S7Xm zhy=WYTfKPG`86{M#_+LneHBmDUwdD~#8Il>xwgofOPA|+aH;w)@s85i zi>@0rD!wcejm#}t#J+}0-OVI6^Qrm78 z)&6z!vuy3*t&3oq_h6VH9<@Vu9YAAfCz?Xj;HDnK!vjGg=Hqk5P(#7KC`~SMycvIaH+Z#>E6`-D5yj!)VpNJ1<*fp^ELP!zW?z2pq;Obqn(jd-NvJJznvgz)L}N`+v2cXV}hlo9dSx;V&0)@qDr zbneiy-#?MgWX6(WuYBv!Oo=^Mq~bV{9}8p^@w#nYVt3o`X%OTYmtS8 z3h0_JuTY7#|K9$;Of5B0!UhJ*1vo(4Vs4ckruyRcYpaxt3BCzlMVf!0lo}0v!Ra4In^rb%{PNA+qJh)wOZ9wBo#-e zqO=IKK0SR8-dEn(M)`F)bgTzR1lj>a+bF-@-v|7K56kf3VZXVzr+NmT!k@=qXO1yf znO~Dh@*H`S9cDkr{=^aC0^Dxi#6i74dr=T^(CHo^X%5FS@_& zz9nTmrsss`yPp5(jC6jlvn~&N^WM*TZ}<-SzTo?qc;c-F4jSfKynwRk*1n@>PM%Ly&OUK&k2bnc?X8-^I delta 2491 zcmZuzYfK#16~1@wJa+a0yX?*m4D7@rXc!rBxiMs%=$Pf4KeO{)w7YaU;C+%(5t! z>N|7hob#P?U+12C@7%eCA6>!h*&c+hcc<7|&kcdSjQ+3Wp*fU5lV}_*rcNtM&!}h= z&7f&CzgGnVGofWfQ1!`|t0K91>^LAdfzAw1C1%Cm&;EoEE&{!KEHO6=+zPtR4P%q9 zjsAV)g%!{j5jxp;ZX|Km{uRd{)Oj83wdVlfZqo+P`#%T3e{O1i(TlksBh=-9N)?kc z!-=2YxiyW@OO0TEcPgMTBtThtHmG5GG_aqT|8gS9DhH>G{Y`Z@7g}VJ&3v><59M0GW#4rWjd`~=}vrW-S^jg0YYp8OpeJ!4% zFw#1uW}^1HyVX_48I394#s!cTyW2E^g(1j+@=+12ryqq;h59;G=ny=650M3*kR?^4 z;->kznK>#xr!(z#NsP8o(9Q#B=Q5IzTm72#s4lKT{mQ?lF@`3bOHeti|6S4{u2|XsOpA(IhY=Ex=QR$muq5+#$;HVSYF-dlO^_B z{@NaKL;cVs9Y{CTu{pfa#Md2&<=f?w60@bUxHtfykq0nPTwH0f_=}>VBX$63-(?oC z+RQ|?KscXh_bVXWPw8WtqjJQcw(%FW)AdQJkVo|H?Mz_L!$w~~Z=$!+JLn49M4CF; z{^AlWj>0)u$PZbBD9B88qz2xAo(oE(HWr0t7a=H+UjaqT#bPX^FkC>uftUz>a&@F$ zPo0|T+L&Uqfs3q&j0M}oYA1jhV?70qil8u|fLMhUk$jPU;wG4IWPN0*9T*{9#6*0} zF1utjN_JPXj~KfMp;^*C@)qG~h6w3@aSSoB$>TI=y$rzs<+(@PjkT1Qy}VY!_P zclfKp^0qeI+PaHyPkQT18oX$_F@5*ans?)^^j+MR-fF~zq3JIM(p#;#b*Zgs!+aC} z;k+A0K-iW(h7be0MvD$}vDIE=c8Co99w3B$xrHU*Bg}9Hj%DejK5o{lv0N$z1J%4> z_5Q6(SVz)#({4(_Jt-}G{71A(h!cOLO5~U7r{tnKOs{F1o$IvL)BA*i zO)-@1s1v<{eyY+(P9Nd)bA@AJ@hh`EA+8=M_v?ORS^T25FR*^7yp#fcHg&U`HTE8&Ry@^EIK36{&P-4gS z@Qe{bp9n|1@=)o6O%gU$Y=f(z21`&v}^hBsXHMwys!z zV=J*W+1{~F+b;@>!nW|(`ET)2!DT5&x*+|n@ND5nMNLK5itf4Ri;GGmPqNJOiT9j$ z$G7f#4_Fr3NCMifOi=Mt0Si=#8s^WXeAsoSrXRz3&c|Al&vNp%gm?9anHhZg?_^rrpx diff --git a/front/core/styles/salixfont.svg b/front/core/styles/salixfont.svg index d6654ec1e..9c99d9457 100644 --- a/front/core/styles/salixfont.svg +++ b/front/core/styles/salixfont.svg @@ -3,87 +3,87 @@ Generated by IcoMoon - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/front/core/styles/salixfont.ttf b/front/core/styles/salixfont.ttf index 7c0ac2492e9e53d1af4eb16ed47a939da5cb585b..229075e3522ad98524ebf2577c77a4c97f7f37aa 100644 GIT binary patch delta 2742 zcmaJ@eQXrR6`$GJkGu1&z3aW*v(LV>@0R;1v8kCLv9c>Z(>tB>D%ch?2Hy)wD`m(WaGXDN^mD zZ+!?4^^c5?4vjc=S^tR8z;6*k z$#D>Hi?o2ypaaIM#`jH4ug8{+Fm8o8-4m0~4hegMR}gw~2Jkob4NX6X4&a|5^i&g! z>-P`s8_j;{gPSn!2L1ETP3EQ$0R%mL$HWmKCw_9f+JeyC1sahBz#OO=d60@is2Rod z^Ky+VA$w(Su_2nQCgl5#{*l}!=Kh?^eVohT_j4sqKeDbG8~WV3x3Q*gP0wOl|3i9C zKdNrhEp<`jgnJ4{C|L2=u;Mx70xu9&6Y)S8`&c(teXJ}x6wMn;Cd7C^^{NRi;?Q4k zHBnil|ElXfqpK!^^+%d!jmtQTB?g7>E|BZsyMlZuh{C8vKT{j9dlOzc1&#UXOSM&! zTT$HZ!-ZGzsIt04&pC@zvbBUG!TrY*5Y715L|8g&6Q)>q13@P)Tk%3Sd{mJky4dw|y-w=YySDZl*QEt)c$GM<|Il@6jJ=;`8d;DXiAaWIBgQLw z#Re>T&EEgu0Pn>uh3kcrW=mbiEz1v$)6}`;!6K!xtMEyY^o!dL8OJt;us+axT>sYA zFBq5VzD?vh$9+_MN1w8f`JwH zs2iz$Nn&9)WHx*qh;>@qpKm92789XfpgFdqv*V@Cjt)!?OFqfjtOy>PRkD#Xq8(VX z?aVg95;||S(lBH5>CI~nXe>uWg%7zKf&#A!LW4k9u1;|_3X&?Z8`QD*J$QAS~8b_1p1#}c0N8dze(RcO7Th{N1rZ@)+*G+T6wbK~QzZSP+NH5ft z7VI=L9SHhU&I;^|22%{@$Nq# zn4sU;f>X{Q`A1<%#}PR%xNSC<LTzA%vm(7#e3S zc#JSR34=){%W;Hb*rg+j*4G1J$o=D)!V>N&T)xF)!lVl~PR`MR`D29}I9+%*jfr?` zu<+vy?n-yOX1@}~i+eq0+?mH3pMZ>V+-ast;_C!RkFAO!b08wj_Qx1PR}guUwXzWK zKK-W=S1ZeOThjCe-|)=vaA9#~ZWxn3+!P)Qhw*SO{hDZ*Z_V*HXRvE0Jv{%r8BjZ# zwsh0TxU=RZ+Q>gT2Pg4<@gRspWl%b5Q3u+HdQczSN>LR#Ae>NTE}=$N;wkaWeO z1&$@5=0U-OYL{rk2@b@Z$~jYs6coqU%C&_&1x+iOpVLxsL$MPo?Tr`1VX87bIDk`m zSF${7a>;@}0_p)apn&zTvnc_sg%!|57qlo~re(P|aM;V(m50E1uhR z4I}kzeb!s+{f=+m_c!%<_0v@jKMI@)W~&CDT0 z!8!hNi6^jubtRq#{&JPY!tOS}!fR{8|@t(J2WwL5cQ%_Snm+n9YO~`drBwxP(L=hfArwc)aXe4u-^UDGyelXaV;YN delta 2197 zcmZuxYitwQ6~1@wof$t9PwnwIPHe|-=N&R}CTtuCG!98%L+N7h8bXO7z(Rs)lPzf# zHFUM1`+y2_O9c^2QPl2(R-)|yp%trIEz5Q*v=XQ*ZTW%vV^>0Lf3(_m#gAR5XA-0K z2lgDFbH4MKbI(0K=WpR({05)tn|pNe_IZTx3_?5Uq4BZ(F7=n!5z5XYgt`s^Al{}9 z(650WIW##vvk{x#1N~!&*)mbsHZ(C$-)9T8Ie-RF9P`4DEO8~5w)TDNohd)5EM9UOXjxkP432?bFv zLQzq6iB(t>!l8I8j>nS3t@yFxRy(wHSnJY==wxFF*PPn10+W;^%OjeW{(364)#XeD z5{a>Ht+z+h_9ha3)zs(rA50I7j0~g?`r-3G`J+?3zs3`?m~GaWNAYk4S(0i*Q4|!( zA(sn7T+UzXO<1iqTf*!0`MlnQ&1SX5y|r+v+;U0(t@J+DldiLPLl*rBufq&ZU4?x( z9E!!e@fs*L-Wh`vghK)xM|Qab7~qf)hTpIh1VDkukJWC>mgQ&PQzu8<(v*`;qDB;5BX(LZj@bme`yeb_qs@ATM;Nqf1ka)2_@zJe*WhI0+93T`MzT^h8|kv`PvO zoLg0O#PP5(m1^W3H1v|5@9;xe8 zT*(%s-=W7bJ4ZY97vmnHH#9@LpQW4i{Vn4rcENO3zuKMWYR!l)-(G3#VN^iJ(J6EW z{Rmw_SCP(c4Q-r*%h5!a0P~?L&;^xm?^pv*)R+aWqbu17*RDWQV7{W7QjL{lT;s*4 zjH5{f{M7c2wZ`bIY41vEk_0ZQrto$wDeZ0mSBz^paMWatk4Kd@tSRKP@?$^2L?oBS z=Z1k1vW-|tIPG(KEf%lSmktxlHbSUChR076Gv$d~{=3K%tB~J9LEFI-e1uYbgz!5E zkICQx!9)b{i`hS#e;#WZ8p4Bv%Lr%6OaG?eMQLC8-noU);_31|JXBul!-S{wvs`&; z5D(4`^)K3P;SUb`p#mZdWO+hN!U9!Xwt&M~XLBh$y#NRio*NJd_{as(Bnkq}8+8jI zT@Z^!C{z!DRU~;T2%<>oHgi9Hi}&Z}^9T8IY5qbUlO5&1;eE$bi*IPhAI@WMhTnJT z;e1}0&%e@Vepa{lbno+Z0h2siY1qY11_RoAfoMz#;L?>o1%%+MD0r7z1~jDMSLj{KMn zMW^+DHNv2M8atzJ=Sl{A_M> zuxP+Qdw@tqeie8>(91wMb~&f8_$~)~KbHtLRXmIcgN$ecTd3%Jm~B^J8?9(hybLY@ z4OMV^h0DNafie}{@Ox6jlUNn7J*CDVP=7v^S*&9dEc(sIM{p|#uAY&&YZXnSNIw!cR&wOgL4U8rlWyI5E9?+(y6w33@NRp8RM zaJH-{y_?_6Z{B-5`)1yo+4<~O`27o5`DRyJ8^Q>F`-V};YFmM@@z*`dQ}t~#eZvU# z4S%%bx$R>kgTM#EV3D%m+GqdU7zjc3AoSN+;Ff4%Y~si?$Yv43offuWTgQRPhrn+4 zTVV5|1z|jNVPbIl5JG#v7S*oeF#heq!HE%&ordRLvXC$N*4sA@O->yF=d!h%6$4T&NOxk%q#k0mZ>w^oaqVpOr3M|VAyM@CJ@o93yiEH=JZKW7puk0l00zgQ$!z-tBhQ3yp*qwzs? zu-}*T$!VypKbgEHb?N$c;oZ8HmOAQMq?K$ej4B?F0ytWD8c&{C`HZqzAOrOqHq^J) zt>}@~)(CaEuGOPjhN@>p&*v}a^P|QC-Sg&UvXe4#=PTIsvH!y67273je6oF~@f+zu z^Q>bIH+P{oaR@&GOIM0LSn~%%vGgV!N(4jep~rHiSavBj*w1P)P4od*p?G0Y4mktH zkDOlRE)4d1+!D$z%O1vP#Kv3B7Ne9`j1V6-diVz881OTEjMkd`G4m3CKV=4lEHU=B z|IQef?lVqx^_d>mA~q+K1Z@mzuv2dku z%Bra=xN+r6{S0+(Wnc{%>@Hki1LV-HY^p*vkVy#pVG^7n^z1eN)DgzU^Y@)JKI;00 z`FYKcDPunwHYa+Tv3b@Hm1o_U&HQ`s`;;j+3{&RbSQBF=cRZBPWS!!9{U3DFO4 z=zg}Fu!Nqm+i7@W+nH?}4(lvOM1>D~A|Zj-1R)|2ma9?JIziGTw$#Cj9H9y4L?6vogohEMFzCc8<7McfjEYX%0Kr$Vg$u;o${|5SUmS(*@q{CVT(gO>j!VQig zCG1cSAq?Hi&^T|yqlDQ-7)-Kxjw2kyE+1R6zYvTb1Tmn#cigQj@u) z*0j37asc*~n&irGJO#%doOy8IC0lTk12Ly@YC4&Q^D(}1o)qScSv( z>SNI;RURGa$LSe&gEY{eVR<&w+t=FKmt|$i={~2QvwJ$~)`!CzL}8?T<63-)`a@GHKIAx_Bmy~x-Ek>>ly$UUrhbwfwGoQPzenJ zgx*$hg>FV{{ET@497WX+!`IXtyki{FbjW^p6(hmW&uD`&~2E6p;h2 z6<%}zKa8KmFH%F)9Q85jCMU@|bTj<~{WjxgtJzL2$Sv5swx8K)`+EC6hu`Vq^ZaY2 z6{TBB50-5&J686KvWr4o42omoE8+*`{_@w#3sSQy<@$l^g4`!RE&p4|R(LD6xWiTR zRZG>Eyia;Rt%(fRvbA|%weKhX1^1U45r4g6%0GmzijB4SWt`>xdSE8#T|nO_D?tDCl4M$JJ29HfcB$l)L{H~ dcO>!EDwKy)@gO?#)mo!_k4O1Gs$+Ym{|Bs4FyH_H delta 2244 zcmaJ?eQZXNChAOF|N|P&PtLAS^KiCP(5hi;S1QaMs6>p8Xlko=QdwV1K;n1n z`e9nz=4f>4cUq$bAw92AGg~bj=0|+4Ep_Xhr{lO z`2%mP`w;6-dd}m{Ecz4Pj2Tp3ii0>DipJ8o39^f|M4^;$NPxN|kGB#79TLLu9d=a% zA;YU+73}8J7R(A>ciA`LJd90acG9bGpq}@7352oVdNYRkiD`c2jT@#SHw4mnBZg&+ z#T#+5B?Zf?&1*}t5xI%0!}>*efWt`tth|G;FN3>SwP#qrsx07g3qmUk6v0UlRH}Ct6vq{aT!5%aNtX@j2DH_5c}K~otDBL!Pp6y7j~jKrO8GOs}~>^PO2H4gcpEO zkCuXpWN~eaRFc2r-l3{}&b#X~nf2VA+E%iuc-R}Pa(jcpWAhY~`8heO*0joMIGd=A zMz{EUWx4+TT#4-45{uR)vSHOPe5)qaFVC?TWB!I>ds-;9+U(YJL(=C~tEwC&jg^%V zAZ=D4BbAknB_%Z#EwU%sfb@0zBxZl3E&AIrAJLzvhhw-zx9is$MlI~`mh<|5(m5_* zMRa9xbz_gBJeow$p>yb0=vDMO(wU`a>ogpxCVB+82dWIapz?|4CU_&8aVyrEQ^}U- z1}wv-z+H%Fav7GBF^v}^5{@Kgh*J~I8*!ppZAzq)n#%}5 zASe8=Wl`2-S1opF*rmF##+@$A@40c|>(j;41-#*O@$~{(DBRdHe*qgzajB?qe%xQs z7q|bCvKKioeuG`--eP0qJX;~N`u4}JQ2k&1%N%P8zQ;ZluItul9P2}+Z({u)**45R zbnjwUyL(x;l4Wnle$2-07uki#gx*>Q7p*CFPCwh$j`hOUF|13edt4YpD+URqH@SXL zmiZFdq5s44(KFYpA8OV+xP4>6;6e6-5EDNGx*gYU(OeBS!aX)pZXoQya4x z+^lKuXW6}#P1LlEbsmZfaJOlfm|6mT3Z$Q1+Z&ix0U2369P$6O5og4IGsdV9*`RqT z=x69Qrnty8axal6IYT{kj8BLO%Tt!ymIu~)o5QxtcE)zy_Gf$AQSUh6xa_!J(o^#6 zp;AZbd!?V0`JF!JnDbSa#Z~V*<=*Z7sWdFTBHi}hkv}MZzWgiyLH}Z)H!xdKUvar& zLD^SHtGMc(>Ni7=h3Zhta&z~M3$p3MBjz-m$ z`!-BlAz9^TtSDn*3i#(H=HcHxU}6FI0TbJx%g#Z^#?%VTI`FJv4wa&x zn3w?HVPXpSoPkvsz(Ws?nhpUR!zQ+&7IbTTWbE;&L-`XEXdI28G4wc^V*7?_8y~@= XL(texpovGg*v+A!`%(O7LsS0+MMTzC From 1b2f8515257531ea048095d5e678c3d64f08879e Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 4 Mar 2019 20:00:12 +0100 Subject: [PATCH 47/60] #1191 item not available icon added --- modules/item/front/descriptor/index.html | 7 +++++++ modules/item/front/descriptor/locale/es.yml | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index d0c89e9e1..c139ad3d9 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -57,6 +57,13 @@ value="{{tag.value}}">
+
+ + +