From f48171dcabf9d59d9f3b51eb7a5f2f83e0a0faea Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 8 May 2018 00:14:38 -0700 Subject: [PATCH] Add category to licenses --- app/Models/License.php | 8 +++++ app/Models/Loggable.php | 2 ++ .../lang/en/admin/categories/general.php | 3 +- resources/views/licenses/checkout.blade.php | 34 +++++++++++++++++++ resources/views/licenses/view.blade.php | 9 +++++ .../markdown/checkin-license.blade.php | 3 ++ .../markdown/checkout-license.blade.php | 3 ++ 7 files changed, 61 insertions(+), 1 deletion(-) diff --git a/app/Models/License.php b/app/Models/License.php index 494d8ca8b..162bea4c3 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.php index a325762d4..cdebaf11b 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.php index 16b3b79f5..7551fefff 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.php index 7e348e9e0..1fe0c4280 100755 --- a/resources/views/licenses/checkout.blade.php +++ b/resources/views/licenses/checkout.blade.php @@ -57,6 +57,40 @@ + + + @if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->slack_endpoint!='')) +
+
+
+ + @if ($license->requireAcceptance()) + + {{ trans('admin/categories/general.required_acceptance') }} +
+ @endif + + @if ($license->getEula()) + + {{ trans('admin/categories/general.required_eula') }} +
+ @endif + + @if (($license->category) && ($license->category->checkin_email)) + + {{ trans('admin/categories/general.checkin_email_notification') }} +
+ @endif + + @if ($snipeSettings->slack_endpoint!='') + + A slack message will be sent + @endif +
+
+
+ @endif +