From 2d3311b824ea299b9cef4cbfad161c5125f8c12c Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 18 Jun 2024 13:44:39 +0200 Subject: [PATCH 01/41] refs #6898 fix supplier remove --- .../01_summary_and_descriptor.spec.js | 79 ------ e2e/paths/13-supplier/02_basic_data.spec.js | 67 ----- e2e/paths/13-supplier/03_fiscal_data.spec.js | 56 ----- e2e/paths/13-supplier/04_billing_data.spec.js | 52 ---- e2e/paths/13-supplier/05_address.spec.js | 79 ------ e2e/paths/13-supplier/06_contact.spec.js | 89 ------- modules/supplier/front/account/index.html | 86 ------- modules/supplier/front/account/index.js | 66 ----- modules/supplier/front/account/index.spec.js | 98 -------- modules/supplier/front/account/locale/en.yml | 1 - modules/supplier/front/account/locale/es.yml | 6 - .../supplier/front/address/create/index.html | 109 -------- .../supplier/front/address/create/index.js | 74 ------ .../front/address/create/index.spec.js | 102 -------- .../supplier/front/address/edit/index.html | 104 -------- modules/supplier/front/address/edit/index.js | 62 ----- .../supplier/front/address/edit/index.spec.js | 39 --- .../supplier/front/address/index/index.html | 64 ----- modules/supplier/front/address/index/index.js | 46 ---- .../front/address/index/index.spec.js | 34 --- .../supplier/front/address/index/style.scss | 21 -- modules/supplier/front/address/locale/es.yml | 18 -- .../front/agency-term/create/index.html | 77 ------ .../front/agency-term/create/index.js | 26 -- .../front/agency-term/create/index.spec.js | 28 --- .../front/agency-term/index/index.html | 91 ------- .../supplier/front/agency-term/index/index.js | 36 --- .../front/agency-term/index/index.spec.js | 37 --- .../supplier/front/agency-term/locale/es.yml | 9 - modules/supplier/front/basic-data/index.html | 62 ----- modules/supplier/front/basic-data/index.js | 10 - .../supplier/front/basic-data/locale/es.yml | 5 - .../supplier/front/billing-data/index.html | 66 ----- modules/supplier/front/billing-data/index.js | 28 --- .../supplier/front/billing-data/locale/es.yml | 1 - modules/supplier/front/card/index.html | 5 - modules/supplier/front/card/index.js | 48 ---- .../front/consumption-search-panel/index.html | 67 ----- .../front/consumption-search-panel/index.js | 7 - .../consumption-search-panel/locale/es.yml | 7 - modules/supplier/front/consumption/index.html | 97 ------- modules/supplier/front/consumption/index.js | 88 ------- .../supplier/front/consumption/index.spec.js | 110 -------- .../supplier/front/consumption/locale/es.yml | 2 - modules/supplier/front/contact/index.html | 84 ------- modules/supplier/front/contact/index.js | 27 -- modules/supplier/front/contact/style.scss | 10 - modules/supplier/front/create/index.html | 30 --- modules/supplier/front/create/index.js | 23 -- .../front/descriptor-popover/index.html | 3 - .../front/descriptor-popover/index.js | 9 - modules/supplier/front/descriptor/index.html | 66 ----- modules/supplier/front/descriptor/index.js | 80 ------ .../supplier/front/descriptor/index.spec.js | 65 ----- .../supplier/front/descriptor/locale/es.yml | 8 - modules/supplier/front/fiscal-data/index.html | 237 ------------------ modules/supplier/front/fiscal-data/index.js | 86 ------- .../supplier/front/fiscal-data/index.spec.js | 109 -------- .../supplier/front/fiscal-data/locale/es.yml | 8 - modules/supplier/front/index.js | 20 -- modules/supplier/front/index/index.html | 64 ----- modules/supplier/front/index/index.js | 18 -- modules/supplier/front/index/locale/es.yml | 6 - modules/supplier/front/log/index.html | 1 - modules/supplier/front/log/index.js | 7 - modules/supplier/front/main/index.html | 17 -- modules/supplier/front/main/index.js | 10 +- modules/supplier/front/routes.json | 142 +---------- .../supplier/front/search-panel/index.html | 46 ---- modules/supplier/front/search-panel/index.js | 7 - .../supplier/front/search-panel/locale/es.yml | 4 - modules/supplier/front/summary/index.html | 172 ------------- modules/supplier/front/summary/index.js | 30 --- modules/supplier/front/summary/index.spec.js | 32 --- modules/supplier/front/summary/locale/es.yml | 12 - modules/supplier/front/summary/style.scss | 7 - 76 files changed, 10 insertions(+), 3689 deletions(-) delete mode 100644 e2e/paths/13-supplier/01_summary_and_descriptor.spec.js delete mode 100644 e2e/paths/13-supplier/02_basic_data.spec.js delete mode 100644 e2e/paths/13-supplier/03_fiscal_data.spec.js delete mode 100644 e2e/paths/13-supplier/04_billing_data.spec.js delete mode 100644 e2e/paths/13-supplier/05_address.spec.js delete mode 100644 e2e/paths/13-supplier/06_contact.spec.js delete mode 100644 modules/supplier/front/account/index.html delete mode 100644 modules/supplier/front/account/index.js delete mode 100644 modules/supplier/front/account/index.spec.js delete mode 100644 modules/supplier/front/account/locale/en.yml delete mode 100644 modules/supplier/front/account/locale/es.yml delete mode 100644 modules/supplier/front/address/create/index.html delete mode 100644 modules/supplier/front/address/create/index.js delete mode 100644 modules/supplier/front/address/create/index.spec.js delete mode 100644 modules/supplier/front/address/edit/index.html delete mode 100644 modules/supplier/front/address/edit/index.js delete mode 100644 modules/supplier/front/address/edit/index.spec.js delete mode 100644 modules/supplier/front/address/index/index.html delete mode 100644 modules/supplier/front/address/index/index.js delete mode 100644 modules/supplier/front/address/index/index.spec.js delete mode 100644 modules/supplier/front/address/index/style.scss delete mode 100644 modules/supplier/front/address/locale/es.yml delete mode 100644 modules/supplier/front/agency-term/create/index.html delete mode 100644 modules/supplier/front/agency-term/create/index.js delete mode 100644 modules/supplier/front/agency-term/create/index.spec.js delete mode 100644 modules/supplier/front/agency-term/index/index.html delete mode 100644 modules/supplier/front/agency-term/index/index.js delete mode 100644 modules/supplier/front/agency-term/index/index.spec.js delete mode 100644 modules/supplier/front/agency-term/locale/es.yml delete mode 100644 modules/supplier/front/basic-data/index.html delete mode 100644 modules/supplier/front/basic-data/index.js delete mode 100644 modules/supplier/front/basic-data/locale/es.yml delete mode 100644 modules/supplier/front/billing-data/index.html delete mode 100644 modules/supplier/front/billing-data/index.js delete mode 100644 modules/supplier/front/billing-data/locale/es.yml delete mode 100644 modules/supplier/front/card/index.html delete mode 100644 modules/supplier/front/card/index.js delete mode 100644 modules/supplier/front/consumption-search-panel/index.html delete mode 100644 modules/supplier/front/consumption-search-panel/index.js delete mode 100644 modules/supplier/front/consumption-search-panel/locale/es.yml delete mode 100644 modules/supplier/front/consumption/index.html delete mode 100644 modules/supplier/front/consumption/index.js delete mode 100644 modules/supplier/front/consumption/index.spec.js delete mode 100644 modules/supplier/front/consumption/locale/es.yml delete mode 100644 modules/supplier/front/contact/index.html delete mode 100644 modules/supplier/front/contact/index.js delete mode 100644 modules/supplier/front/contact/style.scss delete mode 100644 modules/supplier/front/create/index.html delete mode 100644 modules/supplier/front/create/index.js delete mode 100644 modules/supplier/front/descriptor-popover/index.html delete mode 100644 modules/supplier/front/descriptor-popover/index.js delete mode 100644 modules/supplier/front/descriptor/index.html delete mode 100644 modules/supplier/front/descriptor/index.js delete mode 100644 modules/supplier/front/descriptor/index.spec.js delete mode 100644 modules/supplier/front/descriptor/locale/es.yml delete mode 100644 modules/supplier/front/fiscal-data/index.html delete mode 100644 modules/supplier/front/fiscal-data/index.js delete mode 100644 modules/supplier/front/fiscal-data/index.spec.js delete mode 100644 modules/supplier/front/fiscal-data/locale/es.yml delete mode 100644 modules/supplier/front/index/index.html delete mode 100644 modules/supplier/front/index/index.js delete mode 100644 modules/supplier/front/index/locale/es.yml delete mode 100644 modules/supplier/front/log/index.html delete mode 100644 modules/supplier/front/log/index.js delete mode 100644 modules/supplier/front/search-panel/index.html delete mode 100644 modules/supplier/front/search-panel/index.js delete mode 100644 modules/supplier/front/search-panel/locale/es.yml delete mode 100644 modules/supplier/front/summary/index.html delete mode 100644 modules/supplier/front/summary/index.js delete mode 100644 modules/supplier/front/summary/index.spec.js delete mode 100644 modules/supplier/front/summary/locale/es.yml delete mode 100644 modules/supplier/front/summary/style.scss diff --git a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js b/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js deleted file mode 100644 index a2e194e42..000000000 --- a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js +++ /dev/null @@ -1,79 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Supplier summary & descriptor path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('administrative', 'supplier'); - await page.accessToSearchResult('1'); - }); - - afterAll(async() => { - await browser.close(); - }); - - // summary - it('should reach the second entry summary section', async() => { - await page.waitForState('supplier.card.summary'); - }); - - it(`should confirm there's data on the summary header`, async() => { - const result = await page.waitToGetProperty(selectors.supplierSummary.header, 'innerText'); - - expect(result).toContain('PLANTS SL - 1'); - }); - - it(`should confirm there's data on the summary basic data`, async() => { - const result = await page.waitToGetProperty(selectors.supplierSummary.basicDataId, 'innerText'); - - expect(result).toContain('Id 1'); - }); - - it(`should confirm there's data on the summary fiscal address`, async() => { - const result = await page.waitToGetProperty(selectors.supplierSummary.fiscalAddressTaxNumber, 'innerText'); - - expect(result).toContain('Tax number 06089160W'); - }); - - it(`should confirm there's data on the summary fiscal pay method`, async() => { - const result = await page.waitToGetProperty(selectors.supplierSummary.billingDataPayMethod, 'innerText'); - - expect(result).toContain('Pay method PayMethod one'); - }); - - // descriptor - it(`should confirm there's data on the descriptor`, async() => { - const result = await page.waitToGetProperty(selectors.supplierDescriptor.alias, 'innerText'); - - expect(result).toContain('Plants nick'); - }); - - it(`should navigate to the supplier's client summary using the icon client button`, async() => { - await page.waitToClick(selectors.supplierDescriptor.clientButton); - await page.waitForState('client.card.summary'); - }); - - it(`should navigate back to the supplier`, async() => { - await page.waitToClick(selectors.globalItems.homeButton); - await page.waitForState('home'); - await page.selectModule('supplier'); - await page.accessToSearchResult('1'); - await page.waitForState('supplier.card.summary'); - }); - - it(`should navigate back to suppliers but a different one this time`, async() => { - await page.waitToClick(selectors.globalItems.homeButton); - await page.waitForState('home'); - await page.selectModule('supplier'); - await page.accessToSearchResult('2'); - await page.waitForState('supplier.card.summary'); - }); - - it(`should check the client button isn't present since this supplier should not be a client`, async() => { - await page.waitForSelector(selectors.supplierDescriptor.clientButton, {visible: false}); - }); -}); diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js deleted file mode 100644 index 710ebd8df..000000000 --- a/e2e/paths/13-supplier/02_basic_data.spec.js +++ /dev/null @@ -1,67 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Supplier basic data path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('financial', 'supplier'); - await page.accessToSearchResult('1'); - await page.accessToSection('supplier.card.basicData'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should edit the basic data', async() => { - await page.clearInput(selectors.supplierBasicData.alias); - await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL'); - await page.waitToClick(selectors.supplierBasicData.isReal); - await page.waitToClick(selectors.supplierBasicData.isActive); - await page.waitToClick(selectors.supplierBasicData.isPayMethodChecked); - await page.write(selectors.supplierBasicData.notes, 'Some notes'); - - await page.waitToClick(selectors.supplierBasicData.saveButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should reload the section', async() => { - await page.reloadSection('supplier.card.basicData'); - }); - - it('should check the alias was edited', async() => { - const result = await page.waitToGetProperty(selectors.supplierBasicData.alias, 'value'); - - expect(result).toEqual('Plants Nick SL'); - }); - - it('should check the isReal checkbox is now checked', async() => { - const result = await page.checkboxState(selectors.supplierBasicData.isReal); - - expect(result).toBe('checked'); - }); - - it('should check the isActive checkbox is now unchecked', async() => { - const result = await page.checkboxState(selectors.supplierBasicData.isActive); - - expect(result).toBe('unchecked'); - }); - - it('should check the isPayMethodChecked checkbox is now unchecked', async() => { - const result = await page.checkboxState(selectors.supplierBasicData.isPayMethodChecked); - - expect(result).toBe('unchecked'); - }); - - it('should check the notes were edited', async() => { - const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value'); - - expect(result).toEqual('Some notes'); - }); -}); diff --git a/e2e/paths/13-supplier/03_fiscal_data.spec.js b/e2e/paths/13-supplier/03_fiscal_data.spec.js deleted file mode 100644 index ccd9d7809..000000000 --- a/e2e/paths/13-supplier/03_fiscal_data.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -import getBrowser from '../../helpers/puppeteer'; - -describe('Supplier fiscal data path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('administrative', 'supplier'); - await page.accessToSearchResult('2'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should attempt to edit the fiscal data and check data iss saved', async() => { - await page.accessToSection('supplier.card.fiscalData'); - - const form = 'vn-supplier-fiscal-data form'; - const values = { - province: null, - country: null, - postcode: null, - city: 'Valencia', - socialName: 'FARMER KING SL', - taxNumber: '12345678Z', - account: '0123456789', - sageWithholding: 'retencion estimacion objetiva', - sageTaxType: 'operaciones no sujetas' - }; - - const errorMessage = await page.sendForm(form, { - taxNumber: 'Wrong tax number' - }); - const message = await page.sendForm(form, values); - - await page.reloadSection('supplier.card.fiscalData'); - const formValues = await page.fetchForm(form, Object.keys(values)); - - expect(errorMessage.text).toContain('Invalid Tax number'); - expect(message.isSuccess).toBeTrue(); - expect(formValues).toEqual({ - province: 'Province one', - country: 'España', - postcode: '46000', - city: 'Valencia', - socialName: 'FARMER KING SL', - taxNumber: '12345678Z', - account: '0123456789', - sageWithholding: 'RETENCION ESTIMACION OBJETIVA', - sageTaxType: 'Operaciones no sujetas' - }); - }); -}); diff --git a/e2e/paths/13-supplier/04_billing_data.spec.js b/e2e/paths/13-supplier/04_billing_data.spec.js deleted file mode 100644 index d3cb6dcab..000000000 --- a/e2e/paths/13-supplier/04_billing_data.spec.js +++ /dev/null @@ -1,52 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Supplier billing data path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('administrative', 'supplier'); - await page.accessToSearchResult('442'); - await page.accessToSection('supplier.card.billingData'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should edit the billing data', async() => { - await page.autocompleteSearch(selectors.supplierBillingData.payMethod, 'PayMethod with IBAN'); - await page.autocompleteSearch(selectors.supplierBillingData.payDem, '10'); - await page.clearInput(selectors.supplierBillingData.payDay); - await page.write(selectors.supplierBillingData.payDay, '19'); - await page.waitToClick(selectors.supplierBillingData.saveButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should reload the section', async() => { - await page.reloadSection('supplier.card.billingData'); - }); - - it('should check the pay method was edited', async() => { - const result = await page.waitToGetProperty(selectors.supplierBillingData.payMethod, 'value'); - - expect(result).toEqual('PayMethod with IBAN'); - }); - - it('should check the payDem was edited', async() => { - const result = await page.waitToGetProperty(selectors.supplierBillingData.payDem, 'value'); - - expect(result).toEqual('10'); - }); - - it('should check the pay day was edited', async() => { - const result = await page.waitToGetProperty(selectors.supplierBillingData.payDay, 'value'); - - expect(result).toEqual('19'); - }); -}); diff --git a/e2e/paths/13-supplier/05_address.spec.js b/e2e/paths/13-supplier/05_address.spec.js deleted file mode 100644 index 5bccba3ee..000000000 --- a/e2e/paths/13-supplier/05_address.spec.js +++ /dev/null @@ -1,79 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Supplier address path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('employee', 'supplier'); - await page.accessToSearchResult('1'); - await page.accessToSection('supplier.card.address.index'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should count the addresses before creating one', async() => { - const count = await page.countElement(selectors.supplierAddress.anyAddress); - - expect(count).toEqual(2); - }); - - it('should open the new address form by clicking the add button', async() => { - await page.waitToClick(selectors.supplierAddress.newAddress); - await page.waitForState('supplier.card.address.create'); - }); - - it('should create a new address', async() => { - await page.write(selectors.supplierAddress.newNickname, 'Darkest dungeon'); - await page.write(selectors.supplierAddress.newStreet, 'Wayne manor'); - await page.write(selectors.supplierAddress.newPostcode, '46000'); - await page.write(selectors.supplierAddress.newCity, 'Valencia'); - await page.autocompleteSearch(selectors.supplierAddress.newProvince, 'Province one'); - await page.write(selectors.supplierAddress.newPhone, '888888888'); - await page.write(selectors.supplierAddress.newMobile, '444444444'); - await page.waitToClick(selectors.supplierAddress.saveButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should have been redirected to the addresses index', async() => { - await page.waitForState('supplier.card.address.index'); - }); - - it('should count the addresses and find one more now', async() => { - const count = await page.countElement(selectors.supplierAddress.anyAddress); - - expect(count).toEqual(3); - }); - - it('should open the edit address form by clicking the new address', async() => { - await page.waitToClick(selectors.supplierAddress.thirdAddress); - await page.waitForState('supplier.card.address.edit'); - }); - - it('should edit the address', async() => { - await page.overwrite(selectors.supplierAddress.editNickname, 'Wayne manor'); - await page.overwrite(selectors.supplierAddress.editStreet, '1007 Mountain Drive'); - await page.overwrite(selectors.supplierAddress.editPostcode, '46000'); - await page.overwrite(selectors.supplierAddress.editCity, 'Valencia'); - await page.autocompleteSearch(selectors.supplierAddress.editProvince, 'Province one'); - await page.overwrite(selectors.supplierAddress.editPhone, '777777777'); - await page.overwrite(selectors.supplierAddress.editMobile, '555555555'); - await page.waitToClick(selectors.supplierAddress.saveButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should check the address has now the expected data', async() => { - let thirdAddress = await page.waitToGetProperty(selectors.supplierAddress.thirdAddress, 'innerText'); - - expect(thirdAddress).toContain('Wayne manor'); - }); -}); diff --git a/e2e/paths/13-supplier/06_contact.spec.js b/e2e/paths/13-supplier/06_contact.spec.js deleted file mode 100644 index 60fd28f9c..000000000 --- a/e2e/paths/13-supplier/06_contact.spec.js +++ /dev/null @@ -1,89 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Supplier contact path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('administrative', 'supplier'); - await page.accessToSearchResult('1'); - await page.accessToSection('supplier.card.contact'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should create a new contact', async() => { - await page.waitToClick(selectors.supplierContact.addNewContact); - await page.write(selectors.supplierContact.thirdContactName, 'The tester'); - await page.write(selectors.supplierContact.thirdContactPhone, '99 999 99 99'); - await page.write(selectors.supplierContact.thirdContactMobile, '555 55 55 55'); - await page.write(selectors.supplierContact.thirdContactEmail, 'testing@puppeteer.com'); - await page.write(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester'); - await page.waitToClick(selectors.supplierContact.saveButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it(`should reload the section and count the contacts`, async() => { - await page.reloadSection('supplier.card.contact'); - const result = await page.countElement(selectors.supplierContact.anyContact); - - expect(result).toEqual(3); - }); - - it(`should check the new contact name was saved correctly`, async() => { - const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactName, 'value'); - - expect(result).toContain('The tester'); - }); - - it(`should check the new contact phone was saved correctly`, async() => { - const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactPhone, 'value'); - - expect(result).toContain('99 999 99 99'); - }); - - it(`should check the new contact mobile was saved correctly`, async() => { - const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactMobile, 'value'); - - expect(result).toContain('555 55 55 55'); - }); - - it(`should check the new contact email was saved correctly`, async() => { - const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactEmail, 'value'); - - expect(result).toContain('testing@puppeteer.com'); - }); - - it(`should check the new contact note was saved correctly`, async() => { - await page.waitForTextInField(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester'); - const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value'); - - expect(result).toContain('the end to end integration tester'); - }); - - it(`should remove the created contact`, async() => { - await page.waitToClick(selectors.supplierContact.thirdContactDeleteButton, 'value'); - const result = await page.countElement(selectors.supplierContact.anyContact); - - expect(result).toEqual(2); - - await page.waitToClick(selectors.supplierContact.saveButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it(`should reload the section and count the amount of contacts went back to 2`, async() => { - await page.reloadSection('supplier.card.contact'); - const result = await page.countElement(selectors.supplierContact.anyContact); - - expect(result).toEqual(2); - }); -}); diff --git a/modules/supplier/front/account/index.html b/modules/supplier/front/account/index.html deleted file mode 100644 index a0b58c737..000000000 --- a/modules/supplier/front/account/index.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -
- - - - - - {{bic}} {{name}} - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - \ 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 5629e65d3..000000000 --- a/modules/supplier/front/account/index.js +++ /dev/null @@ -1,66 +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'] - } - }; - const filter = { - where: {code: 'wireTransfer'} - }; - - this.$http.get(`payMethods/findOne`, {filter}) - .then(res => { - this.wireTransferFk = res.data.id; - }); - } - - add() { - this.$.model.insert({ - supplierFk: this.$params.id - }); - } - - onAccept(data) { - const accounts = this.supplierAccounts; - const targetAccount = accounts[data.index]; - targetAccount.bankEntityFk = data.id; - } - - onSubmit() { - this.$.watcher.check(); - return this.$.model.save() - .then(() => { - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - return this.card.reload(); - }) - .then(() => { - if (this.supplier.payMethodFk != this.wireTransferFk) - this.$.payMethodToTransfer.show(); - }); - } - - setWireTransfer() { - const params = { - id: this.$params.id, - payMethodFk: this.wireTransferFk - }; - const query = `Suppliers/${this.$params.id}`; - return this.$http.patch(query, params) - .then(() => this.$.watcher.notifySaved()); - } -} - -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 ad29d1abc..000000000 --- a/modules/supplier/front/account/index.spec.js +++ /dev/null @@ -1,98 +0,0 @@ -import './index.js'; -import watcher from 'core/mocks/watcher'; -import crudModel from 'core/mocks/crud-model'; - -describe('Supplier Component vnSupplierAccount', () => { - let $scope; - let controller; - let $httpBackend; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - $scope.model = crudModel; - $scope.watcher = watcher; - - $scope.bankEntity = { - open: () => {} - }; - - const $element = angular.element(''); - controller = $componentController('vnSupplierAccount', {$element, $scope}); - controller.supplierAccount = { - supplierFk: 442, - name: 'Verdnatura' - }; - })); - - describe('onAccept()', () => { - it('should set the created bank entity id into the target account', () => { - controller.supplierAccounts = [{}, {}, {}]; - - const data = { - id: 999, - index: 1 - }; - - controller.onAccept(data); - - const targetAccount = controller.supplierAccounts[data.index]; - - expect(targetAccount.bankEntityFk).toEqual(data.id); - }); - }); - - describe('onSubmit()', () => { - it(`should reload the card`, done => { - controller.card = {reload: () => {}}; - controller.$.payMethodToTransfer = {show: () => {}}; - jest.spyOn(controller.$.payMethodToTransfer, 'show'); - jest.spyOn(controller.$.model, 'save').mockReturnValue(new Promise(resolve => { - return resolve({ - id: 1234 - }); - })); - jest.spyOn(controller.card, 'reload').mockReturnValue(new Promise(resolve => { - return resolve({ - id: 1234 - }); - })); - - controller.wireTransferFk = 'a'; - controller.supplier = {payMethodFk: 'b'}; - controller.onSubmit().then(() => { - expect(controller.card.reload).toHaveBeenCalledWith(); - expect(controller.$.payMethodToTransfer.show).toHaveBeenCalled(); - done(); - }).catch(done.fail); - }); - }); - - describe('setWireTransfer()', () => { - it(`should make HTTP PATCH request to set wire transfer and call notifySaved`, () => { - const supplierId = 1; - const params = { - id: supplierId, - payMethodFk: 2 - }; - const response = { - data: {id: 2} - }; - const uri = 'payMethods/findOne?filter=%7B%22where%22:%7B%22code%22:%22wireTransfer%22%7D%7D'; - jest.spyOn($scope.watcher, 'notifySaved'); - - controller.$params.id = supplierId; - controller.wireTransferFk = 2; - controller.supplier = {payMethodFk: 1}; - $httpBackend.expectGET(uri).respond(response); - $httpBackend.expectPATCH(`Suppliers/${supplierId}`, params).respond(); - controller.setWireTransfer(); - $httpBackend.flush(); - - expect($scope.watcher.notifySaved).toHaveBeenCalledWith(); - }); - }); -}); - diff --git a/modules/supplier/front/account/locale/en.yml b/modules/supplier/front/account/locale/en.yml deleted file mode 100644 index f41f5756a..000000000 --- a/modules/supplier/front/account/locale/en.yml +++ /dev/null @@ -1 +0,0 @@ -Beneficiary information: Name of the bank account holder if different from the provider \ No newline at end of file diff --git a/modules/supplier/front/account/locale/es.yml b/modules/supplier/front/account/locale/es.yml deleted file mode 100644 index f445a3fb8..000000000 --- a/modules/supplier/front/account/locale/es.yml +++ /dev/null @@ -1,6 +0,0 @@ -Bank entity: Entidad bancaria -swift: Swift BIC -Add account: Añadir cuenta -Beneficiary: Beneficiario -Beneficiary information: Nombre del titular de la cuenta bancaria en caso de ser diferente del proveedor -Do you want to change the pay method to wire transfer?: ¿Quieres modificar la forma de pago a transferencia? \ No newline at end of file diff --git a/modules/supplier/front/address/create/index.html b/modules/supplier/front/address/create/index.html deleted file mode 100644 index e3f883641..000000000 --- a/modules/supplier/front/address/create/index.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - -
- - - - - - - - - - - {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.name}}) - - - - - - - - - {{name}}, {{province.name}} - ({{province.country.name}}) - - - - {{name}} ({{country.name}}) - - - - - - - - - - - - - - -
- - - - diff --git a/modules/supplier/front/address/create/index.js b/modules/supplier/front/address/create/index.js deleted file mode 100644 index 21b845881..000000000 --- a/modules/supplier/front/address/create/index.js +++ /dev/null @@ -1,74 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - this.address = { - supplierFk: this.$params.id - }; - } - - onSubmit() { - this.$.watcher.submit().then(res => { - this.$state.go('supplier.card.address.index'); - }); - } - - get town() { - return this._town; - } - - // Town auto complete - set town(selection) { - this._town = selection; - - if (!selection) return; - - const province = selection.province; - const postcodes = selection.postcodes; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - - if (postcodes.length === 1) - this.address.postalCode = postcodes[0].code; - } - - get postcode() { - return this._postcode; - } - - // Postcode auto complete - set postcode(selection) { - this._postcode = selection; - - if (!selection) return; - - const town = selection.town; - const province = town.province; - - if (!this.address.city) - this.address.city = town.name; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - } - - onResponse(response) { - this.address.postalCode = response.code; - this.address.city = response.city; - this.address.provinceFk = response.provinceFk; - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnSupplierAddressCreate', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/address/create/index.spec.js b/modules/supplier/front/address/create/index.spec.js deleted file mode 100644 index 026de3769..000000000 --- a/modules/supplier/front/address/create/index.spec.js +++ /dev/null @@ -1,102 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Supplier', () => { - describe('Component vnSupplierAddressCreate', () => { - let $scope; - let controller; - let $element; - let $state; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $state = _$state_; - $state.params.id = '1234'; - $element = angular.element(''); - controller = $componentController('vnSupplierAddressCreate', {$element, $scope}); - controller.$.watcher = watcher; - controller.$.watcher.submit = () => { - return { - then: callback => { - callback({data: {id: 124}}); - } - }; - }; - controller.supplier = {id: 1}; - })); - - describe('onSubmit()', () => { - it('should perform a PATCH and then redirect to the main section', () => { - jest.spyOn(controller.$state, 'go'); - controller.onSubmit(); - - expect(controller.$state.go).toHaveBeenCalledWith('supplier.card.address.index'); - }); - }); - - describe('town() setter', () => { - it(`should set provinceFk property`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [] - }; - - expect(controller.address.provinceFk).toEqual(1); - }); - - it(`should set provinceFk property and fill the postalCode if there's just one`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [{code: '46001'}] - }; - - expect(controller.address.provinceFk).toEqual(1); - expect(controller.address.postalCode).toEqual('46001'); - }); - }); - - describe('postcode() setter', () => { - it(`should set the town and province properties`, () => { - controller.postcode = { - townFk: 1, - code: 46001, - town: { - id: 1, - name: 'New York', - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - } - } - }; - - expect(controller.address.city).toEqual('New York'); - expect(controller.address.provinceFk).toEqual(1); - }); - }); - }); -}); diff --git a/modules/supplier/front/address/edit/index.html b/modules/supplier/front/address/edit/index.html deleted file mode 100644 index b966023da..000000000 --- a/modules/supplier/front/address/edit/index.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - -
- - - - - - - - - - - {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.name}}) - - - - - - - - - {{name}}, {{province.name}} - ({{province.country.name}}) - - - - {{name}} ({{country.name}}) - - - - - - - - - - - - - -
- - - - diff --git a/modules/supplier/front/address/edit/index.js b/modules/supplier/front/address/edit/index.js deleted file mode 100644 index 4c7450666..000000000 --- a/modules/supplier/front/address/edit/index.js +++ /dev/null @@ -1,62 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - onSubmit() { - this.$.watcher.submit() - .then(() => this.$state.go('supplier.card.address.index')); - } - - get town() { - return this._town; - } - - // Town auto complete - set town(selection) { - const oldValue = this._town; - this._town = selection; - - if (!selection || !oldValue) return; - - const province = selection.province; - const postcodes = selection.postcodes; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - - if (!this.address.postalCode && postcodes.length === 1) - this.address.postalCode = postcodes[0].code; - } - - get postcode() { - return this._postcode; - } - - // Postcode auto complete - set postcode(selection) { - const oldValue = this._postcode; - this._postcode = selection; - - if (!selection || !oldValue) return; - - const town = selection.town; - const province = town.province; - - if (!this.address.city) - this.address.city = town.name; - - if (!this.address.provinceFk) - this.address.provinceFk = province.id; - } - - onResponse(response) { - this.address.postalCode = response.code; - this.address.city = response.city; - this.address.provinceFk = response.provinceFk; - } -} - -ngModule.vnComponent('vnSupplierAddressEdit', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/supplier/front/address/edit/index.spec.js b/modules/supplier/front/address/edit/index.spec.js deleted file mode 100644 index 991163baa..000000000 --- a/modules/supplier/front/address/edit/index.spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Supplier', () => { - describe('Component vnSupplierAddressEdit', () => { - let $scope; - let controller; - let $element; - let $state; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $state = _$state_; - $state.params.addressId = '1'; - $element = angular.element(''); - controller = $componentController('vnSupplierAddressEdit', {$element, $scope}); - controller.address = {id: 1}; - controller.$.watcher = watcher; - controller.$.watcher.submit = () => { - return { - then: callback => { - callback({data: {id: 124}}); - } - }; - }; - })); - - describe('onSubmit()', () => { - it('should perform a PATCH and then redirect to the main section', () => { - jest.spyOn(controller.$state, 'go'); - controller.onSubmit(); - - expect(controller.$state.go).toHaveBeenCalledWith('supplier.card.address.index'); - }); - }); - }); -}); diff --git a/modules/supplier/front/address/index/index.html b/modules/supplier/front/address/index/index.html deleted file mode 100644 index cb7b3d56c..000000000 --- a/modules/supplier/front/address/index/index.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - diff --git a/modules/supplier/front/address/index/index.js b/modules/supplier/front/address/index/index.js deleted file mode 100644 index c3985a0c1..000000000 --- a/modules/supplier/front/address/index/index.js +++ /dev/null @@ -1,46 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - fields: [ - 'id', - 'nickname', - 'street', - 'city', - 'provinceFk', - 'phone', - 'mobile', - 'postalCode' - ], - order: ['nickname ASC'], - include: [{ - relation: 'province', - scope: { - fields: ['id', 'name'] - } - }] - }; - } - - exprBuilder(param, value) { - switch (param) { - case 'search': - return /^\d+$/.test(value) - ? {id: value} - : {nickname: {like: `%${value}%`}}; - } - } -} -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnSupplierAddressIndex', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/address/index/index.spec.js b/modules/supplier/front/address/index/index.spec.js deleted file mode 100644 index 086d3a9fa..000000000 --- a/modules/supplier/front/address/index/index.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -import './index'; - -describe('Supplier', () => { - describe('Component vnSupplierAddressIndex', () => { - let controller; - let $scope; - let $stateParams; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$stateParams_) => { - $stateParams = _$stateParams_; - $stateParams.id = 1; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnSupplierAddressIndex', {$element, $scope}); - controller.supplier = {id: 1}; - })); - - describe('exprBuilder()', () => { - it('should return a filter based on a search by id', () => { - const filter = controller.exprBuilder('search', '123'); - - expect(filter).toEqual({id: '123'}); - }); - - it('should return a filter based on a search by name', () => { - const filter = controller.exprBuilder('search', 'Arkham Chemicals'); - - expect(filter).toEqual({nickname: {like: '%Arkham Chemicals%'}}); - }); - }); - }); -}); diff --git a/modules/supplier/front/address/index/style.scss b/modules/supplier/front/address/index/style.scss deleted file mode 100644 index 44ce07b3c..000000000 --- a/modules/supplier/front/address/index/style.scss +++ /dev/null @@ -1,21 +0,0 @@ -@import "variables"; -@import "./effects"; - -vn-supplier-address-index { - .address { - padding-bottom: $spacing-md; - - &:last-child { - padding-bottom: 0; - } - & > a { - @extend %clickable; - box-sizing: border-box; - display: flex; - align-items: center; - width: 100%; - color: inherit; - overflow: hidden; - } - } -} \ No newline at end of file diff --git a/modules/supplier/front/address/locale/es.yml b/modules/supplier/front/address/locale/es.yml deleted file mode 100644 index 30009fa87..000000000 --- a/modules/supplier/front/address/locale/es.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Index -Search by address: Buscar por dirección -You can search by address id or name: Puedes buscar por el id o nombre de la dirección - -# Create -Street address: Dirección postal -Postcode: Código postal -Town/City: Ciudad -Province: Provincia -Phone: Teléfono -Mobile: Móvil - -# Common -Fiscal name: Nombre fiscal -Street: Dirección fiscal -Addresses: Direcciones -New address: Nueva dirección -Edit address: Editar dirección \ No newline at end of file diff --git a/modules/supplier/front/agency-term/create/index.html b/modules/supplier/front/agency-term/create/index.html deleted file mode 100644 index 728e98146..000000000 --- a/modules/supplier/front/agency-term/create/index.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/modules/supplier/front/agency-term/create/index.js b/modules/supplier/front/agency-term/create/index.js deleted file mode 100644 index 3f66ac5e9..000000000 --- a/modules/supplier/front/agency-term/create/index.js +++ /dev/null @@ -1,26 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - this.supplierAgencyTerm = { - supplierFk: this.$params.id - }; - } - - onSubmit() { - this.$.watcher.submit().then(res => { - this.$state.go('supplier.card.agencyTerm.index'); - }); - } -} - -ngModule.vnComponent('vnSupplierAgencyTermCreate', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/agency-term/create/index.spec.js b/modules/supplier/front/agency-term/create/index.spec.js deleted file mode 100644 index 682e1cc58..000000000 --- a/modules/supplier/front/agency-term/create/index.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Supplier', () => { - describe('Component vnSupplierAddressCreate', () => { - let $scope; - let controller; - let $element; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $scope.watcher = watcher; - $element = angular.element(''); - controller = $componentController('vnSupplierAgencyTermCreate', {$element, $scope}); - })); - - describe('onSubmit()', () => { - it(`should redirect to 'supplier.card.agencyTerm.index' state`, () => { - jest.spyOn(controller.$state, 'go'); - controller.onSubmit(); - - expect(controller.$state.go).toHaveBeenCalledWith('supplier.card.agencyTerm.index'); - }); - }); - }); -}); diff --git a/modules/supplier/front/agency-term/index/index.html b/modules/supplier/front/agency-term/index/index.html deleted file mode 100644 index 44c6deba9..000000000 --- a/modules/supplier/front/agency-term/index/index.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - diff --git a/modules/supplier/front/agency-term/index/index.js b/modules/supplier/front/agency-term/index/index.js deleted file mode 100644 index 9f77d686a..000000000 --- a/modules/supplier/front/agency-term/index/index.js +++ /dev/null @@ -1,36 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.filter = { - include: - {relation: 'agency', - scope: { - fields: ['id', 'name'] - } - } - }; - } - - add() { - this.$.model.insert({}); - } - - onSubmit() { - this.$.watcher.check(); - this.$.model.save().then(() => { - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - }); - } -} - -ngModule.vnComponent('vnSupplierAgencyTermIndex', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/agency-term/index/index.spec.js b/modules/supplier/front/agency-term/index/index.spec.js deleted file mode 100644 index 3e9ea4c1e..000000000 --- a/modules/supplier/front/agency-term/index/index.spec.js +++ /dev/null @@ -1,37 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; -import crudModel from 'core/mocks/crud-model'; - -describe('Supplier', () => { - describe('Component vnSupplierAddressCreate', () => { - let $scope; - let controller; - let $element; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$state_) => { - $scope = $rootScope.$new(); - $scope.model = crudModel; - $scope.watcher = watcher; - $element = angular.element(''); - controller = $componentController('vnSupplierAgencyTermIndex', {$element, $scope}); - })); - - describe('onSubmit()', () => { - it('should make HTTP POST request to save values', () => { - jest.spyOn($scope.watcher, 'check'); - jest.spyOn($scope.watcher, 'notifySaved'); - jest.spyOn($scope.watcher, 'updateOriginalData'); - jest.spyOn($scope.model, 'save'); - - controller.onSubmit(); - - expect($scope.model.save).toHaveBeenCalledWith(); - expect($scope.watcher.updateOriginalData).toHaveBeenCalledWith(); - expect($scope.watcher.check).toHaveBeenCalledWith(); - expect($scope.watcher.notifySaved).toHaveBeenCalledWith(); - }); - }); - }); -}); diff --git a/modules/supplier/front/agency-term/locale/es.yml b/modules/supplier/front/agency-term/locale/es.yml deleted file mode 100644 index cdbd7c2ca..000000000 --- a/modules/supplier/front/agency-term/locale/es.yml +++ /dev/null @@ -1,9 +0,0 @@ -Minimum M3: M3 minimos -Package Price: Precio bulto -Km Price: Precio Km -M3 Price: Precio M3 -Route Price: Precio ruta -Minimum Km: Km minimos -Remove row: Eliminar fila -Add row: Añadir fila -New autonomous: Nuevo autónomo diff --git a/modules/supplier/front/basic-data/index.html b/modules/supplier/front/basic-data/index.html deleted file mode 100644 index fcdb2a522..000000000 --- a/modules/supplier/front/basic-data/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/modules/supplier/front/basic-data/index.js b/modules/supplier/front/basic-data/index.js deleted file mode 100644 index 447118ebb..000000000 --- a/modules/supplier/front/basic-data/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -ngModule.vnComponent('vnSupplierBasicData', { - template: require('./index.html'), - controller: Section, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/basic-data/locale/es.yml b/modules/supplier/front/basic-data/locale/es.yml deleted file mode 100644 index e965ffc2e..000000000 --- a/modules/supplier/front/basic-data/locale/es.yml +++ /dev/null @@ -1,5 +0,0 @@ -Notes: Notas -Active: Activo -Verified: Verificado -PayMethodChecked: Método de pago validado -Responsible for approving invoices: Responsable de aprobar las facturas \ No newline at end of file diff --git a/modules/supplier/front/billing-data/index.html b/modules/supplier/front/billing-data/index.html deleted file mode 100644 index 238760c1a..000000000 --- a/modules/supplier/front/billing-data/index.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - -
- - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/supplier/front/billing-data/index.js b/modules/supplier/front/billing-data/index.js deleted file mode 100644 index 9d2863f64..000000000 --- a/modules/supplier/front/billing-data/index.js +++ /dev/null @@ -1,28 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - get supplier() { - return this._supplier; - } - - set supplier(value) { - this._supplier = value; - } - - onSubmit() { - this.$.watcher.submit() - .then(() => this.card.reload()); - } -} - -ngModule.vnComponent('vnSupplierBillingData', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - }, - require: { - card: '^vnSupplierCard' - } -}); diff --git a/modules/supplier/front/billing-data/locale/es.yml b/modules/supplier/front/billing-data/locale/es.yml deleted file mode 100644 index d84d37f3a..000000000 --- a/modules/supplier/front/billing-data/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -Pay day: Dia de pago \ No newline at end of file diff --git a/modules/supplier/front/card/index.html b/modules/supplier/front/card/index.html deleted file mode 100644 index 2c3c9df36..000000000 --- a/modules/supplier/front/card/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/modules/supplier/front/card/index.js b/modules/supplier/front/card/index.js deleted file mode 100644 index 13fc3d52d..000000000 --- a/modules/supplier/front/card/index.js +++ /dev/null @@ -1,48 +0,0 @@ -import ngModule from '../module'; -import ModuleCard from 'salix/components/module-card'; - -class Controller extends ModuleCard { - reload() { - let filter = { - include: [ - { - relation: 'province', - scope: { - fields: ['id', 'name'] - } - }, - { - relation: 'country', - scope: { - fields: ['id', 'name', 'code'] - } - }, - { - relation: 'payMethod', - scope: { - fields: ['id', 'name'] - } - }, - { - relation: 'payDem', - scope: { - fields: ['id', 'payDem'] - } - }, - { - relation: 'client', - scope: { - fields: ['id', 'fi'] - } - } - ] - }; - return this.$http.get(`Suppliers/${this.$params.id}`, {filter}) - .then(response => this.supplier = response.data); - } -} - -ngModule.vnComponent('vnSupplierCard', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/supplier/front/consumption-search-panel/index.html b/modules/supplier/front/consumption-search-panel/index.html deleted file mode 100644 index 5cba11d3c..000000000 --- a/modules/supplier/front/consumption-search-panel/index.html +++ /dev/null @@ -1,67 +0,0 @@ -
-
- - - - - - - - - - - - - -
{{name}}
-
- {{category.name}} -
-
-
- - -
- - - - - - - - - -
-
diff --git a/modules/supplier/front/consumption-search-panel/index.js b/modules/supplier/front/consumption-search-panel/index.js deleted file mode 100644 index f6c63c55c..000000000 --- a/modules/supplier/front/consumption-search-panel/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import ngModule from '../module'; -import SearchPanel from 'core/components/searchbar/search-panel'; - -ngModule.vnComponent('vnSupplierConsumptionSearchPanel', { - template: require('./index.html'), - controller: SearchPanel -}); diff --git a/modules/supplier/front/consumption-search-panel/locale/es.yml b/modules/supplier/front/consumption-search-panel/locale/es.yml deleted file mode 100644 index f136283f8..000000000 --- a/modules/supplier/front/consumption-search-panel/locale/es.yml +++ /dev/null @@ -1,7 +0,0 @@ -Item id: Id artículo -From: Desde -To: Hasta -Campaign: Campaña -allSaints: Día de todos los Santos -valentinesDay: Día de San Valentín -mothersDay: Día de la madre \ No newline at end of file diff --git a/modules/supplier/front/consumption/index.html b/modules/supplier/front/consumption/index.html deleted file mode 100644 index e6c86abe3..000000000 --- a/modules/supplier/front/consumption/index.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - -
- - - - - - -
- - - - Entry - {{::entry.id}} - Date - {{::entry.shipped | date: 'dd/MM/yyyy'}} - Reference - {{::entry.invoiceNumber}} - - - - - - - {{::buy.itemName}} - - - -
- - -

{{::buy.subName}}

-
-
- - -
- {{::buy.quantity | dashIfEmpty}} - {{::buy.price | dashIfEmpty}} - {{::buy.total | dashIfEmpty}} - -
-
- - - - - - - - -
-
-
- - - - diff --git a/modules/supplier/front/consumption/index.js b/modules/supplier/front/consumption/index.js deleted file mode 100644 index 9af0d1747..000000000 --- a/modules/supplier/front/consumption/index.js +++ /dev/null @@ -1,88 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $, vnReport, vnEmail) { - super($element, $); - this.vnReport = vnReport; - this.vnEmail = vnEmail; - - this.setDefaultFilter(); - } - - setDefaultFilter() { - const minDate = Date.vnNew(); - minDate.setHours(0, 0, 0, 0); - minDate.setMonth(minDate.getMonth() - 2); - - const maxDate = Date.vnNew(); - maxDate.setHours(23, 59, 59, 59); - - this.filterParams = { - from: minDate, - to: maxDate - }; - } - - get reportParams() { - const userParams = this.$.model.userParams; - return Object.assign({ - authorization: this.vnToken.token, - recipientId: this.supplier.id - }, userParams); - } - - showReport() { - const path = `Suppliers/${this.supplier.id}/campaign-metrics-pdf`; - this.vnReport.show(path, this.reportParams); - } - - sendEmail() { - const params = { - filter: { - where: { - supplierFk: this.$params.id, - email: {neq: null} - }, - limit: 1 - } - }; - this.$http.get('SupplierContacts', params).then(({data}) => { - if (data.length) { - const contact = data[0]; - const params = Object.assign({ - recipient: contact.email - }, this.reportParams); - - const path = `Suppliers/${this.supplier.id}/campaign-metrics-email`; - this.vnEmail.send(path, params); - } else { - const message = this.$t(`This supplier doesn't have a contact with an email address`); - this.vnApp.showError(message); - } - }); - } - - getTotal(entry) { - if (entry.buys) { - let total = 0; - for (let buy of entry.buys) - total += buy.total; - - return total; - } - } -} - -Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; - -ngModule.vnComponent('vnSupplierConsumption', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - }, - require: { - card: '^vnSupplierCard' - } -}); diff --git a/modules/supplier/front/consumption/index.spec.js b/modules/supplier/front/consumption/index.spec.js deleted file mode 100644 index 0ac531a68..000000000 --- a/modules/supplier/front/consumption/index.spec.js +++ /dev/null @@ -1,110 +0,0 @@ -import './index.js'; -import crudModel from 'core/mocks/crud-model'; - -describe('Supplier', () => { - describe('Component vnSupplierConsumption', () => { - let $scope; - let controller; - let $httpParamSerializer; - let $httpBackend; - const supplierId = 2; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { - $scope = $rootScope.$new(); - $httpParamSerializer = _$httpParamSerializer_; - $httpBackend = _$httpBackend_; - const $element = angular.element(' { - it('should call the window.open function', () => { - jest.spyOn(window, 'open').mockReturnThis(); - - const now = Date.vnNew(); - controller.$.model.userParams = { - from: now, - to: now - }; - - controller.showReport(); - - const expectedParams = { - recipientId: 2, - from: now, - to: now - }; - const serializedParams = $httpParamSerializer(expectedParams); - const path = `api/Suppliers/${supplierId}/campaign-metrics-pdf?${serializedParams}`; - - expect(window.open).toHaveBeenCalledWith(path); - }); - }); - - describe('sendEmail()', () => { - it('should throw an error', () => { - jest.spyOn(controller.vnApp, 'showError'); - - const expectedParams = { - filter: { - where: { - supplierFk: supplierId, - email: {neq: null} - }, - limit: 1 - } - }; - const serializedParams = $httpParamSerializer(expectedParams); - $httpBackend.expectGET(`SupplierContacts?${serializedParams}`).respond({}); - controller.sendEmail(); - $httpBackend.flush(); - - expect(controller.vnApp.showError) - .toHaveBeenCalledWith(`This supplier doesn't have a contact with an email address`); - }); - - it('should make a GET query sending the report', () => { - let serializedParams; - const params = { - filter: { - where: { - supplierFk: supplierId, - email: {neq: null} - }, - limit: 1 - } - }; - serializedParams = $httpParamSerializer(params); - $httpBackend.whenGET(`SupplierContacts?${serializedParams}`).respond([ - {id: 1, email: 'batman@gothamcity.com'} - ]); - - const now = Date.vnNew(); - controller.$.model.userParams = { - from: now, - to: now - }; - const expectedParams = { - recipient: 'batman@gothamcity.com', - from: now, - to: now - }; - - serializedParams = $httpParamSerializer(expectedParams); - const path = `Suppliers/${supplierId}/campaign-metrics-email`; - - $httpBackend.expect('POST', path).respond({}); - controller.sendEmail(); - $httpBackend.flush(); - }); - }); - }); -}); - diff --git a/modules/supplier/front/consumption/locale/es.yml b/modules/supplier/front/consumption/locale/es.yml deleted file mode 100644 index 08c2a22e5..000000000 --- a/modules/supplier/front/consumption/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Total entry: Total entrada -This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email diff --git a/modules/supplier/front/contact/index.html b/modules/supplier/front/contact/index.html deleted file mode 100644 index 347e4261a..000000000 --- a/modules/supplier/front/contact/index.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - -
- -
- - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -
\ No newline at end of file diff --git a/modules/supplier/front/contact/index.js b/modules/supplier/front/contact/index.js deleted file mode 100644 index 48db3d526..000000000 --- a/modules/supplier/front/contact/index.js +++ /dev/null @@ -1,27 +0,0 @@ -import ngModule from '../module'; -import './style.scss'; -import Section from 'salix/components/section'; - -class Controller extends Section { - add() { - this.$.model.insert({ - supplierFk: this.supplier.id - }); - } - - onSubmit() { - this.$.watcher.check(); - this.$.model.save().then(() => { - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - }); - } -} - -ngModule.vnComponent('vnSupplierContact', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/contact/style.scss b/modules/supplier/front/contact/style.scss deleted file mode 100644 index becc66dcf..000000000 --- a/modules/supplier/front/contact/style.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import "variables"; - - -.contact { - max-width: $width-lg; - margin-bottom: 10px; - padding-right: 10px; - padding-left: 10px; - border: 1px solid $color-spacer; -} diff --git a/modules/supplier/front/create/index.html b/modules/supplier/front/create/index.html deleted file mode 100644 index 1e051f3a8..000000000 --- a/modules/supplier/front/create/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - -
- - - - - - - - - - - - -
diff --git a/modules/supplier/front/create/index.js b/modules/supplier/front/create/index.js deleted file mode 100644 index c33367dac..000000000 --- a/modules/supplier/front/create/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - } - - onSubmit() { - this.$.watcher.submit().then( - json => { - this.$state.go(`supplier.card.fiscalData`, {id: json.data.id}); - } - ); - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnSupplierCreate', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/supplier/front/descriptor-popover/index.html b/modules/supplier/front/descriptor-popover/index.html deleted file mode 100644 index 874ba6708..000000000 --- a/modules/supplier/front/descriptor-popover/index.html +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/supplier/front/descriptor-popover/index.js b/modules/supplier/front/descriptor-popover/index.js deleted file mode 100644 index a30aa4829..000000000 --- a/modules/supplier/front/descriptor-popover/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import ngModule from '../module'; -import DescriptorPopover from 'salix/components/descriptor-popover'; - -class Controller extends DescriptorPopover {} - -ngModule.vnComponent('vnSupplierDescriptorPopover', { - slotTemplate: require('./index.html'), - controller: Controller -}); diff --git a/modules/supplier/front/descriptor/index.html b/modules/supplier/front/descriptor/index.html deleted file mode 100644 index af5be2537..000000000 --- a/modules/supplier/front/descriptor/index.html +++ /dev/null @@ -1,66 +0,0 @@ - - -
- - - - - - - - - - - - -
-
- - - - -
- -
-
- - - \ No newline at end of file diff --git a/modules/supplier/front/descriptor/index.js b/modules/supplier/front/descriptor/index.js deleted file mode 100644 index f84b4ef92..000000000 --- a/modules/supplier/front/descriptor/index.js +++ /dev/null @@ -1,80 +0,0 @@ -import ngModule from '../module'; -import Descriptor from 'salix/components/descriptor'; - -class Controller extends Descriptor { - get supplier() { - return this.entity; - } - - set supplier(value) { - this.entity = value; - } - - get entryFilter() { - if (!this.supplier) return null; - - const date = Date.vnNew(); - date.setHours(0, 0, 0, 0); - - const from = new Date(date.getTime()); - from.setDate(from.getDate() - 10); - - const to = new Date(date.getTime()); - to.setDate(to.getDate() + 10); - - return JSON.stringify({ - supplierFk: this.id, - from, - to - }); - } - - loadData() { - const filter = { - fields: [ - 'id', - 'name', - 'nickname', - 'nif', - 'payMethodFk', - 'payDemFk', - 'payDay', - 'isActive', - 'isReal', - 'isTrucker', - 'account' - ], - include: [ - { - relation: 'payMethod', - scope: { - fields: ['id', 'name'] - } - }, - { - relation: 'payDem', - scope: { - fields: ['id', 'payDem'] - } - }, - { - relation: 'client', - scope: { - fields: ['id', 'fi'] - } - } - ] - }; - - return this.getData(`Suppliers/${this.id}`, {filter}) - .then(res => this.supplier = res.data); - } -} - -ngModule.vnComponent('vnSupplierDescriptor', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/descriptor/index.spec.js b/modules/supplier/front/descriptor/index.spec.js deleted file mode 100644 index 12c3e43bc..000000000 --- a/modules/supplier/front/descriptor/index.spec.js +++ /dev/null @@ -1,65 +0,0 @@ -import './index.js'; - -describe('Supplier Component vnSupplierDescriptor', () => { - let $httpBackend; - let controller; - let $httpParamSerializer; - const supplier = {id: 1}; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - controller = $componentController('vnSupplierDescriptor', {$element: null}, {supplier}); - })); - - describe('loadData()', () => { - it('should perform ask for the supplier', () => { - const filter = { - fields: [ - 'id', - 'name', - 'nickname', - 'nif', - 'payMethodFk', - 'payDemFk', - 'payDay', - 'isActive', - 'isReal', - 'isTrucker', - 'account' - ], - include: [ - { - relation: 'payMethod', - scope: { - fields: ['id', 'name'] - } - }, - { - relation: 'payDem', - scope: { - fields: ['id', 'payDem'] - } - }, - { - relation: 'client', - scope: { - fields: ['id', 'fi'] - } - } - ] - }; - const serializedParams = $httpParamSerializer({filter}); - let query = `Suppliers/${controller.supplier.id}?${serializedParams}`; - jest.spyOn(controller, 'getData'); - - $httpBackend.expect('GET', query).respond({id: 1}); - controller.loadData(); - $httpBackend.flush(); - - expect(controller.getData).toHaveBeenCalledTimes(1); - }); - }); -}); diff --git a/modules/supplier/front/descriptor/locale/es.yml b/modules/supplier/front/descriptor/locale/es.yml deleted file mode 100644 index cf4a52393..000000000 --- a/modules/supplier/front/descriptor/locale/es.yml +++ /dev/null @@ -1,8 +0,0 @@ -Tax number: NIF / CIF -All entries with current supplier: Todas las entradas con el proveedor actual -Go to client: Ir al cliente -Verified supplier: Proveedor verificado -Unverified supplier: Proveedor no verificado -Inactive supplier: Proveedor inactivo -Create invoiceIn: Crear factura recibida -Supplier name: Razón social diff --git a/modules/supplier/front/fiscal-data/index.html b/modules/supplier/front/fiscal-data/index.html deleted file mode 100644 index 6455bf3fd..000000000 --- a/modules/supplier/front/fiscal-data/index.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - {{id}}: {{transaction}} - - - - - - - - - - - - - - {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.name}}) - - - - - - - - - - - {{name}}, {{province.name}} - ({{province.country.name}}) - - - - {{name}} ({{country.name}}) - - - - - - - - - - - - - - - - - - - -
- - - diff --git a/modules/supplier/front/fiscal-data/index.js b/modules/supplier/front/fiscal-data/index.js deleted file mode 100644 index 8a6a51249..000000000 --- a/modules/supplier/front/fiscal-data/index.js +++ /dev/null @@ -1,86 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - get province() { - return this._province; - } - - // Province auto complete - set province(selection) { - const oldValue = this._province; - this._province = selection; - - if (!selection || !oldValue) return; - - const country = selection.country; - - if (!this.supplier.countryFk) - this.supplier.countryFk = country.id; - } - - get town() { - return this._town; - } - - // Town auto complete - set town(selection) { - const oldValue = this._town; - this._town = selection; - - if (!selection || !oldValue) return; - - const province = selection.province; - const country = province.country; - const postcodes = selection.postcodes; - - if (!this.supplier.provinceFk) - this.supplier.provinceFk = province.id; - - if (!this.supplier.countryFk) - this.supplier.countryFk = country.id; - - if (!this.supplier.postCode && postcodes.length === 1) - this.supplier.postCode = postcodes[0].code; - } - - get postcode() { - return this._postcode; - } - - // Postcode auto complete - set postcode(selection) { - const oldValue = this._postcode; - this._postcode = selection; - - if (!selection || !oldValue) return; - - const town = selection.town; - const province = town.province; - const country = province.country; - - if (!this.supplier.city) - this.supplier.city = town.name; - - if (!this.supplier.provinceFk) - this.supplier.provinceFk = province.id; - - if (!this.supplier.countryFk) - this.supplier.countryFk = country.id; - } - - onResponse(response) { - this.supplier.postCode = response.code; - this.supplier.city = response.city; - this.supplier.provinceFk = response.provinceFk; - this.supplier.countryFk = response.countryFk; - } -} - -ngModule.vnComponent('vnSupplierFiscalData', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/fiscal-data/index.spec.js b/modules/supplier/front/fiscal-data/index.spec.js deleted file mode 100644 index 6fb135c08..000000000 --- a/modules/supplier/front/fiscal-data/index.spec.js +++ /dev/null @@ -1,109 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher'; - -describe('Supplier', () => { - describe('Component vnSupplierFiscalData', () => { - let $scope; - let $element; - let controller; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, $rootScope) => { - $scope = $rootScope.$new(); - $scope.watcher = watcher; - $scope.watcher.orgData = {id: 1}; - $element = angular.element(''); - controller = $componentController('vnSupplierFiscalData', {$element, $scope}); - controller.card = {reload: () => {}}; - controller.supplier = { - id: 1, - name: 'Batman' - }; - - controller._province = {}; - controller._town = {}; - controller._postcode = {}; - })); - - describe('province() setter', () => { - it(`should set countryFk property`, () => { - controller.supplier.countryFk = null; - controller.province = { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }; - - expect(controller.supplier.countryFk).toEqual(2); - }); - }); - - describe('town() setter', () => { - it(`should set provinceFk property`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [] - }; - - expect(controller.supplier.provinceFk).toEqual(1); - }); - - it(`should set provinceFk property and fill the postalCode if there's just one`, () => { - controller.town = { - provinceFk: 1, - code: 46001, - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - }, - postcodes: [{code: '46001'}] - }; - - expect(controller.supplier.provinceFk).toEqual(1); - expect(controller.supplier.postCode).toEqual('46001'); - }); - }); - - describe('postcode() setter', () => { - it(`should set the town, provinceFk and contryFk properties`, () => { - controller.postcode = { - townFk: 1, - code: 46001, - town: { - id: 1, - name: 'New York', - province: { - id: 1, - name: 'New york', - country: { - id: 2, - name: 'USA' - } - } - } - }; - - expect(controller.supplier.city).toEqual('New York'); - expect(controller.supplier.provinceFk).toEqual(1); - expect(controller.supplier.countryFk).toEqual(2); - }); - }); - }); -}); diff --git a/modules/supplier/front/fiscal-data/locale/es.yml b/modules/supplier/front/fiscal-data/locale/es.yml deleted file mode 100644 index ee641231f..000000000 --- a/modules/supplier/front/fiscal-data/locale/es.yml +++ /dev/null @@ -1,8 +0,0 @@ -Sage tax type: Tipo de impuesto Sage -Sage transaction type: Tipo de transacción Sage -Sage withholding: Retención Sage -Supplier activity: Actividad proveedor -Healt register: Pasaporte sanitario -Trucker: Transportista -When activating it, do not enter the country code in the ID field.: Al activarlo, no informar el código del país en el campo nif -The first two values are letters.: Los dos primeros valores son letras \ No newline at end of file diff --git a/modules/supplier/front/index.js b/modules/supplier/front/index.js index 9216d0781..a7209a0bd 100644 --- a/modules/supplier/front/index.js +++ b/modules/supplier/front/index.js @@ -1,23 +1,3 @@ export * from './module'; import './main'; -import './card'; -import './descriptor'; -import './descriptor-popover'; -import './index/'; -import './search-panel'; -import './summary'; -import './basic-data'; -import './fiscal-data'; -import './account'; -import './contact'; -import './log'; -import './consumption'; -import './consumption-search-panel'; -import './billing-data'; -import './address/index'; -import './address/create'; -import './address/edit'; -import './agency-term/index'; -import './agency-term/create'; -import './create/index'; diff --git a/modules/supplier/front/index/index.html b/modules/supplier/front/index/index.html deleted file mode 100644 index 49f38cb1b..000000000 --- a/modules/supplier/front/index/index.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/supplier/front/index/index.js b/modules/supplier/front/index/index.js deleted file mode 100644 index 77b2e8347..000000000 --- a/modules/supplier/front/index/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - openSummary(supplier, event) { - if (event.defaultPrevented) return; - event.preventDefault(); - event.stopPropagation(); - - this.supplierSelected = supplier; - this.$.dialogSummarySupplier.show(); - } -} - -ngModule.vnComponent('vnSupplierIndex', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/supplier/front/index/locale/es.yml b/modules/supplier/front/index/locale/es.yml deleted file mode 100644 index ce06f462c..000000000 --- a/modules/supplier/front/index/locale/es.yml +++ /dev/null @@ -1,6 +0,0 @@ -Payment deadline: Plazo de pago -Pay day: Dia de pago -Account: Cuenta -Pay method: Metodo de pago -Tax number: Nif -New supplier: Nuevo proveedor \ No newline at end of file diff --git a/modules/supplier/front/log/index.html b/modules/supplier/front/log/index.html deleted file mode 100644 index 7895b585e..000000000 --- a/modules/supplier/front/log/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/supplier/front/log/index.js b/modules/supplier/front/log/index.js deleted file mode 100644 index 52a491c70..000000000 --- a/modules/supplier/front/log/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -ngModule.vnComponent('vnSupplierLog', { - template: require('./index.html'), - controller: Section, -}); diff --git a/modules/supplier/front/main/index.html b/modules/supplier/front/main/index.html index 04d7aa0ad..e69de29bb 100644 --- a/modules/supplier/front/main/index.html +++ b/modules/supplier/front/main/index.html @@ -1,17 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/modules/supplier/front/main/index.js b/modules/supplier/front/main/index.js index 2fd870573..fd99cc0a2 100644 --- a/modules/supplier/front/main/index.js +++ b/modules/supplier/front/main/index.js @@ -1,7 +1,15 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; -export default class Supplier extends ModuleMain {} +export default class Supplier extends ModuleMain { + constructor($element, $) { + super($element, $); + } + async $onInit() { + this.$state.go('home'); + window.location.href = await this.vnApp.getUrl(`supplier/`); + } +} ngModule.vnComponent('vnSupplier', { controller: Supplier, diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 75b8213cb..ab0022ff9 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -36,146 +36,6 @@ "state": "supplier.index", "component": "vn-supplier-index", "description": "Suppliers" - }, - { - "url": "/:id", - "state": "supplier.card", - "abstract": true, - "component": "vn-supplier-card" - }, - { - "url": "/summary", - "state": "supplier.card.summary", - "component": "vn-supplier-summary", - "description": "Summary", - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/create", - "state": "supplier.create", - "component": "vn-supplier-create", - "acl": ["administrative"], - "description": "New supplier" - }, - { - "url": "/basic-data", - "state": "supplier.card.basicData", - "component": "vn-supplier-basic-data", - "description": "Basic data", - "acl": ["administrative"], - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/fiscal-data", - "state": "supplier.card.fiscalData", - "component": "vn-supplier-fiscal-data", - "description": "Fiscal data", - "params": { - "supplier": "$ctrl.supplier" - }, - "acl": ["administrative"] - }, - { - "url" : "/log", - "state": "supplier.card.log", - "component": "vn-supplier-log", - "description": "Log" - }, - { - "url": "/contact", - "state": "supplier.card.contact", - "component": "vn-supplier-contact", - "description": "Contacts", - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/agency-term", - "state": "supplier.card.agencyTerm", - "component": "ui-view", - "abstract": true - }, - { - "url": "/index", - "state": "supplier.card.agencyTerm.index", - "component": "vn-supplier-agency-term-index", - "description": "Agency Agreement", - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/create", - "state": "supplier.card.agencyTerm.create", - "component": "vn-supplier-agency-term-create", - "description": "New autonomous", - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/consumption?q", - "state": "supplier.card.consumption", - "component": "vn-supplier-consumption", - "description": "Consumption", - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/billing-data", - "state": "supplier.card.billingData", - "component": "vn-supplier-billing-data", - "description": "Billing data", - "params": { - "supplier": "$ctrl.supplier" - }, - "acl": ["administrative"] - }, - { - "url": "/account", - "state": "supplier.card.account", - "component": "vn-supplier-account", - "description": "Accounts", - "params": { - "supplier": "$ctrl.supplier" - }, - "acl": ["administrative"] - }, - { - "url": "/address", - "state": "supplier.card.address", - "component": "ui-view", - "abstract": true - }, - { - "url": "/index?q", - "state": "supplier.card.address.index", - "component": "vn-supplier-address-index", - "description": "Addresses", - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/create", - "state": "supplier.card.address.create", - "component": "vn-supplier-address-create", - "description": "New address", - "params": { - "supplier": "$ctrl.supplier" - } - }, - { - "url": "/:addressId/edit", - "state": "supplier.card.address.edit", - "component": "vn-supplier-address-edit", - "description": "Edit address" } ] -} \ No newline at end of file +} diff --git a/modules/supplier/front/search-panel/index.html b/modules/supplier/front/search-panel/index.html deleted file mode 100644 index e67fa9083..000000000 --- a/modules/supplier/front/search-panel/index.html +++ /dev/null @@ -1,46 +0,0 @@ -
-
- - - - - - - - - - - - - - - - - - - -
-
\ No newline at end of file diff --git a/modules/supplier/front/search-panel/index.js b/modules/supplier/front/search-panel/index.js deleted file mode 100644 index 6223b5670..000000000 --- a/modules/supplier/front/search-panel/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import ngModule from '../module'; -import SearchPanel from 'core/components/searchbar/search-panel'; - -ngModule.vnComponent('vnSupplierSearchPanel', { - template: require('./index.html'), - controller: SearchPanel -}); diff --git a/modules/supplier/front/search-panel/locale/es.yml b/modules/supplier/front/search-panel/locale/es.yml deleted file mode 100644 index 77253a4ef..000000000 --- a/modules/supplier/front/search-panel/locale/es.yml +++ /dev/null @@ -1,4 +0,0 @@ -Province: Provincia -Country: País -Tax number: NIF / CIF -Search suppliers by id, name or alias: Busca proveedores por id, nombre o alias \ No newline at end of file diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html deleted file mode 100644 index 5ba713fcf..000000000 --- a/modules/supplier/front/summary/index.html +++ /dev/null @@ -1,172 +0,0 @@ - -
- - - - {{::$ctrl.summary.name}} - {{::$ctrl.summary.id}} -
- - -

- - Basic data - -

-

- Basic data -

- - - - - - - - {{$ctrl.summary.worker.user.nickname}} - - - - - - - - - -
- -

- - Billing data - -

-

- Billing data -

- - - - - - - - -
-
- - -

- - Fiscal data - -

-

- Fiscal data -

- - - - - - - - - -
-
- - -

- - Fiscal address - -

-

- Fiscal address -

- - - - - - - - - - - - - - -
-
-
- - \ No newline at end of file diff --git a/modules/supplier/front/summary/index.js b/modules/supplier/front/summary/index.js deleted file mode 100644 index a828379bc..000000000 --- a/modules/supplier/front/summary/index.js +++ /dev/null @@ -1,30 +0,0 @@ -import ngModule from '../module'; -import Summary from 'salix/components/summary'; -import './style.scss'; - -class Controller extends Summary { - $onChanges() { - if (!this.supplier) - return; - - this.getSummary(); - } - - get isAdministrative() { - return this.aclService.hasAny(['administrative']); - } - - getSummary() { - return this.$http.get(`Suppliers/${this.supplier.id}/getSummary`).then(response => { - this.summary = response.data; - }); - } -} - -ngModule.vnComponent('vnSupplierSummary', { - template: require('./index.html'), - controller: Controller, - bindings: { - supplier: '<' - } -}); diff --git a/modules/supplier/front/summary/index.spec.js b/modules/supplier/front/summary/index.spec.js deleted file mode 100644 index aa44cd14f..000000000 --- a/modules/supplier/front/summary/index.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -import './index'; - -describe('Supplier', () => { - describe('Component vnSupplierSummary', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(ngModule('supplier')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnSupplierSummary', {$element, $scope}); - })); - - describe('getSummary()', () => { - it('should perform a get asking for the supplier data', () => { - controller.supplier = {id: 1}; - - const query = `Suppliers/${controller.supplier.id}/getSummary`; - - $httpBackend.expectGET(query).respond({id: 1}); - controller.getSummary(); - $httpBackend.flush(); - - expect(controller.summary).toEqual({id: 1}); - }); - }); - }); -}); diff --git a/modules/supplier/front/summary/locale/es.yml b/modules/supplier/front/summary/locale/es.yml deleted file mode 100644 index 35291e579..000000000 --- a/modules/supplier/front/summary/locale/es.yml +++ /dev/null @@ -1,12 +0,0 @@ -Verified: Verificado -Country: País -Tax number: NIF / CIF -Search suppliers by id, name or alias: Busca proveedores por id, nombre o alias -Is Farmer: Es agrícola -Sage tax type: Tipo de impuesto Sage -Sage transaction type: Tipo de transacción Sage -Sage withholding: Retencion Sage -Go to the supplier: Ir al proveedor -Responsible: Responsable -Supplier activity: Actividad proveedor -Healt register: Pasaporte sanitario \ No newline at end of file diff --git a/modules/supplier/front/summary/style.scss b/modules/supplier/front/summary/style.scss deleted file mode 100644 index 1eb6b2323..000000000 --- a/modules/supplier/front/summary/style.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "variables"; - -vn-client-summary { - .alert span { - color: $color-alert - } -} \ No newline at end of file From 7f278269a5b4e3d48910a9c71c417cc0a52c34cb Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Jun 2024 14:28:55 +0200 Subject: [PATCH 02/41] feat(AccessToken&ACL): refs #7547 upgrade security --- back/methods/vn-token/killSession.js | 29 +++++++++++++++++++ back/model-config.json | 3 ++ back/models/vn-token.js | 5 ++++ back/models/vn-token.json | 22 ++++++++++++++ .../11112-blackRose/00-firstScript.sql | 13 +++++++++ modules/account/front/connections/index.html | 4 +-- modules/account/front/connections/index.js | 4 +-- 7 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 back/methods/vn-token/killSession.js create mode 100644 back/models/vn-token.js create mode 100644 back/models/vn-token.json create mode 100644 db/versions/11112-blackRose/00-firstScript.sql diff --git a/back/methods/vn-token/killSession.js b/back/methods/vn-token/killSession.js new file mode 100644 index 000000000..23d02bfc2 --- /dev/null +++ b/back/methods/vn-token/killSession.js @@ -0,0 +1,29 @@ +module.exports = Self => { + Self.remoteMethodCtx('killSession', { + description: 'Kill session', + accepts: [{ + arg: 'userId', + type: 'integer', + description: 'The user id', + required: true, + }, { + arg: 'created', + type: 'date', + description: 'The created time', + required: true, + }], + accessType: 'WRITE', + http: { + path: `/killSession`, + verb: 'POST' + } + }); + + Self.killSession = async function(ctx, userId, created) { + await Self.app.models.VnUser.userSecurity(ctx, ctx.req.accessToken.userId); + const tokens = await Self.app.models.AccessToken.find({where: {userId, created}}); + if (!tokens?.length) return; + for (const token of tokens) + await Self.app.models.AccessToken.deleteById(token.id); + }; +}; diff --git a/back/model-config.json b/back/model-config.json index b643ab54f..c956e96e5 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -166,6 +166,9 @@ "ViaexpressConfig": { "dataSource": "vn" }, + "VnToken": { + "dataSource": "vn" + }, "VnUser": { "dataSource": "vn" }, diff --git a/back/models/vn-token.js b/back/models/vn-token.js new file mode 100644 index 000000000..03d45dae2 --- /dev/null +++ b/back/models/vn-token.js @@ -0,0 +1,5 @@ +const vnModel = require('vn-loopback/common/models/vn-model'); +module.exports = function(Self) { + vnModel(Self); + require('../methods/vn-token/killSession')(Self); +}; diff --git a/back/models/vn-token.json b/back/models/vn-token.json new file mode 100644 index 000000000..fab8965d6 --- /dev/null +++ b/back/models/vn-token.json @@ -0,0 +1,22 @@ +{ + "name": "VnToken", + "base": "AccessToken", + "options": { + "mysql": { + "table": "salix.AccessToken" + } + }, + "properties": { + "created": { + "type": "date" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "userId" + } + }, + "hidden": ["id"] +} diff --git a/db/versions/11112-blackRose/00-firstScript.sql b/db/versions/11112-blackRose/00-firstScript.sql new file mode 100644 index 000000000..c26149240 --- /dev/null +++ b/db/versions/11112-blackRose/00-firstScript.sql @@ -0,0 +1,13 @@ +UPDATE `salix`.`ACL` + SET accessType='READ' + WHERE model = 'ACL'; + +UPDATE `salix`.`ACL` + SET principalId='developerBoss' + WHERE model = 'AccessToken'; + +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('VnToken', '*', 'READ', 'ALLOW', 'ROLE', 'developer'), + ('VnToken', 'killSession', '*', 'ALLOW', 'ROLE', 'developer'), + ('ACL', '*', 'WRITE', 'ALLOW', 'ROLE', 'developerBoss'); diff --git a/modules/account/front/connections/index.html b/modules/account/front/connections/index.html index d634b7a9f..b98fbf5a8 100644 --- a/modules/account/front/connections/index.html +++ b/modules/account/front/connections/index.html @@ -1,6 +1,6 @@ @@ -42,4 +42,4 @@ ng-click="model.refresh()" vn-bind="r" fixed-bottom-right> - \ No newline at end of file + diff --git a/modules/account/front/connections/index.js b/modules/account/front/connections/index.js index c4ddd5615..236174c63 100644 --- a/modules/account/front/connections/index.js +++ b/modules/account/front/connections/index.js @@ -16,8 +16,8 @@ export default class Controller extends Section { }; } - onDisconnect(row) { - return this.$http.delete(`AccessTokens/${row.id}`) + onDisconnect({created, userId}) { + return this.$http.post(`VnTokens/killSession`, {created, userId}) .then(() => this.$.model.refresh()) .then(() => this.vnApp.showSuccess(this.$t('Session killed'))); } From 2064107897592413be6bdabc6e1479ab7dbdaf8f Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 4 Jul 2024 15:25:21 +0000 Subject: [PATCH 03/41] feat(salix): #7671 define isDestiny field in model --- back/models/warehouse.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/back/models/warehouse.json b/back/models/warehouse.json index 54006130b..9267900a5 100644 --- a/back/models/warehouse.json +++ b/back/models/warehouse.json @@ -25,6 +25,9 @@ "isManaged": { "type": "boolean" }, + "isDestiny": { + "type": "boolean" + }, "countryFk": { "type": "number" } From ea626821fc410e29ae5aac56ffb416c4613308e6 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 11 Jul 2024 06:17:19 +0200 Subject: [PATCH 04/41] feat(ssalix): refs #7671 #7671 checkDates --- modules/item/back/methods/fixed-price/filter.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js index 9c91886c1..5580dfecf 100644 --- a/modules/item/back/methods/fixed-price/filter.js +++ b/modules/item/back/methods/fixed-price/filter.js @@ -137,6 +137,7 @@ module.exports = Self => { SELECT fp.id, fp.itemFk, fp.warehouseFk, + w.name as warehouseName, fp.rate2, fp.rate3, fp.started, @@ -160,6 +161,7 @@ module.exports = Self => { FROM priceFixed fp JOIN item i ON i.id = fp.itemFk JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON fp.warehouseFk = w.id `); if (ctx.args.tags) { @@ -183,6 +185,11 @@ module.exports = Self => { } } } + if (ctx.req.query.showBadDates === 'true') { + stmt.merge({ + sql: `WHERE + fp.started< fp.ended `}); + } stmt.merge(conn.makeSuffix(filter)); From 9c5f38648ab84a1e6c5363d4ce8d1aa088124420 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 12 Jul 2024 00:24:26 +0200 Subject: [PATCH 05/41] feat(ssalix): refs #7671 #7671 checkDates to present --- modules/item/back/methods/fixed-price/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js index 5580dfecf..0dde9da99 100644 --- a/modules/item/back/methods/fixed-price/filter.js +++ b/modules/item/back/methods/fixed-price/filter.js @@ -188,7 +188,7 @@ module.exports = Self => { if (ctx.req.query.showBadDates === 'true') { stmt.merge({ sql: `WHERE - fp.started< fp.ended `}); + fp.started> util.VN_CURDATE() `}); } stmt.merge(conn.makeSuffix(filter)); From 9340d474852b40355da18e0a027c52035aee8f5c Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 19 Jul 2024 09:53:41 +0200 Subject: [PATCH 06/41] test: fix connections e2e --- e2e/paths/14-account/04_acl.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/14-account/04_acl.spec.js b/e2e/paths/14-account/04_acl.spec.js index ce2a63b14..180e35e68 100644 --- a/e2e/paths/14-account/04_acl.spec.js +++ b/e2e/paths/14-account/04_acl.spec.js @@ -8,7 +8,7 @@ describe('Account ACL path', () => { beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('developer', 'account'); + await page.loginAndModule('developerBoss', 'account'); await page.accessToSection('account.acl'); }); From 77fd3e7f460b96eb19f4fdb1e1008dfa24720728 Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 3 Sep 2024 14:42:07 +0200 Subject: [PATCH 07/41] feat: refs #7898 Add column "floor" in vn.parking --- db/versions/11211-greenCataractarum/00-firstScript.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/versions/11211-greenCataractarum/00-firstScript.sql diff --git a/db/versions/11211-greenCataractarum/00-firstScript.sql b/db/versions/11211-greenCataractarum/00-firstScript.sql new file mode 100644 index 000000000..55b73925c --- /dev/null +++ b/db/versions/11211-greenCataractarum/00-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.parking ADD COLUMN floor VARCHAR(5) DEFAULT '--' AFTER row; From 75be124e1f9e600d74b509cb3d22e7f417c79681 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 4 Sep 2024 14:14:12 +0200 Subject: [PATCH 08/41] feat: refs #7929 create table material --- .../11213-aquaCarnation/00-firstScript.sql | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 db/versions/11213-aquaCarnation/00-firstScript.sql diff --git a/db/versions/11213-aquaCarnation/00-firstScript.sql b/db/versions/11213-aquaCarnation/00-firstScript.sql new file mode 100644 index 000000000..3067ce06e --- /dev/null +++ b/db/versions/11213-aquaCarnation/00-firstScript.sql @@ -0,0 +1,253 @@ + +use vn; + +CREATE TABLE IF NOT EXISTS `material` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT IGNORE INTO `material` (`name`) VALUES ('Abedul'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acacia'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acero'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acero Galvanizado'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acetato'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Acrílico'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Alambre'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Algodón'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Aluminio'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Antracita'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Arcilla'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Bambú'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Banano'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Canneté'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cartón'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cartulina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Celofán'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cemento'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cera'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cerámica'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Chapa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Chenilla'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cloruro de polivinilo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cobre'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Corcho'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cordel'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cotton Chess'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cristal'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cubo Asa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cuerda'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Cuero'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Raso'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Doble Velvet'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Eco Glass'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Encaje'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Esparto'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Espuma'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Felpa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Coco'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fibra de Vidrio y Resina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Fieltro'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Foam'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Gamuza'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Gasa'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Glass'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Goma'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Grafito'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hierro'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja Carbono'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hoja de Mirto'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Hormigón'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Jute'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Kraft'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lana'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Látex'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Latrix'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lienzo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lino'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Lurex'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Madera'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Metacrilato'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Metal'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Mimbre'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Musgo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Nonwoven'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Nylon'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Organza'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Paja'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Pana'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Papel'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Paperweb'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Paulownia'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Peluche'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Piedra'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Pizarra'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Plástico'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Poliestireno'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Polipropileno'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Poliresina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Polyester'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Porcelana'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Puntilla'); +INSERT IGNORE INTO `material` (`name`) VALUES ('PVC'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rafia'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rama'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Raso'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rattan'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rayon'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Reciclable'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Red'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Resina'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Roca'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Rope'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Saco'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Salim'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Seagrass'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Silicona'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Sisal'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Tejido'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Tela'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Terciopelo'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Terracota'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Textil'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Titanio'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Tul'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Velvet'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Vidrio'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Yute'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Zinc'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Base de goma'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Base de madera'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Plumas'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Protección Uva'); +INSERT IGNORE INTO `material` (`name`) VALUES ('Purpurina'); + +CREATE TABLE IF NOT EXISTS `secondaryMaterial` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Abedul'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acacia'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero Galvanizado'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acetato'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acrílico'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Alambre'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Algodón'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Aluminio'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Antracita'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Arcilla'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Bambú'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Banano'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Canneté'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartón'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartulina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Celofán'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cemento'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cera'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cerámica'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chapa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chenilla'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cloruro de polivinilo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cobre'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Corcho'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cordel'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton Chess'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cristal'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cubo Asa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuerda'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuero'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Raso'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Velvet'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Eco Glass'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Encaje'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Esparto'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Espuma'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Felpa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Coco'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Vidrio y Resina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fieltro'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Foam'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gamuza'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gasa'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Glass'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Goma'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Grafito'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hierro'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja Carbono'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja de Mirto'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hormigón'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Jute'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Kraft'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lana'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Látex'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Latrix'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lienzo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lino'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lurex'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Madera'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metacrilato'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metal'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Mimbre'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Musgo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nonwoven'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nylon'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Organza'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paja'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pana'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Papel'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paperweb'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paulownia'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Peluche'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Piedra'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pizarra'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plástico'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliestireno'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polipropileno'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliresina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polyester'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Porcelana'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Puntilla'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('PVC'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rafia'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rama'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Raso'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rattan'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rayon'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Reciclable'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Red'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Resina'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Roca'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rope'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Saco'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Salim'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Seagrass'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Silicona'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Sisal'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tejido'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tela'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terciopelo'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terracota'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Textil'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Titanio'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tul'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Velvet'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Vidrio'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Yute'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Zinc'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de goma'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de madera'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plumas'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Protección Uva'); +INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Purpurina'); + +UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name= 'Material'; +UPDATE vn.tag SET isFree=0,sourceTable='secondaryMaterial' WHERE name='Material secundario'; \ No newline at end of file From 684658bb966766ad0a3d7bd5175a3ab7709e38a2 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 5 Sep 2024 14:25:50 +0200 Subject: [PATCH 09/41] feat: refs #7929 quitar codigo --- .../11213-aquaCarnation/00-firstScript.sql | 126 +----------------- 1 file changed, 1 insertion(+), 125 deletions(-) diff --git a/db/versions/11213-aquaCarnation/00-firstScript.sql b/db/versions/11213-aquaCarnation/00-firstScript.sql index 3067ce06e..b23a6c782 100644 --- a/db/versions/11213-aquaCarnation/00-firstScript.sql +++ b/db/versions/11213-aquaCarnation/00-firstScript.sql @@ -125,129 +125,5 @@ INSERT IGNORE INTO `material` (`name`) VALUES ('Plumas'); INSERT IGNORE INTO `material` (`name`) VALUES ('Protección Uva'); INSERT IGNORE INTO `material` (`name`) VALUES ('Purpurina'); -CREATE TABLE IF NOT EXISTS `secondaryMaterial` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(50) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Abedul'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acacia'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acero Galvanizado'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acetato'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Acrílico'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Alambre'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Algodón'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Aluminio'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Antracita'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Arcilla'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Bambú'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Banano'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Canneté'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartón'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cartulina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Celofán'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cemento'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cera'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cerámica'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chapa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Chenilla'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cloruro de polivinilo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cobre'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Corcho'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cordel'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cotton Chess'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cristal'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cubo Asa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuerda'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Cuero'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Raso'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Doble Velvet'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Eco Glass'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Encaje'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Esparto'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Espuma'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Felpa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Coco'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fibra de Vidrio y Resina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Fieltro'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Foam'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gamuza'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Gasa'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Glass'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Goma'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Grafito'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hierro'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja Carbono'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hoja de Mirto'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Hormigón'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Jute'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Kraft'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lana'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Látex'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Latrix'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lienzo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lino'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Lurex'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Madera'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metacrilato'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Metal'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Mimbre'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Musgo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nonwoven'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Nylon'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Organza'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paja'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pana'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Papel'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paperweb'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Paulownia'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Peluche'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Piedra'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Pizarra'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plástico'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliestireno'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polipropileno'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Poliresina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Polyester'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Porcelana'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Puntilla'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('PVC'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rafia'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rama'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Raso'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rattan'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rayon'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Reciclable'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Red'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Resina'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Roca'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Rope'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Saco'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Salim'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Seagrass'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Silicona'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Sisal'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tejido'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tela'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terciopelo'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Terracota'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Textil'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Titanio'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Tul'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Velvet'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Vidrio'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Yute'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Zinc'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de goma'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Base de madera'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Plumas'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Protección Uva'); -INSERT IGNORE INTO `secondaryMaterial` (`name`) VALUES ('Purpurina'); - UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name= 'Material'; -UPDATE vn.tag SET isFree=0,sourceTable='secondaryMaterial' WHERE name='Material secundario'; \ No newline at end of file +UPDATE vn.tag SET isFree=0,sourceTable='material' WHERE name='Material secundario'; \ No newline at end of file From 3e4caa8edf5f4633aedaa7bb591bb15549113d26 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 5 Sep 2024 14:38:55 +0200 Subject: [PATCH 10/41] feat: refs #7929 autoincrement 1 --- db/versions/11213-aquaCarnation/00-firstScript.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/11213-aquaCarnation/00-firstScript.sql b/db/versions/11213-aquaCarnation/00-firstScript.sql index b23a6c782..9e744b66c 100644 --- a/db/versions/11213-aquaCarnation/00-firstScript.sql +++ b/db/versions/11213-aquaCarnation/00-firstScript.sql @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `material` ( `name` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; INSERT IGNORE INTO `material` (`name`) VALUES ('Abedul'); INSERT IGNORE INTO `material` (`name`) VALUES ('Acacia'); From a7bc58a5bc6374e9c9227ff9ab376a7ea0e332dd Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 5 Sep 2024 14:45:17 +0200 Subject: [PATCH 11/41] fix: refs #7931 Immediately discount order lines from available --- .../cache/procedures/available_refresh.sql | 7 +++++- .../cache/procedures/available_updateItem.sql | 23 +++++++++++++++++++ .../hedera/procedures/order_addItem.sql | 10 ++++---- 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 db/routines/cache/procedures/available_updateItem.sql diff --git a/db/routines/cache/procedures/available_refresh.sql b/db/routines/cache/procedures/available_refresh.sql index abf023a41..87c003648 100644 --- a/db/routines/cache/procedures/available_refresh.sql +++ b/db/routines/cache/procedures/available_refresh.sql @@ -1,5 +1,10 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDated` DATE) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refresh`( + OUT `vCalc` INT, + `vRefresh` INT, + `vWarehouse` INT, + `vDated` DATE +) proc: BEGIN DECLARE vStartDate DATE; DECLARE vReserveDate DATETIME; diff --git a/db/routines/cache/procedures/available_updateItem.sql b/db/routines/cache/procedures/available_updateItem.sql new file mode 100644 index 000000000..347eaa137 --- /dev/null +++ b/db/routines/cache/procedures/available_updateItem.sql @@ -0,0 +1,23 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_updateItem`( + `vItem` INT, + `vWarehouse` INT, + `vDated` DATE, + `vQuantity` INT +) +BEGIN + DECLARE vCalc INT; + + SELECT id INTO vCalc FROM cache_calc + WHERE cacheName = 'available' + AND params = CONCAT_WS('/', vWarehouse, vDated) + AND last_refresh <= NOW(); + + IF vCalc IS NOT NULL THEN + UPDATE available + SET available = available - vQuantity + WHERE calc_id = vCalc + AND item_id = vItem; + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/hedera/procedures/order_addItem.sql b/db/routines/hedera/procedures/order_addItem.sql index f690f9aa6..204dcb6bf 100644 --- a/db/routines/hedera/procedures/order_addItem.sql +++ b/db/routines/hedera/procedures/order_addItem.sql @@ -1,8 +1,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_addItem`( vSelf INT, - vWarehouse INT, - vItem INT, + vWarehouse INT, + vItem INT, vAmount INT) BEGIN /** @@ -37,7 +37,7 @@ BEGIN ROLLBACK; RESIGNAL; END; - + CALL order_calcCatalogFromItem(vSelf, vItem); START TRANSACTION; @@ -102,6 +102,8 @@ BEGIN amount = vAdd, price = vPrice; + CALL cache.available_updateItem(vItem, vWarehouse, vShipment, vAdd); + SET vRow = LAST_INSERT_ID(); INSERT INTO orderRowComponent (rowFk, componentFk, price) @@ -121,6 +123,6 @@ BEGIN END IF; COMMIT; - CALL vn.ticketCalculatePurge; + CALL vn.ticketCalculatePurge; END$$ DELIMITER ; From c1e086072b7c95addf1d40f08321444f386f1868 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 5 Sep 2024 14:50:36 +0200 Subject: [PATCH 12/41] fix: refs #7524 load after get client --- modules/client/front/balance/create/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 9113d7605..f4ff0e3aa 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -23,6 +23,7 @@ class Controller extends Dialog { } set clientFk(value) { + if (!value) return; this.receipt.clientFk = value; const filter = { @@ -32,6 +33,7 @@ class Controller extends Dialog { } }; + this.getAmountPaid(); this.$http.get(`Clients/findOne`, {filter}) .then(res => { this.receipt.email = res.data.email; @@ -50,7 +52,6 @@ class Controller extends Dialog { set companyFk(value) { this.receipt.companyFk = value; - this.getAmountPaid(); } set description(value) { @@ -152,7 +153,7 @@ class Controller extends Dialog { getAmountPaid() { const filter = { where: { - clientFk: this.$params.id, + clientFk: this.$params.id ?? this.clientFk, companyFk: this.receipt.companyFk } }; @@ -210,8 +211,8 @@ ngModule.vnComponent('vnClientBalanceCreate', { payed: ' Date: Thu, 5 Sep 2024 15:47:45 +0200 Subject: [PATCH 13/41] fix: refs #7524 add fixture orm config --- db/dump/fixtures.before.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 769c081c5..9f590233f 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3953,3 +3953,7 @@ VALUES (4, 'Referencia Transferencias', 'trnRef'), (5, 'Referencia Nominas', 'payRef'), (6, 'ABA', 'aba'); + +INSERT INTO vn.ormConfig SET + id = 1, + selectLimit = 1000; \ No newline at end of file From ac8b101455db4ce37707aeb5c99ab77a169f2e38 Mon Sep 17 00:00:00 2001 From: ivanm Date: Thu, 5 Sep 2024 17:05:48 +0200 Subject: [PATCH 14/41] feat: refs #7898 Modify default --- db/versions/11211-greenCataractarum/00-firstScript.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/11211-greenCataractarum/00-firstScript.sql b/db/versions/11211-greenCataractarum/00-firstScript.sql index 55b73925c..c9ba73479 100644 --- a/db/versions/11211-greenCataractarum/00-firstScript.sql +++ b/db/versions/11211-greenCataractarum/00-firstScript.sql @@ -1 +1 @@ -ALTER TABLE vn.parking ADD COLUMN floor VARCHAR(5) DEFAULT '--' AFTER row; +ALTER TABLE vn.parking ADD COLUMN floor VARCHAR(5) DEFAULT NULL AFTER row; From 747e6a562a218c4e123dc9616b5ab28eea6150ef Mon Sep 17 00:00:00 2001 From: ivanm Date: Fri, 6 Sep 2024 08:51:41 +0200 Subject: [PATCH 15/41] feat: refs #7747 Delete buyUltimate and buyUltimateFromInterval --- .../cache/procedures/last_buy_refresh.sql | 2 +- db/routines/vn/procedures/buyUltimate.sql | 18 ----------------- .../vn/procedures/buyUltimateFromInterval.sql | 20 ------------------- 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 db/routines/vn/procedures/buyUltimate.sql delete mode 100644 db/routines/vn/procedures/buyUltimateFromInterval.sql diff --git a/db/routines/cache/procedures/last_buy_refresh.sql b/db/routines/cache/procedures/last_buy_refresh.sql index 555ae0b8d..86a5e8d8c 100644 --- a/db/routines/cache/procedures/last_buy_refresh.sql +++ b/db/routines/cache/procedures/last_buy_refresh.sql @@ -4,7 +4,7 @@ proc: BEGIN /** * Crea o actualiza la cache con la última compra y fecha de cada * artículo hasta ayer. Para obtener la última compra hasta una fecha - * determinada utilizar el procedimiento vn.buyUltimate(). + * determinada utilizar el procedimiento vn.buy_getUltimate(). * * @param vRefresh %TRUE para forzar el recálculo de la cache */ diff --git a/db/routines/vn/procedures/buyUltimate.sql b/db/routines/vn/procedures/buyUltimate.sql deleted file mode 100644 index 37d4312f6..000000000 --- a/db/routines/vn/procedures/buyUltimate.sql +++ /dev/null @@ -1,18 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buyUltimate`( - vWarehouseFk SMALLINT, - vDated DATE -) -BEGIN -/** - * @deprecated Usar buy_getUltimate - * Calcula las últimas compras realizadas hasta una fecha. - * - * @param vItemFk Id del artículo - * @param vWarehouseFk Id del almacén - * @param vDated Compras hasta fecha - * @return tmp.buyUltimate - */ - CALL buy_getUltimate(NULL, vWarehouseFk, vDated); -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/buyUltimateFromInterval.sql b/db/routines/vn/procedures/buyUltimateFromInterval.sql deleted file mode 100644 index 08450470c..000000000 --- a/db/routines/vn/procedures/buyUltimateFromInterval.sql +++ /dev/null @@ -1,20 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buyUltimateFromInterval`( - vWarehouseFk SMALLINT, - vStarted DATE, - vEnded DATE -) -BEGIN -/** - * @deprecated Usar buy_getUltimateFromInterval - * Calcula las últimas compras realizadas - * desde un rango de fechas. - * - * @param vWarehouseFk Id del almacén si es NULL se actualizan todos - * @param vStarted Fecha inicial - * @param vEnded Fecha fin - * @return tmp.buyUltimateFromInterval - */ - CALL vn.buy_getUltimateFromInterval(NULL, vWarehouseFk, vStarted, vEnded); -END$$ -DELIMITER ; From 640b45ed995a3e75fadcf3f3931438553f55d7bc Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 09:06:00 +0200 Subject: [PATCH 16/41] fix: refs #7931 Apply PR change requests --- .../cache/procedures/available_updateItem.sql | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/db/routines/cache/procedures/available_updateItem.sql b/db/routines/cache/procedures/available_updateItem.sql index 347eaa137..8e94a9d75 100644 --- a/db/routines/cache/procedures/available_updateItem.sql +++ b/db/routines/cache/procedures/available_updateItem.sql @@ -6,12 +6,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_update `vQuantity` INT ) BEGIN +/** + * Immediately deduct/add an amount from the available cache (if exists). + * + * @param vItem The item id + * @param vWarehouse The warehouse id + * @param vDated Available cache date + * @param vQuantity The amount to be deducted from the cache + */ DECLARE vCalc INT; - SELECT id INTO vCalc FROM cache_calc + SELECT id INTO vCalc + FROM cache_calc WHERE cacheName = 'available' - AND params = CONCAT_WS('/', vWarehouse, vDated) - AND last_refresh <= NOW(); + AND params = CONCAT_WS('/', vWarehouse, vDated); IF vCalc IS NOT NULL THEN UPDATE available From 78a851336fe14918b8d390225e45c6a13bab0511 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 09:11:20 +0200 Subject: [PATCH 17/41] chore: refs #7323 worker changes wip --- db/dump/fixtures.before.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 56450b27c..cdc60981d 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -108,6 +108,7 @@ INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`) UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20; UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9; UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18; +UPDATE `vn`.`worker` SET bossFk = 50 WHERE id = 49; DELETE FROM `vn`.`worker` WHERE firstName ='customer'; From 48f94140e265cadc274833ef0004dfae66b73273 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 09:16:22 +0200 Subject: [PATCH 18/41] fix: refs #7931 Back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index 61bf6b3e7..f068a3a32 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => { const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(185); + expect(result.available).toEqual(175); expect(result.visible).toEqual(92); await tx.rollback(); From 46a4b577ce911c06ebb3eb252b8508ecb606c60d Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 6 Sep 2024 10:07:46 +0200 Subject: [PATCH 19/41] feat: refs #7277 test with warehouse --- .../methods/invoiceOut/refundAndInvoice.js | 8 +++- .../invoiceOut/specs/refundAndInvoice.spec.js | 39 ++++++++++++++++++- .../back/methods/invoiceOut/transfer.js | 1 + 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/refundAndInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/refundAndInvoice.js index 7c7788459..41a645ff3 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/refundAndInvoice.js +++ b/modules/invoiceOut/back/methods/invoiceOut/refundAndInvoice.js @@ -9,6 +9,11 @@ module.exports = Self => { required: true, description: 'Issued invoice id' }, + { + arg: 'withWarehouse', + type: 'boolean', + required: true + }, { arg: 'cplusRectificationTypeFk', type: 'number', @@ -38,6 +43,7 @@ module.exports = Self => { Self.refundAndInvoice = async( ctx, id, + withWarehouse, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk, @@ -59,7 +65,7 @@ module.exports = Self => { try { const originalInvoice = await models.InvoiceOut.findById(id, myOptions); - const refundedTickets = await Self.refund(ctx, originalInvoice.ref, false, myOptions); + const refundedTickets = await Self.refund(ctx, originalInvoice.ref, withWarehouse, myOptions); const invoiceCorrection = { correctedFk: id, diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/refundAndInvoice.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/refundAndInvoice.spec.js index c54ae5f6c..ed15fb404 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/refundAndInvoice.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/refundAndInvoice.spec.js @@ -14,14 +14,16 @@ describe('InvoiceOut refundAndInvoice()', () => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: activeCtx}); }); - it('should refund an invoice and create a new invoice', async() => { + it('should refund an invoice and create a new invoice with warehouse', async() => { const tx = await models.InvoiceOut.beginTransaction({}); const options = {transaction: tx}; + const withWarehouse = true; try { const result = await models.InvoiceOut.refundAndInvoice( ctx, id, + withWarehouse, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk, @@ -32,7 +34,40 @@ describe('InvoiceOut refundAndInvoice()', () => { expect(result.refundId).toBeDefined(); const invoicesAfter = await models.InvoiceOut.find({where: {id: result.refundId}}, options); - const ticketsAfter = await models.Ticket.find({where: {refFk: 'R10100001'}}, options); + const ticketsAfter = await models.Ticket.find( + {where: {refFk: 'R10100001', warehouse: {neq: null}}}, options); + + expect(invoicesAfter.length).toBeGreaterThan(0); + expect(ticketsAfter.length).toBeGreaterThan(0); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should refund an invoice and create a new invoice with warehouse null', async() => { + const tx = await models.InvoiceOut.beginTransaction({}); + const options = {transaction: tx}; + const withWarehouse = false; + + try { + const result = await models.InvoiceOut.refundAndInvoice( + ctx, + id, + withWarehouse, + cplusRectificationTypeFk, + siiTypeInvoiceOutFk, + invoiceCorrectionTypeFk, + options + ); + + expect(result).toBeDefined(); + expect(result.refundId).toBeDefined(); + + const invoicesAfter = await models.InvoiceOut.find({where: {id: result.refundId}}, options); + const ticketsAfter = await models.Ticket.find({where: {refFk: 'R10100001', warehouse: null}}, options); expect(invoicesAfter.length).toBeGreaterThan(0); expect(ticketsAfter.length).toBeGreaterThan(0); diff --git a/modules/invoiceOut/back/methods/invoiceOut/transfer.js b/modules/invoiceOut/back/methods/invoiceOut/transfer.js index 954adf780..aa5c0d9d2 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/transfer.js +++ b/modules/invoiceOut/back/methods/invoiceOut/transfer.js @@ -75,6 +75,7 @@ module.exports = Self => { await Self.refundAndInvoice( ctx, id, + false, cplusRectificationTypeFk, siiTypeInvoiceOutFk, invoiceCorrectionTypeFk, From 18d93d93a609daf2f215a48cba19ef1c68dce28f Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 10:40:16 +0200 Subject: [PATCH 20/41] chore: refs #7323 worker changes --- .../11215-purpleIvy/00-firstScript.sql | 4 ++ loopback/server/boot/role-resolver.js | 12 ++++++ modules/worker/back/models/worker.json | 40 ++++++++++++++++++- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 db/versions/11215-purpleIvy/00-firstScript.sql create mode 100644 loopback/server/boot/role-resolver.js diff --git a/db/versions/11215-purpleIvy/00-firstScript.sql b/db/versions/11215-purpleIvy/00-firstScript.sql new file mode 100644 index 000000000..ac82b7773 --- /dev/null +++ b/db/versions/11215-purpleIvy/00-firstScript.sql @@ -0,0 +1,4 @@ +-- Place your SQL code here +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES ('Worker', '__get__descriptor', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Worker', 'findById', 'READ', 'ALLOW', 'ROLE', '$subordinate'); \ No newline at end of file diff --git a/loopback/server/boot/role-resolver.js b/loopback/server/boot/role-resolver.js new file mode 100644 index 000000000..cf70abb39 --- /dev/null +++ b/loopback/server/boot/role-resolver.js @@ -0,0 +1,12 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = async function(app) { + const models = app.models; + + models.VnRole.registerResolver('$subordinate', async(role, ctx) => { + Object.assign(ctx, {req: {accessToken: {userId: ctx.accessToken.userId}}}); + + const isSubordinate = await models.Worker.isSubordinate(ctx, +ctx.modelId); + if (!isSubordinate) throw new UserError(`You don't have enough privileges`); + }); +}; diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 855d77e39..b809768a4 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -140,5 +140,41 @@ "principalType": "ROLE", "principalId": "$owner" } - ] -} + ], + "scopes": { + "descriptor": { + "include": [ + { + "relation": "user", + "scope": { + "fields": [ + "name", + "nickname" + ], + "include": { + "relation": "emailUser", + "scope": { + "fields": [ + "email" + ] + } + } + } + }, + { + "relation": "department", + "scope": { + "include": [ + { + "relation": "department" + } + ] + } + }, + { + "relation": "sip" + } + ] + } + } +} \ No newline at end of file From d44dec3703dca6f6182ce9cdbf20dfdc07a5a52c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 11:25:49 +0200 Subject: [PATCH 21/41] fix: refs #7931 Back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index f068a3a32..61bf6b3e7 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => { const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(175); + expect(result.available).toEqual(185); expect(result.visible).toEqual(92); await tx.rollback(); From 382e54b57220c36c2e29065986cb3fbf0f78999f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 11:30:43 +0200 Subject: [PATCH 22/41] fix: refs #7931 Back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index 61bf6b3e7..f068a3a32 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -12,7 +12,7 @@ describe('item getVisibleAvailable()', () => { const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(185); + expect(result.available).toEqual(175); expect(result.visible).toEqual(92); await tx.rollback(); From d10db686e536df72cb982b8d811702f5425c4b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 6 Sep 2024 12:52:24 +0200 Subject: [PATCH 23/41] fix: refs #7346 ticket_close serial --- db/routines/vn/procedures/ticket_close.sql | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/ticket_close.sql b/db/routines/vn/procedures/ticket_close.sql index 97da5057c..f8bbe239b 100644 --- a/db/routines/vn/procedures/ticket_close.sql +++ b/db/routines/vn/procedures/ticket_close.sql @@ -17,6 +17,7 @@ BEGIN DECLARE vHasDailyInvoice BOOL; DECLARE vWithPackage BOOL; DECLARE vHasToInvoice BOOL; + DECLARE vSerial VARCHAR(2); DECLARE cur CURSOR FOR SELECT ticketFk FROM tmp.ticket_close; @@ -83,14 +84,17 @@ BEGIN GROUP BY e.freightItemFk); IF(vHasDailyInvoice) AND vHasToInvoice THEN + SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial; + IF NOT vSerial THEN + CALL util.throw('Cannot booking without a serial'); + END IF; - -- Facturacion rapida CALL ticket_setState(vCurTicketFk, 'DELIVERED'); - -- Facturar si está contabilizado + IF vIsTaxDataChecked THEN CALL invoiceOut_newFromClient( vClientFk, - (SELECT invoiceSerial(vClientFk, vCompanyFk, 'multiple')), + vSerial, vShipped, vCompanyFk, NULL, From e2c6a4575610e89c29cc32e9e6718af45189befb Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 12:57:57 +0200 Subject: [PATCH 24/41] fix: refs #7931 Available back test fix --- .../item/back/methods/item/specs/getVisibleAvailable.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js index f068a3a32..adf9b7f76 100644 --- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js +++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('item getVisibleAvailable()', () => { - it('should check available visible for today', async() => { + it('should check available visible for tomorrow', async() => { const tx = await models.Item.beginTransaction({}); const options = {transaction: tx}; @@ -9,10 +9,11 @@ describe('item getVisibleAvailable()', () => { const itemFk = 1; const warehouseFk = 1; const dated = Date.vnNew(); + dated.setDate(dated.getDate() + 1); const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options); - expect(result.available).toEqual(175); + expect(result.available).toEqual(185); expect(result.visible).toEqual(92); await tx.rollback(); From 0ad4d3a9592dcb8283b3f25ffd39f8c2bcfbdc3b Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 6 Sep 2024 13:50:49 +0200 Subject: [PATCH 25/41] feat: refs #7905 getBuysCsv --- loopback/util/flatten.js | 42 ++++++++++++++++++ .../entry/back/methods/entry/getBuysCsv.js | 44 +++++++++++++++++++ modules/entry/back/models/entry.js | 1 + 3 files changed, 87 insertions(+) create mode 100644 loopback/util/flatten.js create mode 100644 modules/entry/back/methods/entry/getBuysCsv.js diff --git a/loopback/util/flatten.js b/loopback/util/flatten.js new file mode 100644 index 000000000..18d682d1f --- /dev/null +++ b/loopback/util/flatten.js @@ -0,0 +1,42 @@ +/** + * Flattens an array of objects by converting each object into a flat structure. + * + * @param {Array} dataArray Array of objects to be flattened + * @return {Array} Array of flattened objects + */ +function flatten(dataArray) { + return dataArray.map(item => flattenObj(item.__data)); +} + +/** + * Recursively flattens an object, converting nested properties into a single level object + * with keys representing the original nested structure. + * + * @param {Object} data The object to be flattened + * @param {String} [prefix=''] Optional prefix for nested keys + * @return {Object} Flattened object + */ +function flattenObj(data, prefix = '') { + let result = {}; + try { + for (let key in data) { + if (!data[key]) continue; + + const newKey = prefix ? `${prefix}_${key}` : key; + const value = data[key]; + + if (typeof value === 'object' && value !== null && !Array.isArray(value)) + Object.assign(result, flattenObj(value.__data, newKey)); + else + result[newKey] = value; + } + } catch (error) { + console.error(error); + } + + return result; +} +module.exports = { + flatten, + flattenObj, +}; diff --git a/modules/entry/back/methods/entry/getBuysCsv.js b/modules/entry/back/methods/entry/getBuysCsv.js new file mode 100644 index 000000000..4bd246fa0 --- /dev/null +++ b/modules/entry/back/methods/entry/getBuysCsv.js @@ -0,0 +1,44 @@ +const {toCSV} = require('vn-loopback/util/csv'); +const {flatten} = require('vn-loopback/util/flatten'); +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('getBuysCsv', { + description: 'Returns buys for one entry in CSV file format', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The entry id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/getBuysCsv`, + verb: 'GET' + } + }); + + Self.getBuysCsv = async(ctx, id, options) => { + const data = await Self.getBuys(ctx, id, null, options); + if (!data.length) throw new UserError('The entry has no lines or does not exist'); + const dataFlatted = flatten(data); + return [toCSV(dataFlatted), 'text/csv', `inline; filename="buys-${id}.csv"`]; + }; +}; diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index b11d64415..8ca79f531 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -3,6 +3,7 @@ module.exports = Self => { require('../methods/entry/filter')(Self); require('../methods/entry/getEntry')(Self); require('../methods/entry/getBuys')(Self); + require('../methods/entry/getBuysCsv')(Self); require('../methods/entry/importBuys')(Self); require('../methods/entry/importBuysPreview')(Self); require('../methods/entry/lastItemBuys')(Self); From 37fabc38bd99da9b6d8755fc59306424586b1cb2 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 14:56:14 +0200 Subject: [PATCH 26/41] fix(hedera): refs #7931 PROC order_addItem NULL available fix, translations added --- .../hedera/procedures/order_addItem.sql | 6 +++++- .../11217-greenDracena/00-hederaMessages.sql | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/versions/11217-greenDracena/00-hederaMessages.sql diff --git a/db/routines/hedera/procedures/order_addItem.sql b/db/routines/hedera/procedures/order_addItem.sql index 204dcb6bf..1470ddf35 100644 --- a/db/routines/hedera/procedures/order_addItem.sql +++ b/db/routines/hedera/procedures/order_addItem.sql @@ -47,11 +47,15 @@ BEGIN FROM tmp.zoneGetShipped WHERE warehouseFk = vWarehouse; - SELECT IFNULL(available, 0) INTO vAvailable + SELECT available INTO vAvailable FROM tmp.ticketLot WHERE warehouseFk = vWarehouse AND itemFk = vItem; + IF vAvailable IS NULL THEN + SET vAvailable = 0; + END IF; + IF vAmount > vAvailable THEN CALL util.throw ('ORDER_ROW_UNAVAILABLE'); END IF; diff --git a/db/versions/11217-greenDracena/00-hederaMessages.sql b/db/versions/11217-greenDracena/00-hederaMessages.sql new file mode 100644 index 000000000..f6c9bdce3 --- /dev/null +++ b/db/versions/11217-greenDracena/00-hederaMessages.sql @@ -0,0 +1,19 @@ +INSERT INTO hedera.message (code,description) + VALUES ('ORDER_ROW_UNAVAILABLE','The ordered quantity exceeds the available'); +INSERT INTO hedera.message (code,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','The quantity ordered does not match the grouping'); + +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('ORDER_ROW_UNAVAILABLE','es','La cantidad pedida excede el disponible'); +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','es','La cantidad pedida no coincide con el agrupado'); + +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('ORDER_ROW_UNAVAILABLE','fr','La quantité demandée dépasse ce qui est disponible'); +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','fr','La quantité commandée ne correspond pas au regroupement'); + +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('ORDER_ROW_UNAVAILABLE','pt','A quantidade de entrega excede a disponibilidade'); +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','pt','A quantidade solicitada não corresponde ao agrupamento'); From eb11e18df52000d1ecd45e7d6d01fa4924b6933b Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 16:01:26 +0200 Subject: [PATCH 27/41] fix: refs #7323 fetch from right source --- modules/worker/front/descriptor/index.js | 38 ++---------------------- 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js index 75265acb4..4860163c1 100644 --- a/modules/worker/front/descriptor/index.js +++ b/modules/worker/front/descriptor/index.js @@ -36,42 +36,8 @@ class Controller extends Descriptor { } loadData() { - const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['name', 'emailVerified'], - include: { - relation: 'emailUser', - scope: { - fields: ['email'] - } - } - } - }, { - relation: 'client', - scope: { - fields: ['fi'] - } - }, { - relation: 'sip', - scope: { - fields: ['extension'] - } - }, { - relation: 'department', - scope: { - include: { - relation: 'department' - } - } - } - ] - }; - - return this.getData(`Workers/${this.id}`, {filter}) - .then(res => this.entity = res.data); + return this.getData('Workers/descriptor', {filter: {where: {id: this.id}}}) + .then(res => this.entity = res.data[0]); } getPassRequirements() { From 6065c056e20da91f3f8984f8159cf0d15a2e29fc Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 16:04:40 +0200 Subject: [PATCH 28/41] chore: refs #7323 fix test --- modules/worker/front/descriptor/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/front/descriptor/index.spec.js b/modules/worker/front/descriptor/index.spec.js index 4f7fa6a05..e7eec86d3 100644 --- a/modules/worker/front/descriptor/index.spec.js +++ b/modules/worker/front/descriptor/index.spec.js @@ -17,7 +17,7 @@ describe('vnWorkerDescriptor', () => { const response = 'foo'; $httpBackend.whenGET('UserConfigs/getUserConfig').respond({}); - $httpBackend.expectRoute('GET', `Workers/${id}`).respond(response); + $httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response); controller.id = id; $httpBackend.flush(); From 0a4bd0f2d51f4950b46b67e2fd54ab0d120a825e Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 16:09:29 +0200 Subject: [PATCH 29/41] chore: refs #7323 fix test --- modules/worker/front/descriptor/index.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/front/descriptor/index.spec.js b/modules/worker/front/descriptor/index.spec.js index e7eec86d3..8797c8b4a 100644 --- a/modules/worker/front/descriptor/index.spec.js +++ b/modules/worker/front/descriptor/index.spec.js @@ -14,14 +14,14 @@ describe('vnWorkerDescriptor', () => { describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { const id = 1; - const response = 'foo'; + const response = ['foo']; $httpBackend.whenGET('UserConfigs/getUserConfig').respond({}); $httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response); controller.id = id; $httpBackend.flush(); - expect(controller.worker).toEqual(response); + expect(controller.worker).toEqual(response[0]); }); }); From ba2c5cb209c999baa11d0aa57024900c27f1515e Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 17:49:45 +0200 Subject: [PATCH 30/41] chore: refs #7323 filter data --- modules/worker/back/models/worker.json | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index b809768a4..82cd1cc2d 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -143,6 +143,10 @@ ], "scopes": { "descriptor": { + "fields": [ + "id", + "phone" + ], "include": [ { "relation": "user", @@ -164,15 +168,29 @@ { "relation": "department", "scope": { + "fields": [ + "departmentFk" + ], "include": [ { - "relation": "department" + "relation": "department", + "scope": { + "fields": [ + "id", + "name" + ] + } } ] } }, { - "relation": "sip" + "relation": "sip", + "scope": { + "fields": [ + "extension" + ] + } } ] } From dbd8f945552609cf8dde82a18af48aa1fe33b985 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sun, 8 Sep 2024 12:49:55 +0200 Subject: [PATCH 31/41] perf: refs #7671 improve showBadDates --- db/dump/dump.after.sql | 1 + modules/item/back/methods/fixed-price/filter.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/db/dump/dump.after.sql b/db/dump/dump.after.sql index 7508a36a7..a7de86efc 100644 --- a/db/dump/dump.after.sql +++ b/db/dump/dump.after.sql @@ -1,4 +1,5 @@ CREATE USER 'vn'@'localhost'; +INSERT INTO `ormConfig`(`id`,`selectLimit`) VALUES(1,1000); GRANT SELECT, INSERT, diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js index 838e913bf..f8cbfb5eb 100644 --- a/modules/item/back/methods/fixed-price/filter.js +++ b/modules/item/back/methods/fixed-price/filter.js @@ -186,12 +186,12 @@ module.exports = Self => { } if (ctx.req.query.showBadDates === 'true') { stmt.merge({ - sql: `WHERE - fp.started> util.VN_CURDATE() `}); - } - - stmt.merge(conn.makeSuffix(filter)); - + sql: ` WHERE + fp.started> util.VN_CURDATE() `}); + } else + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); const fixedPriceIndex = stmts.push(stmt) - 1; const sql = ParameterizedSQL.join(stmts, ';'); const result = await conn.executeStmt(sql, myOptions); From 5c4a30f2f9873d7c38c780205e07545a750443fa Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sun, 8 Sep 2024 12:50:32 +0200 Subject: [PATCH 32/41] perf: refs #7671 improve showBadDates --- db/dump/dump.after.sql | 1 - modules/item/back/methods/fixed-price/filter.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/db/dump/dump.after.sql b/db/dump/dump.after.sql index a7de86efc..7508a36a7 100644 --- a/db/dump/dump.after.sql +++ b/db/dump/dump.after.sql @@ -1,5 +1,4 @@ CREATE USER 'vn'@'localhost'; -INSERT INTO `ormConfig`(`id`,`selectLimit`) VALUES(1,1000); GRANT SELECT, INSERT, diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js index f8cbfb5eb..addc7027d 100644 --- a/modules/item/back/methods/fixed-price/filter.js +++ b/modules/item/back/methods/fixed-price/filter.js @@ -136,7 +136,7 @@ module.exports = Self => { SELECT DISTINCT fp.id, fp.itemFk, fp.warehouseFk, - w.name as warehouseName, + w.name warehouseName, fp.rate2, fp.rate3, fp.started, From 632d3190b1fc93f8bf7c59df3cffea56e5753e73 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 9 Sep 2024 07:49:22 +0200 Subject: [PATCH 33/41] feat: refs #7938 remove unnecessary insert in clientLog --- modules/ticket/back/methods/ticket/closure.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index 89343b193..4622ba271 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -171,16 +171,6 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) { {userId}, ); - const oldInstance = `{"email": "${ticket.recipient}"}`; - const newInstance = `{"email": ""}`; - await Self.rawSql( - ` - INSERT INTO clientLog (originFk, userFk, action, changedModel, oldInstance, newInstance) - VALUES (?, NULL, 'UPDATE', 'Client', ?, ?)`, - [ticket.clientFk, oldInstance, newInstance], - {userId}, - ); - const body = `No se ha podido enviar el albarán ${ticket.id} al cliente ${ticket.clientFk} - ${ticket.clientName} porque la dirección de email "${ticket.recipient}" no es correcta From c4527cc5c56dd0382e710db4b99e6ba47371115d Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 9 Sep 2024 08:28:27 +0200 Subject: [PATCH 34/41] feat: refs #4515 New throw buy_checkItem --- .../{buy_chekItem.sql => buy_checkItem.sql} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename db/routines/vn/procedures/{buy_chekItem.sql => buy_checkItem.sql} (63%) diff --git a/db/routines/vn/procedures/buy_chekItem.sql b/db/routines/vn/procedures/buy_checkItem.sql similarity index 63% rename from db/routines/vn/procedures/buy_chekItem.sql rename to db/routines/vn/procedures/buy_checkItem.sql index e9e9336b7..1144db889 100644 --- a/db/routines/vn/procedures/buy_chekItem.sql +++ b/db/routines/vn/procedures/buy_checkItem.sql @@ -6,9 +6,10 @@ BEGIN * * @param tmp.buysToCheck(id as INT). */ - DECLARE hasVolumetricAgency INT; + DECLARE vHasVolumetricAgency INT; + DECLARE vItemFk INT; - SELECT a.hasWeightVolumetric INTO hasVolumetricAgency + SELECT a.hasWeightVolumetric, i.id INTO vHasVolumetricAgency, vItemFk FROM entry e JOIN travel t ON t.id = e.travelFk JOIN agencyMode a ON a.id = t.agencyModeFk @@ -19,10 +20,10 @@ BEGIN AND a.hasWeightVolumetric LIMIT 1; - DROP TEMPORARY TABLE tmp.buysToCheck; + DROP TEMPORARY TABLE tmp.buysToCheck; - IF hasVolumetricAgency THEN - CALL util.throw('Item lacks size/weight in purchase line at agency'); - END IF; + IF vHasVolumetricAgency THEN + CALL util.throw(CONCAT('Missing size/weight in buy line at agency, item: ', vItemFk)); + END IF; END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; From 601260494694578df7e0c06e450eb4ef39e08544 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 9 Sep 2024 09:57:38 +0200 Subject: [PATCH 35/41] perf(salix): refs #7671 #7671 imrpove and revert where changes --- modules/item/back/methods/fixed-price/filter.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js index addc7027d..3bc8ed6b0 100644 --- a/modules/item/back/methods/fixed-price/filter.js +++ b/modules/item/back/methods/fixed-price/filter.js @@ -128,6 +128,9 @@ module.exports = Self => { return {[param]: value}; } }); + if (ctx.req.query.showBadDates === 'true') + where['fp.started'] = {gte: Date.vnNew()}; + filter = mergeFilters(filter, {where}); const stmts = []; @@ -184,14 +187,8 @@ module.exports = Self => { } } } - if (ctx.req.query.showBadDates === 'true') { - stmt.merge({ - sql: ` WHERE - fp.started> util.VN_CURDATE() `}); - } else - stmt.merge(conn.makeWhere(filter.where)); - stmt.merge(conn.makeOrderBy(filter.order)); - stmt.merge(conn.makeLimit(filter)); + + stmt.merge(conn.makeSuffix(filter)); const fixedPriceIndex = stmts.push(stmt) - 1; const sql = ParameterizedSQL.join(stmts, ';'); const result = await conn.executeStmt(sql, myOptions); From 7710b87f4a84cc5a057d90b2d1b378c74a3b7237 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 9 Sep 2024 10:07:05 +0200 Subject: [PATCH 36/41] test(salix): refs #7671 #7671 improve and revert where changes --- modules/item/back/methods/fixed-price/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js index 3bc8ed6b0..488c2441d 100644 --- a/modules/item/back/methods/fixed-price/filter.js +++ b/modules/item/back/methods/fixed-price/filter.js @@ -128,7 +128,7 @@ module.exports = Self => { return {[param]: value}; } }); - if (ctx.req.query.showBadDates === 'true') + if (ctx.req.query?.showBadDates === 'true') where['fp.started'] = {gte: Date.vnNew()}; filter = mergeFilters(filter, {where}); From 723ec2b453b16562ab2868044506ddeb0981a408 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 9 Sep 2024 11:34:42 +0200 Subject: [PATCH 37/41] fix: refs #7844 Filter monitor --- modules/monitor/back/methods/sales-monitor/salesFilter.js | 4 ++-- modules/ticket/back/methods/ticket/filter.js | 2 +- modules/ticket/back/methods/ticket/getTicketsFuture.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index 8ef51a0d1..927f49999 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -285,7 +285,7 @@ module.exports = Self => { if (hasProblems === true) { whereProblems = {or: [ {'tp.isFreezed': true}, - {'tp.risk': {lt: 0}}, + {'tp.hasRisk': true}, {'tp.hasTicketRequest': true}, {'tp.hasComponentLack': true}, {'tp.isTaxDataChecked': false}, @@ -295,7 +295,7 @@ module.exports = Self => { } else if (hasProblems === false) { whereProblems = {and: [ {'tp.isFreezed': false}, - {'tp.risk': 0}, + {'tp.hasRisk': false}, {'tp.hasTicketRequest': false}, {'tp.hasComponentLack': false}, {'tp.isTaxDataChecked': true}, diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 2209c8df4..c98ddaab6 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -343,7 +343,7 @@ module.exports = Self => { const problems = {[condition]: [ {'tp.isFreezed': hasProblem}, - {'tp.risk': hasProblem}, + {'tp.hasRisk': hasProblem}, {'tp.hasTicketRequest': hasProblem}, {'tp.itemShortage': range}, {'tp.hasRounding': hasProblem} diff --git a/modules/ticket/back/methods/ticket/getTicketsFuture.js b/modules/ticket/back/methods/ticket/getTicketsFuture.js index 9f455ec03..abd269e5e 100644 --- a/modules/ticket/back/methods/ticket/getTicketsFuture.js +++ b/modules/ticket/back/methods/ticket/getTicketsFuture.js @@ -196,7 +196,7 @@ module.exports = Self => { const problems = { [condition]: [ {'tp.isFreezed': hasProblem}, - {'tp.risk': hasProblem}, + {'tp.hasRisk': hasProblem}, {'tp.hasTicketRequest': hasProblem}, {'tp.itemShortage': range}, {'tp.hasComponentLack': hasProblem}, From 88a8b4975bd9118f1c7a306b964a69f7c731ef5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 9 Sep 2024 12:37:49 +0200 Subject: [PATCH 38/41] fix: ticket 218504 ticket_close --- db/routines/vn/procedures/ticket_close.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/ticket_close.sql b/db/routines/vn/procedures/ticket_close.sql index f8bbe239b..639b6b505 100644 --- a/db/routines/vn/procedures/ticket_close.sql +++ b/db/routines/vn/procedures/ticket_close.sql @@ -85,7 +85,7 @@ BEGIN IF(vHasDailyInvoice) AND vHasToInvoice THEN SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial; - IF NOT vSerial THEN + IF vSerial IS NULL THEN CALL util.throw('Cannot booking without a serial'); END IF; From d9a4b3e6fb7b689a644499ca205b3e3c54c57226 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 9 Sep 2024 12:42:19 +0200 Subject: [PATCH 39/41] fix: refs #7346 Global invoice --- modules/invoiceOut/front/global-invoicing/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/invoiceOut/front/global-invoicing/index.js b/modules/invoiceOut/front/global-invoicing/index.js index 9a936611a..b9a5ffe91 100644 --- a/modules/invoiceOut/front/global-invoicing/index.js +++ b/modules/invoiceOut/front/global-invoicing/index.js @@ -105,7 +105,8 @@ class Controller extends Section { addressId: address.id, invoiceDate: this.invoiceDate, maxShipped: this.maxShipped, - companyFk: this.companyFk + companyFk: this.companyFk, + serialType: 'quick' }; this.$http.post(`InvoiceOuts/invoiceClient`, params) From 52f368e4f7d96d91598ec0917f796915d86336c7 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 9 Sep 2024 14:25:13 +0200 Subject: [PATCH 40/41] fix: refs #7346 Global invoice --- modules/invoiceOut/front/global-invoicing/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/invoiceOut/front/global-invoicing/index.js b/modules/invoiceOut/front/global-invoicing/index.js index b9a5ffe91..5ea8c2c28 100644 --- a/modules/invoiceOut/front/global-invoicing/index.js +++ b/modules/invoiceOut/front/global-invoicing/index.js @@ -106,7 +106,7 @@ class Controller extends Section { invoiceDate: this.invoiceDate, maxShipped: this.maxShipped, companyFk: this.companyFk, - serialType: 'quick' + serialType: 'global' }; this.$http.post(`InvoiceOuts/invoiceClient`, params) From 1c0e148233f066993713b92355fc4b00fc52c7f0 Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 10 Sep 2024 09:08:43 +0200 Subject: [PATCH 41/41] fix: cau #217599 --- modules/client/back/models/client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 0a8ebcae5..dc19c5d81 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -320,7 +320,8 @@ module.exports = Self => { // Credit management changes - if (changes?.rating >= 0 || changes?.recommendedCredit >= 0) + if ((changes?.rating != null && changes.rating >= 0) + || (changes?.recommendedCredit != null && changes.recommendedCredit >= 0)) await Self.changeCreditManagement(ctx, finalState, changes); const oldInstance = {};