diff --git a/app/controllers/admin/AssetsController.php b/app/controllers/admin/AssetsController.php index 2ebc6616fd17..39630dc2627a 100644 --- a/app/controllers/admin/AssetsController.php +++ b/app/controllers/admin/AssetsController.php @@ -117,6 +117,7 @@ public function postCreate() $asset->notes = e(Input::get('notes')); $asset->asset_tag = e(Input::get('asset_tag')); $asset->status_id = e(Input::get('status_id')); + $asset->warrantee_months = e(Input::get('warrantee_months')); $asset->user_id = Sentry::getId(); $asset->physical = '1'; @@ -191,6 +192,7 @@ public function postEdit($assetId = null) 'asset_tag' => 'required|min:3', 'model_id' => 'required', 'serial' => 'required|min:3', + 'warrantee_months' => 'integer|min:1', ); // Create a new validator instance from our validation rules @@ -213,6 +215,7 @@ public function postEdit($assetId = null) $asset->order_number = e(Input::get('order_number')); $asset->asset_tag = e(Input::get('asset_tag')); $asset->status_id = e(Input::get('status_id')); + $asset->warrantee_months = e(Input::get('warrantee_months')); $asset->notes = e(Input::get('notes')); $asset->physical = '1'; diff --git a/app/database/migrations/2013_11_25_101308_add_warrantee_to_assets_table.php b/app/database/migrations/2013_11_25_101308_add_warrantee_to_assets_table.php new file mode 100644 index 000000000000..c99f091162b6 --- /dev/null +++ b/app/database/migrations/2013_11_25_101308_add_warrantee_to_assets_table.php @@ -0,0 +1,35 @@ +integer('warrantee_months')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + Schema::table('assets', function($table) + { + $table->dropColumn('warrantee_months'); + }); + } + +} \ No newline at end of file diff --git a/app/models/Asset.php b/app/models/Asset.php index 05657ab63203..692159d27e9c 100644 --- a/app/models/Asset.php +++ b/app/models/Asset.php @@ -9,6 +9,7 @@ class Asset extends Elegant { 'asset_tag' => 'required|min:3|unique:assets', 'model_id' => 'required', 'serial' => 'required|min:3', + 'warrantee_months' => 'integer|min:1', ); @@ -104,4 +105,15 @@ public function assetstatus() } + public function warrantee_expires() + { + + + $date = date_create($this->purchase_date); + date_add($date, date_interval_create_from_date_string($this->warrantee_months.' months')); + return date_format($date, 'Y-m-d'); + + } + + } diff --git a/app/views/backend/assets/edit.blade.php b/app/views/backend/assets/edit.blade.php index 853565cf9a32..544bb50e1629 100755 --- a/app/views/backend/assets/edit.blade.php +++ b/app/views/backend/assets/edit.blade.php @@ -105,6 +105,15 @@ + +
+ +
+ months + {{ $errors->first('warrantee_months', ':message') }} +
+
+
diff --git a/app/views/backend/assets/view.blade.php b/app/views/backend/assets/view.blade.php index cdd83df4a7e4..1fdd250e7d74 100644 --- a/app/views/backend/assets/view.blade.php +++ b/app/views/backend/assets/view.blade.php @@ -98,6 +98,25 @@
+

More Info:
+ + + @if ((isset($asset->assigned_to ) && ($asset->assigned_to > 0)))

Checked Out To: