refs #6757 fix back, fix upperCase, fix e2e back
gitea/salix/pipeline/pr-dev Something is wrong with the build of this commit Details

This commit is contained in:
Carlos Satorres 2024-01-31 17:01:47 +01:00
parent d7a5ec1e5b
commit aa993e7386
15 changed files with 61 additions and 24 deletions

View File

@ -569,13 +569,13 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
VALUES VALUES
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), (1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), (2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
(69, 'Packaging', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), (69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), (442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
(567, 'Holland', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), (567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
(791, 'Bros SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), (791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
(1381, 'Ornamentales', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); (1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`) INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
VALUES VALUES

11
db/myt.config.yml Executable file
View File

@ -0,0 +1,11 @@
code: my-db
schemas:
- myt
- my_db
fixtures:
myt:
- version
- versionLog
my_db:
- table1
- table2

13
db/package.json Normal file
View File

@ -0,0 +1,13 @@
{
"name": "my-db",
"version": "1.0.0",
"author": "Me",
"description": "My database project",
"license": "GPL-3.0",
"repository": {
"type": "git"
},
"dependencies": {
"@verdnatura/myt": "^1.6.3"
}
}

View File

@ -0,0 +1,4 @@
-- Place your SQL code here
UPDATE vn.supplier
SET name = UPPER(name),
nickname = UPPER(nickname);

View File

@ -24,7 +24,7 @@ describe('Supplier summary & descriptor path', () => {
it(`should confirm there's data on the summary header`, async() => { it(`should confirm there's data on the summary header`, async() => {
const result = await page.waitToGetProperty(selectors.supplierSummary.header, 'innerText'); const result = await page.waitToGetProperty(selectors.supplierSummary.header, 'innerText');
expect(result).toContain('Plants SL - 1'); expect(result).toContain('PLANTS SL - 1');
}); });
it(`should confirm there's data on the summary basic data`, async() => { it(`should confirm there's data on the summary basic data`, async() => {

View File

@ -24,7 +24,7 @@ describe('Supplier fiscal data path', () => {
country: null, country: null,
postcode: null, postcode: null,
city: 'Valencia', city: 'Valencia',
socialName: 'Farmer King SL', socialName: 'FARMER KING SL',
taxNumber: '12345678Z', taxNumber: '12345678Z',
account: '0123456789', account: '0123456789',
sageWithholding: 'retencion estimacion objetiva', sageWithholding: 'retencion estimacion objetiva',
@ -46,7 +46,7 @@ describe('Supplier fiscal data path', () => {
country: 'España', country: 'España',
postcode: '46000', postcode: '46000',
city: 'Valencia', city: 'Valencia',
socialName: 'Farmer King SL', socialName: 'FARMER KING SL',
taxNumber: '12345678Z', taxNumber: '12345678Z',
account: '0123456789', account: '0123456789',
sageWithholding: 'RETENCION ESTIMACION OBJETIVA', sageWithholding: 'RETENCION ESTIMACION OBJETIVA',

View File

@ -203,5 +203,6 @@
"Cannot past travels with entries": "Cannot past travels with entries", "Cannot past travels with entries": "Cannot past travels with entries",
"It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}",
"Incorrect pin": "Incorrect pin.", "Incorrect pin": "Incorrect pin.",
"The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified" "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified",
"Name should be uppercase": "Name should be uppercase"
} }

View File

@ -336,5 +336,6 @@
"Incorrect pin": "Pin incorrecto.", "Incorrect pin": "Pin incorrecto.",
"You already have the mailAlias": "Ya tienes este alias de correo", "You already have the mailAlias": "Ya tienes este alias de correo",
"The alias cant be modified": "Este alias de correo no puede ser modificado", "The alias cant be modified": "Este alias de correo no puede ser modificado",
"No tickets to invoice": "No hay tickets para facturar" "No tickets to invoice": "No hay tickets para facturar",
"Name should be uppercase": "Name should be uppercase"
} }

View File

@ -8,14 +8,14 @@ describe('InvoiceIn filter()', () => {
try { try {
const ctx = { const ctx = {
args: { args: {
search: 'Plants SL', search: 'PLANTS SL',
} }
}; };
const result = await models.InvoiceIn.filter(ctx, {}, options); const result = await models.InvoiceIn.filter(ctx, {}, options);
expect(result.length).toEqual(5); expect(result.length).toEqual(5);
expect(result[0].supplierName).toEqual('Plants SL'); expect(result[0].supplierName).toEqual('PLANTS SL');
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {

View File

@ -5,7 +5,7 @@ describe('Supplier getSummary()', () => {
const supplier = await app.models.Supplier.getSummary(1); const supplier = await app.models.Supplier.getSummary(1);
expect(supplier.id).toEqual(1); expect(supplier.id).toEqual(1);
expect(supplier.name).toEqual('Plants SL'); expect(supplier.name).toEqual('PLANTS SL');
expect(supplier.nif).toEqual('06089160W'); expect(supplier.nif).toEqual('06089160W');
expect(supplier.account).toEqual('4100000001'); expect(supplier.account).toEqual('4100000001');
expect(supplier.payDay).toEqual(15); expect(supplier.payDay).toEqual(15);

View File

@ -25,13 +25,13 @@ describe('Supplier newSupplier()', () => {
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
ctx.args = { ctx.args = {
name: 'newSupplier', name: 'NEWSUPPLIER',
nif: '12345678Z' nif: '12345678Z'
}; };
const result = await models.Supplier.newSupplier(ctx, options); const result = await models.Supplier.newSupplier(ctx, options);
expect(result.name).toEqual('newSupplier'); expect(result.name).toEqual('NEWSUPPLIER');
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();

View File

@ -6,7 +6,7 @@ describe('Supplier updateFiscalData', () => {
const administrativeId = 5; const administrativeId = 5;
const employeeId = 1; const employeeId = 1;
const defaultData = { const defaultData = {
name: 'Plants SL', name: 'PLANTS SL',
nif: '06089160W', nif: '06089160W',
account: '4100000001', account: '4100000001',
sageTaxTypeFk: 4, sageTaxTypeFk: 4,
@ -56,7 +56,7 @@ describe('Supplier updateFiscalData', () => {
}); });
ctx.args = { ctx.args = {
name: 'Weapon Dealer', name: 'WEAPON DEALER',
nif: 'A68446004', nif: 'A68446004',
account: '4000000005', account: '4000000005',
sageTaxTypeFk: 5, sageTaxTypeFk: 5,
@ -72,7 +72,7 @@ describe('Supplier updateFiscalData', () => {
const result = await app.models.Supplier.updateFiscalData(ctx, supplierId); const result = await app.models.Supplier.updateFiscalData(ctx, supplierId);
expect(result.name).toEqual('Weapon Dealer'); expect(result.name).toEqual('WEAPON DEALER');
expect(result.nif).toEqual('A68446004'); expect(result.nif).toEqual('A68446004');
expect(result.account).toEqual('4000000005'); expect(result.account).toEqual('4000000005');
expect(result.sageTaxTypeFk).toEqual(5); expect(result.sageTaxTypeFk).toEqual(5);

View File

@ -129,7 +129,7 @@ describe('loopback model Supplier', () => {
const options = {transaction: tx}; const options = {transaction: tx};
try { try {
const newSupplier = await models.Supplier.create({name: 'Alfred Pennyworth'}, options); const newSupplier = await models.Supplier.create({name: 'ALFRED PENNYWORTH'}, options);
const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options); const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options);
expect(Number(fetchedSupplier.account)).toEqual(4100000000 + newSupplier.id); expect(Number(fetchedSupplier.account)).toEqual(4100000000 + newSupplier.id);

View File

@ -46,6 +46,12 @@ module.exports = Self => {
Self.validateAsync('postCode', hasValidPostcode, { Self.validateAsync('postCode', hasValidPostcode, {
message: `The postcode doesn't exist. Please enter a correct one` message: `The postcode doesn't exist. Please enter a correct one`
}); });
Self.validatesFormatOf('name', {
message: 'Name should be uppercase',
allowNull: false,
allowBlank: false,
with: /^[^a-z]*$/
});
async function hasValidPostcode(err, done) { async function hasValidPostcode(err, done) {
if (!this.postcode) if (!this.postcode)

View File

@ -12,7 +12,8 @@
<vn-textfield <vn-textfield
label="Supplier name" label="Supplier name"
ng-model="$ctrl.supplier.name" ng-model="$ctrl.supplier.name"
vn-focus> vn-focus
ng-keyup="$ctrl.supplier.name = $ctrl.supplier.name.toUpperCase()">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>