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; }
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 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; }
#**************************************************************************** $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"); } $fld->setFieldData($_POST["fieldData"]); $fld->setIsRequired(true); $_POST["fieldData"] = $fld->getFieldData(); $validData = $fld->validateData(); if (!$validData) { $pageErrors["fieldData"] = $fld->getFieldDataError(); $pageErrors["tag"] = $fld->getTagError(); $pageErrors["subfieldCd"] = $fld->getSubfieldCdError(); $_SESSION["postVars"] = $_POST; $_SESSION["pageErrors"] = $pageErrors; header("Location: ../catalog/biblio_marc_edit_form.php"); exit;