diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index 172d9305e..75e06dabf 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -15,19 +15,25 @@ vn-focus label="Social name" field="$ctrl.client.socialName" - vn-acl="administrative"> + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > @@ -35,13 +41,17 @@ vn-two label="Street" field="$ctrl.client.street" - vn-acl="administrative"> + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > @@ -49,7 +59,9 @@ vn-one label="Postcode" field="$ctrl.client.postcode" - vn-acl="administrative"> + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > @@ -77,21 +93,26 @@ + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative" + > @@ -100,28 +121,34 @@ + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > + vn-acl="administrative, salesPerson" + acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}" + > - + this.checkEtChanges()); diff --git a/client/core/src/directives/acl.js b/client/core/src/directives/acl.js index 6daf5a333..c32b02830 100644 --- a/client/core/src/directives/acl.js +++ b/client/core/src/directives/acl.js @@ -1,6 +1,8 @@ import ngModule from '../module'; function vnAcl(aclService, $timeout) { + let acls = []; + function getMaterialType(className) { let type = ''; if (className) { @@ -20,32 +22,78 @@ function vnAcl(aclService, $timeout) { } } } + function getDynamicConditions($attrs) { + let atributes = $attrs.$attr; + let conditions = {}; + + Object.keys(atributes).forEach(atribute => { + if (atribute.startsWith('aclConditionalTo')) { + let role = atributes[atribute].split('-').slice(-1)[0]; + conditions[atribute] = { + role: role + }; + } + }); + return conditions; + } + + function permissionElement($element, action) { + if (!aclService.aclPermission(acls)) { + if (action === 'disabled') { + let input = $element[0]; + let selector = 'input, textarea, button, submit'; + + if (!input.matches(selector)) + input = input.querySelector(selector); + + if (input) { + $timeout(() => { + input.setAttribute("disabled", "true"); + updateMaterial(input); + }); + $element[0].querySelectorAll('i, vn-drop-down').forEach(element => { + element.parentNode.removeChild(element); + }); + } + } else { + $element.remove(); + } + } + } + + function updateAcls(role, toAdd) { + let position = acls.indexOf(role); + + if (!toAdd && position > -1) { + acls.splice(position, 1); + } // todo: add acl and enabled element if previusly was disabled + } + return { restrict: 'A', priority: -1, link: function($scope, $element, $attrs) { - let acls = $attrs.vnAcl.split(','); + acls = $attrs.vnAcl.split(',').map(element => element.trim().toLowerCase()); let action = $attrs.vnAclAction || 'disabled'; - if (!aclService.aclPermission(acls)) { - if (action === 'disabled') { - let input = $element[0]; - let selector = 'input, textarea, button, submit'; + let conditions = getDynamicConditions($attrs); + permissionElement($element, action); - if (!input.matches(selector)) - input = input.querySelector(selector); + if (Object.keys(conditions).length) { + let watchConditions = $scope.$watch(() => { + Object.keys(conditions).forEach(attrName => { + let hasPermission = $scope.$eval($attrs[attrName]); + if (!hasPermission) { + updateAcls(conditions[attrName].role, hasPermission); + permissionElement($element, action); + delete conditions[attrName]; + } + }); - if (input) { - $timeout(() => { - input.setAttribute("disabled", "true"); - updateMaterial(input); - }); - $element[0].querySelectorAll('i, vn-drop-down').forEach(element => { - element.parentNode.removeChild(element); - }); + if (Object.keys(conditions).length === 0) { + // unWacth + watchConditions(); } - } else { - $element.remove(); - } + }); } } }; diff --git a/client/core/src/lib/acl-service.js b/client/core/src/lib/acl-service.js index ac2a11bc3..ae4c865bf 100644 --- a/client/core/src/lib/acl-service.js +++ b/client/core/src/lib/acl-service.js @@ -5,7 +5,14 @@ ngModule.constant('aclConstant', acl); aclService.$inject = ['aclConstant']; function aclService(aclConstant) { - this.roles = aclConstant.roles || undefined; + if (aclConstant.roles) { + this.roles = {}; + Object.keys(aclConstant.roles).forEach(role => { + this.roles[role.toLowerCase()] = aclConstant.roles[role]; + }); + } else { + this.roles = undefined; + } this.routeHasPermission = function(route) { let hasPermission; @@ -23,7 +30,8 @@ function aclService(aclConstant) { let hasPermission = false; let total = aclCollection.length; for (let i = 0; i < total; i++) { - if (this.roles[aclCollection[i]]) { + let role = aclCollection[i].trim().toLowerCase(); + if (this.roles[role]) { hasPermission = true; break; } diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ee90c48d3..94a730df4 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -245,7 +245,7 @@ export default { }, itemSummary: { basicData: `${components.vnItemSummary} > vn-horizontal:nth-child(1) > vn-one:nth-child(2) > vn-vertical > p:nth-child(2)`, - tags: `${components.vnItemSummary} > vn-horizontal:nth-child(1) > vn-one:nth-child(3) > vn-vertical > p:nth-child(2)`, + tags: `${components.vnItemSummary} > vn-horizontal:nth-child(1) > vn-one:nth-child(3) > vn-vertical > p`, niche: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-vertical > p:nth-child(2)`, botanical: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(2) > vn-vertical > p`, barcode: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(3) > vn-vertical > p` diff --git a/e2e/paths/item-module/01_item_summary.spec.js b/e2e/paths/item-module/01_item_summary.spec.js index 3e95f468f..2b87ab0c1 100644 --- a/e2e/paths/item-module/01_item_summary.spec.js +++ b/e2e/paths/item-module/01_item_summary.spec.js @@ -51,7 +51,7 @@ describe('Item summary path', () => { it(`should check the item summary preview shows fields from tags`, () => { return nightmare - .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') + .wait(200) .getInnerText(selectors.itemSummary.tags) .then(result => { expect(result).toContain('Color: Yellow'); diff --git a/e2e/paths/item-module/08_item_create_and_clone.spec.js b/e2e/paths/item-module/08_item_create_and_clone.spec.js index 0275a3f64..66c3d79b0 100644 --- a/e2e/paths/item-module/08_item_create_and_clone.spec.js +++ b/e2e/paths/item-module/08_item_create_and_clone.spec.js @@ -85,13 +85,14 @@ describe('Item', () => { }); describe('clone path', () => { - it('should access to the items index by clicking the items button', () => { + it('should return to the items index by clicking the return to items button', () => { return nightmare .click(selectors.itemBasicData.goToItemIndexButton) .wait(selectors.itemsIndex.createItemButton) + .waitForURL('#!/item/list') .parsedUrl() .then(url => { - expect(url.hash).toEqual('#!/item/list'); + expect(url.hash).toContain('#!/item/list'); }); }); diff --git a/services/client/common/models/invoice-out.json b/services/client/common/models/invoice-out.json new file mode 100644 index 000000000..704901b08 --- /dev/null +++ b/services/client/common/models/invoice-out.json @@ -0,0 +1,55 @@ +{ + "name": "InvoiceOut", + "base": "VnModel", + "options": { + "mysql": { + "table": "invoiceOut" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "ref": { + "id": true, + "type": "String", + "required": true + }, + "serial": { + "type": "String" + }, + "issued": { + "type": "date" + }, + "amount": { + "type": "Number" + }, + "created": { + "type": "date" + }, + "dued": { + "type": "date" + }, + "booked": { + "type": "date" + }, + "pdf": { + "type": "Number" + } + }, + "relations": { + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + }, + "company": { + "type": "belongsTo", + "model": "Company", + "foreignKey": "companyFk", + "required": true + } + } + } \ No newline at end of file diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 9eecb7263..95c2e3253 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -28,5 +28,8 @@ }, "Recovery": { "dataSource": "vn" + }, + "InvoiceOut": { + "dataSource": "vn" } } diff --git a/services/db/02-dumpedFixtures.sql b/services/db/02-dumpedFixtures.sql index 8043e29c8..6b8f43c09 100644 --- a/services/db/02-dumpedFixtures.sql +++ b/services/db/02-dumpedFixtures.sql @@ -1,4 +1,4 @@ -USE `account`; +USE `account`; -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: db.verdnatura.es Database: account @@ -22,7 +22,7 @@ USE `account`; LOCK TABLES `role` WRITE; /*!40000 ALTER TABLE `role` DISABLE KEYS */; -INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',0,'2018-02-16 14:07:10','2018-02-23 13:30:32'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'); +INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyBoss','Jefe/a del departamento de agencias',1,'2018-01-29 16:44:39','2018-02-23 07:58:53'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42'),(36,'replenisher','Trabajadores de camara',0,'2018-02-16 14:07:10','2018-02-23 13:30:32'),(37,'hr','Gestor/a de recursos humanos',1,'2018-02-22 17:34:53','2018-02-22 17:34:53'),(38,'hrBoss','Jefe/a de recursos humanos',1,'2018-02-22 17:35:09','2018-02-22 17:35:09'),(39,'adminAssistant','Jefe auxiliar administrativo',1,'2018-02-23 10:37:36','2018-02-23 10:38:41'),(40,'handmade','Departamento de confección',1,'2018-02-23 11:14:53','2018-02-23 11:39:12'),(41,'handmadeBoss','Jefe de departamento de confección',1,'2018-02-23 11:15:09','2018-02-23 11:39:26'),(42,'artificial','Departamento de artificial',1,'2018-02-23 11:39:59','2018-02-23 11:39:59'),(43,'artificialBoss','Jefe del departamento de artificial',1,'2018-02-23 11:40:16','2018-02-23 11:40:16'),(44,'accessory','Departamento de complementos',1,'2018-02-23 11:41:12','2018-02-23 11:41:12'),(45,'accessoryBoss','Jefe del departamento de complementos',1,'2018-02-23 11:41:23','2018-02-23 11:41:23'),(47,'cooler','Empleados de cámara',1,'2018-02-23 13:08:18','2018-02-23 13:08:18'),(48,'coolerBoss','Jefe del departamento de cámara',1,'2018-02-23 13:12:01','2018-02-23 13:12:01'),(49,'production','Empleado de producción',1,'2018-02-26 15:28:23','2018-02-26 15:28:23'),(50,'productionBoss','Jefe de producción',1,'2018-02-26 15:34:12','2018-02-26 15:34:12'); /*!40000 ALTER TABLE `role` ENABLE KEYS */; UNLOCK TABLES; @@ -32,7 +32,7 @@ UNLOCK TABLES; LOCK TABLES `roleRole` WRITE; /*!40000 ALTER TABLE `roleRole` DISABLE KEYS */; -INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,19),(5,21),(5,33),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,15),(15,35),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,37),(17,39),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,20),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,19),(39,21),(39,33),(39,39),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48); +INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,19),(5,21),(5,33),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,15),(15,35),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,37),(17,39),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,20),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,19),(39,21),(39,33),(39,39),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50); /*!40000 ALTER TABLE `roleRole` ENABLE KEYS */; UNLOCK TABLES; @@ -42,7 +42,7 @@ UNLOCK TABLES; LOCK TABLES `roleInherit` WRITE; /*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */; -INSERT INTO `roleInherit` VALUES (9,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(1,2),(1,3),(30,5),(39,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(16,15),(21,18),(5,19),(17,20),(30,20),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(17,37),(38,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47); +INSERT INTO `roleInherit` VALUES (9,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(1,2),(1,3),(30,5),(39,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(16,15),(21,18),(5,19),(17,20),(30,20),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(49,36),(17,37),(38,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49); /*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -55,7 +55,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-02-26 14:07:27 +-- Dump completed on 2018-02-28 15:45:02 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- @@ -93,4 +93,62 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2018-02-26 14:07:27 +-- Dump completed on 2018-02-28 15:45:02 +USE `vn`; +-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) +-- +-- Host: db.verdnatura.es Database: vn +-- ------------------------------------------------------ +-- Server version 5.6.25-4-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Dumping data for table `cplusInvoiceType477` +-- + +LOCK TABLES `cplusInvoiceType477` WRITE; +/*!40000 ALTER TABLE `cplusInvoiceType477` DISABLE KEYS */; +INSERT INTO `cplusInvoiceType477` VALUES (1,'F1 - Factura'),(2,'F2 - Factura simplificada (ticket)'),(3,'F3 - Factura emitida en sustitución de facturas simplificadas facturadas y declaradas'),(4,'F4 - Asiento resumen de facturas'),(5,'R1 - Factura rectificativa (Art. 80.1, 80.2 y error fundado en derecho)'),(6,'R2 - Factura rectificativa (Art. 80.3)'),(7,'R3 - Factura rectificativa (Art. 80.4)'),(8,'R4 - Factura rectificativa (Resto)'),(9,'R5 - Factura rectificativa en facturas simplificadas'); +/*!40000 ALTER TABLE `cplusInvoiceType477` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `cplusSubjectOp` +-- + +LOCK TABLES `cplusSubjectOp` WRITE; +/*!40000 ALTER TABLE `cplusSubjectOp` DISABLE KEYS */; +INSERT INTO `cplusSubjectOp` VALUES (1,'Campo vacio'),(2,'S1 – Sujeta – No exenta'),(3,'S2 – Sujeta – No exenta – Inv. Suj. Pasivo'); +/*!40000 ALTER TABLE `cplusSubjectOp` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `cplusTaxBreak` +-- + +LOCK TABLES `cplusTaxBreak` WRITE; +/*!40000 ALTER TABLE `cplusTaxBreak` DISABLE KEYS */; +INSERT INTO `cplusTaxBreak` VALUES (1,'Campo vacio'),(2,'E1 - Exenta por el artículo 20'),(3,'E2 - Exenta por el artículo 21'),(4,'E3 - Exenta por el artículo 22'),(5,'E4 - Exenta por el artículo 24'),(6,'E5 - Exenta por el artículo 25'),(7,'E6 - Exenta por otros'); +/*!40000 ALTER TABLE `cplusTaxBreak` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-02-28 15:45:02 diff --git a/services/db/04-fixtures.sql b/services/db/04-fixtures.sql index a1edf85f5..24f37a0ae 100644 --- a/services/db/04-fixtures.sql +++ b/services/db/04-fixtures.sql @@ -440,4 +440,10 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`) VALUES - ('1', '1', '1', 'insert', 'We made an change!'); \ No newline at end of file + ('1', '1', '1', 'insert', 'We made an change!'); + +INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`) + VALUES + ( 1, 'T1111111' , 'T', 500 , 1, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1), + ( 2, 'V2222222' , 'V', 350.50 , 2, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1), + ( 3, 'E3333333' , 'E', 90.30 , 3, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1); \ No newline at end of file diff --git a/services/db/changes/1.0.1/03-invoiceOut.sql b/services/db/changes/1.0.1/03-invoiceOut.sql new file mode 100644 index 000000000..f6eeeb879 --- /dev/null +++ b/services/db/changes/1.0.1/03-invoiceOut.sql @@ -0,0 +1,24 @@ +CREATE OR REPLACE + ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn`.`invoiceOut` AS + SELECT + `f`.`factura_id` AS `id`, + `f`.`Id_Factura` AS `ref`, + `f`.`Serie` AS `serial`, + `f`.`Fecha` AS `issued`, + `f`.`Importe` AS `amount`, + `f`.`Id_Cliente` AS `clientFk`, + `f`.`odbc_date` AS `created`, + `f`.`empresa_id` AS `companyFk`, + `f`.`Vencimiento` AS `dued`, + `f`.`booked` AS `booked`, + `f`.`Id_Banco` AS `bankFk`, + `f`.`cplusInvoiceType477Fk` AS `cplusInvoiceType477Fk`, + `f`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`, + `f`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`, + `f`.`cplusTrascendency477Fk` AS `cplusTrascendency477Fk`, + `f`.`pdf` AS `pdf` + FROM + `vn2008`.`Facturas` `f` \ No newline at end of file