A free open source IT asset/license management system
Add category to licenses
snipef48171dcabf9
diff --git a/app/Models/License.php b/app/Models/License.phpindex 494d8ca8b0..162bea4c3e 100755--- a/app/Models/License.php+++ b/app/Models/License.php@@ -16,6 +16,14 @@ use Watson\Validating\ValidatingTrait;class License extends Depreciable{protected $presenter = 'App\Presenters\LicensePresenter';++ /**+ * Set static properties to determine which checkout/checkin handlers we should use+ */+ public static $checkoutClass = CheckoutLicenseNotification::class;+ public static $checkinClass = CheckinLicenseNotification::class;++use SoftDeletes;use CompanyableTrait;use Loggable, Presentable;diff --git a/app/Models/Loggable.php b/app/Models/Loggable.phpindex a325762d4a..cdebaf11b4 100644--- a/app/Models/Loggable.php+++ b/app/Models/Loggable.php@@ -76,6 +76,7 @@ trait Loggable$checkoutClass = null;if (method_exists($target, 'notify')) {+ \Log::debug('This target is notifiable');$target->notify(new static::$checkoutClass($params));}@@ -83,6 +84,7 @@ trait Loggable$recipient = new \App\Models\Recipients\AdminRecipient();if (($settings->admin_cc_email!='') && (static::$checkoutClass!='')) {+ \Log::debug('Send an email to the admin - '.$settings->admin_cc_email);$recipient->notify(new static::$checkoutClass($params));}diff --git a/resources/lang/en/admin/categories/general.php b/resources/lang/en/admin/categories/general.phpindex 16b3b79f51..7551fefffd 100644--- a/resources/lang/en/admin/categories/general.php+++ b/resources/lang/en/admin/categories/general.php@@ -5,7 +5,8 @@ return array('about_categories' => 'Categories help you organize your items. Some example categories might be "Desktops", "Laptops", "Mobile Phones", "Tablets", and so on, but you can use categories any way that makes sense for you.','asset_categories' => 'Asset Categories','category_name' => 'Category Name',- 'checkin_email' => 'Send email to user on checkin.',+ 'checkin_email' => 'Send email to user on checkin/checkout.',+ 'checkin_email_notification' => 'This user will be sent an email on checkin/checkout.','clone' => 'Clone Category','create' => 'Create Category','edit' => 'Edit Category',diff --git a/resources/views/licenses/checkout.blade.php b/resources/views/licenses/checkout.blade.phpindex 7e348e9e05..1fe0c4280e 100755--- a/resources/views/licenses/checkout.blade.php+++ b/resources/views/licenses/checkout.blade.php@@ -57,6 +57,40 @@</div></div></div>+++ @if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->slack_endpoint!=''))+ <div class="form-group notification-callout">+ <div class="col-md-8 col-md-offset-3">+ <div class="callout callout-info">++ @if ($license->requireAcceptance())+ <i class="fa fa-envelope"></i>+ {{ trans('admin/categories/general.required_acceptance') }}+ <br>+ @endif++ @if ($license->getEula())+ <i class="fa fa-envelope"></i>+ {{ trans('admin/categories/general.required_eula') }}+ <br>+ @endif++ @if (($license->category) && ($license->category->checkin_email))+ <i class="fa fa-envelope"></i>+ {{ trans('admin/categories/general.checkin_email_notification') }}+ <br>+ @endif++ @if ($snipeSettings->slack_endpoint!='')+ <i class="fa fa-slack"></i>+ A slack message will be sent+ @endif+ </div>+ </div>+ </div>+ @endif+<div class="box-footer"><a class="btn btn-link" href="{{ route('licenses.index') }}">{{ trans('button.cancel') }}</a><button type="submit" class="btn btn-success pull-right"><i class="fa fa-check icon-white"></i> {{ trans('general.checkout') }}</button>diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.phpindex 3de2f6a6da..9442a77d80 100755--- a/resources/views/licenses/view.blade.php+++ b/resources/views/licenses/view.blade.php@@ -126,6 +126,15 @@</tr>@endif+ @if ($license->category)+ <tr>+ <td>{{ trans('general.category') }}: </td>+ <td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">+ <a href="{{ route('categories.show', $license->category->id) }}">{{ $license->category->name }}</a>+ </td>+ </tr>+ @endif+@if ($license->license_name!='')<tr>diff --git a/resources/views/notifications/markdown/checkin-license.blade.php b/resources/views/notifications/markdown/checkin-license.blade.phpindex 124c36636f..6a40cd453c 100644--- a/resources/views/notifications/markdown/checkin-license.blade.php+++ b/resources/views/notifications/markdown/checkin-license.blade.php@@ -13,6 +13,9 @@@if ($target->can('update', $item))| **Key** | {{ $item->serial }} |@endif+@if (isset($item->category))+| **{{ trans('general.category') }}** | {{ $item->category->name }} |+@endif@if ($admin)| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |@endifdiff --git a/resources/views/notifications/markdown/checkout-license.blade.php b/resources/views/notifications/markdown/checkout-license.blade.phpindex a0a906c0aa..dd867552f0 100644--- a/resources/views/notifications/markdown/checkout-license.blade.php+++ b/resources/views/notifications/markdown/checkout-license.blade.php@@ -13,6 +13,9 @@@if (isset($item->manufacturer))| **{{ trans('general.manufacturer') }}** | {{ $item->manufacturer->name }} |@endif+@if (isset($item->category))+| **{{ trans('general.category') }}** | {{ $item->category->name }} |+@endif@if ($target->can('update', $item))| **Key** | {{ $item->serial }} |@endif