21 lines
874 B
JavaScript
21 lines
874 B
JavaScript
const UserError = require('vn-loopback/util/user-error');
|
|
|
|
module.exports = Self => {
|
|
require('../methods/invoice-in/filter')(Self);
|
|
require('../methods/invoice-in/summary')(Self);
|
|
require('../methods/invoice-in/clone')(Self);
|
|
require('../methods/invoice-in/toBook')(Self);
|
|
require('../methods/invoice-in/getTotals')(Self);
|
|
require('../methods/invoice-in/invoiceInPdf')(Self);
|
|
require('../methods/invoice-in/invoiceInEmail')(Self);
|
|
require('../methods/invoice-in/getSerial')(Self);
|
|
require('../methods/invoice-in/corrective')(Self);
|
|
require('../methods/invoice-in/exchangeRateUpdate')(Self);
|
|
|
|
Self.rewriteDbError(function(err) {
|
|
if (err.code === 'ER_ROW_IS_REFERENCED_2' && err.sqlMessage.includes('vehicleInvoiceIn'))
|
|
return new UserError(`This invoice has a linked vehicle.`);
|
|
return err;
|
|
});
|
|
};
|