diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 87c8e147a..cbb623b67 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -815,6 +815,7 @@ class Asset extends Depreciable { return $query->where(function ($query) use ($filter) { foreach ($filter as $key => $search_val) { + if ($key =='asset_tag') { $query->where('assets.asset_tag', 'LIKE', '%'.$search_val.'%'); } @@ -914,11 +915,13 @@ class Asset extends Depreciable } foreach (CustomField::all() as $field) { - if (array_key_exists($field->db_column_name(), $filter)) { - $query->orWhere($field->db_column_name(), 'LIKE', "%$search_val%"); - } + if (array_key_exists('custom_fields.'.$field->db_column_name(), $filter)) { + $query->orWhere($field->db_column_name(), 'LIKE', '%' . $search_val . '%'); + } } + }); + } diff --git a/install.sh b/install.sh index 8bc20705a..0202235c3 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,13 @@ # ensure running as root if [ "$(id -u)" != "0" ]; then - exec sudo "$0" "$@" + #Debian doesnt have sudo if root has a password. + if ! hash sudo 2>/dev/null; then + exec su -c "$0" "$@" + else + exec sudo "$0" "$@" + fi fi + wget https://raw.githubusercontent.com/snipe/snipe-it/master/snipeit.sh chmod 744 snipeit.sh sudo ./snipeit.sh 2>&1 | sudo tee -a /var/log/snipeit-install.log diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index ce1889f6b..ef2e4c961 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -311,6 +311,11 @@ $('.snipe-table').bootstrapTable({ // for custom fields in a more useful way. function customFieldsFormatter(value, row) { + + if ((!this) || (!this.title)) { + return ''; + } + var field_column = this.title; // Pull out any HTMl that might be passed via the presenter