mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 15:44:11 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
c5d7a1fdd6
|
@ -530,6 +530,8 @@ class AssetsController extends Controller
|
|||
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
} elseif (!$asset->availableForCheckout()) {
|
||||
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.checkout.not_available'));
|
||||
}
|
||||
|
||||
$user = User::find(e(Input::get('assigned_to')));
|
||||
|
@ -1725,19 +1727,17 @@ class AssetsController extends Controller
|
|||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" title="Restore asset" data-toggle="tooltip" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if (($asset->assetstatus->deployable != 0) && ($asset->deleted_at=='')) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
if (Gate::allows('assets.checkin')) {
|
||||
$inout = '<a href="' . route('checkin/hardware',
|
||||
$asset->id) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
|
||||
}
|
||||
} else {
|
||||
if (Gate::allows('assets.checkout')) {
|
||||
$inout = '<a href="' . route('checkout/hardware',
|
||||
$asset->id) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
}
|
||||
if (($asset->availableForCheckout()))
|
||||
{
|
||||
if (Gate::allows('assets.checkout')) {
|
||||
$inout = '<a href="' . route('checkout/hardware',
|
||||
$asset->id) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Gate::allows('assets.checkin')) {
|
||||
$inout = '<a href="' . route('checkin/hardware',
|
||||
$asset->id) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Category as Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\Setting;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Redirect;
|
||||
|
@ -344,13 +345,13 @@ class CategoriesController extends Controller
|
|||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if ($asset->assetstatus->deployable != 0) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
} else {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
if ($asset->availableForCheckout()) {
|
||||
if (Gate::allows('assets.checkout')) {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
} else {
|
||||
if (Gate::allows('assets.checkin')) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,14 +2,15 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Manufacturer;
|
||||
use App\Models\Setting;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Input;
|
||||
use Lang;
|
||||
use App\Models\Manufacturer;
|
||||
use Redirect;
|
||||
use App\Models\Setting;
|
||||
use Str;
|
||||
use View;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Manufacturers for
|
||||
|
@ -293,13 +294,13 @@ class ManufacturersController extends Controller
|
|||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if ($asset->assetstatus->deployable != 0) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
} else {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
if ($asset->availableForCheckout()) {
|
||||
if (Gate::allows('assets.checkout')) {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
} else {
|
||||
if (Gate::allows('assets.checkin')) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ class AssetRequest extends Request
|
|||
'supplier_id' => 'integer',
|
||||
'status' => 'integer',
|
||||
'asset_tag' => 'required',
|
||||
'purchase_cost' => 'numeric',
|
||||
|
||||
];
|
||||
|
||||
|
|
|
@ -22,11 +22,12 @@ class Accessory extends Model
|
|||
* Accessory validation rules
|
||||
*/
|
||||
public $rules = array(
|
||||
'name' => 'required|min:3|max:255',
|
||||
'qty' => 'required|integer|min:1',
|
||||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'min_amt' => 'integer|min:1',
|
||||
'name' => 'required|min:3|max:255',
|
||||
'qty' => 'required|integer|min:1',
|
||||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'min_amt' => 'integer|min:1',
|
||||
'purchase_cost' => 'numeric',
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ class Asset extends Depreciable
|
|||
'supplier_id' => 'integer',
|
||||
'asset_tag' => 'required|min:1|max:255|unique_undeleted',
|
||||
'status' => 'integer',
|
||||
'purchase_cost' => 'numeric',
|
||||
];
|
||||
|
||||
|
||||
|
@ -72,16 +73,26 @@ class Asset extends Depreciable
|
|||
}
|
||||
|
||||
|
||||
|
||||
public function availableForCheckout()
|
||||
{
|
||||
return (
|
||||
empty($this->assigned_to) &&
|
||||
$this->assetstatus->deployable == 1 &&
|
||||
empty($this->deleted_at)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkout asset
|
||||
*/
|
||||
public function checkOutToUser($user, $admin, $checkout_at = null, $expected_checkin = null, $note = null, $name = null)
|
||||
{
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($expected_checkin) {
|
||||
$this->expected_checkin = $expected_checkin ;
|
||||
$this->expected_checkin = $expected_checkin;
|
||||
}
|
||||
|
||||
$this->last_checkout = $checkout_at;
|
||||
|
@ -95,9 +106,7 @@ class Asset extends Depreciable
|
|||
$this->accepted="pending";
|
||||
}
|
||||
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->save()) {
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ class Component extends Model
|
|||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'purchase_date' => 'date',
|
||||
'purchase_cost' => 'numeric',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,7 @@ class Consumable extends Model
|
|||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'min_amt' => 'integer|min:1',
|
||||
'purchase_cost' => 'numeric',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
return array (
|
||||
'app_version' => '3.3.0-beta',
|
||||
'hash_version' => '3.3.0-beta-19-g7a0843e',
|
||||
'app_version' => 'v3.3.0',
|
||||
'hash_version' => 'v3.3.0-3-g7ef4f23',
|
||||
);
|
||||
|
|
|
@ -52,7 +52,8 @@ return array(
|
|||
'checkout' => array(
|
||||
'error' => 'Asset was not checked out, please try again',
|
||||
'success' => 'Asset checked out successfully.',
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.'
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.',
|
||||
'not_available' => 'That asset is not available for checkout!'
|
||||
),
|
||||
|
||||
'checkin' => array(
|
||||
|
|
Loading…
Reference in a new issue