function show_import_form() { lcm_page_start(_T('title_archives'), '', '', 'archives_import'); global $tabs; show_tabs_links($tabs, 1); lcm_bubble('archive_restore'); // Show the errors (if any) echo show_all_errors($_SESSION['errors']); // Upload backup form echo '<form enctype="multipart/form-data" action="import_db.php" method="post">' . "\n"; echo '<input type="hidden" name="action" value="upload_file" />' . "\n"; echo '<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />' . "\n"; echo "<fieldset class='info_box'>\n"; show_page_subtitle(_T('archives_subtitle_upload'), 'archives_import', 'newrestore'); echo '<p class="normal_text">' . _T('archives_info_how_to_upload') . "</p>\n"; echo '<p class="normal_text">' . _Ti('file_input_name'); echo '<input type="file" name="filename" size="40" value="" /> '; echo '<input type="submit" name="submit" id="btn_upload" value="' . _T('button_validate') . '" class="search_form_btn" />'; echo "</p>\n"; echo "</fieldset>\n"; echo "</form>\n"; // Restore backup form echo '<form action="import_db.php" method="post">' . "\n"; echo '<input type="hidden" name="action" value="import" />' . "\n"; echo "<fieldset class='info_box'>\n"; show_page_subtitle(_T('archives_subtitle_restore'), 'archives_import', 'delrestore'); echo "<strong>" . _Ti('archives_input_select_backup') . "</strong><br />"; echo "<select name='file' class='sel_frm'>\n"; lcm_debug("opendir: " . DIR_BACKUPS); $storage = opendir(DIR_BACKUPS); while ($file = readdir($storage)) { lcm_debug("file in opendir: {$file}"); if (is_dir(DIR_BACKUPS . '/' . $file) && strpos($file, 'db-') === 0) { echo "\t\t<option value='" . substr($file, 3) . "'>" . substr($file, 3) . "</option>\n"; } } echo "</select>\n"; // Select restore type echo "<p class='normal_text'>\n"; echo "<input type='radio' name='restore_type' value='clean' id='r1' /><label for='r1'> <strong>" . _T('archives_input_option_restore') . "</strong></label><br />" . _T('archives_info_option_restore') . "<br /><br />\n"; // [ML] This is confusing as hell. I understand the aim from DB point of view // but I don't understand the aim from the admin's point of view. // echo "<input type='radio' name='restore_type' value='replace' id='r2' /><label for='r2'> <strong>Replace (experimental!)</strong></label><br /> Imported backup data will replace the existing. This is usefull to undo the changes made in the database since last backup, without losing the new information. Warning: This operation could break database integrity, especially if importing data between different LCM installations.<br /><br />\n"; echo "<input type='radio' name='restore_type' value='ignore' id='r3' /><label for='r3'> <strong>" . _T('archives_input_option_sync') . " (experimental!)</strong></label><br /> Only backup data NOT existing in the database will be imported. This is usefull to import data lost since last backup, without changing the existing information. Warning: This operation could break database integrity, especially if importing data between different LCM installations.<br /><br />\n"; // TRAD echo "<button type='submit' class='simple_form_btn'>" . _T('button_validate') . "</button>\n"; echo "</p>\n"; echo "</fieldset\n>"; echo "</form>\n"; lcm_page_end(); $_SESSION['errors'] = array(); }
} // TRAD } } else { if (!(isset($_SESSION['form_data']['app_rem_offset_days']) && (!is_numeric($_SESSION['form_data']['app_rem_offset_days']) || $_SESSION['form_data']['app_rem_offset_days'] < 0) || isset($_SESSION['form_data']['app_rem_offset_hours']) && (!is_numeric($_SESSION['form_data']['app_rem_offset_hours']) || $_SESSION['form_data']['app_rem_offset_hours'] < 0) || isset($_SESSION['form_data']['app_rem_offset_minutes']) && (!is_numeric($_SESSION['form_data']['app_rem_offset_minutes']) || $_SESSION['form_data']['app_rem_offset_minutes'] < 0))) { $unix_app_reminder_time = $unix_app_start_time - $_SESSION['form_data']['app_rem_offset_days'] * 86400 - $_SESSION['form_data']['app_rem_offset_hours'] * 3600 - $_SESSION['form_data']['app_rem_offset_minutes'] * 60; $_SESSION['form_data']['app_reminder'] = date('Y-m-d H:i:s', $unix_app_reminder_time); } else { $_SESSION['errors']['app_reminder'] = _Ti('app_input_reminder') . _T('time_warning_invalid_format') . ' (' . $_SESSION['form_data']['app_rem_offset_hours'] . ')'; // XXX $_SESSION['form_data']['app_reminder'] = $_SESSION['form_data']['app_start_time']; } } // title if (!$_SESSION['form_data']['app_title']) { $_SESSION['errors']['app_title'] = _Ti('app_input_title') . _T('warning_field_mandatory'); } } // // Check if any errors found // if (count($_SESSION['errors'])) { lcm_header("Location: " . $_SERVER['HTTP_REFERER']); exit; } /////////////////////////////////////////////////////////////////////// // Followup information update /////////////////////////////////////////////////////////////////////// $fu = new LcmFollowup($id_followup); $errs = $fu->save(); if (count($errs)) {
</tr> <tr> <td align="left" valign="top"><?php echo f_err_star('password_confirm') . _T('authorconf_input_password_confirm'); ?> </td> <td align="left" valign="top"><input name="usr_retype_passwd" type="password" class="search_form_txt" id="usr_retype_passwd" size="35" /></td> </tr> <?php } /* is_newpass_allowed() */ ?> <tr><td align="left" valign="top"><?php echo _Ti('authoredit_input_status'); ?> </td> <td align="left" valign="top"> <?php echo '<input type="hidden" name="status_old" value="' . $user['status'] . '"/>' . "\n"; if ($author_session['status'] == 'admin' && $user['id_author'] != $author_session['id_author']) { echo '<select name="status" class="sel_frm" id="status">' . "\n"; foreach ($statuses as $s) { echo "\t\t\t\t<option value=\"{$s}\"" . ($s == $user['status'] ? ' selected="selected"' : '') . ">" . _T('authoredit_input_status_' . $s) . "</option>\n"; } echo "</select>\n"; } else { echo '<input type="hidden" name="status" value="' . $user['status'] . '"/>' . "\n"; echo $user['status'];
function show_report_filters($id_report, $is_runtime = false) { // Get general report info $q = "SELECT * FROM lcm_report WHERE id_report = " . intval($id_report); $res = lcm_query($q); $rep_info = lcm_fetch_array($res); if (!$rep_info) { lcm_panic("Report does not exist: {$id_report}"); } // List filters attached to this report $query = "SELECT *\n\t\tFROM lcm_rep_filter as v, lcm_fields as f\n\t\tWHERE id_report = " . $id_report . "\n\t\tAND f.id_field = v.id_field"; // If generating the report (as opposed to editing), show filters // who have a filter type (eq, neq, in, ..), but no value. if ($is_runtime) { $query .= " AND v.type != '' AND v.value = '' "; } $result = lcm_query($query); if (lcm_num_rows($result)) { if ($is_runtime) { // submit all at once (else submit on a per-filter basis) echo '<form action="run_rep.php" name="frm_filters" method="get">' . "\n"; echo '<input name="rep" value="' . $id_report . '" type="hidden" />' . "\n"; if (isset($_REQUEST['export'])) { echo '<input name="export" value="' . $_REQUEST['export'] . '" type="hidden" />' . "\n"; } } echo "<table border='0' class='tbl_usr_dtl' width='99%'>\n"; while ($filter = lcm_fetch_array($result)) { if (!$is_runtime) { echo "<form action='upd_rep_field.php' name='frm_line_additem' method='get'>\n"; echo "<input name='update' value='filter' type='hidden' />\n"; echo "<input name='rep' value='{$id_report}' type='hidden' />\n"; echo "<input name='id_filter' value='" . $filter['id_filter'] . "' type='hidden' />\n"; } echo "<tr>\n"; echo "<td>" . _Th($filter['description']) . "</td>\n"; // Type of filter echo "<td>"; $all_filters = array('number' => array('none', 'num_eq', 'num_neq', 'num_lt', 'num_le', 'num_gt', 'num_ge'), 'date' => array('none', 'date_eq', 'date_in', 'date_lt', 'date_le', 'date_gt', 'date_ge'), 'text' => array('none', 'text_eq', 'text_neq')); if ($all_filters[$filter['filter']]) { // At runtime, if a filter has been selected, do not allow select if ($filter['type'] && $is_runtime) { echo _T('rep_filter_' . $filter['type']); } else { echo "<select name='filter_type'>\n"; echo "<option value=''>...</option>\n"; foreach ($all_filters[$filter['filter']] as $f) { $sel = $filter['type'] == $f ? ' selected="selected"' : ''; echo "<option value='" . $f . "'" . $sel . ">" . _T('rep_filter_' . $f) . "</option>\n"; } echo "</select>\n"; } } else { // XXX Should happen only if a filter was removed in a future version, e.g. rarely // or between development releases. echo "Unknown filter"; } echo "</td>\n"; // Value for filter echo "<td>"; switch ($filter['type']) { case 'num_eq': case 'num_neq': if ($filter['field_name'] == 'id_author') { $name = $is_runtime ? "filter_val" . $filter['id_filter'] : 'filter_value'; // XXX make this a function $q = "SELECT * FROM lcm_author WHERE status IN ('admin', 'normal', 'external')"; $result_author = lcm_query($q); echo "<select name='{$name}'>\n"; echo "<option value=''>...</option>\n"; // TRAD while ($author = lcm_fetch_array($result_author)) { // Check for already submitted value $sel = $filter['value'] == $author['id_author'] || $_REQUEST['filter_val' . $filter['id_filter']] == $author['id_author'] ? ' selected="selected"' : ''; echo "<option value='" . $author['id_author'] . "'" . $sel . ">" . $author['id_author'] . " : " . get_person_name($author) . "</option>\n"; } echo "</select>\n"; break; } case 'num_lt': case 'num_gt': $name = $is_runtime ? "filter_val" . $filter['id_filter'] : 'filter_value'; echo '<input style="width: 99%;" type="text" name="' . $name . '" value="' . $filter['value'] . '" />'; break; case 'date_eq': case 'date_lt': case 'date_le': case 'date_gt': case 'date_ge': $name = $is_runtime ? "filter_val" . $filter['id_filter'] : 'date'; echo get_date_inputs($name, $filter['value']); // FIXME break; case 'date_in': // date_in has two values, stored ex: 2005-01-01 00:00:00;2006-02-02 00:00:00 $name = $is_runtime ? "filter_val" . $filter['id_filter'] : 'date'; $values = split(";", $filter['value']); echo get_date_inputs($name . '_start', $values[0]); echo "<br />\n"; echo get_date_inputs($name . '_end', $values[1]); break; case 'text_eq': case 'text_neq': $name = $is_runtime ? "filter_val" . $filter['id_filter'] : 'filter_value'; if ($filter['enum_type']) { $enum = explode(":", $filter['enum_type']); if ($enum[0] == 'keyword') { if ($enum[1] == 'system_kwg') { $all_kw = get_keywords_in_group_name($enum[2]); echo '<select name="' . $name . '">' . "\n"; echo '<option value="">' . "..." . "</option>\n"; // TRAD foreach ($all_kw as $kw) { $sel = $filter['value'] == $kw['name'] || $_REQUEST['filter_val' . $filter['id_filter']] == $kw['name'] ? ' selected="selected" ' : ''; echo '<option value="' . $kw['name'] . '"' . $sel . '>' . _Tkw($enum[2], $kw['name']) . "</option>\n"; } echo "</select>\n"; } } elseif ($enum[0] == 'list') { $items = split(",", $enum[1]); echo '<select name="' . $name . '">' . "\n"; echo '<option value="">' . "..." . "</option>\n"; // TRAD foreach ($items as $i) { $tmp = $i; if ($enum[2]) { $tmp = _T($enum[2] . $tmp); } $sel = $filter['value'] == $i || $_REQUEST['filter_val' . $filter['id_filter']] == $i ? ' selected="selected" ' : ''; echo '<option value="' . $i . '"' . $sel . '>' . $tmp . "</option>\n"; } echo "</select>\n"; } } else { echo '<input style="width: 99%;" type="text" name="' . $name . '" value="' . $filter['value'] . '" />'; } break; default: echo "<!-- no type -->\n"; } echo "</td>\n"; if (!$is_runtime) { // Button to validate echo "<td>"; echo "<button class='simple_form_btn' name='validate_filter_addfield'>" . _T('button_validate') . "</button>\n"; echo "</td>\n"; // Link for "Remove" echo "<td><a class='content_link' href='upd_rep_field.php?rep=" . $id_report . "&" . "remove=filter" . "&" . "id_filter=" . $filter['id_filter'] . "'>" . "X" . "</a></td>\n"; } echo "</tr>\n"; if (!$is_runtime) { echo "</form>\n"; } } echo "</table>\n"; } if ($is_runtime) { echo "<p><button class='simple_form_btn' name='validate_filter_addfield'>" . _T('button_validate') . "</button></p>\n"; echo "</form>\n"; return; } // List all available fields in selected tables for report $query = "SELECT *\n\t\tFROM lcm_fields\n\t\tWHERE "; $sources = array(); if ($rep_info['line_src_name']) { array_push($sources, "'lcm_" . $rep_info['line_src_name'] . "'"); } // Fetch all tables available as rep colums // (this is not like rep line, because the source is not always in // lcm_report, but this should be 'fixed') $q_tmp = "SELECT DISTINCT table_name \n\t\t\t\tFROM lcm_rep_col as rp, lcm_fields as f\n\t\t\t\tWHERE rp.id_field = f.id_field\n\t\t\t\t AND rp.id_report = " . $id_report; $result_tmp = lcm_query($q_tmp); while ($row = lcm_fetch_array($result_tmp)) { array_push($sources, "'" . $row['table_name'] . "'"); } // Fetch all keyword sources if ($rep_info['col_src_type'] == 'keyword' && $rep_info['col_src_name']) { $kwg = get_kwg_from_name($rep_info['col_src_name']); if ($kwg['type'] == 'system') { switch ($kwg['name']) { } } else { if ($kwg['type'] == 'client_org') { array_push($sources, "'lcm_client'"); array_push($sources, "'lcm_org'"); } else { array_push($sources, "'lcm_" . $kwg['type'] . "'"); } } } // If lcm_case in there, also add lcm_stage $tmp = ''; foreach ($sources as $s) { if ($s == "'lcm_case'") { $tmp = "lcm_stage"; } } if ($tmp) { array_push($sources, "'lcm_stage'"); } // List only filters if table were selected as sources (line/col) if (count($sources)) { $query .= " table_name IN ( " . implode(" , ", $sources) . " ) AND "; $query .= " filter != 'none'"; $query .= " ORDER BY table_name "; echo "<!-- QUERY: {$query} -->\n"; $result = lcm_query($query); if (lcm_num_rows($result)) { echo "<form action='upd_rep_field.php' name='frm_line_additem' method='get'>\n"; echo "<input name='rep' value='" . $rep_info['id_report'] . "' type='hidden' />\n"; echo "<input name='add' value='filter' type='hidden' />\n"; echo "<p class='normal_text'>" . _Ti('rep_input_filter_add'); echo "<select name='id_field'>\n"; echo "<option value=''>...</option>\n"; while ($row = lcm_fetch_array($result)) { echo "<option value='" . $row['id_field'] . "'>" . _Ti('rep_info_table_' . $row['table_name']) . _Th($row['description']) . "</option>\n"; } echo "</select>\n"; echo "<button class='simple_form_btn' name='validate_filter_addfield'>" . _T('button_validate') . "</button>\n"; echo "</p>\n"; echo "</form>\n"; } } else { echo '<p class="normal_text">' . _T('rep_info_select_source_first') . "</p>\n"; } }
$_SESSION['form_data']['reminder'] = get_datetime_from_array($_SESSION['form_data'], 'reminder', 'start', '', false); } else { // Join fields and check resulting time $_SESSION['form_data']['reminder'] = get_datetime_from_array($_SESSION['form_data'], 'reminder', 'start', '', false); $unix_reminder_time = strtotime($_SESSION['form_data']['reminder']); if ($unix_reminder_time < 0 || !checkdate($_SESSION['form_data']['reminder_month'], $_SESSION['form_data']['reminder_day'], $_SESSION['form_data']['reminder_year'])) { $_SESSION['errors']['reminder'] = 'Invalid reminder time!'; } // TRAD } } else { if (!(isset($_SESSION['form_data']['rem_offset_days']) && (!is_numeric($_SESSION['form_data']['rem_offset_days']) || $_SESSION['form_data']['rem_offset_days'] < 0) || isset($_SESSION['form_data']['rem_offset_hours']) && (!is_numeric($_SESSION['form_data']['rem_offset_hours']) || $_SESSION['form_data']['rem_offset_hours'] < 0) || isset($_SESSION['form_data']['rem_offset_minutes']) && (!is_numeric($_SESSION['form_data']['rem_offset_minutes']) || $_SESSION['form_data']['rem_offset_minutes'] < 0))) { $unix_reminder_time = $unix_start_time - $_SESSION['form_data']['rem_offset_days'] * 86400 - $_SESSION['form_data']['rem_offset_hours'] * 3600 - $_SESSION['form_data']['rem_offset_minutes'] * 60; $_SESSION['form_data']['reminder'] = date('Y-m-d H:i:s', $unix_reminder_time); } else { $_SESSION['errors']['reminder'] = _Ti('app_input_reminder') . _T('time_warning_invalid_format') . ' (' . $_SESSION['form_data']['rem_offset_hours'] . ')'; // XXX $_SESSION['form_data']['reminder'] = $_SESSION['form_data']['start_time']; } } // title if (!(strlen($_SESSION['form_data']['title']) > 0)) { $_SESSION['errors']['title'] = 'Appointment title should not be empty!'; } // TRAD // // Check if errors found // if (count($_SESSION['errors'])) { // Errors, return to editing page lcm_header("Location: " . $_SERVER['HTTP_REFERER']);
function printEdit() { global $prefs; $admin = allowed($this->getDataInt('id_case'), 'a'); // FIXME $edit = allowed($this->getDataInt('id_case'), 'e'); // FIXME $write = allowed($this->getDataInt('id_case'), 'w'); // FIXME (put in constructor) // FIXME: not sure whether this works as previously $dis = isDisabled(!($admin || $edit)); echo '<table class="tbl_usr_dtl" width="99%">' . "\n"; echo '<tr><td>'; echo f_err_star('date_start') . _T('fu_input_date_start'); echo "</td>\n"; echo "<td>"; $name = $admin || $edit ? 'start' : ''; echo get_date_inputs($name, $this->data['date_start'], false); echo ' ' . _T('time_input_time_at') . ' '; echo get_time_inputs($name, $this->data['date_start']); echo "</td>\n"; echo "</tr>\n"; echo "<tr><td>"; echo f_err_star('date_end') . ($prefs['time_intervals'] == 'absolute' ? _T('fu_input_date_end') : _T('fu_input_time_length')); echo "</td>\n"; echo '<td>'; if ($prefs['time_intervals'] == 'absolute') { // Buggy code, so isolated most important cases if ($this->data['id_followup'] == 0) { $name = 'end'; } elseif ($edit) { $name = 'end'; } else { // user can 'finish' entering data $name = $admin || $edit && $this->data['date_end'] == '0000-00-00 00:00:00' ? 'end' : ''; } echo get_date_inputs($name, $this->data['date_end']); echo ' '; echo _T('time_input_time_at') . ' '; echo get_time_inputs($name, $this->data['date_end']); } else { $name = ''; // Buggy code, so isolated most important cases if ($this->getDataInt('id_followup') == 0) { $name = 'delta'; } elseif ($edit) { $name = 'delta'; } else { // user can 'finish' entering data $name = $admin || $edit && $this->getDataString('date_end') == '0000-00-00 00:00:00' ? 'delta' : ''; } if (empty($_SESSION['errors'])) { $interval = $this->getDataString('date_end') != '0000-00-00 00:00:00' ? strtotime($this->getDataString('date_end')) - strtotime($this->getDataString('date_start')) : 0; echo get_time_interval_inputs($name, $interval); } else { echo get_time_interval_inputs_from_array($name, $this->data); } } echo "</td>\n"; echo "</tr>\n"; // Show 'conclusion' options if ($this->show_conclusion) { $kws_conclusion = get_keywords_in_group_name('conclusion'); $kws_result = get_keywords_in_group_name('_crimresults'); echo "<tr>\n"; echo "<td>" . _Ti('fu_input_conclusion') . "</td>\n"; echo '<td>'; // Result if (read_meta('case_result') == 'yes') { echo '<select ' . $dis . ' name="result" size="1" class="sel_frm">' . "\n"; $default = ''; if ($this->data['result']) { $default = $this->data['result']; } foreach ($kws_result as $kw) { $sel = isSelected($kw['name'] == $default); echo '<option ' . $sel . ' value="' . $kw['name'] . '">' . _T(remove_number_prefix($kw['title'])) . "</option>\n"; } echo "</select><br/>\n"; } // Conclusion echo '<select ' . $dis . ' name="conclusion" size="1" class="sel_frm">' . "\n"; $default = ''; if ($this->data['conclusion']) { $default = $this->data['conclusion']; } foreach ($kws_conclusion as $kw) { $sel = isSelected($kw['name'] == $default); echo '<option ' . $sel . ' value="' . $kw['name'] . '">' . _T(remove_number_prefix($kw['title'])) . "</option>\n"; } echo "</select>\n"; echo "</td>\n"; echo "</tr>\n"; // If guilty, what sentence? $kws_sentence = get_keywords_in_group_name('sentence'); echo "<tr>\n"; echo "<td>" . _Ti('fu_input_sentence') . "</td>\n"; echo '<td>'; echo '<select ' . $dis . ' name="sentence" size="1" class="sel_frm">' . "\n"; $default = ''; if ($this->data['sentence']) { $default = $this->data['sentence']; } echo "<!-- " . $default . " -->\n"; foreach ($kws_sentence as $kw) { $sel = $kw['name'] == $default ? ' selected="selected"' : ''; echo '<option ' . $sel . ' value="' . $kw['name'] . '">' . _T(remove_number_prefix($kw['title']), array('currency' => read_meta('currency'))) . "</option>\n"; } echo "</select>\n"; // If sentence, for how much? echo '<input type="text" name="sentence_val" size="10" value="' . $this->data['sentence_val'] . '" />'; echo "</td>\n"; echo "</tr>\n"; } if (_request('submit') == 'set_status' || is_status_change($this->getDataString('type'))) { // Change status echo "<tr>\n"; echo "<td>" . _T('case_input_status') . "</td>\n"; echo "<td>"; echo '<input type="hidden" name="type" value="' . $this->getDataString('type') . '" />' . "\n"; echo _T('kw_followups_' . $this->data['type'] . '_title'); echo "</td>\n"; echo "</tr>\n"; } elseif (_request('submit') == 'set_stage' || $this->getDataString('type') == 'stage_change') { // Change stage echo "<tr>\n"; echo "<td>" . _T('fu_input_next_stage') . "</td>\n"; echo "<td>"; echo '<input type="hidden" name="type" value="' . $this->getDataString('type') . '" />' . "\n"; // This is to compensate an old bug, when 'case stage' was not stored in fu.description // and therefore editing a follow-up would not give correct information. // Bug was in CVS of 0.4.3 between 19-20 April 2005. Should not affect many people. if ($s = $this->getDataString('new_stage')) { echo '<input type="hidden" name="new_stage" value="' . $s . '" />' . "\n"; echo _Tkw('stage', $s); } else { echo "New stage information not available"; } echo "</td>\n"; echo "</tr>\n"; if ($s = $this->getDataString('new_stage')) { // Update stage keywords (if any) $stage = get_kw_from_name('stage', $s); $id_stage = $stage['id_keyword']; show_edit_keywords_form('stage', $this->data['id_case'], $id_stage); } } elseif ($this->getDataString('type') == 'assignment' || $this->getDataString('type') == 'unassignment') { // Do not allow assignment/un-assignment follow-ups to be changed echo "<tr>\n"; echo "<td>" . _T('fu_input_next_stage') . "</td>\n"; echo "<td>"; echo '<input type="hidden" name="type" value="' . $this->getDataString('type') . '" />' . "\n"; echo _Tkw('followups', $this->getDataString('type')); echo "</td>\n"; echo "</tr>\n"; } else { // The usual follow-up echo "<tr>\n"; echo "<td>" . _T('fu_input_type') . "</td>\n"; echo "<td>"; echo '<select ' . $dis . ' name="type" size="1" class="sel_frm">' . "\n"; $default_fu = get_suggest_in_group_name('followups'); $futype_kws = get_keywords_in_group_name('followups'); $kw_found = false; foreach ($futype_kws as $kw) { $sel = isSelected($kw['name'] == $default_fu); if ($sel) { $kw_found = true; } echo '<option value="' . $kw['name'] . '"' . $sel . '>' . _T(remove_number_prefix($kw['title'])) . "</option>\n"; } // Exotic case where the FU keyword was hidden by the administrator, // but an old follow-up using that keyword is being edited. if (!$kw_found) { echo '<option selected="selected" value="' . $default_fu . '">' . _Tkw('followups', $default_fu) . "</option>\n"; } echo "</select>\n"; echo "</td>\n"; echo "</tr>\n"; } // Keywords (if any) show_edit_keywords_form('followup', $this->getDataInt('id_followup')); // Description echo "<tr>\n"; echo '<td valign="top">' . f_err_star('description') . _T('fu_input_description') . "</td>\n"; echo '<td>'; if ($this->getDataString('type') == 'assignment' || $this->getDataString('type') == 'unassignment') { // Do not allow edit of assignment echo '<input type="hidden" name="description" value="' . $this->getDataString('description') . '" />' . "\n"; echo get_fu_description($this->data); } else { echo '<textarea ' . $dis . ' name="description" rows="15" cols="60" class="frm_tarea">'; echo clean_output($this->getDataString('description')); echo "</textarea>"; } echo "</td></tr>\n"; // Sum billed field if ($this->show_sum_billed == "yes") { echo '<tr>'; echo '<td>' . _T('fu_input_sum_billed') . "</td>\n"; echo '<td>'; echo '<input ' . $dis . ' name="sumbilled" ' . 'value="' . clean_output($this->getDataString('sumbilled')) . '" ' . 'class="search_form_txt" size="10" />'; // [ML] If we do this we may as well make a function // out of it, but not sure where to place it :-) // This code is also in config_site.php $currency = read_meta('currency'); if (empty($currency)) { $current_lang = $GLOBALS['lang']; $GLOBALS['lang'] = read_meta('default_language'); $currency = _T('currency_default_format'); $GLOBALS['lang'] = $current_lang; } echo htmlspecialchars($currency); echo "</td></tr>\n"; } echo "</table>\n\n"; // XXX FIXME: Should probably be in some function "is_system_fu" // or even "is_deletable" if ($this->getDataInt('id_followup') && allowed($this->data['id_case'], 'a') && !(is_status_change($this->data['type']) || $this->data['type'] == 'assignment' || $this->data['type'] == 'unassignment')) { $checked = $this->getDataString('hidden') == 'Y' ? ' checked="checked" ' : ''; echo '<p class="normal_text">'; echo '<input type="checkbox"' . $checked . ' name="delete" id="box_delete" />'; echo '<label for="box_delete">' . _T('fu_info_delete') . '</label>'; echo "</p>\n"; } // Add followup appointment if (!_request('followup')) { echo "<!-- Add appointment? -->\n"; echo '<p class="normal_text">'; echo '<input type="checkbox" name="add_appointment" id="box_new_app" onclick="display_block(\'new_app\', \'flip\')" />'; echo '<label for="box_new_app">' . _T('fu_info_add_future_activity') . '</label>'; echo "</p>\n"; echo '<div id="new_app" style="display: none;">'; echo '<table class="tbl_usr_dtl" width="99%">' . "\n"; echo "<!-- Start time -->\n\t\t<tr><td>"; echo _T('time_input_date_start'); echo "</td><td>"; echo get_date_inputs('app_start', $this->data['app_start_time'], false); echo ' ' . _T('time_input_time_at') . ' '; echo get_time_inputs('app_start', $this->data['app_start_time']); echo f_err_star('app_start_time'); echo "</td></tr>\n"; echo "<!-- End time -->\n\t\t<tr><td>"; echo $prefs['time_intervals'] == 'absolute' ? _T('time_input_date_end') : _T('app_input_time_length'); echo "</td><td>"; if ($prefs['time_intervals'] == 'absolute') { echo get_date_inputs('app_end', $this->data['app_end_time']); echo ' ' . _T('time_input_time_at') . ' '; echo get_time_inputs('app_end', $this->data['app_end_time']); echo f_err_star('app_end_time'); } else { $interval = $this->data['app_end_time'] != '0000-00-00 00:00:00' ? strtotime($this->data['app_end_time']) - strtotime($this->data['app_start_time']) : 0; // echo _T('calendar_info_time') . ' '; echo get_time_interval_inputs('app_delta', $interval); echo f_err_star('app_end_time'); } echo "</td></tr>\n"; /* [ML] Removing, not useful for now echo "<!-- Reminder -->\n\t\t<tr><td>"; echo (($prefs['time_intervals'] == 'absolute') ? _T('app_input_reminder_time') : _T('app_input_reminder_offset')); echo "</td><td>"; if ($prefs['time_intervals'] == 'absolute') { echo get_date_inputs('app_reminder', $this->data['app_reminder']); echo ' ' . _T('time_input_time_at') . ' '; echo get_time_inputs('app_reminder', $this->data['app_reminder']); echo f_err_star('app_reminder'); } else { $interval = ( ($this->data['app_end_time']!='0000-00-00 00:00:00') ? strtotime($this->data['app_start_time']) - strtotime($this->data['app_reminder']) : 0); // echo _T('calendar_info_time') . ' '; echo get_time_interval_inputs('app_rem_offset', $interval); echo " " . _T('time_info_before_start'); echo f_err_star('app_reminder'); } echo "</td></tr>\n"; */ // TODO: [ML] a bit of testing to see if this survives an error on new case // I suspect it doesn't.. echo "<!-- Appointment title -->\n\t\t<tr><td>"; echo f_err_star('app_title') . _T('app_input_title'); echo "</td><td>"; echo '<input type="text" ' . $dis . ' name="app_title" size="50" value="'; echo clean_output($this->getDataString('app_title')) . '" class="search_form_txt" />'; echo "</td></tr>\n"; echo "<!-- Appointment type -->\n\t\t<tr><td>"; echo _T('app_input_type'); echo "</td><td>"; echo '<select ' . $dis . ' name="app_type" size="1" class="sel_frm">'; global $system_kwg; if ($_SESSION['fu_app_data']['type']) { $default_app = $_SESSION['fu_app_data']['type']; } else { $app_kwg = get_kwg_from_name('appointments'); $default_app = $app_kwg['suggest']; } $opts = array(); foreach ($system_kwg['appointments']['keywords'] as $kw) { $opts[$kw['name']] = _T(remove_number_prefix($kw['title'])); } asort($opts); foreach ($opts as $k => $opt) { $sel = isSelected($k == $default_app); echo "<option value='{$k}'{$sel}>{$opt}</option>\n"; } echo '</select>'; echo "</td></tr>\n"; echo "<!-- Appointment description -->\n"; echo "<tr><td valign=\"top\">"; echo _T('app_input_description'); echo "</td><td>"; echo '<textarea ' . $dis . ' name="app_description" rows="5" cols="60" class="frm_tarea">'; echo clean_output($this->getDataString('app_description')); echo '</textarea>'; echo "</td></tr>\n"; echo "</table>\n"; echo "</div>\n"; } }
$client->printEdit(); echo '</div>'; echo "<script type=\"text/javascript\">\n\t\t\tautocomplete('clientsearchkey', 'autocomplete-client-popup', 'ajax.php', 'autocomplete-client-data', 'autocomplete-client-alt')\n\t\t\t</script>\n"; echo "</div>\n"; // closes box that hides this form by default } } if (!$id_case) { // // Find case (show only if new case) // show_page_subtitle("Case information", 'cases_intro'); // TRAD echo "<div style='overflow: hidden; width: 100%;'>"; echo '<div style="float: left; text-align: right; width: 29%;">'; echo '<p class="normal_text" style="margin: 0; padding: 4px;">' . _Ti('input_search_case') . '</p>'; echo "</div>\n"; echo '<div style="float: right; width: 69%;">'; echo '<p class="normal_text" style="margin: 0; padding: 4px;"><input type="text" autocomplete="off" name="casesearchkey" id="casesearchkey" size="25" />' . "</p>\n"; echo '<span id="autocomplete-case-popup" class="autocomplete" style="position: absolute; visibility: hidden;"><span></span></span>'; echo '</div>'; echo '<div style="clear: right;"></div>'; echo '<div id="autocomplete-case-data"></div>' . "\n"; echo "</div>\n"; } echo '<div id="case_data">'; $obj_case = new LcmCaseInfoUI($id_case); $obj_case->printEdit(); echo "</div>\n"; /* div case_data */ echo "<script type=\"text/javascript\">\n\t\tautocomplete('casesearchkey', 'autocomplete-case-popup', 'ajax.php', 'autocomplete-case-data', 'case_data')\n\t</script>\n";
function update_contacts_request($type_person, $id_of_person) { // This will be useful later, to check mandatory/optional contacts $all_contact_kwg = get_kwg_all('contact'); // // Update existing contacts // if (isset($_REQUEST['contact_value'])) { $contacts = $_REQUEST['contact_value']; $c_ids = $_REQUEST['contact_id']; $c_types = $_REQUEST['contact_type']; // // Check if the contacts provided are really attached to the person // or else the user can provide a form with false contacts. // $all_contacts = get_contacts($type_person, $id_of_person); for ($cpt = 0; isset($c_ids[$cpt]) && $c_ids[$cpt]; $cpt++) { $valid = false; foreach ($all_contacts as $c) { if ($c['id_contact'] == $c_ids[$cpt]) { $valid = true; } } if (!$valid) { lcm_panic("Invalid modification of existing contact detected."); } } for ($cpt = 0; isset($c_ids[$cpt]); $cpt++) { // Check first to see if the contact is mandatory $kwg = get_kwg_from_id($c_types[$cpt]); $delete_allowed = true; if ($kwg['policy'] == 'mandatory') { // XXX Having policy == 'mandatory' but quantity = many // really makes a mess, and is not handled. $delete_allowed = false; } if (_request('del_contact_' . $c_ids[$cpt])) { if ($delete_allowed) { lcm_debug("Contact DEL: {$type_person}, {$id_of_person}, " . $c_ids[$cpt], 1); delete_contact($c_ids[$cpt]); } else { $_SESSION['errors']['upd_contact_' . $cpt] = _T('warning_field_mandatory'); } } else { if (!$delete_allowed && !$contacts[$cpt]) { $_SESSION['errors']['upd_contact_' . $cpt] = _T('warning_field_mandatory'); } else { lcm_debug("Contact UPD: {$type_person}, {$id_of_person}, " . $c_ids[$cpt] . ' = ' . $contacts[$cpt], 1); $err = update_contact($c_ids[$cpt], $contacts[$cpt]); if ($err) { $_SESSION['errors']['upd_contact_' . $cpt] = $err; } } } } } // // New contacts // if (isset($_REQUEST['new_contact_value'])) { $cpt = 0; $new_contacts = $_REQUEST['new_contact_value']; $c_type_names = $_REQUEST['new_contact_type_name']; while (isset($new_contacts[$cpt])) { // Process only new contacts which have a value if ($new_contacts[$cpt]) { // And make sure that they have a "type of contact" if ($c_type_names[$cpt]) { lcm_debug("Contact NEW: {$type_person}, {$id_of_person}, Name = " . $c_type_names[$cpt] . ', ' . $new_contacts[$cpt], 1); $err = add_contact($type_person, $id_of_person, $c_type_names[$cpt], $new_contacts[$cpt]); if ($err) { $_SESSION['errors']['new_contact_' . $cpt] = $err; } } else { $_SESSION['errors']['new_contact_' . $cpt] = "Please specify the type of contact."; // TRAD } } $cpt++; } } // // Check if all mandatory contacts were provided // $all_contacts = get_contacts($type_person, $id_of_person); foreach ($all_contact_kwg as $c) { if ($c['policy'] == 'mandatory') { $found = false; foreach ($all_contacts as $a) { if ($a['name'] == $c['name'] && trim($a['value'])) { $found = true; } } if (!$found) { $_SESSION['errors']['contact_' . $c['name']] = _Ti($c['title']) . _T('warning_field_mandatory'); } } } }
function validate_update_keywords_request($type_obj, $id_obj, $id_obj_sec = 0) { // - Check if, for all mandatory keywords, there is // -* a new keyword to be attached // -* not for deletion $kw_entries = _request('kw_entry_' . $type_obj); $kw_values = _request('kw_value_' . $type_obj); $kwg_ids = _request('kwg_id_' . $type_obj); $new_keywords = _request('new_keyword_' . $type_obj . '_value'); $new_kwg_id = _request('new_kwg_' . $type_obj . '_id'); $nop_keywords = _request('nop_keyword_' . $type_obj . '_value'); $nop_kwg_id = _request('nop_kwg_' . $type_obj . '_id'); $kwg_count = array(); $kwg_applicable = get_kwg_applicable_for($type_obj, $id_obj, $id_obj_sec); foreach ($kwg_applicable as $kwg) { // TODO; validate sub-kwg if any (make recursive function?) if ($kwg['policy'] == 'mandatory') { // check in already applied keywords for ($cpt = 0; isset($kw_entries[$cpt]); $cpt++) { if (_request('kw_del_' . $type_obj . $cpt)) { // for deletion if (isset($kwg_count[$kwg_ids[$cpt]])) { $kwg_count[$kwg_ids[$cpt]]--; } else { $kwg_count[$kwg_ids[$cpt]] = 0; } } else { if (isset($kw_values[$cpt]) && $kw_values[$cpt]) { // for update if (isset($kwg_count[$kwg_ids[$cpt]])) { $kwg_count[$kwg_ids[$cpt]]++; } else { $kwg_count[$kwg_ids[$cpt]] = 1; } } } } // check in new keywords for ($cpt = 0; isset($new_keywords[$cpt]); $cpt++) { if ($new_keywords[$cpt]) { if (isset($kwg_count[$new_kwg_id[$cpt]])) { $kwg_count[$new_kwg_id[$cpt]]++; } else { $kwg_count[$new_kwg_id[$cpt]] = 1; } } } // check in 'nop' (keyword groups, for which their sub-kwg will have keywords for ($cpt = 0; isset($nop_keywords[$cpt]); $cpt++) { if ($nop_keywords[$cpt]) { if (isset($kwg_count[$nop_kwg_id[$cpt]])) { $kwg_count[$nop_kwg_id[$cpt]]++; } else { $kwg_count[$nop_kwg_id[$cpt]] = 1; } } } if (!(isset($kwg_count[$kwg['id_group']]) && $kwg_count[$kwg['id_group']] > 0)) { $_SESSION['errors']['kwg' . $kwg['id_group']] = _Ti($kwg['title']) . _T('warning_field_mandatory'); } } } }
die("You don't have permission to view this client details!"); } $edit = allowed($client,'w'); */ $edit = true; // Show tabs $groups = array('general' => array('name' => _T('generic_tab_general'), 'tooltip' => _T('generic_subtitle_general')), 'cases' => array('name' => _T('generic_tab_cases'), 'tooltip' => _T('client_subtitle_cases')), 'attachments' => array('name' => _T('generic_tab_documents'), 'tooltip' => _T('client_subtitle_attachments'))); $tab = isset($_GET['tab']) ? $_GET['tab'] : 'general'; show_tabs($groups, $tab, $_SERVER['REQUEST_URI']); if ($c = intval(_request('attach_case', 0))) { $q = "SELECT title\n\t\t\t\t\tFROM lcm_case\n\t\t\t\t\tWHERE id_case = " . $c; $result = lcm_query($q); while ($row1 = lcm_fetch_array($result)) { echo '<div class="sys_msg_box">'; echo '<ul>'; echo '<li>' . _Ti('client_info_created_attached') . '<a class="content_link" href="case_det.php?case=' . $c . '">' . $row1['title'] . "</a></li>\n"; echo "</ul>\n"; echo "</div>\n"; } } switch ($tab) { case 'general': // // Show client general information // echo '<fieldset class="info_box">'; $obj_client = new LcmClientInfoUI($row['id_client']); $obj_client->printGeneral(); if ($edit) { echo '<a href="edit_client.php?client=' . $row['id_client'] . '" class="edit_lnk">' . _T('client_button_edit') . '</a>' . "\n"; }
function update_keyword($id_keyword) { $kw_title = _request('kw_title'); $kw_name = _request('kw_name'); // only for new keyword $kw_desc = _request('kw_desc'); $kw_ac_author = _request('kw_ac_author'); // show/hide keyword $kw_hasvalue = _request('kw_hasvalue'); // show field to enter text value $kw_idgroup = intval(_request('id_group')); // // Check for errors // if (!$id_keyword) { // new keyword global $system_kwg; if (!$kw_idgroup) { lcm_panic("update_keyword: missing or badly formatted id_keyword or id_group"); } $kwg_info = get_kwg_from_id($kw_idgroup); if (!$kw_name) { $_SESSION['errors']['name'] = _Ti('keywords_input_name') . _T('warning_field_mandatory'); } if (isset($system_kwg[$kwg_info['name']]['keywords'][$kw_name])) { // XXX [ML] what about user keywords? $_SESSION['errors']['name'] = _Ti('keywords_input_name') . _T('keywords_warning_kw_code_exists'); } } if (!$kw_title) { $_SESSION['errors']['title'] = _Ti('keywords_input_name') . _T('warning_field_mandatory'); } if (count($_SESSION['errors'])) { lcm_header("Location: " . $_SERVER['HTTP_REFERER']); exit; } // // Apply to database // $fl = "description = '{$kw_desc}',\n\t\t\ttitle = '{$kw_title}' "; if ($kw_ac_author == 'Y' || $kw_ac_author == 'N') { $fl .= ", ac_author = '{$kw_ac_author}'"; } if ($kw_hasvalue == 'Y' || $kw_hasvalue == 'N') { $query .= ", hasvalue = '{$kw_hasvalue}'"; } if (!$id_keyword) { // new $query = "INSERT INTO lcm_keyword\n\t\t\t\tSET id_group = {$kw_idgroup}, \n\t\t\t\t\tname = '{$kw_name}',\n\t\t\t\t\t{$fl} "; lcm_query($query); $id_keyword = lcm_insert_id('lcm_keyword', 'id_keyword'); $kw_info = get_kw_from_id($id_keyword); // for redirection later } else { // Get current info about keyword (don't trust the user) $kw_info = get_kw_from_id($id_keyword); $query = "UPDATE lcm_keyword\n\t\t\t\t\tSET {$fl}\n\t\t\t\t\tWHERE id_keyword = " . $id_keyword; lcm_query($query); } write_metas(); // update inc_meta_cache.php $tab = $kw_info['type'] == 'system' ? 'system' : 'user'; lcm_header("Location: keywords.php?tab=" . $tab . "#" . $kw_info['kwg_name']); exit; }
function show_report_field_edit($type, $rep_info) { $src_type = $rep_info[$type . '_src_type']; $src_name = $rep_info[$type . '_src_name']; if ($src_type == 'table' && $src_name && !preg_match('/^lcm_/', $src_name)) { $src_name = 'lcm_' . $src_name; } // Extract source type, if any if ($src_type && $src_name) { if ($src_type == 'keyword') { $kwg = get_kwg_from_name($src_name); echo '<p class="normal_text">' . _Ti('rep_info_source_' . $src_type) . " (" . _T('rep_info_table_lcm_' . $kwg['type']) . ") " . _T(remove_number_prefix($kwg['title'])); } else { echo "<p class='normal_text'>" . _Ti('rep_info_source_' . $src_type) . _T('rep_info_table_' . $src_name); } // Show list of fields for line/col, if any $my_id = $type == 'col' ? 'id_column' : 'id_line'; $my_fields = array(); $query = "SELECT " . $my_id . ", f.id_field, f.description \n\t\t\tFROM lcm_rep_" . $type . " as rl, lcm_fields as f\n\t\t\tWHERE id_report = " . $rep_info['id_report'] . "\n\t\t\tAND rl.id_field = f.id_field\n\t\t\tORDER BY col_order, " . $my_id . " ASC"; $result_fields = lcm_query($query); if (lcm_num_rows($result_fields)) { echo "</p>\n"; echo "<table border='0' class='tbl_usr_dtl' width='99%'>\n"; while ($field = lcm_fetch_array($result_fields)) { echo "<tr>\n"; echo "<td>" . _Th($field['description']) . "</td>\n"; echo "<td><a href='upd_rep_field.php?rep=" . $rep_info['id_report'] . "&" . "remove=" . $type . "&" . $my_id . "=" . $field[$my_id] . "' class='content_link'>" . "X" . "</a></td>\n"; // ACCESSIBILITY echo "</tr>\n"; array_push($my_fields, $field['id_field']); } echo "</table>\n"; } else { if (!$rep_info['filecustom']) { // Allow to change the source table echo ' <a href="upd_rep_field.php?rep=' . $rep_info['id_report'] . '&unselect_' . $type . '=1" class="content_link">' . "X" . '</a>'; // TRAD ACCESSIBILITY echo "</p>\n"; } } // Add field (if line_src_type == table) // TODO: add 'not in (...existing fields..) $query = "SELECT *\n\t\t\tFROM lcm_fields\n\t\t\tWHERE table_name = '" . $src_name . "'"; $result = lcm_query($query); if (lcm_num_rows($result)) { echo "\n<br />\n\n"; echo "<form action='upd_rep_field.php' name='frm_" . $type . "_additem' method='get'>\n"; echo "<input name='rep' value='" . $rep_info['id_report'] . "' type='hidden' />\n"; echo "<input name='add' value='" . $type . "' type='hidden' />\n"; echo "<table border='0' class='tbl_usr_dtl' width='99%'>\n"; echo "<tr>\n"; echo "<th class='heading'>" . _Ti('rep_input_item_add') . "</th>\n"; echo "<td>\n"; echo "<select name='id_field' class='sel_frm'>"; echo "<option value=''>...</option>\n"; while ($row = lcm_fetch_array($result)) { echo "<option value='" . $row['id_field'] . "'>" . _Th($row['description']) . "</option>\n"; } echo "</select>\n"; echo "<button class='simple_form_btn' name='validate_" . $type . "_additem'>" . _T('button_validate') . "</button>\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "</form>\n"; } } else { if (!$src_type || $src_type != 'keyword') { echo "<form action='upd_rep_field.php' name='frm_" . $type . "_source' method='post'>\n"; echo "<input name='rep' value='" . $rep_info['id_report'] . "' type='hidden' />\n"; echo '<p class="normal_text">' . f_err_star('rep_' . $type) . _Ti('rep_info_source_table'); echo "<input name='select_" . $type . "_type' value='table' type='hidden' />\n"; echo "<select name='select_" . $type . "_name' class='sel_frm'>\n\t\t\t\t<option value='author'>" . _T('rep_info_table_lcm_author') . "</option>\n\t\t\t\t<option value='case'>" . _T('rep_info_table_lcm_case') . "</option>\n\t\t\t\t<option value='stage'>" . _T('rep_info_table_lcm_stage') . "</option>\n\t\t\t\t<option value='client'>" . _T('rep_info_table_lcm_client') . "</option>\n\t\t\t\t<option value='followup'>" . _T('rep_info_table_lcm_followup') . "</option>\n\t\t\t\t</select>\n"; echo "<button class='simple_form_btn' name='validate_" . $type . "_source'>" . _T('button_validate') . "</button>\n"; echo "</p>\n"; echo "</form>\n"; } if (!$src_type) { echo '<p class="normal_text">' . _T('info_or') . "</p>\n"; } if (!$src_type || $src_type != 'table') { echo "<form action='upd_rep_field.php' name='frm_" . $type . "_source' method='post'>\n"; echo "<input name='rep' value='" . $rep_info['id_report'] . "' type='hidden' />\n"; echo "<p class='normal_text'>" . _Ti('rep_info_source_keyword'); echo "<input name='select_" . $type . "_type' value='keyword' type='hidden' />\n"; // Restrict list of keywords if custom report if ($rep_info['filecustom']) { include_custom_report($rep_info['filecustom']); $obj = new CustomReportSpecs(); $info = $type == 'line' ? $obj->getReportLine() : $obj->getReportCol(); if (substr($info['name'], 0, 4) == 'FOR:') { $choices = split(':', $info['name']); $all_kwgs = get_kwg_all($choices[1], true); } else { lcm_panic("Error in custom report specifications."); } } else { $all_kwgs = get_kwg_all('', true); } echo "<select name='select_" . $type . "_name' class='sel_frm'>\n"; echo "<option value=''>...</option>\n"; foreach ($all_kwgs as $kwg) { echo "<option value='" . $kwg['name'] . "'>" . _T('rep_info_table_lcm_' . $kwg['type']) . " - " . _T(remove_number_prefix($kwg['title'])) . "</option>\n"; } echo "</select>\n"; echo "<button class='simple_form_btn' name='validate_" . $type . "_source_kw'>" . _T('button_validate') . "</button>\n"; echo "</p>\n"; echo "</form>\n"; } } }
function show_attachments_upload($type, $id_type, $filename = '', $description = '') { if (!($type == 'case' || $type == 'client' || $type == 'org')) { lcm_panic("unknown type -" . $type . "-"); } echo '<div class="prefs_column_menu_head">' . _T('generic_subtitle_document_add') . "</div>\n"; // echo '<form enctype="multipart/form-data" action="attach_file.php" method="post">' . "\n"; // echo '<input type="hidden" name="' . $type . '" value="' . $id_type . '" />' . "\n"; echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . $GLOBALS['max_file_upload_size'] . '" />' . "\n"; echo '<strong>' . f_err_star('file') . _Ti('file_input_name') . "</strong><br />"; echo '<input type="file" name="filename" size="40" value="' . $filename . '" />' . "<br />\n"; echo '<strong>' . _Ti('file_input_description') . "</strong><br />\n"; echo '<input type="text" name="description" class="search_form_txt" value="' . $description . '" /> ' . "\n"; // echo '<input type="submit" name="submit" value="' . _T('button_validate') . '" class="search_form_btn" />' . "\n"; // echo "</form>\n"; }
function show_filters_info($report) { if (!$report->getOption('headers_sent')) { return; } $my_filters = get_filters($report->getId()); if (count($my_filters)) { echo '<p class="normal_text">'; } foreach ($my_filters as $f) { if (!$f['value']) { // Value may be provided by $_REQUEST if (isset($_REQUEST['filter_val' . $f['id_filter']])) { // text or number $f['value'] = $_REQUEST['filter_val' . $f['id_filter']]; } elseif (isset_datetime_from_array($_REQUEST, 'filter_val' . $f['id_filter'], 'year_only')) { // Date $f['value'] = get_datetime_from_array($_REQUEST, 'filter_val' . $f['id_filter'], 'year_only'); } elseif (isset_datetime_from_array($_REQUEST, 'filter_val' . $f['id_filter'] . "_start", 'year_only') && isset_datetime_from_array($_REQUEST, 'filter_val' . $f['id_filter'] . "_end", 'year_only')) { // Date interval $f['value'] = get_datetime_from_array($_REQUEST, 'filter_val' . $f['id_filter'] . "_start", 'start'); $f['value'] .= ";"; $f['value'] .= get_datetime_from_array($_REQUEST, 'filter_val' . $f['id_filter'] . "_end", 'end'); } else { // Should never happen $f['value'] = _T('info_not_available'); } } // TODO: If field.type == text and field.value is based on keyword or // list, use translation if known. if ($f['enum_type']) { $enum = explode(":", $f['enum_type']); if ($enum[0] == 'keyword') { if ($enum[2]) { $f['value'] = _Tkw($enum[2], $f['value']); } } elseif ($enum[0] == 'list') { if ($enum[2]) { $f['value'] = _T($enum[2] . $f['value']); } } } // Example: "Follow-up - Start: in 1 Apr 05, 00h00 - 31 Dec 05, 23h59" // or.....: Table - Field: type_filter value echo _T('rep_info_table_' . $f['table_name']) . " - " . _Ti($f['description']) . _T('rep_filter_' . $f['type']) . " "; switch ($f['type']) { case 'date_in': $values = split(";", $f['value']); echo format_date($values[0], 'short') . " - " . format_date($values[1], 'short'); break; case 'date_eq': case 'date_ge': case 'date_gt': case 'date_le': case 'date_lt': echo format_date($f['value'], 'short'); break; default: echo $f['value']; } echo "<br />\n"; } if (count($my_filters)) { echo "</p>\n"; } }
function printStartDoc($title, $description, $helpref) { if ($this->ui == 'html') { $title = _Ti('title_rep_run') . $title; $this->setOption('headers_sent', 'yes'); } $this->exporter->printStartDoc(remove_number_prefix($title), $description, $helpref); }
function printFollowups($show_filters = false) { $cpt = 0; $my_list_pos = intval(_request('list_pos', 0)); show_page_subtitle(_T('case_subtitle_followups'), 'cases_followups'); // Show filters (if not shown in ajaxed page) if ($show_filters) { // By default, show from "case creation date" to NOW(). $link = new Link(); $link->delVar('date_start_day'); $link->delVar('date_start_month'); $link->delVar('date_start_year'); $link->delVar('date_end_day'); $link->delVar('date_end_month'); $link->delVar('date_end_year'); echo $link->getForm(); $date_end = get_datetime_from_array($_REQUEST, 'date_end', 'end', '0000-00-00 00:00:00'); // date('Y-m-d H:i:s')); $date_start = get_datetime_from_array($_REQUEST, 'date_start', 'start', '0000-00-00 00:00:00'); // $row['date_creation']); echo _Ti('time_input_date_start'); echo get_date_inputs('date_start', $date_start); echo _Ti('time_input_date_end'); echo get_date_inputs('date_end', $date_end); echo ' <button name="submit" type="submit" value="submit" class="simple_form_btn">' . _T('button_validate') . "</button>\n"; echo "</form>\n"; echo "<div style='margin-bottom: 4px;'> </div>\n"; // FIXME patch for now (leave small space between filter and list) } show_listfu_start('general', false); for ($cpt = 0, $this->getFollowupStart(); !$this->getFollowupDone(); $cpt++) { $item = $this->getFollowupIterator(); show_listfu_item($item, $cpt); } if (!$cpt) { echo "No followups"; } // TRAD show_list_end($my_list_pos, $this->getFollowupTotal(), true); }
// // Case attachments // case 'attachments': echo '<fieldset class="info_box">'; show_page_subtitle(_T('case_subtitle_attachments'), 'tools_documents'); echo '<form enctype="multipart/form-data" action="attach_file.php" method="post">' . "\n"; echo '<input type="hidden" name="case" value="' . $case . '" />' . "\n"; // List of attached files show_attachments_list('case', $case); // Attach new file form if ($add) { show_attachments_upload('case', $case, $_SESSION['user_file']['name'], $_SESSION['user_file']['description']); } echo '<input type="submit" name="submit" value="' . _T('button_validate') . '" class="search_form_btn" />' . "\n"; echo "</form>\n"; echo "</fieldset>\n"; $_SESSION['user_file'] = array(); break; } } else { lcm_page_start(_T('title_error')); // [ML] Maybe not worth translating, since it should never happen. // TRAD echo "<p>" . _Ti('title_error') . 'The case no. "' . htmlspecialchars($case) . '" does not exist in the database.' . "</p>\n"; } $_SESSION['errors'] = array(); $_SESSION['case_data'] = array(); // DEPRECATED $_SESSION['form_data'] = array(); $_SESSION['fu_data'] = array(); lcm_page_end();
function printEdit() { echo '<table width="99%" border="0" align="center" cellpadding="5" cellspacing="0" class="tbl_usr_dtl">' . "\n"; // Organisation ID if ($this->getDataInt('id_org')) { echo "<tr>\n"; echo "<td>" . _Ti('org_input_id') . "</td>\n"; echo "<td>" . $this->getDataInt('id_org') . '<input type="hidden" name="id_org" value="' . $this->getDataInt('id_org') . '" />' . "</td>\n"; echo "</tr>\n"; } // Organisation name echo "<tr>\n"; echo "<td>" . f_err_star('name') . _Ti('org_input_name') . "</td>\n"; echo '<td><input name="name" value="' . clean_output($this->getDataString('name')) . '" class="search_form_txt" />' . "</td>\n"; echo "</tr>\n"; // Court registration number echo "<tr>\n"; echo "<td>" . f_err_star('court_reg') . _Ti('org_input_court_reg') . "</td>\n"; echo '<td><input name="court_reg" value="' . clean_output($this->getDataString('court_reg')) . '" class="search_form_txt" />' . "</td>\n"; echo "</tr>\n"; // Tax number echo "<tr>\n"; echo "<td>" . f_err_star('tax_number') . _Ti('org_input_tax_number') . "</td>\n"; echo '<td><input name="tax_number" value="' . clean_output($this->getDataString('tax_number')) . '" class="search_form_txt" />' . "</td>\n"; echo "</tr>\n"; // Statistical number echo "<tr>\n"; echo "<td>" . f_err_star('stat_number') . _Ti('org_input_stat_number') . "</td>\n"; echo '<td><input name="stat_number" value="' . clean_output($this->getDataString('stat_number')) . '" class="search_form_txt" />' . "</td>\n"; echo "</tr>\n"; // Creation date if ($this->getDataInt('id_org')) { echo "<tr>\n"; echo '<td>' . _Ti('time_input_date_creation') . '</td>'; echo '<td>' . format_date($this->getDataString('date_creation'), 'full') . '</td>'; echo "</tr>\n"; } // // Keywords, if any // show_edit_keywords_form('org', $this->getDataInt('id_org')); // Notes echo "<tr>\n"; echo "<td>" . f_err_star('notes') . _Ti('org_input_notes') . "</td>\n"; echo '<td><textarea name="notes" id="input_notes" class="frm_tarea" rows="3" cols="60">' . clean_output($this->getDataString('notes')) . "</textarea>\n" . "</td>\n"; echo "</tr>\n"; // // Contacts (e-mail, phones, etc.) // echo "<tr>\n"; echo '<td colspan="2" align="center" valign="middle">'; show_page_subtitle(_T('client_subtitle_contacts')); echo '</td>'; echo "</tr>\n"; show_edit_contacts_form('org', $this->getDataInt('id_org')); echo "</table>\n"; }
function get_fu_description($item, $make_short = true) { if (!is_array($item)) { lcm_debug("get_fu_description: parameter is not an array."); return ''; } global $prefs; global $fu_desc_len; // configure via my_options.php with $GLOBALS['fu_desc_len'] = NNN; $short_description = ''; // Set the length of short followup title (was: wide = 48, narrow = 115) $title_length = isset($fu_desc_len) && $fu_desc_len > 0 ? $fu_desc_len : 256; if ($item['type'] == 'assignment' && is_numeric($item['description'])) { $res1 = lcm_query("SELECT * FROM lcm_author WHERE id_author = " . $item['description']); $author1 = lcm_fetch_array($res1); $short_description = _T('case_info_author_assigned', array('name' => get_person_name($author1))); } elseif ($item['type'] == 'unassignment' && is_numeric($item['description'])) { $res1 = lcm_query("SELECT * FROM lcm_author WHERE id_author = " . $item['description']); $author1 = lcm_fetch_array($res1); $short_description = _T('case_info_author_unassigned', array('name' => get_person_name($author1))); } elseif ($item['type'] == 'stage_change' || is_status_change($item['type'])) { $tmp = lcm_unserialize($item['description']); // for backward compatibility, make it optional if ($item['case_stage']) { $short_description = _Tkw('stage', $item['case_stage']); } if ($tmp['description']) { $short_description .= " / " . $tmp['description']; } if ($tmp['result'] || $tmp['conclusion']) { $short_description .= "\n" . _Ti('fu_input_conclusion'); } if ($tmp['result']) { $short_description .= _Tkw('_crimresults', $tmp['result']) . "/"; } if ($tmp['conclusion']) { $short_description .= _Tkw('conclusion', $tmp['conclusion']); } if ($tmp['sentence']) { $short_description .= "\n" . _Ti('fu_input_sentence') . _Tkw('sentence', $tmp['sentence'], array('currency' => read_meta('currency'))); } if ($tmp['sentence_val']) { $short_description .= ": " . $tmp['sentence_val']; } } else { if ($item['description']) { if (!$make_short || strlen(lcm_utf8_decode($item['description'])) < $title_length) { $short_description = $item['description']; } else { $short_description = substr($item['description'], 0, $title_length) . '...'; } $short_description = clean_output($short_description); } else { $short_description = _T('fu_info_emptydesc'); } } $short_description = nl2br($short_description); if (empty($short_description)) { $short_description = _T('info_not_available'); } return $short_description; }
function show_report_for_user($author, $date_start, $date_end, $type) { if ($type == "case") { $q = "SELECT c.title, c.id_case, \n\t\t\t\t\t\t\t\tsum(IF(UNIX_TIMESTAMP(fu.date_end) > 0,\n\t\t\t\t\t\t\t\t\tUNIX_TIMESTAMP(fu.date_end)-UNIX_TIMESTAMP(fu.date_start), 0)) as time,\n\t\t\t\t\t\t\t\tsum(sumbilled) as sumbilled \n\t\t\t\t\t\t \t FROM lcm_case as c, lcm_followup as fu \n\t\t\t\t\t\t\t WHERE fu.id_case = c.id_case AND fu.id_author = {$author}\n\t\t\t\t\t\t\t\tAND UNIX_TIMESTAMP(date_start) >= UNIX_TIMESTAMP('" . $date_start . "') "; if ($date_end != "-1") { $q .= " AND UNIX_TIMESTAMP(date_end) <= UNIX_TIMESTAMP('" . $date_end . "')"; } $q .= " GROUP BY fu.id_case"; } elseif ($type == "fu") { $q = "SELECT fu.type,\n\t\t\t\t\t\t\t\tsum(IF(UNIX_TIMESTAMP(fu.date_end) > 0,\n\t\t\t\t\t\t\t\t\tUNIX_TIMESTAMP(fu.date_end)-UNIX_TIMESTAMP(fu.date_start), 0)) as time,\n\t\t\t\t\t\t\t\tsum(sumbilled) as sumbilled \n\t\t\t\t\t\t \t FROM lcm_followup as fu \n\t\t\t\t\t\t\t WHERE fu.id_author = {$author}\n\t\t\t\t\t\t\t\tAND UNIX_TIMESTAMP(date_start) >= UNIX_TIMESTAMP('" . $date_start . "') "; if ($date_end != "-1") { $q .= " AND UNIX_TIMESTAMP(date_end) <= UNIX_TIMESTAMP('" . $date_end . "') "; } $q .= " GROUP BY fu.type"; } elseif ($type == "agenda") { $q = "SELECT ap.type,\n\t\t\t\t\t\t\t\tsum(IF(UNIX_TIMESTAMP(ap.end_time) > 0,\n\t\t\t\t\t\t\t\t\tUNIX_TIMESTAMP(ap.end_time)-UNIX_TIMESTAMP(ap.start_time), 0)) as time\n\t\t\t\t\t\t \t FROM lcm_app as ap\n\t\t\t\t\t\t\t WHERE ap.id_author = {$author}\n\t\t\t\t\t\t\t \tAND ap.id_case = 0\n\t\t\t\t\t\t\t\tAND UNIX_TIMESTAMP(start_time) >= UNIX_TIMESTAMP('" . $date_start . "') "; if ($date_end != "-1") { $q .= " AND UNIX_TIMESTAMP(end_time) <= UNIX_TIMESTAMP('" . $date_end . "') "; } $q .= " GROUP BY ap.type"; } $result = lcm_query($q); echo "<p class=\"normal_text\">\n"; echo "<table border='0' class='tbl_usr_dtl' width='99%'>\n"; echo "<tr>\n"; echo '<th class="heading">' . _T('case_subtitle_times_by_' . $type) . "</th>\n"; echo "<th class='heading' width='1%' nowrap='nowrap'>" . _Th('case_input_total_time') . ' (' . _T('time_info_short_hour') . ")" . "</th>\n"; $total_time = 0; $total_sum_billed = 0.0; $meta_sum_billed = read_meta('fu_sum_billed') == 'yes'; $meta_sum_billed &= $type == "case" || $type == "fu"; if ($meta_sum_billed) { $currency = read_meta('currency'); echo "<th class='heading' width='1%' nowrap='nowrap'>" . _Th('fu_input_sum_billed') . ' (' . $currency . ")</th>\n"; } echo "</tr>\n"; // Show table contents & calculate total while ($row = lcm_fetch_array($result)) { echo "<tr>\n"; echo "<!-- Total = " . $total_sum_billed . " - row = " . $row['sumbilled'] . " -->\n"; $total_time += $row['time']; $total_sum_billed += $row['sumbilled']; echo '<td>'; if ($type == "case") { echo '<a class="content_link" href="case_det.php?case=' . $row['id_case'] . '">' . $row['id_case'] . ': ' . $row['title'] . '</a>'; } elseif ($type == "fu") { echo _Tkw("followups", $row['type']); } elseif ($type == "agenda") { echo _Tkw("appointments", $row['type']); } echo '</td>'; echo '<td align="right">' . format_time_interval_prefs($row['time']) . "</td>\n"; if ($meta_sum_billed) { echo '<td align="right">'; echo format_money($row['sumbilled']); echo "</td>\n"; } echo "</tr>\n"; } // Show total case hours echo "<tr>\n"; echo "<td><strong>" . _Ti('generic_input_total') . "</strong></td>\n"; echo "<td align='right'><strong>"; echo format_time_interval_prefs($total_time); echo "</strong></td>\n"; if ($meta_sum_billed) { echo '<td align="right"><strong>'; echo format_money($total_sum_billed); echo "</strong></td>\n"; } echo "</tr>\n"; echo "</table>\n"; echo "</p>\n"; }
function printEdit() { // Get site preferences $client_name_middle = read_meta('client_name_middle'); $client_citizen_number = read_meta('client_citizen_number'); $client_civil_status = read_meta('client_civil_status'); $client_income = read_meta('client_income'); $meta_date_birth = read_meta('client_date_birth'); echo '<table width="99%" border="0" align="center" cellpadding="5" cellspacing="0" class="tbl_usr_dtl">' . "\n"; if ($this->getDataInt('id_client')) { echo "<tr><td>" . _T('client_input_id') . "</td>\n"; echo "<td>" . $this->getDataInt('id_client') . '<input type="hidden" name="id_client" value="' . $this->getDataInt('id_client') . '" /></td></tr>' . "\n"; } // Client name echo '<tr><td>' . f_err_star('name_first') . _T('person_input_name_first') . '</td>' . "\n"; echo '<td><input name="name_first" value="' . clean_output($this->getDataString('name_first')) . '" class="search_form_txt" /></td></tr>' . "\n"; // [ML] always show middle name, if any, no matter the configuration if ($this->getDataString('name_middle') || substr($client_name_middle, 0, 3) == 'yes') { echo '<tr><td>' . f_err_star('name_middle') . _T('person_input_name_middle') . '</td>' . "\n"; echo '<td><input name="name_middle" value="' . clean_output($this->getDataString('name_middle')) . '" class="search_form_txt" /></td></tr>' . "\n"; } echo '<tr><td>' . f_err_star('name_last') . _T('person_input_name_last') . '</td>' . "\n"; echo '<td><input name="name_last" value="' . clean_output($this->getDataString('name_last')) . '" class="search_form_txt" /></td></tr>' . "\n"; if (substr($meta_date_birth, 0, 3) == 'yes') { echo "<tr>\n"; echo "<td>" . f_err_star('date_birth') . _Ti('person_input_date_birth') . "</td>\n"; echo "<td>" . get_date_inputs('date_birth', $this->getDataString('date_birth'), true) . "</td>\n"; echo "</tr>\n"; } echo '<tr><td>' . f_err_star('gender') . _T('person_input_gender') . '</td>' . "\n"; echo '<td><select name="gender" class="sel_frm">' . "\n"; $opt_sel_male = $opt_sel_female = $opt_sel_unknown = ''; if ($this->getDataString('gender') == 'male') { $opt_sel_male = 'selected="selected" '; } else { if ($this->getDataString('gender') == 'female') { $opt_sel_female = 'selected="selected" '; } else { $opt_sel_unknown = 'selected="selected" '; } } echo '<option ' . $opt_sel_unknown . 'value="unknown">' . _T('info_not_available') . "</option>\n"; echo '<option ' . $opt_sel_male . 'value="male">' . _T('person_input_gender_male') . "</option>\n"; echo '<option ' . $opt_sel_female . 'value="female">' . _T('person_input_gender_female') . "</option>\n"; echo "</select>\n"; echo "</td></tr>\n"; if ($this->getDataString('id_client')) { echo "<tr>\n"; echo '<td>' . _Ti('time_input_date_creation') . '</td>'; echo '<td>' . format_date($this->getDataString('date_creation'), 'full') . '</td>'; echo "</tr>\n"; } if (substr($client_citizen_number, 0, 3) == 'yes') { echo "<tr>\n"; echo '<td>' . f_err_star('citizen_number') . _T('person_input_citizen_number') . '</td>'; echo '<td><input name="citizen_number" value="' . clean_output($this->getDataString('citizen_number')) . '" class="search_form_txt" /></td>'; echo "</tr>\n"; } if (substr($client_civil_status, 0, 3) == 'yes') { echo "<tr>\n"; echo '<td>' . f_err_star('civil_status') . _Ti('person_input_civil_status') . '</td>'; echo '<td>'; echo '<select name="civil_status">'; if (!$this->getDataInt('id_client')) { echo '<option value=""></option>'; } $kwg = get_kwg_from_name('civilstatus'); $all_kw = get_keywords_in_group_name('civilstatus'); // A bit overkill, but if the user made the error of not entering // a valid civil_status, make sure that the field stays empty if (!$this->getDataString('civil_status') || !count($_SESSION['errors'])) { if ($this->getDataInt('id_client')) { $this->data['civil_status'] = $all_kw['unknown']['name']; } else { $this->data['civil_status'] = $kwg['suggest']; } } foreach ($all_kw as $kw) { $sel = $this->getDataString('civil_status') == $kw['name'] ? ' selected="selected"' : ''; echo '<option value="' . $kw['name'] . '"' . $sel . '>' . _T($kw['title']) . '</option>'; } echo '</select>'; echo '</td>'; echo "</tr>\n"; } if (substr($client_income, 0, 3) == 'yes') { echo "<tr>\n"; echo '<td>' . f_err_star('income') . _Ti('person_input_income') . '</td>'; echo '<td>'; echo '<select name="income">'; if (!$this->getDataInt('id_client')) { echo '<option value=""></option>'; } $kwg = get_kwg_from_name('income'); $all_kw = get_keywords_in_group_name('income'); if (!$this->getDataString('income') && !count($_SESSION['errors'])) { if ($this->getDataInt('id_client')) { $this->data['income'] = $all_kw['unknown']['name']; } else { $this->data['income'] = $kwg['suggest']; } } foreach ($all_kw as $kw) { $sel = $this->getDataString('income') == $kw['name'] ? ' selected="selected"' : ''; echo '<option value="' . $kw['name'] . '"' . $sel . '>' . _T($kw['title']) . '</option>'; } echo '</select>'; echo '</td>'; echo "</tr>\n"; } // // Keywords, if any // show_edit_keywords_form('client', $this->getDataInt('id_client')); // Notes echo "<tr>\n"; echo "<td>" . f_err_star('client_notes') . _Ti('client_input_notes') . "</td>\n"; echo '<td><textarea name="client_notes" id="input_client_notes" class="frm_tarea" rows="3" cols="60">' . clean_output($this->getDataString('notes')) . "</textarea>\n" . "</td>\n"; echo "</tr>\n"; // // Contacts (e-mail, phones, etc.) // echo "<tr>\n"; echo '<td colspan="2" align="center" valign="middle">'; show_page_subtitle(_T('client_subtitle_contacts')); echo '</td>'; echo "</tr>\n"; show_edit_contacts_form('client', $this->getDataInt('id_client')); echo "</table>\n"; }
function print_registration_form() { install_html_start(_T('pass_title_register'), 'login'); $link = new Link(); $url = $link->getUrl(); echo '<p align="left" class="normal_text">' . _T('pass_info_why_register') . "</p>\n"; echo show_all_errors(); echo "<form method='post' action='{$url}' style='border: 0px; margin: 0px;'>\n"; echo '<input type="hidden" name="register" value="data" />' . "\n"; echo "<fieldset><label><b>" . _T('info_your_contact_information') . "</b><br></label>\n"; // [ML] Altough not most problematic, could be better. But if someone // fixes here, please fix install.php also (step 4) echo "<table border='0'>\n"; echo "<tr>\n"; echo "<td>\n\t\t\t<label for='name_first'>" . f_err_star('name_first') . _Ti('person_input_name_first') . "</label><br />\n\t\t\t<input type='text' style='width: 100%;' id='name_first' name='name_first' class='formo' value='" . _session('name_first') . "' size='20'>\n\t\t</td>\n"; echo "<td>\n\t\t\t<label for='name_last'>" . f_err_star('name_last') . _Ti('person_input_name_last') . "</label><br />\n\t\t\t<input type='text' style='width: 100%;' id='name_last' name='name_last' class='formo' value='" . _session('name_last') . "' size='20'>\n\t\t</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td colspan='2'>"; echo "<p><label for='email'>" . f_err_star('email') . _Ti('input_email') . "</label><br />"; echo "<input type='text' id='email' name='email' class='formo' value='" . _session('email') . "' size='40'></p>\n"; echo "<p><label for='username'>" . f_err_star('username') . _Ti('authoredit_input_username') . "</label> "; echo "<small>" . _T('info_more_than_three') . "</small><br />"; echo "<input type='text' id='username' name='username' class='formo' value='" . _session('username') . "' size='40'></p>\n"; echo "<small>" . _T('pass_info_password_by_mail') . "</small>\n"; echo "</fieldset>\n"; echo "<p align=\"right\">"; echo '<button type="submit" name="Validate">' . _T('button_validate') . "</button>"; echo "</p>"; echo "</form>\n"; $_SESSION['form_data'] = array(); $_SESSION['errors'] = array(); }
function printEdit() { $id_comment = $this->getDataInt('id_comment', 0); echo '<input type="hidden" name="edit_comment" value="1" />' . "\n"; echo '<input type="hidden" name="id_expense" value="' . $this->getDataInt('id_expense') . '" />' . "\n"; if ($id_comment) { echo "<!-- id_comment = {$id_comment} -->\n"; echo '<input type="hidden" name="id_comment" value="' . $id_comment . '" />' . "\n"; } echo '<table width="99%" border="0" align="center" cellpadding="5" cellspacing="0" class="tbl_usr_dtl">' . "\n"; echo '<tr>'; echo "<td>" . f_err_star('comment') . _Ti('expense_input_comment') . "</td>\n"; echo '<td><textarea name="comment" id="input_expense_comment" class="frm_tarea" rows="3" cols="60">' . clean_output($this->getDataString('comment')) . "</textarea>\n" . "</td>\n"; echo "</tr>\n"; echo "</table>\n"; }
echo '<input type="hidden" name="filecustom" value="' . $_SESSION['form_data']['filecustom'] . '" />' . "\n"; } if ($_SESSION['form_data']['id_report']) { echo "<strong>" . _Ti('rep_input_id') . "</strong> " . $_SESSION['form_data']['id_report'] . "\n\t\t<input type=\"hidden\" name=\"id_report\" value=\"" . $_SESSION['form_data']['id_report'] . "\">\n"; // [ML] echo " | \n"; } // Title of report echo "<p>" . f_err_star('title') . "<strong>" . _Ti('rep_input_title') . "</strong><br />"; echo '<input name="title" value="' . clean_output($_SESSION['form_data']['title']) . '" class="search_form_txt"></p>' . "\n"; // Description echo '<p>' . "<strong>" . _Ti('rep_input_description') . "</strong><br />\n"; echo '<textarea name="description" rows="5" cols="40" class="frm_tarea">'; echo $_SESSION['form_data']['description']; echo "</textarea></p>\n"; // Notes echo '<p>' . "<strong>" . _Ti('rep_input_notes') . "</strong><br />\n"; echo '<textarea name="notes" rows="5" cols="40" class="frm_tarea">'; echo $_SESSION['form_data']['notes']; echo "</textarea></p>\n"; // if ($admin || !read_meta('case_read_always') || !read_meta('case_write_always')) { // echo "\t<tr><td>" . _T('public') . "</td> // <td> // <table> // <tr>\n"; // // if (!read_meta('case_read_always') || $admin) echo " <td>" . _T('read') . "</td>\n"; // if (!read_meta('case_write_always') || $admin) echo " <td>" . _T('write') . "</td>\n"; // // echo "</tr><tr>\n"; // // if (!read_meta('case_read_always') || $admin) {
function install_step_2() { $using_pgsql = false; if (preg_match("/^PostgreSQL/", lcm_sql_server_info())) { $using_pgsql = true; } $db_address = $_SESSION['form_data']['db_address'] = $_REQUEST['db_address']; $db_login = $_SESSION['form_data']['db_login'] = $_REQUEST['db_login']; $db_password = $_SESSION['form_data']['db_password'] = $_REQUEST['db_password']; $db_choice = $_SESSION['form_data']['db_choice'] = _request('db_choice'); if (!$db_login) { $_SESSION['errors']['login'] = _Ti('install_connection_login') . _T('warning_field_mandatory'); } if (!$db_password) { $_SESSION['errors']['password'] = _Ti('install_connection_password') . _T('warning_field_mandatory'); } if ($using_pgsql && !$db_choice) { $_SESSION['errors']['dbname'] = "Database name: " . _T('warning_field_mandatory'); } // TRAD if (count($_SESSION['errors'])) { return install_step_1(); } echo "\n<!--\n"; $link = lcm_connect_db_test($db_address, $db_login, $db_password, $db_choice); $error = lcm_sql_errno() ? lcm_sql_error() : ''; echo "\n-->\n"; if ($error || !$link) { $_SESSION['errors']['generic'] = _T('warning_sql_connection_failed') . ' ' . _T('install_info_sql_connection_failed') . ' (' . lcm_sql_errno() . ': ' . $error . ')'; return install_step_1(); } // If PgSQL, go to next step, db already chosen if ($using_pgsql) { return install_step_3(); } install_html_start('AUTO', '', 2); echo "<h3><small>" . _T('install_step_two') . "</small> " . _T('install_title_select_database') . "</h3>\n"; echo "<form action='install.php' method='post'>\n"; echo "<input type='hidden' name='step' value='3' />\n"; echo "<input type='hidden' name='db_address' value=\"{$db_address}\" size='40' />\n"; echo "<input type='hidden' name='db_login' value=\"{$db_login}\" />\n"; echo "<input type='hidden' name='db_password' value=\"{$db_password}\" />\n\n"; $result = lcm_list_databases($db_address, $db_login, $db_password); echo "<fieldset class='fs_box'>\n"; echo "<p><b><label>" . _T('install_select_database') . "</label></b> " . lcm_help('install_database', 'database') . "</p>"; echo "<!-- " . count($result) . " -->\n"; if (is_array($result) && ($num = count($result)) > 0) { echo "<ul class=\"simple_list\">"; $listdbtxt = ""; for ($i = 0; $i < $num; $i++) { // $table_nom = mysql_dbname($result, $i); $table_name = array_pop($result); $base = "<li><input name='db_choice' value='" . $table_name . "' type='radio' id='tab{$i}'"; $base_end = " /><label for='tab{$i}'>" . $table_name . "</label></li>\n"; if ($table_name == $db_login) { $listdbtxt = "{$base} checked='checked'{$base_end}" . $listdbtxt; $checked = true; } else { $listdbtxt .= "{$base}{$base_end}\n"; } } echo $listdbtxt; echo "</ul>\n"; } else { echo "<div class='box_warning'>\n"; echo "<p><b>" . _T('install_warning_no_databases_1') . "</b></p>\n"; echo "<p><small>" . _T('install_warning_no_databases_2') . "</small></p>\n"; echo "</div>\n"; if ($db_login) { echo _T('install_warning_no_databases_3'); echo "<ul class=\"simple_list\">"; echo "<li><input name=\"db_choice\" value=\"" . $db_login . "\" type='radio' id='stand' checked='checked' />"; echo "<label for='stand'>" . $db_login . "</label><br />\n"; echo "</li></ul>"; echo "<p align='left'>" . _T('info_or') . " ... </p>\n"; $checked = true; } echo '<ul class="simple_list">'; echo '<li><input name="db_choice" value="__manual__" type="radio" id="manual_db_checkbox"'; if (!$checked) { echo ' checked="checked"'; } echo " />\n"; echo "<label for='manual_db_checkbox'>" . _T('install_enter_name_manually') . "</label><br />\n"; echo "<label for='manual_db'>" . _T('install_input_database_name') . "</label>\n"; echo "<input type='text' name='manual_db' id='manual_db' value='' size='20' class='txt_lmnt' /></li>\n"; echo "</ul>\n"; } echo "</fieldset>\n"; echo "<br /><div align='" . $GLOBALS['lcm_lang_right'] . "'>" . "<button type='submit' name='Next'>" . _T('button_next') . " >></button> " . "</div>\n"; echo "</form>\n"; install_html_end(); }
$res_author = lcm_query($q); if (lcm_num_rows($res_author) > 0) { echo "Participants: "; // TRAD $participants = array(); while ($author = lcm_fetch_array($res_author)) { $participants[] = get_person_name($author); } echo join(', ', $participants); echo "<br />\n"; } // Show appointment clients $q = "SELECT aco.*, c.name_first, c.name_middle, c.name_last, o.name\n\t\tFROM lcm_app_client_org as aco\n\t\tLEFT JOIN lcm_org as o ON (aco.id_org = o.id_org)\n\t\tLEFT JOIN lcm_client as c ON (aco.id_client = c.id_client)\n\t\tWHERE id_app = " . $row['id_app']; $res_client = lcm_query($q); if (lcm_num_rows($res_client) > 0) { echo _Ti('app_input_clients'); $clients = array(); while ($client = lcm_fetch_array($res_client)) { $clients[] = get_person_name($client) . ($client['id_org'] > 0 ? " of " . $client['name'] : ''); } // TRAD echo join(', ', $clients); echo "<br />\n"; } // Show edit appointment button if ($ac['e']) { echo '<br /><a href="edit_app.php?app=' . $row['id_app'] . '" class="create_new_lnk">' . _T('app_button_edit') . "</a><br />\n"; } if ($row['id_case'] > 0) { // Show parent followup ([ML] fu.type necessary for short-desc) $q = "SELECT a.id_followup, fu.description, fu.type\n\t\t\t\tFROM lcm_app_fu as a, lcm_followup as fu\n\t\t\t\tWHERE a.id_app = " . $row['id_app'] . "\n\t\t\t \t AND a.id_followup = fu.id_followup\n\t\t\t\t AND a.relation = 'parent'";
lcm_page_start(_T('title_fu_change_status'), '', '', 'cases_intro#status'); } } else { lcm_page_start(_T('title_fu_new'), '', '', 'cases_followups'); } } show_context_start(); show_context_case_title($case, 'followups'); show_context_case_involving($case); // For 'change status' // FIXME (for edit existing fu?) if ($_REQUEST['submit'] == 'set_status') { show_context_item(_Ti('fu_input_current_status') . _T('case_status_option_' . $row['status'])); } // For 'change stage' if (isset($old_stage) && $old_stage) { show_context_item(_Ti('fu_input_current_stage') . _Tkw('stage', $old_stage)); } // Show stage information [ML] Not very efficient, I know, but I prefer to avoid spagetti if ($_SESSION['form_data']['case_stage']) { // if editing an existing followup.. $stage_info = get_kw_from_name('stage', $_SESSION['form_data']['case_stage']); $id_stage = $stage_info['id_keyword']; show_context_stage($case, $id_stage); } elseif (isset($old_stage) && $old_stage) { // setting new stage $stage_info = get_kw_from_name('stage', $old_stage); $id_stage = $stage_info['id_keyword']; show_context_stage($case, $id_stage); } else { // Normal follow-up $result = lcm_query("SELECT stage FROM lcm_case WHERE id_case = " . $case);
$_SESSION['fu_data'] = array(); } // Get case details $q = "SELECT * FROM lcm_case WHERE id_case={$case}"; $result = lcm_query($q); // Check if the case exists if (!($row = lcm_fetch_array($result))) { die("There is no such case."); } // Check if the stage is changed if ($row['stage'] == $stage) { header('Location: ' . $GLOBALS['HTTP_REFERER']); exit; } // Start the page lcm_page_start('Changing case stage: ' . $row['title']); // TRAD // Show the errors (if any) echo show_all_errors($_SESSION['errors']); // Write form echo "<form action='upd_fu.php' method='post'>\n\t<table class='tbl_usr_dtl' width='99%'>\n\t\t<tr><td>" . _Ti('time_input_date_start') . "</td>\n\t\t\t<td>"; $date_start = date('Y-m-d H:i:s'); echo get_date_inputs('start', $date_start, false); echo ' ' . _T('time_input_time_at') . ' '; echo get_time_inputs('start', $date_start); echo ' ' . f_err_star('date_start', $errors); echo "</td>\n"; echo "</tr><tr>\n"; echo "<td>" . "Type:" . "</td>\n\t\t\t<td><input type='hidden' name='type' value='stage_change'>" . _T('kw_followups_stage_change_title') . "</td>\n\t\t</tr>\n\t\t<tr><td valign='top'>" . f_err_star('description') . "Description:" . "</td>\n\t\t\t<td><textarea name='description' rows='15' cols='40' class='frm_tarea'>" . $_SESSION['fu_data']['description'] . "</textarea></td>\n\t\t</tr>\n"; echo "\t</table>\n\n\t<p><button name='submit' type='submit' value='submit' class='simple_form_btn'>" . _T('button_validate') . "</button></p>\n\n\t<input type='hidden' name='id_case' value='{$case}'>\n\t<input type='hidden' name='new_stage' value='{$stage}'>\n\t<input type='hidden' name='ref_edit_fu' value='" . $GLOBALS['HTTP_REFERER'] . "'>\n</form>\n"; lcm_page_end();