public function preprocess() { $this->box_css_class = 'coloredArea'; $this->msg = _('please enter your password'); $this->body_class = ''; if (isset($_REQUEST['reginput']) || isset($_REQUEST['userPassword'])) { $passwd = ''; if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) { $passwd = $_REQUEST['reginput']; UdpComm::udpSend('goodBeep'); } elseif (isset($_REQUEST['userPassword']) && !empty($_REQUEST['userPassword'])) { $passwd = $_REQUEST['userPassword']; } if (Authenticate::checkPassword($passwd)) { Database::testremote(); $sd = MiscLib::scaleObject(); if (is_object($sd)) { $sd->ReadReset(); } /** Find a drawer for the cashier */ $my_drawer = ReceiptLib::currentDrawer(); if ($my_drawer == 0) { $available = ReceiptLib::availableDrawers(); if (count($available) > 0) { ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $available[0]); $my_drawer = $available[0]; } } else { ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $my_drawer); } TransRecord::addLogRecord(array('upc' => 'SIGNIN', 'description' => 'Sign In Emp#' . CoreLocal::get('CashierNo'))); /** Use Kicker object to determine whether the drawer should open The first line is just a failsafe in case the setting has not been configured. */ if (session_id() != '') { session_write_close(); } $kicker_class = CoreLocal::get("kickerModule") == "" ? 'Kicker' : CoreLocal::get('kickerModule'); $kicker_object = new $kicker_class(); if ($kicker_object->kickOnSignIn()) { ReceiptLib::drawerKick(); } if ($my_drawer == 0) { $this->change_page($this->page_url . "gui-modules/drawerPage.php"); } else { $this->change_page($this->page_url . "gui-modules/pos2.php"); } return false; } else { $this->box_css_class = 'errorColoredArea'; $this->msg = _('password invalid, please re-enter'); } } return true; }
public function testMiscLib() { chdir(dirname(__FILE__) . '/../../pos/is4c-nf/gui-modules/'); $rel = MiscLib::baseURL(); $this->assertEquals('../', $rel); $this->assertEquals(1, MiscLib::nullwrap(1)); $this->assertEquals(1.5, MiscLib::nullwrap(1.5)); $this->assertEquals('test', MiscLib::nullwrap('test')); $this->assertEquals(0, MiscLib::nullwrap(False)); $this->assertEquals(1, MiscLib::truncate2(1)); $this->assertEquals(1.99, MiscLib::truncate2(1.99)); $this->assertEquals(1.99, MiscLib::truncate2("1.99")); $this->assertEquals(1.35, MiscLib::truncate2("1.345")); $hostCheck = MiscLib::pingport(CoreLocal::get('localhost'), CoreLocal::get('DBMS')); $this->assertInternalType('integer', $hostCheck); $hostCheck = MiscLib::win32(); $this->assertInternalType('integer', $hostCheck); $scale = MiscLib::scaleObject(); if ($scale !== 0) { $this->assertInstanceOf('ScaleDriverWrapper', $scale); } }
$receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, false, $doEmail); } if ($receiptType == "ccSlip" || $receiptType == 'gcSlip') { // don't mess with reprints } elseif (CoreLocal::get("autoReprint") == 1) { CoreLocal::set("autoReprint", 0); $receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, true); } // use same email class for sending the receipt // as was used to generate the receipt $email_class = ReceiptLib::emailReceiptMod(); if ($transFinished) { CoreLocal::set("End", 0); $output = $yesSync; UdpComm::udpSend("termReset"); $sd = MiscLib::scaleObject(); if (is_object($sd)) { $sd->ReadReset(); } CoreLocal::set('ccTermState', 'swipe'); uploadAndReset($receiptType); } // close session so if printer hangs // this script won't lock the session file if (session_id() != '') { session_write_close(); } if ($receiptType == "full" && $dokick) { ReceiptLib::drawerKick(); } /**
function preprocess() { $this->display = ""; $sd = MiscLib::scaleObject(); $entered = ""; if (isset($_REQUEST["reginput"])) { $entered = strtoupper(trim($_REQUEST["reginput"])); } if (substr($entered, -2) == "CL") { $entered = "CL"; } if ($entered == "RI") { $entered = CoreLocal::get("strEntered"); } if (CoreLocal::get("msgrepeat") == 1 && $entered != "CL") { $entered = CoreLocal::get("strRemembered"); CoreLocal::set('strRemembered', ''); } CoreLocal::set("strEntered", $entered); $json = array(); if ($entered != "") { if (in_array("Paycards", CoreLocal::get("PluginList"))) { /* this breaks the model a bit, but I'm putting * putting the CC parser first manually to minimize * code that potentially handles the PAN */ if (CoreLocal::get("PaycardsCashierFacing") == "1" && substr($entered, 0, 9) == "PANCACHE:") { /* cashier-facing device behavior; run card immediately */ $entered = substr($entered, 9); CoreLocal::set("CachePanEncBlock", $entered); } $pe = new paycardEntered(); if ($pe->check($entered)) { $valid = $pe->parse($entered); $entered = "PAYCARD"; CoreLocal::set("strEntered", ""); $json = $valid; } CoreLocal::set("quantity", 0); CoreLocal::set("multiple", 0); } /* FIRST PARSE CHAIN: * Objects belong in the first parse chain if they * modify the entered string, but do not process it * This chain should be used for checking prefixes/suffixes * to set up appropriate session variables. */ $parser_lib_path = $this->page_url . "parser-class-lib/"; if (!is_array(CoreLocal::get("preparse_chain"))) { CoreLocal::set("preparse_chain", PreParser::get_preparse_chain()); } foreach (CoreLocal::get("preparse_chain") as $cn) { if (!class_exists($cn)) { continue; } $p = new $cn(); if ($p->check($entered)) { $entered = $p->parse($entered); } if (!$entered || $entered == "") { break; } } if ($entered != "" && $entered != "PAYCARD") { /* * SECOND PARSE CHAIN * these parser objects should process any input * completely. The return value of parse() determines * whether to call lastpage() [list the items on screen] */ if (!is_array(CoreLocal::get("parse_chain"))) { CoreLocal::set("parse_chain", Parser::get_parse_chain()); } $result = False; foreach (CoreLocal::get("parse_chain") as $cn) { if (!class_exists($cn)) { continue; } $p = new $cn(); if ($p->check($entered)) { $result = $p->parse($entered); break; } } if ($result && is_array($result)) { // postparse chain: modify result if (!is_array(CoreLocal::get("postparse_chain"))) { CoreLocal::set("postparse_chain", PostParser::getPostParseChain()); } foreach (CoreLocal::get('postparse_chain') as $class) { if (!class_exists($class)) { continue; } $obj = new $class(); $result = $obj->parse($result); } $json = $result; if (isset($result['udpmsg']) && $result['udpmsg'] !== False) { if (is_object($sd)) { $sd->WriteToScale($result['udpmsg']); } } } else { $arr = array('main_frame' => false, 'target' => '.baseHeight', 'output' => DisplayLib::inputUnknown()); $json = $arr; if (is_object($sd)) { $sd->WriteToScale('errorBeep'); } } } } CoreLocal::set("msgrepeat", 0); if (isset($json['main_frame']) && $json['main_frame'] != False) { $this->change_page($json['main_frame']); return False; } if (isset($json['output']) && !empty($json['output'])) { $this->display = $json['output']; } if (isset($json['retry']) && $json['retry'] != False) { $this->add_onload_command("setTimeout(\"inputRetry('" . $json['retry'] . "');\", 150);\n"); } if (isset($json['receipt']) && $json['receipt'] != False) { $ref = isset($json['trans_num']) ? $json['trans_num'] : ReceiptLib::mostRecentReceipt(); $this->add_onload_command("receiptFetch('" . $json['receipt'] . "', '" . $ref . "');\n"); } if (CoreLocal::get('CustomerDisplay') === true) { $child_url = MiscLib::baseURL() . 'gui-modules/posCustDisplay.php'; $this->add_onload_command("setCustomerURL('{$child_url}');\n"); $this->add_onload_command("reloadCustomerDisplay();\n"); } return true; }