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


PHP Audit::getInstance方法代碼示例

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


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

示例1: addTransaction

 public static function addTransaction($invoiceId, $customer, $amount, $currency_code, $description = '')
 {
     if (is_numeric($customer)) {
         /// customer ID is passed. Need to get customer object
         $customer = CustomerDAO::getInstance()->getCustomer($customer);
     }
     /// Now need to convert transaction amount to customer base currency
     $currency = Transaction::$instance->getRegistry()->get('currency');
     $amountInCustomerCurrency = (double) $currency->convert($amount, $currency_code, $customer['base_currency_code']);
     $newCustomerBalance = $customer['balance'] - $amountInCustomerCurrency;
     Transaction::$instance->getDb()->query("\r\n            INSERT INTO customer_transaction\r\n            SET\r\n                customer_id = " . (int) $customer['customer_id'] . ",\r\n                invoice_id = " . (int) $invoiceId . ",\r\n                description = '" . Transaction::$instance->getDb()->escape($description) . "',\r\n                amount = {$amountInCustomerCurrency},\r\n                currency_code = '" . $customer['base_currency_code'] . "',\r\n                date_added = NOW(),\r\n                balance = {$newCustomerBalance},\r\n                balance_currency = '" . Transaction::$instance->getDb()->escape($customer['base_currency_code']) . "'\r\n        ");
     //$transactionId = Transaction::$instance->getDb()->getLastId();
     /// Update customer's balance
     Transaction::$instance->getDb()->query("\r\n                UPDATE customer\r\n                SET\r\n                    balance = {$newCustomerBalance}\r\n                WHERE customer_id = " . $customer['customer_id']);
     Transaction::$instance->getCache()->delete('customer.' . $customer['customer_id']);
     if (Transaction::$instance->user->isLogged()) {
         Audit::getInstance(Transaction::$instance->getRegistry())->addAdminEntry(Transaction::$instance->user->getId(), AUDIT_ADMIN_TRANSACTION_ADD, $_REQUEST);
     } elseif (Transaction::$instance->customer->isLogged()) {
         Audit::getInstance(Transaction::$instance->getRegistry())->addUserEntry(Transaction::$instance->customer->getId(), AUDIT_ADMIN_TRANSACTION_ADD, $_REQUEST);
     }
 }
開發者ID:ralfeus,項目名稱:moomi-daeri.com,代碼行數:21,代碼來源:Transaction.php

示例2: disable

 public function disable()
 {
     $this->changeStatusProducts(0);
     Audit::getInstance($this->getRegistry())->addAdminEntry($this->getUser()->getId(), AUDIT_ADMIN_PRODUCT_DISABLE, $_REQUEST);
 }
開發者ID:ralfeus,項目名稱:moomi-daeri.com,代碼行數:5,代碼來源:product.php


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