Compare commits
401 Commits
v2.0-beta
...
v2.0-pre-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2036402742 | ||
|
|
e9e62fbfaf | ||
|
|
e49cfb4bde | ||
|
|
db8ea88207 | ||
|
|
729795364b | ||
|
|
ee46b223c9 | ||
|
|
e7d7cc6fc2 | ||
|
|
23bde13665 | ||
|
|
3dfbd8a4f0 | ||
|
|
80fb7a4c13 | ||
|
|
b8ef6dfba4 | ||
|
|
a57a465147 | ||
|
|
e14ebd0daa | ||
|
|
676bedc9be | ||
|
|
6b85bbfe65 | ||
|
|
b629fd36a0 | ||
|
|
260abfc2d7 | ||
|
|
eb7017d5cb | ||
|
|
4e86b590d4 | ||
|
|
95af577353 | ||
|
|
c4ba69b4b6 | ||
|
|
4b59a6cb5a | ||
|
|
229432af5e | ||
|
|
43efe4e80b | ||
|
|
286df911c0 | ||
|
|
54d95c510b | ||
|
|
61a4b03aba | ||
|
|
bebd569490 | ||
|
|
470b543910 | ||
|
|
07171498a9 | ||
|
|
2dbeb1aeb5 | ||
|
|
4fcf70872f | ||
|
|
ac7b5da711 | ||
|
|
1fc83443db | ||
|
|
c17bbe9dfe | ||
|
|
59617083c9 | ||
|
|
d167f31af0 | ||
|
|
1343c09cd7 | ||
|
|
8e6621f332 | ||
|
|
34b14f67c6 | ||
|
|
5574ea89bb | ||
|
|
d780f0f3cf | ||
|
|
03f5af29f2 | ||
|
|
a531ea34bb | ||
|
|
aa72b9c107 | ||
|
|
176469294b | ||
|
|
afd94ff52a | ||
|
|
b2c2c1ee15 | ||
|
|
b004a7448b | ||
|
|
c5e5930c1b | ||
|
|
ed2d7310f8 | ||
|
|
547de2b9e3 | ||
|
|
58abd15d93 | ||
|
|
dd60976d51 | ||
|
|
07b045007b | ||
|
|
1f7e0a2893 | ||
|
|
1159cdeab2 | ||
|
|
7f3ceea77b | ||
|
|
1d89b78315 | ||
|
|
463469e7c7 | ||
|
|
c839f0cbc8 | ||
|
|
a832346bfb | ||
|
|
3d77666ad1 | ||
|
|
6ad7a9bb70 | ||
|
|
7fa9e49880 | ||
|
|
e2e070d5e1 | ||
|
|
9f4fca4238 | ||
|
|
b366dec983 | ||
|
|
e91c1942f8 | ||
|
|
6f6b74b82c | ||
|
|
315f02905a | ||
|
|
738e253375 | ||
|
|
358cd1eaf9 | ||
|
|
e4284d20f3 | ||
|
|
f7874ec106 | ||
|
|
ad802cfead | ||
|
|
41838f1e89 | ||
|
|
8624931a88 | ||
|
|
8840e57ae7 | ||
|
|
16cb4f6d05 | ||
|
|
aa304375a6 | ||
|
|
b22789aa59 | ||
|
|
f93e140ce1 | ||
|
|
de238f1551 | ||
|
|
4247904f19 | ||
|
|
75852bdb8b | ||
|
|
5cc1e7d3fe | ||
|
|
a98f4883be | ||
|
|
d5a709a836 | ||
|
|
4243270e7d | ||
|
|
b576fce1f7 | ||
|
|
d7313543ef | ||
|
|
2636474120 | ||
|
|
0c3b55a8b5 | ||
|
|
d7dd35a2f2 | ||
|
|
0c8e3809f2 | ||
|
|
4538bca29f | ||
|
|
eeda4366a3 | ||
|
|
fc31a828bc | ||
|
|
88e10516a9 | ||
|
|
481b905331 | ||
|
|
959df613ae | ||
|
|
c476eda868 | ||
|
|
b3249dcf48 | ||
|
|
242e6ff030 | ||
|
|
f026f886ae | ||
|
|
936d7dab1b | ||
|
|
38d774eb6a | ||
|
|
d363a0deec | ||
|
|
3ebbd030e7 | ||
|
|
7ae226635f | ||
|
|
afbe23c214 | ||
|
|
7f91f6e349 | ||
|
|
6db7001dd5 | ||
|
|
9a763db2d9 | ||
|
|
99a591c970 | ||
|
|
9540db424a | ||
|
|
84d81184fa | ||
|
|
3c0cc94652 | ||
|
|
5dcc795aa2 | ||
|
|
106ed6a9a0 | ||
|
|
daff0dbccb | ||
|
|
56f490cef9 | ||
|
|
145cf1093c | ||
|
|
336858e4ed | ||
|
|
e3c1a9f80c | ||
|
|
66991ea663 | ||
|
|
e253d611b4 | ||
|
|
7e76d8858e | ||
|
|
dc265ba2a8 | ||
|
|
eb00acddfd | ||
|
|
449ad4f86b | ||
|
|
77bff707fa | ||
|
|
183f8ae1bf | ||
|
|
fda6d60225 | ||
|
|
3c730c691b | ||
|
|
cf4f178485 | ||
|
|
b20fecc2de | ||
|
|
03e294b6d0 | ||
|
|
85ba7c3a15 | ||
|
|
889fa6b74d | ||
|
|
e63a07800f | ||
|
|
4082957c85 | ||
|
|
24edf81b27 | ||
|
|
03818adc14 | ||
|
|
b195934a4a | ||
|
|
82a80b9ac8 | ||
|
|
7c7edcd191 | ||
|
|
794dc5998a | ||
|
|
a2aa05fcf9 | ||
|
|
8f68bdb318 | ||
|
|
239f438a98 | ||
|
|
41127bf5dd | ||
|
|
64bff852bd | ||
|
|
d0a8dda14f | ||
|
|
cc5bec07ea | ||
|
|
e560cc2ee2 | ||
|
|
37d4a0105e | ||
|
|
c74c89a171 | ||
|
|
3bb296db78 | ||
|
|
305c22f72d | ||
|
|
9f81792e70 | ||
|
|
57e21193c9 | ||
|
|
ce9d728c2d | ||
|
|
6bc2128c3e | ||
|
|
78835a8b1f | ||
|
|
5297d699b3 | ||
|
|
39da217a9e | ||
|
|
948c443829 | ||
|
|
1a3bf10753 | ||
|
|
7876ae462c | ||
|
|
8fbc77a844 | ||
|
|
87c493bf12 | ||
|
|
8c30c5d879 | ||
|
|
d8df6a0982 | ||
|
|
d6382fb4a3 | ||
|
|
9772039c4f | ||
|
|
ad6cec080c | ||
|
|
028cde8738 | ||
|
|
20f94ce418 | ||
|
|
cced7a93a5 | ||
|
|
6430f7a4a7 | ||
|
|
1fff9f6048 | ||
|
|
85a9f1b71f | ||
|
|
480fd78c51 | ||
|
|
0c9018289b | ||
|
|
65bf156da1 | ||
|
|
a8624a736d | ||
|
|
c1ae844308 | ||
|
|
bb450e6bb6 | ||
|
|
20eb2df9be | ||
|
|
1e38ced885 | ||
|
|
fe2fb63007 | ||
|
|
b79841d481 | ||
|
|
e4ad1011da | ||
|
|
de8180ec70 | ||
|
|
5455abfd16 | ||
|
|
80145c699e | ||
|
|
f99cafc101 | ||
|
|
4014f5e15b | ||
|
|
3460016c94 | ||
|
|
e49c33b56b | ||
|
|
fdb31ac19e | ||
|
|
9184dd5303 | ||
|
|
26e081a2cb | ||
|
|
66a198a175 | ||
|
|
7aba5f3a84 | ||
|
|
78dcdb4dce | ||
|
|
3fdafe30c1 | ||
|
|
39022c9766 | ||
|
|
e3a9145459 | ||
|
|
8d48fddac4 | ||
|
|
8b101b10ec | ||
|
|
8b5de894df | ||
|
|
5781a01311 | ||
|
|
de1adf227b | ||
|
|
5e7bfe314a | ||
|
|
08ce08db62 | ||
|
|
56504e07c9 | ||
|
|
a901a648af | ||
|
|
a099d16714 | ||
|
|
464c83599b | ||
|
|
c78355e39a | ||
|
|
bc7c456f99 | ||
|
|
4f07818a2d | ||
|
|
979212b2ed | ||
|
|
b32e3a3475 | ||
|
|
67e18cb110 | ||
|
|
28304556a9 | ||
|
|
6a5777816c | ||
|
|
2b2e6a8829 | ||
|
|
5701b4d38e | ||
|
|
23866bce26 | ||
|
|
ac5dd0dbf9 | ||
|
|
0f0dab556d | ||
|
|
6dea227c3e | ||
|
|
cf3619d766 | ||
|
|
59b739c1c4 | ||
|
|
59963b88f5 | ||
|
|
7d67b6a9ae | ||
|
|
e944b2d1c3 | ||
|
|
442db4b5c8 | ||
|
|
991a364a3d | ||
|
|
eaf077f807 | ||
|
|
fbb55c14d6 | ||
|
|
e4bee3d372 | ||
|
|
42694f2e9f | ||
|
|
2835905398 | ||
|
|
f9c7022bcc | ||
|
|
60d05e1ae1 | ||
|
|
b918ea88cc | ||
|
|
e8c8509ed3 | ||
|
|
42e101291e | ||
|
|
00bcae7feb | ||
|
|
6d96d6cba4 | ||
|
|
e3f0815012 | ||
|
|
f154692dad | ||
|
|
b4e79592c4 | ||
|
|
e779bf52d1 | ||
|
|
d62d6ebf05 | ||
|
|
e4277b47e8 | ||
|
|
fd9e8b712b | ||
|
|
0de1d45492 | ||
|
|
fdee3ee93e | ||
|
|
ef045c61ca | ||
|
|
212800b074 | ||
|
|
6d1197a144 | ||
|
|
e455b2af6e | ||
|
|
d26c40b26e | ||
|
|
8ba55b4bf2 | ||
|
|
4f1f21287c | ||
|
|
878a163d11 | ||
|
|
dea23bef45 | ||
|
|
d12d1f161f | ||
|
|
7afcd09651 | ||
|
|
4375d66d09 | ||
|
|
e2bb6cf6c6 | ||
|
|
2e11a68c0d | ||
|
|
27fe904970 | ||
|
|
130a041be0 | ||
|
|
a7a2f5f974 | ||
|
|
e47146faee | ||
|
|
d1d6fe26a6 | ||
|
|
3df0550b19 | ||
|
|
6eb296303f | ||
|
|
5a2ca33d0f | ||
|
|
215c21891b | ||
|
|
4c37dcf5bb | ||
|
|
2457003deb | ||
|
|
5ee4eb5871 | ||
|
|
c253000af1 | ||
|
|
f0d9ba89df | ||
|
|
05219e69c4 | ||
|
|
c3439b41b8 | ||
|
|
e479575825 | ||
|
|
0282169703 | ||
|
|
0da0998e44 | ||
|
|
60d3af7bb7 | ||
|
|
8ddf035a9b | ||
|
|
0f5b8b5a90 | ||
|
|
69a5c99396 | ||
|
|
3aa3d67675 | ||
|
|
cf46e322b9 | ||
|
|
3a3c021a6a | ||
|
|
4b3267649a | ||
|
|
1c4190bf22 | ||
|
|
3e2bd02ce5 | ||
|
|
2f83f2aa52 | ||
|
|
914b1cb628 | ||
|
|
6dae07be7d | ||
|
|
c683c1c57e | ||
|
|
775a38880e | ||
|
|
9d949a5b89 | ||
|
|
01c2968388 | ||
|
|
41b711740a | ||
|
|
0d0589800a | ||
|
|
2f0f2c5002 | ||
|
|
abfb5bcd2e | ||
|
|
5ff84d80b4 | ||
|
|
e29ab6b0d6 | ||
|
|
89df6fc6da | ||
|
|
78a45d72d7 | ||
|
|
f8ecbed829 | ||
|
|
38c9d8d6ca | ||
|
|
4557502b1d | ||
|
|
55309bfaef | ||
|
|
0c842fc772 | ||
|
|
5210d7621e | ||
|
|
b85d972488 | ||
|
|
919df7ed56 | ||
|
|
de62db5e18 | ||
|
|
24b0d83387 | ||
|
|
dec3f290d0 | ||
|
|
190b4cd010 | ||
|
|
e447159d4a | ||
|
|
b191406a0c | ||
|
|
d732b60a38 | ||
|
|
ba94a57e08 | ||
|
|
1fcd36e4ac | ||
|
|
31362f3e07 | ||
|
|
0fbccef759 | ||
|
|
2659521dc9 | ||
|
|
0f489b34b5 | ||
|
|
0642b4b830 | ||
|
|
8b77be9da3 | ||
|
|
56345b5743 | ||
|
|
f09ee24975 | ||
|
|
aed7036595 | ||
|
|
9fbb9746bc | ||
|
|
0154f240f3 | ||
|
|
a7abea692d | ||
|
|
f04b3f9b09 | ||
|
|
2841eadc91 | ||
|
|
616af831a7 | ||
|
|
1e730078c1 | ||
|
|
0132360e49 | ||
|
|
1c2a409e6a | ||
|
|
15e1774a13 | ||
|
|
16b49c25e1 | ||
|
|
c61adc7041 | ||
|
|
6524ac3678 | ||
|
|
c8842a85ee | ||
|
|
7255a8bb0c | ||
|
|
f5d4eb5842 | ||
|
|
7e5f32c9d8 | ||
|
|
e714def74a | ||
|
|
a9e169261c | ||
|
|
665ffa6571 | ||
|
|
a22687abc5 | ||
|
|
8335f10f8c | ||
|
|
518680f23c | ||
|
|
38c36699a7 | ||
|
|
f363e742e6 | ||
|
|
1b423f5b54 | ||
|
|
269f73205a | ||
|
|
8147e64c48 | ||
|
|
d321dcf20b | ||
|
|
59e72cd1c2 | ||
|
|
d67fe22b8d | ||
|
|
b2847811ef | ||
|
|
b7f050aa3b | ||
|
|
cc67569425 | ||
|
|
7657d8680e | ||
|
|
26927907cf | ||
|
|
e406dd02ed | ||
|
|
c90ea92a4e | ||
|
|
c28feb56a8 | ||
|
|
78f1c0f11f | ||
|
|
95f8e9fbe8 | ||
|
|
1befbfee6f | ||
|
|
9316b2bed0 | ||
|
|
58ce44c935 | ||
|
|
c59c5e35f8 | ||
|
|
90da6ba364 | ||
|
|
0f190e094d | ||
|
|
0c63dac5e7 | ||
|
|
3a86c53b49 | ||
|
|
a5292d4b71 | ||
|
|
cd7a7fa3d2 | ||
|
|
255a492db6 | ||
|
|
6cff270d3d |
9
.gitignore
vendored
9
.gitignore
vendored
@@ -23,6 +23,9 @@ public/uploads/logo.gif
|
||||
public/uploads/logo.png
|
||||
.siteflow
|
||||
public/assets/.siteflow
|
||||
.settings/settings.json
|
||||
|
||||
|
||||
app/config/local/session.php
|
||||
.couscous
|
||||
tests/_support/_generated/*
|
||||
tests/_data/scenarios
|
||||
nbproject/*
|
||||
app/config/local/ldap.php
|
||||
|
||||
15
.travis.yml
15
.travis.yml
@@ -1,6 +1,7 @@
|
||||
addons:
|
||||
hosts:
|
||||
- AlisonMBP
|
||||
hosts:
|
||||
- snipe-it.dev
|
||||
sudo: false
|
||||
|
||||
# see http://about.travis-ci.org/docs/user/languages/php/ for more hints
|
||||
language: php
|
||||
@@ -17,7 +18,7 @@ env:
|
||||
|
||||
# execute any number of scripts before the test run, custom env's are available as variables
|
||||
before_script:
|
||||
- if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS snipeit_laravel;" -utravis; fi
|
||||
- if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS snipeit_unit;" -utravis; fi
|
||||
- curl -s http://getcomposer.org/installer | php
|
||||
- cp app/config/testing/app.example.php app/config/testing/app.php
|
||||
- cp app/config/testing/database.example.php app/config/testing/database.php
|
||||
@@ -32,9 +33,17 @@ before_script:
|
||||
|
||||
# omitting "script:" will default to phpunit
|
||||
# use the $DB env variable to determine the phpunit.xml to use
|
||||
# script: ./vendor/bin/codecept run
|
||||
script: phpunit
|
||||
|
||||
# configure notifications (email, IRC, campfire etc)
|
||||
notifications:
|
||||
email: false
|
||||
slack:
|
||||
secure: vv9we1RxB9RsrMbomSdq6D7vz/okobw87pEkgIZjB+hj1QpQ2by90gsPsOa+NgsJEFaEP7e4KlT6SH8kK+zhbmuKaUd3d1//XdcancE22LZXi6tkiB5yuR/Jhhb1LLDqyGJTB4D92hMnnCPiUjpxNA3r437ttNeYRdYIEEP3drA=
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/5e136eb0c1965f3918d0
|
||||
on_success: change # options: [always|never|change] default: always
|
||||
on_failure: change # options: [always|never|change] default: always
|
||||
on_start: false # default: false
|
||||
|
||||
1211
CHANGELOG.md
1211
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
48
README.md
48
README.md
@@ -14,13 +14,16 @@ This project is being actively developed and we're [releasing quite frequently](
|
||||
__This is web-based software__. This means there there is no executable file (aka no .exe files), and it must be run on a web server and accessed through a web browser. It runs on any Mac OSX, flavor of Linux, as well as Windows.
|
||||
|
||||
-----
|
||||
### Documentation & Installation
|
||||
|
||||
__Installation and configuration documentation for this project has been moved to http://snipeitapp.com/documentation/.__
|
||||
### Installation
|
||||
|
||||
We'll be adding a long-overdue user's manual soon as well.
|
||||
__Installation and configuration documentation for this project has been moved to http://docs.snipeitapp.com.__
|
||||
|
||||
__To deploy on Ubuntu using Ansible and Vagrant, be sure to check out the [Snipe-IT Installation scripts](https://github.com/GR360RY/snipeit-ansible) created by [@GR360RY](https://github.com/GR360RY/).__
|
||||
#### Server Requirements
|
||||
Please see the [requirements documentation](http://docs.snipeitapp.com/requirements.html) for full requirements.
|
||||
|
||||
|
||||
To deploy on Ubuntu using Ansible and Vagrant, check out the [Snipe-IT Installation scripts](https://github.com/GR360RY/snipeit-ansible) created by [@GR360RY](https://github.com/GR360RY/).
|
||||
|
||||
-----
|
||||
### Bug Reports & Feature Requests
|
||||
@@ -29,44 +32,31 @@ Feel free to check out the [GitHub Issues for this project](https://github.com/s
|
||||
|
||||
We use Waffle.io to help better communicate our roadmap with users. Our [project page there](http://waffle.io/snipe/snipe-it) will show you the backlog, what's ready to be worked on, what's in progress, and what's completed.
|
||||
|
||||
[](http://waffle.io/snipe/snipe-it)
|
||||
If you're having trouble with the installation, please check the [Common Issues](http://docs.snipeitapp.com/common-issues.html) and [Getting Help](http://docs.snipeitapp.com/getting-help.html) documentation.
|
||||
|
||||
-----
|
||||
|
||||
### Upgrading
|
||||
|
||||
Please see the [upgrading documentation](http://docs.snipeitapp.com/upgrading.html) for instructions on upgrading Snipe-IT.
|
||||
|
||||
------
|
||||
### Announcement List
|
||||
|
||||
To be notified of important news (such as new releases, security advisories, etc), [sign up for our list](http://eepurl.com/XyZKz). We'll never sell or give away your info, and we'll only email you when it's important.
|
||||
|
||||
------
|
||||
|
||||
### Translations!
|
||||
|
||||
If you're not a coder but want to give back to the project and you're fluent in other languages, consider helping out with the translations. We use [CrowdIn](https://crowdin.com) to manage translations, and it makes it super-simple for you to add translations to the project without messing with code. Check out [the Snipe-IT CrowdIn translation project here](https://crowdin.com/project/snipe-it/).
|
||||
|
||||
We currently have English, Chinese, Finnish, Malay, Romanian and Spanish completed, and are looking for lots more!
|
||||
|
||||
-----
|
||||
## Requirements
|
||||
|
||||
- PHP 5.4 or later
|
||||
- MCrypt PHP Extension
|
||||
- Fileinfo Extension
|
||||
|
||||
And _one_ of the following image libraries (for QR codes, asset model image and user avatar image uploads).
|
||||
|
||||
- GD Library (>=2.0) … or …
|
||||
- Imagick PHP extension (>=6.3.8)
|
||||
Please see the [translations documentation](http://docs.snipeitapp.com/translations.html) for information about available languages and how to add translations to Snipe-IT.
|
||||
|
||||
-----
|
||||
|
||||
## Important Notes on Updating
|
||||
### Contributing
|
||||
|
||||
Whenever you pull down a new version from master or develop, when you grab the [latest official release](https://github.com/snipe/snipe-it/releases), make sure to run the following commands via command line:
|
||||
Please see the documentation on [contributing and developing for Snipe-IT](http://docs.snipeitapp.com/contributing.html).
|
||||
|
||||
php composer.phar dump-autoload
|
||||
php artisan migrate
|
||||
|
||||
Forgetting to do this can mean your DB might end up out of sync with the new files you just pulled, or you may have some funky cached autoloader values. It's a good idea to get into the habit of running these every time you pull anything new down. If there are no database changes to migrate, it won't hurt anything to run migrations anyway.
|
||||
|
||||
## Contributor Code of Conduct
|
||||
[](http://waffle.io/snipe/snipe-it)
|
||||
|
||||
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ class AppCommand extends Command
|
||||
$this->askUserFirstName();
|
||||
$this->askUserLastName();
|
||||
$this->askUserUsername();
|
||||
$this->askUserEmail();
|
||||
$this->askUserPassword();
|
||||
|
||||
$this->askUserDummyData();
|
||||
@@ -89,10 +90,10 @@ class AppCommand extends Command
|
||||
$this->call('migrate:install');
|
||||
|
||||
// Run the Sentry Migrations
|
||||
$this->call('migrate', array('--package' => 'cartalyst/sentry'));
|
||||
$this->call('migrate', array('--package' => 'cartalyst/sentry','--force'=>true));
|
||||
|
||||
// Run the Migrations
|
||||
$this->call('migrate');
|
||||
$this->call('migrate', array('--force'=>true));
|
||||
|
||||
// Create the default user and default groups.
|
||||
$this->sentryRunner();
|
||||
|
||||
394
app/commands/AssetImportCommand.php
Normal file
394
app/commands/AssetImportCommand.php
Normal file
@@ -0,0 +1,394 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use League\Csv\Reader;
|
||||
|
||||
class AssetImportCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'asset-import:csv';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Import Assets from CSV';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$filename = $this->argument('filename');
|
||||
|
||||
|
||||
if (!$this->option('testrun')=='true') {
|
||||
$this->comment('======= Importing Assets from '.$filename.' =========');
|
||||
} else {
|
||||
$this->comment('====== TEST ONLY Asset Import for '.$filename.' ====');
|
||||
$this->comment('============== NO DATA WILL BE WRITTEN ==============');
|
||||
}
|
||||
|
||||
if (! ini_get("auto_detect_line_endings")) {
|
||||
ini_set("auto_detect_line_endings", '1');
|
||||
}
|
||||
|
||||
$csv = Reader::createFromPath($this->argument('filename'));
|
||||
$csv->setNewline("\r\n");
|
||||
$csv->setOffset(1);
|
||||
$duplicates = '';
|
||||
|
||||
// Loop through the records
|
||||
$nbInsert = $csv->each(function ($row) use ($duplicates) {
|
||||
$status_id = 1;
|
||||
|
||||
// Let's just map some of these entries to more user friendly words
|
||||
|
||||
// User's name
|
||||
if (array_key_exists('0',$row)) {
|
||||
$user_name = trim($row[0]);
|
||||
} else {
|
||||
$user_name = '';
|
||||
}
|
||||
|
||||
// User's email
|
||||
if (array_key_exists('1',$row)) {
|
||||
$user_email = trim($row[1]);
|
||||
} else {
|
||||
$user_email = '';
|
||||
}
|
||||
|
||||
// Asset Category
|
||||
if (array_key_exists('2',$row)) {
|
||||
$user_asset_category = trim($row[2]);
|
||||
} else {
|
||||
$user_asset_category = '';
|
||||
}
|
||||
|
||||
// Asset Name
|
||||
if (array_key_exists('3',$row)) {
|
||||
$user_asset_name = trim($row[3]);
|
||||
} else {
|
||||
$user_asset_name = '';
|
||||
}
|
||||
|
||||
// Asset Manufacturer
|
||||
if (array_key_exists('4',$row)) {
|
||||
$user_asset_mfgr = trim($row[4]);
|
||||
} else {
|
||||
$user_asset_mfgr = '';
|
||||
}
|
||||
|
||||
// Asset model number
|
||||
if (array_key_exists('5',$row)) {
|
||||
$user_asset_modelno = trim($row[5]);
|
||||
} else {
|
||||
$user_asset_modelno = '';
|
||||
}
|
||||
|
||||
// Asset serial number
|
||||
if (array_key_exists('6',$row)) {
|
||||
$user_asset_serial = trim($row[6]);
|
||||
} else {
|
||||
$user_asset_serial = '';
|
||||
}
|
||||
|
||||
// Asset tag
|
||||
if (array_key_exists('7',$row)) {
|
||||
$user_asset_tag = trim($row[7]);
|
||||
} else {
|
||||
$user_asset_tag = '';
|
||||
}
|
||||
|
||||
// Asset location
|
||||
if (array_key_exists('8',$row)) {
|
||||
$user_asset_location = trim($row[8]);
|
||||
} else {
|
||||
$user_asset_location = '';
|
||||
}
|
||||
|
||||
// Asset notes
|
||||
if (array_key_exists('9',$row)) {
|
||||
$user_asset_notes = trim($row[9]);
|
||||
} else {
|
||||
$user_asset_notes = '';
|
||||
}
|
||||
|
||||
// Asset purchase date
|
||||
if (array_key_exists('10',$row)) {
|
||||
if ($row[10]!='') {
|
||||
$user_asset_purchase_date = date("Y-m-d 00:00:01", strtotime($row[10]));
|
||||
} else {
|
||||
$user_asset_purchase_date = '';
|
||||
}
|
||||
} else {
|
||||
$user_asset_purchase_date = '';
|
||||
}
|
||||
|
||||
// A number was given instead of a name
|
||||
if (is_numeric($user_name)) {
|
||||
$this->comment('User '.$user_name.' is not a name - assume this user already exists');
|
||||
$user_username = '';
|
||||
|
||||
// No name was given
|
||||
} elseif ($user_name=='') {
|
||||
$this->comment('No user data provided - skipping user creation, just adding asset');
|
||||
$first_name = '';
|
||||
$last_name = '';
|
||||
$user_username = '';
|
||||
|
||||
} else {
|
||||
|
||||
$name = explode(" ", $user_name);
|
||||
$first_name = $name[0];
|
||||
$email_last_name = '';
|
||||
$email_prefix = $first_name;
|
||||
|
||||
if (!array_key_exists(1, $name)) {
|
||||
$last_name='';
|
||||
$email_last_name = $last_name;
|
||||
$email_prefix = $first_name;
|
||||
} else {
|
||||
$last_name = str_replace($first_name,'',$user_name);
|
||||
|
||||
if ($this->option('email_format')=='filastname') {
|
||||
$email_last_name.=str_replace(' ','',$last_name);
|
||||
$email_prefix = $first_name[0].$email_last_name;
|
||||
|
||||
} elseif ($this->option('email_format')=='firstname.lastname') {
|
||||
$email_last_name.=str_replace(' ','',$last_name);
|
||||
$email_prefix = $first_name.'.'.$email_last_name;
|
||||
|
||||
} elseif ($this->option('email_format')=='firstname') {
|
||||
$email_last_name.=str_replace(' ','',$last_name);
|
||||
$email_prefix = $first_name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$user_username = $email_prefix;
|
||||
|
||||
// Generate an email based on their name if no email address is given
|
||||
if ($user_email=='') {
|
||||
if ($first_name=='Unknown') {
|
||||
$status_id = 7;
|
||||
}
|
||||
$email = strtolower($email_prefix).'@'.$this->option('domain');
|
||||
$user_email = str_replace("'",'',$email);
|
||||
}
|
||||
}
|
||||
|
||||
$this->comment('Full Name: '.$user_name);
|
||||
$this->comment('First Name: '.$first_name);
|
||||
$this->comment('Last Name: '.$last_name);
|
||||
$this->comment('Username: '.$user_username);
|
||||
$this->comment('Email: '.$user_email);
|
||||
$this->comment('Category Name: '.$user_asset_category);
|
||||
$this->comment('Item: '.$user_asset_name);
|
||||
$this->comment('Manufacturer ID: '.$user_asset_mfgr);
|
||||
$this->comment('Model No: '.$user_asset_modelno);
|
||||
$this->comment('Serial No: '.$user_asset_serial);
|
||||
$this->comment('Asset Tag: '.$user_asset_tag);
|
||||
$this->comment('Location: '.$user_asset_location);
|
||||
$this->comment('Purchase Date: '.$user_asset_purchase_date);
|
||||
$this->comment('Notes: '.$user_asset_notes);
|
||||
|
||||
$this->comment('------------- Action Summary ----------------');
|
||||
|
||||
if ($user_username!='') {
|
||||
if ($user = User::where('username', $user_username)->whereNotNull('username')->first()) {
|
||||
$this->comment('User '.$user_username.' already exists');
|
||||
} else {
|
||||
// Create the user
|
||||
$user = Sentry::createUser(array(
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'email' => $user_email,
|
||||
'username' => $user_username,
|
||||
'password' => substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10),
|
||||
'activated' => true,
|
||||
'permissions' => array(
|
||||
'admin' => 0,
|
||||
'user' => 1,
|
||||
),
|
||||
'notes' => 'User imported through asset importer'
|
||||
));
|
||||
|
||||
// Find the group using the group id
|
||||
$userGroup = Sentry::findGroupById(3);
|
||||
|
||||
// Assign the group to the user
|
||||
$user->addGroup($userGroup);
|
||||
$this->comment('User '.$first_name.' created');
|
||||
}
|
||||
} else {
|
||||
$user = new User;
|
||||
}
|
||||
|
||||
// Check for the location match and create it if it doesn't exist
|
||||
if ($location = Location::where('name', $user_asset_location)->first()) {
|
||||
$this->comment('Location '.$user_asset_location.' already exists');
|
||||
} else {
|
||||
$location = new Location();
|
||||
$location->name = e($user_asset_location);
|
||||
$location->address = '';
|
||||
$location->city = '';
|
||||
$location->state = '';
|
||||
$location->country = '';
|
||||
$location->user_id = 1;
|
||||
|
||||
if (!$this->option('testrun')=='true') {
|
||||
|
||||
if ($location->save()) {
|
||||
$this->comment('Location '.$user_asset_location.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Location '.$user_asset_location.' was NOT created');
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->comment('Location '.$user_asset_location.' was (not) created - test run only');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the category match and create it if it doesn't exist
|
||||
if ($category = Category::where('name', $user_asset_category)->where('category_type', 'asset')->first()) {
|
||||
$this->comment('Category '.$user_asset_category.' already exists');
|
||||
} else {
|
||||
$category = new Category();
|
||||
$category->name = e($user_asset_category);
|
||||
$category->category_type = 'asset';
|
||||
$category->user_id = 1;
|
||||
|
||||
if ($category->save()) {
|
||||
$this->comment('Category '.$user_asset_category.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Category '.$user_asset_category.' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the manufacturer match and create it if it doesn't exist
|
||||
if ($manufacturer = Manufacturer::where('name', $user_asset_mfgr)->first()) {
|
||||
$this->comment('Manufacturer '.$user_asset_mfgr.' already exists');
|
||||
} else {
|
||||
$manufacturer = new Manufacturer();
|
||||
$manufacturer->name = e($user_asset_mfgr);
|
||||
$manufacturer->user_id = 1;
|
||||
|
||||
if ($manufacturer->save()) {
|
||||
$this->comment('Manufacturer '.$user_asset_mfgr.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Manufacturer '.$user_asset_mfgr.' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the asset model match and create it if it doesn't exist
|
||||
if ($asset_model = Model::where('name', $user_asset_name)->where('modelno', $user_asset_modelno)->where('category_id', $category->id)->where('manufacturer_id', $manufacturer->id)->first()) {
|
||||
$this->comment('The Asset Model '.$user_asset_name.' with model number '.$user_asset_modelno.' already exists');
|
||||
} else {
|
||||
$asset_model = new Model();
|
||||
$asset_model->name = e($user_asset_name);
|
||||
$asset_model->manufacturer_id = $manufacturer->id;
|
||||
$asset_model->modelno = e($user_asset_modelno);
|
||||
$asset_model->category_id = $category->id;
|
||||
$asset_model->user_id = 1;
|
||||
|
||||
if ($asset_model->save()) {
|
||||
$this->comment('Asset Model '.$user_asset_name.' with model number '.$user_asset_modelno.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Asset Model '.$user_asset_name.' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the asset match and create it if it doesn't exist
|
||||
|
||||
$asset = new Asset();
|
||||
$asset->name = e($user_asset_name);
|
||||
if ($user_asset_purchase_date!='') {
|
||||
$asset->purchase_date = $user_asset_purchase_date;
|
||||
} else {
|
||||
$asset->purchase_date = NULL;
|
||||
}
|
||||
$asset->serial = e($user_asset_serial);
|
||||
$asset->asset_tag = e($user_asset_tag);
|
||||
$asset->model_id = $asset_model->id;
|
||||
$asset->assigned_to = $user->id;
|
||||
$asset->rtd_location_id = $location->id;
|
||||
$asset->user_id = 1;
|
||||
$asset->status_id = $status_id;
|
||||
if ($user_asset_purchase_date!='') {
|
||||
$asset->purchase_date = $user_asset_purchase_date;
|
||||
} else {
|
||||
$asset->purchase_date = NULL;
|
||||
}
|
||||
$asset->notes = e($user_asset_notes);
|
||||
|
||||
if ($asset->save()) {
|
||||
$this->comment('Asset '.$user_asset_name.' with serial number '.$user_asset_serial.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Asset '.$user_asset_name.' was NOT created');
|
||||
}
|
||||
|
||||
|
||||
$this->comment('=====================================');
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
array('filename', InputArgument::REQUIRED, 'File for the CSV import.'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('domain', null, InputOption::VALUE_REQUIRED, 'Email domain for generated email addresses.', null),
|
||||
array('email_format', null, InputOption::VALUE_REQUIRED, 'The format of the email addresses that should be generated. Options are firstname.lastname, firstname, filastname', null),
|
||||
array('testrun', null, InputOption::VALUE_REQUIRED, 'Test the output without writing to the database or not.', null),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,275 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use League\Csv\Reader;
|
||||
|
||||
class ImportCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'import:csv';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Import from CSV';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$filename = $this->argument('filename');
|
||||
|
||||
|
||||
if (!$this->option('testrun')=='true') {
|
||||
$this->comment('======= Importing '.$filename.' =========');
|
||||
} else {
|
||||
$this->comment('====== TEST ONLY Import for '.$filename.' ====');
|
||||
$this->comment('============== NO DATA WILL BE WRITTEN ==============');
|
||||
}
|
||||
|
||||
if (! ini_get("auto_detect_line_endings")) {
|
||||
ini_set("auto_detect_line_endings", '1');
|
||||
}
|
||||
|
||||
$csv = Reader::createFromPath($this->argument('filename'));
|
||||
$csv->setNewline("\r\n");
|
||||
$csv->setOffset(1);
|
||||
$duplicates = '';
|
||||
|
||||
// Loop through the records
|
||||
$nbInsert = $csv->each(function ($row) use ($duplicates) {
|
||||
$status_id = 1;
|
||||
|
||||
if (is_numeric($row[0])) {
|
||||
$this->comment('User '.$row[0].' is not a name - assume this user already exists');
|
||||
} elseif ($row[0]=='') {
|
||||
$this->comment('No user data provided - skipping user creation, just adding asset');
|
||||
} else {
|
||||
|
||||
// Generate an email based on their name
|
||||
$name = explode(" ", $row[0]);
|
||||
$first_name = $name[0];
|
||||
$last_name = '';
|
||||
$email_last_name = '';
|
||||
|
||||
if ($first_name=='Unknown') {
|
||||
$status_id = 7;
|
||||
}
|
||||
|
||||
if (!array_key_exists(1, $name)) {
|
||||
$last_name='';
|
||||
$email_last_name = $last_name;
|
||||
$email_prefix = $first_name;
|
||||
} else {
|
||||
// Loop through the rest of the explode so you don't truncate
|
||||
for ($x=0; $x < count($name); $x++) {
|
||||
if (($x > 0) && ($name[$x]!='')) {
|
||||
$last_name.=' '.$name[$x];
|
||||
$email_last_name.=$name[$x];
|
||||
}
|
||||
}
|
||||
$email_prefix = $first_name[0].$email_last_name;
|
||||
}
|
||||
|
||||
$email = strtolower(str_replace('.','',$email_prefix)).'@'.$this->option('domain');
|
||||
$email = str_replace("'",'',$email);
|
||||
|
||||
$this->comment('Full Name: '.$row[0]);
|
||||
$this->comment('First Name: '.$first_name);
|
||||
$this->comment('Last Name: '.$last_name);
|
||||
$this->comment('Email: '.$email);
|
||||
$this->comment('Category Name: '.$row[1]);
|
||||
$this->comment('Item: '.$row[2]);
|
||||
$this->comment('Manufacturer ID: '.$row[3]);
|
||||
$this->comment('Model No: '.$row[4]);
|
||||
$this->comment('Serial No: '.$row[5]);
|
||||
$this->comment('Asset Tag: '.$row[6]);
|
||||
$this->comment('Location: '.$row[7]);
|
||||
}
|
||||
|
||||
$this->comment('------------- Action Summary ----------------');
|
||||
|
||||
if (isset($email)) {
|
||||
if ($user = User::where('email', $email)->first()) {
|
||||
$this->comment('User '.$email.' already exists');
|
||||
} else {
|
||||
// Create the user
|
||||
$user = Sentry::createUser(array(
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'email' => $email,
|
||||
'password' => substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10),
|
||||
'activated' => true,
|
||||
'permissions' => array(
|
||||
'admin' => 0,
|
||||
'user' => 1,
|
||||
),
|
||||
'notes' => 'Imported user'
|
||||
));
|
||||
|
||||
// Find the group using the group id
|
||||
$userGroup = Sentry::findGroupById(3);
|
||||
|
||||
// Assign the group to the user
|
||||
$user->addGroup($userGroup);
|
||||
$this->comment('User '.$first_name.' created');
|
||||
}
|
||||
} else {
|
||||
$user = new User;
|
||||
}
|
||||
|
||||
// Check for the location match and create it if it doesn't exist
|
||||
if ($location = Location::where('name', $row[7])->first()) {
|
||||
$this->comment('Location '.$row[7].' already exists');
|
||||
} else {
|
||||
$location = new Location();
|
||||
$location->name = e($row[7]);
|
||||
$location->address = '';
|
||||
$location->city = '';
|
||||
$location->state = '';
|
||||
$location->country = '';
|
||||
$location->user_id = 1;
|
||||
|
||||
if (!$this->option('testrun')=='true') {
|
||||
|
||||
if ($location->save()) {
|
||||
$this->comment('Location '.$row[7].' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Location '.$row[1].' was NOT created');
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->comment('Location '.$row[7].' was (not) created - test run only');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the category match and create it if it doesn't exist
|
||||
if ($category = Category::where('name', $row[1])->where('category_type', 'asset')->first()) {
|
||||
$this->comment('Category '.$row[1].' already exists');
|
||||
} else {
|
||||
$category = new Category();
|
||||
$category->name = e($row[1]);
|
||||
$category->category_type = 'asset';
|
||||
$category->user_id = 1;
|
||||
|
||||
if ($category->save()) {
|
||||
$this->comment('Category '.$row[1].' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Category '.$row[1].' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the manufacturer match and create it if it doesn't exist
|
||||
if ($manufacturer = Manufacturer::where('name', $row[3])->first()) {
|
||||
$this->comment('Manufacturer '.$row[3].' already exists');
|
||||
} else {
|
||||
$manufacturer = new Manufacturer();
|
||||
$manufacturer->name = e($row[3]);
|
||||
$manufacturer->user_id = 1;
|
||||
|
||||
if ($manufacturer->save()) {
|
||||
$this->comment('Manufacturer '.$row[3].' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Manufacturer '.$row[3].' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the asset model match and create it if it doesn't exist
|
||||
if ($asset_model = Model::where('name', $row[2])->where('modelno', $row[4])->where('category_id', $category->id)->where('manufacturer_id', $manufacturer->id)->first()) {
|
||||
$this->comment('The Asset Model '.$row[2].' with model number '.$row[4].' already exists');
|
||||
} else {
|
||||
$asset_model = new Model();
|
||||
$asset_model->name = e($row[2]);
|
||||
$asset_model->manufacturer_id = $manufacturer->id;
|
||||
$asset_model->modelno = e($row[4]);
|
||||
$asset_model->category_id = $category->id;
|
||||
$asset_model->user_id = 1;
|
||||
|
||||
if ($asset_model->save()) {
|
||||
$this->comment('Asset Model '.$row[2].' with model number '.$row[4].' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Asset Model '.$row[2].' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the asset match and create it if it doesn't exist
|
||||
|
||||
$asset = new Asset();
|
||||
$asset->name = e($row[2]);
|
||||
$asset->serial = e($row[5]);
|
||||
$asset->asset_tag = e($row[6]);
|
||||
$asset->model_id = $asset_model->id;
|
||||
$asset->assigned_to = $user->id;
|
||||
$asset->rtd_location_id = $location->id;
|
||||
$asset->user_id = 1;
|
||||
$asset->status_id = $status_id;
|
||||
|
||||
if ($asset->save()) {
|
||||
$this->comment('Asset '.$row[2].' with serial number '.$row[5].' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Asset '.$row[5].' was NOT created');
|
||||
}
|
||||
|
||||
|
||||
$this->comment('=====================================');
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
array('filename', InputArgument::REQUIRED, 'File for the CSV import.'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('domain', null, InputOption::VALUE_REQUIRED, 'Email domain for generated email addresses.', null),
|
||||
array('testrun', null, InputOption::VALUE_REQUIRED, 'Test the output without writing to the database or not.', null),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
381
app/commands/LicenseImportCommand.php
Normal file
381
app/commands/LicenseImportCommand.php
Normal file
@@ -0,0 +1,381 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use League\Csv\Reader;
|
||||
|
||||
class LicenseImportCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'license-import:csv';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Import Licenses from CSV';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$filename = $this->argument('filename');
|
||||
|
||||
|
||||
if (!$this->option('testrun')=='true') {
|
||||
$this->comment('======= Importing Licenses from '.$filename.' =========');
|
||||
} else {
|
||||
$this->comment('====== TEST ONLY License Import for '.$filename.' ====');
|
||||
$this->comment('============== NO DATA WILL BE WRITTEN ==============');
|
||||
}
|
||||
|
||||
if (! ini_get("auto_detect_line_endings")) {
|
||||
ini_set("auto_detect_line_endings", '1');
|
||||
}
|
||||
|
||||
$csv = Reader::createFromPath($this->argument('filename'));
|
||||
$csv->setNewline("\r\n");
|
||||
$csv->setOffset(1);
|
||||
$duplicates = '';
|
||||
|
||||
// Loop through the records
|
||||
$nbInsert = $csv->each(function ($row) use ($duplicates) {
|
||||
$status_id = 1;
|
||||
|
||||
// Let's just map some of these entries to more user friendly words
|
||||
|
||||
if (array_key_exists('0',$row)) {
|
||||
$user_name = trim($row[0]);
|
||||
} else {
|
||||
$user_name = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('1',$row)) {
|
||||
$user_email = trim($row[1]);
|
||||
} else {
|
||||
$user_email = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('2',$row)) {
|
||||
$user_username = trim($row[2]);
|
||||
} else {
|
||||
$user_username = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('3',$row)) {
|
||||
$user_license_name = trim($row[3]);
|
||||
} else {
|
||||
$user_license_name = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('4',$row)) {
|
||||
$user_license_serial = trim($row[4]);
|
||||
} else {
|
||||
$user_license_serial = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('5',$row)) {
|
||||
$user_licensed_to_name = trim($row[5]);
|
||||
} else {
|
||||
$user_licensed_to_name = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('6',$row)) {
|
||||
$user_licensed_to_email = trim($row[6]);
|
||||
} else {
|
||||
$user_licensed_to_email = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('7',$row)) {
|
||||
$user_license_seats = trim($row[7]);
|
||||
} else {
|
||||
$user_license_seats = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('8',$row)) {
|
||||
$user_license_reassignable = trim($row[8]);
|
||||
if ($user_license_reassignable!='') {
|
||||
if ((strtolower($user_license_reassignable)=='yes') || (strtolower($user_license_reassignable)=='true') || ($user_license_reassignable=='1')) {
|
||||
$user_license_reassignable = 1;
|
||||
}
|
||||
} else {
|
||||
$user_license_reassignable = 0;
|
||||
}
|
||||
} else {
|
||||
$user_license_reassignable = 0;
|
||||
}
|
||||
|
||||
if (array_key_exists('9',$row)) {
|
||||
$user_license_supplier = trim($row[9]);
|
||||
} else {
|
||||
$user_license_supplier = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('10',$row)) {
|
||||
$user_license_maintained = trim($row[10]);
|
||||
|
||||
if ($user_license_maintained!='') {
|
||||
if ((strtolower($user_license_maintained)=='yes') || (strtolower($user_license_maintained)=='true') || ($user_license_maintained=='1')) {
|
||||
$user_license_maintained = 1;
|
||||
}
|
||||
} else {
|
||||
$user_license_maintained = 0;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$user_license_maintained = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('11',$row)) {
|
||||
$user_license_notes = trim($row[11]);
|
||||
} else {
|
||||
$user_license_notes = '';
|
||||
}
|
||||
|
||||
if (array_key_exists('12',$row)) {
|
||||
if ($row[12]!='') {
|
||||
$user_license_purchase_date = date("Y-m-d 00:00:01", strtotime($row[12]));
|
||||
} else {
|
||||
$user_license_purchase_date = '';
|
||||
}
|
||||
} else {
|
||||
$user_license_purchase_date = 0;
|
||||
}
|
||||
|
||||
// A number was given instead of a name
|
||||
if (is_numeric($user_name)) {
|
||||
$this->comment('User '.$user_name.' is not a name - assume this user already exists');
|
||||
$user_username = '';
|
||||
// No name was given
|
||||
|
||||
} elseif ($user_name=='') {
|
||||
$this->comment('No user data provided - skipping user creation, just adding license');
|
||||
$first_name = '';
|
||||
$last_name = '';
|
||||
$user_username = '';
|
||||
|
||||
} else {
|
||||
|
||||
$name = explode(" ", $user_name);
|
||||
$first_name = $name[0];
|
||||
$email_last_name = '';
|
||||
$email_prefix = $first_name;
|
||||
|
||||
if (!array_key_exists(1, $name)) {
|
||||
$last_name='';
|
||||
$email_last_name = $last_name;
|
||||
$email_prefix = $first_name;
|
||||
} else {
|
||||
$last_name = str_replace($first_name,'',$user_name);
|
||||
|
||||
if ($this->option('email_format')=='filastname') {
|
||||
$email_last_name.=str_replace(' ','',$last_name);
|
||||
$email_prefix = $first_name[0].$email_last_name;
|
||||
|
||||
} elseif ($this->option('email_format')=='firstname.lastname') {
|
||||
$email_last_name.=str_replace(' ','',$last_name);
|
||||
$email_prefix = $first_name.'.'.$email_last_name;
|
||||
|
||||
} elseif ($this->option('email_format')=='firstname') {
|
||||
$email_last_name.=str_replace(' ','',$last_name);
|
||||
$email_prefix = $first_name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$user_username = $email_prefix;
|
||||
|
||||
// Generate an email based on their name if no email address is given
|
||||
if ($user_email=='') {
|
||||
if ($first_name=='Unknown') {
|
||||
$status_id = 7;
|
||||
}
|
||||
$email = strtolower($email_prefix).'@'.$this->option('domain');
|
||||
$user_email = str_replace("'",'',$email);
|
||||
}
|
||||
}
|
||||
|
||||
$this->comment('Full Name: '.$user_name);
|
||||
$this->comment('First Name: '.$first_name);
|
||||
$this->comment('Last Name: '.$last_name);
|
||||
$this->comment('Username: '.$user_username);
|
||||
$this->comment('Email: '.$user_email);
|
||||
$this->comment('License Name: '.$user_license_name);
|
||||
$this->comment('Serial No: '.$user_license_serial);
|
||||
$this->comment('Licensed To Name: '.$user_licensed_to_name);
|
||||
$this->comment('Licensed To Email: '.$user_licensed_to_email);
|
||||
$this->comment('Seats: '.$user_license_seats);
|
||||
$this->comment('Reassignable: '.$user_license_reassignable);
|
||||
$this->comment('Supplier: '.$user_license_supplier);
|
||||
$this->comment('Maintained: '.$user_license_maintained);
|
||||
$this->comment('Notes: '.$user_license_notes);
|
||||
$this->comment('Purchase Date: '.$user_license_purchase_date);
|
||||
|
||||
$this->comment('------------- Action Summary ----------------');
|
||||
|
||||
if ($user_username!='') {
|
||||
if ($user = User::where('username', $user_username)->whereNotNull('username')->first()) {
|
||||
$this->comment('User '.$user_username.' already exists');
|
||||
} else {
|
||||
// Create the user
|
||||
$user = Sentry::createUser(array(
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'email' => $user_email,
|
||||
'username' => $user_username,
|
||||
'password' => substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10),
|
||||
'activated' => true,
|
||||
'permissions' => array(
|
||||
'admin' => 0,
|
||||
'user' => 1,
|
||||
),
|
||||
'notes' => 'User importerd through license importer'
|
||||
));
|
||||
|
||||
// Find the group using the group id
|
||||
$userGroup = Sentry::findGroupById(3);
|
||||
|
||||
// Assign the group to the user
|
||||
$user->addGroup($userGroup);
|
||||
$this->comment('User '.$first_name.' created');
|
||||
}
|
||||
} else {
|
||||
$user = new User;
|
||||
$user->user_id = NULL;
|
||||
}
|
||||
|
||||
|
||||
// Check for the supplier match and create it if it doesn't exist
|
||||
if ($supplier = Supplier::where('name', $user_license_supplier)->first()) {
|
||||
$this->comment('Supplier '.$user_license_supplier.' already exists');
|
||||
} else {
|
||||
$supplier = new Supplier();
|
||||
$supplier->name = e($user_license_supplier);
|
||||
$supplier->user_id = 1;
|
||||
|
||||
if ($supplier->save()) {
|
||||
$this->comment('Supplier '.$user_license_supplier.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Supplier '.$user_license_supplier.' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Add the license
|
||||
$license = new License();
|
||||
$license->name = e($user_license_name);
|
||||
if ($user_license_purchase_date!='') {
|
||||
$license->purchase_date = $user_license_purchase_date;
|
||||
} else {
|
||||
$license->purchase_date = NULL;
|
||||
}
|
||||
$license->serial = e($user_license_serial);
|
||||
$license->seats = e($user_license_seats);
|
||||
$license->supplier_id = $supplier->id;
|
||||
$license->user_id = 1;
|
||||
if ($user_license_purchase_date!='') {
|
||||
$license->purchase_date = $user_license_purchase_date;
|
||||
} else {
|
||||
$license->purchase_date = NULL;
|
||||
}
|
||||
$license->license_name = $user_licensed_to_name;
|
||||
$license->license_email = $user_licensed_to_email;
|
||||
$license->notes = e($user_license_notes);
|
||||
|
||||
if ($license->save()) {
|
||||
$this->comment('License '.$user_license_name.' with serial number '.$user_license_serial.' was created');
|
||||
|
||||
|
||||
$license_seat_created = 0;
|
||||
|
||||
for ($x = 0; $x < $user_license_seats; $x++) {
|
||||
// Create the license seat entries
|
||||
$license_seat = new LicenseSeat();
|
||||
$license_seat->license_id = $license->id;
|
||||
|
||||
// Only assign the first seat to the user
|
||||
if ($x==0) {
|
||||
$license_seat->assigned_to = $user->id;
|
||||
} else {
|
||||
$license_seat->assigned_to = NULL;
|
||||
}
|
||||
|
||||
if ($license_seat->save()) {
|
||||
$license_seat_created++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($license_seat_created > 0) {
|
||||
$this->comment($license_seat_created.' seats were created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! NO seats for '.$user_license_name.' were created');
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$this->comment('Something went wrong! License '.$user_license_name.' was NOT created');
|
||||
}
|
||||
|
||||
|
||||
$this->comment('=====================================');
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
array('filename', InputArgument::REQUIRED, 'File for the CSV import.'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('domain', null, InputOption::VALUE_REQUIRED, 'Email domain for generated email addresses.', null),
|
||||
array('email_format', null, InputOption::VALUE_REQUIRED, 'The format of the email addresses that should be generated. Options are firstname.lastname, firstname, filastname', null),
|
||||
array('testrun', null, InputOption::VALUE_REQUIRED, 'Test the output without writing to the database or not.', null),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
107
app/config/local/ldap.example.php
Normal file
107
app/config/local/ldap.example.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| URL for the LDAP server.
|
||||
|
|
||||
*/
|
||||
'url' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Username
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Username to use to connect authenticate to LDAP.
|
||||
|
|
||||
*/
|
||||
'username' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Password to use when authenticating to LDAP.
|
||||
|
|
||||
*/
|
||||
'password' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Basedn
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The base where the search for users will be executed.
|
||||
|
|
||||
*/
|
||||
'basedn' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'filter' => "&(cn=*)",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP field names that will be retrieved to create a user.
|
||||
|
|
||||
| Using the username as an example:
|
||||
| If I set 'result.username' => 'my-org-username', the code will connect to
|
||||
| LDAP as follows (where $results[$i] represents a row in the LDAP query:
|
||||
| $username-to-insert-in-snipe-it = $results[$i]["my-org-username"][0]
|
||||
|
|
||||
| Note: all these fields are required.
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'result.username' => "",
|
||||
'result.emp.num' => "",
|
||||
'result.last.name' => "",
|
||||
'result.first.name' => "",
|
||||
'result.email' => "",
|
||||
|
||||
/*
|
||||
| This field is optional as not all LDAP directories will have it. If yours
|
||||
| does not have it, just leave this field blank and the extra check will
|
||||
| be omitted.
|
||||
*/
|
||||
'result.active.flag' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP filter query for authentication
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'authentication.filter.query' => "uid=",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP Version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'version' => 3,
|
||||
|
||||
|
||||
);
|
||||
@@ -46,7 +46,7 @@ return array(
|
||||
|
|
||||
*/
|
||||
|
||||
'hasher' => 'native',
|
||||
'hasher' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
1
app/config/production/.gitignore
vendored
1
app/config/production/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
app.php
|
||||
mail.php
|
||||
database.php
|
||||
ldap.php
|
||||
107
app/config/production/ldap.example.php
Normal file
107
app/config/production/ldap.example.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| URL for the LDAP server.
|
||||
|
|
||||
*/
|
||||
'url' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Username
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Username to use to connect authenticate to LDAP.
|
||||
|
|
||||
*/
|
||||
'username' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Password to use when authenticating to LDAP.
|
||||
|
|
||||
*/
|
||||
'password' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Basedn
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The base where the search for users will be executed.
|
||||
|
|
||||
*/
|
||||
'basedn' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'filter' => "&(cn=*)",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP field names that will be retrieved to create a user.
|
||||
|
|
||||
| Using the username as an example:
|
||||
| If I set 'result.username' => 'my-org-username', the code will connect to
|
||||
| LDAP as follows (where $results[$i] represents a row in the LDAP query:
|
||||
| $username-to-insert-in-snipe-it = $results[$i]["my-org-username"][0]
|
||||
|
|
||||
| Note: all these fields are required.
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'result.username' => "",
|
||||
'result.emp.num' => "",
|
||||
'result.last.name' => "",
|
||||
'result.first.name' => "",
|
||||
'result.email' => "",
|
||||
|
||||
/*
|
||||
| This field is optional as not all LDAP directories will have it. If yours
|
||||
| does not have it, just leave this field blank and the extra check will
|
||||
| be omitted.
|
||||
*/
|
||||
'result.active.flag' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP filter query for authentication
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'authentication.filter.query' => "uid=",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP Version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'version' => 3,
|
||||
|
||||
|
||||
);
|
||||
107
app/config/staging/ldap.example.php
Normal file
107
app/config/staging/ldap.example.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| URL for the LDAP server.
|
||||
|
|
||||
*/
|
||||
'url' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Username
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Username to use to connect authenticate to LDAP.
|
||||
|
|
||||
*/
|
||||
'username' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Password to use when authenticating to LDAP.
|
||||
|
|
||||
*/
|
||||
'password' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Basedn
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The base where the search for users will be executed.
|
||||
|
|
||||
*/
|
||||
'basedn' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'filter' => "&(cn=*)",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP field names that will be retrieved to create a user.
|
||||
|
|
||||
| Using the username as an example:
|
||||
| If I set 'result.username' => 'my-org-username', the code will connect to
|
||||
| LDAP as follows (where $results[$i] represents a row in the LDAP query:
|
||||
| $username-to-insert-in-snipe-it = $results[$i]["my-org-username"][0]
|
||||
|
|
||||
| Note: all these fields are required.
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'result.username' => "",
|
||||
'result.emp.num' => "",
|
||||
'result.last.name' => "",
|
||||
'result.first.name' => "",
|
||||
'result.email' => "",
|
||||
|
||||
/*
|
||||
| This field is optional as not all LDAP directories will have it. If yours
|
||||
| does not have it, just leave this field blank and the extra check will
|
||||
| be omitted.
|
||||
*/
|
||||
'result.active.flag' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP filter query for authentication
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'authentication.filter.query' => "uid=",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP Version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'version' => 3,
|
||||
|
||||
|
||||
);
|
||||
@@ -26,7 +26,7 @@ return array(
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => 'http://staging.yourserver.com',
|
||||
'url' => 'http://snipe-it.dev',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -40,6 +40,6 @@ return array(
|
||||
| Run a php artisan key:generate --env=staging to create a random one
|
||||
*/
|
||||
|
||||
'key' => 'Change_this_key_or_snipe_will_get_ya',
|
||||
'key' => '8YHfiO4EyWBewqrpGHDA4Iuom2ZIahXQ',
|
||||
|
||||
);
|
||||
|
||||
@@ -54,7 +54,7 @@ return array(
|
||||
'mysql' => array(
|
||||
'driver' => 'mysql',
|
||||
'host' => 'localhost',
|
||||
'database' => 'snipeit_laravel',
|
||||
'database' => 'snipeit_unit',
|
||||
'username' => 'travis',
|
||||
'password' => '',
|
||||
'charset' => 'utf8',
|
||||
|
||||
107
app/config/testing/ldap.example.php
Normal file
107
app/config/testing/ldap.example.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| URL for the LDAP server.
|
||||
|
|
||||
*/
|
||||
'url' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Username
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Username to use to connect authenticate to LDAP.
|
||||
|
|
||||
*/
|
||||
'username' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Password to use when authenticating to LDAP.
|
||||
|
|
||||
*/
|
||||
'password' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Basedn
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The base where the search for users will be executed.
|
||||
|
|
||||
*/
|
||||
'basedn' => "",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'filter' => "&(cn=*)",
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP field names that will be retrieved to create a user.
|
||||
|
|
||||
| Using the username as an example:
|
||||
| If I set 'result.username' => 'my-org-username', the code will connect to
|
||||
| LDAP as follows (where $results[$i] represents a row in the LDAP query:
|
||||
| $username-to-insert-in-snipe-it = $results[$i]["my-org-username"][0]
|
||||
|
|
||||
| Note: all these fields are required.
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The search filter for the LDAP query.
|
||||
|
|
||||
*/
|
||||
'result.username' => "",
|
||||
'result.emp.num' => "",
|
||||
'result.last.name' => "",
|
||||
'result.first.name' => "",
|
||||
'result.email' => "",
|
||||
|
||||
/*
|
||||
| This field is optional as not all LDAP directories will have it. If yours
|
||||
| does not have it, just leave this field blank and the extra check will
|
||||
| be omitted.
|
||||
*/
|
||||
'result.active.flag' => "",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP filter query for authentication
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'authentication.filter.query' => "uid=",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LDAP Version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The LDAP query that we want to execute when authenticating a user
|
||||
|
|
||||
*/
|
||||
'version' => 3,
|
||||
|
||||
|
||||
);
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
return array (
|
||||
'app_version' => 'v1.2.8-150',
|
||||
'hash_version' => 'v1.2.8-150-g84ffc1a',
|
||||
'app_version' => 'v2.0-pre',
|
||||
'hash_version' => 'v2.0-pre-beta-391-ge49cfb4',
|
||||
);
|
||||
@@ -18,6 +18,46 @@ class AuthController extends BaseController
|
||||
return View::make('frontend.auth.signin');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Authenticates a user to LDAP
|
||||
*
|
||||
* @return true if the username and/or password provided are valid
|
||||
* false if the username and/or password provided are invalid
|
||||
*
|
||||
*/
|
||||
function ldap($username, $password) {
|
||||
|
||||
$ldaphost = Config::get('ldap.url');
|
||||
$ldaprdn = Config::get('ldap.username');
|
||||
$ldappass = Config::get('ldap.password');
|
||||
$baseDn = Config::get('ldap.basedn');
|
||||
$filterQuery = Config::get('ldap.authentication.filter.query') . $username;
|
||||
|
||||
// Connecting to LDAP
|
||||
$connection = ldap_connect($ldaphost) or die("Could not connect to {$ldaphost}");
|
||||
|
||||
try {
|
||||
if ($connection) {
|
||||
// binding to ldap server
|
||||
$ldapbind = ldap_bind($connection, $ldaprdn, $ldappass);
|
||||
if ( ($results = @ldap_search($connection, $baseDn, $filterQuery)) !==false ) {
|
||||
$entry = ldap_first_entry($connection, $results);
|
||||
if ( ($userDn = @ldap_get_dn($connection, $entry)) !== false ) {
|
||||
if( ($isBound = ldap_bind($connection, $userDn, $password)) == "true") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
LOG::error($e->getMessage());
|
||||
}
|
||||
ldap_close($connection);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Account sign in form processing.
|
||||
*
|
||||
@@ -41,9 +81,40 @@ class AuthController extends BaseController
|
||||
}
|
||||
|
||||
try {
|
||||
// Try to log the user in
|
||||
Sentry::authenticate(Input::only('username', 'password'), Input::get('remember-me', 0));
|
||||
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
* Hack in LDAP authentication
|
||||
*/
|
||||
|
||||
// Try to get the user from the database.
|
||||
$user = (array) DB::table('users')->where('username', Input::get('username'))->first();
|
||||
|
||||
if ($user && strpos($user["notes"],'LDAP') !== false) {
|
||||
LOG::debug("Authenticating user against LDAP.");
|
||||
if( $this->ldap(Input::get('username'), Input::get('password')) ) {
|
||||
LOG::debug("valid login");
|
||||
$pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10);
|
||||
$user = Sentry::findUserByLogin( Input::get('username') );
|
||||
$user->password = $pass;
|
||||
$user->save();
|
||||
$credentials = array(
|
||||
'username' => Input::get('username'),
|
||||
'password' => $pass,
|
||||
);
|
||||
Sentry::authenticate($credentials, Input::get('remember-me', 0));
|
||||
}
|
||||
else {
|
||||
throw new Cartalyst\Sentry\Users\UserNotFoundException();
|
||||
}
|
||||
}
|
||||
/* ============================================================== */
|
||||
else {
|
||||
LOG::debug("Authenticating user against database.");
|
||||
// Try to log the user in
|
||||
Sentry::authenticate(Input::only('username', 'password'), Input::get('remember-me', 0));
|
||||
}
|
||||
|
||||
// Get the page we were before
|
||||
$redirect = Session::get('loginRedirect', 'account');
|
||||
|
||||
@@ -136,14 +207,20 @@ class AuthController extends BaseController
|
||||
// Get the user password recovery code
|
||||
$user = Sentry::getUserProvider()->findByLogin(Input::get('username'));
|
||||
|
||||
$reset = $user->getResetPasswordCode();
|
||||
|
||||
// Data to be used on the username view
|
||||
$data = array(
|
||||
'user' => $user,
|
||||
'forgotPasswordUrl' => URL::route('forgot-password-confirm', $user->getResetPasswordCode()),
|
||||
'forgotPasswordUrl' => URL::route('forgot-password-confirm', $reset),
|
||||
);
|
||||
|
||||
$user->reset_password_code = $reset;
|
||||
$user->save();
|
||||
|
||||
|
||||
// Send the activation code through username
|
||||
Mail::send('usernames.forgot-password', $data, function ($m) use ($user) {
|
||||
Mail::send('emails.forgot-password', $data, function ($m) use ($user) {
|
||||
$m->to($user->username, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Account Password Recovery');
|
||||
});
|
||||
@@ -165,12 +242,13 @@ class AuthController extends BaseController
|
||||
*/
|
||||
public function getForgotPasswordConfirm($passwordResetCode = null)
|
||||
{
|
||||
|
||||
try {
|
||||
// Find the user using the password reset code
|
||||
$user = Sentry::getUserProvider()->findByResetPasswordCode($passwordResetCode);
|
||||
} catch(Cartalyst\Sentry\Users\UserNotFoundException $e) {
|
||||
// Redirect to the forgot password page
|
||||
return Redirect::route('forgot-password')->with('error', Lang::get('auth/message.account_not_found'));
|
||||
//return Redirect::route('forgot-password')->with('error', Lang::get('auth/message.account_not_found'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
|
||||
@@ -47,117 +47,152 @@ class ViewAssetsController extends AuthorizedController
|
||||
|
||||
public function getRequestAsset($assetId = null) {
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($asset = Asset::find($assetId))) {
|
||||
$user = Sentry::getUser();
|
||||
|
||||
// Check if the asset exists and is requestable
|
||||
if (is_null($asset = Asset::RequestableAssets()->find($assetId))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('frontend/account/view-assets')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
|
||||
return Redirect::route('requestable-assets')->with('error', Lang::get('admin/hardware/message.does_not_exist_or_not_requestable'));
|
||||
} else {
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->created_at = date("Y-m-d h:i:s");
|
||||
|
||||
return View::make('frontend/account/view-assets', compact('asset'));
|
||||
if ($user->location_id) {
|
||||
$logaction->location_id = $user->location_id;
|
||||
}
|
||||
$logaction->user_id = Sentry::getUser()->id;
|
||||
$log = $logaction->logaction('requested');
|
||||
|
||||
return Redirect::route('requestable-assets')->with('success')->with('success', Lang::get('admin/hardware/message.asset_requested'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Get the acceptance screen
|
||||
public function getAcceptAsset($logID = null) {
|
||||
|
||||
|
||||
if (is_null($findlog = Actionlog::find($logID))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
// Asset
|
||||
if (($findlog->asset_id!='') && ($findlog->asset_type=='hardware')) {
|
||||
$item = Asset::find($findlog->asset_id);
|
||||
|
||||
// software
|
||||
} elseif (($findlog->asset_id!='') && ($findlog->asset_type=='software')) {
|
||||
|
||||
// software
|
||||
} elseif (($findlog->asset_id!='') && ($findlog->asset_type=='software')) {
|
||||
$item = License::find($findlog->asset_id);
|
||||
// accessories
|
||||
// accessories
|
||||
} elseif ($findlog->accessory_id!='') {
|
||||
$item = Accessory::find($findlog->accessory_id);
|
||||
$item = Accessory::find($findlog->accessory_id);
|
||||
}
|
||||
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($item)) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
return View::make('frontend/account/accept-asset', compact('item'))->with('findlog', $findlog);
|
||||
|
||||
|
||||
|
||||
|
||||
return View::make('frontend/account/accept-asset', compact('item'))->with('findlog', $findlog);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Save the acceptance
|
||||
public function postAcceptAsset($logID = null) {
|
||||
|
||||
|
||||
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($findlog = Actionlog::find($logID))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($findlog->accepted_id!='') {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.asset_already_accepted'));
|
||||
}
|
||||
|
||||
|
||||
if (!Input::has('asset_acceptance')) {
|
||||
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.accept_or_decline'));
|
||||
}
|
||||
|
||||
$user = Sentry::getUser();
|
||||
$logaction = new Actionlog();
|
||||
|
||||
|
||||
if (Input::get('asset_acceptance')=='accepted') {
|
||||
$logaction_msg = 'accepted';
|
||||
$accepted="accepted";
|
||||
$return_msg = Lang::get('admin/users/message.accepted');
|
||||
} else {
|
||||
$logaction_msg = 'declined';
|
||||
$accepted="rejected";
|
||||
$return_msg = Lang::get('admin/users/message.declined');
|
||||
}
|
||||
|
||||
// Asset
|
||||
if (($findlog->asset_id!='') && ($findlog->asset_type=='hardware')) {
|
||||
$logaction->asset_id = $findlog->asset_id;
|
||||
$logaction->accessory_id = NULL;
|
||||
$logaction->asset_type = 'hardware';
|
||||
|
||||
// software
|
||||
} elseif (($findlog->asset_id!='') && ($findlog->asset_type=='software')) {
|
||||
|
||||
if (Input::get('asset_acceptance')!='accepted') {
|
||||
DB::table('assets')
|
||||
->where('id', $findlog->asset_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->asset_type = 'software';
|
||||
|
||||
// accessories
|
||||
|
||||
// accessories
|
||||
} elseif ($findlog->accessory_id!='') {
|
||||
$logaction->asset_id = NULL;
|
||||
$logaction->accessory_id = $findlog->accessory_id;
|
||||
$logaction->asset_type = 'accessory';
|
||||
$logaction->asset_type = 'accessory';
|
||||
}
|
||||
|
||||
|
||||
$logaction->checkedout_to = $findlog->checkedout_to;
|
||||
|
||||
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction->user_id = $user->id;
|
||||
$logaction->accepted_at = date("Y-m-d h:i:s");
|
||||
$log = $logaction->logaction('accepted');
|
||||
|
||||
|
||||
$log = $logaction->logaction($logaction_msg);
|
||||
|
||||
$update_checkout = DB::table('asset_logs')
|
||||
->where('id',$findlog->id)
|
||||
->update(array('accepted_id' => $logaction->id));
|
||||
|
||||
$affected_asset=$logaction->assetlog;
|
||||
$affected_asset->accepted=$accepted;
|
||||
$affected_asset->save();
|
||||
|
||||
if ($update_checkout ) {
|
||||
return Redirect::to('account/view-assets')->with('success', 'You have successfully accept this asset.');
|
||||
|
||||
return Redirect::to('account/view-assets')->with('success', $return_msg);
|
||||
|
||||
} else {
|
||||
return Redirect::to('account/view-assets')->with('error', 'Something went wrong ');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ class AccessoriesController extends AdminController
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name) as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
|
||||
return View::make('backend/accessories/checkout', compact('accessory'))->with('users_list',$users_list);
|
||||
|
||||
@@ -322,6 +322,10 @@ class AccessoriesController extends AdminController
|
||||
$data['eula'] = $accessory->getEula();
|
||||
$data['first_name'] = $user->first_name;
|
||||
$data['item_name'] = $accessory->name;
|
||||
$data['checkout_date'] = $logaction->created_at;
|
||||
$data['item_tag'] = '';
|
||||
$data['expected_checkin'] = '';
|
||||
$data['note'] = $logaction->note;
|
||||
$data['require_acceptance'] = $accessory->requireAcceptance();
|
||||
|
||||
|
||||
@@ -428,6 +432,25 @@ class AccessoriesController extends AdminController
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkin from');
|
||||
|
||||
if(!is_null($accessory_user->assigned_to)) {
|
||||
$user = User::find($accessory_user->assigned_to);
|
||||
}
|
||||
|
||||
$data['log_id'] = $logaction->id;
|
||||
$data['first_name'] = $user->first_name;
|
||||
$data['item_name'] = $accessory->name;
|
||||
$data['checkin_date'] = $logaction->created_at;
|
||||
$data['item_tag'] = '';
|
||||
$data['note'] = $logaction->note;
|
||||
|
||||
if (($accessory->checkin_email()=='1')) {
|
||||
|
||||
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');
|
||||
});
|
||||
}
|
||||
|
||||
if ($backto=='user') {
|
||||
return Redirect::to("admin/users/".$return_to.'/view')->with('success', Lang::get('admin/accessories/message.checkin.success'));
|
||||
|
||||
464
app/controllers/admin/AssetMaintenancesController.php
Normal file
464
app/controllers/admin/AssetMaintenancesController.php
Normal file
@@ -0,0 +1,464 @@
|
||||
<?php
|
||||
|
||||
namespace Controllers\Admin;
|
||||
|
||||
use AdminController;
|
||||
use AssetMaintenance;
|
||||
use Carbon\Carbon;
|
||||
use Datatable;
|
||||
use DB;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Log;
|
||||
use Mail;
|
||||
use Redirect;
|
||||
use Response;
|
||||
use Sentry;
|
||||
use Slack;
|
||||
use Str;
|
||||
use Supplier;
|
||||
use TCPDF;
|
||||
use Validator;
|
||||
use View;
|
||||
|
||||
class AssetMaintenancesController extends AdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* getIndex
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
|
||||
return View::make( 'backend/asset_maintenances/index' );
|
||||
}
|
||||
|
||||
/**
|
||||
* getDatatable
|
||||
* Gets the datatable for the index page
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getDatatable()
|
||||
{
|
||||
|
||||
$assetMaintenances = AssetMaintenance::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn( 'actions', function ( $assetMaintenances ) {
|
||||
|
||||
return '<a href="' . route( 'update/asset_maintenance', $assetMaintenances->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', $assetMaintenances->id ) . '" data-content="'
|
||||
. Lang::get( 'admin/asset_maintenances/message.delete.confirm' ) . '" data-title="'
|
||||
. Lang::get( 'general.delete' ) . ' ' . htmlspecialchars( $assetMaintenances->title )
|
||||
. '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
} );
|
||||
|
||||
return Datatable::collection( $assetMaintenances )
|
||||
->addColumn( 'asset', function ( $assetMaintenances ) {
|
||||
|
||||
return link_to( '/hardware/' . $assetMaintenances->asset_id . '/view',
|
||||
mb_strimwidth( $assetMaintenances->asset->name, 0, 50, "..." ) );
|
||||
} )
|
||||
->addColumn( 'supplier', function ( $assetMaintenances ) {
|
||||
|
||||
return link_to( '/admin/settings/suppliers/' . $assetMaintenances->supplier_id
|
||||
. '/view',
|
||||
mb_strimwidth( $assetMaintenances->supplier->name, 0, 50, "..." ) );
|
||||
} )
|
||||
->addColumn( 'asset_maintenance_type', function ( $assetMaintenances ) {
|
||||
|
||||
return $assetMaintenances->asset_maintenance_type;
|
||||
} )
|
||||
->addColumn( 'title', function ( $assetMaintenances ) {
|
||||
|
||||
return link_to( '/admin/asset_maintenances/' . $assetMaintenances->id . '/view',
|
||||
mb_strimwidth( $assetMaintenances->title, 0, 50, "..." ) );
|
||||
} )
|
||||
->addColumn( 'start_date', function ( $assetMaintenances ) {
|
||||
|
||||
return $assetMaintenances->start_date;
|
||||
} )
|
||||
->addColumn( 'completion_date', function ( $assetMaintenances ) {
|
||||
|
||||
return $assetMaintenances->completion_date;
|
||||
} )
|
||||
->addColumn( 'asset_maintenance_time', function ( $assetMaintenances ) {
|
||||
|
||||
if (is_null( $assetMaintenances->asset_maintenance_time )) {
|
||||
$assetMaintenances->asset_maintenance_time = Carbon::now()
|
||||
->diffInDays( Carbon::parse( $assetMaintenances->start_date ) );
|
||||
}
|
||||
|
||||
return intval( $assetMaintenances->asset_maintenance_time );
|
||||
} )
|
||||
->addColumn( 'cost', function ( $assetMaintenances ) {
|
||||
|
||||
return sprintf( Lang::get( 'general.currency' ) . '%01.2f', $assetMaintenances->cost );
|
||||
} )
|
||||
->addColumn( $actions )
|
||||
->searchColumns( 'asset', 'supplier', 'asset_maintenance_type', 'title', 'start_date',
|
||||
'completion_date', 'asset_maintenance_time', 'cost', 'actions' )
|
||||
->orderColumns( 'asset', 'supplier', 'asset_maintenance_type', 'title', 'start_date',
|
||||
'completion_date', 'asset_maintenance_time', 'cost', 'actions' )
|
||||
->make();
|
||||
}
|
||||
|
||||
/**
|
||||
* getCreate
|
||||
*
|
||||
* @param null $assetId
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getCreate( $assetId = null )
|
||||
{
|
||||
|
||||
// Prepare Asset Maintenance Type List
|
||||
$assetMaintenanceType = [
|
||||
'' => 'Select an asset maintenance type',
|
||||
] + AssetMaintenance::getImprovementOptions();
|
||||
// Mark the selected asset, if it came in
|
||||
$selectedAsset = $assetId;
|
||||
// Get the possible assets using a left join to get a list of assets and some other helpful info
|
||||
$asset = DB::table( 'assets' )
|
||||
->leftJoin( 'users', 'users.id', '=', 'assets.assigned_to' )
|
||||
->leftJoin( 'models', 'assets.model_id', '=', 'models.id' )
|
||||
->select( 'assets.id', 'assets.name', 'first_name', 'last_name', 'asset_tag',
|
||||
DB::raw( 'concat(first_name," ",last_name) as full_name, assets.id as id, models.name as modelname' ) )
|
||||
->whereNull( 'assets.deleted_at' )
|
||||
->get();
|
||||
$asset_array = json_decode( json_encode( $asset ), true );
|
||||
$asset_element[ '' ] = 'Please select an asset';
|
||||
// Build a list out of the data results
|
||||
for ($x = 0; $x < count( $asset_array ); $x++) {
|
||||
|
||||
if ($asset_array[ $x ][ 'full_name' ] != '') {
|
||||
$full_name = ' (' . $asset_array[ $x ][ 'full_name' ] . ') ' . $asset_array[ $x ][ 'modelname' ];
|
||||
} else {
|
||||
$full_name = ' (Unassigned) ' . $asset_array[ $x ][ 'modelname' ];
|
||||
}
|
||||
$asset_element[ $asset_array[ $x ][ 'id' ] ] =
|
||||
$asset_array[ $x ][ 'asset_tag' ] . ' - ' . $asset_array[ $x ][ 'name' ] . $full_name;
|
||||
}
|
||||
// Get Supplier List
|
||||
$supplier_list = [ '' => 'Select Supplier' ] + Supplier::orderBy( 'name', 'asc' )
|
||||
->lists( 'name', 'id' );
|
||||
|
||||
// Render the view
|
||||
return View::make( 'backend/asset_maintenances/edit' )
|
||||
->with( 'asset_list', $asset_element )
|
||||
->with( 'selectedAsset', $selectedAsset )
|
||||
->with( 'supplier_list', $supplier_list )
|
||||
->with( 'assetMaintenanceType', $assetMaintenanceType )
|
||||
->with( 'assetMaintenance', new AssetMaintenance );
|
||||
}
|
||||
|
||||
/**
|
||||
* postCreate
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function postCreate()
|
||||
{
|
||||
|
||||
// get the POST data
|
||||
$new = Input::all();
|
||||
|
||||
// create a new model instance
|
||||
$assetMaintenance = new AssetMaintenance();
|
||||
|
||||
// attempt validation
|
||||
if ($assetMaintenance->validate( $new )) {
|
||||
|
||||
if (e( Input::get( 'supplier_id' ) ) == '') {
|
||||
$assetMaintenance->supplier_id = null;
|
||||
} else {
|
||||
$assetMaintenance->supplier_id = e( Input::get( 'supplier_id' ) );
|
||||
}
|
||||
|
||||
if (e( Input::get( 'is_warranty' ) ) == '') {
|
||||
$assetMaintenance->is_warranty = 0;
|
||||
} else {
|
||||
$assetMaintenance->is_warranty = e( Input::get( 'is_warranty' ) );
|
||||
}
|
||||
|
||||
if (e( Input::get( 'cost' ) ) == '') {
|
||||
$assetMaintenance->cost = '';
|
||||
} else {
|
||||
$assetMaintenance->cost = ParseFloat( e( Input::get( 'cost' ) ) );
|
||||
}
|
||||
|
||||
if (e( Input::get( 'notes' ) ) == '') {
|
||||
$assetMaintenance->notes = null;
|
||||
} else {
|
||||
$assetMaintenance->notes = e( Input::get( 'notes' ) );
|
||||
}
|
||||
|
||||
// Save the asset maintenance data
|
||||
$assetMaintenance->asset_id = e( Input::get( 'asset_id' ) );
|
||||
$assetMaintenance->asset_maintenance_type = e( Input::get( 'asset_maintenance_type' ) );
|
||||
$assetMaintenance->title = e( Input::get( 'title' ) );
|
||||
$assetMaintenance->start_date = e( Input::get( 'start_date' ) );
|
||||
$assetMaintenance->completion_date = e( Input::get( 'completion_date' ) );
|
||||
|
||||
if (( $assetMaintenance->completion_date == "" )
|
||||
|| ( $assetMaintenance->completion_date == "0000-00-00" )
|
||||
) {
|
||||
$assetMaintenance->completion_date = null;
|
||||
}
|
||||
|
||||
// Was the asset maintenance created?
|
||||
if ($assetMaintenance->save()) {
|
||||
|
||||
// Redirect to the new asset maintenance page
|
||||
return Redirect::to( "admin/asset_maintenances" )
|
||||
->with( 'success', Lang::get( 'admin/asset_maintenances/message.create.success' ) );
|
||||
}
|
||||
} else {
|
||||
// failure
|
||||
$errors = $assetMaintenance->errors();
|
||||
|
||||
return Redirect::back()
|
||||
->withInput()
|
||||
->withErrors( $errors );
|
||||
}
|
||||
|
||||
// Redirect to the asset maintenance create page
|
||||
return Redirect::to( 'admin/asset_maintenances/edit' )
|
||||
->with( 'error', Lang::get( 'admin/asset_maintenances/message.create.error' ) )
|
||||
->with( 'assetMaintenance', new AssetMaintenance );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getEdit
|
||||
*
|
||||
* @param null $assetMaintenanceId
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getEdit( $assetMaintenanceId = null )
|
||||
{
|
||||
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
|
||||
// Redirect to the improvement management page
|
||||
return Redirect::to( 'admin/asset_maintenances' )
|
||||
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
|
||||
}
|
||||
|
||||
if ($assetMaintenance->completion_date == '0000-00-00') {
|
||||
$assetMaintenance->completion_date = null;
|
||||
}
|
||||
|
||||
if ($assetMaintenance->start_date == '0000-00-00') {
|
||||
$assetMaintenance->start_date = null;
|
||||
}
|
||||
|
||||
if ($assetMaintenance->cost == '0.00') {
|
||||
$assetMaintenance->cost = null;
|
||||
}
|
||||
|
||||
// Prepare Improvement Type List
|
||||
$assetMaintenanceType = [
|
||||
'' => 'Select an improvement type',
|
||||
] + AssetMaintenance::getImprovementOptions();
|
||||
|
||||
// Get the possible assets using a left join to get a list of assets and some other helpful info
|
||||
$asset = DB::table( 'assets' )
|
||||
->leftJoin( 'users', 'users.id', '=', 'assets.assigned_to' )
|
||||
->leftJoin( 'models', 'assets.model_id', '=', 'models.id' )
|
||||
->select( 'assets.id', 'assets.name', 'first_name', 'last_name', 'asset_tag',
|
||||
DB::raw( 'concat(first_name," ",last_name) as full_name, assets.id as id, models.name as modelname' ) )
|
||||
->whereNull( 'assets.deleted_at' )
|
||||
->get();
|
||||
$asset_array = json_decode( json_encode( $asset ), true );
|
||||
$asset_element[ '' ] = 'Please select an asset';
|
||||
// Build a list out of the data results
|
||||
for ($x = 0; $x < count( $asset_array ); $x++) {
|
||||
|
||||
if ($asset_array[ $x ][ 'full_name' ] != '') {
|
||||
$full_name = ' (' . $asset_array[ $x ][ 'full_name' ] . ') ' . $asset_array[ $x ][ 'modelname' ];
|
||||
} else {
|
||||
$full_name = ' (Unassigned) ' . $asset_array[ $x ][ 'modelname' ];
|
||||
}
|
||||
$asset_element[ $asset_array[ $x ][ 'id' ] ] =
|
||||
$asset_array[ $x ][ 'asset_tag' ] . ' - ' . $asset_array[ $x ][ 'name' ] . $full_name;
|
||||
}
|
||||
// Get Supplier List
|
||||
$supplier_list = [ '' => 'Select Supplier' ] + Supplier::orderBy( 'name', 'asc' )
|
||||
->lists( 'name', 'id' );
|
||||
|
||||
// Render the view
|
||||
return View::make( 'backend/asset_maintenances/edit' )
|
||||
->with( 'asset_list', $asset_element )
|
||||
->with( 'selectedAsset', null )
|
||||
->with( 'supplier_list', $supplier_list )
|
||||
->with( 'assetMaintenanceType', $assetMaintenanceType )
|
||||
->with( 'assetMaintenance', $assetMaintenance );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* postEdit
|
||||
*
|
||||
* @param null $assetMaintenanceId
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function postEdit( $assetMaintenanceId = null )
|
||||
{
|
||||
|
||||
// get the POST data
|
||||
$new = Input::all();
|
||||
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
|
||||
// Redirect to the asset maintenance management page
|
||||
return Redirect::to( 'admin/asset_maintenances' )
|
||||
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
|
||||
}
|
||||
|
||||
// attempt validation
|
||||
if ($assetMaintenance->validate( $new )) {
|
||||
|
||||
if (e( Input::get( 'supplier_id' ) ) == '') {
|
||||
$assetMaintenance->supplier_id = null;
|
||||
} else {
|
||||
$assetMaintenance->supplier_id = e( Input::get( 'supplier_id' ) );
|
||||
}
|
||||
|
||||
if (e( Input::get( 'is_warranty' ) ) == '') {
|
||||
$assetMaintenance->is_warranty = 0;
|
||||
} else {
|
||||
$assetMaintenance->is_warranty = e( Input::get( 'is_warranty' ) );
|
||||
}
|
||||
|
||||
if (e( Input::get( 'cost' ) ) == '') {
|
||||
$assetMaintenance->cost = '';
|
||||
} else {
|
||||
$assetMaintenance->cost = ParseFloat( e( Input::get( 'cost' ) ) );
|
||||
}
|
||||
|
||||
if (e( Input::get( 'notes' ) ) == '') {
|
||||
$assetMaintenance->notes = null;
|
||||
} else {
|
||||
$assetMaintenance->notes = e( Input::get( 'notes' ) );
|
||||
}
|
||||
|
||||
// Save the asset maintenance data
|
||||
$assetMaintenance->asset_id = e( Input::get( 'asset_id' ) );
|
||||
$assetMaintenance->asset_maintenance_type = e( Input::get( 'asset_maintenance_type' ) );
|
||||
$assetMaintenance->title = e( Input::get( 'title' ) );
|
||||
$assetMaintenance->start_date = e( Input::get( 'start_date' ) );
|
||||
$assetMaintenance->completion_date = e( Input::get( 'completion_date' ) );
|
||||
|
||||
if (( $assetMaintenance->completion_date == "" )
|
||||
|| ( $assetMaintenance->completion_date == "0000-00-00" )
|
||||
) {
|
||||
$assetMaintenance->completion_date = null;
|
||||
if (( $assetMaintenance->asset_maintenance_time !== 0 )
|
||||
|| ( !is_null( $assetMaintenance->asset_maintenance_time ) )
|
||||
) {
|
||||
$assetMaintenance->asset_maintenance_time = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (( $assetMaintenance->completion_date !== "" )
|
||||
&& ( $assetMaintenance->completion_date !== "0000-00-00" )
|
||||
&& ( $assetMaintenance->start_date !== "" )
|
||||
&& ( $assetMaintenance->start_date !== "0000-00-00" )
|
||||
) {
|
||||
$startDate = Carbon::parse( $assetMaintenance->start_date );
|
||||
$completionDate = Carbon::parse( $assetMaintenance->completion_date );
|
||||
$assetMaintenance->asset_maintenance_time = $completionDate->diffInDays( $startDate );
|
||||
}
|
||||
|
||||
// Was the asset maintenance created?
|
||||
if ($assetMaintenance->save()) {
|
||||
|
||||
// Redirect to the new asset maintenance page
|
||||
return Redirect::to( "admin/asset_maintenances" )
|
||||
->with( 'success', Lang::get( 'admin/asset_maintenances/message.create.success' ) );
|
||||
}
|
||||
} else {
|
||||
// failure
|
||||
$errors = $assetMaintenance->errors();
|
||||
|
||||
return Redirect::back()
|
||||
->withInput()
|
||||
->withErrors( $errors );
|
||||
}
|
||||
|
||||
// Redirect to the improvement create page
|
||||
return Redirect::to( 'admin/asset_maintenances/edit' )
|
||||
->with( 'error', Lang::get( 'admin/asset_maintenances/message.create.error' ) )
|
||||
->with( 'assetMaintenance', $assetMaintenance );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getDelete
|
||||
*
|
||||
* @param $assetMaintenanceId
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getDelete( $assetMaintenanceId )
|
||||
{
|
||||
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
|
||||
// Redirect to the asset maintenance management page
|
||||
return Redirect::to( 'admin/asset_maintenances' )
|
||||
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
|
||||
}
|
||||
// Delete the asset maintenance
|
||||
$assetMaintenance->delete();
|
||||
|
||||
// Redirect to the asset_maintenance management page
|
||||
return Redirect::to( 'admin/asset_maintenances' )
|
||||
->with( 'success', Lang::get( 'admin/asset_maintenances/message.delete.success' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* getView
|
||||
*
|
||||
* @param $assetMaintenanceId
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getView( $assetMaintenanceId )
|
||||
{
|
||||
|
||||
// Check if the asset maintenance exists
|
||||
if (is_null( $assetMaintenance = AssetMaintenance::find( $assetMaintenanceId ) )) {
|
||||
// Redirect to the asset maintenance management page
|
||||
return Redirect::to( 'admin/asset_maintenances' )
|
||||
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
|
||||
}
|
||||
|
||||
return View::make( 'backend/asset_maintenances/view')->with('assetMaintenance', $assetMaintenance);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use Input;
|
||||
use Lang;
|
||||
use Asset;
|
||||
use Supplier;
|
||||
use AssetMaintenance;
|
||||
use Statuslabel;
|
||||
use User;
|
||||
use Setting;
|
||||
@@ -21,15 +22,18 @@ use Response;
|
||||
use Config;
|
||||
use Location;
|
||||
use Log;
|
||||
use DNS1D;
|
||||
use DNS2D;
|
||||
use Mail;
|
||||
use Datatable;
|
||||
use TCPDF;
|
||||
use Slack;
|
||||
use Manufacturer; //for embedded-create
|
||||
|
||||
class AssetsController extends AdminController
|
||||
{
|
||||
protected $qrCodeDimensions = array( 'height' => 3.5, 'width' => 3.5);
|
||||
protected $barCodeDimensions = array( 'height' => 2, 'width' => 22);
|
||||
|
||||
/**
|
||||
* Show a list of all the assets.
|
||||
@@ -42,8 +46,6 @@ class AssetsController extends AdminController
|
||||
return View::make('backend/hardware/index');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Asset create.
|
||||
*
|
||||
@@ -53,29 +55,15 @@ class AssetsController extends AdminController
|
||||
*/
|
||||
public function getCreate($model_id = null)
|
||||
{
|
||||
|
||||
/*
|
||||
// Grab the dropdown list of models
|
||||
//$model_list = array('' => 'Select a Model') + Model::orderBy('name', 'asc')->lists('name'.' '. 'modelno', 'id');
|
||||
|
||||
$model_list = Model::select(DB::raw('concat(manufacturers.name," ",name) as name, id'))->orderBy('name', 'asc')->with('manufacturer')->lists('name', 'id');
|
||||
//$model_list = array('' => Lang::get('general.select_model'));
|
||||
*/
|
||||
|
||||
$model_list = array('' => Lang::get('general.select_model')) + DB::table('models')
|
||||
->select(DB::raw('concat(name," / ",modelno) as name, id'))->orderBy('name', 'asc')
|
||||
->orderBy('modelno', 'asc')
|
||||
->whereNull('deleted_at')
|
||||
->lists('name', 'id');
|
||||
|
||||
|
||||
$supplier_list = array('' => Lang::get('general.select_supplier')) + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
$assigned_to = array('' => Lang::get('general.select_user')) + DB::table('users')->select(DB::raw('concat(first_name," ",last_name) as full_name, id'))->whereNull('deleted_at')->lists('full_name', 'id');
|
||||
$location_list = array('' => Lang::get('general.select_location')) + Location::orderBy('name', 'asc')->lists('name', 'id');
|
||||
|
||||
|
||||
// Grab the dropdown list of status
|
||||
$statuslabel_list = array('' => Lang::get('general.select_statuslabel')) + Statuslabel::orderBy('name', 'asc')->lists('name', 'id');
|
||||
// Grab the dropdown lists
|
||||
$model_list = modelList();
|
||||
$statuslabel_list = statusLabelList();
|
||||
$location_list = locationsList();
|
||||
$manufacturer_list = manufacturerList();
|
||||
$category_list = categoryList();
|
||||
$supplier_list = suppliersList();
|
||||
$assigned_to = assignedToList();
|
||||
$statuslabel_types = statusTypeList();
|
||||
|
||||
$view = View::make('backend/hardware/edit');
|
||||
$view->with('supplier_list',$supplier_list);
|
||||
@@ -84,6 +72,9 @@ class AssetsController extends AdminController
|
||||
$view->with('assigned_to',$assigned_to);
|
||||
$view->with('location_list',$location_list);
|
||||
$view->with('asset',new Asset);
|
||||
$view->with('manufacturer',$manufacturer_list);
|
||||
$view->with('category',$category_list);
|
||||
$view->with('statuslabel_types',$statuslabel_types);
|
||||
|
||||
if (!is_null($model_id)) {
|
||||
$selected_model = Model::find($model_id);
|
||||
@@ -215,19 +206,25 @@ class AssetsController extends AdminController
|
||||
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Grab the dropdown lists
|
||||
$model_list = modelList();
|
||||
$statuslabel_list = statusLabelList();
|
||||
$location_list = locationsList();
|
||||
$manufacturer_list = manufacturerList();
|
||||
$category_list = categoryList();
|
||||
$supplier_list = suppliersList();
|
||||
$assigned_to = assignedToList();
|
||||
$statuslabel_types = statusTypeList();
|
||||
|
||||
// Grab the dropdown list of models
|
||||
$model_list = array('' => Lang::get('general.select_model')) + DB::table('models')
|
||||
->select(DB::raw('concat(name," / ",modelno) as name, id'))->orderBy('name', 'asc')
|
||||
->orderBy('modelno', 'asc')
|
||||
->lists('name', 'id');
|
||||
$supplier_list = array('' => Lang::get('general.select_supplier')) + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
$location_list = array('' => Lang::get('general.select_location')) + Location::orderBy('name', 'asc')->lists('name', 'id');
|
||||
|
||||
// Grab the dropdown list of status
|
||||
$statuslabel_list = Statuslabel::orderBy('name', 'asc')->lists('name', 'id');
|
||||
|
||||
return View::make('backend/hardware/edit', compact('asset'))->with('model_list',$model_list)->with('supplier_list',$supplier_list)->with('location_list',$location_list)->with('statuslabel_list',$statuslabel_list);
|
||||
return View::make('backend/hardware/edit', compact('asset'))
|
||||
->with('model_list',$model_list)
|
||||
->with('supplier_list',$supplier_list)
|
||||
->with('location_list',$location_list)
|
||||
->with('statuslabel_list',$statuslabel_list)
|
||||
->with('assigned_to',$assigned_to)
|
||||
->with('manufacturer',$manufacturer_list)
|
||||
->with('statuslabel_types',$statuslabel_types)
|
||||
->with('category',$category_list);
|
||||
}
|
||||
|
||||
|
||||
@@ -375,7 +372,7 @@ class AssetsController extends AdminController
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
$users_list = array('' => Lang::get('general.select_user')) + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name) as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
$users_list = array('' => Lang::get('general.select_user')) + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
|
||||
return View::make('backend/hardware/checkout', compact('asset'))->with('users_list',$users_list);
|
||||
|
||||
@@ -386,113 +383,51 @@ class AssetsController extends AdminController
|
||||
**/
|
||||
public function postCheckout($assetId)
|
||||
{
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($asset = Asset::find($assetId))) {
|
||||
// Redirect to the asset management page with error
|
||||
if (!$asset = Asset::find($assetId)) {
|
||||
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.not_found'));
|
||||
}
|
||||
|
||||
$assigned_to = e(Input::get('assigned_to'));
|
||||
|
||||
|
||||
|
||||
// Declare the rules for the form validation
|
||||
$rules = array(
|
||||
'assigned_to' => 'required|min:1',
|
||||
'checkout_at' => 'required|date',
|
||||
'note' => 'alpha_space',
|
||||
);
|
||||
|
||||
// Create a new validator instance from our validation rules
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
// If validation fails, we'll exit the operation now.
|
||||
if ($validator->fails()) {
|
||||
// Ooops.. something went wrong
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
}
|
||||
|
||||
|
||||
// Check if the user exists
|
||||
if (is_null($user = User::find($assigned_to))) {
|
||||
// Redirect to the asset management page with error
|
||||
if (!$user = User::find(e(Input::get('assigned_to')))) {
|
||||
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.user_does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the asset data
|
||||
$asset->assigned_to = e(Input::get('assigned_to'));
|
||||
|
||||
// Was the asset updated?
|
||||
if($asset->save()) {
|
||||
$logaction = new Actionlog();
|
||||
|
||||
if (Input::has('checkout_at')) {
|
||||
if (Input::get('checkout_at')!= date("Y-m-d")){
|
||||
$logaction->created_at = e(Input::get('checkout_at')).' 00:00:00';
|
||||
}
|
||||
}
|
||||
if (!$admin = Sentry::getUser()) {
|
||||
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.admin_user_does_not_exist'));
|
||||
}
|
||||
|
||||
|
||||
if (Input::get('checkout_at')!= date("Y-m-d")){
|
||||
$checkout_at = e(Input::get('checkout_at')).' 00:00:00';
|
||||
} else {
|
||||
$checkout_at = date("Y-m-d h:i:s");
|
||||
}
|
||||
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->checkedout_to = $asset->assigned_to;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->location_id = $user->location_id;
|
||||
$logaction->user_id = Sentry::getUser()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$log = $logaction->logaction('checkout');
|
||||
|
||||
$data['log_id'] = $logaction->id;
|
||||
$data['eula'] = $asset->getEula();
|
||||
$data['first_name'] = $user->first_name;
|
||||
$data['item_name'] = $asset->showAssetName();
|
||||
$data['require_acceptance'] = $asset->requireAcceptance();
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
|
||||
|
||||
$slack_settings = [
|
||||
'username' => $settings->botname,
|
||||
'channel' => $settings->slack_channel,
|
||||
'link_names' => true
|
||||
];
|
||||
|
||||
$client = new \Maknz\Slack\Client($settings->slack_endpoint,$slack_settings);
|
||||
|
||||
try {
|
||||
$client->attach([
|
||||
'color' => 'good',
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'Checked Out:',
|
||||
'value' => strtoupper($logaction->asset_type).' asset <'.Config::get('app.url').'/hardware/'.$asset->id.'/view'.'|'.$asset->showAssetName().'> checked out to <'.Config::get('app.url').'/admin/users/'.$user->id.'/view|'.$user->fullName().'> by <'.Config::get('app.url').'/hardware/'.$asset->id.'/view'.'|'.Sentry::getUser()->fullName().'>.'
|
||||
],
|
||||
[
|
||||
'title' => 'Note:',
|
||||
'value' => e($logaction->note)
|
||||
],
|
||||
|
||||
|
||||
|
||||
]
|
||||
])->send('Asset Checked Out');
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
if (Input::has('expected_checkin')) {
|
||||
if (Input::get('expected_checkin')!= date("Y-m-d")){
|
||||
$expected_checkin = e(Input::get('expected_checkin')).' 00:00:00';
|
||||
}
|
||||
} else {
|
||||
$expected_checkin = null;
|
||||
}
|
||||
|
||||
|
||||
if (($asset->requireAcceptance()=='1') || ($asset->getEula())) {
|
||||
|
||||
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');
|
||||
});
|
||||
}
|
||||
|
||||
if ($asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')))) {
|
||||
// Redirect to the new asset page
|
||||
return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.checkout.success'));
|
||||
}
|
||||
@@ -546,6 +481,7 @@ class AssetsController extends AdminController
|
||||
|
||||
// Update the asset data to null, since it's being checked in
|
||||
$asset->assigned_to = NULL;
|
||||
$asset->accepted = NULL;
|
||||
|
||||
|
||||
// Was the asset updated?
|
||||
@@ -602,6 +538,20 @@ class AssetsController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
$data['log_id'] = $logaction->id;
|
||||
$data['first_name'] = $user->first_name;
|
||||
$data['item_name'] = $asset->showAssetName();
|
||||
$data['checkin_date'] = $logaction->created_at;
|
||||
$data['item_tag'] = $asset->asset_tag;
|
||||
$data['note'] = $logaction->note;
|
||||
|
||||
if ((($asset->checkin_email()=='1')) && (!Config::get('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');
|
||||
});
|
||||
}
|
||||
|
||||
if ($backto=='user') {
|
||||
return Redirect::to("admin/users/".$return_to.'/view')->with('success', Lang::get('admin/hardware/message.checkin.success'));
|
||||
} else {
|
||||
@@ -660,9 +610,14 @@ class AssetsController extends AdminController
|
||||
|
||||
if (isset($asset->id,$asset->asset_tag)) {
|
||||
|
||||
if ($settings->barcode_type == 'C128'){
|
||||
$content = DNS1D::getBarcodePNG(route('view/hardware', $asset->id), $settings->barcode_type,
|
||||
$this->barCodeDimensions['height'],$this->barCodeDimensions['width']);
|
||||
}
|
||||
else{
|
||||
$content = DNS2D::getBarcodePNG(route('view/hardware', $asset->id), $settings->barcode_type,
|
||||
$this->qrCodeDimensions['height'],$this->qrCodeDimensions['width']);
|
||||
|
||||
}
|
||||
$img = imagecreatefromstring(base64_decode($content));
|
||||
imagepng($img);
|
||||
imagedestroy($img);
|
||||
@@ -693,17 +648,14 @@ class AssetsController extends AdminController
|
||||
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
// Grab the dropdown list of models
|
||||
$model_list = array('' => Lang::get('general.select_model')) + Model::lists('name', 'id');
|
||||
|
||||
// Grab the dropdown list of status
|
||||
$statuslabel_list = Statuslabel::lists('name', 'id');
|
||||
|
||||
$location_list = array('' => Lang::get('general.select_location')) + Location::lists('name', 'id');
|
||||
|
||||
// get depreciation list
|
||||
$supplier_list = array('' => Lang::get('general.select_supplier')) + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
$assigned_to = array('' => Lang::get('general.select_user')) + DB::table('users')->select(DB::raw('concat(first_name," ",last_name) as full_name, id'))->whereNull('deleted_at')->lists('full_name', 'id');
|
||||
// Grab the dropdown lists
|
||||
$model_list = modelList();
|
||||
$statuslabel_list = statusLabelList();
|
||||
$location_list = locationsList();
|
||||
$manufacturer_list = manufacturerList();
|
||||
$category_list = categoryList();
|
||||
$supplier_list = suppliersList();
|
||||
$assigned_to = assignedToList();
|
||||
|
||||
$asset = clone $asset_to_clone;
|
||||
$asset->id = null;
|
||||
@@ -711,7 +663,15 @@ class AssetsController extends AdminController
|
||||
$asset->serial = '';
|
||||
$asset->assigned_to = '';
|
||||
$asset->mac_address = '';
|
||||
return View::make('backend/hardware/edit')->with('supplier_list',$supplier_list)->with('model_list',$model_list)->with('statuslabel_list',$statuslabel_list)->with('assigned_to',$assigned_to)->with('asset',$asset)->with('location_list',$location_list);
|
||||
return View::make('backend/hardware/edit')
|
||||
->with('supplier_list',$supplier_list)
|
||||
->with('model_list',$model_list)
|
||||
->with('statuslabel_list',$statuslabel_list)
|
||||
->with('assigned_to',$assigned_to)
|
||||
->with('asset',$asset)
|
||||
->with('location_list',$location_list)
|
||||
->with('manufacturer',$manufacturer_list)
|
||||
->with('category',$category_list);
|
||||
|
||||
}
|
||||
|
||||
@@ -795,7 +755,7 @@ class AssetsController extends AdminController
|
||||
}
|
||||
|
||||
} else {
|
||||
return Redirect::back()->with('success', Lang::get('admin/hardware/message.upload.nofiles'));
|
||||
return Redirect::back()->with('error', Lang::get('admin/hardware/message.upload.nofiles'));
|
||||
}
|
||||
|
||||
|
||||
@@ -911,10 +871,10 @@ class AssetsController extends AdminController
|
||||
$assets = Input::get('edit_asset');
|
||||
|
||||
$supplier_list = array('' => '') + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
$statuslabel_list = array('' => '') + Statuslabel::lists('name', 'id');
|
||||
$location_list = array('' => '') + Location::lists('name', 'id');
|
||||
$statuslabel_list = array('' => '') + Statuslabel::lists('name', 'id');
|
||||
$location_list = array('' => '') + Location::lists('name', 'id');
|
||||
|
||||
return View::make('backend/hardware/bulk')->with('assets',$assets)->with('supplier_list',$supplier_list)->with('statuslabel_list',$statuslabel_list)->with('location_list',$location_list);
|
||||
return View::make('backend/hardware/bulk')->with('assets',$assets)->with('supplier_list',$supplier_list)->with('statuslabel_list',$statuslabel_list)->with('location_list',$location_list);
|
||||
|
||||
|
||||
}
|
||||
@@ -941,7 +901,7 @@ class AssetsController extends AdminController
|
||||
|
||||
$assets = Input::get('bulk_edit');
|
||||
|
||||
if ( (Input::has('purchase_date')) || (Input::has('purchase_cost')) || (Input::has('supplier_id')) || (Input::has('order_number')) || (Input::has('warranty_months')) || (Input::has('rtd_location_id')) || (Input::has('status_id')) ) {
|
||||
if ( (Input::has('purchase_date')) || (Input::has('purchase_cost')) || (Input::has('supplier_id')) || (Input::has('order_number')) || (Input::has('warranty_months')) || (Input::has('rtd_location_id')) || (Input::has('requestable')) || (Input::has('status_id')) ) {
|
||||
|
||||
foreach ($assets as $key => $value) {
|
||||
|
||||
@@ -975,6 +935,12 @@ class AssetsController extends AdminController
|
||||
$update_array['status_id'] = e(Input::get('status_id'));
|
||||
}
|
||||
|
||||
if (Input::get('requestable')=='1') {
|
||||
$update_array['requestable'] = 1;
|
||||
} else {
|
||||
$update_array['requestable'] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (DB::table('assets')
|
||||
->where('id', $key)
|
||||
@@ -1014,7 +980,7 @@ class AssetsController extends AdminController
|
||||
public function getDatatable($status = null)
|
||||
{
|
||||
|
||||
$assets = Asset::with('model','assigneduser','assigneduser.userloc','assetstatus','defaultLoc','assetlog','model','model.category')->Hardware()->select(array('id', 'name','model_id','assigned_to','asset_tag','serial','status_id','purchase_date','deleted_at','rtd_location_id'));
|
||||
$assets = Asset::with('model','assigneduser','assigneduser.userloc','assetstatus','defaultLoc','assetlog','model','model.category')->Hardware()->select(array('id', 'name','model_id','assigned_to','asset_tag','serial','status_id','purchase_date','deleted_at','rtd_location_id','notes','order_number','mac_address'));
|
||||
|
||||
|
||||
switch ($status) {
|
||||
@@ -1042,6 +1008,9 @@ class AssetsController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
if (Input::has('order_number')) {
|
||||
$assets->where('order_number','=',e(Input::get('order_number')));
|
||||
}
|
||||
|
||||
$assets = $assets->orderBy('asset_tag', 'ASC')->get();
|
||||
|
||||
@@ -1049,37 +1018,43 @@ class AssetsController extends AdminController
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($assets)
|
||||
{
|
||||
if ($assets->deleted_at=='') {
|
||||
return '<a href="'.route('update/hardware', $assets->id).'" class="btn btn-warning btn-sm"><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', $assets->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($assets->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
return '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $assets->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $assets->id).'" class="btn btn-warning btn-sm"><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', $assets->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($assets->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
} elseif ($assets->model->deleted_at=='') {
|
||||
return '<a href="'.route('restore/hardware', $assets->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$inout = new \Chumper\Datatable\Columns\FunctionColumn('inout', function ($assets)
|
||||
$inout = new \Chumper\Datatable\Columns\FunctionColumn('inout', function ($assets)
|
||||
{
|
||||
if (($assets->assigned_to !='') && ($assets->assigned_to > 0)) {
|
||||
return '<a href="'.route('checkin/hardware', $assets->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
|
||||
} else {
|
||||
return '<a href="'.route('checkout/hardware', $assets->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
|
||||
}
|
||||
|
||||
if ($assets->assetstatus) {
|
||||
|
||||
if ($assets->assetstatus->deployable != 0) {
|
||||
if (($assets->assigned_to !='') && ($assets->assigned_to > 0)) {
|
||||
return '<a href="'.route('checkin/hardware', $assets->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
|
||||
} else {
|
||||
return '<a href="'.route('checkout/hardware', $assets->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
return Datatable::collection($assets)
|
||||
->addColumn('',function($assets)
|
||||
{
|
||||
return '<input type="checkbox" name="edit_asset['.$assets->id.']" class="one_required">';
|
||||
})
|
||||
->addColumn('name',function($assets)
|
||||
{
|
||||
return '<a title="'.$assets->name.'" href="hardware/'.$assets->id.'/view">'.$assets->name.'</a>';
|
||||
})
|
||||
->addColumn('asset_tag',function($assets)
|
||||
{
|
||||
return '<a title="'.$assets->asset_tag.'" href="hardware/'.$assets->id.'/view">'.$assets->asset_tag.'</a>';
|
||||
})
|
||||
return Datatable::collection($assets)
|
||||
->addColumn('',function($assets)
|
||||
{
|
||||
return '<div class="text-center"><input type="checkbox" name="edit_asset['.$assets->id.']" class="one_required"></div>';
|
||||
})
|
||||
->addColumn('name',function($assets)
|
||||
{
|
||||
return '<a title="'.$assets->name.'" href="hardware/'.$assets->id.'/view">'.$assets->name.'</a>';
|
||||
})
|
||||
->addColumn('asset_tag',function($assets)
|
||||
{
|
||||
return '<a title="'.$assets->asset_tag.'" href="hardware/'.$assets->id.'/view">'.$assets->asset_tag.'</a>';
|
||||
})
|
||||
|
||||
->showColumns('serial')
|
||||
|
||||
@@ -1095,7 +1070,7 @@ class AssetsController extends AdminController
|
||||
->addColumn('status',function($assets)
|
||||
{
|
||||
if ($assets->assigned_to!='') {
|
||||
return link_to('../admin/users/'.$assets->assigned_to.'/view', $assets->assigneduser->fullName());
|
||||
return link_to(Config::get('app.url').'/admin/users/'.$assets->assigned_to.'/view', $assets->assigneduser->fullName());
|
||||
} else {
|
||||
if ($assets->assetstatus) {
|
||||
return $assets->assetstatus->name;
|
||||
@@ -1127,6 +1102,20 @@ class AssetsController extends AdminController
|
||||
return $assets->eol_date();
|
||||
})
|
||||
|
||||
->addColumn('notes',function($assets)
|
||||
{
|
||||
return $assets->notes;
|
||||
})
|
||||
->addColumn('mac_address',function($assets)
|
||||
{
|
||||
return $assets->mac_address;
|
||||
})
|
||||
|
||||
->addColumn('order_number',function($assets)
|
||||
{
|
||||
return '<a href="../hardware/?order_number='.$assets->order_number.'">'.$assets->order_number.'';
|
||||
})
|
||||
|
||||
|
||||
->addColumn('checkout_date',function($assets)
|
||||
{
|
||||
@@ -1137,8 +1126,8 @@ class AssetsController extends AdminController
|
||||
})
|
||||
->addColumn($inout)
|
||||
->addColumn($actions)
|
||||
->searchColumns('name', 'asset_tag', 'serial', 'model', 'status','location','eol','checkout_date', 'inout','category')
|
||||
->orderColumns('name', 'asset_tag', 'serial', 'model', 'status','location','eol','checkout_date', 'inout')
|
||||
->searchColumns('name', 'asset_tag', 'serial', 'model', 'status','location','eol','checkout_date', 'inout','category','notes','order_number','mac_address')
|
||||
->orderColumns('name', 'asset_tag', 'serial', 'model', 'status','location','eol','notes','order_number','checkout_date', 'inout','mac_address')
|
||||
->make();
|
||||
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ class CategoriesController extends AdminController
|
||||
$category->eula_text = e(Input::get('eula_text'));
|
||||
$category->use_default_eula = e(Input::get('use_default_eula', '0'));
|
||||
$category->require_acceptance = e(Input::get('require_acceptance', '0'));
|
||||
$category->checkin_email = e(Input::get('checkin_email', '0'));
|
||||
$category->user_id = Sentry::getId();
|
||||
|
||||
// Was the asset created?
|
||||
@@ -145,6 +146,7 @@ class CategoriesController extends AdminController
|
||||
$category->eula_text = e(Input::get('eula_text'));
|
||||
$category->use_default_eula = e(Input::get('use_default_eula', '0'));
|
||||
$category->require_acceptance = e(Input::get('require_acceptance', '0'));
|
||||
$category->checkin_email = e(Input::get('checkin_email', '0'));
|
||||
|
||||
// Was the asset created?
|
||||
if($category->save()) {
|
||||
|
||||
@@ -218,7 +218,7 @@ class ConsumablesController extends AdminController
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name) as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
|
||||
return View::make('backend/consumables/checkout', compact('consumable'))->with('users_list',$users_list);
|
||||
|
||||
@@ -322,6 +322,10 @@ class ConsumablesController extends AdminController
|
||||
$data['eula'] = $consumable->getEula();
|
||||
$data['first_name'] = $user->first_name;
|
||||
$data['item_name'] = $consumable->name;
|
||||
$data['checkout_date'] = $logaction->created_at;
|
||||
$data['item_tag'] = '';
|
||||
$data['expected_checkin'] = '';
|
||||
$data['note'] = $logaction->note;
|
||||
$data['require_acceptance'] = $consumable->requireAcceptance();
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class GroupsController extends AdminController
|
||||
// Was the group created?
|
||||
if ($group = Sentry::getGroupProvider()->create($inputs)) {
|
||||
// Redirect to the new group page
|
||||
return Redirect::route('update/group', $group->id)->with('success', Lang::get('admin/groups/message.success.create'));
|
||||
return Redirect::route('groups')->with('success', Lang::get('admin/groups/message.success.create'));
|
||||
}
|
||||
|
||||
// Redirect to the new group page
|
||||
|
||||
@@ -101,6 +101,12 @@ class LicensesController extends AdminController
|
||||
$license->maintained = e(Input::get('maintained'));
|
||||
}
|
||||
|
||||
if ( e(Input::get('reassignable')) == '') {
|
||||
$license->reassignable = 0;
|
||||
} else {
|
||||
$license->reassignable = e(Input::get('reassignable'));
|
||||
}
|
||||
|
||||
if ( e(Input::get('purchase_order')) == '') {
|
||||
$license->purchase_order = '';
|
||||
} else {
|
||||
@@ -135,7 +141,7 @@ class LicensesController extends AdminController
|
||||
|
||||
// Was the license created?
|
||||
if($license->save()) {
|
||||
|
||||
|
||||
$insertedId = $license->id;
|
||||
// Save the license seat data
|
||||
for ($x=0; $x<$license->seats; $x++) {
|
||||
@@ -408,7 +414,7 @@ class LicensesController extends AdminController
|
||||
}
|
||||
|
||||
// Get the dropdown of users and then pass it to the checkout view
|
||||
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name) as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
$users_list = array('' => 'Select a User') + DB::table('users')->select(DB::raw('concat(last_name,", ",first_name," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
|
||||
|
||||
// Left join to get a list of assets and some other helpful info
|
||||
@@ -524,7 +530,7 @@ class LicensesController extends AdminController
|
||||
$logaction->asset_id = $licenseseat->license_id;
|
||||
|
||||
|
||||
$license = License::find($licenseseat->license_id);
|
||||
$license = License::find($licenseseat->license_id);
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
|
||||
@@ -533,23 +539,23 @@ class LicensesController extends AdminController
|
||||
$logaction->checkedout_to = NULL;
|
||||
$slack_msg = strtoupper($logaction->asset_type).' license <'.Config::get('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.Config::get('app.url').'/hardware/'.$is_asset_id->id.'/view|'.$is_asset_id->showAssetName().'> by <'.Config::get('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.';
|
||||
} else {
|
||||
$logaction->checkedout_to = e(Input::get('assigned_to'));
|
||||
$logaction->checkedout_to = e(Input::get('assigned_to'));
|
||||
$slack_msg = strtoupper($logaction->asset_type).' license <'.Config::get('app.url').'/admin/licenses/'.$license->id.'/view'.'|'.$license->name.'> checked out to <'.Config::get('app.url').'/admin/users/'.$is_assigned_to->id.'/view|'.$is_assigned_to->fullName().'> by <'.Config::get('app.url').'/admin/users/'.$user->id.'/view'.'|'.$user->fullName().'>.';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
|
||||
|
||||
|
||||
$slack_settings = [
|
||||
'username' => $settings->botname,
|
||||
'channel' => $settings->slack_channel,
|
||||
'link_names' => true
|
||||
];
|
||||
|
||||
|
||||
$client = new \Maknz\Slack\Client($settings->slack_endpoint,$slack_settings);
|
||||
|
||||
|
||||
try {
|
||||
$client->attach([
|
||||
'color' => 'good',
|
||||
@@ -563,13 +569,13 @@ class LicensesController extends AdminController
|
||||
'value' => e($logaction->note)
|
||||
],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
])->send('License Checked Out');
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -612,7 +618,7 @@ class LicensesController extends AdminController
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
$license = License::find($licenseseat->license_id);
|
||||
|
||||
if(!$license->reassignable) {
|
||||
@@ -620,7 +626,7 @@ class LicensesController extends AdminController
|
||||
Session::flash('error', 'License not reassignable.');
|
||||
return Redirect::back()->withInput();
|
||||
}
|
||||
|
||||
|
||||
// Declare the rules for the form validation
|
||||
$rules = array(
|
||||
'note' => 'alpha_space',
|
||||
@@ -642,7 +648,7 @@ class LicensesController extends AdminController
|
||||
// Update the asset data
|
||||
$licenseseat->assigned_to = NULL;
|
||||
$licenseseat->asset_id = NULL;
|
||||
|
||||
|
||||
$user = Sentry::getUser();
|
||||
|
||||
// Was the asset updated?
|
||||
@@ -652,20 +658,20 @@ class LicensesController extends AdminController
|
||||
$logaction->asset_type = 'software';
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction->user_id = $user->id;
|
||||
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
|
||||
|
||||
|
||||
$slack_settings = [
|
||||
'username' => $settings->botname,
|
||||
'channel' => $settings->slack_channel,
|
||||
'link_names' => true
|
||||
];
|
||||
|
||||
|
||||
$client = new \Maknz\Slack\Client($settings->slack_endpoint,$slack_settings);
|
||||
|
||||
|
||||
try {
|
||||
$client->attach([
|
||||
'color' => 'good',
|
||||
@@ -678,20 +684,20 @@ class LicensesController extends AdminController
|
||||
'title' => 'Note:',
|
||||
'value' => e($logaction->note)
|
||||
],
|
||||
|
||||
|
||||
]
|
||||
])->send('License Checked In');
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkin from');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($backto=='user') {
|
||||
return Redirect::to("admin/users/".$return_to.'/view')->with('success', Lang::get('admin/licenses/message.checkin.success'));
|
||||
@@ -805,7 +811,7 @@ class LicensesController extends AdminController
|
||||
}
|
||||
|
||||
} else {
|
||||
return Redirect::back()->with('success', Lang::get('admin/licenses/message.upload.nofiles'));
|
||||
return Redirect::back()->with('error', Lang::get('admin/licenses/message.upload.nofiles'));
|
||||
}
|
||||
|
||||
|
||||
@@ -884,7 +890,7 @@ class LicensesController extends AdminController
|
||||
$licenses = License::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function($licenses) {
|
||||
return '<a href="'.route('update/license', $licenses->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', $licenses->id).'" data-content="'.Lang::get('admin/licenses/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($licenses->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
return '<span style="white-space: nowrap;"><a href="'.route('freecheckout/license', $licenses->id).'" class="btn btn-primary btn-sm" style="margin-right:5px;" '.(($licenses->remaincount() > 0) ? '' : 'disabled').'>'.Lang::get('general.checkout').'</a> <a href="'.route('clone/license', $licenses->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', $licenses->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', $licenses->id).'" data-content="'.Lang::get('admin/licenses/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($licenses->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></span>';
|
||||
});
|
||||
|
||||
return Datatable::collection($licenses)
|
||||
@@ -908,4 +914,14 @@ class LicensesController extends AdminController
|
||||
->orderColumns('name','serial','totalSeats','remaining','purchase_date','actions')
|
||||
->make();
|
||||
}
|
||||
|
||||
public function getFreeLicense($licenseId) {
|
||||
// Check if the asset exists
|
||||
if (is_null($license = License::find($licenseId))) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
|
||||
}
|
||||
$seatId = $license->freeSeat($licenseId);
|
||||
return Redirect::to('admin/licenses/'.$seatId.'/checkout');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ use Str;
|
||||
use Validator;
|
||||
use View;
|
||||
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class LocationsController extends AdminController
|
||||
{
|
||||
/**
|
||||
@@ -98,6 +100,52 @@ class LocationsController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$new = Input::all();
|
||||
|
||||
$new['currency']=Setting::first()->default_currency;
|
||||
|
||||
// create a new location instance
|
||||
$location = new Location();
|
||||
|
||||
// attempt validation
|
||||
if ($location->validate($new)) {
|
||||
|
||||
// Save the location data
|
||||
$location->name = e(Input::get('name'));
|
||||
// if (Input::get('parent_id')=='') {
|
||||
// $location->parent_id = null;
|
||||
// } else {
|
||||
// $location->parent_id = e(Input::get('parent_id'));
|
||||
// }
|
||||
$location->currency = Setting::first()->default_currency; //e(Input::get('currency'));
|
||||
$location->address = ''; //e(Input::get('address'));
|
||||
// $location->address2 = e(Input::get('address2'));
|
||||
$location->city = e(Input::get('city'));
|
||||
$location->state = '';//e(Input::get('state'));
|
||||
$location->country = e(Input::get('country'));
|
||||
// $location->zip = e(Input::get('zip'));
|
||||
$location->user_id = Sentry::getId();
|
||||
|
||||
// Was the asset created?
|
||||
if($location->save()) {
|
||||
// Redirect to the new location page
|
||||
return JsonResponse::create($location);
|
||||
//return Redirect::to("admin/settings/locations")->with('success', Lang::get('admin/locations/message.create.success'));
|
||||
} else {
|
||||
return JsonResponse::create(["error" => "Couldn't save Location"],500);
|
||||
}
|
||||
} else {
|
||||
// failure
|
||||
$errors = $location->errors();
|
||||
return JsonResponse::create(["error" => "Failed validation: ".print_r($errors->all('<li>:message</li>'),true)],500);
|
||||
}
|
||||
|
||||
// Redirect to the location create page
|
||||
return Redirect::to('admin/settings/locations/create')->with('error', Lang::get('admin/locations/message.create.error'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Location update.
|
||||
@@ -189,10 +237,14 @@ class LocationsController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
if ($location->has_users->count() > 0) {
|
||||
if ($location->users->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_users'));
|
||||
} elseif ($location->childLocations->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_users'));
|
||||
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_child_loc'));
|
||||
} elseif ($location->assets->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_assets'));
|
||||
} elseif ($location->assignedassets->count() > 0) {
|
||||
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_assets'));
|
||||
} else {
|
||||
$location->delete();
|
||||
return Redirect::to('admin/settings/locations')->with('success', Lang::get('admin/locations/message.delete.success'));
|
||||
|
||||
@@ -16,6 +16,9 @@ use Validator;
|
||||
use View;
|
||||
use Datatable;
|
||||
|
||||
//use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class ModelsController extends AdminController
|
||||
{
|
||||
/**
|
||||
@@ -60,6 +63,27 @@ class ModelsController extends AdminController
|
||||
// Create a new manufacturer
|
||||
$model = new Model;
|
||||
|
||||
|
||||
$validator = Validator::make(
|
||||
// Validator data goes here
|
||||
array(
|
||||
'unique_fields' => array(Input::get('name'), Input::get('modelno'), Input::get('manufacturer_id'))
|
||||
),
|
||||
// Validator rules go here
|
||||
array(
|
||||
'unique_fields' => 'unique_multiple:models,name,modelno,manufacturer_id'
|
||||
)
|
||||
);
|
||||
|
||||
// attempt validation
|
||||
if ($validator->fails())
|
||||
{
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->with('error', Lang::get('admin/models/message.create.duplicate_set'));;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$validator = Validator::make(Input::all(), $model->validationRules());
|
||||
|
||||
// attempt validation
|
||||
@@ -77,7 +101,7 @@ class ModelsController extends AdminController
|
||||
$model->depreciation_id = e(Input::get('depreciation_id'));
|
||||
}
|
||||
|
||||
if ( e(Input::get('eol')) == '') {
|
||||
if ( e(Input::get('eol')) == '') {
|
||||
$model->eol = 0;
|
||||
} else {
|
||||
$model->eol = e(Input::get('eol'));
|
||||
@@ -115,6 +139,36 @@ class ModelsController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
//COPYPASTA!!!! FIXME
|
||||
$model = new Model;
|
||||
|
||||
$settings=Input::all();
|
||||
$settings['eol']=0;
|
||||
//
|
||||
|
||||
$validator = Validator::make($settings, $model->validationRules());
|
||||
if ($validator->fails())
|
||||
{
|
||||
// The given data did not pass validation
|
||||
return JsonResponse::create(["error" => "Failed validation: ".print_r($validator->messages()->all('<li>:message</li>'),true)],500);
|
||||
} else {
|
||||
$model->name=e(Input::get('name'));
|
||||
$model->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
$model->category_id = e(Input::get('category_id'));
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->user_id = Sentry::getUser()->id;
|
||||
$model->eol=0;
|
||||
|
||||
if($model->save()) {
|
||||
return JsonResponse::create($model);
|
||||
} else {
|
||||
return JsonResponse::create(["error" => "Couldn't save Model"],500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Model update.
|
||||
*
|
||||
@@ -131,7 +185,7 @@ class ModelsController extends AdminController
|
||||
|
||||
$depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id');
|
||||
$manufacturer_list = array('' => 'Select One') + Manufacturer::lists('name', 'id');
|
||||
$category_list = array('' => '') + DB::table('categories')->lists('name', 'id');
|
||||
$category_list = array('' => '') + DB::table('categories')->whereNull('deleted_at')->lists('name', 'id');
|
||||
$view = View::make('backend/models/edit', compact('model'));
|
||||
$view->with('category_list',$category_list);
|
||||
$view->with('depreciation_list',$depreciation_list);
|
||||
|
||||
@@ -1,22 +1,75 @@
|
||||
<?php namespace Controllers\Admin;
|
||||
|
||||
use AdminController;
|
||||
use Input;
|
||||
use Lang;
|
||||
use License;
|
||||
use Asset;
|
||||
use User;
|
||||
use View;
|
||||
use Location;
|
||||
use Redirect;
|
||||
use Response;
|
||||
use Accessory;
|
||||
use Actionlog;
|
||||
use Setting;
|
||||
use League\Csv\Writer;
|
||||
use AdminController;
|
||||
use Asset;
|
||||
use AssetMaintenance;
|
||||
use Carbon\Carbon;
|
||||
use Category;
|
||||
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 License;
|
||||
use Location;
|
||||
use Model;
|
||||
use Redirect;
|
||||
use Setting;
|
||||
|
||||
class ReportsController extends AdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* Show Report for Accessories
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function getAccessoryReport()
|
||||
{
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->get();
|
||||
return View::make('backend/reports/accessories', compact('accessories'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Export Accessories Report as CSV
|
||||
*
|
||||
* @return file download
|
||||
*/
|
||||
public function exportAccessoryReport()
|
||||
{
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->get();
|
||||
$rows = array();
|
||||
$header = array(
|
||||
Lang::get('admin/accessories/table.title'),
|
||||
Lang::get('admin/accessories/general.accessory_category'),
|
||||
Lang::get('admin/accessories/general.total'),
|
||||
Lang::get('admin/accessories/general.remaining')
|
||||
);
|
||||
$header = array_map('trim', $header);
|
||||
$rows[] = implode($header, ', ');
|
||||
|
||||
// Row per accessory
|
||||
foreach ($accessories as $accessory) {
|
||||
$row = array();
|
||||
$row[] = $accessory->accessory_name;
|
||||
$row[] = $accessory->accessory_category;
|
||||
$row[] = $accessory->total;
|
||||
$row[] = $accessory->remaining;
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
}
|
||||
|
||||
$csv = implode($rows, "\n");
|
||||
$response = Response::make($csv, 200);
|
||||
$response->header('Content-Type', 'text/csv');
|
||||
$response->header('Content-disposition', 'attachment;filename=report.csv');
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Asset Report
|
||||
*
|
||||
@@ -24,9 +77,14 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function getAssetsReport()
|
||||
{
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::with('model','assigneduser.userLoc','assetstatus','defaultLoc','assetlog','supplier','model.manufacturer')->orderBy('created_at', 'DESC')->get();
|
||||
return View::make('backend/reports/asset', compact('assets'));
|
||||
$assets = Asset::with( 'model', 'assigneduser.userLoc', 'assetstatus', 'defaultLoc', 'assetlog', 'supplier',
|
||||
'model.manufacturer' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
return View::make( 'backend/reports/asset', compact( 'assets' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,41 +94,44 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function exportAssetReport()
|
||||
{
|
||||
// Grab all the assets
|
||||
$assets = Asset::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
$rows = array();
|
||||
// Grab all the assets
|
||||
$assets = Asset::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
$rows = [ ];
|
||||
|
||||
// Create the header row
|
||||
$header = array(
|
||||
Lang::get('admin/hardware/table.asset_tag'),
|
||||
Lang::get('admin/hardware/form.manufacturer'),
|
||||
Lang::get('admin/hardware/form.model'),
|
||||
Lang::get('general.model_no'),
|
||||
Lang::get('general.name'),
|
||||
Lang::get('admin/hardware/table.serial'),
|
||||
Lang::get('general.status'),
|
||||
Lang::get('admin/hardware/table.purchase_date'),
|
||||
Lang::get('admin/hardware/table.purchase_cost'),
|
||||
Lang::get('admin/hardware/form.order'),
|
||||
Lang::get('admin/hardware/form.supplier'),
|
||||
Lang::get('admin/hardware/table.checkoutto'),
|
||||
Lang::get('admin/hardware/table.location')
|
||||
);
|
||||
$header = array_map('trim', $header);
|
||||
$rows[] = implode($header, ',');
|
||||
$header = [
|
||||
Lang::get( 'admin/hardware/table.asset_tag' ),
|
||||
Lang::get( 'admin/hardware/form.manufacturer' ),
|
||||
Lang::get( 'admin/hardware/form.model' ),
|
||||
Lang::get( 'general.model_no' ),
|
||||
Lang::get( 'general.name' ),
|
||||
Lang::get( 'admin/hardware/table.serial' ),
|
||||
Lang::get( 'general.status' ),
|
||||
Lang::get( 'admin/hardware/table.purchase_date' ),
|
||||
Lang::get( 'admin/hardware/table.purchase_cost' ),
|
||||
Lang::get( 'admin/hardware/form.order' ),
|
||||
Lang::get( 'admin/hardware/form.supplier' ),
|
||||
Lang::get( 'admin/hardware/table.checkoutto' ),
|
||||
Lang::get( 'admin/hardware/table.location' ),
|
||||
Lang::get( 'general.notes' ),
|
||||
];
|
||||
$header = array_map( 'trim', $header );
|
||||
$rows[] = implode( $header, ',' );
|
||||
|
||||
// Create a row per asset
|
||||
foreach ($assets as $asset) {
|
||||
$row = array();
|
||||
$row = [ ];
|
||||
$row[] = $asset->asset_tag;
|
||||
if ($asset->model->manufacturer) {
|
||||
$row[] = $asset->model->manufacturer->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
$row[] = '"'.$asset->model->name.'"';
|
||||
$row[] = '"'.$asset->model->modelno.'"';
|
||||
$row[] = '"' . $asset->model->name . '"';
|
||||
$row[] = '"' . $asset->model->modelno . '"';
|
||||
$row[] = $asset->name;
|
||||
$row[] = $asset->serial;
|
||||
if ($asset->assetstatus) {
|
||||
@@ -79,7 +140,7 @@ class ReportsController extends AdminController
|
||||
$row[] = '';
|
||||
}
|
||||
$row[] = $asset->purchase_date;
|
||||
$row[] = '"'.number_format($asset->purchase_cost).'"';
|
||||
$row[] = '"' . number_format( $asset->purchase_cost ) . '"';
|
||||
if ($asset->order_number) {
|
||||
$row[] = $asset->order_number;
|
||||
} else {
|
||||
@@ -92,21 +153,21 @@ class ReportsController extends AdminController
|
||||
}
|
||||
|
||||
if ($asset->assigned_to > 0) {
|
||||
$user = User::find($asset->assigned_to);
|
||||
$user = User::find( $asset->assigned_to );
|
||||
$row[] = $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 (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
|
||||
$location = Location::find( $asset->assigneduser->location_id );
|
||||
if ($location->name) {
|
||||
$row[] = $location->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
} elseif ($asset->rtd_location_id) {
|
||||
$location = Location::find($asset->rtd_location_id);
|
||||
$location = Location::find( $asset->rtd_location_id );
|
||||
if ($location->name) {
|
||||
$row[] = $location->name;
|
||||
} else {
|
||||
@@ -116,14 +177,20 @@ class ReportsController extends AdminController
|
||||
$row[] = ''; // Empty string if location is not set
|
||||
}
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
if ($asset->notes) {
|
||||
$row[] = '"' . $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');
|
||||
$csv = implode( $rows, "\n" );
|
||||
$response = Response::make( $csv, 200 );
|
||||
$response->header( 'Content-Type', 'text/csv' );
|
||||
$response->header( 'Content-disposition', 'attachment;filename=report.csv' );
|
||||
|
||||
return $response;
|
||||
}
|
||||
@@ -135,9 +202,13 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function getDeprecationReport()
|
||||
{
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::with('model','assigneduser','assetstatus','defaultLoc','assetlog')->orderBy('created_at', 'DESC')->get();
|
||||
return View::make('backend/reports/depreciation', compact('assets'));
|
||||
$assets = Asset::with( 'model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
return View::make( 'backend/reports/depreciation', compact( 'assets' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,47 +218,49 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function exportDeprecationReport()
|
||||
{
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::with('model','assigneduser','assetstatus','defaultLoc','assetlog')->orderBy('created_at', 'DESC')->get();
|
||||
$assets = Asset::with( 'model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
$csv = \League\Csv\Writer::createFromFileObject(new \SplTempFileObject());
|
||||
$csv->setOutputBOM(Reader::BOM_UTF16_BE);
|
||||
$csv = \League\Csv\Writer::createFromFileObject( new \SplTempFileObject() );
|
||||
$csv->setOutputBOM( Reader::BOM_UTF16_BE );
|
||||
|
||||
$rows = array();
|
||||
$rows = [ ];
|
||||
|
||||
// Create the header row
|
||||
$header = array(
|
||||
Lang::get('admin/hardware/table.asset_tag'),
|
||||
Lang::get('admin/hardware/table.title'),
|
||||
Lang::get('admin/hardware/table.serial'),
|
||||
Lang::get('admin/hardware/table.checkoutto'),
|
||||
Lang::get('admin/hardware/table.location'),
|
||||
Lang::get('admin/hardware/table.purchase_date'),
|
||||
Lang::get('admin/hardware/table.purchase_cost'),
|
||||
Lang::get('admin/hardware/table.book_value'),
|
||||
Lang::get('admin/hardware/table.diff')
|
||||
);
|
||||
$header = [
|
||||
Lang::get( 'admin/hardware/table.asset_tag' ),
|
||||
Lang::get( 'admin/hardware/table.title' ),
|
||||
Lang::get( 'admin/hardware/table.serial' ),
|
||||
Lang::get( 'admin/hardware/table.checkoutto' ),
|
||||
Lang::get( 'admin/hardware/table.location' ),
|
||||
Lang::get( 'admin/hardware/table.purchase_date' ),
|
||||
Lang::get( 'admin/hardware/table.purchase_cost' ),
|
||||
Lang::get( 'admin/hardware/table.book_value' ),
|
||||
Lang::get( 'admin/hardware/table.diff' )
|
||||
];
|
||||
|
||||
//we insert the CSV header
|
||||
$csv->insertOne($header);
|
||||
$csv->insertOne( $header );
|
||||
|
||||
// Create a row per asset
|
||||
foreach ($assets as $asset) {
|
||||
$row = array();
|
||||
$row = [ ];
|
||||
$row[] = $asset->asset_tag;
|
||||
$row[] = $asset->name;
|
||||
$row[] = $asset->serial;
|
||||
|
||||
|
||||
if ($asset->assigned_to > 0) {
|
||||
$user = User::find($asset->assigned_to);
|
||||
$row[] = $user->fullName();
|
||||
} else {
|
||||
$user = User::find( $asset->assigned_to );
|
||||
$row[] = $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 (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
|
||||
$location = Location::find( $asset->assigneduser->location_id );
|
||||
if ($location->city) {
|
||||
$row[] = $location->city . ', ' . $location->state;
|
||||
} elseif ($location->name) {
|
||||
@@ -199,45 +272,44 @@ class ReportsController extends AdminController
|
||||
$row[] = ''; // Empty string if location is not set
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($asset->assetloc) {
|
||||
$currency = $asset->assetloc->currency;
|
||||
$currency = $asset->assetloc->currency;
|
||||
} else {
|
||||
$currency = Setting::first()->default_currency;
|
||||
$currency = Setting::first()->default_currency;
|
||||
}
|
||||
|
||||
$row[] = $asset->purchase_date;
|
||||
$row[] = $currency.number_format($asset->purchase_cost);
|
||||
$row[] = $currency.number_format($asset->getDepreciatedValue());
|
||||
$row[] = $currency.number_format(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
||||
$csv->insertOne($row);
|
||||
$row[] = $currency . number_format( $asset->purchase_cost );
|
||||
$row[] = $currency . number_format( $asset->getDepreciatedValue() );
|
||||
$row[] = $currency . number_format( ( $asset->purchase_cost - $asset->getDepreciatedValue() ) );
|
||||
$csv->insertOne( $row );
|
||||
}
|
||||
|
||||
$csv->output('depreciation-report-'.date('Y-m-d').'.csv');
|
||||
$csv->output( 'depreciation-report-' . date( 'Y-m-d' ) . '.csv' );
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Show Report for Activity
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
|
||||
public function getActivityReport()
|
||||
public function getActivityReport()
|
||||
{
|
||||
$log_actions = Actionlog::orderBy('created_at', 'DESC')
|
||||
->with('adminlog')
|
||||
->with('accessorylog')
|
||||
->with('assetlog')
|
||||
->with('licenselog')
|
||||
->with('userlog')
|
||||
->orderBy('created_at','DESC')
|
||||
->get();
|
||||
return View::make('backend/reports/activity', compact('log_actions'));
|
||||
}
|
||||
|
||||
$log_actions = Actionlog::orderBy( 'created_at', 'DESC' )
|
||||
->with( 'adminlog' )
|
||||
->with( 'accessorylog' )
|
||||
->with( 'assetlog' )
|
||||
->with( 'licenselog' )
|
||||
->with( 'userlog' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
return View::make( 'backend/reports/activity', compact( 'log_actions' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Report for Licenses
|
||||
@@ -246,8 +318,11 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function getLicenseReport()
|
||||
{
|
||||
$licenses = License::orderBy('created_at', 'DESC')->get();
|
||||
return View::make('backend/reports/licenses', compact('licenses'));
|
||||
|
||||
$licenses = License::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
return View::make( 'backend/reports/licenses', compact( 'licenses' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,170 +332,161 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function exportLicenseReport()
|
||||
{
|
||||
$licenses = License::orderBy('created_at', 'DESC')->get();
|
||||
$rows = array();
|
||||
$header = array(
|
||||
Lang::get('admin/licenses/table.title'),
|
||||
Lang::get('admin/licenses/table.serial'),
|
||||
Lang::get('admin/licenses/form.seats'),
|
||||
Lang::get('admin/licenses/form.remaining_seats'),
|
||||
Lang::get('admin/licenses/form.expiration'),
|
||||
Lang::get('admin/licenses/form.date'),
|
||||
Lang::get('admin/licenses/form.cost')
|
||||
);
|
||||
|
||||
$header = array_map('trim', $header);
|
||||
$rows[] = implode($header, ', ');
|
||||
$licenses = License::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
$rows = [ ];
|
||||
$header = [
|
||||
Lang::get( 'admin/licenses/table.title' ),
|
||||
Lang::get( 'admin/licenses/table.serial' ),
|
||||
Lang::get( 'admin/licenses/form.seats' ),
|
||||
Lang::get( 'admin/licenses/form.remaining_seats' ),
|
||||
Lang::get( 'admin/licenses/form.expiration' ),
|
||||
Lang::get( 'admin/licenses/form.date' ),
|
||||
Lang::get( 'admin/licenses/form.cost' )
|
||||
];
|
||||
|
||||
$header = array_map( 'trim', $header );
|
||||
$rows[] = implode( $header, ', ' );
|
||||
|
||||
// Row per license
|
||||
foreach ($licenses as $license) {
|
||||
$row = array();
|
||||
$row = [ ];
|
||||
$row[] = $license->name;
|
||||
$row[] = $license->serial;
|
||||
$row[] = $license->seats;
|
||||
$row[] = $license->remaincount();
|
||||
$row[] = $license->expiration_date;
|
||||
$row[] = $license->purchase_date;
|
||||
$row[] = '"'.number_format($license->purchase_cost).'"';
|
||||
$row[] = '"' . number_format( $license->purchase_cost ) . '"';
|
||||
|
||||
$rows[] = implode($row, ',');
|
||||
$rows[] = implode( $row, ',' );
|
||||
}
|
||||
|
||||
$csv = implode($rows, "\n");
|
||||
$response = Response::make($csv, 200);
|
||||
$response->header('Content-Type', 'text/csv');
|
||||
$response->header('Content-disposition', 'attachment;filename=report.csv');
|
||||
$csv = implode( $rows, "\n" );
|
||||
$response = Response::make( $csv, 200 );
|
||||
$response->header( 'Content-Type', 'text/csv' );
|
||||
$response->header( 'Content-disposition', 'attachment;filename=report.csv' );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getCustomReport()
|
||||
{
|
||||
return View::make('backend/reports/custom');
|
||||
|
||||
return View::make( 'backend/reports/custom' );
|
||||
}
|
||||
|
||||
public function postCustom()
|
||||
{
|
||||
$assets = Asset::orderBy('created_at', 'DESC')->get();
|
||||
$rows = array();
|
||||
$header = array();
|
||||
|
||||
if (e(Input::get('asset_name')) == '1')
|
||||
{
|
||||
$assets = Asset::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
$rows = [ ];
|
||||
$header = [ ];
|
||||
|
||||
if (e( Input::get( 'asset_name' ) ) == '1') {
|
||||
$header[] = 'Asset Name';
|
||||
}
|
||||
if (e(Input::get('asset_tag')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'asset_tag' ) ) == '1') {
|
||||
$header[] = 'Asset Tag';
|
||||
}
|
||||
if (e(Input::get('manufacturer')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'manufacturer' ) ) == '1') {
|
||||
$header[] = 'Manufacturer';
|
||||
}
|
||||
if (e(Input::get('model')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'model' ) ) == '1') {
|
||||
$header[] = 'Model';
|
||||
$header[] = 'Model Number';
|
||||
}
|
||||
if (e(Input::get('serial')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'serial' ) ) == '1') {
|
||||
$header[] = 'Serial';
|
||||
}
|
||||
if (e(Input::get('purchase_date')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'purchase_date' ) ) == '1') {
|
||||
$header[] = 'Purchase Date';
|
||||
}
|
||||
if ((e(Input::get('purchase_cost')) == '1') && (e(Input::get('depreciation')) == '0'))
|
||||
{
|
||||
if (( e( Input::get( 'purchase_cost' ) ) == '1' ) && ( e( Input::get( 'depreciation' ) ) == '0' )) {
|
||||
$header[] = 'Purchase Cost';
|
||||
}
|
||||
if (e(Input::get('order')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'order' ) ) == '1') {
|
||||
$header[] = 'Order Number';
|
||||
}
|
||||
if (e(Input::get('supplier')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'supplier' ) ) == '1') {
|
||||
$header[] = 'Supplier';
|
||||
}
|
||||
if (e(Input::get('location')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'location' ) ) == '1') {
|
||||
$header[] = 'Location';
|
||||
}
|
||||
if (e(Input::get('assigned_to')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'assigned_to' ) ) == '1') {
|
||||
$header[] = 'Assigned To';
|
||||
}
|
||||
if (e(Input::get('status')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'status' ) ) == '1') {
|
||||
$header[] = 'Status';
|
||||
}
|
||||
if (e(Input::get('warranty')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'warranty' ) ) == '1') {
|
||||
$header[] = 'Warranty';
|
||||
$header[] = 'Warranty Expires';
|
||||
}
|
||||
if (e(Input::get('depreciation')) == '1')
|
||||
{
|
||||
if (e( Input::get( 'depreciation' ) ) == '1') {
|
||||
$header[] = 'Purchase Cost';
|
||||
$header[] = 'Value';
|
||||
$header[] = 'Diff';
|
||||
}
|
||||
|
||||
$header = array_map('trim', $header);
|
||||
$rows[] = implode($header, ',');
|
||||
$header = array_map( 'trim', $header );
|
||||
$rows[] = implode( $header, ',' );
|
||||
|
||||
foreach($assets as $asset) {
|
||||
$row = array();
|
||||
if (e(Input::get('asset_name')) == '1') {
|
||||
foreach ($assets as $asset) {
|
||||
$row = [ ];
|
||||
if (e( Input::get( 'asset_name' ) ) == '1') {
|
||||
$row[] = $asset->name;
|
||||
}
|
||||
if (e(Input::get('asset_tag')) == '1') {
|
||||
if (e( Input::get( 'asset_tag' ) ) == '1') {
|
||||
$row[] = $asset->asset_tag;
|
||||
}
|
||||
if (e(Input::get('manufacturer')) == '1') {
|
||||
if (e( Input::get( 'manufacturer' ) ) == '1') {
|
||||
if ($asset->model->manufacturer) {
|
||||
$row[] = $asset->model->manufacturer->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
if (e(Input::get('model')) == '1') {
|
||||
$row[] = '"'.$asset->model->name.'"';
|
||||
$row[] = '"'.$asset->model->modelno.'"';
|
||||
if (e( Input::get( 'model' ) ) == '1') {
|
||||
$row[] = '"' . $asset->model->name . '"';
|
||||
$row[] = '"' . $asset->model->modelno . '"';
|
||||
}
|
||||
if (e(Input::get('serial')) == '1') {
|
||||
if (e( Input::get( 'serial' ) ) == '1') {
|
||||
$row[] = $asset->serial;
|
||||
}
|
||||
if (e(Input::get('purchase_date')) == '1') {
|
||||
if (e( Input::get( 'purchase_date' ) ) == '1') {
|
||||
$row[] = $asset->purchase_date;
|
||||
}
|
||||
if (e(Input::get('purchase_cost')) == '1') {
|
||||
$row[] = '"'.number_format($asset->purchase_cost).'"';
|
||||
if (e( Input::get( 'purchase_cost' ) ) == '1') {
|
||||
$row[] = '"' . number_format( $asset->purchase_cost ) . '"';
|
||||
}
|
||||
if (e(Input::get('order')) == '1') {
|
||||
if (e( Input::get( 'order' ) ) == '1') {
|
||||
if ($asset->order_number) {
|
||||
$row[] = $asset->order_number;
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
if (e(Input::get('supplier')) == '1') {
|
||||
if (e( Input::get( 'supplier' ) ) == '1') {
|
||||
if ($asset->supplier_id) {
|
||||
$row[] = $asset->supplier->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
if (e(Input::get('location')) == '1') {
|
||||
if (($asset->assigned_to > 0) && ($asset->assigneduser->location_id > 0)) {
|
||||
$location = Location::find($asset->assigneduser->location_id);
|
||||
if (e( Input::get( 'location' ) ) == '1') {
|
||||
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
|
||||
$location = Location::find( $asset->assigneduser->location_id );
|
||||
if ($location->name) {
|
||||
$row[] = $location->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
} elseif ($asset->rtd_location_id) {
|
||||
$location = Location::find($asset->rtd_location_id);
|
||||
$location = Location::find( $asset->rtd_location_id );
|
||||
if ($location->name) {
|
||||
$row[] = $location->name;
|
||||
} else {
|
||||
@@ -430,26 +496,26 @@ class ReportsController extends AdminController
|
||||
$row[] = ''; // Empty string if location is not set
|
||||
}
|
||||
}
|
||||
if (e(Input::get('assigned_to')) == '1') {
|
||||
if (e( Input::get( 'assigned_to' ) ) == '1') {
|
||||
if ($asset->assigned_to > 0) {
|
||||
$user = User::find($asset->assigned_to);
|
||||
$user = User::find( $asset->assigned_to );
|
||||
$row[] = $user->fullName();
|
||||
} else {
|
||||
$row[] = ''; // Empty string if unassigned
|
||||
}
|
||||
}
|
||||
if (e(Input::get('status')) == '1') {
|
||||
if (($asset->status_id == '0') && ($asset->assigned_to == '0')) {
|
||||
$row[] = Lang::get('general.ready_to_deploy');
|
||||
} elseif (($asset->status_id == '') && ($asset->assigned_to == '0')) {
|
||||
$row[] = Lang::get('general.pending');
|
||||
if (e( Input::get( 'status' ) ) == '1') {
|
||||
if (( $asset->status_id == '0' ) && ( $asset->assigned_to == '0' )) {
|
||||
$row[] = Lang::get( 'general.ready_to_deploy' );
|
||||
} elseif (( $asset->status_id == '' ) && ( $asset->assigned_to == '0' )) {
|
||||
$row[] = Lang::get( 'general.pending' );
|
||||
} elseif ($asset->assetstatus) {
|
||||
$row[] = $asset->assetstatus->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
if (e(Input::get('warranty')) == '1') {
|
||||
if (e( Input::get( 'warranty' ) ) == '1') {
|
||||
if ($asset->warranty_months) {
|
||||
$row[] = $asset->warranty_months;
|
||||
$row[] = $asset->warrantee_expires();
|
||||
@@ -458,24 +524,249 @@ class ReportsController extends AdminController
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
if (e(Input::get('depreciation')) == '1') {
|
||||
if (e( Input::get( 'depreciation' ) ) == '1') {
|
||||
$depreciation = $asset->getDepreciatedValue();
|
||||
$row[] = '"'.number_format($asset->purchase_cost).'"';
|
||||
$row[] = '"'.number_format($depreciation).'"';
|
||||
$row[] = '"'.number_format($asset->purchase_cost - $depreciation).'"';
|
||||
$row[] = '"' . number_format( $asset->purchase_cost ) . '"';
|
||||
$row[] = '"' . number_format( $depreciation ) . '"';
|
||||
$row[] = '"' . number_format( $asset->purchase_cost - $depreciation ) . '"';
|
||||
}
|
||||
$rows[] = implode($row, ',');
|
||||
$rows[] = implode( $row, ',' );
|
||||
}
|
||||
|
||||
// spit out a csv
|
||||
if (array_filter($rows)) {
|
||||
$csv = implode($rows, "\n");
|
||||
$response = Response::make($csv, 200);
|
||||
$response->header('Content-Type', 'text/csv');
|
||||
$response->header('Content-disposition', 'attachment;filename=report.csv');
|
||||
if (array_filter( $rows )) {
|
||||
$csv = implode( $rows, "\n" );
|
||||
$response = Response::make( $csv, 200 );
|
||||
$response->header( 'Content-Type', 'text/csv' );
|
||||
$response->header( 'Content-disposition', 'attachment;filename=report.csv' );
|
||||
|
||||
return $response;
|
||||
} else {
|
||||
return Redirect::to("reports/custom")->with('error', Lang::get('admin/reports/message.error'));
|
||||
return Redirect::to( "reports/custom" )
|
||||
->with( 'error', Lang::get( 'admin/reports/message.error' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getImprovementsReport
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getAssetMaintenancesReport()
|
||||
{
|
||||
|
||||
// Grab all the improvements
|
||||
$assetMaintenances = \AssetMaintenance::with( 'asset', 'supplier' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
return View::make( 'backend/reports/asset_maintenances', compact( 'assetMaintenances' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* exportImprovementsReport
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function exportAssetMaintenancesReport()
|
||||
{
|
||||
|
||||
// Grab all the improvements
|
||||
$assetMaintenances = AssetMaintenance::with( 'asset', 'supplier' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
$rows = [ ];
|
||||
|
||||
$header = [
|
||||
Lang::get( 'admin/asset_maintenances/table.asset_name' ),
|
||||
Lang::get( 'admin/asset_maintenances/table.supplier_name' ),
|
||||
Lang::get( 'admin/asset_maintenances/form.asset_maintenance_type' ),
|
||||
Lang::get( 'admin/asset_maintenances/form.title' ),
|
||||
Lang::get( 'admin/asset_maintenances/form.start_date' ),
|
||||
Lang::get( 'admin/asset_maintenances/form.completion_date' ),
|
||||
Lang::get( 'admin/asset_maintenances/form.asset_maintenance_time' ),
|
||||
Lang::get( 'admin/asset_maintenances/form.cost' )
|
||||
];
|
||||
|
||||
$header = array_map( 'trim', $header );
|
||||
$rows[] = implode( $header, ',' );
|
||||
|
||||
foreach ($assetMaintenances as $assetMaintenance) {
|
||||
$row = [ ];
|
||||
$row[] = str_replace( ',', '', $assetMaintenance->asset->name );
|
||||
$row[] = str_replace( ',', '', $assetMaintenance->supplier->name );
|
||||
$row[] = $assetMaintenance->improvement_type;
|
||||
$row[] = $assetMaintenance->title;
|
||||
$row[] = $assetMaintenance->start_date;
|
||||
$row[] = $assetMaintenance->completion_date;
|
||||
if (is_null( $assetMaintenance->asset_maintenance_time )) {
|
||||
$improvementTime = intval( Carbon::now()
|
||||
->diffInDays( Carbon::parse( $assetMaintenance->start_date ) ) );
|
||||
} else {
|
||||
$improvementTime = intval( $assetMaintenance->asset_maintenance_time );
|
||||
}
|
||||
$row[] = $improvementTime;
|
||||
$row[] = Lang::get( 'general.currency' ) . number_format( $assetMaintenance->cost, 2 );
|
||||
$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' );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* getAssetAcceptanceReport
|
||||
*
|
||||
* @return mixed
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getAssetAcceptanceReport()
|
||||
{
|
||||
|
||||
$assetsForReport = Asset::notYetAccepted()
|
||||
->get();
|
||||
|
||||
return View::make( 'backend/reports/unaccepted_assets', compact( 'assetsForReport' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* exportAssetAcceptanceReport
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function exportAssetAcceptanceReport()
|
||||
{
|
||||
|
||||
// Grab all the improvements
|
||||
$assetsForReport = Actionlog::whereIn( 'id', $this->getAssetsNotAcceptedYet() )
|
||||
->get();
|
||||
|
||||
$rows = [ ];
|
||||
|
||||
$header = [
|
||||
Lang::get( 'general.category' ),
|
||||
Lang::get( 'admin/hardware/form.model' ),
|
||||
Lang::get( 'admin/hardware/form.name' ),
|
||||
Lang::get( 'admin/hardware/table.asset_tag' ),
|
||||
Lang::get( 'admin/hardware/table.checkoutto' ),
|
||||
];
|
||||
|
||||
$header = array_map( 'trim', $header );
|
||||
$rows[] = implode( $header, ',' );
|
||||
|
||||
foreach ($assetsForReport as $assetItem) {
|
||||
$row = [ ];
|
||||
$row[] = str_replace( ',', '', $assetItem->assetlog->model->category->name );
|
||||
$row[] = str_replace( ',', '', $assetItem->assetlog->model->name );
|
||||
$row[] = str_replace( ',', '', $assetItem->assetlog->showAssetName() );
|
||||
$row[] = str_replace( ',', '', $assetItem->assetlog->asset_tag );
|
||||
$row[] = str_replace( ',', '', $assetItem->assetlog->assigneduser->fullName() );
|
||||
$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' );
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getCheckedOutAssetsRequiringAcceptance
|
||||
*
|
||||
* @param $modelsInCategoriesThatRequireAcceptance
|
||||
*
|
||||
* @return array
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getCheckedOutAssetsRequiringAcceptance( $modelsInCategoriesThatRequireAcceptance )
|
||||
{
|
||||
|
||||
return array_pluck( Asset::deployed()
|
||||
->inModelList( $modelsInCategoriesThatRequireAcceptance )
|
||||
->select( 'id' )
|
||||
->get()
|
||||
->toArray(), 'id' );
|
||||
}
|
||||
|
||||
/**
|
||||
* getModelsInCategoriesThatRequireAcceptance
|
||||
*
|
||||
* @param $assetCategoriesRequiringAcceptance
|
||||
*
|
||||
* @return array
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getModelsInCategoriesThatRequireAcceptance( $assetCategoriesRequiringAcceptance )
|
||||
{
|
||||
|
||||
return array_pluck( Model::inCategory( $assetCategoriesRequiringAcceptance )
|
||||
->select( 'id' )
|
||||
->get()
|
||||
->toArray(), 'id' );
|
||||
}
|
||||
|
||||
/**
|
||||
* getCategoriesThatRequireAcceptance
|
||||
*
|
||||
* @return array
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getCategoriesThatRequireAcceptance()
|
||||
{
|
||||
|
||||
return array_pluck( Category::requiresAcceptance()
|
||||
->select( 'id' )
|
||||
->get()
|
||||
->toArray(), 'id' );
|
||||
}
|
||||
|
||||
/**
|
||||
* getAssetsCheckedOutRequiringAcceptance
|
||||
*
|
||||
* @return array
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getAssetsCheckedOutRequiringAcceptance()
|
||||
{
|
||||
|
||||
return $this->getCheckedOutAssetsRequiringAcceptance(
|
||||
$this->getModelsInCategoriesThatRequireAcceptance( $this->getCategoriesThatRequireAcceptance() )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* getAssetsNotAcceptedYet
|
||||
*
|
||||
* @return array
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getAssetsNotAcceptedYet()
|
||||
{
|
||||
|
||||
return Asset::unaccepted();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ use Str;
|
||||
use Validator;
|
||||
use View;
|
||||
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class StatuslabelsController extends AdminController
|
||||
{
|
||||
/**
|
||||
@@ -40,8 +42,7 @@ class StatuslabelsController extends AdminController
|
||||
// Show the page
|
||||
$statuslabel = new Statuslabel;
|
||||
$use_statuslabel_type = $statuslabel->getStatuslabelType();
|
||||
|
||||
$statuslabel_types = array('' => Lang::get('admin/hardware/form.select_statustype')) + array('undeployable' => Lang::get('admin/hardware/general.undeployable')) + array('pending' => Lang::get('admin/hardware/general.pending')) + array('archived' => Lang::get('admin/hardware/general.archived')) + array('deployable' => Lang::get('admin/hardware/general.deployable'));
|
||||
$statuslabel_types = statusTypeList();
|
||||
|
||||
return View::make('backend/statuslabels/edit', compact('statuslabel_types','statuslabel'))->with('use_statuslabel_type',$use_statuslabel_type);
|
||||
}
|
||||
@@ -90,6 +91,44 @@ class StatuslabelsController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
// get the POST data
|
||||
$new = Input::all();
|
||||
|
||||
$new['statuslabel_types']="deployable";
|
||||
|
||||
// create a new model instance
|
||||
$statuslabel = new Statuslabel();
|
||||
$statustype = Statuslabel::getStatuslabelTypesForDB(Input::get('statuslabel_types'));
|
||||
|
||||
// attempt validation
|
||||
if ($statuslabel->validate($new)) {
|
||||
|
||||
//$statustype = Statuslabel::getStatuslabelTypesForDB(Input::get('statuslabel_types'));
|
||||
|
||||
// Save the Statuslabel data
|
||||
$statuslabel->name = e(Input::get('name'));
|
||||
$statuslabel->user_id = Sentry::getId();
|
||||
$statuslabel->notes = '';
|
||||
$statuslabel->deployable = $statustype['deployable'];
|
||||
$statuslabel->pending = $statustype['pending'];
|
||||
$statuslabel->archived = $statustype['archived'];
|
||||
|
||||
// Was the asset created?
|
||||
if($statuslabel->save()) {
|
||||
// Redirect to the new Statuslabel page
|
||||
return JsonResponse::create($statuslabel);
|
||||
} else {
|
||||
return JsonResponse::create(["error" => "Couldn't save Statuslabel"],500);
|
||||
}
|
||||
} else {
|
||||
// failure
|
||||
$errors = $statuslabel->errors();
|
||||
return JsonResponse::create(["error" => "Failed validation: ".print_r($errors->all('<li>:message</li>'),true)],500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Statuslabel update.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use AdminController;
|
||||
use Image;
|
||||
use AssetMaintenance;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Supplier;
|
||||
@@ -12,6 +13,9 @@ use Str;
|
||||
use Validator;
|
||||
use View;
|
||||
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
|
||||
class SuppliersController extends AdminController
|
||||
{
|
||||
/**
|
||||
@@ -99,6 +103,26 @@ class SuppliersController extends AdminController
|
||||
return Redirect::to('admin/settings/suppliers/create')->with('error', Lang::get('admin/suppliers/message.create.error'));
|
||||
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$supplier=new Supplier;
|
||||
$new=Input::all();
|
||||
$validator = Validator::make($new, $supplier->validationRules());
|
||||
if($validator->fails()) {
|
||||
return JsonResponse::create(["error" => "Failed validation: ".print_r($validator->messages()->all('<li>:message</li>'),true)],500);
|
||||
} else {
|
||||
//$supplier->fill($new);
|
||||
$supplier->name=$new['name'];
|
||||
$supplier->user_id = Sentry::getId();
|
||||
|
||||
if($supplier->save()) {
|
||||
return JsonResponse::create($supplier);
|
||||
} else {
|
||||
return JsonResponse::create(["error" => "Couldn't save Supplier"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplier update.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
|
||||
class CreateAssetMaintenancesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::create( 'asset_maintenances', function ( Blueprint $table ) {
|
||||
|
||||
$table->increments( 'id' );
|
||||
$table->integer( 'asset_id' )
|
||||
->unsigned();
|
||||
$table->integer( 'supplier_id' )
|
||||
->unsigned();
|
||||
$table->enum( 'asset_maintenance_type', $this->getEnumFields() );
|
||||
$table->string( 'title', 100 );
|
||||
$table->boolean( 'is_warranty' );
|
||||
$table->date( 'start_date' );
|
||||
$table->date( 'completion_date' )
|
||||
->nullable();
|
||||
$table->integer( 'asset_maintenance_time' )
|
||||
->nullable();
|
||||
$table->longText( 'notes' )
|
||||
->nullable();
|
||||
$table->decimal( 'cost', 10, 2 )
|
||||
->nullable();
|
||||
$table->dateTime( 'deleted_at' )
|
||||
->nullable();
|
||||
$table->timestamps();
|
||||
} );
|
||||
}
|
||||
|
||||
protected function getEnumFields()
|
||||
{
|
||||
|
||||
return [
|
||||
Lang::get( 'admin/asset_maintenances/general.maintenance' ),
|
||||
Lang::get( 'admin/asset_maintenances/general.repair' ),
|
||||
Lang::get( 'admin/asset_maintenances/general.upgrade' )
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::dropIfExists( 'asset_maintenances' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddExpectedCheckinDateToAssetLogs extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table('asset_logs', function ($table) {
|
||||
$table->date('expected_checkin')->nullable()->default(NULL);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::table('asset_logs', function(Blueprint $table)
|
||||
{
|
||||
$table->dropColumn('expected_checkin');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCheckinEmailToCategoryTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('categories', function ($table) {
|
||||
$table->boolean('checkin_email')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('categories', function ($table) {
|
||||
$table->dropColumn('checkin_email');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveEmailUniqueConstraint extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table)
|
||||
{
|
||||
$table->dropUnique('users_email_unique');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddThreadIdToAssetLogsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* currentAssetId
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $currentAssetId = null;
|
||||
|
||||
/**
|
||||
* currentAssetLogId
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $currentAssetLogId = null;
|
||||
|
||||
/**
|
||||
* assetLogs
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $assetLogs = null;
|
||||
|
||||
/**
|
||||
* startOfCurrentThread
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $startOfCurrentThread = true;
|
||||
|
||||
/**
|
||||
* threadStartingActionTypes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $threadStartingActionTypes = [ 'checkout', 'requested' ];
|
||||
|
||||
/**
|
||||
* threadFinalActionTypes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $threadFinalActionTypes = [ 'checkin from' ];
|
||||
|
||||
/**
|
||||
* actionlog
|
||||
*
|
||||
* @var \Actionlog
|
||||
*/
|
||||
private $actionlog;
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table( 'asset_logs', function ( Blueprint $table ) {
|
||||
|
||||
$table->integer( 'thread_id' )
|
||||
->nullable()
|
||||
->default( null );
|
||||
$table->index( 'thread_id' );
|
||||
} );
|
||||
|
||||
$this->actionlog = new Actionlog();
|
||||
$this->assetLogs = $this->actionlog->getListingOfActionLogsChronologicalOrder();
|
||||
|
||||
foreach ($this->assetLogs as $assetLog) {
|
||||
|
||||
if ($this->hasAssetChanged( $assetLog )) {
|
||||
$this->resetCurrentAssetInformation( $assetLog );
|
||||
}
|
||||
|
||||
if ($this->hasBegunNewChain( $assetLog )) {
|
||||
$this->startOfCurrentThread = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->updateAssetLogWithThreadInformation( $assetLog );
|
||||
|
||||
if ($this->hasReachedEndOfChain( $assetLog )
|
||||
) {
|
||||
$this->clearCurrentAssetInformation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::table( 'asset_logs', function ( Blueprint $table ) {
|
||||
|
||||
$table->dropIndex( 'thread_id' );
|
||||
$table->dropColumn( 'thread_id' );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* hasAssetChanged
|
||||
*
|
||||
* @param $assetLog
|
||||
*
|
||||
* @return bool
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function hasAssetChanged( $assetLog )
|
||||
{
|
||||
|
||||
return $assetLog->asset_id !== $this->currentAssetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* resetCurrentAssetInformation
|
||||
*
|
||||
* @param $assetLog
|
||||
*
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function resetCurrentAssetInformation( $assetLog )
|
||||
{
|
||||
|
||||
$this->currentAssetId = $assetLog->asset_id;
|
||||
$this->currentAssetLogId = $assetLog->id;
|
||||
$this->startOfCurrentThread = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* hasReachedEndOfChain
|
||||
*
|
||||
* @param $assetLog
|
||||
*
|
||||
* @return bool
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function hasReachedEndOfChain( $assetLog )
|
||||
{
|
||||
|
||||
return in_array( $assetLog->action_type, $this->threadFinalActionTypes )
|
||||
&& $this->startOfCurrentThread == false;
|
||||
}
|
||||
|
||||
/**
|
||||
* clearCurrentAssetInformation
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function clearCurrentAssetInformation()
|
||||
{
|
||||
|
||||
$this->startOfCurrentThread = true;
|
||||
$this->currentAssetLogId = null;
|
||||
$this->currentAssetId = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateAssetLogWithThreadInformation
|
||||
*
|
||||
* @param $assetLog
|
||||
*
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function updateAssetLogWithThreadInformation( $assetLog )
|
||||
{
|
||||
|
||||
$loadedAssetLog = Actionlog::find( $assetLog->id );
|
||||
|
||||
$loadedAssetLog->thread_id = $this->currentAssetLogId;
|
||||
|
||||
$loadedAssetLog->update();
|
||||
|
||||
unset( $loadedAssetLog );
|
||||
}
|
||||
|
||||
/**
|
||||
* hasBegunNewChain
|
||||
*
|
||||
* @param $assetLog
|
||||
*
|
||||
* @return bool
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function hasBegunNewChain( $assetLog )
|
||||
{
|
||||
|
||||
return in_array( $assetLog->action_type, $this->threadStartingActionTypes )
|
||||
&& $this->startOfCurrentThread == true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAcceptedToAssets extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('assets', function(Blueprint $table)
|
||||
{
|
||||
$table->enum('accepted',["pending","accepted","rejected"])->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('assets', function(Blueprint $table)
|
||||
{
|
||||
$table->dropColumn('accepted');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
function ParseFloat($floatString){
|
||||
|
||||
function ParseFloat($floatString){
|
||||
|
||||
// use comma for thousands until local info is property used
|
||||
$LocaleInfo = localeconv();
|
||||
//$thousands = isset($LocaleInfo["mon_thousands_sep"]) ? $LocaleInfo["mon_thousands_sep"] : ",";
|
||||
//$floatString = str_replace($LocaleInfo["mon_thousands_sep"] , "", $floatString);
|
||||
//$floatString = str_replace($LocaleInfo["decimal_point"] , ".", $floatString);
|
||||
$floatString = str_replace("," , "", $floatString);
|
||||
$floatString = str_replace($LocaleInfo["decimal_point"] , ".", $floatString);
|
||||
return floatval($floatString);
|
||||
}
|
||||
$floatString = str_replace("," , "", $floatString);
|
||||
$floatString = str_replace($LocaleInfo["decimal_point"] , ".", $floatString);
|
||||
return floatval($floatString);
|
||||
}
|
||||
|
||||
function modelList() {
|
||||
$model_list = array('' => Lang::get('general.select_model')) + DB::table('models')
|
||||
->select(DB::raw('IF (modelno="" OR modelno IS NULL,name,concat(name, " / ",modelno)) as name, id'))->orderBy('name', 'asc')
|
||||
->orderBy('modelno', 'asc')
|
||||
->whereNull('deleted_at')
|
||||
->lists('name', 'id');
|
||||
return $model_list;
|
||||
}
|
||||
|
||||
function categoryList() {
|
||||
$category_list = array('' => '') + DB::table('categories')->whereNull('deleted_at')->lists('name', 'id');
|
||||
return $category_list;
|
||||
}
|
||||
|
||||
function suppliersList() {
|
||||
$supplier_list = array('' => Lang::get('general.select_supplier')) + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
return $supplier_list;
|
||||
}
|
||||
|
||||
function assignedToList() {
|
||||
$assigned_to = array('' => Lang::get('general.select_user')) + DB::table('users')->select(DB::raw('concat(first_name," ",last_name) as full_name, id'))->whereNull('deleted_at')->lists('full_name', 'id');
|
||||
return $assigned_to;
|
||||
}
|
||||
|
||||
function statusLabelList() {
|
||||
$statuslabel_list = Statuslabel::lists('name', 'id');
|
||||
return $statuslabel_list;
|
||||
}
|
||||
|
||||
function locationsList() {
|
||||
$location_list = array('' => Lang::get('general.select_location')) + Location::lists('name', 'id');
|
||||
return $location_list;
|
||||
}
|
||||
|
||||
function manufacturerList() {
|
||||
$manufacturer_list = array('' => 'Select One') + Manufacturer::lists('name', 'id');
|
||||
return $manufacturer_list;
|
||||
}
|
||||
|
||||
function statusTypeList() {
|
||||
$statuslabel_types = array('' => Lang::get('admin/hardware/form.select_statustype')) + array('undeployable' => Lang::get('admin/hardware/general.undeployable')) + array('pending' => Lang::get('admin/hardware/general.pending')) + array('archived' => Lang::get('admin/hardware/general.archived')) + array('deployable' => Lang::get('admin/hardware/general.deployable'));
|
||||
return $statuslabel_types;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ return array(
|
||||
'about_accessories_text' => 'الملحقات هي أي شيء تقوم بتسليمه للمستخدمين لكنه لا يحتوي على رقم تسلسلي (أو أنك لست بحاجة إلى تتبعه بشكل خاص). مثال: فأرة الحاسوب أو لوحة المفاتيح.',
|
||||
'accessory_category' => 'فئة الملحق',
|
||||
'accessory_name' => 'اسم الملحق',
|
||||
'create' => 'إنشاء فئة جديدة',
|
||||
'create' => 'Create Accessory',
|
||||
'eula_text' => 'إنشاء اتفاقية جديدة',
|
||||
'eula_text_help' => 'يسمح لك هذا الحقل بتخصيص الاتفاقيات لأنواع معينة من الأصول. اذا كنت تمتلك اتفاقية واحدة لجميع أصولك يمكنك أن تقوم بتأشير المربع في الأسفل لاستخدام الاتفاقية الافتراضية.',
|
||||
'require_acceptance' => 'مطالبة المستخدمين بتأكيد قبولهم الأصول في هذه الفئة.',
|
||||
@@ -13,7 +13,7 @@ return array(
|
||||
'qty' => 'الكمية',
|
||||
'total' => 'المجموع',
|
||||
'remaining' => 'المتاح',
|
||||
'update' => 'تحديث الفئة',
|
||||
'update' => 'Update Accessory',
|
||||
'use_default_eula' => 'قم باستعمال <a href="#" data-toggle="modal" data-target="#eulaModal">primary default EULA</a>.',
|
||||
'use_default_eula_disabled' => '<del>Use the primary default EULA instead.</del> No primary default EULA is set. Please add one in Settings.',
|
||||
|
||||
|
||||
14
app/lang/ar/admin/asset_maintenances/form.php
Executable file
14
app/lang/ar/admin/asset_maintenances/form.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'asset_maintenance_type' => 'Asset Maintenance Type',
|
||||
'title' => 'Title',
|
||||
'start_date' => 'Start Date',
|
||||
'completion_date' => 'Completion Date',
|
||||
'cost' => 'Cost',
|
||||
'is_warranty' => 'Warranty Improvement',
|
||||
'asset_maintenance_time' => 'Asset Maintenance Time (in days)',
|
||||
'notes' => 'Notes',
|
||||
'update' => 'Update Asset Maintenance',
|
||||
'create' => 'Create Asset Maintenance'
|
||||
];
|
||||
11
app/lang/ar/admin/asset_maintenances/general.php
Executable file
11
app/lang/ar/admin/asset_maintenances/general.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'asset_maintenances' => 'Asset Maintenances',
|
||||
'edit' => 'Edit Asset Maintenance',
|
||||
'delete' => 'Delete Asset Maintenance',
|
||||
'view' => 'View Asset Maintenance Details',
|
||||
'repair' => 'Repair',
|
||||
'maintenance' => 'Maintenance',
|
||||
'upgrade' => 'Upgrade'
|
||||
];
|
||||
17
app/lang/ar/admin/asset_maintenances/message.php
Executable file
17
app/lang/ar/admin/asset_maintenances/message.php
Executable file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'not_found' => 'Asset Maintenance you were looking for was not found!',
|
||||
'delete' => [
|
||||
'confirm' => 'Are you sure you wish to delete this asset maintenance?',
|
||||
'error' => 'There was an issue deleting the asset maintenance. Please try again.',
|
||||
'success' => 'The asset maintenance was deleted successfully.'
|
||||
],
|
||||
'create' => [
|
||||
'error' => 'Asset Maintenance was not created, please try again.',
|
||||
'success' => 'Asset Maintenance created successfully.'
|
||||
],
|
||||
'asset_maintenance_incomplete' => 'Not Completed Yet',
|
||||
'warranty' => 'Warranty',
|
||||
'not_warranty' => 'Not Warranty',
|
||||
];
|
||||
9
app/lang/ar/admin/asset_maintenances/table.php
Executable file
9
app/lang/ar/admin/asset_maintenances/table.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'title' => 'Asset Maintenance',
|
||||
'asset_name' => 'Asset Name',
|
||||
'supplier_name' => 'Supplier Name',
|
||||
'is_warranty' => 'Warranty',
|
||||
'dl_csv' => 'Download CSV'
|
||||
];
|
||||
@@ -5,6 +5,7 @@ return array(
|
||||
'about_categories' => 'تصنيفات الأصول تساعدك على ترتيب الأصول. من الأمثلة على التصنيفات " مكاتب "، "أجهزة الكمبيوتر المحمولة "، "الهواتف النقالة "، "أجهزة لوحية " وهكذا، كما يمكنك استخدام التصنيفات بأي طريقة تناسبك. ',
|
||||
'asset_categories' => 'التصنيفات',
|
||||
'category_name' => 'اسم التصنيف',
|
||||
'checkin_email' => 'Send email to user on checkin.',
|
||||
'clone' => 'Clone Category',
|
||||
'create' => 'إنشاء تصنيف',
|
||||
'edit' => 'Edit Category',
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
return array(
|
||||
'about_consumables_title' => 'About Consumables',
|
||||
'about_consumables_text' => 'Consumables are anything purchased that will be used up over time. For example, printer ink or copier paper.',
|
||||
'consumable_name' => 'Consumable Name',
|
||||
'create' => 'Create Consumable',
|
||||
'remaining' => 'Remaining',
|
||||
'total' => 'Total',
|
||||
'update' => 'Update Consumable',
|
||||
);
|
||||
|
||||
@@ -17,9 +17,10 @@ return array(
|
||||
'default_location' => 'Default Location',
|
||||
'eol_date' => 'EOL Date',
|
||||
'eol_rate' => 'EOL Rate',
|
||||
'expected_checkin' => 'Expected Checkin Date',
|
||||
'expires' => 'Expires',
|
||||
'fully_depreciated' => 'Fully Depreciated',
|
||||
'help_checkout' => 'If you wish to assign this asset immediately, you should select "Ready to Deploy" from the status list above, or unexpected things may happen. ',
|
||||
'help_checkout' => 'If you wish to assign this asset immediately, select "Ready to Deploy" from the status list above. ',
|
||||
'mac_address' => 'MAC Address',
|
||||
'manufacturer' => 'Manufacturer',
|
||||
'model' => 'Model',
|
||||
|
||||
@@ -5,6 +5,7 @@ return array(
|
||||
'undeployable' => '<strong>Warning: </strong> This asset has been marked as currently undeployable.
|
||||
If this status has changed, please update the asset status.',
|
||||
'does_not_exist' => 'Asset does not exist.',
|
||||
'does_not_exist_or_not_requestable' => 'Nice try. That asset does not exist or is not requestable.',
|
||||
'assoc_users' => 'This asset is currently checked out to a user and cannot be deleted. Please check the asset in first, and then try deleting again. ',
|
||||
|
||||
'create' => array(
|
||||
@@ -22,7 +23,7 @@ return array(
|
||||
'error' => 'Asset was not restored, please try again',
|
||||
'success' => 'Asset restored successfully.'
|
||||
),
|
||||
|
||||
|
||||
'deletefile' => array(
|
||||
'error' => 'File not deleted. Please try again.',
|
||||
'success' => 'File successfully deleted.',
|
||||
@@ -31,7 +32,7 @@ return array(
|
||||
'upload' => array(
|
||||
'error' => 'File(s) not uploaded. Please try again.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'nofiles' => 'You did not select any files for upload, or the file you are trying to upload is too large',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
|
||||
@@ -18,5 +18,6 @@ return array(
|
||||
'serial' => 'Serial',
|
||||
'status' => 'Status',
|
||||
'title' => 'Asset ',
|
||||
'days_without_acceptance' => 'Days Without Acceptance'
|
||||
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@ return array(
|
||||
'upload' => array(
|
||||
'error' => 'File(s) not uploaded. Please try again.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'nofiles' => 'You did not select any files for upload, or the file you are trying to upload is too large',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ return array(
|
||||
|
||||
'does_not_exist' => 'Location does not exist.',
|
||||
'assoc_users' => 'This location is currently associated with at least one user and cannot be deleted. Please update your users to no longer reference this location and try again. ',
|
||||
'assoc_assets' => 'This location is currently associated with at least one asset and cannot be deleted. Please update your assets to no longer reference this location and try again. ',
|
||||
'assoc_child_loc' => 'This location is currently the parent of at least one child location and cannot be deleted. Please update your locations to no longer reference this location and try again. ',
|
||||
|
||||
|
||||
'create' => array(
|
||||
|
||||
@@ -12,4 +12,6 @@ return array(
|
||||
'address' => 'Address',
|
||||
'zip' => 'Postal Code',
|
||||
'locations' => 'Locations',
|
||||
'parent' => 'Parent',
|
||||
'currency' => 'Location Currency', // this is deprecated
|
||||
);
|
||||
|
||||
@@ -8,7 +8,8 @@ return array(
|
||||
|
||||
'create' => array(
|
||||
'error' => 'Model was not created, please try again.',
|
||||
'success' => 'Model created successfully.'
|
||||
'success' => 'Model created successfully.',
|
||||
'duplicate_set' => 'An asset model with that name, manufacturer and model number already exists.',
|
||||
),
|
||||
|
||||
'update' => array(
|
||||
@@ -21,7 +22,7 @@ return array(
|
||||
'error' => 'There was an issue deleting the model. Please try again.',
|
||||
'success' => 'The model was deleted successfully.'
|
||||
),
|
||||
|
||||
|
||||
'restore' => array(
|
||||
'error' => 'Model was not restored, please try again',
|
||||
'success' => 'Model restored successfully.'
|
||||
|
||||
@@ -10,6 +10,7 @@ return array(
|
||||
'backups' => 'Backups',
|
||||
'barcode_type' => 'Barcode Type',
|
||||
'barcode_settings' => 'Barcode Settings',
|
||||
'default_currency' => 'Default Currency',
|
||||
'default_eula_text' => 'Default EULA',
|
||||
'default_eula_help_text' => 'You can also associate custom EULAs to specific asset categories.',
|
||||
'display_asset_name' => 'Display Asset Name',
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
|
||||
return array(
|
||||
|
||||
'assets_user' => 'الجهاز مسجل بعهدة :name',
|
||||
'clone' => 'نسخ المستخدم',
|
||||
'contact_user' => 'اتصل بـ :name',
|
||||
'edit' => 'تعديل المستخدم',
|
||||
'history_user' => 'الأرشيف الخاص بـ :name',
|
||||
'last_login' => 'آخر دخول للمستخدم',
|
||||
'software_user' => 'البرامج المسجلة لـ :name',
|
||||
'view_user' => 'عرض المستخدم :name',
|
||||
'usercsv' => 'ملف CSV',
|
||||
'assets_user' => 'الجهاز مسجل بعهدة :name',
|
||||
'clone' => 'نسخ المستخدم',
|
||||
'contact_user' => 'اتصل بـ :name',
|
||||
'edit' => 'تعديل المستخدم',
|
||||
'filetype_info' => 'Allowed filetypes are png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, and rar.',
|
||||
'history_user' => 'الأرشيف الخاص بـ :name',
|
||||
'last_login' => 'آخر دخول للمستخدم',
|
||||
'software_user' => 'البرامج المسجلة لـ :name',
|
||||
'view_user' => 'عرض المستخدم :name',
|
||||
'usercsv' => 'ملف CSV',
|
||||
);
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
return array(
|
||||
|
||||
'user_exists' => 'المستخدم موجود مسبقاً!',
|
||||
'user_not_found' => 'المستخدم [id:] غير موجود.',
|
||||
'user_login_required' => 'حقل "الدخول" مطلوب',
|
||||
'user_password_required' => 'كلمة السر مطلوبة.',
|
||||
'insufficient_permissions' => 'صلاحيات غير كافية.',
|
||||
'user_deleted_warning' => 'تم حذف المستخدم. سيكون عليك استعادة هذا المستخدم للتعديل عليه او تسليمه اجهزة جديدة.',
|
||||
'accepted' => 'You have successfully accepted this asset.',
|
||||
'declined' => 'You have successfully declined this asset.',
|
||||
'user_exists' => 'المستخدم موجود مسبقاً!',
|
||||
'user_not_found' => 'المستخدم [id:] غير موجود.',
|
||||
'user_login_required' => 'حقل "الدخول" مطلوب',
|
||||
'user_password_required' => 'كلمة السر مطلوبة.',
|
||||
'insufficient_permissions' => 'صلاحيات غير كافية.',
|
||||
'user_deleted_warning' => 'تم حذف المستخدم. سيكون عليك استعادة هذا المستخدم للتعديل عليه او تسليمه اجهزة جديدة.',
|
||||
|
||||
|
||||
'success' => array(
|
||||
@@ -29,6 +31,19 @@ return array(
|
||||
'unsuspend' => 'حدث خطأ ما أثناء إلغاء التعليق عن المستخدم. حاول مرة أخرى.',
|
||||
'import' => 'حدث خطأ أثناء استيراد المستخدمين. حاول مرة أخرى.',
|
||||
'asset_already_accepted' => 'هذا الجهاز تم قبوله مسبقاً.',
|
||||
'accept_or_decline' => 'You must either accept or decline this asset.',
|
||||
),
|
||||
|
||||
'deletefile' => array(
|
||||
'error' => 'File not deleted. Please try again.',
|
||||
'success' => 'File successfully deleted.',
|
||||
),
|
||||
|
||||
'upload' => array(
|
||||
'error' => 'File(s) not uploaded. Please try again.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
return array(
|
||||
|
||||
'account_already_exists' => 'An account with the this email already exists.',
|
||||
'account_not_found' => 'The email account or password is incorrect.',
|
||||
'account_not_found' => 'The username or password is incorrect.',
|
||||
'account_not_activated' => 'This user account is not activated.',
|
||||
'account_suspended' => 'This user account is suspended.',
|
||||
'account_banned' => 'This user account is banned.',
|
||||
|
||||
@@ -8,6 +8,7 @@ return array(
|
||||
'delete' => 'حذف',
|
||||
'edit' => 'تعديل',
|
||||
'restore' => 'إستعادة',
|
||||
'request' => 'Request',
|
||||
'submit' => 'إرسال',
|
||||
'upload' => 'Upload',
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
|
||||
return [
|
||||
'accessories' => 'Accessories',
|
||||
'accessory' => 'Accessory',
|
||||
'action' => 'Action',
|
||||
@@ -21,6 +19,7 @@ return array(
|
||||
'avatar_delete' => 'حذف الصورة الرمزية',
|
||||
'avatar_upload' => 'رفع صورة رمزية',
|
||||
'back' => 'الرجوع للخلف',
|
||||
'bad_data' => 'Nothing found. Maybe bad data?',
|
||||
'cancel' => 'إلغاء',
|
||||
'categories' => 'Categories',
|
||||
'category' => 'Category',
|
||||
@@ -36,7 +35,7 @@ return array(
|
||||
'create' => 'إضافة',
|
||||
'created_asset' => 'الأصول المضافة',
|
||||
'created_at' => 'أنشئت في',
|
||||
'currency' => '$',
|
||||
'currency' => '$', // this is deprecated
|
||||
'current' => 'الحالي',
|
||||
'custom_report' => 'Custom Asset Report',
|
||||
'dashboard' => 'Dashboard',
|
||||
@@ -60,6 +59,9 @@ return array(
|
||||
'id' => 'الرقم',
|
||||
'image_delete' => 'حذف الصورة',
|
||||
'image_upload' => 'رفع صورة',
|
||||
'asset_maintenance' => 'Asset Maintenance',
|
||||
'asset_maintenance_report' => 'Asset Maintenance Report',
|
||||
'asset_maintenances' => 'Asset Maintenances',
|
||||
'item' => 'Item',
|
||||
'last' => 'Last',
|
||||
'last_name' => 'الإسم الأخير',
|
||||
@@ -69,6 +71,8 @@ return array(
|
||||
'licenses' => 'الرخص',
|
||||
'list_all' => 'عرض الكل',
|
||||
'loading' => 'Loading',
|
||||
'lock_passwords' => 'This field cannot be edited in this installation.',
|
||||
'feature_disabled' => 'This feature has been disabled for this installation.',
|
||||
'location' => 'الموقع',
|
||||
'locations' => 'المواقع',
|
||||
'logout' => 'تسجيل خروج',
|
||||
@@ -96,6 +100,7 @@ return array(
|
||||
'ready_to_deploy' => 'جاهزة للتوزيع',
|
||||
'recent_activity' => 'Recent Activity',
|
||||
'reports' => 'التقارير',
|
||||
'requested' => 'Requested',
|
||||
'save' => 'حفظ',
|
||||
'select' => 'Select',
|
||||
'search' => 'Search',
|
||||
@@ -106,6 +111,7 @@ return array(
|
||||
'select_supplier' => 'Select a Supplier',
|
||||
'select_user' => 'Select a User',
|
||||
'select_date' => 'Select Date',
|
||||
'select_statuslabel' => 'Select Status',
|
||||
'settings' => 'الإعدادات',
|
||||
'sign_in' => 'تسجيل الدخول',
|
||||
'site_name' => 'إسم الموقع',
|
||||
@@ -118,8 +124,12 @@ return array(
|
||||
'type' => 'Type',
|
||||
'undeployable' => 'غير قابلة للتوزيع',
|
||||
'unknown_admin' => 'إداري غير معروف',
|
||||
'update' => 'Update',
|
||||
'uploaded' => 'Uploaded',
|
||||
'user' => 'المستخدم',
|
||||
'accepted' => 'accepted',
|
||||
'declined' => 'declined',
|
||||
'unaccepted_asset_report' => 'Unaccepted Assets',
|
||||
'users' => 'Users',
|
||||
'viewassets' => 'عرض الأصول المسجلة',
|
||||
'website' => 'الموقع',
|
||||
@@ -127,5 +137,4 @@ return array(
|
||||
'years' => 'سنوات',
|
||||
'yes' => 'نعم',
|
||||
'zip' => 'الرمز البريدي',
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
@@ -77,7 +77,7 @@ return array(
|
||||
*/
|
||||
|
||||
'custom' => array(),
|
||||
'alpha_space' => "The :attribute field may only contain letters, commas, spaces and dashes.",
|
||||
'alpha_space' => "The :attribute field contains a character that is not allowed.",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -5,7 +5,7 @@ return array(
|
||||
'about_accessories_text' => 'Příslušenství je cokoliv, co předáte uživatelům, ale nemá to sérivoé číslo (nebo to neevidujete). Např. myš, klávesnice.',
|
||||
'accessory_category' => 'Kategorie příslušenství',
|
||||
'accessory_name' => 'Název příslušenství',
|
||||
'create' => 'Vytvořit kategorii',
|
||||
'create' => 'Vytvoř příslušenství',
|
||||
'eula_text' => 'Kategorie EULA',
|
||||
'eula_text_help' => 'Toto pole umožňuje upravit EULA pro různé druhy majetku. Pokud máte pouze jeden typ pro všechen majetek, můžete zaškrtnout položku níže pro použití jako výchozí.',
|
||||
'require_acceptance' => 'Požadovat potvrzení převzetí majetku v této kategorii.',
|
||||
@@ -13,7 +13,7 @@ return array(
|
||||
'qty' => 'Množství',
|
||||
'total' => 'CELKEM',
|
||||
'remaining' => 'Dostupný',
|
||||
'update' => 'Upravit kategorii',
|
||||
'update' => 'Aktualizace příslušenství',
|
||||
'use_default_eula' => 'Použít <a href="#" data-toggle="modal" data-target="#eulaModal">primární výchozí EULA</a>.',
|
||||
'use_default_eula_disabled' => '<del>Použít výchozí EULA.</del>
|
||||
Žádná výchozí EULA nenastavena. Zadejte novou v nastevení.',
|
||||
|
||||
14
app/lang/cs/admin/asset_maintenances/form.php
Executable file
14
app/lang/cs/admin/asset_maintenances/form.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'asset_maintenance_type' => 'Asset Maintenance Type',
|
||||
'title' => 'Title',
|
||||
'start_date' => 'Začátek',
|
||||
'completion_date' => 'Completion Date',
|
||||
'cost' => 'Cena',
|
||||
'is_warranty' => 'Warranty Improvement',
|
||||
'asset_maintenance_time' => 'Asset Maintenance Time (in days)',
|
||||
'notes' => 'Poznámky',
|
||||
'update' => 'Update Asset Maintenance',
|
||||
'create' => 'Create Asset Maintenance'
|
||||
];
|
||||
11
app/lang/cs/admin/asset_maintenances/general.php
Executable file
11
app/lang/cs/admin/asset_maintenances/general.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'asset_maintenances' => 'Asset Maintenances',
|
||||
'edit' => 'Edit Asset Maintenance',
|
||||
'delete' => 'Delete Asset Maintenance',
|
||||
'view' => 'View Asset Maintenance Details',
|
||||
'repair' => 'Oprava',
|
||||
'maintenance' => 'Údržba',
|
||||
'upgrade' => 'Upgradovat'
|
||||
];
|
||||
17
app/lang/cs/admin/asset_maintenances/message.php
Executable file
17
app/lang/cs/admin/asset_maintenances/message.php
Executable file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'not_found' => 'Asset Maintenance you were looking for was not found!',
|
||||
'delete' => [
|
||||
'confirm' => 'Are you sure you wish to delete this asset maintenance?',
|
||||
'error' => 'There was an issue deleting the asset maintenance. Please try again.',
|
||||
'success' => 'The asset maintenance was deleted successfully.'
|
||||
],
|
||||
'create' => [
|
||||
'error' => 'Asset Maintenance was not created, please try again.',
|
||||
'success' => 'Asset Maintenance created successfully.'
|
||||
],
|
||||
'asset_maintenance_incomplete' => 'Not Completed Yet',
|
||||
'warranty' => 'Záruka',
|
||||
'not_warranty' => 'Bez záruky',
|
||||
];
|
||||
9
app/lang/cs/admin/asset_maintenances/table.php
Executable file
9
app/lang/cs/admin/asset_maintenances/table.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'title' => 'Asset Maintenance',
|
||||
'asset_name' => 'Název majetku',
|
||||
'supplier_name' => 'Dodavatel',
|
||||
'is_warranty' => 'Záruka',
|
||||
'dl_csv' => 'Stáhnout CSV'
|
||||
];
|
||||
@@ -5,11 +5,12 @@ return array(
|
||||
'about_categories' => 'Kategorie pomáhají organizovat majetek. Takovou kategorii může být např. "Desktopy", "Notebooky", "Mobilní telefony", "Tablety", apod., kategorie můžete ale používat jakkoliv Vám to bude dávat smysl. ',
|
||||
'asset_categories' => 'Kategorie majetku',
|
||||
'category_name' => 'Jméno kategorie',
|
||||
'checkin_email' => 'Send email to user on checkin.',
|
||||
'clone' => 'Klonovat Kategorii',
|
||||
'create' => 'Vytvořit kategorii',
|
||||
'edit' => 'Upravit Kategorii',
|
||||
'eula_text' => 'EULA Kategorie',
|
||||
'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.',
|
||||
'eula_text_help' => 'Toto pole umožňuje upravit EULA pro různé druhy majetku. Pokud máte pouze jeden typ pro všechen majetek, můžete zaškrtnout položku níže pro použití jako výchozí.',
|
||||
'require_acceptance' => 'Žádat uživatelé o potvrzení převzetí majetku v této kategorii.',
|
||||
'required_acceptance' => 'Uživateli bude zaslán email s odkazem pro potvrzení přijetí této položky.',
|
||||
'required_eula' => 'Tomuto uživateli bude zaslána kopie EUAL emailem',
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
return array(
|
||||
'about_consumables_title' => 'About Consumables',
|
||||
'about_consumables_text' => 'Consumables are anything purchased that will be used up over time. For example, printer ink or copier paper.',
|
||||
'remaining' => 'Remaining',
|
||||
'total' => 'Total',
|
||||
'consumable_name' => 'Consumable Name',
|
||||
'create' => 'Create Consumable',
|
||||
'remaining' => 'Zbývá',
|
||||
'total' => 'Celkem',
|
||||
'update' => 'Update Consumable',
|
||||
);
|
||||
|
||||
@@ -17,9 +17,10 @@ return array(
|
||||
'default_location' => 'Výchozí umístění',
|
||||
'eol_date' => 'Konec životnosti',
|
||||
'eol_rate' => 'Míra ukončení životnosti',
|
||||
'expected_checkin' => 'Expected Checkin Date',
|
||||
'expires' => 'Expiruje',
|
||||
'fully_depreciated' => 'Plně odepsané',
|
||||
'help_checkout' => 'Pokud si přejete přiřadit majetek okamžitě, měli by jste ze seznamu stavů zvolit "Připraveno k přiděleni", nebo se může něco pokazit. ',
|
||||
'help_checkout' => 'If you wish to assign this asset immediately, select "Ready to Deploy" from the status list above. ',
|
||||
'mac_address' => 'MAC adresa',
|
||||
'manufacturer' => 'Výrobce',
|
||||
'model' => 'Model',
|
||||
|
||||
@@ -5,6 +5,7 @@ return array(
|
||||
'undeployable' => '<strong>Warning: </strong> This asset has been marked as currently undeployable.
|
||||
If this status has changed, please update the asset status.',
|
||||
'does_not_exist' => 'Asset does not exist.',
|
||||
'does_not_exist_or_not_requestable' => 'Nice try. That asset does not exist or is not requestable.',
|
||||
'assoc_users' => 'This asset is currently checked out to a user and cannot be deleted. Please check the asset in first, and then try deleting again. ',
|
||||
|
||||
'create' => array(
|
||||
@@ -14,7 +15,7 @@ return array(
|
||||
|
||||
'update' => array(
|
||||
'error' => 'Asset was not updated, please try again',
|
||||
'success' => 'Asset updated successfully.',
|
||||
'success' => 'Majetek úspěšně aktualizován.',
|
||||
'nothing_updated' => 'No fields were selected, so nothing was updated.',
|
||||
),
|
||||
|
||||
@@ -22,16 +23,16 @@ return array(
|
||||
'error' => 'Asset was not restored, please try again',
|
||||
'success' => 'Asset restored successfully.'
|
||||
),
|
||||
|
||||
|
||||
'deletefile' => array(
|
||||
'error' => 'File not deleted. Please try again.',
|
||||
'success' => 'File successfully deleted.',
|
||||
'success' => 'Soubor byl úspěšně smazán.',
|
||||
),
|
||||
|
||||
'upload' => array(
|
||||
'error' => 'File(s) not uploaded. Please try again.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'nofiles' => 'You did not select any files for upload, or the file you are trying to upload is too large',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
@@ -39,7 +40,7 @@ return array(
|
||||
'delete' => array(
|
||||
'confirm' => 'Are you sure you wish to delete this asset?',
|
||||
'error' => 'There was an issue deleting the asset. Please try again.',
|
||||
'success' => 'The asset was deleted successfully.'
|
||||
'success' => 'Majetek byl úspěšně smazán.'
|
||||
),
|
||||
|
||||
'checkout' => array(
|
||||
|
||||
@@ -18,5 +18,6 @@ return array(
|
||||
'serial' => 'Sériové číslo',
|
||||
'status' => 'Stav',
|
||||
'title' => 'Majetek ',
|
||||
'days_without_acceptance' => 'Days Without Acceptance'
|
||||
|
||||
);
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
|
||||
return array(
|
||||
|
||||
'asset' => 'Asset',
|
||||
'checkin' => 'Checkin',
|
||||
'cost' => 'Purchase Cost',
|
||||
'create' => 'Create License',
|
||||
'date' => 'Purchase Date',
|
||||
'depreciation' => 'Depreciation',
|
||||
'expiration' => 'Expiration Date',
|
||||
'maintained' => 'Maintained',
|
||||
'name' => 'Software Name',
|
||||
'asset' => 'Majetek',
|
||||
'checkin' => 'Příjem',
|
||||
'cost' => 'Pořizovací cena',
|
||||
'create' => 'Založ licenci',
|
||||
'date' => 'Datum pořízení',
|
||||
'depreciation' => 'Amortizace',
|
||||
'expiration' => 'Expirace',
|
||||
'maintained' => 'Údržba',
|
||||
'name' => 'Software',
|
||||
'no_depreciation' => 'Do Not Depreciate',
|
||||
'notes' => 'Notes',
|
||||
'order' => 'Order No.',
|
||||
'notes' => 'Poznámky',
|
||||
'order' => 'Koupeno',
|
||||
'purchase_order' => 'Purchase Order Number',
|
||||
'reassignable' => 'Reassignable',
|
||||
'remaining_seats' => 'Remaining Seats',
|
||||
'seats' => 'Seats',
|
||||
'serial' => 'Serial',
|
||||
'supplier' => 'Supplier',
|
||||
'termination_date' => 'Termination Date',
|
||||
'to_email' => 'Licensed to Email',
|
||||
'to_name' => 'Licensed to Name',
|
||||
'update' => 'Update License',
|
||||
'remaining_seats' => 'Nasazeno',
|
||||
'seats' => 'Počet licencí',
|
||||
'serial' => 'Sériové číslo',
|
||||
'supplier' => 'Dodavatel',
|
||||
'termination_date' => 'Platná do',
|
||||
'to_email' => 'Registrováno na Email',
|
||||
'to_name' => 'Registrace na jméno',
|
||||
'update' => 'Úprava licence',
|
||||
'checkout_help' => 'You must check a license out to a hardware asset or a person. You can select both, but the owner of the asset must match the person you\'re checking the asset out to.'
|
||||
);
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
return array(
|
||||
|
||||
'checkin' => 'Checkin License Seat',
|
||||
'checkout_history' => 'Checkout History',
|
||||
'checkout_history' => 'Historie',
|
||||
'checkout' => 'Checkout License Seat',
|
||||
'edit' => 'Edit License',
|
||||
'edit' => 'Uprav licenci',
|
||||
'filetype_info' => 'Allowed filetypes are png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, and rar.',
|
||||
'clone' => 'Clone License',
|
||||
'history_for' => 'History for ',
|
||||
'in_out' => 'In/Out',
|
||||
'info' => 'License Info',
|
||||
'clone' => 'Duplikovat licenci',
|
||||
'history_for' => 'Historie uživatele ',
|
||||
'in_out' => 'Stav',
|
||||
'info' => 'Informace o licenci',
|
||||
'license_seats' => 'License Seats',
|
||||
'seat' => 'Seat',
|
||||
'seats' => 'Seats',
|
||||
'software_licenses' => 'Software Licenses',
|
||||
'user' => 'User',
|
||||
'view' => 'View License',
|
||||
'seats' => 'Počet licencí',
|
||||
'software_licenses' => 'Softwarové licence',
|
||||
'user' => 'Uživatel',
|
||||
'view' => 'Ukaž licenci',
|
||||
);
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
|
||||
return array(
|
||||
|
||||
'does_not_exist' => 'License does not exist.',
|
||||
'user_does_not_exist' => 'User does not exist.',
|
||||
'does_not_exist' => 'Licence neexistuje.',
|
||||
'user_does_not_exist' => 'Uživatel neexistuje.',
|
||||
'asset_does_not_exist' => 'The asset you are trying to associate with this license does not exist.',
|
||||
'owner_doesnt_match_asset' => 'The asset you are trying to associate with this license is owned by somene other than the person selected in the assigned to dropdown.',
|
||||
'assoc_users' => 'This license is currently checked out to a user and cannot be deleted. Please check the license in first, and then try deleting again. ',
|
||||
|
||||
|
||||
'create' => array(
|
||||
'error' => 'License was not created, please try again.',
|
||||
'success' => 'License created successfully.'
|
||||
'error' => 'Licence nebyla vytvořena, zkuste to prosím znovu.',
|
||||
'success' => 'Licence byla úspěšně vytvořena.'
|
||||
),
|
||||
|
||||
'deletefile' => array(
|
||||
'error' => 'File not deleted. Please try again.',
|
||||
'success' => 'File successfully deleted.',
|
||||
'error' => 'Soubor se nepodařilo smazat. Prosím zkuste to znovu.',
|
||||
'success' => 'Soubor byl úspěšně smazán.',
|
||||
),
|
||||
|
||||
'upload' => array(
|
||||
'error' => 'File(s) not uploaded. Please try again.',
|
||||
'error' => 'Soubor(y) se nepodařilo nahrát. Prosím zkuste to znovu.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'nofiles' => 'You did not select any files for upload, or the file you are trying to upload is too large',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
@@ -34,7 +34,7 @@ return array(
|
||||
'delete' => array(
|
||||
'confirm' => 'Are you sure you wish to delete this license?',
|
||||
'error' => 'There was an issue deleting the license. Please try again.',
|
||||
'success' => 'The license was deleted successfully.'
|
||||
'success' => 'Licence byla úspěšně smazána.'
|
||||
),
|
||||
|
||||
'checkout' => array(
|
||||
@@ -44,7 +44,7 @@ return array(
|
||||
|
||||
'checkin' => array(
|
||||
'error' => 'There was an issue checking in the license. Please try again.',
|
||||
'success' => 'The license was checked in successfully'
|
||||
'success' => 'Licence byla úspěšně zkontrolována'
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
return array(
|
||||
|
||||
'assigned_to' => 'Assigned To',
|
||||
'checkout' => 'In/Out',
|
||||
'assigned_to' => 'Přiděleno',
|
||||
'checkout' => 'Stav',
|
||||
'id' => 'ID',
|
||||
'license_email' => 'License Email',
|
||||
'license_name' => 'Licensed To',
|
||||
'purchase_date' => 'Purchase Date',
|
||||
'purchased' => 'Purchased',
|
||||
'license_name' => 'Registrováno na',
|
||||
'purchase_date' => 'Pořízeno',
|
||||
'purchased' => 'Zakoupeno',
|
||||
'seats' => 'Seats',
|
||||
'hardware' => 'Hardware',
|
||||
'serial' => 'Serial',
|
||||
'title' => 'License',
|
||||
'serial' => 'Sériové číslo',
|
||||
'title' => 'Licence',
|
||||
|
||||
);
|
||||
|
||||
@@ -4,6 +4,8 @@ return array(
|
||||
|
||||
'does_not_exist' => 'Místo neexistuje.',
|
||||
'assoc_users' => 'This location is currently associated with at least one user and cannot be deleted. Please update your users to no longer reference this location and try again. ',
|
||||
'assoc_assets' => 'This location is currently associated with at least one asset and cannot be deleted. Please update your assets to no longer reference this location and try again. ',
|
||||
'assoc_child_loc' => 'This location is currently the parent of at least one child location and cannot be deleted. Please update your locations to no longer reference this location and try again. ',
|
||||
|
||||
|
||||
'create' => array(
|
||||
|
||||
@@ -12,4 +12,6 @@ return array(
|
||||
'address' => 'Adresa',
|
||||
'zip' => 'PSČ',
|
||||
'locations' => 'Umístění',
|
||||
'parent' => 'Parent',
|
||||
'currency' => 'Location Currency', // this is deprecated
|
||||
);
|
||||
|
||||
@@ -8,7 +8,8 @@ return array(
|
||||
|
||||
'create' => array(
|
||||
'error' => 'Model was not created, please try again.',
|
||||
'success' => 'Model created successfully.'
|
||||
'success' => 'Model created successfully.',
|
||||
'duplicate_set' => 'An asset model with that name, manufacturer and model number already exists.',
|
||||
),
|
||||
|
||||
'update' => array(
|
||||
@@ -21,7 +22,7 @@ return array(
|
||||
'error' => 'There was an issue deleting the model. Please try again.',
|
||||
'success' => 'The model was deleted successfully.'
|
||||
),
|
||||
|
||||
|
||||
'restore' => array(
|
||||
'error' => 'Model was not restored, please try again',
|
||||
'success' => 'Model restored successfully.'
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
return array(
|
||||
|
||||
'create' => 'Create Asset Model',
|
||||
'created_at' => 'Created at',
|
||||
'eol' => 'EOL',
|
||||
'modelnumber' => 'Model No.',
|
||||
'created_at' => 'Vytvořeno',
|
||||
'eol' => 'KŽ',
|
||||
'modelnumber' => 'Modelová řada',
|
||||
'name' => 'Asset Model Name',
|
||||
'numassets' => 'Assets',
|
||||
'title' => 'Asset Models',
|
||||
'numassets' => 'Počet',
|
||||
'title' => 'Model',
|
||||
'update' => 'Update Asset Model',
|
||||
'view' => 'View Asset Model',
|
||||
'update' => 'Update Asset Model',
|
||||
'clone' => 'Clone Model',
|
||||
'edit' => 'Edit Model',
|
||||
'clone' => 'Kopíruj modelovou řadu',
|
||||
'edit' => 'Edituj model',
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'error' => 'You must select at least ONE option.'
|
||||
'error' => 'Musíte vybrat alespoň jednu možnost.'
|
||||
);
|
||||
|
||||
@@ -7,9 +7,10 @@ return array(
|
||||
'auto_increment_assets' => 'Vygenerovat zvyšující se ID majetku',
|
||||
'auto_increment_prefix' => 'Předpona (volitnelná)',
|
||||
'auto_incrementing_help' => 'Nastavte nejdříve automaticky se zvyšující ID majetku pro nastavení tohoto',
|
||||
'backups' => 'Backups',
|
||||
'backups' => 'Zálohy',
|
||||
'barcode_type' => 'Tyo čárového kódu',
|
||||
'barcode_settings' => 'Nastavení čárového kódu',
|
||||
'default_currency' => 'Default Currency',
|
||||
'default_eula_text' => 'Výchozí EULA',
|
||||
'default_eula_help_text' => 'Můžete také spojit vlastní EULA se specifickými kategoriemi majetku.',
|
||||
'display_asset_name' => 'Zobrazit název majetku',
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
|
||||
return array(
|
||||
|
||||
'does_not_exist' => 'Supplier does not exist.',
|
||||
'does_not_exist' => 'Dodavatel neexistuje.',
|
||||
'assoc_users' => 'This supplier is currently associated with at least one model and cannot be deleted. Please update your models to no longer reference this supplier and try again. ',
|
||||
|
||||
'create' => array(
|
||||
'error' => 'Supplier was not created, please try again.',
|
||||
'success' => 'Supplier created successfully.'
|
||||
'success' => 'Dodavatel úspěšně vytvořen.'
|
||||
),
|
||||
|
||||
'update' => array(
|
||||
'error' => 'Supplier was not updated, please try again',
|
||||
'success' => 'Supplier updated successfully.'
|
||||
'success' => 'Dodavatel úspěšně aktualizován.'
|
||||
),
|
||||
|
||||
'delete' => array(
|
||||
'confirm' => 'Are you sure you wish to delete this supplier?',
|
||||
'error' => 'There was an issue deleting the supplier. Please try again.',
|
||||
'success' => 'Supplier was deleted successfully.'
|
||||
'success' => 'Dodavatel byl úspěšně smazán.'
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'address' => 'Supplier Address',
|
||||
'address' => 'Adresa dodavatele',
|
||||
'assets' => 'Assets',
|
||||
'city' => 'City',
|
||||
'contact' => 'Contact Name',
|
||||
'country' => 'Country',
|
||||
'create' => 'Create Supplier',
|
||||
'city' => 'Město',
|
||||
'contact' => 'Kontaktní osoba',
|
||||
'country' => 'Země',
|
||||
'create' => 'Nový dodavatel',
|
||||
'email' => 'Email',
|
||||
'fax' => 'Fax',
|
||||
'id' => 'ID',
|
||||
'licenses' => 'Licenses',
|
||||
'name' => 'Supplier Name',
|
||||
'notes' => 'Notes',
|
||||
'phone' => 'Phone',
|
||||
'state' => 'State',
|
||||
'suppliers' => 'Suppliers',
|
||||
'licenses' => 'Licence',
|
||||
'name' => 'Dodavatel',
|
||||
'notes' => 'Poznámky',
|
||||
'phone' => 'Telefon',
|
||||
'state' => 'Stát',
|
||||
'suppliers' => 'Dodavatelé',
|
||||
'update' => 'Update Supplier',
|
||||
'url' => 'URL',
|
||||
'view' => 'View Supplier',
|
||||
'view' => 'Zobrazit dodavatele',
|
||||
'view_assets_for' => 'View Assets for',
|
||||
'zip' => 'Postal Code',
|
||||
'zip' => 'PSČ',
|
||||
|
||||
);
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
|
||||
return array(
|
||||
|
||||
'assets_user' => 'Assets assigned to :name',
|
||||
'clone' => 'Clone User',
|
||||
'contact_user' => 'Contact :name',
|
||||
'edit' => 'Edit User',
|
||||
'history_user' => 'History for :name',
|
||||
'last_login' => 'Last Login',
|
||||
'software_user' => 'Software Checked out to :name',
|
||||
'view_user' => 'View User :name',
|
||||
'usercsv' => 'CSV file',
|
||||
'assets_user' => 'Assets assigned to :name',
|
||||
'clone' => 'Duplikuj uživatele',
|
||||
'contact_user' => 'Kontakt na :name',
|
||||
'edit' => 'Upravit uživatele',
|
||||
'filetype_info' => 'Povolené přílohy: png, gif, jpg, jpeg, doc, docx, pdf, txt, zip, and rar.',
|
||||
'history_user' => 'Historie:',
|
||||
'last_login' => 'Poslední přihlášení',
|
||||
'software_user' => 'Software vydaný pro :name',
|
||||
'view_user' => 'Zobraz uživatele',
|
||||
'usercsv' => 'CSV soubor',
|
||||
);
|
||||
|
||||
@@ -2,24 +2,26 @@
|
||||
|
||||
return array(
|
||||
|
||||
'user_exists' => 'User already exists!',
|
||||
'user_not_found' => 'User [:id] does not exist.',
|
||||
'user_login_required' => 'The login field is required',
|
||||
'user_password_required' => 'The password is required.',
|
||||
'insufficient_permissions' => 'Insufficient Permissions.',
|
||||
'user_deleted_warning' => 'This user has been deleted. You will have to restore this user to edit them or assign them new assets.',
|
||||
'accepted' => 'You have successfully accepted this asset.',
|
||||
'declined' => 'You have successfully declined this asset.',
|
||||
'user_exists' => 'Uživatel již existuje!',
|
||||
'user_not_found' => 'Uživatel [:id] neexistuje.',
|
||||
'user_login_required' => 'The login field is required',
|
||||
'user_password_required' => 'Je vyžadováno heslo.',
|
||||
'insufficient_permissions' => 'Nedostatečná oprávnění.',
|
||||
'user_deleted_warning' => 'This user has been deleted. You will have to restore this user to edit them or assign them new assets.',
|
||||
|
||||
|
||||
'success' => array(
|
||||
'create' => 'User was successfully created.',
|
||||
'update' => 'User was successfully updated.',
|
||||
'create' => 'Uživatel byl úspěšně vytvořen.',
|
||||
'update' => 'Uživatel byl úspěšně aktualizován.',
|
||||
'delete' => 'User was successfully deleted.',
|
||||
'ban' => 'User was successfully banned.',
|
||||
'unban' => 'User was successfully unbanned.',
|
||||
'ban' => 'Uživatel byl úspěšně zakázán.',
|
||||
'unban' => 'Uživatel byl úspěšně povolen.',
|
||||
'suspend' => 'User was successfully suspended.',
|
||||
'unsuspend' => 'User was successfully unsuspended.',
|
||||
'restored' => 'User was successfully restored.',
|
||||
'import' => 'Users imported successfully.',
|
||||
'import' => 'Uživatelé úspěšně naimportování.',
|
||||
),
|
||||
|
||||
'error' => array(
|
||||
@@ -29,6 +31,19 @@ return array(
|
||||
'unsuspend' => 'There was an issue unsuspending the user. Please try again.',
|
||||
'import' => 'There was an issue importing users. Please try again.',
|
||||
'asset_already_accepted' => 'This asset has already been accepted.',
|
||||
'accept_or_decline' => 'You must either accept or decline this asset.',
|
||||
),
|
||||
|
||||
'deletefile' => array(
|
||||
'error' => 'Soubor se nepodařilo smazat. Prosím zkuste to znovu.',
|
||||
'success' => 'Soubor byl úspěšně smazán.',
|
||||
),
|
||||
|
||||
'upload' => array(
|
||||
'error' => 'Soubor(y) se nepodařilo nahrát. Prosím zkuste to znovu.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
@@ -2,35 +2,35 @@
|
||||
|
||||
return array(
|
||||
|
||||
'activated' => 'Active',
|
||||
'allow' => 'Allow',
|
||||
'activated' => 'Aktivní',
|
||||
'allow' => 'Povolit',
|
||||
'checkedout' => 'Assets',
|
||||
'created_at' => 'Created',
|
||||
'createuser' => 'Create User',
|
||||
'deny' => 'Deny',
|
||||
'created_at' => 'Vytvořeno',
|
||||
'createuser' => 'Nový uživatel',
|
||||
'deny' => 'Zakázat',
|
||||
'email' => 'Email',
|
||||
'employee_num' => 'Employee No.',
|
||||
'first_name' => 'First Name',
|
||||
'employee_num' => 'Osobní číslo',
|
||||
'first_name' => 'Jméno',
|
||||
'groupnotes' => 'Select a group to assign to the user, remember that a user takes on the permissions of the group they are assigned.',
|
||||
'id' => 'Id',
|
||||
'inherit' => 'Inherit',
|
||||
'job' => 'Job Title',
|
||||
'last_login' => 'Last Login',
|
||||
'last_name' => 'Last Name',
|
||||
'location' => 'Location',
|
||||
'id' => 'ID',
|
||||
'inherit' => 'Převzít',
|
||||
'job' => 'Pracovní pozice',
|
||||
'last_login' => 'Poslední přihlášení',
|
||||
'last_name' => 'Příjmení',
|
||||
'location' => 'Umístění',
|
||||
'lock_passwords' => 'Login details cannot be changed on this installation.',
|
||||
'manager' => 'Manager',
|
||||
'name' => 'Name',
|
||||
'notes' => 'Notes',
|
||||
'password_confirm' => 'Confirm Password',
|
||||
'password' => 'Password',
|
||||
'phone' => 'Phone',
|
||||
'manager' => 'Nadřízený',
|
||||
'name' => 'Položka',
|
||||
'notes' => 'Poznámky',
|
||||
'password_confirm' => 'Potvrzení hesla',
|
||||
'password' => 'Heslo',
|
||||
'phone' => 'Telefon',
|
||||
'show_current' => 'Show Current Users',
|
||||
'show_deleted' => 'Show Deleted Users',
|
||||
'title' => 'Title',
|
||||
'updateuser' => 'Update User',
|
||||
'username' => 'Username',
|
||||
'username' => 'Uživatelské jméno',
|
||||
'username_note' => '(This is used for Active Directory binding only, not for login.)',
|
||||
'cloneuser' => 'Clone User',
|
||||
'viewusers' => 'View Users',
|
||||
'cloneuser' => 'Duplikuj uživatele',
|
||||
'viewusers' => 'Zobrazit uživatele',
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
return array(
|
||||
|
||||
'account_already_exists' => 'Účet s tímto emailem již existuje.',
|
||||
'account_not_found' => 'Emailový účet nebo heslo je nesprávné.',
|
||||
'account_not_found' => 'Neexistující uživatel nebo chybné heslo!',
|
||||
'account_not_activated' => 'Uživatelský účet není aktivován.',
|
||||
'account_suspended' => 'Uživatelský účet je pozastaven.',
|
||||
'account_banned' => 'Uživatelský účet je zablokován.',
|
||||
|
||||
@@ -8,6 +8,7 @@ return array(
|
||||
'delete' => 'Smazat',
|
||||
'edit' => 'Upravit',
|
||||
'restore' => 'Obnovit',
|
||||
'request' => 'Request',
|
||||
'submit' => 'Odeslat',
|
||||
'upload' => 'Nahrát',
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
|
||||
return [
|
||||
'accessories' => 'Příslušenství',
|
||||
'accessory' => 'Příslušenství',
|
||||
'action' => 'Action',
|
||||
'action' => 'Akce',
|
||||
'activity_report' => 'Report aktivity',
|
||||
'address' => 'Adresa',
|
||||
'admin' => 'Admin',
|
||||
@@ -21,9 +19,10 @@ return array(
|
||||
'avatar_delete' => 'Smazat avatara',
|
||||
'avatar_upload' => 'Nahrát avatara',
|
||||
'back' => 'Zpět',
|
||||
'bad_data' => 'Nothing found. Maybe bad data?',
|
||||
'cancel' => 'Storno',
|
||||
'categories' => 'Categories',
|
||||
'category' => 'Category',
|
||||
'categories' => 'Kategorie',
|
||||
'category' => 'Kategorie',
|
||||
'changeemail' => 'Změnit e-mailovou adresu',
|
||||
'changepassword' => 'Změnit heslo',
|
||||
'checkin' => 'Příjem',
|
||||
@@ -36,7 +35,7 @@ return array(
|
||||
'create' => 'Vytvořit nové',
|
||||
'created_asset' => 'vytvořit majetek',
|
||||
'created_at' => 'Vytvořeno',
|
||||
'currency' => 'Kč',
|
||||
'currency' => 'Kč', // this is deprecated
|
||||
'current' => 'Aktuální',
|
||||
'custom_report' => 'Vlastní report majetku',
|
||||
'dashboard' => 'Nástěnka',
|
||||
@@ -60,6 +59,9 @@ return array(
|
||||
'id' => 'ID',
|
||||
'image_delete' => 'Smazat obrázek',
|
||||
'image_upload' => 'Nahrát obrázek',
|
||||
'asset_maintenance' => 'Asset Maintenance',
|
||||
'asset_maintenance_report' => 'Asset Maintenance Report',
|
||||
'asset_maintenances' => 'Asset Maintenances',
|
||||
'item' => 'Položka',
|
||||
'last' => 'Poslední',
|
||||
'last_name' => 'Příjmení',
|
||||
@@ -69,6 +71,8 @@ return array(
|
||||
'licenses' => 'Licence',
|
||||
'list_all' => 'Vypsat vše',
|
||||
'loading' => 'Nahrávání',
|
||||
'lock_passwords' => 'This field cannot be edited in this installation.',
|
||||
'feature_disabled' => 'This feature has been disabled for this installation.',
|
||||
'location' => 'Lokalita',
|
||||
'locations' => 'Umístění',
|
||||
'logout' => 'Odhlásit',
|
||||
@@ -92,10 +96,11 @@ return array(
|
||||
'processing' => 'Pracuji',
|
||||
'profile' => 'Váš profil',
|
||||
'qty' => 'QTY',
|
||||
'quanitity' => 'Quanitity',
|
||||
'quanitity' => 'Množství',
|
||||
'ready_to_deploy' => 'Připraveno k přidělení',
|
||||
'recent_activity' => 'Nedávná aktivita',
|
||||
'reports' => 'Reporty',
|
||||
'requested' => 'Requested',
|
||||
'save' => 'Uložit',
|
||||
'select' => 'Zvolit',
|
||||
'search' => 'Hledat',
|
||||
@@ -106,6 +111,7 @@ return array(
|
||||
'select_supplier' => 'Zvolit dodavatele',
|
||||
'select_user' => 'Zvolit uživatele',
|
||||
'select_date' => 'Zvolit datum',
|
||||
'select_statuslabel' => 'Vybrat stav',
|
||||
'settings' => 'Nastavení',
|
||||
'sign_in' => 'Přihlásit se',
|
||||
'site_name' => 'Název lokality',
|
||||
@@ -118,8 +124,12 @@ return array(
|
||||
'type' => 'Typ',
|
||||
'undeployable' => 'Ne-přiřaditelné',
|
||||
'unknown_admin' => 'Neznámy správce',
|
||||
'update' => 'Aktualizace',
|
||||
'uploaded' => 'Nahráno',
|
||||
'user' => 'Uživatel',
|
||||
'accepted' => 'přijato',
|
||||
'declined' => 'zamítnuto',
|
||||
'unaccepted_asset_report' => 'Unaccepted Assets',
|
||||
'users' => 'Uživatelé',
|
||||
'viewassets' => 'Zobrazit přiřazený majetek',
|
||||
'website' => 'Webová stránka',
|
||||
@@ -127,5 +137,4 @@ return array(
|
||||
'years' => 'roky',
|
||||
'yes' => 'Ano',
|
||||
'zip' => 'PSČ',
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
@@ -77,7 +77,7 @@ return array(
|
||||
*/
|
||||
|
||||
'custom' => array(),
|
||||
'alpha_space' => "Pole :attribute může obsahovat pouze znaky, čárky, mezery a pomlčky.",
|
||||
'alpha_space' => "Pole :attribute obsahuje nepovolené znaky.",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -5,7 +5,7 @@ return array(
|
||||
'about_accessories_text' => 'Tilbehør er alt du udleverer til brugere men som ikke har et serienummer (eller som du er ligeglad med følge præcist). For eksempel, computermus eller tastaturer.',
|
||||
'accessory_category' => 'Tilbehør Kategori',
|
||||
'accessory_name' => 'Tilbehør Navn',
|
||||
'create' => 'Tilbehør Kategori',
|
||||
'create' => 'Create Accessory',
|
||||
'eula_text' => 'Slutbrugerlicenskategori',
|
||||
'eula_text_help' => 'Dette felt tillader dig at tilpasse din slutbrugerlicens til specifikke typer af tilbehør. Hvis du kun har en slutbrugerlicens for alle dine tilbehør, kan du afkrydse boksen nedenfor for at bruge den primære standardlicens.',
|
||||
'require_acceptance' => 'Kræver brugere at bekræfte accept af tilbehør i denne kategori.',
|
||||
@@ -13,7 +13,7 @@ return array(
|
||||
'qty' => 'STK',
|
||||
'total' => 'I alt',
|
||||
'remaining' => 'Tilgængelig',
|
||||
'update' => 'Opdater Kategori',
|
||||
'update' => 'Update Accessory',
|
||||
'use_default_eula' => 'Brug den <a href="#" data-toggle="modal" data-target="#eulaModal">primære standard slutbrugerlicens</a> i stedet for.',
|
||||
'use_default_eula_disabled' => '<del>Brug den primære standard slutbrugerlicens i stedet for.</del> Ingen primær standard slutbrugerlicens er defineret. Tilføj en under indstillinger.',
|
||||
|
||||
|
||||
14
app/lang/da/admin/asset_maintenances/form.php
Executable file
14
app/lang/da/admin/asset_maintenances/form.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'asset_maintenance_type' => 'Asset Maintenance Type',
|
||||
'title' => 'Title',
|
||||
'start_date' => 'Start Date',
|
||||
'completion_date' => 'Completion Date',
|
||||
'cost' => 'Cost',
|
||||
'is_warranty' => 'Warranty Improvement',
|
||||
'asset_maintenance_time' => 'Asset Maintenance Time (in days)',
|
||||
'notes' => 'Notes',
|
||||
'update' => 'Update Asset Maintenance',
|
||||
'create' => 'Create Asset Maintenance'
|
||||
];
|
||||
11
app/lang/da/admin/asset_maintenances/general.php
Executable file
11
app/lang/da/admin/asset_maintenances/general.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'asset_maintenances' => 'Asset Maintenances',
|
||||
'edit' => 'Edit Asset Maintenance',
|
||||
'delete' => 'Delete Asset Maintenance',
|
||||
'view' => 'View Asset Maintenance Details',
|
||||
'repair' => 'Repair',
|
||||
'maintenance' => 'Maintenance',
|
||||
'upgrade' => 'Upgrade'
|
||||
];
|
||||
17
app/lang/da/admin/asset_maintenances/message.php
Executable file
17
app/lang/da/admin/asset_maintenances/message.php
Executable file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'not_found' => 'Asset Maintenance you were looking for was not found!',
|
||||
'delete' => [
|
||||
'confirm' => 'Are you sure you wish to delete this asset maintenance?',
|
||||
'error' => 'There was an issue deleting the asset maintenance. Please try again.',
|
||||
'success' => 'The asset maintenance was deleted successfully.'
|
||||
],
|
||||
'create' => [
|
||||
'error' => 'Asset Maintenance was not created, please try again.',
|
||||
'success' => 'Asset Maintenance created successfully.'
|
||||
],
|
||||
'asset_maintenance_incomplete' => 'Not Completed Yet',
|
||||
'warranty' => 'Warranty',
|
||||
'not_warranty' => 'Not Warranty',
|
||||
];
|
||||
9
app/lang/da/admin/asset_maintenances/table.php
Executable file
9
app/lang/da/admin/asset_maintenances/table.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'title' => 'Asset Maintenance',
|
||||
'asset_name' => 'Asset Name',
|
||||
'supplier_name' => 'Supplier Name',
|
||||
'is_warranty' => 'Warranty',
|
||||
'dl_csv' => 'Download CSV'
|
||||
];
|
||||
@@ -5,6 +5,7 @@ return array(
|
||||
'about_categories' => 'Aktiver kategorier hjælper dig med at organisere dine aktiver. Eksempler på kategorier kunne være "Stationære coputere", "Bærbare", "Mobiltelefoner", "Tabletter" osv., men du kan bruge aktiver kategorier på en hvilken som helst måde som giver mening for dig.',
|
||||
'asset_categories' => 'Aktiver Kategorier',
|
||||
'category_name' => 'Kategorinavn',
|
||||
'checkin_email' => 'Send email to user on checkin.',
|
||||
'clone' => 'Klon Kategori',
|
||||
'create' => 'Opret kategori',
|
||||
'edit' => 'Rediger Kategori',
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
return array(
|
||||
'about_consumables_title' => 'About Consumables',
|
||||
'about_consumables_text' => 'Consumables are anything purchased that will be used up over time. For example, printer ink or copier paper.',
|
||||
'consumable_name' => 'Consumable Name',
|
||||
'create' => 'Create Consumable',
|
||||
'remaining' => 'Remaining',
|
||||
'total' => 'Total',
|
||||
'update' => 'Update Consumable',
|
||||
);
|
||||
|
||||
@@ -17,9 +17,10 @@ return array(
|
||||
'default_location' => 'Standardplacering',
|
||||
'eol_date' => 'EOL Dato',
|
||||
'eol_rate' => 'EOL Rate',
|
||||
'expected_checkin' => 'Expected Checkin Date',
|
||||
'expires' => 'Udløber',
|
||||
'fully_depreciated' => 'Fuldt Afskrevet',
|
||||
'help_checkout' => 'Hvis du ønsker at tildele aktiver med det samme, bør du vælge "Klar til Implementering" fra statuslisten ovenfor ellers kan uventede ting ske. ',
|
||||
'help_checkout' => 'If you wish to assign this asset immediately, select "Ready to Deploy" from the status list above. ',
|
||||
'mac_address' => 'MAC-adresse',
|
||||
'manufacturer' => 'Producent',
|
||||
'model' => 'Model',
|
||||
|
||||
@@ -5,6 +5,7 @@ return array(
|
||||
'undeployable' => '<strong>Warning: </strong> This asset has been marked as currently undeployable.
|
||||
If this status has changed, please update the asset status.',
|
||||
'does_not_exist' => 'Asset does not exist.',
|
||||
'does_not_exist_or_not_requestable' => 'Nice try. That asset does not exist or is not requestable.',
|
||||
'assoc_users' => 'This asset is currently checked out to a user and cannot be deleted. Please check the asset in first, and then try deleting again. ',
|
||||
|
||||
'create' => array(
|
||||
@@ -22,7 +23,7 @@ return array(
|
||||
'error' => 'Asset was not restored, please try again',
|
||||
'success' => 'Asset restored successfully.'
|
||||
),
|
||||
|
||||
|
||||
'deletefile' => array(
|
||||
'error' => 'File not deleted. Please try again.',
|
||||
'success' => 'File successfully deleted.',
|
||||
@@ -31,7 +32,7 @@ return array(
|
||||
'upload' => array(
|
||||
'error' => 'File(s) not uploaded. Please try again.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'nofiles' => 'You did not select any files for upload, or the file you are trying to upload is too large',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
|
||||
@@ -18,5 +18,6 @@ return array(
|
||||
'serial' => 'Serial',
|
||||
'status' => 'Status',
|
||||
'title' => 'Asset ',
|
||||
'days_without_acceptance' => 'Days Without Acceptance'
|
||||
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@ return array(
|
||||
'upload' => array(
|
||||
'error' => 'File(s) not uploaded. Please try again.',
|
||||
'success' => 'File(s) successfully uploaded.',
|
||||
'nofiles' => 'You did not select any files for upload',
|
||||
'nofiles' => 'You did not select any files for upload, or the file you are trying to upload is too large',
|
||||
'invalidfiles' => 'One or more of your files is too large or is a filetype that is not allowed. Allowed filetypes are png, gif, jpg, doc, docx, pdf, and txt.',
|
||||
),
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user