diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 338a73225..7a572fb04 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -360,13 +360,13 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) VALUES - (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), - (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), - (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), + (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), (1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'), (1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'), diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index ff2aac6b9..3274ae8f1 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -73,8 +73,8 @@ describe('Client create path', () => { it(`should attempt to create a new user with all it's data but wrong email`, async() => { await page.write(selectors.createClientView.name, 'Carol Danvers'); - await page.write(selectors.createClientView.socialName, 'AVG tax'); - await page.write(selectors.createClientView.street, 'Many places'); + await page.write(selectors.createClientView.socialName, 'AVG TAX'); + await page.write(selectors.createClientView.street, 'MANY PLACES'); await page.clearInput(selectors.createClientView.email); await page.write(selectors.createClientView.email, 'incorrect email format'); await page.waitToClick(selectors.createClientView.createButton); diff --git a/e2e/paths/02-client/03_edit_fiscal_data.spec.js b/e2e/paths/02-client/03_edit_fiscal_data.spec.js index 0babb5396..9098e816f 100644 --- a/e2e/paths/02-client/03_edit_fiscal_data.spec.js +++ b/e2e/paths/02-client/03_edit_fiscal_data.spec.js @@ -61,7 +61,7 @@ describe('Client Edit fiscalData path', () => { await page.clearInput(selectors.clientFiscalData.fiscalId); await page.write(selectors.clientFiscalData.fiscalId, 'INVALID!'); await page.clearInput(selectors.clientFiscalData.address); - await page.write(selectors.clientFiscalData.address, 'Somewhere edited'); + await page.write(selectors.clientFiscalData.address, 'SOMEWHERE EDITED'); await page.autocompleteSearch(selectors.clientFiscalData.country, 'España'); await page.autocompleteSearch(selectors.clientFiscalData.province, 'Province one'); await page.clearInput(selectors.clientFiscalData.city); @@ -190,7 +190,7 @@ describe('Client Edit fiscalData path', () => { const verifiedData = await page.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox); expect(fiscalId).toEqual('94980061C'); - expect(address).toEqual('Somewhere edited'); + expect(address).toEqual('SOMEWHERE EDITED'); expect(postcode).toContain('46000'); expect(sageTax).toEqual('Operaciones no sujetas'); expect(sageTransaction).toEqual('Regularización de inversiones'); diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index 139af0cea..2d7ab7541 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -28,7 +28,7 @@ describe('Client lock verified data path', () => { it('should edit the social name', async() => { await page.waitForSelector(selectors.clientFiscalData.socialName); await page.clearInput(selectors.clientFiscalData.socialName); - await page.write(selectors.clientFiscalData.socialName, 'Captain America Civil War'); + await page.write(selectors.clientFiscalData.socialName, 'CAPTAIN AMERICA CIVIL WAR'); await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); @@ -39,7 +39,7 @@ describe('Client lock verified data path', () => { await page.reloadSection('client.card.fiscalData'); const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); - expect(result).toEqual('Captain America Civil War'); + expect(result).toEqual('CAPTAIN AMERICA CIVIL WAR'); }); }); @@ -88,7 +88,7 @@ describe('Client lock verified data path', () => { await page.reloadSection('client.card.fiscalData'); const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); - expect(result).toEqual('Ant man and the Wasp'); + expect(result).toEqual('ANT MAN AND THE WASP'); }); }); @@ -142,7 +142,7 @@ describe('Client lock verified data path', () => { await page.reloadSection('client.card.fiscalData'); const result = await page.waitToGetProperty(selectors.clientFiscalData.socialName, 'value'); - expect(result).toEqual('new social name edition'); + expect(result).toEqual('NEW SOCIAL NAME EDITION'); }); }); diff --git a/e2e/paths/02-client/19_summary.spec.js b/e2e/paths/02-client/19_summary.spec.js index ab39154cf..b3bf43c5c 100644 --- a/e2e/paths/02-client/19_summary.spec.js +++ b/e2e/paths/02-client/19_summary.spec.js @@ -36,7 +36,7 @@ describe('Client summary path', () => { it('should display fiscal address details', async() => { const result = await page.waitToGetProperty(selectors.clientSummary.street, 'innerText'); - expect(result).toContain('20 Ingram Street'); + expect(result).toContain('20 INGRAM STREET'); }); it('should display some fiscal data', async() => { diff --git a/e2e/paths/03-worker/06_create.spec.js b/e2e/paths/03-worker/06_create.spec.js index 11d36b3cf..07eb57fe4 100644 --- a/e2e/paths/03-worker/06_create.spec.js +++ b/e2e/paths/03-worker/06_create.spec.js @@ -23,7 +23,7 @@ describe('Worker create path', () => { await page.write(selectors.workerCreate.fi, '78457139E'); await page.write(selectors.workerCreate.phone, '12356789'); await page.write(selectors.workerCreate.postcode, '46680'); - await page.write(selectors.workerCreate.street, 'S/ Doomstadt'); + await page.write(selectors.workerCreate.street, 'S/ DOOMSTADT'); await page.write(selectors.workerCreate.email, 'doctorDoom@marvel.com'); await page.write(selectors.workerCreate.iban, 'ES9121000418450200051332'); diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 135bb2be9..df0a72202 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -179,6 +179,8 @@ "You can not use the same password": "You can not use the same password", "Valid priorities": "Valid priorities: %d", "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}", + "Social name should be uppercase": "Social name should be uppercase", + "Street should be uppercase": "Street should be uppercase", "You don't have enough privileges.": "You don't have enough privileges.", "This ticket is locked.": "This ticket is locked.", "This ticket is not editable.": "This ticket is not editable.", diff --git a/loopback/locale/es.json b/loopback/locale/es.json index ac62d62e1..b69eb1574 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -305,11 +305,14 @@ "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", - "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", + "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", "You don't have enough privileges.": "No tienes suficientes permisos.", "This ticket is locked.": "Este ticket está bloqueado.", "This ticket is not editable.": "Este ticket no es editable.", - "The ticket doesn't exist.": "No existe el ticket." -} \ No newline at end of file + "The ticket doesn't exist.": "No existe el ticket.", + "Social name should be uppercase": "La razón social debe ir en mayúscula", + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula" +} diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index 69440c1d1..03106acc1 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -7,8 +7,8 @@ describe('Client Create', () => { email: 'Deadpool@marvel.com', fi: '16195279J', name: 'Wade', - socialName: 'Deadpool Marvel', - street: 'Wall Street', + socialName: 'DEADPOOL MARVEL', + street: 'WALL STREET', city: 'New York', businessTypeFk: 'florist', provinceFk: 1 diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 8369fa906..129924b78 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -36,6 +36,20 @@ module.exports = Self => { min: 3, max: 10 }); + Self.validatesFormatOf('street', { + message: 'Street should be uppercase', + allowNull: false, + allowBlank: false, + with: /^[^a-z]*$/ + }); + + Self.validatesFormatOf('socialName', { + message: 'Social name should be uppercase', + allowNull: false, + allowBlank: false, + with: /^[^a-z]*$/ + }); + Self.validateAsync('socialName', socialNameIsUnique, { message: 'The company name must be unique' }); diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index d232d6dab..d1de87309 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -33,6 +33,7 @@ ng-model="$ctrl.client.socialName" info="Only letters, numbers and spaces can be used" required="true" + ng-keyup="$ctrl.client.socialName = $ctrl.client.socialName.toUpperCase()" rule> diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js index b2804c203..d0830b00f 100644 --- a/modules/worker/back/methods/worker/specs/new.spec.js +++ b/modules/worker/back/methods/worker/specs/new.spec.js @@ -20,11 +20,11 @@ describe('Worker new', () => { const employeeId = 1; const defaultWorker = { fi: '78457139E', - name: 'defaultWorker', - firstName: 'default', - lastNames: 'worker', + name: 'DEFAULTERWORKER', + firstName: 'DEFAULT', + lastNames: 'WORKER', email: 'defaultWorker@mydomain.com', - street: 'S/ defaultWorkerStreet', + street: 'S/ DEFAULTWORKERSTREET', city: 'defaultWorkerCity', provinceFk: 1, companyFk: 442,