refs #5712 hotFix(docuware): tickets. hotFix(catalog): search_panel
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-08-22 10:17:46 +02:00
parent 555306c5da
commit a26652045c
10 changed files with 25 additions and 30 deletions

View File

@ -71,11 +71,10 @@ module.exports = Self => {
} }
try { try {
const response = await Self.get(fileCabinet, filter); const [response] = await Self.get(fileCabinet, filter);
const [documents] = response.Items; if (!response) return false;
if (!documents) return false;
return {id: documents.Id}; return {id: response['Document ID']};
} catch (error) { } catch (error) {
return false; return false;
} }

View File

@ -65,7 +65,7 @@ module.exports = Self => {
const email = new Email('delivery-note', params); const email = new Email('delivery-note', params);
const docuwareFile = await models.Docuware.download(ctx, id, 'deliveryNote'); const docuwareFile = await models.Docuware.download(id, 'deliveryNote');
return email.send({ return email.send({
overrideAttachments: true, overrideAttachments: true,

View File

@ -16,19 +16,9 @@ describe('docuware download()', () => {
it('should return the document data', async() => { it('should return the document data', async() => {
const docuwareId = 1; const docuwareId = 1;
const response = { const response = [{
Items: [ 'Document ID': docuwareId
{ }];
Id: docuwareId,
Fields: [
{
FieldName: 'ESTADO',
Item: 'Firmado'
}
]
}
]
};
spyOn(docuwareModel, 'get').and.returnValue((new Promise(resolve => resolve(response)))); spyOn(docuwareModel, 'get').and.returnValue((new Promise(resolve => resolve(response))));
const result = await models.Docuware.checkFile(ticketId, fileCabinetName, null, true); const result = await models.Docuware.checkFile(ticketId, fileCabinetName, null, true);

View File

@ -111,7 +111,7 @@ module.exports = Self => {
throw new UserError('Action not allowed on the test environment'); throw new UserError('Action not allowed on the test environment');
// delete old // delete old
const docuwareFile = await models.Docuware.checkFile(ctx, id, fileCabinet, false); const docuwareFile = await models.Docuware.checkFile(id, fileCabinet, false);
if (docuwareFile) { if (docuwareFile) {
const deleteJson = { const deleteJson = {
'Field': [{'FieldName': 'ESTADO', 'Item': 'Pendiente eliminar', 'ItemElementName': 'String'}] 'Field': [{'FieldName': 'ESTADO', 'Item': 'Pendiente eliminar', 'ItemElementName': 'String'}]

View File

@ -25,10 +25,6 @@ class Controller extends SearchPanel {
this.filter.values.push({}); this.filter.values.push({});
setTimeout(() => this.parentPopover.relocate()); setTimeout(() => this.parentPopover.relocate());
} }
changeTag() {
}
} }
ngModule.vnComponent('vnOrderCatalogSearchPanel', { ngModule.vnComponent('vnOrderCatalogSearchPanel', {

View File

@ -236,7 +236,7 @@ class Controller extends Section {
tagGroups: this.tagGroups, tagGroups: this.tagGroups,
}; };
return model.applyFilter({where: newFilter}, newParams); return model.addFilter({where: newFilter}, newParams);
} }
openPanel(event) { openPanel(event) {

View File

@ -191,14 +191,14 @@ describe('Order', () => {
describe('applyFilters()', () => { describe('applyFilters()', () => {
it(`should call model applyFilter() method with a new filter`, () => { it(`should call model applyFilter() method with a new filter`, () => {
jest.spyOn(controller.$.model, 'applyFilter'); jest.spyOn(controller.$.model, 'addFilter');
controller._categoryId = 2; controller._categoryId = 2;
controller._typeId = 4; controller._typeId = 4;
controller.applyFilters(); controller.applyFilters();
expect(controller.$.model.applyFilter).toHaveBeenCalledWith( expect(controller.$.model.addFilter).toHaveBeenCalledWith(
{where: {categoryFk: 2, typeFk: 4}}, {where: {categoryFk: 2, typeFk: 4}},
{orderFk: 4, orderBy: controller.getOrderBy(), tagGroups: []}); {orderFk: 4, orderBy: controller.getOrderBy(), tagGroups: []});
}); });

View File

@ -32,6 +32,14 @@ module.exports = Self => {
}); });
Self.docuwareDownload = async id => { Self.docuwareDownload = async id => {
const models = Self.app.models;
const docuwareInfo = await models.Docuware.findOne({
where: {
code: 'deliveryNote',
action: 'find'
}
});
const filter = { const filter = {
condition: [ condition: [
{ {
@ -50,6 +58,6 @@ module.exports = Self => {
} }
] ]
}; };
return Self.app.models.Docuware.download(id, 'deliveryNote', filter); return models.Docuware.download(id, 'deliveryNote', filter);
}; };
}; };

View File

@ -42,4 +42,5 @@ module.exports = function(Self) {
require('../methods/ticket/expeditionPalletLabel')(Self); require('../methods/ticket/expeditionPalletLabel')(Self);
require('../methods/ticket/saveSign')(Self); require('../methods/ticket/saveSign')(Self);
require('../methods/ticket/invoiceTickets')(Self); require('../methods/ticket/invoiceTickets')(Self);
require('../methods/ticket/docuwareDownload')(Self);
}; };

View File

@ -3,10 +3,11 @@ import Section from 'salix/components/section';
import './style.scss'; import './style.scss';
class Controller extends Section { class Controller extends Section {
constructor($element, $, vnReport, vnEmail) { constructor($element, $, vnReport, vnEmail, vnFile) {
super($element, $); super($element, $);
this.vnReport = vnReport; this.vnReport = vnReport;
this.vnEmail = vnEmail; this.vnEmail = vnEmail;
this.vnFile = vnFile;
} }
get ticketId() { get ticketId() {
@ -322,7 +323,7 @@ class Controller extends Section {
} }
docuwareDownload() { docuwareDownload() {
this.vnFile.download(`api/Ticket/${this.ticket.id}/docuwareDownload`); this.vnFile.download(`api/Tickets/${this.ticket.id}/docuwareDownload`);
} }
setTicketWeight(weight) { setTicketWeight(weight) {
@ -335,7 +336,7 @@ class Controller extends Section {
} }
} }
Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail', 'vnFile'];
ngModule.vnComponent('vnTicketDescriptorMenu', { ngModule.vnComponent('vnTicketDescriptorMenu', {
template: require('./index.html'), template: require('./index.html'),