Skip to content

A free open source IT asset/license management system

Fix mismerged code. (#2705)

Brady Wetherington7ca787774071
diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php
index dcc93e0341..0e16bfdc79 100644
--- a/app/Http/Controllers/ReportsController.php
+++ b/app/Http/Controllers/ReportsController.php
@@ -33,7 +33,7 @@ class ReportsController extends Controller
{
/**
- * Returns a view that displaysthe accessories report.
+ * Returns a view that displays the accessories report.
*
* @author [A. Gianotto] [<[email protected]>]
* @since [v1.0]
@@ -292,11 +292,7 @@ class ReportsController extends Controller
public function getActivityReport()
{
$log_actions = Actionlog::orderBy('created_at', 'DESC')
- ->with('adminlog')
- ->with('accessorylog')
- ->with('assetlog')
- ->with('licenselog')
- ->with('userlog')
+ ->with('item')
->orderBy('created_at', 'DESC')
->get();
@@ -304,16 +300,111 @@ class ReportsController extends Controller
}
/**
- * Displays license report
- *
- * @author [A. Gianotto] [<[email protected]>]
- * @since [v1.0]
- * @return View
- */
+ * Returns Activity Report JSON.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v1.0]
+ * @return View
+ */
+ public function getActivityReportDataTable()
+ {
+ $activitylogs = Actionlog::orderBy('created_at', 'DESC');
+
+ if (Input::has('search')) {
+ $activity = $activity->TextSearch(e(Input::get('search')));
+ }
+
+ if (Input::has('offset')) {
+ $offset = e(Input::get('offset'));
+ } else {
+ $offset = 0;
+ }
+
+ if (Input::has('limit')) {
+ $limit = e(Input::get('limit'));
+ } else {
+ $limit = 50;
+ }
+
+
+ $allowed_columns = ['created_at'];
+ $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
+ $sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
+
+
+ $activityCount = $activitylogs->count();
+ $activitylogs = $activitylogs->skip($offset)->take($limit)->get();
+
+ $rows = array();
+
+ foreach ($activitylogs as $activity) {
+
+ if ($activity->itemType() == "asset") {
+ $activity_icons = '<i class="fa fa-barcode"></i>';
+ } elseif ($activity->itemType() == "accessory") {
+ $activity_icons = '<i class="fa fa-keyboard-o"></i>';
+ } elseif ($activity->itemType()=="consumable") {
+ $activity_icons = '<i class="fa fa-tint"></i>';
+ } elseif ($activity->itemType()=="license"){
+ $activity_icons = '<i class="fa fa-floppy-o"></i>';
+ } elseif ($activity->itemType()=="component") {
+ $activity_icons = '<i class="fa fa-hdd-o"></i>';
+ } else {
+ $activity_icons = '<i class="fa fa-paperclip"></i>';
+ }
+
+ if (($activity->item) && ($activity->itemType()=="asset")) {
+ $actvity_item = '<a href="'.route('view/hardware', $activity->item_id).'">'.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).'</a>';
+ $item_type = 'asset';
+ } elseif ($activity->item) {
+ $actvity_item = '<a href="'.route('view/'. $activity->itemType(), $activity->item_id).'">'.e($activity->item->name).'</a>';
+ $item_type = $activity->itemType();
+ }
+
+
+ if (($activity->userasassetlog) && ($activity->action_type=="uploaded") && ($activity->itemType()=="user")) {
+ $activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->userasassetlog->fullName().'</a>';
+ } elseif (($activity->item) && ($activity->target instanceof \App\Models\Asset)) {
+ $activity_target = '<a href="'.route('view/hardware', $activity->target_id).'">'.$activity->target->showAssetName().'</a>';
+ } elseif (($activity->item) && ($activity->target instanceof \App\Models\User)) {
+ $activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->target->fullName().'</a>';
+ } elseif ($activity->action_type=='requested') {
+ $activity_target = '<a href="'.route('view/user', $activity->user_id).'">'.$activity->user->fullName().'</a>';
+ } else {
+ $activity_target = $activity->target;
+ }
+
+
+ $rows[] = array(
+ 'icon' => $activity_icons,
+ 'created_at' => date("M d, Y g:iA", strtotime($activity->created_at)),
+ 'action_type' => strtolower(trans('general.'.str_replace(' ','_',$activity->action_type))),
+ 'admin' => $activity->user ? (string) link_to('/admin/users/'.$activity->user_id.'/view', $activity->user->fullName()) : 'Deleted Admin',
+ 'target' => $activity_target,
+ 'item' => $actvity_item,
+ 'item_type' => $item_type,
+ 'note' => e($activity->note),
+
+ );
+ }
+
+ $data = array('total'=>$activityCount, 'rows'=>$rows);
+
+ return $data;
+
+ }
+
+ /**
+ * Displays license report
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v1.0]
+ * @return View
+ */
public function getLicenseReport()
{
- $licenses = License::orderBy('created_at', 'DESC')
+ $licenses = License::with('depreciation')->orderBy('created_at', 'DESC')
->with('company')
->get();
@@ -340,6 +431,7 @@ class ReportsController extends Controller
trans('admin/licenses/form.remaining_seats'),
trans('admin/licenses/form.expiration'),
trans('admin/licenses/form.date'),
+ trans('admin/licenses/form.depreciation'),
trans('admin/licenses/form.cost')
];
@@ -355,6 +447,7 @@ class ReportsController extends Controller
$row[] = $license->remaincount();
$row[] = $license->expiration_date;
$row[] = $license->purchase_date;
+ $row[] = ($license->depreciation!='') ? '' : e($license->depreciation->name);
$row[] = '"' . Helper::formatCurrencyOutput($license->purchase_cost) . '"';
$rows[] = implode($row, ',');
diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php
index 83a1900380..87ea4f74eb 100644
--- a/app/Providers/AuthServiceProvider.php
+++ b/app/Providers/AuthServiceProvider.php
@@ -261,6 +261,12 @@ class AuthServiceProvider extends ServiceProvider
}
});
+ $gate->define('components.checkout', function ($user) {
+ if (($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
+ return true;
+ }
+ });
+
// Checks for some level of management
$gate->define('components.manage', function ($user) {
if (($user->hasAccess('components.edit')) || ($user->hasAccess('components.delete')) || ($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
diff --git a/resources/views/models/edit.blade.php b/resources/views/models/edit.blade.php
index 4590fc7bd0..a9605871b5 100755
--- a/resources/views/models/edit.blade.php
+++ b/resources/views/models/edit.blade.php
@@ -129,6 +129,15 @@
</div>
</div>
+ <!-- Requestable -->
+ <div class="form-group">
+ <div class="col-sm-offset-3 col-sm-10">
+ <label>
+ <input type="checkbox" value="1" name="requestable" id="requestable" class="minimal" {{ Input::old('requestable', $model->requestable) == '1' ? ' checked="checked"' : '' }}> {{ trans('admin/models/general.requestable') }}
+ </label>
+ </div>
+ </div>
+
<!-- Image -->
@if ($model->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php
index 535ddc85b8..38d47ee60f 100644
--- a/resources/views/reports/custom.blade.php
+++ b/resources/views/reports/custom.blade.php
@@ -48,6 +48,13 @@
</label>
</div>
+ <div class="checkbox col-md-12">
+ <label>
+ {{ Form::checkbox('company_name', '1') }}
+ {{ trans('general.company') }}
+ </label>
+ </div>
+
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('asset_tag', '1') }}