Skip to content

A free open source IT asset/license management system

Move notes above custom fields

sniped1085a0f4682
diff --git a/app/Models/CustomFieldset.php b/app/Models/CustomFieldset.php
index 987eb3b7d0..c06f4dc0eb 100644
--- a/app/Models/CustomFieldset.php
+++ b/app/Models/CustomFieldset.php
@@ -73,16 +73,24 @@ class CustomFieldset extends Model
public function displayAnyFieldsInForm($form_type = null)
{
- switch ($form_type) {
- case 'audit':
- return $this->displayFieldInAuditForm();
- case 'checkin':
- return $this->displayFieldInCheckinForm();
- case 'checkout':
- return $this->displayFieldInCheckoutForm();
- default:
- return true;
+ if ($this->fields) {
+ // \Log::error(print_r($this->fields, true));
+ \Log::error($this->fields->where('display_audit', '1')->count());
+ \Log::error($this->fields->where('display_checkin', '1')->count());
+ \Log::error($this->fields->where('display_checkout', '1')->count());
+ switch ($form_type) {
+ case 'audit':
+ return $this->fields->where('display_audit', '1')->count() > 0;
+ case 'checkin':
+ return $this->fields->where('display_checkin', '1')->count() > 0;
+ case 'checkout':
+ return $this->fields->where('display_checkout', '1')->count() > 0;
+ default:
+ return true;
+ }
}
+
+ return false;
}
/**
diff --git a/resources/views/hardware/checkin.blade.php b/resources/views/hardware/checkin.blade.php
index 2137c11ca2..4367d79b8a 100755
--- a/resources/views/hardware/checkin.blade.php
+++ b/resources/views/hardware/checkin.blade.php
@@ -139,6 +139,19 @@
</div>
</div>
+ <!-- Note -->
+ <div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
+ <label for="note" class="col-md-3 control-label">
+ {{ trans('general.notes') }}
+ </label>
+ <div class="col-md-8">
+ <textarea class="col-md-6 form-control" id="note" @required($snipeSettings->require_checkinout_notes)
+ name="note">{{ old('note', $asset->note) }}</textarea>
+ {!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
+ </div>
+ </div>
+
+
<!-- Custom fields -->
@include("models/custom_fields_form", [
'model' => $asset->model,
@@ -146,22 +159,6 @@
])
-
-
-
-
-
- <!-- Note -->
- <div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
- <label for="note" class="col-md-3 control-label">
- {{ trans('general.notes') }}
- </label>
- <div class="col-md-8">
- <textarea class="col-md-6 form-control" id="note" @required($snipeSettings->require_checkinout_notes)
- name="note">{{ old('note', $asset->note) }}</textarea>
- {!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
- </div>
- </div>
</div> <!--/.box-body-->
</div> <!--/.box-body-->
diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.php
index 3aedbfd054..ac5c8022ec 100755
--- a/resources/views/hardware/checkout.blade.php
+++ b/resources/views/hardware/checkout.blade.php
@@ -142,12 +142,6 @@
</div>
</div>
- <!-- Custom fields -->
- @include("models/custom_fields_form", [
- 'model' => $asset->model,
- 'show_custom_fields_type' => 'checkout'
- ])
-
<!-- Note -->
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}">
<label for="note" class="col-md-3 control-label">
@@ -156,10 +150,18 @@
<div class="col-md-8">
<textarea class="col-md-6 form-control" id="note" @required($snipeSettings->require_checkinout_notes)
- name="note">{{ old('note', $asset->note) }}</textarea>
+ name="note">{{ old('note', $asset->note) }}</textarea>
{!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>
+
+ <!-- Custom fields -->
+ @include("models/custom_fields_form", [
+ 'model' => $asset->model,
+ 'show_custom_fields_type' => 'checkout'
+ ])
+
+
@if ($asset->requireAcceptance() || $asset->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout">