mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-14 08:37:00 +02:00
Finally fixed #192
This commit is contained in:
parent
ea88b14234
commit
0e2041edd6
2 changed files with 115 additions and 15 deletions
|
@ -110,6 +110,14 @@ class DapiController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Check admin status and apply registrar filter if needed
|
||||
$registrarCondition = '';
|
||||
if ($_SESSION['auth_roles'] !== 0) { // not admin
|
||||
$registrarId = $_SESSION['auth_registrar_id'];
|
||||
$registrarCondition = "d.clid = :registrarId";
|
||||
$bindParams["registrarId"] = $registrarId;
|
||||
}
|
||||
|
||||
// Base SQL
|
||||
$sqlBase = "
|
||||
FROM domain d
|
||||
|
@ -117,9 +125,27 @@ class DapiController extends Controller
|
|||
LEFT JOIN domain_status ds ON d.id = ds.domain_id
|
||||
";
|
||||
|
||||
$sqlWhere = '';
|
||||
// Combine registrar condition and search filters
|
||||
if (!empty($whereClauses)) {
|
||||
$sqlWhere = "WHERE " . implode(" OR ", $whereClauses);
|
||||
// We have search conditions
|
||||
$filtersCombined = "(" . implode(" OR ", $whereClauses) . ")";
|
||||
if ($registrarCondition) {
|
||||
// If registrarCondition exists and we have filters
|
||||
// we do registrarCondition AND (filters OR...)
|
||||
$sqlWhere = "WHERE $registrarCondition AND $filtersCombined";
|
||||
} else {
|
||||
// No registrar restriction, just the filters
|
||||
$sqlWhere = "WHERE $filtersCombined";
|
||||
}
|
||||
} else {
|
||||
// No search filters
|
||||
if ($registrarCondition) {
|
||||
// Only registrar condition
|
||||
$sqlWhere = "WHERE $registrarCondition";
|
||||
} else {
|
||||
// No filters, no registrar condition
|
||||
$sqlWhere = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Count total results
|
||||
|
@ -290,6 +316,14 @@ class DapiController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Check admin status and apply registrar filter if needed
|
||||
$registrarCondition = '';
|
||||
if ($_SESSION['auth_roles'] !== 0) { // not admin
|
||||
$registrarId = $_SESSION['auth_registrar_id'];
|
||||
$registrarCondition = "d.clid = :registrarId";
|
||||
$bindParams["registrarId"] = $registrarId;
|
||||
}
|
||||
|
||||
// Base SQL
|
||||
$sqlBase = "
|
||||
FROM application d
|
||||
|
@ -297,9 +331,27 @@ class DapiController extends Controller
|
|||
LEFT JOIN application_status ds ON d.id = ds.domain_id
|
||||
";
|
||||
|
||||
$sqlWhere = '';
|
||||
// Combine registrar condition and search filters
|
||||
if (!empty($whereClauses)) {
|
||||
$sqlWhere = "WHERE " . implode(" OR ", $whereClauses);
|
||||
// We have search conditions
|
||||
$filtersCombined = "(" . implode(" OR ", $whereClauses) . ")";
|
||||
if ($registrarCondition) {
|
||||
// If registrarCondition exists and we have filters
|
||||
// we do registrarCondition AND (filters OR...)
|
||||
$sqlWhere = "WHERE $registrarCondition AND $filtersCombined";
|
||||
} else {
|
||||
// No registrar restriction, just the filters
|
||||
$sqlWhere = "WHERE $filtersCombined";
|
||||
}
|
||||
} else {
|
||||
// No search filters
|
||||
if ($registrarCondition) {
|
||||
// Only registrar condition
|
||||
$sqlWhere = "WHERE $registrarCondition";
|
||||
} else {
|
||||
// No filters, no registrar condition
|
||||
$sqlWhere = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Count total results
|
||||
|
@ -454,17 +506,41 @@ class DapiController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Check admin status and apply registrar filter if needed
|
||||
$registrarCondition = '';
|
||||
if ($_SESSION['auth_roles'] !== 0) { // not admin
|
||||
$registrarId = $_SESSION['auth_registrar_id'];
|
||||
$registrarCondition = "ph.registrar_id = :registrarId";
|
||||
$bindParams["registrarId"] = $registrarId;
|
||||
}
|
||||
|
||||
// Base SQL
|
||||
$sqlBase = "
|
||||
FROM payment_history ph
|
||||
LEFT JOIN registrar r ON ph.registrar_id = r.id
|
||||
";
|
||||
|
||||
// If you want all filters combined with OR, keep " OR ".
|
||||
// If you want AND logic for multiple filters, change to "AND".
|
||||
$sqlWhere = '';
|
||||
// Combine registrar condition and search filters
|
||||
if (!empty($whereClauses)) {
|
||||
$sqlWhere = "WHERE " . implode(" OR ", $whereClauses);
|
||||
// We have search conditions
|
||||
$filtersCombined = "(" . implode(" OR ", $whereClauses) . ")";
|
||||
if ($registrarCondition) {
|
||||
// If registrarCondition exists and we have filters
|
||||
// we do registrarCondition AND (filters OR...)
|
||||
$sqlWhere = "WHERE $registrarCondition AND $filtersCombined";
|
||||
} else {
|
||||
// No registrar restriction, just the filters
|
||||
$sqlWhere = "WHERE $filtersCombined";
|
||||
}
|
||||
} else {
|
||||
// No search filters
|
||||
if ($registrarCondition) {
|
||||
// Only registrar condition
|
||||
$sqlWhere = "WHERE $registrarCondition";
|
||||
} else {
|
||||
// No filters, no registrar condition
|
||||
$sqlWhere = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Count total results
|
||||
|
@ -596,16 +672,41 @@ class DapiController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Check admin status and apply registrar filter if needed
|
||||
$registrarCondition = '';
|
||||
if ($_SESSION['auth_roles'] !== 0) { // not admin
|
||||
$registrarId = $_SESSION['auth_registrar_id'];
|
||||
$registrarCondition = "st.registrar_id = :registrarId";
|
||||
$bindParams["registrarId"] = $registrarId;
|
||||
}
|
||||
|
||||
// Base SQL
|
||||
$sqlBase = "
|
||||
FROM statement st
|
||||
LEFT JOIN registrar r ON st.registrar_id = r.id
|
||||
";
|
||||
|
||||
// Combine filters with OR (common approach)
|
||||
$sqlWhere = '';
|
||||
// Combine registrar condition and search filters
|
||||
if (!empty($whereClauses)) {
|
||||
$sqlWhere = "WHERE " . implode(" OR ", $whereClauses);
|
||||
// We have search conditions
|
||||
$filtersCombined = "(" . implode(" OR ", $whereClauses) . ")";
|
||||
if ($registrarCondition) {
|
||||
// If registrarCondition exists and we have filters
|
||||
// we do registrarCondition AND (filters OR...)
|
||||
$sqlWhere = "WHERE $registrarCondition AND $filtersCombined";
|
||||
} else {
|
||||
// No registrar restriction, just the filters
|
||||
$sqlWhere = "WHERE $filtersCombined";
|
||||
}
|
||||
} else {
|
||||
// No search filters
|
||||
if ($registrarCondition) {
|
||||
// Only registrar condition
|
||||
$sqlWhere = "WHERE $registrarCondition";
|
||||
} else {
|
||||
// No filters, no registrar condition
|
||||
$sqlWhere = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Count total results
|
||||
|
@ -651,5 +752,4 @@ class DapiController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -25,9 +25,9 @@
|
|||
placeholder: "{{ __('No Data') }}",
|
||||
columns:[
|
||||
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
|
||||
{title:"{{ __('Registrar') }}", field:"registrar_id.name", resizable:false, headerSort:true, responsive:0},
|
||||
{title:"{{ __('Date') }}", field:"date", resizable:false, headerSort:true, responsive:0},
|
||||
{title:"{{ __('Log') }}", field:"log", resizable:false, headerSort:true, responsive:2},
|
||||
{title:"{{ __('Registrar') }}", field:"registrar_id.name", minWidth:200, resizable:false, headerSort:true, responsive:0},
|
||||
{title:"{{ __('Date') }}", field:"date", resizable:false, minWidth:300, headerSort:true, responsive:0},
|
||||
{title:"{{ __('Log') }}", field:"log", resizable:false, minWidth:600, headerSort:true, responsive:2},
|
||||
]
|
||||
});
|
||||
var searchInput = document.getElementById("search-input");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue