custom training price
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
PAGE CLASS
|
||||
url alapjan lekeri a template-et
|
||||
http://badmintoncoach-demo.hu/PAGE/SUBPAGE/ID
|
||||
http://cegledcoach.hu/PAGE/SUBPAGE/ID
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
/*
|
||||
TRAINING osztály
|
||||
Edzések
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class training {
|
||||
@@ -16,13 +13,12 @@ class training {
|
||||
private $tr_duration;
|
||||
private $tr_note;
|
||||
private $tr_locked;
|
||||
private $tr_price;
|
||||
private $tr_deleted;
|
||||
private $coaches = array();
|
||||
|
||||
private $helpers = array();
|
||||
|
||||
|
||||
|
||||
public function set_tr_id($_tr_id) {
|
||||
$this->tr_id = $_tr_id;
|
||||
}
|
||||
@@ -47,6 +43,10 @@ class training {
|
||||
$this->tr_locked = $_tr_locked;
|
||||
}
|
||||
|
||||
public function set_tr_price($_tr_price) {
|
||||
$this->tr_price = $_tr_price;
|
||||
}
|
||||
|
||||
public function set_tr_deleted($_tr_deleted) {
|
||||
$this->tr_deleted = $_tr_deleted;
|
||||
}
|
||||
@@ -89,6 +89,10 @@ class training {
|
||||
return $this->tr_locked;
|
||||
}
|
||||
|
||||
public function get_tr_price() {
|
||||
return $this->tr_price;
|
||||
}
|
||||
|
||||
public function get_tr_deleted() {
|
||||
return $this->tr_deleted;
|
||||
}
|
||||
@@ -209,6 +213,9 @@ class training {
|
||||
if ($_training_value_array['tr_note'] == "") {
|
||||
$_training_value_array['tr_note'] = null;
|
||||
}
|
||||
if ($_training_value_array['tr_price'] == "") {
|
||||
$_training_value_array['tr_price'] = null;
|
||||
}
|
||||
$new_tr_id = $sql->insert_into('training', $_training_value_array);
|
||||
log::register('new_training', $new_tr_id);
|
||||
if (isset($coaches)) {
|
||||
|
||||
@@ -2,42 +2,62 @@
|
||||
|
||||
# EDZÉS TÍPUS OSZTÁLY
|
||||
|
||||
|
||||
class training_type {
|
||||
private $trt_id;
|
||||
private $trt_name;
|
||||
private $trt_deleted;
|
||||
private $trt_id;
|
||||
private $trt_name;
|
||||
private $trt_default_price;
|
||||
private $trt_deleted;
|
||||
|
||||
public function set_trt_id($_id) {
|
||||
$this->trt_id = $_id;
|
||||
}
|
||||
public function set_trt_id($_id) {
|
||||
$this->trt_id = $_id;
|
||||
}
|
||||
|
||||
public function set_trt_name($_name) {
|
||||
$this->trt_name = $_name;
|
||||
}
|
||||
public function set_trt_name($_name) {
|
||||
$this->trt_name = $_name;
|
||||
}
|
||||
|
||||
public function set_trt_deleted($_deleted) {
|
||||
$this->trt_deleted = $_deleted;
|
||||
}
|
||||
public function set_trt_deleted($_deleted) {
|
||||
$this->trt_deleted = $_deleted;
|
||||
}
|
||||
|
||||
public function get_trt_id() {
|
||||
return $this->trt_id;
|
||||
}
|
||||
public function set_trt_default_price($_price) {
|
||||
$this->trt_default_price = $_price;
|
||||
}
|
||||
|
||||
public function get_trt_name() {
|
||||
return $this->trt_name;
|
||||
}
|
||||
public function get_trt_id() {
|
||||
return $this->trt_id;
|
||||
}
|
||||
|
||||
public function get_trt_deleted() {
|
||||
return $this->trt_deleted;
|
||||
}
|
||||
public function get_trt_name() {
|
||||
return $this->trt_name;
|
||||
}
|
||||
|
||||
public static function create_training_type($_trt_value_array) {
|
||||
global $sql;
|
||||
return $sql->insert_into('training_type', $_trt_value_array);
|
||||
}
|
||||
public function get_trt_default_price() {
|
||||
return $this->trt_default_price;
|
||||
}
|
||||
|
||||
public function set_trt_data_by_id($_id) {
|
||||
public function get_trt_deleted() {
|
||||
return $this->trt_deleted;
|
||||
}
|
||||
|
||||
public static function create_training_type($_trt_value_array) {
|
||||
global $sql;
|
||||
if ('' == $_trt_value_array['trt_default_price']) {
|
||||
$_trt_value_array['trt_default_price'] = 'null';
|
||||
}
|
||||
return $sql->insert_into('training_type', $_trt_value_array);
|
||||
}
|
||||
|
||||
public static function update_training_type($_trt_value_array) {
|
||||
global $sql;
|
||||
$default_price = $_trt_value_array['trt_default_price'];
|
||||
if ('' == $default_price) {
|
||||
$default_price = 'null';
|
||||
}
|
||||
return $sql->update_table('training_type', array('trt_name' => $_trt_value_array['trt_name'], 'trt_default_price' => $default_price), array('trt_id' => $_trt_value_array['trt_id']));
|
||||
}
|
||||
|
||||
public function set_trt_data_by_id($_id) {
|
||||
global $sql;
|
||||
$trt_data_assoc_array = $sql->assoc_array("select * from training_type where trt_id = " . $_id);
|
||||
$trt_data_array = $trt_data_assoc_array[0];
|
||||
@@ -49,5 +69,4 @@ class training_type {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -531,7 +531,9 @@ class user_kid extends user_parent {
|
||||
if ($_de->get_de_type() == 'training') {
|
||||
|
||||
//$balance -= 1200;
|
||||
$_de->set_de_transaction(-1000); //beállítjuk, mennyivel csökken az egyenleg
|
||||
$training = $_de->get_de_training();
|
||||
$trainingPrice = $training->get_tr_price();
|
||||
$_de->set_de_transaction(-$trainingPrice); //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
|
||||
}
|
||||
@@ -588,7 +590,7 @@ class user_kid extends user_parent {
|
||||
if(pr_training_tr_id is not null, 'training', null) as object_type
|
||||
FROM
|
||||
presence
|
||||
JOIN training ON tr_id = pr_training_tr_id
|
||||
JOIN training ON (tr_id = pr_training_tr_id AND tr_locked = 1)
|
||||
WHERE
|
||||
pr_user_kid_uk_id = ".$userId."
|
||||
AND tr_deleted = 0) UNION (SELECT
|
||||
|
||||
Reference in New Issue
Block a user