Beispiel #1
0
// Clear all previous errors
$_SESSION['errors'] = array();
$_SESSION['form_data'] = array();
// Get form data from POST fields
foreach ($_POST as $key => $value) {
    $_SESSION['form_data'][$key] = $value;
}
$ref_upd_client = 'edit_client.php?client=' . _session('id_client', 0);
if ($_SERVER['HTTP_REFERER']) {
    $ref_upd_client = $_SERVER['HTTP_REFERER'];
}
//
// Update data
//
$obj_client = new LcmClient(_session('id_client'));
$errs = $obj_client->save();
if (count($errs)) {
    $_SESSION['errors'] = array_merge($_SESSION['errors'], $errs);
    lcm_header("Location: " . $ref_upd_client);
    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_client = " . $obj_client->getDataInt('id_client'));
}
//
// Add organisation
// [ML] 2007-01-11: not clear what this does. probably w.r.t "client represents orgs".
//
Beispiel #2
0
$_SESSION['errors'] = array();
// Get form data from POST fields
foreach ($_POST as $key => $value) {
    $_SESSION['form_data'][$key] = $value;
}
//
// Clean (most of the) input
//
$id_case = _request('id_case', 0);
//
// Create client, if requested
//
if (_request('add_client')) {
    include_lcm('inc_obj_client');
    $client = new LcmClient();
    $errs = $client->save();
    if (count($errs)) {
        $_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);