diff --git a/db/changes/231601/00-kkearEntryNotes.sql b/db/changes/231601/00-kkearEntryNotes.sql new file mode 100644 index 000000000..ff5c7ce29 --- /dev/null +++ b/db/changes/231601/00-kkearEntryNotes.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`entry` DROP COLUMN `notes`; \ No newline at end of file diff --git a/db/changes/231601/00-updateIsVies.sql b/db/changes/231601/00-updateIsVies.sql new file mode 100644 index 000000000..83fde7352 --- /dev/null +++ b/db/changes/231601/00-updateIsVies.sql @@ -0,0 +1,5 @@ + UPDATE vn.supplier s + JOIN vn.country c ON c.id = s.countryFk + SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1) + WHERE s.isVies = TRUE + AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2); \ No newline at end of file diff --git a/db/changes/231601/00-updateisViesClient.sql b/db/changes/231601/00-updateisViesClient.sql new file mode 100644 index 000000000..bdf62d7a8 --- /dev/null +++ b/db/changes/231601/00-updateisViesClient.sql @@ -0,0 +1,5 @@ +UPDATE IGNORE vn.client c + JOIN vn.country co ON co.id = c.countryFk + SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1) + WHERE c.isVies = TRUE + AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2); \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 15ccece35..e69974d08 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1409,16 +1409,16 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1), (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2); -INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`) +INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`) VALUES - (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, '', ''), - (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'this is the note two', 'observation two'), - (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'this is the note three', 'observation three'), - (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'this is the note four', 'observation four'), - (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'this is the note five', 'observation five'), - (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'this is the note six', 'observation six'), - (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), - (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, '', ''); + (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''), + (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'), + (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'), + (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'), + (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'), + (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'), + (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'), + (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''); INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) VALUES diff --git a/e2e/paths/12-entry/05_basicData.spec.js b/e2e/paths/12-entry/05_basicData.spec.js index 3b5f40c35..0272446d9 100644 --- a/e2e/paths/12-entry/05_basicData.spec.js +++ b/e2e/paths/12-entry/05_basicData.spec.js @@ -20,7 +20,6 @@ describe('Entry basic data path', () => { it('should edit the basic data', async() => { await page.write(selectors.entryBasicData.reference, 'new movement 8'); await page.write(selectors.entryBasicData.invoiceNumber, 'new movement 8'); - await page.write(selectors.entryBasicData.notes, 'new notes'); await page.write(selectors.entryBasicData.observations, ' edited'); await page.autocompleteSearch(selectors.entryBasicData.supplier, 'Plants nick'); await page.autocompleteSearch(selectors.entryBasicData.currency, 'eur'); @@ -53,12 +52,6 @@ describe('Entry basic data path', () => { expect(result).toEqual('new movement 8'); }); - it('should confirm the note was edited', async() => { - const result = await page.waitToGetProperty(selectors.entryBasicData.notes, 'value'); - - expect(result).toEqual('new notes'); - }); - it('should confirm the observation was edited', async() => { const result = await page.waitToGetProperty(selectors.entryBasicData.observations, 'value'); diff --git a/e2e/paths/13-supplier/03_fiscal_data.spec.js b/e2e/paths/13-supplier/03_fiscal_data.spec.js index 31b3fafd2..170a8d05a 100644 --- a/e2e/paths/13-supplier/03_fiscal_data.spec.js +++ b/e2e/paths/13-supplier/03_fiscal_data.spec.js @@ -15,7 +15,7 @@ const $inputs = { sageTaxType: 'vn-supplier-fiscal-data [ng-model="$ctrl.supplier.sageTaxTypeFk"]' }; -fdescribe('Supplier fiscal data path', () => { +describe('Supplier fiscal data path', () => { let browser; let page; diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index b1e5ace12..00ab23cc9 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -19,19 +19,17 @@
- - -
+
{{::log.user ? log.user.name.charAt(0).toUpperCase() : 'S'}}
+ +
@@ -116,12 +114,6 @@
-
- Filter -
diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index 19bf5b597..46c6cd0f4 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -23,7 +23,7 @@ export default class Controller extends Section { include: [{ relation: 'user', scope: { - fields: ['nickname'], + fields: ['nickname', 'name', 'image'], include: { relation: 'worker', scope: { @@ -120,11 +120,6 @@ export default class Controller extends Section { return this.dateFilter(date, `${format} HH:mm`); } - showWorkerDescriptor(event, workerId) { - if (!workerId) return; - this.$.workerDescriptor.show(event.target, workerId); - } - resetFilter() { this.$.filter = {who: 'all'}; } @@ -201,6 +196,11 @@ export default class Controller extends Section { backgroundColor: '#'+ colors[hash % colors.length] }; } + + showWorkerDescriptor(event, log) { + if (log.user?.worker) + this.$.workerDescriptor.show(event.target, log.userFk); + } } ngModule.vnComponent('vnLog', { @@ -229,7 +229,7 @@ const colors = [ 'DC143C', // Red crimson '5681cf', // Blue steel 'FF1493', // Ping intense - '00d700', // Green lime + '02ba02', // Green lime '1E90FF', // Blue sky '8B008B', // Purple dark 'cc7000', // Orange bright diff --git a/front/salix/components/log/style.scss b/front/salix/components/log/style.scss index 34c432083..ca0c9473c 100644 --- a/front/salix/components/log/style.scss +++ b/front/salix/components/log/style.scss @@ -9,6 +9,7 @@ vn-log { padding-right: 10px; & > .user { + position: relative; border-radius: 50%; height: 36px; width: 36px; @@ -21,19 +22,20 @@ vn-log { width: 100%; height: 100%; } - img { - display: block; - cursor: pointer; + &.system { + background-color: $color-main; } - .user-icon { + .user-letter { font-size: 22px; display: flex; align-items: center; justify-content: center; - - &.system { - background-color: $color-main; - } + } + img { + cursor: pointer; + position: absolute; + top: 0; + left: 0; } } & > .arrow { diff --git a/loopback/locale/es.json b/loopback/locale/es.json index f38678811..f18f64513 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -289,5 +289,6 @@ "isTaxDataChecked": "Datos comprobados", "comercialId": "Id comercial", "comercialName": "Comercial", - "Pass expired": "La contraseña ha caducado, cambiela desde Salix" + "Pass expired": "La contraseña ha caducado, cambiela desde Salix", + "Invalid NIF for VIES": "NIF invalido para VIES" } diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index a86a782e4..56adc8b03 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -14,7 +14,7 @@ module.exports = Self => { Self.validatesPresenceOf('street', { message: 'Street cannot be empty' }); - + Self.validatesPresenceOf('city', { message: 'City cannot be empty' }); @@ -89,8 +89,9 @@ module.exports = Self => { }; const country = await Self.app.models.Country.findOne(filter); const code = country ? country.code.toLowerCase() : null; + const countryCode = this.fi.toLowerCase().substring(0, 2); - if (!this.fi || !validateTin(this.fi, code)) + if (!this.fi || !validateTin(this.fi, code) || (this.isVies && countryCode == code)) err(); done(); } diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index 88586cff7..4b1219f31 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -72,7 +72,9 @@ - + diff --git a/modules/client/front/fiscal-data/locale/es.yml b/modules/client/front/fiscal-data/locale/es.yml index 7624c86bd..61a91828f 100644 --- a/modules/client/front/fiscal-data/locale/es.yml +++ b/modules/client/front/fiscal-data/locale/es.yml @@ -12,3 +12,5 @@ Previous client: Cliente anterior In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente Incoterms authorization: Autorización incoterms Electronic invoice: Factura electrónica +When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF +The first two values are letters: Los dos primeros valores son letras \ No newline at end of file diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index e90043074..1cd12b737 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -158,7 +158,6 @@ module.exports = Self => { e.invoiceNumber, e.isBooked, e.isExcludedFromAvailable, - e.notes, e.evaNotes AS observation, e.isConfirmed, e.isOrdered, diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index 3933f6a34..a7508b4e8 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -27,9 +27,6 @@ "isExcludedFromAvailable": { "type": "boolean" }, - "notes": { - "type": "string" - }, "isConfirmed": { "type": "boolean" }, diff --git a/modules/entry/front/basic-data/index.html b/modules/entry/front/basic-data/index.html index 68a65e890..4e4631a3c 100644 --- a/modules/entry/front/basic-data/index.html +++ b/modules/entry/front/basic-data/index.html @@ -52,13 +52,6 @@ rule vn-focus> - - - - diff --git a/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js index d4479d00b..c368ec1b8 100644 --- a/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js +++ b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js @@ -19,13 +19,14 @@ describe('Supplier newSupplier()', () => { }); }); - it('should create a new supplier containing only the name', async() => { + it('should create a new supplier containing only the name and the nif', async() => { const tx = await models.Supplier.beginTransaction({}); try { const options = {transaction: tx}; ctx.args = { - name: 'newSupplier' + name: 'newSupplier', + nif: '12345678Z' }; const result = await models.Supplier.newSupplier(ctx, options); diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index c4ce0c517..ae3eb4bcc 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -67,8 +67,9 @@ module.exports = Self => { }; const country = await Self.app.models.Country.findOne(filter); const code = country ? country.code.toLowerCase() : null; + const countryCode = this.nif.toLowerCase().substring(0, 2); - if (!this.nif || !validateTin(this.nif, code)) + if (!this.nif || !validateTin(this.nif, code) || (this.isVies && countryCode == code)) err(); done(); } diff --git a/modules/supplier/front/fiscal-data/index.html b/modules/supplier/front/fiscal-data/index.html index 3c5f64dcf..3a0aefbf2 100644 --- a/modules/supplier/front/fiscal-data/index.html +++ b/modules/supplier/front/fiscal-data/index.html @@ -54,7 +54,8 @@ name="taxNumber" ng-model="$ctrl.supplier.nif" required="true" - rule> + rule + > @@ -210,7 +211,9 @@ + info="When activating it, do not enter the country code in the ID field." + ng-model="$ctrl.supplier.isVies" + > diff --git a/modules/supplier/front/fiscal-data/locale/es.yml b/modules/supplier/front/fiscal-data/locale/es.yml index 5232dd95d..ee641231f 100644 --- a/modules/supplier/front/fiscal-data/locale/es.yml +++ b/modules/supplier/front/fiscal-data/locale/es.yml @@ -3,4 +3,6 @@ Sage transaction type: Tipo de transacción Sage Sage withholding: Retención Sage Supplier activity: Actividad proveedor Healt register: Pasaporte sanitario -Trucker: Transportista \ No newline at end of file +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/locale/es.yml b/modules/supplier/front/locale/es.yml index abb6a9775..a2b6dd04d 100644 --- a/modules/supplier/front/locale/es.yml +++ b/modules/supplier/front/locale/es.yml @@ -1 +1,2 @@ -Accounts: Cuentas \ No newline at end of file +Accounts: Cuentas +Invalid NIF for VIES: NIF no valido por VIES \ No newline at end of file diff --git a/modules/travel/back/methods/travel/extraCommunityFilter.js b/modules/travel/back/methods/travel/extraCommunityFilter.js index 5ee51de8e..388ba52a1 100644 --- a/modules/travel/back/methods/travel/extraCommunityFilter.js +++ b/modules/travel/back/methods/travel/extraCommunityFilter.js @@ -167,7 +167,6 @@ module.exports = Self => { s.name AS supplierName, SUM(b.stickers) AS stickers, e.evaNotes, - e.notes, e.invoiceAmount, CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg, CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg diff --git a/modules/travel/back/methods/travel/getEntries.js b/modules/travel/back/methods/travel/getEntries.js index 5ca12f7a1..71bb0d8fb 100644 --- a/modules/travel/back/methods/travel/getEntries.js +++ b/modules/travel/back/methods/travel/getEntries.js @@ -31,7 +31,6 @@ module.exports = Self => { e.isConfirmed, e.invoiceNumber, e.reference, - e.notes, e.evaNotes AS observation, s.name AS supplierName, CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index 113128e0e..5d38ed08f 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -100,12 +100,6 @@ {{entry.pallet}} {{entry.m3}} - - { client = await models.Client.findById( user.id, - {fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']}, + {fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'fi']}, myOptions ); diff --git a/print/templates/reports/entry-order/entry-order.html b/print/templates/reports/entry-order/entry-order.html index 5d362dea9..ddf0e9b5d 100644 --- a/print/templates/reports/entry-order/entry-order.html +++ b/print/templates/reports/entry-order/entry-order.html @@ -77,16 +77,6 @@ -
-
-
-
-

{{$t('notes')}}

-
{{entry.notes}}
-
-
-
-