Changeset 58 for trunk


Ignore:
Timestamp:
Feb 3, 2009, 8:26:12 AM (16 years ago)
Author:
george
Message:
  • Opraveno: Chyba řazení seznamu překladů s odlišnými názvy textových sloupců pro různé skupiny překladu. Různý název sloupce způsoboval chybu v ORDER BY.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/TranslationList.php

    r57 r58  
    6767  global $Database, $order, $desc, $TranslationTree, $GroupId, $Table;
    6868 
     69  // Check if order column exists
     70  $Items = $TranslationTree[$GroupId]['Items'];
     71  $I = 0;
     72  while(($I < count($Items)) and ($Items[$I]['MangosColumn'] != $order)) $I++;
     73  if($I >= count($Items)) $order = 'ID';       
     74
    6975  if($limit <> '') $limit = 'LIMIT '.$limit;
    7076
     
    7884    $desc = '';
    7985  }
    80        
     86 
    8187  echo('<table border="1" cellpadding="2" cellspacing="0"><tr>
    8288    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=ID&amp;desc='.$desc.'">Pořadové číslo</a></th>
    8389    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=entry&amp;desc='.$desc.'">Identifikační číslo</a></th>
    84     <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=Title&amp;desc='.$desc.'">Název</a></th>');
     90    <th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order='.$TranslationTree[$GroupId]['Items'][0]['Column'].'&amp;desc='.$desc.'">Název</a></th>');
    8591  if ($address == 'selection') echo('<th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=CountQuests&amp;desc='.$desc.'">Výskyt</a></th>');
    8692  else if($address <> 'notran') echo('<th><a href="?group='.$GroupId.'&amp;action='.$address.'&amp;order=user&amp;desc='.$desc.'">Uživatel</a></th>
     
    112118        <strong>Vypsání nepřeložených textů s limitem na stránku</strong><br /><br />');
    113119
    114   WritePages('?group='.$GroupId.'&amp;action=notran', 'items WHERE items.Language = 0 AND
    115     NOT EXISTS(SELECT 1 FROM '.$Table.' sub WHERE sub.Language <> 0 AND sub.entry = items.entry)');
    116 
    117   WriteQuests('SELECT * FROM '.$Table.' items WHERE items.Language = 0 AND
    118     NOT EXISTS(SELECT 1 FROM '.$Table.' sub WHERE sub.Language <> 0 AND sub.entry = items.entry) ', $_SESSION['limitx'].','.$_SESSION['limity'], 'notran');
     120  WritePages('?group='.$GroupId.'&amp;action=notran', 'AS items WHERE items.Language = 0 AND
     121    NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE sub.Language <> 0 AND sub.entry = items.entry)');
     122
     123  WriteQuests('SELECT * FROM '.$Table.' AS items WHERE (items.Language = 0) AND
     124    NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry)) ', $_SESSION['limitx'].','.$_SESSION['limity'], 'notran');
    119125}
    120126
     
    151157
    152158  WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User
    153     FROM '.$Table.' WHERE Language <> 0 AND '.$Table.'.Complete = 1 AND admin_check = 1', $_SESSION['limitx'].','.$_SESSION['limity'], 'admin_check');
     159    FROM '.$Table.' WHERE (Language <> 0) AND ('.$Table.'.Complete = 1) AND (admin_check = 1)', $_SESSION['limitx'].','.$_SESSION['limity'], 'admin_check');
    154160}
    155161
     
    162168
    163169  WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User
    164     FROM '.$Table.'  WHERE Language <> 0 AND '.$Table.'.Complete = 1 AND admin_check <> 1', $_SESSION['limitx'].','.$_SESSION['limity'], 'admin_nocheck');
     170    FROM '.$Table.'  WHERE (Language <> 0) AND ('.$Table.'.Complete = 1) AND (admin_check <> 1)', $_SESSION['limitx'].','.$_SESSION['limity'], 'admin_nocheck');
    165171}
    166172
  • trunk/includes/databaseconection.php

    r57 r58  
    2424       
    2525    $ReturnCommand = mysql_query($Command, $this->id_connection);
    26         if((mysql_error() != '') and ($Config['Web']['ShowSQLErrors'] = true))
     26        if((mysql_error() != '') and ($Config['Web']['ShowSQLError'] == true))
    2727          echo('<div>'.mysql_error().'<br>'.$Command.'</div>');
    2828    return($ReturnCommand);
Note: See TracChangeset for help on using the changeset viewer.