Пример #1
0
 /**
   Set up state and redirect if needed
   @return True or a URL to redirect
 */
 public function preReqCheck()
 {
     $pref = CoreState::getCustomerPref('store_charge_see_id');
     if ($pref == 'yes') {
         if (CoreLocal::get('msgrepeat') == 0) {
             CoreLocal::set("boxMsg", "<BR>please verify member ID</B><BR>press [enter] to continue<P><FONT size='-1'>[clear] to cancel</FONT>");
             CoreLocal::set('lastRepeat', 'storeChargeSeeID');
             return MiscLib::base_url() . 'gui-modules/boxMsg2.php?quiet=1';
         } else {
             if (CoreLocal::get('msgrepeat') == 1 && CoreLocal::get('lastRepeat') == 'storeChargeSeeID') {
                 CoreLocal::set('msgrepeat', 0);
                 CoreLocal::set('lastRepeat', '');
             }
         }
     }
     return true;
 }
Пример #2
0
 register_shutdown_function(array('ReceiptLib', 'shutdownFunction'));
 $receiptContent = array();
 if ($transFinished) {
     $kicker_class = CoreLocal::get("kickerModule") == "" ? 'Kicker' : CoreLocal::get('kickerModule');
     $kicker_object = new $kicker_class();
     if (!is_object($kicker_object)) {
         $kicker_object = new Kicker();
     }
     $dokick = $kicker_object->doKick($receiptNum);
 }
 $print_class = CoreLocal::get('ReceiptDriver');
 if ($print_class === '' || !class_exists($print_class)) {
     $print_class = 'ESCPOSPrintHandler';
 }
 $PRINT_OBJ = new $print_class();
 $email = trim(CoreState::getCustomerPref('email_receipt'));
 $customerEmail = filter_var($email, FILTER_VALIDATE_EMAIL);
 $doEmail = $customerEmail !== false ? true : false;
 if ($receiptType != "none") {
     $receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, false, $doEmail);
 }
 if ($receiptType == "ccSlip" || $receiptType == 'gcSlip') {
     // don't mess with reprints
 } elseif (CoreLocal::get("autoReprint") == 1) {
     CoreLocal::set("autoReprint", 0);
     $receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, true);
 }
 // use same email class for sending the receipt
 // as was used to generate the receipt
 $email_class = ReceiptLib::emailReceiptMod();
 if ($transFinished) {
Пример #3
0
 /**
   Show some items and farewell message
   @param $readOnly don't update totals
   @return An HTML string
 
   Show a few recent items and the 
   "Thank you for shopping" messaging.
 
   Yes, this function should be renamed. It
   has nothing to do with receipts.
 */
 public static function printReceiptfooter($readOnly = False)
 {
     if (!$readOnly) {
         Database::getsubtotals();
     }
     $last_id = CoreLocal::get("LastID");
     if ($last_id - 7 < 0) {
         $top_id = 1;
     } else {
         $top_id = $last_id - 7;
     }
     $ret = self::drawitems($top_id, 7, 0);
     $ret .= "<div class=\"farewellMsg coloredText\">";
     for ($i = 0; $i <= CoreLocal::get("farewellMsgCount"); $i++) {
         $ret .= CoreLocal::get("farewellMsg" . $i) . "<br />";
     }
     $email = CoreState::getCustomerPref('email_receipt');
     $doEmail = filter_var($email, FILTER_VALIDATE_EMAIL);
     if ($doEmail) {
         $ret .= 'receipt emailed';
     }
     $ret .= "</div>";
     return $ret;
 }
Пример #4
0
 public function testCoreState()
 {
     // normal session init attempts to recover state
     // transaction info - e.g., after a browser crash
     // or reboot. Clear the table so that doesn't
     // happen
     $db = Database::tDataConnect();
     $db->query('TRUNCATE TABLE localtemptrans');
     /**
       This will trigger any syntax or run-time errors
       Testing all the invidual values of session
       might be worthwhile is anyone wants to write
       all those tests out. They're mostly static values
       so the test would only catch changes to the
       defaults.
     */
     CoreState::initiate_session();
     $str = CoreState::getCustomerPref('asdf');
     $this->assertInternalType('string', $str);
     $this->assertEquals('', $str);
     // non-numeric age converts to zero
     CoreState::cashierLogin(false, 'z');
     $this->assertEquals(0, CoreLocal::get('cashierAge'));
 }