mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
handles purchase cost explicit and auto assign in update
This commit is contained in:
parent
853333911f
commit
dbfc897ff1
|
@ -303,7 +303,16 @@ class AssetsController extends Controller
|
|||
|
||||
$asset->status_id = $request->input('status_id', null);
|
||||
$asset->warranty_months = $request->input('warranty_months', null);
|
||||
$asset->purchase_cost = $request->input('purchase_cost', null);
|
||||
if($request->filled('purchase_cost')) {
|
||||
$asset->purchase_cost = $request->input('purchase_cost', null);
|
||||
}
|
||||
else if($asset->model->default_purchase_cost !== null) {
|
||||
$asset->purchase_cost = $asset->model->default_purchase_cost;
|
||||
}
|
||||
else{
|
||||
$asset->purchase_cost = null;
|
||||
}
|
||||
$asset->purchase_cost_explicit = Asset::purchaseCostExplicit($asset, $request);
|
||||
$asset->purchase_date = $request->input('purchase_date', null);
|
||||
$asset->next_audit_date = $request->input('next_audit_date', null);
|
||||
if ($request->filled('purchase_date') && !$request->filled('asset_eol_date') && ($asset->model->eol > 0)) {
|
||||
|
|
|
@ -968,6 +968,18 @@ class Asset extends Depreciable
|
|||
}
|
||||
return $cost;
|
||||
}
|
||||
public static function purchaseCostExplicit($asset, $request)
|
||||
{
|
||||
if ($request->input('purchase_cost')) {
|
||||
if ($asset->model->default_purchase_cost) {
|
||||
if ($request->input('purchase_cost') !== $asset->model->default_purchase_cost) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* -----------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue