Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
#****************************************************************************
if (isset($_POST["autobarco"]) and $_POST["autobarco"]) {
    $nzeros = "5";
    $bibid = $_POST["bibid"];
    $CopyNmbr = $copyQ->nextCopyid($bibid);
    if ($copyQ->errorOccurred()) {
        $copyQ->close();
        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();
$copy->setLocationid($_POST["location"]);
$_POST["location"] = $copy->getCopyDesc();
$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]);
    }
Exemplo n.º 3
0
 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"]);
     $copy->setStatusCd($array["status_cd"]);
     $copy->setLocationid($array["locationid"]);
     $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;
 }
Exemplo n.º 4
0
#****************************************************************************
if (isset($_POST["autobarco"]) and $_POST["autobarco"]) {
    $nzeros = "5";
    $bibid = $_POST["bibid"];
    $CopyNmbr = $copyQ->nextCopyid($bibid);
    if ($copyQ->errorOccurred()) {
        $copyQ->close();
        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();
$validData = $copy->validateData();
if (!$validData) {
    $pageErrors["barcodeNmbr"] = $copy->getBarcodeNmbrError();
    $_SESSION["postVars"] = $_POST;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../catalog/biblio_copy_new_form.php?bibid=" . U($bibid));
    exit;
}
#**************************************************************************
#*  Insert new bibliography copy
Exemplo n.º 5
0
 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();
 }
Exemplo n.º 6
0
 $recCount++;
 $mandatoryCols = array("Call1" => false, '245$a' => false, '100$a' => false);
 $localErrors = array();
 $localWarnings = array();
 $barcode = "";
 $record = trim($record);
 if ($record == "") {
     continue;
 }
 $colCount = 0;
 $biblio = new Biblio();
 $biblio->setLastChangeUserid($_POST["userid"]);
 $biblio->setMaterialCd($defaultMaterial);
 $biblio->setCollectionCd($defaultCollection);
 $biblio->setOpacFlg($_POST["opac"] == 'Y');
 $copy = new BiblioCopy();
 $copy->setBibid("!auto!");
 $copy->setCopyDesc($_POST["copyText"]);
 $copy->setStatusCd($defaultstatus_dm);
 //JALG 3-2015 añadido para opción de estado de materiales
 $entries = explode($fieldterminator, $record);
 for ($colCount = 0; $colCount < count($targets); $colCount++) {
     if (isset($entries[$colCount])) {
         $entry = trim($entries[$colCount]);
         if ($entry == "") {
             continue;
         }
     } else {
         continue;
     }
     $target = trim($targets[$colCount]);
Exemplo n.º 7
0
 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();
 }
#* User A's process gets next copy id, then checks for a duplicate barcode,
#* Before the final insert, though, User B's process asks for the next copy id
#* and checks for a duplicate barcode.  At that point, both inserts will succeed
#* and two copies will have the same barcode.  Several different interleavings
#* either cause the duplicate barcode check to fail or cause duplicate barcodes
#* to be entered.  This can be fixed with a lock or by an atomic
#* get-and-increment-sequence-value operation.  I'll fix it later. -- Micah
#****************************************************************************
if ((isset($_POST["autobarco"]) and $_POST["autobarco"]) || 0 + $_GET['hits'] > 1) {
    $_POST["barcodeNmbr"] = generateBarcode();
}
#****************************************************************************
#*  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();
$validData = $copy->validateData();
if (!$validData) {
    $pageErrors["barcodeNmbr"] = $copy->getBarcodeNmbrError();
    $_SESSION["postVars"] = $_POST;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../catalog/biblio_copy_new_form.php?bibid=" . U($bibid) . (empty($_GET['isbn']) ? '' : "&isbn={$_GET['isbn']}&hits={$_GET['hits']}"));
    exit;
}
#**************************************************************************
#*  Insert new bibliography copy
Exemplo n.º 9
0
 function fetchCopy()
 {
     $array = $this->_conn->fetchRow();
     if ($array == false) {
         return false;
     }
     $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"]);
     $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"]);
     return $copy;
 }
 function _mkObj(&$array, &$customs = NULL)
 {
     // jalg multi 5-7-2015 ALX
     $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"]);
     $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"]);
     if (is_null($customs)) {
         $copy->_custom = $this->getCustomFields($array['bibid'], $array['copyid']);
     } else {
         Fatal::dbError($array["copyid"], "not implemented multycopy method", 'No DBMS error.');
         if (isset($customs[$array['copyid']])) {
             $copy->_custom = $customs[$array['copyid']];
         }
     }
     return $copy;
 }