CMXX - Update whereclause get/post
This commit is contained in:
@@ -695,7 +695,7 @@ function ioAPIv2($api_call, $data, $token){
|
||||
// DEFINE WHERECLAUSE BASED ON ACCOUNTHIERARCHY ALL
|
||||
//------------------------------------------
|
||||
|
||||
function getWhereclause($table_name,$permission,$partner){
|
||||
function getWhereclause($table_name,$permission,$partner,$method){
|
||||
|
||||
//api_name converter to table
|
||||
$table =[
|
||||
@@ -704,7 +704,7 @@ function getWhereclause($table_name,$permission,$partner){
|
||||
];
|
||||
|
||||
$table = ($table_name != '') ? $table[$table_name] : 'accounthierarchy';
|
||||
|
||||
$type = ($method == 'get') ? 'WHERE ' : '';
|
||||
//SoldTo is empty
|
||||
if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} else {$soldto_search = '-%';}
|
||||
|
||||
@@ -717,15 +717,15 @@ function getWhereclause($table_name,$permission,$partner){
|
||||
break;
|
||||
case '3':
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___%';
|
||||
$whereclause = 'WHERE '.$table.' like "'.$condition.'"';
|
||||
$whereclause = $type.$table.' like "'.$condition.'"';
|
||||
break;
|
||||
case '2':
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||
$whereclause = 'WHERE '.$table.' like "'.$condition.'"';
|
||||
$whereclause = $type.$table.' like "'.$condition.'"';
|
||||
break;
|
||||
default:
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search.'___shipto___'.substr($partner->shipto, 0, strpos($partner->shipto, "-")).'%___location___'.substr($partner->location, 0, strpos($partner->location, "-")).'%';
|
||||
$whereclause = 'WHERE '.$table.' like "'.$condition.'"';
|
||||
$whereclause = $type.$table.' like "'.$condition.'"';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ function getWhereclause($table_name,$permission,$partner){
|
||||
//------------------------------------------
|
||||
// DEFINE WHERECLAUSE BASED ON ACCOUNTHIERARCHY SALES AND SOLD
|
||||
//------------------------------------------
|
||||
function getWhereclauselvl2($table_name,$permission,$partner){
|
||||
function getWhereclauselvl2($table_name,$permission,$partner,$method){
|
||||
|
||||
//api_name converter to table
|
||||
$table =[
|
||||
@@ -752,7 +752,8 @@ function getWhereclauselvl2($table_name,$permission,$partner){
|
||||
];
|
||||
|
||||
$table = ($table_name != '') ? $table[$table_name] : 'accounthierarchy';
|
||||
|
||||
$type = ($method == 'get') ? 'WHERE ' : '';
|
||||
|
||||
//SoldTo is empty
|
||||
if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} else {$soldto_search = '-%';}
|
||||
|
||||
@@ -765,11 +766,11 @@ function getWhereclauselvl2($table_name,$permission,$partner){
|
||||
break;
|
||||
case '3':
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___%';
|
||||
$whereclause = 'WHERE '.$table.' like "'.$condition.'" ';
|
||||
$whereclause = $type.$table.' like "'.$condition.'" ';
|
||||
break;
|
||||
default:
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||
$whereclause = 'WHERE '.$table.' like "'.$condition.'"';
|
||||
$whereclause = $type.$table.' like "'.$condition.'"';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user