$copyQ->close(); displayErrorPage($copyQ); } $_POST["barcodeNmbr"] = sprintf("%0" . $nzeros . "s", $bibid) . $CopyNmbr; } #**************************************************************************** #* Validate data #**************************************************************************** $bibid = $_POST["bibid"]; $copy = new BiblioCopy(); $copy->setBibid($bibid); $copy->setCopyDesc($_POST["copyDesc"]); $_POST["copyDesc"] = $copy->getCopyDesc(); $copy->setBarcodeNmbr($_POST["barcodeNmbr"]); $_POST["barcodeNmbr"] = $copy->getBarcodeNmbr(); $validData = $copy->validateData(); if (!$validData) { $pageErrors["barcodeNmbr"] = $copy->getBarcodeNmbrError(); $_SESSION["postVars"] = $_POST; $_SESSION["pageErrors"] = $pageErrors; header("Location: ../catalog/biblio_copy_new_form.php?bibid=" . U($bibid)); exit; } #************************************************************************** #* Insert new bibliography copy #************************************************************************** if (!$copyQ->insert($copy)) { $copyQ->close(); if ($copyQ->getDbErrno() == "") { $pageErrors["barcodeNmbr"] = $copyQ->getError(); $_SESSION["postVars"] = $_POST;
$_POST["copyDesc"] = $copy->getCopyDesc(); $copy->setBarcodeNmbr($_POST["barcodeNmbr"]); $_POST["barcodeNmbr"] = $copy->getBarcodeNmbr(); $copy->setLocationid($_POST["location"]); $_POST["location"] = $copy->getCopyDesc(); $dmQ = new DmQuery(); $dmQ->connect(); $customFields = $dmQ->getAssoc('biblio_copy_fields_dm'); $dmQ->close(); foreach ($customFields as $name => $title) { if (isset($_REQUEST['custom_' . $name])) { $copy->setCustom($name, $_REQUEST['custom_' . $name]); } } $validBarco = $_POST["validBarco"]; $validData = $copy->validateData($validBarco); if (!$validData) { $pageErrors["barcodeNmbr"] = $copy->getBarcodeNmbrError(); $_SESSION["postVars"] = $_POST; $_SESSION["pageErrors"] = $pageErrors; header("Location: ../catalog/biblio_copy_new_form.php?bibid=" . U($bibid)); exit; } #************************************************************************** #* Insert new bibliography copy #************************************************************************** if (!$copyQ->insert($copy)) { $copyQ->close(); if ($copyQ->getDbErrno() == "") { $pageErrors["barcodeNmbr"] = $copyQ->getError(); $_SESSION["postVars"] = $_POST;
$biblio->addBiblioField($tag[0] . $tag[1], $f); } break; } } // Display the biblio. Don't keep it in a array due to memory reasons. $validate = $biblio->validateData(); // Check for uniqueness with existing barcodes and new entries read. if ($barcode != "") { if (in_array($barcode, $newBarcodes)) { array_push($localErrors, $copy->_loc->getText("biblioCopyQueryErr1")); $validate = false; } // push new barcode into validation array after validation to each the check. array_push($newBarcodes, $barcode); if (!$copy->validateData()) { $validate = false; } } // Check for mandatory entries foreach ($mandatoryCols as $col => $seen) { if (!$seen) { array_push($localErrors, "Missing column entry: '" . $col . "'"); $validate = false; } } if (count($localErrors)) { $validate = false; } if ($validate != true) { array_push($errorList, $recCount);