dev #1731
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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'}]
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
INSERT INTO `account`.`role` (`id`, `name`, `description`, `hasLogin`)
|
||||||
|
VALUES ('claimViewer','Trabajadores que consulta las reclamaciones ',1);
|
||||||
|
|
||||||
|
INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`)
|
||||||
|
SELECT `r`.`id`, `r2`.`id`
|
||||||
|
FROM `account`.`role` `r`
|
||||||
|
JOIN `account`.`role` `r2` ON `r2`.`name` = 'claimViewer'
|
||||||
|
WHERE `r`.`name` IN (
|
||||||
|
'salesPerson',
|
||||||
|
'buyer',
|
||||||
|
'deliveryBoss',
|
||||||
|
'handmadeBoss'
|
||||||
|
)
|
||||||
|
|
||||||
|
DELETE FROM `salix`.`ACL`
|
||||||
|
WHERE `model`= 'claim'
|
||||||
|
AND `property` IN (
|
||||||
|
'filter',
|
||||||
|
'find',
|
||||||
|
'findById',
|
||||||
|
'getSummary'
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`)
|
||||||
|
VALUES ('Claim','filter','READ','ALLOW','ROLE','claimViewer');
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`)
|
||||||
|
VALUES ('Claim','find','READ','ALLOW','ROLE','claimViewer');
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`)
|
||||||
|
VALUES ('Claim','findById','READ','ALLOW','ROLE','claimViewer');
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`)
|
||||||
|
VALUES ('Claim','getSummary','READ','ALLOW','ROLE','claimViewer');
|
||||||
|
|
|
@ -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', {
|
||||||
|
|
|
@ -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>m³</vn-th>
|
<vn-th field="volume" shrink>m³</vn-th>
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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'),
|
||||||
|
|
|
@ -121,15 +121,18 @@ module.exports = Self => {
|
||||||
`, [started, ended]);
|
`, [started, ended]);
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`INSERT INTO mail (receiver, subject, body)
|
stmt = new ParameterizedSQL(`
|
||||||
SELECT CONCAT(u.name, '@verdnatura.es'),
|
INSERT INTO mail (receiver, subject, body)
|
||||||
CONCAT('Error registro de horas semana ', ?, ' año ', ?) ,
|
SELECT CONCAT(u.name, '@verdnatura.es'),
|
||||||
CONCAT('No se ha podido enviar el registro de horas al empleado/s: ', GROUP_CONCAT(DISTINCT CONCAT('<br>', w.id, ' ', w.firstName, ' ', w.lastName)))
|
CONCAT('Error registro de horas semana ', ?, ' año ', ?) ,
|
||||||
FROM tmp.timeControlError tce
|
CONCAT('No se ha podido enviar el registro de horas al empleado/s: ',
|
||||||
JOIN vn.workerTimeControl wtc ON wtc.id = tce.id
|
GROUP_CONCAT(DISTINCT CONCAT('<br>', w.id, ' ', w.firstName, ' ', w.lastName)))
|
||||||
JOIN worker w ON w.id = wtc.userFK
|
FROM tmp.timeControlError tce
|
||||||
JOIN account.user u ON u.id = w.bossFk
|
JOIN vn.workerTimeControl wtc ON wtc.id = tce.id
|
||||||
GROUP BY w.bossFk`, [args.week, args.year]);
|
JOIN worker w ON w.id = wtc.userFK
|
||||||
|
JOIN account.user u ON u.id = w.bossFk
|
||||||
|
GROUP BY w.bossFk
|
||||||
|
`, [args.week, args.year]);
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
|
@ -177,10 +180,8 @@ module.exports = Self => {
|
||||||
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
|
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
|
||||||
|
|
||||||
for (let day of days[index]) {
|
for (let day of days[index]) {
|
||||||
if (!myOptions.transaction) {
|
tx = await Self.beginTransaction({});
|
||||||
tx = await Self.beginTransaction({});
|
myOptions.transaction = tx;
|
||||||
myOptions.transaction = tx;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
workerFk = day.workerFk;
|
workerFk = day.workerFk;
|
||||||
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
||||||
|
@ -365,13 +366,31 @@ module.exports = Self => {
|
||||||
previousReceiver = day.receiver;
|
previousReceiver = day.receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tx) {
|
if (tx) await tx.commit();
|
||||||
await tx.commit();
|
|
||||||
delete myOptions.transaction;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
const stmts = [];
|
||||||
|
let stmt;
|
||||||
|
stmt = new ParameterizedSQL(`
|
||||||
|
INSERT INTO mail (receiver, subject, body)
|
||||||
|
SELECT CONCAT(u.name, '@verdnatura.es'),
|
||||||
|
CONCAT('Error registro de horas semana ', ?, ' año ', ?) ,
|
||||||
|
CONCAT('No se ha podido enviar el registro de horas al empleado: ',
|
||||||
|
w.id, ' ', w.firstName, ' ', w.lastName, ' por el motivo: ', ?)
|
||||||
|
FROM worker w
|
||||||
|
JOIN account.user u ON u.id = w.bossFk
|
||||||
|
WHERE w.id = ?
|
||||||
|
`, [args.week, args.year, e.message, day.workerFk]);
|
||||||
|
stmts.push(stmt);
|
||||||
|
|
||||||
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
|
await conn.executeStmt(sql);
|
||||||
|
|
||||||
|
previousWorkerFk = day.workerFk;
|
||||||
|
previousReceiver = day.receiver;
|
||||||
|
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
throw e;
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ module.exports = Self => {
|
||||||
const salix = await models.Url.findOne({
|
const salix = await models.Url.findOne({
|
||||||
where: {
|
where: {
|
||||||
appName: 'salix',
|
appName: 'salix',
|
||||||
environment: process.env.NODE_ENV || 'dev'
|
environment: process.env.NODE_ENV || 'development'
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ module.exports = Self => {
|
||||||
const url = `${salix.url}worker/${args.workerId}/time-control?timestamp=${timestamp}`;
|
const url = `${salix.url}worker/${args.workerId}/time-control?timestamp=${timestamp}`;
|
||||||
ctx.args.url = url;
|
ctx.args.url = url;
|
||||||
|
|
||||||
Self.sendTemplate(ctx, 'weekly-hour-record');
|
await Self.sendTemplate(ctx, 'weekly-hour-record');
|
||||||
|
|
||||||
return models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, myOptions);
|
return models.WorkerTimeControl.updateWorkerTimeControlMail(ctx, myOptions);
|
||||||
};
|
};
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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 = ?
|
||||||
|
|
Loading…
Reference in New Issue