Exemplo n.º 1
0
 function preprocess()
 {
     $plugin_info = new QuickMenus();
     $this->plugin_url = $plugin_info->pluginUrl() . '/';
     $this->offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
     if (count($_POST) > 0) {
         $output = "";
         if ($_REQUEST["clear"] == 0) {
             $value = $_REQUEST['ddQKselect'];
             if ($value === '') {
                 CoreLocal::set("msgrepeat", 0);
                 CoreLocal::set("strRemembered", '');
             } else {
                 $output = CoreLocal::get("qmInput") . $value;
                 CoreLocal::set("msgrepeat", 1);
                 CoreLocal::set("strRemembered", $output);
                 CoreLocal::set("currentid", CoreLocal::get("qmCurrentId"));
             }
             if (!FormLib::validateToken() && is_numeric($value)) {
                 CoreLocal::set("msgrepeat", 0);
             }
         }
         if (substr(strtoupper($output), 0, 2) == "QM") {
             CoreLocal::set("qmNumber", substr($output, 2));
             return True;
         } else {
             $this->change_page($this->page_url . "gui-modules/pos2.php");
         }
         return False;
     }
     return True;
 }
Exemplo n.º 2
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;
 }