$status_from = ''; $res = fn_change_company_status($company_id, $status, $reason, $status_from, false, $notification); if ($res) { $result[] = $company_id; } } if ($result) { fn_set_notification('N', __('notice'), $msg); } else { fn_set_notification('E', __('error'), __('error_status_not_changed'), 'I'); } return array(CONTROLLER_STATUS_REDIRECT, 'companies.manage'); } } if ($mode == 'delete') { fn_delete_company($_REQUEST['company_id']); return array(CONTROLLER_STATUS_REDIRECT, 'companies.manage'); } if ($mode == 'update_status') { $notification = !empty($_REQUEST['notify_user']) && $_REQUEST['notify_user'] == 'Y'; if (fn_change_company_status($_REQUEST['id'], $_REQUEST['status'], '', $status_from, false, $notification)) { fn_set_notification('N', __('notice'), __('status_changed')); } else { fn_set_notification('E', __('error'), __('error_status_not_changed')); Tygh::$app['ajax']->assign('return_status', $status_from); } if (!empty($_REQUEST['return_url'])) { return array(CONTROLLER_STATUS_REDIRECT, $_REQUEST['return_url']); } exit; }
public function delete($id) { $data = array(); $status = Response::STATUS_BAD_REQUEST; if (fn_delete_company($id)) { $status = Response::STATUS_OK; $data['message'] = 'Ok'; } elseif (!fn_notification_exists('extra', 'company_has_orders')) { $status = Response::STATUS_NOT_FOUND; } return array('status' => $status, 'data' => $data); }