mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Merge remote-tracking branch 'snipe-it-upstream/develop' into develop
This commit is contained in:
commit
1dff71e4df
|
@ -43,6 +43,8 @@ MAIL_FROM_ADDR=you@example.com
|
|||
MAIL_FROM_NAME='Snipe-IT'
|
||||
MAIL_REPLYTO_ADDR=you@example.com
|
||||
MAIL_REPLYTO_NAME='Snipe-IT'
|
||||
MAIL_AUTO_EMBED=true
|
||||
MAIL_AUTO_EMBED_METHOD=base64
|
||||
|
||||
# --------------------------------------------
|
||||
# REQUIRED: IMAGE LIBRARY
|
||||
|
|
61
app/Console/Commands/SendCurrentInventoryToUsers.php
Normal file
61
app/Console/Commands/SendCurrentInventoryToUsers.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Asset;
|
||||
use App\Models\User;
|
||||
use App\Notifications\CurrentInventory;
|
||||
|
||||
class SendCurrentInventoryToUsers extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'snipeit:user-inventory';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'This will send users a report of all of the items currently checked out to them.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$users = User::whereNull('deleted_at')->whereNotNull('email')->with('assets', 'accessories', 'licenses')->get();
|
||||
|
||||
$count = 0;
|
||||
foreach ($users as $user) {
|
||||
|
||||
if (($user->assets->count() > 0) || ($user->accessories->count() > 0) || ($user->licenses->count() > 0))
|
||||
{
|
||||
$count++;
|
||||
$user->notify((new CurrentInventory($user)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->info($count.' users notified.');
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ class Kernel extends ConsoleKernel
|
|||
Commands\RegenerateAssetTags::class,
|
||||
Commands\SyncAssetCounters::class,
|
||||
Commands\RestoreDeletedUsers::class,
|
||||
Commands\SendCurrentInventoryToUsers::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -733,6 +733,12 @@ class AssetsController extends Controller
|
|||
$asset->next_audit_date = $request->input('next_audit_date');
|
||||
}
|
||||
|
||||
// Check to see if they checked the box to update the physical location,
|
||||
// not just note it in the audit notes
|
||||
if ($request->input('update_location')=='1') {
|
||||
$asset->location_id = $request->input('location_id');
|
||||
}
|
||||
|
||||
$asset->last_audit_date = date('Y-m-d h:i:s');
|
||||
|
||||
if ($asset->save()) {
|
||||
|
|
|
@ -763,6 +763,14 @@ class AssetsController extends Controller
|
|||
$asset->next_audit_date = $request->input('next_audit_date');
|
||||
$asset->last_audit_date = date('Y-m-d h:i:s');
|
||||
|
||||
// Check to see if they checked the box to update the physical location,
|
||||
// not just note it in the audit notes
|
||||
if ($request->input('update_location')=='1') {
|
||||
\Log::debug('update location in audit');
|
||||
$asset->location_id = $request->input('location_id');
|
||||
}
|
||||
|
||||
|
||||
if ($asset->save()) {
|
||||
|
||||
|
||||
|
|
|
@ -42,14 +42,19 @@ class CustomFieldsetsController extends Controller
|
|||
if ($cfset) {
|
||||
$custom_fields_list = ["" => "Add New Field to Fieldset"] + CustomField::pluck("name", "id")->toArray();
|
||||
|
||||
|
||||
$maxid = 0;
|
||||
foreach ($cfset->fields() as $field) {
|
||||
if ($field->pivot->order > $maxid) {
|
||||
$maxid=$field->pivot->order;
|
||||
}
|
||||
if (isset($custom_fields_list[$field->id])) {
|
||||
unset($custom_fields_list[$field->id]);
|
||||
|
||||
if ($field) {
|
||||
if ($field->pivot->order > $maxid) {
|
||||
$maxid=$field->pivot->order;
|
||||
}
|
||||
if (isset($custom_fields_list[$field->id])) {
|
||||
unset($custom_fields_list[$field->id]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return view("custom_fields.fieldsets.view")
|
||||
|
|
|
@ -1360,8 +1360,8 @@ class Asset extends Depreciable
|
|||
*/
|
||||
public function scopeInCategory($query, $category_id)
|
||||
{
|
||||
return $query->join('models', 'assets.model_id', '=', 'models.id')
|
||||
->join('categories', 'models.category_id', '=', 'categories.id')->where('models.category_id', '=', $category_id);
|
||||
return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id')
|
||||
->join('categories', 'category_models.category_id', '=', 'categories.id')->where('category_models.category_id', '=', $category_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,6 +87,7 @@ class CustomField extends Model
|
|||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
self::created(function ($custom_field) {
|
||||
|
||||
// Column already exists on the assets table - nothing to do here.
|
||||
|
|
66
app/Notifications/CurrentInventory.php
Normal file
66
app/Notifications/CurrentInventory.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class CurrentInventory extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$message = (new MailMessage)->markdown('notifications.markdown.user-inventory',
|
||||
[
|
||||
'assets' => $this->user->assets,
|
||||
'accessories' => $this->user->accessories,
|
||||
'licenses' => $this->user->licenses,
|
||||
])
|
||||
->subject('Inventory Report');
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
|
@ -13,11 +13,12 @@
|
|||
"doctrine/dbal": "^2.8.0",
|
||||
"doctrine/inflector": "1.3.*",
|
||||
"doctrine/instantiator": "1.1.*",
|
||||
"eduardokum/laravel-mail-auto-embed": "^1.0",
|
||||
"erusev/parsedown": "^1.6",
|
||||
"fideloper/proxy": "~4.0",
|
||||
"intervention/image": "^2.3",
|
||||
"javiereguiluz/easyslugger": "^1.0",
|
||||
"laravel/framework": "5.6.30",
|
||||
"laravel/framework": "5.7.*",
|
||||
"laravel/passport": "~6.0",
|
||||
"laravel/tinker": "^1.0",
|
||||
"laravelcollective/html": "^5.3",
|
||||
|
@ -39,7 +40,7 @@
|
|||
"tecnickcom/tc-lib-barcode": "^1.15",
|
||||
"tightenco/ziggy": "^0.6.3",
|
||||
"unicodeveloper/laravel-password": "^1.0",
|
||||
"watson/validating": "^3.0"
|
||||
"watson/validating": "3.1.7"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "^2.4",
|
||||
|
|
480
composer.lock
generated
480
composer.lock
generated
File diff suppressed because it is too large
Load diff
28
config/mail-auto-embed.php
Normal file
28
config/mail-auto-embed.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail auto embed
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If true, images will be automatically embedded.
|
||||
| If false, only images with the 'data-auto-embed' attribute will be embedded
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled' => env('MAIL_AUTO_EMBED', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail embed method
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Supported: "attachment", "base64"
|
||||
|
|
||||
*/
|
||||
|
||||
'method' => env('MAIL_AUTO_EMBED_METHOD', 'base64'),
|
||||
|
||||
];
|
|
@ -53,6 +53,18 @@
|
|||
<!-- Locations -->
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
|
||||
|
||||
<!-- Update location -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-md-9">
|
||||
<label>
|
||||
<input type="checkbox" value="1" name="update_location" class="minimal" {{ Input::old('update_location') == '1' ? ' checked="checked"' : '' }}> Update asset location
|
||||
</label>
|
||||
sdd
|
||||
<p class="help-block">Checking this box will edit the asset record to reflect this new location. Leaving it unchecked will simply note the location in the audit log.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Next Audit -->
|
||||
<div class="form-group {{ $errors->has('next_audit_date') ? 'error' : '' }}">
|
||||
|
|
|
@ -46,6 +46,16 @@
|
|||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
|
||||
|
||||
|
||||
<!-- Update location -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-md-9">
|
||||
<label>
|
||||
<input type="checkbox" value="1" name="update_location" class="minimal" {{ Input::old('update_location') == '1' ? ' checked="checked"' : '' }}> Update asset location
|
||||
</label> <a href="#" class="text-dark-gray" tabindex="0" role="button" data-toggle="popover" data-trigger="focus" title="More Info" data-html="true" data-content="Checking this box will edit the asset record to reflect this new location. Leaving it unchecked will simply note the location in the audit log.<br><br>Note that is this asset is checked out, it will not change the location of the person, asset or location it is checked out to."><i class="fa fa-life-ring"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Next Audit -->
|
||||
<div class="form-group {{ $errors->has('next_audit_date') ? 'error' : '' }}">
|
||||
{{ Form::label('next_audit_date', trans('general.next_audit_date'), array('class' => 'col-md-3 control-label')) }}
|
||||
|
|
|
@ -803,8 +803,11 @@
|
|||
@show
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
|
||||
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$('[data-toggle="popover"]').popover();
|
||||
$('.select2 span').addClass('needsclick');
|
||||
|
||||
// This javascript handles saving the state of the menu (expanded or not)
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
@component('mail::message')
|
||||
|
||||
This is a reminder of the items currently checked out to you. If you feel this list is inaccurate (something is missing, or something appears here that you believe you never received), please email {{ config('mail.reply_to.name') }} at {{ config('mail.reply_to.address') }}.
|
||||
|
||||
|
||||
@component('mail::table')
|
||||
|
||||
@if ($assets->count() > 0)
|
||||
## {{ $assets->count() }} Assets
|
||||
|{{ trans('mail.name') }} |{{ trans('mail.asset_tag') }} |
|
||||
|:------------- |:-------------|:---------|
|
||||
@foreach($assets as $asset)
|
||||
|{{ $asset->present()->name }} |{{ $asset->asset_tag }} |
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if ($accessories->count() > 0)
|
||||
## {{ $accessories->count() }} Accessories
|
||||
|{{ trans('mail.name') }} |
|
||||
| |:------------- |
|
||||
@foreach($accessories as $accessory)
|
||||
|{{ $accessory->name }} |
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if ($licenses->count() > 0)
|
||||
## {{ $licenses->count() }} Licenses
|
||||
|
||||
| |:------------- |
|
||||
@foreach($licenses as $license)
|
||||
|{{ $asset->$license }} |
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
|
||||
@endcomponent
|
||||
|
||||
|
||||
@endcomponent
|
|
@ -132,7 +132,7 @@
|
|||
text_help = '';
|
||||
}
|
||||
|
||||
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '" data-tooltip="true" title="'+ status_meta[value.status_meta] + '"> <i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + value.name + ' ' + text_help + ' </a> </nobr>';
|
||||
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '" data-toggle="tooltip" title="'+ status_meta[value.status_meta] + '"> <i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + value.name + ' ' + text_help + ' </a> </nobr>';
|
||||
} else if ((value) && (value.name)) {
|
||||
|
||||
// Add some overrides for any funny urls we have
|
||||
|
@ -164,11 +164,11 @@
|
|||
}
|
||||
|
||||
if ((row.available_actions) && (row.available_actions.clone === true)) {
|
||||
actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/clone" class="btn btn-sm btn-info" data-tooltip="true" title="Clone"><i class="fa fa-copy"></i></a> ';
|
||||
actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/clone" class="btn btn-sm btn-info" data-toggle="tooltip" title="Clone"><i class="fa fa-copy"></i></a> ';
|
||||
}
|
||||
|
||||
if ((row.available_actions) && (row.available_actions.update === true)) {
|
||||
actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/edit" class="btn btn-sm btn-warning" data-tooltip="true" title="Update"><i class="fa fa-pencil"></i></a> ';
|
||||
actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/edit" class="btn btn-sm btn-warning" data-toggle="tooltip" title="Update"><i class="fa fa-pencil"></i></a> ';
|
||||
}
|
||||
|
||||
if ((row.available_actions) && (row.available_actions.delete === true)) {
|
||||
|
@ -183,7 +183,7 @@
|
|||
}
|
||||
|
||||
if ((row.available_actions) && (row.available_actions.restore === true)) {
|
||||
actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/restore" class="btn btn-sm btn-warning" data-tooltip="true" title="Restore"><i class="fa fa-retweet"></i></a> ';
|
||||
actions += '<a href="{{ url('/') }}/' + dest + '/' + row.id + '/restore" class="btn btn-sm btn-warning" data-toggle="tooltip" title="Restore"><i class="fa fa-retweet"></i></a> ';
|
||||
}
|
||||
|
||||
actions +='</nobr>';
|
||||
|
@ -224,7 +224,7 @@
|
|||
item_icon = 'fa-map-marker';
|
||||
}
|
||||
|
||||
return '<nobr><a href="{{ url('/') }}/' + item_destination +'/' + value.id + '" data-tooltip="true" title="' + value.type + '"><i class="fa ' + item_icon + ' text-blue"></i> ' + value.name + '</a></nobr>';
|
||||
return '<nobr><a href="{{ url('/') }}/' + item_destination +'/' + value.id + '" data-toggle="tooltip" title="' + value.type + '"><i class="fa ' + item_icon + ' text-blue"></i> ' + value.name + '</a></nobr>';
|
||||
|
||||
} else {
|
||||
return '';
|
||||
|
@ -552,4 +552,4 @@
|
|||
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
@endpush
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
@if ($snipeSettings->brand == '3')
|
||||
@if ($snipeSettings->logo!='')
|
||||
<img class="navbar-brand-img logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
|
||||
<img class="navbar-brand-img logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}"alt="{{ $snipeSettings->site_name }}">
|
||||
@endif
|
||||
{{ $snipeSettings->site_name }}
|
||||
|
||||
@elseif ($snipeSettings->brand == '2')
|
||||
@if ($snipeSettings->logo!='')
|
||||
<img class="navbar-brand-img logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
|
||||
<img class="navbar-brand-img logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}" alt="{{ $snipeSettings->site_name }}">
|
||||
@endif
|
||||
@else
|
||||
{{ $snipeSettings->site_name }}
|
||||
|
|
|
@ -88,7 +88,7 @@ echo "--------------------------------------------------------\n\n";
|
|||
|
||||
|
||||
if (file_exists('bootstrap/cache/compiled.php')) {
|
||||
echo "-- Deleting bootstrap/cache/compiled.php. It it no longer used.\n";
|
||||
echo "-- Deleting bootstrap/cache/compiled.php. It is no longer used.\n";
|
||||
@unlink('bootstrap/cache/compiled.php');
|
||||
} else {
|
||||
echo "-- No bootstrap/cache/compiled.php, so nothing to delete.\n";
|
||||
|
|
Loading…
Reference in a new issue