From 6110295cc287541f1b447bd6ead3ea4ddcba17ec Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 10 Feb 2025 11:40:54 +0100 Subject: [PATCH] fix: refs #6897 update entry_clone method to return newEntryId instead of result --- modules/entry/back/methods/entry/cloneEntry.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/entry/back/methods/entry/cloneEntry.js b/modules/entry/back/methods/entry/cloneEntry.js index 24a2f7a75c..fa4b479060 100644 --- a/modules/entry/back/methods/entry/cloneEntry.js +++ b/modules/entry/back/methods/entry/cloneEntry.js @@ -24,7 +24,6 @@ module.exports = Self => { const userId = ctx.req.accessToken.userId; const myOptions = {userId}; let tx; - let result; if (typeof options == 'object') Object.assign(myOptions, options); @@ -32,12 +31,13 @@ module.exports = Self => { tx = await Self.beginTransaction({}); myOptions.transaction = tx; } - try { - result = await Self.rawSql('CALL entry_clone(?)', [id], myOptions); + await Self.rawSql('CALL entry_clone(?, @newEntryId)', [id], myOptions); + const result = await Self.rawSql('SELECT @newEntryId', [], myOptions); + const newEntryId = result[0]['@newEntryId']; if (tx) await tx.commit(); - return result[0]; + return newEntryId; } catch (e) { if (tx) await tx.rollback(); throw e;