Merge branch 'dev' into 6013-sendMail_fix
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-08-24 07:33:07 +00:00
commit 9a12169ba4
15 changed files with 36 additions and 36 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

@ -33,14 +33,14 @@ module.exports = Self => {
await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']}); await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']});
let html = `<strong>Motivo</strong>:<br/>${reason}<br/>`; let html = `<strong>Motivo</strong>:<br/>${reason}<br/>`;
html += `<strong>Usuario</strong>:<br/>${ctx.req.accessToken.userId} ${emailUser.email}<br/>`;
for (const data in additionalData) for (const data in additionalData)
html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`; html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`;
const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error; const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error;
smtp.send({ smtp.send({
to: config.app.reportEmail, to: `${config.app.reportEmail}, ${emailUser.email}`,
replyTo: emailUser.email,
subject: subject:
'[Support-Salix] ' + '[Support-Salix] ' +
additionalData?.frontPath + ' ' + additionalData?.frontPath + ' ' +

View File

@ -60,7 +60,7 @@ export default class Token {
if (!this.token) return; if (!this.token) return;
const created = storage.getItem('vnTokenCreated'); const created = storage.getItem('vnTokenCreated');
this.created = created && new Date(created); this.created = created && new Date(created);
this.renewPeriod = storage.getItem('vnTokenRenewPeriod'); this.ttl = storage.getItem('vnTokenTtl');
} }
setStorage(storage, token, created, ttl) { setStorage(storage, token, created, ttl) {

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

@ -58,7 +58,7 @@
<vn-th field="street" expand>Street</vn-th> <vn-th field="street" expand>Street</vn-th>
<vn-th field="city">City</vn-th> <vn-th field="city">City</vn-th>
<vn-th field="postalCode" translate-attr="{title: 'Postcode'}" shrink>PC</vn-th> <vn-th field="postalCode" translate-attr="{title: 'Postcode'}" shrink>PC</vn-th>
<vn-th field="clientFk" expand>Client</vn-th> <vn-th field="nickname" expand>Client</vn-th>
<vn-th field="warehouse" expand>Warehouse</vn-th> <vn-th field="warehouse" expand>Warehouse</vn-th>
<vn-th field="packages" shrink>Packages</vn-th> <vn-th field="packages" shrink>Packages</vn-th>
<vn-th field="volume" shrink></vn-th> <vn-th field="volume" shrink></vn-th>
@ -100,9 +100,9 @@
</field> </field>
</vn-td-editable> </vn-td-editable>
<vn-td expand title="{{::ticket.street}}">{{::ticket.street}}</vn-td> <vn-td expand title="{{::ticket.street}}">{{::ticket.street}}</vn-td>
<vn-td <vn-td
expand expand
ng-click="$ctrl.goToBuscaman(ticket)" ng-click="$ctrl.goToBuscaman(ticket)"
class="link" class="link"
vn-tooltip="Open buscaman" vn-tooltip="Open buscaman"
tooltip-position="up"> tooltip-position="up">

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'),

View File

@ -5,7 +5,7 @@ class Controller extends Section {
onSubmit() { onSubmit() {
const sip = this.worker.sip; const sip = this.worker.sip;
const params = { const params = {
userFk: this.worker.userFk, userFk: this.worker.id,
extension: sip.extension extension: sip.extension
}; };
this.$.watcher.check(); this.$.watcher.check();

View File

@ -8,4 +8,4 @@ SELECT
FROM supplier s FROM supplier s
JOIN entry e ON e.supplierFk = s.id JOIN entry e ON e.supplierFk = s.id
LEFT JOIN province p ON p.id = s.provinceFk LEFT JOIN province p ON p.id = s.provinceFk
WHERE e.id = ? WHERE e.id = ?

View File

@ -32,6 +32,7 @@
<h3 class="uppercase">{{invoice.name}}</h3> <h3 class="uppercase">{{invoice.name}}</h3>
<div>{{invoice.postalAddress}}</div> <div>{{invoice.postalAddress}}</div>
<div>{{invoice.postcodeCity}}</div> <div>{{invoice.postcodeCity}}</div>
<div>{{invoice.postCode}}, {{invoice.city}}, ({{invoice.province}})</div>
<div v-if="invoice.nif">{{$t('fiscalId')}}: {{invoice.nif}}</div> <div v-if="invoice.nif">{{$t('fiscalId')}}: {{invoice.nif}}</div>
<div v-if="invoice.phone">{{$t('phone')}}: {{invoice.phone}}</div> <div v-if="invoice.phone">{{$t('phone')}}: {{invoice.phone}}</div>
</div> </div>

View File

@ -4,6 +4,9 @@ SELECT
i.issued, i.issued,
s.name, s.name,
s.street AS postalAddress, s.street AS postalAddress,
s.city,
s.postCode,
pr.name province,
s.nif, s.nif,
s.phone, s.phone,
p.name payMethod p.name payMethod
@ -11,4 +14,5 @@ SELECT
JOIN supplier s ON s.id = i.supplierFk JOIN supplier s ON s.id = i.supplierFk
JOIN company c ON c.id = i.companyFk JOIN company c ON c.id = i.companyFk
JOIN payMethod p ON p.id = s.payMethodFk JOIN payMethod p ON p.id = s.payMethodFk
LEFT JOIN province pr ON pr.id = s.provinceFk
WHERE i.id = ? WHERE i.id = ?