<?php

function P_NAME($ID) {
 global $error,$thiss,$result;

 if($COMMAND=='POST_VERIFY') { 
   echo "Weryfikacja niedostepna";
  } else {
  if($_SESSION['CURRENT_MENU']==$thiss->DETECT_EDIT_FUNCTION) {
    		//Wykrycie tabeli nazwy tabeli  SES_X_C
	if(substr($thiss->DETECT_TABLE_NAME,0,4)=='SES_' && substr($thiss->DETECT_TABLE_NAME,-2)=='_A') {
	
	//	echo "<h2>Detect table name=:".$thiss->DETECT_TABLE_NAME."</h2>";

    
			$zap_sql="SELECT concat_ws(' ',BUA.P_NAME,BUA.P_NAME_SECOND) as P_NAME from SERVICES as SV
			 		inner JOIN BILLING_USERS_ADD  as BUA on BUA.id_users=SV.ID_BILLING_USERS

			 
			 where SV.ID='".$_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDIT_TEMPLATE']['ID_SERVICES']."'";//szukamy numeru uslugi
	//		echo $zap_sql;
      ZAP_SQL($zap_sql); 
//       echo "<table border=1 cellspacing=0 cellpadding=1>";
       while ($h=mysql_fetch_object($result)) 
       	 echo "<i>Dane z L2: </i>".$h->P_NAME;
       }
 
    
  } else GETFORMITEM($_SESSION[$thiss->DETECT_TABLE_COLUMN][EDIT_TEMPLATE]['P_NAME'],$_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPE']['P_NAME'],'P_NAME');

 } 


}

