Ignore:
Timestamp:
Oct 10, 2012, 8:46:02 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Další chybné použití tabulky UserCustomerRel vedlo k chybě při zobrazení financí uživatele, který má právo platícího klienta, ale nemá vazbu na tabulu Member.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/user_state.php

    r415 r427  
    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 Customer FROM UserCustomerRel WHERE User='.$UserId.' LIMIT 1))');
    25       $Subject = $DbResult->fetch_assoc();
     24      $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$UserId.' LIMIT 1');
     25      if($DbResult->num_rows > 0)
     26      {
     27        $CustomerUserRel = $DbResult->fetch_assoc();
     28        $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id='.$CustomerUserRel['Customer'].')');
     29        $Subject = $DbResult->fetch_assoc();
     30      } else return($this->SystemMessage('Chyba', 'Nejste zákazníkem'));
    2631    }
    2732   
     
    4247    $FinanceYearSelected = $DbResult->fetch_assoc();
    4348    $YearWhere = ' WHERE (Time >= "'.$FinanceYearSelected['DateStart'].'") AND (Time <= "'.$FinanceYearSelected['DateEnd'].'")';
    44 
    45    
     49   
    4650   
    4751    // Year list
Note: See TracChangeset for help on using the changeset viewer.