<?php


//echo "<BR>superedit-superedit-IN7_POST_HISTORY.php";

function IN7_POST_HISTORY($TABLE,$FIELDS,$VALUES,$thiss,$SESSION) {


//$ZAP_FIELDS
//$ZAP_VAL
$I=0;
  foreach($FIELDS as $FIELDS_V) {
	
     $ZAP_FIELDS.=", $FIELDS_V ";
     $ZAP_VAL.=", '".$VALUES[$I]."'";
     $ZAP_UPD.=", $FIELDS_V='".$VALUES[$I]."' ";

	$I++;
  }


//
$ZAP_FIELDS="ID_USERS2, A_RECORD_UPDATE_DATE , A_RECORD_UPDATE_AUTHOR ".$ZAP_FIELDS;
$ZAP_VAL=" '".$_SESSION[$thiss->DETECT_TABLE_COLUMN][EDITRECORD][ID]."', now() , '".$_SESSION[ADM_ACCOUNT]."' ".$ZAP_VAL;
//, A_RECORD_UPDATE_DATE=now(), A_RECORD_UPDATE_AUTHOR='system-imported'

$ZAP_HIST="INSERT INTO ".$thiss->DETECT_TABLE_NAME."_HIST  ($ZAP_FIELDS) VALUES ($ZAP_VAL) ; ";
$ZAP_UPD="UPDATE ".$thiss->DETECT_TABLE_NAME." SET A_RECORD_UPDATE_DATE=now() , A_RECORD_UPDATE_AUTHOR='".$_SESSION[ADM_ACCOUNT]."' ".$ZAP_UPD." where ID='".$_SESSION[$thiss->DETECT_TABLE_COLUMN][EDITRECORD][ID]."' limit 1 ;" ;

echo "<br> ZAP_HIST $ZAP_HIST ";
echo "<br> ZAP_UPD $ZAP_UPD ";

//TODO check verify
ZAP_SQL($ZAP_HIST);
ZAP_SQL($ZAP_UPD); 

//print_r($thiss);
//print_r($_SESSION);

}

