Merge branch 'develop' of https://github.com/snipe/snipe-it into develop

This commit is contained in:
snipe 2021-02-17 13:34:59 -08:00
commit 1ab349a63d
23 changed files with 72 additions and 24 deletions

View file

@ -165,10 +165,17 @@ class AssetsController extends Controller
foreach ($model->fieldset->fields as $field) {
if ($field->field_encrypted=='1') {
if (Gate::allows('admin')) {
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt($request->input($field->convertUnicodeDbSlug()));
}
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e(implode(', ', $request->input($field->convertUnicodeDbSlug()))));
}else{
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e($request->input($field->convertUnicodeDbSlug())));
} }
} else {
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = implode(', ', $request->input($field->convertUnicodeDbSlug()));
}else{
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
}
}
}
}
@ -342,10 +349,18 @@ class AssetsController extends Controller
foreach ($model->fieldset->fields as $field) {
if ($field->field_encrypted=='1') {
if (Gate::allows('admin')) {
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e($request->input($field->convertUnicodeDbSlug())));
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e(implode(', ', $request->input($field->convertUnicodeDbSlug()))));
}else{
$asset->{$field->convertUnicodeDbSlug()} = \Crypt::encrypt(e($request->input($field->convertUnicodeDbSlug())));
}
}
} else {
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
if(is_array($request->input($field->convertUnicodeDbSlug()))){
$asset->{$field->convertUnicodeDbSlug()} = implode(', ', $request->input($field->convertUnicodeDbSlug()));
}else{
$asset->{$field->convertUnicodeDbSlug()} = $request->input($field->convertUnicodeDbSlug());
}
}
}
}

View file

@ -158,7 +158,7 @@ class ManufacturersController extends Controller
public function destroy($manufacturerId)
{
$this->authorize('delete', Manufacturer::class);
if (is_null($manufacturer = Manufacturer::withCount('models as models_count')->find($manufacturerId))) {
if (is_null($manufacturer = Manufacturer::withTrashed()->withCount('models as models_count')->find($manufacturerId))) {
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.not_found'));
}
@ -174,8 +174,12 @@ class ManufacturersController extends Controller
}
}
// Delete the manufacturer
$manufacturer->delete();
// Soft delete the manufacturer if active, permanent delete if is already deleted
if($manufacturer->deleted_at === NULL) {
$manufacturer->delete();
} else {
$manufacturer->forceDelete();
}
// Redirect to the manufacturers management page
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.delete.success'));
}

View file

@ -121,7 +121,7 @@ class AssetImporter extends ItemImporter
// If we have a target to checkout to, lets do so.
if(isset($target)) {
$asset->fresh()->checkOut($target);
$asset->fresh()->checkOut($target, $this->user_id);
}
return;
}

View file

@ -279,7 +279,7 @@ class Asset extends Depreciable
* @since [v3.0]
* @return boolean
*/
public function checkOut($target, $admin = null, $checkout_at = null, $expected_checkin = null, $note = null, $name = null, $location = null)
public function checkOut($target, $admin_id = null, $checkout_at = null, $expected_checkin = null, $note = null, $name = null, $location = null)
{
if (!$target) {
return false;
@ -313,9 +313,14 @@ class Asset extends Depreciable
}
if ($this->save()) {
if(isset($admin_id)){
$checkedOutBy = User::find($admin_id);
event(new CheckoutableCheckedOut($this, $target, Auth::user(), $note));
event(new CheckoutableCheckedOut($this, $target, $checkedOutBy, $note));
} else {
event(new CheckoutableCheckedOut($this, $target, Auth::user(), $note));
}
$this->increment('checkout_counter', 1);
return true;
}

View file

@ -17,7 +17,7 @@ class Manufacturer extends SnipeModel
// Declare the rules for the form validation
protected $rules = array(
'name' => 'required|min:2|max:255|unique:manufacturers,name,NULL,deleted_at',
'name' => 'required|min:2|max:255|unique:manufacturers,name,NULL,id,deleted_at,NULL',
'url' => 'url|nullable',
'support_url' => 'url|nullable',
'support_email' => 'email|nullable'

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -3,21 +3,21 @@
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=5d8ce6b758f170008cd6",
"/css/build/app.css": "/css/build/app.css?id=9b6ddbece1a3cfc99036",
"/css/build/overrides.css": "/css/build/overrides.css?id=0a65220cdae6fbb6d913",
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=07ea041939045be9f35e",
"/css/dist/skins/skin-red.css": "/css/dist/skins/skin-red.css?id=9f62f7b52ce7bc11ddfd",
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=a5c05d669800b5f5afa1",
"/css/dist/skins/skin-red.css": "/css/dist/skins/skin-red.css?id=1d5974e034b61b5795ec",
"/css/dist/skins/skin-contrast.css": "/css/dist/skins/skin-contrast.css?id=cf23e72b9c963c5ab23a",
"/css/dist/skins/skin-green.css": "/css/dist/skins/skin-green.css?id=77ce26763889742cbb58",
"/css/dist/skins/skin-green.css": "/css/dist/skins/skin-green.css?id=76d0cc15e24e6a03fd2f",
"/css/dist/skins/skin-green-dark.css": "/css/dist/skins/skin-green-dark.css?id=97a05b4e3c6f0e31b895",
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=87b54289d2c1370974d1",
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=d3c953fe66305cef3b54",
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=c2d8517bfd68b3bf3509",
"/css/dist/skins/skin-red-dark.css": "/css/dist/skins/skin-red-dark.css?id=51a2ad946665800523fb",
"/css/dist/skins/skin-purple.css": "/css/dist/skins/skin-purple.css?id=3e904c2867143e27aebf",
"/css/dist/skins/skin-purple.css": "/css/dist/skins/skin-purple.css?id=56d008e86c006d37bc23",
"/css/dist/skins/skin-purple-dark.css": "/css/dist/skins/skin-purple-dark.css?id=7af6dbd5a265f3fe205e",
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=11813086909e31b3d753",
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=2b17e31c820ef66db5a1",
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=36169e10a1d74507c371",
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=86ff7070f892baa764c7",
"/css/dist/skins/skin-orange-dark.css": "/css/dist/skins/skin-orange-dark.css?id=f12f9af189df0ff1c615",
"/css/dist/skins/skin-orange.css": "/css/dist/skins/skin-orange.css?id=d1cda85cbff0723be5f7",
"/css/dist/skins/skin-orange.css": "/css/dist/skins/skin-orange.css?id=4bf9e22405edb2dc2b76",
"/css/dist/all.css": "/css/dist/all.css?id=fc64989106daf3be016b",
"/css/blue.png": "/css/blue.png?id=4c85d6a97173123bd14a",
"/css/blue@2x.png": "/css/blue@2x.png?id=62c67c6a822439e8a4ac",

View file

@ -61,4 +61,5 @@
.modal-footer {
text-align: left;
}
}

View file

@ -106,3 +106,6 @@ a {
.skin-black .main-header .navbar .nav>li>a, .skin-black .main-header .navbar .nav>li>a {
text-decoration: none;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: @black;
}

View file

@ -117,4 +117,7 @@ a {
.fixed-table-container tbody .selected td {
background-color: #fff8af;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #3c8dbc;
}

View file

@ -102,4 +102,7 @@ a {
.fixed-table-container tbody .selected td {
background-color: #fff8af;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: @green;
}

View file

@ -102,4 +102,7 @@ a {
.fixed-table-container tbody .selected td {
background-color: #fff8af;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: @orange;
}

View file

@ -102,4 +102,9 @@ a {
.fixed-table-container tbody .selected td {
background-color: #fff8af;
}
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: @purple;
}

View file

@ -102,4 +102,7 @@ a {
.fixed-table-container tbody .selected td {
background-color: #fff8af;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: @red;
}

View file

@ -103,3 +103,6 @@ a {
.fixed-table-container tbody .selected td {
background-color: #fff8af;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: @yellow;
}

View file

@ -168,10 +168,10 @@
});
}).change();
// If the element is a radiobutton, doesn't show the format input box
// If the element is a radiobutton/checkbox, doesn't show the format input box
$(".field_element").change(function(){
$(this).find("option:selected").each(function(){
if (($(this).attr("value") != "radio")){
if (($(this).attr("value") != "radio") && ($(this).attr("value") != "checkbox")){
$("#format_values").show();
} else{
$("#format_values").hide();

View file

@ -21,7 +21,7 @@
<div>
<label>
<input type="checkbox" value="1" name="{{ $field->db_column_name() }}[]" class="minimal" {{ Request::old($field->db_column_name()) != '' ? ' checked="checked"' : '' }}>
<input type="checkbox" value="{{ $value }}" name="{{ $field->db_column_name() }}[]" class="minimal" {{ isset($item) ? (in_array($key, explode(', ', $item->{$field->db_column_name()})) ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : '') }}>
{{ $value }}
</label>
</div>