mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Fixes #1909 - allow 0 month depreciation
This commit is contained in:
parent
679a6a5522
commit
13f85e82bb
|
@ -11,6 +11,7 @@ use Str;
|
|||
use View;
|
||||
use Auth;
|
||||
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Depreciations for
|
||||
* the Snipe-IT Asset Management application.
|
||||
|
@ -46,8 +47,7 @@ class DepreciationsController extends Controller
|
|||
public function getCreate()
|
||||
{
|
||||
// Show the page
|
||||
$depreciation_options = \App\Helpers\Helper::depreciationList();
|
||||
return View::make('depreciations/edit')->with('depreciation_options', $depreciation_options)->with('depreciation', new Depreciation);
|
||||
return View::make('depreciations/edit')->with('depreciation', new Depreciation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ class DepreciationsController extends Controller
|
|||
// Show the page
|
||||
//$depreciation_options = array('' => 'Top Level') + Depreciation::lists('name', 'id');
|
||||
|
||||
$depreciation_options = array('' => 'Top Level') + DB::table('depreciations')->where('id', '!=', $depreciationId)->lists('name', 'id');
|
||||
$depreciation_options = Helper::depreciationList();
|
||||
return View::make('depreciations/edit', compact('depreciation'))->with('depreciation_options', $depreciation_options);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class Depreciation extends Model
|
|||
// Declare the rules for the form validation
|
||||
protected $rules = array(
|
||||
'name' => 'required|min:3|max:255|unique:depreciations,name',
|
||||
'months' => 'required|min:1|max:240|integer',
|
||||
'months' => 'required|max:240|integer',
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ class Depreciation extends Model
|
|||
{
|
||||
|
||||
return $query->where(function ($query) use ($search) {
|
||||
|
||||
|
||||
$query->where('name', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('months', 'LIKE', '%'.$search.'%');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue