mysql/core_enum_translation_display_name.sql
authorAlan Knowles <alan@roojs.com>
Wed, 29 Jul 2015 08:45:38 +0000 (16:45 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 29 Jul 2015 08:45:38 +0000 (16:45 +0800)
mysql/core_enum_translation.sql

mysql/core_enum_translation.sql [new file with mode: 0644]
mysql/core_enum_translation_display_name.sql [new file with mode: 0644]

diff --git a/mysql/core_enum_translation.sql b/mysql/core_enum_translation.sql
new file mode 100644 (file)
index 0000000..bb0ceac
--- /dev/null
@@ -0,0 +1 @@
+ --- deleted..
\ No newline at end of file
diff --git a/mysql/core_enum_translation_display_name.sql b/mysql/core_enum_translation_display_name.sql
new file mode 100644 (file)
index 0000000..a22cba1
--- /dev/null
@@ -0,0 +1,29 @@
+
+DROP FUNCTION IF EXISTS core_enum_translation_display_name;
+
+DELIMITER $$
+CREATE FUNCTION core_enum_translation_display_name(
+    in_id INT(11),
+    in_lang VARCHAR (256)
+)  
+RETURNS TEXT DETERMINISTIC
+    BEGIN
+
+        DECLARE v_ret TEXT;
+        DECLARE v_orginal TEXT;
+        SET v_ret = '';
+        SET v_orginal = '';
+
+        SELECT display_name INTO v_orginal FROM core_enum WHERE id = in_id;
+        
+        SELECT txt INTO v_ret FROM cms_templatestr WHERE active = 1 AND lang = in_lang AND on_id = in_id AND on_table = 'core_enum' AND on_col = 'display_name' LIMIT 1;
+
+        IF (v_ret IS NULL OR v_ret = '') THEN
+            RETURN v_orginal;
+        END IF;
+
+        RETURN v_ret;
+
+    END $$
+
+DELIMITER ;
\ No newline at end of file