/** * 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) { $bibQ = new BiblioCopyQuery(); $barcodenumber = $bibQ->getBarcodeNumber(); $sql = "INSERT INTO biblio_copy (create_dt, bibid, barcode_nmbr, status_cd, status_begin_dt, copy_desc , locationid) VALUES ( "; $sql .= "'" . date("Y-m-d H:i:s") . "','" . $lastInsertID . "','" . $barcodenumber . "','" . $data[3] . "','" . date("Y-m-d H:i:s") . "','"; $sql .= $data[7] . "','" . $data[8] . "' ) "; $r = $this->_act($sql); return $r; }
/** * 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; }
} #**************************************************************************** #* Edit input #**************************************************************************** if (!ctypeAlnum($barcode)) { $pageErrors["barcodeNmbr"] = $loc->getText("shelvingCartErr1"); $postVars["barcodeNmbr"] = $barcode; $_SESSION["postVars"] = $postVars; $_SESSION["pageErrors"] = $pageErrors; header("Location: ../circ/checkin_form.php"); exit; } #**************************************************************************** #* Ready copy record #**************************************************************************** $copyQ = new BiblioCopyQuery(); $copyQ->connect(); if ($copyQ->errorOccurred()) { $copyQ->close(); displayErrorPage($copyQ); } if (is_bool($copy = $copyQ->queryByBarcode($barcode))) { $copyQ->close(); $pageErrors["barcodeNmbr"] = $loc->getText("shelvingCartErr2"); $_SESSION["pageErrors"] = $pageErrors; header("Location: ../circ/checkin_form.php"); exit; } #**************************************************************************** #* Edit results #****************************************************************************
function _shelving_cart_e($bcode, $date, $force) { $info = array('mbrid' => NULL, 'bibid' => NULL, 'hold' => NULL); if ($date === NULL) { list($date, $err) = Date::read_e('today'); if ($err) { Fatal::internalError("Unexpected date error: " . $err); } $earliest = $latest = time(); } else { list($date, $err) = Date::read_e($date); if ($err) { return array($info, new Error($this->_loc->getText("Can't understand date: %err%", array('err' => $err->toStr())))); } $earliest = strtotime($date . " 00:00:00"); $latest = strtotime($date . " 23:59:59"); } if ($earliest > time()) { return array($info, new Error($this->_loc->getText("Won't do checkins for future dates."))); } $copyQ = new BiblioCopyQuery(); $copy = $copyQ->maybeGetByBarcode($bcode); if (!$copy) { return array($info, new Error($this->_loc->getText("Bad copy barcode: %bcode%", array('bcode' => $bcode)))); } $info['bibid'] = $copy->getBibid(); $fee = $copyQ->getDailyLateFee($copy); $mbrid = $info['mbrid'] = $copy->getMbrid(); if ($copy->getDueBackDt()) { // FIXME: Y2K38. This temporary fix should prevent unjust late fee when Override Due Date was used. if (strtotime($copy->getDueBackDt()) != false && strtotime($copy->getDueBackDt()) != -1) { $late = $info['late'] = Date::daysLater($date, $copy->getDueBackDt()); } } $holdQ = new BiblioHoldQuery(); $hold = $info['hold'] = $holdQ->maybeGetFirstHold($copy->getBibid(), $copy->getCopyid()); if ($hold) { $copy->setStatusCd(OBIB_STATUS_ON_HOLD); } else { $copy->setStatusCd(OBIB_STATUS_SHELVING_CART); } $oldtime = strtotime($copy->getStatusBeginDt()); if ($oldtime > $latest) { return array($info, new Error($this->_loc->getText("Can't change status to an earlier date on item %bcode%.", array('bcode' => $bcode)))); } else { if ($oldtime == $latest) { return array($info, new Error($this->_loc->getText("Can't change status more than once per second on item %bcode%.", array('bcode' => $bcode)))); } else { if ($oldtime < $earliest) { $time = date('Y-m-d H:i:s', $earliest); } else { $time = date('Y-m-d H:i:s', $oldtime + 1); } } } $copy->setMbrid(""); $copy->setStatusBeginDt($time); $copy->setDueBackDt(""); if (!$copyQ->updateStatus($copy)) { Fatal::InternalError("Impossible copyQ update error."); } if ($mbrid != "" and $late > 0 and $fee > 0) { $trans = new MemberAccountTransaction(); $trans->setMbrid($mbrid); $trans->setCreateUserid($_SESSION['userid']); $trans->setTransactionTypeCd("+c"); $trans->setAmount($fee * $late); $trans->setDescription($this->_loc->getText("Late fee (barcode=%barcode%)", array('barcode' => $bcode))); $transQ = new MemberAccountQuery(); if (!$transQ->insert($trans)) { Fatal::internalError("Impossible transQ insert error."); } } $hist = new BiblioStatusHist(); $hist->setBibid($copy->getBibid()); $hist->setCopyid($copy->getCopyid()); $hist->setStatusCd($copy->getStatusCd()); $hist->setStatusBeginDt($copy->getStatusBeginDt()); $hist->setDueBackDt($copy->getDueBackDt()); $hist->setMbrid($mbrid); $histQ = new BiblioStatusHistQuery(); if (!$histQ->insert($hist)) { Fatal::internalError("Impossible histQ insert error."); } return array($info, 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(); } $copyQ->close(); }
#* Checking for query string. Go back to list if none found. #**************************************************************************** if (!isset($_GET["code"])) { header("Location: ../admin/copy_fields_list.php"); exit; } $code = $_GET["code"]; $description = $_GET["desc"]; #************************************************************************** #* Delete row #************************************************************************** $dmQ = new DmQuery(); $dmQ->connect(); $dmQ->delete("biblio_copy_fields_dm", $code); $dmQ->close(); $biblioCopyQ = new BiblioCopyQuery(); $biblioCopyQ->connect(); $biblioCopyQ->deleteCustomField($code); $biblioCopyQ->close(); #************************************************************************** #* Show success page #************************************************************************** require_once "../shared/header.php"; echo $loc->getText("Copy field, %desc%, has been deleted.", array('desc' => $description)); ?> <br><br> <a href="../admin/copy_fields_list.php"><?php echo $loc->getText("return to copy field list"); ?> </a>
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(); }
require_once "../classes/BiblioCopyQuery.php"; require_once "../functions/errorFuncs.php"; require_once "../classes/Localize.php"; $loc = new Localize(OBIB_LOCALE, $tab); #**************************************************************************** #* Checking for post vars. Go back to form if none found. #**************************************************************************** if (count($_POST) == 0) { header("Location: ../circ/loc_new_form.php"); exit; } #**************************************************************************** #* Validate data #**************************************************************************** $location = $_POST["locationid"]; $bibCopyQ = new BiblioCopyQuery(); $bibCopyQ->connect(); $booksList = $bibCopyQ->getBooksList($location); $my_file = '../layouts/default/LocationBooksFile.csv'; $handle = fopen($my_file, 'w') or die('Cannot open file: ' . $my_file); foreach ($booksList as $book) { $line = array($book['barcode_nmbr'], $book['title'], $book['author']); fputcsv($handle, $line); } header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($my_file)); header('Content-Disposition: attachment; filename="' . 'LocationOfBooks.csv' . '"'); readfile($my_file); /** *