Ignore:
Timestamp:
Dec 6, 2013, 7:07:56 PM (11 years ago)
Author:
maron
Message:
  • Fixed: Longest name first
  • Fixed: Search names in every translate group
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/global.php

    r621 r628  
    538538  foreach($TablesColumn as $Table => $Column)
    539539  { 
    540     $sql = 'SELECT `ID`,`'.$Column.'` AS Orig, (SELECT `'.$Column.'` FROM `'.$Table.'` AS `T` WHERE '.
     540    $sql = 'SELECT `ID`, (SELECT CONCAT(  \''.GetIDbyName($Table).'\' )) AS  `GoupId`,`'.$Column.'` AS Orig, (SELECT `'.$Column.'` FROM `'.$Table.'` AS `T` WHERE '.
    541541      '(`O`.`Entry` = `T`.`Entry`) AND (`Language` <> '.$Config['OriginalLanguage'].') LIMIT 1) AS `Tran` FROM `'.$Table.'` AS `O` WHERE ';
    542542    $groupby = ' GROUP BY `'.$Column.'` ';
    543                                        // ORDER BY LENGTH('.$Column.') DESC
     543    $orderby = ' ORDER BY LENGTH(Orig) DESC ';
    544544
    545545    $where = '(`Language` = '.$Config['OriginalLanguage'].') ';
     
    563563      $where .= ')';
    564564    }
    565       if ($SqlOK) {
    566         $DbResult = $System->Database->query($sql.$where.$groupby.'  ORDER BY LENGTH(Orig) DESC');
     565      if ($SqlOK) {                                                       
     566        //$sql.$where.$groupby.$orderby
     567//          $buff[] = array($Line['ID'], GetIDbyName($Table), $Line['Orig'], $Line['Tran']);
     568        if ($sqlall <> '') { $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';}
     569        else {$sqlall .= ' ( '.$sql.$where.$groupby.' )'; }
     570      }
     571
     572  }   
     573        $DbResult = $System->Database->query($sqlall.$orderby);
    567574    //  echo ($sql.'|'.$where.'|'.$groupby);
    568575        while($Line = $DbResult->fetch_assoc())
    569576        {
    570           $buff[] = array($Line['ID'], GetIDbyName($Table), $Line['Orig'], $Line['Tran']);
     577          $buff[] = array($Line['ID'], $Line['GoupId'], $Line['Orig'], $Line['Tran']);
    571578        }
    572       }
    573 
    574    // if ($sqlall <> '') { $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';}
    575   //  else {$sqlall .= ' ( '.$sql.$where.$groupby.' )'; }
    576   }
     579   
    577580    return $buff;
    578581}
Note: See TracChangeset for help on using the changeset viewer.