Esempio n. 1
0
 function fetchRow()
 {
     $array = $this->_conn->fetchRow();
     if ($array == false) {
         return false;
     }
     $hist = new BiblioStatusHist();
     $hist->setBibid($array["bibid"]);
     $hist->setCopyid($array["copyid"]);
     $hist->setBiblioBarcodeNmbr($array["biblio_barcode_nmbr"]);
     $hist->setTitle($array["title"]);
     $hist->setAuthor($array["author"]);
     $hist->setStatusCd($array["status_cd"]);
     $hist->setStatusBeginDt($array["status_begin_dt"]);
     $hist->setMbrid($array["mbrid"]);
     $hist->setLastName($array["last_name"]);
     $hist->setFirstName($array["first_name"]);
     $hist->setMbrBarcodeNmbr($array["mbr_barcode_nmbr"]);
     $hist->setDueBackDt($array["due_back_dt"]);
     $hist->setRenewalCount($array["renewal_count"]);
     return $hist;
 }
Esempio n. 2
0
 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);
 }
    $copy->setStatusCd(OBIB_STATUS_ON_HOLD);
} else {
    $copy->setStatusCd(OBIB_STATUS_SHELVING_CART);
}
$copy->setMbrid("");
$copy->setDueBackDt("");
if (!$copyQ->update($copy, true)) {
    $copyQ->close();
    displayErrorPage($copyQ);
}
$copyQ->close();
#**************************************************************************
#*  Insert into biblio status history
#**************************************************************************
if ($saveMbrid != "") {
    $hist = new BiblioStatusHist();
    $hist->setBibid($copy->getBibid());
    $hist->setCopyid($copy->getCopyid());
    $hist->setStatusCd($copy->getStatusCd());
    $hist->setDueBackDt($copy->getDueBackDt());
    $hist->setMbrid($saveMbrid);
    $histQ = new BiblioStatusHistQuery();
    $histQ->connect();
    if ($histQ->errorOccurred()) {
        $histQ->close();
        displayErrorPage($histQ);
    }
    $histQ->insert($hist);
    if ($histQ->errorOccurred()) {
        $histQ->close();
        displayErrorPage($histQ);
Esempio n. 4
0
// we need to also insert into status history table
$copy->setStatusCd(OBIB_STATUS_OUT);
$copy->setMbrid($_POST["mbrid"]);
if (isset($_POST['date_from']) && ($_POST['date_from'] = 'override')) {
    list($today, $err) = Date::read_e("today");
}
$copy->setDueBackDt($dueDate);
if (!$copyQ->update($copy, true)) {
    $copyQ->close();
    displayErrorPage($copyQ);
}
$copyQ->close();
#**************************************************************************
#*  Insert into biblio status history
#**************************************************************************
$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->connect();
if ($histQ->errorOccurred()) {
    $histQ->close();
    displayErrorPage($histQ);
}
$histQ->insert($hist);
if ($histQ->errorOccurred()) {