fixes #4945 Dejar de buscar por tag 'Nombre temporal' #1258

Merged
alexandre merged 9 commits from 4945-dejar-buscar-tag-nombreTemporal into dev 2023-01-23 06:04:41 +00:00
7 changed files with 52 additions and 16 deletions
Showing only changes of commit be5f987b0a - Show all commits

View File

@ -0,0 +1,8 @@
ALTER TABLE `vn`.`itemConfig` ADD defaultTag INT DEFAULT 56 NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultTag) REFERENCES vn.tag(id);
ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL;
INSERT INTO `salix`.`ACL`
(model, property, accessType, permission, principalType, principalId)
VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer');

View File

@ -2719,6 +2719,10 @@ INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPack
VALUES
(3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL);
INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`)
VALUES
(0, 0, 24, '', '[1,2,3]', 2, 56);
Review

A comentar en Juan en la revisio semanal de hui

A comentar en Juan en la revisio semanal de hui
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
VALUES
(9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL);

View File

@ -522,7 +522,7 @@ export default {
},
itemLog: {
anyLineCreated: 'vn-item-log > vn-log vn-tbody > vn-tr',
fourthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(4) table tr:nth-child(3) td.after',
fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) table tr:nth-child(2) td.after',
},
ticketSummary: {
header: 'vn-ticket-summary > vn-card > h5',

View File

@ -48,17 +48,17 @@ describe('Item log path', () => {
await page.accessToSection('item.card.log');
});
it(`should confirm the log is showing 4 entries`, async() => {
it(`should confirm the log is showing 5 entries`, async() => {
await page.waitForSelector(selectors.itemLog.anyLineCreated);
const anyLineCreatedCount = await page.countElement(selectors.itemLog.anyLineCreated);
expect(anyLineCreatedCount).toEqual(4);
expect(anyLineCreatedCount).toEqual(5);
});
it(`should confirm the log is showing the intrastat for the created item`, async() => {
const fourthLineCreatedProperty = await page
.waitToGetProperty(selectors.itemLog.fourthLineCreatedProperty, 'innerText');
const fifthLineCreatedProperty = await page
.waitToGetProperty(selectors.itemLog.fifthLineCreatedProperty, 'innerText');
expect(fourthLineCreatedProperty).toEqual('Coral y materiales similares');
expect(fifthLineCreatedProperty).toEqual('Coral y materiales similares');
});
});

View File

@ -37,7 +37,6 @@ module.exports = Self => {
'typeFk',
'intrastatFk',
'originFk',
'relevancy',

perque s'ha lleva't la relevancia?

perque s'ha lleva't la relevancia?
'priority',
'tag'
];
@ -48,9 +47,9 @@ module.exports = Self => {
}
try {
const validPriorities = new Set([1, 2, 3]);
if (!validPriorities.has(params.priority))
throw new UserError(`Valid priorities: ${[...validPriorities]}`);
const itemConfig = await models.ItemConfig.findOne({fields: ['validPriorities']}, myOptions);
if (!itemConfig.validPriorities.includes(params.priority))

açò? pregunta a Juan pero jo no ho veig, crec que deuria estar en taula config

açò? pregunta a Juan pero jo no ho veig, crec que deuria estar en taula config
throw new UserError(`Valid priorities: ${[...itemConfig.validPriorities]}`);
const provisionalName = params.provisionalName;
delete params.provisionalName;

View File

@ -16,6 +16,22 @@
"wasteRecipients": {
"type": "string",
"description": "Buyers waste report recipients"
},
"validPriorities": {
"type": "array"
},
"defaultPriority": {
"type": "int"
},
"defaultTag": {
"type": "int"
}
},
"relations": {
"tag": {
"type": "belongsTo",
"model": "Tag",
"foreignKey": "defaultTag"
}
}
}

View File

@ -4,12 +4,21 @@ import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.fetchDefaultPriorityTag();
}

Has de vore la forma de llevar el 2 del codi

Has de vore la forma de llevar el 2 del codi
fetchDefaultPriorityTag() {
const filter = {fields: ['defaultPriority', 'defaultTag'], limit: 1};
this.$http.get(`ItemConfigs`, {filter})
.then(res => {
if (res.data) {
this.item = {
relevancy: 0,
priority: 2,
tag: 1
priority: res.data[0].defaultPriority,
tag: res.data[0].defaultTag
};
}
});
}
onSubmit() {
this.$.watcher.submit().then(