Changeset 427 for trunk/index.php


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/index.php

    r420 r427  
    231231      {
    232232        $UserOptions = new Form('MemberOptions');
    233         $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
    234         $DbRow = $DbResult->fetch_array();
    235         foreach($UserOptions->Definition['Items'] as $Index => $Item)
    236         {
    237           $UserOptions->Values[$Index] = $DbRow[$Index];
    238         }
    239         $UserOptions->OnSubmit = '?Action=MemberOptionsSave';
    240         $Output .= $UserOptions->ShowEditForm();
     233        $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->Modules['User']->User['Id']);
     234        if($DbResult->num_rows > 0)
     235        {
     236          $CustomerUserRel = $DbResult->fetch_assoc();
     237          $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, '.
     238            'Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, '.
     239            'Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
     240           'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']);       
     241          $DbRow = $DbResult->fetch_array();
     242          foreach($UserOptions->Definition['Items'] as $Index => $Item)
     243          {
     244            $UserOptions->Values[$Index] = $DbRow[$Index];
     245          }
     246          $UserOptions->OnSubmit = '?Action=MemberOptionsSave';
     247          $Output .= $UserOptions->ShowEditForm();
     248        } else $Output .= $this->SystemMessage('Chyba', 'Nejste zákazníkem');
    241249      } else
    242250      if($_GET['Action'] == 'MemberOptionsSave')
Note: See TracChangeset for help on using the changeset viewer.