mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net> # Conflicts: # resources/lang/en/admin/locations/general.php
This commit is contained in:
commit
5bc5e9f108
|
@ -23,6 +23,7 @@ php7.4-xml \
|
||||||
php7.4-mbstring \
|
php7.4-mbstring \
|
||||||
php7.4-zip \
|
php7.4-zip \
|
||||||
php7.4-bcmath \
|
php7.4-bcmath \
|
||||||
|
php7.4-redis \
|
||||||
patch \
|
patch \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
|
|
|
@ -27,6 +27,7 @@ RUN apk add --no-cache \
|
||||||
php7-xmlwriter \
|
php7-xmlwriter \
|
||||||
php7-xmlreader \
|
php7-xmlreader \
|
||||||
php7-sodium \
|
php7-sodium \
|
||||||
|
php7-redis \
|
||||||
curl \
|
curl \
|
||||||
wget \
|
wget \
|
||||||
vim \
|
vim \
|
||||||
|
|
|
@ -841,6 +841,16 @@ class Helper
|
||||||
return preg_replace('/\s+/u', '_', trim($string));
|
return preg_replace('/\s+/u', '_', trim($string));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array (or null) of the the raw and formatted date object for easy use in
|
||||||
|
* the API and the bootstrap table listings.
|
||||||
|
*
|
||||||
|
* @param $date
|
||||||
|
* @param $type
|
||||||
|
* @param $array
|
||||||
|
* @return array|string|null
|
||||||
|
*/
|
||||||
|
|
||||||
public static function getFormattedDateObject($date, $type = 'datetime', $array = true)
|
public static function getFormattedDateObject($date, $type = 'datetime', $array = true)
|
||||||
{
|
{
|
||||||
if ($date == '') {
|
if ($date == '') {
|
||||||
|
@ -848,6 +858,21 @@ class Helper
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings = Setting::getSettings();
|
$settings = Setting::getSettings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrap this in a try/catch so that if Carbon crashes, for example if the $date value
|
||||||
|
* isn't actually valid, we don't crash out completely.
|
||||||
|
*
|
||||||
|
* While this *shouldn't* typically happen since we validate dates before entering them
|
||||||
|
* into the database (and we use date/datetime fields for native fields in the system),
|
||||||
|
* it is a possible scenario that a custom field could be created as an "ANY" field, data gets
|
||||||
|
* added, and then the custom field format gets edited later. If someone put bad data in the
|
||||||
|
* database before then - or if they manually edited the field's value - it will crash.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
$tmp_date = new \Carbon($date);
|
$tmp_date = new \Carbon($date);
|
||||||
|
|
||||||
if ($type == 'datetime') {
|
if ($type == 'datetime') {
|
||||||
|
@ -863,6 +888,12 @@ class Helper
|
||||||
}
|
}
|
||||||
|
|
||||||
return $dt['formatted'];
|
return $dt['formatted'];
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::warning($e);
|
||||||
|
return $date.' (Invalid '.$type.' value.)';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nicked from Drupal :)
|
// Nicked from Drupal :)
|
||||||
|
|
|
@ -519,12 +519,16 @@ class UsersController extends Controller
|
||||||
{
|
{
|
||||||
$this->authorize('view', User::class);
|
$this->authorize('view', User::class);
|
||||||
$this->authorize('view', License::class);
|
$this->authorize('view', License::class);
|
||||||
$user = User::where('id', $id)->withTrashed()->first();
|
|
||||||
$licenses = $user->licenses()->get();
|
|
||||||
|
|
||||||
|
if ($user = User::where('id', $id)->withTrashed()->first()) {
|
||||||
|
$licenses = $user->licenses()->get();
|
||||||
return (new LicensesTransformer())->transformLicenses($licenses, $licenses->count());
|
return (new LicensesTransformer())->transformLicenses($licenses, $licenses->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/users/message.user_not_found', compact('id'))));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the user's two-factor status
|
* Reset the user's two-factor status
|
||||||
*
|
*
|
||||||
|
|
|
@ -211,23 +211,35 @@ class LocationsController extends Controller
|
||||||
|
|
||||||
public function print_assigned($id)
|
public function print_assigned($id)
|
||||||
{
|
{
|
||||||
$location = Location::where('id', $id)->first();
|
|
||||||
|
if ($location = Location::where('id', $id)->first()) {
|
||||||
$parent = Location::where('id', $location->parent_id)->first();
|
$parent = Location::where('id', $location->parent_id)->first();
|
||||||
$manager = User::where('id', $location->manager_id)->first();
|
$manager = User::where('id', $location->manager_id)->first();
|
||||||
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
|
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
|
||||||
$assets = Asset::where('assigned_to', $id)->where('assigned_type', Location::class)->with('model', 'model.category')->get();
|
$assets = Asset::where('assigned_to', $id)->where('assigned_type', Location::class)->with('model', 'model.category')->get();
|
||||||
|
|
||||||
return view('locations/print')->with('assets', $assets)->with('users', $users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
|
return view('locations/print')->with('assets', $assets)->with('users', $users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function print_all_assigned($id)
|
public function print_all_assigned($id)
|
||||||
{
|
{
|
||||||
$location = Location::where('id', $id)->first();
|
if ($location = Location::where('id', $id)->first()) {
|
||||||
$parent = Location::where('id', $location->parent_id)->first();
|
$parent = Location::where('id', $location->parent_id)->first();
|
||||||
$manager = User::where('id', $location->manager_id)->first();
|
$manager = User::where('id', $location->manager_id)->first();
|
||||||
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
|
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
|
||||||
$assets = Asset::where('location_id', $id)->with('model', 'model.category')->get();
|
$assets = Asset::where('location_id', $id)->with('model', 'model.category')->get();
|
||||||
|
|
||||||
return view('locations/print')->with('assets', $assets)->with('users', $users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
|
return view('locations/print')->with('assets', $assets)->with('users', $users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
|
||||||
|
|
||||||
|
}
|
||||||
|
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,5 @@ return array(
|
||||||
'assigned_to' => 'Assigned To:',
|
'assigned_to' => 'Assigned To:',
|
||||||
'manager' => 'Manager',
|
'manager' => 'Manager',
|
||||||
'date' => 'Current Date:',
|
'date' => 'Current Date:',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -156,34 +156,23 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ trans('admin/locations/table.signed_by_asset_auditor') }}</td>
|
<td>{{ trans('admin/locations/table.signed_by_asset_auditor') }}</td>
|
||||||
<td>___________________________</td>
|
<td><br>------------------------------------------------------ <br></td>
|
||||||
<td></td>
|
|
||||||
<td>{{ trans('admin/locations/table.date') }}</td>
|
<td>{{ trans('admin/locations/table.date') }}</td>
|
||||||
<td>____________________</td>
|
<td><br>------------------------------ <br></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<table>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ trans('admin/locations/table.signed_by_finance_auditor') }}</td>
|
<td>{{ trans('admin/locations/table.signed_by_finance_auditor') }}</td>
|
||||||
<td>____________________</td>
|
<td><br>------------------------------------------------------ <br></td>
|
||||||
<td></td>
|
|
||||||
<td>{{ trans('admin/locations/table.date') }}</td>
|
<td>{{ trans('admin/locations/table.date') }}</td>
|
||||||
<td>____________________</td>
|
<td><br>------------------------------ <br></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<table>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ trans('admin/locations/table.signed_by_location_manager') }}</td>
|
<td>{{ trans('admin/locations/table.signed_by_location_manager') }}</td>
|
||||||
<td>_______________________</td>
|
<td><br>------------------------------------------------------ <br></td>
|
||||||
<td></td>
|
|
||||||
<td>{{ trans('admin/locations/table.date') }}</td>
|
<td>{{ trans('admin/locations/table.date') }}</td>
|
||||||
<td>____________________</td>
|
<td><br>------------------------------ <br></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -191,9 +191,20 @@
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<a href="{{ route('locations.edit', ['location' => $location->id]) }}" style="width: 100%;" class="btn btn-sm btn-primary pull-left">{{ trans('admin/locations/table.update') }} </a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12" style="padding-top: 5px;">
|
||||||
|
<a href="{{ route('locations.print_assigned', ['locationId' => $location->id]) }}" style="width: 100%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_assigned') }} </a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12" style="padding-top: 5px; padding-bottom: 20px;">
|
||||||
|
<a href="{{ route('locations.print_all_assigned', ['locationId' => $location->id]) }}" style="width: 100%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_all_assigned') }} </a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@if ($location->image!='')
|
@if ($location->image!='')
|
||||||
<div class="col-md-12 text-center" style="padding-bottom: 20px;">
|
<div class="col-md-12 text-center" style="padding-bottom: 20px;">
|
||||||
<img src="{{ Storage::disk('public')->url('locations/'.e($location->image)) }}" class="img-responsive img-thumbnail" alt="{{ $location->name }}">
|
<img src="{{ Storage::disk('public')->url('locations/'.e($location->image)) }}" class="img-responsive img-thumbnail" style="width:100%" alt="{{ $location->name }}">
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
@ -220,21 +231,13 @@
|
||||||
|
|
||||||
@if (($location->state!='') && ($location->country!='') && (config('services.google.maps_api_key')))
|
@if (($location->state!='') && ($location->country!='') && (config('services.google.maps_api_key')))
|
||||||
<div class="col-md-12 text-center">
|
<div class="col-md-12 text-center">
|
||||||
<img src="https://maps.googleapis.com/maps/api/staticmap?markers={{ urlencode($location->address.','.$location->city.' '.$location->state.' '.$location->country.' '.$location->zip) }}&size=500x300&maptype=roadmap&key={{ config('services.google.maps_api_key') }}" class="img-responsive img-thumbnail" alt="Map">
|
<img src="https://maps.googleapis.com/maps/api/staticmap?markers={{ urlencode($location->address.','.$location->city.' '.$location->state.' '.$location->country.' '.$location->zip) }}&size=700x500&maptype=roadmap&key={{ config('services.google.maps_api_key') }}" class="img-thumbnail" style="width:100%" alt="Map">
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
<a href="{{ route('locations.edit', ['location' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-primary pull-left">{{ trans('admin/locations/table.update') }} </a>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12" style="padding-top: 5px;">
|
|
||||||
<a href="{{ route('locations.print_assigned', ['locationId' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_assigned') }} </a>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-12" style="padding-top: 5px;">
|
|
||||||
<a href="{{ route('locations.print_all_assigned', ['locationId' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_all_assigned') }} </a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue