Zoli requests

This commit is contained in:
Tóth Richárd
2018-09-03 18:19:21 +02:00
parent a50eab7528
commit 180e9af3ff
9 changed files with 134 additions and 46 deletions

View File

@@ -38,6 +38,7 @@ class user_kid extends user_parent {
private $user_official_age_category;
private $user_contact;
private $user_other;
private $user_balance_transfer;
private $user_deleted;
public function set_uk_id($_uid) {
@@ -263,6 +264,12 @@ class user_kid extends user_parent {
public function get_uk_balance() {
return $this->user_balance;
}
public function set_uk_balance_transfer($_balance_transfer) {
$this->user_balance_transfer = $_balance_transfer;
}
public function get_uk_balance_transfer() {
return $this->user_balance_transfer;
}
public function is_logged_in() {
//leellenőrzi cookie alapján h be vagyunk-e jelentkezve
//JAVÍTVA: adja vissza az adattag igazságértékét
@@ -476,14 +483,29 @@ class user_kid extends user_parent {
global $sql;
//kezdetben 0
$balance = 0;
if (is_object($_user_obj)) {
if (null == $_user_obj->get_uk_balance_transfer()) {
$balance = 0;
}
else {
$balance = $_user_obj->get_uk_balance_transfer();
}
}
else {
if (null == $this->get_uk_balance_transfer()) {
$balance = 0;
}
else {
$balance = $this->get_uk_balance_transfer();
}
}
foreach ($_de_obj_array as $i => $_de) {
//minden lépésben az balance-t be kell állítani az előző lépésben updatelt balance-ra
if (isset($_de_obj_array[$i-1])) {
$_de->set_de_balance($_de_obj_array[$i-1]->get_de_balance());
}
if ($_de->get_de_type() == 'training') {
//ha edzés, akkor -1000 levonás, kivéve, ha kedvezményes:
//ha edzés, akkor -1200 levonás, kivéve, ha kedvezményes:
//1-nél több edzés / nap
//8-nál több edzés / hónap
//első két alkalom egyike
@@ -498,13 +520,18 @@ class user_kid extends user_parent {
//TODO: ha van már havi 8+ akk ne nézze a duplázót!
if ($_de->get_de_first_two() > 0) $_de->set_de_discount_id(1);
if ($_de->get_de_training_per_day() > 1) $_de->set_de_discount_id(3);
if ($_de->get_de_training_per_month() > 8) $_de->set_de_discount_id(2);
if ($_de->get_de_training_per_month() > 10) $_de->set_de_discount_id(2);
}
else {
//$balance -= 1000;
$_de->set_de_transaction(-1000); //beállítjuk, mennyivel csökken az egyenleg
$_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction()); //beállítjuk az új egyenleget
//echo $_de->get_de_date() . " minusz 1000<br><br>";
//$balance -= 1200;
$_de->set_de_transaction(-1200); //beállítjuk, mennyivel csökken az egyenleg
if (0 == $i) {
$_de->set_de_balance($balance+$_de->get_de_transaction()); //beállítjuk az új egyenleget
}
else {
$_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction()); //beállítjuk az új egyenleget
}
//echo $_de->get_de_date() . " minusz 1200<br><br>";
}
}
elseif ($_de->get_de_type() == 'money_deposit') {