Skip to content

A free open source IT asset/license management system

Added additional searchable relations to activity report

snipe83562cfa8315
diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php
index 3a8fcf1cb9..7781004827 100755
--- a/app/Models/Actionlog.php
+++ b/app/Models/Actionlog.php
@@ -69,7 +69,25 @@ class Actionlog extends SnipeModel
'company' => ['name'],
'adminuser' => ['first_name','last_name','username', 'email'],
'user' => ['first_name','last_name','username', 'email'],
- 'assets' => ['asset_tag','name', 'serial'],
+ 'assets' => ['asset_tag','name', 'serial', 'order_number'],
+ 'assets.model' => ['name', 'model_number', 'eol'],
+ 'assets.model.category' => ['name'],
+ 'assets.model.manufacturer' => ['name'],
+ 'licenses' => ['name', 'serial', 'notes', 'order_number', 'license_email', 'license_name', 'purchase_order'],
+ 'licenses.category' => ['name'],
+ 'licenses.supplier' => ['name'],
+ 'consumables' => ['name', 'notes', 'order_number', 'model_number', 'item_no'],
+ 'consumables.category' => ['name'],
+ 'consumables.location' => ['name'],
+ 'consumables.supplier' => ['name'],
+ 'components' => ['name'],
+ 'components.category' => ['name'],
+ 'components.location' => ['name'],
+ 'components.supplier' => ['name'],
+ 'accessories' => ['name'],
+ 'accessories.category' => ['name'],
+ 'accessories.location' => ['name'],
+ 'accessories.supplier' => ['name'],
];
/**
@@ -134,6 +152,54 @@ class Actionlog extends SnipeModel
return $this->hasMany(\App\Models\Asset::class, 'id', 'item_id');
}
+ /**
+ * Establishes the actionlog -> license relationship
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v3.0]
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function licenses()
+ {
+ return $this->hasMany(\App\Models\License::class, 'id', 'item_id');
+ }
+
+ /**
+ * Establishes the actionlog -> consumable relationship
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v3.0]
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function consumables()
+ {
+ return $this->hasMany(\App\Models\Consumable::class, 'id', 'item_id');
+ }
+
+ /**
+ * Establishes the actionlog -> consumable relationship
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v3.0]
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function accessories()
+ {
+ return $this->hasMany(\App\Models\Accessory::class, 'id', 'item_id');
+ }
+
+ /**
+ * Establishes the actionlog -> components relationship
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v3.0]
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function components()
+ {
+ return $this->hasMany(\App\Models\Component::class, 'id', 'item_id');
+ }
+
/**
* Establishes the actionlog -> item type relationship
*