Merge branch '2.0' of https://github.com/snipe/snipe-it into 2.0

This commit is contained in:
Vincent Sposato
2015-07-23 20:17:01 -04:00
10 changed files with 131 additions and 11 deletions
@@ -218,7 +218,7 @@ class AccessoriesController extends AdminController
}
// Get the dropdown of users and then pass it to the checkout view
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",email,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
return View::make('backend/accessories/checkout', compact('accessory'))->with('users_list',$users_list);
@@ -322,6 +322,10 @@ class AccessoriesController extends AdminController
$data['eula'] = $accessory->getEula();
$data['first_name'] = $user->first_name;
$data['item_name'] = $accessory->name;
$data['checkout_date'] = $logaction->created_at;
$data['item_tag'] = '';
$data['expected_checkin'] = '';
$data['note'] = $logaction->note;
$data['require_acceptance'] = $accessory->requireAcceptance();
+10 -4
View File
@@ -377,7 +377,7 @@ class AssetsController extends AdminController
}
// Get the dropdown of users and then pass it to the checkout view
$users_list = array('' => Lang::get('general.select_user')) + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",email,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
$users_list = array('' => Lang::get('general.select_user')) + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
return View::make('backend/hardware/checkout', compact('asset'))->with('users_list',$users_list);
@@ -426,14 +426,16 @@ class AssetsController extends AdminController
// Was the asset updated?
if($asset->save()) {
$logaction = new Actionlog();
if (Input::has('checkout_at')) {
if (Input::has('checkout_at')) {
if (Input::get('checkout_at')!= date("Y-m-d")){
$logaction->created_at = e(Input::get('checkout_at')).' 00:00:00';
}
}
if (Input::has('expected_checkin')) {
$logaction->expected_checkin = e(Input::get('expected_checkin'));
}
$logaction->asset_id = $asset->id;
$logaction->checkedout_to = $asset->assigned_to;
@@ -447,6 +449,10 @@ class AssetsController extends AdminController
$data['eula'] = $asset->getEula();
$data['first_name'] = $user->first_name;
$data['item_name'] = $asset->showAssetName();
$data['checkout_date'] = $logaction->created_at;
$data['expected_checkin'] = $logaction->expected_checkin;
$data['item_tag'] = $asset->asset_tag;
$data['note'] = $logaction->note;
$data['require_acceptance'] = $asset->requireAcceptance();
$settings = Setting::getSettings();
@@ -218,7 +218,7 @@ class ConsumablesController extends AdminController
}
// Get the dropdown of users and then pass it to the checkout view
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",email,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
return View::make('backend/consumables/checkout', compact('consumable'))->with('users_list',$users_list);
@@ -322,6 +322,10 @@ class ConsumablesController extends AdminController
$data['eula'] = $consumable->getEula();
$data['first_name'] = $user->first_name;
$data['item_name'] = $consumable->name;
$data['checkout_date'] = $logaction->created_at;
$data['item_tag'] = '';
$data['expected_checkin'] = '';
$data['note'] = $logaction->note;
$data['require_acceptance'] = $consumable->requireAcceptance();
+7 -1
View File
@@ -100,6 +100,12 @@ class LicensesController extends AdminController
} else {
$license->maintained = e(Input::get('maintained'));
}
if ( e(Input::get('reassignable')) == '') {
$license->reassignable = 0;
} else {
$license->reassignable = e(Input::get('reassignable'));
}
if ( e(Input::get('purchase_order')) == '') {
$license->purchase_order = '';
@@ -408,7 +414,7 @@ class LicensesController extends AdminController
}
// Get the dropdown of users and then pass it to the checkout view
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",email,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
// Left join to get a list of assets and some other helpful info
+1 -1
View File
@@ -131,7 +131,7 @@ class ModelsController extends AdminController
$depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id');
$manufacturer_list = array('' => 'Select One') + Manufacturer::lists('name', 'id');
$category_list = array('' => '') + DB::table('categories')->lists('name', 'id');
$category_list = array('' => '') + DB::table('categories')->whereNull('deleted_at')->lists('name', 'id');
$view = View::make('backend/models/edit', compact('model'));
$view->with('category_list',$category_list);
$view->with('depreciation_list',$depreciation_list);
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddExpectedCheckinDateToAssetLogs extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('asset_logs', function ($table) {
$table->date('expected_checkin')->nullable()->default(NULL);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('asset_logs', function(Blueprint $table)
{
$table->dropColumn('expected_checkin');
});
}
}
+1
View File
@@ -17,6 +17,7 @@ return array(
'default_location' => 'Default Location',
'eol_date' => 'EOL Date',
'eol_rate' => 'EOL Rate',
'expected_checkin' => 'Expected Checkin Date',
'expires' => 'Expires',
'fully_depreciated' => 'Fully Depreciated',
'help_checkout' => 'If you wish to assign this asset immediately, select "Ready to Deploy" from the status list above. ',
@@ -74,6 +74,16 @@
{{ $errors->first('checkout_at', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Expected Checkin Date -->
<div class="form-group {{ $errors->has('expected_checkin') ? ' has-error' : '' }}">
<label for="checkout_at" class="col-md-2 control-label">@lang('admin/hardware/form.expected_checkin')</label>
<div class="input-group col-md-3">
<input type="date" class="datepicker form-control" data-date-format="yyyy-mm-dd" placeholder="Expected Checkin Date" name="expected_checkin" id="expected_checkin" value="{{{ Input::old('expected_checkin') }}}">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
{{ $errors->first('expected_checkin', '<br><span class="alert-msg"><i class="fa fa-times"></i> :message</span>') }}
</div>
</div>
<!-- Note -->
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
@@ -491,6 +491,10 @@
<ul>
@if (($asset->assetstatus->deployable=='1') && ($asset->assigned_to > 0) && ($asset->deleted_at==''))
@if ($asset->assetlog->first()->expected_checkin)
<li><br />@lang('admin/hardware/form.expected_checkin')
: {{{ date('Y-m-d', strtotime($asset->assetlog->first()->expected_checkin)) }}}</li>
@endif
<li><br /><a href="{{ route('checkin/hardware', $asset->id) }}" class="btn btn-primary btn-sm">@lang('admin/hardware/general.checkin')</a></li>
@elseif ((($asset->assetstatus->deployable=='1') && (($asset->assigned_to=='') || ($asset->assigned_to==0))) && ($asset->deleted_at==''))
<li><br /><a href="{{ route('checkout/hardware', $asset->id) }}" class="btn btn-info btn-sm">@lang('admin/hardware/general.checkout')</a></li>
+51 -3
View File
@@ -4,7 +4,56 @@
<p>Hello {{{ $first_name }}},</p>
<p>A new item ({{{ strtoupper($item_name) }}}) has been checked out to you.
<p>A new item has been checked out to under your name, details are below.
<table>
<tr>
<td style="background-color:#ccc">
Asset Name:
</td>
<td>
<strong>{{{ $item_name }}}</strong>
</td>
</tr>
@if ($item_tag)
<tr>
<td style="background-color:#ccc">
Asset Tag:
</td>
<td>
<strong>{{{ $item_tag }}}</strong>
</td>
</tr>
@endif
<tr>
<td style="background-color:#ccc">
Checkout Date:
</td>
<td>
<strong>{{{ $checkout_date }}}</strong>
</td>
</tr>
@if ($expected_checkin)
<tr>
<td style="background-color:#ccc">
Expected Checkin Date:
</td>
<td>
<strong>{{{ $expected_checkin }}}</strong>
</td>
</tr>
@endif
@if ($note)
<tr>
<td style="background-color:#ccc">
Additional Notes:
</td>
<td>
<strong>{{{ $note }}}</strong>
</td>
</tr>
@endif
</table>
@if (($require_acceptance==1) && ($eula!=''))
@@ -22,8 +71,7 @@
</p>
<p>{{ $eula }}</p>
<p><blockquote>{{ $eula }}</blockquote></p>
@if ($require_acceptance==1)
<p><strong><a href="{{{ Config::get('app.url') }}}/account/accept-asset/{{ $log_id }}">I have read and agree to the terms of use, and have received this item.</a></strong></p>