From 690e87a3fb0e8d1f319cf785640becfe01b6a116 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Oct 2019 12:05:00 +0200 Subject: [PATCH 1/3] select manager error if order by non existing field --- application/Espo/Core/SelectManagers/Base.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/Espo/Core/SelectManagers/Base.php b/application/Espo/Core/SelectManagers/Base.php index 04c042f669..9f3a521c29 100644 --- a/application/Espo/Core/SelectManagers/Base.php +++ b/application/Espo/Core/SelectManagers/Base.php @@ -186,6 +186,12 @@ class Base $result['orderBy'] = 'LIST:' . $sortBy . ':' . implode(',', $list); return; } + } else { + if (strpos($sortBy, '.') === false && strpos($sortBy, ':') === false) { + if (!$this->getSeed()->hasAttribute($sortBy)) { + throw new Error("Order by non-existing field."); + } + } } } if (!$desc) { From 3d8be61fbfd76ca803e2c1b8d6f2e0aff604e413 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Oct 2019 12:05:33 +0200 Subject: [PATCH 2/3] amend --- application/Espo/Core/SelectManagers/Base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/Espo/Core/SelectManagers/Base.php b/application/Espo/Core/SelectManagers/Base.php index 9f3a521c29..e51c635675 100644 --- a/application/Espo/Core/SelectManagers/Base.php +++ b/application/Espo/Core/SelectManagers/Base.php @@ -189,7 +189,7 @@ class Base } else { if (strpos($sortBy, '.') === false && strpos($sortBy, ':') === false) { if (!$this->getSeed()->hasAttribute($sortBy)) { - throw new Error("Order by non-existing field."); + throw new Error("Order by non-existing field '{$sortBy}'."); } } } From 57803c08285bb973bd74495c2959a5614ecaf664 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Oct 2019 12:24:03 +0200 Subject: [PATCH 3/3] v --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c04af1a02..7d36d3a2e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "espocrm", - "version": "5.7.6", + "version": "5.7.7", "description": "", "main": "index.php", "repository": {