doPhoto updated on item upload
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
99338bb6f8
commit
2e988ea701
|
@ -145,13 +145,6 @@ module.exports = Self => {
|
||||||
fileName,
|
fileName,
|
||||||
myOptions
|
myOptions
|
||||||
);
|
);
|
||||||
if (item.isPhotoRequested) {
|
|
||||||
await item.updateAttribute(
|
|
||||||
'isPhotoRequested',
|
|
||||||
false,
|
|
||||||
myOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs.existsSync(srcFilePath))
|
if (fs.existsSync(srcFilePath))
|
||||||
|
|
|
@ -21,6 +21,15 @@ module.exports = Self => {
|
||||||
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});
|
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});
|
||||||
|
|
||||||
Self.observe('before save', async function(ctx) {
|
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);
|
await Self.availableId(ctx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,26 @@
|
||||||
{{$ctrl.summary.item.itemType.worker.user.name}}
|
{{$ctrl.summary.item.itemType.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
</vn-label-value>
|
</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"
|
<vn-label-value label="Do photo"
|
||||||
style="display: grid; align-items: center;">
|
style="display: grid; align-items: center;">
|
||||||
<vn-check
|
<vn-check
|
||||||
|
|
Loading…
Reference in New Issue