<?php


function NEW_RECORD() {
global $thiss,$MENU_INIT,$ARG1,$ARG1_VAL,$SQL_USER,$SQL_DATABASE,$INTERFACE_ADDR,$SQL_USER_PASS,$PHP_SELF;
//DETECT_TABLE_COLUMN();
if(strstr($_SESSION[$thiss->DETECT_TABLE_COLUMN]['FUNCPERMEDIT']['NEW_RECORD'],"X")) {
 //if($_SESSION[$thiss->DETECT_TABLE_COLUMN][
echo'<table width="100%" border="1" cellspacing="0" cellpadding="0" class="tbl-view">';
echo'<thead>';
// echo "<table width='100%' border='1' cellspacing='1' cellpadding='1'><tr><td colspan=2>";
 echo '<tr><td colspan=2>';
 //$TEMP="P_NAME P_NIP P_PESEL P_OTHER_DOC P_ADDRESS_CITY P_ADDRESS_POST_CODE P_ADDRESS_POST_OFFICE P_ADDRESS_STREET P_ADDRESS_HOUSE S_ADDRESS_STREET P_PHONE P_FAX P_CONTACT_PERSON P_OTHER_INFO P_DEALNUMBER P_DEAL_DATE P_DEALEXPIRE A_ADM_COMPANY P_INSTALL_QUOTE P_PERIOD_QUOTE P_PERIOD_MONTHS P_SERVICE_QUOTA P_ACCOUNT P_ACCOUNT_LIMIT S_HOST S_ACCOUNT S_ALIAS S_PASSWD";
 $TEMP=explode(" ", $TEMP);
     echo "Podaj dane do wprowadzenia nowego rekordu do bazy $thiss->DETECT_TABLE_NAME ";
     CREATE_MENUFUNC_NOTD_INIT($_SESSION['LAST_MENU'],'<img src=icon/back.gif border=0 alt=POWROT>');
     echo "</TD></TR>";
echo'</thead>';
echo'<tbody>';
	echo '<FORM ACTION="' . $_SERVER['PHP_SELF'] . '" method="POST" name="NEWRECORD_SUBMIT">';
	echo '<input type="HIDDEN" name="FUNCTION_INIT" value="TABLE_INSERTDB" />';
	$t = 0;
	foreach ($_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC'] as $value) {
		if (strstr($_SESSION[$thiss->DETECT_TABLE_COLUMN]['PERMEDIT']["$value"],"C")) {
			echo'<tr class="row-' . ($t = 1 - $t) . '">';
			if (!($_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC_TO_LANG'][$value])) {
				echo "<td><font size=-1>".$_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC'][$_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC_TO_KEY']["$value"]]." <font size=-1></font></td><td>";
			} else {
				echo "<td>".$_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC_TO_LANG'][$value]."<br /><font size=-2>".$value."</font></td><td>";
			}
      if($_SESSION[LAST_MENU]==$thiss->DETECT_TABLE_NAME) {
//	$_SESSION[$thiss->DETECT_TABLE_COLUMN]['NEW_RECORD'][$value]=$_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC_TO_LANG'][$value]; 
        if((strstr($ARG1_VAL,'RESTORE'))) $_SESSION[$thiss->DETECT_TABLE_COLUMN]['NEW_RECORD'][$value]=$_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDIT_TEMPLATE'][$value];
      }
			//TODO 2007-08-02 test test restore capability 
			if((strstr($ARG1_VAL,'RESTORE'))) $_SESSION[$thiss->DETECT_TABLE_COLUMN]['NEW_RECORD'][$value]=$_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDIT_TEMPLATE'][$value];
			if(!isset($_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPESPECIAL'][$value])) {
				GETFORMITEM($_SESSION[$thiss->DETECT_TABLE_COLUMN]['NEW_RECORD'][$value],$_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPE'][$value],$_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC'][$_SESSION[$thiss->DETECT_TABLE_COLUMN]['DESC_TO_KEY'][$value]]);
				echo "($h[$value])"; 
				echo $_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPESPECIAL'][$value];
			} else if(isset($_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPESPECIAL'][$value])) {
				if (!function_exists($_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPESPECIAL'][$value])) SEF($_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPESPECIAL'][$value]);
				$_SESSION[$thiss->DETECT_TABLE_COLUMN]['TYPESPECIAL'][$value]();
				echo "TYP_SPECJALNY";
			} else {
				echo $_SESSION[$thiss->DETECT_TABLE_COLUMN]['NEW_RECORD'][$value];
			}
//      GETFORMITEM($_SESSION[$thiss->DETECT_TABLE_COLUMN][NEW_RECORD][$value],$_SESSION[$thiss->DETECT_TABLE_COLUMN][TYPE][$value],$_SESSION[$thiss->DETECT_TABLE_COLUMN][DESC][$_SESSION[$thiss->DETECT_TABLE_COLUMN][DESC_TO_KEY][$value]]);
			echo " </td></tr>\n";
		}
	}
	echo'</tbody>';
	echo "<tr><td colspan=3 align=left><input type=submit value='          OK          '></td></tr></form></table>";
} else {
	CREATE_MENUFUNC_NOTD_INIT($_SESSION['LAST_MENU'],'<img src=icon/back.gif border=0 alt=POWROT> Brak Uprawnien');
}

}

