Compare commits
287 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f30631efb6 | ||
|
|
f156ec58b6 | ||
|
|
f9a06a183e | ||
|
|
da0b6d4d90 | ||
|
|
40befa7b37 | ||
|
|
66585bcc40 | ||
|
|
d57135c81b | ||
|
|
f976f440ef | ||
|
|
0728a991a8 | ||
|
|
33a0c2087a | ||
|
|
59ce46dce7 | ||
|
|
2dbd1089f5 | ||
|
|
85f3cc1762 | ||
|
|
1793461642 | ||
|
|
d24c4b1152 | ||
|
|
30f0f6f527 | ||
|
|
b839741069 | ||
|
|
d7434797ec | ||
|
|
85af8e46e3 | ||
|
|
0a0006c68c | ||
|
|
e85241af6a | ||
|
|
219ef23126 | ||
|
|
31898d0f85 | ||
|
|
1e82058f4d | ||
|
|
b3329135df | ||
|
|
2350c1c15c | ||
|
|
8f4e016c01 | ||
|
|
8e60767c00 | ||
|
|
2e0a7abbe9 | ||
|
|
4b6ba6cb30 | ||
|
|
fe5e813970 | ||
|
|
d6f7e03431 | ||
|
|
87f50dfd10 | ||
|
|
85ddb9cfff | ||
|
|
c6338d6a8b | ||
|
|
b92d26f3c4 | ||
|
|
2a95a95e00 | ||
|
|
b41883c125 | ||
|
|
0a218a37d0 | ||
|
|
7ca7877740 | ||
|
|
1394424760 | ||
|
|
fc07753a5c | ||
|
|
7bbe85801e | ||
|
|
8774927b91 | ||
|
|
8cb4954f8a | ||
|
|
48b52a0ccc | ||
|
|
9ecb0e6ca1 | ||
|
|
9091385182 | ||
|
|
b90c0de822 | ||
|
|
ee2522571c | ||
|
|
d3a13bcd45 | ||
|
|
67f199b09d | ||
|
|
f1c458185d | ||
|
|
ed22ec4b36 | ||
|
|
fa72e64b98 | ||
|
|
2a8ab06ca3 | ||
|
|
61d07bdc7c | ||
|
|
3061ce2983 | ||
|
|
e9f3d622f5 | ||
|
|
1e3244b2b3 | ||
|
|
a92bfe8ade | ||
|
|
c42dfadd17 | ||
|
|
0a391de09f | ||
|
|
b6cc7e7c14 | ||
|
|
819ca2921b | ||
|
|
7d272e3c96 | ||
|
|
40f00665b3 | ||
|
|
03ee6b8f91 | ||
|
|
937192f7ce | ||
|
|
ce1f62b9be | ||
|
|
3208522dd1 | ||
|
|
c3cd329604 | ||
|
|
2ba4986396 | ||
|
|
8ba19632cf | ||
|
|
caf6a10227 | ||
|
|
580091269d | ||
|
|
bcc6ca5180 | ||
|
|
7fdd4fbe98 | ||
|
|
aecef2618f | ||
|
|
bd5e6d8551 | ||
|
|
1e4e9dd3d7 | ||
|
|
2ab91fed01 | ||
|
|
5b0220ac1e | ||
|
|
aa92b93bd1 | ||
|
|
998624ad68 | ||
|
|
d3d36315d3 | ||
|
|
6dc143d95d | ||
|
|
d8753a7d86 | ||
|
|
90af734f6b | ||
|
|
3aa7c60765 | ||
|
|
0962d770cf | ||
|
|
5d8c06bc30 | ||
|
|
2597a7b896 | ||
|
|
3741a93884 | ||
|
|
71be73781b | ||
|
|
7aea9341f8 | ||
|
|
e5098c3ba1 | ||
|
|
46507c929a | ||
|
|
8233d520c6 | ||
|
|
06f174adf9 | ||
|
|
08f320b76a | ||
|
|
04898c49b2 | ||
|
|
eeff305b02 | ||
|
|
2d8269ddcd | ||
|
|
b0a8a0427d | ||
|
|
f384593e19 | ||
|
|
5846f23d8b | ||
|
|
91a035ec5b | ||
|
|
d357326dc1 | ||
|
|
5e2dbaffc4 | ||
|
|
391c9a77ef | ||
|
|
7bde0f4f92 | ||
|
|
aa0ccf11fa | ||
|
|
a8f79369ee | ||
|
|
0a506120b7 | ||
|
|
0e28f36678 | ||
|
|
e86adccf19 | ||
|
|
e7fba08f92 | ||
|
|
35f3f1432f | ||
|
|
934b39268d | ||
|
|
67315d81d6 | ||
|
|
eee64d5509 | ||
|
|
b450ef3534 | ||
|
|
d4dc1830ec | ||
|
|
04e9ca0942 | ||
|
|
06021d79c1 | ||
|
|
7ecb8d7bc1 | ||
|
|
efe95d9ad0 | ||
|
|
6f89699f1a | ||
|
|
2c18bc24a7 | ||
|
|
f81b21208b | ||
|
|
ba70e5b053 | ||
|
|
5090468357 | ||
|
|
213cda8cf4 | ||
|
|
421cbf11fc | ||
|
|
8816c481af | ||
|
|
3ed0cf2be8 | ||
|
|
cd28b012b3 | ||
|
|
25902db659 | ||
|
|
35a67ab18a | ||
|
|
2cfb015b1a | ||
|
|
e4dcd47d6c | ||
|
|
64cd4fb1c9 | ||
|
|
276e0a7114 | ||
|
|
9bf3403f31 | ||
|
|
0d088f3031 | ||
|
|
a92ed97b4e | ||
|
|
fcdea4825e | ||
|
|
35439f9976 | ||
|
|
d473432436 | ||
|
|
4dff58ec26 | ||
|
|
537ad28a67 | ||
|
|
96eb832fd3 | ||
|
|
130c798c90 | ||
|
|
e1229bfb0f | ||
|
|
f185c2e0de | ||
|
|
122f0b9cba | ||
|
|
c49f10c9bb | ||
|
|
97a938f119 | ||
|
|
308fcf96de | ||
|
|
f1fab8b164 | ||
|
|
0e8502a323 | ||
|
|
3171d9230b | ||
|
|
11b9df4b48 | ||
|
|
0c2524954f | ||
|
|
b76ad5ea88 | ||
|
|
43fbd54a12 | ||
|
|
406d270c01 | ||
|
|
98eb26a2bd | ||
|
|
61aa9beddb | ||
|
|
e89fd9b3a2 | ||
|
|
d72443c335 | ||
|
|
f38593b530 | ||
|
|
4cf2d16c7a | ||
|
|
f38912a5cf | ||
|
|
ad22293f4b | ||
|
|
fb402e138d | ||
|
|
90d2d0c7e1 | ||
|
|
9d730af50f | ||
|
|
9407b4e28c | ||
|
|
ec19924bea | ||
|
|
7b8403cdb9 | ||
|
|
85f3e7e3d4 | ||
|
|
11dc20de61 | ||
|
|
14fa7ed965 | ||
|
|
5cf1c8dfa3 | ||
|
|
f04cfb3e7f | ||
|
|
d970daa666 | ||
|
|
0b0c81a110 | ||
|
|
b1324c2e64 | ||
|
|
3c28be33c5 | ||
|
|
e52a0f65bb | ||
|
|
b726d131a4 | ||
|
|
014167699d | ||
|
|
d9f2e7bf58 | ||
|
|
4c8c58d453 | ||
|
|
923352537c | ||
|
|
be8049b41a | ||
|
|
4419dc7434 | ||
|
|
ac63642224 | ||
|
|
5959f83de3 | ||
|
|
0c912bcf49 | ||
|
|
16014945b6 | ||
|
|
44821b9667 | ||
|
|
c5d7a1fdd6 | ||
|
|
29c4189419 | ||
|
|
7ef4f23d0f | ||
|
|
8232cefbba | ||
|
|
a852c624d3 | ||
|
|
7edf1db101 | ||
|
|
5e9740e0b4 | ||
|
|
41a20d8f66 | ||
|
|
7a0843e954 | ||
|
|
4a9f3fd6ff | ||
|
|
9ae1841fc4 | ||
|
|
ba5a2edd54 | ||
|
|
c73cbccffc | ||
|
|
24d2726c86 | ||
|
|
06fcf3e07d | ||
|
|
cc15a4f018 | ||
|
|
18e576e5fd | ||
|
|
4c787891e4 | ||
|
|
dbd96a4c10 | ||
|
|
d314f85b93 | ||
|
|
3a81b7e612 | ||
|
|
7992258b46 | ||
|
|
869da1da78 | ||
|
|
a6a6aa78b0 | ||
|
|
4ffea7ceaa | ||
|
|
1d3255a00b | ||
|
|
29eadb10ae | ||
|
|
1ca5f8bee5 | ||
|
|
8dbc098836 | ||
|
|
45ea44e172 | ||
|
|
fff2bce9e4 | ||
|
|
75e0c5565c | ||
|
|
098e7e4feb | ||
|
|
e4355292e4 | ||
|
|
ca8ca89955 | ||
|
|
30c45442f9 | ||
|
|
03c2c267bc | ||
|
|
a76fe98b2d | ||
|
|
9e43a44d20 | ||
|
|
6fe639f490 | ||
|
|
a5467ba25d | ||
|
|
1c09479d5f | ||
|
|
682c75e990 | ||
|
|
1612562f41 | ||
|
|
1b7f28598d | ||
|
|
17d5e40e02 | ||
|
|
099a85e26d | ||
|
|
0e5209e80f | ||
|
|
95328f0a6a | ||
|
|
cbc42f3e59 | ||
|
|
846356974d | ||
|
|
ef6fb69cee | ||
|
|
fb1eab0978 | ||
|
|
39929c7d89 | ||
|
|
d6ba0b67f0 | ||
|
|
66ad0f1d4c | ||
|
|
bfac25d445 | ||
|
|
3b247ba31f | ||
|
|
bc3482b281 | ||
|
|
23e23bab90 | ||
|
|
848e3837aa | ||
|
|
1747be4b29 | ||
|
|
565ea95803 | ||
|
|
e7e8c487c9 | ||
|
|
5a242433fb | ||
|
|
6204969639 | ||
|
|
cde5efd698 | ||
|
|
283bb4ae4b | ||
|
|
3d1d248bb5 | ||
|
|
9c31c0edce | ||
|
|
39450c1fe9 | ||
|
|
64ffd261fc | ||
|
|
de17da099f | ||
|
|
886a31190c | ||
|
|
8246a319a2 | ||
|
|
27adeb427e | ||
|
|
bfc18c758a | ||
|
|
735595be07 | ||
|
|
27dee1b793 | ||
|
|
cdeccb399f | ||
|
|
2f679ccc29 | ||
|
|
eac6abe60a | ||
|
|
c9d3cd724b |
@@ -30,7 +30,9 @@ MAIL_USERNAME=YOURUSERNAME
|
||||
MAIL_PASSWORD=YOURPASSWORD
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDR=you@example.com
|
||||
MAIL_FROM_NAME=Snipe-IT
|
||||
MAIL_FROM_NAME='Snipe-IT'
|
||||
MAIL_REPLYTO_ADDR=you@example.com
|
||||
MAIL_REPLYTO_NAME='Snipe-IT'
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
@@ -74,4 +76,5 @@ AWS_BUCKET=null
|
||||
APP_LOG=single
|
||||
APP_LOCKED=false
|
||||
FILESYSTEM_DISK=local
|
||||
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
|
||||
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1
|
||||
ALLOW_IFRAMING=false
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,6 +15,7 @@ Homestead.yaml
|
||||
output
|
||||
phpDocumentor.phar
|
||||
public/uploads/*.gif
|
||||
public/uploads/barcodes/*.png
|
||||
public/uploads/*.jpg
|
||||
public/uploads/*.png
|
||||
public/uploads/*.svg
|
||||
|
||||
@@ -80,7 +80,7 @@ RUN cd /var/www/html;composer install
|
||||
|
||||
############### DATA VOLUME #################
|
||||
|
||||
VOLUME [/var/lib/snipeit]
|
||||
VOLUME ["/var/lib/snipeit"]
|
||||
|
||||
##### START SERVER
|
||||
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
<?php
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use League\Csv\Reader;
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Accessory;
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\Consumable;
|
||||
use App\Models\CustomField;
|
||||
use App\Models\Location;
|
||||
use App\Models\Manufacturer;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\User;
|
||||
use App\Models\CustomField;
|
||||
use DB;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use League\Csv\Reader;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use ForceUTF8\Encoding;
|
||||
|
||||
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
|
||||
ini_set('memory_limit', '500M');
|
||||
@@ -102,9 +104,17 @@ class ObjectImportCommand extends Command
|
||||
$this->companies = Company::All(['name', 'id']);
|
||||
$this->status_labels = Statuslabel::All(['name', 'id']);
|
||||
$this->suppliers = Supplier::All(['name', 'id']);
|
||||
$this->assets = Asset::all(['asset_tag']);
|
||||
$this->accessories = Accessory::All(['name']);
|
||||
$this->consumables = Consumable::All(['name']);
|
||||
switch (strtolower($this->option('item-type'))) {
|
||||
case "asset":
|
||||
$this->assets = Asset::all();
|
||||
break;
|
||||
case "accessory":
|
||||
$this->accessories = Accessory::All();
|
||||
break;
|
||||
case "consumable":
|
||||
$this->consumables = Consumable::All();
|
||||
break;
|
||||
}
|
||||
$this->customfields = CustomField::All(['name']);
|
||||
$bar = null;
|
||||
|
||||
@@ -275,7 +285,7 @@ class ObjectImportCommand extends Command
|
||||
*/
|
||||
public function array_smart_fetch(array $array, $key, $default = '')
|
||||
{
|
||||
return array_key_exists($key, $array) ? e(trim($array[ $key ])) : $default;
|
||||
return array_key_exists(trim($key), $array) ? e(Encoding::fixUTF8(trim($array[ $key ]))) : $default;
|
||||
}
|
||||
|
||||
|
||||
@@ -312,8 +322,10 @@ class ObjectImportCommand extends Command
|
||||
|
||||
$asset_model_name = $this->array_smart_fetch($row, "model name");
|
||||
$asset_modelno = $this->array_smart_fetch($row, "model number");
|
||||
if (empty($asset_model_name)) {
|
||||
$asset_model_name='Unknown';
|
||||
if ((empty($asset_model_name)) && (!empty($asset_modelno))) {
|
||||
$asset_model_name = $asset_modelno;
|
||||
} elseif ((empty($asset_model_name)) && (empty($asset_modelno))) {
|
||||
$asset_model_name ='Unknown';
|
||||
}
|
||||
if (empty($asset_modelno)) {
|
||||
$asset_modelno='';
|
||||
@@ -346,6 +358,7 @@ class ObjectImportCommand extends Command
|
||||
return $asset_model;
|
||||
} else {
|
||||
$this->jsonError('Asset Model "' . $asset_model_name . '"', $asset_model->getErrors());
|
||||
$this->log('Asset Model "' . $asset_model_name . '"', $asset_model->getErrors());
|
||||
return $asset_model;
|
||||
}
|
||||
} else {
|
||||
@@ -660,7 +673,12 @@ class ObjectImportCommand extends Command
|
||||
$last_name = $user_email_array['last_name'];
|
||||
|
||||
if ($user_email=='') {
|
||||
$user_email = $user_email_array['username'].'@'.Setting::getSettings()->email_domain;
|
||||
if (Setting::getSettings()->email_domain) {
|
||||
$user_email = str_slug($user_email_array['username']).'@'.Setting::getSettings()->email_domain;
|
||||
} else {
|
||||
$user_email = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($user_username=='') {
|
||||
@@ -727,6 +745,24 @@ class ObjectImportCommand extends Command
|
||||
*/
|
||||
public function createAssetIfNotExists(array $row, array $item)
|
||||
{
|
||||
$asset = null;
|
||||
$editingAsset = false;
|
||||
foreach ($this->assets as $tempasset) {
|
||||
if (strcasecmp($tempasset->asset_tag, $item['asset_tag']) == 0) {
|
||||
$this->log('A matching Asset ' . $item['asset_tag'] . ' already exists');
|
||||
if (!$this->option('update')) {
|
||||
$this->log("Skipping item.");
|
||||
return;
|
||||
}
|
||||
$this->log('Updating matching asset with new values');
|
||||
$editingAsset = true;
|
||||
$asset = $tempasset;
|
||||
}
|
||||
}
|
||||
if (is_null($asset)) {
|
||||
$this->log("No Matching Asset, Creating a new one");
|
||||
$asset = new Asset;
|
||||
}
|
||||
$asset_serial = $this->array_smart_fetch($row, "serial number");
|
||||
$asset_image = $this->array_smart_fetch($row, "image");
|
||||
$asset_warranty_months = intval($this->array_smart_fetch($row, "warranty months"));
|
||||
@@ -742,12 +778,7 @@ class ObjectImportCommand extends Command
|
||||
$this->log('Notes: '.$item["notes"]);
|
||||
$this->log('Warranty Months: ' . $asset_warranty_months);
|
||||
|
||||
foreach ($this->assets as $tempasset) {
|
||||
if (strcasecmp($tempasset->asset_tag, $item['asset_tag']) == 0) {
|
||||
$this->log('A matching Asset ' . $item['asset_tag'] . ' already exists');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($item["status_label"]) {
|
||||
$status_id = $item["status_label"]->id;
|
||||
@@ -758,12 +789,14 @@ class ObjectImportCommand extends Command
|
||||
$status_id = 1;
|
||||
}
|
||||
|
||||
$asset = new Asset();
|
||||
$asset->name = $item["item_name"];
|
||||
if ($item["purchase_date"] != '') {
|
||||
if (!$editingAsset) {
|
||||
$asset->asset_tag = $item['asset_tag']; // This doesn't need to be guarded for empty because it's the key we use to identify the asset.
|
||||
}
|
||||
if (!empty($item['item_name'])) {
|
||||
$asset->name = $item["item_name"];
|
||||
}
|
||||
if (!empty($item["purchase_date"])) {
|
||||
$asset->purchase_date = $item["purchase_date"];
|
||||
} else {
|
||||
$asset->purchase_date = null;
|
||||
}
|
||||
|
||||
if (array_key_exists('custom_fields', $item)) {
|
||||
@@ -775,40 +808,57 @@ class ObjectImportCommand extends Command
|
||||
if (!empty($item["purchase_cost"])) {
|
||||
//TODO How to generalize this for not USD?
|
||||
$purchase_cost = substr($item["purchase_cost"], 0, 1) === '$' ? substr($item["purchase_cost"], 1) : $item["purchase_cost"];
|
||||
$asset->purchase_cost = number_format($purchase_cost, 2);
|
||||
// $asset->purchase_cost = number_format($purchase_cost, 2, '.', '');
|
||||
$asset->purchase_cost = Helper::ParseFloat($purchase_cost);
|
||||
$this->log("Asset cost parsed: " . $asset->purchase_cost);
|
||||
} else {
|
||||
$asset->purchase_cost = 0.00;
|
||||
}
|
||||
$asset->serial = $asset_serial;
|
||||
$asset->asset_tag = $item['asset_tag'];
|
||||
$asset->warranty_months = $asset_warranty_months;
|
||||
if (!empty($asset_serial)) {
|
||||
$asset->serial = $asset_serial;
|
||||
}
|
||||
if (!empty($asset_warranty_months)) {
|
||||
$asset->warranty_months = $asset_warranty_months;
|
||||
}
|
||||
|
||||
if ($asset_model) {
|
||||
$asset->model_id = $asset_model->id;
|
||||
}
|
||||
|
||||
if ($item["user"]) {
|
||||
$asset->assigned_to = $item["user"]->id;
|
||||
}
|
||||
|
||||
if ($item["location"]) {
|
||||
$asset->rtd_location_id = $item["location"]->id;
|
||||
}
|
||||
|
||||
$asset->user_id = $this->option('user_id');
|
||||
$this->log("status_id: " . $status_id);
|
||||
$asset->status_id = $status_id;
|
||||
if (!empty($status_id)) {
|
||||
$asset->status_id = $status_id;
|
||||
}
|
||||
if ($item["company"]) {
|
||||
$asset->company_id = $item["company"]->id;
|
||||
}
|
||||
$asset->order_number = $item["order_number"];
|
||||
if ($item["order_number"]) {
|
||||
$asset->order_number = $item["order_number"];
|
||||
}
|
||||
if ($supplier) {
|
||||
$asset->supplier_id = $supplier->id;
|
||||
}
|
||||
$asset->notes = $item["notes"];
|
||||
$asset->image = $asset_image;
|
||||
$this->assets->add($asset);
|
||||
if ($item["notes"]) {
|
||||
$asset->notes = $item["notes"];
|
||||
}
|
||||
if (!empty($asset_image)) {
|
||||
$asset->image = $asset_image;
|
||||
}
|
||||
if (!$editingAsset) {
|
||||
$this->assets->add($asset);
|
||||
}
|
||||
if (!$this->option('testrun')) {
|
||||
|
||||
if ($asset->save()) {
|
||||
$asset->logCreate('Imported using csv importer');
|
||||
$this->log('Asset ' . $item["item_name"] . ' with serial number ' . $asset_serial . ' was created');
|
||||
} else {
|
||||
$this->jsonError('Asset', $asset->getErrors());
|
||||
@@ -830,17 +880,29 @@ class ObjectImportCommand extends Command
|
||||
*/
|
||||
public function createAccessoryIfNotExists(array $item)
|
||||
{
|
||||
$accessory = null;
|
||||
$editingAccessory = false;
|
||||
$this->log("Creating Accessory");
|
||||
foreach ($this->accessories as $tempaccessory) {
|
||||
if (strcasecmp($tempaccessory->name, $item["item_name"]) == 0) {
|
||||
$this->log('A matching Accessory ' . $item["item_name"] . ' already exists. ');
|
||||
// FUTURE: Adjust quantity on import maybe?
|
||||
return;
|
||||
if (!$this->option('update')) {
|
||||
$this->log("Skipping accessory.");
|
||||
return;
|
||||
}
|
||||
$this->log('Updating matching accessory with new values');
|
||||
$editingAccessory = true;
|
||||
$accessory = $tempaccessory;
|
||||
}
|
||||
}
|
||||
if (is_null($accessory)) {
|
||||
$this->log("No Matching Accessory, Creating a new one");
|
||||
$accessory = new Accessory();
|
||||
}
|
||||
|
||||
$accessory = new Accessory();
|
||||
$accessory->name = $item["item_name"];
|
||||
if (!$editingAccessory) {
|
||||
$accessory->name = $item["item_name"];
|
||||
}
|
||||
|
||||
if (!empty($item["purchase_date"])) {
|
||||
$accessory->purchase_date = $item["purchase_date"];
|
||||
@@ -848,10 +910,9 @@ class ObjectImportCommand extends Command
|
||||
$accessory->purchase_date = null;
|
||||
}
|
||||
if (!empty($item["purchase_cost"])) {
|
||||
$accessory->purchase_cost = number_format(e($item["purchase_cost"]), 2);
|
||||
} else {
|
||||
$accessory->purchase_cost = 0.00;
|
||||
$accessory->purchase_cost = Helper::ParseFloat($item["purchase_cost"]);
|
||||
}
|
||||
|
||||
if ($item["location"]) {
|
||||
$accessory->location_id = $item["location"]->id;
|
||||
}
|
||||
@@ -859,24 +920,31 @@ class ObjectImportCommand extends Command
|
||||
if ($item["company"]) {
|
||||
$accessory->company_id = $item["company"]->id;
|
||||
}
|
||||
$accessory->order_number = $item["order_number"];
|
||||
if (!empty($item["order_number"])) {
|
||||
$accessory->order_number = $item["order_number"];
|
||||
}
|
||||
if ($item["category"]) {
|
||||
$accessory->category_id = $item["category"]->id;
|
||||
}
|
||||
|
||||
//TODO: Implement
|
||||
// $accessory->notes = e($item_notes);
|
||||
$accessory->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
|
||||
if (!empty($item["requestable"])) {
|
||||
$accessory->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
//Must have at least zero of the item if we import it.
|
||||
if ($item["quantity"] > -1) {
|
||||
$accessory->qty = $item["quantity"];
|
||||
} else {
|
||||
$accessory->qty = 1;
|
||||
if (!empty($item["quantity"])) {
|
||||
if ($item["quantity"] > -1) {
|
||||
$accessory->qty = $item["quantity"];
|
||||
} else {
|
||||
$accessory->qty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->option('testrun')) {
|
||||
if ($accessory->save()) {
|
||||
$accessory->logCreate('Imported using CSV Importer');
|
||||
$this->log('Accessory ' . $item["item_name"] . ' was created');
|
||||
// $this->comment('Accessory ' . $item["item_name"] . ' was created');
|
||||
|
||||
@@ -899,18 +967,29 @@ class ObjectImportCommand extends Command
|
||||
*/
|
||||
public function createConsumableIfNotExists(array $item)
|
||||
{
|
||||
$consumable = null;
|
||||
$editingConsumable = false;
|
||||
$this->log("Creating Consumable");
|
||||
foreach ($this->consumables as $tempconsumable) {
|
||||
if (strcasecmp($tempconsumable->name, $item["item_name"]) == 0) {
|
||||
$this->log("A matching consumable " . $item["item_name"] . " already exists");
|
||||
//TODO: Adjust quantity if different maybe?
|
||||
return;
|
||||
if (!$this->option('update')) {
|
||||
$this->log("Skipping consumable.");
|
||||
return;
|
||||
}
|
||||
$this->log('Updating matching consumable with new values');
|
||||
$editingConsumable = true;
|
||||
$consumable = $tempconsumable;
|
||||
}
|
||||
}
|
||||
|
||||
$consumable = new Consumable();
|
||||
$consumable->name = $item["item_name"];
|
||||
|
||||
if (is_null($consumable)) {
|
||||
$this->log("No matching consumable, creating one");
|
||||
$consumable = new Consumable();
|
||||
}
|
||||
if (!$editingConsumable) {
|
||||
$consumable->name = $item["item_name"];
|
||||
}
|
||||
if (!empty($item["purchase_date"])) {
|
||||
$consumable->purchase_date = $item["purchase_date"];
|
||||
} else {
|
||||
@@ -918,27 +997,39 @@ class ObjectImportCommand extends Command
|
||||
}
|
||||
|
||||
if (!empty($item["purchase_cost"])) {
|
||||
$consumable->purchase_cost = number_format(e($item["purchase_cost"]), 2);
|
||||
} else {
|
||||
$consumable->purchase_cost = 0.00;
|
||||
$consumable->purchase_cost = Helper::ParseFloat($item["purchase_cost"]);
|
||||
}
|
||||
if ($item["location"]) {
|
||||
$consumable->location_id = $item["location"]->id;
|
||||
}
|
||||
$consumable->location_id = $item["location"]->id;
|
||||
$consumable->user_id = $this->option('user_id');
|
||||
$consumable->company_id = $item["company"]->id;
|
||||
$consumable->order_number = $item["order_number"];
|
||||
$consumable->category_id = $item["category"]->id;
|
||||
if ($item["company"]) {
|
||||
$consumable->company_id = $item["company"]->id;
|
||||
}
|
||||
if (!empty($item["order_number"])) {
|
||||
$consumable->order_number = $item["order_number"];
|
||||
}
|
||||
if ($item["category"]) {
|
||||
$consumable->category_id = $item["category"]->id;
|
||||
}
|
||||
// TODO:Implement
|
||||
//$consumable->notes= e($item_notes);
|
||||
$consumable->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
|
||||
if (!empty($item["requestable"])) {
|
||||
$consumable->requestable = filter_var($item["requestable"], FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
if ($item["quantity"] > -1) {
|
||||
$consumable->qty = $item["quantity"];
|
||||
} else {
|
||||
$consumable->qty = 1;
|
||||
if (!empty($item["quantity"])) {
|
||||
if ($item["quantity"] > -1) {
|
||||
$consumable->qty = $item["quantity"];
|
||||
} else {
|
||||
$consumable->qty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->option("testrun")) {
|
||||
// dd($consumable);
|
||||
if ($consumable->save()) {
|
||||
$consumable->logCreate('Imported using CSV Importer');
|
||||
$this->log("Consumable " . $item["item_name"] . ' was created');
|
||||
// $this->comment("Consumable " . $item["item_name"] . ' was created');
|
||||
|
||||
@@ -980,8 +1071,9 @@ class ObjectImportCommand extends Command
|
||||
array('testrun', null, InputOption::VALUE_NONE, 'If set, will parse and output data without adding to database', null),
|
||||
array('logfile', null, InputOption::VALUE_REQUIRED, 'The path to log output to. storage/logs/importer.log by default', storage_path('logs/importer.log') ),
|
||||
array('item-type', null, InputOption::VALUE_REQUIRED, 'Item Type To import. Valid Options are Asset, Consumable, Or Accessory', 'Asset'),
|
||||
array('web-importer', null, InputOption::VALUE_NONE, 'Internal: packages output for use with the web importer'),
|
||||
array('user_id', null, InputOption::VALUE_REQUIRED, 'ID of user creating items', 1)
|
||||
array('web-importer', null, InputOption::VALUE_NONE, 'Internal: packages output for use with the web importer'),
|
||||
array('user_id', null, InputOption::VALUE_REQUIRED, 'ID of user creating items', 1),
|
||||
array('update', null, InputOption::VALUE_NONE, 'If a matching item is found, update item information'),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -77,6 +77,8 @@ class PaveIt extends Command
|
||||
DB::statement('delete from asset_logs');
|
||||
DB::statement('delete from asset_maintenances');
|
||||
DB::statement('delete from asset_uploads');
|
||||
DB::statement('delete from action_logs');
|
||||
DB::statement('delete from checkout_requests');
|
||||
DB::statement('delete from consumables_users');
|
||||
DB::statement('delete from custom_field_custom_fieldset');
|
||||
DB::statement('delete from custom_fields');
|
||||
@@ -92,10 +94,12 @@ class PaveIt extends Command
|
||||
\DB::statement('drop table IF EXISTS accessories_users');
|
||||
\DB::statement('drop table IF EXISTS accessories');
|
||||
\DB::statement('drop table IF EXISTS asset_logs');
|
||||
\DB::statement('drop table IF EXISTS action_logs');
|
||||
\DB::statement('drop table IF EXISTS asset_maintenances');
|
||||
\DB::statement('drop table IF EXISTS asset_uploads');
|
||||
\DB::statement('drop table IF EXISTS assets');
|
||||
\DB::statement('drop table IF EXISTS categories');
|
||||
\DB::statement('drop table IF EXISTS checkout_requests');
|
||||
\DB::statement('drop table IF EXISTS companies');
|
||||
\DB::statement('drop table IF EXISTS consumables_users');
|
||||
\DB::statement('drop table IF EXISTS consumables');
|
||||
|
||||
@@ -62,15 +62,19 @@ class Purge extends Command
|
||||
$assetcount = $assets->count();
|
||||
$this->info($assets->count().' assets purged.');
|
||||
$asset_assoc = 0;
|
||||
$asset_maintenances = 0;
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
$this->info('- Asset "'.$asset->showAssetName().'" deleted.');
|
||||
$asset_assoc += $asset->assetlog()->count();
|
||||
$asset->assetlog()->forceDelete();
|
||||
$asset_maintenances += $asset->assetmaintenances()->count();
|
||||
$asset->assetmaintenances()->forceDelete();
|
||||
$asset->forceDelete();
|
||||
}
|
||||
|
||||
$this->info($asset_assoc.' corresponding log records purged.');
|
||||
$this->info($asset_maintenances.' corresponding maintenance records purged.');
|
||||
|
||||
$locations = Location::whereNotNull('deleted_at')->withTrashed()->get();
|
||||
$this->info($locations->count().' locations purged.');
|
||||
|
||||
@@ -66,7 +66,7 @@ class SendExpirationAlerts extends Command
|
||||
$asset_data['email_content'] .= '<td><a href="'.config('app.url').'/hardware/'.e($asset->id).'/view">';
|
||||
$asset_data['email_content'] .= $asset->showAssetName().'</a></td><td>'.e($asset->asset_tag).'</td>';
|
||||
$asset_data['email_content'] .= '<td>'.e($asset->warrantee_expires()).'</td>';
|
||||
$asset_data['email_content'] .= '<td>'.$difference.' days</td>';
|
||||
$asset_data['email_content'] .= '<td>'.$difference.' '.trans('mail.days').'</td>';
|
||||
$asset_data['email_content'] .= '<td>'.($asset->supplier ? e($asset->supplier->name) : '').'</td>';
|
||||
$asset_data['email_content'] .= '<td>'.($asset->assigneduser ? e($asset->assigneduser->fullName()) : '').'</td>';
|
||||
$asset_data['email_content'] .= '</tr>';
|
||||
@@ -100,17 +100,21 @@ class SendExpirationAlerts extends Command
|
||||
|
||||
|
||||
if (count($expiring_assets) > 0) {
|
||||
$this->info('Report sent to '.Setting::getSettings()->alert_email);
|
||||
\Mail::send('emails.expiring-assets-report', $asset_data, function ($m) {
|
||||
$m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
|
||||
$m->subject('Expiring Assets Report');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Expiring_Assets_Report'));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (count($expiring_licenses) > 0) {
|
||||
$this->info('Report sent to '.Setting::getSettings()->alert_email);
|
||||
\Mail::send('emails.expiring-licenses-report', $license_data, function ($m) {
|
||||
$m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
|
||||
$m->subject('Expiring Licenses Report');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Expiring_Licenses_Report'));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ class SendInventoryAlerts extends Command
|
||||
if (count($data['data']) > 0) {
|
||||
\Mail::send('emails.low-inventory', $data, function ($m) {
|
||||
$m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
|
||||
$m->subject('Low Inventory Report');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Low_Inventory_Report'));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -17,16 +17,20 @@ use App\Models\Component;
|
||||
use App\Models\Accessory;
|
||||
use App\Models\Consumable;
|
||||
use App\Models\Asset;
|
||||
use Crypt;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
class Helper
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Simple helper to invoke the markdown parser
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.0]
|
||||
* @return String
|
||||
*/
|
||||
public static function parseEscapedMarkedown($str) {
|
||||
$Parsedown = new \Parsedown();
|
||||
|
||||
@@ -36,20 +40,33 @@ class Helper
|
||||
}
|
||||
|
||||
|
||||
// This doesn't do anything yet
|
||||
public static function parseEmailList($emails)
|
||||
/**
|
||||
* The importer has formatted number strings since v3,
|
||||
* so the value might be a string, or an integer.
|
||||
* If it's a number, format it as a string.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.0]
|
||||
* @return String
|
||||
*/
|
||||
public static function formatCurrencyOutput($cost)
|
||||
{
|
||||
$emails_array = explode(',', $emails);
|
||||
return array_walk($emails_array, 'trim_value');
|
||||
if (is_numeric($cost)) {
|
||||
return number_format($cost, 2, '.', '');
|
||||
}
|
||||
// It's already been parsed.
|
||||
return $cost;
|
||||
}
|
||||
|
||||
// This doesn't do anything yet
|
||||
public static function trim_value(&$value)
|
||||
{
|
||||
return trim($value);
|
||||
}
|
||||
|
||||
// Static colors for pie charts
|
||||
/**
|
||||
* Static colors for pie charts.
|
||||
* This is inelegant, and could be refactored later.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.3]
|
||||
* @return Array
|
||||
*/
|
||||
public static function chartColors()
|
||||
{
|
||||
$colors = [
|
||||
@@ -67,8 +84,15 @@ class Helper
|
||||
return $colors;
|
||||
}
|
||||
|
||||
// Static background (highlight) colors for pie charts
|
||||
// This is not currently used, but might be in the near future.
|
||||
|
||||
/**
|
||||
* Static background (highlight) colors for pie charts
|
||||
* This is inelegant, and could be refactored later.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.2]
|
||||
* @return Array
|
||||
*/
|
||||
public static function chartBackgroundColors()
|
||||
{
|
||||
$colors = [
|
||||
@@ -87,10 +111,15 @@ class Helper
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Format currency using comma for thousands until local info is property used.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.7]
|
||||
* @return String
|
||||
*/
|
||||
public static function ParseFloat($floatString)
|
||||
{
|
||||
// use comma for thousands until local info is property used
|
||||
$LocaleInfo = localeconv();
|
||||
$floatString = str_replace(",", "", $floatString);
|
||||
$floatString = str_replace($LocaleInfo["decimal_point"], ".", $floatString);
|
||||
@@ -98,6 +127,13 @@ class Helper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of models in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function modelList()
|
||||
{
|
||||
$models = AssetModel::with('manufacturer')->get();
|
||||
@@ -108,6 +144,13 @@ class Helper
|
||||
return $model_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of companies in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function companyList()
|
||||
{
|
||||
$company_list = array('0' => trans('general.select_company')) + DB::table('companies')
|
||||
@@ -117,6 +160,13 @@ class Helper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of categories in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function categoryList($category_type = null)
|
||||
{
|
||||
$categories = Category::orderBy('name', 'asc')
|
||||
@@ -128,6 +178,13 @@ class Helper
|
||||
return $category_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of suppliers in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function suppliersList()
|
||||
{
|
||||
$supplier_list = array('' => trans('general.select_supplier')) + Supplier::orderBy('name', 'asc')
|
||||
@@ -136,6 +193,14 @@ class Helper
|
||||
return $supplier_list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of status labels in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function statusLabelList()
|
||||
{
|
||||
$statuslabel_list = array('' => trans('general.select_statuslabel')) + Statuslabel::orderBy('name', 'asc')
|
||||
@@ -143,6 +208,14 @@ class Helper
|
||||
return $statuslabel_list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of locations in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function locationsList()
|
||||
{
|
||||
$location_list = array('' => trans('general.select_location')) + Location::orderBy('name', 'asc')
|
||||
@@ -150,6 +223,14 @@ class Helper
|
||||
return $location_list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of manufacturers in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function manufacturerList()
|
||||
{
|
||||
$manufacturer_list = array('' => trans('general.select_manufacturer')) +
|
||||
@@ -158,12 +239,26 @@ class Helper
|
||||
return $manufacturer_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of status label types in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function statusTypeList()
|
||||
{
|
||||
$statuslabel_types = array('' => trans('admin/hardware/form.select_statustype')) + array('undeployable' => trans('admin/hardware/general.undeployable')) + array('pending' => trans('admin/hardware/general.pending')) + array('archived' => trans('admin/hardware/general.archived')) + array('deployable' => trans('admin/hardware/general.deployable'));
|
||||
return $statuslabel_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of managers in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function managerList()
|
||||
{
|
||||
$manager_list = array('' => trans('general.select_user')) +
|
||||
@@ -175,6 +270,13 @@ class Helper
|
||||
return $manager_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of depreciations in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function depreciationList()
|
||||
{
|
||||
$depreciation_list = ['' => 'Do Not Depreciate'] + Depreciation::orderBy('name', 'asc')
|
||||
@@ -182,16 +284,30 @@ class Helper
|
||||
return $depreciation_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of category types in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function categoryTypeList()
|
||||
{
|
||||
$category_types = array('' => '','accessory' => 'Accessory', 'asset' => 'Asset', 'consumable' => 'Consumable','component' => 'Component');
|
||||
return $category_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of users in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function usersList()
|
||||
{
|
||||
$users_list = array( '' => trans('general.select_user')) +
|
||||
User::where('deleted_at', '=', null)
|
||||
Company::scopeCompanyables(User::where('deleted_at', '=', null))
|
||||
->where('show_in_list','=',1)
|
||||
->orderBy('last_name', 'asc')
|
||||
->orderBy('first_name', 'asc')->get()
|
||||
@@ -200,6 +316,13 @@ class Helper
|
||||
return $users_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of assets in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function assetsList()
|
||||
{
|
||||
$assets_list = array('' => trans('general.select_asset')) + Asset::orderBy('name', 'asc')
|
||||
@@ -208,27 +331,54 @@ class Helper
|
||||
return $assets_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the detailed list of assets in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function detailedAssetList()
|
||||
{
|
||||
|
||||
$assets = array('' => trans('general.select_asset')) + Company::scopeCompanyables(Asset::all(), 'assets.company_id')->lists('detailed_name', 'id')->toArray();
|
||||
$assets = array('' => trans('general.select_asset')) + Company::scopeCompanyables(Asset::with('assignedUser', 'model'), 'assets.company_id')->get()->lists('detailed_name', 'id')->toArray();
|
||||
return $assets;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of custom fields in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v2.5]
|
||||
* @return Array
|
||||
*/
|
||||
public static function customFieldsetList()
|
||||
{
|
||||
$customfields = array('' => trans('admin/models/general.no_custom_field')) + CustomFieldset::pluck('name', 'id')->toArray();
|
||||
return $customfields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of custom field formats in an array to make a dropdown menu
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.4]
|
||||
* @return Array
|
||||
*/
|
||||
public static function predefined_formats()
|
||||
{
|
||||
$keys=array_keys(CustomField::$PredefinedFormats);
|
||||
$stuff=array_combine($keys, $keys);
|
||||
return $stuff+["" => "Custom Format..."];
|
||||
return $stuff+["" => trans('admin/custom_fields/general.custom_format')];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of barcode dimensions
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.3]
|
||||
* @return Array
|
||||
*/
|
||||
public static function barcodeDimensions($barcode_type = 'QRCODE')
|
||||
{
|
||||
if ($barcode_type == 'C128') {
|
||||
@@ -244,6 +394,13 @@ class Helper
|
||||
return $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a random string
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.0]
|
||||
* @return Array
|
||||
*/
|
||||
public static function generateRandomString($length = 10)
|
||||
{
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
@@ -255,10 +412,15 @@ class Helper
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This nasty little method gets the low inventory info for the
|
||||
* alert dropdown
|
||||
**/
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.0]
|
||||
* @return Array
|
||||
*/
|
||||
public static function checkLowInventory()
|
||||
{
|
||||
$consumables = Consumable::with('users')->whereNotNull('min_amt')->get();
|
||||
@@ -339,9 +501,16 @@ class Helper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the file is an image, so we can show a preview
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.0]
|
||||
* @param File $file
|
||||
* @return String | Boolean
|
||||
*/
|
||||
public static function checkUploadIsImage($file)
|
||||
{
|
||||
// Check if the file is an image, so we can show a preview
|
||||
$finfo = @finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
|
||||
$filetype = @finfo_file($finfo, $file);
|
||||
finfo_close($finfo);
|
||||
@@ -429,4 +598,91 @@ class Helper
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check to see if the given key exists in the array, and trim excess white space before returning it
|
||||
*
|
||||
* @author Daniel Melzter
|
||||
* @since 3.0
|
||||
* @param $array array
|
||||
* @param $key string
|
||||
* @param $default string
|
||||
* @return string
|
||||
*/
|
||||
public static function array_smart_fetch(array $array, $key, $default = '')
|
||||
{
|
||||
array_change_key_case($array, CASE_LOWER);
|
||||
return array_key_exists(strtolower($key), array_change_key_case($array)) ? e(trim($array[ $key ])) : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the given key exists in the array, and trim excess white space before returning it
|
||||
*
|
||||
* @author A. Gianotto
|
||||
* @since 3.2
|
||||
* @param $array array
|
||||
* @return string
|
||||
*/
|
||||
public static function getLastDateFromHistoryArray(array $array)
|
||||
{
|
||||
foreach ($array as $key => $value) {
|
||||
// echo '<pre>';
|
||||
// echo 'last:'.$key;
|
||||
// print_r($array);
|
||||
// echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gracefully handle decrypting the legacy data (encrypted via mcrypt) and use the new
|
||||
* decryption method instead.
|
||||
*
|
||||
* This is not currently used, but will be.
|
||||
*
|
||||
* @author A. Gianotto
|
||||
* @since 3.6
|
||||
* @param CustomField $field
|
||||
* @param String $string
|
||||
* @return string
|
||||
*/
|
||||
public static function gracefulDecrypt(CustomField $field, $string) {
|
||||
|
||||
if ($field->isFieldDecryptable($string)) {
|
||||
|
||||
try {
|
||||
Crypt::decrypt($string);
|
||||
return Crypt::decrypt($string);
|
||||
|
||||
} catch (DecryptException $e) {
|
||||
return 'Error Decrypting: '.$e->getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
return $string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip HTML out of returned JSON. This is pretty gross, and I'd like to find a better way
|
||||
* to handle this, but the REST API will solve some of these problems anyway.
|
||||
*
|
||||
* This is not currently used, but will be.
|
||||
*
|
||||
* @author A. Gianotto
|
||||
* @since 3.4
|
||||
* @param $array array
|
||||
* @return Array
|
||||
*/
|
||||
public static function stripTagsFromJSON(Array $array) {
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
$clean_value = strip_tags($value);
|
||||
$clean_array[$key] = $clean_value;
|
||||
}
|
||||
return $clean_array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ use Str;
|
||||
use View;
|
||||
use Auth;
|
||||
use Request;
|
||||
use Gate;
|
||||
|
||||
/** This controller handles all actions related to Accessories for
|
||||
* the Snipe-IT Asset Management application.
|
||||
@@ -52,14 +53,12 @@ class AccessoriesController extends Controller
|
||||
public function getCreate(Request $request)
|
||||
{
|
||||
// Show the page
|
||||
$category_list = Helper::categoryList('accessory');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
return View::make('accessories/edit')
|
||||
->with('accessory', new Accessory)
|
||||
->with('category_list', $category_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('location_list', $location_list);
|
||||
->with('category_list', Helper::categoryList('accessory'))
|
||||
->with('company_list', Helper::companyList())
|
||||
->with('location_list', Helper::locationsList())
|
||||
->with('manufacturer_list', Helper::manufacturerList());
|
||||
}
|
||||
|
||||
|
||||
@@ -76,12 +75,13 @@ class AccessoriesController extends Controller
|
||||
$accessory = new Accessory();
|
||||
|
||||
// Update the accessory data
|
||||
$accessory->name = e(Input::get('name'));
|
||||
$accessory->category_id = e(Input::get('category_id'));
|
||||
$accessory->location_id = e(Input::get('location_id'));
|
||||
$accessory->min_amt = e(Input::get('min_amt'));
|
||||
$accessory->name = e(Input::get('name'));
|
||||
$accessory->category_id = e(Input::get('category_id'));
|
||||
$accessory->location_id = e(Input::get('location_id'));
|
||||
$accessory->min_amt = e(Input::get('min_amt'));
|
||||
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$accessory->order_number = e(Input::get('order_number'));
|
||||
$accessory->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$accessory->purchase_date = null;
|
||||
@@ -92,14 +92,15 @@ class AccessoriesController extends Controller
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$accessory->purchase_cost = null;
|
||||
} else {
|
||||
$accessory->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$accessory->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
$accessory->user_id = Auth::user()->id;
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
$accessory->user_id = Auth::user()->id;
|
||||
|
||||
// Was the accessory created?
|
||||
if ($accessory->save()) {
|
||||
$accessory->logCreate();
|
||||
// Redirect to the new accessory page
|
||||
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.create.success'));
|
||||
}
|
||||
@@ -125,14 +126,11 @@ class AccessoriesController extends Controller
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = Helper::categoryList('accessory');
|
||||
$company_list = Helper::companyList();
|
||||
$location_list = Helper::locationsList();
|
||||
|
||||
return View::make('accessories/edit', compact('accessory'))
|
||||
->with('category_list', $category_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('location_list', $location_list);
|
||||
->with('category_list', Helper::categoryList('accessory'))
|
||||
->with('company_list', Helper::companyList())
|
||||
->with('location_list', Helper::locationsList())
|
||||
->with('manufacturer_list', Helper::manufacturerList());
|
||||
}
|
||||
|
||||
|
||||
@@ -145,9 +143,9 @@ class AccessoriesController extends Controller
|
||||
*/
|
||||
public function postEdit(Request $request, $accessoryId = null)
|
||||
{
|
||||
// Check if the blog post exists
|
||||
// Check if the accessory exists
|
||||
if (is_null($accessory = Accessory::find($accessoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
// Redirect to the accessory index page
|
||||
return redirect()->to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
@@ -159,11 +157,12 @@ class AccessoriesController extends Controller
|
||||
if (e(Input::get('location_id')) == '') {
|
||||
$accessory->location_id = null;
|
||||
} else {
|
||||
$accessory->location_id = e(Input::get('location_id'));
|
||||
$accessory->location_id = e(Input::get('location_id'));
|
||||
}
|
||||
$accessory->min_amt = e(Input::get('min_amt'));
|
||||
$accessory->min_amt = e(Input::get('min_amt'));
|
||||
$accessory->category_id = e(Input::get('category_id'));
|
||||
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$accessory->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
$accessory->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
@@ -180,9 +179,9 @@ class AccessoriesController extends Controller
|
||||
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
|
||||
// Was the accessory created?
|
||||
// Was the accessory updated?
|
||||
if ($accessory->save()) {
|
||||
// Redirect to the new accessory page
|
||||
// Redirect to the updated accessory page
|
||||
return redirect()->to("admin/accessories")->with('success', trans('admin/accessories/message.update.success'));
|
||||
}
|
||||
|
||||
@@ -311,14 +310,7 @@ class AccessoriesController extends Controller
|
||||
'user_id' => Auth::user()->id,
|
||||
'assigned_to' => e(Input::get('assigned_to'))));
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->accessory_id = $accessory->id;
|
||||
$logaction->asset_id = 0;
|
||||
$logaction->checkedout_to = $accessory->assigned_to;
|
||||
$logaction->asset_type = 'accessory';
|
||||
$logaction->location_id = $user->location_id;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction = $accessory->logCheckout(e(Input::get('note')));
|
||||
|
||||
|
||||
|
||||
@@ -342,11 +334,11 @@ class AccessoriesController extends Controller
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'Checked Out:',
|
||||
'value' => strtoupper($logaction->asset_type).' <'.config('app.url').'/admin/accessories/'.$accessory->id.'/view'.'|'.$accessory->name.'> checked out to <'.config('app.url').'/admin/users/'.$user->id.'/view|'.$user->fullName().'> by <'.config('app.url').'/admin/users/'.$admin_user->id.'/view'.'|'.$admin_user->fullName().'>.'
|
||||
'value' => 'Accessory <'.config('app.url').'/admin/accessories/'.$accessory->id.'/view'.'|'.$accessory->name.'> checked out to <'.config('app.url').'/admin/users/'.$user->id.'/view|'.$user->fullName().'> by <'.config('app.url').'/admin/users/'.$admin_user->id.'/view'.'|'.$admin_user->fullName().'>.'
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
'value' => e($logaction->note)
|
||||
'value' => e(Input::get('note'))
|
||||
],
|
||||
]
|
||||
])->send('Accessory Checked Out');
|
||||
@@ -357,9 +349,6 @@ class AccessoriesController extends Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkout');
|
||||
|
||||
$accessory_user = DB::table('accessories_users')->where('assigned_to', '=', $accessory->assigned_to)->where('accessory_id', '=', $accessory->id)->first();
|
||||
|
||||
$data['log_id'] = $logaction->id;
|
||||
@@ -377,7 +366,8 @@ class AccessoriesController extends Controller
|
||||
|
||||
Mail::send('emails.accept-accessory', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Confirm accessory delivery');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Confirm_accessory_delivery'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -437,8 +427,7 @@ class AccessoriesController extends Controller
|
||||
return redirect()->to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->checkedout_to = e($accessory_user->assigned_to);
|
||||
$logaction = $accessory->logCheckin(e(Input::get('note')));
|
||||
$return_to = e($accessory_user->assigned_to);
|
||||
$admin_user = Auth::user();
|
||||
|
||||
@@ -446,12 +435,6 @@ class AccessoriesController extends Controller
|
||||
// Was the accessory updated?
|
||||
if (DB::table('accessories_users')->where('id', '=', $accessory_user->id)->delete()) {
|
||||
|
||||
$logaction->accessory_id = e($accessory->id);
|
||||
$logaction->location_id = null;
|
||||
$logaction->asset_type = 'accessory';
|
||||
$logaction->user_id = e($admin_user->id);
|
||||
$logaction->note = e(Input::get('note'));
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
@@ -471,7 +454,7 @@ class AccessoriesController extends Controller
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'Checked In:',
|
||||
'value' => strtoupper($logaction->asset_type).' <'.config('app.url').'/admin/accessories/'.e($accessory->id).'/view'.'|'.e($accessory->name).'> checked in by <'.config('app.url').'/admin/users/'.e($admin_user->id).'/view'.'|'.e($admin_user->fullName()).'>.'
|
||||
'value' => class_basename(strtoupper($logaction->item_type)).' <'.config('app.url').'/admin/accessories/'.e($accessory->id).'/view'.'|'.e($accessory->name).'> checked in by <'.config('app.url').'/admin/users/'.e($admin_user->id).'/view'.'|'.e($admin_user->fullName()).'>.'
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
@@ -487,9 +470,6 @@ class AccessoriesController extends Controller
|
||||
|
||||
}
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkin from');
|
||||
|
||||
if (!is_null($accessory_user->assigned_to)) {
|
||||
$user = User::find($accessory_user->assigned_to);
|
||||
}
|
||||
@@ -505,7 +485,8 @@ class AccessoriesController extends Controller
|
||||
|
||||
Mail::send('emails.checkin-asset', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Confirm Accessory Checkin');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Confirm_Accessory_Checkin'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -591,7 +572,21 @@ class AccessoriesController extends Controller
|
||||
$rows = array();
|
||||
|
||||
foreach ($accessories as $accessory) {
|
||||
$actions = '<nobr><a href="'.route('checkout/accessory', $accessory->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($accessory->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/accessory', $accessory->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/accessory', $accessory->id).'" data-content="'.trans('admin/accessories/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($accessory->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
|
||||
$actions = '<nobr>';
|
||||
if (Gate::allows('accessories.checkout')) {
|
||||
$actions .= '<a href="' . route('checkout/accessory',
|
||||
$accessory->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($accessory->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
if (Gate::allows('accessories.edit')) {
|
||||
$actions .= '<a href="' . route('update/accessory',
|
||||
$accessory->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('accessories.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/accessory',
|
||||
$accessory->id) . '" data-content="' . trans('admin/accessories/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($accessory->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
$actions .= '</nobr>';
|
||||
$company = $accessory->company;
|
||||
|
||||
$rows[] = array(
|
||||
@@ -602,10 +597,12 @@ class AccessoriesController extends Controller
|
||||
'min_amt' => e($accessory->min_amt),
|
||||
'location' => ($accessory->location) ? e($accessory->location->name): '',
|
||||
'purchase_date' => e($accessory->purchase_date),
|
||||
'purchase_cost' => number_format($accessory->purchase_cost, 2),
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($accessory->purchase_cost),
|
||||
'numRemaining' => $accessory->numRemaining(),
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : e($company->name)
|
||||
'companyName' => is_null($company) ? '' : e($company->name),
|
||||
'manufacturer' => $accessory->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$accessory->manufacturer_id.'/view', $accessory->manufacturer->name) : ''
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -654,10 +651,20 @@ class AccessoriesController extends Controller
|
||||
$rows = array();
|
||||
|
||||
foreach ($accessory_users as $user) {
|
||||
$actions = '<a href="'.route('checkin/accessory', $user->pivot->id).'" class="btn btn-info btn-sm">Checkin</a>';
|
||||
$actions = '';
|
||||
if (Gate::allows('accessories.checkin')) {
|
||||
$actions .= '<a href="' . route('checkin/accessory',
|
||||
$user->pivot->id) . '" class="btn btn-info btn-sm">Checkin</a>';
|
||||
}
|
||||
|
||||
if (Gate::allows('users.view')) {
|
||||
$name = (string) link_to('/admin/users/'.$user->id.'/view', e($user->fullName()));
|
||||
} else {
|
||||
$name = e($user->fullName());
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'name' =>(string) link_to('/admin/users/'.$user->id.'/view', e($user->fullName())),
|
||||
'name' => $name,
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
@@ -122,20 +122,18 @@ class AssetMaintenancesController extends Controller
|
||||
|
||||
$actions = '<nobr><a href="'.route('update/asset_maintenance', $maintenance->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/asset_maintenance', $maintenance->id).'" data-content="'.trans('admin/asset_maintenances/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($maintenance->title).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
|
||||
if (($maintenance->cost) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
|
||||
if (($maintenance->cost) && (isset($maintenance->asset)) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
|
||||
$maintenance_cost = $maintenance->asset->assetloc->currency.$maintenance->cost;
|
||||
} else {
|
||||
$maintenance_cost = $settings->default_currency.$maintenance->cost;
|
||||
}
|
||||
|
||||
$company = $maintenance->asset->company;
|
||||
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $maintenance->id,
|
||||
'asset_name' => (string)link_to('/hardware/'.$maintenance->asset->id.'/view', $maintenance->asset->showAssetName()) ,
|
||||
'asset_name' => ($maintenance->asset) ? (string)link_to('/hardware/'.$maintenance->asset->id.'/view', $maintenance->asset->showAssetName()) : 'Deleted Asset' ,
|
||||
'title' => $maintenance->title,
|
||||
'notes' => $maintenance->notes,
|
||||
'supplier' => $maintenance->supplier->name,
|
||||
'supplier' => ($maintenance->supplier) ? (string)link_to('/admin/settings/suppliers/'.$maintenance->supplier->id.'/view', $maintenance->supplier->name) : 'Deleted Supplier',
|
||||
'cost' => $maintenance_cost,
|
||||
'asset_maintenance_type' => e($maintenance->asset_maintenance_type),
|
||||
'start_date' => $maintenance->start_date,
|
||||
@@ -143,7 +141,7 @@ class AssetMaintenancesController extends Controller
|
||||
'completion_date' => $maintenance->completion_date,
|
||||
'user_id' => ($maintenance->admin) ? (string)link_to('/admin/users/'.$maintenance->admin->id.'/view', $maintenance->admin->fullName()) : '',
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : $company->name
|
||||
'companyName' => ($maintenance->asset->company) ? $maintenance->asset->company->name : ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -217,7 +215,7 @@ class AssetMaintenancesController extends Controller
|
||||
if (e(Input::get('cost')) == '') {
|
||||
$assetMaintenance->cost = '';
|
||||
} else {
|
||||
$assetMaintenance->cost = e(Input::get('cost'));
|
||||
$assetMaintenance->cost = Helper::ParseFloat(e(Input::get('cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('notes')) == '') {
|
||||
@@ -309,7 +307,7 @@ class AssetMaintenancesController extends Controller
|
||||
'' => 'Select an improvement type',
|
||||
] + AssetMaintenance::getImprovementOptions();
|
||||
|
||||
$assets = Company::scopeCompanyables(Asset::all(), 'assets.company_id')->lists('detailed_name', 'id');
|
||||
$assets = Company::scopeCompanyables(Asset::with('model','assignedUser')->get(), 'assets.company_id')->lists('detailed_name', 'id');
|
||||
// Get Supplier List
|
||||
$supplier_list = Helper::suppliersList();
|
||||
|
||||
@@ -365,7 +363,7 @@ class AssetMaintenancesController extends Controller
|
||||
if (e(Input::get('cost')) == '') {
|
||||
$assetMaintenance->cost = '';
|
||||
} else {
|
||||
$assetMaintenance->cost = e(Input::get('cost'));
|
||||
$assetMaintenance->cost = Helper::ParseFloat(e(Input::get('cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('notes')) == '') {
|
||||
|
||||
@@ -92,19 +92,19 @@ class AssetModelsController extends Controller
|
||||
$model->eol = e(Input::get('eol'));
|
||||
}
|
||||
|
||||
// Save the model data
|
||||
$model->name = e(Input::get('name'));
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
$model->category_id = e(Input::get('category_id'));
|
||||
$model->note = e(Input::get('note'));
|
||||
$model->user_id = Auth::user()->id;
|
||||
// Save the model data
|
||||
$model->name = e(Input::get('name'));
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
$model->category_id = e(Input::get('category_id'));
|
||||
$model->note = e(Input::get('note'));
|
||||
$model->user_id = Auth::user()->id;
|
||||
$model->requestable = Input::has('requestable');
|
||||
|
||||
if (Input::get('custom_fieldset')!='') {
|
||||
$model->fieldset_id = e(Input::get('custom_fieldset'));
|
||||
}
|
||||
|
||||
//$model->show_mac_address = e(Input::get('show_mac_address', '0'));
|
||||
|
||||
|
||||
if (Input::file('image')) {
|
||||
$image = Input::file('image');
|
||||
@@ -141,7 +141,7 @@ class AssetModelsController extends Controller
|
||||
$model = new AssetModel;
|
||||
|
||||
$settings=Input::all();
|
||||
$settings['eol']=0;
|
||||
$settings['eol']= null;
|
||||
|
||||
$model->name=e(Input::get('name'));
|
||||
$model->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
@@ -149,7 +149,7 @@ class AssetModelsController extends Controller
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->user_id = Auth::user()->id;
|
||||
$model->note = e(Input::get('note'));
|
||||
$model->eol=0;
|
||||
$model->eol= null;
|
||||
|
||||
if (Input::get('fieldset_id')=='') {
|
||||
$model->fieldset_id = null;
|
||||
@@ -217,7 +217,7 @@ class AssetModelsController extends Controller
|
||||
}
|
||||
|
||||
if (e(Input::get('eol')) == '') {
|
||||
$model->eol = 0;
|
||||
$model->eol = null;
|
||||
} else {
|
||||
$model->eol = e(Input::get('eol'));
|
||||
}
|
||||
@@ -227,7 +227,10 @@ class AssetModelsController extends Controller
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
$model->category_id = e(Input::get('category_id'));
|
||||
$model->note = e(Input::get('note'));
|
||||
$model->note = e(Input::get('note'));
|
||||
|
||||
$model->requestable = Input::has('requestable');
|
||||
|
||||
if (Input::get('custom_fieldset')=='') {
|
||||
$model->fieldset_id = null;
|
||||
} else {
|
||||
|
||||
@@ -23,6 +23,7 @@ use Validator;
|
||||
use Artisan;
|
||||
use Auth;
|
||||
use Config;
|
||||
use League\Csv\Reader;
|
||||
use DB;
|
||||
use Image;
|
||||
use Input;
|
||||
@@ -40,6 +41,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use TCPDF;
|
||||
use View;
|
||||
use Carbon\Carbon;
|
||||
use Gate;
|
||||
|
||||
/**
|
||||
* This class controls all actions related to assets for
|
||||
@@ -176,7 +178,7 @@ class AssetsController extends Controller
|
||||
if (e(Input::get('purchase_cost')) == '') {
|
||||
$asset->purchase_cost = null;
|
||||
} else {
|
||||
$asset->purchase_cost = (e(Input::get('purchase_cost')));
|
||||
$asset->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
@@ -229,7 +231,7 @@ class AssetsController extends Controller
|
||||
$directory= public_path('uploads/assets/');
|
||||
// Check if the uploads directory exists. If not, try to create it.
|
||||
if (!file_exists($directory)) {
|
||||
mkdir($directory, 0755);
|
||||
mkdir($directory, 0755, true);
|
||||
}
|
||||
$path = public_path('uploads/assets/'.$file_name);
|
||||
try {
|
||||
@@ -238,7 +240,7 @@ class AssetsController extends Controller
|
||||
$constraint->upsize();
|
||||
})->save($path);
|
||||
$asset->image = $file_name;
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
\Input::flash();
|
||||
$messageBag = new \Illuminate\Support\MessageBag();
|
||||
$messageBag->add('image', $e->getMessage());
|
||||
@@ -262,15 +264,10 @@ class AssetsController extends Controller
|
||||
|
||||
// Was the asset created?
|
||||
if ($asset->save()) {
|
||||
|
||||
$asset->logCreate();
|
||||
if (Input::get('assigned_to')!='') {
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->checkedout_to = $asset->assigned_to;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$log = $logaction->logaction('checkout');
|
||||
$user = User::find(e(Input::get('assigned_to')));
|
||||
$asset->checkOutToUser($user, Auth::user(), date('Y-m-d H:i:s'), '', 'Checked out on asset creation', e(Input::get('name')));
|
||||
}
|
||||
// Redirect to the asset listing page
|
||||
\Session::flash('success', trans('admin/hardware/message.create.success'));
|
||||
@@ -291,7 +288,7 @@ class AssetsController extends Controller
|
||||
*/
|
||||
public function getEdit($assetId = null)
|
||||
{
|
||||
|
||||
|
||||
// Check if the asset exists
|
||||
if (!$asset = Asset::find($assetId)) {
|
||||
// Redirect to the asset management page
|
||||
@@ -357,7 +354,7 @@ class AssetsController extends Controller
|
||||
}
|
||||
|
||||
if ($request->has('purchase_cost')) {
|
||||
$asset->purchase_cost = e($request->input('purchase_cost'));
|
||||
$asset->purchase_cost = Helper::ParseFloat(e($request->input('purchase_cost')));
|
||||
} else {
|
||||
$asset->purchase_cost = null;
|
||||
}
|
||||
@@ -410,7 +407,7 @@ class AssetsController extends Controller
|
||||
$directory= public_path('uploads/assets/');
|
||||
// Check if the uploads directory exists. If not, try to create it.
|
||||
if (!file_exists($directory)) {
|
||||
mkdir($directory, 0755);
|
||||
mkdir($directory, 0755, true);
|
||||
}
|
||||
|
||||
$file_name = str_random(25).".".$extension;
|
||||
@@ -421,7 +418,7 @@ class AssetsController extends Controller
|
||||
$constraint->upsize();
|
||||
})->save($path);
|
||||
$asset->image = $file_name;
|
||||
} catch(\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
\Input::flash();
|
||||
$messageBag = new \Illuminate\Support\MessageBag();
|
||||
$messageBag->add('image', $e->getMessage());
|
||||
@@ -439,14 +436,22 @@ class AssetsController extends Controller
|
||||
$model = AssetModel::find($request->get('model_id'));
|
||||
if ($model->fieldset) {
|
||||
foreach ($model->fieldset->fields as $field) {
|
||||
$asset->{\App\Models\CustomField::name_to_db_name($field->name)} = e($request->input(\App\Models\CustomField::name_to_db_name($field->name)));
|
||||
// LOG::debug($field->name);
|
||||
// LOG::debug(\App\Models\CustomField::name_to_db_name($field->name));
|
||||
// LOG::debug($field->db_column_name());
|
||||
|
||||
|
||||
if ($field->field_encrypted=='1') {
|
||||
if (Gate::allows('admin')) {
|
||||
$asset->{\App\Models\CustomField::name_to_db_name($field->name)} = \Crypt::encrypt(e($request->input(\App\Models\CustomField::name_to_db_name($field->name))));
|
||||
}
|
||||
|
||||
} else {
|
||||
$asset->{\App\Models\CustomField::name_to_db_name($field->name)} = e($request->input(\App\Models\CustomField::name_to_db_name($field->name)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($asset->save()) {
|
||||
// Redirect to the new asset page
|
||||
\Session::flash('success', trans('admin/hardware/message.update.success'));
|
||||
@@ -533,6 +538,8 @@ class AssetsController extends Controller
|
||||
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
} elseif (!$asset->availableForCheckout()) {
|
||||
return redirect()->to('hardware')->with('error', trans('admin/hardware/message.checkout.not_available'));
|
||||
}
|
||||
|
||||
$user = User::find(e(Input::get('assigned_to')));
|
||||
@@ -652,7 +659,7 @@ class AssetsController extends Controller
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'Checked In:',
|
||||
'value' => strtoupper($logaction->asset_type).' asset <'.config('app.url').'/hardware/'.$asset->id.'/view'.'|'.e($asset->showAssetName()).'> checked in by <'.config('app.url').'/admin/users/'.Auth::user()->id.'/view'.'|'.e(Auth::user()->fullName()).'>.'
|
||||
'value' => class_basename(strtoupper($logaction->item_type)).' asset <'.config('app.url').'/hardware/'.$asset->id.'/view'.'|'.e($asset->showAssetName()).'> checked in by <'.config('app.url').'/admin/users/'.Auth::user()->id.'/view'.'|'.e(Auth::user()->fullName()).'>.'
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
@@ -679,7 +686,8 @@ class AssetsController extends Controller
|
||||
if ((($asset->checkin_email()=='1')) && ($user) && (!config('app.lock_passwords'))) {
|
||||
Mail::send('emails.checkin-asset', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Confirm Asset Checkin');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Confirm_Asset_Checkin'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -761,14 +769,20 @@ class AssetsController extends Controller
|
||||
if ($settings->qr_code == '1') {
|
||||
$asset = Asset::find($assetId);
|
||||
$size = Helper::barcodeDimensions($settings->barcode_type);
|
||||
|
||||
|
||||
$qr_file = public_path().'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'.png';
|
||||
|
||||
if (isset($asset->id,$asset->asset_tag)) {
|
||||
$barcode = new \Com\Tecnick\Barcode\Barcode();
|
||||
$barcode_obj = $barcode->getBarcodeObj($settings->barcode_type, route('view/hardware', $asset->id), $size['height'], $size['width'], 'black', array(-2, -2, -2, -2));
|
||||
|
||||
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
|
||||
if (file_exists($qr_file)) {
|
||||
$header = ['Content-type' => 'image/png'];
|
||||
return response()->file($qr_file, $header);
|
||||
} else {
|
||||
$barcode = new \Com\Tecnick\Barcode\Barcode();
|
||||
$barcode_obj = $barcode->getBarcodeObj($settings->barcode_type, route('view/hardware', $asset->id), $size['height'], $size['width'], 'black', array(-2, -2, -2, -2));
|
||||
file_put_contents($qr_file, $barcode_obj->getPngData());
|
||||
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,12 +802,20 @@ class AssetsController extends Controller
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
$asset = Asset::find($assetId);
|
||||
$barcode_file = public_path().'/uploads/barcodes/'.str_slug($settings->alt_barcode).'-'.str_slug($asset->asset_tag).'.png';
|
||||
|
||||
|
||||
if (isset($asset->id,$asset->asset_tag)) {
|
||||
$barcode = new \Com\Tecnick\Barcode\Barcode();
|
||||
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, 250, 20);
|
||||
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
|
||||
|
||||
if (file_exists($barcode_file)) {
|
||||
$header = ['Content-type' => 'image/png'];
|
||||
return response()->file($barcode_file, $header);
|
||||
} else {
|
||||
$barcode = new \Com\Tecnick\Barcode\Barcode();
|
||||
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, 250, 20);
|
||||
file_put_contents($barcode_file, $barcode_obj->getPngData());
|
||||
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -818,7 +840,7 @@ class AssetsController extends Controller
|
||||
|
||||
// Check if the uploads directory exists. If not, try to create it.
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path, 0755);
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
if ($handle = opendir($path)) {
|
||||
|
||||
@@ -879,11 +901,11 @@ class AssetsController extends Controller
|
||||
try {
|
||||
$file->move($path, $date.'-'.$fixed_filename);
|
||||
} catch (\Symfony\Component\HttpFoundation\File\Exception\FileException $exception) {
|
||||
$results['error']=trans('admin/hardware/message.upload.error');
|
||||
if( config('app.debug')) {
|
||||
$results['error'].= ' ' . $exception->getMessage();
|
||||
}
|
||||
return $results;
|
||||
$results['error']=trans('admin/hardware/message.upload.error');
|
||||
if (config('app.debug')) {
|
||||
$results['error'].= ' ' . $exception->getMessage();
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
$name = date('Y-m-d-his').'-'.$fixed_filename;
|
||||
$filesize = Setting::fileSizeConvert(filesize($path.'/'.$name));
|
||||
@@ -906,6 +928,18 @@ class AssetsController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function getDeleteImportFile($filename)
|
||||
{
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (unlink(config('app.private_uploads').'/imports/assets/'.$filename)) {
|
||||
return redirect()->back()->with('success', trans('admin/hardware/message.import.file_delete_success'));
|
||||
}
|
||||
return redirect()->back()->with('error', trans('admin/hardware/message.import.file_delete_error'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the uploaded file
|
||||
@@ -915,28 +949,47 @@ class AssetsController extends Controller
|
||||
* @since [v2.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function getProcessImportFile($filename)
|
||||
public function postProcessImportFile()
|
||||
{
|
||||
// php artisan asset-import:csv path/to/your/file.csv --domain=yourdomain.com --email_format=firstname.lastname
|
||||
$filename = Input::get('filename');
|
||||
$itemType = Input::get('import-type');
|
||||
$updateItems = Input::get('import-update');
|
||||
|
||||
if (!Company::isCurrentUserAuthorized()) {
|
||||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$return = Artisan::call(
|
||||
'snipeit:import',
|
||||
['filename'=> config('app.private_uploads').'/imports/assets/'.$filename,
|
||||
$importOptions = ['filename'=> config('app.private_uploads').'/imports/assets/'.$filename,
|
||||
'--email_format'=>'firstname.lastname',
|
||||
'--username_format'=>'firstname.lastname',
|
||||
'--web-importer' => true,
|
||||
'--user_id' => Auth::user()->id
|
||||
]
|
||||
);
|
||||
'--user_id' => Auth::user()->id,
|
||||
'--item-type' => $itemType,
|
||||
];
|
||||
if ($updateItems) {
|
||||
$importOptions['--update'] = true;
|
||||
}
|
||||
|
||||
$return = Artisan::call('snipeit:import', $importOptions);
|
||||
$display_output = Artisan::output();
|
||||
$file = config('app.private_uploads').'/imports/assets/'.str_replace('.csv', '', $filename).'-output-'.date("Y-m-d-his").'.txt';
|
||||
file_put_contents($file, $display_output);
|
||||
// We use hardware instead of asset in the url
|
||||
$redirectTo = "hardware";
|
||||
switch($itemType) {
|
||||
case "asset":
|
||||
$redirectTo = "hardware";
|
||||
break;
|
||||
case "accessory":
|
||||
$redirectTo = "accessories";
|
||||
break;
|
||||
case "consumable":
|
||||
$redirectTo = "consumables";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($return === 0) { //Success
|
||||
return redirect()->to('hardware')->with('success', trans('admin/hardware/message.import.success'));
|
||||
return redirect()->to(route($redirectTo))->with('success', trans('admin/hardware/message.import.success'));
|
||||
} elseif ($return === 1) { // Failure
|
||||
return redirect()->back()->with('import_errors', json_decode($display_output))->with('error', trans('admin/hardware/message.import.error'));
|
||||
}
|
||||
@@ -994,6 +1047,178 @@ class AssetsController extends Controller
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return history import view
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getImportHistory()
|
||||
{
|
||||
|
||||
return View::make('hardware/history');
|
||||
}
|
||||
|
||||
/**
|
||||
* Import history
|
||||
*
|
||||
* This needs a LOT of love. It's done very inelegantly right now, and there are
|
||||
* a ton of optimizations that could (and should) be done.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.3]
|
||||
* @return View
|
||||
*/
|
||||
public function postImportHistory(Request $request)
|
||||
{
|
||||
|
||||
if (!ini_get("auto_detect_line_endings")) {
|
||||
ini_set("auto_detect_line_endings", '1');
|
||||
}
|
||||
|
||||
$assets = Asset::all(['asset_tag']);
|
||||
|
||||
$csv = Reader::createFromPath(Input::file('user_import_csv'));
|
||||
$csv->setNewline("\r\n");
|
||||
//get the first row, usually the CSV header
|
||||
//$headers = $csv->fetchOne();
|
||||
|
||||
$results = $csv->fetchAssoc();
|
||||
$item = array();
|
||||
$status = array();
|
||||
$status['error'] = array();
|
||||
$status['success'] = array();
|
||||
|
||||
|
||||
foreach($results as $row) {
|
||||
|
||||
if (is_array($row)) {
|
||||
|
||||
$row = array_change_key_case($row, CASE_LOWER);
|
||||
$asset_tag = Helper::array_smart_fetch($row, "asset tag");
|
||||
if (!array_key_exists($asset_tag, $item)) {
|
||||
$item[$asset_tag] = array();
|
||||
}
|
||||
$batch_counter = count($item[$asset_tag]);
|
||||
|
||||
$item[$asset_tag][$batch_counter]['checkout_date'] = Carbon::parse(Helper::array_smart_fetch($row, "date"))->format('Y-m-d H:i:s');
|
||||
|
||||
$item[$asset_tag][$batch_counter]['asset_tag'] = Helper::array_smart_fetch($row, "asset tag");
|
||||
$item[$asset_tag][$batch_counter]['name'] = Helper::array_smart_fetch($row, "name");
|
||||
$item[$asset_tag][$batch_counter]['email'] = Helper::array_smart_fetch($row, "email");
|
||||
|
||||
if ($asset = Asset::where('asset_tag','=',$asset_tag)->first()) {
|
||||
|
||||
$item[$asset_tag][$batch_counter]['asset_id'] = $asset->id;
|
||||
|
||||
$base_username = User::generateFormattedNameFromFullName(Setting::getSettings()->username_format,$item[$asset_tag][$batch_counter]['name']);
|
||||
$user = User::where('username','=',$base_username['username']);
|
||||
$user_query = ' on username '.$base_username['username'];
|
||||
|
||||
if ($request->input('match_firstnamelastname')=='1') {
|
||||
$firstnamedotlastname = User::generateFormattedNameFromFullName('firstname.lastname',$item[$asset_tag][$batch_counter]['name']);
|
||||
$item[$asset_tag][$batch_counter]['username'][] = $firstnamedotlastname['username'];
|
||||
$user->orWhere('username','=',$firstnamedotlastname['username']);
|
||||
$user_query .= ', or on username '.$firstnamedotlastname['username'];
|
||||
}
|
||||
|
||||
if ($request->input('match_flastname')=='1') {
|
||||
$flastname = User::generateFormattedNameFromFullName('filastname',$item[$asset_tag][$batch_counter]['name']);
|
||||
$item[$asset_tag][$batch_counter]['username'][] = $flastname['username'];
|
||||
$user->orWhere('username','=',$flastname['username']);
|
||||
$user_query .= ', or on username '.$flastname['username'];
|
||||
}
|
||||
if ($request->input('match_firstname')=='1') {
|
||||
$firstname = User::generateFormattedNameFromFullName('firstname',$item[$asset_tag][$batch_counter]['name']);
|
||||
$item[$asset_tag][$batch_counter]['username'][] = $firstname['username'];
|
||||
$user->orWhere('username','=',$firstname['username']);
|
||||
$user_query .= ', or on username '.$firstname['username'];
|
||||
}
|
||||
if ($request->input('match_email')=='1') {
|
||||
if ($item[$asset_tag][$batch_counter]['email']=='') {
|
||||
$item[$asset_tag][$batch_counter]['username'][] = $user_email = User::generateEmailFromFullName($item[$asset_tag][$batch_counter]['name']);
|
||||
$user->orWhere('username','=',$user_email);
|
||||
$user_query .= ', or on username '.$user_email;
|
||||
}
|
||||
}
|
||||
|
||||
// A matching user was found
|
||||
if ($user = $user->first()) {
|
||||
$item[$asset_tag][$batch_counter]['checkedout_to'] = $user->id;
|
||||
$item[$asset_tag][$batch_counter]['user_id'] = $user->id;
|
||||
|
||||
Actionlog::firstOrCreate(array(
|
||||
'item_id' => $asset->id,
|
||||
'item_type' => Asset::class,
|
||||
'user_id' => Auth::user()->id,
|
||||
'note' => 'Checkout imported by '.Auth::user()->fullName().' from history importer',
|
||||
'target_id' => $item[$asset_tag][$batch_counter]['user_id'],
|
||||
'target_type' => User::class,
|
||||
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'],
|
||||
'action_type' => 'checkout',
|
||||
)
|
||||
);
|
||||
|
||||
$asset->assigned_to = $user->id;
|
||||
|
||||
if ($asset->save()) {
|
||||
$status['success'][]['asset'][$asset_tag]['msg'] = 'Asset successfully matched for '.Helper::array_smart_fetch($row, "name").$user_query.' on '.$item[$asset_tag][$batch_counter]['checkout_date'];
|
||||
} else {
|
||||
$status['error'][]['asset'][$asset_tag]['msg'] = 'Asset and user was matched but could not be saved.';
|
||||
}
|
||||
|
||||
} else {
|
||||
$item[$asset_tag][$batch_counter]['checkedout_to'] = null;
|
||||
$status['error'][]['user'][Helper::array_smart_fetch($row, "name")]['msg'] = 'User does not exist so no checkin log was created.';
|
||||
}
|
||||
|
||||
} else {
|
||||
$item[$asset_tag][$batch_counter]['asset_id'] = null;
|
||||
$status['error'][]['asset'][$asset_tag]['msg'] = 'Asset does not exist so no match was attempted.';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through and backfill the checkins
|
||||
foreach ($item as $key => $asset_batch) {
|
||||
$total_in_batch = count($asset_batch);
|
||||
for($x = 0; $x < $total_in_batch; $x++) {
|
||||
$next = $x + 1;
|
||||
|
||||
// Only do this if a matching user was found
|
||||
if ((array_key_exists('checkedout_to',$asset_batch[$x])) && ($asset_batch[$x]['checkedout_to']!='')) {
|
||||
|
||||
if (($total_in_batch > 1) && ($x < $total_in_batch) && (array_key_exists($next,$asset_batch))) {
|
||||
$checkin_date = Carbon::parse($asset_batch[$next]['checkout_date'])->subDay(1)->format('Y-m-d H:i:s');
|
||||
$asset_batch[$x]['real_checkin'] = $checkin_date;
|
||||
|
||||
Actionlog::firstOrCreate(array(
|
||||
'item_id' => $asset_batch[$x]['asset_id'],
|
||||
'item_type' => Asset::class,
|
||||
'user_id' => Auth::user()->id,
|
||||
'note' => 'Checkin imported by ' . Auth::user()->fullName() . ' from history importer',
|
||||
'target_id' => null,
|
||||
'created_at' => $checkin_date,
|
||||
'action_type' => 'checkin'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return View::make('hardware/history')->with('status',$status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retore a deleted asset.
|
||||
*
|
||||
@@ -1055,15 +1280,8 @@ class AssetsController extends Controller
|
||||
$upload_success = $file->move($destinationPath, $filename);
|
||||
|
||||
//Log the deletion of seats to the log
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('notes'));
|
||||
$logaction->checkedout_to = null;
|
||||
$logaction->created_at = date("Y-m-d H:i:s");
|
||||
$logaction->filename = $filename;
|
||||
$log = $logaction->logaction('uploaded');
|
||||
$asset->logUpload($filename, e(Input::get('notes')));
|
||||
|
||||
}
|
||||
} else {
|
||||
return redirect()->back()->with('error', trans('admin/hardware/message.upload.nofiles'));
|
||||
@@ -1206,7 +1424,7 @@ class AssetsController extends Controller
|
||||
|
||||
return View::make('hardware/labels')->with('assets', $assets)->with('settings', $settings)->with('count', $count)->with('settings', $settings);
|
||||
|
||||
|
||||
|
||||
|
||||
} elseif (Input::get('bulk_actions')=='delete') {
|
||||
|
||||
@@ -1274,7 +1492,7 @@ class AssetsController extends Controller
|
||||
}
|
||||
|
||||
if (Input::has('purchase_cost')) {
|
||||
$update_array['purchase_cost'] = e(Input::get('purchase_cost'));
|
||||
$update_array['purchase_cost'] = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (Input::has('supplier_id')) {
|
||||
@@ -1320,8 +1538,8 @@ class AssetsController extends Controller
|
||||
->update($update_array)) {
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $key;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->item_type = Asset::class;
|
||||
$logaction->item_id = $key;
|
||||
$logaction->created_at = date("Y-m-d H:i:s");
|
||||
|
||||
if (Input::has('rtd_location_id')) {
|
||||
@@ -1370,7 +1588,7 @@ class AssetsController extends Controller
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
//echo '<li>'.$asset;
|
||||
$update_array['deleted_at'] = date('Y-m-d h:i:s');
|
||||
$update_array['deleted_at'] = date('Y-m-d H:i:s');
|
||||
$update_array['assigned_to'] = null;
|
||||
|
||||
if (DB::table('assets')
|
||||
@@ -1378,8 +1596,8 @@ class AssetsController extends Controller
|
||||
->update($update_array)) {
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->item_type = Asset::class;
|
||||
$logaction->item_id = $asset->id;
|
||||
$logaction->created_at = date("Y-m-d H:i:s");
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$log = $logaction->logaction('deleted');
|
||||
@@ -1410,31 +1628,31 @@ class AssetsController extends Controller
|
||||
* @since [v2.0]
|
||||
* @return String JSON
|
||||
*/
|
||||
public function getDatatable($status = null)
|
||||
public function getDatatable(Request $request, $status = null)
|
||||
{
|
||||
|
||||
|
||||
$assets = Company::scopeCompanyables(Asset::select('assets.*'))->with('model', 'assigneduser', 'assigneduser.userloc', 'assetstatus', 'defaultLoc', 'assetlog', 'model', 'model.category', 'model.manufacturer', 'model.fieldset', 'assetstatus', 'assetloc', 'company')
|
||||
->Hardware();
|
||||
|
||||
if (Input::has('search')) {
|
||||
$assets = $assets->TextSearch(e(Input::get('search')));
|
||||
if ($request->has('search')) {
|
||||
$assets = $assets->TextSearch(e($request->get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
if ($request->has('offset')) {
|
||||
$offset = e($request->get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
if ($request->has('limit')) {
|
||||
$limit = e($request->get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
if (Input::has('order_number')) {
|
||||
$assets->where('order_number', '=', e(Input::get('order_number')));
|
||||
if ($request->has('order_number')) {
|
||||
$assets->where('order_number', '=', e($request->get('order_number')));
|
||||
}
|
||||
|
||||
switch ($status) {
|
||||
@@ -1459,9 +1677,14 @@ class AssetsController extends Controller
|
||||
case 'Deployed':
|
||||
$assets->Deployed();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ($request->has('status_id')) {
|
||||
$assets->where('status_id','=', e($request->get('status_id')));
|
||||
}
|
||||
|
||||
|
||||
|
||||
$allowed_columns = [
|
||||
'id',
|
||||
'name',
|
||||
@@ -1491,8 +1714,8 @@ class AssetsController extends Controller
|
||||
$allowed_columns[]=$field->db_column_name();
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'asset_tag';
|
||||
$order = $request->get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'asset_tag';
|
||||
|
||||
switch ($sort) {
|
||||
case 'model':
|
||||
@@ -1531,23 +1754,42 @@ class AssetsController extends Controller
|
||||
$rows = array();
|
||||
foreach ($assets as $asset) {
|
||||
$inout = '';
|
||||
$actions = '';
|
||||
$actions = '<div style="white-space: nowrap;">';
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
if (Gate::allows('assets.create')) {
|
||||
$actions .= '<a href="' . route('clone/hardware',
|
||||
$asset->id) . '" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> ';
|
||||
}
|
||||
if (Gate::allows('assets.edit')) {
|
||||
$actions .= '<a href="' . route('update/hardware',
|
||||
$asset->id) . '" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
}
|
||||
if (Gate::allows('assets.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/hardware',
|
||||
$asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->asset_tag) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
} elseif ($asset->model->deleted_at=='') {
|
||||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" title="Restore asset" data-toggle="tooltip" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
$actions .= '<a href="'.route('restore/hardware', $asset->id).'" title="Restore asset" data-toggle="tooltip" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if (($asset->assetstatus->deployable != 0) && ($asset->deleted_at=='')) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">'.trans('general.checkin').'</a>';
|
||||
} else {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
$actions .= '</div>';
|
||||
|
||||
if (($asset->availableForCheckout()))
|
||||
{
|
||||
if (Gate::allows('assets.checkout')) {
|
||||
$inout = '<a href="' . route('checkout/hardware',
|
||||
$asset->id) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Gate::allows('assets.checkin')) {
|
||||
$inout = '<a href="' . route('checkin/hardware',
|
||||
$asset->id) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$purchase_cost = Helper::formatCurrencyOutput($asset->purchase_cost);
|
||||
|
||||
$row = array(
|
||||
'checkbox' =>'<div class="text-center"><input type="checkbox" name="edit_asset['.$asset->id.']" class="one_required"></div>',
|
||||
'id' => $asset->id,
|
||||
@@ -1559,11 +1801,11 @@ class AssetsController extends Controller
|
||||
'model_number' => ($asset->model && $asset->model->modelno) ? (string)$asset->model->modelno : '',
|
||||
'status_label' => ($asset->assigneduser) ? 'Deployed' : ((e($asset->assetstatus)) ? e($asset->assetstatus->name) : ''),
|
||||
'assigned_to' => ($asset->assigneduser) ? (string)link_to(config('app.url').'/admin/users/'.$asset->assigned_to.'/view', e($asset->assigneduser->fullName())) : '',
|
||||
'location' => (($asset->assigneduser) && ($asset->assigneduser->userloc!='')) ? (string)link_to('admin/settings/locations/'.$asset->assigneduser->userloc->id.'/view', e($asset->assigneduser->userloc->name)) : (($asset->defaultLoc!='') ? (string)link_to('admin/settings/locations/'.$asset->defaultLoc->id.'/edit', e($asset->defaultLoc->name)) : ''),
|
||||
'location' => (($asset->assigneduser) && ($asset->assigneduser->userloc!='')) ? (string)link_to('admin/settings/locations/'.$asset->assigneduser->userloc->id.'/view', e($asset->assigneduser->userloc->name)) : (($asset->defaultLoc!='') ? (string)link_to('admin/settings/locations/'.$asset->defaultLoc->id.'/view', e($asset->defaultLoc->name)) : ''),
|
||||
'category' => (($asset->model) && ($asset->model->category)) ?(string)link_to('/admin/settings/categories/'.$asset->model->category->id.'/view', e($asset->model->category->name)) : '',
|
||||
'manufacturer' => (($asset->model) && ($asset->model->manufacturer)) ? (string)link_to('/admin/settings/manufacturers/'.$asset->model->manufacturer->id.'/view', e($asset->model->manufacturer->name)) : '',
|
||||
'eol' => ($asset->eol_date()) ? $asset->eol_date() : '',
|
||||
'purchase_cost' => ($asset->purchase_cost) ? number_format($asset->purchase_cost, 2) : '',
|
||||
'purchase_cost' => $purchase_cost,
|
||||
'purchase_date' => ($asset->purchase_date) ? $asset->purchase_date : '',
|
||||
'notes' => e($asset->notes),
|
||||
'order_number' => ($asset->order_number!='') ? '<a href="'.config('app.url').'/hardware?order_number='.e($asset->order_number).'">'.e($asset->order_number).'</a>' : '',
|
||||
@@ -1575,9 +1817,36 @@ class AssetsController extends Controller
|
||||
'companyName' => is_null($asset->company) ? '' : e($asset->company->name)
|
||||
);
|
||||
foreach ($all_custom_fields as $field) {
|
||||
$row[$field->db_column_name()]=$asset->{$field->db_column_name()};
|
||||
$column_name = $field->db_column_name();
|
||||
|
||||
if ($field->isFieldDecryptable($asset->{$column_name})) {
|
||||
|
||||
if (Gate::allows('admin')) {
|
||||
if (($field->format=='URL') && ($asset->{$column_name}!='')) {
|
||||
$row[$column_name] = '<a href="'.Helper::gracefulDecrypt($field, $asset->{$column_name}).'" target="_blank">'.Helper::gracefulDecrypt($field, $asset->{$column_name}).'</a>';
|
||||
} else {
|
||||
$row[$column_name] = Helper::gracefulDecrypt($field, $asset->{$column_name});
|
||||
}
|
||||
|
||||
} else {
|
||||
$row[$field->db_column_name()] = strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||
}
|
||||
} else {
|
||||
if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) {
|
||||
$row[$field->db_column_name()] = '<a href="'.$asset->{$field->db_column_name()}.'" target="_blank">'.$asset->{$field->db_column_name()}.'</a>';
|
||||
} else {
|
||||
$row[$field->db_column_name()] = e($asset->{$field->db_column_name()});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$rows[]=$row;
|
||||
|
||||
if (($request->has('report')) && ($request->get('report')=='true')) {
|
||||
$rows[]= Helper::stripTagsFromJSON($row);
|
||||
} else {
|
||||
$rows[]= $row;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data = array('total'=>$assetCount, 'rows'=>$rows);
|
||||
@@ -1591,12 +1860,12 @@ class AssetsController extends Controller
|
||||
$users_list = Helper::usersList();
|
||||
// Filter out assets that are not deployable.
|
||||
$assets = Asset::RTD()->get();
|
||||
|
||||
|
||||
$assets_list = Company::scopeCompanyables($assets, 'assets.company_id')->lists('detailed_name', 'id')->toArray();
|
||||
|
||||
|
||||
return View::make('hardware/bulk-checkout')->with('users_list', $users_list)->with('assets_list', $assets_list);
|
||||
}
|
||||
|
||||
|
||||
public function postBulkCheckout(Request $request)
|
||||
{
|
||||
|
||||
@@ -1606,31 +1875,31 @@ class AssetsController extends Controller
|
||||
|
||||
$user = User::find(e(Input::get('assigned_to')));
|
||||
$admin = Auth::user();
|
||||
|
||||
|
||||
$asset_ids = array_filter(Input::get('selected_assets'));
|
||||
|
||||
|
||||
if ((Input::has('checkout_at')) && (Input::get('checkout_at')!= date("Y-m-d"))) {
|
||||
$checkout_at = e(Input::get('checkout_at'));
|
||||
} else {
|
||||
$checkout_at = date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
|
||||
if (Input::has('expected_checkin')) {
|
||||
$expected_checkin = e(Input::get('expected_checkin'));
|
||||
} else {
|
||||
$expected_checkin = '';
|
||||
}
|
||||
|
||||
|
||||
$has_errors = false;
|
||||
$errors = [];
|
||||
DB::transaction(function() use ($user, $admin, $checkout_at, $expected_checkin, $errors, $asset_ids)
|
||||
{
|
||||
{
|
||||
foreach($asset_ids as $asset_id)
|
||||
{
|
||||
$asset = Asset::find($asset_id);
|
||||
|
||||
|
||||
$error = $asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), null);
|
||||
|
||||
|
||||
if($error)
|
||||
{
|
||||
$has_errors = true;
|
||||
@@ -1638,12 +1907,12 @@ class AssetsController extends Controller
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (!$errors) {
|
||||
// Redirect to the new asset page
|
||||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.checkout.success'));
|
||||
}
|
||||
|
||||
|
||||
// Redirect to the asset management page with error
|
||||
return redirect()->to("hardware/bulk-checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class AuthController extends Controller
|
||||
LOG::debug("Creating local user ".Input::get('username'));
|
||||
|
||||
if ($newuser = Ldap::createUserFromLdap($userattr)) {
|
||||
LOG::debug("Local user created..");
|
||||
LOG::debug("Local user created.");
|
||||
} else {
|
||||
LOG::debug("Could not create local user.");
|
||||
}
|
||||
@@ -131,12 +131,21 @@ class AuthController extends Controller
|
||||
|
||||
LOG::debug("Valid LDAP login. Updating the local data.");
|
||||
|
||||
$user->password = bcrypt($request->input('password'));
|
||||
if (Setting::getSettings()->ldap_pw_sync=='1') {
|
||||
$user->password = bcrypt($request->input('password'));
|
||||
}
|
||||
|
||||
$user->email = $ldap_attr['email'];
|
||||
$user->first_name = $ldap_attr['firstname'];
|
||||
$user->last_name = $ldap_attr['lastname'];
|
||||
$user->save();
|
||||
|
||||
if (Setting::getSettings()->ldap_pw_sync!='1') {
|
||||
Auth::login($user, true);
|
||||
// Redirect to the users page
|
||||
return redirect()->to('/home')->with('success', trans('auth/message.signin.success'));
|
||||
}
|
||||
|
||||
} else {
|
||||
LOG::debug("User ".Input::get('username')." did not authenticate correctly against LDAP. Local user was not updated.");
|
||||
}// End LDAP auth
|
||||
@@ -146,14 +155,17 @@ class AuthController extends Controller
|
||||
// NO LDAP enabled - just try to login the user normally
|
||||
}
|
||||
|
||||
|
||||
LOG::debug("Authenticating user against database.");
|
||||
// Try to log the user in
|
||||
if (!Auth::attempt(Input::only('username', 'password'), Input::get('remember-me', 0))) {
|
||||
LOG::debug("Local authentication failed.");
|
||||
// throw new Cartalyst\Sentry\Users\UserNotFoundException();
|
||||
// throw new Cartalyst\Sentry\Users\UserNotFoundException();
|
||||
return redirect()->back()->withInput()->with('error', trans('auth/message.account_not_found'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get the page we were before
|
||||
$redirect = \Session::get('loginRedirect', 'home');
|
||||
|
||||
|
||||
@@ -37,4 +37,13 @@ class PasswordController extends Controller
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the e-mail subject line to be used for the reset link email.
|
||||
* Overriding method "getEmailSubject()" from trait "use ResetsPasswords"
|
||||
* @return string
|
||||
*/
|
||||
public function getEmailSubject(){
|
||||
return property_exists($this, 'subject') ? $this->subject : \Lang::get('mail.reset_link');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Category as Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\Setting;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Redirect;
|
||||
@@ -344,13 +345,13 @@ class CategoriesController extends Controller
|
||||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if ($asset->assetstatus->deployable != 0) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
} else {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
if ($asset->availableForCheckout()) {
|
||||
if (Gate::allows('assets.checkout')) {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
} else {
|
||||
if (Gate::allows('assets.checkin')) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ use Str;
|
||||
use View;
|
||||
use Validator;
|
||||
use Illuminate\Http\Request;
|
||||
use Gate;
|
||||
|
||||
/**
|
||||
* This class controls all actions related to Components for
|
||||
@@ -98,7 +99,7 @@ class ComponentsController extends Controller
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$component->purchase_cost = null;
|
||||
} else {
|
||||
$component->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$component->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$component->total_qty = e(Input::get('total_qty'));
|
||||
@@ -106,6 +107,7 @@ class ComponentsController extends Controller
|
||||
|
||||
// Was the component created?
|
||||
if ($component->save()) {
|
||||
$component->logCreate();
|
||||
// Redirect to the new component page
|
||||
return redirect()->to("admin/components")->with('success', trans('admin/components/message.create.success'));
|
||||
}
|
||||
@@ -182,7 +184,7 @@ class ComponentsController extends Controller
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$component->purchase_cost = null;
|
||||
} else {
|
||||
$component->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$component->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$component->total_qty = e(Input::get('total_qty'));
|
||||
@@ -344,17 +346,11 @@ class ComponentsController extends Controller
|
||||
$component->assets()->attach($component->id, array(
|
||||
'component_id' => $component->id,
|
||||
'user_id' => $admin_user->id,
|
||||
'created_at' => date('Y-m-d h:i:s'),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'assigned_qty' => e(Input::get('assigned_qty')),
|
||||
'asset_id' => $asset_id));
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->component_id = $component->id;
|
||||
$logaction->asset_id = $asset_id;
|
||||
$logaction->asset_type = 'component';
|
||||
$logaction->location_id = $asset->location_id;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction = $component->logCheckout(e(Input::get('note')), $asset_id);
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
@@ -374,7 +370,7 @@ class ComponentsController extends Controller
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'Checked Out:',
|
||||
'value' => strtoupper($logaction->asset_type).' <'.config('app.url').'/admin/components/'.$component->id.'/view'.'|'.$component->name.'> checked out to <'.config('app.url').'/hardware/'.$asset->id.'/view|'.$asset->name.'> by <'.config('app.url').'/admin/users/'.$admin_user->id.'/view'.'|'.$admin_user->fullName().'>.'
|
||||
'value' => class_basename(strtoupper($logaction->item_type)).' <'.config('app.url').'/admin/components/'.$component->id.'/view'.'|'.$component->name.'> checked out to <'.config('app.url').'/hardware/'.$asset->id.'/view|'.$asset->showAssetName().'> by <'.config('app.url').'/admin/users/'.$admin_user->id.'/view'.'|'.$admin_user->fullName().'>.'
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
@@ -388,9 +384,6 @@ class ComponentsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkout');
|
||||
|
||||
// Redirect to the new component page
|
||||
return redirect()->to("admin/components")->with('success', trans('admin/components/message.checkout.success'));
|
||||
|
||||
@@ -454,7 +447,23 @@ class ComponentsController extends Controller
|
||||
$rows = array();
|
||||
|
||||
foreach ($components as $component) {
|
||||
$actions = '<nobr><a href="'.route('checkout/component', $component->id).'" style="margin-right:5px;" class="btn btn-info btn-sm '.(($component->numRemaining() > 0 ) ? '' : ' disabled').'" '.(($component->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/component', $component->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/component', $component->id).'" data-content="'.trans('admin/components/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($component->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
$actions = '<nobr>';
|
||||
if (Gate::allows('components.checkout')) {
|
||||
$actions .= '<a href="' . route('checkout/component',
|
||||
$component->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm ' . (($component->numRemaining() > 0) ? '' : ' disabled') . '" ' . (($component->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
|
||||
if (Gate::allows('components.edit')) {
|
||||
$actions .= '<a href="' . route('update/component',
|
||||
$component->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if (Gate::allows('components.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/component',
|
||||
$component->id) . '" data-content="' . trans('admin/components/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($component->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
|
||||
$actions .='</nobr>';
|
||||
$company = $component->company;
|
||||
|
||||
$rows[] = array(
|
||||
@@ -467,7 +476,7 @@ class ComponentsController extends Controller
|
||||
'category' => ($component->category) ? e($component->category->name) : 'Missing category',
|
||||
'order_number' => e($component->order_number),
|
||||
'purchase_date' => e($component->purchase_date),
|
||||
'purchase_cost' => ($component->purchase_cost!='') ? number_format($component->purchase_cost, 2): '' ,
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost),
|
||||
'numRemaining' => $component->numRemaining(),
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : e($company->name),
|
||||
|
||||
@@ -18,6 +18,7 @@ use Redirect;
|
||||
use Slack;
|
||||
use Str;
|
||||
use View;
|
||||
use Gate;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Consumables for
|
||||
@@ -96,7 +97,7 @@ class ConsumablesController extends Controller
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = null;
|
||||
} else {
|
||||
$consumable->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$consumable->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
@@ -104,6 +105,7 @@ class ConsumablesController extends Controller
|
||||
|
||||
// Was the consumable created?
|
||||
if ($consumable->save()) {
|
||||
$consumable->logCreate();
|
||||
// Redirect to the new consumable page
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.create.success'));
|
||||
}
|
||||
@@ -181,10 +183,10 @@ class ConsumablesController extends Controller
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = null;
|
||||
} else {
|
||||
$consumable->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$consumable->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->qty = Helper::ParseFloat(e(Input::get('qty')));
|
||||
|
||||
if ($consumable->save()) {
|
||||
return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.update.success'));
|
||||
@@ -315,14 +317,7 @@ class ConsumablesController extends Controller
|
||||
'user_id' => $admin_user->id,
|
||||
'assigned_to' => e(Input::get('assigned_to'))));
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->consumable_id = $consumable->id;
|
||||
$logaction->checkedout_to = $consumable->assigned_to;
|
||||
$logaction->asset_type = 'consumable';
|
||||
$logaction->asset_id = 0;
|
||||
$logaction->location_id = $user->location_id;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction = $consumable->logCheckout(e(Input::get('note')));
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
@@ -342,7 +337,7 @@ class ConsumablesController extends Controller
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'Checked Out:',
|
||||
'value' => strtoupper($logaction->asset_type).' <'.config('app.url').'/admin/consumables/'.$consumable->id.'/view'.'|'.$consumable->name.'> checked out to <'.config('app.url').'/admin/users/'.$user->id.'/view|'.$user->fullName().'> by <'.config('app.url').'/admin/users/'.$admin_user->id.'/view'.'|'.$admin_user->fullName().'>.'
|
||||
'value' => 'Consumable <'.config('app.url').'/admin/consumables/'.$consumable->id.'/view'.'|'.$consumable->name.'> checked out to <'.config('app.url').'/admin/users/'.$user->id.'/view|'.$user->fullName().'> by <'.config('app.url').'/admin/users/'.$admin_user->id.'/view'.'|'.$admin_user->fullName().'>.'
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
@@ -356,9 +351,6 @@ class ConsumablesController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkout');
|
||||
|
||||
$consumable_user = DB::table('consumables_users')->where('assigned_to', '=', $consumable->assigned_to)->where('consumable_id', '=', $consumable->id)->first();
|
||||
|
||||
$data['log_id'] = $logaction->id;
|
||||
@@ -374,7 +366,8 @@ class ConsumablesController extends Controller
|
||||
|
||||
Mail::send('emails.accept-asset', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Confirm consumable delivery');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Confirm_consumable_delivery'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -444,7 +437,23 @@ class ConsumablesController extends Controller
|
||||
$rows = array();
|
||||
|
||||
foreach ($consumables as $consumable) {
|
||||
$actions = '<nobr><a href="'.route('checkout/consumable', $consumable->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($consumable->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/consumable', $consumable->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/consumable', $consumable->id).'" data-content="'.trans('admin/consumables/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($consumable->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
$actions = '<nobr>';
|
||||
if (Gate::allows('consumables.checkout')) {
|
||||
$actions .= '<a href="' . route('checkout/consumable',
|
||||
$consumable->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($consumable->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
|
||||
if (Gate::allows('consumables.edit')) {
|
||||
$actions .= '<a href="' . route('update/consumable',
|
||||
$consumable->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('consumables.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/consumable',
|
||||
$consumable->id) . '" data-content="' . trans('admin/consumables/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($consumable->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
|
||||
$actions .='</nobr>';
|
||||
|
||||
$company = $consumable->company;
|
||||
|
||||
$rows[] = array(
|
||||
@@ -453,13 +462,13 @@ class ConsumablesController extends Controller
|
||||
'location' => ($consumable->location) ? e($consumable->location->name) : '',
|
||||
'min_amt' => e($consumable->min_amt),
|
||||
'qty' => e($consumable->qty),
|
||||
'manufacturer' => ($consumable->manufacturer) ? e($consumable->manufacturer->name) : '',
|
||||
'model_no' => e($consumable->model_no),
|
||||
'item_no' => e($consumable->item_no),
|
||||
'category' => ($consumable->category) ? e($consumable->category->name) : 'Missing category',
|
||||
'manufacturer' => ($consumable->manufacturer) ? (string) link_to('/admin/settings/manufacturers/'.$consumable->manufacturer_id.'/view', $consumable->manufacturer->name): '',
|
||||
'model_no' => e($consumable->model_no),
|
||||
'item_no' => e($consumable->item_no),
|
||||
'category' => ($consumable->category) ? (string) link_to('/admin/settings/categories/'.$consumable->category_id.'/view', $consumable->category->name) : 'Missing category',
|
||||
'order_number' => e($consumable->order_number),
|
||||
'purchase_date' => e($consumable->purchase_date),
|
||||
'purchase_cost' => ($consumable->purchase_cost!='') ? number_format($consumable->purchase_cost, 2): '' ,
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost),
|
||||
'numRemaining' => $consumable->numRemaining(),
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : e($company->name),
|
||||
|
||||
@@ -10,6 +10,7 @@ use Redirect;
|
||||
use App\Models\AssetModel;
|
||||
use Lang;
|
||||
use Auth;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Custom Asset Fields for
|
||||
@@ -63,10 +64,15 @@ class CustomFieldsController extends Controller
|
||||
* @since [v1.8]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function store()
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$cfset=new CustomFieldset(["name" => Input::get("name"),"user_id" => Auth::user()->id]);
|
||||
$cfset = new CustomFieldset(
|
||||
[
|
||||
"name" => e($request->get("name")),
|
||||
"user_id" => Auth::user()->id]
|
||||
);
|
||||
|
||||
$validator=Validator::make(Input::all(), $cfset->rules);
|
||||
if ($validator->passes()) {
|
||||
$cfset->save();
|
||||
@@ -122,24 +128,33 @@ class CustomFieldsController extends Controller
|
||||
* @since [v1.8]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function storeField()
|
||||
public function storeField(Request $request)
|
||||
{
|
||||
$field=new CustomField(["name" => Input::get("name"),"element" => Input::get("element"),"user_id" => Auth::user()->id]);
|
||||
$field = new CustomField([
|
||||
"name" => e($request->get("name")),
|
||||
"element" => e($request->get("element")),
|
||||
"field_values" => e($request->get("field_values")),
|
||||
"field_encrypted" => e($request->get("field_encrypted", 0)),
|
||||
"user_id" => Auth::user()->id
|
||||
]);
|
||||
|
||||
|
||||
|
||||
if (!in_array(Input::get('format'), array_keys(CustomField::$PredefinedFormats))) {
|
||||
$field->format=Input::get("custom_format");
|
||||
$field->format = e($request->get("custom_format"));
|
||||
} else {
|
||||
$field->format=Input::get('format');
|
||||
$field->format = e($request->get("format"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
$validator=Validator::make(Input::all(), $field->rules);
|
||||
if ($validator->passes()) {
|
||||
$results=$field->save();
|
||||
//return "postCreateField: $results";
|
||||
$results = $field->save();
|
||||
if ($results) {
|
||||
return redirect()->route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.create.success'));
|
||||
} else {
|
||||
dd($field);
|
||||
return redirect()->back()->withInput()->with('error', trans('admin/custom_fields/message.field.create.error'));
|
||||
}
|
||||
} else {
|
||||
@@ -175,9 +190,7 @@ class CustomFieldsController extends Controller
|
||||
*/
|
||||
public function deleteField($field_id)
|
||||
{
|
||||
$field=CustomField::find($field_id);
|
||||
|
||||
|
||||
$field = CustomField::find($field_id);
|
||||
|
||||
if ($field->fieldset->count()>0) {
|
||||
return redirect()->back()->withErrors(['message' => "Field is in-use"]);
|
||||
|
||||
@@ -30,12 +30,6 @@ class DashboardController extends Controller
|
||||
// Show the page
|
||||
if (Auth::user()->hasAccess('admin')) {
|
||||
|
||||
$recent_activity = Actionlog::orderBy('created_at', 'DESC')
|
||||
->with('accessorylog', 'consumablelog', 'licenselog', 'assetlog', 'adminlog', 'userlog', 'componentlog')
|
||||
->take(30)
|
||||
->get();
|
||||
|
||||
|
||||
$asset_stats['total'] = Asset::Hardware()->count();
|
||||
|
||||
$asset_stats['rtd']['total'] = Asset::Hardware()->RTD()->count();
|
||||
@@ -82,7 +76,7 @@ class DashboardController extends Controller
|
||||
}
|
||||
|
||||
|
||||
return View::make('dashboard')->with('asset_stats', $asset_stats)->with('recent_activity', $recent_activity);
|
||||
return View::make('dashboard')->with('asset_stats', $asset_stats);
|
||||
} else {
|
||||
// Redirect to the profile page
|
||||
return redirect()->route('view-assets');
|
||||
|
||||
@@ -23,6 +23,7 @@ use Config;
|
||||
use Session;
|
||||
use App\Helpers\Helper;
|
||||
use Auth;
|
||||
use Gate;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Licenses for
|
||||
@@ -60,18 +61,17 @@ class LicensesController extends Controller
|
||||
public function getCreate()
|
||||
{
|
||||
|
||||
$depreciation_list = Helper::depreciationList();
|
||||
$supplier_list = Helper::suppliersList();
|
||||
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
|
||||
$company_list = Helper::companyList();
|
||||
|
||||
return View::make('licenses/edit')
|
||||
//->with('license_options',$license_options)
|
||||
->with('depreciation_list', $depreciation_list)
|
||||
->with('supplier_list', $supplier_list)
|
||||
->with('depreciation_list', Helper::depreciationList())
|
||||
->with('supplier_list', Helper::suppliersList())
|
||||
->with('maintained_list', $maintained_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('company_list', Helper::companyList())
|
||||
->with('manufacturer_list', Helper::manufacturerList())
|
||||
->with('license', new License);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -87,17 +87,13 @@ class LicensesController extends Controller
|
||||
public function postCreate()
|
||||
{
|
||||
|
||||
|
||||
// get the POST data
|
||||
$new = Input::all();
|
||||
|
||||
// create a new model instance
|
||||
$license = new License();
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '') {
|
||||
$license->purchase_cost = null;
|
||||
} else {
|
||||
$license->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$license->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('supplier_id')) == '') {
|
||||
@@ -124,6 +120,12 @@ class LicensesController extends Controller
|
||||
$license->purchase_order = e(Input::get('purchase_order'));
|
||||
}
|
||||
|
||||
if (empty(e(Input::get('manufacturer_id')))) {
|
||||
$license->manufacturer_id = null;
|
||||
} else {
|
||||
$license->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
}
|
||||
|
||||
// Save the license data
|
||||
$license->name = e(Input::get('name'));
|
||||
$license->serial = e(Input::get('serial'));
|
||||
@@ -153,7 +155,7 @@ class LicensesController extends Controller
|
||||
|
||||
// Was the license created?
|
||||
if ($license->save()) {
|
||||
|
||||
$license->logCreate();
|
||||
$insertedId = $license->id;
|
||||
// Save the license seat data
|
||||
DB::transaction(function () use (&$insertedId, &$license) {
|
||||
@@ -205,17 +207,15 @@ class LicensesController extends Controller
|
||||
|
||||
// Show the page
|
||||
$license_options = array('' => 'Top Level') + DB::table('assets')->where('id', '!=', $licenseId)->pluck('name', 'id');
|
||||
$depreciation_list = array('0' => trans('admin/licenses/form.no_depreciation')) + Depreciation::pluck('name', 'id')->toArray();
|
||||
$supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
|
||||
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
|
||||
$company_list = Helper::companyList();
|
||||
|
||||
return View::make('licenses/edit', compact('license'))
|
||||
->with('license_options', $license_options)
|
||||
->with('depreciation_list', $depreciation_list)
|
||||
->with('supplier_list', $supplier_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('maintained_list', $maintained_list);
|
||||
->with('depreciation_list', Helper::depreciationList())
|
||||
->with('supplier_list', Helper::suppliersList())
|
||||
->with('company_list', Helper::companyList())
|
||||
->with('maintained_list', $maintained_list)
|
||||
->with('manufacturer_list', Helper::manufacturerList());
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +252,13 @@ class LicensesController extends Controller
|
||||
$license->maintained = e(Input::get('maintained'));
|
||||
$license->reassignable = e(Input::get('reassignable'));
|
||||
|
||||
if (empty(e(Input::get('manufacturer_id')))) {
|
||||
$license->manufacturer_id = null;
|
||||
} else {
|
||||
$license->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
}
|
||||
|
||||
|
||||
if (e(Input::get('supplier_id')) == '') {
|
||||
$license->supplier_id = null;
|
||||
} else {
|
||||
@@ -278,10 +285,9 @@ class LicensesController extends Controller
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '') {
|
||||
$license->purchase_cost = null;
|
||||
$license->purchase_cost = null;
|
||||
} else {
|
||||
$license->purchase_cost = e(Input::get('purchase_cost'));
|
||||
//$license->purchase_cost = e(Input::get('purchase_cost'));
|
||||
$license->purchase_cost = Helper::ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
if (e(Input::get('maintained')) == '') {
|
||||
@@ -323,11 +329,11 @@ class LicensesController extends Controller
|
||||
|
||||
//Log the deletion of seats to the log
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $license->id;
|
||||
$logaction->asset_type = 'software';
|
||||
$logaction->item_type = License::class;
|
||||
$logaction->item_id = $license->id;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = abs($difference)." seats";
|
||||
$logaction->checkedout_to = null;
|
||||
$logaction->note = '-'.abs($difference)." seats";
|
||||
$logaction->target_id = null;
|
||||
$log = $logaction->logaction('delete seats');
|
||||
|
||||
} else {
|
||||
@@ -348,10 +354,11 @@ class LicensesController extends Controller
|
||||
|
||||
//Log the addition of license to the log.
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $license->id;
|
||||
$logaction->asset_type = 'software';
|
||||
$logaction->item_type = License::class;
|
||||
$logaction->item_id = $license->id;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = abs($difference)." seats";
|
||||
$logaction->note = '+'.abs($difference)." seats";
|
||||
$logaction->target_id = null;
|
||||
$log = $logaction->logaction('add seats');
|
||||
}
|
||||
$license->seats = e(Input::get('seats'));
|
||||
@@ -501,7 +508,7 @@ class LicensesController extends Controller
|
||||
}
|
||||
|
||||
|
||||
if (($asset->assigned_to!='') && (($asset->assigned_to!=$assigned_to)) && ($assigned_to!='') ) {
|
||||
if (($asset->assigned_to!='') && (($asset->assigned_to!=$assigned_to)) && ($assigned_to!='')) {
|
||||
return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.owner_doesnt_match_asset'));
|
||||
}
|
||||
|
||||
@@ -532,14 +539,10 @@ class LicensesController extends Controller
|
||||
// Was the asset updated?
|
||||
if ($licenseseat->save()) {
|
||||
|
||||
$logaction = new Actionlog();
|
||||
|
||||
//$logaction->location_id = $assigned_to->location_id;
|
||||
$logaction->asset_type = 'software';
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction->asset_id = $licenseseat->license_id;
|
||||
$licenseseat->logCheckout(e(Input::get('note')));
|
||||
|
||||
$data['license_id'] =$licenseseat->license_id;
|
||||
$data['note'] = e(Input::get('note'));
|
||||
|
||||
$license = License::find($licenseseat->license_id);
|
||||
$settings = Setting::getSettings();
|
||||
@@ -547,11 +550,9 @@ class LicensesController extends Controller
|
||||
|
||||
// Update the asset data
|
||||
if (e(Input::get('assigned_to')) == '') {
|
||||
$logaction->checkedout_to = null;
|
||||
$slack_msg = strtoupper($logaction->asset_type).' license <'.config('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.config('app.url').'/hardware/'.$asset->id.'/view|'.$asset->showAssetName().'> by <'.config('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.';
|
||||
$slack_msg = 'License <'.config('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.config('app.url').'/hardware/'.$asset->id.'/view|'.$asset->showAssetName().'> by <'.config('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.';
|
||||
} else {
|
||||
$logaction->checkedout_to = e(Input::get('assigned_to'));
|
||||
$slack_msg = strtoupper($logaction->asset_type).' license <'.config('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.config('app.url').'/admin/users/'.$user->id.'/view|'.$is_assigned_to->fullName().'> by <'.config('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.';
|
||||
$slack_msg = 'License <'.config('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.config('app.url').'/admin/users/'.$user->id.'/view|'.$is_assigned_to->fullName().'> by <'.config('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.';
|
||||
}
|
||||
|
||||
|
||||
@@ -577,7 +578,7 @@ class LicensesController extends Controller
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
'value' => e($logaction->note)
|
||||
'value' => e(Input::get('note'))
|
||||
],
|
||||
|
||||
|
||||
@@ -591,9 +592,6 @@ class LicensesController extends Controller
|
||||
|
||||
}
|
||||
|
||||
$log = $logaction->logaction('checkout');
|
||||
|
||||
|
||||
// Redirect to the new asset page
|
||||
return redirect()->to("admin/licenses")->with('success', trans('admin/licenses/message.checkout.success'));
|
||||
}
|
||||
@@ -672,8 +670,6 @@ class LicensesController extends Controller
|
||||
return redirect()->back()->withInput()->withErrors($validator);
|
||||
}
|
||||
$return_to = $licenseseat->assigned_to;
|
||||
$logaction = new Actionlog();
|
||||
$logaction->checkedout_to = $licenseseat->assigned_to;
|
||||
|
||||
// Update the asset data
|
||||
$licenseseat->assigned_to = null;
|
||||
@@ -683,11 +679,7 @@ class LicensesController extends Controller
|
||||
|
||||
// Was the asset updated?
|
||||
if ($licenseseat->save()) {
|
||||
$logaction->asset_id = $licenseseat->license_id;
|
||||
$logaction->location_id = null;
|
||||
$logaction->asset_type = 'software';
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction->user_id = $user->id;
|
||||
$licenseseat->logCheckin(e(Input::get('note')));
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
@@ -708,11 +700,11 @@ class LicensesController extends Controller
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'Checked In:',
|
||||
'value' => strtoupper($logaction->asset_type).' <'.config('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked in by <'.config('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.'
|
||||
'value' => 'License: <'.config('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked in by <'.config('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.'
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
'value' => e($logaction->note)
|
||||
'value' => e(Input::get('note'))
|
||||
],
|
||||
|
||||
]
|
||||
@@ -725,9 +717,6 @@ class LicensesController extends Controller
|
||||
}
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkin from');
|
||||
|
||||
|
||||
|
||||
if ($backto=='user') {
|
||||
return redirect()->to("admin/users/".$return_to.'/view')->with('success', trans('admin/licenses/message.checkin.success'));
|
||||
@@ -798,7 +787,8 @@ class LicensesController extends Controller
|
||||
->with('supplier_list', $supplier_list)
|
||||
->with('license', $license)
|
||||
->with('maintained_list', $maintained_list)
|
||||
->with('company_list', $company_list);
|
||||
->with('company_list', $company_list)
|
||||
->with('manufacturer_list', Helper::manufacturerList());
|
||||
|
||||
}
|
||||
|
||||
@@ -831,7 +821,7 @@ class LicensesController extends Controller
|
||||
foreach (Input::file('licensefile') as $file) {
|
||||
|
||||
$rules = array(
|
||||
'licensefile' => 'required|mimes:png,gif,jpg,jpeg,doc,docx,pdf,txt,zip,rar|max:2000'
|
||||
'licensefile' => 'required|mimes:png,gif,jpg,jpeg,doc,docx,pdf,txt,zip,rar,rtf|max:2000'
|
||||
);
|
||||
$validator = Validator::make(array('licensefile'=> $file), $rules);
|
||||
|
||||
@@ -842,16 +832,8 @@ class LicensesController extends Controller
|
||||
$filename .= '-'.str_slug($file->getClientOriginalName()).'.'.$extension;
|
||||
$upload_success = $file->move($destinationPath, $filename);
|
||||
|
||||
//Log the deletion of seats to the log
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $license->id;
|
||||
$logaction->asset_type = 'software';
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('notes'));
|
||||
$logaction->checkedout_to = null;
|
||||
$logaction->created_at = date("Y-m-d h:i:s");
|
||||
$logaction->filename = $filename;
|
||||
$log = $logaction->logaction('uploaded');
|
||||
//Log the upload to the log
|
||||
$license->logUpload($filename, e(Input::get('notes')));
|
||||
} else {
|
||||
return redirect()->back()->with('error', trans('admin/licenses/message.upload.invalidfiles'));
|
||||
}
|
||||
@@ -983,7 +965,27 @@ class LicensesController extends Controller
|
||||
$rows = array();
|
||||
|
||||
foreach ($licenses as $license) {
|
||||
$actions = '<span style="white-space: nowrap;"><a href="'.route('freecheckout/license', $license->id).'" class="btn btn-primary btn-sm'.(($license->remaincount() > 0) ? '' : ' disabled').'" style="margin-right:5px;">'.trans('general.checkout').'</a> <a href="'.route('clone/license', $license->id).'" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a><a href="'.route('update/license', $license->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/license', $license->id).'" data-content="'.trans('admin/licenses/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($license->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></span>';
|
||||
$actions = '<span style="white-space: nowrap;">';
|
||||
|
||||
if (Gate::allows('licenses.checkout')) {
|
||||
$actions .= '<a href="' . route('freecheckout/license', $license->id)
|
||||
. '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
|
||||
}
|
||||
|
||||
if (Gate::allows('licenses.create')) {
|
||||
$actions .= '<a href="' . route('clone/license', $license->id)
|
||||
. '" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone license"><i class="fa fa-files-o"></i></a>';
|
||||
}
|
||||
if (Gate::allows('licenses.edit')) {
|
||||
$actions .= '<a href="' . route('update/license', $license->id)
|
||||
. '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('licenses.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'
|
||||
. route('delete/license', $license->id)
|
||||
. '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
$actions .='</span>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $license->id,
|
||||
@@ -992,15 +994,16 @@ class LicensesController extends Controller
|
||||
'totalSeats' => $license->totalSeatsByLicenseID(),
|
||||
'remaining' => $license->remaincount(),
|
||||
'license_name' => e($license->license_name),
|
||||
'license_email' => e($license->license_email),
|
||||
'license_email' => e($license->license_email),
|
||||
'purchase_date' => ($license->purchase_date) ? $license->purchase_date : '',
|
||||
'expiration_date' => ($license->expiration_date) ? $license->expiration_date : '',
|
||||
'purchase_cost' => ($license->purchase_cost) ? number_format($license->purchase_cost, 2) : '',
|
||||
'purchase_cost' => Helper::formatCurrencyOutput($license->purchase_cost),
|
||||
'purchase_order' => ($license->purchase_order) ? e($license->purchase_order) : '',
|
||||
'order_number' => ($license->order_number) ? e($license->order_number) : '',
|
||||
'notes' => ($license->notes) ? e($license->notes) : '',
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($license->company) ? '' : e($license->company->name)
|
||||
'companyName' => is_null($license->company) ? '' : e($license->company->name),
|
||||
'manufacturer' => $license->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Manufacturer;
|
||||
use App\Models\Setting;
|
||||
use Auth;
|
||||
use Gate;
|
||||
use Input;
|
||||
use Lang;
|
||||
use App\Models\Manufacturer;
|
||||
use Redirect;
|
||||
use App\Models\Setting;
|
||||
use Str;
|
||||
use View;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Manufacturers for
|
||||
@@ -254,10 +255,27 @@ class ManufacturersController extends Controller
|
||||
* @since [v1.0]
|
||||
* @return String JSON
|
||||
*/
|
||||
public function getDataView($manufacturerId)
|
||||
public function getDataView($manufacturerId, $itemtype = null)
|
||||
{
|
||||
|
||||
$manufacturer = Manufacturer::with('assets.company')->find($manufacturerId);
|
||||
|
||||
switch ($itemtype) {
|
||||
case "assets":
|
||||
return $this->getDataAssetsView($manufacturer);
|
||||
case "licenses":
|
||||
return $this->getDataLicensesView($manufacturer);
|
||||
case "accessories":
|
||||
return $this->getDataAccessoriesView($manufacturer);
|
||||
case "consumables":
|
||||
return $this->getDataConsumablesView($manufacturer);
|
||||
}
|
||||
|
||||
throw new Exception("We shouldn't be here");
|
||||
|
||||
}
|
||||
|
||||
protected function getDataAssetsView(Manufacturer $manufacturer)
|
||||
{
|
||||
$manufacturer_assets = $manufacturer->assets;
|
||||
|
||||
if (Input::has('search')) {
|
||||
@@ -293,35 +311,213 @@ class ManufacturersController extends Controller
|
||||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if ($asset->assetstatus->deployable != 0) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
} else {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
if ($asset->availableForCheckout()) {
|
||||
if (Gate::allows('assets.checkout')) {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
|
||||
}
|
||||
} else {
|
||||
if (Gate::allows('assets.checkin')) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$row = array(
|
||||
'id' => $asset->id,
|
||||
'name' => (string)link_to('/hardware/'.$asset->id.'/view', e($asset->showAssetName())),
|
||||
'model' => e($asset->model->name),
|
||||
'asset_tag' => e($asset->asset_tag),
|
||||
'serial' => e($asset->serial),
|
||||
'assigned_to' => ($asset->assigneduser) ? (string)link_to('/admin/users/'.$asset->assigneduser->id.'/view', e($asset->assigneduser->fullName())): '',
|
||||
'actions' => $actions,
|
||||
'companyName' => e(Company::getName($asset)),
|
||||
);
|
||||
$rows[] = array(
|
||||
'id' => $asset->id,
|
||||
'name' => (string)link_to('/hardware/'.$asset->id.'/view', e($asset->showAssetName())),
|
||||
'model' => e($asset->model->name),
|
||||
'asset_tag' => e($asset->asset_tag),
|
||||
'serial' => e($asset->serial),
|
||||
'assigned_to' => ($asset->assigneduser) ? (string)link_to('/admin/users/'.$asset->assigneduser->id.'/view', e($asset->assigneduser->fullName())): '',
|
||||
'actions' => $actions,
|
||||
'companyName' => e(Company::getName($asset)),
|
||||
);
|
||||
|
||||
if (isset($inout)) {
|
||||
$row['change'] = $inout;
|
||||
if (isset($inout)) {
|
||||
$row['change'] = $inout;
|
||||
}
|
||||
}
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getDataLicensesView(Manufacturer $manufacturer)
|
||||
{
|
||||
$licenses = $manufacturer->licenses;
|
||||
|
||||
if (Input::has('search')) {
|
||||
$licenses = $licenses->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
$licenseCount = $licenses->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($licenses as $license) {
|
||||
$actions = '<span style="white-space: nowrap;">';
|
||||
|
||||
if (Gate::allows('licenses.checkout')) {
|
||||
$actions .= '<a href="' . route('freecheckout/license', $license->id)
|
||||
. '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
|
||||
}
|
||||
|
||||
if (Gate::allows('licenses.create')) {
|
||||
$actions .= '<a href="' . route('clone/license', $license->id)
|
||||
. '" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a>';
|
||||
}
|
||||
if (Gate::allows('licenses.edit')) {
|
||||
$actions .= '<a href="' . route('update/license', $license->id)
|
||||
. '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('licenses.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'
|
||||
. route('delete/license', $license->id)
|
||||
. '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
$actions .='</span>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $license->id,
|
||||
'name' => (string) link_to('/admin/licenses/'.$license->id.'/view', $license->name),
|
||||
'serial' => (string) link_to('/admin/licenses/'.$license->id.'/view', mb_strimwidth($license->serial, 0, 50, "...")),
|
||||
'totalSeats' => $license->totalSeatsByLicenseID(),
|
||||
'remaining' => $license->remaincount(),
|
||||
'license_name' => e($license->license_name),
|
||||
'license_email' => e($license->license_email),
|
||||
'purchase_date' => ($license->purchase_date) ? $license->purchase_date : '',
|
||||
'expiration_date' => ($license->expiration_date) ? $license->expiration_date : '',
|
||||
'purchase_cost' => ($license->purchase_cost) ? number_format($license->purchase_cost, 2) : '',
|
||||
'purchase_order' => ($license->purchase_order) ? e($license->purchase_order) : '',
|
||||
'order_number' => ($license->order_number) ? e($license->order_number) : '',
|
||||
'notes' => ($license->notes) ? e($license->notes) : '',
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($license->company) ? '' : e($license->company->name),
|
||||
'manufacturer' => $license->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$license->manufacturer_id.'/view', $license->manufacturer->name) : ''
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $licenseCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDataAccessoriesView(Manufacturer $manufacturer)
|
||||
{
|
||||
$accessories = $manufacturer->accessories;
|
||||
|
||||
if (Input::has('search')) {
|
||||
$accessories = $accessories->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$accessCount = $accessories->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($accessories as $accessory) {
|
||||
|
||||
$actions = '<nobr>';
|
||||
if (Gate::allows('accessories.checkout')) {
|
||||
$actions .= '<a href="' . route('checkout/accessory',
|
||||
$accessory->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($accessory->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
if (Gate::allows('accessories.edit')) {
|
||||
$actions .= '<a href="' . route('update/accessory',
|
||||
$accessory->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('accessories.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/accessory',
|
||||
$accessory->id) . '" data-content="' . trans('admin/accessories/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($accessory->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
$actions .= '</nobr>';
|
||||
$company = $accessory->company;
|
||||
|
||||
$rows[] = array(
|
||||
'name' => '<a href="'.url('admin/accessories/'.$accessory->id).'/view">'. $accessory->name.'</a>',
|
||||
'category' => ($accessory->category) ? (string)link_to('admin/settings/categories/'.$accessory->category->id.'/view', $accessory->category->name) : '',
|
||||
'qty' => e($accessory->qty),
|
||||
'order_number' => e($accessory->order_number),
|
||||
'min_amt' => e($accessory->min_amt),
|
||||
'location' => ($accessory->location) ? e($accessory->location->name): '',
|
||||
'purchase_date' => e($accessory->purchase_date),
|
||||
'purchase_cost' => number_format($accessory->purchase_cost, 2),
|
||||
'numRemaining' => $accessory->numRemaining(),
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : e($company->name),
|
||||
'manufacturer' => $accessory->manufacturer ? (string) link_to('/admin/settings/manufacturers/'.$accessory->manufacturer_id.'/view', $accessory->manufacturer->name) : ''
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$accessCount, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDataConsumablesView($manufacturer)
|
||||
{
|
||||
$consumables = $manufacturer->consumables;
|
||||
|
||||
if (Input::has('search')) {
|
||||
$consumables = $consumables->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$consumCount = $consumables->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($consumables as $consumable) {
|
||||
$actions = '<nobr>';
|
||||
if (Gate::allows('consumables.checkout')) {
|
||||
$actions .= '<a href="' . route('checkout/consumable',
|
||||
$consumable->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($consumable->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
|
||||
}
|
||||
|
||||
if (Gate::allows('consumables.edit')) {
|
||||
$actions .= '<a href="' . route('update/consumable',
|
||||
$consumable->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
|
||||
}
|
||||
if (Gate::allows('consumables.delete')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/consumable',
|
||||
$consumable->id) . '" data-content="' . trans('admin/consumables/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($consumable->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
}
|
||||
|
||||
$actions .='</nobr>';
|
||||
|
||||
$company = $consumable->company;
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $consumable->id,
|
||||
'name' => (string)link_to('admin/consumables/'.$consumable->id.'/view', e($consumable->name)),
|
||||
'location' => ($consumable->location) ? e($consumable->location->name) : '',
|
||||
'min_amt' => e($consumable->min_amt),
|
||||
'qty' => e($consumable->qty),
|
||||
'manufacturer' => ($consumable->manufacturer) ? (string) link_to('/admin/settings/manufacturers/'.$consumable->manufacturer_id.'/view', $consumable->manufacturer->name): '',
|
||||
'model_no' => e($consumable->model_no),
|
||||
'item_no' => e($consumable->item_no),
|
||||
'category' => ($consumable->category) ? (string) link_to('/admin/settings/categories/'.$consumable->category_id.'/view', $consumable->category->name) : 'Missing category',
|
||||
'order_number' => e($consumable->order_number),
|
||||
'purchase_date' => e($consumable->purchase_date),
|
||||
'purchase_cost' => ($consumable->purchase_cost!='') ? number_format($consumable->purchase_cost, 2): '' ,
|
||||
'numRemaining' => $consumable->numRemaining(),
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : e($company->name),
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $consumCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class ProfileController extends Controller
|
||||
|
||||
if (Input::file('avatar')) {
|
||||
$image = Input::file('avatar');
|
||||
$file_name = $user->first_name."-".$user->last_name.".".$image->getClientOriginalExtension();
|
||||
$file_name = str_slug($user->first_name."-".$user->last_name).".".$image->getClientOriginalExtension();
|
||||
$path = public_path('uploads/avatars/'.$file_name);
|
||||
Image::make($image->getRealPath())->resize(84, 84)->save($path);
|
||||
$user->avatar = $file_name;
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Accessory;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetMaintenance;
|
||||
use Carbon\Carbon;
|
||||
use Category;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\Company;
|
||||
use App\Models\CustomField;
|
||||
use App\Models\License;
|
||||
use App\Models\Location;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Input;
|
||||
use League\Csv\Reader;
|
||||
use App\Models\License;
|
||||
use App\Models\Location;
|
||||
use App\Models\AssetModel;
|
||||
use Redirect;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Reports for
|
||||
@@ -31,7 +33,7 @@ class ReportsController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns a view that displaysthe accessories report.
|
||||
* Returns a view that displays the accessories report.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
@@ -87,7 +89,7 @@ class ReportsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display asset report.
|
||||
* Display asset report view.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
@@ -96,23 +98,11 @@ class ReportsController extends Controller
|
||||
public function getAssetsReport()
|
||||
{
|
||||
$settings = \App\Models\Setting::first();
|
||||
// Grab all the assets
|
||||
$assets = Asset::with(
|
||||
'model',
|
||||
'assigneduser.userLoc',
|
||||
'assetstatus',
|
||||
'defaultLoc',
|
||||
'assetlog',
|
||||
'supplier',
|
||||
'model.manufacturer',
|
||||
'company'
|
||||
)
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
return View::make('reports/asset', compact('assets'))->with('settings', $settings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Exports the assets to CSV
|
||||
*
|
||||
@@ -122,103 +112,76 @@ class ReportsController extends Controller
|
||||
*/
|
||||
public function exportAssetReport()
|
||||
{
|
||||
// Grab all the assets
|
||||
$assets = Asset::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
$rows = [ ];
|
||||
\Debugbar::disable();
|
||||
|
||||
// Create the header row
|
||||
$header = [
|
||||
trans('admin/hardware/table.asset_tag'),
|
||||
trans('admin/hardware/form.manufacturer'),
|
||||
trans('admin/hardware/form.model'),
|
||||
trans('general.model_no'),
|
||||
trans('general.name'),
|
||||
trans('admin/hardware/table.serial'),
|
||||
trans('general.status'),
|
||||
trans('admin/hardware/table.purchase_date'),
|
||||
trans('admin/hardware/table.purchase_cost'),
|
||||
trans('admin/hardware/form.order'),
|
||||
trans('admin/hardware/form.supplier'),
|
||||
trans('admin/hardware/table.checkoutto'),
|
||||
trans('admin/hardware/table.location'),
|
||||
trans('general.notes'),
|
||||
];
|
||||
$header = array_map('trim', $header);
|
||||
$rows[] = implode($header, ',');
|
||||
$customfields = CustomField::get();
|
||||
|
||||
// Create a row per asset
|
||||
foreach ($assets as $asset) {
|
||||
$row = [ ];
|
||||
$row[] = e($asset->asset_tag);
|
||||
if ($asset->model->manufacturer) {
|
||||
$row[] = e($asset->model->manufacturer->name);
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
$row[] = '"' . e($asset->model->name) . '"';
|
||||
$row[] = '"' . e($asset->model->modelno) . '"';
|
||||
$row[] = e($asset->name);
|
||||
$row[] = e($asset->serial);
|
||||
if ($asset->assetstatus) {
|
||||
$row[] = e($asset->assetstatus->name);
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
$row[] = $asset->purchase_date;
|
||||
$row[] = '"' . number_format($asset->purchase_cost, 2) . '"';
|
||||
if ($asset->order_number) {
|
||||
$row[] = e($asset->order_number);
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
if ($asset->supplier_id) {
|
||||
$row[] = e($asset->supplier->name);
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
$response = new StreamedResponse(function() use ($customfields) {
|
||||
// Open output stream
|
||||
$handle = fopen('php://output', 'w');
|
||||
|
||||
if ($asset->assigned_to > 0) {
|
||||
$user = User::find($asset->assigned_to);
|
||||
$row[] = e($user->fullName());
|
||||
} else {
|
||||
$row[] = ''; // Empty string if unassigned
|
||||
}
|
||||
|
||||
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
|
||||
$location = Location::find($asset->assigneduser->location_id);
|
||||
if ($location) {
|
||||
$row[] = e($location->name);
|
||||
} else {
|
||||
$row[] = '';
|
||||
Asset::with('assigneduser', 'assetloc','defaultLoc','assigneduser.userloc','model','supplier','assetstatus','model.manufacturer')->orderBy('created_at', 'DESC')->chunk(500, function($assets) use($handle, $customfields) {
|
||||
$headers=[
|
||||
trans('general.company'),
|
||||
trans('admin/hardware/table.asset_tag'),
|
||||
trans('admin/hardware/form.manufacturer'),
|
||||
trans('admin/hardware/form.model'),
|
||||
trans('general.model_no'),
|
||||
trans('general.name'),
|
||||
trans('admin/hardware/table.serial'),
|
||||
trans('general.status'),
|
||||
trans('admin/hardware/table.purchase_date'),
|
||||
trans('admin/hardware/table.purchase_cost'),
|
||||
trans('admin/hardware/form.order'),
|
||||
trans('admin/hardware/form.supplier'),
|
||||
trans('admin/hardware/table.checkoutto'),
|
||||
trans('admin/hardware/table.checkout_date'),
|
||||
trans('admin/hardware/table.location'),
|
||||
trans('general.notes'),
|
||||
];
|
||||
foreach($customfields as $field) {
|
||||
$headers[]=$field->name;
|
||||
}
|
||||
} elseif ($asset->rtd_location_id) {
|
||||
$location = Location::find($asset->rtd_location_id);
|
||||
if ($location->name) {
|
||||
$row[] = e($location->name);
|
||||
} else {
|
||||
$row[] = '';
|
||||
fputcsv($handle, $headers);
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
// Add a new row with data
|
||||
$values=[
|
||||
($asset->company) ? $asset->company->name : '',
|
||||
$asset->asset_tag,
|
||||
($asset->model->manufacturer) ? $asset->model->manufacturer->name : '',
|
||||
($asset->model) ? $asset->model->name : '',
|
||||
($asset->model->modelno) ? $asset->model->modelno : '',
|
||||
($asset->name) ? $asset->name : '',
|
||||
($asset->serial) ? $asset->serial : '',
|
||||
($asset->assetstatus) ? e($asset->assetstatus->name) : '',
|
||||
($asset->purchase_date) ? e($asset->purchase_date) : '',
|
||||
($asset->purchase_cost > 0) ? Helper::formatCurrencyOutput($asset->purchase_cost) : '',
|
||||
($asset->order_number) ? e($asset->order_number) : '',
|
||||
($asset->supplier) ? e($asset->supplier->name) : '',
|
||||
($asset->assigneduser) ? e($asset->assigneduser->fullName()) : '',
|
||||
($asset->last_checkout!='') ? e($asset->last_checkout) : '',
|
||||
($asset->assigneduser && $asset->assigneduser->userloc!='') ?
|
||||
e($asset->assigneduser->userloc->name) : ( ($asset->defaultLoc!='') ? e($asset->defaultLoc->name) : ''),
|
||||
($asset->notes) ? e($asset->notes) : '',
|
||||
];
|
||||
foreach($customfields as $field) {
|
||||
$values[]=$asset->{$field->db_column_name()};
|
||||
}
|
||||
fputcsv($handle, $values);
|
||||
}
|
||||
} else {
|
||||
$row[] = ''; // Empty string if location is not set
|
||||
}
|
||||
});
|
||||
|
||||
if ($asset->notes) {
|
||||
$row[] = '"' . e($asset->notes) . '"';
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
}
|
||||
|
||||
// spit out a csv
|
||||
$csv = implode($rows, "\n");
|
||||
$response = Response::make($csv, 200);
|
||||
$response->header('Content-Type', 'text/csv');
|
||||
$response->header('Content-disposition', 'attachment;filename=report.csv');
|
||||
// Close the output stream
|
||||
fclose($handle);
|
||||
}, 200, [
|
||||
'Content-Type' => 'text/csv',
|
||||
'Content-Disposition' => 'attachment; filename="assets-'.date('Y-m-d-his').'.csv"',
|
||||
]);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,9 +271,9 @@ class ReportsController extends Controller
|
||||
}
|
||||
|
||||
$row[] = $asset->purchase_date;
|
||||
$row[] = $currency . number_format($asset->purchase_cost, 2);
|
||||
$row[] = $currency . number_format($asset->getDepreciatedValue(), 2);
|
||||
$row[] = $currency . number_format(( $asset->purchase_cost - $asset->getDepreciatedValue() ), 2);
|
||||
$row[] = $currency . Helper::formatCurrencyOutput($asset->purchase_cost);
|
||||
$row[] = $currency . Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
||||
$row[] = $currency . Helper::formatCurrencyOutput(( $asset->purchase_cost - $asset->getDepreciatedValue() ));
|
||||
$csv->insertOne($row);
|
||||
}
|
||||
|
||||
@@ -329,11 +292,7 @@ class ReportsController extends Controller
|
||||
public function getActivityReport()
|
||||
{
|
||||
$log_actions = Actionlog::orderBy('created_at', 'DESC')
|
||||
->with('adminlog')
|
||||
->with('accessorylog')
|
||||
->with('assetlog')
|
||||
->with('licenselog')
|
||||
->with('userlog')
|
||||
->with('item')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
||||
@@ -341,16 +300,130 @@ class ReportsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays license report
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
* Returns Activity Report JSON.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getActivityReportDataTable()
|
||||
{
|
||||
$activitylogs = Company::scopeCompanyables(Actionlog::with('item', 'user', 'target'))->orderBy('created_at', 'DESC');
|
||||
|
||||
if (Input::has('search')) {
|
||||
$activity = $activity->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
|
||||
$allowed_columns = ['created_at'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
|
||||
|
||||
|
||||
$activityCount = $activitylogs->count();
|
||||
// dd("Offset:" . $offset . " Limit " . $limit);
|
||||
$activitylogs = $activitylogs->offset($offset)->limit($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
foreach ($activitylogs as $activity) {
|
||||
|
||||
if ($activity->itemType() == "asset") {
|
||||
$activity_icons = '<i class="fa fa-barcode"></i>';
|
||||
} elseif ($activity->itemType() == "accessory") {
|
||||
$activity_icons = '<i class="fa fa-keyboard-o"></i>';
|
||||
} elseif ($activity->itemType()=="consumable") {
|
||||
$activity_icons = '<i class="fa fa-tint"></i>';
|
||||
} elseif ($activity->itemType()=="license"){
|
||||
$activity_icons = '<i class="fa fa-floppy-o"></i>';
|
||||
} elseif ($activity->itemType()=="component") {
|
||||
$activity_icons = '<i class="fa fa-hdd-o"></i>';
|
||||
} else {
|
||||
$activity_icons = '<i class="fa fa-paperclip"></i>';
|
||||
}
|
||||
|
||||
if (($activity->item) && ($activity->itemType()=="asset")) {
|
||||
$activity_item = '<a href="'.route('view/hardware', $activity->item_id).'">'.e($activity->item->asset_tag).' - '. e($activity->item->showAssetName()).'</a>';
|
||||
$item_type = 'asset';
|
||||
} elseif ($activity->item()) {
|
||||
$activity_item = '<a href="'.route('view/'. $activity->itemType(), $activity->item_id).'">'.e($activity->item->name).'</a>';
|
||||
$item_type = $activity->itemType();
|
||||
} else {
|
||||
$activity_item = "unkonwn";
|
||||
$item_type = "null";
|
||||
}
|
||||
|
||||
|
||||
if (($activity->user) && ($activity->action_type=="uploaded") && ($activity->itemType()=="user")) {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->user->fullName().'</a>';
|
||||
} elseif ($activity->target_type === "App\Models\Asset") {
|
||||
if($activity->target) {
|
||||
$activity_target = '<a href="'.route('view/hardware', $activity->target_id).'">'.$activity->target->showAssetName().'</a>';
|
||||
} else {
|
||||
$activity_target = "";
|
||||
}
|
||||
} elseif ( $activity->target_type === "App\Models\User") {
|
||||
if($activity->target) {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->target_id).'">'.$activity->target->fullName().'</a>';
|
||||
} else {
|
||||
$activity_target = '';
|
||||
}
|
||||
} elseif ($activity->action_type=='requested') {
|
||||
if ($activity->user) {
|
||||
$activity_target = '<a href="'.route('view/user', $activity->user_id).'">'.$activity->user->fullName().'</a>';
|
||||
} else {
|
||||
$activity_target = '';
|
||||
}
|
||||
} else {
|
||||
if($activity->target) {
|
||||
$activity_target = $activity->target->id;
|
||||
} else {
|
||||
$activity_target = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rows[] = array(
|
||||
'icon' => $activity_icons,
|
||||
'created_at' => date("M d, Y g:iA", strtotime($activity->created_at)),
|
||||
'action_type' => strtolower(trans('general.'.str_replace(' ','_',$activity->action_type))),
|
||||
'admin' => $activity->user ? (string) link_to('/admin/users/'.$activity->user_id.'/view', $activity->user->fullName()) : '',
|
||||
'target' => $activity_target,
|
||||
'item' => $activity_item,
|
||||
'item_type' => $item_type,
|
||||
'note' => e($activity->note),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$activityCount, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays license report
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
*/
|
||||
public function getLicenseReport()
|
||||
{
|
||||
|
||||
$licenses = License::orderBy('created_at', 'DESC')
|
||||
$licenses = License::with('depreciation')->orderBy('created_at', 'DESC')
|
||||
->with('company')
|
||||
->get();
|
||||
|
||||
@@ -377,6 +450,7 @@ class ReportsController extends Controller
|
||||
trans('admin/licenses/form.remaining_seats'),
|
||||
trans('admin/licenses/form.expiration'),
|
||||
trans('admin/licenses/form.date'),
|
||||
trans('admin/licenses/form.depreciation'),
|
||||
trans('admin/licenses/form.cost')
|
||||
];
|
||||
|
||||
@@ -392,7 +466,8 @@ class ReportsController extends Controller
|
||||
$row[] = $license->remaincount();
|
||||
$row[] = $license->expiration_date;
|
||||
$row[] = $license->purchase_date;
|
||||
$row[] = '"' . number_format($license->purchase_cost, 2) . '"';
|
||||
$row[] = ($license->depreciation!='') ? '' : e($license->depreciation->name);
|
||||
$row[] = '"' . Helper::formatCurrencyOutput($license->purchase_cost) . '"';
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
}
|
||||
@@ -415,25 +490,30 @@ class ReportsController extends Controller
|
||||
*/
|
||||
public function getCustomReport()
|
||||
{
|
||||
|
||||
return View::make('reports/custom');
|
||||
$customfields = CustomField::get();
|
||||
return View::make('reports/custom')->with('customfields', $customfields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the custom report to CSV
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ReportsController::getCustomReport() method that generates form view
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
* Exports the custom report to CSV
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ReportsController::getCustomReport() method that generates form view
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function postCustom()
|
||||
{
|
||||
$assets = Asset::orderBy('created_at', 'DESC')->get();
|
||||
$assets = Asset::orderBy('created_at', 'DESC')->with('company','assigneduser', 'assetloc','defaultLoc','assigneduser.userloc','model','supplier','assetstatus','model.manufacturer')->get();
|
||||
$customfields = CustomField::get();
|
||||
|
||||
$rows = [ ];
|
||||
$header = [ ];
|
||||
|
||||
if (e(Input::get('company')) == '1') {
|
||||
$header[] = 'Company Name';
|
||||
}
|
||||
|
||||
if (e(Input::get('asset_name')) == '1') {
|
||||
$header[] = 'Asset Name';
|
||||
}
|
||||
@@ -471,6 +551,9 @@ class ReportsController extends Controller
|
||||
if (e(Input::get('assigned_to')) == '1') {
|
||||
$header[] = 'Assigned To';
|
||||
}
|
||||
if (e(Input::get('username')) == '1') {
|
||||
$header[] = 'Username';
|
||||
}
|
||||
if (e(Input::get('status')) == '1') {
|
||||
$header[] = 'Status';
|
||||
}
|
||||
@@ -484,11 +567,23 @@ class ReportsController extends Controller
|
||||
$header[] = 'Diff';
|
||||
}
|
||||
|
||||
foreach ($customfields as $customfield) {
|
||||
if (e(Input::get($customfield->db_column_name())) == '1') {
|
||||
$header[] = $customfield->name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$header = array_map('trim', $header);
|
||||
$rows[] = implode($header, ',');
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
$row = [ ];
|
||||
|
||||
if (e(Input::get('company')) == '1') {
|
||||
$row[] = is_null($asset->company) ? '' : '"'.$asset->company->name.'"';
|
||||
}
|
||||
|
||||
if (e(Input::get('asset_name')) == '1') {
|
||||
$row[] = '"' .e($asset->name) . '"';
|
||||
}
|
||||
@@ -517,7 +612,7 @@ class ReportsController extends Controller
|
||||
$row[] = e($asset->purchase_date);
|
||||
}
|
||||
if (e(Input::get('purchase_cost')) == '1' && ( e(Input::get('depreciation')) != '1' )) {
|
||||
$row[] = '"' . number_format($asset->purchase_cost, 2) . '"';
|
||||
$row[] = '"' . Helper::formatCurrencyOutput($asset->purchase_cost) . '"';
|
||||
}
|
||||
if (e(Input::get('order')) == '1') {
|
||||
if ($asset->order_number) {
|
||||
@@ -533,15 +628,13 @@ class ReportsController extends Controller
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (e(Input::get('location')) == '1') {
|
||||
$show_loc = '';
|
||||
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id !='' )) {
|
||||
$location = Location::find($asset->assigneduser->location_id);
|
||||
if ($location) {
|
||||
$show_loc .= '"' .e($location->name). '"';
|
||||
} else {
|
||||
$show_loc .= 'User location '.$asset->assigneduser->location_id.' is invalid';
|
||||
}
|
||||
|
||||
|
||||
if (($asset->assigned_to > 0) && ($asset->assigneduser) && ($asset->assigneduser->location)) {
|
||||
$show_loc .= '"' .e($asset->assigneduser->location->name). '"';
|
||||
} elseif ($asset->rtd_location_id!='') {
|
||||
$location = Location::find($asset->rtd_location_id);
|
||||
if ($location) {
|
||||
@@ -554,14 +647,24 @@ class ReportsController extends Controller
|
||||
$row[] = $show_loc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (e(Input::get('assigned_to')) == '1') {
|
||||
if ($asset->assigned_to > 0) {
|
||||
$user = User::find($asset->assigned_to);
|
||||
$row[] = '"' .e($user->fullName()). '"';
|
||||
if ($asset->assigneduser) {
|
||||
$row[] = '"' .e($asset->assigneduser->fullName()). '"';
|
||||
} else {
|
||||
$row[] = ''; // Empty string if unassigned
|
||||
}
|
||||
}
|
||||
|
||||
if (e(Input::get('username')) == '1') {
|
||||
if ($asset->assigneduser) {
|
||||
$row[] = '"' .e($asset->assigneduser->username). '"';
|
||||
} else {
|
||||
$row[] = ''; // Empty string if unassigned
|
||||
}
|
||||
}
|
||||
|
||||
if (e(Input::get('status')) == '1') {
|
||||
if (( $asset->status_id == '0' ) && ( $asset->assigned_to == '0' )) {
|
||||
$row[] = trans('general.ready_to_deploy');
|
||||
@@ -584,10 +687,19 @@ class ReportsController extends Controller
|
||||
}
|
||||
if (e(Input::get('depreciation')) == '1') {
|
||||
$depreciation = $asset->getDepreciatedValue();
|
||||
$row[] = '"' . number_format($asset->purchase_cost, 2) . '"';
|
||||
$row[] = '"' . number_format($depreciation, 2) . '"';
|
||||
$row[] = '"' . number_format($asset->purchase_cost - $depreciation, 2) . '"';
|
||||
$row[] = '"' . Helper::formatCurrencyOutput($asset->purchase_cost) . '"';
|
||||
$row[] = '"' . Helper::formatCurrencyOutput($depreciation) . '"';
|
||||
$row[] = '"' . Helper::formatCurrencyOutput($asset->purchase_cost) . '"';
|
||||
}
|
||||
|
||||
foreach ($customfields as $customfield) {
|
||||
$column_name = $customfield->db_column_name();
|
||||
if (e(Input::get($customfield->db_column_name())) == '1') {
|
||||
$row[] = str_replace(",", "\,", $asset->$column_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
}
|
||||
|
||||
@@ -596,14 +708,15 @@ class ReportsController extends Controller
|
||||
$csv = implode($rows, "\n");
|
||||
$response = Response::make($csv, 200);
|
||||
$response->header('Content-Type', 'text/csv');
|
||||
$response->header('Content-disposition', 'attachment;filename=report.csv');
|
||||
$response->header('Content-disposition', 'attachment;filename='.date('Y-m-d-His').'-custom-asset-report.csv');
|
||||
|
||||
return $response;
|
||||
} else {
|
||||
return redirect()->to("reports/custom")
|
||||
->with('error', trans('admin/reports/message.error'));
|
||||
->with('error', trans('admin/reports/message.error'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getImprovementsReport
|
||||
@@ -640,6 +753,7 @@ class ReportsController extends Controller
|
||||
$rows = [ ];
|
||||
|
||||
$header = [
|
||||
trans('admin/hardware/table.asset_tag'),
|
||||
trans('admin/asset_maintenances/table.asset_name'),
|
||||
trans('admin/asset_maintenances/table.supplier_name'),
|
||||
trans('admin/asset_maintenances/form.asset_maintenance_type'),
|
||||
@@ -655,6 +769,7 @@ class ReportsController extends Controller
|
||||
|
||||
foreach ($assetMaintenances as $assetMaintenance) {
|
||||
$row = [ ];
|
||||
$row[] = str_replace(',', '', e($assetMaintenance->asset->asset_tag));
|
||||
$row[] = str_replace(',', '', e($assetMaintenance->asset->name));
|
||||
$row[] = str_replace(',', '', e($assetMaintenance->supplier->name));
|
||||
$row[] = e($assetMaintenance->improvement_type);
|
||||
@@ -668,7 +783,7 @@ class ReportsController extends Controller
|
||||
$improvementTime = intval($assetMaintenance->asset_maintenance_time);
|
||||
}
|
||||
$row[] = $improvementTime;
|
||||
$row[] = trans('general.currency') . number_format($assetMaintenance->cost, 2);
|
||||
$row[] = trans('general.currency') . Helper::formatCurrencyOutput($assetMaintenance->cost);
|
||||
$rows[] = implode($row, ',');
|
||||
}
|
||||
|
||||
|
||||
@@ -52,29 +52,18 @@ class SettingsController extends Controller
|
||||
|
||||
$protocol = array_key_exists('HTTPS', $_SERVER) && ( $_SERVER['HTTPS'] == "on") ? 'https://' : 'http://';
|
||||
|
||||
|
||||
$pageURL = $protocol;
|
||||
if ($_SERVER["SERVER_PORT"] != "80") {
|
||||
$main_page = $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
|
||||
$pageURL .= $main_page.$_SERVER["REQUEST_URI"];
|
||||
} else {
|
||||
$main_page = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
||||
$pageURL .= $main_page;
|
||||
$host = $_SERVER['SERVER_NAME'];
|
||||
if (($protocol === 'http://' && $_SERVER['SERVER_PORT'] != '80') || ($protocol === 'https://' && $_SERVER['SERVER_PORT'] != '443')) {
|
||||
$host .= ':' . $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
$pageURL = $protocol . $host . $_SERVER['REQUEST_URI'];
|
||||
|
||||
$start_settings['env_location'] = $pageURL.'../.env';
|
||||
$start_settings['url_valid'] = (config('app.url').'/setup' === $pageURL);
|
||||
|
||||
$start_settings['url_config'] = config('app.url');
|
||||
$start_settings['real_url'] = $pageURL;
|
||||
|
||||
if (config('app.url').'/setup'!=$pageURL) {
|
||||
$start_settings['url_valid']= false;
|
||||
} else {
|
||||
$start_settings['url_valid']= true;
|
||||
}
|
||||
|
||||
$start_settings['url_config']= config('app.url');
|
||||
$start_settings['real_url']= $pageURL;
|
||||
|
||||
$exposed_env = @file_get_contents($main_page.'/.env');
|
||||
$exposed_env = @file_get_contents($protocol . $host.'/.env');
|
||||
|
||||
if ($exposed_env) {
|
||||
$start_settings['env_exposed'] = true;
|
||||
@@ -147,7 +136,8 @@ class SettingsController extends Controller
|
||||
try {
|
||||
Mail::send('emails.test', [], function ($m) {
|
||||
$m->to(config('mail.from.address'), config('mail.from.name'));
|
||||
$m->subject('Test Email from Snipe-IT');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.test_email'));
|
||||
});
|
||||
return 'success';
|
||||
} catch (Exception $e) {
|
||||
@@ -195,11 +185,12 @@ class SettingsController extends Controller
|
||||
} else {
|
||||
$user->save();
|
||||
$settings->save();
|
||||
|
||||
|
||||
if (Input::get('email_creds')=='1') {
|
||||
Mail::send(['text' => 'emails.firstadmin'], $data, function ($m) use ($data) {
|
||||
$m->to($data['email'], $data['first_name']);
|
||||
$m->subject('Your Snipe-IT credentials');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.your_credentials'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -323,7 +314,7 @@ class SettingsController extends Controller
|
||||
$setting->logo = $file_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (config('app.lock_passwords')==false) {
|
||||
$setting->site_name = e(Input::get('site_name'));
|
||||
@@ -417,6 +408,7 @@ class SettingsController extends Controller
|
||||
$setting->ad_domain = e(Input::get('ad_domain'));
|
||||
$setting->is_ad = e(Input::get('is_ad', '0'));
|
||||
$setting->ldap_tls = e(Input::get('ldap_tls', '0'));
|
||||
$setting->ldap_pw_sync = e(Input::get('ldap_pw_sync', '0'));
|
||||
|
||||
// If validation fails, we'll exit the operation now.
|
||||
if ($setting->save()) {
|
||||
@@ -481,7 +473,7 @@ class SettingsController extends Controller
|
||||
|
||||
}
|
||||
closedir($handle);
|
||||
$files = array_reverse($files);
|
||||
rsort($files);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,23 +47,32 @@ class StatuslabelsController extends Controller
|
||||
{
|
||||
$colors = [];
|
||||
|
||||
$statuslabels = Statuslabel::get();
|
||||
$statuslabels = Statuslabel::with('assets')->get();
|
||||
$labels=[];
|
||||
$points=[];
|
||||
|
||||
$colors=[];
|
||||
foreach ($statuslabels as $statuslabel) {
|
||||
$labels[]=$statuslabel->name;
|
||||
$points[]=$statuslabel->assets()->whereNull('assigned_to')->count();
|
||||
if ($statuslabel->assets->count() > 0) {
|
||||
$labels[]=$statuslabel->name;
|
||||
$points[]=$statuslabel->assets()->whereNull('assigned_to')->count();
|
||||
if ($statuslabel->color!='') {
|
||||
$colors[]=$statuslabel->color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$labels[]='Deployed';
|
||||
$points[]=Asset::whereNotNull('assigned_to')->count();
|
||||
|
||||
$colors_array = array_merge($colors, Helper::chartColors());
|
||||
|
||||
$result= [
|
||||
"labels" => $labels,
|
||||
"datasets" => [ [
|
||||
"data" => $points,
|
||||
"backgroundColor" => Helper::chartColors(),
|
||||
"hoverBackgroundColor" => Helper::chartColors()
|
||||
"backgroundColor" => $colors_array,
|
||||
"hoverBackgroundColor" => $colors_array
|
||||
]]
|
||||
];
|
||||
return $result;
|
||||
@@ -110,6 +119,8 @@ class StatuslabelsController extends Controller
|
||||
$statuslabel->deployable = $statustype['deployable'];
|
||||
$statuslabel->pending = $statustype['pending'];
|
||||
$statuslabel->archived = $statustype['archived'];
|
||||
$statuslabel->color = e(Input::get('color'));
|
||||
$statuslabel->show_in_nav = e(Input::get('show_in_nav'),0);
|
||||
|
||||
|
||||
// Was the asset created?
|
||||
@@ -197,6 +208,8 @@ class StatuslabelsController extends Controller
|
||||
$statuslabel->deployable = $statustype['deployable'];
|
||||
$statuslabel->pending = $statustype['pending'];
|
||||
$statuslabel->archived = $statustype['archived'];
|
||||
$statuslabel->color = e(Input::get('color'));
|
||||
$statuslabel->show_in_nav = e(Input::get('show_in_nav'),0);
|
||||
|
||||
|
||||
// Was the asset created?
|
||||
@@ -247,7 +260,7 @@ class StatuslabelsController extends Controller
|
||||
|
||||
public function getDatatable()
|
||||
{
|
||||
$statuslabels = Statuslabel::select(array('id','name','deployable','pending','archived'))
|
||||
$statuslabels = Statuslabel::select(array('id','name','deployable','pending','archived','color','show_in_nav'))
|
||||
->whereNull('deleted_at');
|
||||
|
||||
if (Input::has('search')) {
|
||||
@@ -291,10 +304,19 @@ class StatuslabelsController extends Controller
|
||||
|
||||
$actions = '<a href="'.route('update/statuslabel', $statuslabel->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/statuslabel', $statuslabel->id).'" data-content="'.trans('admin/statuslabels/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($statuslabel->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
|
||||
if ($statuslabel->color!='') {
|
||||
$color = '<div class="pull-left" style="margin-right: 5px; height: 20px; width: 20px; background-color: '.e($statuslabel->color).'"></div>'.e($statuslabel->color);
|
||||
} else {
|
||||
$color = '';
|
||||
}
|
||||
|
||||
|
||||
$rows[] = array(
|
||||
'id' => e($statuslabel->id),
|
||||
'type' => e($label_type),
|
||||
'name' => e($statuslabel->name),
|
||||
'color' => $color,
|
||||
'show_in_nav' => ($statuslabel->show_in_nav=='1') ? trans('general.yes') : trans('general.no'),
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Models\Setting;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Http\Requests\SaveUserRequest;
|
||||
use App\Http\Requests\UpdateUserRequest;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use App\Models\User;
|
||||
use App\Models\Ldap;
|
||||
use Auth;
|
||||
@@ -81,6 +82,7 @@ class UsersController extends Controller
|
||||
|
||||
$permissions = config('permissions');
|
||||
$userPermissions = Helper::selectedPermissionsArray($permissions, Input::old('permissions', array()));
|
||||
$permissions = $this->filterDisplayable($permissions);
|
||||
|
||||
$location_list = Helper::locationsList();
|
||||
$manager_list = Helper::managerList();
|
||||
@@ -157,7 +159,8 @@ class UsersController extends Controller
|
||||
|
||||
Mail::send('emails.send-login', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Welcome ' . $user->first_name);
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.welcome', ['name' => $user->first_name]));
|
||||
});
|
||||
}
|
||||
return redirect::route('users')->with('success', trans('admin/users/message.success.create'));
|
||||
@@ -209,7 +212,8 @@ class UsersController extends Controller
|
||||
|
||||
Mail::send('emails.send-login', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Welcome ' . $user->first_name);
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.welcome', ['name' => $user->first_name]));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -231,6 +235,17 @@ class UsersController extends Controller
|
||||
* @param int $id
|
||||
* @return View
|
||||
*/
|
||||
|
||||
private function filterDisplayable($permissions) {
|
||||
$output = null;
|
||||
foreach($permissions as $key=>$permission) {
|
||||
$output[$key] = array_filter($permission, function($p) {
|
||||
return $p['display'] === true;
|
||||
});
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function getEdit($id = null)
|
||||
{
|
||||
try {
|
||||
@@ -247,7 +262,7 @@ class UsersController extends Controller
|
||||
$userGroups = $user->groups()->pluck('name', 'id');
|
||||
$user->permissions = $user->decodePermissions();
|
||||
$userPermissions = Helper::selectedPermissionsArray($permissions, $user->permissions);
|
||||
|
||||
$permissions = $this->filterDisplayable($permissions);
|
||||
$location_list = Helper::locationsList();
|
||||
$company_list = Helper::companyList();
|
||||
$manager_list = Helper::managerList();
|
||||
@@ -280,7 +295,6 @@ class UsersController extends Controller
|
||||
// permissions here before we update the user.
|
||||
$permissions = $request->input('permissions', array());
|
||||
app('request')->request->set('permissions', $permissions);
|
||||
|
||||
// Only update the email address if locking is set to false
|
||||
if (config('app.lock_passwords')) {
|
||||
return redirect()->route('users')->with('error', 'Denied! You cannot update user information on the demo.');
|
||||
@@ -331,7 +345,6 @@ class UsersController extends Controller
|
||||
$user->notes = e($request->input('notes'));
|
||||
$user->permissions = json_encode($request->input('permission'));
|
||||
|
||||
|
||||
if ($user->manager_id == "") {
|
||||
$user->manager_id = null;
|
||||
}
|
||||
@@ -495,9 +508,10 @@ class UsersController extends Controller
|
||||
|
||||
// Update the asset log
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->checkedout_to = $asset->assigned_to;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->item_id = $asset->id;
|
||||
$logaction->item_type = Asset::class;
|
||||
$logaction->target_id = $asset->assigned_to;
|
||||
$logaction->target_type = User::class;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = 'Bulk checkin asset and delete user';
|
||||
$logaction->logaction('checkin from');
|
||||
@@ -514,9 +528,10 @@ class UsersController extends Controller
|
||||
$accessory_array[] = $accessory->accessory_id;
|
||||
// Update the asset log
|
||||
$logaction = new Actionlog();
|
||||
$logaction->accessory_id = $accessory->id;
|
||||
$logaction->checkedout_to = $accessory->assigned_to;
|
||||
$logaction->asset_type = 'accessory';
|
||||
$logaction->item_id = $accessory->id;
|
||||
$logaction->item_type = Accessory::class;
|
||||
$logaction->target_id = $accessory->assigned_to;
|
||||
$logaction->target_type = User::class;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = 'Bulk checkin accessory and delete user';
|
||||
$logaction->logaction('checkin from');
|
||||
@@ -528,9 +543,10 @@ class UsersController extends Controller
|
||||
$license_array[] = $license->id;
|
||||
// Update the asset log
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $license->id;
|
||||
$logaction->checkedout_to = $license->assigned_to;
|
||||
$logaction->asset_type = 'software';
|
||||
$logaction->item_id = $license->id;
|
||||
$logaction->item_type = License::class;
|
||||
$logaction->target_id = $license->assigned_to;
|
||||
$logaction->target_type = User::class;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = 'Bulk checkin license and delete user';
|
||||
$logaction->logaction('checkin from');
|
||||
@@ -598,7 +614,7 @@ class UsersController extends Controller
|
||||
|
||||
$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($userId);
|
||||
|
||||
$userlog = $user->userlog->load('assetlog', 'consumablelog', 'assetlog.model', 'licenselog', 'accessorylog', 'userlog', 'adminlog');
|
||||
$userlog = $user->userlog->load('item');
|
||||
|
||||
if (isset($user->id)) {
|
||||
|
||||
@@ -809,7 +825,7 @@ class UsersController extends Controller
|
||||
'phone' => trim(e($row[5])),
|
||||
'jobtitle' => trim(e($row[6])),
|
||||
'employee_num' => trim(e($row[7])),
|
||||
//'company_id' => Company::getIdForUser($row[8]),
|
||||
'company_id' => Company::getIdForUser($row[8]),
|
||||
'permissions' => '{"user":1}',
|
||||
'notes' => 'Imported user'
|
||||
);
|
||||
@@ -829,7 +845,8 @@ class UsersController extends Controller
|
||||
if ($newuser['email']) {
|
||||
Mail::send('emails.send-login', $data, function ($m) use ($newuser) {
|
||||
$m->to($newuser['email'], $newuser['first_name'] . ' ' . $newuser['last_name']);
|
||||
$m->subject('Welcome ' . $newuser['first_name']);
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.welcome', ['name' => $newuser['first_name']]));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -876,7 +893,7 @@ class UsersController extends Controller
|
||||
}
|
||||
|
||||
$users = User::select(array('users.id','users.employee_num','users.email','users.username','users.location_id','users.manager_id','users.first_name','users.last_name','users.created_at','users.notes','users.company_id', 'users.deleted_at','users.activated'))
|
||||
->with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'groups', 'userloc', 'company');
|
||||
->with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'groups', 'userloc', 'company','throttle');
|
||||
$users = Company::scopeCompanyables($users);
|
||||
|
||||
switch ($status) {
|
||||
@@ -923,32 +940,39 @@ class UsersController extends Controller
|
||||
$group_names .= '<a href="' . config('app.url') . '/admin/groups/' . $group->id . '/edit" class="label label-default">' . $group->name . '</a> ';
|
||||
}
|
||||
|
||||
if (Gate::allows('users:edit')) {
|
||||
if (!is_null($user->deleted_at)) {
|
||||
|
||||
$actions .= '<a href="' . route('restore/user',
|
||||
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
|
||||
if (!is_null($user->deleted_at)) {
|
||||
if (Gate::allows('users.delete')) {
|
||||
$actions .= '<a href="' . route('restore/user',
|
||||
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($user->accountStatus() == 'suspended') {
|
||||
$actions .= '<a href="' . route('unsuspend/user',
|
||||
$user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
|
||||
if (Gate::allows('users.delete')) {
|
||||
if ($user->accountStatus() == 'suspended') {
|
||||
$actions .= '<a href="' . route('unsuspend/user',
|
||||
$user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
|
||||
}
|
||||
}
|
||||
if (Gate::allows('users.edit')) {
|
||||
$actions .= '<a href="' . route('update/user',
|
||||
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
|
||||
$actions .= '<a href="' . route('update/user',
|
||||
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
|
||||
$actions .= '<a href="' . route('clone/user',
|
||||
$user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
|
||||
|
||||
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user',
|
||||
$user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||
$actions .= '<a href="' . route('clone/user',
|
||||
$user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
|
||||
}
|
||||
if (Gate::allows('users.delete')) {
|
||||
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user',
|
||||
$user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||
} else {
|
||||
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
|
||||
}
|
||||
} else {
|
||||
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
|
||||
$actions.='foo';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$actions .= '</nobr>';
|
||||
|
||||
$rows[] = array(
|
||||
@@ -1010,12 +1034,12 @@ class UsersController extends Controller
|
||||
|
||||
//Log the deletion of seats to the log
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $user->id;
|
||||
$logaction->asset_type = 'user';
|
||||
$logaction->item_id = $user->id;
|
||||
$logaction->item_type = User::class;
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->note = e(Input::get('notes'));
|
||||
$logaction->checkedout_to = null;
|
||||
$logaction->created_at = date("Y-m-d h:i:s");
|
||||
$logaction->target_id = null;
|
||||
$logaction->created_at = date("Y-m-d H:i:s");
|
||||
$logaction->filename = $filename;
|
||||
$logaction->action_type = 'uploaded';
|
||||
$logaction->save();
|
||||
@@ -1142,7 +1166,6 @@ class UsersController extends Controller
|
||||
|
||||
protected $ldapValidationRules = array(
|
||||
'firstname' => 'required|string|min:2',
|
||||
'lastname' => 'required|string|min:2',
|
||||
'employee_number' => 'string',
|
||||
'username' => 'required|min:2|unique:users,username',
|
||||
'email' => 'email|unique:users,email',
|
||||
@@ -1155,7 +1178,7 @@ class UsersController extends Controller
|
||||
* @since [v1.8]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postLDAP()
|
||||
public function postLDAP(Request $request)
|
||||
{
|
||||
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
|
||||
ini_set('memory_limit', '500M');
|
||||
@@ -1168,9 +1191,6 @@ class UsersController extends Controller
|
||||
$ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
|
||||
$ldap_result_email = Setting::getSettings()->ldap_email;
|
||||
|
||||
|
||||
$location_id = e(Input::get('location_id'));
|
||||
|
||||
try {
|
||||
$ldapconn = Ldap::connectToLdap();
|
||||
} catch (\Exception $e) {
|
||||
@@ -1218,7 +1238,9 @@ class UsersController extends Controller
|
||||
$user->email = e($item["email"]);
|
||||
$user->employee_num = e($item["employee_number"]);
|
||||
$user->activated = 1;
|
||||
$user->location_id = e($location_id);
|
||||
if ($request->input('location_id')!='') {
|
||||
$user->location_id = e($request->input('location_id'));
|
||||
}
|
||||
$user->notes = 'Imported from LDAP';
|
||||
$user->ldap_import = 1;
|
||||
|
||||
@@ -1228,9 +1250,7 @@ class UsersController extends Controller
|
||||
$item["note"] = $item["createorupdate"];
|
||||
$item["status"]='success';
|
||||
} else {
|
||||
//$errors_array = array($user->getErrors());
|
||||
foreach ($user->getErrors()->getMessages() as $key => $err) {
|
||||
//echo $user->getErrors();
|
||||
$errors .='<li>'.$err[0];
|
||||
}
|
||||
$item["note"] = $errors;
|
||||
@@ -1259,4 +1279,89 @@ class UsersController extends Controller
|
||||
$assets = Asset::where('assigned_to', '=', $userId)->with('model')->get();
|
||||
return response()->json($assets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports users to CSV
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.5]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getExportUserCsv()
|
||||
{
|
||||
|
||||
\Debugbar::disable();
|
||||
|
||||
|
||||
$response = new StreamedResponse(function() {
|
||||
// Open output stream
|
||||
$handle = fopen('php://output', 'w');
|
||||
|
||||
User::with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'groups', 'userloc', 'company','throttle')->orderBy('created_at', 'DESC')->chunk(500, function($users) use($handle) {
|
||||
$headers=[
|
||||
// strtolower to prevent Excel from trying to open it as a SYLK file
|
||||
strtolower(trans('general.id')),
|
||||
trans('admin/companies/table.title'),
|
||||
trans('admin/users/table.title'),
|
||||
trans('admin/users/table.employee_num'),
|
||||
trans('admin/users/table.name'),
|
||||
trans('admin/users/table.username'),
|
||||
trans('admin/users/table.email'),
|
||||
trans('admin/users/table.manager'),
|
||||
trans('admin/users/table.location'),
|
||||
trans('general.assets'),
|
||||
trans('general.licenses'),
|
||||
trans('general.accessories'),
|
||||
trans('general.consumables'),
|
||||
trans('admin/users/table.groups'),
|
||||
trans('general.notes'),
|
||||
trans('admin/users/table.activated'),
|
||||
trans('general.created_at')
|
||||
];
|
||||
|
||||
fputcsv($handle, $headers);
|
||||
|
||||
foreach ($users as $user) {
|
||||
$user_groups = '';
|
||||
|
||||
foreach ($user->groups as $user_group) {
|
||||
$user_groups .= $user_group->name.', ';
|
||||
}
|
||||
|
||||
// Add a new row with data
|
||||
$values = [
|
||||
$user->id,
|
||||
($user->company) ? $user->company->name : '',
|
||||
$user->jobtitle,
|
||||
$user->employee_num,
|
||||
$user->fullName(),
|
||||
$user->username,
|
||||
$user->email,
|
||||
($user->manager) ? $user->manager->fullName() : '',
|
||||
($user->location) ? $user->location->name : '',
|
||||
$user->assets->count(),
|
||||
$user->licenses->count(),
|
||||
$user->accessories->count(),
|
||||
$user->consumables->count(),
|
||||
$user_groups,
|
||||
$user->notes,
|
||||
($user->activated=='1') ? trans('general.yes') : trans('general.no'),
|
||||
$user->created_at,
|
||||
|
||||
];
|
||||
|
||||
fputcsv($handle, $values);
|
||||
}
|
||||
});
|
||||
|
||||
// Close the output stream
|
||||
fclose($handle);
|
||||
}, 200, [
|
||||
'Content-Type' => 'text/csv',
|
||||
'Content-Disposition' => 'attachment; filename="users-'.date('Y-m-d-his').'.csv"',
|
||||
]);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Accessory;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\CheckoutRequest;
|
||||
use App\Models\Company;
|
||||
use App\Models\Consumable;
|
||||
use App\Models\Component;
|
||||
use App\Models\Consumable;
|
||||
use App\Models\License;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\Models\License;
|
||||
use Auth;
|
||||
use Config;
|
||||
use DB;
|
||||
@@ -37,11 +39,18 @@ class ViewAssetsController extends Controller
|
||||
public function getIndex()
|
||||
{
|
||||
|
||||
$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find(Auth::user()->id);
|
||||
|
||||
$userlog = $user->userlog->load('assetlog', 'consumablelog', 'assetlog.model', 'licenselog', 'accessorylog', 'userlog', 'adminlog');
|
||||
$user = User::with(
|
||||
'assets',
|
||||
'assets.model',
|
||||
'consumables',
|
||||
'accessories',
|
||||
'licenses',
|
||||
'userloc',
|
||||
'userlog'
|
||||
)->withTrashed()->find(Auth::user()->id);
|
||||
|
||||
|
||||
$userlog = $user->userlog->load('item', 'user', 'target');
|
||||
|
||||
if (isset($user->id)) {
|
||||
return View::make('account/view-assets', compact('user', 'userlog'));
|
||||
@@ -60,11 +69,132 @@ class ViewAssetsController extends Controller
|
||||
{
|
||||
|
||||
$assets = Asset::with('model', 'defaultLoc', 'assetloc', 'assigneduser')->Hardware()->RequestableAssets()->get();
|
||||
$models = AssetModel::with('category')->RequestableModels()->get();
|
||||
|
||||
return View::make('account/requestable-assets', compact('user', 'assets'));
|
||||
return View::make('account/requestable-assets', compact('user', 'assets', 'models'));
|
||||
}
|
||||
|
||||
public function getRequestedIndex()
|
||||
{
|
||||
$requestedItems = CheckoutRequest::with('user', 'requestedItem')->get();
|
||||
return View::make('admin/requested-assets', compact('requestedItems'));
|
||||
}
|
||||
|
||||
|
||||
public function getRequestItem($itemType, $itemId = null)
|
||||
{
|
||||
$item = null;
|
||||
$fullItemType = 'App\\Models\\' . studly_case($itemType);
|
||||
if ($itemType == "asset_model") {
|
||||
$itemType = "model";
|
||||
}
|
||||
$item = call_user_func(array($fullItemType, 'find'), $itemId);
|
||||
$user = Auth::user();
|
||||
$quantity = $data['item_quantity'] = Input::has('request-quantity') ? e(Input::get('request-quantity')) : 1;
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->item_id = $data['asset_id'] = $item->id;
|
||||
$logaction->item_type = $fullItemType;
|
||||
$logaction->created_at = $data['requested_date'] = date("Y-m-d H:i:s");
|
||||
if ($user->location_id) {
|
||||
$logaction->location_id = $user->location_id;
|
||||
}
|
||||
$logaction->target_id = $data['user_id'] = Auth::user()->id;
|
||||
$logaction->target_type = User::class;
|
||||
|
||||
$data['requested_by'] = $user->fullName();
|
||||
$data['item_name'] = $item->name;
|
||||
$data['item_type'] = $itemType;
|
||||
|
||||
if ($fullItemType == Asset::class) {
|
||||
$data['item_url'] = route('view/hardware', $item->id);
|
||||
$slackMessage = ' Asset <'.config('app.url').'/hardware/'.$item->id.'/view'.'|'.$item->showAssetName().'> requested by <'.config('app.url').'/users/'.$item->user_id.'/view'.'|'.$user->fullName().'>.';
|
||||
} else {
|
||||
$data['item_url'] = route("view/${itemType}", $item->id);
|
||||
$slackMessage = $quantity. ' ' . class_basename(strtoupper($logaction->item_type)).' <'.$data['item_url'].'|'.$item->name.'> requested by <'.config('app.url').'/user/'.$item->id.'/view'.'|'.$user->fullName().'>.';
|
||||
}
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
|
||||
$slack_settings = [
|
||||
'username' => $settings->botname,
|
||||
'channel' => $settings->slack_channel,
|
||||
'link_names' => true
|
||||
];
|
||||
|
||||
$slackClient = new \Maknz\Slack\Client($settings->slack_endpoint, $slack_settings);
|
||||
}
|
||||
|
||||
if ($item->isRequestedBy($user)) {
|
||||
|
||||
$item->cancelRequest();
|
||||
$log = $logaction->logaction('request_canceled');
|
||||
|
||||
if (($settings->alert_email!='') && ($settings->alerts_enabled=='1') && (!config('app.lock_passwords'))) {
|
||||
Mail::send('emails.asset-canceled', $data, function ($m) use ($user, $settings) {
|
||||
$m->to(explode(',', $settings->alert_email), $settings->site_name);
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Item_Request_Canceled'));
|
||||
});
|
||||
}
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
try {
|
||||
$slackClient->attach([
|
||||
'color' => 'good',
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'CANCELED:',
|
||||
'value' => $slackMessage
|
||||
]
|
||||
|
||||
]
|
||||
])->send('Item Request Canceled');
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.canceled'));
|
||||
|
||||
} else {
|
||||
$item->request();
|
||||
|
||||
$log = $logaction->logaction('requested');
|
||||
|
||||
|
||||
if (($settings->alert_email!='') && ($settings->alerts_enabled=='1') && (!config('app.lock_passwords'))) {
|
||||
Mail::send('emails.asset-requested', $data, function ($m) use ($user, $settings) {
|
||||
$m->to(explode(',', $settings->alert_email), $settings->site_name);
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Item_Requested'));
|
||||
});
|
||||
}
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
try {
|
||||
$slackClient->attach([
|
||||
'color' => 'good',
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'REQUESTED:',
|
||||
'value' => $slackMessage
|
||||
]
|
||||
|
||||
]
|
||||
])->send('Item Requested');
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
|
||||
}
|
||||
}
|
||||
public function getRequestAsset($assetId = null)
|
||||
{
|
||||
|
||||
@@ -76,17 +206,23 @@ class ViewAssetsController extends Controller
|
||||
return redirect()->route('requestable-assets')->with('error', trans('admin/hardware/message.does_not_exist_or_not_requestable'));
|
||||
} elseif (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return redirect()->route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
// If it's requested, cancel the request.
|
||||
if ($asset->isRequestedBy(Auth::user())) {
|
||||
$asset->cancelRequest();
|
||||
return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
|
||||
} else {
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $data['asset_id'] = $asset->id;
|
||||
$logaction->asset_type = $data['asset_type'] = 'hardware';
|
||||
$logaction->created_at = $data['requested_date'] = date("Y-m-d h:i:s");
|
||||
|
||||
$logaction->item_id = $data['asset_id'] = $asset->id;
|
||||
$logaction->item_type = Asset::class;
|
||||
$logaction->created_at = $data['requested_date'] = date("Y-m-d H:i:s");
|
||||
$data['asset_type'] = 'hardware';
|
||||
if ($user->location_id) {
|
||||
$logaction->location_id = $user->location_id;
|
||||
}
|
||||
$logaction->user_id = $data['user_id'] = Auth::user()->id;
|
||||
$logaction->target_id = $data['user_id'] = Auth::user()->id;
|
||||
$logaction->target_type = User::class;
|
||||
$log = $logaction->logaction('requested');
|
||||
|
||||
$data['requested_by'] = $user->fullName();
|
||||
@@ -97,10 +233,13 @@ class ViewAssetsController extends Controller
|
||||
if (($settings->alert_email!='') && ($settings->alerts_enabled=='1') && (!config('app.lock_passwords'))) {
|
||||
Mail::send('emails.asset-requested', $data, function ($m) use ($user, $settings) {
|
||||
$m->to(explode(',', $settings->alert_email), $settings->site_name);
|
||||
$m->subject('Asset Requested');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.asset_requested'));
|
||||
});
|
||||
}
|
||||
|
||||
$asset->request();
|
||||
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
|
||||
@@ -119,7 +258,7 @@ class ViewAssetsController extends Controller
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'REQUESTED:',
|
||||
'value' => strtoupper($logaction->asset_type).' asset <'.config('app.url').'/hardware/'.$asset->id.'/view'.'|'.$asset->showAssetName().'> requested by <'.config('app.url').'/hardware/'.$asset->id.'/view'.'|'.Auth::user()->fullName().'>.'
|
||||
'value' => class_basename(strtoupper($logaction->item_type)).' asset <'.config('app.url').'/hardware/'.$asset->id.'/view'.'|'.$asset->showAssetName().'> requested by <'.config('app.url').'/hardware/'.$asset->id.'/view'.'|'.Auth::user()->fullName().'>.'
|
||||
]
|
||||
|
||||
]
|
||||
@@ -137,13 +276,20 @@ class ViewAssetsController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function getRequestedAssets()
|
||||
{
|
||||
$checkoutrequests = CheckoutRequest::all();
|
||||
|
||||
return View::make('account/requested-items', compact($checkoutrequests));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get the acceptance screen
|
||||
public function getAcceptAsset($logID = null)
|
||||
{
|
||||
|
||||
if (!$findlog = DB::table('asset_logs')->where('id', '=', $logID)->first()) {
|
||||
if (!$findlog = Actionlog::where('id', $logID)->first()) {
|
||||
echo 'no record';
|
||||
//return redirect()->to('account')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
@@ -155,23 +301,7 @@ class ViewAssetsController extends Controller
|
||||
return redirect()->to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
|
||||
}
|
||||
|
||||
// Asset
|
||||
if (($findlog->asset_id!='') && ($findlog->asset_type=='hardware')) {
|
||||
$item = Asset::find($findlog->asset_id);
|
||||
|
||||
// software
|
||||
} elseif (($findlog->asset_id!='') && ($findlog->asset_type=='software')) {
|
||||
$item = License::find($findlog->asset_id);
|
||||
// accessories
|
||||
} elseif ($findlog->accessory_id!='') {
|
||||
$item = Accessory::find($findlog->accessory_id);
|
||||
// consumable
|
||||
} elseif ($findlog->consumable_id!='') {
|
||||
$item = Consumable::find($findlog->consumable_id);
|
||||
// components
|
||||
} elseif ($findlog->component_id!='') {
|
||||
$item = Component::find($findlog->component_id);
|
||||
}
|
||||
$item = $findlog->item;
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($item)) {
|
||||
@@ -189,11 +319,11 @@ class ViewAssetsController extends Controller
|
||||
{
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($findlog = DB::table('asset_logs')->where('id', '=', $logID)->first())) {
|
||||
if (is_null($findlog = Actionlog::where('id', $logID)->first())) {
|
||||
// Redirect to the asset management page
|
||||
return redirect()->to('account/view-assets')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($findlog->accepted_id!='') {
|
||||
// Redirect to the asset management page
|
||||
@@ -221,56 +351,24 @@ class ViewAssetsController extends Controller
|
||||
$accepted="rejected";
|
||||
$return_msg = trans('admin/users/message.declined');
|
||||
}
|
||||
|
||||
$logaction->item_id = $findlog->item_id;
|
||||
$logaction->item_type = $findlog->item_type;
|
||||
// Asset
|
||||
if (($findlog->asset_id!='') && ($findlog->asset_type=='hardware')) {
|
||||
$logaction->asset_id = $findlog->asset_id;
|
||||
$logaction->accessory_id = null;
|
||||
$logaction->asset_type = 'hardware';
|
||||
|
||||
if (($findlog->item_id!='') && ($findlog->item_type==Asset::class)) {
|
||||
if (Input::get('asset_acceptance')!='accepted') {
|
||||
DB::table('assets')
|
||||
->where('id', $findlog->asset_id)
|
||||
->where('id', $findlog->item_id)
|
||||
->update(array('assigned_to' => null));
|
||||
}
|
||||
|
||||
|
||||
// software
|
||||
} elseif (($findlog->asset_id!='') && ($findlog->asset_type=='software')) {
|
||||
$logaction->asset_id = $findlog->asset_id;
|
||||
$logaction->accessory_id = null;
|
||||
$logaction->component_id = null;
|
||||
$logaction->asset_type = 'software';
|
||||
|
||||
// accessories
|
||||
} elseif ($findlog->accessory_id!='') {
|
||||
$logaction->asset_id = null;
|
||||
$logaction->component_id = null;
|
||||
$logaction->accessory_id = $findlog->accessory_id;
|
||||
$logaction->asset_type = 'accessory';
|
||||
// accessories
|
||||
} elseif ($findlog->consumable_id!='') {
|
||||
$logaction->asset_id = null;
|
||||
$logaction->accessory_id = null;
|
||||
$logaction->component_id = null;
|
||||
$logaction->consumable_id = $findlog->consumable_id;
|
||||
$logaction->asset_type = 'consumable';
|
||||
} elseif ($findlog->component_id!='') {
|
||||
$logaction->asset_id = null;
|
||||
$logaction->accessory_id = null;
|
||||
$logaction->consumable_id = null;
|
||||
$logaction->component_id = $findlog->component_id;
|
||||
$logaction->asset_type = 'component';
|
||||
}
|
||||
|
||||
$logaction->checkedout_to = $findlog->checkedout_to;
|
||||
$logaction->target_id = $findlog->target_id;
|
||||
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction->user_id = $user->id;
|
||||
$logaction->accepted_at = date("Y-m-d h:i:s");
|
||||
$logaction->accepted_at = date("Y-m-d H:i:s");
|
||||
$log = $logaction->logaction($logaction_msg);
|
||||
|
||||
$update_checkout = DB::table('asset_logs')
|
||||
$update_checkout = DB::table('action_logs')
|
||||
->where('id', $findlog->id)
|
||||
->update(array('accepted_id' => $logaction->id));
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class Kernel extends HttpKernel
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\MisterPhilip\MaintenanceMode\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\FrameGuard::class,
|
||||
|
||||
@@ -15,7 +15,10 @@ class FrameGuard
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$response = $next($request);
|
||||
$response->headers->set('X-Frame-Options', 'SAMEORIGIN', false);
|
||||
if (config('app.allow_iframing') == false) {
|
||||
$response->headers->set('X-Frame-Options', 'SAMEORIGIN', false);
|
||||
}
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ class AssetRequest extends Request
|
||||
'supplier_id' => 'integer',
|
||||
'status' => 'integer',
|
||||
'asset_tag' => 'required',
|
||||
'purchase_cost' => 'numeric',
|
||||
|
||||
];
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ class SaveUserRequest extends Request
|
||||
{
|
||||
return [
|
||||
'first_name' => 'required|string|min:1',
|
||||
'last_name' => 'required|string|min:1',
|
||||
'email' => 'email',
|
||||
'password' => 'required|min:6',
|
||||
'password_confirm' => 'sometimes|required_with:password',
|
||||
'username' => 'required|string|min:2|unique:users,username,NULL,deleted_at',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\CheckoutRequest;
|
||||
use App\Models\Location;
|
||||
use App\Models\Statuslabel;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -78,7 +79,7 @@ Route::group([ 'prefix' => 'api', 'middleware' => 'auth' ], function () {
|
||||
/*---Manufacturers API---*/
|
||||
Route::group(array('prefix'=>'manufacturers'), function () {
|
||||
Route::get('list', array('as'=>'api.manufacturers.list', 'uses'=>'ManufacturersController@getDatatable'));
|
||||
Route::get('{manufacturerID}/view', array('as'=>'api.manufacturers.view', 'uses'=>'ManufacturersController@getDataView'));
|
||||
Route::get('{manufacturerID}/view/{itemtype}', array('as'=>'api.manufacturers.view', 'uses'=>'ManufacturersController@getDataView'));
|
||||
});
|
||||
|
||||
/*---Suppliers API---*/
|
||||
@@ -184,79 +185,142 @@ Route::group([ 'prefix' => 'api', 'middleware' => 'auth' ], function () {
|
||||
Route::group(
|
||||
[ 'prefix' => 'hardware',
|
||||
'middleware' => ['web',
|
||||
'auth',
|
||||
'authorize:assets.view']],
|
||||
'auth']],
|
||||
function () {
|
||||
|
||||
Route::get('history', [
|
||||
'as' => 'asset.import-history',
|
||||
'middleware' => 'authorize:assets.checkout',
|
||||
'uses' => 'AssetsController@getImportHistory'
|
||||
]);
|
||||
|
||||
Route::post('history', [
|
||||
'as' => 'asset.process-import-history',
|
||||
'middleware' => 'authorize:assets.checkout',
|
||||
'uses' => 'AssetsController@postImportHistory'
|
||||
]);
|
||||
|
||||
|
||||
Route::get('create/{model?}', [
|
||||
'as' => 'create/hardware',
|
||||
'middleware' => 'authorize:assets.create',
|
||||
'uses' => 'AssetsController@getCreate'
|
||||
]);
|
||||
|
||||
Route::post('create', [
|
||||
'as' => 'savenew/hardware',
|
||||
'middleware' => 'authorize:assets.create',
|
||||
'uses' => 'AssetsController@postCreate'
|
||||
]);
|
||||
|
||||
Route::get('{assetId}/edit', [
|
||||
'as' => 'update/hardware',
|
||||
'middleware' => 'authorize:assets.edit',
|
||||
'uses' => 'AssetsController@getEdit'
|
||||
]);
|
||||
Route::get('/bytag', [
|
||||
'as' => 'findbytag/hardware',
|
||||
'middleware' => 'authorize:assets.view',
|
||||
'uses' => 'AssetsController@getAssetByTag'
|
||||
]);
|
||||
|
||||
Route::get('{assetId}/clone', [ 'as' => 'clone/hardware', 'uses' => 'AssetsController@getClone' ]);
|
||||
Route::get('{assetId}/clone', [
|
||||
'as' => 'clone/hardware',
|
||||
'middleware' => 'authorize:assets.create',
|
||||
'uses' => 'AssetsController@getClone'
|
||||
]);
|
||||
|
||||
Route::post('{assetId}/clone', 'AssetsController@postCreate');
|
||||
Route::get('{assetId}/delete', [ 'as' => 'delete/hardware', 'uses' => 'AssetsController@getDelete' ]);
|
||||
Route::get(
|
||||
'{assetId}/checkout',
|
||||
[ 'as' => 'checkout/hardware', 'uses' => 'AssetsController@getCheckout' ]
|
||||
);
|
||||
Route::post('{assetId}/checkout', 'AssetsController@postCheckout');
|
||||
Route::get(
|
||||
'{assetId}/checkin/{backto?}',
|
||||
[ 'as' => 'checkin/hardware', 'uses' => 'AssetsController@getCheckin' ]
|
||||
);
|
||||
Route::post('{assetId}/checkin/{backto?}', 'AssetsController@postCheckin');
|
||||
Route::get('{assetId}/view', [ 'as' => 'view/hardware', 'uses' => 'AssetsController@getView' ]);
|
||||
Route::get('{assetId}/delete', [
|
||||
'as' => 'delete/hardware',
|
||||
'middleware' => 'authorize:assets.delete',
|
||||
'uses' => 'AssetsController@getDelete'
|
||||
]);
|
||||
Route::get('{assetId}/checkout', [
|
||||
'as' => 'checkout/hardware',
|
||||
'middleware' => 'authorize:assets.checkout',
|
||||
'uses' => 'AssetsController@getCheckout'
|
||||
]);
|
||||
Route::post('{assetId}/checkout', [
|
||||
'as' => 'checkout/hardware',
|
||||
'middleware' => 'authorize:assets.checkout',
|
||||
'uses' => 'AssetsController@postCheckout'
|
||||
]);
|
||||
Route::get('{assetId}/checkin/{backto?}', [
|
||||
'as' => 'checkin/hardware',
|
||||
'middleware' => 'authorize:assets.checkin',
|
||||
'uses' => 'AssetsController@getCheckin'
|
||||
]);
|
||||
|
||||
Route::post('{assetId}/checkin/{backto?}', [
|
||||
'as' => 'checkin/hardware',
|
||||
'middleware' => 'authorize:assets.checkin',
|
||||
'uses' => 'AssetsController@postCheckin'
|
||||
]);
|
||||
Route::get('{assetId}/view', [
|
||||
'as' => 'view/hardware',
|
||||
'middleware' => ['authorize:assets.view'],
|
||||
'uses' => 'AssetsController@getView'
|
||||
]);
|
||||
Route::get('{assetId}/qr-view', [ 'as' => 'qr-view/hardware', 'uses' => 'AssetsController@getView' ]);
|
||||
Route::get('{assetId}/qr_code', [ 'as' => 'qr_code/hardware', 'uses' => 'AssetsController@getQrCode' ]);
|
||||
Route::get('{assetId}/barcode', [ 'as' => 'barcode/hardware', 'uses' => 'AssetsController@getBarCode' ]);
|
||||
Route::get('{assetId}/restore', [ 'as' => 'restore/hardware', 'uses' => 'AssetsController@getRestore' ]);
|
||||
Route::post('{assetId}/upload', [ 'as' => 'upload/asset', 'uses' => 'AssetsController@postUpload' ]);
|
||||
Route::get(
|
||||
'{assetId}/deletefile/{fileId}',
|
||||
[ 'as' => 'delete/assetfile', 'uses' => 'AssetsController@getDeleteFile' ]
|
||||
);
|
||||
Route::get(
|
||||
'{assetId}/showfile/{fileId}',
|
||||
[ 'as' => 'show/assetfile', 'uses' => 'AssetsController@displayFile' ]
|
||||
);
|
||||
Route::get('{assetId}/restore', [
|
||||
'as' => 'restore/hardware',
|
||||
'middleware' => 'authorize:assets.delete',
|
||||
'uses' => 'AssetsController@getRestore'
|
||||
]);
|
||||
Route::post('{assetId}/upload', [
|
||||
'as' => 'upload/asset',
|
||||
'middleware' => 'authorize:assets.edit',
|
||||
'uses' => 'AssetsController@postUpload'
|
||||
]);
|
||||
|
||||
Route::get(
|
||||
'import/delete-import/{filename}',
|
||||
[ 'as' => 'assets/import/delete-file', 'uses' => 'AssetsController@getDeleteImportFile' ]
|
||||
);
|
||||
Route::get('{assetId}/deletefile/{fileId}', [
|
||||
'as' => 'delete/assetfile',
|
||||
'middleware' => 'authorize:assets.edit',
|
||||
'uses' => 'AssetsController@getDeleteFile'
|
||||
]);
|
||||
|
||||
Route::get(
|
||||
'import/process/{filename}',
|
||||
[ 'as' => 'assets/import/process-file', 'uses' => 'AssetsController@getProcessImportFile' ]
|
||||
);
|
||||
Route::get('{assetId}/showfile/{fileId}', [
|
||||
'as' => 'show/assetfile',
|
||||
'middleware' => 'authorize:assets.view',
|
||||
'uses' => 'AssetsController@displayFile'
|
||||
]);
|
||||
|
||||
Route::get(
|
||||
'import',
|
||||
[ 'as' => 'assets/import', 'uses' => 'AssetsController@getImportUpload' ]
|
||||
);
|
||||
Route::get('import/delete-import/{filename}', [
|
||||
'as' => 'assets/import/delete-file',
|
||||
'middleware' => 'authorize:assets.create',
|
||||
'uses' => 'AssetsController@getDeleteImportFile'
|
||||
]);
|
||||
|
||||
Route::post( 'import/process/', [ 'as' => 'assets/import/process-file',
|
||||
'middleware' => 'authorize:assets.create',
|
||||
'uses' => 'AssetsController@postProcessImportFile'
|
||||
]);
|
||||
Route::get( 'import/delete/{filename}', [ 'as' => 'assets/import/delete-file',
|
||||
'middleware' => 'authorize:assets.create', // TODO What permissions should this require?
|
||||
'uses' => 'AssetsController@getDeleteImportFile'
|
||||
]);
|
||||
|
||||
Route::get('import',[
|
||||
'as' => 'assets/import',
|
||||
'middleware' => 'authorize:assets.create',
|
||||
'uses' => 'AssetsController@getImportUpload'
|
||||
]);
|
||||
|
||||
|
||||
Route::post('{assetId}/edit', 'AssetsController@postEdit');
|
||||
Route::post('{assetId}/edit',[
|
||||
'as' => 'assets/import',
|
||||
'middleware' => 'authorize:assets.edit',
|
||||
'uses' => 'AssetsController@postEdit'
|
||||
]);
|
||||
|
||||
Route::post(
|
||||
'bulkedit',
|
||||
[
|
||||
'as' => 'hardware/bulkedit',
|
||||
'middleware' => 'authorize:assets.edit',
|
||||
'uses' => 'AssetsController@postBulkEdit'
|
||||
]
|
||||
);
|
||||
@@ -264,6 +328,7 @@ Route::group(
|
||||
'bulkdelete',
|
||||
[
|
||||
'as' => 'hardware/bulkdelete',
|
||||
'middleware' => 'authorize:assets.delete',
|
||||
'uses' => 'AssetsController@postBulkDelete'
|
||||
]
|
||||
);
|
||||
@@ -271,35 +336,42 @@ Route::group(
|
||||
'bulksave',
|
||||
[
|
||||
'as' => 'hardware/bulksave',
|
||||
'middleware' => 'authorize:assets.edit',
|
||||
'uses' => 'AssetsController@postBulkSave'
|
||||
]
|
||||
);
|
||||
|
||||
# Bulk checkout / checkin
|
||||
Route::get(
|
||||
'bulkcheckout',
|
||||
[ 'as' => 'hardware/bulkcheckout', 'uses' => 'AssetsController@getBulkCheckout' ]
|
||||
);
|
||||
Route::post('bulkcheckout', 'AssetsController@postBulkCheckout');
|
||||
Route::get( 'bulkcheckout', [
|
||||
'as' => 'hardware/bulkcheckout',
|
||||
'middleware' => 'authorize:assets.checkout',
|
||||
'uses' => 'AssetsController@getBulkCheckout'
|
||||
]);
|
||||
Route::post( 'bulkcheckout', [
|
||||
'as' => 'hardware/bulkcheckout',
|
||||
'middleware' => 'authorize:assets.checkout',
|
||||
'uses' => 'AssetsController@postBulkCheckout'
|
||||
]);
|
||||
|
||||
# Asset Model Management
|
||||
Route::group([ 'prefix' => 'models', 'middleware' => 'auth' ], function () {
|
||||
Route::group([ 'prefix' => 'models', 'middleware' => ['auth'] ], function () {
|
||||
|
||||
Route::get('/', [ 'as' => 'models', 'uses' => 'AssetModelsController@getIndex' ]);
|
||||
Route::get('create', [ 'as' => 'create/model', 'uses' => 'AssetModelsController@getCreate' ]);
|
||||
Route::get('create', [ 'as' => 'create/model', 'uses' => 'AssetModelsController@getCreate', 'middleware' => ['authorize:superuser'] ]);
|
||||
Route::post('create', 'AssetModelsController@postCreate');
|
||||
Route::get('{modelId}/edit', [ 'as' => 'update/model', 'uses' => 'AssetModelsController@getEdit' ]);
|
||||
Route::post('{modelId}/edit', 'AssetModelsController@postEdit');
|
||||
Route::get('{modelId}/edit', [ 'as' => 'update/model', 'uses' => 'AssetModelsController@getEdit' , 'middleware' => ['authorize:superuser']]);
|
||||
Route::post('{modelId}/edit', [ 'uses' => 'AssetModelsController@postEdit', 'middleware' => ['authorize:superuser']]);
|
||||
Route::get('{modelId}/clone', [ 'as' => 'clone/model', 'uses' => 'AssetModelsController@getClone' ]);
|
||||
Route::post('{modelId}/clone', 'AssetModelsController@postCreate');
|
||||
Route::get('{modelId}/delete', [ 'as' => 'delete/model', 'uses' => 'AssetModelsController@getDelete' ]);
|
||||
Route::get('{modelId}/delete', [ 'as' => 'delete/model', 'uses' => 'AssetModelsController@getDelete', 'middleware' => ['authorize:superuser'] ]);
|
||||
Route::get('{modelId}/view', [ 'as' => 'view/model', 'uses' => 'AssetModelsController@getView' ]);
|
||||
Route::get('{modelID}/restore', [ 'as' => 'restore/model', 'uses' => 'AssetModelsController@getRestore' ]);
|
||||
Route::get('{modelID}/restore', [ 'as' => 'restore/model', 'uses' => 'AssetModelsController@getRestore', 'middleware' => ['authorize:superuser'] ]);
|
||||
Route::get('{modelId}/custom_fields', ['as' => 'custom_fields/model','uses' => 'AssetModelsController@getCustomFields']);
|
||||
Route::get('/', [ 'as' => 'models', 'uses' => 'AssetModelsController@getIndex' ,'middleware' => ['authorize:superuser'] ]);
|
||||
});
|
||||
|
||||
Route::get('/', [
|
||||
'as' => 'hardware',
|
||||
'middleware' => 'authorize:assets.view',
|
||||
'uses' => 'AssetsController@getIndex'
|
||||
]);
|
||||
|
||||
@@ -317,44 +389,68 @@ Route::group(
|
||||
|
||||
Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function () {
|
||||
|
||||
Route::get('requests',
|
||||
// foreach( CheckoutRequest::with('user')->get() as $requestedItem) {
|
||||
// echo $requestedItem->user->username . ' requested ' . $requestedItem->requestedItem->name;
|
||||
[
|
||||
'as' => 'requests',
|
||||
'middleware' => 'authorize:admin',
|
||||
'uses' => 'ViewAssetsController@getRequestedIndex'
|
||||
]);
|
||||
# Licenses
|
||||
Route::group([ 'prefix' => 'licenses', 'middleware'=>'authorize:licenses.view' ], function () {
|
||||
|
||||
Route::get('create', [ 'as' => 'create/licenses', 'uses' => 'LicensesController@getCreate' ]);
|
||||
Route::post('create', 'LicensesController@postCreate');
|
||||
Route::get('{licenseId}/edit', [ 'as' => 'update/license', 'uses' => 'LicensesController@getEdit' ]);
|
||||
Route::post('{licenseId}/edit', 'LicensesController@postEdit');
|
||||
Route::get('{licenseId}/clone', [ 'as' => 'clone/license', 'uses' => 'LicensesController@getClone' ]);
|
||||
Route::post('{licenseId}/clone', 'LicensesController@postCreate');
|
||||
Route::get('{licenseId}/delete', [ 'as' => 'delete/license', 'uses' => 'LicensesController@getDelete' ]);
|
||||
Route::get(
|
||||
'{licenseId}/freecheckout',
|
||||
[ 'as' => 'freecheckout/license', 'uses' => 'LicensesController@getFreeLicense' ]
|
||||
);
|
||||
Route::get('create', [ 'as' => 'create/licenses', 'middleware' => 'authorize:licenses.create','uses' => 'LicensesController@getCreate' ]);
|
||||
Route::post('create', [ 'as' => 'create/licenses', 'middleware' => 'authorize:licenses.create','uses' => 'LicensesController@postCreate' ]);
|
||||
Route::get('{licenseId}/edit', [ 'as' => 'update/license', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@getEdit' ]);
|
||||
Route::post('{licenseId}/edit', [ 'as' => 'update/license', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@postEdit' ]);
|
||||
Route::get('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@getClone' ]);
|
||||
Route::post('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@postCreate' ]);
|
||||
Route::get('{licenseId}/delete', [ 'as' => 'delete/license', 'middleware' => 'authorize:licenses.delete', 'uses' => 'LicensesController@getDelete' ]);
|
||||
Route::get('{licenseId}/freecheckout', [
|
||||
'as' => 'freecheckout/license',
|
||||
'middleware' => 'authorize:licenses.checkout',
|
||||
'uses' => 'LicensesController@getFreeLicense'
|
||||
]);
|
||||
Route::get(
|
||||
'{licenseId}/checkout',
|
||||
[ 'as' => 'checkout/license', 'uses' => 'LicensesController@getCheckout' ]
|
||||
[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ]
|
||||
);
|
||||
Route::post('{licenseId}/checkout', 'LicensesController@postCheckout');
|
||||
Route::get(
|
||||
'{licenseId}/checkin/{backto?}',
|
||||
[ 'as' => 'checkin/license', 'uses' => 'LicensesController@getCheckin' ]
|
||||
Route::post(
|
||||
'{licenseId}/checkout',
|
||||
[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ]
|
||||
);
|
||||
Route::post('{licenseId}/checkin/{backto?}', 'LicensesController@postCheckin');
|
||||
Route::get('{licenseId}/view', [ 'as' => 'view/license', 'uses' => 'LicensesController@getView' ]);
|
||||
Route::get('{licenseId}/checkin/{backto?}', [
|
||||
'as' => 'checkin/license',
|
||||
'middleware' => 'authorize:licenses.checkin',
|
||||
'uses' => 'LicensesController@getCheckin'
|
||||
]);
|
||||
|
||||
Route::post('{licenseId}/checkin/{backto?}', [
|
||||
'as' => 'checkin/license',
|
||||
'middleware' => 'authorize:licenses.checkin',
|
||||
'uses' => 'LicensesController@postCheckin'
|
||||
]);
|
||||
|
||||
Route::get('{licenseId}/view', [
|
||||
'as' => 'view/license',
|
||||
'middleware' => 'authorize:licenses.view',
|
||||
'uses' => 'LicensesController@getView'
|
||||
]);
|
||||
|
||||
Route::post(
|
||||
'{licenseId}/upload',
|
||||
[ 'as' => 'upload/license', 'uses' => 'LicensesController@postUpload' ]
|
||||
[ 'as' => 'upload/license', 'middleware' => 'authorize:licenses.edit','uses' => 'LicensesController@postUpload' ]
|
||||
);
|
||||
Route::get(
|
||||
'{licenseId}/deletefile/{fileId}',
|
||||
[ 'as' => 'delete/licensefile', 'uses' => 'LicensesController@getDeleteFile' ]
|
||||
[ 'as' => 'delete/licensefile', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@getDeleteFile' ]
|
||||
);
|
||||
Route::get(
|
||||
'{licenseId}/showfile/{fileId}',
|
||||
[ 'as' => 'show/licensefile', 'uses' => 'LicensesController@displayFile' ]
|
||||
[ 'as' => 'show/licensefile', 'middleware' => 'authorize:licenses.view','uses' => 'LicensesController@displayFile' ]
|
||||
);
|
||||
Route::get('/', [ 'as' => 'licenses', 'uses' => 'LicensesController@getIndex' ]);
|
||||
Route::get('/', [ 'as' => 'licenses', 'middleware' => 'authorize:licenses.view','uses' => 'LicensesController@getIndex' ]);
|
||||
});
|
||||
|
||||
# Asset Maintenances
|
||||
@@ -384,84 +480,103 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
|
||||
# Accessories
|
||||
Route::group([ 'prefix' => 'accessories', 'middleware'=>'authorize:accessories.view' ], function () {
|
||||
|
||||
Route::get('create', [ 'as' => 'create/accessory', 'uses' => 'AccessoriesController@getCreate' ]);
|
||||
Route::get('create', [ 'as' => 'create/accessory', 'middleware' => 'authorize:accessories.create','uses' => 'AccessoriesController@getCreate' ]);
|
||||
Route::post('create', 'AccessoriesController@postCreate');
|
||||
Route::get(
|
||||
'{accessoryID}/edit',
|
||||
[ 'as' => 'update/accessory', 'uses' => 'AccessoriesController@getEdit' ]
|
||||
[ 'as' => 'update/accessory', 'middleware' => 'authorize:accessories.edit','uses' => 'AccessoriesController@getEdit' ]
|
||||
);
|
||||
Route::post('{accessoryID}/edit', 'AccessoriesController@postEdit');
|
||||
Route::get(
|
||||
'{accessoryID}/delete',
|
||||
[ 'as' => 'delete/accessory', 'uses' => 'AccessoriesController@getDelete' ]
|
||||
[ 'as' => 'delete/accessory', 'middleware' => 'authorize:accessories.delete','uses' => 'AccessoriesController@getDelete' ]
|
||||
);
|
||||
Route::get('{accessoryID}/view', [ 'as' => 'view/accessory', 'uses' => 'AccessoriesController@getView' ]);
|
||||
Route::get('{accessoryID}/view', [ 'as' => 'view/accessory', 'middleware' => 'authorize:accessories.view','uses' => 'AccessoriesController@getView' ]);
|
||||
Route::get(
|
||||
'{accessoryID}/checkout',
|
||||
[ 'as' => 'checkout/accessory', 'uses' => 'AccessoriesController@getCheckout' ]
|
||||
[ 'as' => 'checkout/accessory', 'middleware' => 'authorize:accessories.checkout','uses' => 'AccessoriesController@getCheckout' ]
|
||||
);
|
||||
Route::post('{accessoryID}/checkout', 'AccessoriesController@postCheckout');
|
||||
Route::post(
|
||||
'{accessoryID}/checkout',
|
||||
[ 'as' => 'checkout/accessory', 'middleware' => 'authorize:accessories.checkout','uses' => 'AccessoriesController@postCheckout' ]
|
||||
);
|
||||
|
||||
Route::get(
|
||||
'{accessoryID}/checkin/{backto?}',
|
||||
[ 'as' => 'checkin/accessory', 'uses' => 'AccessoriesController@getCheckin' ]
|
||||
[ 'as' => 'checkin/accessory', 'middleware' => 'authorize:accessories.checkin','uses' => 'AccessoriesController@getCheckin' ]
|
||||
);
|
||||
Route::post(
|
||||
'{accessoryID}/checkin/{backto?}',
|
||||
[ 'as' => 'checkin/accessory', 'middleware' => 'authorize:accessories.checkin','uses' => 'AccessoriesController@postCheckin' ]
|
||||
);
|
||||
Route::post('{accessoryID}/checkin/{backto?}', 'AccessoriesController@postCheckin');
|
||||
|
||||
Route::get('/', [ 'as' => 'accessories', 'uses' => 'AccessoriesController@getIndex' ]);
|
||||
Route::get('/', [ 'as' => 'accessories', 'middleware'=>'authorize:accessories.view', 'uses' => 'AccessoriesController@getIndex' ]);
|
||||
});
|
||||
|
||||
# Consumables
|
||||
Route::group([ 'prefix' => 'consumables', 'middleware'=>'authorize:consumables.view' ], function () {
|
||||
|
||||
Route::get('create', [ 'as' => 'create/consumable', 'uses' => 'ConsumablesController@getCreate' ]);
|
||||
Route::post('create', 'ConsumablesController@postCreate');
|
||||
Route::get('create', [ 'as' => 'create/consumable','middleware'=>'authorize:consumables.create', 'uses' => 'ConsumablesController@getCreate' ]);
|
||||
Route::post('create', [ 'as' => 'create/consumable','middleware'=>'authorize:consumables.create', 'uses' => 'ConsumablesController@postCreate' ]);
|
||||
Route::get(
|
||||
'{consumableID}/edit',
|
||||
[ 'as' => 'update/consumable', 'uses' => 'ConsumablesController@getEdit' ]
|
||||
[ 'as' => 'update/consumable', 'middleware'=>'authorize:consumables.edit', 'uses' => 'ConsumablesController@getEdit' ]
|
||||
);
|
||||
Route::post(
|
||||
'{consumableID}/edit',
|
||||
[ 'as' => 'update/consumable', 'middleware'=>'authorize:consumables.edit', 'uses' => 'ConsumablesController@postEdit' ]
|
||||
);
|
||||
Route::post('{consumableID}/edit', 'ConsumablesController@postEdit');
|
||||
Route::get(
|
||||
'{consumableID}/delete',
|
||||
[ 'as' => 'delete/consumable', 'uses' => 'ConsumablesController@getDelete' ]
|
||||
[ 'as' => 'delete/consumable', 'middleware'=>'authorize:consumables.delete','uses' => 'ConsumablesController@getDelete' ]
|
||||
);
|
||||
Route::get(
|
||||
'{consumableID}/view',
|
||||
[ 'as' => 'view/consumable', 'uses' => 'ConsumablesController@getView' ]
|
||||
[ 'as' => 'view/consumable', 'middleware'=>'authorize:consumables.view','uses' => 'ConsumablesController@getView' ]
|
||||
);
|
||||
Route::get(
|
||||
'{consumableID}/checkout',
|
||||
[ 'as' => 'checkout/consumable', 'uses' => 'ConsumablesController@getCheckout' ]
|
||||
[ 'as' => 'checkout/consumable', 'middleware'=>'authorize:consumables.checkout','uses' => 'ConsumablesController@getCheckout' ]
|
||||
);
|
||||
Route::post('{consumableID}/checkout', 'ConsumablesController@postCheckout');
|
||||
Route::get('/', [ 'as' => 'consumables', 'uses' => 'ConsumablesController@getIndex' ]);
|
||||
Route::post(
|
||||
'{consumableID}/checkout',
|
||||
[ 'as' => 'checkout/consumable', 'middleware'=>'authorize:consumables.checkout','uses' => 'ConsumablesController@postCheckout' ]
|
||||
);
|
||||
Route::get('/', [ 'as' => 'consumables', 'middleware'=>'authorize:consumables.view','uses' => 'ConsumablesController@getIndex' ]);
|
||||
});
|
||||
|
||||
# Components
|
||||
Route::group([ 'prefix' => 'components', 'middleware'=>'authorize:components.view' ], function () {
|
||||
|
||||
Route::get('create', [ 'as' => 'create/component', 'uses' => 'ComponentsController@getCreate' ]);
|
||||
Route::post('create', 'ComponentsController@postCreate');
|
||||
Route::get('create', [ 'as' => 'create/component', 'middleware'=>'authorize:components.create','uses' => 'ComponentsController@getCreate' ]);
|
||||
Route::post('create', [ 'as' => 'create/component', 'middleware'=>'authorize:components.create','uses' => 'ComponentsController@postCreate' ]);
|
||||
Route::get(
|
||||
'{componentID}/edit',
|
||||
[ 'as' => 'update/component', 'uses' => 'ComponentsController@getEdit' ]
|
||||
[ 'as' => 'update/component', 'middleware'=>'authorize:components.edit','uses' => 'ComponentsController@getEdit' ]
|
||||
);
|
||||
Route::post(
|
||||
'{componentID}/edit',
|
||||
[ 'as' => 'update/component', 'middleware'=>'authorize:components.edit','uses' => 'ComponentsController@postEdit' ]
|
||||
);
|
||||
Route::post('{componentID}/edit', 'ComponentsController@postEdit');
|
||||
Route::get(
|
||||
'{componentID}/delete',
|
||||
[ 'as' => 'delete/component', 'uses' => 'ComponentsController@getDelete' ]
|
||||
[ 'as' => 'delete/component', 'middleware'=>'authorize:components.delete','uses' => 'ComponentsController@getDelete' ]
|
||||
);
|
||||
Route::get(
|
||||
'{componentID}/view',
|
||||
[ 'as' => 'view/component', 'uses' => 'ComponentsController@getView' ]
|
||||
[ 'as' => 'view/component', 'middleware'=>'authorize:components.view','uses' => 'ComponentsController@getView' ]
|
||||
);
|
||||
Route::get(
|
||||
'{componentID}/checkout',
|
||||
[ 'as' => 'checkout/component', 'uses' => 'ComponentsController@getCheckout' ]
|
||||
[ 'as' => 'checkout/component', 'middleware'=>'authorize:components.checkout','uses' => 'ComponentsController@getCheckout' ]
|
||||
);
|
||||
Route::post('{componentID}/checkout', 'ComponentsController@postCheckout');
|
||||
Route::post('bulk', [ 'as' => 'component/bulk-form', 'uses' => 'ComponentsController@postBulk' ]);
|
||||
Route::post('bulksave', [ 'as' => 'component/bulk-save', 'uses' => 'ComponentsController@postBulkSave' ]);
|
||||
Route::get('/', [ 'as' => 'components', 'uses' => 'ComponentsController@getIndex' ]);
|
||||
Route::post(
|
||||
'{componentID}/checkout',
|
||||
[ 'as' => 'checkout/component', 'middleware'=>'authorize:components.checkout','uses' => 'ComponentsController@postCheckout' ]
|
||||
);
|
||||
Route::post('bulk', [ 'as' => 'component/bulk-form', 'middleware'=>'authorize:components.checkout','uses' => 'ComponentsController@postBulk' ]);
|
||||
Route::post('bulksave', [ 'as' => 'component/bulk-save', 'middleware'=>'authorize:components.edit','uses' => 'ComponentsController@postBulkSave' ]);
|
||||
Route::get('/', [ 'as' => 'components', 'middleware'=>'authorize:components.view','uses' => 'ComponentsController@getIndex' ]);
|
||||
});
|
||||
|
||||
# Admin Settings Routes (for categories, maufactureres, etc)
|
||||
@@ -615,7 +730,7 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
|
||||
[ 'as' => 'update/location', 'uses' => 'LocationsController@getEdit' ]
|
||||
);
|
||||
Route::post('{locationId}/edit', 'LocationsController@postEdit');
|
||||
Route::get('{locationId}/view', 'LocationsController@getView');
|
||||
Route::get('{locationId}/view', [ 'as' => 'view/location', 'uses' => 'LocationsController@getView' ]);
|
||||
Route::get(
|
||||
'{locationId}/delete',
|
||||
[ 'as' => 'delete/location', 'uses' => 'LocationsController@getDelete' ]
|
||||
@@ -659,6 +774,7 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
|
||||
Route::post('create', [ 'uses' => 'UsersController@postCreate', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('import', [ 'as' => 'import/user', 'uses' => 'UsersController@getImport', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::post('import', [ 'uses' => 'UsersController@postImport', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('export', [ 'uses' => 'UsersController@getExportUserCsv', 'middleware' => ['authorize:users.view'] ]);
|
||||
Route::get('{userId}/edit', [ 'as' => 'update/user', 'uses' => 'UsersController@getEdit', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::post('{userId}/edit', [ 'uses' => 'UsersController@postEdit', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('{userId}/clone', [ 'as' => 'clone/user', 'uses' => 'UsersController@getClone', 'middleware' => ['authorize:users.edit'] ]);
|
||||
@@ -752,6 +868,11 @@ Route::group([ 'prefix' => 'account', 'middleware' => ['web', 'auth']], function
|
||||
[ 'as' => 'account/request-asset', 'uses' => 'ViewAssetsController@getRequestAsset' ]
|
||||
);
|
||||
|
||||
Route::post(
|
||||
'request/{itemType}/{itemId}',
|
||||
[ 'as' => 'account/request-item', 'uses' => 'ViewAssetsController@getRequestItem']
|
||||
);
|
||||
|
||||
# Account Dashboard
|
||||
Route::get('/', [ 'as' => 'account', 'uses' => 'ViewAssetsController@getIndex' ]);
|
||||
|
||||
@@ -804,6 +925,12 @@ Route::group(['middleware' => ['web','auth','authorize:reports.view']], function
|
||||
'reports/activity',
|
||||
[ 'as' => 'reports/activity', 'uses' => 'ReportsController@getActivityReport' ]
|
||||
);
|
||||
|
||||
Route::get(
|
||||
'reports/activity/json',
|
||||
[ 'as' => 'api.activity.list', 'uses' => 'ReportsController@getActivityReportDataTable' ]
|
||||
);
|
||||
|
||||
Route::get(
|
||||
'reports/unaccepted_assets',
|
||||
[ 'as' => 'reports/unaccepted_assets', 'uses' => 'ReportsController@getAssetAcceptanceReport' ]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Loggable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
@@ -12,8 +13,9 @@ use Watson\Validating\ValidatingTrait;
|
||||
*/
|
||||
class Accessory extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use CompanyableTrait;
|
||||
use Loggable;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
protected $table = 'accessories';
|
||||
@@ -22,11 +24,12 @@ class Accessory extends Model
|
||||
* Accessory validation rules
|
||||
*/
|
||||
public $rules = array(
|
||||
'name' => 'required|min:3|max:255',
|
||||
'qty' => 'required|integer|min:1',
|
||||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'min_amt' => 'integer|min:1',
|
||||
'name' => 'required|min:3|max:255',
|
||||
'qty' => 'required|integer|min:1',
|
||||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'min_amt' => 'integer|min:1',
|
||||
'purchase_cost' => 'numeric',
|
||||
);
|
||||
|
||||
|
||||
@@ -67,7 +70,7 @@ class Accessory extends Model
|
||||
*/
|
||||
public function assetlog()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'accessory_id')->where('asset_type', '=', 'accessory')->orderBy('created_at', 'desc')->withTrashed();
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')->where('item_type', Accessory::class)->orderBy('created_at', 'desc')->withTrashed();
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +84,11 @@ class Accessory extends Model
|
||||
return $this->belongsToMany('\App\Models\User', 'accessories_users', 'accessory_id', 'assigned_to')->count();
|
||||
}
|
||||
|
||||
public function manufacturer()
|
||||
{
|
||||
return $this->belongsTo('\App\Models\Manufacturer', 'manufacturer_id');
|
||||
}
|
||||
|
||||
public function checkin_email()
|
||||
{
|
||||
return $this->category->checkin_email;
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Model for the Actionlog (the table that keeps a historical log of
|
||||
@@ -12,88 +13,78 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
*
|
||||
* @version v1.0
|
||||
*/
|
||||
class Actionlog extends Model implements ICompanyableChild
|
||||
class Actionlog extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use CompanyableChildTrait;
|
||||
|
||||
protected $dates = [ 'deleted_at' ];
|
||||
|
||||
protected $table = 'asset_logs';
|
||||
protected $table = 'action_logs';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [ 'created_at', 'asset_type' ];
|
||||
protected $fillable = [ 'created_at', 'item_type','user_id','item_id','action_type','note','target_id', 'target_type' ];
|
||||
|
||||
public function getCompanyableParents()
|
||||
// Overridden from Builder to automatically add the company
|
||||
public static function boot()
|
||||
{
|
||||
return [ 'accessorylog', 'assetlog', 'licenselog', 'consumablelog' ];
|
||||
parent::boot();
|
||||
static::creating( function (Actionlog $actionlog) {
|
||||
// If the admin is a superadmin, let's see if the target instead has a company.
|
||||
if (Auth::user() && Auth::user()->isSuperUser()) {
|
||||
if ($actionlog->target) {
|
||||
$actionlog->company_id = $actionlog->target->company_id;
|
||||
} else if ($actionlog->item) {
|
||||
$actionlog->company_id = $actionlog->item->company_id;
|
||||
}
|
||||
} else if (Auth::user() && Auth::user()->company) {
|
||||
$actionlog->company_id = Auth::user()->company_id;
|
||||
}
|
||||
});
|
||||
}
|
||||
// Eloquent Relationships below
|
||||
public function item()
|
||||
{
|
||||
return $this->morphTo('item')->withTrashed();
|
||||
}
|
||||
|
||||
public function assetlog()
|
||||
public function itemType()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\Asset', 'asset_id')
|
||||
->withTrashed();
|
||||
if($this->item_type == AssetModel::class) {
|
||||
return "model";
|
||||
}
|
||||
return camel_case(class_basename($this->item_type));
|
||||
}
|
||||
|
||||
public function uploads()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\Asset', 'asset_id')
|
||||
return $this->morphTo('item')
|
||||
->where('action_type', '=', 'uploaded')
|
||||
->withTrashed();
|
||||
}
|
||||
|
||||
public function licenselog()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\License', 'asset_id')
|
||||
->withTrashed();
|
||||
}
|
||||
|
||||
public function componentlog()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\Component', 'component_id')
|
||||
->withTrashed();
|
||||
}
|
||||
|
||||
public function accessorylog()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\Accessory', 'accessory_id')
|
||||
->withTrashed();
|
||||
}
|
||||
|
||||
public function consumablelog()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\Consumable', 'consumable_id')
|
||||
->withTrashed();
|
||||
}
|
||||
|
||||
public function adminlog()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\User', 'user_id')
|
||||
->withTrashed();
|
||||
}
|
||||
|
||||
public function userlog()
|
||||
{
|
||||
return $this->target();
|
||||
}
|
||||
|
||||
return $this->belongsTo('\App\Models\User', 'checkedout_to')
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id')
|
||||
->withTrashed();
|
||||
}
|
||||
|
||||
public function target()
|
||||
{
|
||||
return $this->morphTo('target');
|
||||
}
|
||||
|
||||
public function childlogs()
|
||||
{
|
||||
|
||||
return $this->hasMany('\App\Models\ActionLog', 'thread_id');
|
||||
}
|
||||
|
||||
public function parentlog()
|
||||
{
|
||||
|
||||
return $this->belongsTo('\App\Models\ActionLog', 'thread_id');
|
||||
}
|
||||
|
||||
@@ -134,44 +125,10 @@ class Actionlog extends Model implements ICompanyableChild
|
||||
public function getListingOfActionLogsChronologicalOrder()
|
||||
{
|
||||
|
||||
return DB::table('asset_logs')
|
||||
->select('*')
|
||||
return $this->all()
|
||||
->where('action_type', '!=', 'uploaded')
|
||||
->orderBy('asset_id', 'asc')
|
||||
->orderBy('item_id', 'asc')
|
||||
->orderBy('created_at', 'asc')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* getLatestCheckoutActionForAssets
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getLatestCheckoutActionForAssets()
|
||||
{
|
||||
|
||||
return DB::table('asset_logs')
|
||||
->select(DB::raw('asset_id, MAX(created_at) as last_created'))
|
||||
->where('action_type', '=', 'checkout')
|
||||
->groupBy('asset_id')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* scopeCheckoutWithoutAcceptance
|
||||
*
|
||||
* @param $query
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function scopeCheckoutWithoutAcceptance($query)
|
||||
{
|
||||
|
||||
return $query->where('action_type', '=', 'checkout')
|
||||
->where('accepted_id', '=', null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Traits\UniqueUndeletedTrait;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Company;
|
||||
use App\Models\Location;
|
||||
use App\Models\Loggable;
|
||||
use App\Models\Requestable;
|
||||
use App\Models\Setting;
|
||||
use Auth;
|
||||
use Config;
|
||||
use DateTime;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Log;
|
||||
use Parsedown;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
use App\Http\Traits\UniqueUndeletedTrait;
|
||||
use DateTime;
|
||||
use App\Models\Setting;
|
||||
use App\Helpers\Helper;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Model for Assets.
|
||||
@@ -23,7 +25,9 @@ use Auth;
|
||||
*/
|
||||
class Asset extends Depreciable
|
||||
{
|
||||
use Loggable;
|
||||
use SoftDeletes;
|
||||
use Requestable;
|
||||
|
||||
/**
|
||||
* The database table used by the model.
|
||||
@@ -55,6 +59,7 @@ class Asset extends Depreciable
|
||||
'supplier_id' => 'integer',
|
||||
'asset_tag' => 'required|min:1|max:255|unique_undeleted',
|
||||
'status' => 'integer',
|
||||
'purchase_cost' => 'numeric',
|
||||
];
|
||||
|
||||
|
||||
@@ -72,22 +77,36 @@ class Asset extends Depreciable
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function availableForCheckout()
|
||||
{
|
||||
return (
|
||||
empty($this->assigned_to) &&
|
||||
$this->assetstatus->deployable == 1 &&
|
||||
empty($this->deleted_at)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checkout asset
|
||||
*/
|
||||
public function checkOutToUser($user, $admin, $checkout_at = null, $expected_checkin = null, $note = null, $name = null)
|
||||
{
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($expected_checkin) {
|
||||
$this->expected_checkin = $expected_checkin ;
|
||||
$this->expected_checkin = $expected_checkin;
|
||||
}
|
||||
|
||||
$this->last_checkout = $checkout_at;
|
||||
|
||||
$this->assigneduser()->associate($user);
|
||||
$this->name = $name;
|
||||
|
||||
if($name != null)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
@@ -95,9 +114,7 @@ class Asset extends Depreciable
|
||||
$this->accepted="pending";
|
||||
}
|
||||
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->save()) {
|
||||
|
||||
@@ -135,7 +152,8 @@ class Asset extends Depreciable
|
||||
|
||||
\Mail::send('emails.accept-asset', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Confirm asset delivery');
|
||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||
$m->subject(trans('mail.Confirm_asset_delivery'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -196,10 +214,12 @@ class Asset extends Depreciable
|
||||
{
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $this->id;
|
||||
$logaction->checkedout_to = $this->assigned_to;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->item_type = Asset::class;
|
||||
$logaction->item_id = $this->id;
|
||||
$logaction->target_type = User::class;
|
||||
$logaction->target_id = $this->assigned_to;
|
||||
$logaction->note = $note;
|
||||
$logaction->user_id = $admin->id;
|
||||
if ($checkout_at!='') {
|
||||
$logaction->created_at = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', date('Y-m-d H:i:s', strtotime($checkout_at)));
|
||||
} else {
|
||||
@@ -212,15 +232,10 @@ class Asset extends Depreciable
|
||||
}
|
||||
} else {
|
||||
// Update the asset data to null, since it's being checked in
|
||||
$logaction->checkedout_to = $asset->assigned_to;
|
||||
$logaction->checkedout_to = '';
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->target_id = '';
|
||||
$logaction->location_id = null;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->note = $note;
|
||||
$logaction->user_id = $admin->id;
|
||||
}
|
||||
$logaction->adminlog()->associate($admin);
|
||||
$logaction->user()->associate($admin);
|
||||
$log = $logaction->logaction($action);
|
||||
|
||||
return $logaction;
|
||||
@@ -257,8 +272,8 @@ class Asset extends Depreciable
|
||||
public function uploads()
|
||||
{
|
||||
|
||||
return $this->hasMany('\App\Models\Actionlog', 'asset_id')
|
||||
->where('asset_type', '=', 'hardware')
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')
|
||||
->where('item_type', '=', Asset::class)
|
||||
->where('action_type', '=', 'uploaded')
|
||||
->whereNotNull('filename')
|
||||
->orderBy('created_at', 'desc');
|
||||
@@ -295,8 +310,8 @@ class Asset extends Depreciable
|
||||
*/
|
||||
public function assetlog()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'asset_id')
|
||||
->where('asset_type', '=', 'hardware')
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')
|
||||
->where('item_type', '=', Asset::class)
|
||||
->orderBy('created_at', 'desc')
|
||||
->withTrashed();
|
||||
}
|
||||
@@ -563,12 +578,12 @@ public function checkin_email()
|
||||
public function scopeAssetsByLocation($query, $location)
|
||||
{
|
||||
return $query->where(function ($query) use ($location) {
|
||||
|
||||
|
||||
$query->whereHas('assigneduser', function ($query) use ($location) {
|
||||
|
||||
|
||||
$query->where('users.location_id', '=', $location->id);
|
||||
})->orWhere(function ($query) use ($location) {
|
||||
|
||||
|
||||
$query->where('assets.rtd_location_id', '=', $location->id);
|
||||
$query->whereNull('assets.assigned_to');
|
||||
});
|
||||
@@ -615,6 +630,23 @@ public function checkin_email()
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope for non-Archived assets
|
||||
*
|
||||
* @param Illuminate\Database\Query\Builder $query Query builder instance
|
||||
*
|
||||
* @return Illuminate\Database\Query\Builder Modified query builder
|
||||
*/
|
||||
|
||||
public function scopeNotArchived($query)
|
||||
{
|
||||
|
||||
return $query->whereHas('assetstatus', function ($query) {
|
||||
|
||||
$query->where('archived', '=', 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope for Archived assets
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Requestable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
@@ -14,6 +15,7 @@ use Watson\Validating\ValidatingTrait;
|
||||
class AssetModel extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use Requestable;
|
||||
protected $dates = ['deleted_at'];
|
||||
protected $table = 'models';
|
||||
|
||||
@@ -131,6 +133,22 @@ class AssetModel extends Model
|
||||
return $query->whereIn('category_id', $categoryIdListing);
|
||||
}
|
||||
|
||||
/**
|
||||
* scopeRequestable
|
||||
* Get all models that are requestable by a user.
|
||||
*
|
||||
* @param $query
|
||||
*
|
||||
* @return $query
|
||||
* @author Daniel Meltzer <parallelgrapefruit@gmail.com
|
||||
* @version v3.5
|
||||
*/
|
||||
public function scopeRequestableModels($query)
|
||||
{
|
||||
|
||||
return $query->where('requestable', '1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope to search on text
|
||||
*
|
||||
|
||||
59
app/Models/CheckoutRequest.php
Normal file
59
app/Models/CheckoutRequest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CheckoutRequest extends Model
|
||||
{
|
||||
//
|
||||
protected $fillable = ['user_id'];
|
||||
protected $table = 'checkout_requests';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function requestingUser()
|
||||
{
|
||||
return $this->user()->first();
|
||||
}
|
||||
|
||||
public function requestedItem()
|
||||
{
|
||||
return $this->morphTo('requestable');
|
||||
}
|
||||
|
||||
public function itemRequested() // Workaround for laravel polymorphic issue that's not being solved :(
|
||||
{
|
||||
return $this->requestedItem()->first();
|
||||
}
|
||||
|
||||
public function itemType()
|
||||
{
|
||||
return snake_case(class_basename($this->requestable_type));
|
||||
}
|
||||
|
||||
public function location()
|
||||
{
|
||||
if ($this->itemType() == "asset") {
|
||||
$asset = $this->itemRequested();
|
||||
if ($asset->assigneduser && $asset->assetloc) {
|
||||
return $asset->assetloc;
|
||||
} elseif ($asset->defaultLoc) {
|
||||
return $asset->defaultLoc;
|
||||
}
|
||||
}
|
||||
return $this->itemRequested()->location;
|
||||
}
|
||||
|
||||
public function name()
|
||||
{
|
||||
if ($this->itemType() == "asset") {
|
||||
return $this->itemRequested()->showAssetName();
|
||||
}
|
||||
return $this->itemRequested()->name;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,8 @@ final class Company extends Model
|
||||
|
||||
public static function scopeCompanyables($query, $column = 'company_id')
|
||||
{
|
||||
if (!static::isFullMultipleCompanySupportEnabled() || (Auth::check() && Auth::user()->isSuperUser())) {
|
||||
// If not logged in and hitting this, assume we are on the command line and don't scope?'
|
||||
if (!static::isFullMultipleCompanySupportEnabled() || (Auth::check() && Auth::user()->isSuperUser()) || (!Auth::check())) {
|
||||
return $query;
|
||||
} else {
|
||||
return static::scopeCompanyablesDirectly($query, $column);
|
||||
@@ -176,4 +177,27 @@ final class Company extends Model
|
||||
return e($company->name);
|
||||
}
|
||||
}
|
||||
|
||||
public function users() {
|
||||
return $this->hasMany(User::class);
|
||||
}
|
||||
|
||||
public function assets() {
|
||||
return $this->hasMany(Asset::class);
|
||||
}
|
||||
|
||||
public function licenses() {
|
||||
return $this->hasMany(License::class);
|
||||
}
|
||||
public function accessories() {
|
||||
return $this->hasMany(Accessory::class);
|
||||
}
|
||||
|
||||
public function consumables() {
|
||||
return $this->hasMany(Consumable::class);
|
||||
}
|
||||
|
||||
public function components() {
|
||||
return $this->hasMany(Component::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\ConsumableAssignment;
|
||||
use App\Models\Company;
|
||||
use App\Models\Location;
|
||||
use App\Models\Category;
|
||||
use App\Models\ActionLog;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\ConsumableAssignment;
|
||||
use App\Models\Location;
|
||||
use App\Models\Loggable;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
@@ -18,8 +19,9 @@ use Watson\Validating\ValidatingTrait;
|
||||
*/
|
||||
class Component extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use CompanyableTrait;
|
||||
use Loggable;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
protected $table = 'components';
|
||||
@@ -34,6 +36,7 @@ class Component extends Model
|
||||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'purchase_date' => 'date',
|
||||
'purchase_cost' => 'numeric',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -84,7 +87,7 @@ class Component extends Model
|
||||
*/
|
||||
public function assetlog()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'component_id')->where('asset_type', '=', 'component')->orderBy('created_at', 'desc')->withTrashed();
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')->where('item_type', Component::class)->orderBy('created_at', 'desc')->withTrashed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\ConsumableAssignment;
|
||||
use App\Models\Company;
|
||||
use App\Models\Location;
|
||||
use App\Models\Category;
|
||||
use App\Models\ActionLog;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\ConsumableAssignment;
|
||||
use App\Models\Location;
|
||||
use App\Models\Loggable;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
class Consumable extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use CompanyableTrait;
|
||||
use Loggable;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
protected $table = 'consumables';
|
||||
@@ -29,6 +31,7 @@ class Consumable extends Model
|
||||
'category_id' => 'required|integer',
|
||||
'company_id' => 'integer',
|
||||
'min_amt' => 'integer|min:1',
|
||||
'purchase_cost' => 'numeric',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -84,7 +87,7 @@ class Consumable extends Model
|
||||
*/
|
||||
public function assetlog()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'consumable_id')->where('asset_type', '=', 'consumable')->orderBy('created_at', 'desc')->withTrashed();
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')->where('item_type', Consumable::class)->orderBy('created_at', 'desc')->withTrashed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@ class CustomField extends Model
|
||||
|
||||
*/
|
||||
public static $PredefinedFormats=[
|
||||
"ANY" => "",
|
||||
"ALPHA" => "alpha",
|
||||
"EMAIL" => "email",
|
||||
"DATE" => "date",
|
||||
"URL" => "url",
|
||||
"NUMERIC" => "numeric",
|
||||
"MAC" => "regex:/^[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}$/",
|
||||
"IP" => "ip"
|
||||
"ANY" => "",
|
||||
"ALPHA" => "alpha",
|
||||
"EMAIL" => "email",
|
||||
"DATE" => "date",
|
||||
"URL" => "url",
|
||||
"NUMERIC" => "numeric",
|
||||
"MAC" => "regex:/^[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}$/",
|
||||
"IP" => "ip",
|
||||
];
|
||||
|
||||
public $rules=[
|
||||
@@ -109,4 +109,43 @@ class CustomField extends Model
|
||||
$this->attributes['format']=$value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a value string as an array for select boxes and checkboxes.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.4]
|
||||
* @return Array
|
||||
*/
|
||||
public function formatFieldValuesAsArray() {
|
||||
$arr = preg_split("/\\r\\n|\\r|\\n/", $this->field_values);
|
||||
|
||||
$result[''] = 'Select '.strtolower($this->format);
|
||||
|
||||
for ($x = 0; $x < count($arr); $x++) {
|
||||
$arr_parts = explode('|', $arr[$x]);
|
||||
if ($arr_parts[0]!='') {
|
||||
if (key_exists('1',$arr_parts)) {
|
||||
$result[$arr_parts[0]] = $arr_parts[1];
|
||||
} else {
|
||||
$result[$arr_parts[0]] = $arr_parts[0];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isFieldDecryptable($string) {
|
||||
if (($this->field_encrypted=='1') && ($string!='')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Gate;
|
||||
|
||||
class CustomFieldset extends Model
|
||||
{
|
||||
@@ -30,16 +31,21 @@ class CustomFieldset extends Model
|
||||
{
|
||||
$rules=[];
|
||||
foreach ($this->fields as $field) {
|
||||
$rule=[];
|
||||
if ($field->pivot->required) {
|
||||
$rule[]="required";
|
||||
$rule = [];
|
||||
|
||||
if (($field->field_encrypted!='1') ||
|
||||
(($field->field_encrypted =='1') && (Gate::allows('admin')) ))
|
||||
{
|
||||
|
||||
if ($field->pivot->required) {
|
||||
$rule[]="required";
|
||||
}
|
||||
}
|
||||
|
||||
array_push($rule, $field->attributes['format']);
|
||||
$rules[$field->db_column_name()]=$rule;
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
//requiredness goes *here*
|
||||
//sequence goes here?
|
||||
}
|
||||
|
||||
@@ -35,6 +35,11 @@ class Ldap extends Model
|
||||
putenv('LDAPTLS_REQCERT=never');
|
||||
}
|
||||
|
||||
// If the user specifies where CA Certs are, make sure to use them
|
||||
if(env("LDAPTLS_CACERT")) {
|
||||
putenv("LDAPTLS_CACERT=".env("LDAPTLS_CACERT"));
|
||||
}
|
||||
|
||||
$connection = @ldap_connect($ldap_host);
|
||||
|
||||
if (!$connection) {
|
||||
@@ -76,11 +81,18 @@ class Ldap extends Model
|
||||
if ($settings->is_ad =='1')
|
||||
{
|
||||
|
||||
// In case they haven't added an AD domain
|
||||
if ($settings->ad_domain == '') {
|
||||
$userDn = $username.'@'.$settings->email_domain;
|
||||
// Check if they are using the userprincipalname for the username field.
|
||||
// If they are, we can skip building the UPN to authenticate against AD
|
||||
if ($ldap_username_field=='userprincipalname')
|
||||
{
|
||||
$userDn = $username;
|
||||
} else {
|
||||
$userDn = $username.'@'.$settings->ad_domain;
|
||||
// In case they haven't added an AD domain
|
||||
if ($settings->ad_domain == '') {
|
||||
$userDn = $username.'@'.$settings->email_domain;
|
||||
} else {
|
||||
$userDn = $username.'@'.$settings->ad_domain;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -186,6 +198,7 @@ class Ldap extends Model
|
||||
{
|
||||
$item = Ldap::parseAndMapLdapAttributes($ldapatttibutes);
|
||||
|
||||
|
||||
// Create user from LDAP data
|
||||
if (!empty($item["username"])) {
|
||||
$user = new User;
|
||||
@@ -193,7 +206,14 @@ class Ldap extends Model
|
||||
$user->last_name = $item["lastname"];
|
||||
$user->username = $item["username"];
|
||||
$user->email = $item["email"];
|
||||
$user->password = bcrypt(Input::get("password"));
|
||||
|
||||
if (Setting::getSettings()->ldap_pw_sync=='1') {
|
||||
$user->password = bcrypt(Input::get("password"));
|
||||
} else {
|
||||
$pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 25);
|
||||
$user->password = bcrypt($pass);
|
||||
}
|
||||
|
||||
$user->activated = 1;
|
||||
$user->ldap_import = 1;
|
||||
$user->notes = 'Imported on first login from LDAP';
|
||||
@@ -234,8 +254,12 @@ class Ldap extends Model
|
||||
|
||||
// Perform the search
|
||||
do {
|
||||
|
||||
// Paginate (non-critical, if not supported by server)
|
||||
ldap_control_paged_result($ldapconn, $page_size, false, $cookie);
|
||||
if (!$ldap_paging = @ldap_control_paged_result($ldapconn, $page_size, false, $cookie)) {
|
||||
throw new Exception('Problem with your LDAP connection. Try checking the Use TLS setting in Admin > Settings. ');
|
||||
}
|
||||
|
||||
|
||||
$search_results = ldap_search($ldapconn, $base_dn, '('.$filter.')');
|
||||
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Loggable;
|
||||
use DB;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
class License extends Depreciable
|
||||
{
|
||||
use SoftDeletes;
|
||||
use CompanyableTrait;
|
||||
use Loggable;
|
||||
protected $injectUniqueIdentifier = true;
|
||||
use ValidatingTrait;
|
||||
|
||||
@@ -36,6 +37,11 @@ class License extends Depreciable
|
||||
return $this->belongsTo('\App\Models\Company', 'company_id');
|
||||
}
|
||||
|
||||
public function manufacturer()
|
||||
{
|
||||
return $this->belongsTo('\App\Models\Manufacturer', 'manufacturer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the assigned user
|
||||
*/
|
||||
@@ -49,8 +55,8 @@ class License extends Depreciable
|
||||
*/
|
||||
public function assetlog()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'asset_id')
|
||||
->where('asset_type', '=', 'software')
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')
|
||||
->where('item_type', '=', License::class)
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
@@ -59,8 +65,8 @@ class License extends Depreciable
|
||||
*/
|
||||
public function uploads()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'asset_id')
|
||||
->where('asset_type', '=', 'software')
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')
|
||||
->where('item_type', '=', License::class)
|
||||
->where('action_type', '=', 'uploaded')
|
||||
->whereNotNull('filename')
|
||||
->orderBy('created_at', 'desc');
|
||||
@@ -208,6 +214,7 @@ class License extends Depreciable
|
||||
->orWhere('serial', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('notes', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('order_number', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('purchase_order', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('purchase_date', 'LIKE', '%'.$search.'%')
|
||||
->orWhere('purchase_cost', 'LIKE', '%'.$search.'%');
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Loggable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -8,6 +9,7 @@ class LicenseSeat extends Model implements ICompanyableChild
|
||||
{
|
||||
use CompanyableChildTrait;
|
||||
use SoftDeletes;
|
||||
use Loggable;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
protected $guarded = 'id';
|
||||
|
||||
135
app/Models/Loggable.php
Normal file
135
app/Models/Loggable.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
use App\Models\CheckoutRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
trait Loggable
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Daniel Meltzer <parallelgrapefruit@gmail.com
|
||||
* @since [v3.4]
|
||||
* @return \App\Models\Actionlog
|
||||
*/
|
||||
|
||||
public function log()
|
||||
{
|
||||
return $this->morphMany(Actionlog::class, 'item');
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Daniel Meltzer <parallelgrapefruit@gmail.com
|
||||
* @since [v3.4]
|
||||
* @return \App\Models\Actionlog
|
||||
*/
|
||||
public function logCheckout($note, $target = null /*target is overridable for components*/)
|
||||
{
|
||||
$log = new Actionlog;
|
||||
|
||||
// We need to special case licenses because of license_seat vs license. So much for clean polymorphism :)
|
||||
if (static::class == LicenseSeat::class) {
|
||||
$log->item_type = License::class;
|
||||
$log->item_id = $this->license_id;
|
||||
} else {
|
||||
$log->item_type = static::class;
|
||||
$log->item_id = $this->id;
|
||||
}
|
||||
|
||||
$log->user_id = Auth::user()->id;
|
||||
|
||||
if (!is_null($this->asset_id) || isset($target)) {
|
||||
$log->target_type = Asset::class;
|
||||
$log->target_id = $this->asset_id;
|
||||
} else if (!is_null($this->assigned_to)) {
|
||||
$log->target_type = User::class;
|
||||
$log->target_id = $this->assigned_to;
|
||||
}
|
||||
|
||||
$item = call_user_func(array($log->target_type, 'find'), $log->target_id);
|
||||
$log->location_id = $item->location_id;
|
||||
$log->note = $note;
|
||||
$log->logaction('checkout');
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Daniel Meltzer <parallelgrapefruit@gmail.com
|
||||
* @since [v3.4]
|
||||
* @return \App\Models\Actionlog
|
||||
*/
|
||||
public function logCheckin($note)
|
||||
{
|
||||
$log = new Actionlog;
|
||||
if (static::class == LicenseSeat::class) {
|
||||
$log->item_type = License::class;
|
||||
$log->item_id = $this->license_id;
|
||||
} else {
|
||||
$log->item_type = static::class;
|
||||
$log->item_id = $this->id;
|
||||
}
|
||||
$log->location_id = null;
|
||||
$log->note = $note;
|
||||
$log->user_id = Auth::user()->id;
|
||||
$log->logaction('checkin from');
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Daniel Meltzer <parallelgrapefruit@gmail.com
|
||||
* @since [v3.5]
|
||||
* @return \App\Models\Actionlog
|
||||
*/
|
||||
public function logCreate($note = null)
|
||||
{
|
||||
$user_id = -1;
|
||||
if (Auth::user()) {
|
||||
$user_id = Auth::user()->id;
|
||||
}
|
||||
$log = new Actionlog;
|
||||
if (static::class == LicenseSeat::class) {
|
||||
$log->item_type = License::class;
|
||||
$log->item_id = $this->license_id;
|
||||
} else {
|
||||
$log->item_type = static::class;
|
||||
$log->item_id = $this->id;
|
||||
}
|
||||
$log->location_id = null;
|
||||
$log->note = $note;
|
||||
$log->user_id = $user_id;
|
||||
$log->logaction('created');
|
||||
$log->save();
|
||||
return $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Daniel Meltzer <parallelgrapefruit@gmail.com
|
||||
* @since [v3.4]
|
||||
* @return \App\Models\Actionlog
|
||||
*/
|
||||
public function logUpload($filename, $note)
|
||||
{
|
||||
$log = new Actionlog;
|
||||
if (static::class == LicenseSeat::class) {
|
||||
$log->item_type = License::class;
|
||||
$log->item_id = $this->license_id;
|
||||
} else {
|
||||
$log->item_type = static::class;
|
||||
$log->item_id = $this->id;
|
||||
}
|
||||
$log->user_id = Auth::user()->id;
|
||||
$log->note = $note;
|
||||
$log->target_id = null;
|
||||
$log->created_at = date("Y-m-d h:i:s");
|
||||
$log->filename = $filename;
|
||||
$log->logaction('uploaded');
|
||||
|
||||
return $log;
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,21 @@ class Manufacturer extends Model
|
||||
return $this->hasManyThrough('\App\Models\Asset', '\App\Models\AssetModel', 'manufacturer_id', 'model_id');
|
||||
}
|
||||
|
||||
public function licenses()
|
||||
{
|
||||
return $this->hasMany('\App\Models\License', 'manufacturer_id');
|
||||
}
|
||||
|
||||
public function accessories()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Accessory', 'manufacturer_id');
|
||||
}
|
||||
|
||||
public function consumables()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Consumable', 'manufacturer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope to search on text
|
||||
*
|
||||
|
||||
45
app/Models/Requestable.php
Normal file
45
app/Models/Requestable.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\CheckoutRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
// $asset->requests
|
||||
// $asset->isRequestedBy($user)
|
||||
// $asset->whereRequestedBy($user)
|
||||
trait Requestable
|
||||
{
|
||||
|
||||
public function requests()
|
||||
{
|
||||
return $this->morphMany(CheckoutRequest::class, 'requestable');
|
||||
}
|
||||
|
||||
public function isRequestedBy(User $user)
|
||||
{
|
||||
return $this->requests()
|
||||
->where('user_id', $user->id)
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function scopeRequestedBy($query, User $user)
|
||||
{
|
||||
return $query->whereHas('requests', function ($query) use ($user) {
|
||||
$query->where('user_id', $user->id);
|
||||
});
|
||||
}
|
||||
|
||||
public function request()
|
||||
{
|
||||
$this->requests()->save(
|
||||
new CheckoutRequest(['user_id' => Auth::id()])
|
||||
);
|
||||
}
|
||||
|
||||
public function cancelRequest()
|
||||
{
|
||||
$this->requests()->where('user_id', Auth::id())->delete();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Http\Traits\UniqueUndeletedTrait;
|
||||
use App\Models\Setting;
|
||||
|
||||
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
|
||||
{
|
||||
@@ -67,7 +68,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
|
||||
// Loop through the groups to see if any of them grant this permission
|
||||
foreach ($user_groups as $user_group) {
|
||||
$group_permissions = json_decode($user_group->permissions, true);
|
||||
$group_permissions = (array) json_decode($user_group->permissions, true);
|
||||
if (((array_key_exists($section, $group_permissions)) && ($group_permissions[$section]=='1'))) {
|
||||
return true;
|
||||
}
|
||||
@@ -84,7 +85,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
|
||||
foreach ($this->groups as $user_group) {
|
||||
$group_permissions = json_decode($user_group->permissions, true);
|
||||
$group_array = $group_permissions;
|
||||
$group_array = (array)$group_permissions;
|
||||
if ((array_key_exists('superuser', $group_array)) && ($group_permissions['superuser']=='1')) {
|
||||
return true;
|
||||
}
|
||||
@@ -146,10 +147,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
return config('app.url').'/uploads/avatars/'.$this->avatar;
|
||||
}
|
||||
|
||||
if ($this->email) {
|
||||
// Generate the Gravatar hash
|
||||
if ((Setting::getSettings()->load_remote=='1') && ($this->email!='')) {
|
||||
$gravatar = md5(strtolower(trim($this->email)));
|
||||
// Return the Gravatar url
|
||||
return "//gravatar.com/avatar/".$gravatar;
|
||||
}
|
||||
|
||||
@@ -202,7 +201,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
*/
|
||||
public function userlog()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'checkedout_to')->orderBy('created_at', 'DESC')->withTrashed();
|
||||
return $this->hasMany('\App\Models\Actionlog', 'target_id')->orderBy('created_at', 'DESC')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,10 +231,10 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
|
||||
public function accountStatus()
|
||||
{
|
||||
if ($this->sentryThrottle) {
|
||||
if ($this->sentryThrottle->suspended==1) {
|
||||
if ($this->throttle) {
|
||||
if ($this->throttle->suspended==1) {
|
||||
return 'suspended';
|
||||
} elseif ($this->sentryThrottle->banned==1) {
|
||||
} elseif ($this->throttle->banned==1) {
|
||||
return 'banned';
|
||||
} else {
|
||||
return false;
|
||||
@@ -255,14 +254,22 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
*/
|
||||
public function uploads()
|
||||
{
|
||||
return $this->hasMany('\App\Models\Actionlog', 'asset_id')
|
||||
->where('asset_type', '=', 'user')
|
||||
return $this->hasMany('\App\Models\Actionlog', 'item_id')
|
||||
->where('item_type', User::class)
|
||||
->where('action_type', '=', 'uploaded')
|
||||
->whereNotNull('filename')
|
||||
->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
public function sentryThrottle()
|
||||
/**
|
||||
* Fetch Items User has requested
|
||||
*/
|
||||
public function checkoutRequests()
|
||||
{
|
||||
return $this->belongsToMany(Asset::class, 'checkout_requests');
|
||||
}
|
||||
|
||||
public function throttle()
|
||||
{
|
||||
return $this->hasOne('\App\Models\Throttle');
|
||||
}
|
||||
@@ -302,6 +309,10 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
->orWhere('username', '=', $user_email);
|
||||
}
|
||||
|
||||
public static function generateEmailFromFullName($name) {
|
||||
$username = User::generateFormattedNameFromFullName(Setting::getSettings()->email_format, $name);
|
||||
return $username['username'].'@'.Setting::getSettings()->email_domain;
|
||||
}
|
||||
|
||||
public static function generateFormattedNameFromFullName($format = 'filastname', $users_name)
|
||||
{
|
||||
@@ -333,8 +344,9 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
} elseif ($format=='firstname') {
|
||||
$email_last_name.=str_replace(' ', '', $last_name);
|
||||
$email_prefix = $first_name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$user_username = $email_prefix;
|
||||
|
||||
@@ -91,6 +91,19 @@ class AuthServiceProvider extends ServiceProvider
|
||||
}
|
||||
});
|
||||
|
||||
$gate->define('assets.edit', function ($user) {
|
||||
if (($user->hasAccess('assets.edit')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Checks for some level of management
|
||||
$gate->define('assets.manage', function ($user) {
|
||||
if (($user->hasAccess('assets.checkin')) || ($user->hasAccess('assets.edit')) || ($user->hasAccess('assets.delete')) || ($user->hasAccess('assets.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
# -----------------------------------------
|
||||
# Accessories
|
||||
@@ -131,6 +144,13 @@ class AuthServiceProvider extends ServiceProvider
|
||||
}
|
||||
});
|
||||
|
||||
// Checks for some level of management
|
||||
$gate->define('accessories.manage', function ($user) {
|
||||
if (($user->hasAccess('accessories.checkin')) || ($user->hasAccess('accessories.edit')) || ($user->hasAccess('accessories.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
# -----------------------------------------
|
||||
# Consumables
|
||||
# -----------------------------------------
|
||||
@@ -170,6 +190,13 @@ class AuthServiceProvider extends ServiceProvider
|
||||
}
|
||||
});
|
||||
|
||||
// Checks for some level of management
|
||||
$gate->define('consumables.manage', function ($user) {
|
||||
if (($user->hasAccess('consumables.checkin')) || ($user->hasAccess('consumables.edit')) || ($user->hasAccess('consumables.delete')) || ($user->hasAccess('consumables.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
# -----------------------------------------
|
||||
@@ -228,6 +255,25 @@ class AuthServiceProvider extends ServiceProvider
|
||||
}
|
||||
});
|
||||
|
||||
$gate->define('components.checkout', function ($user) {
|
||||
if (($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$gate->define('components.checkout', function ($user) {
|
||||
if (($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Checks for some level of management
|
||||
$gate->define('components.manage', function ($user) {
|
||||
if (($user->hasAccess('components.edit')) || ($user->hasAccess('components.delete')) || ($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
# -----------------------------------------
|
||||
# Licenses
|
||||
@@ -274,6 +320,13 @@ class AuthServiceProvider extends ServiceProvider
|
||||
}
|
||||
});
|
||||
|
||||
// Checks for some level of management
|
||||
$gate->define('licenses.manage', function ($user) {
|
||||
if (($user->hasAccess('licenses.checkin')) || ($user->hasAccess('licenses.edit')) || ($user->hasAccess('licenses.delete')) || ($user->hasAccess('licenses.checkout')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
"doctrine/common": "v2.5.3",
|
||||
"doctrine/dbal": "v2.4.2",
|
||||
"barryvdh/laravel-debugbar": "^2.1",
|
||||
"spatie/laravel-backup": "3.8.1"
|
||||
"spatie/laravel-backup": "3.8.1",
|
||||
"misterphilip/maintenance-mode": "1.0.*",
|
||||
"neitanod/forceutf8": "dev-master"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
|
||||
407
composer.lock
generated
407
composer.lock
generated
@@ -4,21 +4,21 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "bf63c53f99a010e882f5c4b797e9f098",
|
||||
"content-hash": "47c6ecb6331ff36a3e58ca8ddac195f8",
|
||||
"hash": "ed9f8700f2dcd943ff662a82e4d8314f",
|
||||
"content-hash": "9c0251ddc1a110d83a762483abeea079",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.18.30",
|
||||
"version": "3.19.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "fbce85229b913a9e1aded54e464a9bbff0787bf1"
|
||||
"reference": "3cb90413129da42c9d3289d542bee0ae1049892c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fbce85229b913a9e1aded54e464a9bbff0787bf1",
|
||||
"reference": "fbce85229b913a9e1aded54e464a9bbff0787bf1",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3cb90413129da42c9d3289d542bee0ae1049892c",
|
||||
"reference": "3cb90413129da42c9d3289d542bee0ae1049892c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -85,7 +85,7 @@
|
||||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2016-07-18 16:15:53"
|
||||
"time": "2016-08-23 20:58:48"
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php-laravel",
|
||||
@@ -145,21 +145,21 @@
|
||||
},
|
||||
{
|
||||
"name": "barryvdh/laravel-debugbar",
|
||||
"version": "v2.2.2",
|
||||
"version": "V2.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||
"reference": "c291e58d0a13953e0f68d99182ee77ebc693edc0"
|
||||
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/c291e58d0a13953e0f68d99182ee77ebc693edc0",
|
||||
"reference": "c291e58d0a13953e0f68d99182ee77ebc693edc0",
|
||||
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
|
||||
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "5.1.*|5.2.*",
|
||||
"maximebf/debugbar": "~1.11.0",
|
||||
"illuminate/support": "5.1.*|5.2.*|5.3.*",
|
||||
"maximebf/debugbar": "~1.11.0|~1.12.0",
|
||||
"php": ">=5.5.9",
|
||||
"symfony/finder": "~2.7|~3.0"
|
||||
},
|
||||
@@ -195,7 +195,7 @@
|
||||
"profiler",
|
||||
"webprofiler"
|
||||
],
|
||||
"time": "2016-05-11 13:54:43"
|
||||
"time": "2016-07-29 15:00:36"
|
||||
},
|
||||
{
|
||||
"name": "classpreloader/classpreloader",
|
||||
@@ -754,12 +754,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/erusev/parsedown.git",
|
||||
"reference": "490a8f35a4163f59230f53c34f1fbb22a864c01e"
|
||||
"reference": "f671ae73647b6666c1442cbaac98e5d60208e409"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/490a8f35a4163f59230f53c34f1fbb22a864c01e",
|
||||
"reference": "490a8f35a4163f59230f53c34f1fbb22a864c01e",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/f671ae73647b6666c1442cbaac98e5d60208e409",
|
||||
"reference": "f671ae73647b6666c1442cbaac98e5d60208e409",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -788,7 +788,7 @@
|
||||
"markdown",
|
||||
"parser"
|
||||
],
|
||||
"time": "2016-03-09 17:02:39"
|
||||
"time": "2016-07-27 08:05:24"
|
||||
},
|
||||
{
|
||||
"name": "fideloper/proxy",
|
||||
@@ -1018,12 +1018,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Intervention/image.git",
|
||||
"reference": "6886d43f5babe6900c29c59640ca81401fe71c80"
|
||||
"reference": "45a41a38bd1e5290cd51ab773013e6f041b2b711"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Intervention/image/zipball/6886d43f5babe6900c29c59640ca81401fe71c80",
|
||||
"reference": "6886d43f5babe6900c29c59640ca81401fe71c80",
|
||||
"url": "https://api.github.com/repos/Intervention/image/zipball/45a41a38bd1e5290cd51ab773013e6f041b2b711",
|
||||
"reference": "45a41a38bd1e5290cd51ab773013e6f041b2b711",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1072,7 +1072,7 @@
|
||||
"thumbnail",
|
||||
"watermark"
|
||||
],
|
||||
"time": "2016-06-22 08:03:11"
|
||||
"time": "2016-08-19 14:41:12"
|
||||
},
|
||||
{
|
||||
"name": "jakub-onderka/php-console-color",
|
||||
@@ -1221,16 +1221,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v5.2.39",
|
||||
"version": "v5.2.45",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a"
|
||||
"reference": "2a79f920d5584ec6df7cf996d922a742d11095d1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/c2a77050269b4e03bd9a735a9f24e573a7598b8a",
|
||||
"reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/2a79f920d5584ec6df7cf996d922a742d11095d1",
|
||||
"reference": "2a79f920d5584ec6df7cf996d922a742d11095d1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1287,7 +1287,8 @@
|
||||
"illuminate/support": "self.version",
|
||||
"illuminate/translation": "self.version",
|
||||
"illuminate/validation": "self.version",
|
||||
"illuminate/view": "self.version"
|
||||
"illuminate/view": "self.version",
|
||||
"tightenco/collect": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "~3.0",
|
||||
@@ -1310,7 +1311,7 @@
|
||||
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).",
|
||||
"symfony/css-selector": "Required to use some of the crawler integration testing tools (2.8.*|3.0.*).",
|
||||
"symfony/dom-crawler": "Required to use most of the crawler integration testing tools (2.8.*|3.0.*).",
|
||||
"symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)."
|
||||
"symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -1346,7 +1347,7 @@
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2016-06-17 19:25:12"
|
||||
"time": "2016-08-26 11:44:52"
|
||||
},
|
||||
{
|
||||
"name": "laravelcollective/html",
|
||||
@@ -1461,16 +1462,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "1.0.25",
|
||||
"version": "1.0.27",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem.git",
|
||||
"reference": "a76afa4035931be0c78ca8efc6abf3902362f437"
|
||||
"reference": "50e2045ed70a7e75a5e30bc3662904f3b67af8a9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a76afa4035931be0c78ca8efc6abf3902362f437",
|
||||
"reference": "a76afa4035931be0c78ca8efc6abf3902362f437",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/50e2045ed70a7e75a5e30bc3662904f3b67af8a9",
|
||||
"reference": "50e2045ed70a7e75a5e30bc3662904f3b67af8a9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1540,7 +1541,7 @@
|
||||
"sftp",
|
||||
"storage"
|
||||
],
|
||||
"time": "2016-07-18 12:22:57"
|
||||
"time": "2016-08-10 08:55:11"
|
||||
},
|
||||
{
|
||||
"name": "maknz/slack",
|
||||
@@ -1548,12 +1549,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/maknz/slack.git",
|
||||
"reference": "e44a4685743c2286466ce5f0dbc025cf23248333"
|
||||
"reference": "e9bab77eb7344f4697756ca55386576b05dc8e5a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/maknz/slack/zipball/e44a4685743c2286466ce5f0dbc025cf23248333",
|
||||
"reference": "e44a4685743c2286466ce5f0dbc025cf23248333",
|
||||
"url": "https://api.github.com/repos/maknz/slack/zipball/e9bab77eb7344f4697756ca55386576b05dc8e5a",
|
||||
"reference": "e9bab77eb7344f4697756ca55386576b05dc8e5a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1590,20 +1591,20 @@
|
||||
"laravel",
|
||||
"slack"
|
||||
],
|
||||
"time": "2016-06-26 05:15:48"
|
||||
"time": "2016-07-27 23:17:40"
|
||||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
"version": "v1.11.1",
|
||||
"version": "v1.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||
"reference": "d9302891c1f0a0ac5a4f66725163a00537c6359f"
|
||||
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/d9302891c1f0a0ac5a4f66725163a00537c6359f",
|
||||
"reference": "d9302891c1f0a0ac5a4f66725163a00537c6359f",
|
||||
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
|
||||
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.11-dev"
|
||||
"dev-master": "1.12-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -1651,20 +1652,65 @@
|
||||
"debug",
|
||||
"debugbar"
|
||||
],
|
||||
"time": "2016-01-22 12:22:23"
|
||||
"time": "2016-05-15 13:11:34"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.20.0",
|
||||
"name": "misterphilip/maintenance-mode",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "55841909e2bcde01b5318c35f2b74f8ecc86e037"
|
||||
"url": "https://github.com/MisterPhilip/maintenance-mode.git",
|
||||
"reference": "35e061703edb3c0703baea677335c03085f2b179"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/55841909e2bcde01b5318c35f2b74f8ecc86e037",
|
||||
"reference": "55841909e2bcde01b5318c35f2b74f8ecc86e037",
|
||||
"url": "https://api.github.com/repos/MisterPhilip/maintenance-mode/zipball/35e061703edb3c0703baea677335c03085f2b179",
|
||||
"reference": "35e061703edb3c0703baea677335c03085f2b179",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "5.0 - 5.2",
|
||||
"nesbot/carbon": "~1.19",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"MisterPhilip\\MaintenanceMode": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Philip Lawrence",
|
||||
"email": "philip@misterphilip.com",
|
||||
"homepage": "http://misterphilip.com"
|
||||
}
|
||||
],
|
||||
"description": "An enhanced drop-in replacement for Laravel 5's maintenance mode",
|
||||
"keywords": [
|
||||
"l5",
|
||||
"laravel",
|
||||
"laravel5",
|
||||
"maintenance"
|
||||
],
|
||||
"time": "2015-12-23 07:24:42"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.21.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952",
|
||||
"reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1729,7 +1775,7 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-07-02 14:02:10"
|
||||
"time": "2016-07-29 03:23:52"
|
||||
},
|
||||
{
|
||||
"name": "mtdowling/cron-expression",
|
||||
@@ -1830,6 +1876,40 @@
|
||||
],
|
||||
"time": "2016-01-05 18:25:05"
|
||||
},
|
||||
{
|
||||
"name": "neitanod/forceutf8",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/neitanod/forceutf8.git",
|
||||
"reference": "2c1b21e00ed16b2b083ae4e27901cb5f2856db90"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/neitanod/forceutf8/zipball/2c1b21e00ed16b2b083ae4e27901cb5f2856db90",
|
||||
"reference": "2c1b21e00ed16b2b083ae4e27901cb5f2856db90",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"ForceUTF8\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastián Grignoli",
|
||||
"email": "grignoli@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Class Encoding featuring popular Encoding::toUTF8() function --formerly known as forceUTF8()-- that fixes mixed encoded strings.",
|
||||
"homepage": "https://github.com/neitanod/forceutf8",
|
||||
"time": "2015-05-07 16:37:23"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "1.21.0",
|
||||
@@ -1978,16 +2058,16 @@
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
||||
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2015,6 +2095,7 @@
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
"homepage": "https://github.com/php-fig/http-message",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-message",
|
||||
@@ -2023,7 +2104,7 @@
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2015-05-04 20:22:00"
|
||||
"time": "2016-08-06 14:39:51"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
@@ -2302,16 +2383,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "a7abb7153f6d1da47f87ec50274844e246b09d9f"
|
||||
"reference": "926061e74229e935d3c5b4e9ba87237316c6693f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/a7abb7153f6d1da47f87ec50274844e246b09d9f",
|
||||
"reference": "a7abb7153f6d1da47f87ec50274844e246b09d9f",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/926061e74229e935d3c5b4e9ba87237316c6693f",
|
||||
"reference": "926061e74229e935d3c5b4e9ba87237316c6693f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2358,20 +2439,20 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 07:02:21"
|
||||
"time": "2016-07-30 07:22:48"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "c54bc3539c3b87e86799533801e8ae0e971d78c2"
|
||||
"reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/c54bc3539c3b87e86799533801e8ae0e971d78c2",
|
||||
"reference": "c54bc3539c3b87e86799533801e8ae0e971d78c2",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a",
|
||||
"reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2415,20 +2496,20 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:40:00"
|
||||
"time": "2016-07-30 07:22:48"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v3.1.2",
|
||||
"version": "v3.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "7f9839ede2070f53e7e2f0849b9bd14748c434c5"
|
||||
"reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7f9839ede2070f53e7e2f0849b9bd14748c434c5",
|
||||
"reference": "7f9839ede2070f53e7e2f0849b9bd14748c434c5",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c0c00c80b3a69132c4e55c3e7db32b4a387615e5",
|
||||
"reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2475,11 +2556,11 @@
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:41:56"
|
||||
"time": "2016-07-19 10:45:57"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
@@ -2528,16 +2609,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "1341139f906d295baa4f4abd55293d07e25a065a"
|
||||
"reference": "49ba00f8ede742169cb6b70abe33243f4d673f82"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/1341139f906d295baa4f4abd55293d07e25a065a",
|
||||
"reference": "1341139f906d295baa4f4abd55293d07e25a065a",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/49ba00f8ede742169cb6b70abe33243f4d673f82",
|
||||
"reference": "49ba00f8ede742169cb6b70abe33243f4d673f82",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2577,20 +2658,20 @@
|
||||
],
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 07:02:21"
|
||||
"time": "2016-07-17 13:54:30"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "177b63b2d50b63fa6d82ea41359ed9928cc7a1fb"
|
||||
"reference": "d97ba4425e36e79c794e7d14ff36f00f081b37b3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/177b63b2d50b63fa6d82ea41359ed9928cc7a1fb",
|
||||
"reference": "177b63b2d50b63fa6d82ea41359ed9928cc7a1fb",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/d97ba4425e36e79c794e7d14ff36f00f081b37b3",
|
||||
"reference": "d97ba4425e36e79c794e7d14ff36f00f081b37b3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2659,7 +2740,7 @@
|
||||
],
|
||||
"description": "Symfony HttpKernel Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-30 16:30:17"
|
||||
"time": "2016-07-30 09:10:37"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
@@ -2830,16 +2911,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "d7cde1f9d94d87060204f863779389b61c382eeb"
|
||||
"reference": "768debc5996f599c4372b322d9061dba2a4bf505"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/d7cde1f9d94d87060204f863779389b61c382eeb",
|
||||
"reference": "d7cde1f9d94d87060204f863779389b61c382eeb",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/768debc5996f599c4372b322d9061dba2a4bf505",
|
||||
"reference": "768debc5996f599c4372b322d9061dba2a4bf505",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2875,11 +2956,11 @@
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:40:00"
|
||||
"time": "2016-07-28 11:13:34"
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/routing.git",
|
||||
@@ -2954,16 +3035,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "6bf844e1ee3c820c012386c10427a5c67bbefec8"
|
||||
"reference": "eee6c664853fd0576f21ae25725cfffeafe83f26"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/6bf844e1ee3c820c012386c10427a5c67bbefec8",
|
||||
"reference": "6bf844e1ee3c820c012386c10427a5c67bbefec8",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/eee6c664853fd0576f21ae25725cfffeafe83f26",
|
||||
"reference": "eee6c664853fd0576f21ae25725cfffeafe83f26",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3014,20 +3095,20 @@
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:40:00"
|
||||
"time": "2016-07-30 07:22:48"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v3.0.8",
|
||||
"version": "v3.0.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "2f046e9a9d571f22cc8b26783564876713b06579"
|
||||
"reference": "1f7e071aafc6676fcb6e3f0497f87c2397247377"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/2f046e9a9d571f22cc8b26783564876713b06579",
|
||||
"reference": "2f046e9a9d571f22cc8b26783564876713b06579",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/1f7e071aafc6676fcb6e3f0497f87c2397247377",
|
||||
"reference": "1f7e071aafc6676fcb6e3f0497f87c2397247377",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3077,7 +3158,7 @@
|
||||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"time": "2016-06-29 05:40:00"
|
||||
"time": "2016-07-26 08:03:56"
|
||||
},
|
||||
{
|
||||
"name": "tecnickcom/tc-lib-barcode",
|
||||
@@ -3085,17 +3166,17 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tecnickcom/tc-lib-barcode.git",
|
||||
"reference": "220728e5f659b935348442e8d1d3e46fd5f9e178"
|
||||
"reference": "df69541618a0ebc24bc8f938e52f76a471f2e018"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tecnickcom/tc-lib-barcode/zipball/220728e5f659b935348442e8d1d3e46fd5f9e178",
|
||||
"reference": "220728e5f659b935348442e8d1d3e46fd5f9e178",
|
||||
"url": "https://api.github.com/repos/tecnickcom/tc-lib-barcode/zipball/df69541618a0ebc24bc8f938e52f76a471f2e018",
|
||||
"reference": "df69541618a0ebc24bc8f938e52f76a471f2e018",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"tecnickcom/tc-lib-color": "^1.11.0"
|
||||
"tecnickcom/tc-lib-color": "^1.12.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"apigen/apigen": "^4.1.2",
|
||||
@@ -3163,20 +3244,20 @@
|
||||
"tc-lib-barcode",
|
||||
"upc"
|
||||
],
|
||||
"time": "2016-07-10 18:29:15"
|
||||
"time": "2016-08-25 12:36:23"
|
||||
},
|
||||
{
|
||||
"name": "tecnickcom/tc-lib-color",
|
||||
"version": "1.11.0",
|
||||
"version": "1.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tecnickcom/tc-lib-color.git",
|
||||
"reference": "6a000b658758e271bf4c41bbc1ce4c685d8a7160"
|
||||
"reference": "176464ae7ad0256c1dfd9d742ee2461d0b660f7c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tecnickcom/tc-lib-color/zipball/6a000b658758e271bf4c41bbc1ce4c685d8a7160",
|
||||
"reference": "6a000b658758e271bf4c41bbc1ce4c685d8a7160",
|
||||
"url": "https://api.github.com/repos/tecnickcom/tc-lib-color/zipball/176464ae7ad0256c1dfd9d742ee2461d0b660f7c",
|
||||
"reference": "176464ae7ad0256c1dfd9d742ee2461d0b660f7c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3225,7 +3306,7 @@
|
||||
"tc-lib-color",
|
||||
"web"
|
||||
],
|
||||
"time": "2016-06-13 14:31:19"
|
||||
"time": "2016-08-25 11:56:01"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
@@ -3279,24 +3360,24 @@
|
||||
},
|
||||
{
|
||||
"name": "watson/validating",
|
||||
"version": "2.2.1",
|
||||
"version": "2.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dwightwatson/validating.git",
|
||||
"reference": "64dc3d211372576d468e2bfaf3c7b7ace66ee970"
|
||||
"reference": "8f37e416aaf02129c8ad57a446a6ef7080019687"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/dwightwatson/validating/zipball/64dc3d211372576d468e2bfaf3c7b7ace66ee970",
|
||||
"reference": "64dc3d211372576d468e2bfaf3c7b7ace66ee970",
|
||||
"url": "https://api.github.com/repos/dwightwatson/validating/zipball/8f37e416aaf02129c8ad57a446a6ef7080019687",
|
||||
"reference": "8f37e416aaf02129c8ad57a446a6ef7080019687",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "~5.0",
|
||||
"illuminate/database": "~5.0 || >=5.1.27",
|
||||
"illuminate/events": "~5.0",
|
||||
"illuminate/support": "~5.0",
|
||||
"illuminate/validation": "~5.0",
|
||||
"illuminate/contracts": "~5.0 <5.3",
|
||||
"illuminate/database": "~5.0 <5.3 || >=5.1.27",
|
||||
"illuminate/events": "~5.0 <5.3",
|
||||
"illuminate/support": "~5.0 <5.3",
|
||||
"illuminate/validation": "~5.0 <5.3",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -3330,7 +3411,7 @@
|
||||
"laravel",
|
||||
"validation"
|
||||
],
|
||||
"time": "2016-04-07 14:59:06"
|
||||
"time": "2016-08-28 07:54:32"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@@ -3524,16 +3605,16 @@
|
||||
},
|
||||
{
|
||||
"name": "facebook/webdriver",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/php-webdriver.git",
|
||||
"reference": "0b889d7de7461439f8a3bbcca46e0f696cb27986"
|
||||
"reference": "b7186fb1bcfda956d237f59face250d06ef47253"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/0b889d7de7461439f8a3bbcca46e0f696cb27986",
|
||||
"reference": "0b889d7de7461439f8a3bbcca46e0f696cb27986",
|
||||
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/b7186fb1bcfda956d237f59face250d06ef47253",
|
||||
"reference": "b7186fb1bcfda956d237f59face250d06ef47253",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3541,7 +3622,9 @@
|
||||
"php": ">=5.3.19"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.6.*"
|
||||
"friendsofphp/php-cs-fixer": "^1.11",
|
||||
"phpunit/phpunit": "4.6.* || ~5.0",
|
||||
"squizlabs/php_codesniffer": "^2.6"
|
||||
},
|
||||
"suggest": {
|
||||
"phpdocumentor/phpdocumentor": "2.*"
|
||||
@@ -3564,7 +3647,7 @@
|
||||
"selenium",
|
||||
"webdriver"
|
||||
],
|
||||
"time": "2016-06-04 00:02:34"
|
||||
"time": "2016-08-10 00:44:08"
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
@@ -4289,16 +4372,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "4.8.26",
|
||||
"version": "4.8.27",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "fc1d8cd5b5de11625979125c5639347896ac2c74"
|
||||
"reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74",
|
||||
"reference": "fc1d8cd5b5de11625979125c5639347896ac2c74",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c062dddcb68e44b563f66ee319ddae2b5a322a90",
|
||||
"reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4357,7 +4440,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-05-17 03:09:28"
|
||||
"time": "2016-07-21 06:48:14"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
@@ -4533,23 +4616,23 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
"version": "1.3.7",
|
||||
"version": "1.3.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/environment.git",
|
||||
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
|
||||
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
||||
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
|
||||
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"php": "^5.3.3 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.4"
|
||||
"phpunit/phpunit": "^4.8 || ^5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -4579,7 +4662,7 @@
|
||||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2016-05-17 03:18:57"
|
||||
"time": "2016-08-18 05:49:44"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
@@ -4867,16 +4950,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
"version": "v3.1.2",
|
||||
"version": "v3.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/browser-kit.git",
|
||||
"reference": "dcf41ed026b0499254385b5c88f03247b2ba010b"
|
||||
"reference": "d2a07cc11c5fa94820240b1e67592ffb18e347b9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/dcf41ed026b0499254385b5c88f03247b2ba010b",
|
||||
"reference": "dcf41ed026b0499254385b5c88f03247b2ba010b",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/d2a07cc11c5fa94820240b1e67592ffb18e347b9",
|
||||
"reference": "d2a07cc11c5fa94820240b1e67592ffb18e347b9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4920,11 +5003,11 @@
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:41:56"
|
||||
"time": "2016-07-26 08:04:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v3.1.2",
|
||||
"version": "v3.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
@@ -4977,16 +5060,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v3.1.2",
|
||||
"version": "v3.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "99ec4a23330fcd0c8667095f3ef7aa204ffd9dc0"
|
||||
"reference": "c7b9b8db3a6f2bac76dcd9a9db5446f2591897f9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/99ec4a23330fcd0c8667095f3ef7aa204ffd9dc0",
|
||||
"reference": "99ec4a23330fcd0c8667095f3ef7aa204ffd9dc0",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/c7b9b8db3a6f2bac76dcd9a9db5446f2591897f9",
|
||||
"reference": "c7b9b8db3a6f2bac76dcd9a9db5446f2591897f9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5029,20 +5112,20 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:41:56"
|
||||
"time": "2016-07-26 08:04:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.1.2",
|
||||
"version": "v3.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de"
|
||||
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/2884c26ce4c1d61aebf423a8b912950fe7c764de",
|
||||
"reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/1819adf2066880c7967df7180f4f662b6f0567ac",
|
||||
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5078,32 +5161,33 @@
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:41:56"
|
||||
"time": "2016-07-17 14:02:08"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
"version": "1.0.2",
|
||||
"version": "1.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webmozart/assert.git",
|
||||
"reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde"
|
||||
"reference": "bb2d123231c095735130cc8f6d31385a44c7b308"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde",
|
||||
"reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde",
|
||||
"url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308",
|
||||
"reference": "bb2d123231c095735130cc8f6d31385a44c7b308",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"php": "^5.3.3|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.6"
|
||||
"phpunit/phpunit": "^4.6",
|
||||
"sebastian/version": "^1.0.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
"dev-master": "1.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -5127,7 +5211,7 @@
|
||||
"check",
|
||||
"validate"
|
||||
],
|
||||
"time": "2015-08-24 13:29:44"
|
||||
"time": "2016-08-09 15:02:57"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
@@ -5136,7 +5220,8 @@
|
||||
"intervention/image": 20,
|
||||
"maknz/slack": 20,
|
||||
"erusev/parsedown": 20,
|
||||
"tecnickcom/tc-lib-barcode": 20
|
||||
"tecnickcom/tc-lib-barcode": 20,
|
||||
"neitanod/forceutf8": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
|
||||
17
config/app.php
Normal file → Executable file
17
config/app.php
Normal file → Executable file
@@ -127,6 +127,20 @@ return [
|
||||
'private_uploads' => storage_path().'/private_uploads',
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ALLOW I-FRAMING
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Normal users will never need to edit this. This option lets you run
|
||||
| Snipe-IT within an I-Frame, which is normally disabled by default for
|
||||
| security reasons, to prevent clickjacking. It should normally be set to false.
|
||||
|
|
||||
*/
|
||||
|
||||
'allow_iframing' => env('ALLOW_IFRAMING', false),
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Demo Mode Lockdown
|
||||
@@ -140,7 +154,6 @@ return [
|
||||
'lock_passwords' => env('APP_LOCKED', false),
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
@@ -197,6 +210,8 @@ return [
|
||||
Collective\Html\HtmlServiceProvider::class,
|
||||
Spatie\Backup\BackupServiceProvider::class,
|
||||
Fideloper\Proxy\TrustedProxyServiceProvider::class,
|
||||
MisterPhilip\MaintenanceMode\MaintenanceModeServiceProvider::class,
|
||||
MisterPhilip\MaintenanceMode\MaintenanceCommandServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Custom service provider
|
||||
|
||||
0
config/database.php
Normal file → Executable file
0
config/database.php
Normal file → Executable file
24
config/mail.php
Normal file → Executable file
24
config/mail.php
Normal file → Executable file
@@ -3,6 +3,12 @@
|
||||
return [
|
||||
|
||||
/*
|
||||
| ***************************************************************************
|
||||
| DO NOT MAKE CHANGES DIRECTLY TO THIS FILE.
|
||||
|
|
||||
| Instead use your .env file to set your application configuration settings.
|
||||
| See https://snipe-it.readme.io/docs/configuration for more info.
|
||||
|
|
||||
|--------------------------------------------------------------------------
|
||||
| Mail Driver
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -11,6 +17,7 @@ return [
|
||||
| sending of e-mail. You may specify which one you're using throughout
|
||||
| your application here. By default, Laravel is setup for SMTP mail.
|
||||
|
|
||||
|
|
||||
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log"
|
||||
|
|
||||
*/
|
||||
@@ -56,6 +63,23 @@ return [
|
||||
|
||||
'from' => ['address' => env('MAIL_FROM_ADDR', null), 'name' => env('MAIL_FROM_NAME', null)],
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "Reply-To" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to have a different "Reply-to"
|
||||
| address than the "From" address. If this is left blank, the application will use
|
||||
| your MAIL_FROM information.
|
||||
|
|
||||
*/
|
||||
|
||||
'reply_to' => [
|
||||
'address' => env('MAIL_REPLYTO_ADDR', env('MAIL_FROM_ADDR', null)),
|
||||
'name' => env('MAIL_REPLYTO_NAME', env('MAIL_FROM_NAME', null))
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| E-Mail Encryption Protocol
|
||||
|
||||
@@ -46,19 +46,19 @@ return array(
|
||||
'permission' => 'assets.create',
|
||||
'label' => 'Create ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'assets.edit',
|
||||
'label' => 'Edit ',
|
||||
'label' => 'Edit ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'assets.delete',
|
||||
'label' => 'Delete ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'assets.checkout',
|
||||
@@ -71,7 +71,14 @@ return array(
|
||||
'permission' => 'assets.checkin',
|
||||
'label' => 'Checkin ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'permission' => 'assets.checkout',
|
||||
'label' => 'Checkout ',
|
||||
'note' => '',
|
||||
'display' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
@@ -88,6 +95,7 @@ return array(
|
||||
'note' => '',
|
||||
'display' => true,
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
'Accessories' => array(
|
||||
@@ -98,34 +106,34 @@ return array(
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'accessory.create',
|
||||
'permission' => 'accessories.create',
|
||||
'label' => 'Create ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'accessories.edit',
|
||||
'label' => 'Edit ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'accessories.delete',
|
||||
'label' => 'Delete ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'accessories.checkout',
|
||||
'label' => 'Checkout ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'accessories.checkin',
|
||||
'label' => 'Checkin ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -140,25 +148,25 @@ return array(
|
||||
'permission' => 'consumables.create',
|
||||
'label' => 'Create ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'consumables.edit',
|
||||
'label' => 'Edit ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'consumables.delete',
|
||||
'label' => 'Delete ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'consumables.checkout',
|
||||
'label' => 'Checkout ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -172,27 +180,27 @@ return array(
|
||||
),
|
||||
array(
|
||||
'permission' => 'licenses.create',
|
||||
'label' => 'Create Licenses',
|
||||
'label' => 'Create ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'licenses.edit',
|
||||
'label' => 'Edit Licenses',
|
||||
'label' => 'Edit ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'licenses.delete',
|
||||
'label' => 'Delete Licenses',
|
||||
'label' => 'Delete ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'licenses.checkout',
|
||||
'label' => 'Checkout Licenses',
|
||||
'label' => 'Checkout ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'licenses.keys',
|
||||
@@ -212,33 +220,33 @@ return array(
|
||||
),
|
||||
array(
|
||||
'permission' => 'components.create',
|
||||
'label' => 'Create Components',
|
||||
'label' => 'Create ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'components.edit',
|
||||
'label' => 'Edit Components',
|
||||
'label' => 'Edit ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'components.delete',
|
||||
'label' => 'Delete Components',
|
||||
'label' => 'Delete ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'components.checkout',
|
||||
'label' => 'Checkout Components',
|
||||
'label' => 'Checkout ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'components.checkin',
|
||||
'label' => 'Checkin Components',
|
||||
'label' => 'Checkin ',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
|
||||
),
|
||||
@@ -254,19 +262,19 @@ return array(
|
||||
'permission' => 'users.create',
|
||||
'label' => 'Create Users',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'users.edit',
|
||||
'label' => 'Edit Users',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
array(
|
||||
'permission' => 'users.delete',
|
||||
'label' => 'Delete Users',
|
||||
'note' => '',
|
||||
'display' => false,
|
||||
'display' => true,
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
return array (
|
||||
'app_version' => 'v3.1',
|
||||
'hash_version' => 'v3.1-84-g139325d',
|
||||
'app_version' => 'v3.5.0',
|
||||
'hash_version' => 'v3.5.0-30-gf9a06a1',
|
||||
);
|
||||
|
||||
@@ -25,6 +25,7 @@ $factory->defineAs(App\Models\Asset::class, 'asset', function (Faker\Generator $
|
||||
'order_number' => $faker->numberBetween(1000000,50000000),
|
||||
'supplier_id' => $faker->numberBetween(1,5),
|
||||
'requestable' => $faker->numberBetween(0,1),
|
||||
'company_id' => \App\Models\Company::inRandomOrder()->first()->id
|
||||
];
|
||||
});
|
||||
|
||||
@@ -96,6 +97,7 @@ $factory->defineAs(App\Models\Component::class, 'component', function (Faker\Gen
|
||||
'category_id' => $faker->numberBetween(21,25),
|
||||
'total_qty' => $faker->numberBetween(3, 10),
|
||||
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
|
||||
'company_id' => \App\Models\Company::inRandomOrder()->first()->id
|
||||
];
|
||||
});
|
||||
|
||||
@@ -113,6 +115,7 @@ $factory->defineAs(App\Models\Accessory::class, 'accessory', function (Faker\Gen
|
||||
'qty' => $faker->numberBetween(5, 10),
|
||||
'location_id' => $faker->numberBetween(1,5),
|
||||
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
|
||||
'company_id' => \App\Models\Company::inRandomOrder()->first()->id
|
||||
];
|
||||
});
|
||||
|
||||
@@ -138,6 +141,7 @@ $factory->defineAs(App\Models\Consumable::class, 'consumable', function (Faker\G
|
||||
'company_id' => $faker->numberBetween(1, 10),
|
||||
'qty' => $faker->numberBetween(5, 10),
|
||||
'min_amt' => $faker->numberBetween($min = 1, $max = 2),
|
||||
'company_id' => \App\Models\Company::inRandomOrder()->first()->id
|
||||
|
||||
];
|
||||
});
|
||||
@@ -251,6 +255,7 @@ $factory->defineAs(App\Models\License::class, 'license', function (Faker\Generat
|
||||
'purchase_date' => $faker->dateTime(),
|
||||
'purchase_cost' => $faker->randomFloat(2),
|
||||
'notes' => $faker->sentence,
|
||||
'company_id' => \App\Models\Company::inRandomOrder()->first()->id
|
||||
];
|
||||
});
|
||||
|
||||
@@ -265,18 +270,82 @@ $factory->defineAs(App\Models\LicenseSeat::class, 'license-seat', function (Fake
|
||||
});
|
||||
|
||||
$factory->defineAs(App\Models\Actionlog::class, 'asset-checkout', function (Faker\Generator $faker) {
|
||||
$company = \App\Models\Company::has('users')->has('assets')->inRandomOrder()->first();
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'user_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'action_type' => 'checkout',
|
||||
'asset_id' => $faker->numberBetween(1, 10),
|
||||
'checkedout_to' => 1,
|
||||
'item_id' => $company->assets()->inRandomOrder()->first()->id,
|
||||
'target_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'target_type' => 'App\\Models\\User',
|
||||
'created_at' => $faker->dateTime(),
|
||||
'asset_type' => 'hardware',
|
||||
'item_type' => 'App\\Models\\Asset',
|
||||
'note' => $faker->sentence,
|
||||
'user_id' => '1',
|
||||
'company_id' => $company->id
|
||||
];
|
||||
});
|
||||
|
||||
$factory->defineAs(App\Models\Actionlog::class, 'license-checkout-asset', function (Faker\Generator $faker) {
|
||||
$company = \App\Models\Company::has('users')->has('licenses')->inRandomOrder()->first();
|
||||
|
||||
return [
|
||||
'user_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $company->licenses()->whereNotNull('company_id')->inRandomOrder()->first()->id,
|
||||
'target_id' => $company->assets()->inRandomOrder()->first()->id,
|
||||
'target_type' => 'App\\Models\\Asset',
|
||||
'created_at' => $faker->dateTime(),
|
||||
'item_type' => 'App\\Models\\License',
|
||||
'note' => $faker->sentence,
|
||||
'company_id' => $company->id
|
||||
];
|
||||
});
|
||||
|
||||
$factory->defineAs(App\Models\Actionlog::class, 'accessory-checkout', function (Faker\Generator $faker) {
|
||||
$company = \App\Models\Company::has('users')->has('accessories')->inRandomOrder()->first();
|
||||
return [
|
||||
'user_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $company->accessories()->whereNotNull('company_id')->inRandomOrder()->first()->id,
|
||||
'target_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'target_type' => 'App\\Models\\User',
|
||||
'created_at' => $faker->dateTime(),
|
||||
'item_type' => 'App\\Models\\Accessory',
|
||||
'note' => $faker->sentence,
|
||||
'company_id' => $company->id
|
||||
];
|
||||
});
|
||||
|
||||
$factory->defineAs(App\Models\Actionlog::class, 'consumable-checkout', function (Faker\Generator $faker) {
|
||||
$company = \App\Models\Company::has('users')->has('consumables')->inRandomOrder()->first();
|
||||
|
||||
return [
|
||||
'user_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $company->consumables()->whereNotNull('company_id')->inRandomOrder()->first()->id,
|
||||
'target_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'target_type' => 'App\\Models\\User',
|
||||
'created_at' => $faker->dateTime(),
|
||||
'item_type' => 'App\\Models\\Consumable',
|
||||
'note' => $faker->sentence,
|
||||
'company_id' => $company->id
|
||||
];
|
||||
});
|
||||
|
||||
$factory->defineAs(App\Models\Actionlog::class, 'component-checkout', function (Faker\Generator $faker) {
|
||||
$company = \App\Models\Company::has('users')->has('components')->inRandomOrder()->first();
|
||||
|
||||
return [
|
||||
'user_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'action_type' => 'checkout',
|
||||
'item_id' => $company->components()->whereNotNull('company_id')->inRandomOrder()->first()->id,
|
||||
'target_id' => $company->users()->inRandomOrder()->first()->id,
|
||||
'target_type' => 'App\\Models\\User',
|
||||
'created_at' => $faker->dateTime(),
|
||||
'item_type' => 'App\\Models\\Component',
|
||||
'note' => $faker->sentence,
|
||||
'company_id' => $company->id
|
||||
];
|
||||
});
|
||||
|
||||
$factory->defineAs(App\Models\CustomField::class, 'customfield-ip', function (Faker\Generator $faker) {
|
||||
return [
|
||||
@@ -294,5 +363,6 @@ $factory->defineAs(App\Models\User::class, 'valid-user', function (Faker\Generat
|
||||
'email' => $faker->safeEmail,
|
||||
'password' => $faker->password,
|
||||
'username' => $faker->username,
|
||||
'company_id' => \App\Models\Company::inRandomOrder()->first()->id
|
||||
];
|
||||
});
|
||||
|
||||
@@ -64,39 +64,39 @@
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (!Schema::hasColumn('asset_logs', 'thread_id')) {
|
||||
// if (!Schema::hasColumn('asset_logs', 'thread_id')) {
|
||||
|
||||
Schema::table( 'asset_logs', function ( Blueprint $table ) {
|
||||
// Schema::table( 'asset_logs', function ( Blueprint $table ) {
|
||||
|
||||
$table->integer( 'thread_id' )
|
||||
->nullable()
|
||||
->default( null );
|
||||
$table->index( 'thread_id' );
|
||||
} );
|
||||
}
|
||||
// $table->integer( 'thread_id' )
|
||||
// ->nullable()
|
||||
// ->default( null );
|
||||
// $table->index( 'thread_id' );
|
||||
// } );
|
||||
// }
|
||||
|
||||
$this->actionlog = new App\Models\Actionlog();
|
||||
$this->assetLogs = $this->actionlog->getListingOfActionLogsChronologicalOrder();
|
||||
// $this->actionlog = new App\Models\Actionlog();
|
||||
// $this->assetLogs = $this->actionlog->getListingOfActionLogsChronologicalOrder();
|
||||
|
||||
foreach ($this->assetLogs as $assetLog) {
|
||||
// foreach ($this->assetLogs as $assetLog) {
|
||||
|
||||
if ($this->hasAssetChanged( $assetLog )) {
|
||||
$this->resetCurrentAssetInformation( $assetLog );
|
||||
}
|
||||
// if ($this->hasAssetChanged( $assetLog )) {
|
||||
// $this->resetCurrentAssetInformation( $assetLog );
|
||||
// }
|
||||
|
||||
if ($this->hasBegunNewChain( $assetLog )) {
|
||||
$this->startOfCurrentThread = false;
|
||||
continue;
|
||||
}
|
||||
// if ($this->hasBegunNewChain( $assetLog )) {
|
||||
// $this->startOfCurrentThread = false;
|
||||
// continue;
|
||||
// }
|
||||
|
||||
$this->updateAssetLogWithThreadInformation( $assetLog );
|
||||
// $this->updateAssetLogWithThreadInformation( $assetLog );
|
||||
|
||||
if ($this->hasReachedEndOfChain( $assetLog )
|
||||
) {
|
||||
$this->clearCurrentAssetInformation();
|
||||
}
|
||||
// if ($this->hasReachedEndOfChain( $assetLog )
|
||||
// ) {
|
||||
// $this->clearCurrentAssetInformation();
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddColorToStatuslabel extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('status_labels', function (Blueprint $table) {
|
||||
$table->string('color', 10)->nullable()->default(NULL);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('status_labels', function ($table) {
|
||||
$table->dropColumn('color');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddDisallowLdapPwSyncToSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->boolean('ldap_pw_sync')->default(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function ($table) {
|
||||
$table->dropColumn('ldap_pw_sync');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddManufacturerToLicenses extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('licenses', function (Blueprint $table) {
|
||||
//
|
||||
$table->integer('manufacturer_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('licenses', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddManufacturerToAccessoriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accessories', function (Blueprint $table) {
|
||||
//
|
||||
$table->integer('manufacturer_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('accessories', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('manufacturer_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNewFieldsToCustomFields extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('custom_fields', function (Blueprint $table) {
|
||||
//
|
||||
$table->string('field_values')->nullable()->default(null);
|
||||
$table->boolean('field_encrypted')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_fields', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('field_values', 'field_encrypted');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddShowInNavToStatusLabels extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('status_labels', function (Blueprint $table) {
|
||||
$table->boolean('show_in_nav')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('status_labels', function (Blueprint $table) {
|
||||
$table->dropColumn('show_in_nav', 'field_encrypted');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MakePurchaseCostNullable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
|
||||
$platform->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
Schema::table('assets', function ($table) {
|
||||
$table->decimal('purchase_cost',8,2)->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddRequestableToAssetModel extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::table('models', function ($table) {
|
||||
$table->tinyInteger('requestable')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('models', function ($table) {
|
||||
$table->dropColumn('requestable');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCheckoutRequestsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('checkout_requests', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id');
|
||||
$table->integer('requestable_id');
|
||||
$table->string('requestable_type');
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'requestable_id', 'requestable_type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('checkout_requests');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateActionlogTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (!Schema::hasTable('action_logs')) {
|
||||
Schema::create('action_logs', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id')->nullable();
|
||||
$table->string('action_type');
|
||||
$table->integer('target_id')->nullable(); // Was checkedout_to
|
||||
$table->string('target_type')->nullable(); // For polymorphic thingies
|
||||
$table->integer('location_id')->nullable();
|
||||
$table->text('note')->nullable();
|
||||
$table->text('filename')->nullable();
|
||||
$table->string('item_type');
|
||||
$table->integer('item_id'); // Replaces asset_id, accessory_id, etc.
|
||||
$table->date('expected_checkin')->nullable()->default(null);
|
||||
$table->integer('accepted_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->integer('thread_id')
|
||||
->nullable()
|
||||
->default(null);
|
||||
$table->index('thread_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('action_logs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class MigrateAssetLogToActionLog extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
$logs = DB::table('asset_logs')->get();
|
||||
|
||||
foreach ($logs as $log) {
|
||||
// protected $fillable = [ 'created_at', 'asset_type','user_id','asset_id','action_type','note','checkedout_to' ];
|
||||
$a = new Actionlog(compact($log));
|
||||
// var_dump($log);
|
||||
$a->user_id = $log->user_id;
|
||||
|
||||
if (!is_null($log->asset_id)) {
|
||||
$a->item_id = $log->asset_id;
|
||||
if ($log->asset_type == "hardware") {
|
||||
$a->item_type = 'App\\Models\\Asset';
|
||||
} else {
|
||||
$a->item_type = 'App\\Models\\License';
|
||||
}
|
||||
}
|
||||
if (!is_null($log->accessory_id)) {
|
||||
$a->item_id = $log->accessory_id;
|
||||
$a->item_type = 'App\\Models\\Accessory';
|
||||
} else if (!is_null($log->consumable_id)) {
|
||||
$a->item_id = $log->consumable_id;
|
||||
$a->item_type = 'App\\Models\\Consumable';
|
||||
} else if (!is_null($log->component_id)) {
|
||||
$a->item_id = $log->component_id;
|
||||
$a->item_type = 'App\\Models\\Component';
|
||||
}
|
||||
$a->action_type = $log->action_type;
|
||||
// $a->checkout_to = $log->checkout_to;
|
||||
if(!is_null($log->checkedout_to)) {
|
||||
$a->target_id = $log->checkedout_to;
|
||||
$a->target_type = User::class;
|
||||
}
|
||||
if(!is_null($log->accepted_id)) {
|
||||
$a->target_id = $log->accepted_id;
|
||||
$a->target_type = User::class;
|
||||
}
|
||||
$a->location_id = $log->location_id;
|
||||
$a->created_at = $log->created_at;
|
||||
$a->updated_at = $log->updated_at;
|
||||
$a->deleted_at = $log->deleted_at;
|
||||
$a->note = $log->note;
|
||||
$a->expected_checkin = $log->expected_checkin;
|
||||
$a->thread_id = $log->thread_id;
|
||||
$a->accepted_id = $log->accepted_id;
|
||||
|
||||
$a->save();
|
||||
|
||||
}
|
||||
// dd($logs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixFieldtypeForTargetType extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('action_logs', function ($table) {
|
||||
$table->string('target_type')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('action_logs', function ($table) {
|
||||
$table->integer('target_type')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixModelnoInConsumablesToString extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('consumables', function ($table) {
|
||||
$table->string('model_no')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('consumables', function ($table) {
|
||||
$table->integer('model_no')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Actionlog;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddCompanyToLogs extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('action_logs', function (Blueprint $table) {
|
||||
//
|
||||
$table->integer('company_id')->nullable()->default(null);
|
||||
});
|
||||
|
||||
$logs = Actionlog::with('item')->get();
|
||||
foreach ($logs as $log) {
|
||||
if($log->item) {
|
||||
$log->company_id = $log->item->company_id;
|
||||
$log->save();
|
||||
} else {
|
||||
var_dump($log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('action_logs', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('company_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixOrderNumberToVarchar extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('consumables', function ($table) {
|
||||
$table->string('order_number')->nullable()->default(null)->change();
|
||||
});
|
||||
|
||||
Schema::table('components', function ($table) {
|
||||
$table->string('order_number')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('consumables', function ($table) {
|
||||
$table->integer('order_number')->nullable()->default(null)->change();
|
||||
});
|
||||
|
||||
Schema::table('components', function ($table) {
|
||||
$table->integer('order_number')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixOrderNumberInComponentsToString extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('components', function ($table) {
|
||||
$table->string('order_number')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('components', function ($table) {
|
||||
$table->integer('order_number')->nullable()->default(null)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,10 @@ class ActionlogSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
Actionlog::truncate();
|
||||
factory(Actionlog::class, 'asset-checkout',5)->create();
|
||||
factory(Actionlog::class, 'asset-checkout',25)->create();
|
||||
factory(Actionlog::class, 'accessory-checkout',15)->create();
|
||||
factory(Actionlog::class, 'consumable-checkout', 15)->create();
|
||||
factory(Actionlog::class, 'component-checkout', 15)->create();
|
||||
factory(Actionlog::class, 'license-checkout-asset', 15)->create();
|
||||
}
|
||||
}
|
||||
|
||||
19
database/seeds/CompanySeeder.php
Normal file
19
database/seeds/CompanySeeder.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Company;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CompanySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
Company::truncate();
|
||||
factory(Company::class, 'company', 4)->create();
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,12 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
$this->call(CompanySeeder::class);
|
||||
$this->call(UserSeeder::class);
|
||||
$this->call(AssetModelSeeder::class);
|
||||
$this->call(AccessorySeeder::class);
|
||||
$this->call(AssetSeeder::class);
|
||||
$this->call(ComponentSeeder::class);
|
||||
$this->call(ConsumableSeeder::class);
|
||||
$this->call(StatuslabelSeeder::class);
|
||||
$this->call(SupplierSeeder::class);
|
||||
@@ -27,7 +30,6 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(ManufacturerSeeder::class);
|
||||
$this->call(LocationSeeder::class);
|
||||
$this->call(CustomFieldSeeder::class);
|
||||
$this->call(ComponentSeeder::class);
|
||||
|
||||
Model::reguard();
|
||||
}
|
||||
|
||||
18
database/seeds/UserSeeder.php
Normal file
18
database/seeds/UserSeeder.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Don't truncate the user column, that might suck.
|
||||
factory(User::class, 'valid-user', 10)->create();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ MAIL_ENV_FROM_NAME=Brady Wetherington
|
||||
MAIL_ENV_ENCRYPTION=tcp
|
||||
MAIL_ENV_USERNAME=uberbrady@gmail.com
|
||||
MAIL_ENV_PASSWORD=N7AqLufTZMULWHWYwJ0ZCw
|
||||
MAIL_ENV_REPLYTO_ADDR=you@example.com
|
||||
MAIL_ENV_REPLYTO_NAME='Snipe-IT'
|
||||
|
||||
#SNIPE-IT Variables
|
||||
APP_ENV=develop
|
||||
@@ -22,3 +24,5 @@ APP_KEY=Y5hJeC7x1i7OxhDrvrQPlB9KvCorvRdO
|
||||
APP_URL=http://127.0.0.1:32782
|
||||
APP_TIMEZONE=US/Pacific
|
||||
APP_LOCALE=en
|
||||
|
||||
ALLOW_IFRAMING=false
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
# when the CA certificates are directly appended to the server
|
||||
# certificate for convinience.
|
||||
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
|
||||
SSLCertificateChainFile /etc/ssl/private/snipeit-ssl.crt
|
||||
SSLCertificateChainFile /var/lib/snipeit/ssl/snipeit-ssl.crt
|
||||
|
||||
# Certificate Authority (CA):
|
||||
# Set the CA certificate verification path where to find CA
|
||||
|
||||
@@ -18,6 +18,7 @@ DB_DATABASE=${MYSQL_DATABASE}
|
||||
DB_USERNAME=${MYSQL_USER}
|
||||
DB_PASSWORD=${MYSQL_PASSWORD}
|
||||
DB_PREFIX=null
|
||||
DB_DUMP_PATH='/usr/bin'
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
|
||||
@@ -38,7 +38,7 @@ elixir(function(mix) {
|
||||
mix.version(['assets/css/app.css','assets/js/all.js']);
|
||||
|
||||
|
||||
// mix.codeception();
|
||||
mix.codeception();
|
||||
|
||||
|
||||
|
||||
|
||||
1
public/assets/css/jquery.typeahead.min.css
vendored
Executable file
1
public/assets/css/jquery.typeahead.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -34248,7 +34248,7 @@ var pieOptions = {
|
||||
//String - A tooltip template
|
||||
tooltipTemplate: "<%=value %> <%=label%> "
|
||||
};
|
||||
console.dir(pieOptions);
|
||||
//console.dir(pieOptions);
|
||||
//Create pie or douhnut chart
|
||||
// You can switch between pie and douhnut using the method below.
|
||||
//pieChart.Doughnut(PieData, pieOptions);
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
public/assets/js/html5shiv.js
vendored
Normal file
4
public/assets/js/html5shiv.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
|
||||
11
public/assets/js/jquery.typeahead.min.js
vendored
Executable file
11
public/assets/js/jquery.typeahead.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
0
public/assets/js/respond.js
Normal file
0
public/assets/js/respond.js
Normal file
@@ -34248,7 +34248,7 @@ var pieOptions = {
|
||||
//String - A tooltip template
|
||||
tooltipTemplate: "<%=value %> <%=label%> "
|
||||
};
|
||||
console.dir(pieOptions);
|
||||
//console.dir(pieOptions);
|
||||
//Create pie or douhnut chart
|
||||
// You can switch between pie and douhnut using the method below.
|
||||
//pieChart.Doughnut(PieData, pieOptions);
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"assets/css/app.css": "assets/css/app-de75b6d10a.css",
|
||||
"assets/js/all.js": "assets/js/all-edd914620a.js"
|
||||
"assets/js/all.js": "assets/js/all-5ba6978224.js"
|
||||
}
|
||||
@@ -36,6 +36,11 @@ include '../c3.php';
|
||||
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
// set the public path to this directory
|
||||
$app->bind('path.public', function() {
|
||||
return __DIR__;
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Application
|
||||
|
||||
0
public/uploads/barcodes/.gitkeep
Normal file
0
public/uploads/barcodes/.gitkeep
Normal file
@@ -35,7 +35,7 @@ var pieOptions = {
|
||||
//String - A tooltip template
|
||||
tooltipTemplate: "<%=value %> <%=label%> "
|
||||
};
|
||||
console.dir(pieOptions);
|
||||
//console.dir(pieOptions);
|
||||
//Create pie or douhnut chart
|
||||
// You can switch between pie and douhnut using the method below.
|
||||
//pieChart.Doughnut(PieData, pieOptions);
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
return array(
|
||||
'about_consumables_title' => 'حول المواد الاستهلاكية',
|
||||
'about_consumables_text' => 'المواد الاستهلاكية هي الأشياء المشتراة والتي ستستخدم مع مرور الوقت. على سبيل المثال، حبر الطابعة أو ورق الناسخة.',
|
||||
'consumable_name' => 'اسم المادة الإستهلاكية',
|
||||
'cost' => 'تكلفة الشراء',
|
||||
'create' => 'إنشاء مادة إستهلاكية',
|
||||
'date' => 'تاريخ الشراء',
|
||||
'item_no' => 'رقم القطعة.',
|
||||
'order' => 'رقم طلب الشراء',
|
||||
'remaining' => 'المتبقية',
|
||||
'total' => 'المجموع',
|
||||
'checkout' => 'Checkout Consumable to User',
|
||||
'consumable_name' => 'اسم المادة الإستهلاكية',
|
||||
'cost' => 'تكلفة الشراء',
|
||||
'create' => 'إنشاء مادة إستهلاكية',
|
||||
'date' => 'تاريخ الشراء',
|
||||
'item_no' => 'رقم القطعة.',
|
||||
'order' => 'رقم طلب الشراء',
|
||||
'remaining' => 'المتبقية',
|
||||
'total' => 'المجموع',
|
||||
'update' => 'تحديث المادة الإستهلاكية',
|
||||
);
|
||||
|
||||
@@ -5,11 +5,17 @@ return array(
|
||||
'field' => 'حقل',
|
||||
'about_fieldsets_title' => 'حول مجموعة الحقول',
|
||||
'about_fieldsets_text' => 'مجموعات-الحقول تسمح لك بإنشاء مجموعات من الحقول اللتي يمكن إعادة إستخدامها مع أنواع موديل محدد.',
|
||||
'custom_format' => 'Custom format...',
|
||||
'encrypt_field' => 'Encrypt the value of this field in the database for each asset. The decrypted value of this field will only be viewable by admins.',
|
||||
'encrypt_field_help' => 'WARNING: Encrypting a field makes it unsearchable.',
|
||||
'encrypted' => 'Encrypted',
|
||||
'fieldset' => 'مجموعة-حقول',
|
||||
'qty_fields' => 'الحقول الكمية',
|
||||
'fieldsets' => 'مجموعات-الحقول',
|
||||
'fieldset_name' => 'إسم مجموعة-الحقل',
|
||||
'field_name' => 'إسم الحقل',
|
||||
'field_values' => 'Field Values',
|
||||
'field_values_help' => 'Add selectable options, one per line. Blank lines other than the first line will be ignored. Separate values and labels by pipes on each line (optional).',
|
||||
'field_element' => 'عنصر النموذج',
|
||||
'field_element_short' => 'عنصر',
|
||||
'field_format' => 'صيغة',
|
||||
@@ -20,4 +26,5 @@ return array(
|
||||
'order' => 'Order',
|
||||
'create_fieldset' => 'مجموعة-حقول جديدة',
|
||||
'create_field' => 'حقل جديد مخصص',
|
||||
'value_encrypted' => 'The value of this field is encrypted in the database. Only admin users will be able to view the decrypted value',
|
||||
);
|
||||
|
||||
@@ -12,7 +12,8 @@ return array(
|
||||
'edit' => 'Edit Asset',
|
||||
'filetype_info' => 'Allowed filetypes are png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, and rar.',
|
||||
'model_deleted' => 'This Assets model has been deleted. You must restore the model before you can restore the Asset.<br/> <a href="/hardware/models/:model_id/restore">Click here to restore the model</a>.',
|
||||
'requestable' => 'Requestable',
|
||||
'requestable' => 'Requestable',
|
||||
'requested' => 'Requested',
|
||||
'restore' => 'Restore Asset',
|
||||
'pending' => 'Pending',
|
||||
'undeployable' => 'Undeployable',
|
||||
|
||||
@@ -37,9 +37,11 @@ return array(
|
||||
),
|
||||
|
||||
'import' => array(
|
||||
'error' => 'Some Items did not import Correctly.',
|
||||
'errorDetail' => 'The Following Items were not imported because of errors.',
|
||||
'success' => "Your File has been imported",
|
||||
'error' => 'Some items did not import correctly.',
|
||||
'errorDetail' => 'The following Items were not imported because of errors.',
|
||||
'success' => "Your file has been imported",
|
||||
'file_delete_success' => "Your file has been been successfully deleted",
|
||||
'file_delete_error' => "The file was unable to be deleted",
|
||||
),
|
||||
|
||||
|
||||
@@ -52,7 +54,8 @@ return array(
|
||||
'checkout' => array(
|
||||
'error' => 'Asset was not checked out, please try again',
|
||||
'success' => 'Asset checked out successfully.',
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.'
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.',
|
||||
'not_available' => 'That asset is not available for checkout!'
|
||||
),
|
||||
|
||||
'checkin' => array(
|
||||
@@ -66,6 +69,7 @@ return array(
|
||||
'requests' => array(
|
||||
'error' => 'Asset was not requested, please try again',
|
||||
'success' => 'Asset requested successfully.',
|
||||
'canceled' => 'Checkout request successfully canceled'
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user