Update salesid and soldto inclusion based on hierarchy level visibility in mass update form

This commit is contained in:
“VeLiTi”
2026-01-30 10:56:34 +01:00
parent 162933affa
commit 2427d40273

View File

@@ -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'];
}