Ignore:
Timestamp:
Jan 3, 2015, 7:34:55 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Form class ItemActions changed to define URL using #RowId instead of addition of &i=number.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Finance/UserState.php

    r720 r721  
    7070    $this->System->Modules['Finance']->LoadTariffs(1);
    7171
    72     if(array_key_exists('Subject', $_GET))
     72    // Determine which customer should be displayed
     73    if(array_key_exists('i', $_GET))
    7374    {
    7475      if(!$this->System->User->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
    75       $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id='.$_GET['Subject']);
    76       if($DbResult->num_rows > 0)
    77         $Subject = $DbResult->fetch_assoc();
    78       else return($this->SystemMessage('Chyba', 'Subjekt nenalezen'));
     76      $CustomerId = $_GET['i'];
    7977    } else
    8078    {
     
    8583      {
    8684        $CustomerUserRel = $DbResult->fetch_assoc();
    87         $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id=(SELECT Subject FROM Member WHERE Id='.$CustomerUserRel['Customer'].')');
    88         $Subject = $DbResult->fetch_assoc();
     85        $CustomerId = $CustomerUserRel['Customer'];
    8986      } else return($this->SystemMessage('Chyba', 'Nejste zákazníkem'));
    9087    }
    91 
    92     if(!array_key_exists('show', $_GET)) $_GET['show'] = '';
    93     $DbResult = $this->Database->query('SELECT Member.* '.
    94       'FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Subject='.$Subject['Id']);
    95     if($DbResult->num_rows == 0)
     88       
     89    // Load customer info
     90    $DbResult = $this->Database->query('SELECT * FROM Member WHERE Id='.$CustomerId);
     91    if($DbResult->num_rows == 1)
    9692    {
    97       return($this->SystemMessage('Položka nenalezena', 'Zákazník nenalezen'));
    98     }
    99     $Member = $DbResult->fetch_assoc();
    100     $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">';
     93        $Customer = $DbResult->fetch_assoc();     
     94    } else return($this->SystemMessage('Položka nenalezena', 'Zákazník nenalezen'));
     95   
     96   
     97    // Load subject info
     98    $DbResult = $this->Database->query('SELECT * FROM Subject WHERE Id='.$Customer['Subject']);
     99    if($DbResult->num_rows == 1)
     100    {   
     101      $Subject = $DbResult->fetch_assoc();     
     102    } else return($this->SystemMessage('Položka nenalezena', 'Subjekt nenalezen'));
     103   
     104   
     105    $Output = '<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">';       
    101106
    102107    // Account state
     
    131136    $DbResult = $this->Database->query('SELECT Service.Name, Service.Price FROM ServiceCustomerRel '.
    132137      'LEFT JOIN Service ON Service.Id=ServiceCustomerRel.Service '.
    133       'WHERE (ServiceCustomerRel.Customer='.$Member['Id'].') AND (ServiceCustomerRel.Action IS NULL)');
     138      'WHERE (ServiceCustomerRel.Customer='.$Customer['Id'].') AND (ServiceCustomerRel.Action IS NULL)');
    134139    while($DbRow = $DbResult->fetch_assoc())
    135140    {
    136           $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>';
     141            $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>';
    137142      $Total += $DbRow['Price'];
    138143    }
Note: See TracChangeset for help on using the changeset viewer.