Skip to content

Commit

Permalink
Fixes #1291 - use location currency and fall back to defaul currency …
Browse files Browse the repository at this point in the history
…for asset maintenances
  • Loading branch information
snipe committed Nov 4, 2015
1 parent a587b72 commit f4331f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/config/version.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
return array (
'app_version' => 'v2.0-374',
'hash_version' => 'v2.0-374-g577c193',
'app_version' => 'v2.0-377',
'hash_version' => 'v2.0-377-g0b0b556',
);
14 changes: 12 additions & 2 deletions app/controllers/admin/AssetMaintenancesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use TCPDF;
use Validator;
use View;
use Setting;

class AssetMaintenancesController extends AdminController
{
Expand Down Expand Up @@ -48,7 +49,9 @@ public function getIndex()

public function getDatatable()
{
$maintenances = AssetMaintenance::with('asset','supplier')


$maintenances = AssetMaintenance::with('asset','supplier')
->whereNull('deleted_at');

if (Input::has('search')) {
Expand Down Expand Up @@ -77,18 +80,25 @@ public function getDatatable()
$maintenances = $maintenances->skip($offset)->take($limit)->get();

$rows = array();
$settings = Setting::getSettings();

foreach($maintenances as $maintenance) {

$actions = '<a href="'.route('update/location', $maintenance->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/statuslabel', $maintenance->id).'" data-content="'.Lang::get('admin/asset_maintenances/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($maintenance->title).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';

if (($maintenance->cost) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
$maintenance_cost = $maintenance->asset->assetloc->currency.$maintenance->cost;
} else {
$maintenance_cost = $settings->default_currency.$maintenance->cost;
}

$rows[] = array(
'id' => $maintenance->id,
'asset_name' => $maintenance->asset->showAssetName(),
'title' => $maintenance->title,
'notes' => $maintenance->notes,
'supplier' => $maintenance->supplier->name,
'cost' => ($maintenance->cost) ? $maintenance->asset->assetloc->currency.''.$maintenance->cost : $maintenance->cost ,
'cost' => $maintenance_cost,
'asset_maintenance_type' => e($maintenance->asset_maintenance_type),
'start_date' => $maintenance->start_date,
'time' => $maintenance->asset_maintenance_time,
Expand Down

0 comments on commit f4331f4

Please sign in to comment.