This commit is contained in:
seb
2026-09-29 18:48:15 +02:00
parent 69bd0935cc
commit 23d6742a9f
3 changed files with 79 additions and 3 deletions

View File

@@ -147,6 +147,21 @@ export default function addChild(provider) {
});
const childId = childRes.rows[0]?.id ?? childRes.insertId;
// Copy existing attribute values from father (ancestor attributes that father has)
const fatherAttrsRes = await runner.query(
'SELECT attributevalue_id, sort FROM articleattributevalue WHERE article_id = @fatherId',
{ fatherId },
);
for (const faRow of fatherAttrsRes.rows) {
if (faRow.attributevalue_id !== finalValueId) {
await runner.query(articleAttrValQueries.INSERT_ROW, {
articleId: childId,
attributeValueId: faRow.attributevalue_id,
sort: faRow.sort,
});
}
}
// Link articleattributevalue
await runner.query(articleAttrValQueries.INSERT_ROW, {
articleId: childId,