本文整理汇总了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);
}
}
示例2: disable
public function disable()
{
$this->changeStatusProducts(0);
Audit::getInstance($this->getRegistry())->addAdminEntry($this->getUser()->getId(), AUDIT_ADMIN_PRODUCT_DISABLE, $_REQUEST);
}