doPhoto updated on item upload
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2023-01-20 13:34:36 +01:00
parent 99338bb6f8
commit 2e988ea701
3 changed files with 29 additions and 7 deletions

View File

@ -145,13 +145,6 @@ module.exports = Self => {
fileName,
myOptions
);
if (item.isPhotoRequested) {
await item.updateAttribute(
'isPhotoRequested',
false,
myOptions
);
}
}
if (fs.existsSync(srcFilePath))

View File

@ -21,6 +21,15 @@ module.exports = Self => {
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});
Self.observe('before save', async function(ctx) {
let currentInstance = ctx.currentInstance;
let oldInstance;
let newInstance;
ctx.hookState.oldInstance === undefined ? oldInstance = false : oldInstance = ctx.hookState.oldInstance;
ctx.hookState.newInstance === undefined ? newInstance = false : newInstance = ctx.hookState.newInstance;
if (oldInstance.image && newInstance.image) {
let query = `UPDATE vn.item SET doPhoto = 0 WHERE id = ${currentInstance.id}`;
await Self.rawSql(query);
}
await Self.availableId(ctx);
});

View File

@ -65,6 +65,26 @@
{{$ctrl.summary.item.itemType.worker.user.name}}
</span>
</vn-label-value>
<vn-label-value label="Active">
<vn-check
disabled="true"
vn-one
ng-model="$ctrl.item.isActive">
</vn-check>
</vn-label-value>
<vn-check
disabled="true"
label="Price in kg"
vn-one
ng-model="$ctrl.item.hasKgPrice">
</vn-check>
<vn-check
label="Fragile"
disabled="true"
vn-one
ng-model="$ctrl.item.isFragile"
info="Is shown at website, app that this item cannot travel (wreath, palms, ...)">
</vn-check>
<vn-label-value label="Do photo"
style="display: grid; align-items: center;">
<vn-check