diff --git a/db/changes/10270-wiseMan/00-ACL.sql b/db/changes/10270-wiseMan/00-ACL.sql deleted file mode 100644 index 3d3f0d013f..0000000000 --- a/db/changes/10270-wiseMan/00-ACL.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SupplierAccount', '*', '*', 'ALLOW', 'ROLE', 'administrative'); \ No newline at end of file diff --git a/modules/supplier/back/models/supplier-account.json b/modules/supplier/back/models/supplier-account.json deleted file mode 100644 index 1d989cbfbb..0000000000 --- a/modules/supplier/back/models/supplier-account.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "SupplierAccount", - "base": "Loggable", - "log": { - "model":"SupplierLog", - "relation": "supplier" - }, - "options": { - "mysql": { - "table": "supplierAccount" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "supplierFk": { - "type": "Number" - }, - "iban": { - "type": "String" - }, - "office": { - "type": "String" - }, - "DC": { - "type": "String" - }, - "number": { - "type": "String" - }, - "description": { - "type": "String" - }, - "bicSufix": { - "type": "String" - }, - "bankEntityFk": { - "type": "Number" - }, - "bankFk": { - "type": "Number" - } - }, - "relations": { - "supplier": { - "type": "belongsTo", - "model": "Supplier", - "foreignKey": "supplierFk" - }, - "bankEntity": { - "type": "belongsTo", - "model": "BankEntity", - "foreignKey": "bankEntityFk" - } - } -} \ No newline at end of file diff --git a/modules/supplier/front/account/index.html b/modules/supplier/front/account/index.html deleted file mode 100644 index 5a9addeea4..0000000000 --- a/modules/supplier/front/account/index.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - \ No newline at end of file diff --git a/modules/supplier/front/account/index.js b/modules/supplier/front/account/index.js deleted file mode 100644 index 069601a207..0000000000 --- a/modules/supplier/front/account/index.js +++ /dev/null @@ -1,49 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.include = { - relation: 'bankEntity', - scope: { - fields: ['countryFk', 'id', 'name', 'bic'] - } - }; - } - - add() { - this.$.model.insert({ - supplierFk: this.$params.id - }); - } - - onSubmit() { - this.$.watcher.check(); - this.$.model.save().then(() => { - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - this.card.reload(); - }); - } - - showBankEntity(event) { - if (event.defaultPrevented) return; - event.preventDefault(); - this.$.bankEntity.show(); - } - - onBankEntityAccept() { - const query = `SupplierAccounts/${this.$params.id}/createBankEntity`; - return this.$http.patch(query, this.newBankEntity) - .then(res => this.supplierAccount.bankEntityFk = res.data.id); - } -} - -ngModule.vnComponent('vnSupplierAccount', { - template: require('./index.html'), - controller: Controller, - require: { - card: '^vnSupplierCard' - } -}); diff --git a/modules/supplier/front/account/index.spec.js b/modules/supplier/front/account/index.spec.js deleted file mode 100644 index 448db07779..0000000000 --- a/modules/supplier/front/account/index.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -import './index.js'; - -describe('Supplier Component vnSupplierAccount', () => { - let $scope; - let $element; - let controller; - let $httpBackend; - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - $scope.bankEntity = { - show: () => {} - }; - $element = angular.element(''); - controller = $componentController('vnSupplierAccount', {$element, $scope}); - controller.supplierAccount = { - supplierFk: 442, - name: 'Verdnatura' - }; - })); - - describe('showBankEntity()', () => { - it('should do nothing if it default is prevented', () => { - const event = { - defaultPrevented: true, - preventDefault: () => {} - }; - jest.spyOn(event, 'preventDefault'); - jest.spyOn(controller.$.bankEntity, 'show'); - - controller.showBankEntity(event); - - expect(event.preventDefault).not.toHaveBeenCalledWith(); - expect(controller.$.bankEntity.show).not.toHaveBeenCalledWith(); - }); - - it('should call preventDefault() and show() when the default is not prevented', () => { - const event = { - defaultPrevented: false, - preventDefault: () => {} - }; - jest.spyOn(event, 'preventDefault'); - jest.spyOn(controller.$.bankEntity, 'show'); - - controller.showBankEntity(event); - - expect(event.preventDefault).toHaveBeenCalledWith(); - expect(controller.$.bankEntity.show).toHaveBeenCalledWith(); - }); - - it('should request to create a new bank entity', () => { - controller.bankEntity = { - name: 'My new bank entity', - bic: 'ES1234', - countryFk: 1, - id: 2200 - }; - $httpBackend.expectPATCH(`SupplierAccounts/${controller.$.bankEntity.id}/createBankEntity`).respond({id: 2200}); - controller.onBankEntityAccept(); - $httpBackend.flush(); - - expect(controller.supplierAccount.bankEntityFk).toEqual(controller.bankEntity.id); - }); - }); -}); - diff --git a/modules/supplier/front/account/locale/es.yml b/modules/supplier/front/account/locale/es.yml deleted file mode 100644 index 7443ad4e35..0000000000 --- a/modules/supplier/front/account/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Bank entity: Entidad bancaria -swift: Swift BIC \ No newline at end of file diff --git a/modules/supplier/front/bankentity/index.html b/modules/supplier/front/bankentity/index.html deleted file mode 100644 index 74a302d069..0000000000 --- a/modules/supplier/front/bankentity/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - -

Please, ensure you put the correct data!

- - - - - - - - - - -
- - - - -
diff --git a/modules/supplier/front/bankentity/index.js b/modules/supplier/front/bankentity/index.js deleted file mode 100644 index 975b186efb..0000000000 --- a/modules/supplier/front/bankentity/index.js +++ /dev/null @@ -1,40 +0,0 @@ -import ngModule from '../module'; -import Component from 'core/lib/component'; -import './style.scss'; - -class Controller extends Component { - open() { - this.$.bankEntityDialog.show(); - } - resetLocation() { - this.location = {}; - } - - onCountryResponse(response) { - this.location.countryFk = response.id; - } - - onAccept() { - try { - if (!this.location.countryFk) - throw new Error(`The country can't be empty`); - - this.$http.post(`Bankentities`, this.location).then(() => { - this.vnApp.showMessage(this.$t('The bank entity has been created. You can save the data now')); - this.emit('response', {$response: this.location}); - }); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - return false; - } - return true; - } -} - -ngModule.vnComponent('vnNewBankEntity', { - template: require('./index.html'), - controller: Controller, - bindings: { - data: '<', - } -}); diff --git a/modules/supplier/front/bankentity/index.spec.js b/modules/supplier/front/bankentity/index.spec.js deleted file mode 100644 index 84273ded80..0000000000 --- a/modules/supplier/front/bankentity/index.spec.js +++ /dev/null @@ -1,53 +0,0 @@ -import './index'; - -describe('Supplier Component vnNewBankEntity', () => { - let controller; - let $httpBackend; - let $scope; - let $element; - let vnApp; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => { - $httpBackend = _$httpBackend_; - vnApp = _vnApp_; - jest.spyOn(vnApp, 'showError'); - $scope = $rootScope.$new(); - $element = angular.element(''); - controller = $componentController('vnNewBankEntity', {$element, $scope}); - })); - - describe('resetLocation()', () => { - it('should reset the location in the controller', () => { - expect(controller.location).toBeUndefined(); - - controller.resetLocation(); - - expect(controller.location).toEqual({}); - }); - }); - - describe('onAccept()', () => { - it('should throw an error if there is no country id in the location', () => { - jest.spyOn(controller.vnApp, 'showMessage'); - - controller.location = {}; - - controller.onAccept(); - - expect(controller.vnApp.showError).toHaveBeenCalledWith(`The country can't be empty`); - }); - - it('should do add the new bank entity', () => { - controller.location = { - countryFk: 1 - }; - - $httpBackend.expectPOST('Bankentities', controller.location).respond(200, controller.location); - - controller.onAccept(); - $httpBackend.flush(); - }); - }); -}); diff --git a/modules/supplier/front/bankentity/locale/es.yml b/modules/supplier/front/bankentity/locale/es.yml deleted file mode 100644 index 782690e885..0000000000 --- a/modules/supplier/front/bankentity/locale/es.yml +++ /dev/null @@ -1,11 +0,0 @@ -New postcode: Nuevo código postal -New city: Nueva ciudad -New province: Nueva provincia -Please, ensure you put the correct data!: ¡Por favor, asegúrate de poner los datos correctos! -The postcode can't be empty: El código postal no puede quedar vacío -The town can't be empty: La población no puede quedar vacía -The province can't be empty: La provincia no puede quedar vacía -The country can't be empty: El país no puede quedar vacío -The postcode has been created. You can save the data now: Se ha creado el código postal. Ahora puedes guardar los datos -The city has been created: Se ha creado la ciudad -The province has been created: Se ha creado la provincia \ No newline at end of file diff --git a/modules/supplier/front/bankentity/style.scss b/modules/supplier/front/bankentity/style.scss deleted file mode 100644 index 1171366da2..0000000000 --- a/modules/supplier/front/bankentity/style.scss +++ /dev/null @@ -1,9 +0,0 @@ -@import "variables"; - -vn-new-bank-entity { - vn-dialog { - p { - color: $color-alert - } - } -} \ No newline at end of file diff --git a/modules/supplier/front/index.js b/modules/supplier/front/index.js index f24fb997ef..9a9334c416 100644 --- a/modules/supplier/front/index.js +++ b/modules/supplier/front/index.js @@ -8,8 +8,6 @@ import './search-panel'; import './summary'; import './basic-data'; import './fiscal-data'; -import './bankentity'; -import './account'; import './contact'; import './log'; import './consumption'; diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index cf2ec32647..73ff28246a 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -9,7 +9,6 @@ {"state": "supplier.index", "icon": "icon-supplier"} ], "card": [ - {"state": "supplier.card.account", "icon": "face"}, {"state": "supplier.card.basicData", "icon": "settings"}, {"state": "supplier.card.fiscalData", "icon": "account_balance"}, {"state": "supplier.card.billingData", "icon": "icon-payment"}, @@ -100,15 +99,6 @@ "supplier": "$ctrl.supplier" }, "acl": ["administrative"] - },{ - "url": "/account", - "state": "supplier.card.account", - "component": "vn-supplier-account", - "description": "Account", - "params": { - "supplier": "$ctrl.supplier" - }, - "acl": ["administrative"] } ] } \ No newline at end of file