* See the file COPYRIGHT.html for more details. */ require_once "../shared/common.php"; $tab = "circulation"; $nav = "mbr_renew_all"; $restrictInDemo = true; require_once "../shared/logincheck.php"; require_once "../classes/MemberQuery.php"; require_once "../classes/BiblioSearchQuery.php"; require_once "../classes/CircQuery.php"; require_once "../classes/Date.php"; require_once "../functions/errorFuncs.php"; require_once "../functions/formatFuncs.php"; require_once "../classes/Localize.php"; $loc = new Localize(OBIB_LOCALE, $tab); $mbrid = @trim($_GET["mbrid"]); $mbrQ = new MemberQuery(); $mbr = $mbrQ->get($mbrid); $circQ = new CircQuery(); $biblioQ = new BiblioSearchQuery(); if (!$biblioQ->doQuery(OBIB_STATUS_OUT, $mbrid)) { Fatal::dbError($biblioQ->getSQL(), 'doQuery failed', $biblioQ->getDbError()); } while ($biblio = $biblioQ->fetchRow()) { $err = $circQ->checkout_e($mbr->getBarcodeNmbr(), $biblio->getBarcodeNmbr()); if ($err) { header("Location: ../circ/mbr_view.php?mbrid=" . U($mbrid) . "&msg=" . U($err->toStr())); exit; } } header("Location: ../circ/mbr_view.php?mbrid=" . U($mbrid) . "&msg=" . U($loc->getText("All items renewed.")));
function _act($sql) { if (!$this->_link) { Fatal::internalError('Tried to make database query before connection.'); } $r = mysql_query($sql, $this->_link); if ($r === false) { if (mysql_errno() == 1146 && preg_match('/' . OBIB_DATABASE . '.settings/i', mysql_error())) { // Settings not found header("Location: ../install/"); } Fatal::dbError($sql, 'Database query failed (' . mysql_errno() . ')', mysql_error()); } return $r; }
function _act($sql) { if (!$this->_link) { Fatal::internalError('Tried to make database query before connection.'); } $r = mysql_query($sql, $this->_link); if ($r === false) { Fatal::dbError($sql, 'Database query failed', mysql_error()); } return $r; }
$locale = $_POST['locale']; } if (isset($_POST['installTestData'])) { $installTestData = $_POST["installTestData"] == "yes"; } include "../install/header.php"; ?> <br> <h1>OpenBiblio Installation:</h1> <?php # testing connection and current version $installQ = new InstallQuery(); $err = $installQ->connect_e(); if ($err) { Fatal::dbError($e->sql, $e->msg, $e->dberror); } $version = $installQ->getCurrentDatabaseVersion(); echo "Database connection is good.<br>\n"; #************************************************************************************ #* show warning message if database exists. #************************************************************************************ if ($version) { if (!isset($_POST["confirm"]) or $_POST["confirm"] != "yes") { ?> <form method="POST" action="../install/install.php"> OpenBiblio (version <?php echo H($version); ?> ) is already installed. Are you sure you want to delete all library data and create new OpenBiblio
function UseLinkCharset($usecharset) { $tocharset = $this->CharSet2MySQL($usecharset); if (strlen($tocharset) <= 0) { Fatal::dbError($usecharset, "connect charset:" . $tocharset . " obibcharset:" . OBIB_CHARSET, 'No DBMS error.'); } if ($this->_linkcharset == $tocharset) { return true; } $sql = "set names " . $tocharset; if (!$this->_act($sql)) { return false; } $sql = "set character_set_connection=" . $tocharset; if (!$this->_act($sql)) { return false; } $this->_linkcharset = $tocharset; return true; }
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; }
function Lookup($look4type, $type, &$words, $page, $sortBy, $searches = NULL) { global $SearchTagsSelector; global $SearchCriteriaSelector; if (!$searches) { $searches = array(new BiblioSearchQueryItem($type, $words)); } //$lookupword = $words[0]; $lookupword = $words[count($words) - 1]; //$lookupword = $searches[0]->_words[0]; //Fatal::dbError($this->decoratedWord($lookupword), "db report charset ".OBIB_CHARSET, 'sql ok'); $src = $this->makeSearch($searches, $page, "", false); if (!$src) { return false; } if (!isset($SearchCriteriaSelector[$look4type])) { Fatal::dbError($sql, 'Database query report', 'no OBIB_SEARCH_AUTHOR criteria'); } if (!isset($SearchTagsSelector[$look4type])) { Fatal::dbError($sql, 'Database query report', 'no OBIB_SEARCH_AUTHOR tags'); } $union = ""; $criterias = SearchCriteriaFields($look4type); $lookuptable = 'LookupContent'; $this->act('drop table if exists ' . $lookuptable); $this->act($this->mkSQL("create temporary table %I (lookup varchar(127) character set " . $this->CharSet2MySQL(DB_CHARSET) . " null)", $lookuptable)); //temporary for ($i = 0; $i < count($criterias); $i++) { //!!! since mySQL cant use temporary table in single query twice, have to copy it in separate tempoparies for unioning $sql = $this->mkSQL("insert ignore into %I (lookup) select distinct %i as lookup from (%i)", $lookuptable, $this->ExtractColName($criterias[$i]), $this->_lastSelect); //Fatal::dbError($sql, "db report", 'sql ok'); //$this->DumpSQL("Lookup collect ".$this->ExtractColName($criterias[$i]), $sql); $this->act($sql); } $tags = $SearchTagSelector[$look4type]; if (strlen($tags) > 0) { $sql = $this->mkSQL("insert ignore into %I (lookup) \n\t\t\t\t\tselect distinct field_data as lookup from biblio_field where (" . $tags . " and (bibid in (select bibid from %i)))", $lookuptable, $this->_lastSelect); //$this->DumpSQL("Lookup select tags ".$tags, $sql); $this->act($sql); } $drop = 1; $sql = $this->mkSQL("select distinct lookup from %I as src where src.lookup like %Q ", $lookuptable, $this->decoratedWord($lookupword)); if (strlen($sortBy) > 0) { $sql .= " ORDER BY lookup "; if (mb_substr($sortBy, 0, -1, OBIB_CHARSET) == '-') { $sql .= " DESC "; } } //Fatal::dbError($sql, "db report charset ".OBIB_CHARSET, 'sql ok for:'.$words); # setting limit so we can page through the results if ($page > 0) { $offset = ($page - 1) * $this->_itemsPerPage; } else { $offset = -$page; } $limit = $this->_itemsPerPage; $sql .= $this->mkSQL(" limit %N, %N", $offset, $limit); //Fatal::dbError($sql, "db report", 'sql ok'); //$this->DumpSQL("Lookup select ", $sql); # Running search sql statement $result = $this->select($sql); return $result; }