Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d55c176
Merge: 93ff952 c0451fe
Author: snipe <[email protected]>
Date:   Wed Mar 16 18:35:42 2022 +0000

    Merge pull request #10831 from snipe/merges/master_down_to_develop_march_16

    v6.0.0-RC-5 - Merges master down to develop

commit c0451fe
Author: snipe <[email protected]>
Date:   Wed Mar 16 18:10:17 2022 +0000

    Bumped version to v6.0.0-RC-5

    Signed-off-by: snipe <[email protected]>

commit 0f95802
Author: snipe <[email protected]>
Date:   Wed Mar 16 18:05:47 2022 +0000

    Fixed mis-automerge

    Signed-off-by: snipe <[email protected]>

commit 9db8bd7
Author: snipe <[email protected]>
Date:   Wed Mar 16 18:02:07 2022 +0000

    Merging master down into develop

    Signed-off-by: snipe <[email protected]>

commit 93ff952
Merge: 40a9470 89ddbdd
Author: snipe <[email protected]>
Date:   Wed Mar 16 10:04:58 2022 -0700

    Merge pull request #10829 from snipe/features/add_statuslabel_filter_by_type_in_api

    Added filter by status_type in StatusLabels API index endpoint

commit 89ddbdd
Author: snipe <[email protected]>
Date:   Wed Mar 16 16:53:18 2022 +0000

    Fixed comment

    Signed-off-by: snipe <[email protected]>

commit 7498fe3
Author: snipe <[email protected]>
Date:   Wed Mar 16 16:45:03 2022 +0000

    Removed extra space because pedantry

    Signed-off-by: snipe <[email protected]>

commit babf7c0
Author: snipe <[email protected]>
Date:   Wed Mar 16 16:38:45 2022 +0000

    Added ability to filter status label index endpoint by status type

    Signed-off-by: snipe <[email protected]>

commit 40a9470
Merge: f499dcf 781b426
Author: snipe <[email protected]>
Date:   Wed Mar 16 08:54:10 2022 -0700

    Merge pull request #10828 from snipe/fixes/10826_parse_error_on_print_all

    Fixed #10826 - parse error on translation string for print all assets

commit 781b426
Author: snipe <[email protected]>
Date:   Wed Mar 16 08:50:47 2022 -0700

    Fixed #10826 - parse error on translation string for print all assets

    Signed-off-by: snipe <[email protected]>

commit f499dcf
Merge: 84aa26d 54d6a4d
Author: snipe <[email protected]>
Date:   Wed Mar 16 08:25:29 2022 -0700

    Merge pull request #10827 from snipe/fixes/modal_dropdowns_broken

    Fixed #10825 - selectlists in modals b0rked

commit 54d6a4d
Author: snipe <[email protected]>
Date:   Wed Mar 16 08:23:50 2022 -0700

    Fixed #10825 - selectlists in modals b0rked

    Signed-off-by: snipe <[email protected]>

commit 84aa26d
Merge: 8984b3a 14bd07e
Author: snipe <[email protected]>
Date:   Thu Mar 10 13:02:45 2022 -0800

    Merge pull request #10728 from Godmartinz/gh10191-css-dropdownmenu

    Fixed #10191 - font color contrast on mobile menu

commit 8984b3a
Merge: d06ef4b cdc0805
Author: snipe <[email protected]>
Date:   Thu Mar 10 10:40:33 2022 -0800

    Merge pull request #10812 from inietov/fixes/CarbonExceptions_InvalidFormatException_DateTime_develop

    Fixes Carbon\Exceptions\InvalidFormatException: DateTime::__construct(): Failed to parse time string develop

commit cdc0805
Author: Ivan Nieto Vivanco <[email protected]>
Date:   Thu Mar 10 12:07:07 2022 -0600

    Sanitize dates input in the importer before saving

commit 14bd07e
Merge: 4435ea9 16fd109
Author: Godfrey M <[email protected]>
Date:   Thu Mar 3 10:14:30 2022 -0800

    gerge branchevelop' into gh10191-css-dropdownmenu

commit 4435ea9
Author: Godfrey M <[email protected]>
Date:   Thu Mar 3 09:47:11 2022 -0800

    removes changes to mix-manifest

commit f115385
Author: Godfrey M <[email protected]>
Date:   Thu Mar 3 09:32:05 2022 -0800

    C&P mix-manifest to be tracked

commit 708dc08
Author: Godfrey M <[email protected]>
Date:   Wed Feb 23 11:17:44 2022 -0800

    mixes color contrast on dropdown menu from navbar
    on file

Signed-off-by: snipe <[email protected]>
  • Loading branch information
snipe committed Mar 16, 2022
1 parent 9ae2d17 commit 73acf6e
Show file tree
Hide file tree
Showing 34 changed files with 248 additions and 121 deletions.
59 changes: 59 additions & 0 deletions app/Console/Commands/KillAllSessions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class KillAllSessions extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'snipeit:global-logout {--force : Skip the danger prompt; assuming you enter "y"} ';

/**
* The console command description.
*
* @var string
*/
protected $description = 'This command will destroy all web sessions on disk and will force a re-login for all users.';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{

if (!$this->option('force') && !$this->confirm("****************************************************\nTHIS WILL FORCE A LOGIN FOR ALL LOGGED IN USERS.\n\nAre you SURE you wish to continue? ")) {
return $this->error("Session loss not confirmed");
}

$session_files = glob(storage_path("framework/sessions/*"));

$count = 0;
foreach ($session_files as $file) {

if (is_file($file))
unlink($file);
$count++;
}
\DB::table('users')->update(['remember_token' => null]);

$this->info($count. ' sessions cleared!');

}
}
5 changes: 4 additions & 1 deletion app/Console/Commands/RestoreFromBackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function handle()
return $this->error('Could not access file: '.$filename.' - '.array_key_exists($errcode, $errors) ? $errors[$errcode] : " Unknown reason: $errcode");
}


$private_dirs = [
'storage/private_uploads/assets', // these are asset _files_, not the pictures.
'storage/private_uploads/audits',
Expand Down Expand Up @@ -245,19 +246,21 @@ public function handle()
return false;
}
$bytes_read = 0;

while (($buffer = fgets($sql_contents, self::$buffer_size)) !== false) {
$bytes_read += strlen($buffer);
// \Log::debug("Buffer is: '$buffer'");
$bytes_written = fwrite($pipes[0], $buffer);

if ($bytes_written === false) {
$stdout = fgets($pipes[1]);
$this->info($stdout);
$stderr = fgets($pipes[2]);
$this->info($stderr);

return false;
}
}

if (!feof($sql_contents) || $bytes_read == 0) {
return $this->error("Not at end of file for sql file, or zero bytes read. aborting!");
}
Expand Down
14 changes: 14 additions & 0 deletions app/Http/Controllers/Api/StatuslabelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ public function index(Request $request)
$statuslabels = $statuslabels->TextSearch($request->input('search'));
}


// if a status_type is passed, filter by that
if ($request->filled('status_type')) {
if (strtolower($request->input('status_type'))== 'pending') {
$statuslabels = $statuslabels->Pending();
} elseif (strtolower($request->input('status_type'))== 'archived') {
$statuslabels = $statuslabels->Archived();
} elseif (strtolower($request->input('status_type'))== 'deployable') {
$statuslabels = $statuslabels->Deployable();
} elseif (strtolower($request->input('status_type'))== 'undeployable') {
$statuslabels = $statuslabels->Undeployable();
}
}

// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
// case we override with the actual count, so we should return 0 items.
$offset = (($statuslabels) && ($request->get('offset') > $statuslabels->count())) ? $statuslabels->count() : $request->get('offset', 0);
Expand Down
23 changes: 23 additions & 0 deletions app/Http/Controllers/Assets/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ public function edit($assetId = null)
->with('statuslabel_types', Helper::statusTypeList());
}


/**
* Returns a view that presents information about an asset for detail view.
*
Expand Down Expand Up @@ -309,6 +310,7 @@ public function update(ImageUploadRequest $request, $assetId = null)
$asset->location_id = $request->input('rtd_location_id', null);
}


if ($request->filled('image_delete')) {
try {
unlink(public_path().'/uploads/assets/'.$asset->image);
Expand Down Expand Up @@ -401,6 +403,24 @@ public function destroy($assetId)
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.delete.success'));
}

/**
* Searches the assets table by serial, and redirects if it finds one
*
* @author [A. Gianotto] [<[email protected]>]
* @since [v3.0]
* @return Redirect
*/
public function getAssetBySerial(Request $request)
{
$topsearch = ($request->get('topsearch')=="true");

if (!$asset = Asset::where('serial', '=', $request->get('serial'))->first()) {
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
}
$this->authorize('view', $asset);
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
}

/**
* Searches the assets table by asset tag, and redirects if it finds one
*
Expand All @@ -420,6 +440,7 @@ public function getAssetByTag(Request $request)
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
}


/**
* Return a QR code for the asset
*
Expand Down Expand Up @@ -792,6 +813,7 @@ public function overdueForAudit()
return view('hardware/audit-overdue');
}


public function auditStore(Request $request, $id)
{
$this->authorize('audit', Asset::class);
Expand Down Expand Up @@ -822,6 +844,7 @@ public function auditStore(Request $request, $id)
$asset->location_id = $request->input('location_id');
}


if ($asset->save()) {
$file_name = '';
// Upload an image, if attached
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Transformers/AssetsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Helpers\Helper;
use App\Models\Asset;
use App\Models\Setting;
use Gate;
use Illuminate\Database\Eloquent\Collection;

Expand All @@ -21,6 +22,9 @@ public function transformAssets(Collection $assets, $total)

public function transformAsset(Asset $asset)
{
// This uses the getSettings() method so we're pulling from the cache versus querying the settings on single asset
$setting = Setting::getSettings();

$array = [
'id' => (int) $asset->id,
'name' => e($asset->name),
Expand Down Expand Up @@ -65,6 +69,8 @@ public function transformAsset(Asset $asset)
'name'=> e($asset->defaultLoc->name),
] : null,
'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null,
'qr' => ($setting->qr_code=='1') ? config('app.url').'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'-'.str_slug($asset->id).'.png' : null,
'alt_barcode' => ($setting->alt_barcode_enabled=='1') ? config('app.url').'/uploads/barcodes/'.str_slug($setting->alt_barcode).'-'.str_slug($asset->asset_tag).'.png' : null,
'assigned_to' => $this->transformAssignedTo($asset),
'warranty_months' => ($asset->warranty_months > 0) ? e($asset->warranty_months.' '.trans('admin/hardware/form.months')) : null,
'warranty_expires' => ($asset->warranty_months > 0) ? Helper::getFormattedDateObject($asset->warranty_expires, 'date') : null,
Expand Down
2 changes: 2 additions & 0 deletions app/Importer/AssetImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ public function createAssetIfNotExists(array $row)
$item['rtd_location_id'] = $this->item['location_id'];
}

$item['last_audit_date'] = null;
if (isset($this->item['last_audit_date'])) {
$item['last_audit_date'] = $this->item['last_audit_date'];
}

$item['next_audit_date'] = null;
if (isset($this->item['next_audit_date'])) {
$item['next_audit_date'] = $this->item['next_audit_date'];
}
Expand Down
12 changes: 10 additions & 2 deletions app/Importer/LicenseImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,22 @@ public function createLicenseIfNotExists(array $row)
$license = new License;
}
$asset_tag = $this->item['asset_tag'] = $this->findCsvMatch($row, 'asset_tag'); // used for checkout out to an asset.
$this->item['expiration_date'] = $this->findCsvMatch($row, 'expiration_date');

$this->item["expiration_date"] = null;
if ($this->findCsvMatch($row, "expiration_date")!='') {
$this->item["expiration_date"] = date("Y-m-d 00:00:01", strtotime($this->findCsvMatch($row, "expiration_date")));
}
$this->item['license_email'] = $this->findCsvMatch($row, 'license_email');
$this->item['license_name'] = $this->findCsvMatch($row, 'license_name');
$this->item['maintained'] = $this->findCsvMatch($row, 'maintained');
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
$this->item['seats'] = $this->findCsvMatch($row, 'seats');
$this->item['termination_date'] = $this->findCsvMatch($row, 'termination_date');

$this->item["termination_date"] = null;
if ($this->findCsvMatch($row, "termination_date")!='') {
$this->item["termination_date"] = date("Y-m-d 00:00:01", strtotime($this->findCsvMatch($row, "termination_date")));
}

if ($editingLicense) {
$license->update($this->sanitizeItemForUpdating($license));
Expand Down
12 changes: 12 additions & 0 deletions app/Models/Statuslabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ public function scopeDeployable()
->where('deployable', '=', 1);
}

/**
* Query builder scope for undeployable status types
*
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeUndeployable()
{
return $this->where('pending', '=', 0)
->where('archived', '=', 0)
->where('deployable', '=', 0);
}

/**
* Helper function to determine type attributes
*
Expand Down
12 changes: 6 additions & 6 deletions config/version.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
return array (
'app_version' => 'v6.0.0-RC-4',
'full_app_version' => 'v6.0.0-RC-4 - build 6754-gafd83311a',
'build_version' => '6754',
'app_version' => 'v6.0.0-RC-5',
'full_app_version' => 'v6.0.0-RC-5 - build 6772-g7cbcd2d95',
'build_version' => '6772',
'prerelease_version' => '',
'hash_version' => 'gafd83311a',
'full_hash' => 'v6.0.0-RC-4-1-gafd83311a',
'branch' => 'develop',
'hash_version' => 'g7cbcd2d95',
'full_hash' => 'v6.0.0-RC-5-19-g7cbcd2d95',
'branch' => 'merges/master_down_to_develop_march_16',
);
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ class CreateCheckoutAcceptancesTable extends Migration
*/
public function up()
{
Schema::create('checkout_acceptances', function (Blueprint $table) {
$table->increments('id');
if (!Schema::hasTable('checkout_acceptances')) {
Schema::create('checkout_acceptances', function (Blueprint $table) {
$table->increments('id');

$table->morphs('checkoutable');
$table->integer('assigned_to_id')->nullable();
$table->morphs('checkoutable');
$table->integer('assigned_to_id')->nullable();

$table->string('signature_filename')->nullable();
$table->string('signature_filename')->nullable();

$table->timestamp('accepted_at')->nullable();
$table->timestamp('declined_at')->nullable();
$table->timestamp('accepted_at')->nullable();
$table->timestamp('declined_at')->nullable();

$table->timestamps();
$table->softDeletes();
});
$table->timestamps();
$table->softDeletes();
});
}
}

/**
Expand All @@ -36,6 +38,8 @@ public function up()
*/
public function down()
{
Schema::dropIfExists('checkout_acceptances');
if (Schema::hasTable('checkout_acceptances')) {
Schema::dropIfExists('checkout_acceptances');
}
}
}
31 changes: 18 additions & 13 deletions database/migrations/2018_10_18_191228_add_kits_licenses_table.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;


class AddKitsLicensesTable extends Migration
{
Expand All @@ -12,15 +14,16 @@ class AddKitsLicensesTable extends Migration
*/
public function up()
{
//
Schema::create('kits_licenses', function ($table) {
$table->increments('id');
$table->integer('kit_id')->nullable()->default(null);
$table->integer('license_id')->nullable()->default(null);
$table->integer('quantity')->default(1);
$table->timestamps();
});
}
if (!Schema::hasTable('kits_licenses')) {
Schema::create('kits_licenses', function ($table) {
$table->increments('id');
$table->integer('kit_id')->nullable()->default(null);
$table->integer('license_id')->nullable()->default(null);
$table->integer('quantity')->default(1);
$table->timestamps();
});
}
}

/**
* Reverse the migrations.
Expand All @@ -29,7 +32,9 @@ public function up()
*/
public function down()
{
//
Schema::drop('kits_licenses');
}
if (Schema::hasTable('kits_licenses')) {
Schema::drop('kits_licenses');
}
}

}
Loading

0 comments on commit 73acf6e

Please sign in to comment.