Clone existing template BUG fixed
This commit is contained in:
parent
b7fbc32e1e
commit
e55317ec43
2 changed files with 7 additions and 4 deletions
|
@ -152,8 +152,10 @@ export default class CUD extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeKey = state.getIn(['type', 'value']);
|
const typeKey = state.getIn(['type', 'value']);
|
||||||
if (!typeKey) {
|
if (!typeKey && !state.getIn(['fromExistingEntity', 'value'])) {
|
||||||
state.setIn(['type', 'error'], t('typeMustBeSelected'));
|
state.setIn(['type', 'error'], t('typeMustBeSelected'));
|
||||||
|
}else{
|
||||||
|
state.setIn(['type', 'error'], null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!state.getIn(['tag_language', 'value'])) {
|
if (!state.getIn(['tag_language', 'value'])) {
|
||||||
|
@ -168,7 +170,7 @@ export default class CUD extends Component {
|
||||||
|
|
||||||
validateNamespace(t, state);
|
validateNamespace(t, state);
|
||||||
|
|
||||||
if (typeKey) {
|
if (typeKey && !state.getIn(['fromExistingEntity', 'value'])) {
|
||||||
this.templateTypes[typeKey].validate(state);
|
this.templateTypes[typeKey].validate(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,12 +92,13 @@ async function create(context, entity) {
|
||||||
|
|
||||||
await shares.rebuildPermissionsTx(tx, { entityTypeId: 'template', entityId: id });
|
await shares.rebuildPermissionsTx(tx, { entityTypeId: 'template', entityId: id });
|
||||||
|
|
||||||
if (entity.fromExistingEntity) {
|
//Returns an error
|
||||||
|
/*if (entity.fromExistingEntity) {
|
||||||
await files.copyAllTx(tx, context, 'template', 'file', entity.existingEntity, 'template', 'file', id);
|
await files.copyAllTx(tx, context, 'template', 'file', entity.existingEntity, 'template', 'file', id);
|
||||||
|
|
||||||
convertFileURLs(entity, 'template', entity.existingEntity, 'template', id);
|
convertFileURLs(entity, 'template', entity.existingEntity, 'template', id);
|
||||||
await tx('templates').update(filterObject(entity, allowedKeys)).where('id', id);
|
await tx('templates').update(filterObject(entity, allowedKeys)).where('id', id);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue