refs #5995 Added getExternalCmrs #1703

Merged
guillermo merged 5 commits from 5995-liliumExternalCmr into master 2023-08-10 08:35:29 +00:00
1 changed files with 4 additions and 20 deletions
Showing only changes of commit b197109556 - Show all commits

View File

@ -73,23 +73,7 @@ module.exports = Self => {
}; };
const conn = Self.dataSource.connector; const conn = Self.dataSource.connector;
let where = buildFilter(params, (param, value) => { let where = buildFilter(params, (param, value) => {return {[param]: value}});
switch (param) {
case 'cmrFk':
return {'cmrFk': value};
case 'ticketFk':
return {'ticketFk': value};
case 'country':
return {'country': value};
case 'clientFk':
return {'clientFk': value};
case 'hasCmrDms':
return {'hasCmrDms': value};
case 'shipped':
return {'shipped': value};
}
});
filter = mergeFilters(filter, {where}); filter = mergeFilters(filter, {where});
if (!filter.where) { if (!filter.where) {
@ -140,10 +124,10 @@ module.exports = Self => {
`); `);
stmt.merge(conn.makeSuffix(filter)); stmt.merge(conn.makeSuffix(filter));
let itemsIndex = stmts.push(stmt) - 1; const itemsIndex = stmts.push(stmt) - 1;
let sql = ParameterizedSQL.join(stmts, ';'); const sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql); const result = await conn.executeStmt(sql);
return itemsIndex === 0 ? result : result[itemsIndex]; return itemsIndex === 0 ? result : result[itemsIndex];
}; };
}; };