Пример #1
0
function postVarsToBiblio($post)
{
    require_once "../classes/Biblio.php";
    require_once "../classes/BiblioField.php";
    $biblio = new Biblio();
    $biblio->setMaterialCd($post["materialCd"]);
    $biblio->setCollectionCd($post["collectionCd"]);
    $biblio->setCallNmbr1($post["callNmbr1"]);
    $biblio->setCallNmbr2($post["callNmbr2"]);
    $biblio->setCallNmbr3($post["callNmbr3"]);
    $biblio->setLastChangeUserid($_SESSION["userid"]);
    $biblio->setOpacFlg(isset($post["opacFlg"]));
    $indexes = $post["indexes"];
    foreach ($indexes as $index) {
        $value = $post["values"][$index];
        $fieldid = $post["fieldIds"][$index];
        $tag = $post["tags"][$index];
        $subfieldCd = $post["subfieldCds"][$index];
        $requiredFlg = $post["requiredFlgs"][$index];
        $biblioFld = new BiblioField();
        $biblioFld->setFieldid($fieldid);
        $biblioFld->setTag($tag);
        $biblioFld->setSubfieldCd($subfieldCd);
        $biblioFld->setIsRequired($requiredFlg);
        $biblioFld->setFieldData($value);
        $biblio->addBiblioField($index, $biblioFld);
    }
    return $biblio;
}
Пример #2
0
function postVarsToBiblio($post)
{
    require_once "../classes/Biblio.php";
    require_once "../classes/BiblioField.php";
    $biblio = new Biblio();
    $biblio->setMaterialCd($post["materialCd"]);
    $biblio->setCollectionCd($post["collectionCd"]);
    $biblio->setCallNmbr1($post["callNmbr1"]);
    $biblio->setCallNmbr2($post["callNmbr2"]);
    $biblio->setCallNmbr3($post["callNmbr3"]);
    //#C1 - begin
    $biblio->setReadingLevel($post["readingLevel"]);
    $GLOBALS["title"] = $post['values']['245a'];
    $GLOBALS["author"] = $post['values']['100a'];
    $GLOBALS["publication"] = $post['values']['260b'];
    //#C1 - end
    $biblio->setLastChangeUserid($_SESSION["userid"]);
    $biblio->setOpacFlg(isset($post["opacFlg"]));
    $indexes = $post["indexes"];
    foreach ($indexes as $index) {
        $value = $post["values"][$index];
        $fieldid = $post["fieldIds"][$index];
        $tag = $post["tags"][$index];
        $subfieldCd = $post["subfieldCds"][$index];
        $requiredFlg = $post["requiredFlgs"][$index];
        $biblioFld = new BiblioField();
        $biblioFld->setFieldid($fieldid);
        $biblioFld->setTag($tag);
        $biblioFld->setSubfieldCd($subfieldCd);
        $biblioFld->setIsRequired($requiredFlg);
        $biblioFld->setFieldData($value);
        $biblio->addBiblioField($index, $biblioFld);
    }
    return $biblio;
}
Пример #3
0
function postVarsToBiblio($post)
{
    require_once "../classes/Biblio.php";
    require_once "../classes/BiblioField.php";
    $biblio = new Biblio();
    $biblio->setBibid($post['bibid']);
    $biblio->setMaterialCd($post["materialCd"]);
    $biblio->setCollectionCd($post["collectionCd"]);
    $biblio->setCallNmbr1($post["callNmbr1"]);
    $biblio->setCallNmbr2($post["callNmbr2"]);
    $biblio->setCallNmbr3($post["callNmbr3"]);
    $biblio->setLanguage($post["language"]);
    $biblio->setOthernumber($post["othernumber"]);
    $biblio->setImageLocation($post["image_location"]);
    $biblio->setLastChangeUserid($_SESSION["userid"]);
    $biblio->setOpacFlg(isset($post["opacFlg"]));
    $indexes = $post["indexes"];
    foreach ($indexes as $index) {
        $value = $post["values"][$index];
        $fieldid = $post["fieldIds"][$index];
        $tag = $post["tags"][$index];
        $subfieldCd = $post["subfieldCds"][$index];
        $requiredFlg = $post["requiredFlgs"][$index];
        $biblioFld = new BiblioField();
        $biblioFld->setBibid($post['bibid']);
        $biblioFld->setFieldid($fieldid);
        $biblioFld->setTag($tag);
        $biblioFld->setSubfieldCd($subfieldCd);
        $biblioFld->setIsRequired($requiredFlg);
        $biblioFld->setFieldData($value);
        $biblio->addBiblioField($index, $biblioFld);
    }
    //update image, if no file is uploaded do not set image location
    if ($_FILES['input_upload']['size'] != 0) {
        $img = fileUpload("input_upload");
        $biblio->setImageLocation($img);
        print $img;
    } else {
        //use original img path / location
    }
    return $biblio;
}
 function doQuery($bibid, $tab = "cataloging")
 {
     # reset rowNmbr
     $this->_rowNmbr = 0;
     $this->_currentRowNmbr = 1;
     $this->_rowCount = 1;
     $this->_pageCount = 1;
     $exclude = array("363x", "526x", "583x", "754x", "852x", "856x");
     /***********************************************************
      *  Reading biblio data
      ***********************************************************/
     # setting query that will return all the data in biblio
     $sql = $this->mkSQL("select biblio.*, staff.username " . "from biblio left join staff " . "on biblio.last_change_userid = staff.userid " . "where biblio.bibid = %N ", $bibid);
     if (!$this->_query($sql, $this->_loc->getText("biblioQueryQueryErr1"))) {
         return false;
     }
     $array = $this->_conn->fetchRow();
     $bib = new Biblio();
     $bib->setBibid($array["bibid"]);
     $bib->setCreateDt($array["create_dt"]);
     $bib->setLastChangeDt($array["last_change_dt"]);
     $bib->setLastChangeUserid($array["last_change_userid"]);
     if (isset($array["username"])) {
         $bib->setLastChangeUsername($array["username"]);
     }
     $bib->setMaterialCd($array["material_cd"]);
     $bib->setCollectionCd($array["collection_cd"]);
     $bib->setCallNmbr1($array["call_nmbr1"]);
     $bib->setCallNmbr2($array["call_nmbr2"]);
     $bib->setCallNmbr3($array["call_nmbr3"]);
     if ($array["opac_flg"] == "Y") {
         $bib->setOpacFlg(true);
     } else {
         $bib->setOpacFlg(false);
     }
     /***********************************************************
      *  Reading biblio_field data
      ***********************************************************/
     # setting query that will return all the data in biblio
     $sql = $this->mkSQL("select biblio_field.* " . "from biblio_field " . "where biblio_field.bibid = %N " . "order by tag, subfield_cd ", $bibid);
     if (!$this->_query($sql, $this->_loc->getText("biblioQueryQueryErr2"))) {
         return false;
     }
     /***********************************************************
      *  Adding fields from biblio to Biblio object 
      ***********************************************************/
     foreach ($this->_fieldsInBiblio as $key => $name) {
         $tag = substr($key, 0, 3);
         $subfieldCd = substr($key, 3, 1);
         $subfieldIdx = '';
         if (count($key) > 4) {
             $index = substr($key, 4);
         }
         $this->_addField($tag, $subfieldCd, $array[$name], $bib, $subfieldIdx);
     }
     /***********************************************************
      *  Adding fields from biblio_field to Biblio object 
      ***********************************************************/
     # subfieldIdx will be used to construct index
     $subfieldIdx = 0;
     $saveTag = "";
     $saveSubfield = "";
     while ($array = $this->_conn->fetchRow()) {
         $tag = $array["tag"];
         $subfieldCd = $array["subfield_cd"];
         if ($tab == "opac" and in_array($tag . $subfieldCd, $exclude)) {
             continue;
         }
         # checking for tag and subfield break in order to set the subfield Idx correctly.
         if ($tag == $saveTag and $subfieldCd == $saveSubfield) {
             $subfieldIdx = $subfieldIdx + 1;
         } else {
             $subfieldIdx = 0;
             $saveTag = $tag;
             $saveSubfield = $subfieldCd;
         }
         # setting the index.
         # format is ttts[i] where
         #    t=tag
         #    s=subfield code
         #    i=subfield index if > 0
         # examples: 020a 650a 650a1 650a2
         $index = sprintf("%03d", $tag) . $subfieldCd;
         if ($subfieldIdx > 0) {
             $index = $index . $subfieldIdx;
         }
         $bibFld = new BiblioField();
         $bibFld->setBibid($array["bibid"]);
         $bibFld->setFieldid($array["fieldid"]);
         $bibFld->setTag($array["tag"]);
         $bibFld->setInd1Cd($array["ind1_cd"]);
         $bibFld->setInd2Cd($array["ind2_cd"]);
         $bibFld->setSubfieldCd($array["subfield_cd"]);
         $bibFld->setFieldData($array["field_data"]);
         $bib->addBiblioField($index, $bibFld);
     }
     return $bib;
 }
}
include "../shared/header.php";
require_once "import_usmarc_excludes.php";
$recordterminator = "";
$fieldterminator = "";
$delimiter = "";
$usmarc_str = fileGetContents($_FILES["usmarc_data"]["tmp_name"]);
$records = explode($recordterminator, $usmarc_str);
// We separated with a terminator, so the last element will always be empty.
array_pop($records);
$biblios = array();
foreach ($records as $record) {
    $biblio = new Biblio();
    $biblio->setLastChangeUserid($_POST["userid"]);
    $biblio->setMaterialCd($_POST["materialCd"]);
    $biblio->setCollectionCd($_POST["collectionCd"]);
    $biblio->setOpacFlg($_POST["opac"] == 'Y');
    $start = substr($record, 12, 5);
    $header = substr($record, 24, $start - 25);
    $codes = array();
    for ($l = 0; $l < strlen($header); $l += 12) {
        $code = substr($header, $l, 12);
        $codes[] = substr($code, 0, 3);
    }
    $j = 0;
    foreach (explode($fieldterminator, substr($record, $start)) as $field) {
        if ($codes[$j][0] == '0' and $codes[$j][1] == '0') {
            $j++;
            continue;
            // We don't support control fields yet
        }
Пример #6
0
 function _getBiblio($post)
 {
     require_once "Biblio.php";
     require_once "BiblioField.php";
     $biblio = new Biblio();
     $biblio->setMaterialCd($post["materialCd"]);
     $biblio->setCollectionCd($post["collectionCd"]);
     $biblio->setCallNmbr1($post["callNmbr1"]);
     $biblio->setLastChangeUserid($_SESSION["userid"]);
     $biblio->setOpacFlg($post["opac"]);
     unset($post['callNmbr1'], $post['callNmbr2'], $post['callNmbr3'], $post['collectionCd'], $post['materialCd'], $post["opac"]);
     $post['020a'] = $this->verifyISBN($post['020a']);
     $title_trail = substr($post['245a'], strlen($post['245a']) - 1);
     if ($title_trail == '/' || $title_trail == ':') {
         $post['245a'] = substr($post['245a'], 0, -1);
     }
     foreach ($post as $index => $val) {
         $value = $val;
         $fieldid = '';
         $tag = 0 + substr($index, 0, 3);
         $subfieldCd = substr($index, 3, 1);
         $requiredFlg = '';
         if ($index == '100a' || $index == '245a') {
             // Author, Title
             $requiredFlg = 1;
         }
         $biblioFld = new BiblioField();
         $biblioFld->setFieldid($fieldid);
         $biblioFld->setTag($tag);
         $biblioFld->setSubfieldCd($subfieldCd);
         $biblioFld->setIsRequired($requiredFlg);
         $biblioFld->setFieldData($value);
         $biblio->addBiblioField($index, $biblioFld);
     }
     return $biblio;
 }
Пример #7
0
// TODO: For import of multiple copies, introduce copies array?
foreach ($records as $record) {
    $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;