Example #1
0
 function preprocess()
 {
     $me = CoreLocal::get('CashierNo');
     $this->security = Authenticate::getPermission($me);
     if (isset($_REQUEST['selectlist'])) {
         if (!FormLib::validateToken()) {
             return false;
         }
         if (empty($_REQUEST['selectlist'])) {
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         } elseif ($_REQUEST['selectlist'] == 'SUSPEND') {
             Database::getsubtotals();
             if (CoreLocal::get("LastID") == 0) {
                 CoreLocal::set("boxMsg", _("no transaction in progress"));
                 CoreLocal::set('boxMsgButtons', array('Dismiss [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
                 $this->change_page($this->page_url . "gui-modules/boxMsg2.php");
                 return False;
             } else {
                 // ajax call to end transaction
                 // and print receipt
                 $ref = SuspendLib::suspendorder();
                 $this->add_onload_command("\$.ajax({\n                        type:'post',\n                        url:'{$this->page_url}ajax-callbacks/ajax-end.php',\n                        cache: false,\n                        data: 'receiptType=suspended&ref={$ref}',\n                        dataType: 'json',\n                        success: function(data){\n                            \$.ajax({\n                            type:'post',\n                            url:'{$this->page_url}ajax-callbacks/ajax-transaction-sync.php',\n                            cache: false,\n                            success: function(data){\n                                location='{$this->page_url}gui-modules/pos2.php';\n                            },\n                            error: function(e1){\n                                location='{$this->page_url}gui-modules/pos2.php';\n                            }\n                            });\n                        },\n                        error: function(e1){\n                            location='{$this->page_url}gui-modules/pos2.php';\n                        }\n                        });");
                 return True;
             }
         } else {
             if ($_REQUEST['selectlist'] == 'RESUME') {
                 Database::getsubtotals();
                 if (CoreLocal::get("LastID") != 0) {
                     CoreLocal::set("boxMsg", _("transaction in progress"));
                     CoreLocal::set('boxMsgButtons', array('Dismiss [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
                     $this->change_page($this->page_url . "gui-modules/boxMsg2.php");
                 } elseif (SuspendLib::checksuspended() == 0) {
                     CoreLocal::set("boxMsg", _("no suspended transaction"));
                     CoreLocal::set('boxMsgButtons', array('Dismiss [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
                     CoreLocal::set("strRemembered", "");
                     $this->change_page($this->page_url . "gui-modules/boxMsg2.php");
                 } else {
                     $this->change_page($this->page_url . "gui-modules/suspendedlist.php");
                 }
                 return False;
             } else {
                 if ($_REQUEST['selectlist'] == 'TR') {
                     TenderReport::printReport();
                     $this->change_page($this->page_url . "gui-modules/pos2.php");
                     return False;
                 } else {
                     if ($_REQUEST['selectlist'] == 'OTR' && $this->security >= 30) {
                         $this->change_page($this->page_url . 'gui-modules/requestInfo.php?class=AnyTenderReportRequest');
                         return False;
                     } elseif ($_REQUEST['selectlist'] == 'UNDO' && $this->security >= 30) {
                         $this->change_page($this->page_url . 'gui-modules/undo.php');
                         return false;
                     }
                 }
             }
         }
     }
     return True;
 }
Example #2
0
 public static function requestInfoCallback($info)
 {
     if ($info === '' || strtoupper($info) == 'CL') {
         // clear/blank => go back to adminlist
         return MiscLib::base_url . 'gui-modules/adminlist.php';
     } else {
         if (!is_numeric($info)) {
             // other non-number is invalid input
             return false;
         } else {
             // change employee setting to desired,
             // print report, change back
             $my_emp_no = CoreLocal::get('CashierNo');
             CoreLocal::set('CashierNo', $info);
             TenderReport::printReport();
             CoreLocal::set('CashierNo', $my_emp_no);
             return true;
         }
     }
 }