コード例 #1
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;
 }
コード例 #2
0
ファイル: drawerPage.php プロジェクト: phpsmith/IS4C
 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;
 }