} $_SESSION['form_data']['id_org'] = intval(_session('id_org', 0)); $ref_upd_org = 'edit_org.php?org=' . _session('id_org'); if ($_SERVER['HTTP_REFERER']) { $ref_upd_org = $_SERVER['HTTP_REFERER']; } // // Update data // $obj_org = new LcmOrg(_session('id_org')); $errs = $obj_org->save(); if (count($errs)) { $_SESSION['errors'] = array_merge($_SESSION['errors'], $errs); lcm_header("Location: " . $ref_upd_org); exit; } // // Attach to case // if (_session('attach_case')) { lcm_query("INSERT INTO lcm_case_client_org\n\t\t\t\tSET id_case = " . _session('attach_case') . ",\n\t\t\t\t\tid_org = " . $obj_org->getDataInt('id_org')); } // // Go to the 'view details' page of the organisation // // small reminder, if the client was created from the "add client to case" (Case details) $attach = ""; if (_session('attach_case')) { $attach = "&attach_case=" . _session('attach_case'); } lcm_header('Location: org_det.php?org=' . $obj_org->getDataInt('id_org', '__ASSERT__') . $attach);
$_SESSION['errors'] = array_merge($_SESSION['errors'], $errs); } else { $_SESSION['form_data']['attach_client'] = $client->getDataInt('id_client', '__ASSERT__'); } } // // Create organisation, if requested // if (_request('add_org')) { include_lcm('inc_obj_org'); $org = new LcmOrg(); $errs = $org->save(); if (count($errs)) { $_SESSION['errors'] = array_merge($_SESSION['errors'], $errs); } else { $_SESSION['form_data']['attach_org'] = $org->getDataInt('id_org', '__ASSERT__'); } } // // Create or update case data // $case = new LcmCase($id_case); $errs = $case->save(); if (count($errs)) { $_SESSION['errors'] = array_merge($_SESSION['errors'], $errs); lcm_header("Location: " . $_SERVER['HTTP_REFERER']); exit; } // // Create follow-up data //