/** Input processing function */ function preprocess() { // a selection was made if (FormLib::get('comment') !== '') { if (FormLib::get('cleared') === '1') { $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } $comment = str_replace("\r", '', FormLib::get('comment')); // remove trailing newline from double enter $comment = substr($comment, 0, strlen($comment) - 1); $lines = explode("\n", $comment); foreach ($lines as $line) { $line = trim($line); if (strlen($line) == 0) { continue; } elseif (strlen($line) <= 30) { TransRecord::addcomment($line); } else { $wrap = wordwrap($line, 30, "\n", True); $shorter_lines = explode("\n", $wrap); foreach ($shorter_lines as $short_line) { TransRecord::addcomment($short_line); } } } $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } return True; }
protected function ajax() { $decision = strtoupper(FormLib::get('input', 'CL')); $ret = array('dest_page' => MiscLib::base_url() . 'gui-modules/pos2.php', 'endorse' => false, 'cleared' => false); $repeat_cmd = CoreLocal::get('strEntered'); $requested_cmd = FormLib::get('cmd'); if (!empty($requested_cmd)) { $repeat_cmd = $requested_cmd; } if ($decision == "CL") { CoreLocal::set("msgrepeat", 0); CoreLocal::set("lastRepeat", ''); CoreLocal::set("toggletax", 0); CoreLocal::set("togglefoodstamp", 0); CoreLocal::set("RepeatAgain", false); $ret['cleared'] = true; } elseif (strlen($decision) > 0) { CoreLocal::set("msgrepeat", 1); CoreLocal::set("strRemembered", $repeat_cmd); } else { CoreLocal::set("msgrepeat", 1); CoreLocal::set("strRemembered", $repeat_cmd); } return $ret; }
public function preprocess() { $this->upc = FormLib::get('upc'); if (FormLib::get('reginput', false) !== false) { $inp = FormLib::get('reginput'); if (strtoupper($inp) == 'CL') { $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php'); return false; } $dbc = Database::pDataConnect(); $empP = $dbc->prepare(' SELECT emp_no FROM employees WHERE EmpActive=1 AND frontendsecurity >= ? AND (CashierPassword=? OR AdminPassword=?)'); if ($dbc->getValue($empP, array(30, $inp, $inp)) !== false) { CoreLocal::set('strRemembered', $this->upc); CoreLocal::set('msgrepeat', 1); $arr = CoreLocal::get('WicOverride'); if (!is_array($arr)) { $arr = array(); } $arr[] = ltrim($this->upc, '0'); CoreLocal::set('WicOverride', $arr); $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php'); return false; } else { $this->box_color = 'errorColoredArea'; } } return true; }
function preprocess() { if (FormLib::get('input') !== '') { $arr = $this->mgrauthenticate(FormLib::get('input')); echo JsonLib::array_to_json($arr); return False; } else { // beep on initial page load if (CoreLocal::get('LoudLogins') == 1) { UdpComm::udpSend('twoPairs'); } } return True; }
public function preprocess() { if (FormLib::get('reginput', false) !== false) { $inp = FormLib::get('reginput'); $this->step = FormLib::get('step', 0); // clear backtracks through steps if ($inp == 'CL' && $this->step == 0) { $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php'); return false; } elseif ($inp == 'CL') { $this->step--; return true; } switch ($this->step) { case 0: if (strlen($inp) != 8 || !is_numeric($inp)) { $this->box_color = "errorColoredArea"; $this->errMsg = 'Invalid Date: MMDDYYYY'; } else { $stamp = mktime(0, 0, 0, substr($inp, 0, 2), substr($inp, 2, 2), substr($inp, -4)); $today = mktime(0, 0, 0, date('n'), date('j'), date('Y')); if ($stamp > $today) { $this->box_color = "errorColoredArea"; $this->errMsg = 'Note valid until ' . date('m/d/Y', $stamp); } else { $this->step++; } } break; case 1: if (strlen($inp) != 8 || !is_numeric($inp)) { $this->box_color = "errorColoredArea"; $this->errMsg = 'Invalid Date: MMDDYYYY'; } else { $stamp = mktime(0, 0, 0, substr($inp, 0, 2), substr($inp, 2, 2), substr($inp, -4)); $today = mktime(0, 0, 0, date('n'), date('j'), date('Y')); if ($stamp < $today) { $this->box_color = "errorColoredArea"; $this->errMsg = 'Expired ' . date('m/d/Y', $stamp); } else { $this->step++; } } break; case 2: if ($inp !== '') { $this->box_color = "errorColoredArea"; $this->errMsg = '[enter] to continue'; } else { $this->step++; } break; case 3: if (!is_numeric($inp)) { $this->box_color = "errorColoredArea"; $this->errMsg = 'Invalid amount'; } elseif ($inp / 100 - CoreLocal::get('amtdue') > 0.005) { $this->box_color = "errorColoredArea"; $this->errMsg = 'Max amount is ' . CoreLocal::get('amtdue'); } else { $tender = $inp . 'WT'; CoreLocal::set('strRemembered', $tender); CoreLocal::set('msgrepeat', 1); CoreLocal::set('RepeatAgain', true); $this->change_page(MiscLib::baseURL() . 'gui-modules/pos2.php'); return false; } break; } } return true; }
function body_content() { $this->input_header(); echo DisplayLib::printheaderb(); $mode = FormLib::get('qty-mode', 0); $this->add_onload_command("formAdd('#formlocal','qty-mode','{$mode}');\n"); $item = FormLib::get('entered-item', CoreLocal::get('strEntered')); $this->add_onload_command("formAdd('#formlocal','entered-item','{$item}');\n"); ?> <div class="baseHeight"> <div class="<?php echo $this->box_color; ?> centeredDisplay"> <span class="larger"> <?php echo $this->msg; ?> </span><br /> <p> <?php echo _("enter quantity or clear to cancel"); ?> </p> </div> </div> <?php CoreLocal::set("msgrepeat", 2); CoreLocal::set("item", CoreLocal::get("strEntered")); UdpComm::udpSend('errorBeep'); echo "<div id=\"footer\">"; echo DisplayLib::printfooter(); echo "</div>"; }