diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index 870326c..e3621bb 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -545,6 +545,8 @@ class user_kid extends user_parent { //ha user_obj null, akkor az aktuális usernél állítja be global $sql; + $actualExpireDate = '2100-01-01'; + //kezdetben 0 if (is_object($_user_obj)) { if (null == $_user_obj->get_uk_balance_transfer()) { @@ -570,6 +572,11 @@ class user_kid extends user_parent { else { $_de->set_de_balance($balance); } + + if ($_de->get_de_date() > $actualExpireDate) { + $_de->set_de_balance(0); + } + if ($_de->get_de_type() == 'training') { //$balance -= 1200; @@ -586,15 +593,18 @@ class user_kid extends user_parent { } elseif ($_de->get_de_type() == 'money_deposit') { + $actualExpireDate = $_de->get_de_money_deposit()->get_mod_expire_date(); $_de->set_de_transaction($_de->get_de_money_deposit()->get_mod_money_income()->get_mi_sum()); - if (!$_de->get_de_expired()) { + if (!$_de->get_de_expired() || !$update) { $_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction()); - } else { + } elseif($update) { $_de->set_de_balance(0); } //$balance += $_de->get_de_money_deposit()->get_mod_sum(); //echo $_de->get_de_date() . " plussz " . $_de->get_de_money_deposit()->get_mod_sum() . "

"; } + + //var_dump('balance: '.$_de->get_de_balance()); } if ($update) { if (isset($_de)) $sql->update_table('user_kid', (array('uk_balance' => $_de->get_de_balance())), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false); @@ -658,7 +668,6 @@ class user_kid extends user_parent { "; $action_assoc_array = $sql->assoc_array($action_list_query); -var_dump($action_assoc_array); $actions = array(); $de_array = array(); foreach ($action_assoc_array as $action) { diff --git a/_include/include_diary.php b/_include/include_diary.php index 5e93102..e6351ff 100644 --- a/_include/include_diary.php +++ b/_include/include_diary.php @@ -18,7 +18,7 @@ JOIN training ON (tr_id = pr_training_tr_id AND tr_locked = 1) WHERE - pr_user_kid_uk_id = ".$user->get_uk_id()." + pr_user_kid_uk_id = {$user->get_uk_id()} AND tr_deleted = 0) UNION (SELECT mod_id, TIMESTAMP(mi_date), @@ -28,7 +28,7 @@ money_deposit JOIN money_income ON mi_id = mod_money_income_mi_id WHERE - mod_user_kid_uk_id = ".$user->get_uk_id()." + mod_user_kid_uk_id = {$user->get_uk_id()} AND mod_deleted = 0)) actions ORDER BY object_date ASC; "; @@ -57,9 +57,8 @@ } - //itt csak hivatkozással adjuk át a tömböt, a calculate_balance kiszámolja, belerakja és visszadja - $user->calculate_balance($de_array, $user); + $user->calculate_balance($de_array, $user, false); //lekérjük az áthozatot, és felvesszük entryként $balance_transfer = $user->get_uk_balance_transfer(); if (null == $balance_transfer) { diff --git a/template/templates/user_diary.tpl b/template/templates/user_diary.tpl index dd64ab6..0332fa3 100644 --- a/template/templates/user_diary.tpl +++ b/template/templates/user_diary.tpl @@ -8,7 +8,7 @@
- Aktuális egyenleg: {$action->get_de_balance()|number_format:0:'':' '} Ft + Aktuális egyenleg: {$user->get_uk_balance()|number_format:0:'':' '} Ft