Compare commits

..

No commits in common. "c0a1da23ecf1b15480e4f8d0e9487551690d0f2e" and "473ead9616d8870ffd49e0f447cc78fc97be500c" have entirely different histories.

18 changed files with 41 additions and 90 deletions

View file

@ -26,10 +26,6 @@
"description": "URL where your Snipe-IT install will be available at.",
"value": "https://your-app-name.herokuapp.com"
},
"LABEL_URL": {
"description": "Labels",
"value": "https://your-app-name.herokuapp.com"
},
"APP_TIMEZONE": {
"description": "Which timezone do you want to use for your install? (http://php.net/manual/en/timezones.php)",
"value": "UTC"

View file

@ -5,8 +5,6 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Transformers\ActionlogsTransformer;
use App\Models\Actionlog;
use App\Models\Company;
use App\Models\Setting;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
@ -20,11 +18,10 @@ class ReportsController extends Controller
*/
public function index(Request $request) : JsonResponse | array
{
$this->authorize('activity.view');
$this->authorize('reports.view');
$actionlogs = Actionlog::with('item', 'user', 'adminuser', 'target', 'location');
if ($request->filled('search')) {
$actionlogs = $actionlogs->TextSearch(e($request->input('search')));
}

View file

@ -238,8 +238,8 @@ class CustomFieldsController extends Controller
$display_in_user_view = '0';
}
$field->name = trim($request->get("name"));
$field->element = $request->get("element");
$field->name = trim(e($request->get("name")));
$field->element = e($request->get("element"));
$field->field_values = $request->get("field_values");
$field->created_by = auth()->id();
$field->help_text = $request->get("help_text");
@ -254,9 +254,9 @@ class CustomFieldsController extends Controller
$field->display_audit = $request->get("display_audit", 0);
if ($request->get('format') == 'CUSTOM REGEX') {
$field->format = $request->get('custom_format');
$field->format = e($request->get('custom_format'));
} else {
$field->format = $request->get('format');
$field->format = e($request->get('format'));
}
if ($field->element == 'checkbox' || $field->element == 'radio'){

View file

@ -485,7 +485,7 @@ class ReportsController extends Controller
$header[] = trans('admin/hardware/table.purchase_date');
}
if ($request->filled('purchase_cost')) {
if (($request->filled('purchase_cost')) || ($request->filled('depreciation'))) {
$header[] = trans('admin/hardware/table.purchase_cost');
}

View file

@ -70,7 +70,6 @@ class TZe_24mm_D extends TZe_24mm
}
foreach ($record->get('fields') as $field) {
if (!empty($field['label']) && $field['label'] !== "\u{200B}") {
// Write label and value on the same line
// Calculate label width with proportional character spacing
$labelWidth = $pdf->GetStringWidth($field['label'], 'freemono', '', self::LABEL_SIZE);
@ -92,16 +91,6 @@ class TZe_24mm_D extends TZe_24mm
'freemono', 'B', self::FIELD_SIZE, 'L',
$usableWidth - $adjustedWidth - 2, self::FIELD_SIZE, true, 0, 0.3
);
} else {
// Label is empty, so write value only.
static::writeText(
$pdf, $field['value'],
$currentX, $currentY, // No offset
'freemono', 'B', self::FIELD_SIZE, 'L',
$usableWidth, self::FIELD_SIZE, true, 0, 0.3
);
}
$currentY += max(self::LABEL_SIZE, self::FIELD_SIZE) + self::FIELD_MARGIN;
}

View file

@ -33,7 +33,7 @@ class LocationPresenter extends Presenter
'switchable' => true,
'title' => trans('general.company'),
'visible' => false,
'formatter' => 'companiesLinkObjFormatter'
'formatter' => 'locationCompanyObjFilterFormatter'
],
[
'field' => 'name',

View file

@ -168,15 +168,6 @@ class AuthServiceProvider extends ServiceProvider
}
});
// -----------------------------------------
// Activity
// -----------------------------------------
Gate::define('activity.view', function ($user) {
if (($user->hasAccess('reports.view')) || ($user->hasAccess('admin'))) {
return true;
}
});
// -----------------------------------------
// Self
// -----------------------------------------

View file

@ -385,7 +385,6 @@ class BreadcrumbsServiceProvider extends ServiceProvider
Breadcrumbs::for('locations.edit', fn (Trail $trail, Location $location) =>
$trail->parent('locations.index', route('locations.index'))
->push($location->name, route('locations.show', $location))
->push(trans('general.breadcrumb_button_actions.edit_item', ['name' => $location->name]), route('locations.edit', $location))
);

View file

@ -142,9 +142,6 @@ class Label implements View
case 'location':
$barcode2DTarget = route('locations.show', $asset->location_id);
break;
case 'custom_url_hardware_id':
$barcode2DTarget = route('hardware.show', $asset);
break;
case 'hardware_id':
default:
$barcode2DTarget = route('hardware.show', $asset);
@ -180,13 +177,10 @@ class Label implements View
// The end result of this will be in this format:
// {labelOne} {valueOne} | {labelTwo} {valueTwo} | {labelThree} {valueThree}
$previous['value'] = trim(implode(' | ', [
implode(' ', [$previous['label'], $previous['value']]),
implode(' ', [null, $previous['value']]),
implode(' ', [$current['label'], $current['value']]),
]));
// We'll set the label to an empty string since we
// injected the label into the value field above.
$previous['label'] = '';
return $previous;
});

View file

@ -74,7 +74,6 @@ return [
*/
'url' => env('APP_URL', 'http://localhost'),
'label_url' => env('LABEL_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------

View file

@ -390,8 +390,6 @@ return [
'new_license' => 'New License',
'new_accessory' => 'New Accessory',
'new_consumable' => 'New Consumable',
'new_component' => 'New Component',
'new_user' => 'New User',
'collapse' => 'Collapse',
'assigned' => 'Assigned',
'asset_count' => 'Asset Count',

View file

@ -172,7 +172,6 @@ return [
'url' => 'The :attribute field must be a valid URL.',
'ulid' => 'The :attribute field must be a valid ULID.',
'uuid' => 'The :attribute field must be a valid UUID.',
'fmcs_location' => 'Full multiple company support and location scoping is enabled in the Admin Settings, and the selected location and selected company are not compatible.',
/*

View file

@ -172,36 +172,26 @@
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="col-md-3">
@can('create', \App\Models\Asset::class)
<a class="btn bg-teal" style="width: 100%" href="{{ route('hardware.create') }}">{{ trans('general.new_asset') }}</a>
@endcan
</div>
<div class="col-md-2">
<div class="col-md-3">
@can('create', \App\Models\License::class)
<a class="btn bg-maroon" style="width: 100%" href="{{ route('licenses.create') }}">{{ trans('general.new_license') }}</a>
@endcan
</div>
<div class="col-md-2">
<div class="col-md-3">
@can('create', \App\Models\Accessory::class)
<a class="btn bg-orange" style="width: 100%" href="{{ route('accessories.create') }}">{{ trans('general.new_accessory') }}</a>
@endcan
</div>
<div class="col-md-2">
<div class="col-md-3">
@can('create', \App\Models\Consumable::class)
<a class="btn bg-purple" style="width: 100%" href="{{ route('consumables.create') }}">{{ trans('general.new_consumable') }}</a>
@endcan
</div>
<div class="col-md-2">
@can('create', \App\Models\Component::class)
<a class="btn bg-yellow" style="width: 100%" href="{{ route('components.create') }}">{{ trans('general.new_component') }}</a>
@endcan
</div>
<div class="col-md-2">
@can('create', \App\Models\User::class)
<a class="btn bg-light-blue" style="width: 100%" href="{{ route('users.create') }}">{{ trans('general.new_user') }}</a>
@endcan
</div>
</div>
</div>
</div>
@ -292,7 +282,7 @@
<div class="row">
<div class="col-md-6">
@if ((($snipeSettings->scope_locations_fmcs!='1') && ($snipeSettings->full_multiple_companies_support=='1')))
@if ($snipeSettings->full_multiple_companies_support=='1')
<!-- Companies -->
<div class="box box-default">
<div class="box-header with-border">

View file

@ -217,7 +217,7 @@
$.ajax({
type: 'GET',
url: "{{ config('app.label_url') }}/models/" + modelid + "/custom_fields",
url: "{{ config('app.url') }}/models/" + modelid + "/custom_fields",
headers: {
"X-Requested-With": 'XMLHttpRequest',
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
@ -260,7 +260,7 @@
if (status_id != '') {
$(".status_spinner").css("display", "inline");
$.ajax({
url: "{{config('app.label_url') }}/api/v1/statuslabels/" + status_id + "/deployable",
url: "{{config('app.url') }}/api/v1/statuslabels/" + status_id + "/deployable",
headers: {
"X-Requested-With": 'XMLHttpRequest',
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')

View file

@ -112,7 +112,7 @@ $qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->label2_1d_type!=
@if ($settings->qr_code=='1')
<div class="qr_img">
<img src="{{ config('app.label_url') }}/hardware/{{ $asset->id }}/qr_code" class="qr_img">
<img src="{{ config('app.url') }}/hardware/{{ $asset->id }}/qr_code" class="qr_img">
</div>
@endif
@ -158,7 +158,7 @@ $qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->label2_1d_type!=
@if ((($settings->alt_barcode_enabled=='1') && $settings->label2_1d_type!=''))
<div class="barcode_container">
<img src="{{ config('app.label_url') }}/hardware/{{ $asset->id }}/barcode" class="barcode">
<img src="{{ config('app.url') }}/hardware/{{ $asset->id }}/barcode" class="barcode">
</div>
@endif

View file

@ -276,7 +276,7 @@
function genericRowLinkFormatter(destination) {
return function (value,row) {
if (value) {
return '<a href="{{ config('app.label_url') }}/' + destination + '/' + row.id + '">' + value + '</a>';
return '<a href="{{ config('app.url') }}/' + destination + '/' + row.id + '">' + value + '</a>';
}
};
}
@ -318,7 +318,7 @@
text_help = '';
}
return '<nobr><a href="{{ config('app.label_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="{{ config('app.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>';
} else if ((value) && (value.name)) {
// Add some overrides for any funny urls we have
@ -328,7 +328,7 @@
var dpolymorphicItemFormatterest = 'fields/';
}
return '<nobr><a href="{{ config('app.label_url') }}/' + dpolymorphicItemFormatterest + dest + '/' + value.id + '">' + value.name + '</a></span>';
return '<nobr><a href="{{ config('app.url') }}/' + dpolymorphicItemFormatterest + dest + '/' + value.id + '">' + value.name + '</a></span>';
}
};
}
@ -341,7 +341,7 @@
function hardwareAuditFormatter(value, row) {
return '<a href="{{ config('app.label_url') }}/hardware/' + row.id + '/audit" class="btn btn-sm bg-yellow" data-tooltip="true" title="Audit this item">{{ trans('general.audit') }}</a>';
return '<a href="{{ config('app.url') }}/hardware/' + row.id + '/audit" class="btn btn-sm bg-yellow" data-tooltip="true" title="Audit this item">{{ trans('general.audit') }}</a>';
}

View file

@ -303,7 +303,6 @@
id="label2_2d_target"
:options="['hardware_id'=>'/hardware/{id} ('.trans('admin/settings/general.default').')',
'ht_tag'=>'/ht/{asset_tag}',
'custom_url_hardware_id'=>'/hardware/{id}',
'location' => '/location/{location_id}',
]"
:selected="old('label2_2d_target', $setting->label2_2d_target)"

View file

@ -91,7 +91,7 @@
function statuslabelsAssetLinkFormatter(value, row) {
if ((row) && (row.name)) {
return '<a href="{{ config('app.label_url') }}/hardware/?status_id=' + row.id + '"> ' + row.name + '</a>';
return '<a href="{{ config('app.url') }}/hardware/?status_id=' + row.id + '"> ' + row.name + '</a>';
}
}