2661 - Added clone options #494
|
@ -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;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue