예제 #1
0
 function get1($table, $code)
 {
     $rows = $this->_get($table, $code);
     if (count($rows) != 1) {
         Fatal::internalError("Invalid domain table code");
     }
     return $this->_mkObj($rows[0]);
 }
예제 #2
0
 function render($rpt)
 {
     $cols = $rpt->columns();
     $colspacing = 0.125;
     $total = 0;
     $totalspacing = 0;
     for ($i = 0; $i < count($cols); $i++) {
         if (isset($cols[$i]['hidden'])) {
             continue;
         }
         if (!isset($cols[$i]['width'])) {
             $cols[$i]['width'] = 1;
         }
         $total += $cols[$i]['width'];
         $totalspacing += $colspacing;
     }
     $totalspacing -= $colspacing;
     if ($total <= 0) {
         Fatal::internalError('Total width of columns must be positive');
     }
     # We have 7.5in, distribute it weighted by width
     $unit = (7.5 - $totalspacing) / $total;
     $lay = new Lay();
     $lay->container('Columns', array('margin-left' => '0.5in', 'margin-right' => '0.5in', 'margin-top' => '0.5in', 'margin-bottom' => '0.5in'));
     if ($rpt->title()) {
         $lay->pushFont('Times-Bold', 18);
         $lay->container('TextLine', array('x-align' => 'center'));
         $lay->text($rpt->title());
         $lay->close();
         $lay->popFont();
     }
     $lay->pushFont('Times-Italic', 12);
     $lay->container('Line', array('x-spacing' => $colspacing . 'in'));
     foreach ($cols as $col) {
         if (isset($col['hidden'])) {
             continue;
         }
         $lay->container('TextLine', array('width' => $unit * $col['width'] . 'in', 'underline' => 1));
         $lay->text($col['title']);
         $lay->close();
     }
     $lay->close();
     $lay->popFont();
     while ($row = $rpt->each()) {
         $lay->container('Line', array('x-spacing' => $colspacing . 'in'));
         foreach ($cols as $col) {
             if (isset($col['hidden'])) {
                 continue;
             }
             $lay->container('TextLine', array('width' => $unit * $col['width'] . 'in'));
             $lay->text($row[$col['name']]);
             $lay->close();
         }
         $lay->close();
     }
     $lay->close();
     $lay->close();
 }
예제 #3
0
 function get($material_cd, $classification)
 {
     $sql = "select mat.code material_cd, mat.description material_type, " . "class.code classification, class.description classification_type, " . "ifnull(privs.checkout_limit, 0) checkout_limit, " . "ifnull(privs.renewal_limit, 0) renewal_limit " . "from material_type_dm mat join mbr_classify_dm class " . "left join checkout_privs privs " . "on privs.material_cd=mat.code " . "and privs.classification=class.code " . $this->mkSQL("where mat.code=%N and class.code=%N ", $material_cd, $classification) . "order by material_type, classification ";
     $rows = $this->exec($sql);
     if (count($rows) != 1) {
         Fatal::internalError("Wrong number of checkout privilege rows");
     }
     return $rows[0];
 }
예제 #4
0
파일: Error.php 프로젝트: aimakun/odlib
 function dbError($sql, $msg, $dberror)
 {
     global $_Error_FatalHandler;
     if (method_exists($_Error_FatalHandler, 'dbError')) {
         $_Error_FatalHandler->dbError($sql, $msg, $dberror);
     } else {
         Fatal::error('Database Error: ' . $msg . ' in query: ' . $sql . ' DBMS says: ' . $dberror);
     }
 }
예제 #5
0
 function getWithStats($table)
 {
     $this->_tableNm = $table;
     if ($table == "collection_dm") {
         $sql = "select collection_dm.*, count(biblio.bibid) row_count ";
         $sql .= "from collection_dm left join biblio on collection_dm.code = biblio.collection_cd ";
         $sql .= "group by 1, 2, 3, 4, 5 ";
     } elseif ($table == "material_type_dm") {
         $sql = "select material_type_dm.*, count(biblio.bibid) row_count ";
         $sql .= "from material_type_dm left join biblio on material_type_dm.code = biblio.material_cd ";
         $sql .= "group by 1, 2, 3, 4 ";
     } elseif ($table == "mbr_classify_dm") {
         $sql = "select mbr_classify_dm.*, count(member.mbrid) row_count ";
         $sql .= "from mbr_classify_dm left join member on mbr_classify_dm.code = member.classification ";
         $sql .= "group by 1, 2, 3, 4 ";
     } else {
         Fatal::internalError("Cannot retrieve stats for that dm table");
     }
     $sql .= "order by description ";
     return array_map(array($this, '_mkObj'), $this->exec($sql));
 }
예제 #6
0
 function render($rpt)
 {
     list($rpt, $errs) = $rpt->variant_el(array('order_by' => 'member'));
     if (!empty($errs)) {
         Fatal::internalError('Unexpected report error');
     }
     $mbrQ = new MemberQuery();
     $lay = new Lay();
     $lay->pushFont('Helvetica', 10);
     $lay->container('Columns', array('margin-left' => '1in', 'margin-right' => '1in', 'margin-top' => '1in', 'margin-bottom' => '1in'));
     $mbr = NULL;
     $oldmbr = NULL;
     while ($row = $rpt->each()) {
         if ($row['mbrid'] != $oldmbr) {
             if ($oldmbr !== NULL) {
                 $lay->close();
                 $lay->container('Columns', array('margin-left' => '1in', 'margin-right' => '1in', 'margin-top' => '1in', 'margin-bottom' => '1in'));
             }
             $mbr = $mbrQ->get($row['mbrid']);
             $oldmbr = $row['mbrid'];
             $lay->container('Column', array('margin-left' => '3.25in'));
             $lay->container('TextLine');
             $lay->text(date('m/d/Y'));
             $lay->close();
             $lay->element('Spacer', array('height' => 14));
             $lines = array(OBIB_LIBRARY_NAME, '101 1st Street', 'Busytown, IA 11111-2222', 'phone: ' . OBIB_LIBRARY_PHONE, 'hours: ' . OBIB_LIBRARY_HOURS);
             foreach ($lines as $l) {
                 $lay->container('TextLine');
                 $lay->text($l);
                 $lay->close();
             }
             $lay->close();
             $lay->element('Spacer', array('height' => 14));
             $lay->container('TextLine');
             $lay->text($mbr->getFirstName() . ' ' . $mbr->getLastName());
             $lay->close();
             foreach (explode("\n", $mbr->getAddress()) as $l) {
                 $lay->container('TextLine');
                 $lay->text($l);
                 $lay->close();
             }
             $lay->element('Spacer', array('height' => 14));
             $lay->container('TextLine');
             $lay->text('Dear ' . $mbr->getFirstName() . ' ' . $mbr->getLastName() . ':');
             $lay->close();
             $lay->element('Spacer', array('height' => 9));
             $lay->container('Paragraph');
             $lay->container('TextLines');
             $lay->text('Our records show that the following library items ' . 'are checked out under your name and are past due.  Please ' . 'return them as soon as possible and pay any late fees due.');
             $lay->close();
             $lay->close();
             $lay->element('Spacer', array('height' => 28));
             $lay->container('TextLine');
             $lay->text('Sincerely,');
             $lay->close();
             $lay->element('Spacer', array('height' => 14));
             $lay->container('TextLine');
             $lay->text('The library staff at ' . OBIB_LIBRARY_NAME);
             $lay->close();
             $lay->element('Spacer', array('height' => 14));
             $lay->pushFont('Times-Italic', 12);
             $lay->container('Line');
             $lay->container('TextLine', array('width' => '1.5in', 'underline' => 1));
             $lay->text('Title');
             $lay->close();
             $lay->container('TextLine', array('width' => '1.5in', 'underline' => 1));
             $lay->text('Author');
             $lay->close();
             $lay->container('TextLine', array('width' => '1in', 'underline' => 1));
             $lay->text('Due Date');
             $lay->close();
             $lay->container('TextLine', array('width' => '0.75in', 'underline' => 1));
             $lay->text('Days Late');
             $lay->close();
             $lay->close();
             $lay->popFont();
         }
         $lay->container('Line');
         $lay->container('TextLine', array('width' => '1.5in'));
         $lay->text($row['title']);
         $lay->close();
         $lay->container('TextLine', array('width' => '1.5in'));
         $lay->text($row['author']);
         $lay->close();
         $lay->container('TextLine', array('width' => '1in'));
         $lay->text(date('m/d/y', strtotime($row['due_back_dt'])));
         $lay->close();
         $lay->container('TextLine', array('width' => '0.75in'));
         $lay->text($row['days_late']);
         $lay->close();
         $lay->close();
     }
     $lay->close();
     $lay->popFont();
     $lay->close();
 }
$postVars = array();
$pageErrors = array();
if (isset($_GET["xref_id"])) {
    $xref_id = $_GET["xref_id"];
    $postVars["xref_id"] = $xref_id;
    if (!isset($_GET["materialCd"])) {
        Fatal::internalError('no material code set');
    }
    $materialCd = $_GET["materialCd"];
    $postVars["materialCd"] = $materialCd;
    $matQ = new MaterialFieldQuery();
    $matQ->connect();
    $row = $matQ->get1($xref_id);
    $matQ->close();
    if ($row === NULL) {
        Fatal::internalError('bad xref ID');
    }
    $postVars["tag"] = $row["tag"];
    $postVars["subfieldCd"] = $row["subfieldCd"];
    $postVars["descr"] = $row["descr"];
    $postVars["required"] = $row["required"];
    $postVars["cntrltype"] = $row["cntrltype"];
} else {
    if (isset($_SESSION['postVars'])) {
        $postVars = $_SESSION['postVars'];
        if (isset($_SESSION['pageErrors'])) {
            $pageErrors = $_SESSION['pageErrors'];
        }
        $xref_id = $postVars['xref_id'];
        $materialCd = $postVars['materialCd'];
    }
예제 #8
0
 function _exec($code, $scope)
 {
     $query = '';
     foreach ($code as $c) {
         switch ($c[0]) {
             case 'sqlcode':
                 list(, $sql) = $c;
                 $query .= $sql;
                 break;
             case 'value':
                 list(, $name, $conv) = $c;
                 list($type, $value) = $scope->getFirst($name);
                 $query .= $this->q->mkSQL($conv, $value);
                 break;
             case 'if_set':
                 list(, $name, $then, $else) = $c;
                 if ($scope->exists($name)) {
                     $query .= $this->_exec($then, $scope);
                 } else {
                     $query .= $this->_exec($else, $scope);
                 }
                 break;
             case 'if_equal':
                 list(, $name, $value, $then, $else) = $c;
                 if (!$scope->exists($name)) {
                     $query .= $this->_exec($else, $scope);
                 } else {
                     list($t, $v) = $scope->getFirst($name);
                     if ($v == $value) {
                         $query .= $this->_exec($then, $scope);
                     } else {
                         $query .= $this->_exec($else, $scope);
                     }
                 }
                 break;
             case 'if_not_equal':
                 list(, $name, $value, $then, $else) = $c;
                 if (!$scope->exists($name)) {
                     $query .= $this->_exec($then, $scope);
                 } else {
                     list($t, $v) = $scope->getFirst($name);
                     if ($v != $value) {
                         $query .= $this->_exec($then, $scope);
                     } else {
                         $query .= $this->_exec($else, $scope);
                     }
                 }
                 break;
             case 'foreach_parameter':
             case 'foreach_word':
                 list($type, $name, $block) = $c;
                 if ($type == 'foreach_parameter') {
                     $vlist = $scope->getList($name);
                 } else {
                     include_once "../classes/Search.php";
                     list($t, $v) = $scope->getFirst($name);
                     if ($t != "string") {
                         Fatal::internalError('$t != "string"');
                     }
                     $vlist = array();
                     foreach (Search::explodeQuoted($v) as $w) {
                         $vlist[] = array('string', $w);
                     }
                 }
                 foreach ($vlist as $v) {
                     list($type, $value) = $v;
                     $s = $scope->copy();
                     $s->set($name, $type, $value);
                     $query .= $this->_exec($block, $s);
                 }
                 break;
             case 'order_by_expr':
                 if ($v = $scope->getFirst('order_by')) {
                     list($type, $value, $raw) = $v;
                     if ($type != "order_by") {
                         Fatal::internalError('$type != "order_by"');
                     }
                     $query .= 'order by ' . $value . ' ';
                 }
                 break;
             default:
                 Fatal::internalError("Can't happen");
                 break;
         }
     }
     return $query;
 }
    $postVars["materialCd"] = $materialCd;
    $postVars["tag"] = "";
    $postVars["subfieldCd"] = "";
    $postVars["descr"] = "";
    $postVars["required"] = "";
} else {
    if (isset($_SESSION['postVars'])) {
        $postVars = $_SESSION['postVars'];
        if (isset($_SESSION['pageErrors'])) {
            $pageErrors = $_SESSION['pageErrors'];
        }
        $materialCd = $postVars['materialCd'];
    }
}
if (!isset($materialCd) || $materialCd == "") {
    Fatal::internalError('no material code set');
}
if (isset($_GET["tag"])) {
    $postVars["tag"] = $_GET["tag"];
}
if (isset($_GET["subfld"])) {
    $postVars["subfieldCd"] = $_GET["subfld"];
}
if (isset($_GET["descr"])) {
    $postVars["descr"] = $_GET["descr"];
}
require_once "../shared/header.php";
$returnPg = "../admin/custom_marc_add_form.php?materialCd=" . U($materialCd);
$fieldid = "";
$cancelLocation = "../admin/custom_marc_view.php?materialCd={$materialCd}";
if (isset($_GET["msg"])) {
    $selectedSubfld = $field->getSubfieldCd();
} else {
    $postVars = $_SESSION['postVars'];
    if (isset($_SESSION['pageErrors'])) {
        $pageErrors = $_SESSION['pageErrors'];
    }
    $bibid = $postVars["bibid"];
    $fieldid = $postVars["fieldid"];
    $selectedTag = $postVars["tag"];
    $selectedSubfld = $postVars["subfieldCd"];
}
if (!isset($bibid) || $bibid == "") {
    Fatal::internalError('no bibid set');
}
if (!isset($fieldid) || $fieldid == "") {
    Fatal::internalError('no fieldid set');
}
if (isset($_GET["tag"])) {
    $selectedTag = $_GET["tag"];
    $postVars["tag"] = $selectedTag;
}
if (isset($_GET["subfld"])) {
    $selectedSubfld = $_GET["subfld"];
    $postVars["subfieldCd"] = $selectedSubfld;
}
require_once "../shared/header.php";
#****************************************************************************
#*  Read for field value descriptions
#****************************************************************************
getTagDesc($selectedTag, $selectedSubfld, $tagDesc, $subfldDesc, $ind1Desc, $ind2Desc);
$formLabel = $loc->getText("biblioMarcEditFormHdr");
예제 #11
0
 function _shelving_cart_e($bcode, $date, $force)
 {
     $info = array('mbrid' => NULL, 'bibid' => NULL, 'hold' => NULL);
     if ($date === NULL) {
         list($date, $err) = Date::read_e('today');
         if ($err) {
             Fatal::internalError("Unexpected date error: " . $err);
         }
         $earliest = $latest = time();
     } else {
         list($date, $err) = Date::read_e($date);
         if ($err) {
             return array($info, new Error($this->_loc->getText("Can't understand date: %err%", array('err' => $err->toStr()))));
         }
         $earliest = strtotime($date . " 00:00:00");
         $latest = strtotime($date . " 23:59:59");
     }
     if ($earliest > time()) {
         return array($info, new Error($this->_loc->getText("Won't do checkins for future dates.")));
     }
     $copyQ = new BiblioCopyQuery();
     $copy = $copyQ->maybeGetByBarcode($bcode);
     if (!$copy) {
         return array($info, new Error($this->_loc->getText("Bad copy barcode: %bcode%", array('bcode' => $bcode))));
     }
     $info['bibid'] = $copy->getBibid();
     $fee = $copyQ->getDailyLateFee($copy);
     $mbrid = $info['mbrid'] = $copy->getMbrid();
     if ($copy->getDueBackDt()) {
         // FIXME: Y2K38. This temporary fix should prevent unjust late fee when Override Due Date was used.
         if (strtotime($copy->getDueBackDt()) != false && strtotime($copy->getDueBackDt()) != -1) {
             $late = $info['late'] = Date::daysLater($date, $copy->getDueBackDt());
         }
     }
     $holdQ = new BiblioHoldQuery();
     $hold = $info['hold'] = $holdQ->maybeGetFirstHold($copy->getBibid(), $copy->getCopyid());
     if ($hold) {
         $copy->setStatusCd(OBIB_STATUS_ON_HOLD);
     } else {
         $copy->setStatusCd(OBIB_STATUS_SHELVING_CART);
     }
     $oldtime = strtotime($copy->getStatusBeginDt());
     if ($oldtime > $latest) {
         return array($info, new Error($this->_loc->getText("Can't change status to an earlier date on item %bcode%.", array('bcode' => $bcode))));
     } else {
         if ($oldtime == $latest) {
             return array($info, new Error($this->_loc->getText("Can't change status more than once per second on item %bcode%.", array('bcode' => $bcode))));
         } else {
             if ($oldtime < $earliest) {
                 $time = date('Y-m-d H:i:s', $earliest);
             } else {
                 $time = date('Y-m-d H:i:s', $oldtime + 1);
             }
         }
     }
     $copy->setMbrid("");
     $copy->setStatusBeginDt($time);
     $copy->setDueBackDt("");
     if (!$copyQ->updateStatus($copy)) {
         Fatal::InternalError("Impossible copyQ update error.");
     }
     if ($mbrid != "" and $late > 0 and $fee > 0) {
         $trans = new MemberAccountTransaction();
         $trans->setMbrid($mbrid);
         $trans->setCreateUserid($_SESSION['userid']);
         $trans->setTransactionTypeCd("+c");
         $trans->setAmount($fee * $late);
         $trans->setDescription($this->_loc->getText("Late fee (barcode=%barcode%)", array('barcode' => $bcode)));
         $transQ = new MemberAccountQuery();
         if (!$transQ->insert($trans)) {
             Fatal::internalError("Impossible transQ insert error.");
         }
     }
     $hist = new BiblioStatusHist();
     $hist->setBibid($copy->getBibid());
     $hist->setCopyid($copy->getCopyid());
     $hist->setStatusCd($copy->getStatusCd());
     $hist->setStatusBeginDt($copy->getStatusBeginDt());
     $hist->setDueBackDt($copy->getDueBackDt());
     $hist->setMbrid($mbrid);
     $histQ = new BiblioStatusHistQuery();
     if (!$histQ->insert($hist)) {
         Fatal::internalError("Impossible histQ insert error.");
     }
     return array($info, NULL);
 }
예제 #12
0
 function mkSQL()
 {
     $n = func_num_args();
     if ($n < 1) {
         Fatal::internalError('Not enough arguments given to mkSQL().');
     }
     $i = 1;
     $SQL = "";
     $fmt = func_get_arg(0);
     while (strlen($fmt)) {
         $p = strpos($fmt, "%");
         if ($p === false) {
             $SQL .= $fmt;
             break;
         }
         $SQL .= substr($fmt, 0, $p);
         if (strlen($fmt) < $p + 2) {
             Fatal::internalError('Bad mkSQL() format string.');
         }
         if ($fmt[$p + 1] == '%') {
             $SQL .= "%";
         } else {
             if ($i >= $n) {
                 Fatal::internalError('Not enough arguments given to mkSQL().');
             }
             $arg = func_get_arg($i++);
             switch ($fmt[$p + 1]) {
                 case '!':
                     /* very dangerous, but sometimes very useful -- be careful */
                     $SQL .= $arg;
                     break;
                 case 'B':
                     if ($arg) {
                         $SQL .= "'Y'";
                     } else {
                         $SQL .= "'N'";
                     }
                     break;
                 case 'C':
                     $a = array();
                     foreach (explode('.', $arg) as $ident) {
                         array_push($a, '`' . $this->_ident($ident) . '`');
                     }
                     $SQL .= implode('.', $a);
                     break;
                 case 'I':
                     $SQL .= '`' . $this->_ident($arg) . '`';
                     break;
                 case 'i':
                     $SQL .= $this->_ident($arg);
                     break;
                 case 'N':
                     $SQL .= $this->_numstr($arg);
                     break;
                 case 'Q':
                     $SQL .= "'" . mysql_real_escape_string($arg, $this->_link) . "'";
                     break;
                 case 'q':
                     $SQL .= mysql_real_escape_string($arg, $this->_link);
                     break;
                 default:
                     Fatal::internalError('Bad mkSQL() format string.');
             }
         }
         $fmt = substr($fmt, $p + 2);
     }
     if ($i != $n) {
         Fatal::internalError('Too many arguments to mkSQL().');
     }
     return $SQL;
 }
예제 #13
0
 function variant_el($newParams, $newName = NULL)
 {
     assert('is_array($this->cache["params"])');
     if ($newName === NULL) {
         $newName = $this->name;
     }
     list($rpt, $err) = Report::create_e($this->cache['type'], $newName);
     if ($err) {
         Fatal::internalError("Unexpected report creation error: " . $err->toStr());
     }
     $params = new Params();
     $params->loadDict($this->cache['params']);
     $errs = $params->load_el($rpt->rpt->paramDefs(), $newParams);
     if (!empty($errs)) {
         return array(NULL, $errs);
     }
     $errs = $rpt->_init_el($params);
     if (!empty($errs)) {
         return array(NULL, $errs);
     }
     return array($rpt, array());
 }
예제 #14
0
<?php

/* This file is part of a copyrighted work; it is distributed with NO WARRANTY.
 * See the file COPYRIGHT.html for more details.
 */
$tab = "install";
//jalg para uso de multi-idioma
$locale = $_POST['locale'];
//jalg para uso de multi-idioma
if (isset($_POST['locale'])) {
    if (!preg_match('/^[-_a-zA-Z0-9]+$/', $_POST['locale'])) {
        Fatal::internalError("Bad locale name.");
    }
    $locale = $_POST['locale'];
}
$doing_install = true;
require_once "../shared/common.php";
require_once "../classes/UpgradeQuery.php";
//    require_once("../css/style.css");
include "../install/header.php";
require_once "../classes/Localize.php";
//jalg para uso de multi-idioma
$loc = new Localize($locale, $tab);
//jalg para uso de multi-idioma
?>
<br>
<h3><?php 
echo $loc->getText("update_start");
?>
:</h3>
예제 #15
0
 function executeSqlFile($filename, $tablePrfx = DB_TABLENAME_PREFIX, $Quiet = false)
 {
     $fp = false;
     if (!file_exists($filename)) {
         $filename = absolutePath($filename);
     }
     if (file_exists($filename)) {
         $fp = fopen($filename, "r");
     }
     # show error if file could not be opened
     if ($fp == false) {
         if ($Quiet) {
             return false;
         }
         Fatal::error("Error reading file: " . H($filename));
     } else {
         $dir = dirname($filename);
         $sql_charset = DB_CHARSET;
         if (file_exists($dir . "/sqlcharset.php")) {
             include $dir . "/sqlcharset.php";
         }
         $this->UseLinkCharset($sql_charset);
         $sqlStmt = "";
         while (!feof($fp)) {
             $char = fgetc($fp);
             $sqlStmt .= $char;
             if ($char == ";") {
                 //replace table prefix, we're doing it here as the install script may
                 //want to override the required prefix (eg. during upgrade / conversion
                 //process)
                 $sql = str_replace("%prfx%", $tablePrfx, $sqlStmt);
                 $sql = $this->PreprocessSQL($sql);
                 //replace ENGINE with TYPE for old MySQL versions
                 $MySQLn = explode('.', implode('', explode('-', $this->server_info)));
                 if ($MySQLn[0] < '5') {
                     $sql = str_replace("ENGINE=", "TYPE=", $sql);
                     $sql = str_replace("engine=", "type=", $sql);
                 } else {
                     $sql = str_replace("TYPE=", "ENGINE=", $sql);
                     $sql = str_replace("type=", "engine=", $sql);
                 }
                 $this->exec($sql);
                 $sqlStmt = "";
             }
         }
         fclose($fp);
     }
     return true;
 }
예제 #16
0
 function DupBarcode($barcode, $mbrid = 0)
 {
     $sql = $this->mkSQL("select count(mbrid) as num from member " . "where barcode_nmbr = %Q and mbrid != %Q", $barcode, $mbrid);
     $rows = $this->exec($sql);
     if (count($rows) != 1) {
         Fatal::internalError('Bad number of rows');
     }
     if ($rows[0]['num'] > 0) {
         return true;
     }
     return false;
 }
$loc = new Localize(OBIB_LOCALE, $tab);
if (isset($_GET["msg"])) {
    $msg = "<font class=\"error\">" . H($loc->getText($_GET["msg"])) . "</font><br><br>";
} else {
    $msg = "";
}
require_once "../functions/inputFuncs.php";
require_once "../shared/logincheck.php";
require_once "../classes/MaterialFieldQuery.php";
require_once "../shared/get_form_vars.php";
require_once "../shared/header.php";
require_once "../functions/errorFuncs.php";
if (isset($_GET["materialCd"]) && $_GET["materialCd"] != "") {
    $materialCd = $_GET["materialCd"];
} else {
    Fatal::internalError('materialCd not set');
}
//    Played with printselect function
$postvars["materialCd"] = $materialCd;
// $value=$_GET["materialCd"];
$fieldname = "materialCd";
$domainTable = "material_type_dm";
$dmQ = new DmQuery();
$dmQ->connect();
$dm = $dmQ->get1("material_type_dm", $materialCd);
$material_type = $dm->getDescription();
$dmQ->close();
echo $msg;
?>
<br>	
<a href="custom_marc_add_form.php?materialCd=<?php 
예제 #18
0
 function get($schoolid)
 {
     $sql = $this->mkSQL("select school.*, school.school_name from school " . "left join staff on school.last_change_userid = staff.userid " . "where schoolid=%N ", $schoolid);
     $rows = $this->exec($sql);
     if (count($rows) != 1) {
         Fatal::internalError("Bad Schoolid");
     }
     return $this->_mkObj($rows[0]);
 }
예제 #19
0
 function _cleanFields($fields)
 {
     $defaults = array('name' => NULL, 'title' => NULL, 'type' => 'text', 'default' => '', 'attrs' => array(), 'options' => array(), 'label' => '', 'required' => false);
     for ($i = 0; $i < count($fields); $i++) {
         $fields[$i] = array_merge($defaults, $fields[$i]);
         if (!isset($fields[$i]['name'])) {
             Fatal::internalError(Form::T("No name set for form field."));
         }
         if (!$fields[$i]['title']) {
             $fields[$i]['title'] = $fields[$i]['name'];
         }
     }
     return $fields;
 }
예제 #20
0
}
if (isset($_GET["tag"])) {
    $selectedTag = $_GET["tag"];
} else {
    $selectedTag = "";
}
if (isset($_GET["subfld"])) {
    $selectedSubfld = $_GET["subfld"];
} else {
    $selectedSubfld = "";
}
if (isset($_GET["retpage"])) {
    $retPage = $_GET["retpage"];
    # Sanity check
    if (substr($retPage, 0, 3) != '../') {
        Fatal::internalError('unexpected retPage value');
    }
} else {
    $retPage = "";
}
if (strpos($retPage, '?') === false) {
    $sepchar = '?';
} else {
    $sepchar = '&';
}
#****************************************************************************
#*  Loading up an array ($marcArray) with the USMarc tag descriptions.
#****************************************************************************
$marcBlockDmQ = new UsmarcBlockDmQuery();
$marcBlockDmQ->connect();
if ($marcBlockDmQ->errorOccurred()) {
예제 #21
0
 function get($mbrid)
 {
     $sql = $this->mkSQL("select cdd.* from cdd " . "LIMIT %N ", 100);
     $rows = $this->exec($sql);
     if (count($rows) != 1) {
         Fatal::internalError("Bad mbrid");
     }
     echo "sql=[" . $sql . "]<br>\n";
     return $this->_mkObj($rows[0]);
 }
예제 #22
0
 function init(&$parent, $params)
 {
     parent::init($parent, $params);
     if ($params['scaling'] != 1) {
         Fatal::internalError('Transformer: scaling not implemented');
     }
     if ($params['x-skew'] != 0 or $params['y-skew'] != 0) {
         Fatal::internalError('Transformer: skew not implemented');
     }
     if (abs(fmod($params['rotation'] * 2 / M_PI, 1)) > 0.01) {
         Fatal::internalError('Transformer: rotation is only supported in pi/2 increments');
     }
     $this->setDims();
 }
예제 #23
0
    $postVars["fieldData"] = "";
    $selectedTag = "";
    $selectedSubfld = "";
} else {
    if (isset($_SESSION['postVars'])) {
        $postVars = $_SESSION['postVars'];
        if (isset($_SESSION['pageErrors'])) {
            $pageErrors = $_SESSION['pageErrors'];
        }
        $bibid = $postVars["bibid"];
        $selectedTag = $postVars["tag"];
        $selectedSubfld = $postVars["subfieldCd"];
    }
}
if (!isset($bibid) || $bibid == "") {
    Fatal::internalError('no bibid set');
}
if (isset($_GET["tag"])) {
    $selectedTag = $_GET["tag"];
    $postVars["tag"] = $selectedTag;
}
if (isset($_GET["subfld"])) {
    $selectedSubfld = $_GET["subfld"];
    $postVars["subfieldCd"] = $selectedSubfld;
}
require_once "../shared/header.php";
#****************************************************************************
#*  Read for field value descriptions
#****************************************************************************
if (isset($pageErrors["tag"]) && $pageErrors["tag"] != "") {
    $tagDesc = "";
예제 #24
0
 * 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.")));
예제 #25
0
    $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
예제 #26
0
 function mkSQL()
 {
     $n = func_num_args();
     if ($n < 1) {
         Fatal::internalError('Not enough arguments given to mkSQL().');
     }
     $i = 1;
     $SQL = "";
     $fmt = func_get_arg(0);
     while (strlen($fmt)) {
         $p = strpos($fmt, "%");
         if ($p === false) {
             $SQL .= $fmt;
             break;
         }
         $SQL .= substr($fmt, 0, $p);
         if (strlen($fmt) < $p + 2) {
             Fatal::internalError('Bad mkSQL() format string.');
         }
         if ($fmt[$p + 1] == '%') {
             $SQL .= "%";
         } else {
             if ($i >= $n) {
                 Fatal::internalError('Not enough arguments given to mkSQL().');
             }
             $arg = func_get_arg($i++);
             $FMTCode = $fmt[$p + 1];
             if ($arg != NULL || $FMTCode == 'N') {
                 switch ($FMTCode) {
                     case '!':
                         /* very dangerous, but sometimes very useful -- be careful */
                         $SQL .= $arg;
                         break;
                     case 'B':
                         if ($arg) {
                             $SQL .= "'Y'";
                         } else {
                             $SQL .= "'N'";
                         }
                         break;
                     case 'C':
                         $a = array();
                         foreach (explode('.', $arg) as $ident) {
                             array_push($a, '`' . $this->_ident($ident) . '`');
                         }
                         $SQL .= implode('.', $a);
                         break;
                     case 'L':
                         $a = array();
                         $tokens = explode('.', $arg);
                         foreach ($tokens as $ident) {
                             array_push($a, '`' . $this->_ident($ident) . '`');
                         }
                         if (strlen($this->uselocale) > 0) {
                             $tokens[count($tokens) - 1] .= '_' . $this->uselocale;
                             $loca = array();
                             foreach ($tokens as $ident) {
                                 array_push($loca, '`' . $this->_ident($ident) . '`');
                             }
                             $expr = 'ifnull(' . implode('.', $loca) . ', cast(' . implode('.', $a) . ' as char) )';
                             $SQL .= $expr;
                         } else {
                             $SQL .= implode('.', $a);
                         }
                         break;
                     case 'I':
                         $SQL .= '`' . $this->_ident($arg) . '`';
                         break;
                     case 'i':
                         $SQL .= $this->_ident($arg);
                         break;
                     case 'N':
                         $SQL .= $this->_numstr($arg);
                         break;
                     case 'Q':
                         $SQL .= '\'' . $this->real_escape_string($arg) . '\'';
                         break;
                     case 'S':
                         if ($arg != "") {
                             $SQL .= '\'' . $this->real_escape_string($arg) . '\'';
                         } else {
                             $SQL .= 'null';
                         }
                         break;
                     case 'q':
                         $SQL .= $this->real_escape_string($arg);
                         break;
                     default:
                         Fatal::internalError('Bad mkSQL() format string.');
                 }
             } else {
                 //if ($arg != NULL)
                 $SQL .= "null";
             }
         }
         $fmt = substr($fmt, $p + 2);
     }
     if ($i != $n) {
         Fatal::internalError('Too many arguments to mkSQL().');
     }
     return $SQL;
 }
예제 #27
0
 function getOrderExpr($name, $list, $desc)
 {
     $expr = false;
     foreach ($list as $v) {
         if ($v[0] != $name) {
             continue;
         }
         if (isset($v[1]['expr']) and $v[1]['expr']) {
             $expr = $v[1]['expr'];
         } else {
             $expr = $name;
         }
         if (!isset($v[1]['type']) or !$v[1]['type']) {
             $v[1]['type'] = 'alnum';
         }
         switch ($v[1]['type']) {
             case 'MARC':
                 if (!isset($v[1]['skip_indicator'])) {
                     Fatal::internalError("MARC sort without skip indicator");
                 }
                 $skip = $v[1]['skip_indicator'];
                 $expr = "ifnull(substring({$expr}, {$skip}+1), {$expr})";
                 /* fall through */
             /* fall through */
             case 'alnum':
                 $expr = "if({$expr} regexp '^ *[0-9]', " . "concat('0', ifnull(floor(log10({$expr})), 0), " . "{$expr}), {$expr})" . $desc;
                 break;
             case 'multi':
                 $sorts = explode(',', $expr);
                 $expr = '';
                 foreach ($sorts as $s) {
                     $expr .= ', ' . $this->getOrderExpr(trim($s), $list, $desc);
                 }
                 if ($expr) {
                     $expr = substr($expr, 2);
                     # Lose initial ', '
                 }
                 break;
             default:
                 $expr .= $desc;
                 break;
         }
         break;
     }
     if (!$expr) {
         return '1';
         /* constant expr means no particular order */
     } else {
         return $expr;
     }
 }
예제 #28
0
 function get($locationid)
 {
     $sql = $this->mkSQL("select location.* from biblio_location location" . " where locationid=%N ", $locationid);
     $rows = $this->exec($sql);
     if (count($rows) != 1) {
         Fatal::internalError("Bad Location Id");
     }
     return $this->_mkObj($rows[0]);
 }
예제 #29
0
<?php

/* This file is part of a copyrighted work; it is distributed with NO WARRANTY.
 * See the file COPYRIGHT.html for more details.
 */
if (preg_match('/[^a-zA-Z0-9_]/', $tab)) {
    Fatal::internalError("Possible security violation: bad tab name");
    exit;
    # just in case
}
include "../shared/header_top.php";
?>


<!-- **************************************************************************************
     * Left nav
     **************************************************************************************-->
<table height="100%" width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr bgcolor="<?php 
echo H(OBIB_ALT1_BG);
?>
">
    <td colspan="6"><img src="../images/shim.gif" width="1" height="15" border="0"></td>
  </tr>
  <tr>
    <td bgcolor="<?php 
echo H(OBIB_ALT1_BG);
?>
"><img src="../images/shim.gif" width="10" height="1" border="0"></td>
    <td bgcolor="<?php 
echo H(OBIB_ALT1_BG);
예제 #30
0
<?php

/* This file is part of a copyrighted work; it is distributed with NO WARRANTY.
 * See the file COPYRIGHT.html for more details.
 */
require_once "../shared/common.php";
$tab = 'admin';
require_once "../shared/logincheck.php";
require_once "../classes/MaterialFieldQuery.php";
if (!isset($_GET["xref_id"])) {
    Fatal::internalError('xfref_id not set');
}
$matQ = new MaterialFieldQuery();
$matQ->connect();
$matQ->delete($_GET["xref_id"]);
$matQ->close();
$msg = "Field Successfully Deleted";
header("Location: custom_marc_view.php?materialCd=" . U($_GET["materialCd"]) . "&msg=" . U($msg));