diff --git a/equipments_mass_update.php b/equipments_mass_update.php index 146818b..565043e 100644 --- a/equipments_mass_update.php +++ b/equipments_mass_update.php @@ -68,8 +68,18 @@ if ($update_allowed === 1){ $output_excel[$val]['productname'] = ${$responses->productname} ?? $responses->productname; $output_excel[$val]['order_ref'] = $_POST['order_ref']; $output_excel[$val]['status'] = $_POST['status']; - $output_excel[$val]['salesid'] = $_POST['salesid']; - $output_excel[$val]['soldto'] = $_POST['soldto']; + + // Only include salesid/soldto if form fields were visible (hierarchy 0-1) + $hierarchyLevel = getHierarchyLevel(json_decode($_SESSION['authorization']['partnerhierarchy'])); + if ($hierarchyLevel == 0 || $hierarchyLevel == 1) { + if (isset($_POST['salesid'])) { + $output_excel[$val]['salesid'] = $_POST['salesid']; + } + if (isset($_POST['soldto'])) { + $output_excel[$val]['soldto'] = $_POST['soldto']; + } + } + if (!empty($_POST['shipto']) || $_POST['shipto'] !=''){ $output_excel[$val]['shipto'] = $_POST['shipto']; }