refs #4632 dmsRecover deprecated
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alexandre Riera 2023-03-08 12:29:09 +01:00
parent 88cde4b8a1
commit 423ae85212
5 changed files with 6 additions and 67 deletions

View File

@ -44,9 +44,6 @@
"DmsType": {
"dataSource": "vn"
},
"DmsRecover": {
"dataSource": "vn"
},
"Docuware": {
"dataSource": "vn"
},

View File

@ -1,37 +0,0 @@
{
"name": "DmsRecover",
"description": "Documental Managment System Recover",
"base": "VnModel",
"log": {
"showField": "ticketFk"
},
"options": {
"mysql": {
"table": "dmsRecover"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"ticketFk": {
"type": "number"
},
"sign": {
"type": "string"
},
"created": {
"type": "date"
}
},
"relations": {
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
}
}
}

View File

@ -1,3 +1,5 @@
DROP TABLE `vn`.`dmsRecover`;
ALTER TABLE `vn`.`delivery` DROP FOREIGN KEY delivery_FK;
ALTER TABLE `vn`.`delivery` DROP COLUMN addressFk;
ALTER TABLE `vn`.`delivery` ADD ticketFk INT NOT NULL;

View File

@ -51,7 +51,7 @@ module.exports = Self => {
ticketFk: ticketId,
longitude: args.location.Longitude,
latitude: args.location.Latitude,
dated: args.signedTime
dated: args.signedTime || new Date()
}, myOptions);
}
}
@ -67,7 +67,8 @@ module.exports = Self => {
if (!ticketDms) return false;
const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions);
if (ticket.isSigned == true) return true;
if (ticket.isSigned == true)
return true;
else
await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions);
@ -108,10 +109,6 @@ module.exports = Self => {
await models.Ticket.uploadFile(ctxUploadFile, id, myOptions);
}
// async function dmsRecover(ticketFk, sign) {
// await models.DmsRecover.create({ticketFk, sign}, myOptions);
// }
try {
for (let i = 0; i < args.tickets.length; i++) {
const ticketState = await models.TicketState.findOne(
@ -120,35 +117,15 @@ module.exports = Self => {
}, myOptions);
if (ticketState.alertLevel >= 2 && !await gestDocExists(args.tickets[i])) {
if (!args.signedTime) args.signedTime = Date.vnNew();
if (args.location) setLocation(args.tickets[i]);
await createGestDoc(args.tickets[i]);
// if (image) {
// if (!fs.existsSync(dir))
// dmsRecover(args.tickets[i], args.signContent);
// else {
// fs.writeFile(image, args.signContent, 'base64', async function(err) {
// if (err) {
// await tx.rollback();
// throw err.message;
// }
// });
// }
// } else
// dmsRecover(args.tickets[i], args.signContent);
// if (id && fileName) {
// await models.TicketDms.replaceOrCreate({ticketFk: args.tickets[i], dmsFk: id}, myOptions);
await Self.rawSql(`CALL vn.ticket_setState(?, ?)`, [args.tickets[i], 'DELIVERED'], myOptions);
// await models.Dms.updateAll({id}, {file: fileName, contentType: 'image/png'}, myOptions);
// }
}
}
if (tx) await tx.commit();
return 'Sign uploaded correctly';
return 'Signs uploaded correctly';
} catch (e) {
if (tx) await tx.rollback();
throw e;