Location: PHPKode > projects > OpenVet > openvet/action/editillness.php
<?php

	$ch_uid = $_POST["illnessuid"];

	if ($user->getRechte() >= 2)
	{

		$thisillness = new Illness();
		
		if (!$thisillness->readfromdb ($ch_uid))
		{
			header("Location: index.php?tab=medical&page=notauthorized");
			exit ();
		}

	} else {
		
		header("Location: index.php?tab=medical&page=notauthorized");
		exit ();

	}
	
	$ch_arzt = $_POST["arzt"];
	$ch_problemname = $_POST["problemname"];
	$ch_vorbericht = $_POST["vorbericht"];
	$ch_diagnose = $_POST["diagnose"];
	$ch_behandlung = $_POST["behandlung"];
	$ch_medikation = $_POST["medikation"];
	$ch_notizen = $_POST["notizen"];
	$ch_geschlossen = $_POST["geschlossen"];

	$thisillness->setArzt ($ch_arzt);
	$thisillness->setProblemname ($ch_problemname);
	$thisillness->setVorbericht ($ch_vorbericht);
	$thisillness->setDiagnose ($ch_diagnose);
	$thisillness->setBehandlung ($ch_behandlung);
	$thisillness->setMedikation ($ch_medikation);
	$thisillness->setNotizen ($ch_notizen);
	$thisillness->setLetzteAenderung (time());

	if ($ch_geschlossen == "schliessen" && $thisillness->getGeschlossen() == 0)
		$thisillness->setGeschlossen (time());
	elseif ($ch_geschlossen == "oeffnen" && $thisillness->getGeschlossen() != 0)
		$thisillness->setGeschlossen (0);

	$thispatient = new Patient();
	if ($thispatient->doesexistuid ($thisillness->getPatient()))
	{
		if (!$thisillness->writetodb () || !$thisillness->validateData())
			$message = $thisillness->getError();
		else
			$message = _("The illness data was changed.");
	} else
			$message = _("You can't link an illness to a not existing patient.");

?>
Return current item: OpenVet