Merge branch 'develop'

# Conflicts:
#	snipeit.sh
This commit is contained in:
snipe 2017-10-05 23:14:13 -07:00
commit 8919c3b52a
3 changed files with 18 additions and 4 deletions

View file

@ -815,6 +815,7 @@ class Asset extends Depreciable
{ {
return $query->where(function ($query) use ($filter) { return $query->where(function ($query) use ($filter) {
foreach ($filter as $key => $search_val) { foreach ($filter as $key => $search_val) {
if ($key =='asset_tag') { if ($key =='asset_tag') {
$query->where('assets.asset_tag', 'LIKE', '%'.$search_val.'%'); $query->where('assets.asset_tag', 'LIKE', '%'.$search_val.'%');
} }
@ -914,11 +915,13 @@ class Asset extends Depreciable
} }
foreach (CustomField::all() as $field) { foreach (CustomField::all() as $field) {
if (array_key_exists($field->db_column_name(), $filter)) { if (array_key_exists('custom_fields.'.$field->db_column_name(), $filter)) {
$query->orWhere($field->db_column_name(), 'LIKE', "%$search_val%"); $query->orWhere($field->db_column_name(), 'LIKE', '%' . $search_val . '%');
} }
} }
}); });
} }

View file

@ -1,7 +1,13 @@
# ensure running as root # ensure running as root
if [ "$(id -u)" != "0" ]; then 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 fi
wget https://raw.githubusercontent.com/snipe/snipe-it/master/snipeit.sh wget https://raw.githubusercontent.com/snipe/snipe-it/master/snipeit.sh
chmod 744 snipeit.sh chmod 744 snipeit.sh
sudo ./snipeit.sh 2>&1 | sudo tee -a /var/log/snipeit-install.log sudo ./snipeit.sh 2>&1 | sudo tee -a /var/log/snipeit-install.log

View file

@ -311,6 +311,11 @@ $('.snipe-table').bootstrapTable({
// for custom fields in a more useful way. // for custom fields in a more useful way.
function customFieldsFormatter(value, row) { function customFieldsFormatter(value, row) {
if ((!this) || (!this.title)) {
return '';
}
var field_column = this.title; var field_column = this.title;
// Pull out any HTMl that might be passed via the presenter // Pull out any HTMl that might be passed via the presenter