This commit is contained in:
parent
b6e993dadf
commit
32429a58e0
|
@ -44,7 +44,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
const invoiceOut = await Self.findById(id, null, myOptions);
|
const invoiceOut = await Self.findById(id, null, myOptions);
|
||||||
const hasInvoicing = await models.Account.hasRole(userId, 'invoicing', myOptions);
|
const hasInvoicing = await models.Account.hasRole(userId, 'invoicing', myOptions);
|
||||||
console.log(invoiceOut, !hasInvoicing);
|
|
||||||
if (invoiceOut.hasPdf && !hasInvoicing)
|
if (invoiceOut.hasPdf && !hasInvoicing)
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ module.exports = Self => {
|
||||||
ids = ids.split(',');
|
ids = ids.split(',');
|
||||||
|
|
||||||
for (let id of ids) {
|
for (let id of ids) {
|
||||||
console.log(zipConfig, totalSize, zipConfig ? zipConfig.maxSize : null);
|
|
||||||
if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large');
|
if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large');
|
||||||
const invoiceOutPdf = await models.InvoiceOut.download(ctx, id, myOptions);
|
const invoiceOutPdf = await models.InvoiceOut.download(ctx, id, myOptions);
|
||||||
const fileName = extractFileName(invoiceOutPdf[2]);
|
const fileName = extractFileName(invoiceOutPdf[2]);
|
||||||
|
|
|
@ -65,7 +65,6 @@ describe('InvoiceOut filter()', () => {
|
||||||
await invoiceOut.updateAttribute('hasPdf', true, options);
|
await invoiceOut.updateAttribute('hasPdf', true, options);
|
||||||
|
|
||||||
const result = await models.InvoiceOut.filter(ctx, {id: invoiceOut.id}, options);
|
const result = await models.InvoiceOut.filter(ctx, {id: invoiceOut.id}, options);
|
||||||
console.log(result);
|
|
||||||
|
|
||||||
expect(result.length).toEqual(1);
|
expect(result.length).toEqual(1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue