diff --git a/.bash_history b/.bash_history old mode 100644 new mode 100755 diff --git a/app/commands/.gitkeep b/app/commands/.gitkeep old mode 100644 new mode 100755 diff --git a/app/config/app.php b/app/config/app.php old mode 100644 new mode 100755 diff --git a/app/config/packages/barryvdh/laravel-debugbar/config.php b/app/config/packages/barryvdh/laravel-debugbar/config.php old mode 100644 new mode 100755 diff --git a/app/config/packages/cartalyst/sentry/config.php~ b/app/config/packages/cartalyst/sentry/config.php~ old mode 100644 new mode 100755 diff --git a/app/config/production/.gitignore b/app/config/production/.gitignore old mode 100644 new mode 100755 diff --git a/app/config/production/app.example.php b/app/config/production/app.example.php old mode 100644 new mode 100755 diff --git a/app/config/production/database.example.php b/app/config/production/database.example.php old mode 100644 new mode 100755 diff --git a/app/config/production/mail.example.php b/app/config/production/mail.example.php old mode 100644 new mode 100755 diff --git a/app/config/view.php b/app/config/view.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/AssetsController.php b/app/controllers/admin/AssetsController.php index 0158817a6b..2f35046085 100644 --- a/app/controllers/admin/AssetsController.php +++ b/app/controllers/admin/AssetsController.php @@ -197,7 +197,7 @@ class AssetsController extends AdminController if (e(Input::get('purchase_cost')) == '') { $asset->purchase_cost = NULL; } else { - $asset->purchase_cost = e(Input::get('purchase_cost')); + $asset->purchase_cost = ParseFloat(e(Input::get('purchase_cost'))); } if (e(Input::get('purchase_date')) == '') { @@ -341,7 +341,7 @@ class AssetsController extends AdminController $asset->name = e(Input::get('name')); $asset->serial = e(Input::get('serial')); $asset->model_id = e(Input::get('model_id')); - $asset->order_number = e(Input::get('order_number')); + $asset->order_number = e(Input::get('order_number')); $asset->asset_tag = e(Input::get('asset_tag')); $asset->notes = e(Input::get('notes')); $asset->physical = '1'; @@ -606,7 +606,7 @@ class AssetsController extends AdminController public function getClone($assetId = null) { // Check if the asset exists - if (is_null($asset = Asset::find($assetId))) { + if (is_null($asset_to_clone = Asset::find($assetId))) { // Redirect to the asset management page return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist')); } @@ -619,9 +619,13 @@ class AssetsController extends AdminController // get depreciation list $depreciation_list = array('' => '') + Depreciation::lists('name', 'id'); + $supplier_list = array('' => '') + Supplier::orderBy('name', 'asc')->lists('name', 'id'); + $assigned_to = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat (first_name," ",last_name) as full_name, id'))->whereNull('deleted_at')->lists('full_name', 'id'); + + $asset = clone $asset_to_clone; + $asset->id = null; + $asset->asset_tag = ''; + return View::make('backend/hardware/edit')->with('supplier_list',$supplier_list)->with('model_list',$model_list)->with('statuslabel_list',$statuslabel_list)->with('assigned_to',$assigned_to)->with('asset',$asset); - return View::make('backend/hardware/clone', compact('asset'))->with('model_list',$model_list)->with('depreciation_list',$depreciation_list)->with('statuslabel_list',$statuslabel_list); } - - } diff --git a/app/controllers/admin/CategoriesController.php b/app/controllers/admin/CategoriesController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/DepreciationsController.php b/app/controllers/admin/DepreciationsController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/LicensesController.php b/app/controllers/admin/LicensesController.php index d6dd4b74bf..3fad5c0685 100644 --- a/app/controllers/admin/LicensesController.php +++ b/app/controllers/admin/LicensesController.php @@ -75,6 +75,13 @@ class LicensesController extends AdminController // attempt validation if ($license->validate($new)) { + if ( e(Input::get('purchase_cost')) == '') { + $license->purchase_cost = NULL; + } else { + $license->purchase_cost = ParseFloat(e(Input::get('purchase_cost'))); + //$license->purchase_cost = e(Input::get('purchase_cost')); + } + // Save the license data $license->name = e(Input::get('name')); $license->serial = e(Input::get('serial')); @@ -84,7 +91,7 @@ class LicensesController extends AdminController $license->order_number = e(Input::get('order_number')); $license->seats = e(Input::get('seats')); $license->purchase_date = e(Input::get('purchase_date')); - $license->purchase_cost = e(Input::get('purchase_cost')); + //$license->purchase_cost = e(Input::get('purchase_cost')); $license->depreciation_id = e(Input::get('depreciation_id')); //$license->asset_id = e(Input::get('asset_id')); $license->user_id = Sentry::getId(); @@ -535,6 +542,25 @@ class LicensesController extends AdminController return Redirect::route('licenses')->with('error', $error); } } + + public function getClone($licenseId = null) + { + // Check if the license exists + if (is_null($license_to_clone = License::find($licenseId))) { + // Redirect to the blogs management page + return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist')); + } + + // Show the page + $license_options = array('0' => 'Top Level') + License::lists('name', 'id'); - + $license = clone $license_to_clone; + $license->id = null; + $license->serial = null; + + // Show the page + $depreciation_list = array('0' => Lang::get('admin/licenses/form.no_depreciation')) + Depreciation::lists('name', 'id'); + return View::make('backend/licenses/edit')->with('license_options',$license_options)->with('depreciation_list',$depreciation_list)->with('license',$license); + + } } diff --git a/app/controllers/admin/LocationsController.php b/app/controllers/admin/LocationsController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/ManufacturersController.php b/app/controllers/admin/ManufacturersController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/ModelsController.php b/app/controllers/admin/ModelsController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/StatuslabelsController.php b/app/controllers/admin/StatuslabelsController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/SuppliersController.php b/app/controllers/admin/SuppliersController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/UsersController.php b/app/controllers/admin/UsersController.php old mode 100644 new mode 100755 diff --git a/app/controllers/admin/UsersController.php~ b/app/controllers/admin/UsersController.php~ old mode 100644 new mode 100755 diff --git a/app/database/migrations/20140810_0.4.0_snipeit_sqlmig.sql b/app/database/migrations/20140810_0.4.0_snipeit_sqlmig.sql index b38dcc8790..dae2122334 100644 --- a/app/database/migrations/20140810_0.4.0_snipeit_sqlmig.sql +++ b/app/database/migrations/20140810_0.4.0_snipeit_sqlmig.sql @@ -1,8 +1,11 @@ -ALTER TABLE `asset_uploads` -CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , -CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; -ALTER TABLE `assets` +/* +SNIPE IT SQL migration script +20140810_0.4.0 +Created by Cordeos +*/ + +ALTER TABLE `asset_uploads` CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; @@ -26,6 +29,10 @@ ALTER TABLE `license_seats` CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; +ALTER TABLE `assets` +CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , +CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; + ALTER TABLE `licenses` CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; @@ -38,10 +45,6 @@ ALTER TABLE `manufacturers` CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; -ALTER TABLE `models` -CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , -CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; - ALTER TABLE `settings` CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; @@ -54,14 +57,13 @@ ALTER TABLE `suppliers` CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; -ALTER TABLE `users` +ALTER TABLE `models` CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; -UPDATE assets SET status_id=0 where status_id is null; -UPDATE assets SET purchase_cost=0 where purchase_cost is null; -UPDATE models SET eol=0 where eol is null; -UPDATE users SET location_id=0 where location_id is null; +ALTER TABLE `users` +CHANGE COLUMN `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , +CHANGE COLUMN `updated_at` `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ; ALTER TABLE `assets` CHANGE COLUMN `name` `name` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL , @@ -70,17 +72,18 @@ CHANGE COLUMN `purchase_cost` `purchase_cost` DECIMAL(13,4) NOT NULL DEFAULT '0. CHANGE COLUMN `order_number` `order_number` VARCHAR(255) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL , CHANGE COLUMN `assigned_to` `assigned_to` INT(11) NULL DEFAULT NULL , CHANGE COLUMN `notes` `notes` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL , -CHANGE COLUMN `status_id` `status_id` INT(11) NULL DEFAULT NULL ; CHANGE COLUMN `archived` `archived` TINYINT(1) NOT NULL DEFAULT '0' , -CHANGE COLUMN `depreciate` `depreciate` TINYINT(1) NOT NULL DEFAULT '0' , -CHANGE COLUMN `supplier_id` `supplier_id` INT(11) NULL DEFAULT NULL , -CHANGE COLUMN `requestable` `requestable` TINYINT(4) NOT NULL DEFAULT '0' ; +CHANGE COLUMN `depreciate` `depreciate` TINYINT(1) NOT NULL DEFAULT '0' ; ALTER TABLE `licenses` CHANGE COLUMN `purchase_cost` `purchase_cost` DECIMAL(13,4) NULL DEFAULT NULL , CHANGE COLUMN `depreciate` `depreciate` TINYINT(1) NULL DEFAULT '0' ; +ALTER TABLE `license_seats` +CHANGE COLUMN `assigned_to` `assigned_to` INT(11) NULL DEFAULT NULL ; + ALTER TABLE `locations` +CHANGE COLUMN `state` `state` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL , CHANGE COLUMN `address2` `address2` VARCHAR(80) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL , CHANGE COLUMN `zip` `zip` VARCHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL ; diff --git a/app/helpers.php b/app/helpers.php old mode 100644 new mode 100755 diff --git a/app/lang/en/admin/hardware/table.php b/app/lang/en/admin/hardware/table.php old mode 100644 new mode 100755 diff --git a/app/lang/en/admin/licenses/general.php b/app/lang/en/admin/licenses/general.php old mode 100755 new mode 100644 index bd38945704..0e776b99d6 --- a/app/lang/en/admin/licenses/general.php +++ b/app/lang/en/admin/licenses/general.php @@ -6,6 +6,7 @@ return array( 'checkout_history' => 'Checkout History', 'checkout' => 'Checkout License Seat', 'edit' => 'Edit License', + 'clone' => 'Clone License', 'history_for' => 'History for ', 'in_out' => 'In/Out', 'info' => 'License Info', diff --git a/app/lang/en/general.php b/app/lang/en/general.php old mode 100644 new mode 100755 diff --git a/app/models/Actionlog.php b/app/models/Actionlog.php old mode 100644 new mode 100755 diff --git a/app/models/Asset.php b/app/models/Asset.php old mode 100644 new mode 100755 diff --git a/app/models/Category.php b/app/models/Category.php old mode 100644 new mode 100755 diff --git a/app/models/Depreciation.php b/app/models/Depreciation.php old mode 100644 new mode 100755 diff --git a/app/models/Elegant.php b/app/models/Elegant.php old mode 100644 new mode 100755 diff --git a/app/models/Group.php b/app/models/Group.php old mode 100644 new mode 100755 diff --git a/app/models/License.php b/app/models/License.php old mode 100644 new mode 100755 diff --git a/app/models/Location.php b/app/models/Location.php old mode 100644 new mode 100755 diff --git a/app/models/Manufacturer.php b/app/models/Manufacturer.php old mode 100644 new mode 100755 diff --git a/app/models/Model.php b/app/models/Model.php old mode 100644 new mode 100755 diff --git a/app/models/Statuslabel.php b/app/models/Statuslabel.php old mode 100644 new mode 100755 diff --git a/app/models/Supplier.php b/app/models/Supplier.php old mode 100644 new mode 100755 diff --git a/app/models/User.php b/app/models/User.php old mode 100644 new mode 100755 diff --git a/app/routes.php b/app/routes.php old mode 100755 new mode 100644 index 44730d5542..65e1fe0104 --- a/app/routes.php +++ b/app/routes.php @@ -62,6 +62,8 @@ Route::group(array('prefix' => 'admin'), function () { Route::post('create', 'Controllers\Admin\LicensesController@postCreate'); Route::get('{licenseId}/edit', array('as' => 'update/license', 'uses' => 'Controllers\Admin\LicensesController@getEdit')); Route::post('{licenseId}/edit', 'Controllers\Admin\LicensesController@postEdit'); + Route::get('{licenseId}/clone', array('as' => 'clone/license', 'uses' => 'Controllers\Admin\LicensesController@getClone')); + Route::post('{licenseId}/clone', 'Controllers\Admin\LicensesController@postCreate'); Route::get('{licenseId}/delete', array('as' => 'delete/license', 'uses' => 'Controllers\Admin\LicensesController@getDelete')); Route::get('{licenseId}/checkout', array('as' => 'checkout/license', 'uses' => 'Controllers\Admin\LicensesController@getCheckout')); Route::post('{licenseId}/checkout', 'Controllers\Admin\LicensesController@postCheckout'); diff --git a/app/start/artisan.php b/app/start/artisan.php old mode 100644 new mode 100755 diff --git a/app/start/global.php b/app/start/global.php old mode 100644 new mode 100755 diff --git a/app/tests/ExampleTest.php b/app/tests/ExampleTest.php old mode 100644 new mode 100755 diff --git a/app/views/backend/categories/index.blade.php b/app/views/backend/categories/index.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/hardware/clone.blade.php b/app/views/backend/hardware/clone.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/hardware/edit.blade.php b/app/views/backend/hardware/edit.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/hardware/index.blade.php b/app/views/backend/hardware/index.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/hardware/view.blade.php b/app/views/backend/hardware/view.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/layouts/default.blade.php b/app/views/backend/layouts/default.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/licenses/checkout.blade.php b/app/views/backend/licenses/checkout.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/licenses/edit.blade.php b/app/views/backend/licenses/edit.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/licenses/index.blade.php b/app/views/backend/licenses/index.blade.php old mode 100644 new mode 100755 diff --git a/app/views/backend/licenses/view.blade.php b/app/views/backend/licenses/view.blade.php index c2abd4767c..400a14225b 100644 --- a/app/views/backend/licenses/view.blade.php +++ b/app/views/backend/licenses/view.blade.php @@ -9,11 +9,27 @@ {{-- Page content --}} @section('content') -