예제 #1
0
 function preprocess()
 {
     $this->my_drawer = ReceiptLib::currentDrawer();
     $this->available = ReceiptLib::availableDrawers();
     $this->is_admin = false;
     $db = Database::pDataConnect();
     $sec = Authenticate::getPermission(CoreLocal::get('CashierNo'));
     if ($sec >= 30) {
         $this->is_admin = true;
     }
     if (isset($_REQUEST['selectlist'])) {
         if (empty($_REQUEST['selectlist'])) {
             if (empty($this->available) && !$this->is_admin && $this->my_drawer == 0) {
                 // no drawer available and not admin
                 // sign out and go back to main login screen
                 Database::setglobalvalue("LoggedIn", 0);
                 CoreLocal::set("LoggedIn", 0);
                 CoreLocal::set("training", 0);
                 CoreLocal::set("gui-scale", "no");
                 $this->change_page($this->page_url . "gui-modules/login2.php");
             } else {
                 $this->change_page($this->page_url . "gui-modules/pos2.php");
             }
             return False;
         }
         if (substr($_REQUEST['selectlist'], 0, 2) == 'TO' && $this->is_admin) {
             // take over a drawer
             $new_drawer = substr($_REQUEST['selectlist'], 2);
             if ($this->my_drawer != 0) {
                 // free up the current drawer if it exists
                 ReceiptLib::drawerKick();
                 ReceiptLib::freeDrawer($this->my_drawer);
             }
             // switch to the requested drawer
             ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $new_drawer);
             ReceiptLib::drawerKick();
             $this->my_drawer = $new_drawer;
         } elseif (substr($_REQUEST['selectlist'], 0, 2) == 'SW') {
             // switch to available drawer
             $new_drawer = substr($_REQUEST['selectlist'], 2);
             foreach ($this->available as $id) {
                 // verify the requested drawer is available
                 if ($new_drawer == $id) {
                     if ($this->my_drawer != 0) {
                         // free up the current drawer if it exists
                         ReceiptLib::drawerKick();
                         ReceiptLib::freeDrawer($this->my_drawer);
                     }
                     // switch to the requested drawer
                     ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $new_drawer);
                     ReceiptLib::drawerKick();
                     $this->my_drawer = $new_drawer;
                     break;
                 }
             }
         }
     }
     return True;
 }
예제 #2
0
파일: login2.php 프로젝트: phpsmith/IS4C
 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;
 }
예제 #3
0
파일: Steering.php 프로젝트: phpsmith/IS4C
 function check($str)
 {
     $my_url = MiscLib::base_url();
     $this->dest_input_page = "";
     $this->dest_main_page = "";
     $this->dest_scale = False;
     $this->ret = $this->default_json();
     // Argument to PV, either before or after.
     if (substr($str, -2, 2) == "PV") {
         $pvsearch = substr($str, 0, -2);
         $str = "PV";
     } elseif (substr($str, 0, 2) == "PV") {
         $pvsearch = substr($str, 2);
         $str = "PV";
     }
     // common error message
     $repeat = CoreLocal::get('msgrepeat');
     $in_progress_msg = DisplayLib::boxMsg(_("transaction in progress"), '', true, DisplayLib::standardClearButton());
     CoreLocal::set('msgrepeat', $repeat);
     switch ($str) {
         case 'CAB':
             if (CoreLocal::get("LastID") != "0") {
                 $this->ret['output'] = $in_progress_msg;
             } else {
                 $this->ret['main_frame'] = $my_url . "gui-modules/cablist.php";
             }
             return true;
         case "PV":
             CoreLocal::set("pvsearch", "{$pvsearch}");
             $this->ret['main_frame'] = $my_url . "gui-modules/productlist.php";
             return true;
         case "MSTG":
             if (CoreLocal::get('memType') == 1 || CoreLocal::get('memType') == 2) {
                 // could this be CoreLocal::get('isMember') == 1
                 // to avoid relying on specific memTypes?
                 $this->ret['output'] = DisplayLib::boxMsg(_("Cannot UNset a member status"), '', true, DisplayLib::standardClearButton());
             } elseif (CoreLocal::get("SecuritySR") > 20) {
                 $this->ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=MemStatusAdminLogin";
             } else {
                 $this->ret['output'] = DisplayLib::boxMsg(_("You must be an admin to do this."), _('Access Denied'), true, DisplayLib::standardClearButton());
             }
             return true;
         case "UNDO":
             if (CoreLocal::get("LastID") != "0") {
                 $this->ret['output'] = $in_progress_msg;
             } else {
                 $this->ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=UndoAdminLogin";
             }
             return true;
         case 'SK':
         case "DDD":
             $this->ret['main_frame'] = $my_url . "gui-modules/DDDReason.php";
             return true;
         case 'MG':
             if (CoreLocal::get("SecuritySR") > 20) {
                 $this->ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=SusResAdminLogin";
             } else {
                 $this->ret['main_frame'] = $my_url . "gui-modules/adminlist.php";
             }
             return true;
         case 'RP':
             if (CoreLocal::get("LastID") != "0") {
                 $tr = CoreLocal::get("receiptToggle");
                 if ($tr == 1) {
                     CoreLocal::set("receiptToggle", 0);
                 } else {
                     CoreLocal::set("receiptToggle", 1);
                 }
                 $this->ret['main_frame'] = $my_url . "gui-modules/pos2.php";
             } else {
                 $db = Database::tDataConnect();
                 $query = "select register_no, emp_no, trans_no, " . "sum((case when trans_type = 'T' then -1 * total else 0 end)) as total " . "from localtranstoday where register_no = " . CoreLocal::get("laneno") . " and emp_no = " . CoreLocal::get("CashierNo") . " AND datetime >= " . $db->curdate() . " group by register_no, emp_no, trans_no order by 1000 - trans_no";
                 $result = $db->query($query);
                 $num_rows = $db->num_rows($result);
                 if ($num_rows == 0) {
                     $this->ret['output'] = DisplayLib::boxMsg(_("no receipt found"), '', true, DisplayLib::standardClearButton());
                 } else {
                     $this->ret['main_frame'] = $my_url . "gui-modules/rplist.php";
                 }
             }
             return true;
         case 'ID':
             $this->ret['main_frame'] = $my_url . "gui-modules/memlist.php";
             return true;
         case 'DDM':
             $this->ret['main_frame'] = $my_url . 'gui-modules/drawerPage.php';
             return true;
         case 'SS':
         case 'SO':
             // sign off and suspend shift are identical except for
             // drawer behavior
             if (CoreLocal::get("LastID") != 0) {
                 $this->ret['output'] = $in_progress_msg;
             } else {
                 TransRecord::addLogRecord(array('upc' => 'SIGNOUT', 'description' => 'Sign Out Emp#' . CoreLocal::get('CashierNo')));
                 Database::setglobalvalue("LoggedIn", 0);
                 CoreLocal::set("LoggedIn", 0);
                 CoreLocal::set("training", 0);
                 CoreLocal::set("gui-scale", "no");
                 /**
                   An empty transaction may still contain
                   invisible, logging records. Rotate those
                   out of localtemptrans to ensure sequential
                   trans_id values
                 */
                 if (Database::rotateTempData()) {
                     Database::clearTempTables();
                 }
                 if ($str == 'SO') {
                     if (session_id() != '') {
                         session_write_close();
                     }
                     $kicker_class = CoreLocal::get("kickerModule") == "" ? 'Kicker' : CoreLocal::get('kickerModule');
                     $kicker_object = new $kicker_class();
                     if ($kicker_object->kickOnSignOut()) {
                         ReceiptLib::drawerKick();
                     }
                     ReceiptLib::freeDrawer(ReceiptLib::currentDrawer());
                 }
                 $this->ret['main_frame'] = $my_url . "login.php";
             }
             return true;
         case 'NS':
             if (CoreLocal::get("LastID") != 0) {
                 $this->ret['output'] = $in_progress_msg;
             } else {
                 $this->ret['main_frame'] = $my_url . "gui-modules/nslogin.php";
             }
             return true;
         case 'GD':
             CoreLocal::set("msgrepeat", 0);
             $this->ret['main_frame'] = $my_url . "gui-modules/giftcardlist.php";
             return true;
         case 'IC':
             CoreLocal::set("msgrepeat", 0);
             $this->ret['main_frame'] = $my_url . "gui-modules/HouseCouponList.php";
             return true;
         case "CN":
             $this->ret['main_frame'] = $my_url . "gui-modules/mgrlogin.php";
             return true;
         case "PO":
             $this->ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=PriceOverrideAdminLogin";
             return true;
     }
     return false;
 }