$type = @$r['1']; $remark = array(); for ($i0 = 0; isset($r['2.' . $i0]); $i0++) { $remark[$i0] = @$r['2.' . $i0 . '']; } if (@$r['3'] != '') { $sentat = @$r['3']; } else { $sentat = null; } if (@$r['4'] != '') { $receivedat = @$r['4']; } else { $receivedat = null; } $Correspondence = new Correspondence($ID, $case, $type, $remark, $sentat, $receivedat); if ($Correspondence->save() !== false) { die('ok:' . $_SERVER['PHP_SELF'] . '?Correspondence=' . urlencode($Correspondence->getId())); } else { die(''); } exit; // do not show the interface } $buttons = ""; if (isset($_REQUEST['new'])) { $new = true; } else { $new = false; } if (isset($_REQUEST['edit']) || $new) {
function delCorrespondence($id) { $tobeDeleted = new Correspondence($id); if ($tobeDeleted->isNew()) { return true; } // item never existed in the first place if ($tobeDeleted->del()) { return true; } else { return $tobeDeleted; } }