Fix #6567 - translation for package names
authorAlan Knowles <alan@roojs.com>
Wed, 20 Jan 2021 08:50:11 +0000 (16:50 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 20 Jan 2021 08:50:11 +0000 (16:50 +0800)
Import/Core_templatestr.php

index c71d884..fe0f851 100644 (file)
@@ -83,6 +83,11 @@ class Pman_Admin_Import_Core_templatestr extends Pman
     { 
         $ret = array();
         foreach($rows as $r) {
+            if (isset($r['table id'])) {
+                $ret[] = $this->updateTableTranslation($r);
+                continue;
+            }
+            
             $ret[] = $this->updateTranslation($r);
             
         }
@@ -116,6 +121,33 @@ class Pman_Admin_Import_Core_templatestr extends Pman
     }
     
     
+    
+    function updateTableTranslation($r)
+    {
+      //   print_R($r); DB_DataObject::DebugLevel(1);
+        $tr = DB_DataObject::Factory('core_templatestr');
+        $tr->autoJoin();
+
+       
+        $tr->whereAdd("core_templatestr.on_id='{$tr->escape($r['table id'])}'");
+        $tr->whereAdd("core_templatestr.on_table='{$tr->escape($r['table'])}'");
+        $tr->whereAdd("core_templatestr.on_col='{$tr->escape($r['column'])}'");
+        $tr->whereAdd("join_src_id_id.mdsum='{$tr->escape($r['code'])}'");
+        $tr->lang = $r['translation'];
+        if ($tr->find(true) && strlen(trim($r['txt']))) {
+            $tt = DB_DataObject::Factory('core_templatestr');
+            $tt->get($tr->id);
+            $tr= clone($tt);
+            $tt->txt = $r['txt'];
+            $tt->updated = date('Y-m-d H:i:s');
+            $tt->update($tr);
+             
+            return 1;
+        }
+        return 0;
+    }
+    
+    
     function readXLS($file) {
         
         require_once 'System.php';