コード例 #1
0
ファイル: offline.php プロジェクト: vishnu35/Granthalay
function run_batch($lines, $date)
{
    global $loc;
    $circQ = new CircQuery();
    $errors = array();
    while (count($lines)) {
        $command = trim(array_shift($lines));
        if ($command == '') {
            continue;
        }
        if ($command[0] != '%') {
            return array($loc->getText("Bad upload file: Expected a command code, but didn't get one"));
        }
        $args = array();
        while (isset($lines[0]) and $lines[0][0] != '%') {
            $args[] = trim(array_shift($lines));
        }
        switch ($command) {
            case '%CHECKOUT%':
                if (!isset($args[0])) {
                    break;
                }
                $mbcode = array_shift($args);
                foreach ($args as $bcode) {
                    $err = $circQ->checkout_as_of_e($mbcode, $bcode, $date);
                    if ($err !== NULL) {
                        $errors[] = $loc->getText("Couldn't check out %item% to %member%: %error%", array('item' => $bcode, 'member' => $mbcode, 'error' => $err->toStr()));
                    }
                }
                break;
            case '%CHECKIN%':
                foreach ($args as $bcode) {
                    list($info, $err) = $circQ->shelving_cart_e($bcode, $date, true);
                    if ($err) {
                        $errors[] = $loc->getText("Couldn't check in %item%: %error%", array('item' => $bcode, 'error' => $err->toStr()));
                    }
                }
                break;
            default:
                $errors[] = $loc->getText("Unrecognized command code: %cmd%", array('cmd' => H($command)));
                break;
        }
    }
    return $errors;
}
コード例 #2
0
$mbrid = trim($_POST["mbrid"]);
$mbrQ = new MemberQuery();
$mbr = $mbrQ->get($mbrid);
$postVars = $_POST;
$pageErrors = array();
function checkerror($field, $err)
{
    global $mbrid, $postVars, $pageErrors;
    if (!$err) {
        return;
    }
    $pageErrors[$field] = $err->toStr();
    $_SESSION["postVars"] = $postVars;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../circ/mbr_view.php?mbrid=" . U($mbrid));
    exit;
}
$circQ = new CircQuery();
if (isset($_POST['date_from']) && isset($_POST['dueDate']) && $_POST['date_from'] == 'override') {
    list($dueDate, $err) = Date::read_e($_POST['dueDate']);
    checkerror('dueDate', $err);
    $_SESSION['due_date_override'] = $_POST['dueDate'];
    $err = $circQ->checkout_due_e($mbr->getBarcodeNmbr(), $barcode, $dueDate);
    checkerror('barcodeNmbr', $err);
} else {
    $err = $circQ->checkout_e($mbr->getBarcodeNmbr(), $barcode);
    checkerror('barcodeNmbr', $err);
}
unset($_SESSION["postVars"]);
unset($_SESSION["pageErrors"]);
header("Location: ../circ/mbr_view.php?mbrid=" . U($mbrid));
コード例 #3
0
ファイル: shelving_cart.php プロジェクト: vishnu35/Granthalay
 */
require_once "../shared/common.php";
$tab = "circulation";
$nav = "checkin";
$restrictInDemo = true;
require_once "../shared/logincheck.php";
require_once "../classes/CircQuery.php";
require_once "../functions/formatFuncs.php";
require_once "../classes/Localize.php";
$loc = new Localize(OBIB_LOCALE, $tab);
if (count($_POST) == 0) {
    header("Location: ../circ/checkin_form.php?reset=Y");
    exit;
}
$barcode = trim($_POST["barcodeNmbr"]);
$circQ = new CircQuery();
list($info, $err) = $circQ->shelving_cart_e($barcode);
if ($err) {
    $err = $err->toStr();
}
if ($err) {
    $postVars["barcodeNmbr"] = $barcode;
    $pageErrors["barcodeNmbr"] = $err;
    $_SESSION["postVars"] = $postVars;
    $_SESSION["pageErrors"] = $pageErrors;
    header("Location: ../circ/checkin_form.php");
    exit;
}
unset($_SESSION["postVars"]);
unset($_SESSION["pageErrors"]);
$params = "?barcode=" . U($barcode);
コード例 #4
0
ファイル: mbr_renew_all.php プロジェクト: vishnu35/Granthalay
 * 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.")));