bug fixes. added payment type to deposits
This commit is contained in:
@@ -10,6 +10,7 @@ class money_deposit {
|
||||
private $mod_user_kid; //OBJECT
|
||||
private $mod_date;
|
||||
private $mod_sum;
|
||||
private $mod_payment_type;
|
||||
private $mod_deleted;
|
||||
|
||||
public function set_mod_id($_id) {
|
||||
@@ -32,6 +33,10 @@ class money_deposit {
|
||||
$this->mod_sum = $_sum;
|
||||
}
|
||||
|
||||
public function set_mod_payment_type_pt_id($_payment_type) {
|
||||
$this->mod_payment_type = $_payment_type;
|
||||
}
|
||||
|
||||
public function set_mod_deleted($_deleted) {
|
||||
$this->mod_deleted = $_deleted;
|
||||
}
|
||||
@@ -48,6 +53,10 @@ class money_deposit {
|
||||
return $this->mod_user_kid;
|
||||
}
|
||||
|
||||
public function get_mod_payment_type_pt_id() {
|
||||
return $this->mod_payment_type;
|
||||
}
|
||||
|
||||
|
||||
public function get_mod_date($_formatted = false) {
|
||||
return !$_formatted ? $this->mod_date : date("Y. m. d.", strtotime($this->mod_date));
|
||||
@@ -55,7 +64,7 @@ class money_deposit {
|
||||
|
||||
public function get_mod_date_day() {
|
||||
$day = date("d", strtotime($this->mod_date));
|
||||
if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
|
||||
if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
|
||||
return date("d", strtotime($this->mod_date));
|
||||
}
|
||||
|
||||
@@ -89,25 +98,33 @@ class money_deposit {
|
||||
$new_user->set_user_data_by_id($value);
|
||||
$this->set_mod_user_kid($new_user);
|
||||
}
|
||||
if ($field == "mod_payment_type") {
|
||||
$new_pt = new payment_type();
|
||||
$new_pt->set_pt_data_by_id($value);
|
||||
$this->set_mod_payment_type_pt_id($new_pt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function create_money_deposit($_user_id, $_date, $_sum) {
|
||||
public static function create_money_deposit($_user_id, $_date, $_sum, $_pt) {
|
||||
global $sql;
|
||||
return $sql->insert_into('money_deposit', array(
|
||||
'mod_user_kid_uk_id' => $_user_id,
|
||||
'mod_date' => $_date,
|
||||
'mod_payment_type_pt_id' => $_pt,
|
||||
'mod_sum' => $_sum
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function update_money_deposit($_user_id, $_date, $_sum, $_mod_id) {
|
||||
public static function update_money_deposit($_user_id, $_date, $_sum, $_mod_id, $_pt) {
|
||||
global $sql;
|
||||
$sql->update_table('money_deposit', array(
|
||||
'mod_user_kid_uk_id' => $_user_id,
|
||||
'mod_date' => $_date,
|
||||
'mod_payment_type_pt_id' => $_pt,
|
||||
'mod_sum' => $_sum
|
||||
), array(
|
||||
'mod_id' => $_mod_id
|
||||
@@ -118,4 +135,4 @@ class money_deposit {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
41
_class/class_payment_type.php
Normal file
41
_class/class_payment_type.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
PAYMENT TYPE CLASS
|
||||
*/
|
||||
|
||||
class payment_type {
|
||||
private $pt_id;
|
||||
private $pt_name;
|
||||
|
||||
|
||||
public function set_pt_id($_id) {
|
||||
$this->pt_id = $_id;
|
||||
}
|
||||
|
||||
public function get_pt_id() {
|
||||
return $this->pt_id;
|
||||
}
|
||||
|
||||
public function set_pt_name($_name) {
|
||||
$this->pt_name = $_name;
|
||||
}
|
||||
|
||||
public function get_pt_name() {
|
||||
return $this->pt_name;
|
||||
}
|
||||
|
||||
public function set_pt_data_by_id($_id) {
|
||||
global $sql;
|
||||
$mod_query = "SELECT * FROM payment_type WHERE pt_id = " . $_id . ";";
|
||||
$mod_assoc_array = $sql->assoc_array($mod_query);
|
||||
foreach ($mod_assoc_array[0] as $field => $value) {
|
||||
$function_name = "set_" . $field;
|
||||
$this->$function_name($value); //alapadatok beállítása
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user