當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserDB::getFullUserByCardNumber方法代碼示例

本文整理匯總了PHP中UserDB::getFullUserByCardNumber方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserDB::getFullUserByCardNumber方法的具體用法?PHP UserDB::getFullUserByCardNumber怎麽用?PHP UserDB::getFullUserByCardNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserDB的用法示例。


在下文中一共展示了UserDB::getFullUserByCardNumber方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: post

 public static function post()
 {
     $page = new Page();
     $page->data['title'] = 'Kassa';
     if (isset($_POST['to_enter_transaction_view'])) {
         $errMsgs = CashRegisterEnterCardViewValidator::validate($_POST);
         if (empty($errMsgs)) {
             try {
                 $_SESSION['Stippers']['CashRegister']['user'] = UserDB::getFullUserByCardNumber($_POST['card_number']);
                 if (!$_SESSION['Stippers']['CashRegister']['user']) {
                     CashRegisterController::buildEnterCardView($page, true);
                     $page->data['CashRegisterEnterCardView']['errMsgs']['global'] = '<h2 class="error_message" id="enter_card_form_error_message">Dit kaartnummer is niet gekoppeld aan een gebruiker.</h2>';
                 } else {
                     CashRegisterController::buildEnterTransactionView($page, false);
                 }
             } catch (Exception $ex) {
                 CashRegisterController::buildEnterCardView($page, true);
                 $page->data['CashRegisterEnterCardView']['errMsgs']['global'] = '<h2 class="error_message" id="enter_card_form_error_message">Kan gebruiker niet ophalen, probeer opnieuw.</h2>';
             }
         } else {
             CashRegisterController::buildEnterCardView($page, true);
             $page->data['CashRegisterEnterCardView']['errMsgs'] = array_merge($page->data['CashRegisterEnterCardView']['errMsgs'], $errMsgs);
         }
     } elseif (isset($_POST['register_transaction'])) {
         $errMsgs = CashRegisterEnterTransactionViewValidator::validate($_POST);
         if (empty($errMsgs)) {
             try {
                 $decrMoney = $_POST['decrease_money'] == '' ? 0 : SafeMath::getCentsFromString($_POST['decrease_money']);
                 $executingBrowserName = BrowserDB::getBrowserById($_SESSION['Stippers']['browser']->browserId)->name;
                 $trans = new MoneyTransaction(null, $_SESSION['Stippers']['CashRegister']['user']->userId, $_SESSION['Stippers']['CashRegister']['user']->balance, 0, $decrMoney, MoneyTransactionConfig::DEFAULT_DISCOUNT_PERC, false, null, $executingBrowserName, null);
                 if ($trans->getBalAfter() < 0) {
                     $page->data['ErrorMessageWithDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
                     $page->data['ErrorMessageWithDescriptionWithLinkView']['errorTitle'] = 'Saldo te laag';
                     $page->data['ErrorMessageWithDescriptionWithLinkView']['errorDescription'] = 'Het saldo de kaart is te laag.<br>Je komt onder nul uit.';
                     $page->addView('error/ErrorMessageWithDescriptionWithLinkView');
                 } else {
                     MoneyTransactionDB::addTransaction($_SESSION['Stippers']['CashRegister']['user'], $trans);
                     $page->data['CashRegisterTransactionResultView']['balBefore'] = $trans->getBalBefore() / 100;
                     $page->data['CashRegisterTransactionResultView']['balAfter'] = $trans->getBalAfter() / 100;
                     $page->data['CashRegisterTransactionResultView']['discount'] = $trans->getDiscount() / 100;
                     $page->data['CashRegisterTransactionResultView']['decrMoney'] = $trans->getDecrMoney() / 100;
                     $page->addView('cashRegister/CashRegisterTransactionResultView');
                 }
             } catch (Exception $ex) {
                 CashRegisterController::buildEnterTransactionView($page, true);
                 $page->data['CashRegisterEnterTransactionView']['errMsgs']['global'] = '<h2 class="error_message" id="enter_transaction_form_error_message">Kan transactie niet registreren, probeer opnieuw.</h2>';
             }
         } else {
             CashRegisterController::buildEnterTransactionView($page, true);
             $page->data['CashRegisterEnterTransactionView']['errMsgs'] = array_merge($page->data['CashRegisterEnterTransactionView']['errMsgs'], $errMsgs);
         }
     }
     $page->showWithMenu();
 }
開發者ID:JHDeStip,項目名稱:Stippers,代碼行數:54,代碼來源:CashRegisterController.php


注:本文中的UserDB::getFullUserByCardNumber方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。