diff --git a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js index aec209657..fe005f1ab 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js +++ b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js @@ -37,12 +37,12 @@ module.exports = Self => { Self.downloadZip = async function(ctx, ids, options) { const models = Self.app.models; const myOptions = {}; - const zipConfig = await models.ZipConfig.findOne(null, myOptions); const zip = new JSZip(); if (typeof options == 'object') Object.assign(myOptions, options); + const zipConfig = await models.ZipConfig.findOne(null, myOptions); let totalSize = 0; ids = ids.split(','); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js index e458ad9ff..4d1833635 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js @@ -3,7 +3,7 @@ const UserError = require('vn-loopback/util/user-error'); describe('InvoiceOut downloadZip()', () => { const userId = 9; - const invoiceIds = [1, 2]; + const invoiceIds = '1,2'; const ctx = { req: {