<?php if (isset($_GET['barcode'])) { if (isset($_GET['mbrid']) and $_GET['mbrid']) { $memberQ = new MemberQuery(); $mbr = $memberQ->get($_GET['mbrid']); echo '<p>'; echo $loc->getText("Checked in %barcode% for ", array('barcode' => $_GET['barcode'])); echo '<a href="../circ/mbr_view.php?mbrid=' . HURL($mbr->getMbrid()) . '&reset=Y">'; echo $loc->getText("%fname% %lname%", array('fname' => $mbr->getFirstName(), 'lname' => $mbr->getLastName())); echo '</a>.'; echo '</p>'; if (isset($_GET['late']) and $_GET['late']) { echo '<p><font class="error">' . $loc->getText("mbrViewOutHdr7") . ': ' . $_GET['late'] . '</font></p>'; } $acctQ = new MemberAccountQuery(); $balance = $acctQ->getBalance($mbr->getMbrid()); $balMsg = ""; if ($balance > 0) { $balText = moneyFormat($balance, 2); $balMsg = "<font class=\"error\">" . $loc->getText("mbrViewBalMsg", array("bal" => $balText)) . "</font><br><br>"; } echo $balMsg; } else { echo '<p>' . $loc->getText("Checked in %barcode%.", array('barcode' => $_GET['barcode'])) . '</p>'; } } ?> <form name="barcodesearch" method="POST" action="../circ/shelving_cart.php"> <table class="primary"> <tr>
function _purgeHistory($mbrid) { $setQ = new SettingsQuery(); $purgeMo = $setQ->getPurgeHistoryAfterMonths($this); if ($purgeMo == 0) { return TRUE; } // do not purge at all when there might be unpaid overdue fees $acctQ = new MemberAccountQuery(); $balance = $acctQ->getBalance($mbrid); if ($balance != 0) { return TRUE; } $sql = $this->mkSQL("delete biblio_status_hist from biblio_status_hist" . " left join biblio_copy on biblio_copy.mbrid = biblio_status_hist.mbrid" . " and biblio_copy.bibid = biblio_status_hist.bibid" . " and biblio_copy.copyid = biblio_status_hist.copyid" . " where biblio_status_hist.mbrid = %N" . " and biblio_status_hist.status_begin_dt <= date_add(sysdate(),interval - %N month)" . " and biblio_copy.mbrid is null", $mbrid, $purgeMo); // history is not purged for copies that are not returned return $this->_query($sql, $this->_loc->getText("biblioStatusHistQueryErr5")); }
function _checkout_e($mbcode, $bcode, $due, $date, $force) { 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 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 ($due !== NULL) { list($due, $err) = Date::read_e($due); if ($err) { return new Error($this->_loc->getText("Can't understand date: %err%", array('err' => $err->toStr()))); } } if ($earliest > time()) { return new Error($this->_loc->getText("Won't do checkouts for future dates.")); } $mbrQ = new MemberQuery(); $mbr = $mbrQ->maybeGetByBarcode($mbcode); if (!$mbr) { return new Error($this->_loc->getText("Bad member barcode: %bcode%", array('bcode' => $mbcode))); } $mbrid = $mbr->getMbrid(); if (!$force && OBIB_BLOCK_CHECKOUTS_WHEN_FINES_DUE) { $acctQ = new MemberAccountQuery(); $balance = $acctQ->getBalance($mbrid); if ($balance > 0) { return new Error($this->_loc->getText("Member owes fines: checkout not allowed")); } } $copyQ = new BiblioCopyQuery(); $copy = $copyQ->maybeGetByBarcode($bcode); if (!$copy) { return new Error($this->_loc->getText("Bad copy barcode: %bcode%", array('bcode' => $bcode))); } if ($copy->getStatusCd() == OBIB_STATUS_OUT) { if ($copy->getMbrid() == $mbrid) { # Renewal $reachedLimit = $copyQ->hasReachedRenewalLimit($mbrid, $mbr->getClassification(), $copy); if (!$force && $reachedLimit) { return new Error($this->_loc->getText("Item %bcode% has reached its renewal limit.", array('bcode' => $bcode))); } else { if (!$force && $copy->getDaysLate() > 0) { return new Error($this->_loc->getText("Item %bcode% is late and cannot be renewed.", array('bcode' => $bcode))); } else { $copy->setRenewalCount($copy->getRenewalCount() + 1); } } } else { if ($force) { list($dummy, $err) = $this->shelving_cart_e($bcode, $date, $force); if ($err) { return $err; } $copy = $copyQ->maybeGetByBarcode($bcode); if (!$copy) { Fatal::internalError("Copy disappeared mysteriously."); } } else { return new Error($this->_loc->getText("Item %bcode% is already checked out to another member.", array('bcode' => $bcode))); } } } else { $copy->setRenewalCount(0); $reachedLimit = $copyQ->hasReachedCheckoutLimit($mbrid, $mbr->getClassification(), $copy->getBibid()); if (!$force && $reachedLimit) { return new Error($this->_loc->getText("Member has reached checkout limit for this collection.")); } } $days = $copyQ->getDaysDueBack($copy); if ($days <= 0) { if ($force) { # the checkout has probably already happened, just guess - FIXME? $days = 14; } else { return new Error($this->_loc->getText("Checkouts are disallowed for this collection.")); } } if ($copy->getStatusCd() == OBIB_STATUS_ON_HOLD) { $holdQ = new BiblioHoldQuery(); $hold = $holdQ->maybeGetFirstHold($copy->getBibid(), $copy->getCopyid()); if ($hold) { // FIXME: Y2K38. Before 2038, timestamp won't be outside valid range. $holdAge = Date::daysLater($date, $hold->getHoldBeginDt()); if (OBIB_HOLD_MAX_DAYS > 0 && $holdAge > OBIB_HOLD_MAX_DAYS) { $tooOld = true; } else { $tooOld = false; } if ($tooOld || $mbrid == $hold->getMbrid()) { $holdQ->delete($hold->getBibid(), $hold->getCopyid(), $hold->getHoldid()); } else { if (!$force) { return new Error($this->_loc->getText("Item is on hold for another member.")); } } } } $oldtime = strtotime($copy->getStatusBeginDt()); if ($oldtime > $latest) { return new Error($this->_loc->getText("Can't change status to an earlier date on item %bcode%.", array('bcode' => $bcode))); } else { if ($oldtime == $latest) { return 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->setStatusCd(OBIB_STATUS_OUT); $copy->setMbrid($mbrid); $copy->setStatusBeginDt($time); if ($due === NULL) { $copy->setDueBackDt(Date::addDays($date, $days)); } else { $copy->setDueBackDt($due); } if (!$copyQ->updateStatus($copy)) { Fatal::InternalError("Impossible copyQ update 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($copy->getMbrid()); $hist->setRenewalCount($copy->getRenewalCount()); $histQ = new BiblioStatusHistQuery(); $histQ->insert($hist); }
#**************************************************************************** #* Search database for member #**************************************************************************** $mbrQ = new MemberQuery(); $mbrQ->connect(); $mbr = $mbrQ->get($mbrid); $mbrQ->close(); $sclQ = new SchoolQuery(); $sclQ->connect(); $sclName = $sclQ->getSchoolName($mbr->getSchoolId()); $sclQ->close(); #**************************************************************************** #* Check for outstanding balance due #**************************************************************************** $acctQ = new MemberAccountQuery(); $balance = $acctQ->getBalance($mbrid); $balMsg = ""; if ($balance > 0 && $balance >= $mbrMaxFines[$mbr->getClassification()]) { $balText = moneyFormat($balance, 2); $balMsg = "<font class=\"error\">" . $loc->getText("mbrViewBalMsg", array("bal" => $balText)) . "</font><br><br>"; } #************************************************************************** #* Show member information #************************************************************************** require_once "../shared/header.php"; ?> <?php echo $balMsg; echo $msg; ?>