-
-
+
+
+
Loading data, please wait...
-
-
- Invalid file type. Please upload a .txt file.
";
- exit;
- }
-
- // Read the file content line by line
- $lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
-
-
-
- if (!$lines) {
- echo "
The file is empty or could not be read.
";
- exit;
- }
-
-
-
- // Get API Keys
- include 'include/apikey.php';
-
- echo '
-
';
- // Display the table header and row count
- $row_count = count($rows); // Count rows
- echo '
Item Details
';
-
- echo '
-
- | Tray Barcode |
- Title |
- Item Barcode |
- Internal Note 3 |
- Status |
-
';
-
- // Process lines in pairs
- for ($i = 0; $i < count($lines); $i += 2) {
- $trayBarcode = $lines[$i]; // Odd row
- $barcode = isset($lines[$i + 1]) ? $lines[$i + 1] : null; // Even row (barcode)
-
- if (substr($barcode, -1) !== 'X') {
- $barcode .= 'X'; // Append 'X' to the end of the barcode if it is missing
- }
-// Himmelfarb check: begins with 'p' and 6 characters
-if (strtolower(substr($barcode, 0, 1)) === 'p' && strlen($barcode) === 6) {
- // If it begins with 'p' (case-insensitive), always add another X
- $barcode .= 'X';
-}
- $trayBarcode = substr($trayBarcode, 0, 12);
-
-
+No file uploaded.";
+ } else {
+ $uploadedFile = $_FILES['file']['tmp_name'];
+
+ if (!is_uploaded_file($uploadedFile)) {
+ echo "Upload failed.
";
+ } else {
+ $mimeType = function_exists('mime_content_type') ? mime_content_type($uploadedFile) : '';
+ $originalName = isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '';
+
+ if (
+ $mimeType !== 'text/plain' &&
+ strtolower(pathinfo($originalName, PATHINFO_EXTENSION)) !== 'txt'
+ ) {
+ echo "Invalid file type. Please upload a .txt file.
";
+ } else {
+ $lines = file($uploadedFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+
+ if (!$lines || count($lines) === 0) {
+ echo "The file is empty or could not be read.
";
+ } else {
+ echo '';
+ echo '
Item Details
';
+ echo '
';
+ echo '
+ | Tray Barcode |
+ Title |
+ Item Barcode |
+ Internal Note 3 |
+ Status |
+
';
+
+ for ($i = 0; $i < count($lines); $i += 2) {
+ $trayBarcode = isset($lines[$i]) ? trim($lines[$i]) : '';
+ $barcode = isset($lines[$i + 1]) ? trim($lines[$i + 1]) : '';
+
+ if ($barcode === '') {
+ echo "| Missing item barcode for tray " . h($trayBarcode) . ". |
";
+ continue;
+ }
- if ($barcode) {
+ $trayBarcode = substr($trayBarcode, 0, 12);
-// API URL to get item data
- $url = "https://api-na.hosted.exlibrisgroup.com/almaws/v1/items?item_barcode=" . $barcode . "&apikey=" . $api_key;
+ $itemLookup = findItemXmlByBarcode($barcode, $api_key);
-//////// Check if barcode uses X, remove it, check again, error message if nothing works. Uses function above
- // Check if the URL redirects
- $redirectUrl = getFinalRedirectUrl($url);
+ if (!$itemLookup['ok'] || $itemLookup['xml'] === false) {
+ echo "| Item record for barcode " . h($barcode) . " does not exist. |
";
+ continue;
+ }
- // Check for redirect; if not found, try removing the 'X'
- // Check for redirect; if not found, try removing the 'X'
- $redirectUrl = getFinalRedirectUrl($url);
- if (!$redirectUrl) {
- $item_barcode_no_x = str_replace('X', '', $barcode);
- $urlWithoutX = "https://api-na.hosted.exlibrisgroup.com/almaws/v1/items?item_barcode=" . $item_barcode_no_x . "&apikey=" . $api_key;
- $redirectUrl = getFinalRedirectUrl($urlWithoutX);
- if ($redirectUrl) {
- $url = $urlWithoutX;
+ $xml = $itemLookup['xml'];
+
+ $title = isset($xml->bib_data->title) ? (string)$xml->bib_data->title : '';
+ $item_barcode = isset($xml->item_data->barcode) ? (string)$xml->item_data->barcode : '';
+ $internalNote1 = isset($xml->item_data->internal_note_1) ? (string)$xml->item_data->internal_note_1 : '';
+ $internalNote1 = substr($internalNote1, 0, 12);
+ $internalNote3 = isset($xml->item_data->internal_note_3) ? (string)$xml->item_data->internal_note_3 : '';
+ $mms_id = isset($xml->bib_data->mms_id) ? (string)$xml->bib_data->mms_id : '';
+ $holding_id = isset($xml->holding_data->holding_id) ? (string)$xml->holding_data->holding_id : '';
+ $pid = isset($xml->item_data->pid) ? (string)$xml->item_data->pid : '';
+
+ $loan_url = '';
+ $total_record_count = 0;
+ $status = '';
+ $due_date = '';
+ $process_status = '';
+
+ if ($mms_id !== '' && $holding_id !== '' && $pid !== '') {
+ $loan_url = 'https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/'
+ . rawurlencode($mms_id)
+ . '/holdings/' . rawurlencode($holding_id)
+ . '/items/' . rawurlencode($pid)
+ . '/loans?apikey=' . rawurlencode($api_key);
+
+ $loanResponse = almaRequest($loan_url, 'GET');
+ $loan_xml = loadXmlFromResponse($loanResponse);
+
+ if ($loan_xml === false) {
+ $status = 'Loan status unavailable';
+ } else {
+ $total_record_count = isset($loan_xml['total_record_count']) ? (int)$loan_xml['total_record_count'] : 0;
+
+ if ($total_record_count === 0) {
+ $status = 'Item Checked In';
+ } else {
+ $item_loan = isset($loan_xml->item_loan) ? $loan_xml->item_loan : null;
+
+ if ($item_loan) {
+ $status = 'Checked Out';
+ $due_date = isset($item_loan->due_date) ? (string)$item_loan->due_date : '';
+ $process_status = isset($item_loan->process_status) ? (string)$item_loan->process_status : '';
+ } else {
+ $status = 'Loan status unavailable';
+ }
+ }
+ }
} else {
- echo "Item record for barcode $barcode does not exist
";
- continue; // Skip this iteration instead of exiting
+ $status = 'Loan status unavailable';
}
- }
-///// end check barcode
+ $rows[] = array(
+ 'trayBarcode' => $trayBarcode,
+ 'title' => $title,
+ 'item_barcode' => $item_barcode,
+ 'internalNote1' => $internalNote1,
+ 'internalNote3' => $internalNote3,
+ 'mms_id' => $mms_id,
+ 'holding_id' => $holding_id,
+ 'pid' => $pid
+ );
+
+ echo "";
+
+ if (!empty($trayBarcode) && !empty($internalNote1)) {
+ if ($trayBarcode === $internalNote1) {
+ echo '| ' . h($trayBarcode) . ' - Match | ';
+ } else {
+ $barcodeFile = $trayBarcode;
+ $barcodeAlma = $internalNote1;
+ $itembarcode = $item_barcode;
+
+ $google_form_url = "https://docs.google.com/forms/u/0/d/e/1FAIpQLSfdqhD8VPq8X13niOSL-y7146PkmYtzJW0v7U-Sr94EmJOtyA/formResponse";
+ $form_data = array(
+ "entry.1671538415" => $barcodeFile,
+ "entry.1478552555" => $barcodeAlma,
+ "entry.860961451" => $itembarcode
+ );
+
+ $googleResponse = almaRequest(
+ $google_form_url,
+ 'POST',
+ http_build_query($form_data)
+ );
+
+ echo ''
+ . h($trayBarcode) . ' (from File) - '
+ . h($internalNote1) . ' (from Alma) - Does Not Match. '
+ . 'Mismatch Recorded'
+ . ' | ';
+ }
+ } else {
+ $missing = array();
+
+ if (empty($trayBarcode)) {
+ $missing[] = 'trayBarcode (from File)';
+ }
+
+ if (empty($internalNote1)) {
+ $missing[] = 'internalNote1 (from Alma)';
+ }
+
+ $missing_message = implode(' and ', $missing) . ' missing';
+
+ $barcodeFile = !empty($trayBarcode) ? $trayBarcode : 'MISSING';
+ $barcodeAlma = !empty($internalNote1) ? $internalNote1 : 'MISSING';
+ $itembarcode = $item_barcode;
+
+ $google_form_url = "https://docs.google.com/forms/u/0/d/e/1FAIpQLSfdqhD8VPq8X13niOSL-y7146PkmYtzJW0v7U-Sr94EmJOtyA/formResponse";
+ $form_data = array(
+ "entry.1671538415" => $barcodeFile,
+ "entry.1478552555" => $barcodeAlma,
+ "entry.860961451" => $itembarcode
+ );
+
+ $googleResponse = almaRequest(
+ $google_form_url,
+ 'POST',
+ http_build_query($form_data)
+ );
+
+ echo 'Error: '
+ . h($missing_message)
+ . '. Missing Data Recorded | ';
+ }
+ echo "" . h($title) . " | ";
+ echo "" . h($item_barcode) . " | ";
+ echo "" . h($internalNote3) . " | ";
+ if ($total_record_count !== 0) {
+ echo "" . $status . " Due: " . h($due_date) . " Processing Data: " . h($process_status) . " | ";
+ } else {
+ echo "" . $status . " | ";
+ }
+ echo "
";
+ }
-// Initialize cURL session for the first request
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
+ $row_count = count($rows);
-// Execute the cURL session and fetch the response
- $response = curl_exec($ch);
+ echo '
Item Count: ' . (int)$row_count . '
';
+ echo '
';
- if ($response === false) {
- echo "cURL Error: " . curl_error($ch) . "
";
- curl_close($ch); // Ensure cURL is closed before continue
- continue;
- }
-// Load the response into a SimpleXML object for easy parsing
- $xml = simplexml_load_string($response);
- if ($xml === false) {
- echo "Failed to parse XML response for item information.
";
- curl_close($ch); // Ensure cURL is closed before continue
- continue;
- }
-// Extract relevant fields
- $title = (string) $xml->bib_data->title;
- $item_barcode = (string) $xml->item_data->barcode;
- $internalNote1 = (string) $xml->item_data->internal_note_1;
- $internalNote1 = substr($internalNote1, 0, 12);
- $internalNote3 = (string) $xml->item_data->internal_note_3;
- $mms_id = (string) $xml->bib_data->mms_id;
- $holding_id = (string) $xml->holding_data->holding_id;
- $pid = (string) $xml->item_data->pid;
-
-// Second API call to get loan details
- $loan_url = "https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/" . $mms_id . "/holdings/" . $holding_id . "/items/" . $pid . "/loans?apikey=" . $api_key;
- curl_setopt($ch, CURLOPT_URL, $loan_url);
- $loan_response = curl_exec($ch);
- if ($loan_response === false) {
- echo "cURL Error: " . curl_error($ch) . "
";
- continue;
- }
-// Load the loan response into a SimpleXML object
- $loan_xml = simplexml_load_string($loan_response);
- if ($loan_xml === false) {
- echo "Failed to parse loan XML response for loan details. " . $url . "
";
- continue;
- }
-// Check if the item is checked in (no loans)
- $total_record_count = (int) $loan_xml['total_record_count'];
- $status = '';
- $due_date = '';
- $process_status = '';
- if ($total_record_count === 0) {
- $status = 'Item Checked In';
- } else {
- // Extract loan details if item is checked out
- $item_loan = $loan_xml->item_loan;
- if ($item_loan) {
- $status = 'Checked Out';
- $due_date = (string) $item_loan->due_date;
- $process_status = (string) $item_loan->process_status;
+ if (!empty($rows)) {
+ echo '';
+ }
}
}
+ }
+ }
+}
-// Store the row data for later use
- $rows[] = [
- 'trayBarcode' => $trayBarcode,
- 'title' => $title,
- 'item_barcode' => $item_barcode,
- 'internalNote1' => $internalNote1,
- 'internalNote3' => $internalNote3,
- 'mms_id' => $mms_id,
- 'holding_id' => $holding_id,
- 'pid' => $pid,
- ];
-
- $row_count = count($rows);
-// Display the results in table rows
- echo "";
-
-
+if (isset($_POST['proceed'])) {
+ $serializedRows = isset($_POST['rows']) ? $_POST['rows'] : '';
+ $rows = @unserialize($serializedRows);
+ if (!is_array($rows) || empty($rows)) {
+ echo "No rows available to process.
";
+ } else {
+ foreach ($rows as $row) {
+ $mms_id = isset($row['mms_id']) ? $row['mms_id'] : '';
+ $holding_id = isset($row['holding_id']) ? $row['holding_id'] : '';
+ $pid = isset($row['pid']) ? $row['pid'] : '';
+ if ($mms_id === '' || $holding_id === '' || $pid === '') {
+ continue;
+ }
+ $getUrl = "https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/"
+ . rawurlencode($mms_id)
+ . "/holdings/" . rawurlencode($holding_id)
+ . "/items/" . rawurlencode($pid)
+ . "?apikey=" . rawurlencode($api_key);
-if (!empty($trayBarcode) && !empty($internalNote1)) {
+ $getResponse = almaRequest($getUrl, 'GET');
+ $xml = loadXmlFromResponse($getResponse);
- if ($trayBarcode == $internalNote1) {
- // Both available and match
- echo '' . htmlspecialchars($trayBarcode) . ' - Match | ';
- } else {
- // Both available but do not match
- $barcode = $trayBarcode;
- $barcodeAlma = $internalNote1;
- $itembarcode = $item_barcode;
-
- // Google Form URL
- $google_form_url = "https://docs.google.com/forms/u/0/d/e/1FAIpQLSfdqhD8VPq8X13niOSL-y7146PkmYtzJW0v7U-Sr94EmJOtyA/formResponse";
-
- // Google Form fields
- $form_data = [
- "entry.1671538415" => $barcode,
- "entry.1478552555" => $barcodeAlma,
- "entry.860961451" => $itembarcode,
- ];
-
- // Initialize cURL session
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $google_form_url);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($form_data));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ if ($xml === false) {
+ continue;
+ }
- // Execute cURL session
- $response = curl_exec($ch);
- curl_close($ch);
+ if (isset($xml->item_data->internal_note_3)) {
+ $xml->item_data->internal_note_3 = '';
+ }
- echo '' . htmlspecialchars($trayBarcode) . ' (from File) - ' . htmlspecialchars($internalNote1) . ' (from Alma) - Does Not Match. Mismatch Recorded | ';
- }
+ if (isset($xml->holding_data->in_temp_location)) {
+ $xml->holding_data->in_temp_location = 'false';
+ }
-} else {
+ if (isset($xml->holding_data->temp_library)) {
+ $xml->holding_data->temp_library = '';
+ }
- // One or both variables are missing
- $missing = [];
+ if (isset($xml->holding_data->temp_location)) {
+ $xml->holding_data->temp_location = '';
+ }
- if (empty($trayBarcode)) {
- $missing[] = 'trayBarcode (from File)';
- }
+ $xmlString = $xml->asXML();
- if (empty($internalNote1)) {
- $missing[] = 'internalNote1 (from Alma)';
- }
+ $putResponse = almaRequest(
+ $getUrl,
+ 'PUT',
+ $xmlString,
+ array('Content-Type: application/xml')
+ );
+ }
- $missing_message = implode(' and ', $missing) . ' missing';
+ echo '';
+ echo '
';
+ echo '
Updated Item Details Clear
';
+ echo '
';
+ echo '
+ | Tray Barcode |
+ Title |
+ Item Barcode |
+ Internal Note 3 |
+ MMS ID |
+ Status |
+
';
+
+ foreach ($rows as $row) {
+ $itemBarcode = isset($row['item_barcode']) ? $row['item_barcode'] : '';
+ $trayBarcode = isset($row['trayBarcode']) ? $row['trayBarcode'] : '';
+
+ if ($itemBarcode === '') {
+ echo "| Missing item barcode for updated record. |
";
+ continue;
+ }
- $barcode = !empty($trayBarcode) ? $trayBarcode : 'MISSING';
- $barcodeAlma = !empty($internalNote1) ? $internalNote1 : 'MISSING';
- $itembarcode = $item_barcode;
+ $updatedLookup = findItemXmlByBarcode($itemBarcode, $api_key);
- // Google Form URL
- $google_form_url = "https://docs.google.com/forms/u/0/d/e/1FAIpQLSfdqhD8VPq8X13niOSL-y7146PkmYtzJW0v7U-Sr94EmJOtyA/formResponse";
+ if (!$updatedLookup['ok'] || $updatedLookup['xml'] === false) {
+ echo "| Unable to reload updated data for barcode " . h($itemBarcode) . ". |
";
+ continue;
+ }
- // Google Form fields
- $form_data = [
- "entry.1671538415" => $barcode,
- "entry.1478552555" => $barcodeAlma,
- "entry.860961451" => $itembarcode,
- ];
+ $xml = $updatedLookup['xml'];
- // Initialize cURL session
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $google_form_url);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($form_data));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ $title = isset($xml->bib_data->title) ? (string)$xml->bib_data->title : '';
+ $item_barcode = isset($xml->item_data->barcode) ? (string)$xml->item_data->barcode : '';
+ $internalNote3 = isset($xml->item_data->internal_note_3) ? (string)$xml->item_data->internal_note_3 : '';
+ $internalNote1 = isset($xml->item_data->internal_note_1) ? (string)$xml->item_data->internal_note_1 : '';
+ $mms_id = isset($xml->bib_data->mms_id) ? (string)$xml->bib_data->mms_id : '';
+ $process_type = isset($xml->item_data->process_type) ? (string)$xml->item_data->process_type : '';
- // Execute cURL session
- $response = curl_exec($ch);
- curl_close($ch);
+ echo "";
+ echo '| ' . h($trayBarcode) . ' | ';
+ echo "" . h($title) . " | ";
+ echo "" . h($item_barcode) . " | ";
+ echo "" . h($internalNote3) . " | ";
+ echo "" . h($mms_id) . " | ";
+ echo "Updated | ";
+ echo "
";
- echo 'Error: ' . htmlspecialchars($missing_message) . '. Missing Data Recorded | ';
-}
+ $file = __DIR__ . '/refile.ndjson';
- echo "" . htmlspecialchars($title) . " | ";
- echo "" . htmlspecialchars($item_barcode) . " | ";
- echo "" . htmlspecialchars($internalNote3) . " | ";
- // echo "" . htmlspecialchars($mms_id) ." | ";
+ $jsonDate = date('Y-m-d H:i:s');
+ $jsonName = $name;
+ $jsonBarcode = $item_barcode;
+ $jsonTrayBarcode = $internalNote1;
- if ($total_record_count !== 0) {
- echo "" . $status . " Due: " . htmlspecialchars($due_date) . " Processing Data: " . htmlspecialchars($process_status) . " | ";
+ if ($process_type !== '') {
+ $jsonStatus = 'Item In Place - ' . $process_type;
} else {
- echo "" . $status . " | ";
+ $jsonStatus = 'Item In Place';
}
- echo "";
- }
- }
-
- echo '
Item Count: ' . $row_count . '
';
- echo '
';
-
- // Close the cURL session
- curl_close($ch);
+ $jsonStep = '2';
- // Show Proceed button if rows were fetched
- if (!empty($rows)) {
- echo '';
- }
-}
+ $newEntry = array(
+ 'date' => $jsonDate,
+ 'name' => $jsonName,
+ 'barcode' => $jsonBarcode,
+ 'tray barcode' => $jsonTrayBarcode,
+ 'status' => $jsonStatus,
+ 'step' => $jsonStep
+ );
-// Handle the Proceed action
-if (isset($_POST['proceed'])) {
- $rows = unserialize($_POST['rows']);
- // Get API Keys again so they work with the loop
- include 'include/apikey.php';?>
-
-
-
-
-
-
-
-
-
Loading data, please wait...
-
-
-
-
- field to blank
- $internalNote3 = $xml->item_data->internal_note_3;
- $internalNote3[0] = ''; // Update the value to blank
-
- //Modify Temp Location fields to reset
- // In temp location - true or false
- $custom_in_temp_location = 'false';
- $xml->holding_data->in_temp_location = $custom_in_temp_location;
-
- // In temp location - true or false
- $custom_temp_library = '';
- $xml->holding_data->temp_library = $custom_temp_library;
-
- // In temp location - true or false
- $custom_temp_location = '';
- $xml->holding_data->temp_location = $custom_temp_location;
-
- // Convert XML back to string for the PUT request
- $xmlString = $xml->asXML();
-
- // Construct the URL for PUT request
- $putUrl = $getUrl; // Same URL for PUT request
-
- // Initialize cURL for the PUT request
- // $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $putUrl);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/xml']);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlString);
- $putResponse = curl_exec($ch);
- curl_close($ch). PHP_EOL;
+ $jsonLine = json_encode($newEntry, JSON_UNESCAPED_SLASHES);
-
+ if ($jsonLine !== false) {
+ file_put_contents($file, $jsonLine . "\n", FILE_APPEND | LOCK_EX);
+ }
+ }
- // Pause for 1 second
- // sleep(1);
+ echo '
';
+ echo '
';
}
-
- // Redisplay the updated data
- // We can reuse the same code as above to fetch and display updated item details
- echo '
';
- echo '
';
- // Count the rows in $rows and display next to "Updated Item Details"
- $updated_row_count = count($rows);
- echo '
Updated Item Details Clear
';
-
- echo '
';
- echo '
- | Tray Barcode |
- Title |
- Item Barcode |
- Internal Note 3 |
- MMS ID |
- Status |
-
';
-
- foreach ($rows as $row) {
- $url = "https://api-na.hosted.exlibrisgroup.com/almaws/v1/items?item_barcode=" . $row['item_barcode'] . "&apikey=" . $api_key;
-
- // Initialize cURL session for GET request to fetch updated data
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- $response = curl_exec($ch);
- curl_close($ch);
-
- // Parse the response XML
- $xml = simplexml_load_string($response);
-
- // Extract updated fields
- $title = (string) $xml->bib_data->title;
- $item_barcode = (string) $xml->item_data->barcode;
- $internalNote3 = (string) $xml->item_data->internal_note_3;
- $internalNote1 = (string) $xml->item_data->internal_note_1;
- $mms_id = (string) $xml->bib_data->mms_id;
- $process_type = (string) $xml->item_data->process_type;
-
- // Display updated details in table
- echo "";
- echo '| ' . htmlspecialchars($row['trayBarcode']) . ' | ';
- echo "" . htmlspecialchars($title) . " | ";
- echo "" . htmlspecialchars($item_barcode) . " | ";
- echo "" . htmlspecialchars($internalNote3) . " | ";
- echo "" . htmlspecialchars($mms_id) . " | ";
- echo "Updated | ";
- echo "
";
-
-/////// ***** Record to NDJSON File ******** //////////////
-// File path for the NDJSON file
-$file = __DIR__ . '/refile.ndjson';
-
-// Optional: ensure $process_type is defined before this line
-$process_type_full = ' - ' . $process_type;
-
-// Define the variables for a new entry
-$jsonDate = date('Y-m-d H:i:s'); // Current timestamp
-$jsonName = $name; // Replace this with actual name variable
-$jsonBarcode = $item_barcode; // Replace this with actual barcode variable
-$jsonTrayBarcode = $internalNote1; // Tray barcode
-
-if (isset($process_type) && $process_type !== '') {
- $jsonStatus = 'Item In Place - ' . $process_type;
-} else {
- $jsonStatus = 'Item In Place';
-}
-
-$jsonStep = '2'; // Define the step the row is part of
-
-// Create a new entry
-$newEntry = [
- 'date' => $jsonDate,
- 'name' => $jsonName,
- 'barcode' => $jsonBarcode,
- 'tray barcode' => $jsonTrayBarcode,
- 'status' => $jsonStatus,
- 'step' => $jsonStep,
-];
-
-// Encode as JSON (compact) and append to file
-$jsonLine = json_encode($newEntry, JSON_UNESCAPED_SLASHES);
-if ($jsonLine === false) {
- die('Error: JSON encoding failed. ' . json_last_error_msg());
-}
-
-if (file_put_contents($file, $jsonLine . "\n", FILE_APPEND | LOCK_EX) === false) {
- die('Error: Unable to write to the NDJSON file.');
-} }
-
-/////// ***** End Record to NDJSON File ******** //////////////
-
- echo '
';
- echo '
';
}
?>
-
Upload a .txt file with barcodes
-
Format should be:
- Tray Barcode
- Item Barcode
- Tray Barcode
- Item Barcode
+
Upload a .txt file with barcodes
+
Format should be:
+ Tray Barcode
Item Barcode
+ Tray Barcode
Item Barcode
Etc...
-
+