示例#1
0
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
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);
if ($info['mbrid']) {