CMXX - Consumer identity

This commit is contained in:
“VeLiTi”
2025-02-22 23:45:27 +01:00
parent 8dd7023310
commit 3182cb0b3c
10 changed files with 381 additions and 16 deletions

View File

@@ -700,11 +700,12 @@ function getWhereclause($table_name,$permission,$partner,$method){
//api_name converter to table
$table =[
"equipment" => "e.accounthierarchy",
"profile" => "partnerhierarchy"
"profile" => "partnerhierarchy",
"text_variables" => "tv.accounthierarchy"
];
$table = ($table_name != '') ? $table[$table_name] : 'accounthierarchy';
$type = ($method == 'get') ? 'WHERE ' : '';
$type = ($method == 'get') ? 'WHERE ' : ' AND ';
//SoldTo is empty
if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} else {$soldto_search = '-%';}
@@ -752,7 +753,7 @@ function getWhereclauselvl2($table_name,$permission,$partner,$method){
];
$table = ($table_name != '') ? $table[$table_name] : 'accounthierarchy';
$type = ($method == 'get') ? 'WHERE ' : '';
$type = ($method == 'get') ? 'WHERE ' : ' AND ';
//SoldTo is empty
if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} else {$soldto_search = '-%';}
@@ -818,8 +819,8 @@ function getProfile($profile, $permission){
$user_permission = ${'permission_'.$permission};
//CHECK ALLOWED
$page_action = str_contains($user_permission,$action) > 0 ? 1 : 0;
$page_access = str_contains($profile,$page) > 0 ? 1 : 0;
$page_action = str_contains($user_permission,$action) > 0 ? 1 : 0; //CHECK IF USER IS ALLOWED TODO THE ACTION
$page_access = str_contains($profile,$page) > 0 ? 1 : 0; //CHECK USER IS ALLOWED TO ACCESS PAGE
//RETURN CODE
if ($page_access == 1 && $page_action == 1){
@@ -920,6 +921,15 @@ function getPartnerName($str){
return $str2;
}
}
//------------------------------------------
// GET ID of Partner
//------------------------------------------
function getPartnerID($str){
$partner_id = explode("-",$str) ?? '';
return $partner_id[0];
}
//------------------------------------------
// overview Indicators
//------------------------------------------