top.window.location = '../../index.php'"; exit; } require_once __DIR__ . "/" . "../../includes/include_basics_only.php"; require_once __DIR__ . "/" . "../../includes/classes/ConnectPDO.php"; use includes\classes\ConnectPDO; $conn = ConnectPDO::getInstance(); $post = $_POST; $areaAdmin = 0; if (isset($_SESSION['s_area_admin']) && $_SESSION['s_area_admin'] == '1' && $_SESSION['s_nivel'] != '1') { $areaAdmin = 1; } $units = []; $client = (isset($post['client']) && !empty($post['client']) ? noHtml($post['client']) : null); $from_inventory = (isset($post['from_inventory']) && $post['from_inventory'] == 1 ? 1 : 0); $limit_units = ($from_inventory ? $_SESSION['s_allowed_units'] : ''); $units = getUnits($conn, 1, null, $client, $limit_units); $data = $units; echo json_encode($data);