Changeset 410


Ignore:
Timestamp:
Oct 4, 2012, 10:12:08 AM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Vazba tabulky User na Member oddělena do samostatné tabulky jako vztah N:N.
Location:
trunk
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/finance.php

    r409 r410  
    172172      $Consumption = 0;
    173173      $ID = $Member['NetworkSegment'];
    174       while($ID != 'NULL')
     174      while($ID != '')
    175175      {
    176176        $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$ID);
     
    213213    $Output = 'Aktualizuji parametry segmentů...<br />';
    214214    $this->Database->query('UPDATE `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0');     // Vynulovat počty uživatelů
    215     $DbResult = $this->Database->query('SELECT * FROM `NetworkSegments`');
     215    $DbResult = $this->Database->query('SELECT * FROM `NetworkSegment`');
    216216    while($NetworkSegment = $DbResult->fetch_array())
    217217    {
     
    222222      $RowP2 = $DbResult2->fetch_array();
    223223
    224       $DbResult2 = $this->Database->query('SELECT SUM(Price) AS Price, SUM(Consumption) AS Consumption FROM NetworkDevice WHERE Segment='.$NetworkSegment['Id'].' AND Used=1');
     224      $DbResult2 = $this->Database->query('SELECT SUM(Price) AS Price, SUM(Consumption) AS Consumption FROM Product WHERE Segment='.$NetworkSegment['Id'].' AND Used=1');
    225225      $Row2 = $DbResult2->fetch_array();
    226       $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['id']);
     226      $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['Id']);
    227227      $Row3 = $DbResult2->fetch_array();
    228       $ID = $NetworkSegment['parent'];
     228      $ID = $NetworkSegment['Parent'];
    229229      while($ID != 0)
    230230      {
     
    241241    $DbResult = $this->Database->select('Member', 'COUNT(*)');
    242242    $Row = $DbResult->fetch_array();
    243     $DbResult = $this->Database->update('NetworkSegments', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
     243    $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
    244244    $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters');
    245245    return($Output);
  • trunk/finance/user_state.php

    r409 r410  
    2222      if(!$this->System->Modules['User']->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
    2323      $UserId = $this->System->Modules['User']->User['Id'];
    24       $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Member FROM User WHERE Id='.$UserId.'))');
     24      $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id=(SELECT Customer FROM UserCustomerRel WHERE User='.$UserId.'))');
    2525      $Subject = $DbResult->fetch_assoc();
    2626    }
  • trunk/user.php

    r406 r410  
    5252    if($Row['User'] != $this->AnonymousUserId)
    5353    {
    54       $Query = $this->Database->select('User', '*', 'Id='.$Row['User']);
     54      $Query = $this->Database->query('SELECT *, UserCustomerRel.Customer AS Member FROM User JOIN UserCustomerRel ON UserCustomerRel.User=User.Id WHERE User.Id='.$Row['User']);     
    5555      $this->User = $Query->fetch_assoc();
    5656      $Result = USER_LOGGED;
Note: See TracChangeset for help on using the changeset viewer.