Message expliquant les différences

This commit is contained in:
Vincent Vandemeulebrouck 2021-06-02 23:41:25 +02:00
parent ebb6b34cce
commit 4371937110

View File

@ -195,9 +195,15 @@ export class RdDItem extends Item {
if (itemData.name != otherData.name) return false;
if (tplData.quantite == undefined) return false;
for (const [key, value] of Object.entries(tplData)) {
if (['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key)) continue;
if (value != otherTplData[key]) return false;
const differences = Object.entries(tplData).filter(([key, value]) => !['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key))
.filter(([key, value]) => value != otherTplData[key]);
if (differences.length > 0) {
let message = `Impossible de regrouper les ${itemData.type} ${itemData.name}: `;
for (const [key, value] of differences){
message += `<br>${key}: ${value} vs ${otherTplData[key]}`;
}
ui.notifications.info(message)
return false;
}
return true;
}