$histQ->close(); displayErrorPage($histQ); } $histQ->close(); #************************************************************************** #* Calc late fee if any #************************************************************************** if ($saveDaysLate > 0 and $dailyLateFee > 0) { $fee = $dailyLateFee * $saveDaysLate; $trans = new MemberAccountTransaction(); $trans->setMbrid($saveMbrid); $trans->setCreateUserid($_SESSION["userid"]); $trans->setTransactionTypeCd("+c"); $trans->setAmount($fee); $trans->setDescription($loc->getText("shelvingCartTrans", array("barcode" => $barcode))); $transQ = new MemberAccountQuery(); $transQ->connect(); if ($transQ->errorOccurred()) { $transQ->close(); displayErrorPage($transQ); } $trans = $transQ->insert($trans); if ($transQ->errorOccurred()) { $transQ->close(); displayErrorPage($transQ); } // Set fee message if (OBIB_LOCALE == 'th') { $balText = number_format($fee, 2) . ' บาท'; } else { $balText = moneyFormat($fee, 2);
<?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">
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); }
$biblioStatusDm = $dmQ->getAssoc("biblio_status_dm"); $materialTypeDm = $dmQ->getAssoc("material_type_dm"); $materialImageFiles = $dmQ->getAssoc("material_type_dm", "image_file"); $memberFieldsDm = $dmQ->getAssoc("member_fields_dm"); $dmQ->close(); #**************************************************************************** #* Search database for member #**************************************************************************** $mbrQ = new MemberQuery(); $mbrQ->connect(); $mbr = $mbrQ->get($mbrid); $mbrQ->close(); #**************************************************************************** #* Check for outstanding balance due #**************************************************************************** $acctQ = new MemberAccountQuery(); $acctQ->connect(); if ($acctQ->errorOccurred()) { $acctQ->close(); displayErrorPage($acctQ); } $balance = $acctQ->getBalance($mbrid); if ($acctQ->errorOccurred()) { $acctQ->close(); displayErrorPage($acctQ); } $acctQ->close(); #************************************************************************** #* Show member information #************************************************************************** require_once "../shared/header.php";
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")); }
$dmQ->close(); #**************************************************************************** #* 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;