Compare commits
729 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d47e2aab76 | |||
| c7399b0c4f | |||
| 086b13c17e | |||
| 2620da186b | |||
| 3689a52894 | |||
| 725a9320cb | |||
| 12996cafac | |||
| 859c53e975 | |||
| 1322d81d64 | |||
| 3ab828a4cd | |||
| 5ca572b914 | |||
| 1bc7ff9941 | |||
| b855f2fa2b | |||
| 114e6ec6cc | |||
| be4230af81 | |||
| 390de7ae36 | |||
| 588f0a23ba | |||
| d40129bdae | |||
| 54f3c65624 | |||
| 8e18218652 | |||
| bf9aba3f20 | |||
| 7e554a3c59 | |||
| 91ac9bd485 | |||
| f16122070a | |||
| 4803bc71ec | |||
| f0a589f150 | |||
| 32591d4ca0 | |||
| d1bcee0dfa | |||
| e4dfb188fa | |||
| 4f057bfe5e | |||
| 8bbaf2e52f | |||
| cf5fcdf9d7 | |||
| 2333d4e933 | |||
| e1be3efd82 | |||
| 97f97e3590 | |||
| 701c16f4e6 | |||
| 59c203b6ae | |||
| d84479d9fc | |||
| 480f0ef13b | |||
| 6020de6321 | |||
| 796866fd54 | |||
| ef58de5e8c | |||
| 7e07c7dee3 | |||
| 9dc57ff673 | |||
| dea95f9f5b | |||
| 23431fafd9 | |||
| 2cf566422c | |||
| b85d624f08 | |||
| e69eddeef8 | |||
| 061e0d4cdb | |||
| 64b1355393 | |||
| 2cf169a64a | |||
| 6d810a9b0d | |||
| 4a9701af71 | |||
| 0890a22bdb | |||
| f9c66917bd | |||
| 311cccbb1e | |||
| ca27ef6741 | |||
| 0dfa0d9c45 | |||
| 90442c720b | |||
| e228577936 | |||
| 9a18312ab1 | |||
| fc4863837f | |||
| 9bb2ffcf9a | |||
| a78874d986 | |||
| 458f413c61 | |||
| 503f9145a4 | |||
| 04233336aa | |||
| e5b2163ffe | |||
| 9f899ee878 | |||
| 03caa85396 | |||
| f1a4608faf | |||
| c66fe3d4d2 | |||
| 855b3809d0 | |||
| 2d4dee2f72 | |||
| 8667964e3c | |||
| 72a2ee6ea4 | |||
| 6a638f131f | |||
| ab5ff0f709 | |||
| 36fd4ab7c5 | |||
| 98db6fe9df | |||
| 20fd420690 | |||
| 771e21d9f7 | |||
| 3fd9df62f4 | |||
| 1b1a733043 | |||
| e70dab64a2 | |||
| f121766037 | |||
| 9563cf4614 | |||
| 2d56240408 | |||
| 00bb511506 | |||
| fb1dd29059 | |||
| 0896ca6517 | |||
| 9a84497fb0 | |||
| e4cb237bfe | |||
| 28b89f3ddb | |||
| 9ad9e1d5a5 | |||
| 39f40a3f6d | |||
| 0d3a4813ce | |||
| 51e480661d | |||
| 77632cdfb0 | |||
| 19d6f33770 | |||
| c779034e41 | |||
| 8ff7a6ce21 | |||
| 1908499379 | |||
| 348c8f62d1 | |||
| 7da0ffc325 | |||
| 33b05b071d | |||
| f98b4095a2 | |||
| b30edfd9d6 | |||
| b16ea61da8 | |||
| a5e2e7e285 | |||
| 456e586e02 | |||
| 4c4e0ce5c5 | |||
| 8ea23e6773 | |||
| c9feff0757 | |||
| f1b2ba5c51 | |||
| 76220b7884 | |||
| bb88b85a02 | |||
| dad816ba25 | |||
| 4037200fad | |||
| 326d0cc764 | |||
| 9800786485 | |||
| ce6b2f2e5f | |||
| 3e2fc13af5 | |||
| 73317f14a0 | |||
| 6bc2af6e71 | |||
| 962e7531a6 | |||
| e8e8e8f4f3 | |||
| 2982cffc3a | |||
| 218fe72e16 | |||
| 2b13641661 | |||
| 66fe626d51 | |||
| ca9ab681b9 | |||
| 0f07f12d35 | |||
| 03efe0b3e2 | |||
| d7b91d88d6 | |||
| 298a938db2 | |||
| 6c389298f8 | |||
| d4685ec037 | |||
| 602501b4a3 | |||
| e93aebc27b | |||
| e392c87250 | |||
| 2707742518 | |||
| 738dc1fdf0 | |||
| 6f04cf9f61 | |||
| 4be3f2700c | |||
| 4cb0e40abb | |||
| ad144e127c | |||
| 2f4e54c8a6 | |||
| 7c06cba647 | |||
| 5eb506b9c3 | |||
| 4aa376826f | |||
| 1d9e014bfa | |||
| 506af72d83 | |||
| 1ce205a579 | |||
| a7a82e5fbc | |||
| 23da312fff | |||
| faf2e464fa | |||
| 79c5d3f7d6 | |||
| 2888103d1a | |||
| f89176d500 | |||
| 5eb95272ee | |||
| 6c7e265921 | |||
| 76955ec064 | |||
| de9a15a33b | |||
| f9cf2b2558 | |||
| e4627cee96 | |||
| 36eb51d6e4 | |||
| 689832036e | |||
| 8cfcb2aed8 | |||
| 27962d5439 | |||
| f4af607d1a | |||
| 90340a7111 | |||
| 8742bf26b4 | |||
| 8eb31a9a82 | |||
| aeeb273d4c | |||
| 5f6ba2a148 | |||
| 0cb3a9265e | |||
| 96a5f437f2 | |||
| 4b92cdf684 | |||
| 50be3eed4a | |||
| 3b7da8f379 | |||
| 90b00b02cc | |||
| 9eee73d2e5 | |||
| 6639bc1300 | |||
| e272cab82f | |||
| 5967dbae64 | |||
| f42a3c8918 | |||
| d3b3ed0d16 | |||
| 0484924490 | |||
| 894579314c | |||
| b76f014669 | |||
| f03d1cd4cc | |||
| a0db241ac8 | |||
| 0c27717c20 | |||
| ce1565a545 | |||
| ac5527e7d3 | |||
| 865468d091 | |||
| b20f4d245e | |||
| 927c368235 | |||
| eacd4ee2b0 | |||
| 8dab50edc6 | |||
| ee097dd1da | |||
| 775ea95458 | |||
| 73f0a19adb | |||
| a68cbcf767 | |||
| 5c698d7cfd | |||
| efc06f4b31 | |||
| bac1b313f6 | |||
| cac254ded6 | |||
| e217d354dc | |||
| e1837069da | |||
| eb83d9c486 | |||
| 25338c00e5 | |||
| 599ea20d65 | |||
| 72f3b459c5 | |||
| c34c9438da | |||
| 3d8733c612 | |||
| cab1642ead | |||
| 6aa3e21b4c | |||
| b1e48b7054 | |||
| 2686dd640c | |||
| bb7b8f3964 | |||
| 5bed0bd7ed | |||
| be3c8e4515 | |||
| 784d1995d8 | |||
| 7802af837b | |||
| 6f8a76246e | |||
| 66e9203b97 | |||
| b41461698d | |||
| 8cdb032a14 | |||
| 3417d833ba | |||
| aff7b99d91 | |||
| 3944553bfc | |||
| 3dc79197c3 | |||
| f1b00853c6 | |||
| 7f46a48173 | |||
| ae8c9f420d | |||
| aa385571cf | |||
| 9920cb2744 | |||
| 179f96c8e8 | |||
| 7562552f7a | |||
| 5f9d5ae836 | |||
| 639d6214d8 | |||
| dad492d131 | |||
| 6e78fc0a2d | |||
| e98020fa89 | |||
| 6ec4f605f4 | |||
| e88f5629df | |||
| 475fc4855c | |||
| edb2a0b1b7 | |||
| e81fe52aa8 | |||
| 74ed75dd24 | |||
| 17e681ba7c | |||
| 4e065e8df7 | |||
| 9e0f7089c4 | |||
| c22dcdafa4 | |||
| e5cc6d32d1 | |||
| 54655faf83 | |||
| 3b42738a2d | |||
| 65feb00ea4 | |||
| 82a3560f27 | |||
| e8ca98a37d | |||
| 9316af7ed8 | |||
| bbdb576519 | |||
| 43c26f853b | |||
| 1cd7f10f10 | |||
| e4ceddd6ce | |||
| bb83a14707 | |||
| fffc8ed644 | |||
| c6db29e6c4 | |||
| 948e9c2a2b | |||
| 62fe4b8cd3 | |||
| 9b46a5b0f6 | |||
| 8158c12242 | |||
| 36ecf3032f | |||
| 19820db0cc | |||
| fc06caded5 | |||
| a44c56c937 | |||
| 2accfab79e | |||
| 418be7f5de | |||
| beeb28bf09 | |||
| 92410ba054 | |||
| 078750726f | |||
| 7d2ae0d10d | |||
| d8a9d2d3eb | |||
| b925c5766f | |||
| 6bedaa903a | |||
| 4f3cdc20f5 | |||
| 1efb1f7038 | |||
| 6708911d5d | |||
| 3bbcbf5f47 | |||
| 989ce59a5b | |||
| 774b1cb28b | |||
| 10086479b7 | |||
| c0e988b6b1 | |||
| 93cf37336d | |||
| 924f61fce9 | |||
| c6f8d3e6f2 | |||
| a212abee1d | |||
| 4508225d65 | |||
| e3ec2ae3ec | |||
| d653126a2a | |||
| ba39cbb5e0 | |||
| 34276984f3 | |||
| 2195e27d61 | |||
| 948be5c74b | |||
| 93c582970c | |||
| 9624388522 | |||
| 6abfb1b968 | |||
| 59b2b8c63e | |||
| 658462cda5 | |||
| dad1ffb355 | |||
| 12b82d6679 | |||
| 20490986c6 | |||
| 64eecc8df7 | |||
| 0f33bad1b6 | |||
| 632fa92f92 | |||
| 99391d0179 | |||
| c6c6bd02bb | |||
| 904ddddce9 | |||
| d34e7178b3 | |||
| 0428d21c5e | |||
| d8b43215b0 | |||
| b39c53a5ea | |||
| 67e968b032 | |||
| 032aabeadd | |||
| 1202ce4a81 | |||
| 406e077c1e | |||
| 4be046a675 | |||
| 535263788d | |||
| 29bb6a3c4f | |||
| f04e4b1fb4 | |||
| c8c755f8c3 | |||
| 287c7735b6 | |||
| 2a28c73845 | |||
| 3dc0381e2b | |||
| a3dbd87f9f | |||
| 6d42d2c614 | |||
| e910b532c7 | |||
| a777499c0b | |||
| b99c138cb0 | |||
| cbb2151f1a | |||
| 256f33e6b4 | |||
| 59315878c3 | |||
| f6e2654609 | |||
| 4ad241e65e | |||
| 808b66b9f5 | |||
| edbfdc6eb1 | |||
| 716c459985 | |||
| ef011cdf7e | |||
| b93f36a856 | |||
| e60c0e3b4d | |||
| 407b341510 | |||
| 120c8394bb | |||
| cc17862eae | |||
| c24f1721d7 | |||
| c80f1789d4 | |||
| 4a49e6f471 | |||
| e9f4be711a | |||
| 1bccb6127e | |||
| 61107769e8 | |||
| 4e96a5a793 | |||
| f87a25bf3f | |||
| 4ae02c1fb3 | |||
| 9ec132acde | |||
| 318b4b48c6 | |||
| 329a2282e4 | |||
| f8014c4677 | |||
| 7a07c07e29 | |||
| 4b926f015b | |||
| aa834aa72b | |||
| 400b97c40a | |||
| 8394212df7 | |||
| 2487ce42e3 | |||
| fb59ad9fe6 | |||
| 8af5fd0384 | |||
| 4de42f69ba | |||
| 620d4754c0 | |||
| 6ea3bedb9e | |||
| 840e5b1523 | |||
| 1ee3f29d2e | |||
| 6b26640077 | |||
| 964d2bc463 | |||
| e4a634a8a3 | |||
| 5445a7d16b | |||
| 86a174201e | |||
| 7a03a56498 | |||
| 01b574069a | |||
| cc930fc5b8 | |||
| 67a58221eb | |||
| 31c4a63ec0 | |||
| a0f2ad5d54 | |||
| 2c7553e81e | |||
| e82ede5d44 | |||
| e91a22fce0 | |||
| 31ecd165a3 | |||
| fe44846c1b | |||
| c708a24657 | |||
| dbdc2c8e64 | |||
| e66e2e42d3 | |||
| a598fdcb59 | |||
| 177fadba8a | |||
| 1fe5bd3770 | |||
| 2b26fd7e20 | |||
| 7a0598dfc3 | |||
| 5ebb267a53 | |||
| 638a7773bd | |||
| 113dfc9c24 | |||
| 3942fd1869 | |||
| d2423b2fc8 | |||
| a8e686cdf7 | |||
| 08781a561b | |||
| 8fb7d82bab | |||
| ced2a99031 | |||
| 0a97c626e7 | |||
| 6478425be6 | |||
| 999910f31f | |||
| 73a183677d | |||
| 1d24450dcd | |||
| 6f338e573c | |||
| 8e44421788 | |||
| e031239cf0 | |||
| 21a280676b | |||
| ac44140d83 | |||
| c8ecddba54 | |||
| 2f69be03d3 | |||
| 7e8a0af6e5 | |||
| 63cd0c1ae1 | |||
| 8a014d4bd3 | |||
| 8793a04869 | |||
| d72df21b3b | |||
| 08d0fe5118 | |||
| 2ec5f340e8 | |||
| 3e1e9b0077 | |||
| 937249b960 | |||
| 50ea6c66f9 | |||
| 0910d9cf8c | |||
| 30e8555148 | |||
| 8f6c37c301 | |||
| b202e01205 | |||
| 7f9fab0055 | |||
| b210d90148 | |||
| 23d10a8f7f | |||
| 6d365157e7 | |||
| 3a99136f73 | |||
| 50170dd774 | |||
| 5e1bec71f2 | |||
| d73134f32d | |||
| d8df61bd32 | |||
| 12912b3e27 | |||
| d9cd4a4da0 | |||
| 2afc252549 | |||
| aa05d041bd | |||
| bbe0189be2 | |||
| a0599712a6 | |||
| 1a4926ce13 | |||
| 3c8959e92d | |||
| ab3871f678 | |||
| 7297a6031e | |||
| 75bd29b027 | |||
| b77b9c0434 | |||
| b9c36f8638 | |||
| ecae451ebf | |||
| 9627f15412 | |||
| 464f11c398 | |||
| 90009db1b5 | |||
| d7f8d0fc04 | |||
| effad46cc0 | |||
| 4509631921 | |||
| d1a306cfd8 | |||
| 2de4741170 | |||
| fc609ece12 | |||
| ecfd1b2693 | |||
| a8da68d3fd | |||
| 69970d1296 | |||
| ef7c7da4e5 | |||
| 306d8ebaf7 | |||
| 250880c6f3 | |||
| 6bf2a2875f | |||
| 9f43b6af9f | |||
| a47a4e83e2 | |||
| ca1384504a | |||
| fc6bb7f056 | |||
| 62cee46a83 | |||
| c94ece2925 | |||
| 5d5882ea5b | |||
| 61fc912c47 | |||
| e54bbcd37f | |||
| c1961c0e40 | |||
| 11c2fcd094 | |||
| b856e7f2c6 | |||
| 7a84d1061b | |||
| 56b50468d2 | |||
| c7057f550f | |||
| 037cda36b2 | |||
| f3de39efd6 | |||
| af5c221385 | |||
| feb74806a8 | |||
| 14ba5a3b77 | |||
| bc8c8e4225 | |||
| dc64ad55ee | |||
| 7e2b4183f6 | |||
| 0a843fa856 | |||
| 5a687f280f | |||
| 4b2e7b9b06 | |||
| 1ac41a72ec | |||
| 6e117efebd | |||
| 17207ddea1 | |||
| 130b1b4f4a | |||
| 8a7981a4ae | |||
| 90513b06f5 | |||
| 750fc84592 | |||
| 2a43491792 | |||
| f4331f4498 | |||
| 0d1544c3d6 | |||
| 958672dfd3 | |||
| 7355fd9ebe | |||
| 5df26f9b0a | |||
| a587b72c71 | |||
| 0b0b55619b | |||
| a760a7575a | |||
| a86f0e6178 | |||
| 577c193661 | |||
| f147a0ff02 | |||
| 0745ec1502 | |||
| 5bed0482b6 | |||
| 9731727095 | |||
| 769fb13282 | |||
| a9e1283a17 | |||
| 5bb94c4b4e | |||
| 67a113cbf4 | |||
| d0eed67c42 | |||
| 9cc542aea9 | |||
| 725ca04ac8 | |||
| e07dcf2598 | |||
| 712e415f4d | |||
| c8551367cb | |||
| 5c820d49a6 | |||
| 9f12b6a084 | |||
| 187ab53c18 | |||
| e35de90806 | |||
| 800100c0cc | |||
| fbd79fc943 | |||
| 7e6d142c1f | |||
| da17603be1 | |||
| 34530b209f | |||
| 760e2fca01 | |||
| d1e977b85a | |||
| 21cc1e9aec | |||
| 346090ebff | |||
| 40ca02481d | |||
| b39944b2d7 | |||
| e0fccc8fc9 | |||
| 76968f7d48 | |||
| 5436d54aa0 | |||
| b6f4080b97 | |||
| 09bcb137c4 | |||
| 8ec6b7e03a | |||
| efddda8665 | |||
| 48e6ebe306 | |||
| eb1335405b | |||
| 8a1ffb9014 | |||
| ec4b2f114d | |||
| 9a5edb3db7 | |||
| f0557f8e1c | |||
| 2953b395f2 | |||
| e9050826ec | |||
| 20e7888bd9 | |||
| e93b53ad4c | |||
| 0a3843393d | |||
| 60f403f555 | |||
| cf49920564 | |||
| a955d57c20 | |||
| 63eca44789 | |||
| aaf2c6fbce | |||
| 9a63cbbd6c | |||
| 0aeab1ab7e | |||
| 4c3a5a99df | |||
| 60370b9627 | |||
| df986c7cfe | |||
| a67951fbce | |||
| a3f5dc331d | |||
| af6a3dcccd | |||
| 0f6de6a477 | |||
| 5890d26545 | |||
| 7901b49503 | |||
| 8ea40d4e6d | |||
| 1bdd5886e6 | |||
| 9c71d34761 | |||
| 79a69d7633 | |||
| 27799dc78a | |||
| 4cb19d1aae | |||
| c91113ac95 | |||
| eb5649d0b3 | |||
| f06af97364 | |||
| b1d5812ae2 | |||
| 2e044bf0a3 | |||
| bd418d1422 | |||
| 440bc1a4b4 | |||
| dba7983189 | |||
| 5ff75e7f42 | |||
| 69c95f1f73 | |||
| 30bbc9ad46 | |||
| 059993b064 | |||
| ed612287ee | |||
| ba7b56f5d7 | |||
| 5b5d262d3c | |||
| 9d6608c8f1 | |||
| 28fcd2b8ab | |||
| 7087e86ca5 | |||
| bf32e89e0c | |||
| 7a306cd0f0 | |||
| 95b033bdb8 | |||
| ea4dfdd50c | |||
| 0b87357f3b | |||
| 9c914e7ef5 | |||
| 68e7941c21 | |||
| f761b2e953 | |||
| e03f07bb44 | |||
| 0c830fa564 | |||
| 8ad220701e | |||
| 7087a191c6 | |||
| d1192095d0 | |||
| 348a566f89 | |||
| 9724d118e6 | |||
| b18be5aee8 | |||
| 7dc0039c3b | |||
| 218c76592c | |||
| b5b8865b36 | |||
| a896bb0eff | |||
| 36a3d655ad | |||
| e12e2f2c7c | |||
| cab5dba7c2 | |||
| b25b3321f9 | |||
| 4e3c196664 | |||
| 27735a8821 | |||
| 6800559596 | |||
| 47d6682098 | |||
| def6b4ff50 | |||
| d9ea718d51 | |||
| cf7571d3a6 | |||
| 21982a1d51 | |||
| 87adb5e0ca | |||
| dfca1386ac | |||
| 03e36736c2 | |||
| 644cfee086 | |||
| c346dbaff6 | |||
| fc458e571b | |||
| d61983efdf | |||
| 07f1c5774e | |||
| f96e4ebd4c | |||
| de0e1627c7 | |||
| 46a02b25da | |||
| 3095af4a8e | |||
| 20c35fd0bb | |||
| b39e617e96 | |||
| 93bd9120cc | |||
| 2171e668fe | |||
| 103c61d936 | |||
| f4d882606a | |||
| b56aba3cc2 | |||
| 377e4c06a1 | |||
| 58911cd10e | |||
| 9264e7bdc4 | |||
| 78143cbd1c | |||
| 01f00cfe51 | |||
| b492ac4950 | |||
| bdc0619016 | |||
| 273d838a42 | |||
| 0db075cb13 | |||
| a6586b5919 | |||
| 485b34b66e | |||
| e9e04e86da | |||
| 73d4c65daf | |||
| 3ecfff94ef | |||
| 22ea008bb4 | |||
| 86c620df3d | |||
| 49a8b7b83c | |||
| 6bfa5837c5 | |||
| f3e7f06dc5 | |||
| 0074e1abcc | |||
| 3f5dad7789 | |||
| a365cdc2cc | |||
| 2aac977d57 | |||
| 5aff3d9380 | |||
| a1c6ea798a | |||
| e0bf6ee390 | |||
| 93fe9a2799 | |||
| 611f59b507 | |||
| 899e543173 | |||
| 132f17b0af | |||
| 5568f7fc5f | |||
| d35f8e6244 | |||
| 6a2016685e | |||
| 567ad6c3bb | |||
| 4b68efb80b | |||
| ccc20cbf18 | |||
| fd9cf29459 | |||
| b9e3dd10b4 | |||
| 75c073ee51 | |||
| 0fcf33ed8c | |||
| 0cf3ae95d4 | |||
| 78e0af383d | |||
| 8bedaf7439 | |||
| 032d79593a | |||
| f152841e81 | |||
| e66ea4dcd1 | |||
| c513007b36 | |||
| 43af451709 | |||
| 9122b49ecc | |||
| 35f97cceb7 | |||
| 6c3d9048cf | |||
| 2507c1aa70 | |||
| 679b9f6def | |||
| 87cd77b4df | |||
| d235ae19dc | |||
| ed02d7daae | |||
| 4af635df28 | |||
| a6d4b30df8 | |||
| 4a51ff9ba5 | |||
| 22be076504 | |||
| b85e9bb97f | |||
| 5eedd7810f | |||
| 1ba798a35d | |||
| fc22c3884b | |||
| 0dc2a0ffac | |||
| ae91f829e1 | |||
| 2645acd827 |
@@ -0,0 +1,31 @@
|
||||
#### Expected Behavior (or desired behavior if a feature request)
|
||||
|
||||
(what you expect to happen goes here)
|
||||
|
||||
-----
|
||||
|
||||
#### Actual Behavior
|
||||
|
||||
(what actually happens goes here)
|
||||
|
||||
-----
|
||||
|
||||
#### Please confirm you have done the following before posting your bug report:
|
||||
|
||||
- [ ] I have enabled debug mode
|
||||
- [ ] I have read [checked the Common Issues page](http://docs.snipeitapp.com/common-issues.html)
|
||||
|
||||
-----
|
||||
#### Please provide answers to these questions before posting your bug report:
|
||||
|
||||
- Version of Snipe-IT you're running
|
||||
- What OS and web server you're running Snipe-IT on
|
||||
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)
|
||||
- If you're getting an error in your browser, include that error
|
||||
- What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error
|
||||
- If a stacktrace is provided in the error, include that too.
|
||||
- Any errors that appear in your browser's error console.
|
||||
- Confirm whether the error is [reproduceable on the demo](https://snipeitapp.com/demo).
|
||||
- Include any additional information you can find in `app/storage/logs` and your webserver's logs.
|
||||
- Include what you've done so far in the installation, and if you got any error messages along the way.
|
||||
- Indicate whether or not you've manually edited any data directly in the database
|
||||
+3
-5
@@ -10,6 +10,7 @@ composer.phar
|
||||
/app/config/*/session.php
|
||||
/app/config/*/database.php
|
||||
/app/config/*/app.php
|
||||
/app/config/*/ldap.php
|
||||
public/packages/*
|
||||
public/uploads/models/*
|
||||
public/uploads/avatars/*
|
||||
@@ -25,10 +26,7 @@ public/uploads/logo.png
|
||||
public/assets/.siteflow
|
||||
app/config/local/session.php
|
||||
.couscous
|
||||
app/storage/dumps/*
|
||||
tests/_support/_generated/*
|
||||
tests/_data/scenarios
|
||||
nbproject/*
|
||||
app/config/local/ldap.php
|
||||
app/storage/dumps/*
|
||||
app/config/packages/schickling/backup/config.php
|
||||
app/config/app.backup.php
|
||||
public/uploads/assets/*
|
||||
|
||||
+814
-889
File diff suppressed because it is too large
Load Diff
+2
-26
@@ -1,31 +1,7 @@
|
||||
# Contribution Guidelines
|
||||
|
||||
**Before opening an issue to report a bug or request help, make sure you've checked the [Common Issues](http://snipeitapp.com/documentation/common-issues/) and [Getting Help](http://snipeitapp.com/documentation/getting-help/) pages.**
|
||||
**Before opening an issue to report a bug or request help, make sure you've checked the [Common Issues](http://docs.snipeitapp.com/common-issues.html) and [Getting Help](http://docs.snipeitapp.com/getting-help.html) pages.**
|
||||
|
||||
## Developing on Snipe-IT
|
||||
|
||||
Please submit all pull requests to the [snipe/snipe-it](http://github.com/snipe/snipe-it) repository in the `develop` branch!
|
||||
|
||||
**As you're working on bug-fixes or features, please break them out into their own feature branches and open the pull request against your feature branch**. It makes it _much_ easier to decipher down the road, as you open multiple pull requests over time, and makes it much easier for me to approve pull requests quickly.
|
||||
|
||||
If you don't have a feature in mind, but would like to contribute back to the project, check out the [open issues](https://github.com/snipe/snipe-it/issues?state=open) and see if there are any you can tackle.
|
||||
|
||||
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)
|
||||
|
||||
The labels we use in GitHub Issues and Waffle.io indicate whether we've confirmed an issue as a bug, whether we're considering the issue as a potential feature, and whether it's ready for someone to work on it. We also provide labels such as "n00b", "intermediate" and "advanced" for the experience level we think it requires for contributors who want to help.
|
||||
|
||||
-----
|
||||
|
||||
## Translations!
|
||||
|
||||
If you're not a coder but want to give back to the project and you're fluent in other languages, that's okay too. We use [CrowdIn](https://crowdin.com) to manage translations, and it makes it super-simple for you to add translations (or validate proposed translations) to the project without messing with code. __Check out [the Snipe-IT CrowdIn translation project here](https://crowdin.com/project/snipe-it/)__.
|
||||
|
||||
Thanks!
|
||||
|
||||
-----
|
||||
|
||||
## Contributor Code of Conduct
|
||||
|
||||
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.
|
||||
Please see the [Contributing guidelines in the documentation](http://docs.snipeitapp.com/contributing.html).
|
||||
|
||||
+27
-3
@@ -1,4 +1,4 @@
|
||||
FROM ubuntu
|
||||
FROM ubuntu:trusty
|
||||
MAINTAINER Brady Wetherington <uberbrady@gmail.com>
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
@@ -12,7 +12,8 @@ php5-gd \
|
||||
patch \
|
||||
curl \
|
||||
vim \
|
||||
git
|
||||
git \
|
||||
mysql-client
|
||||
|
||||
RUN php5enmod mcrypt
|
||||
RUN php5enmod gd
|
||||
@@ -27,6 +28,14 @@ RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvars
|
||||
|
||||
COPY docker/000-default.conf /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
#SSL
|
||||
RUN mkdir -p /var/lib/snipeit/ssl
|
||||
COPY docker/001-default-ssl.conf /etc/apache2/sites-enabled/001-default-ssl.conf
|
||||
#COPY docker/001-default-ssl.conf /etc/apache2/sites-available/001-default-ssl.conf
|
||||
|
||||
RUN a2enmod ssl
|
||||
#RUN a2ensite 001-default-ssl.conf
|
||||
|
||||
COPY . /var/www/html
|
||||
|
||||
RUN a2enmod rewrite
|
||||
@@ -43,6 +52,13 @@ COPY docker/*.php /var/www/html/app/config/production/
|
||||
|
||||
RUN chown -R docker /var/www/html
|
||||
|
||||
RUN \
|
||||
rm -r "/var/www/html/app/private_uploads" && ln -fs "/var/lib/snipeit/data/private_uploads" "/var/www/html/app/private_uploads" && \
|
||||
rm -r "/var/www/html/public/uploads/avatars" && ln -fs "/var/lib/snipeit/data/uploads/avatars" "/var/www/html/public/uploads/avatars" && \
|
||||
rm -r "/var/www/html/public/uploads/models" && ln -fs "/var/lib/snipeit/data/uploads/models" "/var/www/html/public/uploads/models" && \
|
||||
rm -r "/var/www/html/public/uploads/suppliers" && ln -fs "/var/lib/snipeit/data/uploads/suppliers" "/var/www/html/public/uploads/suppliers" && \
|
||||
rm -r "/var/www/html/app/storage/dumps" && ln -fs "/var/lib/snipeit/dumps" "/var/www/html/app/storage/dumps"
|
||||
|
||||
############## DEPENDENCIES via COMPOSER ###################
|
||||
|
||||
#global install of composer
|
||||
@@ -60,8 +76,16 @@ RUN cd /var/www/html;composer install
|
||||
#RUN chmod +x /tmp/app_install.exp
|
||||
#RUN /tmp/app_install.exp
|
||||
|
||||
############### DATA VOLUME #################
|
||||
|
||||
VOLUME [/var/lib/snipeit]
|
||||
|
||||
##### START SERVER
|
||||
|
||||
CMD . /etc/apache2/envvars ;apache2 -DFOREGROUND
|
||||
COPY docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[](https://pledgie.com/campaigns/22899) [](https://travis-ci.org/snipe/snipe-it) [](http://waffle.io/snipe/snipe-it) [](http://stillmaintained.com/snipe/snipe-it) [](https://crowdin.com/project/snipe-it)
|
||||
[](https://travis-ci.org/snipe/snipe-it) [](http://waffle.io/snipe/snipe-it) []() [](https://crowdin.com/project/snipe-it)
|
||||
[](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://hub.docker.com/r/snipe/snipe-it/)
|
||||
[](https://twitter.com/snipeyhead)
|
||||
|
||||
|
||||
## Snipe-IT - Asset Management For the Rest of Us
|
||||
|
||||
[](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
This is a FOSS project for asset management in IT Operations. Knowing who has which laptop, when it was purchased in order to depreciate it correctly, handling software licenses, etc.
|
||||
|
||||
It is built on [Laravel 4.2](http://laravel.com) and uses the [Sentry 2](https://github.com/cartalyst/sentry) package.
|
||||
|
||||
+29
-17
@@ -32,7 +32,7 @@ class AppCommand extends Command
|
||||
'password' => null
|
||||
);
|
||||
|
||||
protected $dummyData = true;
|
||||
protected $dummyData = false;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
@@ -70,7 +70,7 @@ class AppCommand extends Command
|
||||
$this->askUserEmail();
|
||||
$this->askUserPassword();
|
||||
|
||||
$this->askUserDummyData();
|
||||
$this->askUserDummyData();
|
||||
|
||||
$this->comment('');
|
||||
$this->comment('');
|
||||
@@ -222,12 +222,23 @@ class AppCommand extends Command
|
||||
{
|
||||
do {
|
||||
// Ask the user to input the user password
|
||||
$password = $this->ask('Please enter your user password (at least 8 characters): ');
|
||||
$password = $this->secret('Please enter your user password (at least 8 characters): ');
|
||||
$password1 = $this->secret('Please confirm your user password: ');
|
||||
|
||||
// Check if password is valid
|
||||
if ($password == '') {
|
||||
if ($password == '' || $password1 == '') {
|
||||
// Return an error message
|
||||
$this->error('Password is invalid. Please try again.');
|
||||
$password = '';
|
||||
$password1 = '';
|
||||
}
|
||||
else{
|
||||
// Verify the user password
|
||||
if ($password != $password1){
|
||||
$this->error('Password do not match. Please try again.');
|
||||
$password = '';
|
||||
$password1 = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Store the password
|
||||
@@ -235,19 +246,18 @@ class AppCommand extends Command
|
||||
} while( ! $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asks the user to create dummy data
|
||||
*
|
||||
* @return void
|
||||
* @todo Use the Laravel Validator
|
||||
*/
|
||||
protected function askUserDummyData()
|
||||
{
|
||||
// Ask the user to input the user password
|
||||
$dummydata = $this->ask('Do you want to seed your database with dummy data? Y/n (default is yes): ');
|
||||
|
||||
$this->dummyData = ( strstr($dummydata, 'Y' ) || empty($dummydata) ) ? true : false;
|
||||
}
|
||||
/**
|
||||
* Asks the user to create dummy data
|
||||
*
|
||||
* @return void
|
||||
* @todo Use the Laravel Validator
|
||||
*/
|
||||
protected function askUserDummyData()
|
||||
{
|
||||
// Ask the user to input the user password
|
||||
$dummydata = $this->ask('Do you want to seed your database with dummy data? y/N (default is no): ');
|
||||
$this->dummyData = (strstr($dummydata, 'y' )) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs all the necessary Sentry commands.
|
||||
@@ -349,6 +359,8 @@ class AppCommand extends Command
|
||||
'permissions' => array(
|
||||
'admin' => 1,
|
||||
'user' => 1,
|
||||
'superuser' => 1,
|
||||
'reports' => 1,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class AssetImportCommand extends Command {
|
||||
|
||||
// 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
|
||||
|
||||
@@ -77,7 +77,7 @@ class AssetImportCommand extends Command {
|
||||
$user_email = '';
|
||||
}
|
||||
|
||||
// User's email
|
||||
// User's username
|
||||
if (array_key_exists('2',$row)) {
|
||||
$user_username = trim($row[2]);
|
||||
} else {
|
||||
@@ -98,23 +98,24 @@ class AssetImportCommand extends Command {
|
||||
$user_asset_category = '';
|
||||
}
|
||||
|
||||
// Asset Name
|
||||
// Asset Model
|
||||
if (array_key_exists('5',$row)) {
|
||||
$user_asset_name = trim($row[5]);
|
||||
$user_asset_model = substr(trim($row[5]), 0, 254);
|
||||
} else {
|
||||
$user_asset_name = '';
|
||||
$user_asset_model = '';
|
||||
}
|
||||
|
||||
// Asset Manufacturer
|
||||
if (array_key_exists('6',$row)) {
|
||||
$user_asset_mfgr = trim($row[6]);
|
||||
$user_asset_mfgr = substr(trim($row[6]), 0, 254);
|
||||
} else {
|
||||
$user_asset_mfgr = '';
|
||||
}
|
||||
|
||||
// Asset model number
|
||||
if (array_key_exists('7',$row)) {
|
||||
$user_asset_modelno = trim($row[7]);
|
||||
$user_asset_modelno = substr(trim($row[7]), 0, 254);
|
||||
//$user_asset_modelno = trim($row[7]);
|
||||
} else {
|
||||
$user_asset_modelno = '';
|
||||
}
|
||||
@@ -169,6 +170,51 @@ class AssetImportCommand extends Command {
|
||||
$user_asset_purchase_cost = '';
|
||||
}
|
||||
|
||||
// Asset Company Name
|
||||
if (array_key_exists('14',$row)) {
|
||||
if ($row[14]!='') {
|
||||
$user_asset_company_name = trim($row[14]);
|
||||
} else {
|
||||
$user_asset_company_name= '';
|
||||
}
|
||||
} else {
|
||||
$user_asset_company_name = '';
|
||||
}
|
||||
|
||||
// Asset Status Name
|
||||
if (array_key_exists('15',$row)) {
|
||||
if ($row[15]!='') {
|
||||
$user_asset_status = trim($row[15]);
|
||||
} else {
|
||||
$user_asset_status= '';
|
||||
}
|
||||
} else {
|
||||
$user_asset_status = '';
|
||||
}
|
||||
|
||||
// Asset Warranty Months
|
||||
if (array_key_exists('16',$row)) {
|
||||
if ($row[16]!='') {
|
||||
$user_asset_warranty = intval($row[16]);
|
||||
} else {
|
||||
$user_asset_warranty= NULL;
|
||||
}
|
||||
} else {
|
||||
$user_asset_warranty = NULL;
|
||||
}
|
||||
|
||||
// Asset Supplier
|
||||
if (array_key_exists('17',$row)) {
|
||||
if ($row[17]!='') {
|
||||
$user_asset_supplier = trim($row[17]);
|
||||
} else {
|
||||
$user_asset_supplier= '';
|
||||
}
|
||||
} else {
|
||||
$user_asset_supplier = '';
|
||||
}
|
||||
|
||||
|
||||
// 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');
|
||||
@@ -179,7 +225,7 @@ class AssetImportCommand extends Command {
|
||||
$this->comment('No user data provided - skipping user creation, just adding asset');
|
||||
$first_name = '';
|
||||
$last_name = '';
|
||||
$user_username = '';
|
||||
//$user_username = '';
|
||||
|
||||
} else {
|
||||
$user_email_array = User::generateFormattedNameFromFullName($this->option('email_format'), $user_name);
|
||||
@@ -208,7 +254,7 @@ class AssetImportCommand extends Command {
|
||||
$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('Item: '.$user_asset_model);
|
||||
$this->comment('Manufacturer ID: '.$user_asset_mfgr);
|
||||
$this->comment('Model No: '.$user_asset_modelno);
|
||||
$this->comment('Serial No: '.$user_asset_serial);
|
||||
@@ -216,8 +262,11 @@ class AssetImportCommand extends Command {
|
||||
$this->comment('Location: '.$user_asset_location);
|
||||
$this->comment('Purchase Date: '.$user_asset_purchase_date);
|
||||
$this->comment('Purchase Cost: '.$user_asset_purchase_cost);
|
||||
$this->comment('Status: '.$user_asset_status);
|
||||
$this->comment('Supplier: '.$user_asset_supplier);
|
||||
$this->comment('Warranty Months: '.$user_asset_warranty);
|
||||
$this->comment('Notes: '.$user_asset_notes);
|
||||
|
||||
$this->comment('Company Name: '.$user_asset_company_name);
|
||||
$this->comment('------------- Action Summary ----------------');
|
||||
|
||||
if ($user_username!='') {
|
||||
@@ -252,13 +301,15 @@ class AssetImportCommand extends Command {
|
||||
}
|
||||
|
||||
// Check for the location match and create it if it doesn't exist
|
||||
if ($location = Location::where('name', $user_asset_location)->first()) {
|
||||
if ($location = Location::where('name', e($user_asset_location))->first()) {
|
||||
$this->comment('Location '.$user_asset_location.' already exists');
|
||||
} else {
|
||||
|
||||
$location = new Location();
|
||||
|
||||
if ($user_asset_location!='') {
|
||||
|
||||
$location = new Location();
|
||||
|
||||
$location->name = e($user_asset_location);
|
||||
$location->address = '';
|
||||
$location->city = '';
|
||||
@@ -283,25 +334,32 @@ class AssetImportCommand extends Command {
|
||||
|
||||
}
|
||||
|
||||
if (e($user_asset_category)=='') {
|
||||
$category_name = 'Unnamed Category';
|
||||
} else {
|
||||
$category_name = e($user_asset_category);
|
||||
}
|
||||
|
||||
// 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');
|
||||
if ($category = Category::where('name', e($category_name))->where('category_type', 'asset')->first()) {
|
||||
$this->comment('Category '.$category_name.' already exists');
|
||||
|
||||
} else {
|
||||
$category = new Category();
|
||||
$category->name = e($user_asset_category);
|
||||
$category->name = e($category_name);
|
||||
$category->category_type = 'asset';
|
||||
$category->user_id = 1;
|
||||
|
||||
if ($category->save()) {
|
||||
$this->comment('Category '.$user_asset_category.' was created');
|
||||
} else {
|
||||
} 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()) {
|
||||
if ($manufacturer = Manufacturer::where('name', e($user_asset_mfgr))->first()) {
|
||||
$this->comment('Manufacturer '.$user_asset_mfgr.' already exists');
|
||||
} else {
|
||||
$manufacturer = new Manufacturer();
|
||||
@@ -310,64 +368,134 @@ class AssetImportCommand extends Command {
|
||||
|
||||
if ($manufacturer->save()) {
|
||||
$this->comment('Manufacturer '.$user_asset_mfgr.' was created');
|
||||
} else {
|
||||
} else {
|
||||
$this->comment('Something went wrong! Manufacturer '.$user_asset_mfgr.' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the supplier match and create it if it doesn't exist
|
||||
if ($supplier = Supplier::where('name', e($user_asset_supplier))->first()) {
|
||||
$this->comment('Supplier '.$user_asset_supplier.' already exists');
|
||||
} else {
|
||||
$supplier = new Supplier();
|
||||
$supplier->name = e($user_asset_supplier);
|
||||
$supplier->user_id = 1;
|
||||
|
||||
if ($supplier->save()) {
|
||||
$this->comment('Supplier '.$user_asset_supplier.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Supplier '.$user_asset_supplier.' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($user_asset_status=='') {
|
||||
$user_asset_status = 'Unspecified Status';
|
||||
}
|
||||
// Check for the status label match and create it if it doesn't exist
|
||||
if ($statuslabel = Statuslabel::where('name', e($user_asset_status))->first()) {
|
||||
$this->comment('Status Label '.$user_asset_status.' already exists');
|
||||
} else {
|
||||
|
||||
$statuslabel = new Statuslabel();
|
||||
$statuslabel->name = e($user_asset_status);
|
||||
$statuslabel->user_id = 1;
|
||||
$statuslabel->deployable = 1;
|
||||
|
||||
if ($statuslabel->save()) {
|
||||
$this->comment('Status Label '.$user_asset_status.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Status Label '.$user_asset_status.' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
$status_id = $statuslabel->id;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 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');
|
||||
if ($asset_model = Model::where('name', e($user_asset_model ))->where('modelno', e($user_asset_modelno))->where('category_id', $category->id)->where('manufacturer_id', $manufacturer->id)->first()) {
|
||||
$this->comment('The Asset Model '.$user_asset_model .' with model number '.$user_asset_modelno.' already exists');
|
||||
} else {
|
||||
$asset_model = new Model();
|
||||
$asset_model->name = e($user_asset_name);
|
||||
$asset_model->name = e($user_asset_model );
|
||||
$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');
|
||||
$this->comment('Asset Model '.$user_asset_model .' with model number '.$user_asset_modelno.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Asset Model '.$user_asset_model .' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for the asset company match and create it if it doesn't exist
|
||||
if ($user_asset_company_name!='') {
|
||||
if ($company = Company::where('name', e($user_asset_company_name))->first()) {
|
||||
$this->comment('Company '.$user_asset_company_name.' already exists');
|
||||
} else {
|
||||
$company = new Company();
|
||||
$company->name = e($user_asset_company_name);
|
||||
|
||||
if ($company->save()) {
|
||||
$this->comment('Company '.$user_asset_company_name.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Company '.$user_asset_company_name.' was NOT created');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$company = new Company();
|
||||
}
|
||||
|
||||
// Check for the asset match and create it if it doesn't exist
|
||||
if ($asset = Asset::where('asset_tag', e($user_asset_tag))->first()) {
|
||||
$this->comment('The Asset with asset tag '.$user_asset_tag.' already exists');
|
||||
} else {
|
||||
$asset = new Asset();
|
||||
$asset->name = e($user_asset_asset_name);
|
||||
if ($user_asset_purchase_date!='') {
|
||||
$asset->purchase_date = $user_asset_purchase_date;
|
||||
} else {
|
||||
$asset->purchase_date = NULL;
|
||||
}
|
||||
if ($user_asset_purchase_cost!='') {
|
||||
$asset->purchase_cost = ParseFloat(e($user_asset_purchase_cost));
|
||||
} else {
|
||||
$asset->purchase_cost = '0.00';
|
||||
}
|
||||
$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;
|
||||
$asset->warranty_months = $user_asset_warranty;
|
||||
$asset->company_id = $company->id;
|
||||
if ($user_asset_purchase_date!='') {
|
||||
$asset->purchase_date = $user_asset_purchase_date;
|
||||
} else {
|
||||
$asset->purchase_date = NULL;
|
||||
}
|
||||
$asset->notes = e($user_asset_notes);
|
||||
|
||||
$asset = new Asset();
|
||||
$asset->name = e($user_asset_asset_name);
|
||||
if ($user_asset_purchase_date!='') {
|
||||
$asset->purchase_date = $user_asset_purchase_date;
|
||||
} else {
|
||||
$asset->purchase_date = NULL;
|
||||
}
|
||||
if ($user_asset_purchase_cost!='') {
|
||||
$asset->purchase_cost = ParseFloat(e($user_asset_purchase_cost));
|
||||
} else {
|
||||
$asset->purchase_cost = 0.00;
|
||||
}
|
||||
$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_model .' with serial number '.$user_asset_serial.' was created');
|
||||
} else {
|
||||
$this->comment('Something went wrong! Asset '.$user_asset_model .' was NOT created');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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('=====================================');
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ return array(
|
||||
| Application Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale ties into the languaage files in app/lang, which contain the
|
||||
| This locale ties into the language files in app/lang, which contain the
|
||||
| language files for each translation.
|
||||
|
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ return array(
|
||||
array(
|
||||
'permission' => 'superuser',
|
||||
'label' => 'Super User',
|
||||
'note' => 'Determines whether the user has full access to all aspects of the admin. ',
|
||||
),
|
||||
),
|
||||
|
||||
@@ -13,6 +14,7 @@ return array(
|
||||
array(
|
||||
'permission' => 'admin',
|
||||
'label' => 'Admin Rights',
|
||||
'note' => 'Determines whether the user has access to most aspects of the admin.',
|
||||
),
|
||||
),
|
||||
|
||||
@@ -20,6 +22,15 @@ return array(
|
||||
array(
|
||||
'permission' => 'reports',
|
||||
'label' => 'View Reports',
|
||||
'note' => 'Determines whether the user has the abiity to view reports.',
|
||||
),
|
||||
),
|
||||
|
||||
'Licenses' => array(
|
||||
array(
|
||||
'permission' => 'license_keys',
|
||||
'label' => 'View License Keys',
|
||||
'note' => 'Determines whether the user has the ability to view the license keys assigned to them in their own profile. (Usually granted for lower-level permissions that wouldn\'t normally have access.)',
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
return array (
|
||||
'app_version' => 'v2.0-175',
|
||||
'hash_version' => 'v2.0-175-gd0aab3e',
|
||||
);
|
||||
'app_version' => 'v2.1.1',
|
||||
'hash_version' => 'v2.1.1-55-g701c16f',
|
||||
);
|
||||
|
||||
@@ -14,6 +14,8 @@ class AdminController extends AuthorizedController
|
||||
// Apply the admin auth filter
|
||||
//$this->beforeFilter('admin-auth', array('except' => $this->whitelist));
|
||||
|
||||
// CSRF Protection
|
||||
$this->beforeFilter('csrf', array('on' => 'post'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,34 +22,46 @@ class AuthController extends BaseController
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @param $username
|
||||
* @param $password
|
||||
* @param bool|false $returnUser
|
||||
* @return bool true if the username and/or password provided are valid
|
||||
* false if the username and/or password provided are invalid
|
||||
* array of ldap_attributes if $returnUser is true
|
||||
*/
|
||||
function ldap($username, $password) {
|
||||
function ldap($username, $password, $returnUser = false) {
|
||||
|
||||
$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;
|
||||
$ldapversion = Config::get('ldap.version');
|
||||
$ldaphost = Setting::getSettings()->ldap_server;
|
||||
$ldaprdn = Setting::getSettings()->ldap_uname;
|
||||
$ldappass = Crypt::decrypt(Setting::getSettings()->ldap_pword);
|
||||
$baseDn = Setting::getSettings()->ldap_basedn;
|
||||
$filterQuery = Setting::getSettings()->ldap_auth_filter_query . $username;
|
||||
$ldapversion = Setting::getSettings()->ldap_version;
|
||||
$ldap_server_cert_ignore = Setting::getSettings()->ldap_server_cert_ignore;
|
||||
|
||||
// Connecting to LDAP
|
||||
$connection = ldap_connect($ldaphost) or die("Could not connect to {$ldaphost}");
|
||||
// Needed for AD
|
||||
ldap_set_option($connection, LDAP_OPT_REFERRALS, 0);
|
||||
ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION,$ldapversion);
|
||||
// If we are ignoring the SSL cert we need to setup the environment variable
|
||||
// before we create the connection
|
||||
if($ldap_server_cert_ignore) {
|
||||
putenv('LDAPTLS_REQCERT=never');
|
||||
}
|
||||
|
||||
// Connecting to LDAP
|
||||
$connection = ldap_connect($ldaphost) or die("Could not connect to {$ldaphost}");
|
||||
// Needed for AD
|
||||
ldap_set_option($connection, LDAP_OPT_REFERRALS, 0);
|
||||
ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION,$ldapversion);
|
||||
|
||||
try {
|
||||
if ($connection) {
|
||||
// binding to ldap server
|
||||
$ldapbind = ldap_bind($connection, $ldaprdn, $ldappass);
|
||||
if ( ($results = @ldap_search($connection, $baseDn, $filterQuery)) !==false ) {
|
||||
if ( ($results = @ldap_search($connection, $baseDn, $filterQuery)) != false ) {
|
||||
$entry = ldap_first_entry($connection, $results);
|
||||
if ( ($userDn = @ldap_get_dn($connection, $entry)) !== false ) {
|
||||
if ( ($userDn = @ldap_get_dn($connection, $entry)) != false ) {
|
||||
if( ($isBound = ldap_bind($connection, $userDn, $password)) == "true") {
|
||||
return true;
|
||||
return $returnUser ?
|
||||
array_change_key_case(ldap_get_attributes($connection, $entry),CASE_LOWER)
|
||||
: true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +73,66 @@ class AuthController extends BaseController
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create user from LDAP attributes
|
||||
*
|
||||
* @param $ldapatttibutes
|
||||
* @return array|bool
|
||||
*/
|
||||
function createUserFromLdap($ldapatttibutes){
|
||||
//Get LDAP attribute config
|
||||
$ldap_result_username = Setting::getSettings()->ldap_username_field;
|
||||
$ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
|
||||
$ldap_result_last_name = Setting::getSettings()->ldap_lname_field;
|
||||
$ldap_result_first_name = Setting::getSettings()->ldap_fname_field;
|
||||
$ldap_result_email = Setting::getSettings()->ldap_email;
|
||||
|
||||
//Get LDAP user data
|
||||
$item = array();
|
||||
$item["username"] = isset( $ldapatttibutes[$ldap_result_username][0] ) ? $ldapatttibutes[$ldap_result_username][0] : "";
|
||||
$item["employee_number"] = isset( $ldapatttibutes[$ldap_result_emp_num][0] ) ? $ldapatttibutes[$ldap_result_emp_num][0] : "";
|
||||
$item["lastname"] = isset( $ldapatttibutes[$ldap_result_last_name][0] ) ? $ldapatttibutes[$ldap_result_last_name][0] : "";
|
||||
$item["firstname"] = isset( $ldapatttibutes[$ldap_result_first_name][0] ) ? $ldapatttibutes[$ldap_result_first_name][0] : "";
|
||||
$item["email"] = isset( $ldapatttibutes[$ldap_result_email][0] ) ? $ldapatttibutes[$ldap_result_email][0] : "" ;
|
||||
|
||||
//create user
|
||||
if(!empty($item["username"])) {
|
||||
//$pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10);
|
||||
|
||||
$newuser = array(
|
||||
'first_name' => $item["firstname"],
|
||||
'last_name' => $item["lastname"],
|
||||
'username' => $item["username"],
|
||||
'email' => $item["email"],
|
||||
'employee_num' => $item["employee_number"],
|
||||
'password' => Input::get("password"), //$pass,
|
||||
'activated' => 1,
|
||||
'location_id' => null,
|
||||
'permissions' => ["user" => 1], //'{"user":1}',
|
||||
'notes' => 'Imported from LDAP'
|
||||
);
|
||||
Sentry::createUser($newuser);
|
||||
/*DB::table('users')->insert($newuser);
|
||||
$updateuser = Sentry::findUserByLogin($item["username"]);
|
||||
$updateuser->setHasher(new Cartalyst\Sentry\Hashing\BcryptHasher);
|
||||
|
||||
// Update the user details
|
||||
$updateuser->password = Input::get('password');
|
||||
|
||||
// Update the user
|
||||
$updateuser->save(); */
|
||||
} else {
|
||||
throw new Cartalyst\Sentry\Users\UserNotFoundException();
|
||||
}
|
||||
|
||||
//$item["note"] = "<strong>created</strong>";
|
||||
$credentials = array(
|
||||
'username' => $item["username"],
|
||||
'password' => Input::get("password")//$pass,
|
||||
);
|
||||
return $credentials;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Account sign in form processing.
|
||||
@@ -83,40 +155,54 @@ class AuthController extends BaseController
|
||||
// Ooops.. something went wrong
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
* Hack in LDAP authentication
|
||||
*/
|
||||
// Should we even check for LDAP users?
|
||||
if (Setting::getSettings()->ldap_enabled=='1') {
|
||||
|
||||
// Try to get the user from the database.
|
||||
$user = (array) DB::table('users')->where('username', Input::get('username'))->first();
|
||||
LOG::debug("LDAP is enabled.");
|
||||
// Check if the user exists in the database
|
||||
$user = User::where('username','=',Input::get('username'))->whereNull('deleted_at')->first();
|
||||
LOG::debug("Sentry lookup complete");
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// The user does not exist in the database. Try to get them from LDAP.
|
||||
// If user does not exist and authenticates sucessfully with LDAP we
|
||||
// will create it on the fly and sign in with default permissions
|
||||
if(!$user){
|
||||
LOG::debug("Local user ".Input::get('username')." does not exist");
|
||||
if($userattr = $this->ldap(Input::get('username'), Input::get('password'),true) ){
|
||||
LOG::debug("Creating local user from authenticated LDAP user.");
|
||||
$credentials = $this->createUserFromLdap($userattr);
|
||||
} else {
|
||||
LOG::debug("User did not authenticate correctly against LDAP. No local user was created.");
|
||||
}
|
||||
|
||||
// If the user exists and they were imported from LDAP already
|
||||
} else {
|
||||
|
||||
LOG::debug("Local user ".Input::get('username')." exists in database. Authenticating existing user against LDAP.");
|
||||
|
||||
if ($this->ldap(Input::get('username'), Input::get('password')) ) {
|
||||
LOG::debug("Valid LDAP login. Updating the local data.");
|
||||
$sentryuser=Sentry::findUserById($user->id); //need the Sentry object, not the Eloquent object, to access critical password hashing functions
|
||||
$sentryuser->password = Input::get('password');
|
||||
$sentryuser->save();
|
||||
|
||||
} else {
|
||||
LOG::debug("User did not authenticate correctly against LDAP. Local user was not updated.");
|
||||
}// End LDAP auth
|
||||
|
||||
} // End if(!user)
|
||||
|
||||
// NO LDAP enabled - just try to login the user normally
|
||||
}
|
||||
/* ============================================================== */
|
||||
else {
|
||||
LOG::debug("Authenticating user against database.");
|
||||
// Try to log the user in
|
||||
Sentry::authenticate(Input::only('username', 'password'), Input::get('remember-me', 0));
|
||||
|
||||
LOG::debug("Authenticating user against database.");
|
||||
// Try to log the user in
|
||||
if (!Sentry::authenticate(Input::only('username', 'password'), Input::get('remember-me', 0))) {
|
||||
LOG::debug("Local authentication failed.");
|
||||
throw new Cartalyst\Sentry\Users\UserNotFoundException();
|
||||
}
|
||||
|
||||
// Get the page we were before
|
||||
@@ -127,13 +213,25 @@ class AuthController extends BaseController
|
||||
|
||||
// Redirect to the users page
|
||||
return Redirect::to($redirect)->with('success', Lang::get('auth/message.signin.success'));
|
||||
|
||||
} catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
|
||||
LOG::debug("Local authentication: User ".Input::get('username')." not found");
|
||||
$this->messageBag->add('username', Lang::get('auth/message.account_not_found'));
|
||||
|
||||
} catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
|
||||
LOG::debug("Local authentication: Password for ".Input::get('username')." is incorrect.");
|
||||
$this->messageBag->add('username', Lang::get('auth/message.account_not_found'));
|
||||
|
||||
} catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
|
||||
LOG::debug("Local authentication: User not activated");
|
||||
$this->messageBag->add('username', Lang::get('auth/message.account_not_activated'));
|
||||
|
||||
} catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
|
||||
LOG::debug("Local authentication: Account suspended");
|
||||
$this->messageBag->add('username', Lang::get('auth/message.account_suspended'));
|
||||
|
||||
} catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
|
||||
LOG::debug("Local authentication: Account banned.");
|
||||
$this->messageBag->add('username', Lang::get('auth/message.account_banned'));
|
||||
}
|
||||
|
||||
@@ -234,6 +332,7 @@ class AuthController extends BaseController
|
||||
}
|
||||
|
||||
} catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
|
||||
return Redirect::route('forgot-password')->withInput()->with('error', $e->getMessage());
|
||||
// Even though the username was not found, we will pretend
|
||||
// we have sent the password reset code through username,
|
||||
// this is a security measure against hackers.
|
||||
|
||||
@@ -20,12 +20,7 @@ class ProfileController extends AuthorizedController
|
||||
{
|
||||
// Get the user information
|
||||
$user = Sentry::getUser();
|
||||
|
||||
// Show the page
|
||||
|
||||
$location_list = array('' => 'Select One') + Location::lists('name', 'id');
|
||||
|
||||
// Show the page
|
||||
$location_list = locationsList();
|
||||
return View::make('frontend/account/profile', compact('user'))->with('location_list',$location_list);
|
||||
}
|
||||
|
||||
@@ -63,7 +58,7 @@ class ProfileController extends AuthorizedController
|
||||
$user->website = Input::get('website');
|
||||
$user->location_id = Input::get('location_id');
|
||||
$user->gravatar = Input::get('gravatar');
|
||||
|
||||
|
||||
if (Input::file('avatar')) {
|
||||
$image = Input::file('avatar');
|
||||
$file_name = $user->first_name."-".$user->last_name.".".$image->getClientOriginalExtension();
|
||||
@@ -75,7 +70,7 @@ class ProfileController extends AuthorizedController
|
||||
if (Input::get('avatar_delete') == 1 && Input::file('avatar') == "") {
|
||||
$user->avatar = NULL;
|
||||
}
|
||||
|
||||
|
||||
$user->save();
|
||||
|
||||
// Redirect to the settings page
|
||||
|
||||
@@ -9,12 +9,16 @@ use Location;
|
||||
use View;
|
||||
use Asset;
|
||||
use Actionlog;
|
||||
use Company;
|
||||
use Lang;
|
||||
use Accessory;
|
||||
use DB;
|
||||
use Slack;
|
||||
use Setting;
|
||||
use Config;
|
||||
use Mail;
|
||||
use User;
|
||||
|
||||
|
||||
class ViewAssetsController extends AuthorizedController
|
||||
{
|
||||
@@ -25,18 +29,22 @@ class ViewAssetsController extends AuthorizedController
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
$user = Sentry::getUser();
|
||||
|
||||
$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find(Sentry::getUser()->id);
|
||||
|
||||
$userlog = $user->userlog->load('assetlog', 'consumablelog', 'assetlog.model', 'licenselog', 'accessorylog', 'userlog', 'adminlog');
|
||||
|
||||
|
||||
if (isset($user->id)) {
|
||||
return View::make('frontend/account/view-assets', compact('user'));
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/users/message.user_not_found', compact('id' ));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
}
|
||||
if (isset($user->id)) {
|
||||
return View::make('frontend/account/view-assets', compact('user', 'userlog'));
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/users/message.user_not_found', compact('id' ));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('error', $error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +52,7 @@ class ViewAssetsController extends AuthorizedController
|
||||
public function getRequestableIndex() {
|
||||
|
||||
$assets = Asset::with('model','defaultLoc')->Hardware()->RequestableAssets()->get();
|
||||
|
||||
return View::make('frontend/account/requestable-assets', compact('user','assets'));
|
||||
}
|
||||
|
||||
@@ -56,49 +65,64 @@ class ViewAssetsController extends AuthorizedController
|
||||
if (is_null($asset = Asset::RequestableAssets()->find($assetId))) {
|
||||
// Redirect to the asset management page
|
||||
return Redirect::route('requestable-assets')->with('error', Lang::get('admin/hardware/message.does_not_exist_or_not_requestable'));
|
||||
} else {
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return Redirect::route('requestable-assets')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else {
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->asset_id = $asset->id;
|
||||
$logaction->asset_type = 'hardware';
|
||||
$logaction->created_at = date("Y-m-d h:i:s");
|
||||
$logaction->asset_id = $data['asset_id'] = $asset->id;
|
||||
$logaction->asset_type = $data['asset_type'] = 'hardware';
|
||||
$logaction->created_at = $data['requested_date'] = date("Y-m-d h:i:s");
|
||||
|
||||
if ($user->location_id) {
|
||||
$logaction->location_id = $user->location_id;
|
||||
}
|
||||
$logaction->user_id = Sentry::getUser()->id;
|
||||
$logaction->user_id = $data['user_id'] = Sentry::getUser()->id;
|
||||
$log = $logaction->logaction('requested');
|
||||
|
||||
$data['requested_by'] = $user->fullName();
|
||||
$data['asset_name'] = $asset->showAssetName();
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
if (($settings->alert_email!='') && ($settings->alerts_enabled=='1') && (!Config::get('app.lock_passwords'))) {
|
||||
Mail::send('emails.asset-requested', $data, function ($m) use ($user, $settings) {
|
||||
$m->to($settings->alert_email, $settings->site_name);
|
||||
$m->subject('Asset Requested');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$slack_settings = [
|
||||
'username' => $settings->botname,
|
||||
'channel' => $settings->slack_channel,
|
||||
'link_names' => true
|
||||
];
|
||||
if ($settings->slack_endpoint) {
|
||||
|
||||
$client = new \Maknz\Slack\Client($settings->slack_endpoint,$slack_settings);
|
||||
|
||||
try {
|
||||
$client->attach([
|
||||
'color' => 'good',
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'REQUESTED:',
|
||||
'value' => strtoupper($logaction->asset_type).' asset <'.Config::get('app.url').'/hardware/'.$asset->id.'/view'.'|'.$asset->showAssetName().'> requested by <'.Config::get('app.url').'/hardware/'.$asset->id.'/view'.'|'.Sentry::getUser()->fullName().'>.'
|
||||
]
|
||||
$slack_settings = [
|
||||
'username' => $settings->botname,
|
||||
'channel' => $settings->slack_channel,
|
||||
'link_names' => true
|
||||
];
|
||||
|
||||
]
|
||||
])->send('Asset Requested');
|
||||
$client = new \Maknz\Slack\Client($settings->slack_endpoint,$slack_settings);
|
||||
|
||||
} catch (Exception $e) {
|
||||
try {
|
||||
$client->attach([
|
||||
'color' => 'good',
|
||||
'fields' => [
|
||||
[
|
||||
'title' => 'REQUESTED:',
|
||||
'value' => strtoupper($logaction->asset_type).' asset <'.Config::get('app.url').'/hardware/'.$asset->id.'/view'.'|'.$asset->showAssetName().'> requested by <'.Config::get('app.url').'/hardware/'.$asset->id.'/view'.'|'.Sentry::getUser()->fullName().'>.'
|
||||
]
|
||||
|
||||
}
|
||||
]
|
||||
])->send('Asset Requested');
|
||||
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Redirect::route('requestable-assets')->with('success')->with('success', Lang::get('admin/hardware/message.requests.success'));
|
||||
}
|
||||
@@ -116,6 +140,12 @@ class ViewAssetsController extends AuthorizedController
|
||||
return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
|
||||
}
|
||||
|
||||
$user = Sentry::getUser();
|
||||
|
||||
if ($user->id != $findlog->checkedout_to) {
|
||||
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.incorrect_user_accepted'));
|
||||
}
|
||||
|
||||
// Asset
|
||||
if (($findlog->asset_id!='') && ($findlog->asset_type=='hardware')) {
|
||||
$item = Asset::find($findlog->asset_id);
|
||||
@@ -133,24 +163,28 @@ class ViewAssetsController extends AuthorizedController
|
||||
// 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);
|
||||
|
||||
|
||||
|
||||
|
||||
else if (!Company::isCurrentUserHasAccess($item)) {
|
||||
return Redirect::route('requestable-assets')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else {
|
||||
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'));
|
||||
}
|
||||
|
||||
// NOTE: make sure the global scope is applied
|
||||
$is_unauthorized = is_null(Actionlog::where('id', '=', $logID)->first());
|
||||
if ($is_unauthorized) {
|
||||
return Redirect::route('requestable-assets')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if ($findlog->accepted_id!='') {
|
||||
// Redirect to the asset management page
|
||||
@@ -162,6 +196,11 @@ class ViewAssetsController extends AuthorizedController
|
||||
}
|
||||
|
||||
$user = Sentry::getUser();
|
||||
|
||||
if ($user->id != $findlog->checkedout_to) {
|
||||
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.incorrect_user_accepted'));
|
||||
}
|
||||
|
||||
$logaction = new Actionlog();
|
||||
|
||||
if (Input::get('asset_acceptance')=='accepted') {
|
||||
@@ -208,11 +247,12 @@ class ViewAssetsController extends AuthorizedController
|
||||
$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();
|
||||
->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', $return_msg);
|
||||
@@ -220,14 +260,5 @@ class ViewAssetsController extends AuthorizedController
|
||||
} else {
|
||||
return Redirect::to('account/view-assets')->with('error', 'Something went wrong ');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ use Validator;
|
||||
use View;
|
||||
use User;
|
||||
use Actionlog;
|
||||
use Company;
|
||||
use Mail;
|
||||
use Datatable;
|
||||
use Slack;
|
||||
@@ -41,7 +42,13 @@ class AccessoriesController extends AdminController
|
||||
{
|
||||
// Show the page
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type','=','accessory')->whereNull('deleted_at')->orderBy('name','ASC')->lists('name', 'id');
|
||||
return View::make('backend/accessories/edit')->with('accessory',new Accessory)->with('category_list',$category_list);
|
||||
$company_list = companyList();
|
||||
$location_list = locationsList();
|
||||
return View::make('backend/accessories/edit')
|
||||
->with('accessory', new Accessory)
|
||||
->with('category_list', $category_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('location_list', $location_list);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +75,22 @@ class AccessoriesController extends AdminController
|
||||
// Update the accessory data
|
||||
$accessory->name = e(Input::get('name'));
|
||||
$accessory->category_id = e(Input::get('category_id'));
|
||||
$accessory->location_id = e(Input::get('location_id'));
|
||||
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$accessory->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$accessory->purchase_date = NULL;
|
||||
} else {
|
||||
$accessory->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$accessory->purchase_cost = NULL;
|
||||
} else {
|
||||
$accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
$accessory->user_id = Sentry::getId();
|
||||
|
||||
@@ -97,9 +120,18 @@ class AccessoriesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.does_not_exist'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type','=','accessory')->whereNull('deleted_at')->orderBy('name','ASC')->lists('name', 'id');
|
||||
return View::make('backend/accessories/edit', compact('accessory'))->with('category_list',$category_list);
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type','=','accessory')->whereNull('deleted_at')->orderBy('name','ASC')->lists('name', 'id');
|
||||
$company_list = companyList();
|
||||
$location_list = locationsList();
|
||||
|
||||
return View::make('backend/accessories/edit', compact('accessory'))
|
||||
->with('category_list',$category_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('location_list', $location_list);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +148,9 @@ class AccessoriesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.does_not_exist'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
|
||||
// get the POST data
|
||||
@@ -135,7 +170,29 @@ class AccessoriesController extends AdminController
|
||||
|
||||
// Update the accessory data
|
||||
$accessory->name = e(Input::get('name'));
|
||||
|
||||
if (e(Input::get('location_id')) == '') {
|
||||
$accessory->location_id = NULL;
|
||||
} else {
|
||||
$accessory->location_id = e(Input::get('location_id'));
|
||||
}
|
||||
|
||||
$accessory->category_id = e(Input::get('category_id'));
|
||||
$accessory->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$accessory->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$accessory->purchase_date = NULL;
|
||||
} else {
|
||||
$accessory->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$accessory->purchase_cost = NULL;
|
||||
} else {
|
||||
$accessory->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$accessory->qty = e(Input::get('qty'));
|
||||
|
||||
// Was the accessory created?
|
||||
@@ -163,6 +220,9 @@ class AccessoriesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
|
||||
if ($accessory->hasUsers() > 0) {
|
||||
@@ -194,7 +254,13 @@ class AccessoriesController extends AdminController
|
||||
$accessory = Accessory::find($accessoryID);
|
||||
|
||||
if (isset($accessory->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else {
|
||||
return View::make('backend/accessories/view', compact('accessory'));
|
||||
}
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/accessories/message.does_not_exist', compact('id'));
|
||||
@@ -216,6 +282,9 @@ class AccessoriesController extends AdminController
|
||||
// Redirect to the accessory management page with error
|
||||
return Redirect::to('accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// 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," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
@@ -234,6 +303,9 @@ class AccessoriesController extends AdminController
|
||||
// Redirect to the accessory management page with error
|
||||
return Redirect::to('accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$admin_user = Sentry::getUser();
|
||||
$assigned_to = e(Input::get('assigned_to'));
|
||||
@@ -360,7 +432,13 @@ class AccessoriesController extends AdminController
|
||||
}
|
||||
|
||||
$accessory = Accessory::find($accessory_user->accessory_id);
|
||||
return View::make('backend/accessories/checkin', compact('accessory'))->with('backto',$backto);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else {
|
||||
return View::make('backend/accessories/checkin', compact('accessory'))->with('backto',$backto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -380,6 +458,11 @@ class AccessoriesController extends AdminController
|
||||
|
||||
|
||||
$accessory = Accessory::find($accessory_user->accessory_id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->checkedout_to = $accessory_user->assigned_to;
|
||||
$return_to = $accessory_user->assigned_to;
|
||||
@@ -465,56 +548,96 @@ class AccessoriesController extends AdminController
|
||||
|
||||
public function getDatatable()
|
||||
{
|
||||
$accessories = Accessory::with('category')
|
||||
->whereNull('deleted_at')
|
||||
->orderBy('created_at', 'DESC');
|
||||
$accessories = Accessory::select('accessories.*')->with('category', 'company')
|
||||
->whereNull('accessories.deleted_at');
|
||||
|
||||
$accessories = $accessories->get();
|
||||
if (Input::has('search')) {
|
||||
$accessories = $accessories->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions',function($accessories)
|
||||
{
|
||||
return '<a href="'.route('checkout/accessory', $accessories->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($accessories->numRemaining() > 0 ) ? '' : ' disabled').'>'.Lang::get('general.checkout').'</a><a href="'.route('update/accessory', $accessories->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/accessory', $accessories->id).'" data-content="'.Lang::get('admin/accessories/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($accessories->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
});
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
return Datatable::collection($accessories)
|
||||
->addColumn('category',function($accessories)
|
||||
{
|
||||
return $accessories->category->name;
|
||||
})
|
||||
->addColumn('name',function($accessories)
|
||||
{
|
||||
return link_to('admin/accessories/'.$accessories->id.'/view', $accessories->name);
|
||||
})
|
||||
->addColumn('qty',function($accessories)
|
||||
{
|
||||
return $accessories->qty;
|
||||
})
|
||||
->addColumn('numRemaining',function($accessories)
|
||||
{
|
||||
return $accessories->numRemaining();
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('category','name','qty','numRemaining','actions')
|
||||
->orderColumns('category','name','qty','numRemaining','actions')
|
||||
->make();
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
|
||||
$allowed_columns = ['name','order_number','purchase_date','purchase_cost','companyName','category'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
switch ($sort)
|
||||
{
|
||||
case 'category':
|
||||
$accessories = $accessories->OrderCategory($order);
|
||||
break;
|
||||
case 'companyName':
|
||||
$accessories = $accessories->OrderCompany($order);
|
||||
break;
|
||||
default:
|
||||
$accessories = $accessories->orderBy($sort, $order);
|
||||
break;
|
||||
}
|
||||
|
||||
$accessCount = $accessories->count();
|
||||
$accessories = $accessories->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($accessories as $accessory) {
|
||||
$actions = '<nobr><a href="'.route('checkout/accessory', $accessory->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($accessory->numRemaining() > 0 ) ? '' : ' disabled').'>'.Lang::get('general.checkout').'</a><a href="'.route('update/accessory', $accessory->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/accessory', $accessory->id).'" data-content="'.Lang::get('admin/accessories/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($accessory->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
$company = $accessory->company;
|
||||
|
||||
$rows[] = array(
|
||||
'name' => link_to('admin/accessories/'.$accessory->id.'/view', $accessory->name),
|
||||
'category' => link_to('admin/settings/categories/'.$accessory->category->id.'/view', $accessory->category->name),
|
||||
'qty' => $accessory->qty,
|
||||
'order_number' => $accessory->order_number,
|
||||
'location' => ($accessory->location) ? $accessory->location->name: '',
|
||||
'purchase_date' => $accessory->purchase_date,
|
||||
'purchase_cost' => $accessory->purchase_cost,
|
||||
'numRemaining' => $accessory->numRemaining(),
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : e($company->name)
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$accessCount, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDataView($accessoryID)
|
||||
{
|
||||
$accessory = Accessory::find($accessoryID);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($accessory)) {
|
||||
return ['total' => 0, 'rows' => []];
|
||||
}
|
||||
|
||||
$accessory_users = $accessory->users;
|
||||
$count = $accessory_users->count();
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions',function($accessory_users){
|
||||
return '<a href="'.route('checkin/accessory', $accessory_users->pivot->id).'" class="btn-flat info">Checkin</a>';
|
||||
});
|
||||
$rows = array();
|
||||
|
||||
return Datatable::collection($accessory_users)
|
||||
->addColumn('name',function($accessory_users)
|
||||
{
|
||||
return link_to('/admin/users/'.$accessory_users->id.'/view', $accessory_users->fullName());
|
||||
})
|
||||
->addColumn($actions)
|
||||
->make();
|
||||
foreach ($accessory_users as $user) {
|
||||
$actions = '<a href="'.route('checkin/accessory', $user->pivot->id).'" class="btn-flat info">Checkin</a>';
|
||||
|
||||
$rows[] = array(
|
||||
'name' => link_to('/admin/users/'.$user->id.'/view', $user->fullName()),
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$count, 'rows'=>$rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use AdminController;
|
||||
use AssetMaintenance;
|
||||
use Carbon\Carbon;
|
||||
use Datatable;
|
||||
use Company;
|
||||
use DB;
|
||||
use Input;
|
||||
use Lang;
|
||||
@@ -20,9 +20,16 @@
|
||||
use TCPDF;
|
||||
use Validator;
|
||||
use View;
|
||||
use Setting;
|
||||
use Asset;
|
||||
|
||||
class AssetMaintenancesController extends AdminController
|
||||
{
|
||||
private static function getInsufficientPermissionsRedirect()
|
||||
{
|
||||
return Redirect::to( 'admin/asset_maintenances')
|
||||
->with('error', Lang::get( 'general.insufficient_permissions' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* getIndex
|
||||
@@ -45,71 +52,73 @@
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getDatatable()
|
||||
{
|
||||
|
||||
$assetMaintenances = AssetMaintenance::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
public function getDatatable()
|
||||
{
|
||||
$maintenances = AssetMaintenance::with('asset','supplier','asset.company')
|
||||
->whereNull('deleted_at');
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn( 'actions', function ( $assetMaintenances ) {
|
||||
if (Input::has('search')) {
|
||||
$maintenances = $maintenances->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
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>';
|
||||
} );
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
return Datatable::collection( $assetMaintenances )
|
||||
->addColumn( 'asset', function ( $assetMaintenances ) {
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
return link_to( '/hardware/' . $assetMaintenances->asset_id . '/view',
|
||||
mb_strimwidth( $assetMaintenances->asset->name, 0, 50, "..." ) );
|
||||
} )
|
||||
->addColumn( 'supplier', function ( $assetMaintenances ) {
|
||||
$allowed_columns = ['id','title','asset_maintenance_time','asset_maintenance_type','cost','start_date','completion_date','notes'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
return link_to( '/admin/settings/suppliers/' . $assetMaintenances->supplier_id
|
||||
. '/view',
|
||||
mb_strimwidth( $assetMaintenances->supplier->name, 0, 50, "..." ) );
|
||||
} )
|
||||
->addColumn( 'asset_maintenance_type', function ( $assetMaintenances ) {
|
||||
$maintenances->orderBy($sort, $order);
|
||||
|
||||
return $assetMaintenances->asset_maintenance_type;
|
||||
} )
|
||||
->addColumn( 'title', function ( $assetMaintenances ) {
|
||||
$maintenancesCount = $maintenances->count();
|
||||
$maintenances = $maintenances->skip($offset)->take($limit)->get();
|
||||
|
||||
return link_to( '/admin/asset_maintenances/' . $assetMaintenances->id . '/view',
|
||||
mb_strimwidth( $assetMaintenances->title, 0, 50, "..." ) );
|
||||
} )
|
||||
->addColumn( 'start_date', function ( $assetMaintenances ) {
|
||||
$rows = array();
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
return $assetMaintenances->start_date;
|
||||
} )
|
||||
->addColumn( 'completion_date', function ( $assetMaintenances ) {
|
||||
foreach($maintenances as $maintenance) {
|
||||
|
||||
return $assetMaintenances->completion_date;
|
||||
} )
|
||||
->addColumn( 'asset_maintenance_time', function ( $assetMaintenances ) {
|
||||
$actions = '<nobr><a href="'.route('update/asset_maintenance', $maintenance->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/asset_maintenance', $maintenance->id).'" data-content="'.Lang::get('admin/asset_maintenances/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($maintenance->title).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
|
||||
if (is_null( $assetMaintenances->asset_maintenance_time )) {
|
||||
$assetMaintenances->asset_maintenance_time = Carbon::now()
|
||||
->diffInDays( Carbon::parse( $assetMaintenances->start_date ) );
|
||||
}
|
||||
if (($maintenance->cost) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
|
||||
$maintenance_cost = $maintenance->asset->assetloc->currency.$maintenance->cost;
|
||||
} else {
|
||||
$maintenance_cost = $settings->default_currency.$maintenance->cost;
|
||||
}
|
||||
|
||||
return intval( $assetMaintenances->asset_maintenance_time );
|
||||
} )
|
||||
->addColumn( 'cost', function ( $assetMaintenances ) {
|
||||
$company = $maintenance->asset->company;
|
||||
|
||||
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();
|
||||
}
|
||||
$rows[] = array(
|
||||
'id' => $maintenance->id,
|
||||
'asset_name' => link_to('/hardware/'.$maintenance->asset->id.'/view', $maintenance->asset->showAssetName()) ,
|
||||
'title' => $maintenance->title,
|
||||
'notes' => $maintenance->notes,
|
||||
'supplier' => $maintenance->supplier->name,
|
||||
'cost' => $maintenance_cost,
|
||||
'asset_maintenance_type' => e($maintenance->asset_maintenance_type),
|
||||
'start_date' => $maintenance->start_date,
|
||||
'asset_maintenance_time' => $maintenance->asset_maintenance_time,
|
||||
'completion_date' => $maintenance->completion_date,
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : $company->name
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $maintenancesCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getCreate
|
||||
@@ -122,7 +131,6 @@
|
||||
*/
|
||||
public function getCreate( $assetId = null )
|
||||
{
|
||||
|
||||
// Prepare Asset Maintenance Type List
|
||||
$assetMaintenanceType = [
|
||||
'' => 'Select an asset maintenance type',
|
||||
@@ -130,7 +138,7 @@
|
||||
// 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' )
|
||||
$asset = Company::scopeCompanyables( DB::table( 'assets' ), 'assets.company_id' )
|
||||
->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',
|
||||
@@ -206,6 +214,12 @@
|
||||
$assetMaintenance->notes = e( Input::get( 'notes' ) );
|
||||
}
|
||||
|
||||
$asset = Asset::find( e( Input::get( 'asset_id' ) ) );
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
}
|
||||
|
||||
// Save the asset maintenance data
|
||||
$assetMaintenance->asset_id = e( Input::get( 'asset_id' ) );
|
||||
$assetMaintenance->asset_maintenance_type = e( Input::get( 'asset_maintenance_type' ) );
|
||||
@@ -219,6 +233,16 @@
|
||||
$assetMaintenance->completion_date = 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()) {
|
||||
|
||||
@@ -253,13 +277,15 @@
|
||||
*/
|
||||
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' ) );
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess( $assetMaintenance->asset )) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
}
|
||||
|
||||
if ($assetMaintenance->completion_date == '0000-00-00') {
|
||||
$assetMaintenance->completion_date = null;
|
||||
@@ -279,7 +305,7 @@
|
||||
] + 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' )
|
||||
$asset = Company::scopeCompanyables( DB::table( 'assets' ), 'assets.company_id' )
|
||||
->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',
|
||||
@@ -334,6 +360,9 @@
|
||||
return Redirect::to( 'admin/asset_maintenances' )
|
||||
->with( 'error', Lang::get( 'admin/asset_maintenances/message.not_found' ) );
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess( $assetMaintenance->asset )) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
}
|
||||
|
||||
// attempt validation
|
||||
if ($assetMaintenance->validate( $new )) {
|
||||
@@ -362,6 +391,12 @@
|
||||
$assetMaintenance->notes = e( Input::get( 'notes' ) );
|
||||
}
|
||||
|
||||
$asset = Asset::find( e( Input::get( 'asset_id' ) ) );
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($asset)) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
}
|
||||
|
||||
// Save the asset maintenance data
|
||||
$assetMaintenance->asset_id = e( Input::get( 'asset_id' ) );
|
||||
$assetMaintenance->asset_maintenance_type = e( Input::get( 'asset_maintenance_type' ) );
|
||||
@@ -424,13 +459,16 @@
|
||||
*/
|
||||
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' ) );
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess( $assetMaintenance->asset )) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
}
|
||||
|
||||
// Delete the asset maintenance
|
||||
$assetMaintenance->delete();
|
||||
|
||||
@@ -450,15 +488,17 @@
|
||||
*/
|
||||
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' ) );
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess( $assetMaintenance->asset )) {
|
||||
return static::getInsufficientPermissionsRedirect();
|
||||
}
|
||||
|
||||
return View::make( 'backend/asset_maintenances/view')->with('assetMaintenance', $assetMaintenance);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ use AdminController;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Category;
|
||||
use Company;
|
||||
use Redirect;
|
||||
use Setting;
|
||||
use DB;
|
||||
@@ -11,7 +12,6 @@ use Sentry;
|
||||
use Str;
|
||||
use Validator;
|
||||
use View;
|
||||
use Datatable;
|
||||
|
||||
class CategoriesController extends AdminController
|
||||
{
|
||||
@@ -171,20 +171,25 @@ class CategoriesController extends AdminController
|
||||
// Check if the category exists
|
||||
if (is_null($category = Category::find($categoryId))) {
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/settings/categories')->with('error', Lang::get('admin/categories/message.not_found'));
|
||||
return Redirect::route('categories')->with('error', Lang::get('admin/categories/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
if ($category->has_models() > 0) {
|
||||
return Redirect::route('categories')->with('error', Lang::get('admin/categories/message.assoc_models'));
|
||||
|
||||
} elseif ($category->accessories()->count() > 0) {
|
||||
return Redirect::route('categories')->with('error', Lang::get('admin/categories/message.assoc_accessories'));
|
||||
|
||||
} elseif ($category->consumables()->count() > 0) {
|
||||
return Redirect::route('categories')->with('error', Lang::get('admin/categories/message.assoc_consumables'));
|
||||
|
||||
// Redirect to the asset management page
|
||||
return Redirect::to('admin/settings/categories')->with('error', Lang::get('admin/categories/message.assoc_users'));
|
||||
} else {
|
||||
|
||||
$category->delete();
|
||||
|
||||
// Redirect to the locations management page
|
||||
return Redirect::to('admin/settings/categories')->with('success', Lang::get('admin/categories/message.delete.success'));
|
||||
return Redirect::route('categories')->with('success', Lang::get('admin/categories/message.delete.success'));
|
||||
}
|
||||
|
||||
|
||||
@@ -218,61 +223,227 @@ class CategoriesController extends AdminController
|
||||
public function getDatatable()
|
||||
{
|
||||
// Grab all the categories
|
||||
$categories = Category::orderBy('created_at', 'DESC')->get();
|
||||
$categories = Category::with('assets', 'accessories');
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function($categories) {
|
||||
return '<a href="'.route('update/category', $categories->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/category', $categories->id).'" data-content="'.Lang::get('admin/categories/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($categories->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
});
|
||||
if (Input::has('search')) {
|
||||
$categories = $categories->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
return Datatable::collection($categories)
|
||||
->showColumns('name')
|
||||
->addColumn('category_type', function($categories) {
|
||||
return ucwords($categories->category_type);
|
||||
})
|
||||
->addColumn('count', function($categories) {
|
||||
return ($categories->category_type=='asset') ? link_to('/admin/settings/categories/'.$categories->id.'/view', $categories->assetscount()) : $categories->accessoriescount();
|
||||
})
|
||||
->addColumn('acceptance', function($categories) {
|
||||
return ($categories->require_acceptance=='1') ? '<i class="fa fa-check" style="margin-right:50%;margin-left:50%;"></i>' : '';
|
||||
})
|
||||
->addColumn('eula', function($categories) {
|
||||
return ($categories->getEula()) ? '<i class="fa fa-check" style="margin-right:50%;margin-left:50%;"></i></a>' : '';
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('name','category_type','count','acceptance','eula','actions')
|
||||
->orderColumns('name','category_type','count','acceptance','eula','actions')
|
||||
->make();
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
|
||||
$allowed_columns = ['id','name','category_type'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$categories = $categories->orderBy($sort, $order);
|
||||
|
||||
$catCount = $categories->count();
|
||||
$categories = $categories->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$actions = '<a href="'.route('update/category', $category->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/category', $category->id).'" data-content="'.Lang::get('admin/categories/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($category->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
$rows[] = array(
|
||||
'id' => $category->id,
|
||||
'name' => link_to('/admin/settings/categories/'.$category->id.'/view', $category->name) ,
|
||||
'category_type' => ucwords($category->category_type),
|
||||
'count' => $category->itemCount(),
|
||||
'acceptance' => ($category->require_acceptance=='1') ? '<i class="fa fa-check"></i>' : '',
|
||||
//EULA is still not working correctly
|
||||
'eula' => ($category->getEula()) ? '<i class="fa fa-check"></i>' : '',
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $catCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDataView($categoryID) {
|
||||
$category = Category::find($categoryID);
|
||||
$categoryassets = $category->assets;
|
||||
public function getDataViewAssets($categoryID) {
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($categoryassets)
|
||||
{
|
||||
if (($categoryassets->assigned_to !='') && ($categoryassets->assigned_to > 0)) {
|
||||
return '<a href="'.route('checkin/hardware', $categoryassets->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
|
||||
$category = Category::with('assets.company')->find($categoryID);
|
||||
$category_assets = $category->assets;
|
||||
|
||||
if (Input::has('search')) {
|
||||
$category_assets = $category_assets->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
$allowed_columns = ['id','name','serial','asset_tag'];
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
$count = $category_assets->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($category_assets as $asset) {
|
||||
|
||||
$actions = '';
|
||||
$inout='';
|
||||
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->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', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
} elseif ($asset->deleted_at!='') {
|
||||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if ($asset->assetstatus->deployable != 0) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
|
||||
} else {
|
||||
return '<a href="'.route('checkout/hardware', $categoryassets->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
|
||||
}
|
||||
});
|
||||
|
||||
return Datatable::collection($categoryassets)
|
||||
->addColumn('name', function ($categoryassets) {
|
||||
return link_to('/hardware/'.$categoryassets->id.'/view', $categoryassets->name);
|
||||
})
|
||||
->addColumn('asset_tag', function ($categoryassets) {
|
||||
return link_to('/hardware/'.$categoryassets->id.'/view', $categoryassets->asset_tag);
|
||||
})
|
||||
->addColumn('assigned_to', function ($categoryassets) {
|
||||
if ($categoryassets->assigned_to) {
|
||||
return link_to('/admin/users/'.$categoryassets->assigned_to.'/view', $categoryassets->assigneduser->fullName());
|
||||
}
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('name','asset_tag','assigned_to','actions')
|
||||
->orderColumns('name','asset_tag','assigned_to','actions')
|
||||
->make();
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $asset->id,
|
||||
'name' => link_to('/hardware/'.$asset->id.'/view', $asset->showAssetName()),
|
||||
'model' => $asset->model->name,
|
||||
'asset_tag' => $asset->asset_tag,
|
||||
'serial' => $asset->serial,
|
||||
'assigned_to' => ($asset->assigneduser) ? link_to('/admin/users/'.$asset->assigneduser->id.'/view', $asset->assigneduser->fullName()): '',
|
||||
'change' => $inout,
|
||||
'actions' => $actions,
|
||||
'companyName' => Company::getName($asset),
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getDataViewAccessories($categoryID) {
|
||||
|
||||
$category = Category::with('accessories.company')->find($categoryID);
|
||||
$category_assets = $category->accessories;
|
||||
|
||||
if (Input::has('search')) {
|
||||
$category_assets = $category_assets->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
$allowed_columns = ['id','name','serial','asset_tag'];
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
$count = $category_assets->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($category_assets as $asset) {
|
||||
|
||||
$actions = '';
|
||||
$inout='';
|
||||
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('update/accessory', $asset->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/accessory', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $asset->id,
|
||||
'name' => link_to_route('view/accessory', $asset->name, [$asset->id]),
|
||||
'actions' => $actions,
|
||||
'companyName' => Company::getName($asset),
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function getDataViewConsumables($categoryID) {
|
||||
|
||||
$category = Category::with('accessories.company')->find($categoryID);
|
||||
$category_assets = $category->consumables;
|
||||
|
||||
if (Input::has('search')) {
|
||||
$category_assets = $category_assets->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
$allowed_columns = ['id','name','serial','asset_tag'];
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
$count = $category_assets->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($category_assets as $asset) {
|
||||
|
||||
$actions = '';
|
||||
$inout='';
|
||||
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('update/consumable', $asset->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/consumable', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $asset->id,
|
||||
'name' => link_to_route('view/consumable', $asset->name, [$asset->id]),
|
||||
'actions' => $actions,
|
||||
'companyName' => Company::getName($asset),
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php namespace Controllers\Admin;
|
||||
|
||||
use AdminController;
|
||||
use Company;
|
||||
|
||||
use Input;
|
||||
use Lang;
|
||||
use Redirect;
|
||||
use Validator;
|
||||
use View;
|
||||
|
||||
final class CompaniesController extends AdminController
|
||||
{
|
||||
public function getIndex()
|
||||
{
|
||||
return View::make('backend/companies/index')->with('companies', Company::all());
|
||||
}
|
||||
|
||||
public function getCreate()
|
||||
{
|
||||
return View::make('backend/companies/edit')->with('company', new Company);
|
||||
}
|
||||
|
||||
public function postCreate()
|
||||
{
|
||||
$company = new Company;
|
||||
|
||||
if ($company->validate(Input::all()))
|
||||
{
|
||||
$company->name = e(Input::get('name'));
|
||||
|
||||
if($company->save())
|
||||
{
|
||||
return Redirect::to('admin/settings/companies')
|
||||
->with('success', Lang::get('admin/companies/message.create.success'));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Redirect::to('admin/settings/companies/create')
|
||||
->with('error', Lang::get('admin/companies/message.create.error'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Redirect::back()->withInput()->withErrors($company->errors());
|
||||
}
|
||||
}
|
||||
|
||||
public function getEdit($companyId)
|
||||
{
|
||||
if (is_null($company = Company::find($companyId)))
|
||||
{
|
||||
return Redirect::to('admin/settings/companies')
|
||||
->with('error', Lang::get('admin/companies/message.does_not_exist'));
|
||||
}
|
||||
else
|
||||
{
|
||||
return View::make('backend/companies/edit')->with('company', $company);
|
||||
}
|
||||
}
|
||||
|
||||
public function postEdit($companyId)
|
||||
{
|
||||
if (is_null($company = Company::find($companyId)))
|
||||
{
|
||||
return Redirect::to('admin/settings/companies')->with('error', Lang::get('admin/companies/message.does_not_exist'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$validator = Validator::make(Input::all(), $company->validationRules($companyId));
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
return Redirect::back()->withInput()->withErrors($validator->messages());
|
||||
}
|
||||
else
|
||||
{
|
||||
$company->name = e(Input::get('name'));
|
||||
|
||||
if($company->save())
|
||||
{
|
||||
return Redirect::to('admin/settings/companies')
|
||||
->with('success', Lang::get('admin/companies/message.update.success'));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Redirect::to("admin/settings/companies/$companyId/edit")
|
||||
->with('error', Lang::get('admin/companies/message.update.error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function postDelete($companyId)
|
||||
{
|
||||
if (is_null($company = Company::find($companyId)))
|
||||
{
|
||||
return Redirect::to('admin/settings/companies')
|
||||
->with('error', Lang::get('admin/companies/message.not_found'));
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$company->delete();
|
||||
return Redirect::to('admin/settings/companies')
|
||||
->with('success', Lang::get('admin/companies/message.delete.success'));
|
||||
}
|
||||
catch (\Illuminate\Database\QueryException $exception)
|
||||
{
|
||||
/*
|
||||
* NOTE: This happens when there's a foreign key constraint violation
|
||||
* For example when rows in other tables are referencing this company
|
||||
*/
|
||||
if ($exception->getCode() == 23000)
|
||||
{
|
||||
return Redirect::to('admin/settings/companies')
|
||||
->with('error', Lang::get('admin/companies/message.assoc_users'));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use Setting;
|
||||
use DB;
|
||||
use Sentry;
|
||||
use Consumable;
|
||||
use Company;
|
||||
use Str;
|
||||
use Validator;
|
||||
use View;
|
||||
@@ -41,7 +42,14 @@ class ConsumablesController extends AdminController
|
||||
{
|
||||
// Show the page
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type','=','consumable')->whereNull('deleted_at')->orderBy('name','ASC')->lists('name', 'id');
|
||||
return View::make('backend/consumables/edit')->with('consumable',new Consumable)->with('category_list',$category_list);
|
||||
$company_list = companyList();
|
||||
$location_list = locationsList();
|
||||
|
||||
return View::make('backend/consumables/edit')
|
||||
->with('consumable', new Consumable)
|
||||
->with('category_list', $category_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('location_list', $location_list);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,10 +74,26 @@ class ConsumablesController extends AdminController
|
||||
else{
|
||||
|
||||
// Update the consumable data
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->user_id = Sentry::getId();
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->location_id = e(Input::get('location_id'));
|
||||
$consumable->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$consumable->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$consumable->purchase_date = NULL;
|
||||
} else {
|
||||
$consumable->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = NULL;
|
||||
} else {
|
||||
$consumable->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->user_id = Sentry::getId();
|
||||
|
||||
// Was the consumable created?
|
||||
if($consumable->save()) {
|
||||
@@ -97,9 +121,18 @@ class ConsumablesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.does_not_exist'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$category_list = array('' => '') + DB::table('categories')->where('category_type','=','consumable')->whereNull('deleted_at')->orderBy('name','ASC')->lists('name', 'id');
|
||||
return View::make('backend/consumables/edit', compact('consumable'))->with('category_list',$category_list);
|
||||
$company_list = companyList();
|
||||
$location_list = locationsList();
|
||||
|
||||
return View::make('backend/consumables/edit', compact('consumable'))
|
||||
->with('category_list', $category_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('location_list', $location_list);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +149,9 @@ class ConsumablesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.does_not_exist'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
|
||||
// get the POST data
|
||||
@@ -134,9 +170,25 @@ class ConsumablesController extends AdminController
|
||||
else {
|
||||
|
||||
// Update the consumable data
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
$consumable->name = e(Input::get('name'));
|
||||
$consumable->category_id = e(Input::get('category_id'));
|
||||
$consumable->location_id = e(Input::get('location_id'));
|
||||
$consumable->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$consumable->order_number = e(Input::get('order_number'));
|
||||
|
||||
if (e(Input::get('purchase_date')) == '') {
|
||||
$consumable->purchase_date = NULL;
|
||||
} else {
|
||||
$consumable->purchase_date = e(Input::get('purchase_date'));
|
||||
}
|
||||
|
||||
if (e(Input::get('purchase_cost')) == '0.00') {
|
||||
$consumable->purchase_cost = NULL;
|
||||
} else {
|
||||
$consumable->purchase_cost = ParseFloat(e(Input::get('purchase_cost')));
|
||||
}
|
||||
|
||||
$consumable->qty = e(Input::get('qty'));
|
||||
|
||||
// Was the consumable created?
|
||||
if($consumable->save()) {
|
||||
@@ -163,6 +215,9 @@ class ConsumablesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.not_found'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$consumable->delete();
|
||||
|
||||
@@ -184,7 +239,14 @@ class ConsumablesController extends AdminController
|
||||
$consumable = Consumable::find($consumableID);
|
||||
|
||||
if (isset($consumable->id)) {
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else {
|
||||
return View::make('backend/consumables/view', compact('consumable'));
|
||||
}
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/consumables/message.does_not_exist', compact('id'));
|
||||
@@ -206,6 +268,9 @@ class ConsumablesController extends AdminController
|
||||
// Redirect to the consumable management page with error
|
||||
return Redirect::to('consumables')->with('error', Lang::get('admin/consumables/message.not_found'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// 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," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
@@ -219,57 +284,60 @@ class ConsumablesController extends AdminController
|
||||
**/
|
||||
public function postCheckout($consumableId)
|
||||
{
|
||||
// Check if the consumable exists
|
||||
if (is_null($consumable = Consumable::find($consumableId))) {
|
||||
// Redirect to the consumable management page with error
|
||||
return Redirect::to('consumables')->with('error', Lang::get('admin/consumables/message.not_found'));
|
||||
}
|
||||
// Check if the consumable exists
|
||||
if (is_null($consumable = Consumable::find($consumableId))) {
|
||||
// Redirect to the consumable management page with error
|
||||
return Redirect::to('consumables')->with('error', Lang::get('admin/consumables/message.not_found'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$admin_user = Sentry::getUser();
|
||||
$assigned_to = e(Input::get('assigned_to'));
|
||||
$admin_user = Sentry::getUser();
|
||||
$assigned_to = e(Input::get('assigned_to'));
|
||||
|
||||
|
||||
// Declare the rules for the form validation
|
||||
$rules = array(
|
||||
'assigned_to' => 'required|min:1'
|
||||
);
|
||||
// Declare the rules for the form validation
|
||||
$rules = array(
|
||||
'assigned_to' => 'required|min:1'
|
||||
);
|
||||
|
||||
// Create a new validator instance from our validation rules
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
// 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);
|
||||
}
|
||||
// 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 consumable management page with error
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.user_does_not_exist'));
|
||||
}
|
||||
// Check if the user exists
|
||||
if (is_null($user = User::find($assigned_to))) {
|
||||
// Redirect to the consumable management page with error
|
||||
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.user_does_not_exist'));
|
||||
}
|
||||
|
||||
// Update the consumable data
|
||||
$consumable->assigned_to = e(Input::get('assigned_to'));
|
||||
// Update the consumable data
|
||||
$consumable->assigned_to = e(Input::get('assigned_to'));
|
||||
|
||||
$consumable->users()->attach($consumable->id, array(
|
||||
'consumable_id' => $consumable->id,
|
||||
'assigned_to' => e(Input::get('assigned_to'))));
|
||||
$consumable->users()->attach($consumable->id, array(
|
||||
'consumable_id' => $consumable->id,
|
||||
'user_id' => $admin_user->id,
|
||||
'assigned_to' => e(Input::get('assigned_to'))));
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->consumable_id = $consumable->id;
|
||||
$logaction->checkedout_to = $consumable->assigned_to;
|
||||
$logaction->asset_type = 'consumable';
|
||||
$logaction->location_id = $user->location_id;
|
||||
$logaction->user_id = Sentry::getUser()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
$logaction = new Actionlog();
|
||||
$logaction->consumable_id = $consumable->id;
|
||||
$logaction->checkedout_to = $consumable->assigned_to;
|
||||
$logaction->asset_type = 'consumable';
|
||||
$logaction->location_id = $user->location_id;
|
||||
$logaction->user_id = Sentry::getUser()->id;
|
||||
$logaction->note = e(Input::get('note'));
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
if ($settings->slack_endpoint) {
|
||||
|
||||
|
||||
$slack_settings = [
|
||||
'username' => $settings->botname,
|
||||
'channel' => $settings->slack_channel,
|
||||
@@ -290,45 +358,40 @@ class ConsumablesController extends AdminController
|
||||
'title' => 'Note:',
|
||||
'value' => e($logaction->note)
|
||||
],
|
||||
|
||||
|
||||
|
||||
]
|
||||
])->send('Consumable Checked Out');
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$log = $logaction->logaction('checkout');
|
||||
|
||||
$log = $logaction->logaction('checkout');
|
||||
$consumable_user = DB::table('consumables_users')->where('assigned_to','=',$consumable->assigned_to)->where('consumable_id','=',$consumable->id)->first();
|
||||
|
||||
$consumable_user = DB::table('consumables_users')->where('assigned_to','=',$consumable->assigned_to)->where('consumable_id','=',$consumable->id)->first();
|
||||
|
||||
$data['log_id'] = $logaction->id;
|
||||
$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();
|
||||
$data['log_id'] = $logaction->id;
|
||||
$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();
|
||||
|
||||
|
||||
if (($consumable->requireAcceptance()=='1') || ($consumable->getEula())) {
|
||||
if (($consumable->requireAcceptance()=='1') || ($consumable->getEula())) {
|
||||
|
||||
Mail::send('emails.accept-asset', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Confirm consumable delivery');
|
||||
});
|
||||
}
|
||||
Mail::send('emails.accept-asset', $data, function ($m) use ($user) {
|
||||
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
|
||||
$m->subject('Confirm consumable delivery');
|
||||
});
|
||||
}
|
||||
|
||||
// Redirect to the new consumable page
|
||||
return Redirect::to("admin/consumables")->with('success', Lang::get('admin/consumables/message.checkout.success'));
|
||||
// Redirect to the new consumable page
|
||||
return Redirect::to("admin/consumables")->with('success', Lang::get('admin/consumables/message.checkout.success'));
|
||||
|
||||
|
||||
|
||||
@@ -337,48 +400,105 @@ class ConsumablesController extends AdminController
|
||||
|
||||
public function getDatatable()
|
||||
{
|
||||
$consumables = Consumable::select(array('id','name','qty'))
|
||||
->whereNull('deleted_at')
|
||||
->orderBy('created_at', 'DESC');
|
||||
$consumables = Consumable::select('consumables.*')->whereNull('consumables.deleted_at')
|
||||
->with('company','location','category','users');
|
||||
|
||||
$consumables = $consumables->get();
|
||||
if (Input::has('search')) {
|
||||
$consumables = $consumables->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions',function($consumables)
|
||||
{
|
||||
return '<a href="'.route('checkout/consumable', $consumables->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($consumables->numRemaining() > 0 ) ? '' : ' disabled').'>'.Lang::get('general.checkout').'</a><a href="'.route('update/consumable', $consumables->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/consumable', $consumables->id).'" data-content="'.Lang::get('admin/consumables/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($consumables->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
});
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$allowed_columns = ['id','name','order_number','purchase_date','purchase_cost','companyName','category'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
switch ($sort)
|
||||
{
|
||||
case 'category':
|
||||
$consumables = $consumables->OrderCategory($order);
|
||||
break;
|
||||
case 'location':
|
||||
$consumables = $consumables->OrderLocation($order);
|
||||
break;
|
||||
case 'companyName':
|
||||
$consumables = $consumables->OrderCompany($order);
|
||||
break;
|
||||
default:
|
||||
$consumables = $consumables->orderBy($sort, $order);
|
||||
break;
|
||||
}
|
||||
|
||||
$consumCount = $consumables->count();
|
||||
$consumables = $consumables->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach($consumables as $consumable) {
|
||||
$actions = '<nobr><a href="'.route('checkout/consumable', $consumable->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($consumable->numRemaining() > 0 ) ? '' : ' disabled').'>'.Lang::get('general.checkout').'</a><a href="'.route('update/consumable', $consumable->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/consumable', $consumable->id).'" data-content="'.Lang::get('admin/consumables/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($consumable->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
$company = $consumable->company;
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $consumable->id,
|
||||
'name' => link_to('admin/consumables/'.$consumable->id.'/view', $consumable->name),
|
||||
'location' => ($consumable->location) ? e($consumable->location->name) : '',
|
||||
'qty' => $consumable->qty,
|
||||
'category' => ($consumable->category) ? $consumable->category->name : 'Missing category',
|
||||
'order_number' => $consumable->order_number,
|
||||
'purchase_date' => $consumable->purchase_date,
|
||||
'purchase_cost' => ($consumable->purchase_cost!='') ? number_format($consumable->purchase_cost,2): '' ,
|
||||
'numRemaining' => $consumable->numRemaining(),
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($company) ? '' : e($company->name),
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $consumCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
|
||||
return Datatable::collection($consumables)
|
||||
->addColumn('name',function($consumables)
|
||||
{
|
||||
return link_to('admin/consumables/'.$consumables->id.'/view', $consumables->name);
|
||||
})
|
||||
->addColumn('qty',function($consumables)
|
||||
{
|
||||
return $consumables->qty;
|
||||
})
|
||||
->addColumn('numRemaining',function($consumables)
|
||||
{
|
||||
return $consumables->numRemaining();
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('name','qty','numRemaining','actions')
|
||||
->orderColumns('name','qty','numRemaining','actions')
|
||||
->make();
|
||||
}
|
||||
|
||||
public function getDataView($consumableID)
|
||||
{
|
||||
$consumable = Consumable::find($consumableID);
|
||||
$consumable_users = $consumable->users;
|
||||
//$consumable = Consumable::find($consumableID);
|
||||
$consumable = Consumable::with(array('consumableAssigments'=>
|
||||
function($query) {
|
||||
$query->orderBy('created_at','DESC');
|
||||
},
|
||||
'consumableAssigments.admin'=> function($query) {},
|
||||
'consumableAssigments.user'=> function($query) {},
|
||||
))->find($consumableID);
|
||||
|
||||
// $consumable->load('consumableAssigments.admin','consumableAssigments.user');
|
||||
|
||||
return Datatable::collection($consumable_users)
|
||||
->addColumn('name',function($consumable_users)
|
||||
{
|
||||
return link_to('/admin/users/'.$consumable_users->id.'/view', $consumable_users->fullName());
|
||||
})
|
||||
->make();
|
||||
if (!Company::isCurrentUserHasAccess($consumable)) {
|
||||
return ['total' => 0, 'rows' => []];
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($consumable->consumableAssigments as $consumable_assignment) {
|
||||
$rows[] = array(
|
||||
'name' => link_to('/admin/users/'.$consumable_assignment->user->id.'/view', $consumable_assignment->user->fullName()),
|
||||
'created_at' => ($consumable_assignment->created_at->format('Y-m-d H:i:s')=='-0001-11-30 00:00:00') ? '' : $consumable_assignment->created_at->format('Y-m-d H:i:s'),
|
||||
'admin' => ($consumable_assignment->admin) ? $consumable_assignment->admin->fullName() : '',
|
||||
);
|
||||
}
|
||||
|
||||
$consumableCount = $consumable->users->count();
|
||||
$data = array('total' => $consumableCount, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
<?php namespace Controllers\Admin;
|
||||
|
||||
use View;
|
||||
use CustomFieldset;
|
||||
use CustomField;
|
||||
use Input;
|
||||
use Validator;
|
||||
use Redirect;
|
||||
use Model;
|
||||
use Lang;
|
||||
use Sentry;
|
||||
|
||||
class CustomFieldsController extends \BaseController {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$fieldsets=CustomFieldset::with("fields","models")->get();
|
||||
//$fieldsets=CustomFieldset::all();
|
||||
$fields=CustomField::with("fieldset")->get();
|
||||
//$fields=CustomField::all();
|
||||
return View::make("backend.custom_fields.index")->with("custom_fieldsets",$fieldsets)->with("custom_fields",$fields);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return View::make("backend.custom_fields.create");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
//
|
||||
$cfset=new CustomFieldset(["name" => Input::get("name"),"user_id" => Sentry::getUser()->id]);
|
||||
$validator=Validator::make(Input::all(),$cfset->rules);
|
||||
if($validator->passes()) {
|
||||
$cfset->save();
|
||||
return Redirect::route("admin.custom_fields.show",[$cfset->id])->with('success',Lang::get('admin/custom_fields/message.fieldset.create.success'));
|
||||
} else {
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
}
|
||||
}
|
||||
|
||||
public function associate($id)
|
||||
{
|
||||
|
||||
$set = CustomFieldset::find($id);
|
||||
|
||||
foreach($set->fields AS $field) {
|
||||
if($field->id == Input::get('field_id')) {
|
||||
return Redirect::route("admin.custom_fields.show",[$id])->withInput()->withErrors(['field_id' => Lang::get('admin/custom_fields/message.field.already_added')]);
|
||||
}
|
||||
}
|
||||
|
||||
$results=$set->fields()->attach(Input::get('field_id'),["required" => (Input::get('required') == "on"),"order" => Input::get('order')]);
|
||||
|
||||
return Redirect::route("admin.custom_fields.show",[$id])->with("success",Lang::get('admin/custom_fields/message.field.create.assoc_success'));
|
||||
}
|
||||
|
||||
public function createField()
|
||||
{
|
||||
return View::make("backend.custom_fields.create_field");
|
||||
}
|
||||
|
||||
public function storeField()
|
||||
{
|
||||
$field=new CustomField(["name" => Input::get("name"),"element" => Input::get("element"),"user_id" => Sentry::getUser()->id]);
|
||||
if(!in_array(Input::get('format'),["ALPHA","NUMERIC","MAC","IP"])) {
|
||||
$field->format=Input::get("custom_format");
|
||||
} else {
|
||||
$field->format=Input::get('format');
|
||||
}
|
||||
|
||||
$validator=Validator::make(Input::all(),$field->rules);
|
||||
if($validator->passes()) {
|
||||
$results=$field->save();
|
||||
//return "postCreateField: $results";
|
||||
if ($results) {
|
||||
return Redirect::route("admin.custom_fields.index")->with("success",Lang::get('admin/custom_fields/message.field.create.success'));
|
||||
} else {
|
||||
return Redirect::back()->withInput()->with('error', Lang::get('admin/custom_fields/message.field.create.error'));
|
||||
}
|
||||
} else {
|
||||
return Redirect::back()->withInput()->withErrors($validator);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteField($field_id)
|
||||
{
|
||||
$field=CustomField::find($field_id);
|
||||
|
||||
if($field->fieldset->count()>0) {
|
||||
return Redirect::back()->withErrors(['message' => "Field is in-use"]);
|
||||
} else {
|
||||
$field->delete();
|
||||
return Redirect::route("admin.custom_fields.index")->with("success",Lang::get('admin/custom_fields/message.field.delete.success'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//$id=$parameters[0];
|
||||
$cfset=CustomFieldset::find($id);
|
||||
|
||||
//print_r($parameters);
|
||||
//
|
||||
$custom_fields_list=["" => "Add New Field to Fieldset"] + CustomField::lists("name","id");
|
||||
// print_r($custom_fields_list);
|
||||
$maxid=0;
|
||||
foreach($cfset->fields AS $field) {
|
||||
// print "Looking for: ".$field->id;
|
||||
if($field->pivot->order > $maxid) {
|
||||
$maxid=$field->pivot->order;
|
||||
}
|
||||
if(isset($custom_fields_list[$field->id])) {
|
||||
// print "Found ".$field->id.", so removing it.<br>";
|
||||
unset($custom_fields_list[$field->id]);
|
||||
}
|
||||
}
|
||||
|
||||
return View::make("backend.custom_fields.show")->with("custom_fieldset",$cfset)->with("maxid",$maxid+1)->with("custom_fields_list",$custom_fields_list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
$fieldset=CustomFieldset::find($id);
|
||||
|
||||
$models=Model::where("fieldset_id","=",$id);
|
||||
if($models->count()==0) {
|
||||
$fieldset->delete();
|
||||
return Redirect::route("admin.custom_fields.index")->with("success",Lang::get('admin/custom_fields/message.fieldset.delete.success'));
|
||||
}
|
||||
else {
|
||||
return Redirect::route("admin.custom_fields.index")->with("error",Lang::get('admin/custom_fields/message.fieldset.delete.in_use')); //->with("models",$models);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ use AdminController;
|
||||
use View;
|
||||
use Asset;
|
||||
use Actionlog;
|
||||
use Company;
|
||||
|
||||
class DashboardController extends AdminController
|
||||
{
|
||||
@@ -16,7 +17,10 @@ class DashboardController extends AdminController
|
||||
{
|
||||
// Show the page
|
||||
|
||||
$recent_activity = Actionlog::orderBy('created_at','DESC')->with('accessorylog','consumablelog','licenselog','assetlog','adminlog','userlog')->take(7)->get();
|
||||
$recent_activity = Actionlog::orderBy('created_at','DESC')
|
||||
->with('accessorylog','consumablelog','licenselog','assetlog','adminlog','userlog')
|
||||
->take(7)
|
||||
->get();
|
||||
|
||||
|
||||
$asset_stats['total'] = Asset::Hardware()->count();
|
||||
|
||||
@@ -22,9 +22,6 @@ class DepreciationsController extends AdminController
|
||||
|
||||
public function getIndex()
|
||||
{
|
||||
// Grab all the depreciations
|
||||
$depreciations = Depreciation::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
// Show the page
|
||||
return View::make('backend/depreciations/index', compact('depreciations'));
|
||||
}
|
||||
@@ -123,7 +120,7 @@ class DepreciationsController extends AdminController
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
// The given data did not pass validation
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->withErrors($validator->messages());
|
||||
}
|
||||
// attempt validation
|
||||
@@ -137,7 +134,7 @@ class DepreciationsController extends AdminController
|
||||
// Redirect to the depreciation page
|
||||
return Redirect::to("admin/settings/depreciations/")->with('success', Lang::get('admin/depreciations/message.update.success'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to the depreciation management page
|
||||
return Redirect::to("admin/settings/depreciations/$depreciationId/edit")->with('error', Lang::get('admin/depreciations/message.update.error'));
|
||||
@@ -174,5 +171,55 @@ class DepreciationsController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function getDatatable()
|
||||
{
|
||||
$depreciations = Depreciation::select(array('id','name','months'));
|
||||
|
||||
if (Input::has('search')) {
|
||||
$depreciations = $depreciations->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$allowed_columns = ['id','name','months'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$depreciations->orderBy($sort, $order);
|
||||
|
||||
$depreciationsCount = $depreciations->count();
|
||||
$depreciations = $depreciations->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach($depreciations as $depreciation) {
|
||||
$actions = '<a href="'.route('update/depreciations', $depreciation->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/depreciations', $depreciation->id).'" data-content="'.Lang::get('admin/depreciations/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($depreciation->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $depreciation->id,
|
||||
'name' => $depreciation->name,
|
||||
'months' => $depreciation->months,
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $depreciationsCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@ class GroupsController extends AdminController
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
// Grab all the groups
|
||||
$groups = Sentry::getGroupProvider()->createModel()->paginate();
|
||||
|
||||
// Show the page
|
||||
return View::make('backend/groups/index', compact('groups'));
|
||||
}
|
||||
@@ -215,4 +212,78 @@ class GroupsController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getDatatable($status = null)
|
||||
{
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
if (Input::get('sort')=='name') {
|
||||
$sort = 'first_name';
|
||||
} else {
|
||||
$sort = e(Input::get('sort'));
|
||||
}
|
||||
|
||||
// Grab all the groups
|
||||
$groups = Sentry::getGroupProvider()->createModel();
|
||||
//$users = Company::scopeCompanyables($users);
|
||||
|
||||
if (Input::has('search')) {
|
||||
$groups = $users->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
$allowed_columns =
|
||||
[
|
||||
'name','created_at'
|
||||
];
|
||||
|
||||
$sort = in_array($sort, $allowed_columns) ? $sort : 'name';
|
||||
$groups = $groups->orderBy($sort, $order);
|
||||
|
||||
$groupsCount = $groups->count();
|
||||
$groups = $groups->skip($offset)->take($limit)->get();
|
||||
$rows = array();
|
||||
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
$group_names = '';
|
||||
$inout = '';
|
||||
$actions = '<nobr>';
|
||||
|
||||
$actions .= '<a href="' . route('update/group', $group->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
|
||||
if (!Config::get('app.lock_passwords')) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/group', $group->id) . '" data-content="'.Lang::get('admin/groups/message.delete.confirm').'" data-title="Delete ' . htmlspecialchars($group->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||
} else {
|
||||
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
|
||||
}
|
||||
|
||||
$actions .= '</nobr>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $group->id,
|
||||
'name' => $group->name,
|
||||
'users' => $group->users->count(),
|
||||
'created_at' => $group->created_at->format('Y-m-d H:i:s'),
|
||||
'actions' => ($actions) ? $actions : '',
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total'=>$groupsCount, 'rows'=>$rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ use DB;
|
||||
use Redirect;
|
||||
use LicenseSeat;
|
||||
use Depreciation;
|
||||
use Company;
|
||||
use Setting;
|
||||
use Sentry;
|
||||
use Str;
|
||||
@@ -55,11 +56,14 @@ class LicensesController extends AdminController
|
||||
$depreciation_list = array('0' => Lang::get('admin/licenses/form.no_depreciation')) + Depreciation::lists('name', 'id');
|
||||
$supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
|
||||
$company_list = companyList();
|
||||
|
||||
return View::make('backend/licenses/edit')
|
||||
->with('license_options',$license_options)
|
||||
->with('depreciation_list',$depreciation_list)
|
||||
->with('supplier_list',$supplier_list)
|
||||
->with('maintained_list',$maintained_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('license',new License);
|
||||
}
|
||||
|
||||
@@ -124,6 +128,7 @@ class LicensesController extends AdminController
|
||||
$license->purchase_date = e(Input::get('purchase_date'));
|
||||
$license->purchase_order = e(Input::get('purchase_order'));
|
||||
$license->depreciation_id = e(Input::get('depreciation_id'));
|
||||
$license->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$license->expiration_date = e(Input::get('expiration_date'));
|
||||
$license->user_id = Sentry::getId();
|
||||
|
||||
@@ -181,6 +186,9 @@ class LicensesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if ($license->purchase_date == "0000-00-00") {
|
||||
$license->purchase_date = NULL;
|
||||
@@ -195,10 +203,13 @@ class LicensesController extends AdminController
|
||||
$depreciation_list = array('0' => Lang::get('admin/licenses/form.no_depreciation')) + Depreciation::lists('name', 'id');
|
||||
$supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
|
||||
$company_list = companyList();
|
||||
|
||||
return View::make('backend/licenses/edit', compact('license'))
|
||||
->with('license_options',$license_options)
|
||||
->with('depreciation_list',$depreciation_list)
|
||||
->with('supplier_list',$supplier_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('maintained_list',$maintained_list);
|
||||
}
|
||||
|
||||
@@ -216,6 +227,9 @@ class LicensesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
|
||||
// get the POST data
|
||||
@@ -234,6 +248,7 @@ class LicensesController extends AdminController
|
||||
$license->notes = e(Input::get('notes'));
|
||||
$license->order_number = e(Input::get('order_number'));
|
||||
$license->depreciation_id = e(Input::get('depreciation_id'));
|
||||
$license->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
|
||||
$license->purchase_order = e(Input::get('purchase_order'));
|
||||
$license->maintained = e(Input::get('maintained'));
|
||||
$license->reassignable = e(Input::get('reassignable'));
|
||||
@@ -374,6 +389,9 @@ class LicensesController extends AdminController
|
||||
// Redirect to the license management page
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (($license->assignedcount()) && ($license->assignedcount() > 0)) {
|
||||
|
||||
@@ -412,6 +430,9 @@ 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'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($licenseseat->license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// 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," (",username,")") as full_name, id'))->whereNull('deleted_at')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc')->lists('full_name', 'id');
|
||||
@@ -453,11 +474,15 @@ class LicensesController extends AdminController
|
||||
public function postCheckout($seatId)
|
||||
{
|
||||
|
||||
|
||||
$licenseseat = LicenseSeat::find($seatId);
|
||||
$assigned_to = e(Input::get('assigned_to'));
|
||||
$asset_id = e(Input::get('asset_id'));
|
||||
$user = Sentry::getUser();
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($licenseseat->license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Declare the rules for the form validation
|
||||
$rules = array(
|
||||
|
||||
@@ -499,7 +524,7 @@ class LicensesController extends AdminController
|
||||
|
||||
|
||||
// Check if the asset exists
|
||||
if (is_null($licenseseat = LicenseSeat::find($seatId))) {
|
||||
if (is_null($licenseseat)) {
|
||||
// Redirect to the asset management page with error
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
|
||||
}
|
||||
@@ -602,6 +627,9 @@ 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'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($licenseseat->license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
return View::make('backend/licenses/checkin', compact('licenseseat'))->with('backto',$backto);
|
||||
|
||||
}
|
||||
@@ -621,6 +649,10 @@ class LicensesController extends AdminController
|
||||
|
||||
$license = License::find($licenseseat->license_id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if(!$license->reassignable) {
|
||||
// Not allowed to checkin
|
||||
Session::flash('error', 'License not reassignable.');
|
||||
@@ -714,7 +746,7 @@ class LicensesController extends AdminController
|
||||
/**
|
||||
* Get the asset information to present to the asset view page
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $licenseId
|
||||
* @return View
|
||||
**/
|
||||
public function getView($licenseId = null)
|
||||
@@ -722,6 +754,10 @@ class LicensesController extends AdminController
|
||||
$license = License::find($licenseId);
|
||||
|
||||
if (isset($license->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
return View::make('backend/licenses/view', compact('license'));
|
||||
} else {
|
||||
// Prepare the error message
|
||||
@@ -739,10 +775,14 @@ class LicensesController extends AdminController
|
||||
// Redirect to the blogs management page
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist'));
|
||||
}
|
||||
else if (!Company::isCurrentUserHasAccess($license_to_clone)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Show the page
|
||||
$license_options = array('0' => 'Top Level') + License::lists('name', 'id');
|
||||
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
|
||||
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
|
||||
$company_list = companyList();
|
||||
//clone the orig
|
||||
$license = clone $license_to_clone;
|
||||
$license->id = null;
|
||||
@@ -751,7 +791,13 @@ class LicensesController extends AdminController
|
||||
// Show the page
|
||||
$depreciation_list = array('0' => Lang::get('admin/licenses/form.no_depreciation')) + Depreciation::lists('name', 'id');
|
||||
$supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->lists('name', 'id');
|
||||
return View::make('backend/licenses/edit')->with('license_options',$license_options)->with('depreciation_list',$depreciation_list)->with('supplier_list',$supplier_list)->with('license',$license)->with('maintained_list',$maintained_list);
|
||||
return View::make('backend/licenses/edit')
|
||||
->with('license_options',$license_options)
|
||||
->with('depreciation_list',$depreciation_list)
|
||||
->with('supplier_list',$supplier_list)
|
||||
->with('license',$license)
|
||||
->with('maintained_list',$maintained_list)
|
||||
->with('company_list',$company_list);
|
||||
|
||||
}
|
||||
|
||||
@@ -759,7 +805,7 @@ class LicensesController extends AdminController
|
||||
/**
|
||||
* Upload the file to the server
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $licenseId
|
||||
* @return View
|
||||
**/
|
||||
public function postUpload($licenseId = null)
|
||||
@@ -771,6 +817,11 @@ class LicensesController extends AdminController
|
||||
|
||||
if (isset($license->id)) {
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (Input::hasFile('licensefile')) {
|
||||
|
||||
foreach(Input::file('licensefile') as $file) {
|
||||
@@ -831,7 +882,8 @@ class LicensesController extends AdminController
|
||||
/**
|
||||
* Delete the associated file
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $licenseId
|
||||
* @param int $fileId
|
||||
* @return View
|
||||
**/
|
||||
public function getDeleteFile($licenseId = null, $fileId = null)
|
||||
@@ -842,6 +894,11 @@ class LicensesController extends AdminController
|
||||
// the license is valid
|
||||
if (isset($license->id)) {
|
||||
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
$full_filename = $destinationPath.'/'.$log->filename;
|
||||
if (file_exists($full_filename)) {
|
||||
@@ -864,7 +921,8 @@ class LicensesController extends AdminController
|
||||
/**
|
||||
* Display/download the uploaded file
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $licenseId
|
||||
* @param int $fileId
|
||||
* @return View
|
||||
**/
|
||||
public function displayFile($licenseId = null, $fileId = null)
|
||||
@@ -874,6 +932,11 @@ class LicensesController extends AdminController
|
||||
|
||||
// the license is valid
|
||||
if (isset($license->id)) {
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($license)) {
|
||||
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
$file = $log->get_src();
|
||||
return Response::download($file);
|
||||
@@ -887,41 +950,41 @@ class LicensesController extends AdminController
|
||||
}
|
||||
|
||||
public function getDatatable() {
|
||||
$licenses = License::orderBy('created_at', 'DESC')->get();
|
||||
$licenses = License::select('id','name','serial','purchase_date','seats', 'company_id')->with('company');
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function($licenses) {
|
||||
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>';
|
||||
});
|
||||
if (Input::has('search')) {
|
||||
$licenses = $licenses->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
return Datatable::collection($licenses)
|
||||
->addColumn('name', function($licenses) {
|
||||
return link_to('/admin/licenses/'.$licenses->id.'/view', $licenses->name);
|
||||
})
|
||||
->addColumn('serial', function($licenses) {
|
||||
return link_to('/admin/licenses/'.$licenses->id.'/view', mb_strimwidth($licenses->serial, 0, 50, "..."));
|
||||
})
|
||||
->addColumn('license_name', function($licenses) {
|
||||
return $licenses->license_name;
|
||||
})
|
||||
->addColumn('license_email', function($licenses) {
|
||||
return $licenses->license_email;
|
||||
})
|
||||
->addColumn('totalSeats', function($licenses) {
|
||||
return $licenses->totalSeatsByLicenseID();
|
||||
})
|
||||
->addColumn('remaining', function($licenses) {
|
||||
return $licenses->remaincount();
|
||||
})
|
||||
->addColumn('purchase_date', function($licenses) {
|
||||
return $licenses->purchase_date;
|
||||
})
|
||||
->addColumn('notes', function($licenses) {
|
||||
return $licenses->notes;
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('name','serial','totalSeats','remaining','purchase_date','actions','notes','license_name','license_email')
|
||||
->orderColumns('name','serial','totalSeats','remaining','purchase_date','actions','notes','license_name','license_email')
|
||||
->make();
|
||||
$allowed_columns = ['id','name','serial'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$licenses = $licenses->orderBy($sort, $order);
|
||||
|
||||
$licenseCount = $licenses->count();
|
||||
$licenses = $licenses->skip(Input::get('offset'))->take(Input::get('limit'))->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($licenses as $license) {
|
||||
$actions = '<span style="white-space: nowrap;"><a href="'.route('freecheckout/license', $license->id).'" class="btn btn-primary btn-sm" style="margin-right:5px;" '.(($license->remaincount() > 0) ? '' : 'disabled').'>'.Lang::get('general.checkout').'</a> <a href="'.route('clone/license', $license->id).'" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a><a href="'.route('update/license', $license->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/license', $license->id).'" data-content="'.Lang::get('admin/licenses/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($license->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></span>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $license->id,
|
||||
'name' => link_to('/admin/licenses/'.$license->id.'/view', $license->name),
|
||||
'serial' => link_to('/admin/licenses/'.$license->id.'/view', mb_strimwidth($license->serial, 0, 50, "...")),
|
||||
'totalSeats' => $license->totalSeatsByLicenseID(),
|
||||
'remaining' => $license->remaincount(),
|
||||
'purchase_date' => ($license->purchase_date) ? $license->purchase_date : '',
|
||||
'actions' => $actions,
|
||||
'companyName' => is_null($license->company) ? '' : e($license->company->name)
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $licenseCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getFreeLicense($licenseId) {
|
||||
|
||||
@@ -75,7 +75,7 @@ class LocationsController extends AdminController
|
||||
} else {
|
||||
$location->parent_id = e(Input::get('parent_id'));
|
||||
}
|
||||
$location->currency = Input::get('currency','$');
|
||||
$location->currency = e(Input::get('currency','$'));
|
||||
$location->address = e(Input::get('address'));
|
||||
$location->address2 = e(Input::get('address2'));
|
||||
$location->city = e(Input::get('city'));
|
||||
@@ -143,6 +143,7 @@ class LocationsController extends AdminController
|
||||
}
|
||||
|
||||
// Redirect to the location create page
|
||||
/** @noinspection PhpUnreachableStatementInspection Known to be unreachable but kept following discussion: https://github.com/snipe/snipe-it/pull/1423 */
|
||||
return Redirect::to('admin/settings/locations/create')->with('error', Lang::get('admin/locations/message.create.error'));
|
||||
}
|
||||
|
||||
@@ -202,7 +203,7 @@ class LocationsController extends AdminController
|
||||
} else {
|
||||
$location->parent_id = e(Input::get('parent_id',''));
|
||||
}
|
||||
$location->currency = Input::get('currency','$');
|
||||
$location->currency = e(Input::get('currency','$'));
|
||||
$location->address = e(Input::get('address'));
|
||||
$location->address2 = e(Input::get('address2'));
|
||||
$location->city = e(Input::get('city'));
|
||||
@@ -255,5 +256,159 @@ class LocationsController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the location page detail page
|
||||
*
|
||||
* @param int $locationID
|
||||
* @return View
|
||||
**/
|
||||
public function getView($locationId = null)
|
||||
{
|
||||
$location = Location::find($locationId);
|
||||
|
||||
if (isset($location->id)) {
|
||||
return View::make('backend/locations/view', compact('location'));
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/locations/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('locations')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the locations API information to present to the location view page
|
||||
*
|
||||
* @param int $locationID
|
||||
* @return JSON
|
||||
**/
|
||||
public function getDatatable()
|
||||
{
|
||||
$locations = Location::select(array('locations.id','locations.name','locations.address','locations.address2','locations.city','locations.state','locations.zip','locations.country','locations.parent_id','locations.currency'))->with('assets');
|
||||
|
||||
|
||||
if (Input::has('search')) {
|
||||
$locations = $locations->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
|
||||
|
||||
switch (Input::get('sort'))
|
||||
{
|
||||
case 'parent':
|
||||
$locations = $locations->OrderParent($order);
|
||||
break;
|
||||
default:
|
||||
$allowed_columns = ['id','name','address','city','state','country','currency'];
|
||||
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
$locations = $locations->orderBy($sort, $order);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$locationsCount = $locations->count();
|
||||
$locations = $locations->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach($locations as $location) {
|
||||
$actions = '<nobr><a href="'.route('update/location', $location->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/location', $location->id).'" data-content="'.Lang::get('admin/locations/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($location->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $location->id,
|
||||
'name' => link_to('admin/settings/locations/'.$location->id.'/view', $location->name),
|
||||
'parent' => ($location->parent) ? $location->parent->name : '',
|
||||
// 'assets' => ($location->assets->count() + $location->assignedassets->count()),
|
||||
'assets_default' => $location->assignedassets->count(),
|
||||
'assets_checkedout' => $location->assets->count(),
|
||||
'address' => ($location->address) ? $location->address: '',
|
||||
'city' => $location->city,
|
||||
'state' => $location->state,
|
||||
'country' => $location->country,
|
||||
'currency' => $location->currency,
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $locationsCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the location user listing information to present to the location details page
|
||||
*
|
||||
* @param int $locationID
|
||||
* @return JSON
|
||||
**/
|
||||
public function getDataViewUsers($locationID)
|
||||
{
|
||||
$location = Location::find($locationID);
|
||||
$location_users = $location->users;
|
||||
$count = $location_users->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($location_users as $user) {
|
||||
$rows[] = array(
|
||||
'name' => link_to('/admin/users/'.$user->id.'/view', $user->fullName())
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the location asset information to present to the location details page
|
||||
*
|
||||
* @param int $locationID
|
||||
* @return JSON
|
||||
**/
|
||||
public function getDataViewAssets($locationID)
|
||||
{
|
||||
$location = Location::find($locationID);
|
||||
$count = $location->assets->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($location->assets as $asset) {
|
||||
$rows[] = array(
|
||||
'name' => link_to('/hardware/'.$asset->id.'/view', $asset->showAssetName()),
|
||||
'asset_tag' => $asset->asset_tag,
|
||||
'serial' => $asset->serial,
|
||||
'model' => $asset->model->name,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php namespace Controllers\Admin;
|
||||
|
||||
use AdminController;
|
||||
use Company;
|
||||
use Input;
|
||||
use Lang;
|
||||
use Manufacturer;
|
||||
@@ -20,9 +21,6 @@ class ManufacturersController extends AdminController
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
// Grab all the manufacturers
|
||||
$manufacturers = Manufacturer::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
// Show the page
|
||||
return View::make('backend/manufacturers/index', compact('manufacturers'));
|
||||
}
|
||||
@@ -192,7 +190,124 @@ class ManufacturersController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function getDatatable()
|
||||
{
|
||||
$manufacturers = Manufacturer::select(array('id','name'))->with('assets')
|
||||
->whereNull('deleted_at');
|
||||
|
||||
if (Input::has('search')) {
|
||||
$manufacturers = $manufacturers->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$allowed_columns = ['id','name'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$manufacturers->orderBy($sort, $order);
|
||||
|
||||
$manufacturersCount = $manufacturers->count();
|
||||
$manufacturers = $manufacturers->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach($manufacturers as $manufacturer) {
|
||||
$actions = '<a href="'.route('update/manufacturer', $manufacturer->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/manufacturer', $manufacturer->id).'" data-content="'.Lang::get('admin/manufacturers/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($manufacturer->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $manufacturer->id,
|
||||
'name' => link_to('admin/settings/manufacturers/'.$manufacturer->id.'/view', $manufacturer->name),
|
||||
'assets' => $manufacturer->assetscount(),
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $manufacturersCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getDataView($manufacturerID) {
|
||||
|
||||
$manufacturer = Manufacturer::with('assets.company')->find($manufacturerID);
|
||||
$manufacturer_assets = $manufacturer->assets;
|
||||
|
||||
if (Input::has('search')) {
|
||||
$manufacturer_assets = $manufacturer_assets->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
$allowed_columns = ['id','name','serial','asset_tag'];
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
$count = $manufacturer_assets->count();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($manufacturer_assets as $asset) {
|
||||
|
||||
$actions = '';
|
||||
if ($asset->deleted_at=='') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->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', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
} elseif ($asset->deleted_at!='') {
|
||||
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if ($asset->assetstatus->deployable != 0) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
|
||||
} else {
|
||||
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$row = array(
|
||||
'id' => $asset->id,
|
||||
'name' => link_to('/hardware/'.$asset->id.'/view', $asset->showAssetName()),
|
||||
'model' => $asset->model->name,
|
||||
'asset_tag' => $asset->asset_tag,
|
||||
'serial' => $asset->serial,
|
||||
'assigned_to' => ($asset->assigneduser) ? link_to('/admin/users/'.$asset->assigneduser->id.'/view', $asset->assigneduser->fullName()): '',
|
||||
'actions' => $actions,
|
||||
'companyName' => Company::getName($asset),
|
||||
);
|
||||
|
||||
if (isset($inout)) { $row['change'] = $inout; }
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ use Str;
|
||||
use Validator;
|
||||
use View;
|
||||
use Datatable;
|
||||
use Asset;
|
||||
use Company;
|
||||
use Config;
|
||||
|
||||
//use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
@@ -79,7 +82,7 @@ class ModelsController extends AdminController
|
||||
if ($validator->fails())
|
||||
{
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->with('error', Lang::get('admin/models/message.create.duplicate_set'));;
|
||||
return Redirect::back()->withInput()->with('error', Lang::get('admin/models/message.create.duplicate_set'));
|
||||
}
|
||||
|
||||
|
||||
@@ -112,8 +115,13 @@ class ModelsController extends AdminController
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
$model->category_id = e(Input::get('category_id'));
|
||||
$model->note = e(Input::get('note'));
|
||||
$model->user_id = Sentry::getId();
|
||||
$model->show_mac_address = e(Input::get('show_mac_address', '0'));
|
||||
if (Input::get('custom_fieldset')!='') {
|
||||
$model->fieldset_id = e(Input::get('custom_fieldset'));
|
||||
}
|
||||
|
||||
//$model->show_mac_address = e(Input::get('show_mac_address', '0'));
|
||||
|
||||
|
||||
if (Input::file('image')) {
|
||||
@@ -159,6 +167,7 @@ class ModelsController extends AdminController
|
||||
$model->category_id = e(Input::get('category_id'));
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->user_id = Sentry::getUser()->id;
|
||||
$model->note = e(Input::get('note'));
|
||||
$model->eol=0;
|
||||
|
||||
if($model->save()) {
|
||||
@@ -236,7 +245,12 @@ class ModelsController extends AdminController
|
||||
$model->modelno = e(Input::get('modelno'));
|
||||
$model->manufacturer_id = e(Input::get('manufacturer_id'));
|
||||
$model->category_id = e(Input::get('category_id'));
|
||||
$model->show_mac_address = e(Input::get('show_mac_address', '0'));
|
||||
$model->note = e(Input::get('note'));
|
||||
if (Input::get('custom_fieldset')=='') {
|
||||
$model->fieldset_id = null;
|
||||
} else {
|
||||
$model->fieldset_id = e(Input::get('custom_fieldset'));
|
||||
}
|
||||
|
||||
if (Input::file('image')) {
|
||||
$image = Input::file('image');
|
||||
@@ -317,9 +331,9 @@ class ModelsController extends AdminController
|
||||
|
||||
|
||||
/**
|
||||
* Get the asset information to present to the model view page
|
||||
* Get the model information to present to the model view page
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $modelId
|
||||
* @return View
|
||||
**/
|
||||
public function getView($modelId = null)
|
||||
@@ -339,7 +353,14 @@ class ModelsController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function getClone($modelId = null)
|
||||
/**
|
||||
* Get the clone page to clone a model
|
||||
*
|
||||
* @param int $modelId
|
||||
* @return View
|
||||
**/
|
||||
|
||||
public function getClone($modelId = null)
|
||||
{
|
||||
// Check if the model exists
|
||||
if (is_null($model_to_clone = Model::find($modelId))) {
|
||||
@@ -364,79 +385,155 @@ class ModelsController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function getDatatable($status = null)
|
||||
|
||||
public function getCustomFields($modelId)
|
||||
{
|
||||
$models = Model::orderBy('created_at', 'DESC')->with('category','assets','depreciation');
|
||||
($status != 'Deleted') ?: $models->withTrashed()->Deleted();;
|
||||
$models = $models->get();
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function($models) {
|
||||
if($models->deleted_at=='') {
|
||||
return '<a href="'.route('update/model', $models->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/model', $models->id).'" data-content="'.Lang::get('admin/models/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($models->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
} else {
|
||||
return '<a href="'.route('restore/model', $models->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
});
|
||||
|
||||
return Datatable::collection($models)
|
||||
->addColumn('manufacturer', function($models) {
|
||||
return $models->manufacturer->name;
|
||||
})
|
||||
->addColumn('name', function ($models) {
|
||||
return link_to('/hardware/models/'.$models->id.'/view', $models->name);
|
||||
})
|
||||
->showColumns('modelno')
|
||||
->addColumn('asset_count', function($models) {
|
||||
return $models->assets->count();
|
||||
})
|
||||
->addColumn('depreciation', function($models) {
|
||||
return (($models->depreciation)&&($models->depreciation->id > 0)) ? $models->depreciation->name.' ('.$models->depreciation->months.')' : Lang::get('general.no_depreciation');
|
||||
})
|
||||
->addColumn('category', function($models) {
|
||||
return ($models->category) ? $models->category->name : '';
|
||||
})
|
||||
->addColumn('eol', function($models) {
|
||||
return ($models->eol) ? $models->eol.' '.Lang::get('general.months') : '';
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('name','modelno','asset_count','depreciation','category','eol','actions')
|
||||
->orderColumns('name','modelno','asset_count','depreciation','category','eol','actions')
|
||||
->make();
|
||||
$model=Model::find($modelId);
|
||||
return View::make("backend.models.custom_fields_form")->with("model",$model);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the JSON response for the bootstrap table list view
|
||||
*
|
||||
* @param string $status
|
||||
* @return JSON
|
||||
**/
|
||||
|
||||
public function getDatatable($status = null)
|
||||
{
|
||||
$models = Model::with('category','assets','depreciation');
|
||||
|
||||
switch ($status) {
|
||||
case 'Deleted':
|
||||
$models->withTrashed()->Deleted();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (Input::has('search')) {
|
||||
$models = $models->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
|
||||
$allowed_columns = ['id','name','modelno'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$models = $models->orderBy($sort, $order);
|
||||
|
||||
$modelCount = $models->count();
|
||||
$models = $models->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($models as $model) {
|
||||
if ($model->deleted_at == '') {
|
||||
$actions = '<div style=" white-space: nowrap;"><a href="'.route('update/model', $model->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/model', $model->id).'" data-content="'.Lang::get('admin/models/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($model->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
|
||||
} else {
|
||||
$actions = '<a href="'.route('restore/model', $model->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $model->id,
|
||||
'manufacturer' => link_to('/admin/settings/manufacturers/'.$model->manufacturer->id.'/view', $model->manufacturer->name),
|
||||
'name' => link_to('/hardware/models/'.$model->id.'/view', $model->name),
|
||||
'image' => ($model->image!='') ? '<img src="'.Config::get('app.url').'/uploads/models/'.$model->image.'" height=50 width=50>' : '',
|
||||
'modelnumber' => $model->modelno,
|
||||
'numassets' => $model->assets->count(),
|
||||
'depreciation' => (($model->depreciation)&&($model->depreciation->id > 0)) ? $model->depreciation->name.' ('.$model->depreciation->months.')' : Lang::get('general.no_depreciation'),
|
||||
'category' => ($model->category) ? $model->category->name : '',
|
||||
'eol' => ($model->eol) ? $model->eol.' '.Lang::get('general.months') : '',
|
||||
'note' => $model->getNote(),
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $modelCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the asset information to present to the model view page
|
||||
*
|
||||
* @param int $modelID
|
||||
* @return View
|
||||
**/
|
||||
public function getDataView($modelID)
|
||||
{
|
||||
$model = Model::withTrashed()->find($modelID);
|
||||
$modelassets = $model->assets;
|
||||
$assets = Asset::where('model_id','=',$modelID)->withTrashed()->with('company');
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($modelassets)
|
||||
{
|
||||
if (($modelassets->assigned_to !='') && ($modelassets->assigned_to > 0)) {
|
||||
return '<a href="'.route('checkin/hardware', $modelassets->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
|
||||
} else {
|
||||
return '<a href="'.route('checkout/hardware', $modelassets->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
|
||||
if (Input::has('search')) {
|
||||
$assets = $assets->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
|
||||
$allowed_columns = ['name', 'serial','asset_tag'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$assets = $assets->orderBy($sort, $order);
|
||||
|
||||
$assetsCount = $assets->count();
|
||||
$assets = $assets->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
$actions = '';
|
||||
|
||||
if ($asset->assetstatus) {
|
||||
if ($asset->assetstatus->deployable != 0) {
|
||||
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
|
||||
$actions = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
|
||||
} else {
|
||||
$actions = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Datatable::collection($modelassets)
|
||||
->addColumn('name', function ($modelassets) {
|
||||
return link_to('/hardware/'.$modelassets->id.'/view', $modelassets->showAssetName());
|
||||
// return $modelassets->name;
|
||||
})
|
||||
->addColumn('asset_tag', function ($modelassets) {
|
||||
return link_to('/hardware/'.$modelassets->id.'/view', $modelassets->asset_tag);
|
||||
})
|
||||
->showColumns('serial')
|
||||
->addColumn('assigned_to', function ($modelassets) {
|
||||
if ($modelassets->assigned_to) {
|
||||
return link_to('/admin/users/'.$modelassets->assigned_to.'/view', $modelassets->assigneduser->fullName());
|
||||
}
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('name','asset_tag','serial','assigned_to','actions')
|
||||
->orderColumns('name','asset_tag','serial','assigned_to','actions')
|
||||
->make();
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $asset->id,
|
||||
'name' => link_to('/hardware/'.$asset->id.'/view', $asset->showAssetName()),
|
||||
'asset_tag' => link_to('hardware/'.$asset->id.'/view', $asset->asset_tag),
|
||||
'serial' => $asset->serial,
|
||||
'assigned_to' => ($asset->assigned_to) ? link_to('/admin/users/'.$asset->assigned_to.'/view', $asset->assigneduser->fullName()) : '',
|
||||
'actions' => $actions,
|
||||
'companyName' => Company::getName($asset)
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $assetsCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use Asset;
|
||||
use AssetMaintenance;
|
||||
use Carbon\Carbon;
|
||||
use Category;
|
||||
use Company;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
@@ -30,7 +31,8 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function getAccessoryReport()
|
||||
{
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->get();
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->with('company')->get();
|
||||
|
||||
return View::make('backend/reports/accessories', compact('accessories'));
|
||||
}
|
||||
|
||||
@@ -42,6 +44,7 @@ class ReportsController extends AdminController
|
||||
public function exportAccessoryReport()
|
||||
{
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
$rows = array();
|
||||
$header = array(
|
||||
Lang::get('admin/accessories/table.title'),
|
||||
@@ -78,10 +81,9 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function getAssetsReport()
|
||||
{
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::with( 'model', 'assigneduser.userLoc', 'assetstatus', 'defaultLoc', 'assetlog', 'supplier',
|
||||
'model.manufacturer' )
|
||||
'model.manufacturer', 'company' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
@@ -95,10 +97,8 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function exportAssetReport()
|
||||
{
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
$assets = Asset::orderBy( 'created_at', 'DESC' )->get();
|
||||
|
||||
$rows = [ ];
|
||||
|
||||
@@ -162,7 +162,7 @@ class ReportsController extends AdminController
|
||||
|
||||
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
|
||||
$location = Location::find( $asset->assigneduser->location_id );
|
||||
if ($location->name) {
|
||||
if ($location) {
|
||||
$row[] = $location->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
@@ -205,9 +205,8 @@ class ReportsController extends AdminController
|
||||
{
|
||||
|
||||
// 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', 'company' )
|
||||
->orderBy( 'created_at', 'DESC' )->get();
|
||||
|
||||
return View::make( 'backend/reports/depreciation', compact( 'assets' ) );
|
||||
}
|
||||
@@ -222,8 +221,7 @@ class ReportsController extends AdminController
|
||||
|
||||
// Grab all the assets
|
||||
$assets = Asset::with( 'model', 'assigneduser', 'assetstatus', 'defaultLoc', 'assetlog' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
->orderBy( 'created_at', 'DESC' )->get();
|
||||
|
||||
$csv = \League\Csv\Writer::createFromFileObject( new \SplTempFileObject() );
|
||||
$csv->setOutputBOM( Reader::BOM_UTF16_BE );
|
||||
@@ -296,10 +294,8 @@ class ReportsController extends AdminController
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
|
||||
public function getActivityReport()
|
||||
{
|
||||
|
||||
$log_actions = Actionlog::orderBy( 'created_at', 'DESC' )
|
||||
->with( 'adminlog' )
|
||||
->with( 'accessorylog' )
|
||||
@@ -321,6 +317,7 @@ class ReportsController extends AdminController
|
||||
{
|
||||
|
||||
$licenses = License::orderBy( 'created_at', 'DESC' )
|
||||
->with( 'company' )
|
||||
->get();
|
||||
|
||||
return View::make( 'backend/reports/licenses', compact( 'licenses' ) );
|
||||
@@ -333,9 +330,8 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function exportLicenseReport()
|
||||
{
|
||||
$licenses = License::orderBy( 'created_at', 'DESC' )->get();
|
||||
|
||||
$licenses = License::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
$rows = [ ];
|
||||
$header = [
|
||||
Lang::get( 'admin/licenses/table.title' ),
|
||||
@@ -380,9 +376,8 @@ class ReportsController extends AdminController
|
||||
|
||||
public function postCustom()
|
||||
{
|
||||
$assets = Asset::orderBy( 'created_at', 'DESC' )->get();
|
||||
|
||||
$assets = Asset::orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
$rows = [ ];
|
||||
$header = [ ];
|
||||
|
||||
@@ -405,7 +400,7 @@ class ReportsController extends AdminController
|
||||
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' ) ) != '1' )) {
|
||||
$header[] = 'Purchase Cost';
|
||||
}
|
||||
if (e( Input::get( 'order' ) ) == '1') {
|
||||
@@ -461,7 +456,7 @@ class ReportsController extends AdminController
|
||||
if (e( Input::get( 'purchase_date' ) ) == '1') {
|
||||
$row[] = $asset->purchase_date;
|
||||
}
|
||||
if (e( Input::get( 'purchase_cost' ) ) == '1') {
|
||||
if (e( Input::get( 'purchase_cost' ) ) == '1' && ( e( Input::get( 'depreciation' ) ) != '1' )) {
|
||||
$row[] = '"' . number_format( $asset->purchase_cost ) . '"';
|
||||
}
|
||||
if (e( Input::get( 'order' ) ) == '1') {
|
||||
@@ -479,23 +474,25 @@ class ReportsController extends AdminController
|
||||
}
|
||||
}
|
||||
if (e( Input::get( 'location' ) ) == '1') {
|
||||
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id > 0 )) {
|
||||
$show_loc = '';
|
||||
if (( $asset->assigned_to > 0 ) && ( $asset->assigneduser->location_id !='' )) {
|
||||
$location = Location::find( $asset->assigneduser->location_id );
|
||||
if ($location->name) {
|
||||
$row[] = $location->name;
|
||||
if ($location) {
|
||||
$show_loc .= $location->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
$show_loc .= 'User location '.$asset->assigneduser->location_id.' is invalid';
|
||||
}
|
||||
} elseif ($asset->rtd_location_id) {
|
||||
} elseif ($asset->rtd_location_id!='') {
|
||||
$location = Location::find( $asset->rtd_location_id );
|
||||
if ($location->name) {
|
||||
$row[] = $location->name;
|
||||
if ($location) {
|
||||
$show_loc .= $location->name;
|
||||
} else {
|
||||
$row[] = '';
|
||||
$show_loc .= 'Default location '.$asset->rtd_location_id.' is invalid';
|
||||
}
|
||||
} else {
|
||||
$row[] = ''; // Empty string if location is not set
|
||||
}
|
||||
|
||||
$row[] = $show_loc;
|
||||
|
||||
}
|
||||
if (e( Input::get( 'assigned_to' ) ) == '1') {
|
||||
if ($asset->assigned_to > 0) {
|
||||
@@ -557,9 +554,8 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function getAssetMaintenancesReport()
|
||||
{
|
||||
|
||||
// Grab all the improvements
|
||||
$assetMaintenances = \AssetMaintenance::with( 'asset', 'supplier' )
|
||||
$assetMaintenances = \AssetMaintenance::with( 'asset', 'supplier', 'asset.company' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
->get();
|
||||
|
||||
@@ -576,7 +572,6 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function exportAssetMaintenancesReport()
|
||||
{
|
||||
|
||||
// Grab all the improvements
|
||||
$assetMaintenances = AssetMaintenance::with( 'asset', 'supplier' )
|
||||
->orderBy( 'created_at', 'DESC' )
|
||||
@@ -635,12 +630,9 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
public function getAssetAcceptanceReport()
|
||||
{
|
||||
|
||||
$assetsForReport = Asset::notYetAccepted()
|
||||
->get();
|
||||
$assetsForReport = Asset::notYetAccepted()->with( 'company' )->get();
|
||||
|
||||
return View::make( 'backend/reports/unaccepted_assets', compact( 'assetsForReport' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -701,12 +693,13 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
protected function getCheckedOutAssetsRequiringAcceptance( $modelsInCategoriesThatRequireAcceptance )
|
||||
{
|
||||
$assets = Asset::deployed()
|
||||
->inModelList( $modelsInCategoriesThatRequireAcceptance )
|
||||
->select( 'id' )
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return array_pluck( Asset::deployed()
|
||||
->inModelList( $modelsInCategoriesThatRequireAcceptance )
|
||||
->select( 'id' )
|
||||
->get()
|
||||
->toArray(), 'id' );
|
||||
return array_pluck( $assets, 'id' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -767,7 +760,6 @@ class ReportsController extends AdminController
|
||||
*/
|
||||
protected function getAssetsNotAcceptedYet()
|
||||
{
|
||||
|
||||
return Asset::unaccepted();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ use Image;
|
||||
use Config;
|
||||
use Response;
|
||||
use Artisan;
|
||||
use Crypt;
|
||||
|
||||
|
||||
class SettingsController extends AdminController
|
||||
{
|
||||
@@ -35,22 +37,30 @@ class SettingsController extends AdminController
|
||||
|
||||
/**
|
||||
* Setting update.
|
||||
*
|
||||
* @param int $settingId
|
||||
* @return View
|
||||
*/
|
||||
public function getEdit()
|
||||
{
|
||||
$settings = Setting::orderBy('created_at', 'DESC')->paginate(10);
|
||||
$setting = Setting::first();
|
||||
$is_gd_installed = extension_loaded('gd');
|
||||
return View::make('backend/settings/edit', compact('settings', 'is_gd_installed'));
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($settings);
|
||||
// echo '</pre>';
|
||||
// exit;
|
||||
|
||||
if ($setting->ldap_pword!='') {
|
||||
$show_ldap_pword = Crypt::decrypt($setting->ldap_pword);
|
||||
} else {
|
||||
$show_ldap_pword = '';
|
||||
}
|
||||
return View::make('backend/settings/edit', compact('setting'))->with('is_gd_installed',$is_gd_installed)->with('show_ldap_pword',$show_ldap_pword);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting update form processing page.
|
||||
*
|
||||
* @param int $settingId
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postEdit()
|
||||
@@ -68,7 +78,8 @@ class SettingsController extends AdminController
|
||||
// Declare the rules for the form validation
|
||||
|
||||
$rules = array(
|
||||
"per_page" => 'required|min:1|numeric',
|
||||
"brand" => 'required|min:1|numeric',
|
||||
"per_page" => 'required|min:1|numeric',
|
||||
"qr_text" => 'min:1|max:31',
|
||||
"logo" => 'mimes:jpeg,bmp,png,gif',
|
||||
"custom_css" => 'alpha_space',
|
||||
@@ -77,12 +88,20 @@ class SettingsController extends AdminController
|
||||
"default_currency" => 'required',
|
||||
"slack_channel" => 'regex:/(?<!\w)#\w+/',
|
||||
"slack_botname" => 'alpha_dash',
|
||||
"ldap_server" => 'sometimes|required_if:ldap_enabled,1|url',
|
||||
"ldap_uname" => 'sometimes|required_if:ldap_enabled,1',
|
||||
"ldap_pword" => 'sometimes|required_if:ldap_enabled,1',
|
||||
"ldap_basedn" => 'sometimes|required_if:ldap_enabled,1',
|
||||
"ldap_filter" => 'sometimes|required_if:ldap_enabled,1',
|
||||
"ldap_username_field" => 'sometimes|required_if:ldap_enabled,1',
|
||||
"ldap_lname_field" => 'sometimes|required_if:ldap_enabled,1',
|
||||
"ldap_auth_filter_query" => 'sometimes|required_if:ldap_enabled,1',
|
||||
"ldap_version" => 'sometimes|required_if:ldap_enabled,1',
|
||||
);
|
||||
|
||||
if (Config::get('app.lock_passwords')==false) {
|
||||
$rules['site_name'] = 'required|min:3';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new validator instance from our validation rules
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
@@ -115,6 +134,7 @@ class SettingsController extends AdminController
|
||||
|
||||
if (Config::get('app.lock_passwords')==false) {
|
||||
$setting->site_name = e(Input::get('site_name'));
|
||||
$setting->brand = e(Input::get('brand'));
|
||||
$setting->custom_css = e(Input::get('custom_css'));
|
||||
}
|
||||
|
||||
@@ -133,6 +153,25 @@ class SettingsController extends AdminController
|
||||
$setting->slack_endpoint = e(Input::get('slack_endpoint'));
|
||||
$setting->slack_channel = e(Input::get('slack_channel'));
|
||||
$setting->slack_botname = e(Input::get('slack_botname'));
|
||||
$setting->ldap_enabled = Input::get('ldap_enabled', '0');
|
||||
$setting->ldap_server = Input::get('ldap_server');
|
||||
$setting->ldap_server_cert_ignore = Input::get('ldap_server_cert_ignore', false);
|
||||
$setting->ldap_uname = Input::get('ldap_uname');
|
||||
$setting->ldap_pword = Crypt::encrypt(Input::get('ldap_pword'));
|
||||
$setting->ldap_basedn = Input::get('ldap_basedn');
|
||||
$setting->ldap_filter = Input::get('ldap_filter');
|
||||
$setting->ldap_username_field = Input::get('ldap_username_field');
|
||||
$setting->ldap_lname_field = Input::get('ldap_lname_field');
|
||||
$setting->ldap_fname_field = Input::get('ldap_fname_field');
|
||||
$setting->ldap_auth_filter_query = Input::get('ldap_auth_filter_query');
|
||||
$setting->ldap_version = Input::get('ldap_version');
|
||||
$setting->ldap_active_flag = Input::get('ldap_active_flag');
|
||||
$setting->ldap_emp_num = Input::get('ldap_emp_num');
|
||||
$setting->ldap_email = Input::get('ldap_email');
|
||||
|
||||
if (Sentry::getUser()->isSuperUser()) {
|
||||
$setting->full_multiple_companies_support = e(Input::get('full_multiple_companies_support', '0'));
|
||||
}
|
||||
|
||||
|
||||
// Was the asset updated?
|
||||
@@ -202,11 +241,11 @@ class SettingsController extends AdminController
|
||||
|
||||
|
||||
/**
|
||||
* Download the dump file
|
||||
*
|
||||
* @param int $assetId
|
||||
* @return View
|
||||
**/
|
||||
* Download the dump file
|
||||
*
|
||||
* @param string|null $filename
|
||||
* @return View
|
||||
*/
|
||||
public function downloadFile($filename = null)
|
||||
{
|
||||
if (!Config::get('app.lock_passwords')) {
|
||||
@@ -227,11 +266,11 @@ class SettingsController extends AdminController
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the dump file
|
||||
*
|
||||
* @param int $assetId
|
||||
* @return View
|
||||
**/
|
||||
* Download the dump file
|
||||
*
|
||||
* @param string|null $filename
|
||||
* @return View
|
||||
*/
|
||||
public function deleteFile($filename = null)
|
||||
{
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ class StatuslabelsController extends AdminController
|
||||
|
||||
public function getIndex()
|
||||
{
|
||||
// Grab all the statuslabels
|
||||
$statuslabels = Statuslabel::orderBy('created_at', 'DESC')->get();
|
||||
|
||||
// Show the page
|
||||
return View::make('backend/statuslabels/index', compact('statuslabels'));
|
||||
}
|
||||
@@ -230,5 +227,67 @@ class StatuslabelsController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function getDatatable()
|
||||
{
|
||||
$statuslabels = Statuslabel::select(array('id','name','deployable','pending','archived'))
|
||||
->whereNull('deleted_at');
|
||||
|
||||
if (Input::has('search')) {
|
||||
$statuslabels = $statuslabels->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$allowed_columns = ['id','name'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$statuslabels->orderBy($sort, $order);
|
||||
|
||||
$statuslabelsCount = $statuslabels->count();
|
||||
$statuslabels = $statuslabels->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach($statuslabels as $statuslabel) {
|
||||
|
||||
if ($statuslabel->deployable == 1) {
|
||||
$label_type = Lang::get('admin/statuslabels/table.deployable');
|
||||
} elseif ($statuslabel->pending == 1) {
|
||||
$label_type = Lang::get('admin/statuslabels/table.pending');
|
||||
} elseif ($statuslabel->archived == 1) {
|
||||
$label_type = Lang::get('admin/statuslabels/table.archived');
|
||||
} else {
|
||||
$label_type = Lang::get('admin/statuslabels/table.undeployable');
|
||||
}
|
||||
|
||||
$actions = '<a href="'.route('update/statuslabel', $statuslabel->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/statuslabel', $statuslabel->id).'" data-content="'.Lang::get('admin/statuslabels/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($statuslabel->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $statuslabel->id,
|
||||
'type' => $label_type,
|
||||
'name' => e($statuslabel->name),
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $statuslabelsCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ 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;
|
||||
@@ -115,7 +115,7 @@ class SuppliersController extends AdminController
|
||||
//$supplier->fill($new);
|
||||
$supplier->name=$new['name'];
|
||||
$supplier->user_id = Sentry::getId();
|
||||
|
||||
|
||||
if($supplier->save()) {
|
||||
return JsonResponse::create($supplier);
|
||||
} else {
|
||||
@@ -163,7 +163,7 @@ class SuppliersController extends AdminController
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
// The given data did not pass validation
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->withErrors($validator->messages());
|
||||
}
|
||||
// attempt validation
|
||||
@@ -204,7 +204,7 @@ class SuppliersController extends AdminController
|
||||
// Redirect to the new supplier page
|
||||
return Redirect::to("admin/settings/suppliers")->with('success', Lang::get('admin/suppliers/message.update.success'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to the supplier management page
|
||||
return Redirect::to("admin/settings/suppliers/$supplierId/edit")->with('error', Lang::get('admin/suppliers/message.update.error'));
|
||||
@@ -264,6 +264,61 @@ class SuppliersController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function getDatatable()
|
||||
{
|
||||
$suppliers = Supplier::select(array('id','name','address','address2','city','state','country','fax', 'phone','email','contact'))
|
||||
->whereNull('deleted_at');
|
||||
|
||||
if (Input::has('search')) {
|
||||
$suppliers = $suppliers->TextSearch(e(Input::get('search')));
|
||||
}
|
||||
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$allowed_columns = ['id','name','address','phone','contact','fax','email'];
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
||||
|
||||
$suppliers->orderBy($sort, $order);
|
||||
|
||||
$suppliersCount = $suppliers->count();
|
||||
$suppliers = $suppliers->skip($offset)->take($limit)->get();
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach($suppliers as $supplier) {
|
||||
$actions = '<a href="'.route('update/supplier', $supplier->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/supplier', $supplier->id).'" data-content="'.Lang::get('admin/suppliers/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($supplier->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $supplier->id,
|
||||
'name' => link_to('admin/settings/suppliers/'.$supplier->id.'/view', $supplier->name),
|
||||
'contact' => $supplier->contact,
|
||||
'address' => $supplier->address.' '.$supplier->address2.' '.$supplier->city.' '.$supplier->state.' '.$supplier->country,
|
||||
'phone' => $supplier->phone,
|
||||
'fax' => $supplier->fax,
|
||||
'email' => ($supplier->email!='') ? '<a href="mailto:'.$supplier->email.'">'.$supplier->email.'</a>' : '',
|
||||
'assets' => $supplier->num_assets(),
|
||||
'licenses' => $supplier->num_licenses(),
|
||||
'actions' => $actions
|
||||
);
|
||||
}
|
||||
|
||||
$data = array('total' => $suppliersCount, 'rows' => $rows);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use DB;
|
||||
use Input;
|
||||
use User;
|
||||
use Asset;
|
||||
use Company;
|
||||
use Lang;
|
||||
use Actionlog;
|
||||
use Location;
|
||||
@@ -31,6 +32,8 @@ use Mail;
|
||||
use Accessory;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Crypt;
|
||||
|
||||
|
||||
class UsersController extends AdminController {
|
||||
|
||||
@@ -40,13 +43,14 @@ class UsersController extends AdminController {
|
||||
* @var array
|
||||
*/
|
||||
protected $validationRules = array(
|
||||
'first_name' => 'required|alpha_space|min:2',
|
||||
'last_name' => 'required|alpha_space|min:2',
|
||||
'location_id' => 'numeric',
|
||||
'username' => 'required|min:2|unique:users,username',
|
||||
'email' => 'email|unique:users,email',
|
||||
'password' => 'required|min:6',
|
||||
'password_confirm' => 'required|min:6|same:password',
|
||||
'first_name' => 'required|alpha_space|min:1',
|
||||
'last_name' => 'required|alpha_space|min:1',
|
||||
'location_id' => 'numeric',
|
||||
'username' => 'required|min:2|unique:users,deleted_at,NULL',
|
||||
'email' => 'email|unique:users,email',
|
||||
'password' => 'required|min:6',
|
||||
'password_confirm' => 'required|same:password',
|
||||
'company_id' => 'integer',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -82,6 +86,7 @@ class UsersController extends AdminController {
|
||||
|
||||
$location_list = locationsList();
|
||||
$manager_list = managerList();
|
||||
$company_list = companyList();
|
||||
|
||||
/* echo '<pre>';
|
||||
print_r($userPermissions);
|
||||
@@ -93,6 +98,7 @@ class UsersController extends AdminController {
|
||||
return View::make('backend/users/edit', compact('groups', 'userGroups', 'permissions', 'userPermissions'))
|
||||
->with('location_list', $location_list)
|
||||
->with('manager_list', $manager_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('user', new User);
|
||||
}
|
||||
|
||||
@@ -102,6 +108,12 @@ class UsersController extends AdminController {
|
||||
* @return Redirect
|
||||
*/
|
||||
public function postCreate() {
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($this->validationRules);
|
||||
// echo '</pre>';
|
||||
// exit;
|
||||
|
||||
// Create a new validator instance from our validation rules
|
||||
$validator = Validator::make(Input::all(), $this->validationRules);
|
||||
$permissions = Input::get('permissions', array());
|
||||
@@ -120,6 +132,8 @@ class UsersController extends AdminController {
|
||||
// Get the inputs, with some exceptions
|
||||
$inputs = Input::except('csrf_token', 'password_confirm', 'groups', 'email_user');
|
||||
|
||||
$inputs['company_id'] = Company::getIdForUser(Input::get('company_id'));
|
||||
|
||||
// @TODO: Figure out WTF I need to do this.
|
||||
if ($inputs['manager_id'] == '') {
|
||||
unset($inputs['manager_id']);
|
||||
@@ -252,6 +266,10 @@ class UsersController extends AdminController {
|
||||
// Get the user information
|
||||
$user = Sentry::getUserProvider()->findById($id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
// Get this user groups
|
||||
$userGroups = $user->groups()->lists('group_id', 'name');
|
||||
|
||||
@@ -266,7 +284,8 @@ class UsersController extends AdminController {
|
||||
$permissions = Config::get('permissions');
|
||||
$this->encodeAllPermissions($permissions);
|
||||
|
||||
$location_list = array('' => '') + Location::lists('name', 'id');
|
||||
$location_list = locationsList();
|
||||
$company_list = companyList();
|
||||
$manager_list = array('' => 'Select a User') + DB::table('users')
|
||||
->select(DB::raw('concat(last_name,", ",first_name," (",email,")") as full_name, id'))
|
||||
->whereNull('deleted_at')
|
||||
@@ -285,6 +304,7 @@ class UsersController extends AdminController {
|
||||
// Show the page
|
||||
return View::make('backend/users/edit', compact('user', 'groups', 'userGroups', 'permissions', 'userPermissions'))
|
||||
->with('location_list', $location_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('manager_list', $manager_list);
|
||||
}
|
||||
|
||||
@@ -309,6 +329,10 @@ class UsersController extends AdminController {
|
||||
try {
|
||||
// Get the user information
|
||||
$user = Sentry::getUserProvider()->findById($id);
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
} catch (UserNotFoundException $e) {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
|
||||
@@ -347,18 +371,21 @@ class UsersController extends AdminController {
|
||||
|
||||
try {
|
||||
// Update the user
|
||||
$user->first_name = Input::get('first_name');
|
||||
$user->last_name = Input::get('last_name');
|
||||
$user->username = Input::get('username');
|
||||
$user->email = Input::get('email');
|
||||
$user->employee_num = Input::get('employee_num');
|
||||
$user->activated = Input::get('activated', $user->activated);
|
||||
$user->permissions = Input::get('permissions');
|
||||
$user->jobtitle = Input::get('jobtitle');
|
||||
$user->phone = Input::get('phone');
|
||||
$user->first_name = e(Input::get('first_name'));
|
||||
$user->last_name = e(Input::get('last_name'));
|
||||
$user->username = e(Input::get('username'));
|
||||
$user->email = e(Input::get('email'));
|
||||
$user->employee_num = e(Input::get('employee_num'));
|
||||
$user->activated = e(Input::get('activated', $user->activated));
|
||||
if (Sentry::getUser()->hasAccess('superuser')) {
|
||||
$user->permissions = Input::get('permissions');
|
||||
}
|
||||
$user->jobtitle = e(Input::get('jobtitle'));
|
||||
$user->phone = e(Input::get('phone'));
|
||||
$user->location_id = Input::get('location_id');
|
||||
$user->company_id = Company::getIdForUser(Input::get('company_id'));
|
||||
$user->manager_id = Input::get('manager_id');
|
||||
$user->notes = Input::get('notes');
|
||||
$user->notes = e(Input::get('notes'));
|
||||
|
||||
if ($user->manager_id == "") {
|
||||
$user->manager_id = NULL;
|
||||
@@ -376,7 +403,7 @@ class UsersController extends AdminController {
|
||||
|
||||
// Do we want to update the user email?
|
||||
if (!Config::get('app.lock_passwords')) {
|
||||
$user->email = Input::get('email');
|
||||
$user->email = e(Input::get('email'));
|
||||
}
|
||||
|
||||
// Get the current user groups
|
||||
@@ -412,7 +439,7 @@ class UsersController extends AdminController {
|
||||
$success = Lang::get('admin/users/message.success.update');
|
||||
|
||||
// Redirect to the user page
|
||||
return Redirect::route('view/user', $id)->with('success', $success);
|
||||
return Redirect::route('users')->with('success', $success);
|
||||
}
|
||||
|
||||
// Prepare the error message
|
||||
@@ -486,9 +513,12 @@ class UsersController extends AdminController {
|
||||
if ((!Input::has('edit_user')) || (count(Input::has('edit_user')) == 0)) {
|
||||
return Redirect::back()->with('error', 'No users selected');
|
||||
} else {
|
||||
$statuslabel_list = array('' => Lang::get('general.select_statuslabel')) + Statuslabel::orderBy('name', 'asc')->lists('name', 'id');
|
||||
$user_raw_array = Input::get('edit_user');
|
||||
$users = User::whereIn('id', $user_raw_array)->with('groups')->get();
|
||||
$statuslabel_list = statusLabelList();
|
||||
$user_raw_array = array_keys(Input::get('edit_user'));
|
||||
|
||||
$users = User::whereIn('id', $user_raw_array)->with('groups');
|
||||
$users = Company::scopeCompanyables($users)->get();
|
||||
|
||||
return View::make('backend/users/confirm-bulk-delete', compact('users', 'statuslabel_list'));
|
||||
}
|
||||
}
|
||||
@@ -508,11 +538,17 @@ class UsersController extends AdminController {
|
||||
unset($user_raw_array[$key]);
|
||||
}
|
||||
|
||||
if (!Sentry::getUser()->isSuperUser()) {
|
||||
return Redirect::route('users')->with('error', Lang::get('admin/users/message.insufficient_permissions'));
|
||||
}
|
||||
|
||||
if (!Config::get('app.lock_passwords')) {
|
||||
|
||||
$assets = Asset::whereIn('assigned_to', $user_raw_array)->get();
|
||||
$accessories = DB::table('accessories_users')->whereIn('assigned_to', $user_raw_array)->get();
|
||||
$users = User::whereIn('id', $user_raw_array)->delete();
|
||||
|
||||
$users = User::whereIn('id', $user_raw_array);
|
||||
$users = Company::scopeCompanyables($users)->delete();
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
|
||||
@@ -557,6 +593,7 @@ class UsersController extends AdminController {
|
||||
return Redirect::route('users')->with('error', 'Bulk delete is not enabled in this installation');
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnreachableStatementInspection Known to be unreachable but kept following discussion: https://github.com/snipe/snipe-it/pull/1423 */
|
||||
return Redirect::route('users')->with('error', 'An error has occurred');
|
||||
}
|
||||
}
|
||||
@@ -572,14 +609,20 @@ class UsersController extends AdminController {
|
||||
// Get user information
|
||||
$user = Sentry::getUserProvider()->createModel()->withTrashed()->find($id);
|
||||
|
||||
// Restore the user
|
||||
$user->restore();
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restore the user
|
||||
$user->restore();
|
||||
|
||||
// Prepare the success message
|
||||
$success = Lang::get('admin/users/message.success.restored');
|
||||
// Prepare the success message
|
||||
$success = Lang::get('admin/users/message.success.restored');
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('success', $success);
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('users')->with('success', $success);
|
||||
}
|
||||
} catch (UserNotFoundException $e) {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
|
||||
@@ -602,7 +645,12 @@ class UsersController extends AdminController {
|
||||
$userlog = $user->userlog->load('assetlog', 'consumablelog', 'assetlog.model', 'licenselog', 'accessorylog', 'userlog', 'adminlog');
|
||||
|
||||
if (isset($user->id)) {
|
||||
return View::make('backend/users/view', compact('user', 'userlog'));
|
||||
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
} else {
|
||||
return View::make('backend/users/view', compact('user', 'userlog'));
|
||||
}
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
|
||||
@@ -689,6 +737,7 @@ class UsersController extends AdminController {
|
||||
$this->encodeAllPermissions($permissions);
|
||||
|
||||
$location_list = array('' => '') + Location::lists('name', 'id');
|
||||
$company_list = companyList();
|
||||
$manager_list = array('' => 'Select a User') + DB::table('users')
|
||||
->select(DB::raw('concat(last_name,", ",first_name," (",email,")") as full_name, id'))
|
||||
->whereNull('deleted_at')
|
||||
@@ -700,6 +749,7 @@ class UsersController extends AdminController {
|
||||
// Show the page
|
||||
return View::make('backend/users/edit', compact('groups', 'userGroups', 'permissions', 'userPermissions'))
|
||||
->with('location_list', $location_list)
|
||||
->with('company_list', $company_list)
|
||||
->with('manager_list', $manager_list)
|
||||
->with('user', $user)
|
||||
->with('clone_user', $user_to_clone);
|
||||
@@ -762,7 +812,15 @@ class UsersController extends AdminController {
|
||||
$activated = '0';
|
||||
}
|
||||
|
||||
$pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10);
|
||||
$pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 15);
|
||||
|
||||
// Location
|
||||
if (array_key_exists('4',$row)) {
|
||||
$user_location_id = trim($row[4]);
|
||||
if ($user_location_id=='') {
|
||||
$user_location_id = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -780,7 +838,11 @@ class UsersController extends AdminController {
|
||||
'email' => $row[3],
|
||||
'password' => $pass,
|
||||
'activated' => $activated,
|
||||
'location_id' => $row[4],
|
||||
'location_id' => $user_location_id,
|
||||
'phone' => $row[5],
|
||||
'jobtitle' => $row[6],
|
||||
'employee_num' => $row[7],
|
||||
//'company_id' => Company::getIdForUser($row[8]),
|
||||
'permissions' => '{"user":1}',
|
||||
'notes' => 'Imported user'
|
||||
);
|
||||
@@ -824,100 +886,130 @@ class UsersController extends AdminController {
|
||||
return Redirect::route('users')->with('duplicates', $duplicates)->with('success', 'Success');
|
||||
}
|
||||
|
||||
public function getDatatable($status = null) {
|
||||
public function getDatatable($status = null)
|
||||
{
|
||||
|
||||
$users = User::with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'sentryThrottle', 'groups', 'userloc');
|
||||
|
||||
switch ($status) {
|
||||
case 'deleted':
|
||||
$users->GetDeleted();
|
||||
break;
|
||||
case '':
|
||||
$users->GetNotDeleted();
|
||||
break;
|
||||
if (Input::has('offset')) {
|
||||
$offset = e(Input::get('offset'));
|
||||
} else {
|
||||
$offset = 0;
|
||||
}
|
||||
|
||||
$users = $users->orderBy('created_at', 'DESC')->get();
|
||||
if (Input::has('limit')) {
|
||||
$limit = e(Input::get('limit'));
|
||||
} else {
|
||||
$limit = 50;
|
||||
}
|
||||
|
||||
$actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($users) {
|
||||
$action_buttons = '';
|
||||
if (Input::get('sort')=='name') {
|
||||
$sort = 'first_name';
|
||||
} else {
|
||||
$sort = e(Input::get('sort'));
|
||||
}
|
||||
|
||||
$users = User::select(array('users.id','users.employee_num','users.email','users.username','users.location_id','users.manager_id','users.first_name','users.last_name','users.created_at','users.notes','users.company_id', 'users.deleted_at','users.activated'))
|
||||
->with('assets','accessories','consumables','licenses','manager','sentryThrottle','groups','userloc','company');
|
||||
$users = Company::scopeCompanyables($users);
|
||||
|
||||
switch ($status) {
|
||||
case 'deleted':
|
||||
$users = $users->withTrashed()->Deleted();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Input::has('search')) {
|
||||
$users = $users->TextSearch(Input::get('search'));
|
||||
}
|
||||
|
||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
switch (Input::get('sort'))
|
||||
{
|
||||
case 'manager':
|
||||
$users = $users->OrderManager($order);
|
||||
break;
|
||||
case 'location':
|
||||
$users = $users->OrderLocation($order);
|
||||
break;
|
||||
default:
|
||||
$allowed_columns =
|
||||
[
|
||||
'last_name','first_name','email','username','employee_num',
|
||||
'assets','accessories', 'consumables','licenses','groups','activated'
|
||||
];
|
||||
|
||||
$sort = in_array($sort, $allowed_columns) ? $sort : 'first_name';
|
||||
$users = $users->orderBy($sort, $order);
|
||||
break;
|
||||
}
|
||||
|
||||
$userCount = $users->count();
|
||||
$users = $users->skip($offset)->take($limit)->get();
|
||||
$rows = array();
|
||||
|
||||
foreach ($users as $user)
|
||||
{
|
||||
|
||||
$group_names = '';
|
||||
$inout = '';
|
||||
$actions = '<nobr>';
|
||||
|
||||
foreach ($user->groups as $group) {
|
||||
$group_names .= '<a href="' . Config::get('app.url') . '/admin/groups/' . $group->id . '/edit" class="label label-default">' . e($group->name) . '</a> ';
|
||||
}
|
||||
|
||||
|
||||
if (!is_null($users->deleted_at)) {
|
||||
$action_buttons .= '<a href="' . route('restore/user', $users->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
|
||||
if (!is_null($user->deleted_at)) {
|
||||
|
||||
$actions .= '<a href="' . route('restore/user', $user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
|
||||
} else {
|
||||
if ($users->accountStatus() == 'suspended') {
|
||||
$action_buttons .= '<a href="' . route('unsuspend/user', $users->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
|
||||
|
||||
if ($user->accountStatus() == 'suspended') {
|
||||
$actions .= '<a href="' . route('unsuspend/user', $user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
|
||||
}
|
||||
|
||||
$action_buttons .= '<a href="' . route('update/user', $users->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
$actions .= '<a href="' . route('update/user', $user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
|
||||
if ((Sentry::getId() !== $users->id) && (!Config::get('app.lock_passwords'))) {
|
||||
$action_buttons .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user', $users->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($users->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||
if ((Sentry::getId() !== $user->id) && (!Config::get('app.lock_passwords'))) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user', $user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||
} else {
|
||||
$action_buttons .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
|
||||
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
|
||||
}
|
||||
}
|
||||
return $action_buttons;
|
||||
});
|
||||
$actions .= '</nobr>';
|
||||
|
||||
$rows[] = array(
|
||||
'id' => $user->id,
|
||||
'checkbox' =>'<div class="text-center hidden-xs hidden-sm"><input type="checkbox" name="edit_user['.$user->id.']" class="one_required"></div>',
|
||||
'name' => '<a title="'.$user->fullName().'" href="../admin/users/'.$user->id.'/view">'.$user->fullName().'</a>',
|
||||
'email' => ($user->email!='') ?
|
||||
'<a href="mailto:'.e($user->email).'" class="hidden-md hidden-lg">'.e($user->email).'</a>'
|
||||
.'<a href="mailto:'.e($user->email).'" class="hidden-xs hidden-sm"><i class="fa fa-envelope"></i></a>'
|
||||
.'</span>' : '',
|
||||
'username' => e($user->username),
|
||||
'location' => ($user->userloc) ? e($user->userloc->name) : '',
|
||||
'manager' => ($user->manager) ? '<a title="' . e($user->manager->fullName()) . '" href="users/' . $user->manager->id . '/view">' . e($user->manager->fullName()) . '</a>' : '',
|
||||
'assets' => $user->assets->count(),
|
||||
'employee_num' => e($user->employee_num),
|
||||
'licenses' => $user->licenses->count(),
|
||||
'accessories' => $user->accessories->count(),
|
||||
'consumables' => $user->consumables->count(),
|
||||
'groups' => $group_names,
|
||||
'notes' => e($user->notes),
|
||||
'activated' => ($user->activated=='1') ? '<i class="fa fa-check"></i>' : '<i class="fa fa-times"></i>',
|
||||
'actions' => ($actions) ? $actions : '',
|
||||
'companyName' => is_null($user->company) ? '' : e($user->company->name)
|
||||
);
|
||||
}
|
||||
|
||||
return Datatable::collection($users)
|
||||
->addColumn('', function($users) {
|
||||
return '<div class="text-center"><input type="checkbox" name="edit_user[]" value="' . $users->id . '" class="one_required"></div>';
|
||||
})
|
||||
->addColumn('name', function($users) {
|
||||
return '<a title="' . $users->fullName() . '" href="users/' . $users->id . '/view">' . $users->fullName() . '</a>';
|
||||
})
|
||||
->addColumn('email', function($users) {
|
||||
if ($users->email) {
|
||||
return '<div class="text-center"><a title="' . $users->email . '" href="mailto:' . $users->email . '"><i class="fa fa-envelope fa-lg"></i></div>';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
})
|
||||
->addColumn('username', function($users) {
|
||||
return $users->username;
|
||||
})
|
||||
->addColumn('manager', function($users) {
|
||||
if ($users->manager) {
|
||||
return '<a title="' . $users->manager->fullName() . '" href="users/' . $users->manager->id . '/view">' . $users->manager->fullName() . '</a>';
|
||||
}
|
||||
})
|
||||
->addColumn('location', function($users) {
|
||||
if ($users->userloc) {
|
||||
return $users->userloc->name;
|
||||
}
|
||||
})
|
||||
->addColumn('assets', function($users) {
|
||||
return $users->assets->count();
|
||||
})
|
||||
->addColumn('licenses', function($users) {
|
||||
return $users->licenses->count();
|
||||
})
|
||||
->addColumn('accessories', function($users) {
|
||||
return $users->accessories->count();
|
||||
})
|
||||
->addColumn('consumables', function($users) {
|
||||
return $users->consumables->count();
|
||||
})
|
||||
->addColumn('groups', function($users) {
|
||||
$group_names = '';
|
||||
foreach ($users->groups as $group) {
|
||||
$group_names .= '<a href="' . Config::get('app.url') . '/admin/groups/' . $group->id . '/edit" class="label label-default">' . $group->name . '</a> ';
|
||||
}
|
||||
return $group_names;
|
||||
})
|
||||
->addColumn($actions)
|
||||
->searchColumns('name', 'email', 'username', 'manager', 'activated', 'groups', 'location')
|
||||
->orderColumns('name', 'email', 'username', 'manager', 'activated', 'licenses', 'assets', 'accessories', 'consumables', 'groups', 'location')
|
||||
->make();
|
||||
$data = array('total'=>$userCount, 'rows'=>$rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the file to the server
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $userId
|
||||
* @return View
|
||||
* */
|
||||
public function postUpload($userId = null) {
|
||||
@@ -928,7 +1020,10 @@ class UsersController extends AdminController {
|
||||
|
||||
if (isset($user->id)) {
|
||||
|
||||
if (Input::hasFile('userfile')) {
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else if (Input::hasFile('userfile')) {
|
||||
|
||||
foreach (Input::file('userfile') as $file) {
|
||||
|
||||
@@ -979,7 +1074,8 @@ class UsersController extends AdminController {
|
||||
/**
|
||||
* Delete the associated file
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $userId
|
||||
* @param int $fileId
|
||||
* @return View
|
||||
* */
|
||||
public function getDeleteFile($userId = null, $fileId = null) {
|
||||
@@ -989,13 +1085,19 @@ class UsersController extends AdminController {
|
||||
// the license is valid
|
||||
if (isset($user->id)) {
|
||||
|
||||
$log = Actionlog::find($fileId);
|
||||
$full_filename = $destinationPath . '/' . $log->filename;
|
||||
if (file_exists($full_filename)) {
|
||||
unlink($destinationPath . '/' . $log->filename);
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$log = Actionlog::find($fileId);
|
||||
$full_filename = $destinationPath . '/' . $log->filename;
|
||||
if (file_exists($full_filename)) {
|
||||
unlink($destinationPath . '/' . $log->filename);
|
||||
}
|
||||
$log->delete();
|
||||
return Redirect::back()->with('success', Lang::get('admin/users/message.deletefile.success'));
|
||||
}
|
||||
$log->delete();
|
||||
return Redirect::back()->with('success', Lang::get('admin/users/message.deletefile.success'));
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/users/message.does_not_exist', compact('id'));
|
||||
@@ -1008,7 +1110,8 @@ class UsersController extends AdminController {
|
||||
/**
|
||||
* Display/download the uploaded file
|
||||
*
|
||||
* @param int $assetId
|
||||
* @param int $userId
|
||||
* @param int $fileId
|
||||
* @return View
|
||||
* */
|
||||
public function displayFile($userId = null, $fileId = null) {
|
||||
@@ -1017,9 +1120,15 @@ class UsersController extends AdminController {
|
||||
|
||||
// the license is valid
|
||||
if (isset($user->id)) {
|
||||
$log = Actionlog::find($fileId);
|
||||
$file = $log->get_src();
|
||||
return Response::download($file);
|
||||
if (!Company::isCurrentUserHasAccess($user)) {
|
||||
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$log = Actionlog::find($fileId);
|
||||
$file = $log->get_src();
|
||||
return Response::download($file);
|
||||
}
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/users/message.does_not_exist', compact('id'));
|
||||
@@ -1063,7 +1172,7 @@ class UsersController extends AdminController {
|
||||
protected $ldapValidationRules = array(
|
||||
'firstname' => 'required|alpha_space|min:2',
|
||||
'lastname' => 'required|alpha_space|min:2',
|
||||
'employee_number' => 'numeric',
|
||||
'employee_number' => 'alpha_space',
|
||||
'username' => 'required|min:2|unique:users,username',
|
||||
'email' => 'email|unique:users,email',
|
||||
);
|
||||
@@ -1094,20 +1203,27 @@ class UsersController extends AdminController {
|
||||
return Redirect::back()->withInput()->withErrors($formValidator);
|
||||
}
|
||||
|
||||
$ldap_version = Config::get('ldap.version');
|
||||
$url = Config::get('ldap.url');
|
||||
$username = Config::get('ldap.username');
|
||||
$password = Config::get('ldap.password');
|
||||
$base_dn = Config::get('ldap.basedn');
|
||||
$filter = Config::get('ldap.filter');
|
||||
$ldap_version = Setting::getSettings()->ldap_version;
|
||||
$url = Setting::getSettings()->ldap_server;
|
||||
$username = Setting::getSettings()->ldap_uname;
|
||||
$password = Crypt::decrypt(Setting::getSettings()->ldap_pword);
|
||||
$base_dn = Setting::getSettings()->ldap_basedn;
|
||||
$filter = Setting::getSettings()->ldap_filter;
|
||||
|
||||
$ldap_result_username = Config::get('ldap.result.username');
|
||||
$ldap_result_emp_num = Config::get('ldap.result.emp.num');
|
||||
$ldap_result_last_name = Config::get('ldap.result.last.name');
|
||||
$ldap_result_first_name = Config::get('ldap.result.first.name');
|
||||
$ldap_result_email = Config::get('ldap.result.email');
|
||||
$ldap_result_active_flag = Config::get('ldap.result.active.flag');
|
||||
$ldap_result_username = Setting::getSettings()->ldap_username_field;
|
||||
$ldap_result_last_name = Setting::getSettings()->ldap_lname_field;
|
||||
$ldap_result_first_name = Setting::getSettings()->ldap_fname_field;
|
||||
|
||||
$ldap_result_active_flag = Setting::getSettings()->ldap_active_flag_field;
|
||||
$ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
|
||||
$ldap_result_email = Setting::getSettings()->ldap_email;
|
||||
$ldap_server_cert_ignore = Setting::getSettings()->ldap_server_cert_ignore;
|
||||
|
||||
// If we are ignoring the SSL cert we need to setup the environment variable
|
||||
// before we create the connection
|
||||
if($ldap_server_cert_ignore) {
|
||||
putenv('LDAPTLS_REQCERT=never');
|
||||
}
|
||||
|
||||
// Connect to LDAP server
|
||||
$ldapconn = @ldap_connect($url);
|
||||
@@ -1127,21 +1243,48 @@ class UsersController extends AdminController {
|
||||
|
||||
// Binding to ldap server
|
||||
$ldapbind = @ldap_bind($ldapconn, $username, $password);
|
||||
|
||||
Log::error(ldap_errno($ldapconn));
|
||||
if (!$ldapbind) {
|
||||
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_bind').ldap_error($ldapconn));
|
||||
}
|
||||
|
||||
// Perform the search
|
||||
$search_results = @ldap_search($ldapconn, $base_dn, '('.$filter.')');
|
||||
if (!$search_results) {
|
||||
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn));
|
||||
}
|
||||
// Set up LDAP pagination for very large databases
|
||||
// @author Richard Hofman
|
||||
$page_size = 500;
|
||||
$cookie = '';
|
||||
$result_set = array();
|
||||
$global_count = 0;
|
||||
|
||||
// Get results
|
||||
$results = @ldap_get_entries($ldapconn, $search_results);
|
||||
if (!$results) {
|
||||
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_get_entries').ldap_error($ldapconn));
|
||||
}
|
||||
// Perform the search
|
||||
do {
|
||||
// Paginate (non-critical, if not supported by server)
|
||||
ldap_control_paged_result($ldapconn, $page_size, false, $cookie);
|
||||
|
||||
$search_results = ldap_search($ldapconn, $base_dn, '('.$filter.')');
|
||||
|
||||
if (!$search_results) {
|
||||
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn));
|
||||
}
|
||||
|
||||
// Get results from page
|
||||
$results = ldap_get_entries($ldapconn, $search_results);
|
||||
if (!$results) {
|
||||
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_get_entries').ldap_error($ldapconn));
|
||||
}
|
||||
|
||||
// Add results to result set
|
||||
$global_count += $results['count'];
|
||||
$result_set = array_merge($result_set, $results);
|
||||
|
||||
ldap_control_paged_result_response($ldapconn, $search_results, $cookie);
|
||||
|
||||
} while ($cookie !== null && $cookie != '');
|
||||
|
||||
// Clean up after search
|
||||
$result_set['count'] = $global_count;
|
||||
$results = $result_set;
|
||||
ldap_control_paged_result($ldapconn, 0);
|
||||
|
||||
$summary = array();
|
||||
for ($i = 0; $i < $results["count"]; $i++) {
|
||||
|
||||
@@ -18,6 +18,7 @@ class CreateModelsTable extends Migration
|
||||
$table->integer('manufacturer_id')->nullable();
|
||||
$table->integer('category_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ class CreateCategoriesTable extends Migration
|
||||
$table->string('name');
|
||||
$table->integer('parent')->default(0);
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ class CreateManufacturersTable extends Migration
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ class CreateAssetsTable extends Migration
|
||||
$table->text('notes');
|
||||
$table->integer('user_id');
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class CreateLicensesTable extends Migration
|
||||
$table->text('notes');
|
||||
$table->integer('user_id');
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class CreateDepreciationsTable extends Migration
|
||||
$table->integer('months');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id');
|
||||
$table->engine = 'InnoDB';
|
||||
//$table->foreign('user_id')->references('id')->on('users');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class CreateLocationsTable extends Migration
|
||||
$table->string('country',2);
|
||||
$table->timestamps();
|
||||
$table->integer('user_id');
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class CreateHistoryTable extends Migration
|
||||
$table->integer('location_id')->nullable;
|
||||
$table->timestamps();
|
||||
$table->integer('user_id');
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class CreateSettingsTable extends Migration
|
||||
$table->string('option_value');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id');
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,8 @@ class EditLocationIdAssetLogsTable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$prefix=DB::getTablePrefix();
|
||||
DB::statement('ALTER TABLE '.$prefix.'asset_logs MODIFY location_id int(11) null');
|
||||
DB::statement('ALTER TABLE '.$prefix.'asset_logs MODIFY added_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||
DB::statement('ALTER TABLE '.DB::getTablePrefix().'asset_logs MODIFY location_id int(11) null');
|
||||
DB::statement('ALTER TABLE '.DB::getTablePrefix().'asset_logs MODIFY added_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class CreateStatusLabels extends Migration
|
||||
$table->integer('user_id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class AddUploadsTable extends Migration
|
||||
$table->string('filenotes')->nullable;
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class ReCreateLicensesTable extends Migration
|
||||
$table->integer('depreciation_id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class CreateLicenseSeatsTable extends Migration
|
||||
$table->integer('user_id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class CreateNewLicensesTable extends Migration
|
||||
$table->integer('depreciation_id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class AddSuppliers extends Migration
|
||||
$table->timestamps();
|
||||
$table->integer('user_id');
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,15 @@ class AddEulaFields extends Migration {
|
||||
});
|
||||
|
||||
|
||||
Schema::create('requested_assets', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('asset_id')->default(NULL);
|
||||
$table->integer('user_id')->default(NULL);
|
||||
$table->dateTime('accepted_at')->nullable()->default(NULL);
|
||||
$table->dateTime('denied_at')->nullable()->default(NULL);
|
||||
$table->string('notes')->default(NULL);
|
||||
$table->timestamps();
|
||||
});
|
||||
Schema::create('requested_assets', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('asset_id')->default(NULL);
|
||||
$table->integer('user_id')->default(NULL);
|
||||
$table->dateTime('accepted_at')->nullable()->default(NULL);
|
||||
$table->dateTime('denied_at')->nullable()->default(NULL);
|
||||
$table->string('notes')->default(NULL);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,7 @@ class AddAccessoriesTable extends Migration {
|
||||
$table->boolean('requestable')->default(0);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
|
||||
Schema::table('asset_logs', function ($table) {
|
||||
|
||||
@@ -17,12 +17,13 @@ class CreateConsumables extends Migration {
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable()->default(NULL);
|
||||
$table->integer('category_id')->nullable()->default(NULL);
|
||||
$table->integer('location_id')->nullable()->default(NULL);
|
||||
$table->integer('location_id')->nullable()->default(NULL);
|
||||
$table->integer('user_id')->nullable()->default(NULL);
|
||||
$table->integer('qty')->default(0);
|
||||
$table->boolean('requestable')->default(0);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
|
||||
Schema::table('asset_logs', function ($table) {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
//use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomFieldsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('custom_fields', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->string('format');
|
||||
$table->string('element');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::drop('custom_fields');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomFieldCustomFieldset extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('custom_field_custom_fieldset', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('custom_field_id');
|
||||
$table->integer('custom_fieldset_id');
|
||||
|
||||
$table->integer('order');
|
||||
$table->boolean('required');
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('custom_field_custom_fieldset');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomFieldsets extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('custom_fieldsets', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->engine = 'InnoDB';
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('custom_fieldsets');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFieldsetIdToAssets extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('models', function (Blueprint $table) {
|
||||
$table->integer('fieldset_id')->nullable();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('models',function (Blueprint $table) {
|
||||
$table->dropColumn('fieldset_id');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MigrateMacAddress extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
||||
|
||||
$f2=new CustomFieldset(['name' => "Asset with MAC Address"]);
|
||||
$f2->timestamps=false; //when this model was first created, it had no timestamps. But later on it gets them.
|
||||
if(!$f2->save()) {
|
||||
throw new Exception("couldn't save customfieldset");
|
||||
}
|
||||
$macid=DB::table('custom_fields')->insertGetId([
|
||||
'name' => "MAC Address",
|
||||
'format' => CustomField::$PredefinedFormats['MAC'],
|
||||
'element'=>'text']);
|
||||
if(!$macid) {
|
||||
throw new Exception("Can't save MAC Custom field: $macid");
|
||||
}
|
||||
|
||||
$f2->fields()->attach($macid,['required' => false, 'order' => 1]);
|
||||
Model::where(["show_mac_address" => true])->update(["fieldset_id"=>$f2->id]);
|
||||
|
||||
DB::statement("ALTER TABLE assets CHANGE mac_address _snipeit_mac_address varchar(255)");
|
||||
|
||||
$ans=Schema::table("models",function (Blueprint $table) {
|
||||
$table->renameColumn('show_mac_address','deprecated_mac_address');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
$f=CustomFieldset::where(["name" => "Asset with MAC Address"])->first();
|
||||
$f->fields()->delete();
|
||||
$f->delete();
|
||||
Schema::table("models",function(Blueprint $table) {
|
||||
$table->renameColumn("deprecated_mac_address","show_mac_address");
|
||||
});
|
||||
DB::statement("ALTER TABLE assets CHANGE _snipeit_mac_address mac_address varchar(255)");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAccessoryConsumablePriceInfo extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accessories', function ($table) {
|
||||
$table->date('purchase_date')->nullable();
|
||||
$table->decimal('purchase_cost', 13, 4)->nullable();
|
||||
$table->string('order_number');
|
||||
});
|
||||
|
||||
Schema::table('consumables', function ($table) {
|
||||
$table->date('purchase_date')->nullable();
|
||||
$table->decimal('purchase_cost', 13, 4)->nullable();
|
||||
$table->string('order_number');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('accessories', function ($table) {
|
||||
$table->dropColumn('purchase_date');
|
||||
$table->dropColumn('purchase_cost');
|
||||
$table->dropColumn('order_number');
|
||||
});
|
||||
|
||||
Schema::table('consumables', function ($table) {
|
||||
$table->dropColumn('purchase_date');
|
||||
$table->dropColumn('purchase_cost');
|
||||
$table->dropColumn('order_number');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBrandToSettings extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->tinyInteger('brand')->default(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->dropColumn('brand');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixDefaultsAccessories extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement('ALTER TABLE `'.DB::getTablePrefix().'accessories` MODIFY `order_number` varchar(255) DEFAULT NULL;');
|
||||
|
||||
DB::statement('ALTER TABLE `'.DB::getTablePrefix().'consumables` MODIFY `order_number` varchar(255) DEFAULT NULL;');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
DB::statement('ALTER TABLE `'.DB::getTablePrefix().'accessories` MODIFY `order_number` varchar(255);');
|
||||
DB::statement('ALTER TABLE `'.DB::getTablePrefix().'consumables` MODIFY `order_number` varchar(255);');
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCheckoutTimeAndExpectedCheckoutDateToAssets extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('assets', function(Blueprint $table)
|
||||
{
|
||||
//
|
||||
$answer=$table->dateTime('last_checkout')->nullable();
|
||||
$table->date('expected_checkin')->nullable();
|
||||
});
|
||||
DB::statement("UPDATE assets SET last_checkout=(SELECT MAX(created_at) FROM asset_logs WHERE asset_logs.id=assets.id AND action_type='checkout') WHERE assigned_to IS NOT NULL");
|
||||
DB::statement("UPDATE assets SET expected_checkin=(SELECT expected_checkin FROM asset_logs WHERE asset_logs.id=assets.id AND action_type='checkout' ORDER BY id DESC limit 1) WHERE assigned_to IS NOT NULL");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('assets', function(Blueprint $table)
|
||||
{
|
||||
//
|
||||
$table->dropColumn('last_checkout');
|
||||
$table->dropColumn('expected_checkin');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCompaniesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('companies', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->timestamps();
|
||||
$table->engine = 'InnoDB';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('companies');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCompanyIdToConsumablesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('consumables', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('company_id')->unsigned()->nullable();
|
||||
//$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('consumables', function(Blueprint $table)
|
||||
{
|
||||
//$table->dropForeign('consumables_company_id_foreign');
|
||||
$table->dropColumn('company_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class Image extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('assets', function(Blueprint $table)
|
||||
{
|
||||
$table->text('image')->after('notes')->nullable()->default(NULL);
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('assets', function ($table) {
|
||||
$table->dropColumn('image');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCompanyIdToAccessoriesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accessories', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('company_id')->unsigned()->nullable();
|
||||
//$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('accessories', function(Blueprint $table)
|
||||
{
|
||||
//$table->dropForeign('accessories_company_id_foreign');
|
||||
$table->dropColumn('company_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCompanyIdToUsersTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('company_id')->unsigned()->nullable();
|
||||
//$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function(Blueprint $table)
|
||||
{
|
||||
//$table->dropForeign('users_company_id_foreign');
|
||||
$table->dropColumn('company_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCompanyIdToLicensesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('licenses', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('company_id')->unsigned()->nullable();
|
||||
//$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('licenses', function(Blueprint $table)
|
||||
{
|
||||
//$table->dropForeign('licenses_company_id_foreign');
|
||||
$table->dropColumn('company_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddCompanyIdToAssetsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('assets', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('company_id')->unsigned()->nullable();
|
||||
//$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('assets', function(Blueprint $table)
|
||||
{
|
||||
// $table->dropForeign('assets_company_id_foreign');
|
||||
$table->dropColumn('company_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddLdapFieldsToSettings extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->string('ldap_enabled')->nullable()->default(NULL);
|
||||
$table->string('ldap_server')->nullable()->default(NULL);
|
||||
$table->string('ldap_uname')->nullable()->default(NULL);
|
||||
$table->longText('ldap_pword')->nullable()->default(NULL);
|
||||
$table->string('ldap_basedn')->nullable()->default(NULL);
|
||||
$table->string('ldap_filter')->nullable()->default('cn=*');
|
||||
$table->string('ldap_username_field')->nullable()->default('samaccountname');
|
||||
$table->string('ldap_lname_field')->nullable()->default('sn');
|
||||
$table->string('ldap_fname_field')->nullable()->default('givenname');
|
||||
$table->string('ldap_auth_filter_query')->nullable()->default('uid=samaccountname');
|
||||
$table->integer('ldap_version')->nullable()->default(3);
|
||||
$table->string('ldap_active_flag')->nullable()->default(NULL);
|
||||
$table->string('ldap_emp_num')->nullable()->default(NULL);
|
||||
$table->string('ldap_email')->nullable()->default(NULL);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->dropColumn('ldap_enabled');
|
||||
$table->dropColumn('ldap_server');
|
||||
$table->dropColumn('ldap_uname');
|
||||
$table->longText('ldap_pword');
|
||||
$table->dropColumn('ldap_basedn');
|
||||
$table->dropColumn('ldap_filter');
|
||||
$table->dropColumn('ldap_username_field');
|
||||
$table->dropColumn('ldap_lname_field');
|
||||
$table->dropColumn('ldap_fname_field');
|
||||
$table->dropColumn('ldap_auth_filter_query');
|
||||
$table->dropColumn('ldap_version');
|
||||
$table->dropColumn('ldap_active_flag');
|
||||
$table->dropColumn('ldap_emp_num');
|
||||
$table->dropColumn('ldap_email');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddFullMultipleCompaniesSupportToSettingsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->boolean('full_multiple_companies_support')->default(FALSE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->dropColumn('full_multiple_companies_support');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ImportLdapSettings extends Migration {
|
||||
|
||||
/**
|
||||
* Migration to pull in LDAP settings from ldap.config into database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
$settings = Setting::first();
|
||||
|
||||
// Only update the settings record if there IS an LDAP Config
|
||||
// AND the Settings table doesn't already have LDAP settings in it
|
||||
|
||||
if ((Config::get('ldap.url')) && ($settings) && ($settings->ldap_server)) {
|
||||
|
||||
$settings->ldap_enabled = 1;
|
||||
$settings->ldap_server = Config::get('ldap.url');
|
||||
$settings->ldap_uname = Config::get('ldap.username');
|
||||
$settings->ldap_pword = Crypt::encrypt(Config::get('ldap.password'));
|
||||
$settings->ldap_basedn = Config::get('ldap.basedn');
|
||||
$settings->ldap_filter = Config::get('ldap.filter');
|
||||
$settings->ldap_username_field = Config::get('ldap.result.username');
|
||||
$settings->ldap_lname_field = Config::get('ldap.result.last.name');
|
||||
$settings->ldap_fname_field = Config::get('ldap.result.first.name');
|
||||
$settings->ldap_auth_filter_query = Config::get('ldap.authentication.filter.query');
|
||||
$settings->ldap_version = Config::get('ldap.version');
|
||||
$settings->ldap_active_flag = Config::get('ldap.result.active.flag');
|
||||
$settings->ldap_emp_num = Config::get('ldap.result.emp.num');
|
||||
$settings->ldap_email = Config::get('ldap.result.email');
|
||||
|
||||
// Save the imported settings
|
||||
if ($settings->save()) {
|
||||
echo 'LDAP settings imported into database'."\n";
|
||||
|
||||
// Copy the old LDAP config file to prevent any future confusion
|
||||
if (@copy(app_path().'/config/'.app()->environment().'/ldap.php', app_path().'/config/'.app()->environment().'/deprecated.ldap.php')) {
|
||||
|
||||
if (@unlink(app_path().'/config/'.app()->environment().'/ldap.php')) {
|
||||
echo 'Original LDAP file archived to '.app_path().'/config/'.app()->environment().'/deprecated.ldap.php'."\n";
|
||||
} else {
|
||||
echo 'Could not archive LDAP config file'."\n";
|
||||
}
|
||||
|
||||
} else {
|
||||
echo 'Could not archive LDAP config file'."\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (@copy(app_path().'/config/'.app()->environment().'/deprecated.ldap.php', app_path().'/config/'.app()->environment().'/ldap.php')) {
|
||||
echo 'Un-archived LDAP config file'."\n";
|
||||
@unlink(app_path().'/config/'.app()->environment().'/deprecated.ldap.php');
|
||||
|
||||
} else {
|
||||
echo 'Could not un-archive LDAP config file. Manually rename it instead.'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveFkCompanyId extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
// Schema::table('users', function(Blueprint $table)
|
||||
// {
|
||||
// $table->dropForeign('users_company_id_foreign');
|
||||
// });
|
||||
//
|
||||
// Schema::table('accessories', function(Blueprint $table)
|
||||
// {
|
||||
// $table->dropForeign('accessories_company_id_foreign');
|
||||
// });
|
||||
//
|
||||
// Schema::table('assets', function(Blueprint $table)
|
||||
// {
|
||||
// $table->dropForeign('assets_company_id_foreign');
|
||||
// });
|
||||
//
|
||||
// Schema::table('consumables', function(Blueprint $table)
|
||||
// {
|
||||
// $table->dropForeign('consumables_company_id_foreign');
|
||||
// });
|
||||
//
|
||||
// Schema::table('licenses', function(Blueprint $table)
|
||||
// {
|
||||
// $table->dropForeign('licenses_company_id_foreign');
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddLdapServerCertIgnoreToSettingsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->boolean('ldap_server_cert_ignore')->default(FALSE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->dropColumn('ldap_server_cert_ignore');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimestampAndUserIdToCustomFields extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('custom_fields', function(Blueprint $table)
|
||||
{
|
||||
$table->integer("user_id")->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_fields', function(Blueprint $table)
|
||||
{
|
||||
$table->dropColumn("user_id");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimestampAndUserIdToCustomFieldsets extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
Schema::table('custom_fieldsets', function(Blueprint $table)
|
||||
{
|
||||
$table->timestamps();
|
||||
$table->integer("user_id")->nullable();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_fieldsets', function(Blueprint $table)
|
||||
{
|
||||
$table->dropTimestamps();
|
||||
$table->dropColumn("user_id");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNotesToModels extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('models', function ($table) {
|
||||
$table->text('note')->nullable()->default(NULL);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('models', function ($table) {
|
||||
$table->dropColumn('note');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,7 @@ class LocationsSeeder extends Seeder
|
||||
'state' => 'NY',
|
||||
'country' => 'US',
|
||||
'zip' => '10004',
|
||||
'currency' => '$',
|
||||
'created_at' => $date->modify('-10 day'),
|
||||
'updated_at' => $date->modify('-3 day'),
|
||||
'user_id' => 1,
|
||||
@@ -31,6 +32,7 @@ class LocationsSeeder extends Seeder
|
||||
'state' => 'NY',
|
||||
'country' => 'US',
|
||||
'zip' => '10004',
|
||||
'currency' => '$',
|
||||
'created_at' => $date->modify('-10 day'),
|
||||
'updated_at' => $date->modify('-3 day'),
|
||||
'user_id' => 1,
|
||||
@@ -45,6 +47,7 @@ class LocationsSeeder extends Seeder
|
||||
'state' => 'CA',
|
||||
'country' => 'US',
|
||||
'zip' => '94111',
|
||||
'currency' => '$',
|
||||
'created_at' => $date->modify('-10 day'),
|
||||
'updated_at' => $date->modify('-3 day'),
|
||||
'user_id' => 1,
|
||||
@@ -59,6 +62,7 @@ class LocationsSeeder extends Seeder
|
||||
'state' => 'CA',
|
||||
'country' => 'US',
|
||||
'zip' => '90028',
|
||||
'currency' => '$',
|
||||
'created_at' => $date->modify('-10 day'),
|
||||
'updated_at' => $date->modify('-3 day'),
|
||||
'user_id' => 1,
|
||||
|
||||
+16
-2
@@ -34,6 +34,7 @@ App::after(function ($request, $response) {
|
||||
Route::filter('auth', function () {
|
||||
// Check if the user is logged in
|
||||
if ( ! Sentry::check()) {
|
||||
Log::debug('Not logged in - auth filter');
|
||||
// Store the current uri in the session
|
||||
Session::put('loginRedirect', Request::url());
|
||||
|
||||
@@ -74,7 +75,8 @@ Route::filter('guest', function () {
|
||||
|
||||
Route::filter('admin-auth', function () {
|
||||
// Check if the user is logged in
|
||||
if ( ! Sentry::check()) {
|
||||
if ( !Sentry::check()) {
|
||||
LOG::debug('Not logged in - admin-auth');
|
||||
// Store the current uri in the session
|
||||
Session::put('loginRedirect', Request::url());
|
||||
|
||||
@@ -84,8 +86,9 @@ Route::filter('admin-auth', function () {
|
||||
|
||||
// Check if the user has access to the admin pages
|
||||
if ( ! Sentry::getUser()->hasAccess('admin')) {
|
||||
LOG::debug('Not a super admin');
|
||||
// Show the insufficient permissions page
|
||||
return Redirect::route('view-assets');
|
||||
return Redirect::route('view-assets')->with('error','You do not have permission to view this page.');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -102,6 +105,7 @@ Route::filter('admin-auth', function () {
|
||||
Route::filter('reporting-auth', function () {
|
||||
// Check if the user is logged in
|
||||
if ( ! Sentry::check()) {
|
||||
LOG::debug('Not logged in');
|
||||
// Store the current uri in the session
|
||||
Session::put('loginRedirect', Request::url());
|
||||
|
||||
@@ -111,11 +115,20 @@ Route::filter('reporting-auth', function () {
|
||||
|
||||
// Check if the user has access to the admin pages
|
||||
if ( ! Sentry::getUser()->hasAccess('reports')) {
|
||||
LOG::debug('Unsufficient permissions');
|
||||
// Show the insufficient permissions page
|
||||
return Redirect::route('profile')->with("error","You do not have permission to view this page.");
|
||||
}
|
||||
});
|
||||
|
||||
Route::filter('backup-auth', function () {
|
||||
|
||||
if (!Sentry::getUser()->isSuperUser()) {
|
||||
LOG::debug('Not a super admin');
|
||||
return Redirect::route('home')->with('error', Lang::get('general.insufficient_permissions'));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -131,6 +144,7 @@ Route::filter('reporting-auth', function () {
|
||||
|
||||
Route::filter('csrf', function () {
|
||||
if (Session::token() != Input::get('_token')) {
|
||||
LOG::debug('No CSRF token');
|
||||
throw new Illuminate\Session\TokenMismatchException;
|
||||
}
|
||||
});
|
||||
|
||||
+29
-7
@@ -5,13 +5,16 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
function ParseFloat($floatString){
|
||||
|
||||
// use comma for thousands until local info is property used
|
||||
$LocaleInfo = localeconv();
|
||||
$floatString = str_replace("," , "", $floatString);
|
||||
$floatString = str_replace($LocaleInfo["decimal_point"] , ".", $floatString);
|
||||
return floatval($floatString);
|
||||
if(!function_exists("ParseFloat")) {
|
||||
//this may be only necessary to run tests?
|
||||
function ParseFloat($floatString){
|
||||
// use comma for thousands until local info is property used
|
||||
$LocaleInfo = localeconv();
|
||||
$floatString = str_replace("," , "", $floatString);
|
||||
$floatString = str_replace($LocaleInfo["decimal_point"] , ".", $floatString);
|
||||
return floatval($floatString);
|
||||
}
|
||||
}
|
||||
|
||||
function modelList() {
|
||||
@@ -23,6 +26,14 @@ function modelList() {
|
||||
return $model_list;
|
||||
}
|
||||
|
||||
function companyList() {
|
||||
$company_list = array('0' => Lang::get('general.select_company')) + DB::table('companies')
|
||||
->orderBy('name', 'asc')
|
||||
->lists('name', 'id');
|
||||
return $company_list;
|
||||
}
|
||||
|
||||
|
||||
function categoryList() {
|
||||
$category_list = array('' => '') + DB::table('categories')
|
||||
->whereNull('deleted_at')
|
||||
@@ -39,7 +50,7 @@ function suppliersList() {
|
||||
}
|
||||
|
||||
function statusLabelList() {
|
||||
$statuslabel_list = Statuslabel::orderBy('name', 'asc')
|
||||
$statuslabel_list = array('' => Lang::get('general.select_statuslabel')) + Statuslabel::orderBy('name', 'asc')
|
||||
->lists('name', 'id');
|
||||
return $statuslabel_list;
|
||||
}
|
||||
@@ -86,6 +97,17 @@ function usersList() {
|
||||
return $users_list;
|
||||
}
|
||||
|
||||
function customFieldsetList() {
|
||||
$customfields=CustomFieldset::lists('name','id');
|
||||
return array('' => Lang::get('admin/models/general.no_custom_field')) + $customfields;
|
||||
}
|
||||
|
||||
function predefined_formats() {
|
||||
$keys=array_keys(CustomField::$PredefinedFormats);
|
||||
$stuff=array_combine($keys,$keys);
|
||||
return $stuff+["" => "Custom Format..."];
|
||||
}
|
||||
|
||||
function barcodeDimensions ($barcode_type = 'QRCODE') {
|
||||
if ($barcode_type == 'C128') {
|
||||
$size['height'] = '-1';
|
||||
|
||||
Executable → Regular
+9
-3
@@ -5,16 +5,22 @@ return array(
|
||||
'about_accessories_text' => 'الملحقات هي أي شيء تقوم بتسليمه للمستخدمين لكنه لا يحتوي على رقم تسلسلي (أو أنك لست بحاجة إلى تتبعه بشكل خاص). مثال: فأرة الحاسوب أو لوحة المفاتيح.',
|
||||
'accessory_category' => 'فئة الملحق',
|
||||
'accessory_name' => 'اسم الملحق',
|
||||
'create' => 'Create Accessory',
|
||||
'cost' => 'تكلفة شراء',
|
||||
'checkout' => 'الملحقات المخرجة',
|
||||
'checkin' => 'إدخالات الملحقات',
|
||||
'create' => 'إنشاء ملحق',
|
||||
'date' => 'تاريخ الشراء',
|
||||
'edit' => 'تعديل الملحق',
|
||||
'eula_text' => 'إنشاء اتفاقية جديدة',
|
||||
'eula_text_help' => 'يسمح لك هذا الحقل بتخصيص الاتفاقيات لأنواع معينة من الأصول. اذا كنت تمتلك اتفاقية واحدة لجميع أصولك يمكنك أن تقوم بتأشير المربع في الأسفل لاستخدام الاتفاقية الافتراضية.',
|
||||
'require_acceptance' => 'مطالبة المستخدمين بتأكيد قبولهم الأصول في هذه الفئة.',
|
||||
'no_default_eula' => 'ليس هناك اتفاقيات. قم باضافة واحدة من "الاعدادات".',
|
||||
'order' => 'رقم طلب الشراء',
|
||||
'qty' => 'الكمية',
|
||||
'total' => 'المجموع',
|
||||
'remaining' => 'المتاح',
|
||||
'update' => 'Update Accessory',
|
||||
'update' => 'تحديث الملحق',
|
||||
'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.',
|
||||
'use_default_eula_disabled' => '<del>استخدام (اتفاقية ترخيص المستخدم) الافتراضية الأساسية بدلا من ذلك.</del> لم يتم تحديد (اتفاقية ترخيص المستخدم) الافتراضية الأساسية. الرجاء إضافتها في الإعدادات.',
|
||||
|
||||
);
|
||||
|
||||
Executable → Regular
+10
-10
@@ -2,25 +2,25 @@
|
||||
|
||||
return array(
|
||||
|
||||
'does_not_exist' => 'هذه الفئة غير موجودة.',
|
||||
'does_not_exist' => 'الملحق غير موجود.',
|
||||
'assoc_users' => 'تم إخراج :count عنصر من هذا الملحق للمستخدمين، الرجاء إيداع الملحقات ثم حاول مرة أخرى. ',
|
||||
|
||||
'create' => array(
|
||||
'error' => 'فشل إنشاء التصنيف، الرجاء المحاولة مرة أخرى.',
|
||||
'success' => 'تم إنشاء الفئة بنجاح.'
|
||||
'error' => 'لم يتم انشاء الملحق، الرجاء المحاولة مرة اخرى.',
|
||||
'success' => 'تم انشاء الملحق بنجاح.'
|
||||
),
|
||||
|
||||
'update' => array(
|
||||
'error' => 'فشل تحديث التصنيف، الرجاء المحاولة مرة أخرى',
|
||||
'success' => 'Category updated successfully.'
|
||||
'error' => 'لم يتم تحديث الملحق، الرجاء المحاولة مرة أخرى',
|
||||
'success' => 'تم بنجاح تحديث الملحق.'
|
||||
),
|
||||
|
||||
'delete' => array(
|
||||
'confirm' => 'Are you sure you wish to delete this category?',
|
||||
'error' => 'There was an issue deleting the category. Please try again.',
|
||||
'success' => 'The category was deleted successfully.'
|
||||
'confirm' => 'هل أنت متأكد من رغبتك في حذف هذا الملحق؟',
|
||||
'error' => 'حدث خطأ أثناء محاولة حذف الملحق. الرجاء حاول مرة أخرى.',
|
||||
'success' => 'تم حذف الملحق بنجاح.'
|
||||
),
|
||||
|
||||
|
||||
'checkout' => array(
|
||||
'error' => 'لم يتم إخراج الملحق، الرجاء المحاولة مرة أخرى',
|
||||
'success' => 'تم إخراج الملحق بنجاح.',
|
||||
@@ -30,7 +30,7 @@ return array(
|
||||
'checkin' => array(
|
||||
'error' => 'لم يتم إيداع الملحق، الرجاء المحاولة مرة أخرى',
|
||||
'success' => 'تم إيداع الملحق بنجاح.',
|
||||
'user_does_not_exist' => 'That user is invalid. Please try again.'
|
||||
'user_does_not_exist' => 'هذا المستخدم خاطئ، الرجاء المحاولة مرة أخرى.'
|
||||
)
|
||||
|
||||
|
||||
|
||||
Executable → Regular
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'dl_csv' => 'Download CSV',
|
||||
'dl_csv' => 'التنزيل كملف CSV',
|
||||
'eula_text' => 'اتفاقية ترخيص المستخدم',
|
||||
'id' => 'رقم المعرف',
|
||||
'require_acceptance' => 'القبول',
|
||||
|
||||
Executable → Regular
+10
-10
@@ -1,14 +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'
|
||||
'asset_maintenance_type' => 'تصنيف الصيانة',
|
||||
'title' => 'المسمى',
|
||||
'start_date' => 'بدأت',
|
||||
'completion_date' => 'أنجزت',
|
||||
'cost' => 'التكلفة',
|
||||
'is_warranty' => 'تحسين الضمان',
|
||||
'asset_maintenance_time' => 'أيام',
|
||||
'notes' => 'مُلاحظات',
|
||||
'update' => 'تعديل',
|
||||
'create' => 'إنشاء'
|
||||
];
|
||||
|
||||
Executable → Regular
+7
-7
@@ -1,11 +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'
|
||||
'asset_maintenances' => 'صيانة الاُصول',
|
||||
'edit' => 'تعديل صيانة الأصل',
|
||||
'delete' => 'حذف صيانة الأصل',
|
||||
'view' => 'عرض تفاصيل صيانة الأصل',
|
||||
'repair' => 'إصلاح',
|
||||
'maintenance' => 'الصيانة',
|
||||
'upgrade' => 'الترقية'
|
||||
];
|
||||
|
||||
Executable → Regular
+9
-9
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'not_found' => 'Asset Maintenance you were looking for was not found!',
|
||||
'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.'
|
||||
'confirm' => 'هل أنت متأكد من رغبتك في حذف صيانة الأصل؟',
|
||||
'error' => 'حدثت مشكلة في عملية الحذف لصيانة الأصل. الرجاء المحاولة مرة اُخرى.',
|
||||
'success' => 'تم حذف صيانة الأصل بنجاح.'
|
||||
],
|
||||
'create' => [
|
||||
'error' => 'Asset Maintenance was not created, please try again.',
|
||||
'success' => 'Asset Maintenance created successfully.'
|
||||
'error' => 'لم يتم إنشاء صيانة الأصل، الرجاء المحاولة مرة أخرى.',
|
||||
'success' => 'تم إنشاء صيانة الأصل بنجاح.'
|
||||
],
|
||||
'asset_maintenance_incomplete' => 'Not Completed Yet',
|
||||
'warranty' => 'Warranty',
|
||||
'not_warranty' => 'Not Warranty',
|
||||
'asset_maintenance_incomplete' => 'لم يكتمل بعد',
|
||||
'warranty' => 'الضمان',
|
||||
'not_warranty' => 'لا يوجد ضمان',
|
||||
];
|
||||
Executable → Regular
+6
-6
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'title' => 'Asset Maintenance',
|
||||
'asset_name' => 'Asset Name',
|
||||
'supplier_name' => 'Supplier Name',
|
||||
'is_warranty' => 'Warranty',
|
||||
'dl_csv' => 'Download CSV'
|
||||
];
|
||||
'title' => 'صيانة الاُصل',
|
||||
'asset_name' => 'الأصل',
|
||||
'supplier_name' => 'المزود',
|
||||
'is_warranty' => 'الضمان',
|
||||
'dl_csv' => 'التنزيل كملف CSV'
|
||||
];
|
||||
|
||||
Executable → Regular
+11
-11
@@ -5,18 +5,18 @@ return array(
|
||||
'about_categories' => 'تصنيفات الأصول تساعدك على ترتيب الأصول. من الأمثلة على التصنيفات " مكاتب "، "أجهزة الكمبيوتر المحمولة "، "الهواتف النقالة "، "أجهزة لوحية " وهكذا، كما يمكنك استخدام التصنيفات بأي طريقة تناسبك. ',
|
||||
'asset_categories' => 'التصنيفات',
|
||||
'category_name' => 'اسم التصنيف',
|
||||
'checkin_email' => 'Send email to user on checkin.',
|
||||
'clone' => 'Clone Category',
|
||||
'checkin_email' => 'إرسال إشعار للمستخدم عند الإدخال.',
|
||||
'clone' => 'نسخ التصنيف',
|
||||
'create' => 'إنشاء تصنيف',
|
||||
'edit' => 'Edit Category',
|
||||
'eula_text' => 'Category EULA',
|
||||
'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.',
|
||||
'require_acceptance' => 'Require users to confirm acceptance of assets in this category.',
|
||||
'required_acceptance' => 'This user will be emailed with a link to confirm acceptance of this item.',
|
||||
'required_eula' => 'This user will be emailed a copy of the EULA',
|
||||
'no_default_eula' => 'No primary default EULA found. Add one in Settings.',
|
||||
'edit' => 'تعديل التصنيف',
|
||||
'eula_text' => 'إتفاقية الإستخدام للتصنيف',
|
||||
'eula_text_help' => 'يسمح لك هذا الحقل بتخصيص الاتفاقيات لأنواع معينة من الأصول. اذا كنت تمتلك اتفاقية واحدة لجميع أصولك يمكنك أن تقوم بتأشير المربع في الأسفل لاستخدام الاتفاقية الافتراضية.',
|
||||
'require_acceptance' => 'مطالبة المستخدمين بتأكيد قبولهم للأصول في هذا التصنيف.',
|
||||
'required_acceptance' => 'سيتم اشعار المستخدم لتأكيد قبول الأصل.',
|
||||
'required_eula' => 'سيتم إشعار هذا المستخدم بإتفاقية الإستخدام',
|
||||
'no_default_eula' => 'ليس هناك اي اتفاقيات إستخدام. قم باضافة واحدة من "الاعدادات".',
|
||||
'update' => 'تحديث التصنيف',
|
||||
'use_default_eula' => 'Use the <a href="#" data-toggle="modal" data-target="#eulaModal">primary default EULA</a> instead.',
|
||||
'use_default_eula_disabled' => '<del>Use the primary default EULA instead.</del> No primary default EULA is set. Please add one in Settings.',
|
||||
'use_default_eula' => 'قم باستعمال <a href="#" data-toggle="modal" data-target="#eulaModal">إتفاقية الإستخدام الإفتراضية</a>.',
|
||||
'use_default_eula_disabled' => '<del>إستعمال إتفاقية الإستخدام الافتراضية بدلا من ذلك.</del> لم يتم تحديد إتفاقية الإستخدام الافتراضية. الرجاء إضافتها في الإعدادات.',
|
||||
|
||||
);
|
||||
|
||||
Executable → Regular
+2
-1
@@ -3,7 +3,8 @@
|
||||
return array(
|
||||
|
||||
'does_not_exist' => 'التصنيف غير موجود.',
|
||||
'assoc_users' => 'هذا التصنيف مرتبط مع نموذج. فضلاً قم بتحديث النماذج بحيث لا تكون مرتبطة بهذا التصنيف. ',
|
||||
'assoc_models' => 'This category is currently associated with at least one model and cannot be deleted. Please update your models to no longer reference this category and try again. ',
|
||||
'assoc_items' => 'This category is currently associated with at least one :asset_type and cannot be deleted. Please update your :asset_type to no longer reference this category and try again. ',
|
||||
|
||||
'create' => array(
|
||||
'error' => 'فشل إنشاء التصنيف، فضلاً حاول مرة أخرى.',
|
||||
|
||||
Executable → Regular
+2
-2
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'eula_text' => 'EULA',
|
||||
'eula_text' => 'اتفاقية ترخيص المستخدم',
|
||||
'id' => 'الرقم',
|
||||
'parent' => 'التصنيف الأب',
|
||||
'require_acceptance' => 'Acceptance',
|
||||
'require_acceptance' => 'القبول',
|
||||
'title' => 'اسم التصنيف',
|
||||
|
||||
);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'select_company' => 'اختر الشركة',
|
||||
];
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
return array(
|
||||
'does_not_exist' => 'الشركة غير موجودة.',
|
||||
'assoc_users' => 'هذه الشركة مرتبطة حاليا مع نموذج ولا يمكن حذفها. رجاءً قم بتحديث النماذج بحيث لا تكون مرتبطة بهذه الشركة ثم حاول مرة اُخرى. ',
|
||||
'create' => array(
|
||||
'error' => 'لم يتم انشاء الشركة، رجاءً حاول مرة اُخرى.',
|
||||
'success' => 'تم إنشاء الشركة بنجاح.'
|
||||
),
|
||||
'update' => array(
|
||||
'error' => 'لم يتم تحديث الشركة، رجاءً حاول مرة اُخرى',
|
||||
'success' => 'تم تحديث الشركة بنجاح.'
|
||||
),
|
||||
'delete' => array(
|
||||
'confirm' => 'هل أنت متأكد من رغبتك في حذف هذه الشركة؟',
|
||||
'error' => 'حدثت مشكلة اثناء عملية حذف الشركة. رجاءً المحاولة مرة اُخرى.',
|
||||
'success' => 'تم حذف الشركة بنجاح.'
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return array(
|
||||
'companies' => 'الشركات',
|
||||
'create' => 'إنشاء شركة',
|
||||
'title' => 'شركة',
|
||||
'update' => 'تحديث الشركة',
|
||||
'name' => 'إسم الشركة',
|
||||
'id' => 'رقم التعريف',
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'about_components_title' => 'حول المكونات',
|
||||
'about_components_text' => 'المكونات هي العناصر التي تشكل جزءا من الأصل، على سبيل المثال القرص الصلب، ذاكرة الوصول العشوائي، إلخ.',
|
||||
'component_name' => 'اسم المكون',
|
||||
'checkin' => 'ادخالات المكونات',
|
||||
'checkout' => 'مخرجات المكونات',
|
||||
'cost' => 'تكلفة الشراء',
|
||||
'create' => 'إنشاء مكون',
|
||||
'edit' => 'تعديل مكون',
|
||||
'date' => 'تاريخ الشراء',
|
||||
'order' => 'رقم طلب الشراء',
|
||||
'remaining' => 'المتبقية',
|
||||
'total' => 'المجموع',
|
||||
'update' => 'تحديث مكون',
|
||||
);
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
'does_not_exist' => 'المكون غير موجود.',
|
||||
|
||||
'create' => array(
|
||||
'error' => 'لم يتم إنشاء المكون، الرجاء المحاولة مرة أخرى.',
|
||||
'success' => 'تم إنشاء المكون بنجاح.'
|
||||
),
|
||||
|
||||
'update' => array(
|
||||
'error' => 'لم يتم تحديث المكون، الرجاء المحاولة مرة أخرى',
|
||||
'success' => 'تم تحديث المكون بنجاح.'
|
||||
),
|
||||
|
||||
'delete' => array(
|
||||
'confirm' => 'هل أنت متأكد من رغبتك في حذف هذا المكون؟',
|
||||
'error' => 'حدثت مشكلة اثناء عملية حذف المكون. رجاءً المحاولة مرة اُخرى.',
|
||||
'success' => 'تم حذف المكون بنجاح.'
|
||||
),
|
||||
|
||||
'checkout' => array(
|
||||
'error' => 'لم تتم عملة اخراج المكون، الرجاء المحاولة مرة اخرى',
|
||||
'success' => 'تم إخراج المكون بنجاح.',
|
||||
'user_does_not_exist' => 'هذا المستخدم خاطئ، الرجاء المحاولة مرة أخرى.'
|
||||
),
|
||||
|
||||
'checkin' => array(
|
||||
'error' => 'لم تتم عملية اخراج المكون، الرجاء المحاولة مرة اخرى',
|
||||
'success' => 'تم إدخال المكون بنجاح.',
|
||||
'user_does_not_exist' => 'هذا المستخدم خاطئ، الرجاء المحاولة مرة أخرى.'
|
||||
)
|
||||
|
||||
|
||||
);
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'title' => 'اسم المكون',
|
||||
);
|
||||
Executable → Regular
+11
-7
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
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',
|
||||
'about_consumables_title' => 'حول المواد الاستهلاكية',
|
||||
'about_consumables_text' => 'المواد الاستهلاكية هي الأشياء المشتراة والتي ستستخدم مع مرور الوقت. على سبيل المثال، حبر الطابعة أو ورق الناسخة.',
|
||||
'consumable_name' => 'اسم المادة الإستهلاكية',
|
||||
'cost' => 'تكلفة الشراء',
|
||||
'create' => 'إنشاء مادة إستهلاكية',
|
||||
'date' => 'تاريخ الشراء',
|
||||
'item_no' => 'Item No.',
|
||||
'order' => 'رقم طلب الشراء',
|
||||
'remaining' => 'المتبقية',
|
||||
'total' => 'المجموع',
|
||||
'update' => 'تحديث المادة الإستهلاكية',
|
||||
);
|
||||
|
||||
Executable → Regular
Executable → Regular
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'custom_fields' => 'Custom Fields',
|
||||
'field' => 'Field',
|
||||
'about_fieldsets_title' => 'About Fieldsets',
|
||||
'about_fieldsets_text' => 'Fieldsets allow you to create groups of custom fields that are frequently re-used used for specific asset model types.',
|
||||
'fieldset' => 'Fieldset',
|
||||
'qty_fields' => 'Qty Fields',
|
||||
'fieldsets' => 'Fieldsets',
|
||||
'fieldset_name' => 'Fieldset Name',
|
||||
'field_name' => 'Field Name',
|
||||
'field_element' => 'Form Element',
|
||||
'field_element_short' => 'Element',
|
||||
'field_format' => 'Format',
|
||||
'field_custom_format' => 'Custom Format',
|
||||
'required' => 'Required',
|
||||
'req' => 'Req.',
|
||||
'used_by_models' => 'Used By Models',
|
||||
'order' => 'Order',
|
||||
'create_fieldset' => 'New Fieldset',
|
||||
'create_field' => 'New Custom Field',
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user