Skip to content

Commit 4524ca5

Browse files
committed
Revert
1 parent f2e1a8f commit 4524ca5

File tree

1 file changed

+16
-46
lines changed

1 file changed

+16
-46
lines changed

hungng/HungNG_Custom_Based_model.php

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function bind_order_result($order_by_field, $direction = 'desc', $field =
329329
public function build_order_result($order_by_field, $direction = 'desc', $field = 'id', $table = '')
330330
{
331331
if (!empty($table)) {
332-
$tableName = $this->db->dbprefix(trim($table)) . '.';
332+
$tableName = trim($table) . '.';
333333
} else {
334334
$tableName = $this->db->dbprefix($this->tableName) . '.';
335335
}
@@ -398,7 +398,7 @@ public function build_list_id_with_parent_id($allSubId, $parentId)
398398
*/
399399
public function prepare_simple_wheres_not_statement($value, $field = 'id', $table = '')
400400
{
401-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
401+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
402402
if ($value !== null) {
403403
if (is_array($value)) {
404404
$this->db->where_not_in($tableName . '.' . $field, $value);
@@ -424,7 +424,7 @@ public function prepare_simple_wheres_not_statement($value, $field = 'id', $tabl
424424
*/
425425
public function prepare_simple_wheres_statement($value, $field = 'id', $table = '')
426426
{
427-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
427+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
428428
if ($value !== null) {
429429
if (is_array($value)) {
430430
$this->db->where_in($tableName . '.' . $field, $value);
@@ -469,21 +469,6 @@ public function prepare_wheres_statement($wheres)
469469
return $this->db;
470470
}
471471

472-
/**
473-
* Function apply_wheres
474-
*
475-
* @param $wheres
476-
*
477-
* @return bool|\CI_DB_query_builder|object
478-
* @author : 713uk13m <dev@nguyenanhung.com>
479-
* @copyright: 713uk13m <dev@nguyenanhung.com>
480-
* @time : 27/03/2023 07:52
481-
*/
482-
public function apply_wheres($wheres)
483-
{
484-
return $this->prepare_wheres_statement($wheres);
485-
}
486-
487472
/**
488473
* Function prepare_wheres_not_statement
489474
*
@@ -517,21 +502,6 @@ public function prepare_wheres_not_statement($wheres)
517502
return $this->db;
518503
}
519504

520-
/**
521-
* Function apply_not_wheres
522-
*
523-
* @param $wheres
524-
*
525-
* @return bool|\CI_DB_query_builder|object
526-
* @author : 713uk13m <dev@nguyenanhung.com>
527-
* @copyright: 713uk13m <dev@nguyenanhung.com>
528-
* @time : 27/03/2023 08:21
529-
*/
530-
public function apply_not_wheres($wheres)
531-
{
532-
return $this->prepare_wheres_not_statement($wheres);
533-
}
534-
535505
/**
536506
* Function only_status_is_active
537507
*
@@ -576,7 +546,7 @@ public function only_status_is_active($act = true, $field = 'status', $table = '
576546
public function only_status_is_de_active($act = true, $field = 'status', $table = '')
577547
{
578548
if ($act === true) {
579-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
549+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
580550
$useField = !empty($field) ? trim($field) : 'status';
581551
$tableExists = $this->db->table_exists($tableName);
582552
$fieldExists = $this->db->field_exists($useField, $tableName);
@@ -605,7 +575,7 @@ public function only_status_is_de_active($act = true, $field = 'status', $table
605575
*/
606576
public function bind_recursive_from_category($allSubId, $parentId, $field = 'categoryId', $table = '')
607577
{
608-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
578+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
609579
$listID = $this->build_list_id_with_parent_id($allSubId, $parentId);
610580
if (is_array($listID)) {
611581
$this->db->where_in($tableName . '.' . $field, $listID);
@@ -630,7 +600,7 @@ public function bind_recursive_from_category($allSubId, $parentId, $field = 'cat
630600
*/
631601
public function filter_by_primary_id($id, $field = 'id', $table = '')
632602
{
633-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
603+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
634604
if ($id !== null) {
635605
if (is_array($id)) {
636606
$this->db->where_in($tableName . '.' . $field, $id);
@@ -656,7 +626,7 @@ public function filter_by_primary_id($id, $field = 'id', $table = '')
656626
*/
657627
public function build_operator_equal_to($id, $field = 'id', $table = '')
658628
{
659-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
629+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
660630
if ($id !== null) {
661631
if (is_array($id)) {
662632
$this->db->where_in($tableName . '.' . $field, $id);
@@ -682,7 +652,7 @@ public function build_operator_equal_to($id, $field = 'id', $table = '')
682652
*/
683653
public function build_operator_not_equal_to($id, $field = 'id', $table = '')
684654
{
685-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
655+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
686656
if ($id !== null) {
687657
if (is_array($id)) {
688658
$this->db->where_not_in($tableName . '.' . $field, $id);
@@ -708,7 +678,7 @@ public function build_operator_not_equal_to($id, $field = 'id', $table = '')
708678
*/
709679
public function build_operator_less_than_to($id, $field = 'id', $table = '')
710680
{
711-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
681+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
712682
$this->db->where($tableName . '.' . $field . ' ' . self::OPERATOR_LESS_THAN, $id);
713683

714684
return $this->db;
@@ -728,7 +698,7 @@ public function build_operator_less_than_to($id, $field = 'id', $table = '')
728698
*/
729699
public function build_operator_greater_than_to($id, $field = 'id', $table = '')
730700
{
731-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
701+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
732702
$this->db->where($tableName . '.' . $field . ' ' . self::OPERATOR_GREATER_THAN, $id);
733703

734704
return $this->db;
@@ -748,7 +718,7 @@ public function build_operator_greater_than_to($id, $field = 'id', $table = '')
748718
*/
749719
public function build_operator_less_than_or_equal_to($id, $field = 'id', $table = '')
750720
{
751-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
721+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
752722
$this->db->where($tableName . '.' . $field . ' ' . self::OPERATOR_LESS_THAN_OR_EQUAL_TO, $id);
753723

754724
return $this->db;
@@ -768,7 +738,7 @@ public function build_operator_less_than_or_equal_to($id, $field = 'id', $table
768738
*/
769739
public function build_operator_greater_than_or_equal_to($id, $field = 'id', $table = '')
770740
{
771-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
741+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
772742
$this->db->where($tableName . '.' . $field . ' ' . self::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $id);
773743

774744
return $this->db;
@@ -788,7 +758,7 @@ public function build_operator_greater_than_or_equal_to($id, $field = 'id', $tab
788758
*/
789759
public function build_operator_space_ship_to($id, $field = 'id', $table = '')
790760
{
791-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
761+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
792762
$this->db->where($tableName . '.' . $field . ' ' . self::OPERATOR_IS_SPACESHIP, $id);
793763

794764
return $this->db;
@@ -1305,7 +1275,7 @@ public function where_update($wheres, $data, $table = '')
13051275

13061276
return 0;
13071277
}
1308-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
1278+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
13091279
$this->prepare_wheres_statement($wheres);
13101280
$this->db->update($tableName, $data);
13111281

@@ -1354,7 +1324,7 @@ public function where_delete($wheres, $data, $table = '')
13541324

13551325
return 0;
13561326
}
1357-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
1327+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
13581328
$this->prepare_wheres_statement($wheres);
13591329
$this->db->delete($tableName, $data);
13601330

@@ -1373,7 +1343,7 @@ public function where_delete($wheres, $data, $table = '')
13731343
*/
13741344
public function request_builder($search, $table = '')
13751345
{
1376-
$tableName = !empty($table) ? $this->db->dbprefix(trim($table)) : $this->db->dbprefix($this->tableName);
1346+
$tableName = !empty($table) ? trim($table) : $this->db->dbprefix($this->tableName);
13771347
if (!empty($search)) {
13781348
foreach ($search as $field => $value) {
13791349
if (!empty($value) && $this->db->field_exists($field, $tableName)) {

0 commit comments

Comments
 (0)