'.$equipment_label2.' '.$product_code.' '.$product_name.' '.$product_status.' '; foreach ($excel_data_1 as $key => $val){ //GET ROW ID $api_url = '/v1/application/serialnumber='.$val.'/get_rowID'; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;} //IF rowID is found add to array if (isset ($responses->rowID)){ $output_excel[$val]['rowID'] = $responses->rowID; $output_excel[$val]['serialnumber'] = $val; $output_excel[$val]['productcode'] = $responses->productcode; $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']; if (!empty($_POST['shipto']) || $_POST['shipto'] !=''){ $output_excel[$val]['shipto'] = $_POST['shipto']; } if (!empty($_POST['location']) || $_POST['location'] !=''){ $output_excel[$val]['location'] = $_POST['location']; } //Count total_rowID $total_rowID++; } else { $output_excel_display .= ''.$val.''.$mass_update_not_found.''; //Count total_not_found $total_not_found++; } } // Update all items of array foreach ($output_excel as $data_to_update){ $data = json_encode($data_to_update, JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/equipments', $payload); if ($responses === 'NOK'){ } else { $output_excel_display .= ''.$data_to_update['serialnumber'].''.$data_to_update['productcode'].''.(${$data_to_update['productname']} ?? $data_to_update['productname']).''.$mass_update_correct.''; } } $output_excel_display .= ''; //Totals $total_input = $total_rowID + $total_not_found; $total_summary = '('.$total_rowID.$general_page_of.$total_input.')'; //CHECK if shipto exists if not empty. Use shipto when soldto not available $shipto = (isset($_POST['shipto']) ? $_POST['shipto'] : ''); $customer = (isset($_POST['soldto']) ? $_POST['soldto'] : $shipto); $order_header = '
'.$tab1.'
'.$mass_update_order_ref.''.($_POST['order_ref'] ?? '').'
'.$mass_update_order_total.''.$total_rowID.'
'.$mass_update_customer.''.$customer.'
'; } } // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 1) { $success_msg = $message_eq_1; } if ($_GET['success_msg'] == 2) { $success_msg = $message_eq_2; } if ($_GET['success_msg'] == 3) { $success_msg = $message_eq_3; } } template_header('Mass update', 'equipment_mass_update', 'view'); $view = '

'.$mass_update_h2.'

'; $view .= '
'; if (isset($success_msg)){ $view .= '

'.$success_msg.'

'; } $view .= '
'; //BUID UP DROPDOWNS $partner = json_decode($_SESSION['partnerhierarchy'],true); $salesid_dropdown = listPartner('salesid',$_SESSION['permission'],$partner['salesid'],'yes'); $soldto_dropdown = listPartner('soldto',$_SESSION['permission'],'','yes'); $shipto_dropdown = listPartner('shipto',$_SESSION['permission'],'',''); $location_dropdown = listPartner('location',$_SESSION['permission'],'',''); $view .='
'.$mass_update_partners.'
'; // SHOW SALESID and SOLDTO ONLY TO ADMIN if ($_SESSION['permission'] == 3 || $_SESSION['permission'] == 4){ $view .='

'.$general_salesid.'

'.$salesid_dropdown.'

'.$general_soldto.'

'.$soldto_dropdown.'

'; } $view .='

'.$general_shipto.'

'.$shipto_dropdown.'

'.$general_location.'

'.$location_dropdown.'

'; $view .= '
'.$mass_update_input.'

'.$paste_excel_h3.'

'; $view .='
'; $view .= ''; $view .= '
'; if ($update_allowed === 1){ $view .= '
'.$tab3.' '.$total_summary.'
'.($order_header ?? '' ).' '.$output_excel_display.'
'; } //OUTPUT echo $view; echo ' '; template_footer(); ?>