예제 #1
0
파일: json.php 프로젝트: jahau/MLInvoice
     $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;
예제 #2
0
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'] : '';
}