当前位置: 首页>>代码示例>>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;未经允许,请勿转载。