2661 - Added clone options #494

Merged
carlosjr merged 14 commits from 2661-travel_cloneWithEntries into dev 2020-12-31 10:00:45 +00:00
1 changed files with 37 additions and 31 deletions
Showing only changes of commit c2d50c6044 - Show all commits

View File

@ -48,6 +48,7 @@ module.exports = Self => {
let stmts = [];
let stmt;
try {
stmt = new ParameterizedSQL(
`CALL travel_cloneWithEntries(?, ?, ?, ?, @vTravelFk)`, [
id, started, ended, travel.ref]);
@ -83,5 +84,10 @@ module.exports = Self => {
});
return newTravel.id;
} catch (error) {
if (error.code === 'ER_DUP_ENTRY')
throw new UserError('A travel with this data already exists');
throw error;
}
};
};