/** * 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; }
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(); //#C4 -begin $copy->setBasketNumber($_POST["basket_nmbr"]); $_POST["basket_nmbr"] = $copy->getBasketNumber(); //#C4 -end $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();
function _mkObj($array) { $copy = new BiblioCopy(); $copy->setBibid($array["bibid"]); $copy->setCopyid($array["copyid"]); $copy->setCreateDt($array["create_dt"]); $copy->setCopyDesc($array["copy_desc"]); $copy->setBarcodeNmbr($array["barcode_nmbr"]); //#C4 - begin $copy->setBasketNumber($array["basket_nmbr"]); //#C4 - end $copy->setStatusCd($array["status_cd"]); $copy->setStatusBeginDt($array["status_begin_dt"]); $copy->setDueBackDt($array["due_back_dt"]); $copy->setDaysLate($array["days_late"]); $copy->setMbrid($array["mbrid"]); $copy->setRenewalCount($array["renewal_count"]); $copy->_custom = $this->getCustomFields($array['bibid'], $array['copyid']); return $copy; }