$table = getRequest('table', ''); if (!$table) { header('HTTP/1.1 400 Bad Request (table)'); exit; } if (!table_valid($table)) { header('HTTP/1.1 400 Bad Request'); die('Invalid table name'); } $pageLen = intval(getRequest('pagelen', 10)); $page = intval(getRequest('page', 1)) - 1; $filter = getRequest('q', ''); $sort = getRequest('sort', ''); $id = getRequest('id', ''); header('Content-Type: application/json'); echo createJSONSelectList($table, $page * $pageLen, $pageLen, $filter, $sort, $id); break; case 'update_invoice_row_dates': if (!sesWriteAccess()) { header('HTTP/1.1 403 Forbidden'); exit; } $invoiceId = getRequest('id', 0); $date = getRequest('date', ''); if (!$date) { header('HTTP/1.1 400 Bad Request'); die('date must be given'); } header('Content-Type: application/json'); echo updateInvoiceRowDates($invoiceId, $date); break;
function getSearchListSelectedValue($strQuery, $strSelected) { parse_str($strQuery, $params); $result = json_decode(createJSONSelectList($params['table'], 0, 1, '', '', $strSelected), true); return isset($result['records'][0]['text']) ? $result['records'][0]['text'] : ''; }