<?php

	
	require_once('modules/EcmAccountCategories/EcmAccountCategory.php');
	require_once('include/Upload.php');
	
	$focus = new EcmAccountCategory();
	
  if(isset($_POST['record']) && $_POST['record'] != '') {
	
    $focus->retrieve($_POST['record']);

  }
  
  foreach($focus->column_fields as $field){

  	if(isset($_POST[$field])){

  		$value = $_POST[$field];

  		$focus->$field = $value;

  	}

  }



  foreach($focus->additional_column_fields as $field){

  	if(isset($_POST[$field])){

  		$value = $_POST[$field];

  		$focus->$field = $value;

  	}

  }
if($_FILES['assigned_file']['name']){
	$_POST['assigned_file']=upload_file("assigned_file","modules/EcmAccountCategories/files/");
	chmod("modules/EcmAccountCategories/files/".$_POST['assigned_file'],0777);
	
	$focus->assigned_file = $_POST['assigned_file'];
}

	$focus->save();
	
	
	header('Location: index.php?module=EcmAccountCategories&action=DetailView&record='.$focus->id);
	
	