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->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);
    }
    return $biblio;
}
 function fetchField()
 {
     $array = $this->_conn->fetchRow();
     if ($array == false) {
         return false;
     }
     $fld = new BiblioField();
     $fld->setBibid($array["bibid"]);
     $fld->setFieldid($array["fieldid"]);
     $fld->setTag($array["tag"]);
     $fld->setInd1Cd($array["ind1_cd"]);
     $fld->setInd2Cd($array["ind2_cd"]);
     $fld->setSubfieldCd($array["subfield_cd"]);
     $fld->setFieldData($array["field_data"]);
     return $fld;
 }
Exemple #3
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;
}
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->setLanguage($post["language"]);
    $biblio->setOthernumber($post["othernumber"]);
    #print( "input upload = " + $_FILES['input_upload']['size'] );
    //set image location
    if ($_FILES['input_upload']['size'] == 0) {
        $img = DEFAULT_IMAGE;
    } else {
        $img = fileUpload("input_upload");
    }
    $biblio->setImageLocation($img);
    $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;
}
 function fetchField()
 {
     // jalg multi 5-7-2015 ALX
     $array = $this->_conn->fetch_assoc();
     if ($array == false) {
         return false;
     }
     $fld = new BiblioField();
     $fld->setBibid($array["bibid"]);
     $fld->setFieldid($array["fieldid"]);
     $fld->setTag($array["tag"]);
     $fld->setInd1Cd($array["ind1_cd"]);
     $fld->setInd2Cd($array["ind2_cd"]);
     $fld->setSubfieldCd($array["subfield_cd"]);
     $fld->setFieldData($array["field_data"]);
     if (isset($array["copyid"])) {
         $fld->setCopyid($array["copyid"]);
     }
     return $fld;
 }
 function _addField($tag, $subfieldCd, $value, &$bib, $seq = "")
 {
     if ($value == "") {
         return;
     }
     $index = sprintf("%03d", $tag) . $subfieldCd;
     if ($seq != "") {
         $index = $index . $seq;
     }
     $bibFld = new BiblioField();
     $bibFld->setTag($tag);
     $bibFld->setSubfieldCd($subfieldCd);
     $bibFld->setFieldData($value);
     $bib->addBiblioField($index, $bibFld);
 }
    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
        }
        // Skip three characters to drop indicators and the first delimiter.
        foreach (explode($delimiter, substr($field, 3)) as $subfield) {
            $ident = $subfield[0];
            $data = substr($subfield, 1);
            if (in_array($codes[$j] . $ident, $exclude)) {
                continue;
            }
            //echo H("$codes[$j]--$ident--$data")."<br />\n";
            if (trim($data) != "" and trim($codes[$j]) !== "") {
                $f = new BiblioField();
                $f->setTag($codes[$j]);
                $f->setSubfieldCd($ident);
                $f->setFieldData($data);
                $biblio->addBiblioField($codes[$j] . $ident, $f);
            }
        }
        $j++;
    }
    array_push($biblios, $biblio);
}
if ($_POST["test"] == "true") {
    foreach ($biblios as $biblio) {
        echo '<h3>' . $loc->getText("MarcUploadMarcRecord") . '</h3>';
        echo '<table><tr>';
        echo '<th>' . $loc->getText("MarcUploadTag") . '</th>';
if (count($_POST) == 0) {
    header("Location: ../admin/materials_list.php");
    exit;
}
$rec = array();
$rec['materialCd'] = $_POST["materialCd"];
$rec['xref_id'] = $_POST["xref_id"];
$rec['tag'] = $_POST["tag"];
$rec['subfieldCd'] = $_POST["subfieldCd"];
$rec['descr'] = $_POST["descr"];
$rec['required'] = $_POST["required"];
$rec['cntrltype'] = $_POST["cntrltype"];
#****************************************************************************
#*  Validate data
#****************************************************************************
$fld = new BiblioField();
$fld->setTag($_POST["tag"]);
$fld->setSubfieldCd($_POST["subfieldCd"]);
$pageErrors = array();
$validData = $fld->validateData();
if (!$validData) {
    $pageErrors["tag"] = $fld->getTagError();
    $pageErrors["subfieldCd"] = $fld->getSubfieldCdError();
}
if (!$rec['descr']) {
    $pageErrors['descr'] = 'Field is required.';
}
if (!empty($pageErrors)) {
    $_SESSION["postVars"] = $_POST;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../admin/custom_marc_edit_form.php");
require_once "../classes/BiblioFieldQuery.php";
require_once "../functions/errorFuncs.php";
require_once "../classes/Localize.php";
$loc = new Localize(OBIB_LOCALE, $tab);
#****************************************************************************
#*  Checking for post vars.  Go back to form if none found.
#****************************************************************************
if (count($_POST) == 0) {
    header("Location: ../catalog/index.php");
    exit;
}
#****************************************************************************
#*  Validate data
#****************************************************************************
$bibid = $_POST["bibid"];
$fld = new BiblioField();
$fld->setBibid($bibid);
$fld->setFieldid($_POST["fieldid"]);
$fld->setTag($_POST["tag"]);
$_POST["tag"] = $fld->getTag();
$fld->setSubfieldCd($_POST["subfieldCd"]);
$_POST["subfieldCd"] = $fld->getSubfieldCd();
if (isset($_POST["ind1Cd"])) {
    $fld->setInd1Cd("Y");
} else {
    $fld->setInd1Cd("N");
}
if (isset($_POST["ind2Cd"])) {
    $fld->setInd2Cd("Y");
} else {
    $fld->setInd2Cd("N");
 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;
 }
                 $biblio->setOpacFlg(false);
             }
             break;
         case "Call1":
             $biblio->setCallNmbr1($entry);
             break;
         case "Call2":
             $biblio->setCallNmbr2($entry);
             break;
         case "Call3":
             $biblio->setCallNmbr3($entry);
             break;
         default:
             if (preg_match('/^[0-9][0-9]*\\$[a-z]$/', $target)) {
                 $tag = explode('$', $target);
                 $f = new BiblioField();
                 $f->setTag($tag[0]);
                 $f->setSubfieldCd($tag[1]);
                 $f->setFieldData($entry);
                 $biblio->addBiblioField($tag[0] . $tag[1], $f);
             }
             break;
     }
 }
 // Display the biblio. Don't keep it in a array due to memory reasons.
 $validate = $biblio->validateData();
 // Check for uniqueness with existing barcodes and new entries read.
 if ($barcode != "") {
     if (in_array($barcode, $newBarcodes)) {
         array_push($localErrors, $copy->_loc->getText("biblioCopyQueryErr1"));
         $validate = false;