echo utf8_encode($result); exit; } elseif ($_POST['me_action'] == 'UPDATEOISTATUS') { $items_id = tep_db_prepare_input($_POST['oi_id']); $old_status = tep_db_prepare_input($_POST['old_status']); $new_status = tep_db_prepare_input($_POST['new_status']); $item = $class_do->retrieveDetail($items_id); if ($item['status'] == $old_status) { $status_to_alert_success = array('3', '4'); if ($new_status == 10) { $class_do->doCancelOrders($items_id, $old_status, $session_userinfo['username']); } else { $class_do->updateStatus($items_id, $new_status, $session_userinfo['username']); } list($new_status, $sub_status) = explode('-', $new_status); $status_name = $sub_status != '' ? subStatusNameShort($new_status, $sub_status) : $class_do->statusNameShort(); if ($sub_status == '') { $status_name = $status_name[$new_status]; } $result = array(); $result['oi_id'] = $items_id; $result['old_status'] = $old_status; $result['new_status'] = $new_status; $result['msg_success'] = !in_array($old_status, $status_to_alert_success) ? '' : 'DP-' . $items_id . ' » set to ' . $status_name; $result['msg_errors'] = ''; } else { $result = array(); $result['oi_id'] = $items_id; $result['old_status'] = $old_status; $result['new_status'] = $item['status']; $result['msg_success'] = '';
$class_o->updateProductStatus($opid, $new_status, $session_userinfo['username']); if ($new_status == '5' || $new_status == '10' || $new_status == '1' && $old_status == '10') { //set order waxing as new/finish/cancel following order product status use_class('orders_waxing'); $class_ow = new orders_waxing(); $ow_data = $class_ow->retrieveByOrderProducts($opid); $ow_status = $new_status == '10' ? '6' : $new_status; if (count($ow_data) > 0) { foreach ($ow_data as $ow) { $waxing_id = $ow['orders_waxing_id']; $class_ow->updateStatus($waxing_id, $ow_status, $session_userinfo['username']); } } } list($new_status, $sub_status) = explode('-', $new_status); $status_name = $sub_status != '' ? subStatusNameShort($new_status, $sub_status) : $class_o->productStatusNameShort(); if ($sub_status == '') { $status_name = $status_name[$new_status]; } $result = array(); $result['op_id'] = $opid; $result['old_status'] = $old_status; $result['new_status'] = $new_status; $result['msg_sukses'] = !in_array($old_status, $status_to_alert_success) ? '' : 'JG-' . $opid . ' » set to ' . $status_name; $result['msg_errors'] = ''; } else { $result = array(); $result['op_id'] = $opid; $result['old_status'] = $old_status; $result['new_status'] = $product['status']; $result['msg_sukses'] = '';