From d2ca0ada6f22776ba08049e3ea9d2eac375a06f4 Mon Sep 17 00:00:00 2001 From: Ricsi Date: Sat, 12 Oct 2019 12:53:56 +0200 Subject: [PATCH] fixed balance bug (expire date) --- _class/class_user_kid.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index d2c9f44..a6f0dc2 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -611,8 +611,13 @@ class user_kid extends user_parent { else { $_de->set_de_balance($balance); } +//var_dump($_de->get_de_date()); +//var_dump(date('Y-m-d 23:59:59', strtotime($actualExpireDate))); + if ($_de->get_de_date() > date('Y-m-d 23:59:59', strtotime($actualExpireDate))) { + $_de->set_de_expired(true); + } - if ($_de->get_de_date() > $actualExpireDate) { + if ($_de->get_de_date() > date('Y-m-d 23:59:59', strtotime($actualExpireDate)) && $_de->get_de_balance() > 0) { $_de->set_de_balance(0); } @@ -634,11 +639,17 @@ 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() || !$update) { + + //ha ez a befizetés az utolsó és lejárt, akkor ne adjuk hozzá a balancehoz + if ($i < (count($_de_obj_array) -1 ) || !$_de->get_de_expired()) { + $_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction()); + } + + /*if (!$_de->get_de_expired() || !$update) { $_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction()); } 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() . "

"; }