From 43089b55d64059efc8868c0c4b0fc82e8807fe4d Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 24 Jun 2016 23:17:13 +0300 Subject: [PATCH] Fix: #38 Allow to suppress warnings for unknown fields --- limereport/lritemdesignintf.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/limereport/lritemdesignintf.cpp b/limereport/lritemdesignintf.cpp index 8f48285..1cf1774 100644 --- a/limereport/lritemdesignintf.cpp +++ b/limereport/lritemdesignintf.cpp @@ -149,14 +149,12 @@ QString ContentItemDesignIntf::expandDataFields(QString context, ExpandType expa context.replace(rx.cap(0),fieldValue); } else { - QString error; - if (dataManager->lastError().isEmpty()){ - error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); - dataManager->putError(error); - } else { - error = dataManager->lastError(); - } - context.replace(rx.cap(0),error); + QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); + dataManager->putError(error); + if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); } } } @@ -188,7 +186,13 @@ QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass p pos=0; } } else { - context.replace(rx.cap(0),tr("Variable %1 not found").arg(variable)); + QString error; + error = tr("Variable %1 not found").arg(variable); + dataManager->putError(error); + if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); } } }