feat: check general status 'open' to close ticket
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
cd78afb539
commit
28bf7bd747
|
@ -30,6 +30,7 @@ module.exports = Self => {
|
|||
|
||||
const sql = `SELECT ot.ticket_id, ot.number
|
||||
FROM osticket.ost_ticket ot
|
||||
JOIN osticket.ost_ticket_status ots ON ots.id = ot.status_id
|
||||
JOIN osticket.ost_thread ot2 ON ot2.object_id = ot.ticket_id AND ot2.object_type = 'T'
|
||||
JOIN (
|
||||
SELECT ote.thread_id, MAX(ote.created) created, MAX(ote.updated) updated
|
||||
|
@ -38,7 +39,7 @@ module.exports = Self => {
|
|||
GROUP BY ote.thread_id
|
||||
) sub ON sub.thread_id = ot2.id
|
||||
WHERE ot.isanswered = 1
|
||||
AND status_id IN (${config.oldStatusId})
|
||||
AND ots.state = '${config.oldStatus}'
|
||||
AND IF(sub.updated > sub.created, sub.updated, sub.created) < DATE_SUB(CURDATE(), INTERVAL ${config.day} DAY)`;
|
||||
|
||||
let ticketsId = [];
|
||||
|
@ -96,7 +97,7 @@ module.exports = Self => {
|
|||
const ostUri = `${config.host}/ajax.php/tickets/${ticketId}/status`;
|
||||
const data = {
|
||||
status_id: config.newStatusId,
|
||||
comments: undefined,
|
||||
comments: config.comment,
|
||||
undefined: config.action
|
||||
};
|
||||
const params = {
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"oldStatusId": {
|
||||
"type": "number"
|
||||
"oldStatus": {
|
||||
"type": "string"
|
||||
},
|
||||
"newStatusId": {
|
||||
"type": "number"
|
||||
|
@ -32,6 +32,9 @@
|
|||
},
|
||||
"day": {
|
||||
"type": "number"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,13 +3,14 @@ CREATE TABLE `vn`.`osTicketConfig` (
|
|||
`host` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`user` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`password` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`oldStatusId` int(11) DEFAULT NULL,
|
||||
`oldStatus` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`newStatusId` int(11) DEFAULT NULL,
|
||||
`action` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`day` int(11) DEFAULT NULL,
|
||||
`comment` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
|
||||
INSERT INTO `vn`.`osTicketConfig`(id, host, `user`, password, oldStatusId, newStatusId, `action`, `day`)
|
||||
INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`)
|
||||
VALUES
|
||||
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', 1, 3, 'Cerrar', 60);
|
||||
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente');
|
||||
|
|
Loading…
Reference in New Issue