function update_case_history($id, $enter = 0, $txt = '') { global $db, $_SESSION; $H = array(); $H["hc_cu_id_k"] = $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["id"]; $H["hc_c_id_k"] = $id; $H["hc_timestamp"] = date("Y-m-d H:i:s"); $H["hc_enter"] = $enter; $cnt = $db->GetOne("SELECT COUNT(1) FROM wind_history_case WHERE hc_timestamp LIKE '" . date("Y-m-d H:i") . "%' AND hc_c_id_k={$id} AND hc_cu_id_k=" . $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["id"]); if (!$cnt) { wpisz($H, "wind_history_case", array()); } //wysyłanie maila do pełnomocnika $sprawa = $db->GetRow("SELECT ca_number_c, ca_agent_id_k, ca_debtor_id_k, ca_creditor_id_k FROM wind_case WHERE ca_id_s={$id}"); $email = $db->GetOne("SELECT cu_email_c FROM wind_users WHERE cu_id_s=" . $sprawa['ca_agent_id_k']); if ($email != '') { if (file_exists("../include/mail.php")) { include "../include/mail.php"; } $dluznik = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $sprawa['ca_debtor_id_k']); $wierzyciel = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $sprawa['ca_creditor_id_k']); $admin_letter = new eMail(2); $admin_letter->eMailContent('Zmiana w sprawie ' . $sprawa['ca_number_c'], '<html><head><title>Zmiana w sprawie ' . $sprawa['ca_number_c'] . '</title></head><body>W sprawie o numerze ' . $sprawa['ca_number_c'] . ' zostały zarejestrowane zmiany.' . "\n" . '<br><br>Dłużnik: ' . $dluznik . "\n" . '<br>Wierzyciel: ' . $wierzyciel . "\n" . ($txt != '' ? '<br>Szczegóły: ' . $txt : '') . '</body></html>'); $admin_letter->eMailSend($email); //$admin_letter->eMailSend('*****@*****.**'); } //////////////////////////////// }
function update_history_operation($where, $operation, $table, $id) { global $_SESSION; $H = array(); $H["bho_datetime_d"] = date("Y-m-d H:i:s"); $H["bho_user_c"] = $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["name"] . " (" . $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["user"] . ")"; $H["bho_where_c"] = $where; $H["bho_operation_c"] = $operation; $H["bho_user_k"] = $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["id"]; $H["bho_table_c"] = $table; $H["bho_table_id"] = $id; wpisz($H, "wind_history_operation", array()); }
} print "<script>go_to('_client,{$typ}');</script>"; } if ($submit_x) { $_POST['c_nip_c'] = str_replace('-', '', $_POST['c_nip_c']); if (isset($_cID) && $_cID > 0) { $_POST["c_modify_d"] = date("Y-m-d H:i:s"); update2($_POST, "wind_client", array("submit_x", "submit_y", "_cID", "offset"), "c_id_s", $_cID); update_history_operation($_POST['c_type_e'] == 'd' ? 'Dłużnicy' : ($_POST['c_type_e'] == 'w' ? 'Wierzyciele' : 'Dłużnicy i wierzyciele'), "Zmiana " . ($_POST['c_type_e'] == 'd' ? 'dłużnika' : ($_POST['c_type_e'] == 'w' ? 'wierzyciela' : 'dłużnika i wierzyciela')) . " \"" . $_POST["c_name_c"] . "\"", "wind_client", $_cID); $_SESSION['message'][] = ($_POST['c_type_e'] == 'd' ? 'Dłużnik' : ($_POST['c_type_e'] == 'w' ? 'Wierzyciel' : 'Dłużnik i wierzyciel')) . " " . $_POST["c_name_c"] . " zmieniony"; } else { $exist = $db->GetOne("SELECT COUNT(1) FROM wind_client WHERE c_shortname_c LIKE '" . $_POST['c_shortname_c'] . "'"); if (!$exist) { $_POST["c_create_d"] = date("Y-m-d H:i:s"); $_POST["c_u_id_k"] = $_SESSION['fh49ty58u893ytf83902g758902djr4cf302ty5798']['id']; $newid = wpisz($_POST, "wind_client", array("submit_x", "submit_y", "offset")); update_history_operation($_POST['c_type_e'] == 'd' ? 'Dłużnicy' : ($_POST['c_type_e'] == 'w' ? 'Wierzyciele' : 'Dłużnicy i wierzyciele'), "Dodanie " . ($_POST['c_type_e'] == 'd' ? 'dłużnika' : ($_POST['c_type_e'] == 'w' ? 'wierzyciela' : 'dłużnika i wierzyciela')) . " \"" . $_POST["c_name_c"] . "\"", "wind_client", $newid); $_SESSION['message'][] = ($_POST['c_type_e'] == 'd' ? 'Dłużnik' : ($_POST['c_type_e'] == 'w' ? 'Wierzyciel' : 'Dłużnik i wierzyciel')) . " " . $_POST["c_name_c"] . " dodany"; } else { $_SESSION['errors'][] = 'Klient o wpisanej nazwie skróconej już istnieje w bazie'; } } print "<script>go_to('_client" . ($_POST['c_type_e'] == 'd' ? ',d' : ',w') . ($offset > 0 ? ",o," . $offset : "") . "');</script>"; } if (isset($del_client)) { $name = $db->GetRow("SELECT c_name_c, c_type_e FROM wind_client WHERE c_id_s={$del_client}"); $deleting = usun2('wind_client', 'c_id_s', $del_client); if ($deleting) { update_history_operation($name['c_type_e'] == 'd' ? 'Dłużnicy' : ($name['c_type_e'] == 'w' ? 'Wierzyciele' : 'Dłużnicy i wierzyciele'), "Usunięcie " . ($name['c_type_e'] == 'd' ? 'dłużnika' : ($name['c_type_e'] == 'w' ? 'wierzyciela' : 'dłużnika i wierzyciela')) . " \"" . $name["c_name_c"] . "\"", "wind_client", 'NULL'); $_SESSION['message'][] = ($name['c_type_e'] == 'd' ? 'Dłużnik' : ($name['c_type_e'] == 'w' ? 'Wierzyciel' : 'Dłużnik i wierzyciel')) . " " . $name["c_name_c"] . " usunięty"; } else {
wpisz($H, "wind_history_log", array()); //aktualni zalogowani $L = array(); $L["l_ip_c"] = $_SERVER["REMOTE_ADDR"]; $L['l_datetime_dt'] = $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["datetime"]; $L['l_cu_id_k'] = $p["cu_id_s"]; $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["logged"] = wpisz($L, "wind_logged", array()); $TMP['user_id_k'] = $p["cu_id_s"]; $TMP['stamp'] = $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["datetime"]; wpisz($TMP, "wind_tmp", array()); } else { $H["bhl_datetime_d"] = date("Y-m-d H:i:s"); $H["bhl_ip_c"] = $_SERVER["REMOTE_ADDR"]; $H["bhl_host_c"] = gethostbyaddr($_SERVER["REMOTE_ADDR"]); $H["bhl_user_c"] = "<b>Próba nieautoryzowanego wejścia</b>"; wpisz($H, "wind_history_log", array()); $_SESSION['errors'][] = 'Zalogowanie niemożliwe'; print "<script>go_to('loguj');</script>"; } ?> <script language="JavaScript"> <!-- window.location.href="index.php"; //--> </script> <?php } } else { czysc_stare_logowania(); ?> <br><br>
$_SESSION['errors'][] = "Usunięcie komornika {$name} nie powiodło się"; } } } print "<script>go_to('_executive');</script>"; } if ($submit_x) { if (isset($_eID) && $_eID > 0) { $_POST["e_modify_d"] = date("Y-m-d H:i:s"); update2($_POST, "wind_executive", array("submit_x", "submit_y", "_eID", "offset"), "e_id_s", $_eID); update_history_operation("Komornicy", "Zmiana komornika \"" . $_POST["e_name_c"] . "\"", "wind_executive", $_eID); $_SESSION['message'][] = "Komornik " . $_POST['e_name_c'] . " zmieniony"; } else { $_POST["e_create_d"] = date("Y-m-d H:i:s"); $_POST["e_u_id_k"] = $_SESSION['fh49ty58u893ytf83902g758902djr4cf302ty5798']['id']; $newid = wpisz($_POST, "wind_executive", array("submit_x", "submit_y", "offset")); update_history_operation("Komornicy", "Dodanie komornika \"" . $_POST["e_name_c"] . "\"", "wind_executive", $newid); $_SESSION['message'][] = "Komornik " . $_POST['e_name_c'] . " dodany"; } print "<script>go_to('_executive" . ($offset > 0 ? ",o," . $offset : "") . "');</script>"; } if (isset($del_executive)) { $name = $db->GetOne("SELECT e_name_c FROM wind_executive WHERE e_id_s={$del_executive}"); $deleting = usun2('wind_executive', 'e_id_s', $del_executive); if ($deleting) { update_history_operation("Komornicy", "Usunięcie komornika \"{$name}\"", "wind_executive", 'NULL'); $_SESSION['message'][] = "Komornik {$name} usunięty"; } else { if ($deleting == -1) { $_SESSION['errors'][] = "Usunięcie komornika {$name} nie powiodło się"; }
$_SESSION['errors'][] = "Usunięcie biura {$name} nie powiodło się"; } } } print "<script>go_to('_office');</script>"; } if (isset($submit_x) || isset($submit)) { if (isset($_offID) && $_offID > 0) { $_POST["o_modify_d"] = date("Y-m-d H:i:s"); update2($_POST, "wind_office", array("submit_x", "submit_y", "_offID", "offset"), "o_id_s", $_offID); update_history_operation("Biura", "Zmiana biura \"" . $_POST["o_name_c"] . "\"", "wind_office", $_offID); $_SESSION['message'][] = "Biuro " . $_POST['o_name_c'] . " zmienione"; } else { $_POST["o_create_d"] = date("Y-m-d H:i:s"); $_POST["o_u_id_k"] = $_SESSION['fh49ty58u893ytf83902g758902djr4cf302ty5798']['id']; $newid = wpisz($_POST, "wind_office", array("submit_x", "submit_y", "offset")); update_history_operation("Biura", "Dodanie biura \"" . $_POST["o_name_c"] . "\"", "wind_office", $newid); $_SESSION['message'][] = "Biuro " . $_POST['o_name_c'] . " dodane"; } print "<script>go_to('_office" . ($offset > 0 ? ",o," . $offset : "") . "');</script>"; } if (isset($del_office)) { $name = $db->GetOne("SELECT o_name_c FROM wind_office WHERE o_id_s={$del_office}"); $deleting = usun2('wind_office', 'o_id_s', $del_office); if ($deleting) { update_history_operation("Biura", "Usunięcie Biura \"{$name}\"", "wind_office", 'NULL'); $_SESSION['message'][] = "Biuro {$name} usunięty"; } else { if ($deleting == -1) { $_SESSION['errors'][] = "Usunięcie Biura {$name} nie powiodło się"; }
foreach ($permtable as $name) { $perm = 0; if (!in_array($_POST['cu_type_e'], array('p', 'c', 'k', 'r'))) { if ($_POST['create'][$name] == 'on') { $perm += 1; } if ($_POST['edit'][$name] == 'on') { $perm += 2; } if ($_POST['del'][$name] == 'on') { $perm += 4; } } $P[$name] = $_POST['cu_type_e'] == 'a' ? 7 : $perm; } wpisz($P, "wind_acl", array()); print "<script>go_to('_users');</script>"; } if (isset($del_user)) { $name = $db->GetOne("SELECT cu_login_c FROM wind_users WHERE cu_id_s={$del_user}"); $deleting = usun2('wind_users', 'cu_id_s', $del_user); if ($deleting) { update_history_operation("Użytkownicy", "Usunięcie użytkownika o loginie \"" . $name . "\"", "wind_users", 'NULL'); $_SESSION['message'][] = "Użytkownik \"{$name}\" usunięty"; } else { if ($deleting == -1) { $_SESSION['errors'][] = "Usunięcie użytkownika \"{$name}\" nie powiodło się"; } } print "<script>go_to('_users');</script>"; }
$db->Execute("DELETE FROM wind_fees WHERE fee_case_id_k={$_caID}"); foreach ($_POST['fee_am'] as $fee => $amount) { ereg("([0-9]{2}).([0-9]{2}).([0-9]{4})", $_POST['fee_date_' . $fee], $DF); $data = $DF[3] . '-' . $DF[2] . '-' . $DF[1]; if ($amount > 0 && $data != '0000-00-00') { wpisz(array('fee_case_id_k' => $_caID, 'fee_type_e' => $fee, 'fee_amount_f' => $amount, 'fee_date_d' => $data), "wind_fees", array()); } } update_case_history($_caID, 0, $case_txt); } else { $_POST["ca_create_d"] = date("Y-m-d H:i:s"); $_POST["ca_u_id_k"] = $_SESSION['fh49ty58u893ytf83902g758902djr4cf302ty5798']['id']; $db->Execute('LOCK TABLES wind_case;'); $_POST['ca_number_i'] = kolejna_sprawa(date("Y")); $_POST['ca_number_c'] = kolejna_sprawa(date("Y")) . "/" . date("Y"); $_caID = wpisz($_POST, "wind_case", array("submit_x", "submit_y", "offset")); $db->Execute('UNLOCK TABLES wind_case;'); if ($_caID) { update_history_operation("Sprawy", "Dodanie sprawy \"" . $_POST["ca_number_c"] . "\"", "wind_case", $_caID); } $_SESSION['message'][] = "Sprawa \"" . $_POST["ca_number_c"] . "\" dodana"; update_case_history($_caID, 0, "Sprawa dodana"); } print "<script>go_to('case,{$_caID}" . ($offset ? ',' . $offset : '') . "');</script>"; } if (isset($del_case)) { $name = $db->GetOne("SELECT ca_number_c FROM wind_case WHERE ca_id_s={$del_case}"); update_case_history($del_case, 0, "Sprawa usunięta"); $deleting = usun2('wind_case', 'ca_id_s', $del_case); if ($deleting) { update_history_operation("Sprawy", "Usunięcie sprawy o numerze \"" . $name . "\"", "wind_case", 'NULL');
function update_prints($typ, $case) { global $db, $_SESSION; $H = array(); $H["p_date_dt"] = date("Y-m-d H:i:s"); $H["p_user_id_k"] = $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["id"]; $H["p_type_c"] = $typ; $H["p_case_id_k"] = $case; $cnt = $db->GetOne("SELECT COUNT(1) FROM wind_prints WHERE p_date_dt LIKE '" . date("Y-m-d H:i") . "%' AND p_case_id_k={$case} AND p_type_c='{$typ}' AND p_user_id_k=" . $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["id"]); if (!$cnt) { wpisz($H, "wind_prints", array()); } }