From 5f8750683d3aaa7135e0f97fa5ee0fbcb449d1a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Tue, 3 Apr 2018 15:59:24 +0200
Subject: [PATCH] :ambulance: fix(objectTypes) Make sure objectTypes are stored
 in uppercase

This avoids small efficiency issues in References tab and foreign key
 handling. Might also impact other parts of FD.

issue #5809
---
 include/class_pluglist.inc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc
index c66669cd4..a4c61cc8b 100644
--- a/include/class_pluglist.inc
+++ b/include/class_pluglist.inc
@@ -139,6 +139,20 @@ class pluglist {
         if (!isset($infos['plTitle']) && isset($infos['plShortName'])) {
           $infos['plTitle'] = $infos['plShortName'];
         }
+        if (isset($infos['plObjectType'])) {
+          /* Convert object types to uppercase */
+          foreach(array_keys($infos['plObjectType']) as $key) {
+            if (is_numeric($key)) {
+              $infos['plObjectType'][$key] = strtoupper($infos['plObjectType'][$key]);
+            } else {
+              $newkey = strtoupper($key);
+              if ($newkey != $key) {
+                $infos['plObjectType'][$newkey] = $infos['plObjectType'][$key];
+                unset($infos['plObjectType'][$key]);
+              }
+            }
+          }
+        }
         $infos['plForeignRefs']         = array();
         $infos['INDEX']                 = $index;
         $this->info[$cname]             = $infos;
-- 
GitLab