log and other fixes

This commit is contained in:
Ricsi
2017-02-14 19:04:49 +01:00
parent 8e31db7ef1
commit 7080ef002c
6 changed files with 19 additions and 9 deletions

View File

@@ -93,7 +93,7 @@ class money_deposit {
}
public function create_money_deposit($_user_id, $_date, $_sum) {
public static function create_money_deposit($_user_id, $_date, $_sum) {
global $sql;
return $sql->insert_into('money_deposit', array(
'mod_user_kid_uk_id' => $_user_id,
@@ -103,7 +103,7 @@ class money_deposit {
);
}
public function update_money_deposit($_user_id, $_date, $_sum, $_mod_id) {
public static function update_money_deposit($_user_id, $_date, $_sum, $_mod_id) {
global $sql;
$sql->update_table('money_deposit', array(
'mod_user_kid_uk_id' => $_user_id,

View File

@@ -106,10 +106,10 @@ class money_expense {
));
}
public static function update_money_expense_category($_name, $_date, $_item, $_sum, $_moxc_id, $_id) {
public static function update_money_expense($_name, $_date, $_item, $_sum, $_moxc_id, $_id) {
global $sql;
$sql->update_table('money_expense_category',
$sql->update_table('money_expense',
array(
'mox_name' => $_name,
'mox_date' => $_date,

View File

@@ -2,7 +2,9 @@
if ($this->is_id()) {
$sql->update_table('money_expense', array('mox_deleted' => 1), array('mox_id' => $this->get_id()));
log::register('delete_mox', $this->get_id());
$mox = new money_expense();
$mox->set_mox_data_by_id($this->get_id());
log::register('delete_mox', $mox->get_mox_item() . ": " . $mox->get_mox_sum() . " Ft");
header("Location: /admin/money_expense");
}

View File

@@ -3,6 +3,14 @@
if ($this->is_id()) {
$sql->update_table('money_expense_category', array('moxc_deleted' => 1), array('moxc_id' => $this->get_id()));
log::register('delete_moxc', $this->get_id());
//akiknek ez a moxc_id van beállítva, azoknál null-ra állítjuk
$mox_query = "SELECT mox_id FROM money_expense WHERE mox_money_expense_category_moxc_id = " . $this->get_id();
$mox_assoc_array = $sql->assoc_array($mox_query);
foreach ($mox_assoc_array as $uk_id) {
$sql->update_table('money_expense', array('mox_money_expense_category_moxc_id' => 'null'), array('mox_id' => $uk_id['mox_id']));
}
header("Location: /admin/money_expense_category");
}

View File

@@ -273,13 +273,13 @@ if (isset($_POST['action'])) {
case 'mox_create':
# befizetés létrehozása
$new_mox_id = money_expense::create_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id']);
log::register('new_mox', $new_mox_id);
log::register('new_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft");
header("Location: /admin/money_expense");
break;
case 'mox_update':
# befizetés módosítása
money_expense::update_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_id']);
log::register('update_mox', $_POST['mox_id']);
log::register('update_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft");
header("Location: /admin/money_expense");
case 'settings_data_edit':
$sql->update_table('setting_value',

View File

@@ -3,8 +3,8 @@
<div class="buttons">
<a href="/admin/delete_money_expense/{$mox->get_mox_id()}" class="addbutton delete-big">Kiadás törlése</a>
</div>
<input type="hidden" name="action" value="mox_create">
<input type="hidden" name="moxc_id" value="{$mox->get_mox_id()}">
<input type="hidden" name="action" value="mox_update">
<input type="hidden" name="mox_id" value="{$mox->get_mox_id()}">
<div>
<label for="mox_name">Név:</label>