This commit is contained in:
snipe 2021-11-24 19:58:52 -08:00
commit d30fa9199c
4 changed files with 54 additions and 22 deletions

View file

@ -92,7 +92,7 @@ class CustomFieldsController extends Controller
$this->authorize('create', CustomField::class); $this->authorize('create', CustomField::class);
$field = new CustomField([ $field = new CustomField([
"name" => $request->get("name"), "name" => trim($request->get("name")),
"element" => $request->get("element"), "element" => $request->get("element"),
"help_text" => $request->get("help_text"), "help_text" => $request->get("help_text"),
"field_values" => $request->get("field_values"), "field_values" => $request->get("field_values"),
@ -212,7 +212,7 @@ class CustomFieldsController extends Controller
$this->authorize('update', $field); $this->authorize('update', $field);
$field->name = e($request->get("name")); $field->name = trim(e($request->get("name")));
$field->element = e($request->get("element")); $field->element = e($request->get("element"));
$field->field_values = e($request->get("field_values")); $field->field_values = e($request->get("field_values"));
$field->user_id = Auth::id(); $field->user_id = Auth::id();

View file

@ -82,7 +82,7 @@ class AccessoriesTransformer
'first_name'=> e($user->first_name), 'first_name'=> e($user->first_name),
'last_name'=> e($user->last_name), 'last_name'=> e($user->last_name),
'employee_number' => e($user->employee_num), 'employee_number' => e($user->employee_num),
'checkout_notes' => $user->pivot->note, 'checkout_notes' => e($user->pivot->note),
'last_checkout' => Helper::getFormattedDateObject($user->pivot->created_at, 'datetime'), 'last_checkout' => Helper::getFormattedDateObject($user->pivot->created_at, 'datetime'),
'type' => 'user', 'type' => 'user',
'available_actions' => ['checkin' => true] 'available_actions' => ['checkin' => true]

View file

@ -145,7 +145,7 @@
function genericRowLinkFormatter(destination) { function genericRowLinkFormatter(destination) {
return function (value,row) { return function (value,row) {
if (value) { if (value) {
return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '"> ' + value + '</a>'; return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '">' + value + '</a>';
} }
}; };
} }
@ -196,7 +196,7 @@
var dpolymorphicItemFormatterest = 'fields/'; var dpolymorphicItemFormatterest = 'fields/';
} }
return '<nobr><a href="{{ url('/') }}/' + dpolymorphicItemFormatterest + dest + '/' + value.id + '"> ' + value.name + '</a></span>'; return '<nobr><a href="{{ url('/') }}/' + dpolymorphicItemFormatterest + dest + '/' + value.id + '">' + value.name + '</a></span>';
} }
}; };
} }
@ -466,7 +466,7 @@
if (value) { if (value) {
var groups = ''; var groups = '';
for (var index in value.rows) { for (var index in value.rows) {
groups += '<a href="{{ url('/') }}/admin/groups/' + value.rows[index].id + '" class="label label-default"> ' + value.rows[index].name + '</a> '; groups += '<a href="{{ url('/') }}/admin/groups/' + value.rows[index].id + '" class="label label-default">' + value.rows[index].name + '</a> ';
} }
return groups; return groups;
} }
@ -495,20 +495,20 @@
function deployedLocationFormatter(row, value) { function deployedLocationFormatter(row, value) {
if ((row) && (row!=undefined)) { if ((row) && (row!=undefined)) {
return '<a href="{{ url('/') }}/locations/' + row.id + '"> ' + row.name + '</a>'; return '<a href="{{ url('/') }}/locations/' + row.id + '">' + row.name + '</a>';
} else if (value.rtd_location) { } else if (value.rtd_location) {
return '<a href="{{ url('/') }}/locations/' + value.rtd_location.id + '" data-toggle="tooltip" title="Default Location"> ' + value.rtd_location.name + '</a>'; return '<a href="{{ url('/') }}/locations/' + value.rtd_location.id + '" data-toggle="tooltip" title="Default Location">' + value.rtd_location.name + '</a>';
} }
} }
function groupsAdminLinkFormatter(value, row) { function groupsAdminLinkFormatter(value, row) {
return '<a href="{{ url('/') }}/admin/groups/' + row.id + '"> ' + value + '</a>'; return '<a href="{{ url('/') }}/admin/groups/' + row.id + '">' + value + '</a>';
} }
function assetTagLinkFormatter(value, row) { function assetTagLinkFormatter(value, row) {
if ((row.asset) && (row.asset.id)) { if ((row.asset) && (row.asset.id)) {
return '<a href="{{ url('/') }}/hardware/' + row.asset.id + '"> ' + row.asset.asset_tag + '</a>'; return '<a href="{{ url('/') }}/hardware/' + row.asset.id + '">' + row.asset.asset_tag + '</a>';
} }
return ''; return '';
@ -516,14 +516,14 @@
function departmentNameLinkFormatter(value, row) { function departmentNameLinkFormatter(value, row) {
if ((row.assigned_user) && (row.assigned_user.department) && (row.assigned_user.department.name)) { if ((row.assigned_user) && (row.assigned_user.department) && (row.assigned_user.department.name)) {
return '<a href="{{ url('/') }}/department/' + row.assigned_user.department.id + '"> ' + row.assigned_user.department.name + '</a>'; return '<a href="{{ url('/') }}/department/' + row.assigned_user.department.id + '">' + row.assigned_user.department.name + '</a>';
} }
} }
function assetNameLinkFormatter(value, row) { function assetNameLinkFormatter(value, row) {
if ((row.asset) && (row.asset.name)) { if ((row.asset) && (row.asset.name)) {
return '<a href="{{ url('/') }}/hardware/' + row.asset.id + '"> ' + row.asset.name + '</a>'; return '<a href="{{ url('/') }}/hardware/' + row.asset.id + '">' + row.asset.name + '</a>';
} }
} }
@ -550,31 +550,31 @@
function emailFormatter(value) { function emailFormatter(value) {
if (value) { if (value) {
return '<a href="mailto:' + value + '"> ' + value + '</a>'; return '<a href="mailto:' + value + '">' + value + '</a>';
} }
} }
function linkFormatter(value) { function linkFormatter(value) {
if (value) { if (value) {
return '<a href="' + value + '"> ' + value + '</a>'; return '<a href="' + value + '">' + value + '</a>';
} }
} }
function assetCompanyFilterFormatter(value, row) { function assetCompanyFilterFormatter(value, row) {
if (value) { if (value) {
return '<a href="{{ url('/') }}/hardware/?company_id=' + row.id + '"> ' + value + '</a>'; return '<a href="{{ url('/') }}/hardware/?company_id=' + row.id + '">' + value + '</a>';
} }
} }
function assetCompanyObjFilterFormatter(value, row) { function assetCompanyObjFilterFormatter(value, row) {
if ((row) && (row.company)) { if ((row) && (row.company)) {
return '<a href="{{ url('/') }}/hardware/?company_id=' + row.company.id + '"> ' + row.company.name + '</a>'; return '<a href="{{ url('/') }}/hardware/?company_id=' + row.company.id + '">' + row.company.name + '</a>';
} }
} }
function usersCompanyObjFilterFormatter(value, row) { function usersCompanyObjFilterFormatter(value, row) {
if (value) { if (value) {
return '<a href="{{ url('/') }}/users/?company_id=' + row.id + '"> ' + value + '</a>'; return '<a href="{{ url('/') }}/users/?company_id=' + row.id + '">' + value + '</a>';
} else { } else {
return value; return value;
} }
@ -583,13 +583,13 @@
function employeeNumFormatter(value, row) { function employeeNumFormatter(value, row) {
if ((row) && (row.assigned_to) && ((row.assigned_to.employee_number))) { if ((row) && (row.assigned_to) && ((row.assigned_to.employee_number))) {
return '<a href="{{ url('/') }}/users/' + row.assigned_to.id + '"> ' + row.assigned_to.employee_number + '</a>'; return '<a href="{{ url('/') }}/users/' + row.assigned_to.id + '">' + row.assigned_to.employee_number + '</a>';
} }
} }
function orderNumberObjFilterFormatter(value, row) { function orderNumberObjFilterFormatter(value, row) {
if (value) { if (value) {
return '<a href="{{ url('/') }}/hardware/?order_number=' + row.order_number + '"> ' + row.order_number + '</a>'; return '<a href="{{ url('/') }}/hardware/?order_number=' + row.order_number + '">' + row.order_number + '</a>';
} }
} }

View file

@ -301,7 +301,7 @@ echo '
' '
echo "" echo ""
echo " Welcome to Snipe-IT Inventory Installer for CentOS, Fedora, Debian and Ubuntu!" echo " Welcome to Snipe-IT Inventory Installer for CentOS, Rocky, Fedora, Debian and Ubuntu!"
echo "" echo ""
shopt -s nocasematch shopt -s nocasematch
case $distro in case $distro in
@ -323,7 +323,7 @@ case $distro in
apache_group=www-data apache_group=www-data
apachefile=/etc/apache2/sites-available/$APP_NAME.conf apachefile=/etc/apache2/sites-available/$APP_NAME.conf
;; ;;
*centos*|*redhat*|*ol*|*rhel*) *centos*|*redhat*|*ol*|*rhel*|*rocky*)
echo " The installer has detected $distro version $version." echo " The installer has detected $distro version $version."
distro=centos distro=centos
apache_group=apache apache_group=apache
@ -374,7 +374,39 @@ done
case $distro in case $distro in
debian) debian)
if [[ "$version" =~ ^10 ]]; then if [[ "$version" =~ ^11 ]]; then
# Install for Debian 11.x
tzone=$(cat /etc/timezone)
echo "* Adding PHP repository."
log "apt-get install -y apt-transport-https lsb-release ca-certificates"
log "wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg"
echo "deb https://packages.sury.org/php/ $codename main" > /etc/apt/sources.list.d/php.list
echo -n "* Updating installed packages."
log "apt-get update && apt-get -y upgrade" & pid=$!
progress
echo "* Installing Apache httpd, PHP, MariaDB and other requirements."
PACKAGES="mariadb-server mariadb-client apache2 libapache2-mod-php7.4 php7.4 php7.4-mcrypt php7.4-curl php7.4-mysql php7.4-gd php7.4-ldap php7.4-zip php7.4-mbstring php7.4-xml php7.4-bcmath curl git unzip"
install_packages
echo "* Configuring Apache."
create_virtualhost
log "a2enmod rewrite"
log "a2ensite $APP_NAME.conf"
rename_default_vhost
set_hosts
echo "* Securing MariaDB."
/usr/bin/mysql_secure_installation
install_snipeit
echo "* Restarting Apache httpd."
log "service apache2 restart"
elif [[ "$version" =~ ^10 ]]; then
# Install for Debian 10.x # Install for Debian 10.x
tzone=$(cat /etc/timezone) tzone=$(cat /etc/timezone)