CMXX - Improved whereclause
This commit is contained in:
@@ -14,20 +14,8 @@ $post_content = json_decode($input,true);
|
||||
if (empty($partner->soldto) || $partner->soldto == ''){$soldto_search = '%';} else {$soldto_search = '-%';}
|
||||
|
||||
//default whereclause
|
||||
$whereclause = '';
|
||||
list($whereclause,$condition) = getWhereclause('',$permission,$partner);
|
||||
|
||||
switch ($permission) {
|
||||
case '4':
|
||||
$whereclause = '';
|
||||
break;
|
||||
case '3':
|
||||
$whereclause = '';
|
||||
break;
|
||||
default:
|
||||
$condition = '__salesid___'.$partner->salesid.'___soldto___'.substr($partner->soldto, 0, strpos($partner->soldto, "-")).$soldto_search;
|
||||
$whereclause = ' AND accounthierarchy like "'.$condition.'"';
|
||||
break;
|
||||
}
|
||||
|
||||
//WEBSHOP UPDATE CAN SEND TXN_ID ONLY
|
||||
if (isset($post_content['txn_id']) && $post_content['txn_id'] != '' && !isset($post_content['id'])){
|
||||
@@ -65,6 +53,20 @@ $partner_product = json_encode(array("salesid"=>$partner->salesid,"soldto"=>$par
|
||||
//ADD STANDARD PARAMETERS TO ARRAY BASED ON INSERT OR UPDATE
|
||||
if ($command == 'update'){
|
||||
|
||||
//CHECK IF PAYMENT STATUS is PAID (1)
|
||||
if(isset($post_content['payment_status']) && $post_content['payment_status'] == 1){
|
||||
|
||||
//check if GIFTCARD ID IS PROVIDED AND NOT EMPTY
|
||||
if(isset($post_content['giftcard_categoryID']) && $post_content['giftcard_categoryID'] != ''){
|
||||
|
||||
//CHECK FOR GIFTCARDS IN ORDER AND CREATE WHEN AVAILABLE AND NOT CREATED YET
|
||||
createGiftCart($pdo, $post_content['id'], $post_content['giftcard_categoryID'],$partner_product);
|
||||
|
||||
//remove giftcard_categoryID from $post_content array
|
||||
unset($post_content['giftcard_categoryID']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($command == 'insert'){
|
||||
$post_content['accounthierarchy'] = $partner_product;
|
||||
|
||||
Reference in New Issue
Block a user