Permalink
Browse files

Fixed cached currency being loaded on some pages

  • Loading branch information...
EsmondTan committed Jul 26, 2016
1 parent cc84822 commit e2e046551376a467b282163cd2a061a157a2a4a4
@@ -114,8 +114,8 @@ public function index() {
'sku' => $inventory['sku'],
'name' => $inventory['name'],
'quantity' => $inventory['quantity'],
'cost' => $this->currency->format($inventory['cost']),
'sell' => $this->currency->format($inventory['sell']),
'cost' => $this->currency->format($inventory['cost'], $this->config->get('config_currency')),
'sell' => $this->currency->format($inventory['sell'], $this->config->get('config_currency')),
'cost_raw' => $inventory['cost'],
'sell_raw' => $inventory['sell'],
'status' => $inventory['status'],
@@ -391,7 +391,7 @@ public function update() {
$json['value'] = $value;
if ($column == 'cost' || $column == 'sell') {
$json['value'] = $this->currency->format($value);
$json['value'] = $this->currency->format($value, $this->config->get('config_currency'));
}
$json['success'] = $this->language->get('text_success');
@@ -107,8 +107,8 @@ public function index() {
'customer_id' => $customer['customer_id'],
'name' => $customer['name'],
'email' => $customer['email'],
'credit' => $this->currency->format($customer['credit']),
'invoice' => $this->currency->format($customer['invoice']),
'credit' => $this->currency->format($customer['credit'], $this->config->get('config_currency')),
'invoice' => $this->currency->format($customer['invoice'], $this->config->get('config_currency')),
'status' => $customer['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
'date_added' => date($this->language->get('datetime_format_short'), strtotime($customer['date_added'])),
'date_modified' => date($this->language->get('datetime_format_short'), strtotime($customer['date_modified'])),
@@ -336,15 +336,15 @@ public function credit() {
$page = (int)$this->request->get['page'];
}
$json['credit'] = sprintf($this->language->get('text_credit'), $this->currency->format($this->model_billing_customer->getCustomerTotalCredits((int)$this->request->get['customer_id'])));
$json['credit'] = sprintf($this->language->get('text_credit'), $this->currency->format($this->model_billing_customer->getCustomerTotalCredits((int)$this->request->get['customer_id']), $this->config->get('config_currency')));
$credits = $this->model_billing_customer->getCreditsByCustomer((int)$this->request->get['customer_id'], ($page - 1) * $this->config->get('config_limit_admin'), $this->config->get('config_limit_admin'));
$json['credits'] = array();
foreach ($credits as $credit) {
$json['credits'][] = array(
'amount' => $this->currency->format($credit['amount']),
'amount' => $this->currency->format($credit['amount'], $this->config->get('config_currency')),
'description' => $credit['description'],
'date_added' => date($this->language->get('datetime_format_short'), strtotime($credit['date_added']))
);
@@ -99,9 +99,9 @@ public function index() {
}
if (in_array($grandchild['type'], $this->data['asset']) || in_array($grandchild['type'], $this->data['expense'])) {
$ytd = $this->currency->format($transaction_total['debit'] - $transaction_total['credit']);
$ytd = $this->currency->format($transaction_total['debit'] - $transaction_total['credit'], $this->config->get('config_currency'));
} else {
$ytd = $this->currency->format($transaction_total['credit'] - $transaction_total['debit']);
$ytd = $this->currency->format($transaction_total['credit'] - $transaction_total['debit'], $this->config->get('config_currency'));
}
$grandchildren_data[] = array(
@@ -126,9 +126,9 @@ public function index() {
}
if (in_array($child['type'], $this->data['asset']) || in_array($child['type'], $this->data['expense'])) {
$ytd = $this->currency->format($transaction_total['debit'] - $transaction_total['credit']);
$ytd = $this->currency->format($transaction_total['debit'] - $transaction_total['credit'], $this->config->get('config_currency'));
} else {
$ytd = $this->currency->format($transaction_total['credit'] - $transaction_total['debit']);
$ytd = $this->currency->format($transaction_total['credit'] - $transaction_total['debit'], $this->config->get('config_currency'));
}
}
@@ -155,9 +155,9 @@ public function index() {
}
if (in_array($account['type'], $this->data['asset']) || in_array($account['type'], $this->data['expense'])) {
$ytd = $this->currency->format($transaction_total['debit'] - $transaction_total['credit']);
$ytd = $this->currency->format($transaction_total['debit'] - $transaction_total['credit'], $this->config->get('config_currency'));
} else {
$ytd = $this->currency->format($transaction_total['credit'] - $transaction_total['debit']);
$ytd = $this->currency->format($transaction_total['credit'] - $transaction_total['debit'], $this->config->get('config_currency'));
}
}
@@ -182,7 +182,7 @@ public function index() {
$expense += ($transaction_total['debit'] - $transaction_total['credit']);
}
$ytd = $this->currency->format($revenue - $expense);
$ytd = $this->currency->format($revenue - $expense, $this->config->get('config_currency'));
}
$this->data['accounts'][] = array(
@@ -64,15 +64,15 @@ public function index() {
if (($transaction_total['credit'] - $transaction_total['debit']) != 0) {
$this->data['revenue_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'])
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'], $this->config->get('config_currency'))
);
$revenue_total += $transaction_total['credit'] - $transaction_total['debit'];
}
}
}
$this->data['revenue_total'] = $this->currency->format($revenue_total);
$this->data['revenue_total'] = $this->currency->format($revenue_total, $this->config->get('config_currency'));
$expense = array(
'depreciation',
@@ -94,17 +94,17 @@ public function index() {
if (($transaction_total['debit'] - $transaction_total['credit']) != 0) {
$this->data['expense_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($transaction_total['debit'] - $transaction_total['credit'])
'total' => $this->currency->format($transaction_total['debit'] - $transaction_total['credit'], $this->config->get('config_currency'))
);
$expense_total += $transaction_total['debit'] - $transaction_total['credit'];
}
}
}
$this->data['expense_total'] = $this->currency->format($expense_total);
$this->data['expense_total'] = $this->currency->format($expense_total, $this->config->get('config_currency'));
$this->data['net_profit'] = $this->currency->format($revenue_total - $expense_total);
$this->data['net_profit'] = $this->currency->format($revenue_total - $expense_total, $this->config->get('config_currency'));
$this->data['filter_date_start'] = $filter_date_start;
$this->data['filter_date_end'] = $filter_date_end;
@@ -57,15 +57,15 @@ public function index() {
if (($transaction_total['debit'] - $transaction_total['credit']) != 0) {
$this->data['current_asset_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($transaction_total['debit'] - $transaction_total['credit'])
'total' => $this->currency->format($transaction_total['debit'] - $transaction_total['credit'], $this->config->get('config_currency'))
);
$current_asset_total += $transaction_total['debit'] - $transaction_total['credit'];
}
}
}
$this->data['current_asset_total'] = $this->currency->format($current_asset_total);
$this->data['current_asset_total'] = $this->currency->format($current_asset_total, $this->config->get('config_currency'));
$non_current_asset = array(
'fixed_asset',
@@ -85,17 +85,17 @@ public function index() {
if (($transaction_total['debit'] - $transaction_total['credit']) != 0) {
$this->data['non_current_asset_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($transaction_total['debit'] - $transaction_total['credit'])
'total' => $this->currency->format($transaction_total['debit'] - $transaction_total['credit'], $this->config->get('config_currency'))
);
$non_current_asset_total += $transaction_total['debit'] - $transaction_total['credit'];
}
}
}
$this->data['non_current_asset_total'] = $this->currency->format($non_current_asset_total);
$this->data['non_current_asset_total'] = $this->currency->format($non_current_asset_total, $this->config->get('config_currency'));
$this->data['asset_total'] = $this->currency->format($current_asset_total + $non_current_asset_total);
$this->data['asset_total'] = $this->currency->format($current_asset_total + $non_current_asset_total, $this->config->get('config_currency'));
$expense = array(
'depreciation',
@@ -152,7 +152,7 @@ public function index() {
if ($equity_total > 0 || $equity_total < 0) {
$this->data['equity_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($equity_total)
'total' => $this->currency->format($equity_total, $this->config->get('config_currency'))
);
}
} else {
@@ -161,7 +161,7 @@ public function index() {
if (($transaction_total['credit'] - $transaction_total['debit']) != 0) {
$this->data['equity_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'])
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'], $this->config->get('config_currency'))
);
$equity_total += $transaction_total['credit'] - $transaction_total['debit'];
@@ -170,7 +170,7 @@ public function index() {
}
}
$this->data['equity_total'] = $this->currency->format($equity_total);
$this->data['equity_total'] = $this->currency->format($equity_total, $this->config->get('config_currency'));
$current_liability = array(
'current_liability',
@@ -190,15 +190,15 @@ public function index() {
if (($transaction_total['credit'] - $transaction_total['debit']) != 0) {
$this->data['current_liability_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'])
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'], $this->config->get('config_currency'))
);
$current_liability_total += $transaction_total['credit'] - $transaction_total['debit'];
}
}
}
$this->data['current_liability_total'] = $this->currency->format($current_liability_total);
$this->data['current_liability_total'] = $this->currency->format($current_liability_total, $this->config->get('config_currency'));
$non_current_liability = array(
'non_current_liability'
@@ -217,19 +217,19 @@ public function index() {
$this->data['non_current_liability_accounts'][] = array(
'name' => $account['name'],
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'])
'total' => $this->currency->format($transaction_total['credit'] - $transaction_total['debit'], $this->config->get('config_currency'))
);
$non_current_liability_total += $transaction_total['credit'] - $transaction_total['debit'];
}
}
}
$this->data['non_current_liability_total'] = $this->currency->format($non_current_liability_total);
$this->data['non_current_liability_total'] = $this->currency->format($non_current_liability_total, $this->config->get('config_currency'));
$this->data['liability_total'] = $this->currency->format($current_liability_total + $non_current_liability_total);
$this->data['liability_total'] = $this->currency->format($current_liability_total + $non_current_liability_total, $this->config->get('config_currency'));
$this->data['liability_equity_total'] = $this->currency->format($current_liability_total + $non_current_liability_total + $equity_total);
$this->data['liability_equity_total'] = $this->currency->format($current_liability_total + $non_current_liability_total + $equity_total, $this->config->get('config_currency'));
$this->data['filter_date_end'] = $filter_date_end;
$this->data['date_end'] = date('d M Y', strtotime($filter_date_end));

0 comments on commit e2e0465

Please sign in to comment.