Compare commits

..

33 Commits

Author SHA1 Message Date
snipe e7fba08f92 Merge remote-tracking branch 'origin/develop' 2016-09-06 10:38:31 -07:00
snipe 35f3f1432f Bumped version 2016-09-06 10:38:07 -07:00
snipe 934b39268d Merge remote-tracking branch 'origin/develop' 2016-09-06 10:35:33 -07:00
snipe 67315d81d6 Fixes #2134 - hide archived assets from list all 2016-09-01 13:28:15 -07:00
snipe eee64d5509 Set the public path for users who can’t use public as a directory (shared hosting) 2016-09-01 12:53:38 -07:00
snipe b450ef3534 Cast group permissions as array for older, wonky installs 2016-08-30 13:25:14 -07:00
snipe d4dc1830ec Fixes #2527 - honor the setting for whether Snpie-IT can access the outside world 2016-08-30 12:58:08 -07:00
snipe 04e9ca0942 Fixes #2399 2016-08-30 12:34:23 -07:00
snipe 06021d79c1 Fixed typo 2016-08-30 12:25:46 -07:00
snipe 7ecb8d7bc1 Patches PR#2526 to develop 2016-08-30 12:13:29 -07:00
Ryan Stafford efe95d9ad0 Syntax error on VOLUME instruction (#2526)
Added quotes to volume path.
2016-08-30 12:11:42 -07:00
snipe 6f89699f1a Make purchase cost default to null
I don’t know why I need to do this?
2016-08-30 08:52:33 -07:00
snipe 2c18bc24a7 Check if username is userprincipalname
If it is, skip building the UPN for AD
2016-08-30 08:34:17 -07:00
snipe f81b21208b Bumped version for v3.4.0-beta 2016-08-30 07:39:55 -07:00
snipe ba70e5b053 A little demo-proofing of the maintenances page 2016-08-30 07:34:33 -07:00
snipe 5090468357 Fixes #2510 and #2488 - CSS class added to images in views 2016-08-30 07:20:07 -07:00
snipe 213cda8cf4 Fixes #2525 2016-08-30 07:03:22 -07:00
snipe 421cbf11fc Patches PR#2500 for dev because @dmeltzer forgot that we commit to the develop branch :P 2016-08-30 06:54:04 -07:00
snipe 8816c481af Added HTML for generating passwords in asset user creation modal 2016-08-30 06:48:23 -07:00
snipe 3ed0cf2be8 Moved import errors up higher on the screen, fixed some weird formatting bugaboos 2016-08-30 06:48:00 -07:00
snipe cd28b012b3 Remove last name requirement in save user request 2016-08-30 06:47:38 -07:00
snipe 25902db659 Generate password from modal 2016-08-30 06:47:18 -07:00
snipe 35a67ab18a Fixes #2516 - listbox error on new asset 2016-08-29 23:49:23 -07:00
snipe 2cfb015b1a Removed extra debugging info 2016-08-29 23:13:30 -07:00
snipe e4dcd47d6c Fix UTF-8 issues in imports 2016-08-29 22:57:48 -07:00
snipe 64cd4fb1c9 Allow X-Frame-Options to be disabled via env if necessary 2016-08-29 22:57:29 -07:00
Daniel Meltzer 276e0a7114 Importer: Implement item update and interface improvments (#2507)
* Add support for updating assets to the importer.

If an asset with a matching asset tag is found, and the --update flag is
passed to the importer, we edit the matching asset with any
asset-specific values, and persist to the database.  Any missing/blank
values are skipped.

TODO: Add to web interface, add support in consumables/accessories

* Allow deleting of files on the import page.

* Extend web interface to allow updating of imported items.

This adds a modal dialog to the import process.  Currently the dialog
allows the choice of update vs ignore, and choosing the item type to
import (Accessory, Asset, Consumable).

Also use Helper::ParseFloat() for purchase_cost processing.  It exists,
and fixes issues on my end at least.

* Implement editing of consumables and accessories.

* Rename getProcessImportFile to postProcessImportFile to reflect how it's now used

* Fix copy-pasta error.
2016-08-29 15:49:32 -07:00
Daniel Meltzer 9bf3403f31 Fix #2499 (#2500)
Missed this instance when renaming the method. Sorry!
2016-08-26 06:01:58 -07:00
snipe f38593b530 Merge remote-tracking branch 'origin/develop' 2016-08-23 19:01:53 -07:00
snipe 0b0c81a110 Merge remote-tracking branch 'origin/develop' 2016-08-23 11:38:03 -07:00
snipe 16014945b6 Merge remote-tracking branch 'origin/develop' 2016-08-16 18:23:36 -07:00
snipe c5d7a1fdd6 Merge remote-tracking branch 'origin/develop' 2016-08-16 18:21:05 -07:00
timwsuqld 8232cefbba Fix path to snipeit-ssl.crt (#2428) 2016-08-16 13:03:55 -07:00
35 changed files with 551 additions and 221 deletions
+1
View File
@@ -75,3 +75,4 @@ APP_LOG=single
APP_LOCKED=false
FILESYSTEM_DISK=local
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
ALLOW_IFRAMING=false
+1 -1
View File
@@ -80,7 +80,7 @@ RUN cd /var/www/html;composer install
############### DATA VOLUME #################
VOLUME [/var/lib/snipeit]
VOLUME ["/var/lib/snipeit"]
##### START SERVER
+146 -64
View File
@@ -1,25 +1,27 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use League\Csv\Reader;
use App\Helpers\Helper;
use App\Models\Accessory;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Category;
use App\Models\Company;
use App\Models\Consumable;
use App\Models\CustomField;
use App\Models\Location;
use App\Models\Manufacturer;
use App\Models\Setting;
use App\Models\Statuslabel;
use App\Models\Supplier;
use App\Models\User;
use App\Models\CustomField;
use DB;
use App\Models\Setting;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use League\Csv\Reader;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use ForceUTF8\Encoding;
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
@@ -102,9 +104,17 @@ class ObjectImportCommand extends Command
$this->companies = Company::All(['name', 'id']);
$this->status_labels = Statuslabel::All(['name', 'id']);
$this->suppliers = Supplier::All(['name', 'id']);
$this->assets = Asset::all(['asset_tag']);
$this->accessories = Accessory::All(['name']);
$this->consumables = Consumable::All(['name']);
switch (strtolower($this->option('item-type'))) {
case "asset":
$this->assets = Asset::all();
break;
case "accessory":
$this->accessories = Accessory::All();
break;
case "consumable":
$this->consumables = Consumable::All();
break;
}
$this->customfields = CustomField::All(['name']);
$bar = null;
@@ -275,7 +285,7 @@ class ObjectImportCommand extends Command
*/
public function array_smart_fetch(array $array, $key, $default = '')
{
return array_key_exists($key, $array) ? e(trim($array[ $key ])) : $default;
return array_key_exists(trim($key), $array) ? e(Encoding::fixUTF8(trim($array[ $key ]))) : $default;
}
@@ -313,7 +323,7 @@ class ObjectImportCommand extends Command
$asset_model_name = $this->array_smart_fetch($row, "model name");
$asset_modelno = $this->array_smart_fetch($row, "model number");
if (empty($asset_model_name)) {
$asset_model_name='Unknown';
$asset_model_name ='Unknown';
}
if (empty($asset_modelno)) {
$asset_modelno='';
@@ -346,6 +356,7 @@ class ObjectImportCommand extends Command
return $asset_model;
} else {
$this->jsonError('Asset Model "' . $asset_model_name . '"', $asset_model->getErrors());
$this->log('Asset Model "' . $asset_model_name . '"', $asset_model->getErrors());
return $asset_model;
}
} else {
@@ -732,6 +743,24 @@ class ObjectImportCommand extends Command
*/
public function createAssetIfNotExists(array $row, array $item)
{
$asset = null;
$editingAsset = false;
foreach ($this->assets as $tempasset) {
if (strcasecmp($tempasset->asset_tag, $item['asset_tag']) == 0) {
$this->log('A matching Asset ' . $item['asset_tag'] . ' already exists');
if (!$this->option('update')) {
$this->log("Skipping item.");
return;
}
$this->log('Updating matching asset with new values');
$editingAsset = true;
$asset = $tempasset;
}
}
if (is_null($asset)) {
$this->log("No Matching Asset, Creating a new one");
$asset = new Asset;
}
$asset_serial = $this->array_smart_fetch($row, "serial number");
$asset_image = $this->array_smart_fetch($row, "image");
$asset_warranty_months = intval($this->array_smart_fetch($row, "warranty months"));
@@ -747,12 +776,7 @@ class ObjectImportCommand extends Command
$this->log('Notes: '.$item["notes"]);
$this->log('Warranty Months: ' . $asset_warranty_months);
foreach ($this->assets as $tempasset) {
if (strcasecmp($tempasset->asset_tag, $item['asset_tag']) == 0) {
$this->log('A matching Asset ' . $item['asset_tag'] . ' already exists');
return;
}
}
if ($item["status_label"]) {
$status_id = $item["status_label"]->id;
@@ -763,12 +787,14 @@ class ObjectImportCommand extends Command
$status_id = 1;
}
$asset = new Asset();
$asset->name = $item["item_name"];
if ($item["purchase_date"] != '') {
if (!$editingAsset) {
$asset->asset_tag = $item['asset_tag']; // This doesn't need to be guarded for empty because it's the key we use to identify the asset.
}
if (!empty($item['item_name'])) {
$asset->name = $item["item_name"];
}
if (!empty($item["purchase_date"])) {
$asset->purchase_date = $item["purchase_date"];
} else {
$asset->purchase_date = null;
}
if (array_key_exists('custom_fields', $item)) {
@@ -780,37 +806,53 @@ class ObjectImportCommand extends Command
if (!empty($item["purchase_cost"])) {
//TODO How to generalize this for not USD?
$purchase_cost = substr($item["purchase_cost"], 0, 1) === '$' ? substr($item["purchase_cost"], 1) : $item["purchase_cost"];
$asset->purchase_cost = number_format($purchase_cost, 2, '.', '');
// $asset->purchase_cost = number_format($purchase_cost, 2, '.', '');
$asset->purchase_cost = Helper::ParseFloat($purchase_cost);
$this->log("Asset cost parsed: " . $asset->purchase_cost);
} else {
$asset->purchase_cost = 0.00;
}
$asset->serial = $asset_serial;
$asset->asset_tag = $item['asset_tag'];
$asset->warranty_months = $asset_warranty_months;
if (!empty($asset_serial)) {
$asset->serial = $asset_serial;
}
if (!empty($asset_warranty_months)) {
$asset->warranty_months = $asset_warranty_months;
}
if ($asset_model) {
$asset->model_id = $asset_model->id;
}
if ($item["user"]) {
$asset->assigned_to = $item["user"]->id;
}
if ($item["location"]) {
$asset->rtd_location_id = $item["location"]->id;
}
$asset->user_id = $this->option('user_id');
$this->log("status_id: " . $status_id);
$asset->status_id = $status_id;
if (!empty($status_id)) {
$asset->status_id = $status_id;
}
if ($item["company"]) {
$asset->company_id = $item["company"]->id;
}
$asset->order_number = $item["order_number"];
if ($item["order_number"]) {
$asset->order_number = $item["order_number"];
}
if ($supplier) {
$asset->supplier_id = $supplier->id;
}
$asset->notes = $item["notes"];
$asset->image = $asset_image;
$this->assets->add($asset);
if ($item["notes"]) {
$asset->notes = $item["notes"];
}
if (!empty($asset_image)) {
$asset->image = $asset_image;
}
if (!$editingAsset) {
$this->assets->add($asset);
}
if (!$this->option('testrun')) {
if ($asset->save()) {
@@ -835,17 +877,29 @@ class ObjectImportCommand extends Command
*/
public function createAccessoryIfNotExists(array $item)
{
$accessory = null;
$editingAccessory = false;
$this->log("Creating Accessory");
foreach ($this->accessories as $tempaccessory) {
if (strcasecmp($tempaccessory->name, $item["item_name"]) == 0) {
$this->log('A matching Accessory ' . $item["item_name"] . ' already exists. ');
// FUTURE: Adjust quantity on import maybe?
return;
if (!$this->option('update')) {
$this->log("Skipping accessory.");
return;
}
$this->log('Updating matching accessory with new values');
$editingAccessory = true;
$accessory = $tempaccessory;
}
}
if (is_null($accessory)) {
$this->log("No Matching Accessory, Creating a new one");
$accessory = new Accessory();
}
$accessory = new Accessory();
$accessory->name = $item["item_name"];
if (!$editingAccessory) {
$accessory->name = $item["item_name"];
}
if (!empty($item["purchase_date"])) {
$accessory->purchase_date = $item["purchase_date"];
@@ -853,10 +907,9 @@ class ObjectImportCommand extends Command
$accessory->purchase_date = null;
}
if (!empty($item["purchase_cost"])) {
$accessory->purchase_cost = number_format(e($item["purchase_cost"]), 2);
} else {
$accessory->purchase_cost = 0.00;
$accessory->purchase_cost = Helper::ParseFloat($item["purchase_cost"]);
}
if ($item["location"]) {
$accessory->location_id = $item["location"]->id;
}
@@ -864,20 +917,26 @@ class ObjectImportCommand extends Command
if ($item["company"]) {
$accessory->company_id = $item["company"]->id;
}
$accessory->order_number = $item["order_number"];
if (!empty($item["order_number"])) {
$accessory->order_number = $item["order_number"];
}
if ($item["category"]) {
$accessory->category_id = $item["category"]->id;
}
//TODO: Implement
// $accessory->notes = e($item_notes);
$accessory->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
if (!empty($item["requestable"])) {
$accessory->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
}
//Must have at least zero of the item if we import it.
if ($item["quantity"] > -1) {
$accessory->qty = $item["quantity"];
} else {
$accessory->qty = 1;
if (!empty($item["quantity"])) {
if ($item["quantity"] > -1) {
$accessory->qty = $item["quantity"];
} else {
$accessory->qty = 1;
}
}
if (!$this->option('testrun')) {
@@ -904,18 +963,29 @@ class ObjectImportCommand extends Command
*/
public function createConsumableIfNotExists(array $item)
{
$consumable = null;
$editingConsumable = false;
$this->log("Creating Consumable");
foreach ($this->consumables as $tempconsumable) {
if (strcasecmp($tempconsumable->name, $item["item_name"]) == 0) {
$this->log("A matching consumable " . $item["item_name"] . " already exists");
//TODO: Adjust quantity if different maybe?
return;
if (!$this->option('update')) {
$this->log("Skipping consumable.");
return;
}
$this->log('Updating matching consumable with new values');
$editingConsumable = true;
$consumable = $tempconsumable;
}
}
$consumable = new Consumable();
$consumable->name = $item["item_name"];
if (is_null($consumable)) {
$this->log("No matching consumable, creating one");
$consumable = new Consumable();
}
if (!$editingConsumable) {
$consumable->name = $item["item_name"];
}
if (!empty($item["purchase_date"])) {
$consumable->purchase_date = $item["purchase_date"];
} else {
@@ -923,26 +993,37 @@ class ObjectImportCommand extends Command
}
if (!empty($item["purchase_cost"])) {
$consumable->purchase_cost = number_format(e($item["purchase_cost"]), 2);
} else {
$consumable->purchase_cost = 0.00;
$consumable->purchase_cost = Helper::ParseFloat($item["purchase_cost"]);
}
if ($item["location"]) {
$consumable->location_id = $item["location"]->id;
}
$consumable->location_id = $item["location"]->id;
$consumable->user_id = $this->option('user_id');
$consumable->company_id = $item["company"]->id;
$consumable->order_number = $item["order_number"];
$consumable->category_id = $item["category"]->id;
if ($item["company"]) {
$consumable->company_id = $item["company"]->id;
}
if (!empty($item["order_number"])) {
$consumable->order_number = $item["order_number"];
}
if ($item["category"]) {
$consumable->category_id = $item["category"]->id;
}
// TODO:Implement
//$consumable->notes= e($item_notes);
$consumable->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
if (!empty($item["requestable"])) {
$consumable->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
}
if ($item["quantity"] > -1) {
$consumable->qty = $item["quantity"];
} else {
$consumable->qty = 1;
if (!empty($item["quantity"])) {
if ($item["quantity"] > -1) {
$consumable->qty = $item["quantity"];
} else {
$consumable->qty = 1;
}
}
if (!$this->option("testrun")) {
// dd($consumable);
if ($consumable->save()) {
$this->log("Consumable " . $item["item_name"] . ' was created');
// $this->comment("Consumable " . $item["item_name"] . ' was created');
@@ -985,8 +1066,9 @@ class ObjectImportCommand extends Command
array('testrun', null, InputOption::VALUE_NONE, 'If set, will parse and output data without adding to database', null),
array('logfile', null, InputOption::VALUE_REQUIRED, 'The path to log output to. storage/logs/importer.log by default', storage_path('logs/importer.log') ),
array('item-type', null, InputOption::VALUE_REQUIRED, 'Item Type To import. Valid Options are Asset, Consumable, Or Accessory', 'Asset'),
array('web-importer', null, InputOption::VALUE_NONE, 'Internal: packages output for use with the web importer'),
array('user_id', null, InputOption::VALUE_REQUIRED, 'ID of user creating items', 1)
array('web-importer', null, InputOption::VALUE_NONE, 'Internal: packages output for use with the web importer'),
array('user_id', null, InputOption::VALUE_REQUIRED, 'ID of user creating items', 1),
array('update', null, InputOption::VALUE_NONE, 'If a matching item is found, update item information'),
);
}
@@ -122,20 +122,18 @@ class AssetMaintenancesController extends Controller
$actions = '<nobr><a href="'.route('update/asset_maintenance', $maintenance->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/asset_maintenance', $maintenance->id).'" data-content="'.trans('admin/asset_maintenances/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($maintenance->title).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
if (($maintenance->cost) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
if (($maintenance->cost) && (isset($maintenance->asset)) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
$maintenance_cost = $maintenance->asset->assetloc->currency.$maintenance->cost;
} else {
$maintenance_cost = $settings->default_currency.$maintenance->cost;
}
$company = $maintenance->asset->company;
$rows[] = array(
'id' => $maintenance->id,
'asset_name' => (string)link_to('/hardware/'.$maintenance->asset->id.'/view', $maintenance->asset->showAssetName()) ,
'asset_name' => ($maintenance->asset) ? (string)link_to('/hardware/'.$maintenance->asset->id.'/view', $maintenance->asset->showAssetName()) : 'Deleted Asset' ,
'title' => $maintenance->title,
'notes' => $maintenance->notes,
'supplier' => $maintenance->supplier->name,
'supplier' => ($maintenance->supplier) ? (string)link_to('/admin/settings/suppliers/'.$maintenance->supplier->id.'/view', $maintenance->supplier->name) : 'Deleted Supplier',
'cost' => $maintenance_cost,
'asset_maintenance_type' => e($maintenance->asset_maintenance_type),
'start_date' => $maintenance->start_date,
@@ -143,7 +141,7 @@ class AssetMaintenancesController extends Controller
'completion_date' => $maintenance->completion_date,
'user_id' => ($maintenance->admin) ? (string)link_to('/admin/users/'.$maintenance->admin->id.'/view', $maintenance->admin->fullName()) : '',
'actions' => $actions,
'companyName' => is_null($company) ? '' : $company->name
'companyName' => ($maintenance->asset) ? $maintenance->asset->company->name : ''
);
}
+43 -9
View File
@@ -927,6 +927,18 @@ class AssetsController extends Controller
}
public function getDeleteImportFile($filename)
{
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
}
if (unlink(config('app.private_uploads').'/imports/assets/'.$filename)) {
return redirect()->back()->with('success', trans('admin/hardware/message.import.file_delete_success'));
}
return redirect()->back()->with('error', trans('admin/hardware/message.import.file_delete_error'));
}
/**
* Process the uploaded file
@@ -936,28 +948,47 @@ class AssetsController extends Controller
* @since [v2.0]
* @return Redirect
*/
public function getProcessImportFile($filename)
public function postProcessImportFile()
{
// php artisan asset-import:csv path/to/your/file.csv --domain=yourdomain.com --email_format=firstname.lastname
$filename = Input::get('filename');
$itemType = Input::get('import-type');
$updateItems = Input::get('import-update');
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
}
$return = Artisan::call(
'snipeit:import',
['filename'=> config('app.private_uploads').'/imports/assets/'.$filename,
$importOptions = ['filename'=> config('app.private_uploads').'/imports/assets/'.$filename,
'--email_format'=>'firstname.lastname',
'--username_format'=>'firstname.lastname',
'--web-importer' => true,
'--user_id' => Auth::user()->id
]
);
'--user_id' => Auth::user()->id,
'--item-type' => $itemType,
];
if ($updateItems) {
$importOptions['--update'] = true;
}
$return = Artisan::call('snipeit:import', $importOptions);
$display_output = Artisan::output();
$file = config('app.private_uploads').'/imports/assets/'.str_replace('.csv', '', $filename).'-output-'.date("Y-m-d-his").'.txt';
file_put_contents($file, $display_output);
// We use hardware instead of asset in the url
$redirectTo = "hardware";
switch($itemType) {
case "asset":
$redirectTo = "hardware";
break;
case "accessory":
$redirectTo = "accessories";
break;
case "consumable":
$redirectTo = "consumables";
break;
}
if ($return === 0) { //Success
return redirect()->to('hardware')->with('success', trans('admin/hardware/message.import.success'));
return redirect()->to(route($redirectTo))->with('success', trans('admin/hardware/message.import.success'));
} elseif ($return === 1) { // Failure
return redirect()->back()->with('import_errors', json_decode($display_output))->with('error', trans('admin/hardware/message.import.error'));
}
@@ -1645,6 +1676,9 @@ class AssetsController extends Controller
case 'Deployed':
$assets->Deployed();
break;
default:
$assets->NotArchived();
break;
}
+1 -1
View File
@@ -55,7 +55,7 @@ class ProfileController extends Controller
if (Input::file('avatar')) {
$image = Input::file('avatar');
$file_name = $user->first_name."-".$user->last_name.".".$image->getClientOriginalExtension();
$file_name = str_slug($user->first_name."-".$user->last_name).".".$image->getClientOriginalExtension();
$path = public_path('uploads/avatars/'.$file_name);
Image::make($image->getRealPath())->resize(84, 84)->save($path);
$user->avatar = $file_name;
+1 -1
View File
@@ -167,7 +167,7 @@ class ReportsController extends Controller
$row[] = '';
}
$row[] = $asset->purchase_date;
$row[] = '"' . Helper::parsePurchasedCost($asset->purchase_cost) . '"';
$row[] = '"' . Helper::formatCurrencyOutput($asset->purchase_cost) . '"';
if ($asset->order_number) {
$row[] = e($asset->order_number);
} else {
+4 -1
View File
@@ -15,7 +15,10 @@ class FrameGuard
public function handle($request, Closure $next)
{
$response = $next($request);
$response->headers->set('X-Frame-Options', 'SAMEORIGIN', false);
if (config('app.allow_iframing') == false) {
$response->headers->set('X-Frame-Options', 'SAMEORIGIN', false);
}
return $response;
}
}
+1 -1
View File
@@ -25,10 +25,10 @@ class SaveUserRequest extends Request
{
return [
'first_name' => 'required|string|min:1',
'last_name' => 'required|string|min:1',
'email' => 'email',
'password' => 'required|min:6',
'password_confirm' => 'sometimes|required_with:password',
'username' => 'required|string|min:2|unique:users,username,NULL,deleted_at',
];
}
}
+6 -2
View File
@@ -293,9 +293,13 @@ Route::group(
'uses' => 'AssetsController@getDeleteImportFile'
]);
Route::get( 'import/process/{filename}', [ 'as' => 'assets/import/process-file',
Route::post( 'import/process/', [ 'as' => 'assets/import/process-file',
'middleware' => 'authorize:assets.create',
'uses' => 'AssetsController@getProcessImportFile'
'uses' => 'AssetsController@postProcessImportFile'
]);
Route::get( 'import/delete/{filename}', [ 'as' => 'assets/import/delete-file',
'middleware' => 'authorize:assets.create', // TODO What permissions should this require?
'uses' => 'AssetsController@getDeleteImportFile'
]);
Route::get('import',[
+17
View File
@@ -628,6 +628,23 @@ public function checkin_email()
});
}
/**
* Query builder scope for non-Archived assets
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeNotArchived($query)
{
return $query->whereHas('assetstatus', function ($query) {
$query->where('archived', '=', 0);
});
}
/**
* Query builder scope for Archived assets
*
+11 -4
View File
@@ -81,11 +81,18 @@ class Ldap extends Model
if ($settings->is_ad =='1')
{
// In case they haven't added an AD domain
if ($settings->ad_domain == '') {
$userDn = $username.'@'.$settings->email_domain;
// Check if they are using the userprincipalname for the username field.
// If they are, we can skip building the UPN to authenticate against AD
if ($ldap_username_field=='userprincipalname')
{
$userDn = $username;
} else {
$userDn = $username.'@'.$settings->ad_domain;
// In case they haven't added an AD domain
if ($settings->ad_domain == '') {
$userDn = $username.'@'.$settings->email_domain;
} else {
$userDn = $username.'@'.$settings->ad_domain;
}
}
} else {
+2 -2
View File
@@ -67,7 +67,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
// Loop through the groups to see if any of them grant this permission
foreach ($user_groups as $user_group) {
$group_permissions = json_decode($user_group->permissions, true);
$group_permissions = (array) json_decode($user_group->permissions, true);
if (((array_key_exists($section, $group_permissions)) && ($group_permissions[$section]=='1'))) {
return true;
}
@@ -84,7 +84,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
foreach ($this->groups as $user_group) {
$group_permissions = json_decode($user_group->permissions, true);
$group_array = $group_permissions;
$group_array = (array)$group_permissions;
if ((array_key_exists('superuser', $group_array)) && ($group_permissions['superuser']=='1')) {
return true;
}
+2 -1
View File
@@ -22,7 +22,8 @@
"doctrine/dbal": "v2.4.2",
"barryvdh/laravel-debugbar": "^2.1",
"spatie/laravel-backup": "3.8.1",
"misterphilip/maintenance-mode": "1.0.*"
"misterphilip/maintenance-mode": "1.0.*",
"neitanod/forceutf8": "dev-master"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
Generated
+101 -64
View File
@@ -4,21 +4,21 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "a770010d0ebb93a2e1b5f4acadd5a7f3",
"content-hash": "59772418a4612685eea10dde38ca77b7",
"hash": "ed9f8700f2dcd943ff662a82e4d8314f",
"content-hash": "9c0251ddc1a110d83a762483abeea079",
"packages": [
{
"name": "aws/aws-sdk-php",
"version": "3.18.39",
"version": "3.19.2",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "85f1fddaeb40b95106b2a2764268e9c89fc258ce"
"reference": "3cb90413129da42c9d3289d542bee0ae1049892c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/85f1fddaeb40b95106b2a2764268e9c89fc258ce",
"reference": "85f1fddaeb40b95106b2a2764268e9c89fc258ce",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3cb90413129da42c9d3289d542bee0ae1049892c",
"reference": "3cb90413129da42c9d3289d542bee0ae1049892c",
"shasum": ""
},
"require": {
@@ -85,7 +85,7 @@
"s3",
"sdk"
],
"time": "2016-08-11 16:40:35"
"time": "2016-08-23 20:58:48"
},
{
"name": "aws/aws-sdk-php-laravel",
@@ -145,21 +145,21 @@
},
{
"name": "barryvdh/laravel-debugbar",
"version": "v2.2.2",
"version": "V2.2.3",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "c291e58d0a13953e0f68d99182ee77ebc693edc0"
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/c291e58d0a13953e0f68d99182ee77ebc693edc0",
"reference": "c291e58d0a13953e0f68d99182ee77ebc693edc0",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
"shasum": ""
},
"require": {
"illuminate/support": "5.1.*|5.2.*",
"maximebf/debugbar": "~1.11.0",
"illuminate/support": "5.1.*|5.2.*|5.3.*",
"maximebf/debugbar": "~1.11.0|~1.12.0",
"php": ">=5.5.9",
"symfony/finder": "~2.7|~3.0"
},
@@ -195,7 +195,7 @@
"profiler",
"webprofiler"
],
"time": "2016-05-11 13:54:43"
"time": "2016-07-29 15:00:36"
},
{
"name": "classpreloader/classpreloader",
@@ -1018,12 +1018,12 @@
"source": {
"type": "git",
"url": "https://github.com/Intervention/image.git",
"reference": "6886d43f5babe6900c29c59640ca81401fe71c80"
"reference": "45a41a38bd1e5290cd51ab773013e6f041b2b711"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Intervention/image/zipball/6886d43f5babe6900c29c59640ca81401fe71c80",
"reference": "6886d43f5babe6900c29c59640ca81401fe71c80",
"url": "https://api.github.com/repos/Intervention/image/zipball/45a41a38bd1e5290cd51ab773013e6f041b2b711",
"reference": "45a41a38bd1e5290cd51ab773013e6f041b2b711",
"shasum": ""
},
"require": {
@@ -1072,7 +1072,7 @@
"thumbnail",
"watermark"
],
"time": "2016-06-22 08:03:11"
"time": "2016-08-19 14:41:12"
},
{
"name": "jakub-onderka/php-console-color",
@@ -1221,16 +1221,16 @@
},
{
"name": "laravel/framework",
"version": "v5.2.43",
"version": "v5.2.45",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "5490b8f00564bb60839002f86828e27edd1e5610"
"reference": "2a79f920d5584ec6df7cf996d922a742d11095d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/5490b8f00564bb60839002f86828e27edd1e5610",
"reference": "5490b8f00564bb60839002f86828e27edd1e5610",
"url": "https://api.github.com/repos/laravel/framework/zipball/2a79f920d5584ec6df7cf996d922a742d11095d1",
"reference": "2a79f920d5584ec6df7cf996d922a742d11095d1",
"shasum": ""
},
"require": {
@@ -1311,7 +1311,7 @@
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).",
"symfony/css-selector": "Required to use some of the crawler integration testing tools (2.8.*|3.0.*).",
"symfony/dom-crawler": "Required to use most of the crawler integration testing tools (2.8.*|3.0.*).",
"symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)."
"symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)."
},
"type": "library",
"extra": {
@@ -1347,7 +1347,7 @@
"framework",
"laravel"
],
"time": "2016-08-10 12:23:59"
"time": "2016-08-26 11:44:52"
},
{
"name": "laravelcollective/html",
@@ -1595,16 +1595,16 @@
},
{
"name": "maximebf/debugbar",
"version": "v1.11.1",
"version": "v1.12.0",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "d9302891c1f0a0ac5a4f66725163a00537c6359f"
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/d9302891c1f0a0ac5a4f66725163a00537c6359f",
"reference": "d9302891c1f0a0ac5a4f66725163a00537c6359f",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
"shasum": ""
},
"require": {
@@ -1623,7 +1623,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
"dev-master": "1.12-dev"
}
},
"autoload": {
@@ -1652,7 +1652,7 @@
"debug",
"debugbar"
],
"time": "2016-01-22 12:22:23"
"time": "2016-05-15 13:11:34"
},
{
"name": "misterphilip/maintenance-mode",
@@ -1876,6 +1876,40 @@
],
"time": "2016-01-05 18:25:05"
},
{
"name": "neitanod/forceutf8",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/neitanod/forceutf8.git",
"reference": "2c1b21e00ed16b2b083ae4e27901cb5f2856db90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/neitanod/forceutf8/zipball/2c1b21e00ed16b2b083ae4e27901cb5f2856db90",
"reference": "2c1b21e00ed16b2b083ae4e27901cb5f2856db90",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"ForceUTF8\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"authors": [
{
"name": "Sebastián Grignoli",
"email": "grignoli@gmail.com"
}
],
"description": "PHP Class Encoding featuring popular Encoding::toUTF8() function --formerly known as forceUTF8()-- that fixes mixed encoded strings.",
"homepage": "https://github.com/neitanod/forceutf8",
"time": "2015-05-07 16:37:23"
},
{
"name": "nesbot/carbon",
"version": "1.21.0",
@@ -3132,17 +3166,17 @@
"source": {
"type": "git",
"url": "https://github.com/tecnickcom/tc-lib-barcode.git",
"reference": "220728e5f659b935348442e8d1d3e46fd5f9e178"
"reference": "df69541618a0ebc24bc8f938e52f76a471f2e018"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tecnickcom/tc-lib-barcode/zipball/220728e5f659b935348442e8d1d3e46fd5f9e178",
"reference": "220728e5f659b935348442e8d1d3e46fd5f9e178",
"url": "https://api.github.com/repos/tecnickcom/tc-lib-barcode/zipball/df69541618a0ebc24bc8f938e52f76a471f2e018",
"reference": "df69541618a0ebc24bc8f938e52f76a471f2e018",
"shasum": ""
},
"require": {
"php": ">=5.4",
"tecnickcom/tc-lib-color": "^1.11.0"
"tecnickcom/tc-lib-color": "^1.12.0"
},
"require-dev": {
"apigen/apigen": "^4.1.2",
@@ -3210,20 +3244,20 @@
"tc-lib-barcode",
"upc"
],
"time": "2016-07-10 18:29:15"
"time": "2016-08-25 12:36:23"
},
{
"name": "tecnickcom/tc-lib-color",
"version": "1.11.0",
"version": "1.12.0",
"source": {
"type": "git",
"url": "https://github.com/tecnickcom/tc-lib-color.git",
"reference": "6a000b658758e271bf4c41bbc1ce4c685d8a7160"
"reference": "176464ae7ad0256c1dfd9d742ee2461d0b660f7c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tecnickcom/tc-lib-color/zipball/6a000b658758e271bf4c41bbc1ce4c685d8a7160",
"reference": "6a000b658758e271bf4c41bbc1ce4c685d8a7160",
"url": "https://api.github.com/repos/tecnickcom/tc-lib-color/zipball/176464ae7ad0256c1dfd9d742ee2461d0b660f7c",
"reference": "176464ae7ad0256c1dfd9d742ee2461d0b660f7c",
"shasum": ""
},
"require": {
@@ -3272,7 +3306,7 @@
"tc-lib-color",
"web"
],
"time": "2016-06-13 14:31:19"
"time": "2016-08-25 11:56:01"
},
{
"name": "vlucas/phpdotenv",
@@ -3326,24 +3360,24 @@
},
{
"name": "watson/validating",
"version": "2.2.1",
"version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/dwightwatson/validating.git",
"reference": "64dc3d211372576d468e2bfaf3c7b7ace66ee970"
"reference": "8f37e416aaf02129c8ad57a446a6ef7080019687"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dwightwatson/validating/zipball/64dc3d211372576d468e2bfaf3c7b7ace66ee970",
"reference": "64dc3d211372576d468e2bfaf3c7b7ace66ee970",
"url": "https://api.github.com/repos/dwightwatson/validating/zipball/8f37e416aaf02129c8ad57a446a6ef7080019687",
"reference": "8f37e416aaf02129c8ad57a446a6ef7080019687",
"shasum": ""
},
"require": {
"illuminate/contracts": "~5.0",
"illuminate/database": "~5.0 || >=5.1.27",
"illuminate/events": "~5.0",
"illuminate/support": "~5.0",
"illuminate/validation": "~5.0",
"illuminate/contracts": "~5.0 <5.3",
"illuminate/database": "~5.0 <5.3 || >=5.1.27",
"illuminate/events": "~5.0 <5.3",
"illuminate/support": "~5.0 <5.3",
"illuminate/validation": "~5.0 <5.3",
"php": ">=5.4.0"
},
"require-dev": {
@@ -3377,7 +3411,7 @@
"laravel",
"validation"
],
"time": "2016-04-07 14:59:06"
"time": "2016-08-28 07:54:32"
}
],
"packages-dev": [
@@ -3571,16 +3605,16 @@
},
{
"name": "facebook/webdriver",
"version": "1.1.2",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/facebook/php-webdriver.git",
"reference": "0b889d7de7461439f8a3bbcca46e0f696cb27986"
"reference": "b7186fb1bcfda956d237f59face250d06ef47253"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/0b889d7de7461439f8a3bbcca46e0f696cb27986",
"reference": "0b889d7de7461439f8a3bbcca46e0f696cb27986",
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/b7186fb1bcfda956d237f59face250d06ef47253",
"reference": "b7186fb1bcfda956d237f59face250d06ef47253",
"shasum": ""
},
"require": {
@@ -3588,7 +3622,9 @@
"php": ">=5.3.19"
},
"require-dev": {
"phpunit/phpunit": "4.6.*"
"friendsofphp/php-cs-fixer": "^1.11",
"phpunit/phpunit": "4.6.* || ~5.0",
"squizlabs/php_codesniffer": "^2.6"
},
"suggest": {
"phpdocumentor/phpdocumentor": "2.*"
@@ -3611,7 +3647,7 @@
"selenium",
"webdriver"
],
"time": "2016-06-04 00:02:34"
"time": "2016-08-10 00:44:08"
},
{
"name": "fzaninotto/faker",
@@ -4580,23 +4616,23 @@
},
{
"name": "sebastian/environment",
"version": "1.3.7",
"version": "1.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
"phpunit/phpunit": "^4.8 || ^5.0"
},
"type": "library",
"extra": {
@@ -4626,7 +4662,7 @@
"environment",
"hhvm"
],
"time": "2016-05-17 03:18:57"
"time": "2016-08-18 05:49:44"
},
{
"name": "sebastian/exporter",
@@ -5184,7 +5220,8 @@
"intervention/image": 20,
"maknz/slack": 20,
"erusev/parsedown": 20,
"tecnickcom/tc-lib-barcode": 20
"tecnickcom/tc-lib-barcode": 20,
"neitanod/forceutf8": 20
},
"prefer-stable": false,
"prefer-lowest": false,
+14 -1
View File
@@ -127,6 +127,20 @@ return [
'private_uploads' => storage_path().'/private_uploads',
/*
|--------------------------------------------------------------------------
| ALLOW I-FRAMING
|--------------------------------------------------------------------------
|
| Normal users will never need to edit this. This option lets you run
| Snipe-IT within an I-Frame, which is normally disabled by default for
| security reasons, to prevent clickjacking. It should normally be set to false.
|
*/
'allow_iframing' => env('ALLOW_IFRAMING', false),
/*
|--------------------------------------------------------------------------
| Demo Mode Lockdown
@@ -140,7 +154,6 @@ return [
'lock_passwords' => env('APP_LOCKED', false),
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
+2 -2
View File
@@ -1,5 +1,5 @@
<?php
return array (
'app_version' => 'v3.4.0-alpha',
'hash_version' => 'v3.4.0-alpha-49-g122f0b9',
'app_version' => 'v3.4.0',
'hash_version' => 'v3.4.0-9-g67315d8',
);
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakePurchaseCostNullable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('assets', function ($table) {
$table->decimal('purchase_cost',8,2)->nullable()->default(null)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
+2
View File
@@ -22,3 +22,5 @@ APP_KEY=Y5hJeC7x1i7OxhDrvrQPlB9KvCorvRdO
APP_URL=http://127.0.0.1:32782
APP_TIMEZONE=US/Pacific
APP_LOCALE=en
ALLOW_IFRAMING=false
+1 -1
View File
@@ -50,7 +50,7 @@
# when the CA certificates are directly appended to the server
# certificate for convinience.
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
SSLCertificateChainFile /etc/ssl/private/snipeit-ssl.crt
SSLCertificateChainFile /var/lib/snipeit/ssl/snipeit-ssl.crt
# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
+4
View File
@@ -0,0 +1,4 @@
/**
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
View File
+5
View File
@@ -36,6 +36,11 @@ include '../c3.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
// set the public path to this directory
$app->bind('path.public', function() {
return __DIR__;
});
/*
|--------------------------------------------------------------------------
| Run The Application
@@ -4,7 +4,7 @@ return array(
'custom_fields' => 'Custom Fields',
'field' => 'Field',
'about_fieldsets_title' => 'About Fieldsets',
'about_fieldsets_text' => 'Fieldsets allow you to create groups of custom fields that are frequently re-used used for specific asset model types.',
'about_fieldsets_text' => 'Fieldsets allow you to create groups of custom fields that are frequently re-used for specific asset model types.',
'custom_format' => 'Custom format...',
'encrypt_field' => 'Encrypt the value of this field in the database for each asset. The decrypted value of this field will only be viewable by admins.',
'encrypt_field_help' => 'WARNING: Encrypting a field makes it unsearchable.',
+5 -3
View File
@@ -37,9 +37,11 @@ return array(
),
'import' => array(
'error' => 'Some items did not import correctly.',
'errorDetail' => 'The following Items were not imported because of errors.',
'success' => "Your file has been imported",
'error' => 'Some items did not import correctly.',
'errorDetail' => 'The following Items were not imported because of errors.',
'success' => "Your file has been imported",
'file_delete_success' => "Your file has been been successfully deleted",
'file_delete_error' => "The file was unable to be deleted",
),
+1 -1
View File
@@ -88,7 +88,7 @@
<label class="col-md-3 control-label" for="avatar_delete">{{ trans('general.avatar_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('avatar_delete') }}
<img src="/uploads/avatars/{{ $user->avatar }}" class="avatar img-circle">
<img src="{{ config('app.url') }}/uploads/avatars/{{ $user->avatar }}" class="avatar img-circle">
{!! $errors->first('avatar_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
+23
View File
@@ -569,5 +569,28 @@ $(function () {
});
});
</script>
<script src="{{ asset('assets/js/pGenerator.jquery.js') }}"></script>
<script>
$(document).ready(function(){
$('#genPassword').pGenerator({
'bind': 'click',
'passwordElement': '#modal-password',
'displayElement': '#generated-password',
'passwordLength': 16,
'uppercase': true,
'lowercase': true,
'numbers': true,
'specialChars': true,
'onPasswordGenerated': function(generatedPassword) {
$('#modal-password_confirm').val($('#modal-password').val());
}
});
});
</script>
@stop
@stop
+93 -36
View File
@@ -9,6 +9,86 @@
{{-- Page content --}}
@section('content')
{{-- Modal import dialog --}}
@if (session()->has('import_errors'))
<div class="box">
<div class="box-body">
<div class="alert alert-warning">
<strong>Warning</strong> {{trans('admin/hardware/message.import.errorDetail')}}
</div>
<div class="errors-table">
<table class="table table-striped table-bordered" id="errors-table">
<thead>
<th>Asset</th>
<th>Errors</th>
</thead>
<tbody>
@foreach (session('import_errors') as $asset => $itemErrors)
<tr>
<td> {{ $asset }}</td>
<td>
@foreach ($itemErrors as $field => $values )
<b>{{ $field }}:</b>
@foreach( $values as $errorString)
<span>{{$errorString[0]}} </span>
@endforeach
<br />
@endforeach
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
<div class="modal fade" id="importModal">
<form id="import-modal-form" class="form-horizontal" method="post" action="{{ route('assets/import/process-file') }}" autocomplete="off" role="form">
{{ csrf_field()}}
<input type="hidden" id="modal-filename" name="filename" value="">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Import File:</h4>
</div>
<div class="modal-body">
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12">
<label for="import-type">Import Type:</label>
</div>
<div class="col-md-8 col-xs-12">
{{ Form::select('import-type', array('asset' => 'Assets', 'accessory' => "Accessories", 'consumable' => "Consumables") , 'asset', array('class'=>'select2 parent', 'style'=>'width:100%','id' =>'import-type')) }}
</div>
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12">
<label for="import-update">Update Existing Values?:</label>
</div>
<div class="col-md-8 col-xs-12">
{{ Form::checkbox('import-update') }}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('button.cancel') }}</button>
<!-- <button type="button" class="btn btn-primary" id="modal-save">{{ trans('general.save') }}</button> -->
{{Form::submit(trans('general.save'), ['class' => 'btn btn-primary'])}}
</div>
</div>
</div>
</form>
</div>
<div class="row">
<div class="col-md-12">
<div class="box">
@@ -40,8 +120,6 @@
<div class="row">
<div class="col-md-12">
<table class="table table-striped" id="upload-table">
<thead>
<th>File</th>
@@ -56,8 +134,8 @@
<td>{{ date("M d, Y g:i A", $file['modified']) }} </td>
<td>{{ $file['filesize'] }}</td>
<td>
<a class="btn btn-info btn-sm" href="import/process/{{ $file['filename'] }}">
<i class="fa fa-spinner process"></i> Process</a>
<a href="#" data-toggle="modal" data-target="#importModal" data-filename={{$file['filename']}} class="btn btn-sm btn-info"><i class="fa fa-spinner process"></i> Process</a>
<a class="btn btn-danger btn-sm" href="import/delete/{{ $file['filename'] }}"><i class="fa fa-trash icon-white"></i></a>
</td>
</tr>
@endforeach
@@ -66,37 +144,9 @@
</div>
</div>
</div>
</div>
@if (session()->has('import_errors'))
<div class="errors-table">
<div class="alert alert-warning">
<strong>Warning</strong> {{trans('admin/hardware/message.import.errorDetail')}}
</div>
<table class="table table-striped table-bordered" id="errors-table">
<thead>
<th>Asset</th>
<th>Errors</th>
</thead>
<tbody>
@foreach (session('import_errors') as $asset => $itemErrors)
<tr>
<td> {{ $asset }}</td>
<td>
@foreach ($itemErrors as $field => $values )
<b>{{ $field }}:</b>
@foreach( $values as $errorString)
<span>{{$errorString[0]}} </span>
@endforeach
<br />
@endforeach
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
</div>
@section('moar_scripts')
@@ -149,8 +199,7 @@
$('.progress-bar-text').html('Finished!');
$('.progress-checkmark').fadeIn('fast').html('<i class="fa fa-check fa-3x icon-white" style="color: green"></i>');
$.each(data.result.files, function (index, file) {
$('<tr><td>' + file.name + '</td><td>Just now</td><td>' + file.filesize + '</td><td><a class="btn btn-info btn-sm" href="import/process/' + file.name + '"><i class="fa fa-spinner process"></i> Process</a></td></tr>').prependTo("#upload-table > tbody");
//$('<tr><td>').text(file.name).appendTo(document.body);
$('<tr><td>' + file.name + '</td><td>Just now</td><td>' + file.filesize + '</td><td><a class="btn btn-info btn-sm" href="#" data-toggle="modal" data-target="#importModal" data-filename='+ file.name + '><i class="fa fa-spinner process"></i> Process</a> <a class="btn btn-danger btn-sm" href="import/delete/' +file.name + '"><i class="fa fa-trash icon-white"></i></a></td></tr>').prependTo("#upload-table > tbody");
});
}
$('#progress').removeClass('active');
@@ -159,6 +208,14 @@
}
});
});
// Modal Import options handling
$('#importModal').on("show.bs.modal", function(event) {
var link = $(event.relatedTarget);
var filename = link.data('filename');
$(this).find('.modal-title').text("Import File: " + filename );
$("#modal-filename").val(filename);
});
</script>
@stop
+2 -2
View File
@@ -288,9 +288,9 @@
<div class="col-md-4">
@if ($asset->image)
<img src="{{ config('app.url') }}/uploads/assets/{{{ $asset->image }}}" class="assetimg">
<img src="{{ config('app.url') }}/uploads/assets/{{{ $asset->image }}}" class="assetimg img-responsive">
@elseif ($asset->model->image!='')
<img src="{{ config('app.url') }}/uploads/models/{{{ $asset->model->image }}}" class="assetimg">
<img src="{{ config('app.url') }}/uploads/models/{{{ $asset->model->image }}}" class="assetimg img-responsive">
@endif
@if (App\Models\Setting::getSettings()->qr_code=='1')
+1 -3
View File
@@ -11,9 +11,7 @@
<!-- CSS -->
<link rel="stylesheet" href="{{ asset('assets/css/bootstrap.min.css') }}">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="{{ asset('assets/css/font-awesome.min.css') }}">
<!-- Select2 -->
<link rel="stylesheet" href="{{ asset('assets/js/plugins/select2/select2.min.css') }}">
+14 -6
View File
@@ -75,12 +75,20 @@
};
</script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
@if (\App\Models\Setting::getSettings()->load_remote=='1')
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
@else
<script src="{{ asset('assets/js/html5shiv.js') }}"></script>
<script src="{{ asset('assets/js/respond.js') }}"></script>
@endif
<![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini sidebar-collapse">
<div class="wrapper">
+1 -1
View File
@@ -299,7 +299,7 @@
</div>
</div>
</div>ey
</div>
</div>
<!-- /.tab-pane -->
@@ -7,7 +7,8 @@
@if ($field->element!='text')
<!-- Listbox -->
@if ($field->element=='listbox')
{{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(), Input::old($field->db_column_name(), $asset->{$field->db_column_name()}), ['class'=>'format select2 form-control']) }}
{{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(),
Input::old($field->db_column_name(),(isset($asset) ? $asset->{$field->db_column_name()} : "")), ['class'=>'format select2 form-control']) }}
@elseif ($field->element=='checkbox')
<!-- Checkboxes -->
+2 -2
View File
@@ -68,7 +68,7 @@
<!-- side address column -->
<div class="col-md-3">
<h4>More Info:</h4>
<ul>
<ul class="list-unstyled">
@if ($model->manufacturer)
<li>{{ trans('general.manufacturer') }}:
@@ -94,7 +94,7 @@
@endif
@if ($model->image)
<li><br /><img src="{{ config('app.url') }}/uploads/models/{{ $model->image }}" /></li>
<li><br /><img src="{{ config('app.url') }}/uploads/models/{{ $model->image }}" class="img-responsive"></li>
@endif
@if ($model->deleted_at!='')
+7 -3
View File
@@ -58,7 +58,7 @@
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-last_name">{{ trans('general.last_name') }}:</label></div>
<div class="col-md-8 col-xs-12 required"><input type='text' id='modal-last_name' class="form-control"></div>
<div class="col-md-8 col-xs-12"><input type='text' id='modal-last_name' class="form-control"> </div>
</div>
<div class="dynamic-form-row">
@@ -68,12 +68,16 @@
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-password">{{ trans('admin/users/table.password') }}:</label></div>
<div class="col-md-8 col-xs-12 required"><input type='password' id='modal-password' class="form-control"></div>
<div class="col-md-8 col-xs-12 required"><input type='password' id='modal-password' class="form-control">
<a href="#" class="left" id="genPassword">Generate</a>
</div>
</div>
<div class="dynamic-form-row">
<div class="col-md-4 col-xs-12"><label for="modal-password_confirm">{{ trans('admin/users/table.password_confirm') }}:</label></div>
<div class="col-md-8 col-xs-12 required"><input type='password' id='modal-password_confirm' class="form-control"></div>
<div class="col-md-8 col-xs-12 required"><input type='password' id='modal-password_confirm' class="form-control">
<div id="generated-password"></div>
</div>
</div>
</div>