<?php

if ($this->is_id()) {
	$sql->update_table('money_income_category', array('mic_deleted' => 1), array('mic_id' => $this->get_id()));
	log::register('delete_mic', $this->get_id());

	//akiknek ez a mic_id van beállítva, azoknál null-ra állítjuk
	$mi_query = "SELECT mi_id FROM money_income WHERE mi_money_income_category_mic_id = " . $this->get_id();
	$mi_assoc_array = $sql->assoc_array($mi_query);
	foreach ($mi_assoc_array as $uk_id) {
		$sql->update_table('money_income', array('mi_money_income_category_mic_id' => 'null'), array('mi_id' => $uk_id['mi_id']));
	}

	header("Location: /admin/money_income_category");
}


?>
