mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Updated Account Types liasting and posting to use the new account_type_parent field, also update setup to inset the correct account types into the correct account_type_parent
This commit is contained in:
@@ -10,42 +10,7 @@ if (isset($_POST['add_account_type'])) {
|
||||
$type = intval($_POST['type']);
|
||||
$description = sanitizeInput($_POST['description']);
|
||||
|
||||
switch ($type) {
|
||||
case 10:
|
||||
$type_name = "Assets";
|
||||
$result = mysqli_query($mysqli,"SELECT account_type_id FROM account_types");
|
||||
$account_type_id = 10;
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
if ($row['account_type_id'] == $account_type_id) {
|
||||
$account_type_id++;
|
||||
}
|
||||
}
|
||||
mysqli_query($mysqli,"INSERT INTO account_types SET account_type_id = $account_type_id, account_type_name = '$name', account_type_description = '$description'");
|
||||
break;
|
||||
case 20:
|
||||
$type_name = "Liabilities";
|
||||
$result = mysqli_query($mysqli,"SELECT account_type_id FROM account_types");
|
||||
$account_type_id = 20;
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
if ($row['account_type_id'] == $account_type_id) {
|
||||
$account_type_id++;
|
||||
}
|
||||
}
|
||||
mysqli_query($mysqli,"INSERT INTO account_types SET account_type_id = $account_type_id, account_type_name = '$name', account_type_description = '$description'");
|
||||
break;
|
||||
case 30:
|
||||
$type_name = "Equity";
|
||||
$result = mysqli_query($mysqli,"SELECT account_type_id FROM account_types");
|
||||
$account_type_id = 30;
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
if ($row['account_type_id'] == $account_type_id) {
|
||||
$account_type_id++;
|
||||
}
|
||||
}
|
||||
mysqli_query($mysqli,"INSERT INTO account_types SET account_type_id = $account_type_id, account_type_name = '$name', account_type_description = '$description'");
|
||||
break;
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO account_types SET account_type_parent = $type, account_type_name = '$name', account_type_description = '$description'");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Account Type', log_action = 'Create', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||
@@ -60,9 +25,10 @@ if (isset($_POST['edit_account_type'])) {
|
||||
|
||||
$account_type_id = intval($_POST['account_type_id']);
|
||||
$name = sanitizeInput($_POST['name']);
|
||||
$type = intval($_POST['type']);
|
||||
$description = sanitizeInput($_POST['description']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE account_types SET account_type_name = '$name', account_type_description = '$description' WHERE account_type_id = $account_type_id");
|
||||
mysqli_query($mysqli,"UPDATE account_types SET account_type_parent = $type, account_type_name = '$name', account_type_description = '$description' WHERE account_type_id = $account_type_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Account Type', log_action = 'Edit', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||
|
||||
Reference in New Issue
Block a user