Example #1
0
        } else {
            $_SESSION['form_data']['status'] = 'open';
        }
        $_SESSION['form_data']['admin'] = true;
    }
}
$attach_client = 0;
$attach_org = 0;
if (!$id_case) {
    $attach_client = intval(_request('attach_client', 0));
    $attach_org = intval(_request('attach_org', 0));
    $attach_client = intval(_session('attach_client', $attach_client));
    $attach_org = intval(_session('attach_org', $attach_org));
}
if ($attach_client) {
    $client = new LcmClient($attach_client);
    // Leave empty if user did the error of leaving it blank
    if (!isset($_SESSION['form_data']['title'])) {
        $_SESSION['form_data']['title'] = $client->getName();
    }
}
if ($attach_org) {
    $org = new LcmOrg($attach_org);
    // Leave empty if user did the error of leaving it blank
    if (!isset($_SESSION['form_data']['title'])) {
        $_SESSION['form_data']['title'] = $info['name'];
    }
}
// Start page and title
if ($id_case) {
    lcm_page_start(_T('title_case_edit'), '', '', 'cases_intro#edit');
Example #2
0
include_lcm('inc_obj_client');
// 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".
Example #3
0
// Clear all previous errors
$_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)) {