From 537fec13fd99dde2283fa9f684c632f9459595cd Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 12 Apr 2018 22:41:34 +0300 Subject: [PATCH] Group functions fixed for qtscriptengine --- limereport/lrscriptenginemanager.cpp | 9 +++++++-- limereport/lrscriptenginemanager.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index d50de7e..3b2385e 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -346,8 +346,8 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ LimeReport::Const::FUNCTION_MANAGER_NAME, m_functionManager, QString("function %1(fieldName, bandName, pageitem){\ - pageitem = typeof pageitem !== 'undefined' ? pageitem : 0; \ - return %2.calcGroupFunction(\"%1\",fieldName, bandName, pageitem);}" + if (typeof pageitem == 'undefined') return %2.calcGroupFunction(\"%1\", fieldName, bandName); \ + else return %2.calcGroupFunction(\"%1\", fieldName, bandName, pageitem);}" ).arg(func) .arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); @@ -1471,6 +1471,11 @@ QVariant ScriptFunctionsManager::calcGroupFunction(const QString &name, const QS } } +QVariant ScriptFunctionsManager::calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName) +{ + return calcGroupFunction(name, expressionID, bandName, 0); +} + QVariant ScriptFunctionsManager::line(const QString &bandName) { QString varName = QLatin1String("line_")+bandName.toLower(); diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 41d9b96..a15f524 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -307,6 +307,7 @@ public: foreach(IWrapperCreator* wrapper, m_wrappersFactory.values()){ delete wrapper;} m_wrappersFactory.clear(); } Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName, QObject* currentPage); + Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName); Q_INVOKABLE QVariant line(const QString& bandName); Q_INVOKABLE QVariant numberFormat(QVariant value, const char &format, int precision, const QString &locale); Q_INVOKABLE QVariant dateFormat(QVariant value, const QString& format);