Merge remote-tracking branch 'refs/remotes/snipe/develop' into features/ldap-settings

This commit is contained in:
Wahlstedt, Walter
2015-11-17 10:11:38 -05:00
24 changed files with 141 additions and 22 deletions
+1
View File
@@ -29,3 +29,4 @@ app/config/local/session.php
app/storage/dumps/*
tests/_support/_generated/*
tests/_data/scenarios
public/uploads/assets/*
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
return array (
'app_version' => 'v2.0.5-pre',
'hash_version' => 'v2.0.5-pre-3-gc1961c0',
'hash_version' => 'v2.0.5-pre-52-gbbe0189',
);
@@ -69,19 +69,19 @@ class AccessoriesController extends AdminController
$accessory->name = e(Input::get('name'));
$accessory->category_id = e(Input::get('category_id'));
$accessory->order_number = e(Input::get('order_number'));
if (e(Input::get('purchase_date')) == '') {
$accessory->purchase_date = NULL;
} else {
$accessory->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('purchase_cost')) == '0.00') {
$accessory->purchase_cost = NULL;
} else {
$accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
}
$accessory->qty = e(Input::get('qty'));
$accessory->user_id = Sentry::getId();
@@ -151,19 +151,19 @@ class AccessoriesController extends AdminController
$accessory->name = e(Input::get('name'));
$accessory->category_id = e(Input::get('category_id'));
$accessory->order_number = e(Input::get('order_number'));
if (e(Input::get('purchase_date')) == '') {
$accessory->purchase_date = NULL;
} else {
$accessory->purchase_date = e(Input::get('purchase_date'));
}
if (e(Input::get('purchase_cost')) == '0.00') {
$accessory->purchase_cost = NULL;
} else {
$accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
}
$accessory->qty = e(Input::get('qty'));
// Was the accessory created?
@@ -529,7 +529,7 @@ class AccessoriesController extends AdminController
$rows[] = array(
'name' => link_to('admin/accessories/'.$accessory->id.'/view', $accessory->name),
'category' => $accessory->category->name,
'category' => link_to('admin/settings/categories/'.$accessory->category->id.'/view', $accessory->category->name),
'qty' => $accessory->qty,
'order_number' => $accessory->order_number,
'purchase_date' => $accessory->purchase_date,
@@ -83,7 +83,7 @@
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>';
$actions = '<nobr><a href="'.route('update/asset_maintenance', $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></nobr>';
if (($maintenance->cost) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
$maintenance_cost = $maintenance->asset->assetloc->currency.$maintenance->cost;
+32 -2
View File
@@ -2,6 +2,7 @@
use AdminController;
use Input;
use Image;
use Lang;
use Asset;
use Supplier;
@@ -29,6 +30,7 @@ use Paginator;
use Manufacturer; //for embedded-create
use Artisan;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\HttpFoundation\JsonResponse;
class AssetsController extends AdminController
@@ -169,6 +171,19 @@ class AssetsController extends AdminController
$asset->physical = '1';
$asset->depreciate = '0';
// Create the image (if one was chosen.)
if (Input::file('image')) {
$image = Input::file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/assets/'.$file_name);
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$asset->image = $file_name;
}
// Was the asset created?
if($asset->save()) {
@@ -181,7 +196,6 @@ class AssetsController extends AdminController
$logaction->note = e(Input::get('note'));
$log = $logaction->logaction('checkout');
}
// Redirect to the asset listing page
return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.create.success'));
}
@@ -308,6 +322,20 @@ class AssetsController extends AdminController
$asset->notes = e(Input::get('notes'));
$asset->physical = '1';
// Update the image
if (Input::file('image')) {
$image = Input::file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/assets/'.$file_name);
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$asset->image = $file_name;
}
// Was the asset updated?
if($asset->save()) {
// Redirect to the new asset page
@@ -1156,7 +1184,8 @@ class AssetsController extends AdminController
'notes',
'expected_checkin',
'order_number',
'location'
'location',
'image',
];
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
@@ -1208,6 +1237,7 @@ class AssetsController extends AdminController
$rows[] = array(
'checkbox' =>'<div class="text-center"><input type="checkbox" name="edit_asset['.$asset->id.']" class="one_required"></div>',
'id' => $asset->id,
'image' => ($asset->image!='') ? '<img src="'.Config::get('app.url').'/uploads/assets/'.$asset->image.'" height=50 width=50>' : (($asset->model->image!='') ? '<img src="'.Config::get('app.url').'/uploads/models/'.$asset->model->image.'" height=40 width=50>' : ''),
'name' => '<a title="'.$asset->name.'" href="hardware/'.$asset->id.'/view">'.$asset->name.'</a>',
'asset_tag' => '<a title="'.$asset->asset_tag.'" href="hardware/'.$asset->id.'/view">'.$asset->asset_tag.'</a>',
'serial' => $asset->serial,
@@ -299,6 +299,8 @@ class CategoriesController extends AdminController
foreach ($category_assets as $asset) {
$actions = '';
$inout='';
if ($asset->deleted_at=='') {
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm"><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/hardware', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
} elseif ($asset->deleted_at!='') {
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Image extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function(Blueprint $table)
{
$table->text('image')->after('notes')->nullable()->default(NULL);
//
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('assets', function ($table) {
$table->dropColumn('image');
});
}
}
+1
View File
@@ -18,6 +18,7 @@ return array(
'serial' => 'Serial',
'status' => 'Status',
'title' => 'Asset ',
'image' => 'Device Image',
'days_without_acceptance' => 'Days Without Acceptance'
);
+1
View File
@@ -140,4 +140,5 @@
'years' => 'years',
'yes' => 'Yes',
'zip' => 'Zip',
'noimage' => 'No image uploaded or image not found.',
];
@@ -71,6 +71,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
@@ -64,6 +64,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
@@ -69,6 +69,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
@@ -69,6 +69,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
@@ -67,6 +67,7 @@ $('#table').bootstrapTable({
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
+25 -3
View File
@@ -113,9 +113,9 @@
<div class="col-md-12 column">
@if ($asset->id)
<form class="form-horizontal" method="post" action="{{ route('update/hardware',$asset->id) }}" autocomplete="off" role="form">
<form class="form-horizontal" method="post" action="{{ route('update/hardware',$asset->id) }}" autocomplete="off" role="form" enctype="multipart/form-data" >
@else
<form class="form-horizontal" method="post" action="{{ route('savenew/hardware') }}" autocomplete="off" role="form">
<form class="form-horizontal" method="post" action="{{ route('savenew/hardware') }}" autocomplete="off" role="form" enctype="multipart/form-data">
@endif
<!-- CSRF Token -->
@@ -300,11 +300,33 @@
</div>
<!-- Image -->
@if ($asset->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-2 control-label" for="image_delete">@lang('general.image_delete')</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="/uploads/assets/{{{ $asset->image }}}" />
{{ $errors->first('image_delete', '<br><span class="alert-msg">:message</span>') }}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-2 control-label" for="image">@lang('general.image_upload')</label>
<div class="col-md-5">
{{ Form::file('image') }}
{{ $errors->first('image', '<br><span class="alert-msg">:message</span>') }}
</div>
</div>
<!-- Form actions -->
<div class="form-group">
<label class="col-md-2 control-label"></label>
<div class="col-md-7 col-sm-12">
<a class="btn btn-link" href="{{ URL::previous() }}">@lang('button.cancel')</a>
<a class="btn btn-link" href="{{ URL::previous() }}" method="post" enctype="multipart/form-data">@lang('button.cancel')</a>
<button type="submit" class="btn btn-success"><i class="fa fa-check icon-white"></i> @lang('general.save')</button>
</div>
</div>
@@ -67,6 +67,7 @@
<th data-class="hidden-xs" data-switchable="false" data-searchable="false" data-sortable="false" data-field="checkbox"><div class="text-center"><input type="checkbox" id="checkAll" style="padding-left: 0px;"></div></th>
<th data-sortable="true" data-field="id" data-visible="false">@lang('general.id')</th>
<th data-sortable="true" data-field="image" data-visible="false">@lang('admin/hardware/table.image')</th>
<th data-sortable="true" data-field="name" data-visible="false">@lang('admin/hardware/form.name')</th>
<th data-sortable="true" data-field="asset_tag">@lang('admin/hardware/table.asset_tag')</th>
<th data-sortable="true" data-field="serial">@lang('admin/hardware/table.serial')</th>
@@ -119,6 +120,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
+18 -8
View File
@@ -38,8 +38,6 @@
<li role="presentation"><a href="{{ route('clone/hardware', $asset->id) }}">@lang('admin/hardware/general.clone')</a></li>
</ul>
</div>
</div>
</div>
</div>
@@ -47,7 +45,6 @@
<div class="user-profile">
<div class="row profile">
<div class="col-md-9 bio">
@if ($asset->model->deleted_at!='')
<div class="alert alert-warning alert-block">
<i class="fa fa-warning"></i>
@@ -91,7 +88,7 @@
@if ($asset->purchase_cost)
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/hardware/form.cost'):</strong>
@if (($asset->id) && ($asset->userloc))
{{{ $asset->userloc->currency }}}
@elseif (($asset->id) && ($asset->assetloc))
@@ -144,6 +141,7 @@
@endif
@if ($asset->model->eol)
<div class="col-md-12" style="padding-bottom: 5px;">
<strong>@lang('admin/hardware/form.eol_rate'): </strong>
@@ -178,10 +176,11 @@
<div class="col-md-12">
<!-- Licenses assets table -->
<h6>Software Assigned </h6>
<br>
<!-- checked out assets table -->
@if (count($asset->licenses) > 0)
<table class="table table-hover">
<thead>
@@ -295,8 +294,6 @@
@else
{{{ $file->filename }}}
@endif
</td>
<td>
@if ($file->filename)
@@ -408,6 +405,17 @@
</ul>
@endif
<!-- Is there an asset or model image to show? -->
@if ($asset->image)
<img src="{{ Config::get('app.url') }}/uploads/assets/{{{ $asset->image }}}" class="assetimg">
@else
@if ($asset->model->image!='')
<img src="{{ Config::get('app.url') }}/uploads/models/{{{ $asset->model->image }}}" class="assetimg">
@endif
@endif
<!-- checked out assets table -->
@if (($asset->assigneduser) && ($asset->assigned_to > 0) && ($asset->deleted_at==''))
<h6><br>@lang('admin/hardware/form.checkedout_to')</h6>
@@ -415,6 +423,8 @@
<li><img src="{{{ $asset->assigneduser->gravatar() }}}" class="img-circle" style="width: 100px; margin-right: 20px;" /><br /><br /></li>
<li><a href="{{ route('view/user', $asset->assigned_to) }}">{{ $asset->assigneduser->fullName() }}</a></li>
<br>
@if (isset($asset->userloc))
@@ -66,6 +66,7 @@ Locations ::
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
@@ -80,6 +80,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
+2
View File
@@ -65,6 +65,8 @@
sortable: true,
mobileResponsive: true,
showExport: true,
cookie: true,
cookieExpire: '2y',
showColumns: true,
maintainSelected: true,
paginationFirstText: "@lang('general.first')",
@@ -63,6 +63,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
+1
View File
@@ -113,6 +113,7 @@
sidePagination: 'server',
sortable: true,
cookie: true,
cookieExpire: '2y',
mobileResponsive: true,
showExport: true,
showColumns: true,
+5
View File
@@ -9,3 +9,8 @@ To remove this comment, please support us and upgrade to SiteFlow Pro.
div.checker {
display: inline;
}
.assetimg {
max-width: 250px;
max-height: 250px;
}
View File