Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2024-01-24 19:49:50 +00:00
commit 896b16d4d5
6 changed files with 101 additions and 4 deletions

View file

@ -29,6 +29,7 @@ class LicenseSeatsTransformer
'assigned_user' => ($seat->user) ? [ 'assigned_user' => ($seat->user) ? [
'id' => (int) $seat->user->id, 'id' => (int) $seat->user->id,
'name'=> e($seat->user->present()->fullName), 'name'=> e($seat->user->present()->fullName),
'email' => e($seat->user->email),
'department'=> ($seat->user->department) ? 'department'=> ($seat->user->department) ?
[ [
'id' => (int) $seat->user->department->id, 'id' => (int) $seat->user->department->id,

View file

@ -365,6 +365,35 @@ class Accessory extends SnipeModel
$accessory_user->limit(1)->delete(); $accessory_user->limit(1)->delete();
} }
/**
* -----------------------------------------------
* BEGIN MUTATORS
* -----------------------------------------------
**/
/**
* This sets a value for qty if no value is given. The database does not allow this
* field to be null, and in the other areas of the code, we set a default, but the importer
* does not.
*
* This simply checks that there is a value for quantity, and if there isn't, set it to 0.
*
* @author A. Gianotto <snipe@snipe.net>
* @since v6.3.4
* @param $value
* @return void
*/
public function setQtyAttribute($value)
{
$this->attributes['qty'] = (!$value) ? 0 : intval($value);
}
/**
* -----------------------------------------------
* BEGIN QUERY SCOPES
* -----------------------------------------------
**/
/** /**
* Query builder scope to order on company * Query builder scope to order on company
* *

View file

@ -224,6 +224,37 @@ class Component extends SnipeModel
return $this->qty - $this->numCheckedOut(); return $this->qty - $this->numCheckedOut();
} }
/**
* -----------------------------------------------
* BEGIN MUTATORS
* -----------------------------------------------
**/
/**
* This sets a value for qty if no value is given. The database does not allow this
* field to be null, and in the other areas of the code, we set a default, but the importer
* does not.
*
* This simply checks that there is a value for quantity, and if there isn't, set it to 0.
*
* @author A. Gianotto <snipe@snipe.net>
* @since v6.3.4
* @param $value
* @return void
*/
public function setQtyAttribute($value)
{
$this->attributes['qty'] = (!$value) ? 0 : intval($value);
}
/**
* -----------------------------------------------
* BEGIN QUERY SCOPES
* -----------------------------------------------
**/
/** /**
* Query builder scope to order on company * Query builder scope to order on company
* *

View file

@ -339,6 +339,35 @@ class Consumable extends SnipeModel
return $remaining; return $remaining;
} }
/**
* -----------------------------------------------
* BEGIN MUTATORS
* -----------------------------------------------
**/
/**
* This sets a value for qty if no value is given. The database does not allow this
* field to be null, and in the other areas of the code, we set a default, but the importer
* does not.
*
* This simply checks that there is a value for quantity, and if there isn't, set it to 0.
*
* @author A. Gianotto <snipe@snipe.net>
* @since v6.3.4
* @param $value
* @return void
*/
public function setQtyAttribute($value)
{
$this->attributes['qty'] = (!$value) ? 0 : intval($value);
}
/**
* -----------------------------------------------
* BEGIN QUERY SCOPES
* -----------------------------------------------
**/
/** /**
* Query builder scope to order on company * Query builder scope to order on company
* *

View file

@ -228,6 +228,14 @@ class LicensePresenter extends Presenter
'title' => trans('admin/licenses/general.user'), 'title' => trans('admin/licenses/general.user'),
'visible' => true, 'visible' => true,
'formatter' => 'usersLinkObjFormatter', 'formatter' => 'usersLinkObjFormatter',
], [
'field' => 'assigned_user.email',
'searchable' => false,
'sortable' => false,
'switchable' => true,
'title' => trans('admin/users/table.email'),
'visible' => true,
'formatter' => 'emailFormatter',
], [ ], [
'field' => 'department', 'field' => 'department',
'searchable' => false, 'searchable' => false,
@ -236,8 +244,7 @@ class LicensePresenter extends Presenter
'title' => trans('general.department'), 'title' => trans('general.department'),
'visible' => false, 'visible' => false,
'formatter' => 'departmentNameLinkFormatter', 'formatter' => 'departmentNameLinkFormatter',
], ], [
[
'field' => 'assigned_asset', 'field' => 'assigned_asset',
'searchable' => false, 'searchable' => false,
'sortable' => false, 'sortable' => false,

View file

@ -701,7 +701,7 @@
html += '<li class="text-success"><i class="fas fa-check" aria-hidden="true"></i> ' + results.bind.message + ' </li>' html += '<li class="text-success"><i class="fas fa-check" aria-hidden="true"></i> ' + results.bind.message + ' </li>'
html += '</ul>' html += '</ul>'
html += '<div>{{ trans('admin/settings/message.ldap.sync_success') }}</div>' html += '<div>{{ trans('admin/settings/message.ldap.sync_success') }}</div>'
html += '<table class="table table-bordered table-condensed" style="background-color: #fff">' html += '<table class="table table-bordered table-condensed" style=" table-layout:fixed; width:100%; background-color: #fff">'
html += buildLdapResultsTableHeader() html += buildLdapResultsTableHeader()
html += buildLdapResultsTableBody(results.user_sync.users) html += buildLdapResultsTableBody(results.user_sync.users)
html += '<table>' html += '<table>'
@ -729,7 +729,7 @@
{ {
let body = '<tbody>' let body = '<tbody>'
for (var i in users) { for (var i in users) {
body += '<tr><td>' + users[i].employee_number + '</td><td>' + users[i].username + '</td><td>' + users[i].firstname + '</td><td>' + users[i].lastname + '</td><td>' + users[i].email + '</td></tr>' body += '<tr><td style="overflow:hidden;">' + users[i].employee_number + '</td><td style="overflow:hidden;">' + users[i].username + '</td><td style="overflow:hidden;">' + users[i].firstname + '</td><td style="overflow:hidden;">' + users[i].lastname + '</td><td style="overflow:hidden;">' + users[i].email + '</td></tr>'
} }
body += "</tbody>" body += "</tbody>"
return body; return body;