allow ZS edit for everyone

This commit is contained in:
2025-12-05 09:12:10 +00:00
parent 292748248b
commit 300aa5381a
3 changed files with 24 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ if ($_GET['ajax']) {
array_push($codes, ['id' => $p['id'], 'code' => $index]);
}
$smarty = new Sugar_Smarty ();
$smarty = new Sugar_Smarty();
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'address') {
$address = $_GET['address'];
@@ -53,8 +53,24 @@ if ($_GET['ajax']) {
SELECT a.ecmproduct_id, p.name, p.code, p.ems_qty_in_stock AS stock_state, a.is_not_full FROM ecmproducts_stock_addresses AS a
INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id
WHERE stock_address='$address';"));
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='" . $product['ecmproduct_id'] . "'"));
$product['stock_state'] = $state['qty'];
if ($product) {
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='" . $product['ecmproduct_id'] . "'"));
$product['stock_state'] = $state['qty'];
}
$smarty->assign("PROCESS", "ADDRESS");
$smarty->assign("PRODUCT", $product);
}
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'address') {
$address = $_GET['address'];
$product = $db->fetchByAssoc($db->query("
SELECT a.ecmproduct_id, p.name, p.code, p.ems_qty_in_stock AS stock_state, a.is_not_full FROM ecmproducts_stock_addresses AS a
INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id
WHERE stock_address='$address';"));
if ($product) {
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='" . $product['ecmproduct_id'] . "'"));
$product['stock_state'] = $state['qty'];
}
$smarty->assign("PROCESS", "ADDRESS");
$smarty->assign("PRODUCT", $product);
}
@@ -167,7 +183,8 @@ ORDER BY s.stock_address;");
}
$headers = [
'Indeks', 'Adres'
'Indeks',
'Adres'
];
$sheetData = array_merge([$headers], $result);
@@ -183,4 +200,4 @@ ORDER BY s.stock_address;");
'fileContent' => base64_encode($xlsx_content),
'fileName' => 'adresy_magazynowe.xlsx'
]);
}
}