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) ? [
'id' => (int) $seat->user->id,
'name'=> e($seat->user->present()->fullName),
'email' => e($seat->user->email),
'department'=> ($seat->user->department) ?
[
'id' => (int) $seat->user->department->id,

View file

@ -365,6 +365,35 @@ class Accessory extends SnipeModel
$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
*

View file

@ -224,6 +224,37 @@ class Component extends SnipeModel
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
*

View file

@ -339,6 +339,35 @@ class Consumable extends SnipeModel
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
*

View file

@ -228,6 +228,14 @@ class LicensePresenter extends Presenter
'title' => trans('admin/licenses/general.user'),
'visible' => true,
'formatter' => 'usersLinkObjFormatter',
], [
'field' => 'assigned_user.email',
'searchable' => false,
'sortable' => false,
'switchable' => true,
'title' => trans('admin/users/table.email'),
'visible' => true,
'formatter' => 'emailFormatter',
], [
'field' => 'department',
'searchable' => false,
@ -236,8 +244,7 @@ class LicensePresenter extends Presenter
'title' => trans('general.department'),
'visible' => false,
'formatter' => 'departmentNameLinkFormatter',
],
[
], [
'field' => 'assigned_asset',
'searchable' => 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 += '</ul>'
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 += buildLdapResultsTableBody(results.user_sync.users)
html += '<table>'
@ -729,7 +729,7 @@
{
let body = '<tbody>'
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>"
return body;