From 3acd3a5209c361cf09c0af5cccb5a81e144aa23b Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 22 Jan 2019 12:00:10 +0200 Subject: [PATCH 1/2] acceptrance status export disabled --- .../Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json | 2 ++ .../Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json | 2 ++ .../Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json | 2 ++ .../Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json | 2 ++ application/Espo/Resources/metadata/entityDefs/User.json | 2 ++ 5 files changed, 10 insertions(+) diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json index b9dbb29fcc..bb426ef413 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json @@ -67,6 +67,8 @@ }, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "importDisabled": true, + "exportDisabled": true, "where": { "=": { "leftJoins": ["users", "contacts", "leads"], diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json index 07cfb8f998..79ab6e4896 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json @@ -211,6 +211,7 @@ "notStorable": true, "layoutListDisabled": true, "layoutDetailDisabled": true, + "importDisabled": true, "layoutMassUpdateDisabled": true, "exportDisabled": true, "view": "crm:views/lead/fields/acceptance-status", @@ -223,6 +224,7 @@ "layoutListDisabled": true, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "importDisabled": true, "exportDisabled": true, "view": "crm:views/lead/fields/acceptance-status", "link": "calls", diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json index 5897aff29e..bd4790ec68 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json @@ -137,6 +137,7 @@ "layoutListDisabled": true, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "importDisabled": true, "exportDisabled": true, "view": "crm:views/lead/fields/acceptance-status", "link": "meetings", @@ -148,6 +149,7 @@ "layoutListDisabled": true, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "importDisabled": true, "exportDisabled": true, "view": "crm:views/lead/fields/acceptance-status", "link": "calls", diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json index 35c4580c4c..018b7cf555 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json @@ -62,6 +62,8 @@ }, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "importDisabled": true, + "exportDisabled": true, "where": { "=": { "leftJoins": ["users", "contacts", "leads"], diff --git a/application/Espo/Resources/metadata/entityDefs/User.json b/application/Espo/Resources/metadata/entityDefs/User.json index 7e8a06d03f..5f27069453 100644 --- a/application/Espo/Resources/metadata/entityDefs/User.json +++ b/application/Espo/Resources/metadata/entityDefs/User.json @@ -182,6 +182,7 @@ "layoutListDisabled": true, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "importDisabled": true, "exportDisabled": true, "view": "crm:views/lead/fields/acceptance-status", "link": "meetings", @@ -193,6 +194,7 @@ "layoutListDisabled": true, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "importDisabled": true, "exportDisabled": true, "view": "crm:views/lead/fields/acceptance-status", "link": "calls", From df3a449a72e7e283ead9bf744befdc7958e15cb2 Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 22 Jan 2019 16:33:56 +0200 Subject: [PATCH 2/2] fix output error --- application/Espo/Core/Utils/Api/Output.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/application/Espo/Core/Utils/Api/Output.php b/application/Espo/Core/Utils/Api/Output.php index a9181f5cee..468627211e 100644 --- a/application/Espo/Core/Utils/Api/Output.php +++ b/application/Espo/Core/Utils/Api/Output.php @@ -33,14 +33,18 @@ class Output { private $slim; - protected $errorDesc = array( + protected $errorDesc = [ 400 => 'Bad Request', 401 => 'Unauthorized', 403 => 'Forbidden', 404 => 'Page Not Found', 409 => 'Conflict', 500 => 'Internal Server Error', - ); + ]; + + protected $allowedStatusCodeList = [ + 200, 400, 401, 403, 404, 409, 500 + ]; protected $ignorePrintXStatusReasonExceptionClassNameList = [ 'PDOException' @@ -104,6 +108,11 @@ class Output if ($exception && in_array(get_class($exception), $this->ignorePrintXStatusReasonExceptionClassNameList)) { $toPrintXStatusReason = false; } + + if (!in_array($statusCode, $this->allowedStatusCodeList)) { + $statusCode = 500; + } + $this->getSlim()->response()->setStatus($statusCode); if ($toPrintXStatusReason) { $this->getSlim()->response()->headers->set('X-Status-Reason', $text);