From edd39eeae370ea38c4a88baeb71b342348d7ec87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B3th=20Rich=C3=A1rd?= Date: Sat, 15 Sep 2018 15:39:16 +0200 Subject: [PATCH] fixes --- _class/class_money_expense.php | 7 +++++-- _class/class_user_kid.php | 4 +++- _include/include_presence.php | 26 +++++++++++++------------- _include/include_settings.php | 8 ++++++-- common.php | 4 ++-- template/templates/user_diary.tpl | 11 ++++++++++- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/_class/class_money_expense.php b/_class/class_money_expense.php index bc6f5d3..326c70c 100644 --- a/_class/class_money_expense.php +++ b/_class/class_money_expense.php @@ -105,8 +105,11 @@ class money_expense { //a paraméterül kapott nevet megpróbálja coach ID-ra alakítani //ha sikerül, akkor visszaadja a coach ID-t //egyébként beszúr egy újat, törölt stáusszal, majd visszatér annak az id-jával - if ($sql->num_of_rows("select ua_id from user_coach where ua_name = '".$_ua_name."';")) { - return $sql->single_variable("select ua_id from user_coach where ua_name = '".$_ua_name."';"); + if ($sql->num_of_rows("select ua_id from user_coach where ua_name = '".$_ua_name."' and ua_deleted = 0;")) { + return $sql->single_variable("select ua_id from user_coach where ua_name = '".$_ua_name."' and ua_deleted = 0;"); + } + elseif ($sql->num_of_rows("select ua_id from user_coach where ua_name = '".$_ua_name."' and ua_deleted = 1;")) { + return $sql->single_variable("select ua_id from user_coach where ua_name = '".$_ua_name."' and ua_deleted = 1;"); } else { return $sql->insert_into('user_coach', array('ua_name' => $_ua_name, 'ua_deleted' => 1)); diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index cf34634..0f13c4b 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -504,6 +504,9 @@ class user_kid extends user_parent { if (isset($_de_obj_array[$i-1])) { $_de->set_de_balance($_de_obj_array[$i-1]->get_de_balance()); } + else { + $_de->set_de_balance($balance); + } if ($_de->get_de_type() == 'training') { //ha edzés, akkor -1200 levonás, kivéve, ha kedvezményes: //1-nél több edzés / nap @@ -541,7 +544,6 @@ class user_kid extends user_parent { //echo $_de->get_de_date() . " plussz " . $_de->get_de_money_deposit()->get_mod_sum() . "

"; } } - 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); else $sql->update_table('user_kid', (array('uk_balance' => 0)), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false); diff --git a/_include/include_presence.php b/_include/include_presence.php index eafda04..7a2e575 100644 --- a/_include/include_presence.php +++ b/_include/include_presence.php @@ -15,7 +15,7 @@ if ($this->is_id()) { $presence_query = "SELECT * FROM user_kid ORDER BY uk_name;"; $presence_assoc_array = $sql->assoc_array($presence_query); //végig kell menni rajta h legeneráljuk az usereket - + $users = array(); //var_dump($presence_assoc_array); /* @@ -29,7 +29,7 @@ if ($this->is_id()) { //training data $training = new training(); $training->set_training_data_by_id($this->get_id()); - + //SZŰRÉS $tr_ids = array(); for ($i=1; $i <=4 ; $i++) { @@ -44,13 +44,13 @@ if ($this->is_id()) { FROM `presence` JOIN user_kid ON uk_id = pr_user_kid_uk_id JOIN training ON tr_id = pr_training_tr_id - WHERE `pr_training_tr_id` - IN ( " . implode(',', $tr_ids) . " ) - AND `uk_deleted` = 0 + WHERE `pr_training_tr_id`". + (!empty($tr_ids)?"IN ( " . implode(',', $tr_ids) . " ) ":" ") + ."AND `uk_deleted` = 0 AND `tr_deleted` = 0 AND `uk_is_active` = 1 GROUP BY `pr_user_kid_uk_id` - ORDER BY count( `pr_id` ) DESC, uk_name ASC; + ORDER BY count( `pr_id` ) DESC, uk_name ASC; "; //echo $presence_query; //echo $presence_query; @@ -71,7 +71,7 @@ if ($this->is_id()) { } if (!empty($exeptions)) $rest_user_query = "SELECT * FROM user_kid WHERE uk_id NOT IN (" . implode(',', $exeptions) . ") AND uk_deleted = 0 AND uk_is_active = 1 ORDER BY uk_name ASC;"; //ha vannak kiemelt userek - else $rest_user_query = "SELECT * FROM user_kid WHERE uk_deleted = 0 ORDER BY uk_name;"; //ha nincsenek kiemelt userek + else $rest_user_query = "SELECT * FROM user_kid WHERE uk_deleted = 0 AND uk_is_active = 1 ORDER BY uk_name;"; //ha nincsenek kiemelt userek $rest_user_assoc_array = $sql->assoc_array($rest_user_query); foreach ($rest_user_assoc_array as $rest_user) { $user = new user_kid(); @@ -102,7 +102,7 @@ if ($this->is_id()) { } //var_dump($users); - + //headcount $headcount_query = "SELECT * FROM presence WHERE pr_training_tr_id = " . $this->get_id() . ";"; $headcount = $sql->num_of_rows($headcount_query); @@ -116,7 +116,7 @@ if ($this->is_id()) { JOIN user_kid ON uk_id = pr_user_kid_uk_id WHERE `pr_training_tr_id` = ".$this->get_id()." AND uk_deleted = 0 - ORDER BY uk_name ASC; + ORDER BY uk_name ASC; "; @@ -126,7 +126,7 @@ if ($this->is_id()) { $s_user->set_user_data_by_id($presence['pr_user_kid_uk_id']); $s_users[] = $s_user; } - + $smarty->assign('training', $training); @@ -139,7 +139,7 @@ if ($this->is_id()) { $smarty->assign('sorted_users', $s_users); $smarty->assign('rest_users', $rest_users); $smarty->assign('tr_id', $this->get_id()); - + $smarty->display("presence.tpl"); } @@ -159,11 +159,11 @@ else { $smarty->assign("training_array", $training_array); $smarty->display("presence_list.tpl"); - + } -?> \ No newline at end of file +?> diff --git a/_include/include_settings.php b/_include/include_settings.php index 119f0d6..6fbbdff 100644 --- a/_include/include_settings.php +++ b/_include/include_settings.php @@ -38,12 +38,16 @@ if ($this->is_id()) { header('Location: /admin/' . $new_setting->get_setv_varchar()); } + elseif ($new_setting->get_setv_setting()->get_set_setting_type_st_id() == 4) { + + } + $smarty->assign("setting", $new_setting); $smarty->display("setting_data_edit.tpl"); - + } else { # BEÁLLÍTÁSOK @@ -66,4 +70,4 @@ else { } -?> \ No newline at end of file +?> diff --git a/common.php b/common.php index e849539..ad81fdc 100644 --- a/common.php +++ b/common.php @@ -27,7 +27,7 @@ spl_autoload_register(function ($class_name) { 'Smarty_Undefined_Variable', 'Smarty_Internal_ParseTree_DqContent', 'Smarty_Internal_ParseTree_Dq' - + ); if (!in_array($class_name, $exception)) include '_class/class_' . $class_name . '.php'; }); @@ -174,4 +174,4 @@ $smarty->assign('can_logout', $logout); -?> \ No newline at end of file +?> diff --git a/template/templates/user_diary.tpl b/template/templates/user_diary.tpl index b15c137..76f1cae 100644 --- a/template/templates/user_diary.tpl +++ b/template/templates/user_diary.tpl @@ -1,4 +1,13 @@
+ + {if count($actions) == 0} +
+
+ Áthozat: {$balance_transfer} Ft +
+
+ {/if} + {foreach $actions as $action} {if $action->get_de_training()|is_a:'training'} @@ -61,7 +70,7 @@ {if $action->get_de_discount_id() == 1} {assign var="discount" value="Próba kedvezmény"} {elseif $action->get_de_discount_id() == 2} - {assign var="discount" value="Havi 8+ kedvezmény"} + {assign var="discount" value="Havi 10+ kedvezmény"} {elseif $action->get_de_discount_id() == 3} {assign var="discount" value="Duplázó kedvezmény"} {/if}