function addCopy($bibid) { $bibid = 0 + $bibid; if ($bibid < 1) { return false; } require_once "BiblioCopyQuery.php"; $copyQ = new BiblioCopyQuery(); $copyQ->connect(); if ($copyQ->errorOccurred()) { $copyQ->close(); } // Auto generate barcode $CopyNmbr = $copyQ->nextCopyid($bibid); if ($copyQ->errorOccurred()) { $copyQ->close(); } $nzeros = "5"; $barcode = sprintf("%0" . $nzeros . "s", $bibid) . $CopyNmbr; $copy = new BiblioCopy(); $copy->setBibid($bibid); $copy->setBarcodeNmbr($barcode); if (!$copyQ->insert($copy)) { $copyQ->close(); } $copyQ->close(); }
/** * inserts data into the biblio_copy table * and create barcodes for the insterted titles * barcode is a 12 char code based on the book id * @param $data * @param $lastInsertID the last inserted id from the biblio table * @return nothing */ function insertBiblioCopy($data, $lastInsertID) { $copy = new BiblioCopy(); $copy->setBibid($lastInsertID); $copy->setCreateDt(date("Y-m-d H:i:s")); $copy->setBarcodeNmbr($data[0]); $copy->setStatusCd($data[3]); $copy->setStatusBeginDt(date("Y-m-d H:i:s")); $copy->setBasketNumber($data[5]); $copy->setCopyDesc($data[6]); $bibcopyQ = new BiblioCopyQuery(); if ($bibcopyQ->insert($copy) == false) { return $bibcopyQ->getError(); } return null; }
function addCopy($bibid) { $bibid = 0 + $bibid; if ($bibid < 1) { return false; } require_once "BiblioCopyQuery.php"; $copyQ = new BiblioCopyQuery(); $copyQ->connect(); if ($copyQ->errorOccurred()) { $copyQ->close(); } // Auto generate barcode $CopyNmbr = $copyQ->nextCopyid($bibid); if ($copyQ->errorOccurred()) { $copyQ->close(); } $nzeros = "5"; $barcode = sprintf("%0" . $nzeros . "s", $bibid) . $CopyNmbr; $copy = new BiblioCopy(); $copy->setBibid($bibid); $copy->setBarcodeNmbr($barcode); if (!$copyQ->insert($copy)) { $copyQ->close(); /* if ($copyQ->getDbErrno() == "") { $pageErrors["barcodeNmbr"] = $copyQ->getError(); $_SESSION["postVars"] = $_POST; $_SESSION["pageErrors"] = $pageErrors; header("Location: ../catalog/biblio_copy_new_form.php?bibid=".U($bibid)); exit(); } else { displayErrorPage($copyQ); } */ } $copyQ->close(); }