Merge branch 'develop'
This commit is contained in:
commit
bf1e742df6
10 changed files with 86 additions and 11 deletions
|
@ -334,6 +334,7 @@ class SettingsController extends Controller
|
||||||
|
|
||||||
$setting->full_multiple_companies_support = $request->input('full_multiple_companies_support', '0');
|
$setting->full_multiple_companies_support = $request->input('full_multiple_companies_support', '0');
|
||||||
$setting->load_remote = $request->input('load_remote', '0');
|
$setting->load_remote = $request->input('load_remote', '0');
|
||||||
|
$setting->unique_serial = $request->input('unique_serial', '0');
|
||||||
$setting->show_images_in_email = $request->input('show_images_in_email', '0');
|
$setting->show_images_in_email = $request->input('show_images_in_email', '0');
|
||||||
$setting->show_archived_in_list = $request->input('show_archived_in_list', '0');
|
$setting->show_archived_in_list = $request->input('show_archived_in_list', '0');
|
||||||
$setting->dashboard_message = $request->input('dashboard_message');
|
$setting->dashboard_message = $request->input('dashboard_message');
|
||||||
|
|
23
app/Http/Traits/UniqueSerialTrait.php
Normal file
23
app/Http/Traits/UniqueSerialTrait.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Traits;
|
||||||
|
|
||||||
|
trait UniqueSerialTrait
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare a unique_ids rule, adding a model identifier if required.
|
||||||
|
*
|
||||||
|
* @param array $parameters
|
||||||
|
* @param string $field
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function prepareUniqueSerialRule($parameters, $field)
|
||||||
|
{
|
||||||
|
$settings = \App\Models\Setting::first();
|
||||||
|
|
||||||
|
if ($settings->unique_serial=='1') {
|
||||||
|
return 'unique_undeleted:'.$this->table.','. $this->getKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,7 +41,7 @@ class CategoriesTransformer
|
||||||
|
|
||||||
$permissions_array['available_actions'] = [
|
$permissions_array['available_actions'] = [
|
||||||
'update' => Gate::allows('update', Category::class) ? true : false,
|
'update' => Gate::allows('update', Category::class) ? true : false,
|
||||||
'delete' => (Gate::allows('delete', Category::class) && ($category->assets_count == 0) && ($category->accessories_count == 0) && ($category->consumables_count == 0) && ($category->components_count == 0)) ? true : false,
|
'delete' => (Gate::allows('delete', Category::class) && ($category->assets_count == 0) && ($category->accessories_count == 0) && ($category->consumables_count == 0) && ($category->components_count == 0) && ($category->licenses_count == 0)) ? true : false,
|
||||||
];
|
];
|
||||||
|
|
||||||
$array += $permissions_array;
|
$array += $permissions_array;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Exceptions\CheckoutNotAllowed;
|
use App\Exceptions\CheckoutNotAllowed;
|
||||||
|
use App\Http\Traits\UniqueSerialTrait;
|
||||||
use App\Http\Traits\UniqueUndeletedTrait;
|
use App\Http\Traits\UniqueUndeletedTrait;
|
||||||
use App\Presenters\Presentable;
|
use App\Presenters\Presentable;
|
||||||
use AssetPresenter;
|
use AssetPresenter;
|
||||||
|
@ -23,7 +24,7 @@ use App\Notifications\CheckoutAssetNotification;
|
||||||
class Asset extends Depreciable
|
class Asset extends Depreciable
|
||||||
{
|
{
|
||||||
protected $presenter = 'App\Presenters\AssetPresenter';
|
protected $presenter = 'App\Presenters\AssetPresenter';
|
||||||
use Loggable, Requestable, Presentable, SoftDeletes, ValidatingTrait, UniqueUndeletedTrait;
|
use Loggable, Requestable, Presentable, SoftDeletes, ValidatingTrait, UniqueUndeletedTrait, UniqueSerialTrait;
|
||||||
|
|
||||||
const LOCATION = 'location';
|
const LOCATION = 'location';
|
||||||
const ASSET = 'asset';
|
const ASSET = 'asset';
|
||||||
|
@ -72,12 +73,13 @@ class Asset extends Depreciable
|
||||||
'status_id' => 'required|integer|exists:status_labels,id',
|
'status_id' => 'required|integer|exists:status_labels,id',
|
||||||
'company_id' => 'integer|nullable',
|
'company_id' => 'integer|nullable',
|
||||||
'warranty_months' => 'numeric|nullable',
|
'warranty_months' => 'numeric|nullable',
|
||||||
'physical' => 'numeric|max:1|nullable',
|
'physical' => 'numeric|max:1|nullable',
|
||||||
'checkout_date' => 'date|max:10|min:10|nullable',
|
'checkout_date' => 'date|max:10|min:10|nullable',
|
||||||
'checkin_date' => 'date|max:10|min:10|nullable',
|
'checkin_date' => 'date|max:10|min:10|nullable',
|
||||||
'supplier_id' => 'numeric|nullable',
|
'supplier_id' => 'numeric|nullable',
|
||||||
'asset_tag' => 'required|min:1|max:255|unique_undeleted',
|
'asset_tag' => 'required|min:1|max:255|unique_undeleted',
|
||||||
'status' => 'integer',
|
'status' => 'integer',
|
||||||
|
'serial' => 'unique_serial|nullable',
|
||||||
'purchase_cost' => 'numeric|nullable',
|
'purchase_cost' => 'numeric|nullable',
|
||||||
'next_audit_date' => 'date|nullable',
|
'next_audit_date' => 'date|nullable',
|
||||||
'last_audit_date' => 'date|nullable',
|
'last_audit_date' => 'date|nullable',
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddUniqueSerialOptionToSettings extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
|
$table->boolean('unique_serial')->default('0');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('unique_serial');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -179,5 +179,7 @@ return array(
|
||||||
'bottom' => 'bottom',
|
'bottom' => 'bottom',
|
||||||
'vertical' => 'vertical',
|
'vertical' => 'vertical',
|
||||||
'horizontal' => 'horizontal',
|
'horizontal' => 'horizontal',
|
||||||
|
'unique_serial' => 'Unique serial numbers',
|
||||||
|
'unique_serial_help_text' => 'Checking this box will enforce a uniqeness constraint on asset serials',
|
||||||
'zerofill_count' => 'Length of asset tags, including zerofill',
|
'zerofill_count' => 'Length of asset tags, including zerofill',
|
||||||
);
|
);
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
<!-- Show in Email -->
|
<!-- Show in Email -->
|
||||||
<div class="form-group {{ $errors->has('show_in_email') ? ' has-error' : '' }}" id="show_in_email">
|
<div class="form-group {{ $errors->has('show_in_email') ? ' has-error' : '' }}" id="show_in_email">
|
||||||
<div class="col-md-8 col-md-offset-4">
|
<div class="col-md-8 col-md-offset-4">
|
||||||
<label for="field_encrypted">
|
<label for="show_in_email">
|
||||||
<input type="checkbox" name="show_in_email" value="1" class="minimal"{{ (Input::old('show_in_email') || $field->show_in_email) ? ' checked="checked"' : '' }}>
|
<input type="checkbox" name="show_in_email" value="1" class="minimal"{{ (Input::old('show_in_email') || $field->show_in_email) ? ' checked="checked"' : '' }}>
|
||||||
{{ trans('admin/custom_fields/general.show_in_email') }}
|
{{ trans('admin/custom_fields/general.show_in_email') }}
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -73,7 +73,8 @@
|
||||||
{{ trans('button.select_file') }}
|
{{ trans('button.select_file') }}
|
||||||
<input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
|
<input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
|
||||||
</label>
|
</label>
|
||||||
<p class="help-block">{{ trans('general.image_filetypes_help') }}</p>
|
|
||||||
|
<p class="help-block" id="upload-file-status">{{ trans('general.image_filetypes_help', ['size' => \App\Helpers\Helper::file_upload_max_size_readable()]) }}</p>
|
||||||
|
|
||||||
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
|
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
|
||||||
{{ Form::checkbox('clear_logo', '1', Input::old('clear_logo'),array('class' => 'minimal')) }} Remove
|
{{ Form::checkbox('clear_logo', '1', Input::old('clear_logo'),array('class' => 'minimal')) }} Remove
|
||||||
|
|
|
@ -137,8 +137,23 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- unique serial -->
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-3">
|
||||||
|
{{ Form::label('unique_serial', trans('admin/settings/general.unique_serial')) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
{{ Form::checkbox('unique_serial', '1', Input::old('unique_serial', $setting->unique_serial),array('class' => 'minimal')) }}
|
||||||
|
{{ trans('general.yes') }}
|
||||||
|
{!! $errors->first('unique_serial', '<span class="alert-msg">:message</span>') !!}
|
||||||
|
<p class="help-block">
|
||||||
|
{{ trans('admin/settings/general.unique_serial_help_text') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Per Page -->
|
|
||||||
|
<!-- Per Page -->
|
||||||
<div class="form-group {{ $errors->has('per_page') ? 'error' : '' }}">
|
<div class="form-group {{ $errors->has('per_page') ? 'error' : '' }}">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
{{ Form::label('per_page', trans('admin/settings/general.per_page')) }}
|
{{ Form::label('per_page', trans('admin/settings/general.per_page')) }}
|
||||||
|
|
|
@ -35,10 +35,9 @@
|
||||||
echo "<div class='phpinfodisplay'><style type='text/css'>\n",
|
echo "<div class='phpinfodisplay'><style type='text/css'>\n",
|
||||||
join( "\n",
|
join( "\n",
|
||||||
array_map(
|
array_map(
|
||||||
create_function(
|
function ($i) {
|
||||||
'$i',
|
return ".phpinfodisplay " . preg_replace( "/,/", ",.phpinfodisplay ", $i );
|
||||||
'return ".phpinfodisplay " . preg_replace( "/,/", ",.phpinfodisplay ", $i );'
|
},
|
||||||
),
|
|
||||||
preg_split( '/\n/', $matches[1] )
|
preg_split( '/\n/', $matches[1] )
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Reference in a new issue