From 79741fba3c1ea2be48c0eb088161c5e97c4753f7 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 15 Apr 2019 14:47:12 +0800 Subject: [PATCH] Fix #5856 - language translations of countries and languages etc. --- DataObjects/I18n.php | 18 ++++++++++++++++++ I18n.php | 2 +- Pman.I18n.js | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/DataObjects/I18n.php b/DataObjects/I18n.php index 3f52fb5a..c85a036b 100644 --- a/DataObjects/I18n.php +++ b/DataObjects/I18n.php @@ -127,9 +127,23 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject $this->buildDB(); // ensure we have the full database... $this->selectAdd(" + id as id, i18n_translate(ltype, lkey, 'en') as lval_en "); } + + if (!empty($q['_as_code_and_title'])) { + $tn = $this->tableName(); + + $this->selectAdd(); + $this->selectAdd(" + {$tn}.lval as title, + {$tn}.lkey as code + "); + if (!empty($q['_title'])) { + $this->whereAdd("{$tn}.lval like '{$this->escape($_REQUEST['_title'])}%'"); + } + } if (!empty($q['!code'])) { $this->whereAddIn('!lkey', explode(',', $q['!code']), 'string'); @@ -140,6 +154,10 @@ class Pman_Core_DataObjects_I18n extends DB_DataObject $this->whereAdd("upper(lval) LIKE '%{$v}%'"); } + if (!empty($q['query']['name_starts'])) { + $this->whereAdd("lval LIKE '". $this->escape($q['query']['name_starts']). "%'"); + } + if (!empty($q['_filtered']) && !empty($this->ltype)) { $cfg = $this->cfg(); $filter = $cfg[$this->ltype]; diff --git a/I18n.php b/I18n.php index 15f11987..8367964c 100644 --- a/I18n.php +++ b/I18n.php @@ -120,7 +120,7 @@ class Pman_Core_I18n extends Pman $i = DB_DataObject::Factory('I18n'); - + $i->is_active = 1; switch($s) { case 'Lang': diff --git a/Pman.I18n.js b/Pman.I18n.js index eefef4d4..d59683bd 100644 --- a/Pman.I18n.js +++ b/Pman.I18n.js @@ -212,7 +212,8 @@ Pman.I18n = { reader: Pman.I18n.reader, listeners : { - loadexception : Pman.loadException + loadexception : Pman.loadException, + }, remoteSort: false, -- 2.39.2