Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2341-Entry_lastBuy_section

This commit is contained in:
Carlos Jimenez Ruiz 2020-08-27 15:14:41 +02:00
commit a66656dcce
4 changed files with 14 additions and 11 deletions

View File

@ -90,7 +90,9 @@ module.exports = Self => {
); );
} }
await fs.unlink(srcFilePath); if (fs.existsSync(srcFilePath))
await fs.unlink(srcFilePath);
await tx.commit(); await tx.commit();
return newImage; return newImage;
} catch (e) { } catch (e) {

View File

@ -19,7 +19,6 @@ module.exports = Self => {
Self.downloadImages = async() => { Self.downloadImages = async() => {
const models = Self.app.models; const models = Self.app.models;
let image;
try { try {
const tempPath = path.join('/tmp/salix-image'); const tempPath = path.join('/tmp/salix-image');
@ -27,7 +26,7 @@ module.exports = Self => {
await fs.mkdir(tempPath, {recursive: true}); await fs.mkdir(tempPath, {recursive: true});
const timer = setInterval(async() => { const timer = setInterval(async() => {
image = await Self.findOne({where: {error: null}}); const image = await Self.findOne({where: {error: null}});
// Exit loop // Exit loop
if (!image) return clearInterval(timer); if (!image) return clearInterval(timer);
@ -62,9 +61,9 @@ module.exports = Self => {
await errorHandler(image.itemFk, error, filePath); await errorHandler(image.itemFk, error, filePath);
} }
}); });
}, 1500); }, 1000);
} catch (error) { } catch (error) {
await errorHandler(image.itemFk, error); throw new Error('Try-catch error: ', error);
} }
async function errorHandler(rowId, error, filePath) { async function errorHandler(rowId, error, filePath) {
@ -76,10 +75,10 @@ module.exports = Self => {
await row.updateAttribute('error', error); await row.updateAttribute('error', error);
if (filePath) if (filePath && fs.existsSync(filePath))
await fs.unlink(filePath); await fs.unlink(filePath);
} catch (error) { } catch (err) {
throw error; throw new Error(`ErrorHandler error: ${err}`);
} }
} }
}; };

View File

@ -58,7 +58,7 @@
</vn-th> </vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
<vn-th number>Id</vn-th> <vn-th number id="ticketId">Id</vn-th>
<vn-th>Quantity</vn-th> <vn-th>Quantity</vn-th>
<vn-th>Item</vn-th> <vn-th>Item</vn-th>
<vn-th number>Price</vn-th> <vn-th number>Price</vn-th>
@ -102,9 +102,8 @@
ng-click="descriptor.show($event, sale.itemFk, sale.id)"> ng-click="descriptor.show($event, sale.itemFk, sale.id)">
{{sale.itemFk}} {{sale.itemFk}}
</span> </span>
<vn-autocomplete ng-if="!sale.id" <vn-autocomplete ng-if="!sale.id" class="dense"
vn-focus vn-focus
vn-one
url="Items" url="Items"
ng-model="sale.itemFk" ng-model="sale.itemFk"
show-field="name" show-field="name"

View File

@ -53,6 +53,9 @@ vn-ticket-sale {
padding: 0!important; padding: 0!important;
} }
} }
#ticketId {
min-width: 150px
}
} }
.vn-popover .transfer { .vn-popover .transfer {
.vn-textfield { .vn-textfield {