diff --git a/.all-contributorsrc b/.all-contributorsrc index 68aec8532..8ea582b9b 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -3190,6 +3190,33 @@ "contributions": [ "code" ] + }, + { + "login": "Scarzy", + "name": "Scarzy", + "avatar_url": "https://avatars.githubusercontent.com/u/1197791?v=4", + "profile": "https://github.com/Scarzy", + "contributions": [ + "code" + ] + }, + { + "login": "setpill", + "name": "setpill", + "avatar_url": "https://avatars.githubusercontent.com/u/37372069?v=4", + "profile": "https://github.com/setpill", + "contributions": [ + "code" + ] + }, + { + "login": "swift2512", + "name": "swift2512", + "avatar_url": "https://avatars.githubusercontent.com/u/3755203?v=4", + "profile": "https://github.com/swift2512", + "contributions": [ + "bug" + ] } ] } diff --git a/.env.dev.docker b/.env.dev.docker index 7b9e2000c..983063bbd 100644 --- a/.env.dev.docker +++ b/.env.dev.docker @@ -1,6 +1,8 @@ # -------------------------------------------- # REQUIRED: DB SETUP # -------------------------------------------- +# https://mariadb.com/kb/en/mariadb-server-docker-official-image-environment-variables/ + MYSQL_DATABASE=snipeit MYSQL_USER=snipeit MYSQL_PASSWORD=changeme1234 diff --git a/.env.docker b/.env.docker index 9e5038301..4865f8e13 100644 --- a/.env.docker +++ b/.env.docker @@ -97,7 +97,7 @@ API_TOKEN_EXPIRATION_YEARS=40 # -------------------------------------------- # OPTIONAL: SECURITY HEADER SETTINGS # -------------------------------------------- -APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1,172.0.0.0/8 +APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1,172.16.0.0/12 ALLOW_IFRAMING=false REFERRER_POLICY=same-origin ENABLE_CSP=false diff --git a/.env.example b/.env.example index 426af4ff8..3bfee7bf2 100644 --- a/.env.example +++ b/.env.example @@ -32,6 +32,8 @@ DB_PREFIX=null DB_DUMP_PATH='/usr/bin' DB_CHARSET=utf8mb4 DB_COLLATION=utf8mb4_unicode_ci +DB_SANITIZE_BY_DEFAULT=false + # -------------------------------------------- # OPTIONAL: SSL DATABASE SETTINGS diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 53acc282e..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 60 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -exemptLabels: - - pinned - - security - - :woman_technologist: ready for dev - - :moneybag: bounty - - :hand: bug - - "🔐 security" - - "👩‍💻 ready for dev" - - "💰 bounty" - - "✋ bug" - -exemptMilestones: true - -# Label to use when marking an issue as stale -staleLabel: stale - -only: issues - -# Comment to post when removing the stale label. -unmarkComment: > - Okay, it looks like this issue or feature request might still be important. We'll re-open - it for now. Thank you for letting us know! - -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - Is this still relevant? We haven't heard from anyone in a bit. If so, - please comment with any updates or additional detail. - - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Don't - take it personally, we just need to keep a handle on things. Thank you - for your contributions! -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: > - This issue has been automatically closed because it has not had - recent activity. If you believe this is still an issue, please confirm that - this issue is still happening in the most recent version of Snipe-IT and reply - to this thread to re-open it. diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..5a4042aee --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,40 @@ +name: 'Close stale issues' +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + # contents: write # only for delete-branch option + issues: write + # pull-requests: write + steps: + - uses: actions/stale@v9 + with: + debug-only: true + ascending: true + operations-per-run: 1000 # just while we're debugging + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 60 + days-before-close: 7 + exempt-all-milestones: true + stale-issue-message: > + Is this still relevant? We haven't heard from anyone in a bit. If so, + please comment with any updates or additional detail. + + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Don't + take it personally, we just need to keep a handle on things. Thank you + for your contributions! + close-issue-message: > + This issue has been automatically closed because it has not had + recent activity. If you believe this is still an issue, please confirm that + this issue is still happening in the most recent version of Snipe-IT and reply + to this thread to re-open it. + # There doesn't seem to be a 'reopen issue message'? + # Since there is no 'stale-pr-message' - PR's should not be stale'd + stale-issue-label: stale + exempt-issue-labels: > + pinned,security,:woman_technologist: ready for dev,:moneybag: bounty,:hand: bug,🔐 security,👩‍💻 ready for dev,💰 bounty,✋ bug \ No newline at end of file diff --git a/.github/workflows/tests-mysql.yml b/.github/workflows/tests-mysql.yml index 737a86dca..310414cda 100644 --- a/.github/workflows/tests-mysql.yml +++ b/.github/workflows/tests-mysql.yml @@ -76,4 +76,4 @@ jobs: DB_DATABASE: snipeit DB_PORT: ${{ job.services.mysql.ports[3306] }} DB_USERNAME: root - run: php artisan test --parallel + run: php artisan test diff --git a/.github/workflows/tests-postgres.yml b/.github/workflows/tests-postgres.yml index 0c361511b..ae48277be 100644 --- a/.github/workflows/tests-postgres.yml +++ b/.github/workflows/tests-postgres.yml @@ -74,4 +74,4 @@ jobs: DB_PORT: ${{ job.services.postgresql.ports[5432] }} DB_USERNAME: snipeit DB_PASSWORD: password - run: php artisan test --parallel + run: php artisan test diff --git a/.github/workflows/tests-sqlite.yml b/.github/workflows/tests-sqlite.yml index 49c7c92d8..8bf011516 100644 --- a/.github/workflows/tests-sqlite.yml +++ b/.github/workflows/tests-sqlite.yml @@ -58,4 +58,4 @@ jobs: - name: Execute tests (Unit and Feature tests) via PHPUnit env: DB_CONNECTION: sqlite_testing - run: php artisan test --parallel + run: php artisan test diff --git a/.gitignore b/.gitignore index 0715ac049..17a7d28da 100755 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ storage/private_uploads/users/* tests/_data/scenarios tests/_output/* tests/_support/_generated/* +tests/coverage/* /npm-debug.log /storage/oauth-private.key /storage/oauth-public.key diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6359814b4..f821c1f17 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -52,7 +52,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken | [
bilias](https://github.com/bilias)
[💻](https://github.com/snipe/snipe-it/commits?author=bilias "Code") | [
coach1988](https://github.com/coach1988)
[💻](https://github.com/snipe/snipe-it/commits?author=coach1988 "Code") | [
MrM](https://github.com/mauro-miatello)
[💻](https://github.com/snipe/snipe-it/commits?author=mauro-miatello "Code") | [
koiakoia](https://github.com/koiakoia)
[💻](https://github.com/snipe/snipe-it/commits?author=koiakoia "Code") | [
Mustafa Online](https://github.com/mustafa-online)
[💻](https://github.com/snipe/snipe-it/commits?author=mustafa-online "Code") | [
franceslui](https://github.com/franceslui)
[💻](https://github.com/snipe/snipe-it/commits?author=franceslui "Code") | [
Q4kK](https://github.com/Q4kK)
[💻](https://github.com/snipe/snipe-it/commits?author=Q4kK "Code") | | [
squintfox](https://github.com/squintfox)
[💻](https://github.com/snipe/snipe-it/commits?author=squintfox "Code") | [
Jeff Clay](https://github.com/jeffclay)
[💻](https://github.com/snipe/snipe-it/commits?author=jeffclay "Code") | [
Phil J R](https://github.com/PP-JN-RL)
[💻](https://github.com/snipe/snipe-it/commits?author=PP-JN-RL "Code") | [
i_virus](https://www.corelight.com/)
[💻](https://github.com/snipe/snipe-it/commits?author=chandanchowdhury "Code") | [
Paul Grime](https://github.com/gitgrimbo)
[💻](https://github.com/snipe/snipe-it/commits?author=gitgrimbo "Code") | [
Lee Porte](https://leeporte.co.uk)
[💻](https://github.com/snipe/snipe-it/commits?author=LeePorte "Code") | [
BRYAN ](https://github.com/bryanlopezinc)
[💻](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Code") [⚠️](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Tests") | | [
U-H-T](https://github.com/U-H-T)
[💻](https://github.com/snipe/snipe-it/commits?author=U-H-T "Code") | [
Matt Tyree](https://github.com/Tyree)
[📖](https://github.com/snipe/snipe-it/commits?author=Tyree "Documentation") | [
Florent Bervas](http://spoontux.net)
[💻](https://github.com/snipe/snipe-it/commits?author=FlorentDotMe "Code") | [
Daniel Albertsen](https://ditscheri.com)
[💻](https://github.com/snipe/snipe-it/commits?author=dbakan "Code") | [
r-xyz](https://github.com/r-xyz)
[💻](https://github.com/snipe/snipe-it/commits?author=r-xyz "Code") | [
Steven Mainor](https://github.com/DrekiDegga)
[💻](https://github.com/snipe/snipe-it/commits?author=DrekiDegga "Code") | [
arne-kroeger](https://github.com/arne-kroeger)
[💻](https://github.com/snipe/snipe-it/commits?author=arne-kroeger "Code") | -| [
Glukose1](https://github.com/Glukose1)
[💻](https://github.com/snipe/snipe-it/commits?author=Glukose1 "Code") | +| [
Glukose1](https://github.com/Glukose1)
[💻](https://github.com/snipe/snipe-it/commits?author=Glukose1 "Code") | [
Scarzy](https://github.com/Scarzy)
[💻](https://github.com/snipe/snipe-it/commits?author=Scarzy "Code") | [
setpill](https://github.com/setpill)
[💻](https://github.com/snipe/snipe-it/commits?author=setpill "Code") | [
swift2512](https://github.com/swift2512)
[🐛](https://github.com/snipe/snipe-it/issues?q=author%3Aswift2512 "Bug reports") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/Dockerfile.alpine b/Dockerfile.alpine index c08cbbd95..2c83a1a11 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -79,12 +79,12 @@ USER root VOLUME ["/var/lib/snipeit"] -# Entrypoints -COPY docker/entrypoint_alpine.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh +# Startup script +COPY docker/startup_alpine.sh /startup.sh +RUN chmod +x /startup.sh ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/entrypoint.sh"] +CMD ["/startup.sh"] EXPOSE 80 diff --git a/Dockerfile.fpm-alpine b/Dockerfile.fpm-alpine index 77302524d..b7fb27298 100644 --- a/Dockerfile.fpm-alpine +++ b/Dockerfile.fpm-alpine @@ -97,7 +97,7 @@ RUN set -eux; \ VOLUME [ "/var/lib/snipeit" ] COPY --chown=www-data:www-data docker/docker-secrets.env /var/www/html/.env -COPY --chmod=655 docker/docker-entrypoint.sh /usr/local/bin/docker-snipeit-entrypoint +COPY --chmod=655 docker/startup_alpine_fpm.sh /startup.sh COPY docker/column-statistics.cnf /etc/mysql/conf.d/column-statistics.cnf -ENTRYPOINT [ "/usr/local/bin/docker-snipeit-entrypoint" ] -CMD [ "/usr/local/bin/docker-php-entrypoint", "php-fpm" ] +ENTRYPOINT [ "/startup.sh" ] +CMD [ "/startup.sh", "php-fpm" ] diff --git a/README.md b/README.md index 0086c7b32..e0f4154f6 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,11 @@ Since the release of the JSON REST API, several third-party developers have been ### Contributing -Please see the documentation on [contributing and developing for Snipe-IT](https://snipe-it.readme.io/docs/contributing-overview). +Please refrain from submitting issues or pull requests generated by fully-automated tools. Maintainers reserve the right, at their sole discretion, to close such submissions and to block any account responsible for them. + +Ideally, contributions should follow from a human-to-human discussion in the form of an issue. + +Please see the complete documentation on [contributing and developing for Snipe-IT](https://snipe-it.readme.io/docs/contributing-overview). 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. diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php old mode 100755 new mode 100644 index 845db27ef..9f4281bd4 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -53,18 +53,22 @@ class LdapSync extends Command ini_set('max_execution_time', env('LDAP_TIME_LIM', 600)); //600 seconds = 10 minutes ini_set('memory_limit', env('LDAP_MEM_LIM', '500M')); - $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; - $ldap_result_emp_num = Setting::getSettings()->ldap_emp_num; - $ldap_result_email = Setting::getSettings()->ldap_email; - $ldap_result_phone = Setting::getSettings()->ldap_phone_field; - $ldap_result_jobtitle = Setting::getSettings()->ldap_jobtitle; - $ldap_result_country = Setting::getSettings()->ldap_country; - $ldap_result_location = Setting::getSettings()->ldap_location; - $ldap_result_dept = Setting::getSettings()->ldap_dept; - $ldap_result_manager = Setting::getSettings()->ldap_manager; + + $ldap_map = [ + "username" => Setting::getSettings()->ldap_username_field, + "last_name" => Setting::getSettings()->ldap_lname_field, + "first_name" => Setting::getSettings()->ldap_fname_field, + "active_flag" => Setting::getSettings()->ldap_active_flag, + "emp_num" => Setting::getSettings()->ldap_emp_num, + "email" => Setting::getSettings()->ldap_email, + "phone" => Setting::getSettings()->ldap_phone_field, + "jobtitle" => Setting::getSettings()->ldap_jobtitle, + "country" => Setting::getSettings()->ldap_country, + "location" => Setting::getSettings()->ldap_location, + "dept" => Setting::getSettings()->ldap_dept, + "manager" => Setting::getSettings()->ldap_manager, + ]; + $ldap_default_group = Setting::getSettings()->ldap_default_group; $search_base = Setting::getSettings()->ldap_base_dn; @@ -107,14 +111,21 @@ class LdapSync extends Command } /** - * If a filter has been specified, use that + * If a filter has been specified, use that, otherwise default to null */ if ($this->option('filter') != '') { - $results = Ldap::findLdapUsers($search_base, -1, $this->option('filter')); + $filter = $this->option('filter'); } else { - $results = Ldap::findLdapUsers($search_base); + $filter = null; } - + + /** + * We only need to request the LDAP attributes that we process + */ + $attributes = array_values(array_filter($ldap_map)); + + $results = Ldap::findLdapUsers($search_base, -1, $filter, $attributes); + } catch (\Exception $e) { if ($this->option('json_summary')) { $json_summary = ['error' => true, 'error_message' => $e->getMessage(), 'summary' => []]; @@ -126,23 +137,24 @@ class LdapSync extends Command } /* Determine which location to assign users to by default. */ - $location = null; // TODO - this would be better called "$default_location", which is more explicit about its purpose + $default_location = null; if ($this->option('location') != '') { - if ($location = Location::where('name', '=', $this->option('location'))->first()) { + if ($default_location = Location::where('name', '=', $this->option('location'))->first()) { Log::debug('Location name ' . $this->option('location') . ' passed'); - Log::debug('Importing to ' . $location->name . ' (' . $location->id . ')'); + Log::debug('Importing to '.$default_location->name.' ('.$default_location->id.')'); } } elseif ($this->option('location_id')) { + //TODO - figure out how or why this is an array? foreach($this->option('location_id') as $location_id) { - if ($location = Location::where('id', '=', $location_id)->first()) { + if ($default_location = Location::where('id', '=', $location_id)->first()) { Log::debug('Location ID ' . $location_id . ' passed'); - Log::debug('Importing to ' . $location->name . ' (' . $location->id . ')'); + Log::debug('Importing to '.$default_location->name.' ('.$default_location->id.')'); } } } - if (! isset($location)) { + if (!isset($default_location)) { Log::debug('That location is invalid or a location was not provided, so no location will be assigned by default.'); } @@ -183,17 +195,17 @@ class LdapSync extends Command } $usernames = []; for ($i = 0; $i < $location_users['count']; $i++) { - if (array_key_exists($ldap_result_username, $location_users[$i])) { + if (array_key_exists($ldap_map["username"], $location_users[$i])) { $location_users[$i]['ldap_location_override'] = true; $location_users[$i]['location_id'] = $ldap_loc['id']; - $usernames[] = $location_users[$i][$ldap_result_username][0]; + $usernames[] = $location_users[$i][$ldap_map["username"]][0]; } } // Delete located users from the general group. foreach ($results as $key => $generic_entry) { - if ((is_array($generic_entry)) && (array_key_exists($ldap_result_username, $generic_entry))) { - if (in_array($generic_entry[$ldap_result_username][0], $usernames)) { + if ((is_array($generic_entry)) && (array_key_exists($ldap_map["username"], $generic_entry))) { + if (in_array($generic_entry[$ldap_map["username"]][0], $usernames)) { unset($results[$key]); } } @@ -218,77 +230,78 @@ class LdapSync extends Command for ($i = 0; $i < $results['count']; $i++) { - $item = []; - $item['username'] = $results[$i][$ldap_result_username][0] ?? ''; - $item['employee_number'] = $results[$i][$ldap_result_emp_num][0] ?? ''; - $item['lastname'] = $results[$i][$ldap_result_last_name][0] ?? ''; - $item['firstname'] = $results[$i][$ldap_result_first_name][0] ?? ''; - $item['email'] = $results[$i][$ldap_result_email][0] ?? ''; - $item['ldap_location_override'] = $results[$i]['ldap_location_override'] ?? ''; - $item['location_id'] = $results[$i]['location_id'] ?? ''; - $item['telephone'] = $results[$i][$ldap_result_phone][0] ?? ''; - $item['jobtitle'] = $results[$i][$ldap_result_jobtitle][0] ?? ''; - $item['country'] = $results[$i][$ldap_result_country][0] ?? ''; - $item['department'] = $results[$i][$ldap_result_dept][0] ?? ''; - $item['manager'] = $results[$i][$ldap_result_manager][0] ?? ''; - $item['location'] = $results[$i][$ldap_result_location][0] ?? ''; + $item = []; + $item['username'] = $results[$i][$ldap_map["username"]][0] ?? ''; + $item['employee_number'] = $results[$i][$ldap_map["emp_num"]][0] ?? ''; + $item['lastname'] = $results[$i][$ldap_map["last_name"]][0] ?? ''; + $item['firstname'] = $results[$i][$ldap_map["first_name"]][0] ?? ''; + $item['email'] = $results[$i][$ldap_map["email"]][0] ?? ''; + $item['ldap_location_override'] = $results[$i]['ldap_location_override'] ?? ''; + $item['location_id'] = $results[$i]['location_id'] ?? ''; + $item['telephone'] = $results[$i][$ldap_map["phone"]][0] ?? ''; + $item['jobtitle'] = $results[$i][$ldap_map["jobtitle"]][0] ?? ''; + $item['country'] = $results[$i][$ldap_map["country"]][0] ?? ''; + $item['department'] = $results[$i][$ldap_map["dept"]][0] ?? ''; + $item['manager'] = $results[$i][$ldap_map["manager"]][0] ?? ''; + $item['location'] = $results[$i][$ldap_map["location"]][0] ?? ''; + $location = $default_location; //initially, set '$location' to the default_location (which may just be `null`) - // ONLY if you are using the "ldap_location" option *AND* you have an actual result - if ($ldap_result_location && $item['location']) { - $location = Location::firstOrCreate([ - 'name' => $item['location'], - ]); - } - $department = Department::firstOrCreate([ - 'name' => $item['department'], + // ONLY if you are using the "ldap_location" option *AND* you have an actual result + if ($ldap_map["location"] && $item['location']) { + $location = Location::firstOrCreate([ + 'name' => $item['location'], ]); + } + $department = Department::firstOrCreate([ + 'name' => $item['department'], + ]); - $user = User::where('username', $item['username'])->first(); - if ($user) { - // Updating an existing user. - $item['createorupdate'] = 'updated'; - } else { - // Creating a new user. - $user = new User; - $user->password = $user->noPassword(); - $user->locale = app()->getLocale(); - $user->activated = 1; // newly created users can log in by default, unless AD's UAC is in use, or an active flag is set (below) - $item['createorupdate'] = 'created'; - } + $user = User::where('username', $item['username'])->first(); + if ($user) { + // Updating an existing user. + $item['createorupdate'] = 'updated'; + } else { + // Creating a new user. + $user = new User; + $user->password = $user->noPassword(); + $user->locale = app()->getLocale(); + $user->activated = 1; // newly created users can log in by default, unless AD's UAC is in use, or an active flag is set (below) + $item['createorupdate'] = 'created'; + } //If a sync option is not filled in on the LDAP settings don't populate the user field - if($ldap_result_username != null){ + if($ldap_map["username"] != null){ $user->username = $item['username']; } - if($ldap_result_last_name != null){ + if($ldap_map["last_name"] != null){ $user->last_name = $item['lastname']; } - if($ldap_result_first_name != null){ + if($ldap_map["first_name"] != null){ $user->first_name = $item['firstname']; } - if($ldap_result_emp_num != null){ + if($ldap_map["emp_num"] != null){ $user->employee_num = e($item['employee_number']); } - if($ldap_result_email != null){ + if($ldap_map["email"] != null){ $user->email = $item['email']; } - if($ldap_result_phone != null){ + if($ldap_map["phone"] != null){ $user->phone = $item['telephone']; } - if($ldap_result_jobtitle != null){ + if($ldap_map["jobtitle"] != null){ $user->jobtitle = $item['jobtitle']; } - if($ldap_result_country != null){ + if($ldap_map["country"] != null){ $user->country = $item['country']; } - if($ldap_result_dept != null){ + if($ldap_map["dept"] != null){ $user->department_id = $department->id; } - if($ldap_result_location != null){ - $user->location_id = $location ? $location->id : null; + if($ldap_map["location"] != null){ + $user->location_id = $location?->id; } - if($ldap_result_manager != null){ + if($ldap_map["manager"] != null){ if($item['manager'] != null) { // Check Cache first if (isset($manager_cache[$item['manager']])) { @@ -305,7 +318,7 @@ class LdapSync extends Command $ldap_manager = [ "count" => 1, 0 => [ - $ldap_result_username => [$item['manager']] + $ldap_map["username"] => [$item['manager']] ] ]; } @@ -314,7 +327,7 @@ class LdapSync extends Command // Get the Manager's username // PHP LDAP returns every LDAP attribute as an array, and 90% of the time it's an array of just one item. But, hey, it's an array. - $ldapManagerUsername = $ldap_manager[0][$ldap_result_username][0]; + $ldapManagerUsername = $ldap_manager[0][$ldap_map["username"]][0]; // Get User from Manager username. $ldap_manager = User::where('username', $ldapManagerUsername)->first(); @@ -330,38 +343,38 @@ class LdapSync extends Command } } - // Sync activated state for Active Directory. - if ( !empty($ldap_result_active_flag)) { // IF we have an 'active' flag set.... - // ....then *most* things that are truthy will activate the user. Anything falsey will deactivate them. - // (Specifically, we don't handle a value of '0.0' correctly) - $raw_value = @$results[$i][$ldap_result_active_flag][0]; - $filter_var = filter_var($raw_value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); - $boolean_cast = (bool)$raw_value; + // Sync activated state for Active Directory. + if (!empty($ldap_map["active_flag"])) { // IF we have an 'active' flag set.... + // ....then *most* things that are truthy will activate the user. Anything falsey will deactivate them. + // (Specifically, we don't handle a value of '0.0' correctly) + $raw_value = @$results[$i][$ldap_map["active_flag"]][0]; + $filter_var = filter_var($raw_value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + $boolean_cast = (bool) $raw_value; - $user->activated = $filter_var ?? $boolean_cast; // if filter_var() was true or false, use that. If it's null, use the $boolean_cast + $user->activated = $filter_var ?? $boolean_cast; // if filter_var() was true or false, use that. If it's null, use the $boolean_cast - } elseif (array_key_exists('useraccountcontrol', $results[$i]) ) { - // ....otherwise, (ie if no 'active' LDAP flag is defined), IF the UAC setting exists, - // ....then use the UAC setting on the account to determine can-log-in vs. cannot-log-in + } elseif (array_key_exists('useraccountcontrol', $results[$i])) { + // ....otherwise, (ie if no 'active' LDAP flag is defined), IF the UAC setting exists, + // ....then use the UAC setting on the account to determine can-log-in vs. cannot-log-in - /* The following is _probably_ the correct logic, but we can't use it because - some users may have been dependent upon the previous behavior, and this - could cause additional access to be available to users they don't want - to allow to log in. + /* The following is _probably_ the correct logic, but we can't use it because + some users may have been dependent upon the previous behavior, and this + could cause additional access to be available to users they don't want + to allow to log in. - $useraccountcontrol = $results[$i]['useraccountcontrol'][0]; - if( - // based on MS docs at: https://support.microsoft.com/en-us/help/305144/how-to-use-useraccountcontrol-to-manipulate-user-account-properties - ($useraccountcontrol & 0x200) && // is a NORMAL_ACCOUNT - !($useraccountcontrol & 0x02) && // *and* _not_ ACCOUNTDISABLE - !($useraccountcontrol & 0x10) // *and* _not_ LOCKOUT - ) { - $user->activated = 1; - } else { - $user->activated = 0; - } */ - $enabled_accounts = [ + $useraccountcontrol = $results[$i]['useraccountcontrol'][0]; + if( + // based on MS docs at: https://support.microsoft.com/en-us/help/305144/how-to-use-useraccountcontrol-to-manipulate-user-account-properties + ($useraccountcontrol & 0x200) && // is a NORMAL_ACCOUNT + !($useraccountcontrol & 0x02) && // *and* _not_ ACCOUNTDISABLE + !($useraccountcontrol & 0x10) // *and* _not_ LOCKOUT + ) { + $user->activated = 1; + } else { + $user->activated = 0; + } */ + $enabled_accounts = [ '512', // 0x200 NORMAL_ACCOUNT '544', // 0x220 NORMAL_ACCOUNT, PASSWD_NOTREQD '66048', // 0x10200 NORMAL_ACCOUNT, DONT_EXPIRE_PASSWORD @@ -374,44 +387,47 @@ class LdapSync extends Command '4260352', // 0x410200 NORMAL_ACCOUNT, DONT_EXPIRE_PASSWORD, DONT_REQ_PREAUTH '1049088', // 0x100200 NORMAL_ACCOUNT, NOT_DELEGATED '1114624', // 0x110200 NORMAL_ACCOUNT, DONT_EXPIRE_PASSWORD, NOT_DELEGATED, - ]; - $user->activated = (in_array($results[$i]['useraccountcontrol'][0], $enabled_accounts)) ? 1 : 0; + ]; + $user->activated = (in_array($results[$i]['useraccountcontrol'][0], $enabled_accounts)) ? 1 : 0; // If we're not using AD, and there isn't an activated flag set, activate all users - } /* implied 'else' here - leave the $user->activated flag alone. Newly-created accounts will be active. - already-existing accounts will be however the administrator has set them */ + } /* implied 'else' here - leave the $user->activated flag alone. Newly-created accounts will be active. + already-existing accounts will be however the administrator has set them */ - if ($item['ldap_location_override'] == true) { - $user->location_id = $item['location_id']; - } elseif ((isset($location)) && (! empty($location))) { - if ((is_array($location)) && (array_key_exists('id', $location))) { - $user->location_id = $location['id']; - } elseif (is_object($location)) { - $user->location_id = $location->id; - } + if ($item['ldap_location_override'] == true) { + $user->location_id = $item['location_id']; + } elseif ((isset($location)) && (!empty($location))) { + if ((is_array($location)) && (array_key_exists('id', $location))) { + $user->location_id = $location['id']; + } elseif (is_object($location)) { + $user->location_id = $location->id; //THIS is the magic line, this should do it. } - $location = null; - $user->ldap_import = 1; + } + // TODO - should we be NULLING locations if $location is really `null`, and that's what we came up with? + // will that conflict with any overriding setting that the user set? Like, if they moved someone from + // the 'null' location to somewhere, we wouldn't want to try to override that, right? + $location = null; + $user->ldap_import = 1; - $errors = ''; + $errors = ''; - if ($user->save()) { - $item['note'] = $item['createorupdate']; - $item['status'] = 'success'; - if ( $item['createorupdate'] === 'created' && $ldap_default_group) { - $user->groups()->attach($ldap_default_group); - } - - } else { - foreach ($user->getErrors()->getMessages() as $key => $err) { - $errors .= $err[0]; - } - $item['note'] = $errors; - $item['status'] = 'error'; + if ($user->save()) { + $item['note'] = $item['createorupdate']; + $item['status'] = 'success'; + if ($item['createorupdate'] === 'created' && $ldap_default_group) { + $user->groups()->attach($ldap_default_group); } - array_push($summary, $item); + } else { + foreach ($user->getErrors()->getMessages() as $key => $err) { + $errors .= $err[0]; + } + $item['note'] = $errors; + $item['status'] = 'error'; + } + + array_push($summary, $item); } if ($this->option('summary')) { diff --git a/app/Console/Commands/ObjectImportCommand.php b/app/Console/Commands/ObjectImportCommand.php index 8370e7c05..a1202ded8 100644 --- a/app/Console/Commands/ObjectImportCommand.php +++ b/app/Console/Commands/ObjectImportCommand.php @@ -6,6 +6,7 @@ use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Illuminate\Support\Facades\Log; +use Symfony\Component\Console\Helper\ProgressIndicator; ini_set('max_execution_time', env('IMPORT_TIME_LIMIT', 600)); //600 seconds = 10 minutes ini_set('memory_limit', env('IMPORT_MEMORY_LIMIT', '500M')); @@ -29,6 +30,11 @@ class ObjectImportCommand extends Command */ protected $description = 'Import Items from CSV'; + /** + * The progress indicator instance. + */ + protected ProgressIndicator $progressIndicator; + /** * Create a new command instance. * @@ -39,8 +45,6 @@ class ObjectImportCommand extends Command parent::__construct(); } - private $bar; - /** * Execute the console command. * @@ -48,6 +52,8 @@ class ObjectImportCommand extends Command */ public function handle() { + $this->progressIndicator = new ProgressIndicator($this->output); + $filename = $this->argument('filename'); $class = title_case($this->option('item-type')); $classString = "App\\Importer\\{$class}Importer"; @@ -61,46 +67,25 @@ class ObjectImportCommand extends Command // This $logFile/useFiles() bit is currently broken, so commenting it out for now // $logFile = $this->option('logfile'); // Log::useFiles($logFile); - $this->comment('======= Importing Items from '.$filename.' ========='); + $this->progressIndicator->start('======= Importing Items from '.$filename.' ========='); + $importer->import(); - $this->bar = null; - - if (! empty($this->errors)) { - $this->comment('The following Errors were encountered.'); - foreach ($this->errors as $asset => $error) { - $this->comment('Error: Item: '.$asset.' failed validation: '.json_encode($error)); - } - } else { - $this->comment('All Items imported successfully!'); - } - $this->comment(''); + $this->progressIndicator->finish('Import finished.'); } - public function errorCallback($item, $field, $errorString) + public function errorCallback($item, $field, $error) { - $this->errors[$item->name][$field] = $errorString; + $this->output->write("\x0D\x1B[2K"); + + $this->warn('Error: Item: '.$item->name.' failed validation: '.json_encode($error)); } - public function progress($count) + public function progress($importedItemsCount) { - if (! $this->bar) { - $this->bar = $this->output->createProgressBar($count); - } - static $index = 0; - $index++; - if ($index < $count) { - $this->bar->advance(); - } else { - $this->bar->finish(); - } + $this->progressIndicator->advance(); } - // Tracks the current item for error messages - private $updating; - // An array of errors encountered while parsing - private $errors; - /** * Log a message to file, configurable by the --log-file parameter. * If a warning message is passed, we'll spit it to the console as well. diff --git a/app/Console/Commands/RemoveExplicitEols.php b/app/Console/Commands/RemoveExplicitEols.php new file mode 100644 index 000000000..f5164c2ee --- /dev/null +++ b/app/Console/Commands/RemoveExplicitEols.php @@ -0,0 +1,60 @@ +option('model_name') == 'all') { + $assets = Asset::all(); + $this->updateAssets($assets); + } else { + $assetModel = AssetModel::where('name', '=', $this->option('model_name'))->first(); + + if ($assetModel) { + $assets = Asset::where('model_id', '=', $assetModel->id)->get(); + $this->updateAssets($assets); + } else { + $this->error('Asset model not found'); + } + } + $endTime = microtime(true); + $executionTime = ($endTime - $startTime); + $this->info('Command executed in ' . round($executionTime, 2) . ' seconds.'); + } + + private function updateAssets($assets) + { + foreach ($assets as $asset) { + $asset->eol_explicit = 0; + $asset->asset_eol_date = null; + $asset->save(); + } + + $this->info($assets->count() . ' Assets updated successfully'); + } +} diff --git a/app/Console/Commands/SendAcceptanceReminder.php b/app/Console/Commands/SendAcceptanceReminder.php index dd9e59f61..155134804 100644 --- a/app/Console/Commands/SendAcceptanceReminder.php +++ b/app/Console/Commands/SendAcceptanceReminder.php @@ -47,7 +47,8 @@ class SendAcceptanceReminder extends Command { $pending = CheckoutAcceptance::pending()->where('checkoutable_type', 'App\Models\Asset') ->whereHas('checkoutable', function($query) { - $query->where('archived', 0); + $query->where('accepted_at', null) + ->where('declined_at', null); }) ->with(['assignedTo', 'checkoutable.assignedTo', 'checkoutable.model', 'checkoutable.adminuser']) ->get(); diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 18e149b57..95a344dce 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Crypt; use Illuminate\Contracts\Encryption\DecryptException; use Carbon\Carbon; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Str; use Intervention\Image\ImageManagerStatic as Image; use Illuminate\Support\Facades\Session; @@ -708,6 +709,28 @@ class Helper return $randomString; } + /** + * A method to be used to handle deprecations notifications, currently handling MS Teams. more can be added when needed. + * + * + * @author [Godfrey Martinez] + * @since [v7.0.14] + * @return array + */ + public static function deprecationCheck() : array { + // The check and message that the user is still using the deprecated version + $deprecations = [ + 'ms_teams_deprecated' => array( + 'check' => !Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows'), + 'message' => 'The Microsoft Teams webhook URL being used will be deprecated Jan 31st, 2025. Change webhook endpoint'), + ]; + + // if item of concern is being used and its being used with the deprecated values return the notification array. + if(Setting::getSettings()->webhook_selected === 'microsoft' && $deprecations['ms_teams_deprecated']['check']) { + return $deprecations; + } + return []; + } /** * This nasty little method gets the low inventory info for the @@ -1123,6 +1146,7 @@ class Helper 'png' => 'far fa-image', 'webp' => 'far fa-image', 'avif' => 'far fa-image', + 'svg' => 'fas fa-vector-square', // word 'doc' => 'far fa-file-word', 'docx' => 'far fa-file-word', @@ -1135,7 +1159,7 @@ class Helper //Text 'txt' => 'far fa-file-alt', 'rtf' => 'far fa-file-alt', - 'xml' => 'far fa-file-alt', + 'xml' => 'fas fa-code', // Misc 'pdf' => 'far fa-file-pdf', 'lic' => 'far fa-save', @@ -1148,41 +1172,7 @@ class Helper return 'far fa-file'; } - public static function show_file_inline($filename) - { - $extension = substr(strrchr($filename, '.'), 1); - if ($extension) { - switch ($extension) { - case 'jpg': - case 'jpeg': - case 'gif': - case 'png': - case 'webp': - case 'avif': - return true; - break; - default: - return false; - } - } - - return false; - } - - /** - * Generate a random encrypted password. - * - * @author Wes Hulette - * - * @since 5.0.0 - * - * @return string - */ - public static function generateEncyrptedPassword(): string - { - return bcrypt(self::generateUnencryptedPassword()); - } /** * Get a random unencrypted password. diff --git a/app/Helpers/IconHelper.php b/app/Helpers/IconHelper.php new file mode 100644 index 000000000..b56871f83 --- /dev/null +++ b/app/Helpers/IconHelper.php @@ -0,0 +1,190 @@ +download($filename); } } + + + /** + * This determines the file types that should be allowed inline and checks their fileinfo extension + * to determine that they are safe to display inline. + * + * @author [ + * @since v7.0.14 + * @param $file_with_path + * @return bool + */ + public static function allowSafeInline($file_with_path) { + + $allowed_inline = [ + 'pdf', + 'svg', + 'jpg', + 'gif', + 'svg', + 'avif', + 'webp', + 'png', + ]; + + + // The file exists and is allowed to be displayed inline + if (Storage::exists($file_with_path) && (in_array(pathinfo($file_with_path, PATHINFO_EXTENSION), $allowed_inline))) { + return true; + } + return false; + + } + + /** + * Decide whether to show the file inline or download it. + */ + public static function showOrDownloadFile($file, $filename) { + + $headers = []; + + if (request('inline') == 'true') { + + $headers = [ + 'Content-Disposition' => 'inline', + ]; + + // This is NOT allowed as inline - force it to be displayed as text in the browser + if (self::allowSafeInline($file) != true) { + $headers = array_merge($headers, ['Content-Type' => 'text/plain']); + } + } + + // Everything else seems okay, but the file doesn't exist on the server. + if (Storage::missing($file)) { + throw new FileNotFoundException(); + } + + return Storage::download($file, $filename, $headers); + + } } diff --git a/app/Http/Controllers/Accessories/AccessoriesController.php b/app/Http/Controllers/Accessories/AccessoriesController.php index 4fd5a4c54..8c66c9a3b 100755 --- a/app/Http/Controllers/Accessories/AccessoriesController.php +++ b/app/Http/Controllers/Accessories/AccessoriesController.php @@ -73,7 +73,7 @@ class AccessoriesController extends Controller $accessory->purchase_date = request('purchase_date'); $accessory->purchase_cost = request('purchase_cost'); $accessory->qty = request('qty'); - $accessory->user_id = auth()->id(); + $accessory->created_by = auth()->id(); $accessory->supplier_id = request('supplier_id'); $accessory->notes = request('notes'); diff --git a/app/Http/Controllers/Accessories/AccessoriesFilesController.php b/app/Http/Controllers/Accessories/AccessoriesFilesController.php index b63c202d3..ebc1e4b8e 100644 --- a/app/Http/Controllers/Accessories/AccessoriesFilesController.php +++ b/app/Http/Controllers/Accessories/AccessoriesFilesController.php @@ -106,50 +106,29 @@ class AccessoriesFilesController extends Controller * @param int $accessoryId * @param int $fileId */ - public function show($accessoryId = null, $fileId = null, $download = true) : View | RedirectResponse | Response | BinaryFileResponse | StreamedResponse + public function show($accessoryId = null, $fileId = null) : View | RedirectResponse | Response | BinaryFileResponse | StreamedResponse { - Log::debug('Private filesystem is: '.config('filesystems.default')); - $accessory = Accessory::find($accessoryId); - - // the accessory is valid - if (isset($accessory->id)) { + if ($accessory = Accessory::find($accessoryId)) { $this->authorize('view', $accessory); $this->authorize('accessories.files', $accessory); - if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $accessory->id)->find($fileId)) { - return redirect()->route('accessories.index')->with('error', trans('admin/users/message.log_record_not_found')); - } + if ($log = Actionlog::whereNotNull('filename')->where('item_id', $accessory->id)->find($fileId)) { + $file = 'private_uploads/accessories/'.$log->filename; - $file = 'private_uploads/accessories/'.$log->filename; - - if (Storage::missing($file)) { - Log::debug('FILE DOES NOT EXISTS for '.$file); - Log::debug('URL should be '.Storage::url($file)); - - return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) - ->header('Content-Type', 'text/plain'); - } else { - - // Display the file inline - if (request('inline') == 'true') { - $headers = [ - 'Content-Disposition' => 'inline', - ]; - return Storage::download($file, $log->filename, $headers); - } - - - // We have to override the URL stuff here, since local defaults in Laravel's Flysystem - // won't work, as they're not accessible via the web - if (config('filesystems.default') == 'local') { // TODO - is there any way to fix this at the StorageHelper layer? - return StorageHelper::downloader($file); + try { + return StorageHelper::showOrDownloadFile($file, $log->filename); + } catch (\Exception $e) { + return redirect()->route('accessories.show', ['accessory' => $accessory])->with('error', trans('general.file_not_found')); } } + + return redirect()->route('accessories.show', ['accessory' => $accessory])->with('error', trans('general.log_record_not_found')); + } - return redirect()->route('accessories.index')->with('error', trans('general.file_does_not_exist', ['id' => $fileId])); + return redirect()->route('accessories.index')->with('error', trans('general.file_not_found')); } } diff --git a/app/Http/Controllers/Accessories/AccessoryCheckoutController.php b/app/Http/Controllers/Accessories/AccessoryCheckoutController.php index 03fb6ac25..2417f1656 100644 --- a/app/Http/Controllers/Accessories/AccessoryCheckoutController.php +++ b/app/Http/Controllers/Accessories/AccessoryCheckoutController.php @@ -78,7 +78,7 @@ class AccessoryCheckoutController extends Controller AccessoryCheckout::create([ 'accessory_id' => $accessory->id, 'created_at' => Carbon::now(), - 'user_id' => Auth::id(), + 'created_by' => auth()->id(), 'assigned_to' => $target->id, 'assigned_type' => $target::class, 'note' => $request->input('note'), diff --git a/app/Http/Controllers/Account/AcceptanceController.php b/app/Http/Controllers/Account/AcceptanceController.php index 6d84861fb..278d7e208 100644 --- a/app/Http/Controllers/Account/AcceptanceController.php +++ b/app/Http/Controllers/Account/AcceptanceController.php @@ -237,7 +237,11 @@ class AcceptanceController extends Controller } $acceptance->accept($sig_filename, $item->getEula(), $pdf_filename, $request->input('note')); - $acceptance->notify(new AcceptanceAssetAcceptedNotification($data)); + try { + $acceptance->notify(new AcceptanceAssetAcceptedNotification($data)); + } catch (\Exception $e) { + Log::warning($e); + } event(new CheckoutAccepted($acceptance)); $return_msg = trans('admin/users/message.accepted'); @@ -334,4 +338,5 @@ class AcceptanceController extends Controller return redirect()->to('account/accept')->with('success', $return_msg); } + } diff --git a/app/Http/Controllers/ActionlogController.php b/app/Http/Controllers/ActionlogController.php index f143c4b73..7f86bff96 100644 --- a/app/Http/Controllers/ActionlogController.php +++ b/app/Http/Controllers/ActionlogController.php @@ -37,10 +37,18 @@ class ActionlogController extends Controller } } - public function getStoredEula($filename) : Response | BinaryFileResponse + public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse { $this->authorize('view', \App\Models\Asset::class); $file = config('app.private_uploads').'/eula-pdfs/'.$filename; - return response()->download($file); + + if (Storage::exists($file)) { + return response()->download($file); + } + + return redirect()->back()->with('error', trans('general.file_does_not_exist')); + + + } } diff --git a/app/Http/Controllers/Api/AccessoriesController.php b/app/Http/Controllers/Api/AccessoriesController.php index b1506e4f4..d1ef72bcc 100644 --- a/app/Http/Controllers/Api/AccessoriesController.php +++ b/app/Http/Controllers/Api/AccessoriesController.php @@ -56,8 +56,9 @@ class AccessoriesController extends Controller ]; - $accessories = Accessory::select('accessories.*')->with('category', 'company', 'manufacturer', 'checkouts', 'location', 'supplier') - ->withCount('checkouts as checkouts_count'); + $accessories = Accessory::select('accessories.*') + ->with('category', 'company', 'manufacturer', 'checkouts', 'location', 'supplier', 'adminuser') + ->withCount('checkouts as checkouts_count'); if ($request->filled('search')) { $accessories = $accessories->TextSearch($request->input('search')); @@ -110,7 +111,10 @@ class AccessoriesController extends Controller break; case 'supplier': $accessories = $accessories->OrderSupplier($order); - break; + break; + case 'created_by': + $accessories = $accessories->OrderByCreatedByName($order); + break; default: $accessories = $accessories->orderBy($column_sort, $order); break; @@ -133,7 +137,6 @@ class AccessoriesController extends Controller */ public function store(StoreAccessoryRequest $request) { - $this->authorize('create', Accessory::class); $accessory = new Accessory; $accessory->fill($request->all()); $accessory = $request->handleImages($accessory); @@ -193,9 +196,6 @@ class AccessoriesController extends Controller $this->authorize('view', Accessory::class); $accessory = Accessory::with('lastCheckout')->findOrFail($id); - if (! Company::isCurrentUserHasAccess($accessory)) { - return ['total' => 0, 'rows' => []]; - } $offset = request('offset', 0); $limit = request('limit', 50); @@ -287,7 +287,7 @@ class AccessoriesController extends Controller AccessoryCheckout::create([ 'accessory_id' => $accessory->id, 'created_at' => Carbon::now(), - 'user_id' => Auth::id(), + 'created_by' => auth()->id(), 'assigned_to' => $target->id, 'assigned_type' => $target::class, 'note' => $request->input('note'), @@ -321,7 +321,7 @@ class AccessoriesController extends Controller $accessory = Accessory::find($accessory_checkout->accessory_id); $this->authorize('checkin', $accessory); - $logaction = $accessory->logCheckin(User::find($accessory_checkout->assigned_to), $request->input('note')); + $accessory->logCheckin(User::find($accessory_checkout->assigned_to), $request->input('note')); // Was the accessory updated? if ($accessory_checkout->delete()) { @@ -329,14 +329,6 @@ class AccessoriesController extends Controller $user = User::find($accessory_checkout->assigned_to); } - $data['log_id'] = $logaction->id; - $data['first_name'] = $user->first_name; - $data['last_name'] = $user->last_name; - $data['item_name'] = $accessory->name; - $data['checkin_date'] = $logaction->created_at; - $data['item_tag'] = ''; - $data['note'] = $logaction->note; - return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/accessories/message.checkin.success'))); } diff --git a/app/Http/Controllers/Api/AssetMaintenancesController.php b/app/Http/Controllers/Api/AssetMaintenancesController.php index ac247a887..3e02a5619 100644 --- a/app/Http/Controllers/Api/AssetMaintenancesController.php +++ b/app/Http/Controllers/Api/AssetMaintenancesController.php @@ -34,7 +34,7 @@ class AssetMaintenancesController extends Controller $this->authorize('view', Asset::class); $maintenances = AssetMaintenance::select('asset_maintenances.*') - ->with('asset', 'asset.model', 'asset.location', 'asset.defaultLoc', 'supplier', 'asset.company', 'asset.assetstatus', 'admin'); + ->with('asset', 'asset.model', 'asset.location', 'asset.defaultLoc', 'supplier', 'asset.company', 'asset.assetstatus', 'adminuser'); if ($request->filled('search')) { $maintenances = $maintenances->TextSearch($request->input('search')); @@ -48,6 +48,10 @@ class AssetMaintenancesController extends Controller $maintenances->where('asset_maintenances.supplier_id', '=', $request->input('supplier_id')); } + if ($request->filled('created_by')) { + $maintenances->where('asset_maintenances.created_by', '=', $request->input('created_by')); + } + if ($request->filled('asset_maintenance_type')) { $maintenances->where('asset_maintenance_type', '=', $request->input('asset_maintenance_type')); } @@ -69,7 +73,7 @@ class AssetMaintenancesController extends Controller 'asset_tag', 'asset_name', 'serial', - 'user_id', + 'created_by', 'supplier', 'is_warranty', 'status_label', @@ -79,8 +83,8 @@ class AssetMaintenancesController extends Controller $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at'; switch ($sort) { - case 'user_id': - $maintenances = $maintenances->OrderAdmin($order); + case 'created_by': + $maintenances = $maintenances->OrderByCreatedBy($order); break; case 'supplier': $maintenances = $maintenances->OrderBySupplier($order); @@ -124,7 +128,7 @@ class AssetMaintenancesController extends Controller // create a new model instance $maintenance = new AssetMaintenance(); $maintenance->fill($request->all()); - $maintenance->user_id = Auth::id(); + $maintenance->created_by = auth()->id(); // Was the asset maintenance created? if ($maintenance->save()) { @@ -186,11 +190,8 @@ class AssetMaintenancesController extends Controller { $this->authorize('update', Asset::class); // Check if the asset maintenance exists - $assetMaintenance = AssetMaintenance::findOrFail($assetMaintenanceId); - if (! Company::isCurrentUserHasAccess($assetMaintenance->asset)) { - return response()->json(Helper::formatStandardApiResponse('error', null, 'You cannot delete a maintenance for that asset')); - } + $assetMaintenance = AssetMaintenance::findOrFail($assetMaintenanceId); $assetMaintenance->delete(); diff --git a/app/Http/Controllers/Api/AssetModelFilesController.php b/app/Http/Controllers/Api/AssetModelFilesController.php new file mode 100644 index 000000000..90d283f72 --- /dev/null +++ b/app/Http/Controllers/Api/AssetModelFilesController.php @@ -0,0 +1,200 @@ + + * + * @version v1.0 + * @author [T. Scarsbrook] [] + */ +class AssetModelFilesController extends Controller +{ + /** + * Accepts a POST to upload a file to the server. + * + * @param \App\Http\Requests\UploadFileRequest $request + * @param int $assetModelId + * @since [v7.0.12] + * @author [r-xyz] + */ + public function store(UploadFileRequest $request, $assetModelId = null) : JsonResponse + { + // Start by checking if the asset being acted upon exists + if (! $assetModel = AssetModel::find($assetModelId)) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404); + } + + // Make sure we are allowed to update this asset + $this->authorize('update', $assetModel); + + if ($request->hasFile('file')) { + // If the file storage directory doesn't exist; create it + if (! Storage::exists('private_uploads/assetmodels')) { + Storage::makeDirectory('private_uploads/assetmodels', 775); + } + + // Loop over the attached files and add them to the asset + foreach ($request->file('file') as $file) { + $file_name = $request->handleFile('private_uploads/assetmodels/','model-'.$assetModel->id, $file); + + $assetModel->logUpload($file_name, e($request->get('notes'))); + } + + // All done - report success + return response()->json(Helper::formatStandardApiResponse('success', $assetModel, trans('admin/models/message.upload.success'))); + } + + // We only reach here if no files were included in the POST, so tell the user this + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.upload.nofiles')), 500); + } + + /** + * List the files for an asset. + * + * @param int $assetModelId + * @since [v7.0.12] + * @author [r-xyz] + */ + public function list($assetModelId = null) : JsonResponse + { + // Start by checking if the asset being acted upon exists + if (! $assetModel = AssetModel::find($assetModelId)) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404); + } + + // the asset is valid + if (isset($assetModel->id)) { + $this->authorize('view', $assetModel); + + // Check that there are some uploads on this asset that can be listed + if ($assetModel->uploads->count() > 0) { + $files = array(); + foreach ($assetModel->uploads as $upload) { + array_push($files, $upload); + } + // Give the list of files back to the user + return response()->json(Helper::formatStandardApiResponse('success', $files, trans('admin/models/message.upload.success'))); + } + + // There are no files. + return response()->json(Helper::formatStandardApiResponse('success', array(), trans('admin/models/message.upload.success'))); + } + + // Send back an error message + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.download.error')), 500); + } + + /** + * Check for permissions and display the file. + * + * @param int $assetModelId + * @param int $fileId + * @return \Illuminate\Http\JsonResponse + * @throws \Illuminate\Auth\Access\AuthorizationException + * @since [v7.0.12] + * @author [r-xyz] + */ + public function show($assetModelId = null, $fileId = null) : JsonResponse | StreamedResponse | Storage | StorageHelper | BinaryFileResponse + { + // Start by checking if the asset being acted upon exists + if (! $assetModel = AssetModel::find($assetModelId)) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404); + } + + // the asset is valid + if (isset($assetModel->id)) { + $this->authorize('view', $assetModel); + + // Check that the file being requested exists for the asset + if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $assetModel->id)->find($fileId)) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.download.no_match', ['id' => $fileId])), 404); + } + + // Form the full filename with path + $file = 'private_uploads/assetmodels/'.$log->filename; + Log::debug('Checking for '.$file); + + if ($log->action_type == 'audit') { + $file = 'private_uploads/audits/'.$log->filename; + } + + // Check the file actually exists on the filesystem + if (! Storage::exists($file)) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.download.does_not_exist', ['id' => $fileId])), 404); + } + + if (request('inline') == 'true') { + + $headers = [ + 'Content-Disposition' => 'inline', + ]; + + return Storage::download($file, $log->filename, $headers); + } + + return StorageHelper::downloader($file); + } + + // Send back an error message + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.download.error', ['id' => $fileId])), 500); + } + + /** + * Delete the associated file + * + * @param int $assetModelId + * @param int $fileId + * @since [v7.0.12] + * @author [r-xyz] + */ + public function destroy($assetModelId = null, $fileId = null) : JsonResponse + { + // Start by checking if the asset being acted upon exists + if (! $assetModel = AssetModel::find($assetModelId)) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404); + } + + $rel_path = 'private_uploads/assetmodels'; + + // the asset is valid + if (isset($assetModel->id)) { + $this->authorize('update', $assetModel); + + // Check for the file + $log = Actionlog::find($fileId); + if ($log) { + // Check the file actually exists, and delete it + if (Storage::exists($rel_path.'/'.$log->filename)) { + Storage::delete($rel_path.'/'.$log->filename); + } + // Delete the record of the file + $log->delete(); + + // All deleting done - notify the user of success + return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/models/message.deletefile.success')), 200); + } + + // The file doesn't seem to really exist, so report an error + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.deletefile.error')), 500); + } + + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.deletefile.error')), 500); + } +} diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index 835f4d22e..e1ae0c12d 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -48,6 +48,8 @@ class AssetModelsController extends Controller 'assets_count', 'category', 'fieldset', + 'deleted_at', + 'updated_at', ]; $assetmodels = AssetModel::select([ @@ -67,7 +69,7 @@ class AssetModelsController extends Controller 'models.deleted_at', 'models.updated_at', ]) - ->with('category', 'depreciation', 'manufacturer', 'fieldset.fields.defaultValues') + ->with('category', 'depreciation', 'manufacturer', 'fieldset.fields.defaultValues','adminuser') ->withCount('assets as assets_count'); if ($request->input('status')=='deleted') { @@ -78,6 +80,10 @@ class AssetModelsController extends Controller $assetmodels = $assetmodels->where('models.category_id', '=', $request->input('category_id')); } + if ($request->filled('depreciation_id')) { + $assetmodels = $assetmodels->where('models.depreciation_id', '=', $request->input('depreciation_id')); + } + if ($request->filled('search')) { $assetmodels->TextSearch($request->input('search')); } diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 855bc5126..d4a103be3 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -56,6 +56,11 @@ class AssetsController extends Controller public function index(Request $request, $action = null, $upcoming_status = null) : JsonResponse | array { + + // This handles the legacy audit endpoints :( + if ($action == 'audit') { + $action = 'audits'; + } $filter_non_deprecable_assets = false; /** @@ -121,7 +126,7 @@ class AssetsController extends Controller } $assets = Asset::select('assets.*') - ->with('location', 'assetstatus', 'company', 'defaultLoc','assignedTo', + ->with('location', 'assetstatus', 'company', 'defaultLoc','assignedTo', 'adminuser','model.depreciation', 'model.category', 'model.manufacturer', 'model.fieldset','supplier'); //it might be tempting to add 'assetlog' here, but don't. It blows up update-heavy users. @@ -154,8 +159,8 @@ class AssetsController extends Controller * Handle due and overdue audits and checkin dates */ switch ($action) { - case 'audits': - + // Audit (singular) is left over from earlier legacy APIs + case 'audits' : switch ($upcoming_status) { case 'due': $assets->DueForAudit($settings); @@ -371,8 +376,33 @@ class AssetsController extends Controller case 'assigned_to': $assets->OrderAssigned($order); break; + case 'created_by': + $assets->OrderByCreatedByName($order); + break; default: - $assets->orderBy($column_sort, $order); + $numeric_sort = false; + + // Search through the custom fields array to see if we're sorting on a custom field + if (array_search($column_sort, $all_custom_fields->pluck('db_column')->toArray()) !== false) { + + // Check to see if this is a numeric field type + foreach ($all_custom_fields as $field) { + if (($field->db_column == $sort_override) && ($field->format == 'NUMERIC')) { + $numeric_sort = true; + break; + } + } + + // This may not work for all databases, but it works for MySQL + if ($numeric_sort) { + $assets->orderByRaw(DB::getTablePrefix() . 'assets.' . $sort_override . ' * 1 ' . $order); + } else { + $assets->orderBy($sort_override, $order); + } + + } else { + $assets->orderBy($column_sort, $order); + } break; } @@ -568,7 +598,7 @@ class AssetsController extends Controller $asset->model()->associate(AssetModel::find((int) $request->get('model_id'))); $asset->fill($request->validated()); - $asset->user_id = Auth::id(); + $asset->created_by = auth()->id(); /** * this is here just legacy reasons. Api\AssetController @@ -602,7 +632,7 @@ class AssetsController extends Controller if ($field->field_encrypted == '1') { Log::debug('This model field is encrypted in this fieldset.'); - if (Gate::allows('admin')) { + if (Gate::allows('assets.view.encrypted_custom_fields')) { // If input value is null, use custom field's default value if (($field_val == null) && ($request->has('model_id') != '')) { @@ -695,7 +725,7 @@ class AssetsController extends Controller } } if ($field->field_encrypted == '1') { - if (Gate::allows('admin')) { + if (Gate::allows('assets.view.encrypted_custom_fields')) { $field_val = Crypt::encrypt($field_val); } else { $problems_updating_encrypted_custom_fields = true; @@ -750,9 +780,16 @@ class AssetsController extends Controller if ($asset = Asset::find($id)) { $this->authorize('delete', $asset); - DB::table('assets') - ->where('id', $asset->id) - ->update(['assigned_to' => null]); + if ($asset->assignedTo) { + + $target = $asset->assignedTo; + $checkin_at = date('Y-m-d H:i:s'); + $originalValues = $asset->getRawOriginal(); + event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on delete', $checkin_at, $originalValues)); + DB::table('assets') + ->where('id', $asset->id) + ->update(['assigned_to' => null]); + } $asset->delete(); diff --git a/app/Http/Controllers/Api/CategoriesController.php b/app/Http/Controllers/Api/CategoriesController.php index 6e9866f90..e772bec4d 100644 --- a/app/Http/Controllers/Api/CategoriesController.php +++ b/app/Http/Controllers/Api/CategoriesController.php @@ -43,6 +43,7 @@ class CategoriesController extends Controller $categories = Category::select([ 'id', + 'created_by', 'created_at', 'updated_at', 'name', 'category_type', @@ -50,8 +51,10 @@ class CategoriesController extends Controller 'eula_text', 'require_acceptance', 'checkin_email', - 'image' - ])->withCount('accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count'); + 'image', + ]) + ->with('adminuser') + ->withCount('accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count'); /* @@ -91,13 +94,33 @@ class CategoriesController extends Controller $categories->where('checkin_email', '=', $request->input('checkin_email')); } + if ($request->filled('created_by')) { + $categories->where('created_by', '=', $request->input('created_by')); + } + + if ($request->filled('created_at')) { + $categories->where('created_at', '=', $request->input('created_at')); + } + + if ($request->filled('updated_at')) { + $categories->where('updated_at', '=', $request->input('updated_at')); + } + // Make sure the offset and limit are actually integers and do not exceed system limits $offset = ($request->input('offset') > $categories->count()) ? $categories->count() : app('api_offset_value'); $limit = app('api_limit_value'); - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'assets_count'; - $categories->orderBy($sort, $order); + $sort_override = $request->input('sort'); + $column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'assets_count'; + + switch ($sort_override) { + case 'created_by': + $categories = $categories->OrderByCreatedBy($order); + break; + default: + $categories = $categories->orderBy($column_sort, $order); + break; + } $total = $categories->count(); $categories = $categories->skip($offset)->take($limit)->get(); diff --git a/app/Http/Controllers/Api/CompaniesController.php b/app/Http/Controllers/Api/CompaniesController.php index 0d78df9ac..5ba342db3 100644 --- a/app/Http/Controllers/Api/CompaniesController.php +++ b/app/Http/Controllers/Api/CompaniesController.php @@ -42,7 +42,7 @@ class CompaniesController extends Controller $companies = Company::withCount(['assets as assets_count' => function ($query) { $query->AssetsForShow(); - }])->withCount('licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'users as users_count'); + }])->withCount('assets as assets_count', 'licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'users as users_count'); if ($request->filled('search')) { $companies->TextSearch($request->input('search')); @@ -56,17 +56,29 @@ class CompaniesController extends Controller $companies->where('email', '=', $request->input('email')); } + if ($request->filled('created_by')) { + $companies->where('created_by', '=', $request->input('created_by')); + } + // Make sure the offset and limit are actually integers and do not exceed system limits $offset = ($request->input('offset') > $companies->count()) ? $companies->count() : app('api_offset_value'); $limit = app('api_limit_value'); - - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; - $companies->orderBy($sort, $order); + $sort_override = $request->input('sort'); + $column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at'; + + switch ($sort_override) { + case 'created_by': + $companies = $companies->OrderByCreatedBy($order); + break; + default: + $companies = $companies->orderBy($column_sort, $order); + break; + } $total = $companies->count(); + $companies = $companies->skip($offset)->take($limit)->get(); return (new CompaniesTransformer)->transformCompanies($companies, $total); diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.php index 69bd82848..8ee5b80e8 100644 --- a/app/Http/Controllers/Api/ComponentsController.php +++ b/app/Http/Controllers/Api/ComponentsController.php @@ -38,6 +38,7 @@ class ComponentsController extends Controller 'name', 'min_amt', 'order_number', + 'model_number', 'serial', 'purchase_date', 'purchase_cost', @@ -47,7 +48,7 @@ class ComponentsController extends Controller ]; $components = Component::select('components.*') - ->with('company', 'location', 'category', 'assets', 'supplier'); + ->with('company', 'location', 'category', 'assets', 'supplier', 'adminuser', 'manufacturer'); if ($request->filled('search')) { $components = $components->TextSearch($request->input('search')); @@ -69,6 +70,14 @@ class ComponentsController extends Controller $components->where('supplier_id', '=', $request->input('supplier_id')); } + if ($request->filled('manufacturer_id')) { + $components->where('manufacturer_id', '=', $request->input('manufacturer_id')); + } + + if ($request->filled('model_number')) { + $components->where('model_number', '=', $request->input('model_number')); + } + if ($request->filled('location_id')) { $components->where('location_id', '=', $request->input('location_id')); } @@ -98,6 +107,12 @@ class ComponentsController extends Controller case 'supplier': $components = $components->OrderSupplier($order); break; + case 'manufacturer': + $components = $components->OrderManufacturer($order); + break; + case 'created_by': + $components = $components->OrderByCreatedBy($order); + break; default: $components = $components->orderBy($column_sort, $order); break; @@ -270,7 +285,7 @@ class ComponentsController extends Controller 'component_id' => $component->id, 'created_at' => Carbon::now(), 'assigned_qty' => $request->get('assigned_qty', 1), - 'user_id' => auth()->id(), + 'created_by' => auth()->id(), 'asset_id' => $request->get('assigned_to'), 'note' => $request->get('note'), ]); diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index 1665b7f4f..7ff676c7b 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -86,9 +86,15 @@ class ConsumablesController extends Controller case 'company': $consumables = $consumables->OrderCompany($order); break; + case 'remaining': + $consumables = $consumables->OrderRemaining($order); + break; case 'supplier': $consumables = $consumables->OrderSupplier($order); break; + case 'created_by': + $consumables = $consumables->OrderByCreatedBy($order); + break; default: // This array is what determines which fields should be allowed to be sorted on ON the table itself. // These must match a column on the consumables table directly. @@ -207,7 +213,7 @@ class ConsumablesController extends Controller $consumable = Consumable::with(['consumableAssignments'=> function ($query) { $query->orderBy($query->getModel()->getTable().'.created_at', 'DESC'); }, - 'consumableAssignments.admin'=> function ($query) { + 'consumableAssignments.adminuser'=> function ($query) { }, 'consumableAssignments.user'=> function ($query) { }, @@ -225,7 +231,8 @@ class ConsumablesController extends Controller 'name' => ($consumable_assignment->user) ? $consumable_assignment->user->present()->nameUrl() : 'Deleted User', 'created_at' => Helper::getFormattedDateObject($consumable_assignment->created_at, 'datetime'), 'note' => ($consumable_assignment->note) ? e($consumable_assignment->note) : null, - 'admin' => ($consumable_assignment->admin) ? $consumable_assignment->admin->present()->nameUrl() : null, + 'admin' => ($consumable_assignment->adminuser) ? $consumable_assignment->adminuser->present()->nameUrl() : null, // legacy, so we don't change the shape of the response + 'created_by' => ($consumable_assignment->adminuser) ? $consumable_assignment->adminuser->present()->nameUrl() : null, ]; } @@ -251,6 +258,8 @@ class ConsumablesController extends Controller $this->authorize('checkout', $consumable); + $consumable->checkout_qty = $request->input('checkout_qty', 1); + // Make sure there is at least one available to checkout if ($consumable->numRemaining() <= 0) { return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/consumables/message.checkout.unavailable'))); @@ -261,6 +270,12 @@ class ConsumablesController extends Controller return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.invalid_item_category_single', ['type' => trans('general.consumable')]))); } + // Make sure there is at least one available to checkout + if ($consumable->numRemaining() <= 0 || $consumable->checkout_qty > $consumable->numRemaining()) { + return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/consumables/message.checkout.unavailable', ['requested' => $consumable->checkout_qty, 'remaining' => $consumable->numRemaining() ]))); + } + + // Check if the user exists - @TODO: this should probably be handled via validation, not here?? if (!$user = User::find($request->input('assigned_to'))) { @@ -271,14 +286,17 @@ class ConsumablesController extends Controller // Update the consumable data $consumable->assigned_to = $request->input('assigned_to'); - $consumable->users()->attach($consumable->id, + for ($i = 0; $i < $consumable->checkout_qty; $i++) { + $consumable->users()->attach($consumable->id, [ 'consumable_id' => $consumable->id, - 'user_id' => $user->id, + 'created_by' => $user->id, 'assigned_to' => $request->input('assigned_to'), 'note' => $request->input('note'), ] ); + } + event(new CheckoutableCheckedOut($consumable, $user, auth()->user(), $request->input('note'))); diff --git a/app/Http/Controllers/Api/DepartmentsController.php b/app/Http/Controllers/Api/DepartmentsController.php index eabc79ec2..e337360cd 100644 --- a/app/Http/Controllers/Api/DepartmentsController.php +++ b/app/Http/Controllers/Api/DepartmentsController.php @@ -97,7 +97,7 @@ class DepartmentsController extends Controller $department->fill($request->all()); $department = $request->handleImages($department); - $department->user_id = auth()->id(); + $department->created_by = auth()->id(); $department->manager_id = ($request->filled('manager_id') ? $request->input('manager_id') : null); if ($department->save()) { diff --git a/app/Http/Controllers/Api/DepreciationsController.php b/app/Http/Controllers/Api/DepreciationsController.php index 0209eae39..254a72c98 100644 --- a/app/Http/Controllers/Api/DepreciationsController.php +++ b/app/Http/Controllers/Api/DepreciationsController.php @@ -20,9 +20,23 @@ class DepreciationsController extends Controller public function index(Request $request) : JsonResponse | array { $this->authorize('view', Depreciation::class); - $allowed_columns = ['id','name','months','depreciation_min', 'depreciation_type','created_at']; + $allowed_columns = [ + 'id', + 'name', + 'months', + 'depreciation_min', + 'depreciation_type', + 'created_at', + 'assets_count', + 'models_count', + 'licenses_count', + ]; - $depreciations = Depreciation::select('id','name','months','depreciation_min','depreciation_type','user_id','created_at','updated_at'); + $depreciations = Depreciation::select('id','name','months','depreciation_min','depreciation_type','created_at','updated_at', 'created_by') + ->with('adminuser') + ->withCount('assets as assets_count') + ->withCount('models as models_count') + ->withCount('licenses as licenses_count'); if ($request->filled('search')) { $depreciations = $depreciations->TextSearch($request->input('search')); @@ -31,10 +45,18 @@ class DepreciationsController extends Controller // Make sure the offset and limit are actually integers and do not exceed system limits $offset = ($request->input('offset') > $depreciations->count()) ? $depreciations->count() : app('api_offset_value'); $limit = app('api_limit_value'); - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; - $depreciations->orderBy($sort, $order); + $sort_override = $request->input('sort'); + $column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at'; + + switch ($sort_override) { + case 'created_by': + $depreciations = $depreciations->OrderByCreatedBy($order); + break; + default: + $depreciations = $depreciations->orderBy($column_sort, $order); + break; + } $total = $depreciations->count(); $depreciations = $depreciations->skip($offset)->take($limit)->get(); diff --git a/app/Http/Controllers/Api/GroupsController.php b/app/Http/Controllers/Api/GroupsController.php index 878650c71..81217ce8d 100644 --- a/app/Http/Controllers/Api/GroupsController.php +++ b/app/Http/Controllers/Api/GroupsController.php @@ -23,9 +23,8 @@ class GroupsController extends Controller $this->authorize('superadmin'); $this->authorize('view', Group::class); - $allowed_columns = ['id', 'name', 'created_at', 'users_count']; - $groups = Group::select('id', 'name', 'permissions', 'created_at', 'updated_at', 'created_by')->with('admin')->withCount('users as users_count'); + $groups = Group::select('id', 'name', 'permissions', 'created_at', 'updated_at', 'created_by')->with('adminuser')->withCount('users as users_count'); if ($request->filled('search')) { $groups = $groups->TextSearch($request->input('search')); @@ -35,13 +34,29 @@ class GroupsController extends Controller $groups->where('name', '=', $request->input('name')); } - // Make sure the offset and limit are actually integers and do not exceed system limits + $offset = ($request->input('offset') > $groups->count()) ? $groups->count() : app('api_offset_value'); $limit = app('api_limit_value'); - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; - $groups->orderBy($sort, $order); + + switch ($request->input('sort')) { + case 'created_by': + $groups = $groups->OrderByCreatedBy($order); + break; + default: + // This array is what determines which fields should be allowed to be sorted on ON the table itself. + // These must match a column on the consumables table directly. + $allowed_columns = [ + 'id', + 'name', + 'created_at', + 'users_count', + ]; + + $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; + $groups = $groups->orderBy($sort, $order); + break; + } $total = $groups->count(); $groups = $groups->skip($offset)->take($limit)->get(); diff --git a/app/Http/Controllers/Api/LicenseSeatsController.php b/app/Http/Controllers/Api/LicenseSeatsController.php index a9630aa29..2ed709732 100644 --- a/app/Http/Controllers/Api/LicenseSeatsController.php +++ b/app/Http/Controllers/Api/LicenseSeatsController.php @@ -107,7 +107,7 @@ class LicenseSeatsController extends Controller // attempt to update the license seat $licenseSeat->fill($request->all()); - $licenseSeat->user_id = auth()->id(); + $licenseSeat->created_by = auth()->id(); // check if this update is a checkin operation // 1. are relevant fields touched at all? diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index 71ad01b59..db39f987a 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -27,7 +27,7 @@ class LicensesController extends Controller $licenses = License::with('company', 'manufacturer', 'supplier','category', 'adminuser')->withCount('freeSeats as free_seats_count'); if ($request->filled('company_id')) { - $licenses->where('company_id', '=', $request->input('company_id')); + $licenses->where('licenses.company_id', '=', $request->input('company_id')); } if ($request->filled('name')) { @@ -70,8 +70,8 @@ class LicensesController extends Controller $licenses->where('depreciation_id', '=', $request->input('depreciation_id')); } - if ($request->filled('user_id')) { - $licenses->where('user_id', '=', $request->input('user_id')); + if ($request->filled('created_by')) { + $licenses->where('created_by', '=', $request->input('created_by')); } if (($request->filled('maintained')) && ($request->input('maintained')=='true')) { @@ -117,7 +117,7 @@ class LicensesController extends Controller $licenses = $licenses->leftJoin('companies', 'licenses.company_id', '=', 'companies.id')->orderBy('companies.name', $order); break; case 'created_by': - $licenses = $licenses->OrderCreatedBy($order); + $licenses = $licenses->OrderByCreatedBy($order); break; default: $allowed_columns = @@ -182,7 +182,7 @@ class LicensesController extends Controller public function show($id) : JsonResponse | array { $this->authorize('view', License::class); - $license = License::withCount('freeSeats')->findOrFail($id); + $license = License::withCount('freeSeats as free_seats_count')->findOrFail($id); $license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset'); return (new LicensesTransformer)->transformLicense($license); @@ -220,7 +220,6 @@ class LicensesController extends Controller */ public function destroy($id) : JsonResponse { - // $license = License::findOrFail($id); $this->authorize('delete', $license); diff --git a/app/Http/Controllers/Api/ManufacturersController.php b/app/Http/Controllers/Api/ManufacturersController.php index eb89693e5..f716fbbf7 100644 --- a/app/Http/Controllers/Api/ManufacturersController.php +++ b/app/Http/Controllers/Api/ManufacturersController.php @@ -25,11 +25,43 @@ class ManufacturersController extends Controller public function index(Request $request) : JsonResponse | array { $this->authorize('view', Manufacturer::class); - $allowed_columns = ['id', 'name', 'url', 'support_url', 'support_email', 'warranty_lookup_url', 'support_phone', 'created_at', 'updated_at', 'image', 'assets_count', 'consumables_count', 'components_count', 'licenses_count']; + $allowed_columns = [ + 'id', + 'name', + 'url', + 'support_url', + 'support_email', + 'warranty_lookup_url', + 'support_phone', + 'created_at', + 'updated_at', + 'image', + 'assets_count', + 'consumables_count', + 'components_count', + 'licenses_count' + ]; - $manufacturers = Manufacturer::select( - ['id', 'name', 'url', 'support_url', 'warranty_lookup_url', 'support_email', 'support_phone', 'created_at', 'updated_at', 'image', 'deleted_at'] - )->withCount('assets as assets_count')->withCount('licenses as licenses_count')->withCount('consumables as consumables_count')->withCount('accessories as accessories_count'); + $manufacturers = Manufacturer::select([ + 'id', + 'name', + 'url', + 'support_url', + 'warranty_lookup_url', + 'support_email', + 'support_phone', + 'created_by', + 'created_at', + 'updated_at', + 'image', + 'deleted_at', + ]) + ->with('adminuser') + ->withCount('assets as assets_count') + ->withCount('licenses as licenses_count') + ->withCount('consumables as consumables_count') + ->withCount('accessories as accessories_count') + ->withCount('components as components_count'); if ($request->input('deleted') == 'true') { $manufacturers->onlyTrashed(); @@ -66,10 +98,18 @@ class ManufacturersController extends Controller // Make sure the offset and limit are actually integers and do not exceed system limits $offset = ($request->input('offset') > $manufacturers->count()) ? $manufacturers->count() : app('api_offset_value'); $limit = app('api_limit_value'); - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; - $manufacturers->orderBy($sort, $order); + $sort_override = $request->input('sort'); + $column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at'; + + switch ($sort_override) { + case 'created_by': + $manufacturers = $manufacturers->OrderByCreatedBy($order); + break; + default: + $manufacturers = $manufacturers->orderBy($column_sort, $order); + break; + } $total = $manufacturers->count(); $manufacturers = $manufacturers->skip($offset)->take($limit)->get(); @@ -181,7 +221,7 @@ class ManufacturersController extends Controller $logaction->item_type = Manufacturer::class; $logaction->item_id = $manufacturer->id; $logaction->created_at = date('Y-m-d H:i:s'); - $logaction->user_id = auth()->id(); + $logaction->created_by = auth()->id(); $logaction->logaction('restore'); return response()->json(Helper::formatStandardApiResponse('success', trans('admin/manufacturers/message.restore.success')), 200); diff --git a/app/Http/Controllers/Api/PredefinedKitsController.php b/app/Http/Controllers/Api/PredefinedKitsController.php index 26ccb5035..24f132018 100644 --- a/app/Http/Controllers/Api/PredefinedKitsController.php +++ b/app/Http/Controllers/Api/PredefinedKitsController.php @@ -23,9 +23,8 @@ class PredefinedKitsController extends Controller public function index(Request $request) : JsonResponse | array { $this->authorize('view', PredefinedKit::class); - $allowed_columns = ['id', 'name']; - $kits = PredefinedKit::query(); + $kits = PredefinedKit::query()->with('adminuser'); if ($request->filled('search')) { $kits = $kits->TextSearch($request->input('search')); @@ -36,8 +35,25 @@ class PredefinedKitsController extends Controller $limit = app('api_limit_value'); $order = $request->input('order') === 'desc' ? 'desc' : 'asc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'name'; - $kits->orderBy($sort, $order); + + switch ($request->input('sort')) { + case 'created_by': + $kits = $kits->OrderByCreatedBy($order); + break; + default: + // This array is what determines which fields should be allowed to be sorted on ON the table itself. + // These must match a column on the consumables table directly. + $allowed_columns = [ + 'id', + 'name', + 'created_at', + 'updated_at', + ]; + + $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; + $kits = $kits->orderBy($sort, $order); + break; + } $total = $kits->count(); $kits = $kits->skip($offset)->take($limit)->get(); diff --git a/app/Http/Controllers/Api/ReportsController.php b/app/Http/Controllers/Api/ReportsController.php index 931886fb2..63fca39d1 100644 --- a/app/Http/Controllers/Api/ReportsController.php +++ b/app/Http/Controllers/Api/ReportsController.php @@ -20,7 +20,7 @@ class ReportsController extends Controller { $this->authorize('reports.view'); - $actionlogs = Actionlog::with('item', 'user', 'admin', 'target', 'location'); + $actionlogs = Actionlog::with('item', 'user', 'adminuser', 'target', 'location'); if ($request->filled('search')) { $actionlogs = $actionlogs->TextSearch(e($request->input('search'))); @@ -44,21 +44,6 @@ class ReportsController extends Controller }); } - if ($request->filled('action_type')) { - $actionlogs = $actionlogs->where('action_type', '=', $request->input('action_type'))->orderBy('created_at', 'desc'); - } - - if ($request->filled('user_id')) { - $actionlogs = $actionlogs->where('user_id', '=', $request->input('user_id')); - } - - if ($request->filled('action_source')) { - $actionlogs = $actionlogs->where('action_source', '=', $request->input('action_source'))->orderBy('created_at', 'desc'); - } - - if ($request->filled('remote_ip')) { - $actionlogs = $actionlogs->where('remote_ip', '=', $request->input('remote_ip'))->orderBy('created_at', 'desc'); - } if ($request->filled('uploads')) { $actionlogs = $actionlogs->whereNotNull('filename')->orderBy('created_at', 'desc'); @@ -68,13 +53,16 @@ class ReportsController extends Controller 'id', 'created_at', 'target_id', - 'user_id', + 'created_by', 'accept_signature', 'action_type', 'note', 'remote_ip', 'user_agent', + 'target_type', + 'item_type', 'action_source', + 'action_date', ]; @@ -86,8 +74,8 @@ class ReportsController extends Controller $order = ($request->input('order') == 'asc') ? 'asc' : 'desc'; switch ($request->input('sort')) { - case 'admin': - $actionlogs->OrderAdmin($order); + case 'created_by': + $actionlogs->OrderByCreatedBy($order); break; default: $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at'; diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php index ce61d653f..7e4851ff5 100644 --- a/app/Http/Controllers/Api/StatuslabelsController.php +++ b/app/Http/Controllers/Api/StatuslabelsController.php @@ -25,9 +25,17 @@ class StatuslabelsController extends Controller public function index(Request $request) : array { $this->authorize('view', Statuslabel::class); - $allowed_columns = ['id', 'name', 'created_at', 'assets_count', 'color', 'notes', 'default_label']; + $allowed_columns = [ + 'id', + 'name', + 'created_at', + 'assets_count', + 'color', + 'notes', + 'default_label' + ]; - $statuslabels = Statuslabel::withCount('assets as assets_count'); + $statuslabels = Statuslabel::with('adminuser')->withCount('assets as assets_count'); if ($request->filled('search')) { $statuslabels = $statuslabels->TextSearch($request->input('search')); @@ -54,10 +62,18 @@ class StatuslabelsController extends Controller // Make sure the offset and limit are actually integers and do not exceed system limits $offset = ($request->input('offset') > $statuslabels->count()) ? $statuslabels->count() : app('api_offset_value'); $limit = app('api_limit_value'); - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; - $statuslabels->orderBy($sort, $order); + $sort_override = $request->input('sort'); + $column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at'; + + switch ($sort_override) { + case 'created_by': + $statuslabels = $statuslabels->OrderByCreatedBy($order); + break; + default: + $statuslabels = $statuslabels->orderBy($column_sort, $order); + break; + } $total = $statuslabels->count(); $statuslabels = $statuslabels->skip($offset)->take($limit)->get(); @@ -79,7 +95,8 @@ class StatuslabelsController extends Controller $request->except('deployable', 'pending', 'archived'); if (! $request->filled('type')) { - return response()->json(Helper::formatStandardApiResponse('error', null, ['type' => ['Status label type is required.']]), 500); + + return response()->json(Helper::formatStandardApiResponse('error', null, ['type' => ['Status label type is required.']])); } $statuslabel = new Statuslabel; diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 9200f80b1..a9c8c26f1 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -14,6 +14,7 @@ use App\Http\Transformers\UsersTransformer; use App\Models\Actionlog; use App\Models\Asset; use App\Models\Accessory; +use App\Models\Company; use App\Models\Consumable; use App\Models\License; use App\Models\User; @@ -42,13 +43,14 @@ class UsersController extends Controller $users = User::select([ 'users.activated', - 'users.created_by', 'users.address', 'users.avatar', 'users.city', 'users.company_id', 'users.country', + 'users.created_by', 'users.created_at', + 'users.updated_at', 'users.deleted_at', 'users.department_id', 'users.email', @@ -67,7 +69,6 @@ class UsersController extends Controller 'users.state', 'users.two_factor_enrolled', 'users.two_factor_optin', - 'users.updated_at', 'users.username', 'users.zip', 'users.remote', @@ -206,6 +207,10 @@ class UsersController extends Controller $users->where('autoassign_licenses', '=', $request->input('autoassign_licenses')); } + if ($request->filled('locale')) { + $users = $users->where('users.locale', '=', $request->input('locale')); + } + if (($request->filled('deleted')) && ($request->input('deleted') == 'true')) { $users = $users->onlyTrashed(); @@ -251,6 +256,7 @@ class UsersController extends Controller 'groups', 'activated', 'created_at', + 'updated_at', 'two_factor_enrolled', 'two_factor_optin', 'last_login', @@ -276,6 +282,7 @@ class UsersController extends Controller 'end_date', 'autoassign_licenses', 'website', + 'locale', ]; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'first_name'; @@ -365,6 +372,7 @@ class UsersController extends Controller $user = new User; $user->fill($request->all()); + $user->company_id = Company::getIdForCurrentUser($request->input('company_id')); $user->created_by = auth()->id(); if ($request->has('permissions')) { @@ -427,13 +435,10 @@ class UsersController extends Controller * @param \Illuminate\Http\Request $request * @param int $id */ - public function update(SaveUserRequest $request, $id) : JsonResponse + public function update(SaveUserRequest $request, User $user): JsonResponse { $this->authorize('update', User::class); - if ($user = User::find($id)) { - - $this->authorize('update', $user); /** @@ -443,14 +448,16 @@ class UsersController extends Controller * */ - - if ((($id == 1) || ($id == 2)) && (config('app.lock_passwords'))) { + if ((($user->id == 1) || ($user->id == 2)) && (config('app.lock_passwords'))) { return response()->json(Helper::formatStandardApiResponse('error', null, 'Permission denied. You cannot update user information via API on the demo.')); } - $user->fill($request->all()); + if ($request->filled('company_id')) { + $user->company_id = Company::getIdForCurrentUser($request->input('company_id')); + } + if ($user->id == $request->input('manager_id')) { return response()->json(Helper::formatStandardApiResponse('error', null, 'You cannot be your own manager')); } @@ -473,16 +480,13 @@ class UsersController extends Controller $user->permissions = $permissions_array; } - // Update the location of any assets checked out to this user Asset::where('assigned_type', User::class) ->where('assigned_to', $user->id)->update(['location_id' => $request->input('location_id', null)]); - app('App\Http\Requests\ImageUploadRequest')->handleImages($user, 600, 'image', 'avatars', 'avatar'); if ($user->save()) { - // Check if the request has groups passed and has a value, AND that the user us a superuser if (($request->has('groups')) && (auth()->user()->isSuperUser())) { @@ -496,18 +500,10 @@ class UsersController extends Controller // Sync the groups since the user is a superuser and the groups pass validation $user->groups()->sync($request->input('groups')); - - } - return response()->json(Helper::formatStandardApiResponse('success', (new UsersTransformer)->transformUser($user), trans('admin/users/message.success.update'))); } - return response()->json(Helper::formatStandardApiResponse('error', null, $user->getErrors())); - } - - return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/users/message.user_not_found', compact('id')))); - } /** @@ -702,7 +698,7 @@ class UsersController extends Controller $logaction->item_type = User::class; $logaction->item_id = $user->id; $logaction->created_at = date('Y-m-d H:i:s'); - $logaction->user_id = auth()->id(); + $logaction->created_by = auth()->id(); $logaction->logaction('2FA reset'); return response()->json(['message' => trans('admin/settings/general.two_factor_reset_success')], 200); @@ -752,7 +748,7 @@ class UsersController extends Controller $logaction->item_type = User::class; $logaction->item_id = $user->id; $logaction->created_at = date('Y-m-d H:i:s'); - $logaction->user_id = auth()->id(); + $logaction->created_by = auth()->id(); $logaction->logaction('restore'); return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/users/message.success.restored')), 200); diff --git a/app/Http/Controllers/AssetMaintenancesController.php b/app/Http/Controllers/AssetMaintenancesController.php index 02be1e606..360db4526 100644 --- a/app/Http/Controllers/AssetMaintenancesController.php +++ b/app/Http/Controllers/AssetMaintenancesController.php @@ -109,7 +109,7 @@ class AssetMaintenancesController extends Controller $assetMaintenance->title = $request->input('title'); $assetMaintenance->start_date = $request->input('start_date'); $assetMaintenance->completion_date = $request->input('completion_date'); - $assetMaintenance->user_id = Auth::id(); + $assetMaintenance->created_by = auth()->id(); if (($assetMaintenance->completion_date !== null) && ($assetMaintenance->start_date !== '') diff --git a/app/Http/Controllers/AssetModelsController.php b/app/Http/Controllers/AssetModelsController.php index 4421829f4..9d4c13afd 100755 --- a/app/Http/Controllers/AssetModelsController.php +++ b/app/Http/Controllers/AssetModelsController.php @@ -78,7 +78,7 @@ class AssetModelsController extends Controller $model->manufacturer_id = $request->input('manufacturer_id'); $model->category_id = $request->input('category_id'); $model->notes = $request->input('notes'); - $model->user_id = Auth::id(); + $model->created_by = auth()->id(); $model->requestable = $request->has('requestable'); if ($request->input('fieldset_id') != '') { @@ -151,17 +151,17 @@ class AssetModelsController extends Controller $model->notes = $request->input('notes'); $model->requestable = $request->input('requestable', '0'); - $this->removeCustomFieldsDefaultValues($model); - $model->fieldset_id = $request->input('fieldset_id'); - if ($this->shouldAddDefaultValues($request->input())) { - if (!$this->assignCustomFieldsDefaultValues($model, $request->input('default_values'))){ - return redirect()->back()->withInput()->with('error', trans('admin/custom_fields/message.fieldset_default_value.error')); - } - } - if ($model->save()) { + $this->removeCustomFieldsDefaultValues($model); + + if ($this->shouldAddDefaultValues($request->input())) { + if (!$this->assignCustomFieldsDefaultValues($model, $request->input('default_values'))) { + return redirect()->back()->withInput()->with('error', trans('admin/custom_fields/message.fieldset_default_value.error')); + } + } + if ($model->wasChanged('eol')) { if ($model->eol > 0) { $newEol = $model->eol; @@ -202,6 +202,7 @@ class AssetModelsController extends Controller if ($model->image) { try { Storage::disk('public')->delete('models/'.$model->image); + $model->update(['image' => null]); } catch (\Exception $e) { Log::info($e); } @@ -233,10 +234,10 @@ class AssetModelsController extends Controller if ($model->restore()) { $logaction = new Actionlog(); - $logaction->item_type = User::class; + $logaction->item_type = AssetModel::class; $logaction->item_id = $model->id; $logaction->created_at = date('Y-m-d H:i:s'); - $logaction->user_id = auth()->id(); + $logaction->created_by = auth()->id(); $logaction->logaction('restore'); diff --git a/app/Http/Controllers/Assets/AssetFilesController.php b/app/Http/Controllers/Assets/AssetFilesController.php index b5a04759b..d15055c4b 100644 --- a/app/Http/Controllers/Assets/AssetFilesController.php +++ b/app/Http/Controllers/Assets/AssetFilesController.php @@ -61,43 +61,30 @@ class AssetFilesController extends Controller */ public function show($assetId = null, $fileId = null) : View | RedirectResponse | Response | StreamedResponse | BinaryFileResponse { - $asset = Asset::find($assetId); - // the asset is valid - if (isset($asset->id)) { + if ($asset = Asset::find($assetId)) { + $this->authorize('view', $asset); - if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $asset->id)->find($fileId)) { - return response('No matching record for that asset/file', 500) - ->header('Content-Type', 'text/plain'); + if ($log = Actionlog::whereNotNull('filename')->where('item_id', $asset->id)->find($fileId)) { + $file = 'private_uploads/assets/'.$log->filename; + + if ($log->action_type == 'audit') { + $file = 'private_uploads/audits/'.$log->filename; + } + + try { + return StorageHelper::showOrDownloadFile($file, $log->filename); + } catch (\Exception $e) { + return redirect()->route('hardware.show', ['hardware' => $asset])->with('error', trans('general.file_not_found')); + } + } - $file = 'private_uploads/assets/'.$log->filename; - - if ($log->action_type == 'audit') { - $file = 'private_uploads/audits/'.$log->filename; - } - - if (! Storage::exists($file)) { - return response('File '.$file.' not found on server', 404) - ->header('Content-Type', 'text/plain'); - } - - if (request('inline') == 'true') { - - $headers = [ - 'Content-Disposition' => 'inline', - ]; - - return Storage::download($file, $log->filename, $headers); - } - - return StorageHelper::downloader($file); + return redirect()->route('hardware.show', ['hardware' => $asset])->with('error', trans('general.log_record_not_found')); } - // Prepare the error message - $error = trans('admin/hardware/message.does_not_exist', ['id' => $fileId]); - // Redirect to the hardware management page - return redirect()->route('hardware.index')->with('error', $error); + return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist')); + } /** diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 75646e726..52eb751a8 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Assets; +use App\Events\CheckoutableCheckedIn; use App\Helpers\Helper; use App\Http\Controllers\Controller; use App\Http\Requests\ImageUploadRequest; @@ -16,7 +17,6 @@ use App\Models\Location; use App\Models\Setting; use App\Models\Statuslabel; use App\Models\User; -use Illuminate\Support\Facades\Auth; use App\View\Label; use Carbon\Carbon; use Illuminate\Support\Facades\DB; @@ -111,8 +111,10 @@ class AssetsController extends Controller $settings = Setting::getSettings(); - $success = false; + $successes = []; + $failures = []; $serials = $request->input('serials'); + $asset = null; for ($a = 1; $a <= count($asset_tags); $a++) { $asset = new Asset(); @@ -132,7 +134,7 @@ class AssetsController extends Controller $asset->model_id = $request->input('model_id'); $asset->order_number = $request->input('order_number'); $asset->notes = $request->input('notes'); - $asset->user_id = Auth::id(); + $asset->created_by = auth()->id(); $asset->status_id = request('status_id'); $asset->warranty_months = request('warranty_months', null); $asset->purchase_cost = request('purchase_cost'); @@ -165,7 +167,7 @@ class AssetsController extends Controller if (($model) && ($model->fieldset)) { foreach ($model->fieldset->fields as $field) { if ($field->field_encrypted == '1') { - if (Gate::allows('admin')) { + if (Gate::allows('assets.view.encrypted_custom_fields')) { if (is_array($request->input($field->db_column))) { $asset->{$field->db_column} = Crypt::encrypt(implode(', ', $request->input($field->db_column))); } else { @@ -199,20 +201,35 @@ class AssetsController extends Controller $asset->checkOut($target, auth()->user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', $request->get('name'), $location); } - $success = true; - + $successes[] = " $asset->id]) . "' style='color: white;'>" . e($asset->asset_tag) . ""; + + } else { + $failures[] = join(",", $asset->getErrors()->all()); } } session()->put(['redirect_option' => $request->get('redirect_option'), 'checkout_to_type' => $request->get('checkout_to_type')]); - if ($success) { + if ($successes) { + if ($failures) { + //some succeeded, some failed + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) //FIXME - not tested + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['links' => join(", ", $successes)])) + ->with('warning', trans_choice('admin/hardware/message.create.partial_failure', $failures, ['failures' => join("; ", $failures)])); + } else { + if (count($successes) == 1) { + //the most common case, keeping it so we don't have to make every use of that translation string be trans_choice'ed + //and re-translated + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) + ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $asset->id]), 'id', 'tag' => e($asset->asset_tag)])); + } else { + //multi-success + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['links' => join(", ", $successes)])); + } + } - return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) - ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $asset->id]), 'id', 'tag' => e($asset->asset_tag)])); - - } return redirect()->back()->withInput()->withErrors($asset->getErrors()); @@ -328,16 +345,21 @@ class AssetsController extends Controller } $asset->supplier_id = $request->input('supplier_id', null); $asset->expected_checkin = $request->input('expected_checkin', null); - - // If the box isn't checked, it's not in the request at all. - $asset->requestable = $request->filled('requestable'); + $asset->requestable = $request->input('requestable', 0); $asset->rtd_location_id = $request->input('rtd_location_id', null); $asset->byod = $request->input('byod', 0); - $status = Statuslabel::find($asset->status_id); + $status = Statuslabel::find($request->input('status_id')); - if ($status && $status->archived) { + // This is a non-deployable status label - we should check the asset back in. + if (($status && $status->getStatuslabelType() != 'deployable') && ($target = $asset->assignedTo)) { + + $originalValues = $asset->getRawOriginal(); $asset->assigned_to = null; + $asset->assigned_type = null; + $asset->accepted = null; + + event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on asset update', date('Y-m-d H:i:s'), $originalValues)); } if ($asset->assigned_to == '') { @@ -388,7 +410,7 @@ class AssetsController extends Controller foreach ($model->fieldset->fields as $field) { if ($field->field_encrypted == '1') { - if (Gate::allows('admin')) { + if (Gate::allows('assets.view.encrypted_custom_fields')) { if (is_array($request->input($field->db_column))) { $asset->{$field->db_column} = Crypt::encrypt(implode(', ', $request->input($field->db_column))); } else { @@ -422,7 +444,7 @@ class AssetsController extends Controller * @param int $assetId * @since [v1.0] */ - public function destroy($assetId) : RedirectResponse + public function destroy(Request $request, $assetId) : RedirectResponse { // Check if the asset exists if (is_null($asset = Asset::find($assetId))) { @@ -432,9 +454,17 @@ class AssetsController extends Controller $this->authorize('delete', $asset); - DB::table('assets') - ->where('id', $asset->id) - ->update(['assigned_to' => null]); + if ($asset->assignedTo) { + + $target = $asset->assignedTo; + $checkin_at = date('Y-m-d H:i:s'); + $originalValues = $asset->getRawOriginal(); + event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on delete', $checkin_at, $originalValues)); + DB::table('assets') + ->where('id', $asset->id) + ->update(['assigned_to' => null]); + } + if ($asset->image) { try { @@ -739,7 +769,7 @@ class AssetsController extends Controller Actionlog::firstOrCreate([ 'item_id' => $asset->id, 'item_type' => Asset::class, - 'user_id' => auth()->id(), + 'created_by' => auth()->id(), 'note' => 'Checkout imported by '.auth()->user()->present()->fullName().' from history importer', 'target_id' => $item[$asset_tag][$batch_counter]['user_id'], 'target_type' => User::class, @@ -767,7 +797,7 @@ class AssetsController extends Controller Actionlog::firstOrCreate([ 'item_id' => $item[$asset_tag][$batch_counter]['asset_id'], 'item_type' => Asset::class, - 'user_id' => auth()->id(), + 'created_by' => auth()->id(), 'note' => 'Checkin imported by '.auth()->user()->present()->fullName().' from history importer', 'target_id' => null, 'created_at' => $checkin_date, diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index d58edbaca..93f7255c0 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -10,6 +10,7 @@ use App\Models\AssetModel; use App\Models\Statuslabel; use App\Models\Setting; use App\View\Label; +use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\DB; @@ -51,6 +52,10 @@ class BulkAssetsController extends Controller } $asset_ids = $request->input('ids'); + if ($request->input('bulk_actions') === 'checkout') { + $request->session()->flashInput(['selected_assets' => $asset_ids]); + return redirect()->route('hardware.bulkcheckout.show'); + } // Figure out where we need to send the user after the update is complete, and store that in the session $bulk_back_url = request()->headers->get('referer'); @@ -240,10 +245,12 @@ class BulkAssetsController extends Controller || ($request->filled('status_id')) || ($request->filled('model_id')) || ($request->filled('next_audit_date')) + || ($request->filled('asset_eol_date')) || ($request->filled('null_name')) || ($request->filled('null_purchase_date')) || ($request->filled('null_expected_checkin_date')) || ($request->filled('null_next_audit_date')) + || ($request->filled('null_asset_eol_date')) || ($request->anyFilled($custom_field_columns)) ) { @@ -266,11 +273,29 @@ class BulkAssetsController extends Controller ->conditionallyAddItem('requestable') ->conditionallyAddItem('supplier_id') ->conditionallyAddItem('warranty_months') - ->conditionallyAddItem('next_audit_date'); + ->conditionallyAddItem('next_audit_date') + ->conditionallyAddItem('asset_eol_date'); foreach ($custom_field_columns as $key => $custom_field_column) { $this->conditionallyAddItem($custom_field_column); } + if (!($asset->eol_explicit)) { + if ($request->filled('model_id')) { + $model = AssetModel::find($request->input('model_id')); + if ($model->eol > 0) { + if ($request->filled('purchase_date')) { + $this->update_array['asset_eol_date'] = Carbon::parse($request->input('purchase_date'))->addMonths($model->eol)->format('Y-m-d'); + } else { + $this->update_array['asset_eol_date'] = Carbon::parse($asset->purchase_date)->addMonths($model->eol)->format('Y-m-d'); + } + } else { + $this->update_array['asset_eol_date'] = null; + } + } elseif (($request->filled('purchase_date')) && ($asset->model->eol > 0)) { + $this->update_array['asset_eol_date'] = Carbon::parse($request->input('purchase_date'))->addMonths($asset->model->eol)->format('Y-m-d'); + } + } + /** * Blank out fields that were requested to be blanked out via checkbox */ @@ -281,6 +306,9 @@ class BulkAssetsController extends Controller if ($request->input('null_purchase_date')=='1') { $this->update_array['purchase_date'] = null; + if (!($asset->eol_explicit)) { + $this->update_array['asset_eol_date'] = null; + } } if ($request->input('null_expected_checkin_date')=='1') { @@ -291,6 +319,17 @@ class BulkAssetsController extends Controller $this->update_array['next_audit_date'] = null; } + if ($request->input('null_asset_eol_date')=='1') { + $this->update_array['asset_eol_date'] = null; + + // If they are nulling the EOL date to allow it to calculate, set eol explicit to 0 + if ($request->input('calc_eol')=='1') { + $this->update_array['eol_explicit'] = 0; + } + } + + + if ($request->filled('purchase_cost')) { $this->update_array['purchase_cost'] = $request->input('purchase_cost'); } @@ -550,31 +589,34 @@ class BulkAssetsController extends Controller } $errors = []; - DB::transaction(function () use ($target, $admin, $checkout_at, $expected_checkin, $errors, $asset_ids, $request) { + DB::transaction(function () use ($target, $admin, $checkout_at, $expected_checkin, &$errors, $asset_ids, $request) { //NOTE: $errors is passsed by reference! foreach ($asset_ids as $asset_id) { $asset = Asset::findOrFail($asset_id); $this->authorize('checkout', $asset); - $error = $asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $asset->name, null); + $checkout_success = $asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $asset->name, null); + //TODO - I think this logic is duplicated in the checkOut method? if ($target->location_id != '') { $asset->location_id = $target->location_id; - $asset->unsetEventDispatcher(); - $asset->save(); + // TODO - I don't know why this is being saved without events + $asset::withoutEvents(function () use ($asset) { + $asset->save(); + }); } - if ($error) { - array_merge_recursive($errors, $asset->getErrors()->toArray()); + if (!$checkout_success) { + $errors = array_merge_recursive($errors, $asset->getErrors()->toArray()); } } }); if (! $errors) { // Redirect to the new asset page - return redirect()->to('hardware')->with('success', trans('admin/hardware/message.checkout.success')); + return redirect()->to('hardware')->with('success', trans_choice('admin/hardware/message.multi-checkout.success', $asset_ids)); } // Redirect to the asset management page with error - return redirect()->route('hardware.bulkcheckout.show')->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors); + return redirect()->route('hardware.bulkcheckout.show')->withInput()->with('error', trans_choice('admin/hardware/message.multi-checkout.error', $asset_ids))->withErrors($errors); } catch (ModelNotFoundException $e) { return redirect()->route('hardware.bulkcheckout.show')->with('error', $e->getErrors()); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 9ac976b43..e7b10877c 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -508,8 +508,8 @@ class LoginController extends Controller protected function validator(array $data) { return Validator::make($data, [ - 'username' => 'required', - 'password' => 'required', + 'username' => 'required|not_array', + 'password' => 'required|not_array', ]); } diff --git a/app/Http/Controllers/CategoriesController.php b/app/Http/Controllers/CategoriesController.php index ac57ad6a6..93b3d4a0d 100755 --- a/app/Http/Controllers/CategoriesController.php +++ b/app/Http/Controllers/CategoriesController.php @@ -69,7 +69,7 @@ class CategoriesController extends Controller $category->use_default_eula = $request->input('use_default_eula', '0'); $category->require_acceptance = $request->input('require_acceptance', '0'); $category->checkin_email = $request->input('checkin_email', '0'); - $category->user_id = Auth::id(); + $category->created_by = auth()->id(); $category = $request->handleImages($category); if ($category->save()) { diff --git a/app/Http/Controllers/CompaniesController.php b/app/Http/Controllers/CompaniesController.php index 589832af7..238ffc85f 100644 --- a/app/Http/Controllers/CompaniesController.php +++ b/app/Http/Controllers/CompaniesController.php @@ -60,6 +60,7 @@ final class CompaniesController extends Controller $company->phone = $request->input('phone'); $company->fax = $request->input('fax'); $company->email = $request->input('email'); + $company->created_by = auth()->id(); $company = $request->handleImages($company); diff --git a/app/Http/Controllers/Components/ComponentCheckoutController.php b/app/Http/Controllers/Components/ComponentCheckoutController.php index e9db70811..b40d59236 100644 --- a/app/Http/Controllers/Components/ComponentCheckoutController.php +++ b/app/Http/Controllers/Components/ComponentCheckoutController.php @@ -106,7 +106,7 @@ class ComponentCheckoutController extends Controller $component->asset_id = $request->input('asset_id'); $component->assets()->attach($component->id, [ 'component_id' => $component->id, - 'user_id' => auth()->user()->id, + 'created_by' => auth()->user()->id, 'created_at' => date('Y-m-d H:i:s'), 'assigned_qty' => $request->input('assigned_qty'), 'asset_id' => $request->input('asset_id'), diff --git a/app/Http/Controllers/Components/ComponentsController.php b/app/Http/Controllers/Components/ComponentsController.php index 57cd0a2b4..c4d9bcec3 100644 --- a/app/Http/Controllers/Components/ComponentsController.php +++ b/app/Http/Controllers/Components/ComponentsController.php @@ -73,6 +73,8 @@ class ComponentsController extends Controller $component->name = $request->input('name'); $component->category_id = $request->input('category_id'); $component->supplier_id = $request->input('supplier_id'); + $component->manufacturer_id = $request->input('manufacturer_id'); + $component->model_number = $request->input('model_number'); $component->location_id = $request->input('location_id'); $component->company_id = Company::getIdForCurrentUser($request->input('company_id')); $component->order_number = $request->input('order_number', null); @@ -81,7 +83,7 @@ class ComponentsController extends Controller $component->purchase_date = $request->input('purchase_date', null); $component->purchase_cost = $request->input('purchase_cost', null); $component->qty = $request->input('qty'); - $component->user_id = Auth::id(); + $component->created_by = auth()->id(); $component->notes = $request->input('notes'); $component = $request->handleImages($component); @@ -150,6 +152,8 @@ class ComponentsController extends Controller $component->name = $request->input('name'); $component->category_id = $request->input('category_id'); $component->supplier_id = $request->input('supplier_id'); + $component->manufacturer_id = $request->input('manufacturer_id'); + $component->model_number = $request->input('model_number'); $component->location_id = $request->input('location_id'); $component->company_id = Company::getIdForCurrentUser($request->input('company_id')); $component->order_number = $request->input('order_number'); diff --git a/app/Http/Controllers/Components/ComponentsFilesController.php b/app/Http/Controllers/Components/ComponentsFilesController.php index a7d42bb07..83468a0b1 100644 --- a/app/Http/Controllers/Components/ComponentsFilesController.php +++ b/app/Http/Controllers/Components/ComponentsFilesController.php @@ -112,40 +112,25 @@ class ComponentsFilesController extends Controller public function show($componentId = null, $fileId = null) { Log::debug('Private filesystem is: '.config('filesystems.default')); - $component = Component::find($componentId); + // the component is valid - if (isset($component->id)) { + if ($component = Component::find($componentId)) { $this->authorize('view', $component); $this->authorize('components.files', $component); - if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $component->id)->find($fileId)) { - return response('No matching record for that asset/file', 500) - ->header('Content-Type', 'text/plain'); - } + if ($log = Actionlog::whereNotNull('filename')->where('item_id', $component->id)->find($fileId)) { - $file = 'private_uploads/components/'.$log->filename; + $file = 'private_uploads/components/'.$log->filename; - if (Storage::missing($file)) { - Log::debug('FILE DOES NOT EXISTS for '.$file); - Log::debug('URL should be '.Storage::url($file)); - - return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) - ->header('Content-Type', 'text/plain'); - } else { - - // Display the file inline - if (request('inline') == 'true') { - $headers = [ - 'Content-Disposition' => 'inline', - ]; - return Storage::download($file, $log->filename, $headers); + try { + return StorageHelper::showOrDownloadFile($file, $log->filename); + } catch (\Exception $e) { + return redirect()->route('components.show', ['component' => $component])->with('error', trans('general.file_not_found')); } - - if (config('filesystems.default') == 'local') { // TODO - is there any way to fix this at the StorageHelper layer? - return StorageHelper::downloader($file); - } } + return redirect()->route('components.show', ['component' => $component])->with('error', trans('general.log_record_not_found')); + } return redirect()->route('components.index')->with('error', trans('general.file_does_not_exist', ['id' => $fileId])); diff --git a/app/Http/Controllers/Consumables/ConsumableCheckoutController.php b/app/Http/Controllers/Consumables/ConsumableCheckoutController.php index 1bdb16af9..e08da4122 100644 --- a/app/Http/Controllers/Consumables/ConsumableCheckoutController.php +++ b/app/Http/Controllers/Consumables/ConsumableCheckoutController.php @@ -70,7 +70,7 @@ class ConsumableCheckoutController extends Controller $this->authorize('checkout', $consumable); // If the quantity is not present in the request or is not a positive integer, set it to 1 - $quantity = $request->input('qty'); + $quantity = $request->input('checkout_qty'); if (!isset($quantity) || !ctype_digit((string)$quantity) || $quantity <= 0) { $quantity = 1; } @@ -92,14 +92,16 @@ class ConsumableCheckoutController extends Controller // Update the consumable data $consumable->assigned_to = e($request->input('assigned_to')); - for($i = 0; $i < $quantity; $i++){ + for ($i = 0; $i < $quantity; $i++){ $consumable->users()->attach($consumable->id, [ 'consumable_id' => $consumable->id, - 'user_id' => $admin_user->id, + 'created_by' => $admin_user->id, 'assigned_to' => e($request->input('assigned_to')), 'note' => $request->input('note'), ]); } + + $consumable->checkout_qty = $quantity; event(new CheckoutableCheckedOut($consumable, $user, auth()->user(), $request->input('note'))); $request->request->add(['checkout_to_type' => 'user']); diff --git a/app/Http/Controllers/Consumables/ConsumablesController.php b/app/Http/Controllers/Consumables/ConsumablesController.php index 42c0766fe..98141f278 100644 --- a/app/Http/Controllers/Consumables/ConsumablesController.php +++ b/app/Http/Controllers/Consumables/ConsumablesController.php @@ -81,7 +81,7 @@ class ConsumablesController extends Controller $consumable->purchase_date = $request->input('purchase_date'); $consumable->purchase_cost = $request->input('purchase_cost'); $consumable->qty = $request->input('qty'); - $consumable->user_id = Auth::id(); + $consumable->created_by = auth()->id(); $consumable->notes = $request->input('notes'); @@ -221,7 +221,7 @@ class ConsumablesController extends Controller $consumable = clone $consumable_to_close; $consumable->id = null; $consumable->image = null; - $consumable->user_id = null; + $consumable->created_by = null; return view('consumables/edit')->with('item', $consumable); } diff --git a/app/Http/Controllers/Consumables/ConsumablesFilesController.php b/app/Http/Controllers/Consumables/ConsumablesFilesController.php index 35a4ae841..054fdc0b8 100644 --- a/app/Http/Controllers/Consumables/ConsumablesFilesController.php +++ b/app/Http/Controllers/Consumables/ConsumablesFilesController.php @@ -104,7 +104,6 @@ class ConsumablesFilesController extends Controller * @since [v1.4] * @param int $consumableId * @param int $fileId - * @return \Symfony\Consumable\HttpFoundation\Response * @throws \Illuminate\Auth\Access\AuthorizationException */ public function show($consumableId = null, $fileId = null) @@ -116,36 +115,18 @@ class ConsumablesFilesController extends Controller $this->authorize('view', $consumable); $this->authorize('consumables.files', $consumable); - if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $consumable->id)->find($fileId)) { - return response('No matching record for that asset/file', 500) - ->header('Content-Type', 'text/plain'); - } + if ($log = Actionlog::whereNotNull('filename')->where('item_id', $consumable->id)->find($fileId)) { + $file = 'private_uploads/consumables/'.$log->filename; - $file = 'private_uploads/consumables/'.$log->filename; - - if (Storage::missing($file)) { - Log::debug('FILE DOES NOT EXISTS for '.$file); - Log::debug('URL should be '.Storage::url($file)); - - return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) - ->header('Content-Type', 'text/plain'); - } else { - - // Display the file inline - if (request('inline') == 'true') { - $headers = [ - 'Content-Disposition' => 'inline', - ]; - return Storage::download($file, $log->filename, $headers); - } - - - // We have to override the URL stuff here, since local defaults in Laravel's Flysystem - // won't work, as they're not accessible via the web - if (config('filesystems.default') == 'local') { // TODO - is there any way to fix this at the StorageHelper layer? - return StorageHelper::downloader($file); + try { + return StorageHelper::showOrDownloadFile($file, $log->filename); + } catch (\Exception $e) { + return redirect()->route('consumables.show', ['consumable' => $consumable])->with('error', trans('general.file_not_found')); } } + // The log record doesn't exist somehow + return redirect()->route('consumables.show', ['consumable' => $consumable])->with('error', trans('general.log_record_not_found')); + } return redirect()->route('consumables.index')->with('error', trans('general.file_does_not_exist', ['id' => $fileId])); diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php index 42f6c212d..5a0dc6aec 100644 --- a/app/Http/Controllers/CustomFieldsController.php +++ b/app/Http/Controllers/CustomFieldsController.php @@ -104,7 +104,7 @@ class CustomFieldsController extends Controller "auto_add_to_fieldsets" => $request->get("auto_add_to_fieldsets", 0), "show_in_listview" => $request->get("show_in_listview", 0), "show_in_requestable_list" => $request->get("show_in_requestable_list", 0), - "user_id" => Auth::id() + "user_id" => auth()->id() ]); @@ -248,7 +248,7 @@ class CustomFieldsController extends Controller $field->name = trim(e($request->get("name"))); $field->element = e($request->get("element")); $field->field_values = $request->get("field_values"); - $field->user_id = Auth::id(); + $field->created_by = auth()->id(); $field->help_text = $request->get("help_text"); $field->show_in_email = $show_in_email; $field->is_unique = $request->get("is_unique", 0); diff --git a/app/Http/Controllers/CustomFieldsetsController.php b/app/Http/Controllers/CustomFieldsetsController.php index 8b9844d15..1d887db29 100644 --- a/app/Http/Controllers/CustomFieldsetsController.php +++ b/app/Http/Controllers/CustomFieldsetsController.php @@ -90,7 +90,7 @@ class CustomFieldsetsController extends Controller $fieldset = new CustomFieldset([ 'name' => $request->get('name'), - 'user_id' => auth()->id(), + 'created_by' => auth()->id(), ]); $validator = Validator::make($request->all(), $fieldset->rules); diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index fc01c496c..af9c7ee44 100755 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use Illuminate\Support\Facades\Artisan; use Illuminate\Http\RedirectResponse; use \Illuminate\Contracts\View\View; +use Illuminate\Support\Facades\Session; /** @@ -44,6 +45,8 @@ class DashboardController extends Controller return view('dashboard')->with('asset_stats', $asset_stats)->with('counts', $counts); } else { + Session::reflash(); + // Redirect to the profile page return redirect()->intended('account/view-assets'); } diff --git a/app/Http/Controllers/DepartmentsController.php b/app/Http/Controllers/DepartmentsController.php index 5818435de..287315ef2 100644 --- a/app/Http/Controllers/DepartmentsController.php +++ b/app/Http/Controllers/DepartmentsController.php @@ -51,7 +51,7 @@ class DepartmentsController extends Controller $this->authorize('create', Department::class); $department = new Department; $department->fill($request->all()); - $department->user_id = auth()->id(); + $department->created_by = auth()->id(); $department->manager_id = ($request->filled('manager_id') ? $request->input('manager_id') : null); $department->location_id = ($request->filled('location_id') ? $request->input('location_id') : null); $department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null); diff --git a/app/Http/Controllers/DepreciationsController.php b/app/Http/Controllers/DepreciationsController.php index c564cc98f..5f4a5ca10 100755 --- a/app/Http/Controllers/DepreciationsController.php +++ b/app/Http/Controllers/DepreciationsController.php @@ -61,7 +61,7 @@ class DepreciationsController extends Controller // Depreciation data $depreciation->name = $request->input('name'); $depreciation->months = $request->input('months'); - $depreciation->user_id = Auth::id(); + $depreciation->created_by = auth()->id(); $request->validate([ 'depreciation_min' => [ @@ -193,13 +193,20 @@ class DepreciationsController extends Controller */ public function show($id) : View | RedirectResponse { - if (is_null($depreciation = Depreciation::find($id))) { - // Redirect to the blogs management page - return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist')); - } + $depreciation = Depreciation::withCount('assets as assets_count') + ->withCount('models as models_count') + ->withCount('licenses as licenses_count') + ->find($id); $this->authorize('view', $depreciation); - return view('depreciations/view', compact('depreciation')); + if ($depreciation) { + return view('depreciations/view', compact('depreciation')); + + } + + return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist')); + + } } diff --git a/app/Http/Controllers/HealthController.php b/app/Http/Controllers/HealthController.php index c75b903b0..dac1f17bf 100644 --- a/app/Http/Controllers/HealthController.php +++ b/app/Http/Controllers/HealthController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Routing\Controller as BaseController; +use Illuminate\Support\Facades\DB; /** * This controller provide the health route for @@ -15,13 +16,35 @@ use Illuminate\Routing\Controller as BaseController; */ class HealthController extends BaseController { + + public function __construct() + { + $this->middleware('health'); + } + + /** * Returns a fixed JSON content ({ "status": "ok"}) which indicate the app is up and running */ public function get() { - return response()->json([ - 'status' => 'ok', - ]); + try { + + if (DB::select('select 2 + 2')) { + return response()->json([ + 'status' => 'ok', + ]); + } + + } catch (\Exception $e) { + \Log::error('Could not connect to database'); + return response()->json([ + 'status' => 'database connection failed', + ], 500); + + } + + + } } diff --git a/app/Http/Controllers/Kits/PredefinedKitsController.php b/app/Http/Controllers/Kits/PredefinedKitsController.php index 187f5aad1..54f751451 100644 --- a/app/Http/Controllers/Kits/PredefinedKitsController.php +++ b/app/Http/Controllers/Kits/PredefinedKitsController.php @@ -55,6 +55,7 @@ class PredefinedKitsController extends Controller // Create a new Predefined Kit $kit = new PredefinedKit; $kit->name = $request->input('name'); + $kit->created_by = auth()->id(); if (! $kit->save()) { return redirect()->back()->withInput()->withErrors($kit->getErrors()); diff --git a/app/Http/Controllers/Licenses/LicenseCheckoutController.php b/app/Http/Controllers/Licenses/LicenseCheckoutController.php index c08980fc0..0f31db144 100644 --- a/app/Http/Controllers/Licenses/LicenseCheckoutController.php +++ b/app/Http/Controllers/Licenses/LicenseCheckoutController.php @@ -77,7 +77,7 @@ class LicenseCheckoutController extends Controller $this->authorize('checkout', $license); $licenseSeat = $this->findLicenseSeatToCheckout($license, $seatId); - $licenseSeat->user_id = Auth::id(); + $licenseSeat->created_by = auth()->id(); $licenseSeat->notes = $request->input('notes'); diff --git a/app/Http/Controllers/Licenses/LicenseFilesController.php b/app/Http/Controllers/Licenses/LicenseFilesController.php index fa18e8cf4..6ab3cb770 100644 --- a/app/Http/Controllers/Licenses/LicenseFilesController.php +++ b/app/Http/Controllers/Licenses/LicenseFilesController.php @@ -112,37 +112,19 @@ class LicenseFilesController extends Controller $this->authorize('view', $license); $this->authorize('licenses.files', $license); - if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $license->id)->find($fileId)) { - return response('No matching record for that asset/file', 500) - ->header('Content-Type', 'text/plain'); - } - - $file = 'private_uploads/licenses/'.$log->filename; - - if (Storage::missing($file)) { - Log::debug('NOT EXISTS for '.$file); - Log::debug('NOT EXISTS URL should be '.Storage::url($file)); - - return response('File '.$file.' ('.Storage::url($file).') not found on server', 404) - ->header('Content-Type', 'text/plain'); - } else { - - if (request('inline') == 'true') { - - $headers = [ - 'Content-Disposition' => 'inline', - ]; - - return Storage::download($file, $log->filename, $headers); - } - - // We have to override the URL stuff here, since local defaults in Laravel's Flysystem - // won't work, as they're not accessible via the web - if (config('filesystems.default') == 'local') { // TODO - is there any way to fix this at the StorageHelper layer? - return StorageHelper::downloader($file); + if ($log = Actionlog::whereNotNull('filename')->where('item_id', $license->id)->find($fileId)) { + $file = 'private_uploads/licenses/'.$log->filename; + try { + return StorageHelper::showOrDownloadFile($file, $log->filename); + } catch (\Exception $e) { + return redirect()->route('licenses.show', ['licenses' => $license])->with('error', trans('general.file_not_found')); } } + + // The log record doesn't exist somehow + return redirect()->route('licenses.show', ['licenses' => $license])->with('error', trans('general.log_record_not_found')); + } return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', ['id' => $fileId])); diff --git a/app/Http/Controllers/Licenses/LicensesController.php b/app/Http/Controllers/Licenses/LicensesController.php index 7a51344dd..6098423ba 100755 --- a/app/Http/Controllers/Licenses/LicensesController.php +++ b/app/Http/Controllers/Licenses/LicensesController.php @@ -99,7 +99,7 @@ class LicensesController extends Controller $license->supplier_id = $request->input('supplier_id'); $license->category_id = $request->input('category_id'); $license->termination_date = $request->input('termination_date'); - $license->user_id = Auth::id(); + $license->created_by = auth()->id(); $license->min_amt = $request->input('min_amt'); session()->put(['redirect_option' => $request->get('redirect_option')]); diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php index c498f0992..75abce97e 100755 --- a/app/Http/Controllers/LocationsController.php +++ b/app/Http/Controllers/LocationsController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Http\Requests\ImageUploadRequest; +use App\Models\Actionlog; use App\Models\Asset; use App\Models\Location; use App\Models\User; @@ -74,7 +75,7 @@ class LocationsController extends Controller $location->zip = $request->input('zip'); $location->ldap_ou = $request->input('ldap_ou'); $location->manager_id = $request->input('manager_id'); - $location->user_id = auth()->id(); + $location->created_by = auth()->id(); $location->phone = request('phone'); $location->fax = request('fax'); @@ -193,7 +194,13 @@ class LocationsController extends Controller */ public function show($id = null) : View | RedirectResponse { - $location = Location::find($id); + $location = Location::withCount('assignedAssets as assigned_assets_count') + ->withCount('assets as assets_count') + ->withCount('rtd_assets as rtd_assets_count') + ->withCount('children as children_count') + ->withCount('users as users_count') + ->withTrashed() + ->find($id); if (isset($location->id)) { return view('locations/view', compact('location')); @@ -249,6 +256,41 @@ class LocationsController extends Controller } + /** + * Restore a given Asset Model (mark as un-deleted) + * + * @author [A. Gianotto] [] + * @since [v1.0] + * @param int $id + */ + public function postRestore($id) : RedirectResponse + { + $this->authorize('create', Location::class); + + if ($location = Location::withTrashed()->find($id)) { + + if ($location->deleted_at == '') { + return redirect()->back()->with('error', trans('general.not_deleted', ['item_type' => trans('general.location')])); + } + + if ($location->restore()) { + $logaction = new Actionlog(); + $logaction->item_type = Location::class; + $logaction->item_id = $location->id; + $logaction->created_at = date('Y-m-d H:i:s'); + $logaction->created_by = auth()->id(); + $logaction->logaction('restore'); + + return redirect()->route('locations.index')->with('success', trans('admin/locations/message.restore.success')); + } + + // Check validation + return redirect()->back()->with('error', trans('general.could_not_restore', ['item_type' => trans('general.location'), 'error' => $location->getErrors()->first()])); + } + + return redirect()->back()->with('error', trans('admin/models/message.does_not_exist')); + + } public function print_all_assigned($id) : View | RedirectResponse { if ($location = Location::where('id', $id)->first()) { diff --git a/app/Http/Controllers/ManufacturersController.php b/app/Http/Controllers/ManufacturersController.php index 8e979e389..68124f644 100755 --- a/app/Http/Controllers/ManufacturersController.php +++ b/app/Http/Controllers/ManufacturersController.php @@ -61,7 +61,7 @@ class ManufacturersController extends Controller $this->authorize('create', Manufacturer::class); $manufacturer = new Manufacturer; $manufacturer->name = $request->input('name'); - $manufacturer->user_id = Auth::id(); + $manufacturer->created_by = auth()->id(); $manufacturer->url = $request->input('url'); $manufacturer->support_url = $request->input('support_url'); $manufacturer->warranty_lookup_url = $request->input('warranty_lookup_url'); @@ -219,7 +219,7 @@ class ManufacturersController extends Controller $logaction->item_type = Manufacturer::class; $logaction->item_id = $manufacturer->id; $logaction->created_at = date('Y-m-d H:i:s'); - $logaction->user_id = auth()->id(); + $logaction->created_by = auth()->id(); $logaction->logaction('restore'); // Redirect them to the deleted page if there are more, otherwise the section index diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index abe09e8af..896c25346 100755 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -194,14 +194,14 @@ class ProfileController extends Controller */ public function printInventory() : View { - $show_user = auth()->user(); + $show_users = User::where('id',auth()->user()->id)->get(); return view('users/print') - ->with('assets', auth()->user()->assets) - ->with('licenses', $show_user->licenses()->get()) - ->with('accessories', $show_user->accessories()->get()) - ->with('consumables', $show_user->consumables()->get()) - ->with('show_user', $show_user) + ->with('assets', auth()->user()->assets()) + ->with('licenses', auth()->user()->licenses()->get()) + ->with('accessories', auth()->user()->accessories()->get()) + ->with('consumables', auth()->user()->consumables()->get()) + ->with('users', $show_users) ->with('settings', Setting::getSettings()); } @@ -222,7 +222,12 @@ class ProfileController extends Controller return redirect()->back()->with('error', trans('admin/users/message.user_has_no_email')); } - $user->notify((new CurrentInventory($user))); + try { + $user->notify((new CurrentInventory($user))); + } catch (\Exception $e) { + \Log::error($e); + } + return redirect()->back()->with('success', trans('admin/users/general.user_notified')); } } diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index c4b7ee060..105dac635 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -703,6 +703,10 @@ class ReportsController extends Controller $assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]); } + if (($request->filled('asset_eol_date_start')) && ($request->filled('asset_eol_date_end'))) { + $assets->whereBetween('assets.asset_eol_date', [$request->input('asset_eol_date_start'), $request->input('asset_eol_date_end')]); + } + if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) { $last_audit_start = Carbon::parse($request->input('last_audit_start'))->startOfDay(); $last_audit_end = Carbon::parse($request->input('last_audit_end'))->endOfDay(); @@ -778,7 +782,7 @@ class ReportsController extends Controller } if ($request->filled('eol')) { - $row[] = ($asset->asset_eol_date) ? $asset->asset_eol_date : ''; + $row[] = ($asset->purchase_date != '') ? $asset->asset_eol_date : ''; } if ($request->filled('order')) { diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 0ab052596..aa773d9ee 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -7,6 +7,11 @@ use App\Helpers\StorageHelper; use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\SettingsSamlRequest; use App\Http\Requests\SetupUserRequest; +use App\Http\Requests\StoreLdapSettings; +use App\Http\Requests\StoreLocalizationSettings; +use App\Http\Requests\StoreNotificationSettings; +use App\Http\Requests\StoreLabelSettings; +use App\Http\Requests\StoreSecuritySettings; use App\Models\CustomField; use App\Models\Group; use App\Models\Setting; @@ -181,7 +186,7 @@ class SettingsController extends Controller $settings->brand = 1; $settings->locale = $request->input('locale', 'en-US'); $settings->default_currency = $request->input('default_currency', 'USD'); - $settings->user_id = 1; + $settings->created_by = 1; $settings->email_domain = $request->input('email_domain'); $settings->email_format = $request->input('email_format'); $settings->next_auto_tag_base = 1; @@ -273,20 +278,6 @@ class SettingsController extends Controller return view('settings/index', compact('settings')); } - /** - * Return the admin settings page. - * - * @author [A. Gianotto] [] - * - * @since [v1.0] - */ - public function getEdit() : View - - { - $setting = Setting::getSettings(); - - return view('settings/general', compact('setting')); - } /** * Return a form to allow a super admin to update settings. @@ -486,7 +477,7 @@ class SettingsController extends Controller * * @since [v1.0] */ - public function postSecurity(Request $request) : RedirectResponse + public function postSecurity(StoreSecuritySettings $request) : RedirectResponse { $this->validate($request, [ 'pwd_secure_complexity' => 'array', @@ -556,7 +547,7 @@ class SettingsController extends Controller * * @since [v1.0] */ - public function postLocalization(Request $request) : RedirectResponse + public function postLocalization(StoreLocalizationSettings $request) : RedirectResponse { if (is_null($setting = Setting::getSettings())) { return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error')); @@ -599,7 +590,7 @@ class SettingsController extends Controller * @author [A. Gianotto] [] * @since [v1.0] */ - public function postAlerts(Request $request) : RedirectResponse + public function postAlerts(StoreNotificationSettings $request) : RedirectResponse { if (is_null($setting = Setting::getSettings())) { return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error')); @@ -780,7 +771,7 @@ class SettingsController extends Controller * @author [A. Gianotto] [] * @since [v4.0] */ - public function postLabels(Request $request) : RedirectResponse + public function postLabels(StoreLabelSettings $request) : RedirectResponse { if (is_null($setting = Setting::getSettings())) { return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error')); @@ -859,26 +850,7 @@ class SettingsController extends Controller { $setting = Setting::getSettings(); $groups = Group::pluck('name', 'id'); - - - /** - * This validator is only temporary (famous last words.) - @snipe - */ - $messages = [ - 'ldap_username_field.not_in' => 'sAMAccountName (mixed case) will likely not work. You should use samaccountname (lowercase) instead. ', - 'ldap_auth_filter_query.not_in' => 'uid=samaccountname is probably not a valid auth filter. You probably want uid= ', - 'ldap_filter.regex' => 'This value should probably not be wrapped in parentheses.', - ]; - - $validator = Validator::make($setting->toArray(), [ - 'ldap_username_field' => 'not_in:sAMAccountName', - 'ldap_auth_filter_query' => 'not_in:uid=samaccountname|required_if:ldap_enabled,1', - 'ldap_filter' => 'nullable|regex:"^[^(]"|required_if:ldap_enabled,1', - ], $messages); - - - - return view('settings.ldap', compact('setting', 'groups'))->withErrors($validator); + return view('settings.ldap', compact('setting', 'groups')); } /** @@ -887,7 +859,7 @@ class SettingsController extends Controller * @author [A. Gianotto] [] * @since [v4.0] */ - public function postLdapSettings(Request $request) : RedirectResponse + public function postLdapSettings(StoreLdapSettings $request) : RedirectResponse { if (is_null($setting = Setting::getSettings())) { return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error')); @@ -1204,7 +1176,7 @@ class SettingsController extends Controller * @author [A. Gianotto] [] * @since [v6.0] */ - public function postRestore($filename = null) : RedirectResponse + public function postRestore(Request $request, $filename = null): RedirectResponse { if (! config('app.lock_passwords')) { @@ -1224,13 +1196,29 @@ class SettingsController extends Controller Log::debug('Attempting to restore from: '. storage_path($path).'/'.$filename); - // run the restore command - Artisan::call('snipeit:restore', - [ + $restore_params = [ '--force' => true, '--no-progress' => true, - 'filename' => storage_path($path).'/'.$filename - ]); + 'filename' => storage_path($path) . '/' . $filename + ]; + + if ($request->input('clean')) { + Log::debug("Attempting 'clean' - first, guessing prefix..."); + Artisan::call('snipeit:restore', [ + '--sanitize-guess-prefix' => true, + 'filename' => storage_path($path) . '/' . $filename + ]); + $guess_prefix_output = Artisan::output(); + Log::debug("Sanitize output is: $guess_prefix_output"); + list($prefix, $_output) = explode("\n", $guess_prefix_output); + Log::debug("prefix is: '$prefix'"); + $restore_params['--sanitize-with-prefix'] = $prefix; + } + + // run the restore command + Artisan::call('snipeit:restore', + $restore_params + ); // If it's greater than 300, it probably worked $output = Artisan::output(); diff --git a/app/Http/Controllers/StatuslabelsController.php b/app/Http/Controllers/StatuslabelsController.php index 535117e97..21a7c798b 100755 --- a/app/Http/Controllers/StatuslabelsController.php +++ b/app/Http/Controllers/StatuslabelsController.php @@ -69,7 +69,7 @@ class StatuslabelsController extends Controller // Save the Statuslabel data $statusLabel->name = $request->input('name'); - $statusLabel->user_id = Auth::id(); + $statusLabel->created_by = auth()->id(); $statusLabel->notes = $request->input('notes'); $statusLabel->deployable = $statusType['deployable']; $statusLabel->pending = $statusType['pending']; diff --git a/app/Http/Controllers/SuppliersController.php b/app/Http/Controllers/SuppliersController.php index e96e32b84..605bb66f6 100755 --- a/app/Http/Controllers/SuppliersController.php +++ b/app/Http/Controllers/SuppliersController.php @@ -62,7 +62,7 @@ class SuppliersController extends Controller $supplier->email = request('email'); $supplier->notes = request('notes'); $supplier->url = $supplier->addhttp(request('url')); - $supplier->user_id = Auth::id(); + $supplier->created_by = auth()->id(); $supplier = $request->handleImages($supplier); if ($supplier->save()) { diff --git a/app/Http/Controllers/Users/BulkUsersController.php b/app/Http/Controllers/Users/BulkUsersController.php index 1a8f84b7a..fbf08c982 100644 --- a/app/Http/Controllers/Users/BulkUsersController.php +++ b/app/Http/Controllers/Users/BulkUsersController.php @@ -13,6 +13,7 @@ use App\Models\Group; use App\Models\LicenseSeat; use App\Models\ConsumableAssignment; use App\Models\Consumable; +use App\Models\Setting; use App\Models\User; use Carbon\Carbon; use Illuminate\Http\Request; @@ -30,12 +31,12 @@ class BulkUsersController extends Controller * @author [A. Gianotto] [] * @since [v1.7] * @param Request $request - * @return \Illuminate\Contracts\View\View + * @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse * @throws \Illuminate\Auth\Access\AuthorizationException */ public function edit(Request $request) { - $this->authorize('update', User::class); + $this->authorize('view', User::class); // Make sure there were users selected if (($request->filled('ids')) && (count($request->input('ids')) > 0)) { @@ -47,16 +48,18 @@ class BulkUsersController extends Controller // bulk edit, display the bulk edit form if ($request->input('bulk_actions') == 'edit') { + $this->authorize('update', User::class); return view('users/bulk-edit', compact('users')) ->with('groups', Group::pluck('name', 'id')); // bulk delete, display the bulk delete confirmation form } elseif ($request->input('bulk_actions') == 'delete') { + $this->authorize('delete', User::class); return view('users/confirm-bulk-delete')->with('users', $users)->with('statuslabel_list', Helper::statusLabelList()); // merge, confirm they have at least 2 users selected and display the merge screen } elseif ($request->input('bulk_actions') == 'merge') { - + $this->authorize('delete', User::class); if (($request->filled('ids')) && (count($request->input('ids')) > 1)) { return view('users/confirm-merge')->with('users', $users); // Not enough users selected, send them back @@ -76,6 +79,33 @@ class BulkUsersController extends Controller } return redirect()->back()->with('success', trans('admin/users/message.password_resets_sent')); + } elseif ($request->input('bulk_actions') == 'print') { + $users = User::query() + ->with([ + 'assets.assetlog', + 'assets.assignedAssets.assetlog', + 'assets.assignedAssets.defaultLoc', + 'assets.assignedAssets.location', + 'assets.assignedAssets.model.category', + 'assets.defaultLoc', + 'assets.location', + 'assets.model.category', + 'accessories.assetlog', + 'accessories.category', + 'accessories.manufacturer', + 'consumables.assetlog', + 'consumables.category', + 'consumables.manufacturer', + 'licenses.category', + ]) + ->withTrashed() + ->findMany($request->input('ids')); + + $users->each(fn($user) => $this->authorize('view', $user)); + + return view('users.print') + ->with('users', $users) + ->with('settings', Setting::getSettings()); } } @@ -101,7 +131,7 @@ class BulkUsersController extends Controller $user_raw_array = $request->input('ids'); // Remove the user from any updates. - $user_raw_array = array_diff($user_raw_array, [Auth::id()]); + $user_raw_array = array_diff($user_raw_array, [auth()->id()]); $manager_conflict = false; $users = User::whereIn('id', $user_raw_array)->where('id', '!=', auth()->id())->get(); @@ -116,6 +146,9 @@ class BulkUsersController extends Controller ->conditionallyAddItem('remote') ->conditionallyAddItem('ldap_import') ->conditionallyAddItem('activated') + ->conditionallyAddItem('start_date') + ->conditionallyAddItem('end_date') + ->conditionallyAddItem('city') ->conditionallyAddItem('autoassign_licenses'); @@ -146,13 +179,24 @@ class BulkUsersController extends Controller $this->update_array['company_id'] = null; } - + if ($request->input('null_start_date')=='1') { + $this->update_array['start_date'] = null; + } + + if ($request->input('null_end_date')=='1') { + $this->update_array['end_date'] = null; + } + + if ($request->input('null_locale')=='1') { + $this->update_array['locale'] = null; + } + if (! $manager_conflict) { $this->conditionallyAddItem('manager_id'); } // Save the updated info User::whereIn('id', $user_raw_array) - ->where('id', '!=', Auth::id())->update($this->update_array); + ->where('id', '!=', auth()->id())->update($this->update_array); if (array_key_exists('location_id', $this->update_array)){ Asset::where('assigned_type', User::class) @@ -214,7 +258,7 @@ class BulkUsersController extends Controller $user_raw_array = request('ids'); - if (($key = array_search(Auth::id(), $user_raw_array)) !== false) { + if (($key = array_search(auth()->id(), $user_raw_array)) !== false) { unset($user_raw_array[$key]); } @@ -279,7 +323,7 @@ class BulkUsersController extends Controller $logAction->item_type = $itemType; $logAction->target_id = $item->assigned_to; $logAction->target_type = User::class; - $logAction->user_id = Auth::id(); + $logAction->created_at = auth()->id(); $logAction->note = 'Bulk checkin items'; $logAction->logaction('checkin from'); } @@ -293,7 +337,7 @@ class BulkUsersController extends Controller $logAction->item_type = Accessory::class; $logAction->target_id = $accessoryUserRow->assigned_to; $logAction->target_type = User::class; - $logAction->user_id = Auth::id(); + $logAction->created_at = auth()->id(); $logAction->note = 'Bulk checkin items'; $logAction->logaction('checkin from'); } @@ -307,7 +351,7 @@ class BulkUsersController extends Controller $logAction->item_type = Consumable::class; $logAction->target_id = $consumableUserRow->assigned_to; $logAction->target_type = User::class; - $logAction->user_id = Auth::id(); + $logAction->created_at = auth()->id(); $logAction->note = 'Bulk checkin items'; $logAction->logaction('checkin from'); } diff --git a/app/Http/Controllers/Users/UserFilesController.php b/app/Http/Controllers/Users/UserFilesController.php index ded44f35f..e99bfe298 100644 --- a/app/Http/Controllers/Users/UserFilesController.php +++ b/app/Http/Controllers/Users/UserFilesController.php @@ -7,9 +7,6 @@ use App\Http\Controllers\Controller; use App\Http\Requests\UploadFileRequest; use App\Models\Actionlog; use App\Models\User; -use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Input; -use Illuminate\Support\Facades\Response; use Symfony\Component\HttpFoundation\JsonResponse; use Illuminate\Support\Facades\Storage; @@ -46,7 +43,7 @@ class UserFilesController extends Controller $logAction = new Actionlog(); $logAction->item_id = $user->id; $logAction->item_type = User::class; - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->note = $request->input('notes'); $logAction->target_id = null; $logAction->created_at = date("Y-m-d H:i:s"); @@ -116,31 +113,30 @@ class UserFilesController extends Controller public function show($userId = null, $fileId = null) { + if (empty($fileId)) { return redirect()->route('users.show')->with('error', 'Invalid file request'); } - $user = User::find($userId); - - // the license is valid - if (isset($user->id)) { + if ($user = User::find($userId)) { $this->authorize('view', $user); if ($log = Actionlog::whereNotNull('filename')->where('item_id', $user->id)->find($fileId)) { + $file = 'private_uploads/users/'.$log->filename; - // Display the file inline - if (request('inline') == 'true') { - $headers = [ - 'Content-Disposition' => 'inline', - ]; - return Storage::download('private_uploads/users/'.$log->filename, $log->filename, $headers); + try { + return StorageHelper::showOrDownloadFile($file, $log->filename); + } catch (\Exception $e) { + return redirect()->route('users.show', ['user' => $user])->with('error', trans('general.file_not_found')); } - - return Storage::download('private_uploads/users/'.$log->filename); } - return redirect()->route('users.index')->with('error', trans('admin/users/message.log_record_not_found')); + // The log record doesn't exist somehow + return redirect()->route('users.show', ['user' => $user])->with('error', trans('general.log_record_not_found')); + + + return redirect()->back()->with('error', trans('general.file_not_found')); } // Redirect to the user management page if the user doesn't exist diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index 1e203e71d..051db1f4e 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -186,7 +186,7 @@ class UsersController extends Controller { $this->authorize('update', User::class); - $user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($id); + $user = User::with(['assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc'])->withTrashed()->find($id); if ($user) { @@ -214,83 +214,79 @@ class UsersController extends Controller * @return \Illuminate\Http\RedirectResponse * @throws \Illuminate\Auth\Access\AuthorizationException */ - public function update(SaveUserRequest $request, $id = null) + public function update(SaveUserRequest $request, User $user) { $this->authorize('update', User::class); // This is a janky hack to prevent people from changing admin demo user data on the public demo. // The $ids 1 and 2 are special since they are seeded as superadmins in the demo seeder. // Thanks, jerks. You are why we can't have nice things. - snipe - - if ((($id == 1) || ($id == 2)) && (config('app.lock_passwords'))) { + if ((($user->id == 1) || ($user->id == 2)) && (config('app.lock_passwords'))) { return redirect()->route('users.index')->with('error', trans('general.permission_denied_superuser_demo')); } - // We need to reverse the UI specific logic for our // permissions here before we update the user. $permissions = $request->input('permissions', []); app('request')->request->set('permissions', $permissions); - $user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($id); + $user->load(['assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc'])->withTrashed(); - // User is valid - continue... - if ($user) { - $this->authorize('update', $user); + $this->authorize('update', $user); - // Figure out of this user was an admin before this edit - $orig_permissions_array = $user->decodePermissions(); - $orig_superuser = '0'; - if (is_array($orig_permissions_array)) { - if (array_key_exists('superuser', $orig_permissions_array)) { - $orig_superuser = $orig_permissions_array['superuser']; - } + // Figure out of this user was an admin before this edit + $orig_permissions_array = $user->decodePermissions(); + $orig_superuser = '0'; + if (is_array($orig_permissions_array)) { + if (array_key_exists('superuser', $orig_permissions_array)) { + $orig_superuser = $orig_permissions_array['superuser']; } + } - // Only save groups if the user is a superuser - if (auth()->user()->isSuperUser()) { - $user->groups()->sync($request->input('groups')); - } + // Only save groups if the user is a superuser + if (auth()->user()->isSuperUser()) { + $user->groups()->sync($request->input('groups')); + } - // Update the user fields - $user->username = trim($request->input('username')); - $user->email = trim($request->input('email')); - $user->first_name = $request->input('first_name'); - $user->last_name = $request->input('last_name'); - $user->two_factor_optin = $request->input('two_factor_optin') ?: 0; - $user->locale = $request->input('locale'); - $user->employee_num = $request->input('employee_num'); - $user->activated = $request->input('activated', 0); - $user->jobtitle = $request->input('jobtitle', null); - $user->phone = $request->input('phone'); - $user->location_id = $request->input('location_id', null); - $user->company_id = Company::getIdForUser($request->input('company_id', null)); - $user->manager_id = $request->input('manager_id', null); - $user->notes = $request->input('notes'); - $user->department_id = $request->input('department_id', null); - $user->address = $request->input('address', null); - $user->city = $request->input('city', null); - $user->state = $request->input('state', null); - $user->country = $request->input('country', null); - // if a user is editing themselves we should always keep activated true - $user->activated = $request->input('activated', $request->user()->is($user) ? 1 : 0); - $user->zip = $request->input('zip', null); - $user->remote = $request->input('remote', 0); - $user->vip = $request->input('vip', 0); - $user->website = $request->input('website', null); - $user->start_date = $request->input('start_date', null); - $user->end_date = $request->input('end_date', null); - $user->autoassign_licenses = $request->input('autoassign_licenses', 0); + // Update the user fields + $user->username = trim($request->input('username')); + $user->email = trim($request->input('email')); + $user->first_name = $request->input('first_name'); + $user->last_name = $request->input('last_name'); + $user->two_factor_optin = $request->input('two_factor_optin') ?: 0; + $user->locale = $request->input('locale'); + $user->employee_num = $request->input('employee_num'); + $user->activated = $request->input('activated', 0); + $user->jobtitle = $request->input('jobtitle', null); + $user->phone = $request->input('phone'); + $user->location_id = $request->input('location_id', null); + $user->company_id = Company::getIdForUser($request->input('company_id', null)); + $user->manager_id = $request->input('manager_id', null); + $user->notes = $request->input('notes'); + $user->department_id = $request->input('department_id', null); + $user->address = $request->input('address', null); + $user->city = $request->input('city', null); + $user->state = $request->input('state', null); + $user->country = $request->input('country', null); + // if a user is editing themselves we should always keep activated true + $user->activated = $request->input('activated', $request->user()->is($user) ? 1 : 0); + $user->zip = $request->input('zip', null); + $user->remote = $request->input('remote', 0); + $user->vip = $request->input('vip', 0); + $user->website = $request->input('website', null); + $user->start_date = $request->input('start_date', null); + $user->end_date = $request->input('end_date', null); + $user->autoassign_licenses = $request->input('autoassign_licenses', 0); - // Update the location of any assets checked out to this user - Asset::where('assigned_type', User::class) - ->where('assigned_to', $user->id) - ->update(['location_id' => $request->input('location_id', null)]); + // Update the location of any assets checked out to this user + Asset::where('assigned_type', User::class) + ->where('assigned_to', $user->id) + ->update(['location_id' => $request->input('location_id', null)]); - // Do we want to update the user password? - if ($request->filled('password')) { - $user->password = bcrypt($request->input('password')); - } + // Do we want to update the user password? + if ($request->filled('password')) { + $user->password = bcrypt($request->input('password')); + } // Update the location of any assets checked out to this user @@ -318,13 +314,7 @@ class UsersController extends Controller return redirect()->to(Helper::getRedirectOption($request, $user->id, 'Users')) ->with('success', trans('admin/users/message.success.update')); } - return redirect()->back()->withInput()->withErrors($user->getErrors()); - - - } - - return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id'))); } /** @@ -382,7 +372,7 @@ class UsersController extends Controller $logaction->item_type = User::class; $logaction->item_id = $user->id; $logaction->created_at = date('Y-m-d H:i:s'); - $logaction->user_id = auth()->id(); + $logaction->created_by = auth()->id(); $logaction->logaction('restore'); // Redirect them to the deleted page if there are more, otherwise the section index @@ -601,29 +591,43 @@ class UsersController extends Controller /** * Print inventory * - * @author Aladin Alaily * @since [v1.8] - * @return \Illuminate\Http\RedirectResponse + * @author Aladin Alaily */ public function printInventory($id) { $this->authorize('view', User::class); - $user = User::where('id', $id)->withTrashed()->first(); - - // Make sure they can view this particular user - $this->authorize('view', $user); + $user = User::where('id', $id) + ->with([ + 'assets.assetlog', + 'assets.assignedAssets.assetlog', + 'assets.assignedAssets.defaultLoc', + 'assets.assignedAssets.location', + 'assets.assignedAssets.model.category', + 'assets.defaultLoc', + 'assets.location', + 'assets.model.category', + 'accessories.assetlog', + 'accessories.category', + 'accessories.manufacturer', + 'consumables.assetlog', + 'consumables.category', + 'consumables.manufacturer', + 'licenses.category', + ]) + ->withTrashed() + ->first(); - $assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model', 'model.category')->get(); - $accessories = $user->accessories()->get(); - $consumables = $user->consumables()->get(); + if ($user) { + $this->authorize('view', $user); - return view('users/print')->with('assets', $assets) - ->with('licenses', $user->licenses()->get()) - ->with('accessories', $accessories) - ->with('consumables', $consumables) - ->with('show_user', $user) - ->with('settings', Setting::getSettings()); + return view('users.print') + ->with('users', [$user]) + ->with('settings', Setting::getSettings()); + } + + return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id'))); } /** diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.php index db4afc832..12c300e5b 100755 --- a/app/Http/Controllers/ViewAssetsController.php +++ b/app/Http/Controllers/ViewAssetsController.php @@ -13,6 +13,7 @@ use App\Notifications\RequestAssetNotification; use Illuminate\Http\Request; use Illuminate\Http\RedirectResponse; use \Illuminate\Contracts\View\View; +use Log; /** * This controller handles all actions related to the ability for users @@ -179,8 +180,11 @@ class ViewAssetsController extends Controller $asset->decrement('requests_counter', 1); $logaction->logaction('request canceled'); - $settings->notify(new RequestAssetCancelation($data)); - + try { + $settings->notify(new RequestAssetCancelation($data)); + } catch (\Exception $e) { + Log::warning($e); + } return redirect()->route('requestable-assets') ->with('success')->with('success', trans('admin/hardware/message.requests.canceled')); } @@ -188,7 +192,11 @@ class ViewAssetsController extends Controller $logaction->logaction('requested'); $asset->request(); $asset->increment('requests_counter', 1); - $settings->notify(new RequestAssetNotification($data)); + try { + $settings->notify(new RequestAssetNotification($data)); + } catch (\Exception $e) { + Log::warning($e); + } return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success')); } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 79027547b..b69e22e4f 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -14,6 +14,7 @@ class Kernel extends HttpKernel * @var array */ protected $middleware = [ + \App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\NoSessionStore::class, \Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance::class, \Illuminate\Session\Middleware\StartSession::class, @@ -21,6 +22,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\CheckForSetup::class, \App\Http\Middleware\CheckForDebug::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, + \App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\SecurityHeaders::class, \App\Http\Middleware\PreventBackHistory::class, \Illuminate\Http\Middleware\HandleCors::class, @@ -51,6 +53,10 @@ class Kernel extends HttpKernel \App\Http\Middleware\CheckLocale::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], + + 'health' => [ + + ], ]; /** @@ -67,5 +73,6 @@ class Kernel extends HttpKernel 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'health' => null, ]; } diff --git a/app/Http/Middleware/CheckForSetup.php b/app/Http/Middleware/CheckForSetup.php index 4e399ffcf..6cb593b5f 100644 --- a/app/Http/Middleware/CheckForSetup.php +++ b/app/Http/Middleware/CheckForSetup.php @@ -7,14 +7,19 @@ use Closure; class CheckForSetup { + + protected $except = [ + '_debugbar*', + 'health' + ]; + public function handle($request, Closure $next, $guard = null) { /** - * This is dumb - * @todo Check on removing this, not sure if it's still needed + * Skip this middleware for the debugbar and health check */ - if ($request->is('_debugbar*')) { + if ($request->is($this->except)) { return $next($request); } @@ -25,7 +30,7 @@ class CheckForSetup return $next($request); } } else { - if (! ($request->is('setup*')) && ! ($request->is('.env')) && ! ($request->is('health'))) { + if (! ($request->is('setup*')) && ! ($request->is('.env'))) { return redirect(config('app.url').'/setup'); } diff --git a/app/Http/Requests/ItemImportRequest.php b/app/Http/Requests/ItemImportRequest.php index 2ea0839c9..a6dc0ad7e 100644 --- a/app/Http/Requests/ItemImportRequest.php +++ b/app/Http/Requests/ItemImportRequest.php @@ -60,7 +60,7 @@ class ItemImportRequest extends FormRequest $fieldMappings = array_change_key_case(array_flip($import->field_map), CASE_LOWER); } $importer->setCallbacks([$this, 'log'], [$this, 'progress'], [$this, 'errorCallback']) - ->setUserId(Auth::id()) + ->setUserId(auth()->id()) ->setUpdating($this->get('import-update')) ->setShouldNotify($this->get('send-welcome')) ->setUsernameFormat('firstname.lastname') diff --git a/app/Http/Requests/SaveUserRequest.php b/app/Http/Requests/SaveUserRequest.php index b38193c15..5a47362cf 100644 --- a/app/Http/Requests/SaveUserRequest.php +++ b/app/Http/Requests/SaveUserRequest.php @@ -6,6 +6,7 @@ use App\Models\Setting; use Illuminate\Contracts\Validation\Validator; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Exceptions\HttpResponseException; +use App\Rules\UserCannotSwitchCompaniesIfItemsAssigned; class SaveUserRequest extends FormRequest { @@ -34,6 +35,7 @@ class SaveUserRequest extends FormRequest $rules = [ 'department_id' => 'nullable|exists:departments,id', 'manager_id' => 'nullable|exists:users,id', + 'company_id' => ['nullable','exists:companies,id'] ]; switch ($this->method()) { @@ -52,11 +54,13 @@ class SaveUserRequest extends FormRequest $rules['first_name'] = 'required|string|min:1'; $rules['username'] = 'required_unless:ldap_import,1|string|min:1'; $rules['password'] = Setting::passwordComplexityRulesSaving('update').'|confirmed'; + $rules['company_id'] = [new UserCannotSwitchCompaniesIfItemsAssigned()]; break; // Save only what's passed case 'PATCH': $rules['password'] = Setting::passwordComplexityRulesSaving('update'); + $rules['company_id'] = [new UserCannotSwitchCompaniesIfItemsAssigned()]; break; default: diff --git a/app/Http/Requests/StoreAssetRequest.php b/app/Http/Requests/StoreAssetRequest.php index b2feb72f7..fb7469ac8 100644 --- a/app/Http/Requests/StoreAssetRequest.php +++ b/app/Http/Requests/StoreAssetRequest.php @@ -9,6 +9,7 @@ use App\Models\Setting; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; use Illuminate\Support\Facades\Gate; +use App\Rules\AssetCannotBeCheckedOutToNondeployableStatus; class StoreAssetRequest extends ImageUploadRequest { @@ -28,7 +29,8 @@ class StoreAssetRequest extends ImageUploadRequest // Guard against users passing in an array for company_id instead of an integer. // If the company_id is not an integer then we simply use what was // provided to be caught by model level validation later. - $idForCurrentUser = is_int($this->company_id) + // The use of is_numeric accounts for 1 and '1'. + $idForCurrentUser = is_numeric($this->company_id) ? Company::getIdForCurrentUser($this->company_id) : $this->company_id; @@ -61,6 +63,7 @@ class StoreAssetRequest extends ImageUploadRequest return array_merge( $modelRules, + ['status_id' => [new AssetCannotBeCheckedOutToNondeployableStatus()]], parent::rules(), ); } diff --git a/app/Http/Requests/StoreLabelSettings.php b/app/Http/Requests/StoreLabelSettings.php new file mode 100644 index 000000000..a203d2702 --- /dev/null +++ b/app/Http/Requests/StoreLabelSettings.php @@ -0,0 +1,41 @@ +|string> + */ + public function rules(): array + { + return [ + 'labels_per_page' => 'numeric', + 'labels_width' => 'numeric', + 'labels_height' => 'numeric', + 'labels_pmargin_left' => 'numeric|nullable', + 'labels_pmargin_right' => 'numeric|nullable', + 'labels_pmargin_top' => 'numeric|nullable', + 'labels_pmargin_bottom' => 'numeric|nullable', + 'labels_display_bgutter' => 'numeric|nullable', + 'labels_display_sgutter' => 'numeric|nullable', + 'labels_fontsize' => 'numeric|min:5', + 'labels_pagewidth' => 'numeric|nullable', + 'labels_pageheight' => 'numeric|nullable', + 'qr_text' => 'max:31|nullable', + ]; + } +} diff --git a/app/Http/Requests/StoreLdapSettings.php b/app/Http/Requests/StoreLdapSettings.php new file mode 100644 index 000000000..419714504 --- /dev/null +++ b/app/Http/Requests/StoreLdapSettings.php @@ -0,0 +1,38 @@ +|string> + */ + public function rules(): array + { + return [ + 'ldap_username_field' => 'not_in:sAMAccountName|required_if:ldap_enabled,1', + 'ldap_auth_filter_query' => 'not_in:uid=samaccountname|required_if:ldap_enabled,1', + 'ldap_filter' => 'nullable|regex:"^[^(]"|required_if:ldap_enabled,1', + 'ldap_server' => 'nullable|required_if:ldap_enabled,1|starts_with:ldap://,ldaps://', + 'ldap_uname' => 'nullable|required_if:ldap_enabled,1', + 'ldap_pword' => 'nullable|required_if:ldap_enabled,1', + 'ldap_basedn' => 'nullable|required_if:ldap_enabled,1', + 'ldap_fname_field' => 'nullable|required_if:ldap_enabled,1', + 'custom_forgot_pass_url' => 'nullable|url', + ]; + } + +} diff --git a/app/Http/Requests/StoreLocalizationSettings.php b/app/Http/Requests/StoreLocalizationSettings.php new file mode 100644 index 000000000..4cea8826e --- /dev/null +++ b/app/Http/Requests/StoreLocalizationSettings.php @@ -0,0 +1,30 @@ +|string> + */ + public function rules(): array + { + return [ + 'default_currency' => 'required', + 'locale' => 'required', + ]; + } +} diff --git a/app/Http/Requests/StoreNotificationSettings.php b/app/Http/Requests/StoreNotificationSettings.php new file mode 100644 index 000000000..13ce5478e --- /dev/null +++ b/app/Http/Requests/StoreNotificationSettings.php @@ -0,0 +1,37 @@ +|string> + */ + public function rules(): array + { + return [ + 'alert_email' => 'email_array|nullable', + 'admin_cc_email' => 'email_array|nullable', + 'alert_threshold' => 'numeric|nullable|gt:0', + 'alert_interval' => 'numeric|nullable|gt:0', + 'audit_warning_days' => 'numeric|nullable|gt:0', + 'due_checkin_days' => 'numeric|nullable|gt:0', + 'audit_interval' => 'numeric|nullable|gt:0', + ]; + } + +} diff --git a/app/Http/Requests/StoreSecuritySettings.php b/app/Http/Requests/StoreSecuritySettings.php new file mode 100644 index 000000000..42a529aa5 --- /dev/null +++ b/app/Http/Requests/StoreSecuritySettings.php @@ -0,0 +1,35 @@ +|string> + */ + public function rules(): array + { + return [ + 'pwd_secure_min' => 'numeric|required|min:8', + 'custom_forgot_pass_url' => 'url|nullable', + 'privacy_policy_link' => 'nullable|url', + 'login_remote_user_enabled' => 'numeric|nullable', + 'login_common_disabled' => 'numeric|nullable', + 'login_remote_user_custom_logout_url' => 'string|nullable', + 'login_remote_user_header_name' => 'string|nullable', + ]; + } +} diff --git a/app/Http/Requests/Traits/MayContainCustomFields.php b/app/Http/Requests/Traits/MayContainCustomFields.php index 9a7f85e3a..bbdf62893 100644 --- a/app/Http/Requests/Traits/MayContainCustomFields.php +++ b/app/Http/Requests/Traits/MayContainCustomFields.php @@ -23,7 +23,7 @@ trait MayContainCustomFields return str_starts_with($attributes, '_snipeit_'); }); // if there are custom fields, find the one's that don't exist on the model's fieldset and add an error to the validator's error bag - if (count($request_fields) > 0) { + if (count($request_fields) > 0 && $validator->errors()->isEmpty()) { $request_fields->diff($asset_model?->fieldset?->fields?->pluck('db_column')) ->each(function ($request_field_name) use ($request_fields, $validator) { if (CustomField::where('db_column', $request_field_name)->exists()) { diff --git a/app/Http/Requests/UpdateAssetRequest.php b/app/Http/Requests/UpdateAssetRequest.php index a749e5816..1b379358f 100644 --- a/app/Http/Requests/UpdateAssetRequest.php +++ b/app/Http/Requests/UpdateAssetRequest.php @@ -4,6 +4,7 @@ namespace App\Http\Requests; use App\Http\Requests\Traits\MayContainCustomFields; use App\Models\Asset; +use App\Models\Setting; use Illuminate\Support\Facades\Gate; use Illuminate\Validation\Rule; @@ -41,6 +42,12 @@ class UpdateAssetRequest extends ImageUploadRequest ], ); + // if the purchase cost is passed in as a string **and** the digit_separator is ',' (as is common in the EU) + // then we tweak the purchase_cost rule to make it a string + if (Setting::getSettings()->digit_separator === '1.234,56' && is_string($this->input('purchase_cost'))) { + $rules['purchase_cost'] = ['nullable', 'string']; + } + return $rules; } } diff --git a/app/Http/Transformers/AccessoriesTransformer.php b/app/Http/Transformers/AccessoriesTransformer.php index c85c4e86f..839576c72 100644 --- a/app/Http/Transformers/AccessoriesTransformer.php +++ b/app/Http/Transformers/AccessoriesTransformer.php @@ -38,9 +38,12 @@ class AccessoriesTransformer 'purchase_cost' => Helper::formatCurrencyOutput($accessory->purchase_cost), 'order_number' => ($accessory->order_number) ? e($accessory->order_number) : null, 'min_qty' => ($accessory->min_amt) ? (int) $accessory->min_amt : null, - 'remaining_qty' => (int) $accessory->numRemaining(), + 'remaining_qty' => (int) ($accessory->qty - $accessory->checkouts_count), 'checkouts_count' => $accessory->checkouts_count, - + 'created_by' => ($accessory->adminuser) ? [ + 'id' => (int) $accessory->adminuser->id, + 'name'=> e($accessory->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($accessory->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($accessory->updated_at, 'datetime'), @@ -57,7 +60,7 @@ class AccessoriesTransformer $permissions_array['user_can_checkout'] = false; - if ($accessory->numRemaining() > 0) { + if (($accessory->qty - $accessory->checkouts_count) > 0) { $permissions_array['user_can_checkout'] = true; } diff --git a/app/Http/Transformers/ActionlogsTransformer.php b/app/Http/Transformers/ActionlogsTransformer.php index 96d74827d..4e6341c8f 100644 --- a/app/Http/Transformers/ActionlogsTransformer.php +++ b/app/Http/Transformers/ActionlogsTransformer.php @@ -141,6 +141,8 @@ class ActionlogsTransformer if ($actionlog->item) { if ($actionlog->itemType() == 'asset') { $file_url = route('show/assetfile', ['assetId' => $actionlog->item->id, 'fileId' => $actionlog->id]); + } elseif ($actionlog->itemType() == 'accessory') { + $file_url = route('show.accessoryfile', ['accessoryId' => $actionlog->item->id, 'fileId' => $actionlog->id]); } elseif ($actionlog->itemType() == 'license') { $file_url = route('show.licensefile', ['licenseId' => $actionlog->item->id, 'fileId' => $actionlog->id]); } elseif ($actionlog->itemType() == 'user') { @@ -158,7 +160,6 @@ class ActionlogsTransformer [ 'url' => $file_url, 'filename' => $actionlog->filename, - 'inlineable' => (bool) Helper::show_file_inline($actionlog->filename), ] : null, 'item' => ($actionlog->item) ? [ @@ -176,11 +177,17 @@ class ActionlogsTransformer 'next_audit_date' => ($actionlog->itemType()=='asset') ? Helper::getFormattedDateObject($actionlog->calcNextAuditDate(null, $actionlog->item), 'date'): null, 'days_to_next_audit' => $actionlog->daysUntilNextAudit($settings->audit_interval, $actionlog->item), 'action_type' => $actionlog->present()->actionType(), - 'admin' => ($actionlog->admin) ? [ - 'id' => (int) $actionlog->admin->id, - 'name' => e($actionlog->admin->getFullNameAttribute()), - 'first_name'=> e($actionlog->admin->first_name), - 'last_name'=> e($actionlog->admin->last_name) + 'admin' => ($actionlog->adminuser) ? [ + 'id' => (int) $actionlog->adminuser->id, + 'name' => e($actionlog->adminuser->getFullNameAttribute()), + 'first_name'=> e($actionlog->adminuser->first_name), + 'last_name'=> e($actionlog->adminuser->last_name) + ] : null, + 'created_by' => ($actionlog->adminuser) ? [ + 'id' => (int) $actionlog->adminuser->id, + 'name' => e($actionlog->adminuser->getFullNameAttribute()), + 'first_name'=> e($actionlog->adminuser->first_name), + 'last_name'=> e($actionlog->adminuser->last_name) ] : null, 'target' => ($actionlog->target) ? [ 'id' => (int) $actionlog->target->id, @@ -340,4 +347,4 @@ class ActionlogsTransformer -} \ No newline at end of file +} diff --git a/app/Http/Transformers/AssetMaintenancesTransformer.php b/app/Http/Transformers/AssetMaintenancesTransformer.php index 88ac447c2..81b4a9eab 100644 --- a/app/Http/Transformers/AssetMaintenancesTransformer.php +++ b/app/Http/Transformers/AssetMaintenancesTransformer.php @@ -64,7 +64,14 @@ class AssetMaintenancesTransformer 'start_date' => Helper::getFormattedDateObject($assetmaintenance->start_date, 'date'), 'asset_maintenance_time' => $assetmaintenance->asset_maintenance_time, 'completion_date' => Helper::getFormattedDateObject($assetmaintenance->completion_date, 'date'), - 'user_id' => ($assetmaintenance->admin) ? ['id' => $assetmaintenance->admin->id, 'name'=> e($assetmaintenance->admin->getFullNameAttribute())] : null, + 'user_id' => ($assetmaintenance->adminuser) ? [ + 'id' => $assetmaintenance->adminuser->id, + 'name'=> e($assetmaintenance->adminuser->present()->fullName()) + ] : null, // legacy to not change the shape of the API + 'created_by' => ($assetmaintenance->adminuser) ? [ + 'id' => (int) $assetmaintenance->adminuser->id, + 'name'=> e($assetmaintenance->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($assetmaintenance->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($assetmaintenance->updated_at, 'datetime'), 'is_warranty'=> $assetmaintenance->is_warranty, diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index 17693fccf..d7ee42324 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -80,6 +80,10 @@ class AssetsTransformer 'assigned_to' => $this->transformAssignedTo($asset), 'warranty_months' => ($asset->warranty_months > 0) ? e($asset->warranty_months.' '.trans('admin/hardware/form.months')) : null, 'warranty_expires' => ($asset->warranty_months > 0) ? Helper::getFormattedDateObject($asset->warranty_expires, 'date') : null, + 'created_by' => ($asset->adminuser) ? [ + 'id' => (int) $asset->adminuser->id, + 'name'=> e($asset->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($asset->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($asset->updated_at, 'datetime'), 'last_audit_date' => Helper::getFormattedDateObject($asset->last_audit_date, 'datetime'), diff --git a/app/Http/Transformers/CategoriesTransformer.php b/app/Http/Transformers/CategoriesTransformer.php index d5e1ceb51..2dd82b3b7 100644 --- a/app/Http/Transformers/CategoriesTransformer.php +++ b/app/Http/Transformers/CategoriesTransformer.php @@ -62,6 +62,10 @@ class CategoriesTransformer 'consumables_count' => (int) $category->consumables_count, 'components_count' => (int) $category->components_count, 'licenses_count' => (int) $category->licenses_count, + 'created_by' => ($category->adminuser) ? [ + 'id' => (int) $category->adminuser->id, + 'name'=> e($category->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($category->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($category->updated_at, 'datetime'), ]; diff --git a/app/Http/Transformers/CompaniesTransformer.php b/app/Http/Transformers/CompaniesTransformer.php index fe8befc27..530df3204 100644 --- a/app/Http/Transformers/CompaniesTransformer.php +++ b/app/Http/Transformers/CompaniesTransformer.php @@ -30,14 +30,18 @@ class CompaniesTransformer 'fax' => ($company->fax!='') ? e($company->fax): null, 'email' => ($company->email!='') ? e($company->email): null, 'image' => ($company->image) ? Storage::disk('public')->url('companies/'.e($company->image)) : null, - 'created_at' => Helper::getFormattedDateObject($company->created_at, 'datetime'), - 'updated_at' => Helper::getFormattedDateObject($company->updated_at, 'datetime'), 'assets_count' => (int) $company->assets_count, 'licenses_count' => (int) $company->licenses_count, 'accessories_count' => (int) $company->accessories_count, 'consumables_count' => (int) $company->consumables_count, 'components_count' => (int) $company->components_count, 'users_count' => (int) $company->users_count, + 'created_by' => ($company->adminuser) ? [ + 'id' => (int) $company->adminuser->id, + 'name'=> e($company->adminuser->present()->fullName()), + ] : null, + 'created_at' => Helper::getFormattedDateObject($company->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($company->updated_at, 'datetime'), ]; $permissions_array['available_actions'] = [ diff --git a/app/Http/Transformers/ComponentsTransformer.php b/app/Http/Transformers/ComponentsTransformer.php index d18870bdc..f98edd6e3 100644 --- a/app/Http/Transformers/ComponentsTransformer.php +++ b/app/Http/Transformers/ComponentsTransformer.php @@ -38,6 +38,8 @@ class ComponentsTransformer 'name' => e($component->category->name), ] : null, 'supplier' => ($component->supplier) ? ['id' => $component->supplier->id, 'name'=> e($component->supplier->name)] : null, + 'manufacturer' => ($component->manufacturer) ? ['id' => $component->manufacturer->id, 'name'=> e($component->manufacturer->name)] : null, + 'model_number' => ($component->model_number) ? e($component->model_number) : null, 'order_number' => e($component->order_number), 'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'), 'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost), @@ -47,6 +49,10 @@ class ComponentsTransformer 'name' => e($component->company->name), ] : null, 'notes' => ($component->notes) ? Helper::parseEscapedMarkedownInline($component->notes) : null, + 'created_by' => ($component->adminuser) ? [ + 'id' => (int) $component->adminuser->id, + 'name'=> e($component->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($component->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($component->updated_at, 'datetime'), 'user_can_checkout' => ($component->numRemaining() > 0) ? 1 : 0, diff --git a/app/Http/Transformers/ConsumablesTransformer.php b/app/Http/Transformers/ConsumablesTransformer.php index d0ae57eef..b31e31ac9 100644 --- a/app/Http/Transformers/ConsumablesTransformer.php +++ b/app/Http/Transformers/ConsumablesTransformer.php @@ -40,6 +40,10 @@ class ConsumablesTransformer 'purchase_date' => Helper::getFormattedDateObject($consumable->purchase_date, 'date'), 'qty' => (int) $consumable->qty, 'notes' => ($consumable->notes) ? Helper::parseEscapedMarkedownInline($consumable->notes) : null, + 'created_by' => ($consumable->adminuser) ? [ + 'id' => (int) $consumable->adminuser->id, + 'name'=> e($consumable->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($consumable->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($consumable->updated_at, 'datetime'), ]; diff --git a/app/Http/Transformers/DepreciationReportTransformer.php b/app/Http/Transformers/DepreciationReportTransformer.php index 47d1cbc47..33d9a1f5f 100644 --- a/app/Http/Transformers/DepreciationReportTransformer.php +++ b/app/Http/Transformers/DepreciationReportTransformer.php @@ -63,15 +63,12 @@ class DepreciationReportTransformer */ if (($asset->model) && ($asset->model->depreciation)) { $depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue()); - if($asset->model->eol==0 || $asset->model->eol==null ){ - $monthly_depreciation = Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months); - } - else { - $monthly_depreciation = Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0)); - } + $monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months); $diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue())); } - + else if($asset->model->eol !== null) { + $monthly_depreciation = Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0)); + } if ($asset->assigned) { $checkout_target = $asset->assigned->name; diff --git a/app/Http/Transformers/DepreciationsTransformer.php b/app/Http/Transformers/DepreciationsTransformer.php index 87e2ddaca..64d4c88f7 100644 --- a/app/Http/Transformers/DepreciationsTransformer.php +++ b/app/Http/Transformers/DepreciationsTransformer.php @@ -28,6 +28,13 @@ class DepreciationsTransformer 'name' => e($depreciation->name), 'months' => $depreciation->months.' '.trans('general.months'), 'depreciation_min' => $depreciation->depreciation_type === 'percent' ? $depreciation->depreciation_min.'%' : $depreciation->depreciation_min, + 'assets_count' => $depreciation->assets_count, + 'models_count' => $depreciation->models_count, + 'licenses_count' => $depreciation->licenses_count, + 'created_by' => ($depreciation->adminuser) ? [ + 'id' => (int) $depreciation->adminuser->id, + 'name'=> e($depreciation->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($depreciation->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($depreciation->updated_at, 'datetime') ]; diff --git a/app/Http/Transformers/GroupsTransformer.php b/app/Http/Transformers/GroupsTransformer.php index bf7e2bfd7..03e96d562 100644 --- a/app/Http/Transformers/GroupsTransformer.php +++ b/app/Http/Transformers/GroupsTransformer.php @@ -26,7 +26,10 @@ class GroupsTransformer 'name' => e($group->name), 'permissions' => json_decode($group->permissions), 'users_count' => (int) $group->users_count, - 'created_by' => ($group->admin) ? e($group->admin->present()->fullName) : null, + 'created_by' => ($group->adminuser) ? [ + 'id' => (int) $group->adminuser->id, + 'name'=> e($group->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($group->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($group->updated_at, 'datetime'), ]; diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index 4fad9b9a6..673ac06b3 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -61,7 +61,7 @@ class LicensesTransformer 'checkin' => Gate::allows('checkin', License::class), 'clone' => Gate::allows('create', License::class), 'update' => Gate::allows('update', License::class), - 'delete' => (Gate::allows('delete', License::class) && ($license->seats == $license->availCount()->count())) ? true : false, + 'delete' => (Gate::allows('delete', License::class) && ($license->free_seats_count > 0)) ? true : false, ]; $array += $permissions_array; diff --git a/app/Http/Transformers/ManufacturersTransformer.php b/app/Http/Transformers/ManufacturersTransformer.php index 9c84fd50f..d6954c1d2 100644 --- a/app/Http/Transformers/ManufacturersTransformer.php +++ b/app/Http/Transformers/ManufacturersTransformer.php @@ -36,6 +36,11 @@ class ManufacturersTransformer 'licenses_count' => (int) $manufacturer->licenses_count, 'consumables_count' => (int) $manufacturer->consumables_count, 'accessories_count' => (int) $manufacturer->accessories_count, + 'components_count' => (int) $manufacturer->components_count, + 'created_by' => ($manufacturer->adminuser) ? [ + 'id' => (int) $manufacturer->adminuser->id, + 'name'=> e($manufacturer->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($manufacturer->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($manufacturer->updated_at, 'datetime'), 'deleted_at' => Helper::getFormattedDateObject($manufacturer->deleted_at, 'datetime'), diff --git a/app/Http/Transformers/PredefinedKitsTransformer.php b/app/Http/Transformers/PredefinedKitsTransformer.php index a5d37e5c7..b5de12fc0 100644 --- a/app/Http/Transformers/PredefinedKitsTransformer.php +++ b/app/Http/Transformers/PredefinedKitsTransformer.php @@ -2,6 +2,7 @@ namespace App\Http\Transformers; +use App\Helpers\Helper; use App\Models\PredefinedKit; use App\Models\SnipeModel; use Illuminate\Support\Facades\Gate; @@ -30,6 +31,12 @@ class PredefinedKitsTransformer $array = [ 'id' => (int) $kit->id, 'name' => e($kit->name), + 'created_by' => ($kit->adminuser) ? [ + 'id' => (int) $kit->adminuser->id, + 'name'=> e($kit->adminuser->present()->fullName()), + ] : null, + 'created_at' => Helper::getFormattedDateObject($kit->created_at, 'datetime'), + 'updated_at' => Helper::getFormattedDateObject($kit->updated_at, 'datetime'), ]; $permissions_array['available_actions'] = [ diff --git a/app/Http/Transformers/StatuslabelsTransformer.php b/app/Http/Transformers/StatuslabelsTransformer.php index 41dd33606..751edb701 100644 --- a/app/Http/Transformers/StatuslabelsTransformer.php +++ b/app/Http/Transformers/StatuslabelsTransformer.php @@ -30,6 +30,10 @@ class StatuslabelsTransformer 'default_label' => ($statuslabel->default_label == '1') ? true : false, 'assets_count' => (int) $statuslabel->assets_count, 'notes' => e($statuslabel->notes), + 'created_by' => ($statuslabel->adminuser) ? [ + 'id' => (int) $statuslabel->adminuser->id, + 'name'=> e($statuslabel->adminuser->present()->fullName()), + ] : null, 'created_at' => Helper::getFormattedDateObject($statuslabel->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($statuslabel->updated_at, 'datetime'), ]; diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index 781a6311f..1112a04e3 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -177,7 +177,7 @@ class AssetImporter extends ItemImporter $this->log('Asset '.$this->item['name'].' with serial number '.$this->item['serial'].' was created'); // If we have a target to checkout to, lets do so. - //-- user_id is a property of the abstract class Importer, which this class inherits from and it's set by + //-- created_by is a property of the abstract class Importer, which this class inherits from and it's set by //-- the class that needs to use it (command importer or GUI importer inside the project). if (isset($target) && ($target !== false)) { if (!is_null($asset->assigned_to)){ @@ -186,7 +186,7 @@ class AssetImporter extends ItemImporter } } - $asset->fresh()->checkOut($target, $this->user_id, $checkout_date, null, 'Checkout from CSV Importer', $asset->name); + $asset->fresh()->checkOut($target, $this->created_by, $checkout_date, null, 'Checkout from CSV Importer', $asset->name); } return; diff --git a/app/Importer/ComponentImporter.php b/app/Importer/ComponentImporter.php index f72d4cbfd..9687ec4f1 100644 --- a/app/Importer/ComponentImporter.php +++ b/app/Importer/ComponentImporter.php @@ -58,7 +58,7 @@ class ComponentImporter extends ItemImporter if (isset($this->item['asset_tag']) && ($asset = Asset::where('asset_tag', $this->item['asset_tag'])->first())) { $component->assets()->attach($component->id, [ 'component_id' => $component->id, - 'user_id' => $this->user_id, + 'created_by' => $this->created_by, 'created_at' => date('Y-m-d H:i:s'), 'assigned_qty' => 1, // Only assign the first one to the asset 'asset_id' => $asset->id, diff --git a/app/Importer/Importer.php b/app/Importer/Importer.php index c2214ef37..6f2816c7a 100644 --- a/app/Importer/Importer.php +++ b/app/Importer/Importer.php @@ -21,8 +21,7 @@ abstract class Importer * Id of User performing import * @var */ - - protected $user_id; + protected $created_by; /** * Are we updating items in the import * @var bool @@ -149,21 +148,28 @@ abstract class Importer { $headerRow = $this->csv->fetchOne(); $this->csv->setHeaderOffset(0); //explicitly sets the CSV document header record - $results = $this->normalizeInputArray($this->csv->getRecords($headerRow)); $this->populateCustomFields($headerRow); - DB::transaction(function () use (&$results) { + DB::transaction(function () use ($headerRow) { + $importedItemsCount = 0; Model::unguard(); - $resultsCount = count($results); - foreach ($results as $row) { + + foreach ($this->csv->getRecords($headerRow) as $row) { + //Lowercase header values to ensure we're comparing values properly. + $row = array_change_key_case($row, CASE_LOWER); + $this->handle($row); + + $importedItemsCount++; + if ($this->progressCallback) { - call_user_func($this->progressCallback, $resultsCount); + call_user_func($this->progressCallback, $importedItemsCount); } $this->log('------------- Action Summary ----------------'); } + Model::reguard(); }); } @@ -236,22 +242,6 @@ abstract class Importer return $key; } - /** - * Used to lowercase header values to ensure we're comparing values properly. - * - * @param $results - * @return array - */ - public function normalizeInputArray($results) - { - $newArray = []; - foreach ($results as $index => $arrayToNormalize) { - $newArray[$index] = array_change_key_case($arrayToNormalize); - } - - return $newArray; - } - /** * Figure out the fieldname of the custom field * @@ -395,7 +385,7 @@ abstract class Importer } /** - * Matches a user by user_id if user_name provided is a number + * Matches a user by created_by if user_name provided is a number * @param string $user_name users full name from csv * @return User User Matching ID */ @@ -412,13 +402,13 @@ abstract class Importer /** * Sets the Id of User performing import. * - * @param mixed $user_id the user id + * @param mixed $created_by the user id * * @return self */ - public function setUserId($user_id) + public function setUserId($created_by) { - $this->user_id = $user_id; + $this->created_by = $created_by; return $this; } diff --git a/app/Importer/ItemImporter.php b/app/Importer/ItemImporter.php index 56c9a3cb0..16ae494c1 100644 --- a/app/Importer/ItemImporter.php +++ b/app/Importer/ItemImporter.php @@ -94,7 +94,7 @@ class ItemImporter extends Importer $this->item['qty'] = $this->findCsvMatch($row, 'quantity'); $this->item['requestable'] = $this->findCsvMatch($row, 'requestable'); - $this->item['user_id'] = $this->user_id; + $this->item['created_by'] = $this->created_by; $this->item['serial'] = $this->findCsvMatch($row, 'serial'); // NO need to call this method if we're running the user import. // TODO: Merge these methods. @@ -309,7 +309,7 @@ class ItemImporter extends Importer $category = new Category(); $category->name = $asset_category; $category->category_type = $item_type; - $category->user_id = $this->user_id; + $category->created_by = $this->created_by; if ($category->save()) { $this->log('Category '.$asset_category.' was created'); @@ -433,7 +433,7 @@ class ItemImporter extends Importer //Otherwise create a manufacturer. $manufacturer = new Manufacturer(); $manufacturer->name = trim($item_manufacturer); - $manufacturer->user_id = $this->user_id; + $manufacturer->created_by = $this->created_by; if ($manufacturer->save()) { $this->log('Manufacturer '.$manufacturer->name.' was created'); @@ -474,7 +474,7 @@ class ItemImporter extends Importer $location->city = ''; $location->state = ''; $location->country = ''; - $location->user_id = $this->user_id; + $location->created_by = $this->created_by; if ($location->save()) { $this->log('Location '.$asset_location.' was created'); @@ -510,7 +510,7 @@ class ItemImporter extends Importer $supplier = new Supplier(); $supplier->name = $item_supplier; - $supplier->user_id = $this->user_id; + $supplier->created_by = $this->created_by; if ($supplier->save()) { $this->log('Supplier '.$item_supplier.' was created'); diff --git a/app/Importer/LicenseImporter.php b/app/Importer/LicenseImporter.php index b7c55cdba..3f7bb9f85 100644 --- a/app/Importer/LicenseImporter.php +++ b/app/Importer/LicenseImporter.php @@ -103,13 +103,13 @@ class LicenseImporter extends ItemImporter if ($checkout_target) { $targetLicense->assigned_to = $checkout_target->id; - $targetLicense->user_id = Auth::id(); + $targetLicense->created_by = auth()->id(); if ($asset) { $targetLicense->asset_id = $asset->id; } $targetLicense->save(); } elseif ($asset) { - $targetLicense->user_id = Auth::id(); + $targetLicense->created_by = auth()->id(); $targetLicense->asset_id = $asset->id; $targetLicense->save(); } diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php index e344b6bea..b3ef59d24 100644 --- a/app/Importer/LocationImporter.php +++ b/app/Importer/LocationImporter.php @@ -65,7 +65,7 @@ class LocationImporter extends ItemImporter $this->item['ldap_ou'] = trim($this->findCsvMatch($row, 'ldap_ou')); $this->item['manager'] = trim($this->findCsvMatch($row, 'manager')); $this->item['manager_username'] = trim($this->findCsvMatch($row, 'manager_username')); - $this->item['user_id'] = auth()->id(); + $this->item['created_by'] = auth()->id(); if ($this->findCsvMatch($row, 'parent_location')) { $this->item['parent_id'] = $this->createOrFetchLocation(trim($this->findCsvMatch($row, 'parent_location'))); diff --git a/app/Importer/UserImporter.php b/app/Importer/UserImporter.php index 4a8d76b68..036bf15c9 100644 --- a/app/Importer/UserImporter.php +++ b/app/Importer/UserImporter.php @@ -165,7 +165,7 @@ class UserImporter extends ItemImporter $department = new department(); $department->name = $department_name; - $department->user_id = $this->user_id; + $department->created_by = $this->created_by; if ($department->save()) { $this->log('department ' . $department_name . ' was created'); diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 5968632fd..8fa96acb6 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -3,14 +3,22 @@ namespace App\Listeners; use App\Events\CheckoutableCheckedOut; +use App\Mail\CheckinAccessoryMail; +use App\Mail\CheckinLicenseMail; +use App\Mail\CheckoutAccessoryMail; +use App\Mail\CheckoutAssetMail; +use App\Mail\CheckinAssetMail; +use App\Mail\CheckoutConsumableMail; +use App\Mail\CheckoutLicenseMail; use App\Models\Accessory; use App\Models\Asset; use App\Models\CheckoutAcceptance; use App\Models\Component; use App\Models\Consumable; use App\Models\LicenseSeat; -use App\Models\Recipients\AdminRecipient; +use App\Models\Location; use App\Models\Setting; +use App\Models\User; use App\Notifications\CheckinAccessoryNotification; use App\Notifications\CheckinAssetNotification; use App\Notifications\CheckinLicenseSeatNotification; @@ -19,9 +27,11 @@ use App\Notifications\CheckoutAssetNotification; use App\Notifications\CheckoutConsumableNotification; use App\Notifications\CheckoutLicenseSeatNotification; use GuzzleHttp\Exception\ClientException; +use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Notification; use Exception; use Illuminate\Support\Facades\Log; +use Osama\LaravelTeamsNotification\TeamsNotification; class CheckoutableListener { @@ -42,32 +52,56 @@ class CheckoutableListener /** * Make a checkout acceptance and attach it in the notification */ + $settings = Setting::getSettings(); $acceptance = $this->getCheckoutAcceptance($event); + $adminCcEmailsArray = []; + if($settings->admin_cc_email !== '') { + $adminCcEmail = $settings->admin_cc_email; + $adminCcEmailsArray = array_map('trim', explode(',', $adminCcEmail)); + } + $ccEmails = array_filter($adminCcEmailsArray); + $mailable = $this->getCheckoutMailType($event, $acceptance); + $notifiable = $this->getNotifiables($event); + + if (!$event->checkedOutTo->locale){ + $mailable->locale($event->checkedOutTo->locale); + } + // Send email notifications try { - if (! $event->checkedOutTo->locale) { - Notification::locale(Setting::getSettings()->locale)->send( - $this->getNotifiables($event), - $this->getCheckoutNotification($event, $acceptance) - ); - } else { - Notification::send( - $this->getNotifiables($event), - $this->getCheckoutNotification($event, $acceptance) - ); - } + /** + * Send an email if any of the following conditions are met: + * 1. The asset requires acceptance + * 2. The item has a EULA + * 3. The item should send an email at check-in/check-out + */ - if ($this->shouldSendWebhookNotification()) { - - //slack doesn't include the url in its messaging format so this is needed to hit the endpoint - - if(Setting::getSettings()->webhook_selected =='slack' || Setting::getSettings()->webhook_selected =='general') { - - - Notification::route('slack', Setting::getSettings()->webhook_endpoint) - ->notify($this->getCheckoutNotification($event)); - } - } + if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || + (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { + if (!empty($notifiable)) { + Mail::to($notifiable)->cc($ccEmails)->send($mailable); + } elseif (!empty($ccEmails)) { + Mail::cc($ccEmails)->send($mailable); + } + Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default')); + } + } catch (ClientException $e) { + Log::debug("Exception caught during checkout email: " . $e->getMessage()); + } catch (Exception $e) { + Log::debug("Exception caught during checkout email: " . $e->getMessage()); + } +// Send Webhook notification + try{ + if ($this->shouldSendWebhookNotification()) { + if (Setting::getSettings()->webhook_selected === 'microsoft') { + $message = $this->getCheckoutNotification($event)->toMicrosoftTeams(); + $notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint); + $notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams + } else { + Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) + ->notify($this->getCheckoutNotification($event, $acceptance)); + } + } } catch (ClientException $e) { Log::debug("Exception caught during checkout notification: " . $e->getMessage()); } catch (Exception $e) { @@ -75,6 +109,7 @@ class CheckoutableListener } } + /** * Notify the user and post to webhook about the checked in checkoutable */ @@ -100,31 +135,51 @@ class CheckoutableListener } } } + $settings = Setting::getSettings(); + $adminCcEmailsArray = []; + if($settings->admin_cc_email !== '') { + $adminCcEmail = $settings->admin_cc_email; + $adminCcEmailsArray = array_map('trim', explode(',', $adminCcEmail)); + } + $ccEmails = array_filter($adminCcEmailsArray); + $mailable = $this->getCheckinMailType($event); + $notifiable = $this->getNotifiables($event); + + if (!$event->checkedOutTo->locale){ + $mailable->locale($event->checkedOutTo->locale); + } + // Send email notifications try { - // Use default locale - if (! $event->checkedOutTo->locale) { - Notification::locale(Setting::getSettings()->locale)->send( - $this->getNotifiables($event), - $this->getCheckinNotification($event) - ); - } else { - Notification::send( - $this->getNotifiables($event), - $this->getCheckinNotification($event) - ); - } - //slack doesn't include the url in its messaging format so this is needed to hit the endpoint - if(Setting::getSettings()->webhook_selected =='slack' || Setting::getSettings()->webhook_selected =='general') { + /** + * Send an email if any of the following conditions are met: + * 1. The asset requires acceptance + * 2. The item has a EULA + * 3. The item should send an email at check-in/check-out + */ + if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || + (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { + if (!empty($notifiable)) { + Mail::to($notifiable)->cc($ccEmails)->send($mailable); + } elseif (!empty($ccEmails)){ + Mail::cc($ccEmails)->send($mailable); + } + Log::info('Sending email, Locale: ' . $event->checkedOutTo->locale); + } + } catch (ClientException $e) { + Log::debug("Exception caught during checkin email: " . $e->getMessage()); + } catch (Exception $e) { + Log::debug("Exception caught during checkin email: " . $e->getMessage()); + } - if ($this->shouldSendWebhookNotification()) { - Notification::route('slack', Setting::getSettings()->webhook_endpoint) + // Send Webhook notification + try { + if ($this->shouldSendWebhookNotification()) { + Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) ->notify($this->getCheckinNotification($event)); } - } - } catch (ClientException $e) { - Log::warning("Exception caught during checkout notification: " . $e->getMessage()); + Log::warning("Exception caught during checkin notification: " . $e->getMessage()); } catch (Exception $e) { Log::warning("Exception caught during checkin notification: " . $e->getMessage()); } @@ -153,33 +208,6 @@ class CheckoutableListener return $acceptance; } - /** - * Gets the entities to be notified of the passed event - * - * @param Event $event - * @return Collection - */ - private function getNotifiables($event) - { - $notifiables = collect(); - - /** - * Notify who checked out the item as long as the model can route notifications - */ - if (method_exists($event->checkedOutTo, 'routeNotificationFor')) { - $notifiables->push($event->checkedOutTo); - } - - /** - * Notify Admin users if the settings is activated - */ - if ((Setting::getSettings()) && (Setting::getSettings()->admin_cc_email != '')) { - $notifiables->push(new AdminRecipient()); - } - - return $notifiables; - } - /** * Get the appropriate notification for the event * @@ -228,7 +256,7 @@ class CheckoutableListener break; case Consumable::class: $notificationClass = CheckoutConsumableNotification::class; - break; + break; case LicenseSeat::class: $notificationClass = CheckoutLicenseSeatNotification::class; break; @@ -237,6 +265,43 @@ class CheckoutableListener return new $notificationClass($event->checkoutable, $event->checkedOutTo, $event->checkedOutBy, $acceptance, $event->note); } + private function getCheckoutMailType($event, $acceptance){ + $lookup = [ + Accessory::class => CheckoutAccessoryMail::class, + Asset::class => CheckoutAssetMail::class, + LicenseSeat::class => CheckoutLicenseMail::class, + Consumable::class => CheckoutConsumableMail::class, + ]; + $mailable= $lookup[get_class($event->checkoutable)]; + + return new $mailable($event->checkoutable, $event->checkedOutTo, $event->checkedOutBy, $event->note, $acceptance); + + } + private function getCheckinMailType($event){ + $lookup = [ + Accessory::class => CheckinAccessoryMail::class, + Asset::class => CheckinAssetMail::class, + LicenseSeat::class => CheckinLicenseMail::class, + ]; + + $mailable= $lookup[get_class($event->checkoutable)]; + + return new $mailable($event->checkoutable, $event->checkedOutTo, $event->checkedInBy, $event->note); + + } + private function getNotifiables($event){ + + if($event->checkedOutTo instanceof Asset){ + $event->checkedOutTo->load('assignedTo'); + return $event->checkedOutTo->assignedto?->email ?? ''; + } + else if($event->checkedOutTo instanceof Location) { + return $event->checkedOutTo->manager?->email ?? ''; + } + else{ + return $event->checkedOutTo->email; + } + } /** * Register the listeners for the subscriber. diff --git a/app/Listeners/LogListener.php b/app/Listeners/LogListener.php index b44fcdfcb..6dbeb7312 100644 --- a/app/Listeners/LogListener.php +++ b/app/Listeners/LogListener.php @@ -111,7 +111,7 @@ class LogListener $logaction->target_type = User::class; $logaction->action_type = 'merged'; $logaction->note = trans('general.merged_log_this_user_from', $to_from_array); - $logaction->user_id = $event->admin->id ?? null; + $logaction->created_by = $event->admin->id ?? null; $logaction->save(); // Add a record to the users being merged TO @@ -122,7 +122,7 @@ class LogListener $logaction->item_type = User::class; $logaction->action_type = 'merged'; $logaction->note = trans('general.merged_log_this_user_into', $to_from_array); - $logaction->user_id = $event->admin->id ?? null; + $logaction->created_by = $event->admin->id ?? null; $logaction->save(); diff --git a/app/Livewire/CustomFieldSetDefaultValuesForModel.php b/app/Livewire/CustomFieldSetDefaultValuesForModel.php index a4a9f9fe7..f45b62ce1 100644 --- a/app/Livewire/CustomFieldSetDefaultValuesForModel.php +++ b/app/Livewire/CustomFieldSetDefaultValuesForModel.php @@ -2,6 +2,8 @@ namespace App\Livewire; +use App\Models\CustomField; +use Livewire\Attributes\Computed; use Livewire\Component; use App\Models\CustomFieldset; @@ -12,37 +14,101 @@ class CustomFieldSetDefaultValuesForModel extends Component public $add_default_values; public $fieldset_id; - public $fields; public $model_id; - public function mount() + public array $selectedValues = []; + + public function mount($model_id = null) { - if(is_null($this->model_id)){ - return; - } - - $this->model = AssetModel::find($this->model_id); // It's possible to do some clever route-model binding here, but let's keep it simple, shall we? - $this->fieldset_id = $this->model->fieldset_id; + $this->model_id = $model_id; + $this->fieldset_id = $this->model?->fieldset_id; + $this->add_default_values = ($this->model?->defaultValues->count() > 0); - $this->fields = null; - - if ($fieldset = CustomFieldset::find($this->fieldset_id)) { - $this->fields = CustomFieldset::find($this->fieldset_id)->fields; - } - - $this->add_default_values = ($this->model->defaultValues->count() > 0); + $this->initializeSelectedValuesArray(); + $this->populatedSelectedValuesArray(); } - public function updatedFieldsetId() + #[Computed] + public function model() { - if (CustomFieldset::find($this->fieldset_id)) { - $this->fields = CustomFieldset::find($this->fieldset_id)->fields; + return AssetModel::find($this->model_id); + } + + #[Computed] + public function fields() + { + $customFieldset = CustomFieldset::find($this->fieldset_id); + + if ($customFieldset) { + return $customFieldset?->fields; } - + + return collect(); } public function render() { return view('livewire.custom-field-set-default-values-for-model'); } + + /** + * Livewire property binding plays nicer with arrays when it knows + * which keys will be present instead of them being + * dynamically added (this is especially true for checkboxes). + * + * Let's go ahead and initialize selectedValues with all the potential keys (custom field db_columns). + * + * @return void + */ + private function initializeSelectedValuesArray(): void + { + CustomField::all()->each(function ($field) { + $this->selectedValues[$field->db_column] = null; + + if ($field->element === 'checkbox') { + $this->selectedValues[$field->db_column] = []; + } + }); + } + + /** + * Populate the selectedValues array with the + * default values or old input for each field. + * + * @return void + */ + private function populatedSelectedValuesArray(): void + { + $this->fields->each(function ($field) { + $this->selectedValues[$field->db_column] = $this->getSelectedValueForField($field); + + // if the element is a checkbox and the value was just sent to null, make it + // an array since Livewire can't bind to non-array values for checkboxes. + if ($field->element === 'checkbox' && is_null($this->selectedValues[$field->db_column])) { + $this->selectedValues[$field->db_column] = []; + } + }); + } + + private function getSelectedValueForField(CustomField $field) + { + $defaultValue = $field->defaultValue($this->model_id); + + // if old() contains a value for default_values that means + // the user has submitted the form and we were redirected + // back with the old input. + // Let's use what they had previously set. + if (old('default_values')) { + $defaultValue = old('default_values.' . $field->id); + } + + // on first load the default value for checkboxes will be + // a comma-separated string but if we're loading the page + // with old input then it was already parsed into an array. + if ($field->element === 'checkbox' && is_string($defaultValue)) { + $defaultValue = explode(', ', $defaultValue); + } + + return $defaultValue; + } } diff --git a/app/Livewire/Importer.php b/app/Livewire/Importer.php index 5af99b35b..164b6411d 100644 --- a/app/Livewire/Importer.php +++ b/app/Livewire/Importer.php @@ -3,30 +3,25 @@ namespace App\Livewire; use App\Models\CustomField; -use Livewire\Component; - use App\Models\Import; use Illuminate\Support\Facades\Storage; - -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; - +use Livewire\Attributes\Computed; +use Livewire\Component; class Importer extends Component { - use AuthorizesRequests; - - public $files; - - public $progress; //upload progress - '-1' means don't show + public $progress = -1; //upload progress - '-1' means don't show public $progress_message; - public $progress_bar_class; + public $progress_bar_class = 'progress-bar-warning'; public $message; //status/error message? public $message_type; //success/error? //originally from ImporterFile public $import_errors; // - public ?Import $activeFile = null; + public $activeFileId; + public $headerRow = []; + public $typeOfImport; public $importTypes; public $columnOptions; public $statusType; @@ -35,7 +30,6 @@ class Importer extends Component public $send_welcome; public $run_backup; public $field_map; // we need a separate variable for the field-mapping, because the keys in the normal array are too complicated for Livewire to understand - public $file_id; // TODO: I can't figure out *why* we need this, but it really seems like we do. I can't seem to pull the id from the activeFile for some reason? // Make these variables public - we set the properties in the constructor so we can localize them (versus the old static arrays) public $accessories_fields; @@ -51,10 +45,8 @@ class Importer extends Component 'files.*.file_path' => 'required|string', 'files.*.created_at' => 'required|string', 'files.*.filesize' => 'required|integer', - 'activeFile' => 'Import', - 'activeFile.import_type' => 'string', - 'activeFile.field_map' => 'array', - 'activeFile.header_row' => 'array', + 'headerRow' => 'array', + 'typeOfImport' => 'string', 'field_map' => 'array' ]; @@ -68,15 +60,13 @@ class Importer extends Component { $tmp = array(); if ($this->activeFile) { - $tmp = array_combine($this->activeFile->header_row, $this->field_map); + $tmp = array_combine($this->headerRow, $this->field_map); $tmp = array_filter($tmp); } return json_encode($tmp); } - - private function getColumns($type) { \Log::error($type); @@ -120,17 +110,15 @@ class Importer extends Component return $results; } - public function updating($name, $new_import_type) + public function updatingTypeOfImport($type) { - if ($name == "activeFile.import_type") { - // go through each header, find a matching field to try and map it to. - foreach ($this->activeFile->header_row as $i => $header) { + foreach ($this->headerRow as $i => $header) { // do we have something mapped already? if (array_key_exists($i, $this->field_map)) { // yes, we do. Is it valid for this type of import? // (e.g. the import type might have been changed...?) - if (array_key_exists($this->field_map[$i], $this->columnOptions[$new_import_type])) { + if (array_key_exists($this->field_map[$i], $this->columnOptions[$type])) { //yes, this key *is* valid. Continue on to the next field. continue; } else { @@ -140,9 +128,9 @@ class Importer extends Component } // TODO - strictly speaking, this isn't necessary here I don't think. } // first, check for exact matches - foreach ($this->columnOptions[$new_import_type] as $value => $text) { + foreach ($this->columnOptions[$type] as $v => $text) { if (strcasecmp($text, $header) === 0) { // case-INSENSITIVe on purpose! - $this->field_map[$i] = $value; + $this->field_map[$i] = $v; continue 2; //don't bother with the alias check, go to the next header } } @@ -154,7 +142,7 @@ class Importer extends Component // Make *absolutely* sure that this key actually _exists_ in this import type - // you can trigger this by importing accessories with a 'Warranty' column (which don't exist // in "Accessories"!) - if (array_key_exists($key, $this->columnOptions[$new_import_type])) { + if (array_key_exists($key, $this->columnOptions[$type])) { $this->field_map[$i] = $key; continue 3; // bust out of both of these loops; as well as the surrounding one - e.g. move on to the next header } @@ -163,20 +151,12 @@ class Importer extends Component } // and if you got here, we got nothing. Let's recommend 'null' $this->field_map[$i] = null; // Booooo :( - } } } - public function boot() { // FIXME - delete or undelete. - ///////$this->activeFile = null; // I do *not* understand why I have to do this, but, well, whatever. - } - - public function mount() { $this->authorize('import'); - $this->progress = -1; // '-1' means 'don't show the progressbar' - $this->progress_bar_class = 'progress-bar-warning'; $this->importTypes = [ 'asset' => trans('general.assets'), 'accessory' => trans('general.accessories'), @@ -191,7 +171,7 @@ class Importer extends Component /** * These are the item-type specific columns */ - $this->accessories_fields = [ + $this->accessories_fields = [ 'company' => trans('general.company'), 'location' => trans('general.location'), 'quantity' => trans('general.qty'), @@ -223,7 +203,6 @@ class Importer extends Component 'supplier' => trans('general.supplier'), 'purchase_cost' => trans('general.purchase_cost'), 'purchase_date' => trans('general.purchase_date'), - 'purchase_order' => trans('admin/licenses/form.purchase_order'), 'asset_notes' => trans('general.item_notes', ['item' => trans('admin/hardware/general.asset')]), 'model_notes' => trans('general.item_notes', ['item' => trans('admin/hardware/form.model')]), 'manufacturer' => trans('general.manufacturer'), @@ -314,7 +293,7 @@ class Importer extends Component 'manufacturer' => trans('general.manufacturer'), ]; - $this->users_fields = [ + $this->users_fields = [ 'id' => trans('general.id'), 'company' => trans('general.company'), 'location' => trans('general.location'), @@ -339,12 +318,12 @@ class Importer extends Component 'website' => trans('general.website'), 'avatar' => trans('general.image'), 'gravatar' => trans('general.importer.gravatar'), - 'start_date' => trans('general.start_date'), - 'end_date' => trans('general.end_date'), - 'employee_num' => trans('general.employee_number'), + 'start_date' => trans('general.start_date'), + 'end_date' => trans('general.end_date'), + 'employee_num' => trans('general.employee_number'), ]; - $this->locations_fields = [ + $this->locations_fields = [ 'name' => trans('general.item_name_var', ['item' => trans('general.location')]), 'address' => trans('general.address'), 'address2' => trans('general.importer.address2'), @@ -529,7 +508,7 @@ class Importer extends Component ]; $this->columnOptions[''] = $this->getColumns(''); //blank mode? I don't know what this is supposed to mean - foreach($this->importTypes AS $type => $name) { + foreach ($this->importTypes as $type => $name) { $this->columnOptions[$type] = $this->getColumns($type); } if ($this->activeFile) { @@ -541,7 +520,7 @@ class Importer extends Component { $this->clearMessage(); - $this->activeFile = Import::find($id); + $this->activeFileId = $id; if (!$this->activeFile) { $this->message = trans('admin/hardware/message.import.file_missing'); @@ -549,10 +528,13 @@ class Importer extends Component return; } - $this->field_map = null; - foreach($this->activeFile->header_row as $element) { + $this->headerRow = $this->activeFile->header_row; + $this->typeOfImport = $this->activeFile->import_type; - if(isset($this->activeFile->field_map[$element])) { + $this->field_map = null; + foreach ($this->headerRow as $element) { + + if (isset($this->activeFile->field_map[$element])) { $this->field_map[] = $this->activeFile->field_map[$element]; } else { $this->field_map[] = null; // re-inject the 'nulls' if a file was imported with some 'Do Not Import' settings @@ -567,16 +549,31 @@ class Importer extends Component public function destroy($id) { - // TODO: why don't we just do File::find($id)? This seems dumb. - foreach($this->files as $file) { - if ($id == $file->id) { - if (Storage::delete('private_uploads/imports/'.$file->file_path)) { - $file->delete(); + $this->authorize('import'); + $import = Import::find($id); + + // Check that the import wasn't deleted after while page was already loaded... + // @todo: next up...handle the file being missing for other interactions... + // for example having an import open in two tabs, deleting it, and then changing + // the import type in the other tab. The error message below wouldn't display in that case. + if (!$import) { + $this->message = trans('admin/hardware/message.import.file_already_deleted'); + $this->message_type = 'danger'; + + return; + } + + if (Storage::delete('private_uploads/imports/' . $import->file_path)) { + $import->delete(); $this->message = trans('admin/hardware/message.import.file_delete_success'); $this->message_type = 'success'; + + unset($this->files); + return; - } else { + } + $this->message = trans('admin/hardware/message.import.file_delete_error'); $this->message_type = 'danger'; } @@ -590,9 +587,20 @@ class Importer extends Component $this->message_type = null; } + #[Computed] + public function files() + { + return Import::orderBy('id', 'desc')->get(); + } + + #[Computed] + public function activeFile() + { + return Import::find($this->activeFileId); + } + public function render() { - $this->files = Import::orderBy('id','desc')->get(); //HACK - slows down renders. return view('livewire.importer') ->extends('layouts.default') ->section('content'); diff --git a/app/Livewire/OauthClients.php b/app/Livewire/OauthClients.php index fda91260c..017e78906 100644 --- a/app/Livewire/OauthClients.php +++ b/app/Livewire/OauthClients.php @@ -47,10 +47,10 @@ class OauthClients extends Component { // test for safety // ->delete must be of type Client - thus the model binding - if ($clientId->user_id == auth()->id()) { + if ($clientId->created_by == auth()->id()) { app(ClientRepository::class)->delete($clientId); } else { - Log::warning('User ' . auth()->id() . ' attempted to delete client ' . $clientId->id . ' which belongs to user ' . $clientId->user_id); + Log::warning('User ' . auth()->id() . ' attempted to delete client ' . $clientId->id . ' which belongs to user ' . $clientId->created_by); $this->authorizationError = 'You are not authorized to delete this client.'; } } @@ -58,10 +58,10 @@ class OauthClients extends Component public function deleteToken($tokenId): void { $token = app(TokenRepository::class)->find($tokenId); - if ($token->user_id == auth()->id()) { + if ($token->created_by == auth()->id()) { app(TokenRepository::class)->revokeAccessToken($tokenId); } else { - Log::warning('User ' . auth()->id() . ' attempted to delete token ' . $tokenId . ' which belongs to user ' . $token->user_id); + Log::warning('User ' . auth()->id() . ' attempted to delete token ' . $tokenId . ' which belongs to user ' . $token->created_by); $this->authorizationError = 'You are not authorized to delete this token.'; } } @@ -84,12 +84,12 @@ class OauthClients extends Component ]); $client = app(ClientRepository::class)->find($editClientId->id); - if ($client->user_id == auth()->id()) { + if ($client->created_by == auth()->id()) { $client->name = $this->editName; $client->redirect = $this->editRedirect; $client->save(); } else { - Log::warning('User ' . auth()->id() . ' attempted to edit client ' . $editClientId->id . ' which belongs to user ' . $client->user_id); + Log::warning('User ' . auth()->id() . ' attempted to edit client ' . $editClientId->id . ' which belongs to user ' . $client->created_by); $this->authorizationError = 'You are not authorized to edit this client.'; } diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php index 45b8b7b41..64196b5dd 100644 --- a/app/Livewire/SlackSettingsForm.php +++ b/app/Livewire/SlackSettingsForm.php @@ -4,10 +4,11 @@ namespace App\Livewire; use GuzzleHttp\Client; use Illuminate\Support\Facades\Http; +use Illuminate\Support\Str; use Livewire\Component; use App\Models\Setting; use App\Helpers\Helper; - +use Osama\LaravelTeamsNotification\TeamsNotification; class SlackSettingsForm extends Component { public $webhook_endpoint; @@ -19,6 +20,7 @@ class SlackSettingsForm extends Component public $webhook_placeholder; public $webhook_icon; public $webhook_selected; + public $teams_webhook_deprecated; public array $webhook_text; public Setting $setting; @@ -62,7 +64,7 @@ class SlackSettingsForm extends Component "name" => trans('admin/settings/general.ms_teams'), "icon" => "fa-brands fa-microsoft", "placeholder" => "https://abcd.webhook.office.com/webhookb2/XXXXXXX", - "link" => "https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet#create-incoming-webhooks-1", + "link" => "https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498", "test" => "msTeamTestWebhook" ), ]; @@ -79,15 +81,17 @@ class SlackSettingsForm extends Component $this->webhook_channel = $this->setting->webhook_channel; $this->webhook_botname = $this->setting->webhook_botname; $this->webhook_options = $this->setting->webhook_selected; - if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ + $this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows'); + if($this->webhook_selected === 'microsoft' || $this->webhook_selected === 'google'){ $this->webhook_channel = '#NA'; } - if($this->setting->webhook_endpoint != null && $this->setting->webhook_channel != null){ $this->isDisabled= ''; } - + if($this->webhook_selected === 'microsoft' && $this->teams_webhook_deprecated) { + session()->flash('warning', 'The selected Microsoft Teams webhook URL will be deprecated Jan 31st, 2025. Please use a workflow URL. Microsofts Documentation on creating a workflow can be found here.'); + } } public function updated($field) { @@ -109,7 +113,6 @@ class SlackSettingsForm extends Component if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ $this->webhook_channel = '#NA'; } - } private function isButtonDisabled() { @@ -126,7 +129,9 @@ class SlackSettingsForm extends Component public function render() { $this->isButtonDisabled(); + return view('livewire.slack-settings-form'); + } public function testWebhook(){ @@ -236,20 +241,32 @@ class SlackSettingsForm extends Component } public function msTeamTestWebhook(){ - $payload = - [ - "@type" => "MessageCard", - "@context" => "http://schema.org/extensions", - "summary" => trans('mail.snipe_webhook_summary'), - "title" => trans('mail.snipe_webhook_test'), - "text" => trans('general.webhook_test_msg', ['app' => $this->webhook_name]), - ]; + try { - try { - $response = Http::withHeaders([ - 'content-type' => 'applications/json', - ])->post($this->webhook_endpoint, - $payload)->throw(); + if($this->teams_webhook_deprecated){ + //will use the deprecated webhook format + $payload = + [ + "@type" => "MessageCard", + "@context" => "http://schema.org/extensions", + "summary" => trans('mail.snipe_webhook_summary'), + "title" => trans('mail.snipe_webhook_test'), + "text" => trans('general.webhook_test_msg', ['app' => $this->webhook_name]), + ]; + $response = Http::withHeaders([ + 'content-type' => 'applications/json', + ])->post($this->webhook_endpoint, + $payload)->throw(); + } + else { + $notification = new TeamsNotification($this->webhook_endpoint); + $message = trans('general.webhook_test_msg', ['app' => $this->webhook_name]); + $notification->success()->sendMessage($message); + + $response = Http::withHeaders([ + 'content-type' => 'applications/json', + ])->post($this->webhook_endpoint); + } if(($response->getStatusCode() == 302)||($response->getStatusCode() == 301)){ return session()->flash('error' , trans('admin/settings/message.webhook.error_redirect', ['endpoint' => $this->webhook_endpoint])); diff --git a/app/Mail/CheckinAccessoryMail.php b/app/Mail/CheckinAccessoryMail.php new file mode 100644 index 000000000..fc8d1455f --- /dev/null +++ b/app/Mail/CheckinAccessoryMail.php @@ -0,0 +1,70 @@ +item = $accessory; + $this->target = $checkedOutTo; + $this->admin = $checkedInby; + $this->note = $note; + $this->settings = Setting::getSettings(); + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + + return new Envelope( + from: $from, + subject: trans('mail.Accessory_Checkin_Notification'), + ); + } + + /** + * Get the message content definition. + */ + public function content(): Content + { + return new Content( + markdown: 'mail.markdown.checkin-accessory', + with: [ + 'item' => $this->item, + 'admin' => $this->admin, + 'note' => $this->note, + 'target' => $this->target, + ] + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Mail/CheckinAssetMail.php b/app/Mail/CheckinAssetMail.php new file mode 100644 index 000000000..5dd8394a5 --- /dev/null +++ b/app/Mail/CheckinAssetMail.php @@ -0,0 +1,93 @@ +target = $checkedOutTo; + $this->item = $asset; + $this->admin = $checkedInBy; + $this->note = $note; + + $this->settings = Setting::getSettings(); + $this->expected_checkin = ''; + + if ($this->item->expected_checkin) { + $this->expected_checkin = Helper::getFormattedDateObject($this->item->expected_checkin, 'date', + false); + } + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + + return new Envelope( + from: $from, + subject: trans('mail.Asset_Checkin_Notification'), + ); + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * @return Content + */ + public function content(): Content + { + $this->item->load('assetstatus'); + $fields = []; + + // Check if the item has custom fields associated with it + if (($this->item->model) && ($this->item->model->fieldset)) { + $fields = $this->item->model->fieldset->fields; + } + + return new Content( + markdown: 'mail.markdown.checkin-asset', + with: [ + 'item' => $this->item, + 'status' => $this->item->assetstatus?->name, + 'admin' => $this->admin, + 'note' => $this->note, + 'target' => $this->target, + 'fields' => $fields, + 'expected_checkin' => $this->expected_checkin, + ], + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Mail/CheckinLicenseMail.php b/app/Mail/CheckinLicenseMail.php new file mode 100644 index 000000000..8957f367e --- /dev/null +++ b/app/Mail/CheckinLicenseMail.php @@ -0,0 +1,71 @@ +target = $checkedOutTo; + $this->item = $licenseSeat; + $this->admin = $checkedInBy; + $this->note = $note; + $this->settings = Setting::getSettings(); + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + + return new Envelope( + from: $from, + subject: trans('mail.License_Checkin_Notification'), + ); + } + + /** + * Get the message content definition. + */ + public function content(): Content + { + return new Content( + markdown: 'mail.markdown.checkin-license', + with: [ + 'license_seat' => $this->item, + 'license' => $this->item->license, + 'admin' => $this->admin, + 'note' => $this->note, + 'target' => $this->target, + ] + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Mail/CheckoutAccessoryMail.php b/app/Mail/CheckoutAccessoryMail.php new file mode 100644 index 000000000..f297c0275 --- /dev/null +++ b/app/Mail/CheckoutAccessoryMail.php @@ -0,0 +1,82 @@ +item = $accessory; + $this->admin = $checkedOutBy; + $this->note = $note; + $this->checkout_qty = $accessory->checkout_qty; + $this->target = $checkedOutTo; + $this->acceptance = $acceptance; + $this->settings = Setting::getSettings(); + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + + return new Envelope( + from: $from, + subject: (trans('mail.Accessory_Checkout_Notification')), + ); + } + + /** + * Get the message content definition. + */ + public function content(): Content + { + Log::debug($this->item->getImageUrl()); + $eula = $this->item->getEula(); + $req_accept = $this->item->requireAcceptance(); + $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); + + return new Content( + markdown: 'mail.markdown.checkout-accessory', + with: [ + 'item' => $this->item, + 'admin' => $this->admin, + 'note' => $this->note, + 'target' => $this->target, + 'eula' => $eula, + 'req_accept' => $req_accept, + 'accept_url' => $accept_url, + 'checkout_qty' => $this->checkout_qty, + ], + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Mail/CheckoutAssetMail.php b/app/Mail/CheckoutAssetMail.php new file mode 100644 index 000000000..fa1290e92 --- /dev/null +++ b/app/Mail/CheckoutAssetMail.php @@ -0,0 +1,110 @@ +item = $asset; + $this->admin = $checkedOutBy; + $this->note = $note; + $this->target = $checkedOutTo; + $this->acceptance = $acceptance; + + $this->settings = Setting::getSettings(); + + $this->last_checkout = ''; + $this->expected_checkin = ''; + + if ($this->item->last_checkout) { + $this->last_checkout = Helper::getFormattedDateObject($this->item->last_checkout, 'date', + false); + } + + if ($this->item->expected_checkin) { + $this->expected_checkin = Helper::getFormattedDateObject($this->item->expected_checkin, 'date', + false); + } + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + $from = new Address(env('MAIL_FROM_ADDR', 'service@snipe-it.io')); + + return new Envelope( + from: $from, + subject: trans('mail.Asset_Checkout_Notification'), + ); + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * @return Content + */ + public function content(): Content + { + $this->item->load('assetstatus'); + $eula = method_exists($this->item, 'getEula') ? $this->item->getEula() : ''; + $req_accept = method_exists($this->item, 'requireAcceptance') ? $this->item->requireAcceptance() : 0; + $fields = []; + + // Check if the item has custom fields associated with it + if (($this->item->model) && ($this->item->model->fieldset)) { + $fields = $this->item->model->fieldset->fields; + } + + $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); + + return new Content( + markdown: 'mail.markdown.checkout-asset', + with: [ + 'item' => $this->item, + 'admin' => $this->admin, + 'status' => $this->item->assetstatus?->name, + 'note' => $this->note, + 'target' => $this->target, + 'fields' => $fields, + 'eula' => $eula, + 'req_accept' => $req_accept, + 'accept_url' => $accept_url, + 'last_checkout' => $this->last_checkout, + 'expected_checkin' => $this->expected_checkin, + ], + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Mail/CheckoutConsumableMail.php b/app/Mail/CheckoutConsumableMail.php new file mode 100644 index 000000000..18fe22825 --- /dev/null +++ b/app/Mail/CheckoutConsumableMail.php @@ -0,0 +1,84 @@ +item = $consumable; + $this->admin = $checkedOutBy; + $this->note = $note; + $this->target = $checkedOutTo; + $this->acceptance = $acceptance; + $this->qty = $consumable->checkout_qty; + + $this->settings = Setting::getSettings(); + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + + return new Envelope( + from: $from, + subject: trans('mail.Confirm_consumable_delivery'), + ); + } + + /** + * Get the message content definition. + */ + public function content(): Content + { + + $eula = $this->item->getEula(); + $req_accept = $this->item->requireAcceptance(); + + $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); + + return new Content( + markdown: 'mail.markdown.checkout-consumable', + with: [ + 'item' => $this->item, + 'admin' => $this->admin, + 'note' => $this->note, + 'target' => $this->target, + 'eula' => $eula, + 'req_accept' => $req_accept, + 'accept_url' => $accept_url, + 'qty' => $this->qty, + ] + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Mail/CheckoutLicenseMail.php b/app/Mail/CheckoutLicenseMail.php new file mode 100644 index 000000000..7377ad340 --- /dev/null +++ b/app/Mail/CheckoutLicenseMail.php @@ -0,0 +1,80 @@ +item = $licenseSeat; + $this->admin = $checkedOutBy; + $this->note = $note; + $this->target = $checkedOutTo; + $this->acceptance = $acceptance; + + $this->settings = Setting::getSettings(); + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + $from = new Address(env('MAIL_FROM_ADDR','service@snipe-it.io')); + + return new Envelope( + from: $from, + subject: trans('mail.Confirm_license_delivery'), + ); + } + + /** + * Get the message content definition. + */ + public function content(): Content + { + $eula = method_exists($this->item, 'getEula') ? $this->item->getEula() : ''; + $req_accept = method_exists($this->item, 'requireAcceptance') ? $this->item->requireAcceptance() : 0; + + $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); + return new Content( + markdown: 'mail.markdown.checkout-license', + with: [ + 'license_seat' => $this->item, + 'license' => $this->item->license, + 'admin' => $this->admin, + 'note' => $this->note, + 'target' => $this->target, + 'eula' => $eula, + 'req_accept' => $req_accept, + 'accept_url' => $accept_url, + ] + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php index c1366f67e..fc1bb36ab 100755 --- a/app/Models/Accessory.php +++ b/app/Models/Accessory.php @@ -62,7 +62,7 @@ class Accessory extends SnipeModel 'category_id' => 'required|integer|exists:categories,id', 'company_id' => 'integer|nullable', 'min_amt' => 'integer|min:0|nullable', - 'purchase_cost' => 'numeric|nullable|gte:0', + 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999', 'purchase_date' => 'date_format:Y-m-d|nullable', ]; @@ -259,6 +259,18 @@ class Accessory extends SnipeModel ->with('assignedTo'); } + /** + * Establishes the accessory -> admin user relationship + * + * @author A. Gianotto + * @since [v7.0.13] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + /** * Checks whether or not the accessory has users * @@ -410,6 +422,16 @@ class Accessory extends SnipeModel * ----------------------------------------------- **/ + + /** + * Query builder scope to order on created_by name + * + */ + public function scopeOrderByCreatedByName($query, $order) + { + return $query->leftJoin('users as admin_sort', 'accessories.created_by', '=', 'admin_sort.id')->select('accessories.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } + /** * Query builder scope to order on company * diff --git a/app/Models/AccessoryCheckout.php b/app/Models/AccessoryCheckout.php index 7f42b354e..bdfbf11d9 100755 --- a/app/Models/AccessoryCheckout.php +++ b/app/Models/AccessoryCheckout.php @@ -22,7 +22,7 @@ class AccessoryCheckout extends Model { use Searchable; - protected $fillable = ['user_id', 'accessory_id', 'assigned_to', 'assigned_type', 'note']; + protected $fillable = ['created_by', 'accessory_id', 'assigned_to', 'assigned_type', 'note']; protected $table = 'accessories_checkout'; /** diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php index 7f3b46e46..008c5b114 100755 --- a/app/Models/Actionlog.php +++ b/app/Models/Actionlog.php @@ -21,7 +21,7 @@ class Actionlog extends SnipeModel // This is to manually set the source (via setActionSource()) for determineActionSource() protected ?string $source = null; - protected $with = ['admin']; + protected $with = ['adminuser']; protected $presenter = \App\Presenters\ActionlogPresenter::class; use SoftDeletes; @@ -32,7 +32,7 @@ class Actionlog extends SnipeModel protected $fillable = [ 'created_at', 'item_type', - 'user_id', + 'created_by', 'item_id', 'action_type', 'note', @@ -52,9 +52,11 @@ class Actionlog extends SnipeModel 'action_type', 'note', 'log_meta', - 'user_id', + 'created_by', 'remote_ip', 'user_agent', + 'item_type', + 'target_type', 'action_source' ]; @@ -64,10 +66,10 @@ class Actionlog extends SnipeModel * @var array */ protected $searchableRelations = [ - 'company' => ['name'], - 'admin' => ['first_name','last_name','username', 'email'], - 'user' => ['first_name','last_name','username', 'email'], - 'assets' => ['asset_tag','name'], + 'company' => ['name'], + 'adminuser' => ['first_name','last_name','username', 'email'], + 'user' => ['first_name','last_name','username', 'email'], + 'assets' => ['asset_tag','name'], ]; /** @@ -198,9 +200,9 @@ class Actionlog extends SnipeModel * @since [v3.0] * @return \Illuminate\Database\Eloquent\Relations\Relation */ - public function admin() + public function adminuser() { - return $this->belongsTo(User::class, 'user_id') + return $this->belongsTo(User::class, 'created_by') ->withTrashed(); } @@ -374,8 +376,8 @@ class Actionlog extends SnipeModel $this->source = $source; } - public function scopeOrderAdmin($query, $order) + public function scopeOrderByCreatedBy($query, $order) { - return $query->leftJoin('users as admin_sort', 'action_logs.user_id', '=', 'admin_sort.id')->select('action_logs.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + return $query->leftJoin('users as admin_sort', 'action_logs.created_by', '=', 'admin_sort.id')->select('action_logs.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); } } diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 98d7275b1..ce8b870eb 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -30,7 +30,7 @@ class Asset extends Depreciable { protected $presenter = AssetPresenter::class; - protected $with = ['model', 'admin']; + protected $with = ['model', 'adminuser']; use CompanyableTrait; use HasFactory, Loggable, Requestable, Presentable, SoftDeletes, ValidatingTrait, UniqueUndeletedTrait; @@ -43,16 +43,16 @@ class Asset extends Depreciable /** * Run after the checkout acceptance was declined by the user - * + * * @param User $acceptedBy * @param string $signature - */ + */ public function declinedCheckout(User $declinedBy, $signature) { $this->assigned_to = null; $this->assigned_type = null; - $this->accepted = null; - $this->save(); + $this->accepted = null; + $this->save(); } /** @@ -108,12 +108,11 @@ class Asset extends Depreciable 'expected_checkin' => ['nullable', 'date'], 'last_audit_date' => ['nullable', 'date_format:Y-m-d H:i:s'], 'next_audit_date' => ['nullable', 'date'], - //'after:last_audit_date'], 'location_id' => ['nullable', 'exists:locations,id'], 'rtd_location_id' => ['nullable', 'exists:locations,id'], 'purchase_date' => ['nullable', 'date', 'date_format:Y-m-d'], 'serial' => ['nullable', 'unique_undeleted:assets,serial'], - 'purchase_cost' => ['nullable', 'numeric', 'gte:0'], + 'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:9999999999999'], 'supplier_id' => ['nullable', 'exists:suppliers,id'], 'asset_eol_date' => ['nullable', 'date'], 'eol_explicit' => ['nullable', 'boolean'], @@ -369,7 +368,7 @@ class Asset extends Depreciable if ($this->save()) { if (is_int($admin)) { $checkedOutBy = User::findOrFail($admin); - } elseif (get_class($admin) === \App\Models\User::class) { + } elseif ($admin && get_class($admin) === \App\Models\User::class) { $checkedOutBy = $admin; } else { $checkedOutBy = auth()->user(); @@ -710,15 +709,15 @@ class Asset extends Depreciable } /** - * Get action logs history for this asset + * Get user who created the item * * @author [A. Gianotto] [] * @since [v1.0] * @return \Illuminate\Database\Eloquent\Relations\Relation */ - public function admin() + public function adminuser() { - return $this->belongsTo(\App\Models\User::class, 'user_id'); + return $this->belongsTo(\App\Models\User::class, 'created_by'); } @@ -931,9 +930,20 @@ class Asset extends Depreciable * */ public function checkInvalidNextAuditDate() { - if (($this->last_audit_date) && ($this->next_audit_date) && ($this->last_audit_date > $this->next_audit_date)) { + + // Deliberately parse the dates as Y-m-d (without H:i:s) to compare them + if ($this->last_audit_date) { + $last = Carbon::parse($this->last_audit_date)->format('Y-m-d'); + } + + if ($this->next_audit_date) { + $next = Carbon::parse($this->next_audit_date)->format('Y-m-d'); + } + + if ((isset($last) && (isset($next))) && ($last > $next)) { return true; } + return false; } @@ -950,11 +960,12 @@ class Asset extends Depreciable { if (($this->model) && ($this->model->category)) { - if ($this->model->category->eula_text) { + if (($this->model->category->eula_text) && ($this->model->category->use_default_eula === 0)) { return Helper::parseEscapedMarkedown($this->model->category->eula_text); - } elseif ($this->model->category->use_default_eula == '1') { + } elseif ($this->model->category->use_default_eula === 1) { return Helper::parseEscapedMarkedown(Setting::getSettings()->default_eula_text); } else { + return false; } } @@ -1561,7 +1572,7 @@ class Asset extends Depreciable $leftJoin->on('assets_dept_users.id', '=', 'assets.assigned_to') ->where('assets.assigned_type', '=', User::class); })->where(function ($query) use ($search) { - $query->where('assets_dept_users.department_id', '=', $search); + $query->whereIn('assets_dept_users.department_id', $search); })->withTrashed()->whereNull('assets.deleted_at'); //workaround for laravel bug } @@ -1694,7 +1705,7 @@ class Asset extends Depreciable }); }); } - + /** * THIS CLUNKY BIT IS VERY IMPORTANT @@ -1715,7 +1726,7 @@ class Asset extends Depreciable * assets.location would fail, as that field doesn't exist -- plus we're already searching * against those relationships earlier in this method. * - * - snipe + * - snipe * */ @@ -1760,6 +1771,20 @@ class Asset extends Depreciable } + /** + * Query builder scope to order on created_by name + * + * @param \Illuminate\Database\Query\Builder $query Query builder instance + * @param text $order Order + * + * @return \Illuminate\Database\Query\Builder Modified query builder + */ + public function scopeOrderByCreatedByName($query, $order) + { + return $query->leftJoin('users as admin_sort', 'assets.created_by', '=', 'admin_sort.id')->select('assets.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } + + /** * Query builder scope to order on assigned user * @@ -1811,7 +1836,9 @@ class Asset extends Depreciable public function scopeInCategory($query, $category_id) { return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id') - ->join('categories', 'category_models.category_id', '=', 'categories.id')->where('category_models.category_id', '=', $category_id); + ->join('categories', 'category_models.category_id', '=', 'categories.id') + ->whereIn('category_models.category_id', (!is_array($category_id) ? explode(',',$category_id): $category_id)); + //->whereIn('category_models.category_id', $category_id); } /** @@ -1825,7 +1852,7 @@ class Asset extends Depreciable public function scopeByManufacturer($query, $manufacturer_id) { return $query->join('models', 'assets.model_id', '=', 'models.id') - ->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->where('models.manufacturer_id', '=', $manufacturer_id); + ->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->whereIn('models.manufacturer_id', (!is_array($manufacturer_id) ? explode(',',$manufacturer_id): $manufacturer_id)); } diff --git a/app/Models/AssetMaintenance.php b/app/Models/AssetMaintenance.php index 5f66783cb..246220f5c 100644 --- a/app/Models/AssetMaintenance.php +++ b/app/Models/AssetMaintenance.php @@ -174,9 +174,9 @@ class AssetMaintenance extends Model implements ICompanyableChild * @author A. Gianotto * @version v3.0 */ - public function admin() + public function adminuser() { - return $this->belongsTo(\App\Models\User::class, 'user_id') + return $this->belongsTo(\App\Models\User::class, 'created_by') ->withTrashed(); } @@ -207,20 +207,6 @@ class AssetMaintenance extends Model implements ICompanyableChild } - /** - * Query builder scope to order on admin user - * - * @param \Illuminate\Database\Query\Builder $query Query builder instance - * @param string $order Order - * - * @return \Illuminate\Database\Query\Builder Modified query builder - */ - public function scopeOrderAdmin($query, $order) - { - return $query->leftJoin('users', 'asset_maintenances.user_id', '=', 'users.id') - ->orderBy('users.first_name', $order) - ->orderBy('users.last_name', $order); - } /** * Query builder scope to order on asset tag @@ -278,4 +264,12 @@ class AssetMaintenance extends Model implements ICompanyableChild ->leftjoin('status_labels as maintained_asset_status', 'maintained_asset_status.id', '=', 'maintained_asset.status_id') ->orderBy('maintained_asset_status.name', $order); } + + /** + * Query builder scope to order on the user that created it + */ + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'asset_maintenances.created_by', '=', 'admin_sort.id')->select('asset_maintenances.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php index 3c023507d..0c8f8e7b3 100755 --- a/app/Models/AssetModel.php +++ b/app/Models/AssetModel.php @@ -36,7 +36,6 @@ class AssetModel extends SnipeModel protected $injectUniqueIdentifier = true; use ValidatingTrait; protected $table = 'models'; - protected $hidden = ['user_id', 'deleted_at']; protected $presenter = AssetModelPresenter::class; // Declare the rules for the model validation @@ -69,7 +68,6 @@ class AssetModel extends SnipeModel 'model_number', 'name', 'notes', - 'user_id', ]; use Searchable; @@ -79,7 +77,12 @@ class AssetModel extends SnipeModel * * @var array */ - protected $searchableAttributes = ['name', 'model_number', 'notes', 'eol']; + protected $searchableAttributes = [ + 'name', + 'model_number', + 'notes', + 'eol' + ]; /** * The relations and their attributes that should be included when searching the model. @@ -221,6 +224,18 @@ class AssetModel extends SnipeModel ->orderBy('created_at', 'desc'); } + /** + * Get user who created the item + * + * @author [A. Gianotto] [] + * @since [v1.0] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + /** * ----------------------------------------------- diff --git a/app/Models/Category.php b/app/Models/Category.php index f21038bab..5965404f5 100755 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -29,17 +29,17 @@ class Category extends SnipeModel use SoftDeletes; protected $table = 'categories'; - protected $hidden = ['user_id', 'deleted_at']; + protected $hidden = ['created_by', 'deleted_at']; protected $casts = [ - 'user_id' => 'integer', + 'created_by' => 'integer', ]; /** * Category validation rules */ public $rules = [ - 'user_id' => 'numeric|nullable', + 'created_by' => 'numeric|nullable', 'name' => 'required|min:1|max:255|two_column_unique_undeleted:category_type', 'require_acceptance' => 'boolean', 'use_default_eula' => 'boolean', @@ -70,7 +70,7 @@ class Category extends SnipeModel 'name', 'require_acceptance', 'use_default_eula', - 'user_id', + 'created_by', ]; use Searchable; @@ -228,6 +228,11 @@ class Category extends SnipeModel return $this->hasMany(\App\Models\AssetModel::class, 'category_id'); } + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + /** * Checks for a category-specific EULA, and if that doesn't exist, * checks for a settings level EULA @@ -286,4 +291,9 @@ class Category extends SnipeModel { return $query->where('require_acceptance', '=', true); } + + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'categories.created_by', '=', 'admin_sort.id')->select('categories.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/CheckoutRequest.php b/app/Models/CheckoutRequest.php index b717a332a..d6a85f297 100644 --- a/app/Models/CheckoutRequest.php +++ b/app/Models/CheckoutRequest.php @@ -13,7 +13,7 @@ class CheckoutRequest extends Model public function user() { - return $this->belongsTo(User::class); + return $this->belongsTo(User::class, 'user_id', 'id'); } public function requestingUser() diff --git a/app/Models/Company.php b/app/Models/Company.php index 657b34390..8886da77f 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -67,6 +67,7 @@ final class Company extends SnipeModel 'phone', 'fax', 'email', + 'created_by' ]; private static function isFullMultipleCompanySupportEnabled() @@ -115,7 +116,7 @@ final class Company extends SnipeModel if ($current_user->company_id != null) { return $current_user->company_id; } else { - return static::getIdFromInput($unescaped_input); + return null; } } } @@ -186,12 +187,15 @@ final class Company extends SnipeModel */ public function isDeletable() { + return Gate::allows('delete', $this) - && ($this->assets()->count() === 0) - && ($this->accessories()->count() === 0) - && ($this->consumables()->count() === 0) - && ($this->components()->count() === 0) - && ($this->users()->count() === 0); + && (($this->assets_count ?? $this->assets()->count()) === 0) + && (($this->accessories_count ?? $this->accessories()->count()) === 0) + && (($this->licenses_count ?? $this->licenses()->count()) === 0) + && (($this->components_count ?? $this->components()->count()) === 0) + && (($this->consumables_count ?? $this->consumables()->count()) === 0) + && (($this->accessories_count ?? $this->accessories()->count()) === 0) + && (($this->users_count ?? $this->users()->count()) === 0); } /** @@ -294,6 +298,12 @@ final class Company extends SnipeModel } + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + + /** * I legit do not know what this method does, but we can't remove it (yet). * @@ -329,4 +339,13 @@ final class Company extends SnipeModel } } + + /** + * Query builder scope to order on the user that created it + */ + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'companies.created_by', '=', 'admin_sort.id')->select('companies.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } + } diff --git a/app/Models/CompanyableTrait.php b/app/Models/CompanyableTrait.php index df67f2be4..04a620d8e 100644 --- a/app/Models/CompanyableTrait.php +++ b/app/Models/CompanyableTrait.php @@ -8,9 +8,6 @@ trait CompanyableTrait * This trait is used to scope models to the current company. To use this scope on companyable models, * we use the "use Companyable;" statement at the top of the mode. * - * We CANNOT USE THIS ON USERS, as it causes an infinite loop and prevents users from logging in, since this scope will be - * applied to the currently logged in (or logging in) user in addition to the user model for viewing lists of users. - * * @see \App\Models\Company\Company::scopeCompanyables() * @return void */ diff --git a/app/Models/Component.php b/app/Models/Component.php index 536e06d0a..fb77bf082 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -30,14 +30,15 @@ class Component extends SnipeModel * Category validation rules */ public $rules = [ - 'name' => 'required|min:3|max:255', + 'name' => 'required|min:3|max:191', 'qty' => 'required|integer|min:1', 'category_id' => 'required|integer|exists:categories,id', 'supplier_id' => 'nullable|integer|exists:suppliers,id', 'company_id' => 'integer|nullable|exists:companies,id', 'min_amt' => 'integer|min:0|nullable', 'purchase_date' => 'date_format:Y-m-d|nullable', - 'purchase_cost' => 'numeric|nullable|gte:0', + 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999', + 'manufacturer_id' => 'integer|exists:manufacturers,id|nullable', ]; /** @@ -60,6 +61,8 @@ class Component extends SnipeModel 'company_id', 'supplier_id', 'location_id', + 'manufacturer_id', + 'model_number', 'name', 'purchase_cost', 'purchase_date', @@ -77,7 +80,15 @@ class Component extends SnipeModel * * @var array */ - protected $searchableAttributes = ['name', 'order_number', 'serial', 'purchase_cost', 'purchase_date', 'notes']; + protected $searchableAttributes = [ + 'name', + 'order_number', + 'serial', + 'purchase_cost', + 'purchase_date', + 'notes', + 'model_number', + ]; /** * The relations and their attributes that should be included when searching the model. @@ -89,6 +100,7 @@ class Component extends SnipeModel 'company' => ['name'], 'location' => ['name'], 'supplier' => ['name'], + 'manufacturer' => ['name'], ]; @@ -130,7 +142,7 @@ class Component extends SnipeModel */ public function assets() { - return $this->belongsToMany(\App\Models\Asset::class, 'components_assets')->withPivot('id', 'assigned_qty', 'created_at', 'user_id', 'note'); + return $this->belongsToMany(\App\Models\Asset::class, 'components_assets')->withPivot('id', 'assigned_qty', 'created_at', 'created_by', 'note'); } /** @@ -142,9 +154,9 @@ class Component extends SnipeModel * @since [v3.0] * @return \Illuminate\Database\Eloquent\Relations\Relation */ - public function admin() + public function adminuser() { - return $this->belongsTo(\App\Models\User::class, 'user_id'); + return $this->belongsTo(\App\Models\User::class, 'created_by'); } /** @@ -183,6 +195,19 @@ class Component extends SnipeModel return $this->belongsTo(\App\Models\Supplier::class, 'supplier_id'); } + + /** + * Establishes the item -> manufacturer relationship + * + * @author [A. Gianotto] [] + * @since [v3.0] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function manufacturer() + { + return $this->belongsTo(\App\Models\Manufacturer::class, 'manufacturer_id'); + } + /** * Establishes the component -> action logs relationship * @@ -310,4 +335,22 @@ class Component extends SnipeModel { return $query->leftJoin('suppliers', 'components.supplier_id', '=', 'suppliers.id')->orderBy('suppliers.name', $order); } + + /** + * Query builder scope to order on manufacturer + * + * @param \Illuminate\Database\Query\Builder $query Query builder instance + * @param text $order Order + * + * @return \Illuminate\Database\Query\Builder Modified query builder + */ + public function scopeOrderManufacturer($query, $order) + { + return $query->leftJoin('manufacturers', 'components.manufacturer_id', '=', 'manufacturers.id')->orderBy('manufacturers.name', $order); + } + + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'components.created_by', '=', 'admin_sort.id')->select('components.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index 944ac5bfd..30161e842 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -50,7 +50,7 @@ class Consumable extends SnipeModel 'category_id' => 'required|integer', 'company_id' => 'integer|nullable', 'min_amt' => 'integer|min:0|max:99999|nullable', - 'purchase_cost' => 'numeric|nullable|gte:0', + 'purchase_cost' => 'numeric|nullable|gte:0|max:9999999999999', 'purchase_date' => 'date_format:Y-m-d|nullable', ]; @@ -154,9 +154,9 @@ class Consumable extends SnipeModel * @since [v3.0] * @return \Illuminate\Database\Eloquent\Relations\Relation */ - public function admin() + public function adminuser() { - return $this->belongsTo(User::class, 'user_id'); + return $this->belongsTo(User::class, 'created_by'); } /** @@ -256,7 +256,7 @@ class Consumable extends SnipeModel */ public function users() : Relation { - return $this->belongsToMany(User::class, 'consumables_users', 'consumable_id', 'assigned_to')->withPivot('user_id')->withTrashed()->withTimestamps(); + return $this->belongsToMany(User::class, 'consumables_users', 'consumable_id', 'assigned_to')->withPivot('created_by')->withTrashed()->withTimestamps(); } /** @@ -425,6 +425,20 @@ class Consumable extends SnipeModel return $query->leftJoin('companies', 'consumables.company_id', '=', 'companies.id')->orderBy('companies.name', $order); } + /** + * Query builder scope to order on remaining + * + * @param \Illuminate\Database\Query\Builder $query Query builder instance + * @param string $order Order + * + * @return \Illuminate\Database\Query\Builder Modified query builder + */ + public function scopeOrderRemaining($query, $order) + { + $order_by = 'consumables.qty - consumables_users_count ' . $order; + return $query->orderByRaw($order_by); + } + /** * Query builder scope to order on supplier * @@ -437,4 +451,9 @@ class Consumable extends SnipeModel { return $query->leftJoin('suppliers', 'consumables.supplier_id', '=', 'suppliers.id')->orderBy('suppliers.name', $order); } + + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as users_sort', 'consumables.created_by', '=', 'users_sort.id')->select('consumables.*')->orderBy('users_sort.first_name', $order)->orderBy('users_sort.last_name', $order); + } } diff --git a/app/Models/ConsumableAssignment.php b/app/Models/ConsumableAssignment.php index db0cfa4bd..4c9a19703 100644 --- a/app/Models/ConsumableAssignment.php +++ b/app/Models/ConsumableAssignment.php @@ -26,8 +26,8 @@ class ConsumableAssignment extends Model return $this->belongsTo(\App\Models\User::class, 'assigned_to'); } - public function admin() + public function adminuser() { - return $this->belongsTo(\App\Models\User::class, 'user_id'); + return $this->belongsTo(\App\Models\User::class, 'created_by'); } } diff --git a/app/Models/Department.php b/app/Models/Department.php index 62755d2aa..855cb25f6 100644 --- a/app/Models/Department.php +++ b/app/Models/Department.php @@ -42,7 +42,7 @@ class Department extends SnipeModel * @var array */ protected $fillable = [ - 'user_id', + 'created_by', 'name', 'phone', 'fax', diff --git a/app/Models/Depreciation.php b/app/Models/Depreciation.php index 9faa1b86e..11ee82c16 100755 --- a/app/Models/Depreciation.php +++ b/app/Models/Depreciation.php @@ -75,4 +75,40 @@ class Depreciation extends SnipeModel { return $this->hasMany(\App\Models\License::class, 'depreciation_id'); } + + /** + * Establishes the depreciation -> assets relationship + * + * @author A. Gianotto + * @since [v5.0] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function assets() + { + return $this->hasManyThrough(\App\Models\Asset::class, \App\Models\AssetModel::class, 'depreciation_id', 'model_id'); + } + + /** + * Get the user that created the depreciation + * + * @author A. Gianotto + * @since [v7.0.13] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + + + /** + * ----------------------------------------------- + * BEGIN QUERY SCOPES + * ----------------------------------------------- + **/ + + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'depreciations.created_by', '=', 'admin_sort.id')->select('depreciations.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/Group.php b/app/Models/Group.php index c6e6e5603..7278152df 100755 --- a/app/Models/Group.php +++ b/app/Models/Group.php @@ -65,7 +65,7 @@ class Group extends SnipeModel * @since [v6.3.0] * @return \Illuminate\Database\Eloquent\Relations\Relation */ - public function admin() + public function adminuser() { return $this->belongsTo(\App\Models\User::class, 'created_by'); } @@ -81,4 +81,16 @@ class Group extends SnipeModel { return json_decode($this->permissions, true); } + + /** + * ----------------------------------------------- + * BEGIN QUERY SCOPES + * ----------------------------------------------- + **/ + + + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'permission_groups.created_by', '=', 'admin_sort.id')->select('permission_groups.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/Import.php b/app/Models/Import.php index 81728c8a5..052612a19 100644 --- a/app/Models/Import.php +++ b/app/Models/Import.php @@ -2,10 +2,13 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Import extends Model { + use HasFactory; + protected $casts = [ 'header_row' => 'array', 'first_row' => 'array', diff --git a/app/Models/Ldap.php b/app/Models/Ldap.php index ecce46d82..f71f926a9 100644 --- a/app/Models/Ldap.php +++ b/app/Models/Ldap.php @@ -283,9 +283,10 @@ class Ldap extends Model * @param $base_dn * @param $count * @param $filter + * @param $attributes * @return array|bool */ - public static function findLdapUsers($base_dn = null, $count = -1, $filter = null) + public static function findLdapUsers($base_dn = null, $count = -1, $filter = null, $attributes = []) { $ldapconn = self::connectToLdap(); self::bindAdminToLdap($ldapconn); @@ -319,7 +320,7 @@ class Ldap extends Model //if($count == -1) { //count is -1 means we have to employ paging to query the entire directory $ldap_controls = [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'iscritical' => false, 'value' => ['size'=> $count == -1||$count>$page_size ? $page_size : $count, 'cookie' => $cookie]]]; //} - $search_results = ldap_search($ldapconn, $base_dn, $filter, [], 0, /* $page_size */ -1, -1, LDAP_DEREF_NEVER, $ldap_controls); // TODO - I hate the @, and I hate that we get a full page even if we ask for 10 records. Can we use an ldap_control? + $search_results = ldap_search($ldapconn, $base_dn, $filter, $attributes, 0, /* $page_size */ -1, -1, LDAP_DEREF_NEVER, $ldap_controls); // TODO - I hate the @, and I hate that we get a full page even if we ask for 10 records. Can we use an ldap_control? Log::debug("LDAP search executed successfully."); if (! $search_results) { return redirect()->route('users.index')->with('error', trans('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn)); // TODO this is never called in any routed context - only from the Artisan command. So this redirect will never work. @@ -340,7 +341,7 @@ class Ldap extends Model $cookie = ''; } // Empty cookie means last page - + // Get results from page $results = ldap_get_entries($ldapconn, $search_results); if (! $results) { diff --git a/app/Models/License.php b/app/Models/License.php index 554929c0a..0997c1e57 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -81,8 +81,7 @@ class License extends Depreciable 'serial', 'supplier_id', 'termination_date', - 'free_seat_count', - 'user_id', + 'created_by', 'min_amt', ]; @@ -184,8 +183,8 @@ class License extends Depreciable $logAction = new Actionlog; $logAction->item_type = self::class; $logAction->item_id = $license->id; - $logAction->user_id = Auth::id() ?: 1; // We don't have an id while running the importer from CLI. - $logAction->note = "deleted ${change} seats"; + $logAction->created_by = auth()->id() ?: 1; // We don't have an id while running the importer from CLI. + $logAction->note = "deleted {$change} seats"; $logAction->target_id = null; $logAction->logaction('delete seats'); @@ -196,7 +195,7 @@ class License extends Depreciable $licenseInsert = []; for ($i = $oldSeats; $i < $newSeats; $i++) { $licenseInsert[] = [ - 'user_id' => Auth::id(), + 'created_by' => auth()->id(), 'license_id' => $license->id, 'created_at' => now(), 'updated_at' => now() @@ -216,8 +215,8 @@ class License extends Depreciable $logAction = new Actionlog(); $logAction->item_type = self::class; $logAction->item_id = $license->id; - $logAction->user_id = Auth::id() ?: 1; // Importer. - $logAction->note = "added ${change} seats"; + $logAction->created_by = auth()->id() ?: 1; // Importer. + $logAction->note = "added {$change} seats"; $logAction->target_id = null; $logAction->logaction('add seats'); } @@ -434,7 +433,7 @@ class License extends Depreciable */ public function adminuser() { - return $this->belongsTo(\App\Models\User::class, 'user_id'); + return $this->belongsTo(\App\Models\User::class, 'created_by'); } /** @@ -739,14 +738,9 @@ class License extends Depreciable /** * Query builder scope to order on the user that created it - * - * @param \Illuminate\Database\Query\Builder $query Query builder instance - * @param text $order Order - * - * @return \Illuminate\Database\Query\Builder Modified query builder */ - public function scopeOrderCreatedBy($query, $order) + public function scopeOrderByCreatedBy($query, $order) { - return $query->leftJoin('users as users_sort', 'licenses.user_id', '=', 'users_sort.id')->select('licenses.*')->orderBy('users_sort.first_name', $order)->orderBy('users_sort.last_name', $order); + return $query->leftJoin('users as admin_sort', 'licenses.created_by', '=', 'admin_sort.id')->select('licenses.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); } -} \ No newline at end of file +} diff --git a/app/Models/Location.php b/app/Models/Location.php index f08a51a98..014db3053 100755 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -33,7 +33,7 @@ class Location extends SnipeModel 'country' => 'min:2|max:191|nullable', 'zip' => 'max:10|nullable', 'manager_id' => 'exists:users,id|nullable', - 'parent_id' => 'non_circular:locations,id', + 'parent_id' => 'nullable|exists:locations,id|non_circular:locations,id', ]; protected $casts = [ @@ -42,7 +42,7 @@ class Location extends SnipeModel ]; /** - * Whether the model should inject it's identifier to the unique + * Whether the model should inject its identifier to the unique * validation rules before attempting validation. If this property * is not set in the model it will default to true. * diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index ae5d55488..72a7a7f26 100644 --- a/app/Models/Loggable.php +++ b/app/Models/Loggable.php @@ -37,7 +37,7 @@ trait Loggable $log = new Actionlog; $log = $this->determineLogItemType($log); if (auth()->user()) { - $log->user_id = auth()->id(); + $log->created_by = auth()->id(); } if (! isset($target)) { @@ -117,7 +117,6 @@ trait Loggable */ public function logCheckin($target, $note, $action_date = null, $originalValues = []) { - $settings = Setting::getSettings(); $log = new Actionlog; if($target != null){ @@ -149,7 +148,7 @@ trait Loggable } if (auth()->user()) { - $log->user_id = auth()->id(); + $log->created_by = auth()->id(); } $changed = []; @@ -171,39 +170,6 @@ trait Loggable $log->logaction('checkin from'); -// $params = [ -// 'target' => $target, -// 'item' => $log->item, -// 'admin' => $log->user, -// 'note' => $note, -// 'target_type' => $log->target_type, -// 'settings' => $settings, -// ]; -// -// -// $checkinClass = null; -// -// if (method_exists($target, 'notify')) { -// try { -// $target->notify(new static::$checkinClass($params)); -// } catch (\Exception $e) { -// Log::debug($e); -// } -// -// } -// -// // Send to the admin, if settings dictate -// $recipient = new \App\Models\Recipients\AdminRecipient(); -// -// if (($settings->admin_cc_email!='') && (static::$checkinClass!='')) { -// try { -// $recipient->notify(new static::$checkinClass($params)); -// } catch (\Exception $e) { -// Log::debug($e); -// } -// -// } - return $log; } @@ -225,14 +191,14 @@ trait Loggable } $log->location_id = ($location_id) ? $location_id : null; $log->note = $note; - $log->user_id = auth()->id(); + $log->created_by = auth()->id(); $log->filename = $filename; $log->logaction('audit'); $params = [ 'item' => $log->item, 'filename' => $log->filename, - 'admin' => $log->admin, + 'admin' => $log->adminuser, 'location' => ($location) ? $location->name : '', 'note' => $note, ]; @@ -248,9 +214,9 @@ trait Loggable */ public function logCreate($note = null) { - $user_id = -1; + $created_by = -1; if (auth()->user()) { - $user_id = auth()->id(); + $created_by = auth()->id(); } $log = new Actionlog; if (static::class == LicenseSeat::class) { @@ -262,7 +228,7 @@ trait Loggable } $log->location_id = null; $log->note = $note; - $log->user_id = $user_id; + $log->created_by = $created_by; $log->logaction('create'); $log->save(); @@ -284,7 +250,7 @@ trait Loggable $log->item_type = static::class; $log->item_id = $this->id; } - $log->user_id = auth()->id(); + $log->created_by = auth()->id(); $log->note = $note; $log->target_id = null; $log->created_at = date('Y-m-d H:i:s'); diff --git a/app/Models/Manufacturer.php b/app/Models/Manufacturer.php index 85907f7dd..1b31f496d 100755 --- a/app/Models/Manufacturer.php +++ b/app/Models/Manufacturer.php @@ -74,10 +74,11 @@ class Manufacturer extends SnipeModel public function isDeletable() { return Gate::allows('delete', $this) - && ($this->assets()->count() === 0) - && ($this->licenses()->count() === 0) - && ($this->consumables()->count() === 0) - && ($this->accessories()->count() === 0) + && (($this->assets_count ?? $this->assets()->count()) === 0) + && (($this->licenses_count ?? $this->licenses()->count()) === 0) + && (($this->consumables_count ?? $this->consumables()->count()) === 0) + && (($this->accessories_count ?? $this->accessories()->count()) === 0) + && (($this->components_count ?? $this->components()->count()) === 0) && ($this->deleted_at == ''); } @@ -105,4 +106,23 @@ class Manufacturer extends SnipeModel { return $this->hasMany(\App\Models\Consumable::class, 'manufacturer_id'); } + + public function components() + { + return $this->hasMany(\App\Models\Component::class, 'manufacturer_id'); + } + + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + + + /** + * Query builder scope to order on the user that created it + */ + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'manufacturers.created_by', '=', 'admin_sort.id')->select('manufacturers.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/PredefinedKit.php b/app/Models/PredefinedKit.php index 1bf6cb098..36790a1fc 100644 --- a/app/Models/PredefinedKit.php +++ b/app/Models/PredefinedKit.php @@ -4,6 +4,7 @@ namespace App\Models; use App\Models\Traits\Searchable; use App\Presenters\Presentable; +use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Validation\Rule; use Watson\Validating\ValidatingTrait; @@ -16,6 +17,7 @@ use Watson\Validating\ValidatingTrait; class PredefinedKit extends SnipeModel { protected $presenter = \App\Presenters\PredefinedKitPresenter::class; + use HasFactory; use Presentable; protected $table = 'kits'; @@ -133,6 +135,13 @@ class PredefinedKit extends SnipeModel */ protected $searchableRelations = []; + + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + + /** * Establishes the kits -> models relationship * @return \Illuminate\Database\Eloquent\Relations\Relation @@ -179,4 +188,9 @@ class PredefinedKit extends SnipeModel * BEGIN QUERY SCOPES * ----------------------------------------------- **/ + + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'kits.created_by', '=', 'admin_sort.id')->select('kits.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/Recipients/AdminRecipient.php b/app/Models/Recipients/AdminRecipient.php index 433bd0020..90e39d4ee 100644 --- a/app/Models/Recipients/AdminRecipient.php +++ b/app/Models/Recipients/AdminRecipient.php @@ -6,9 +6,15 @@ use App\Models\Setting; class AdminRecipient extends Recipient { + + protected $email; public function __construct() { $settings = Setting::getSettings(); $this->email = trim($settings->admin_cc_email); } + + public function getEmail(){ + return $this->email; + } } diff --git a/app/Models/Requestable.php b/app/Models/Requestable.php index bf5c9c427..4dead82bb 100644 --- a/app/Models/Requestable.php +++ b/app/Models/Requestable.php @@ -29,19 +29,19 @@ trait Requestable public function request($qty = 1) { $this->requests()->save( - new CheckoutRequest(['user_id' => Auth::id(), 'qty' => $qty]) + new CheckoutRequest(['user_id' => auth()->id(), 'qty' => $qty]) ); } public function deleteRequest() { - $this->requests()->where('user_id', Auth::id())->delete(); + $this->requests()->where('user_id', auth()->id())->delete(); } public function cancelRequest($user_id = null) { if (!$user_id){ - $user_id = Auth::id(); + $user_id = auth()->id(); } $this->requests()->where('user_id', $user_id)->update(['canceled_at' => \Carbon\Carbon::now()]); diff --git a/app/Models/Setting.php b/app/Models/Setting.php index d775be81c..6f585b95f 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -51,36 +51,7 @@ class Setting extends Model */ protected $rules = [ 'brand' => 'required|min:1|numeric', - 'qr_text' => 'max:31|nullable', - 'alert_email' => 'email_array|nullable', - 'admin_cc_email' => 'email|nullable', - 'default_currency' => 'required', - 'locale' => 'required', - 'labels_per_page' => 'numeric', - 'labels_width' => 'numeric', - 'labels_height' => 'numeric', - 'labels_pmargin_left' => 'numeric|nullable', - 'labels_pmargin_right' => 'numeric|nullable', - 'labels_pmargin_top' => 'numeric|nullable', - 'labels_pmargin_bottom' => 'numeric|nullable', - 'labels_display_bgutter' => 'numeric|nullable', - 'labels_display_sgutter' => 'numeric|nullable', - 'labels_fontsize' => 'numeric|min:5', - 'labels_pagewidth' => 'numeric|nullable', - 'labels_pageheight' => 'numeric|nullable', - 'login_remote_user_enabled' => 'numeric|nullable', - 'login_common_disabled' => 'numeric|nullable', - 'login_remote_user_custom_logout_url' => 'string|nullable', - 'login_remote_user_header_name' => 'string|nullable', 'thumbnail_max_h' => 'numeric|max:500|min:25', - 'pwd_secure_min' => 'numeric|required|min:8', - 'alert_threshold' => 'numeric|nullable', - 'alert_interval' => 'numeric|nullable', - 'audit_warning_days' => 'numeric|nullable', - 'due_checkin_days' => 'numeric|nullable', - 'audit_interval' => 'numeric|nullable', - 'custom_forgot_pass_url' => 'url|nullable', - 'privacy_policy_link' => 'nullable|url', 'google_client_id' => 'nullable|ends_with:apps.googleusercontent.com' ]; diff --git a/app/Models/SnipeModel.php b/app/Models/SnipeModel.php index af12c3d29..f26946d22 100644 --- a/app/Models/SnipeModel.php +++ b/app/Models/SnipeModel.php @@ -21,6 +21,11 @@ class SnipeModel extends Model */ public function setPurchaseCostAttribute($value) { + if (is_float($value)) { + //value is *already* a floating-point number. Just assign it directly + $this->attributes['purchase_cost'] = $value; + return; + } $value = Helper::ParseCurrency($value); if ($value == 0) { diff --git a/app/Models/Statuslabel.php b/app/Models/Statuslabel.php index 0f8a0b607..c1bcc3042 100755 --- a/app/Models/Statuslabel.php +++ b/app/Models/Statuslabel.php @@ -64,6 +64,11 @@ class Statuslabel extends SnipeModel return $this->hasMany(\App\Models\Asset::class, 'status_id'); } + public function adminuser() + { + return $this->belongsTo(\App\Models\User::class, 'created_by'); + } + /** * Gets the status label type * @@ -161,4 +166,9 @@ class Statuslabel extends SnipeModel return $statustype; } + + public function scopeOrderByCreatedBy($query, $order) + { + return $query->leftJoin('users as admin_sort', 'status_labels.created_by', '=', 'admin_sort.id')->select('status_labels.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order); + } } diff --git a/app/Models/User.php b/app/Models/User.php index c03b0d33c..5b3d87682 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -122,6 +122,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo 'jobtitle', 'employee_num', 'website', + 'locale', ]; /** diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php index 7e033f187..28e6c054f 100644 --- a/app/Notifications/CheckinAccessoryNotification.php +++ b/app/Notifications/CheckinAccessoryNotification.php @@ -6,9 +6,11 @@ use App\Models\Accessory; use App\Models\Setting; use App\Models\User; use Illuminate\Bus\Queueable; +use Illuminate\Notifications\Channels\SlackWebhookChannel; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Support\Str; use NotificationChannels\GoogleChat\Card; use NotificationChannels\GoogleChat\GoogleChatChannel; use NotificationChannels\GoogleChat\GoogleChatMessage; @@ -55,22 +57,9 @@ class CheckinAccessoryNotification extends Notification } if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { - $notifyBy[] = 'slack'; + $notifyBy[] = SlackWebhookChannel::class; } - /** - * Only send notifications to users that have email addresses - */ - if ($this->target instanceof User && $this->target->email != '') { - Log::debug('The target is a user'); - - if ($this->item->checkin_email()) { - $notifyBy[] = 'mail'; - } - } - - Log::debug('checkin_email on this category is '.$this->item->checkin_email()); - return $notifyBy; } @@ -103,18 +92,29 @@ class CheckinAccessoryNotification extends Notification $admin = $this->admin; $item = $this->item; $note = $this->note; + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { + return MicrosoftTeamsMessage::create() + ->to($this->settings->webhook_endpoint) + ->type('success') + ->addStartGroupToSection('activityTitle') + ->title(trans('Accessory_Checkin_Notification')) + ->addStartGroupToSection('activityText') + ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') + ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '') + ->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName()) + ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.notes'), $note ?: ''); + } - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->addStartGroupToSection('activityTitle') - ->title(trans('Accessory_Checkin_Notification')) - ->addStartGroupToSection('activityText') - ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') - ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '') - ->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName()) - ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) - ->fact(trans('mail.notes'), $note ?: ''); + $message = trans('mail.Accessory_Checkin_Notification'); + $details = [ + trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name), + trans('mail.checked_into') => $item->location->name ? $item->location->name : '', + trans('mail.Accessory_Checkin_Notification'). ' by' => $admin->present()->fullName(), + trans('admin/consumables/general.remaining')=> $item->numRemaining(), + trans('mail.notes') => $note ?: '', + ]; + return array($message, $details); } public function toGoogleChat() { @@ -142,24 +142,4 @@ class CheckinAccessoryNotification extends Notification ); } - - /** - * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail() - { - Log::debug('to email called'); - - return (new MailMessage)->markdown('notifications.markdown.checkin-accessory', - [ - 'item' => $this->item, - 'admin' => $this->admin, - 'note' => $this->note, - 'target' => $this->target, - ]) - ->subject(trans('mail.Accessory_Checkin_Notification')); - } } diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.php index 77cd6d9b5..fa4780c1f 100644 --- a/app/Notifications/CheckinAssetNotification.php +++ b/app/Notifications/CheckinAssetNotification.php @@ -7,9 +7,11 @@ use App\Models\Asset; use App\Models\Setting; use App\Models\User; use Illuminate\Bus\Queueable; +use Illuminate\Notifications\Channels\SlackWebhookChannel; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Support\Str; use NotificationChannels\GoogleChat\Card; use NotificationChannels\GoogleChat\GoogleChatChannel; use NotificationChannels\GoogleChat\GoogleChatMessage; @@ -50,7 +52,6 @@ class CheckinAssetNotification extends Notification */ public function via() { - $notifyBy = []; if (Setting::getSettings()->webhook_selected == 'google' && Setting::getSettings()->webhook_endpoint) { $notifyBy[] = GoogleChatChannel::class; @@ -62,15 +63,7 @@ class CheckinAssetNotification extends Notification } if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { Log::debug('use webhook'); - $notifyBy[] = 'slack'; - } - - /** - * Only send checkin notifications to users if the category - * has the corresponding checkbox checked. - */ - if ($this->item->checkin_email() && $this->target instanceof User && $this->target->email != '') { - $notifyBy[] = 'mail'; + $notifyBy[] = SlackWebhookChannel::class; } return $notifyBy; @@ -106,16 +99,30 @@ class CheckinAssetNotification extends Notification $item = $this->item; $note = $this->note; - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->title(trans('mail.Asset_Checkin_Notification')) - ->addStartGroupToSection('activityText') - ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText') - ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '') - ->fact(trans('mail.Asset_Checkin_Notification')." by ", $admin->present()->fullName()) - ->fact(trans('admin/hardware/form.status'), $item->assetstatus->name) - ->fact(trans('mail.notes'), $note ?: ''); + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { + return MicrosoftTeamsMessage::create() + ->to($this->settings->webhook_endpoint) + ->type('success') + ->title(trans('mail.Asset_Checkin_Notification')) + ->addStartGroupToSection('activityText') + ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText') + ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '') + ->fact(trans('mail.Asset_Checkin_Notification') . " by ", $admin->present()->fullName()) + ->fact(trans('admin/hardware/form.status'), $item->assetstatus->name) + ->fact(trans('mail.notes'), $note ?: ''); + } + + + $message = trans('mail.Asset_Checkin_Notification'); + $details = [ + trans('mail.asset') => htmlspecialchars_decode($item->present()->name), + trans('mail.checked_into') => $item->location->name ? $item->location->name : '', + trans('mail.Asset_Checkin_Notification')." by " => $admin->present()->fullName(), + trans('admin/hardware/form.status') => $item->assetstatus->name, + trans('mail.notes') => $note ?: '', + ]; + + return array($message, $details); } public function toGoogleChat() { @@ -142,35 +149,5 @@ class CheckinAssetNotification extends Notification ) ) ); - - } - - /** - * Get the mail representation of the notification. - * - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail() - { - $fields = []; - - // Check if the item has custom fields associated with it - if (($this->item->model) && ($this->item->model->fieldset)) { - $fields = $this->item->model->fieldset->fields; - } - - $message = (new MailMessage)->markdown('notifications.markdown.checkin-asset', - [ - 'item' => $this->item, - 'status' => $this->item->assetstatus?->name, - 'admin' => $this->admin, - 'note' => $this->note, - 'target' => $this->target, - 'fields' => $fields, - 'expected_checkin' => $this->expected_checkin, - ]) - ->subject(trans('mail.Asset_Checkin_Notification')); - - return $message; } } diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.php index 289e63a16..1cb8706e6 100644 --- a/app/Notifications/CheckinLicenseSeatNotification.php +++ b/app/Notifications/CheckinLicenseSeatNotification.php @@ -6,9 +6,11 @@ use App\Models\LicenseSeat; use App\Models\Setting; use App\Models\User; use Illuminate\Bus\Queueable; +use Illuminate\Notifications\Channels\SlackWebhookChannel; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Support\Str; use NotificationChannels\GoogleChat\Card; use NotificationChannels\GoogleChat\GoogleChatChannel; use NotificationChannels\GoogleChat\GoogleChatMessage; @@ -58,15 +60,7 @@ class CheckinLicenseSeatNotification extends Notification } if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { - $notifyBy[] = 'slack'; - } - - /** - * Only send checkin notifications to users if the category - * has the corresponding checkbox checked. - */ - if ($this->item->checkin_email() && $this->target instanceof User && $this->target->email != '') { - $notifyBy[] = 'mail'; + $notifyBy[] = SlackWebhookChannel::class; } return $notifyBy; @@ -109,18 +103,30 @@ class CheckinLicenseSeatNotification extends Notification $admin = $this->admin; $item = $this->item; $note = $this->note; + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { + return MicrosoftTeamsMessage::create() + ->to($this->settings->webhook_endpoint) + ->type('success') + ->addStartGroupToSection('activityTitle') + ->title(trans('mail.License_Checkin_Notification')) + ->addStartGroupToSection('activityText') + ->fact(htmlspecialchars_decode($item->present()->name), '', 'header') + ->fact(trans('mail.License_Checkin_Notification')." by ", $admin->present()->fullName() ?: 'CLI tool') + ->fact(trans('mail.checkedin_from'), $target->present()->fullName()) + ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) + ->fact(trans('mail.notes'), $note ?: ''); + } - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->addStartGroupToSection('activityTitle') - ->title(trans('mail.License_Checkin_Notification')) - ->addStartGroupToSection('activityText') - ->fact(htmlspecialchars_decode($item->present()->name), '', 'header') - ->fact(trans('mail.License_Checkin_Notification')." by ", $admin->present()->fullName() ?: 'CLI tool') - ->fact(trans('mail.checkedin_from'), $target->present()->fullName()) - ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) - ->fact(trans('mail.notes'), $note ?: ''); + $message = trans('mail.License_Checkin_Notification'); + $details = [ + trans('mail.checkedin_from')=> $target->present()->fullName(), + trans('mail.license_for') => htmlspecialchars_decode($item->present()->name), + trans('mail.License_Checkin_Notification')." by " => $admin->present()->fullName() ?: 'CLI tool', + trans('admin/consumables/general.remaining') => $item->availCount()->count(), + trans('mail.notes') => $note ?: '', + ]; + + return array($message, $details); } public function toGoogleChat() { @@ -149,23 +155,4 @@ class CheckinLicenseSeatNotification extends Notification ); } - - - /** - * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail() - { - return (new MailMessage)->markdown('notifications.markdown.checkin-license', - [ - 'item' => $this->item, - 'admin' => $this->admin, - 'note' => $this->note, - 'target' => $this->target, - ]) - ->subject(trans('mail.License_Checkin_Notification')); - } } diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.php index 721ba7f6a..116a5ac29 100644 --- a/app/Notifications/CheckoutAccessoryNotification.php +++ b/app/Notifications/CheckoutAccessoryNotification.php @@ -9,6 +9,7 @@ use Illuminate\Bus\Queueable; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Support\Str; use NotificationChannels\GoogleChat\Card; use NotificationChannels\GoogleChat\GoogleChatChannel; use NotificationChannels\GoogleChat\GoogleChatMessage; @@ -120,6 +121,7 @@ class CheckoutAccessoryNotification extends Notification $item = $this->item; $note = $this->note; + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { return MicrosoftTeamsMessage::create() ->to($this->settings->webhook_endpoint) ->type('success') @@ -133,7 +135,19 @@ class CheckoutAccessoryNotification extends Notification ->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->present()->fullName()) ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) ->fact(trans('mail.notes'), $note ?: ''); + } + $message = trans('mail.Accessory_Checkout_Notification'); + $details = [ + trans('mail.assigned_to') => $target->present()->name, + trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name), + trans('general.qty') => $this->checkout_qty, + trans('mail.checkedout_from') => $item->location->name ? $item->location->name : '', + trans('mail.Accessory_Checkout_Notification'). ' by' => $admin->present()->fullName(), + trans('admin/consumables/general.remaining')=> $item->numRemaining(), + trans('mail.notes') => $note ?: '', + ]; + return array($message, $details); } public function toGoogleChat() { diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.php index 5ebde7e4f..83011e5c8 100644 --- a/app/Notifications/CheckoutAssetNotification.php +++ b/app/Notifications/CheckoutAssetNotification.php @@ -8,9 +8,10 @@ use App\Models\Setting; use App\Models\User; use Exception; use Illuminate\Bus\Queueable; -use Illuminate\Notifications\Messages\MailMessage; +use Illuminate\Notifications\Channels\SlackWebhookChannel; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Support\Str; use NotificationChannels\GoogleChat\Card; use NotificationChannels\GoogleChat\Enums\Icon; use NotificationChannels\GoogleChat\Enums\ImageStyle; @@ -21,6 +22,9 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel; use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage; use Illuminate\Support\Facades\Log; +use Osama\LaravelTeamsNotification\Logging\TeamsLoggingChannel; +use Osama\LaravelTeamsNotification\TeamsNotification; + class CheckoutAssetNotification extends Notification { use Queueable; @@ -32,14 +36,11 @@ class CheckoutAssetNotification extends Notification */ public function __construct(Asset $asset, $checkedOutTo, User $checkedOutBy, $acceptance, $note) { + $this->settings = Setting::getSettings(); $this->item = $asset; $this->admin = $checkedOutBy; $this->note = $note; $this->target = $checkedOutTo; - $this->acceptance = $acceptance; - - $this->settings = Setting::getSettings(); - $this->last_checkout = ''; $this->expected_checkin = ''; @@ -53,7 +54,6 @@ class CheckoutAssetNotification extends Notification false); } } - /** * Get the notification's delivery channels. * @@ -62,61 +62,34 @@ class CheckoutAssetNotification extends Notification public function via() { $notifyBy = []; - if (Setting::getSettings()->webhook_selected == 'google' && Setting::getSettings()->webhook_endpoint) { + + if (Setting::getSettings()->webhook_selected === 'google' && Setting::getSettings()->webhook_endpoint) { $notifyBy[] = GoogleChatChannel::class; } - if (Setting::getSettings()->webhook_selected == 'microsoft' && Setting::getSettings()->webhook_endpoint) { + if (Setting::getSettings()->webhook_selected === 'microsoft' && Setting::getSettings()->webhook_endpoint) { - $notifyBy[] = MicrosoftTeamsChannel::class; + $notifyBy[] = TeamsNotification::class; } - if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { + if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general' ) { Log::debug('use webhook'); - $notifyBy[] = 'slack'; - } - - /** - * Only send notifications to users that have email addresses - */ - if ($this->target instanceof User && $this->target->email != '') { - - /** - * Send an email if the asset requires acceptance, - * so the user can accept or decline the asset - */ - if ($this->item->requireAcceptance()) { - $notifyBy[1] = 'mail'; - } - - /** - * Send an email if the item has a EULA, since the user should always receive it - */ - if ($this->item->getEula()) { - $notifyBy[1] = 'mail'; - } - - /** - * Send an email if an email should be sent at checkin/checkout - */ - if ($this->item->checkin_email()) { - $notifyBy[1] = 'mail'; - } + $notifyBy[] = SlackWebhookChannel::class; } return $notifyBy; } - public function toSlack() + public function toSlack() :SlackMessage { $target = $this->target; $admin = $this->admin; $item = $this->item; $note = $this->note; - $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot'; + $botname = ($this->settings->webhook_botname) ?: 'Snipe-Bot'; $channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : ''; $fields = [ @@ -124,7 +97,7 @@ class CheckoutAssetNotification extends Notification 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>', ]; - if (($this->expected_checkin) && ($this->expected_checkin != '')) { + if (($this->expected_checkin) && ($this->expected_checkin !== '')) { $fields['Expected Checkin'] = $this->expected_checkin; } @@ -138,24 +111,33 @@ class CheckoutAssetNotification extends Notification ->content($note); }); } - public function toMicrosoftTeams() + public function toMicrosoftTeams() : array { $target = $this->target; $admin = $this->admin; $item = $this->item; $note = $this->note; - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->title(trans('mail.Asset_Checkout_Notification')) - ->addStartGroupToSection('activityText') - ->fact(trans('mail.assigned_to'), $target->present()->name) - ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText') - ->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->present()->fullName()) - ->fact(trans('mail.notes'), $note ?: ''); - + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { + return MicrosoftTeamsMessage::create() + ->to($this->settings->webhook_endpoint) + ->type('success') + ->title(trans('mail.Asset_Checkout_Notification')) + ->addStartGroupToSection('activityText') + ->fact(trans('mail.assigned_to'), $target->present()->name) + ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText') + ->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->present()->fullName()) + ->fact(trans('mail.notes'), $note ?: ''); + } + $message = trans('mail.Asset_Checkout_Notification'); + $details = [ + trans('mail.assigned_to') => $target->present()->name, + trans('mail.asset') => htmlspecialchars_decode($item->present()->name), + trans('mail.Asset_Checkout_Notification'). ' by' => $admin->present()->fullName(), + trans('mail.notes') => $note ?: '', + ]; + return array($message, $details); } public function toGoogleChat() { @@ -184,43 +166,4 @@ public function toGoogleChat() ); } - - /** - * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail() - { - $eula = method_exists($this->item, 'getEula') ? $this->item->getEula() : ''; - $req_accept = method_exists($this->item, 'requireAcceptance') ? $this->item->requireAcceptance() : 0; - - $fields = []; - - // Check if the item has custom fields associated with it - if (($this->item->model) && ($this->item->model->fieldset)) { - $fields = $this->item->model->fieldset->fields; - } - - $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); - - $message = (new MailMessage)->markdown('notifications.markdown.checkout-asset', - [ - 'item' => $this->item, - 'admin' => $this->admin, - 'status' => $this->item->assetstatus?->name, - 'note' => $this->note, - 'target' => $this->target, - 'fields' => $fields, - 'eula' => $eula, - 'req_accept' => $req_accept, - 'accept_url' => $accept_url, - 'last_checkout' => $this->last_checkout, - 'expected_checkin' => $this->expected_checkin, - ]) - ->subject(trans('mail.Confirm_asset_delivery')); - - return $message; - } } diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.php index 6746795f2..ba7c5646a 100644 --- a/app/Notifications/CheckoutConsumableNotification.php +++ b/app/Notifications/CheckoutConsumableNotification.php @@ -6,9 +6,11 @@ use App\Models\Consumable; use App\Models\Setting; use App\Models\User; use Illuminate\Bus\Queueable; +use Illuminate\Notifications\Channels\SlackWebhookChannel; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Support\Str; use NotificationChannels\GoogleChat\Card; use NotificationChannels\GoogleChat\GoogleChatChannel; use NotificationChannels\GoogleChat\GoogleChatMessage; @@ -38,6 +40,7 @@ class CheckoutConsumableNotification extends Notification $this->note = $note; $this->target = $checkedOutTo; $this->acceptance = $acceptance; + $this->qty = $consumable->checkout_qty; $this->settings = Setting::getSettings(); } @@ -61,35 +64,7 @@ class CheckoutConsumableNotification extends Notification } if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { - $notifyBy[] = 'slack'; - } - - /** - * Only send notifications to users that have email addresses - */ - if ($this->target instanceof User && $this->target->email != '') { - - /** - * Send an email if the asset requires acceptance, - * so the user can accept or decline the asset - */ - if ($this->item->requireAcceptance()) { - $notifyBy[1] = 'mail'; - } - - /** - * Send an email if the item has a EULA, since the user should always receive it - */ - if ($this->item->getEula()) { - $notifyBy[1] = 'mail'; - } - - /** - * Send an email if an email should be sent at checkin/checkout - */ - if ((method_exists($this->item, 'checkin_email')) && ($this->item->checkin_email())) { - $notifyBy[1] = 'mail'; - } + $notifyBy[] = SlackWebhookChannel::class; } return $notifyBy; @@ -126,17 +101,30 @@ class CheckoutConsumableNotification extends Notification $item = $this->item; $note = $this->note; - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->addStartGroupToSection('activityTitle') - ->title(trans('mail.Consumable_checkout_notification')) - ->addStartGroupToSection('activityText') - ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') - ->fact(trans('mail.Consumable_checkout_notification')." by ", $admin->present()->fullName()) - ->fact(trans('mail.assigned_to'), $target->present()->fullName()) - ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) - ->fact(trans('mail.notes'), $note ?: ''); + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { + return MicrosoftTeamsMessage::create() + ->to($this->settings->webhook_endpoint) + ->type('success') + ->addStartGroupToSection('activityTitle') + ->title(trans('mail.Consumable_checkout_notification')) + ->addStartGroupToSection('activityText') + ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') + ->fact(trans('mail.Consumable_checkout_notification')." by ", $admin->present()->fullName()) + ->fact(trans('mail.assigned_to'), $target->present()->fullName()) + ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining()) + ->fact(trans('mail.notes'), $note ?: ''); + } + + $message = trans('mail.Consumable_checkout_notification'); + $details = [ + trans('mail.assigned_to') => $target->present()->fullName(), + trans('mail.item') => htmlspecialchars_decode($item->present()->name), + trans('mail.Consumable_checkout_notification').' by' => $admin->present()->fullName(), + trans('admin/consumables/general.remaining') => $item->numRemaining(), + trans('mail.notes') => $note ?: '', + ]; + + return array($message, $details); } public function toGoogleChat() { @@ -165,30 +153,4 @@ class CheckoutConsumableNotification extends Notification ); } - - /** - * Get the mail representation of the notification. - * - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail() - { - Log::debug($this->item->getImageUrl()); - $eula = $this->item->getEula(); - $req_accept = $this->item->requireAcceptance(); - - $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); - - return (new MailMessage)->markdown('notifications.markdown.checkout-consumable', - [ - 'item' => $this->item, - 'admin' => $this->admin, - 'note' => $this->note, - 'target' => $this->target, - 'eula' => $eula, - 'req_accept' => $req_accept, - 'accept_url' => $accept_url, - ]) - ->subject(trans('mail.Confirm_consumable_delivery')); - } } diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.php index 8e0273c66..1aed0d200 100644 --- a/app/Notifications/CheckoutLicenseSeatNotification.php +++ b/app/Notifications/CheckoutLicenseSeatNotification.php @@ -6,9 +6,11 @@ use App\Models\LicenseSeat; use App\Models\Setting; use App\Models\User; use Illuminate\Bus\Queueable; +use Illuminate\Notifications\Channels\SlackWebhookChannel; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Support\Str; use NotificationChannels\GoogleChat\Card; use NotificationChannels\GoogleChat\GoogleChatChannel; use NotificationChannels\GoogleChat\GoogleChatMessage; @@ -60,35 +62,7 @@ class CheckoutLicenseSeatNotification extends Notification } if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { - $notifyBy[] = 'slack'; - } - - /** - * Only send notifications to users that have email addresses - */ - if ($this->target instanceof User && $this->target->email != '') { - - /** - * Send an email if the asset requires acceptance, - * so the user can accept or decline the asset - */ - if ($this->item->requireAcceptance()) { - $notifyBy[1] = 'mail'; - } - - /** - * Send an email if the item has a EULA, since the user should always receive it - */ - if ($this->item->getEula()) { - $notifyBy[1] = 'mail'; - } - - /** - * Send an email if an email should be sent at checkin/checkout - */ - if ($this->item->checkin_email()) { - $notifyBy[1] = 'mail'; - } + $notifyBy[] = SlackWebhookChannel::class; } return $notifyBy; @@ -125,17 +99,29 @@ class CheckoutLicenseSeatNotification extends Notification $item = $this->item; $note = $this->note; - return MicrosoftTeamsMessage::create() - ->to($this->settings->webhook_endpoint) - ->type('success') - ->addStartGroupToSection('activityTitle') - ->title(trans('mail.License_Checkout_Notification')) - ->addStartGroupToSection('activityText') - ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') - ->fact(trans('mail.License_Checkout_Notification')." by ", $admin->present()->fullName()) - ->fact(trans('mail.assigned_to'), $target->present()->fullName()) - ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) - ->fact(trans('mail.notes'), $note ?: ''); + if(!Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { + return MicrosoftTeamsMessage::create() + ->to($this->settings->webhook_endpoint) + ->type('success') + ->addStartGroupToSection('activityTitle') + ->title(trans('mail.License_Checkout_Notification')) + ->addStartGroupToSection('activityText') + ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle') + ->fact(trans('mail.License_Checkout_Notification')." by ", $admin->present()->fullName()) + ->fact(trans('mail.assigned_to'), $target->present()->fullName()) + ->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count()) + ->fact(trans('mail.notes'), $note ?: ''); + } + + $message = trans('mail.License_Checkout_Notification'); + $details = [ + trans('mail.assigned_to') => $target->present()->fullName(), + trans('mail.license_for') => htmlspecialchars_decode($item->present()->name), + trans('mail.License_Checkout_Notification').' by' => $admin->present()->fullName(), + trans('admin/consumables/general.remaining') => $item->availCount()->count(), + trans('mail.notes') => $note ?: '', + ]; + return array($message, $details); } public function toGoogleChat() { @@ -164,29 +150,4 @@ class CheckoutLicenseSeatNotification extends Notification ); } - - /** - * Get the mail representation of the notification. - * - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail() - { - $eula = method_exists($this->item, 'getEula') ? $this->item->getEula() : ''; - $req_accept = method_exists($this->item, 'requireAcceptance') ? $this->item->requireAcceptance() : 0; - - $accept_url = is_null($this->acceptance) ? null : route('account.accept.item', $this->acceptance); - - return (new MailMessage)->markdown('notifications.markdown.checkout-license', - [ - 'item' => $this->item, - 'admin' => $this->admin, - 'note' => $this->note, - 'target' => $this->target, - 'eula' => $eula, - 'req_accept' => $req_accept, - 'accept_url' => $accept_url, - ]) - ->subject(trans('mail.Confirm_license_delivery')); - } } diff --git a/app/Observers/AccessoryObserver.php b/app/Observers/AccessoryObserver.php index 661d00b4c..0f8b2492c 100644 --- a/app/Observers/AccessoryObserver.php +++ b/app/Observers/AccessoryObserver.php @@ -20,7 +20,7 @@ class AccessoryObserver $logAction->item_type = Accessory::class; $logAction->item_id = $accessory->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('update'); } @@ -37,7 +37,7 @@ class AccessoryObserver $logAction->item_type = Accessory::class; $logAction->item_id = $accessory->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); if($accessory->imported) { $logAction->setActionSource('importer'); } @@ -56,7 +56,7 @@ class AccessoryObserver $logAction->item_type = Accessory::class; $logAction->item_id = $accessory->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('delete'); } } diff --git a/app/Observers/AssetObserver.php b/app/Observers/AssetObserver.php index f77c4cc00..0d01428ea 100644 --- a/app/Observers/AssetObserver.php +++ b/app/Observers/AssetObserver.php @@ -62,7 +62,7 @@ class AssetObserver $logAction->item_type = Asset::class; $logAction->item_id = $asset->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->log_meta = json_encode($changed); $logAction->logaction('update'); } @@ -108,7 +108,7 @@ class AssetObserver $logAction->item_type = Asset::class; // can we instead say $logAction->item = $asset ? $logAction->item_id = $asset->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); if($asset->imported) { $logAction->setActionSource('importer'); } @@ -127,7 +127,7 @@ class AssetObserver $logAction->item_type = Asset::class; $logAction->item_id = $asset->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('delete'); } @@ -143,7 +143,7 @@ class AssetObserver $logAction->item_type = Asset::class; $logAction->item_id = $asset->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('restore'); } diff --git a/app/Observers/ComponentObserver.php b/app/Observers/ComponentObserver.php index 44bf81935..cd2c58c36 100644 --- a/app/Observers/ComponentObserver.php +++ b/app/Observers/ComponentObserver.php @@ -20,7 +20,7 @@ class ComponentObserver $logAction->item_type = Component::class; $logAction->item_id = $component->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('update'); } @@ -37,7 +37,7 @@ class ComponentObserver $logAction->item_type = Component::class; $logAction->item_id = $component->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); if($component->imported) { $logAction->setActionSource('importer'); } @@ -56,7 +56,7 @@ class ComponentObserver $logAction->item_type = Component::class; $logAction->item_id = $component->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('delete'); } } diff --git a/app/Observers/ConsumableObserver.php b/app/Observers/ConsumableObserver.php index 377995ebb..57471cee9 100644 --- a/app/Observers/ConsumableObserver.php +++ b/app/Observers/ConsumableObserver.php @@ -34,7 +34,7 @@ class ConsumableObserver $logAction->item_type = Consumable::class; $logAction->item_id = $consumable->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->log_meta = json_encode($changed); $logAction->logaction('update'); } @@ -53,7 +53,7 @@ class ConsumableObserver $logAction->item_type = Consumable::class; $logAction->item_id = $consumable->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); if($consumable->imported) { $logAction->setActionSource('importer'); } @@ -98,7 +98,7 @@ class ConsumableObserver $logAction->item_type = Consumable::class; $logAction->item_id = $consumable->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('delete'); } } diff --git a/app/Observers/LicenseObserver.php b/app/Observers/LicenseObserver.php index de4863faf..4e355bf63 100644 --- a/app/Observers/LicenseObserver.php +++ b/app/Observers/LicenseObserver.php @@ -20,7 +20,7 @@ class LicenseObserver $logAction->item_type = License::class; $logAction->item_id = $license->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('update'); } @@ -37,7 +37,7 @@ class LicenseObserver $logAction->item_type = License::class; $logAction->item_id = $license->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); if($license->imported) { $logAction->setActionSource('importer'); } @@ -56,7 +56,7 @@ class LicenseObserver $logAction->item_type = License::class; $logAction->item_id = $license->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('delete'); } } diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index c7c2a460c..acde9ceae 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -83,7 +83,7 @@ class UserObserver $logAction->target_type = User::class; // can we instead say $logAction->item = $asset ? $logAction->target_id = $user->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->log_meta = json_encode($changed); $logAction->logaction('update'); } @@ -105,7 +105,7 @@ class UserObserver $logAction->item_type = User::class; // can we instead say $logAction->item = $asset ? $logAction->item_id = $user->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('create'); } @@ -123,7 +123,7 @@ class UserObserver $logAction->target_type = User::class; // can we instead say $logAction->item = $asset ? $logAction->target_id = $user->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('delete'); } @@ -141,7 +141,7 @@ class UserObserver $logAction->target_type = User::class; // can we instead say $logAction->item = $asset ? $logAction->target_id = $user->id; $logAction->created_at = date('Y-m-d H:i:s'); - $logAction->user_id = Auth::id(); + $logAction->created_by = auth()->id(); $logAction->logaction('restore'); } diff --git a/app/Presenters/AccessoryPresenter.php b/app/Presenters/AccessoryPresenter.php index 4ff3c699c..04f55cf36 100644 --- a/app/Presenters/AccessoryPresenter.php +++ b/app/Presenters/AccessoryPresenter.php @@ -127,6 +127,29 @@ class AccessoryPresenter extends Presenter 'visible' => false, 'title' => trans('general.notes'), 'formatter' => 'notesFormatter' + ], [ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], [ + 'field' => 'created_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.created_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'change', 'searchable' => false, diff --git a/app/Presenters/ActionlogPresenter.php b/app/Presenters/ActionlogPresenter.php index ebbe3d782..9251ce634 100644 --- a/app/Presenters/ActionlogPresenter.php +++ b/app/Presenters/ActionlogPresenter.php @@ -7,7 +7,7 @@ namespace App\Presenters; */ class ActionlogPresenter extends Presenter { - public function admin() + public function adminuser() { if ($user = $this->model->user) { if (empty($user->deleted_at)) { @@ -42,27 +42,27 @@ class ActionlogPresenter extends Presenter // User related icons if ($this->itemType() == 'user') { - if ($this->actionType()=='2fa reset') { + if ($this->action_type == '2fa reset') { return 'fa-solid fa-mobile-screen'; } - if ($this->actionType()=='create new') { + if ($this->action_type == 'create new') { return 'fa-solid fa-user-plus'; } - if ($this->actionType()=='merged') { + if ($this->action_type == 'merged') { return 'fa-solid fa-people-arrows'; } - if ($this->actionType()=='delete') { + if ($this->action_type == 'delete') { return 'fa-solid fa-user-minus'; } - if ($this->actionType()=='delete') { + if ($this->action_type == 'delete') { return 'fa-solid fa-user-minus'; } - if ($this->actionType()=='update') { + if ($this->action_type == 'update') { return 'fa-solid fa-user-pen'; } @@ -70,31 +70,31 @@ class ActionlogPresenter extends Presenter } // Everything else - if ($this->actionType()=='create new') { + if ($this->action_type == 'create new') { return 'fa-solid fa-plus'; } - if ($this->actionType()=='delete') { + if ($this->action_type == 'delete') { return 'fa-solid fa-trash'; } - if ($this->actionType()=='update') { + if ($this->action_type == 'update') { return 'fa-solid fa-pen'; } - if ($this->actionType()=='restore') { + if ($this->action_type == 'restore') { return 'fa-solid fa-trash-arrow-up'; } - if ($this->actionType()=='upload') { + if ($this->action_type == 'upload') { return 'fas fa-paperclip'; } - if ($this->actionType()=='checkout') { + if ($this->action_type == 'checkout') { return 'fa-solid fa-rotate-left'; } - if ($this->actionType()=='checkin from') { + if ($this->action_type == 'checkin from') { return 'fa-solid fa-rotate-right'; } diff --git a/app/Presenters/AssetMaintenancesPresenter.php b/app/Presenters/AssetMaintenancesPresenter.php index 3908720dc..ca49c931a 100644 --- a/app/Presenters/AssetMaintenancesPresenter.php +++ b/app/Presenters/AssetMaintenancesPresenter.php @@ -117,12 +117,29 @@ class AssetMaintenancesPresenter extends Presenter 'title' => trans('admin/asset_maintenances/form.cost'), 'class' => 'text-right', ], [ - 'field' => 'user_id', - 'searchable' => true, + 'field' => 'created_by', + 'searchable' => false, 'sortable' => true, - 'title' => trans('general.admin'), + 'title' => trans('general.created_by'), + 'visible' => false, 'formatter' => 'usersLinkObjFormatter', ], [ + 'field' => 'created_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.created_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ],[ 'field' => 'actions', 'searchable' => false, 'sortable' => false, diff --git a/app/Presenters/AssetModelPresenter.php b/app/Presenters/AssetModelPresenter.php index da93092b9..324cc7d09 100644 --- a/app/Presenters/AssetModelPresenter.php +++ b/app/Presenters/AssetModelPresenter.php @@ -135,19 +135,27 @@ class AssetModelPresenter extends Presenter 'formatter' => 'notesFormatter', ], [ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], [ 'field' => 'created_at', 'searchable' => true, 'sortable' => true, - 'visible' => false, + 'switchable' => true, 'title' => trans('general.created_at'), + 'visible' => false, 'formatter' => 'dateDisplayFormatter', - ], - [ + ], [ 'field' => 'updated_at', 'searchable' => true, 'sortable' => true, - 'visible' => false, + 'switchable' => true, 'title' => trans('general.updated_at'), + 'visible' => false, 'formatter' => 'dateDisplayFormatter', ], diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index b86135f33..19bd2985e 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -233,18 +233,28 @@ class AssetPresenter extends Presenter 'title' => trans('general.user_requests_count'), ], [ - 'field' => 'created_at', + 'field' => 'created_by', 'searchable' => false, 'sortable' => true, + 'title' => trans('general.created_by'), 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], + [ + 'field' => 'created_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, 'title' => trans('general.created_at'), + 'visible' => false, 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'updated_at', - 'searchable' => false, + 'searchable' => true, 'sortable' => true, - 'visible' => false, + 'switchable' => true, 'title' => trans('general.updated_at'), + 'visible' => false, 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'last_checkout', @@ -579,6 +589,6 @@ class AssetPresenter extends Presenter public function glyph() { - return ''; + return ''; } } diff --git a/app/Presenters/CategoryPresenter.php b/app/Presenters/CategoryPresenter.php index fbf431637..f551c0ba1 100644 --- a/app/Presenters/CategoryPresenter.php +++ b/app/Presenters/CategoryPresenter.php @@ -77,19 +77,28 @@ class CategoryPresenter extends Presenter "title" => trans('admin/categories/general.use_default_eula_column'), 'visible' => true, "formatter" => 'trueFalseFormatter', + ],[ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', ], [ 'field' => 'created_at', 'searchable' => true, 'sortable' => true, - 'visible' => false, + 'switchable' => true, 'title' => trans('general.created_at'), + 'visible' => false, 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'updated_at', 'searchable' => true, 'sortable' => true, - 'visible' => false, + 'switchable' => true, 'title' => trans('general.updated_at'), + 'visible' => false, 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'actions', diff --git a/app/Presenters/CompanyPresenter.php b/app/Presenters/CompanyPresenter.php index 7603191fc..6f9ece214 100644 --- a/app/Presenters/CompanyPresenter.php +++ b/app/Presenters/CompanyPresenter.php @@ -65,54 +65,69 @@ class CompanyPresenter extends Presenter 'field' => 'users_count', 'searchable' => false, 'sortable' => true, - 'title' => '', + 'title' => trans('general.users'), 'visible' => true, + 'class' => 'css-users', ], [ 'field' => 'assets_count', 'searchable' => false, 'sortable' => true, - 'title' => '', + 'title' => trans('general.assets'), 'visible' => true, + 'class' => 'css-barcode', ], [ 'field' => 'licenses_count', 'searchable' => false, 'sortable' => true, + 'title' => trans('general.licenses'), 'visible' => true, - 'title' => ' ', + 'class' => 'css-license', ], [ 'field' => 'accessories_count', 'searchable' => false, 'sortable' => true, + 'title' => trans('general.accessories'), 'visible' => true, - 'title' => ' ', + 'class' => 'css-accessory', ], [ 'field' => 'consumables_count', 'searchable' => false, 'sortable' => true, + 'title' => trans('general.consumables'), 'visible' => true, - 'title' => ' ', + 'class' => 'css-consumable', ], [ 'field' => 'components_count', 'searchable' => false, 'sortable' => true, + 'title' => trans('general.components'), 'visible' => true, - 'title' => ' ', - ], [ - 'field' => 'updated_at', + 'class' => 'css-component', + ],[ + 'field' => 'created_by', 'searchable' => false, 'sortable' => true, + 'title' => trans('general.created_by'), 'visible' => false, - 'title' => trans('general.updated_at'), - 'formatter' => 'createdAtFormatter', + 'formatter' => 'usersLinkObjFormatter', ], [ 'field' => 'created_at', - 'searchable' => false, + 'searchable' => true, 'sortable' => true, - 'visible' => false, + 'switchable' => true, 'title' => trans('general.created_at'), - 'formatter' => 'createdAtFormatter', + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'actions', 'searchable' => false, diff --git a/app/Presenters/ComponentPresenter.php b/app/Presenters/ComponentPresenter.php index d142d7abc..39a177592 100644 --- a/app/Presenters/ComponentPresenter.php +++ b/app/Presenters/ComponentPresenter.php @@ -66,8 +66,20 @@ class ComponentPresenter extends Presenter 'title' => trans('general.supplier'), 'visible' => false, 'formatter' => 'suppliersLinkObjFormatter', - ], - [ + ], [ + 'field' => 'model_number', + 'searchable' => true, + 'sortable' => true, + 'title' => trans('admin/models/table.modelnumber'), + ], [ + 'field' => 'manufacturer', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.manufacturer'), + 'visible' => false, + 'formatter' => 'manufacturersLinkObjFormatter', + ], [ 'field' => 'qty', 'searchable' => false, 'sortable' => true, @@ -119,6 +131,27 @@ class ComponentPresenter extends Presenter 'visible' => false, 'title' => trans('general.notes'), 'formatter' => 'notesFormatter', + ],[ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ],[ + 'field' => 'created_at', + 'searchable' => false, + 'sortable' => true, + 'visible' => false, + 'title' => trans('general.created_at'), + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => false, + 'sortable' => true, + 'visible' => false, + 'title' => trans('general.updated_at'), + 'formatter' => 'dateDisplayFormatter', ], ]; diff --git a/app/Presenters/ConsumablePresenter.php b/app/Presenters/ConsumablePresenter.php index d3e73de1c..cab8bed8b 100644 --- a/app/Presenters/ConsumablePresenter.php +++ b/app/Presenters/ConsumablePresenter.php @@ -75,13 +75,13 @@ class ConsumablePresenter extends Presenter ], [ 'field' => 'qty', 'searchable' => false, - 'sortable' => false, + 'sortable' => true, 'title' => trans('admin/components/general.total'), 'visible' => true, ], [ 'field' => 'remaining', 'searchable' => false, - 'sortable' => false, + 'sortable' => true, 'title' => trans('admin/components/general.remaining'), 'visible' => true, ], [ @@ -131,6 +131,27 @@ class ConsumablePresenter extends Presenter 'visible' => false, 'title' => trans('general.notes'), 'formatter' => 'notesFormatter', + ], [ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ],[ + 'field' => 'created_at', + 'searchable' => false, + 'sortable' => true, + 'visible' => false, + 'title' => trans('general.created_at'), + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => false, + 'sortable' => true, + 'visible' => false, + 'title' => trans('general.updated_at'), + 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'change', 'searchable' => false, diff --git a/app/Presenters/DepreciationPresenter.php b/app/Presenters/DepreciationPresenter.php index 9df1fe132..3f240fcc5 100644 --- a/app/Presenters/DepreciationPresenter.php +++ b/app/Presenters/DepreciationPresenter.php @@ -47,6 +47,48 @@ class DepreciationPresenter extends Presenter "visible" => true, ], [ + 'field' => 'assets_count', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.assets'), + 'visible' => true, + ], + [ + 'field' => 'models_count', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.asset_models'), + 'visible' => true, + ], [ + 'field' => 'licenses_count', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.licenses'), + 'visible' => true, + ],[ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], [ + 'field' => 'created_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.created_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ 'field' => 'actions', 'searchable' => false, 'sortable' => false, diff --git a/app/Presenters/DepreciationReportPresenter.php b/app/Presenters/DepreciationReportPresenter.php index 50a8b73b5..1d4c45961 100644 --- a/app/Presenters/DepreciationReportPresenter.php +++ b/app/Presenters/DepreciationReportPresenter.php @@ -140,7 +140,7 @@ class DepreciationReportPresenter extends Presenter ], [ "field" => "book_value", "searchable" => true, - "sortable" => true, + "sortable" => false, "visible" => true, "title" => trans('admin/hardware/table.book_value'), "footerFormatter" => 'sumFormatter', @@ -394,6 +394,6 @@ class DepreciationReportPresenter extends Presenter public function glyph() { - return ''; + return ''; } } diff --git a/app/Presenters/LicensePresenter.php b/app/Presenters/LicensePresenter.php index 1545cabd3..4256c2c68 100644 --- a/app/Presenters/LicensePresenter.php +++ b/app/Presenters/LicensePresenter.php @@ -162,7 +162,7 @@ class LicensePresenter extends Presenter 'field' => 'created_by', 'searchable' => false, 'sortable' => true, - 'title' => trans('general.admin'), + 'title' => trans('general.created_by'), 'visible' => false, 'formatter' => 'usersLinkObjFormatter', ], [ diff --git a/app/Presenters/LocationPresenter.php b/app/Presenters/LocationPresenter.php index 56d710ac9..d6bbe0db1 100644 --- a/app/Presenters/LocationPresenter.php +++ b/app/Presenters/LocationPresenter.php @@ -235,7 +235,7 @@ class LocationPresenter extends Presenter public function glyph() { - return ''; + return ''; } public function fullName() diff --git a/app/Presenters/ManufacturerPresenter.php b/app/Presenters/ManufacturerPresenter.php index 3e36cbcde..dfefec299 100644 --- a/app/Presenters/ManufacturerPresenter.php +++ b/app/Presenters/ManufacturerPresenter.php @@ -94,38 +94,52 @@ class ManufacturerPresenter extends Presenter 'searchable' => false, 'sortable' => true, 'switchable' => true, - 'title' => ' ' - .'', + 'title' => trans('general.assets'), 'visible' => true, + 'class' => 'css-barcode', ], [ 'field' => 'licenses_count', 'searchable' => false, 'sortable' => true, 'switchable' => true, - 'title' => ' ' - .'', + 'title' => trans('general.licenses'), 'visible' => true, + 'class' => 'css-license', ], [ 'field' => 'consumables_count', 'searchable' => false, 'sortable' => true, 'switchable' => true, - 'title' => ' ' - .'', + 'title' => trans('general.consumables'), 'visible' => true, + 'class' => 'css-consumable', ], [ 'field' => 'accessories_count', 'searchable' => false, 'sortable' => true, 'switchable' => true, - 'title' => ' ' - .'', + 'title' => trans('general.accessories'), 'visible' => true, - ], - [ + 'class' => 'css-accessory', + ], [ + 'field' => 'components_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.components'), + 'visible' => true, + 'class' => 'css-component', + ], [ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], [ 'field' => 'created_at', 'searchable' => true, 'sortable' => true, @@ -133,9 +147,15 @@ class ManufacturerPresenter extends Presenter 'title' => trans('general.created_at'), 'visible' => false, 'formatter' => 'dateDisplayFormatter', - ], - - [ + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ 'field' => 'actions', 'searchable' => false, 'sortable' => false, diff --git a/app/Presenters/PredefinedKitPresenter.php b/app/Presenters/PredefinedKitPresenter.php index b234653ad..7ce7d8c23 100644 --- a/app/Presenters/PredefinedKitPresenter.php +++ b/app/Presenters/PredefinedKitPresenter.php @@ -27,6 +27,29 @@ class PredefinedKitPresenter extends Presenter 'sortable' => true, 'title' => trans('general.name'), 'formatter' => 'kitsLinkFormatter', + ], [ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], [ + 'field' => 'created_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.created_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', ], ]; diff --git a/app/Presenters/StatusLabelPresenter.php b/app/Presenters/StatusLabelPresenter.php new file mode 100644 index 000000000..2e4340004 --- /dev/null +++ b/app/Presenters/StatusLabelPresenter.php @@ -0,0 +1,115 @@ + 'id', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.id'), + 'visible' => false, + ], [ + 'field' => 'name', + 'searchable' => true, + 'sortable' => true, + 'switchable' => false, + 'title' => trans('general.name'), + 'visible' => true, + 'formatter' => 'statuslabelsAssetLinkFormatter', + ],[ + 'field' => 'type', + 'searchable' => false, + 'sortable' => false, + 'switchable' => false, + 'title' => trans('admin/statuslabels/table.status_type'), + 'visible' => true, + 'formatter' => 'statusLabelTypeFormatter', + ], [ + 'field' => 'assets_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => false, + 'title' => trans('general.assets'), + 'visible' => true, + ], [ + 'field' => 'color', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/statuslabels/table.color'), + 'visible' => true, + 'formatter' => 'colorSqFormatter', + ], [ + 'field' => 'show_in_nav', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/statuslabels/table.show_in_nav'), + 'visible' => true, + 'formatter' => 'trueFalseFormatter', + ], [ + 'field' => 'default_label', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('admin/statuslabels/table.default_label'), + 'visible' => true, + 'formatter' => 'trueFalseFormatter', + ],[ + 'field' => 'notes', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.notes'), + 'visible' => false, + ], [ + 'field' => 'created_by', + 'searchable' => false, + 'sortable' => true, + 'title' => trans('general.created_by'), + 'visible' => false, + 'formatter' => 'usersLinkObjFormatter', + ], [ + 'field' => 'created_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.created_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'actions', + 'searchable' => false, + 'sortable' => false, + 'switchable' => false, + 'title' => trans('table.actions'), + 'formatter' => 'statuslabelsActionsFormatter', + ], + ]; + + return json_encode($layout); + } + + +} diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php index 7054676a9..7ee05da0c 100644 --- a/app/Presenters/UserPresenter.php +++ b/app/Presenters/UserPresenter.php @@ -188,6 +188,14 @@ class UserPresenter extends Presenter 'title' => trans('general.employee_number'), 'visible' => false, ], + [ + 'field' => 'locale', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.language'), + 'visible' => false, + ], [ 'field' => 'department', 'searchable' => true, @@ -353,6 +361,14 @@ class UserPresenter extends Presenter 'title' => trans('general.created_at'), 'visible' => false, 'formatter' => 'dateDisplayFormatter', + ], [ + 'field' => 'updated_at', + 'searchable' => true, + 'sortable' => true, + 'switchable' => true, + 'title' => trans('general.updated_at'), + 'visible' => false, + 'formatter' => 'dateDisplayFormatter', ], [ 'field' => 'start_date', @@ -492,6 +508,6 @@ class UserPresenter extends Presenter public function glyph() { - return ''; + return ''; } } diff --git a/app/Providers/ValidationServiceProvider.php b/app/Providers/ValidationServiceProvider.php index 1f3abca8a..76ba1b629 100644 --- a/app/Providers/ValidationServiceProvider.php +++ b/app/Providers/ValidationServiceProvider.php @@ -31,6 +31,7 @@ class ValidationServiceProvider extends ServiceProvider Validator::extend('email_array', function ($attribute, $value, $parameters, $validator) { $value = str_replace(' ', '', $value); $array = explode(',', $value); + $email_to_validate = []; foreach ($array as $email) { //loop over values $email_to_validate['alert_email'][] = $email; @@ -38,7 +39,7 @@ class ValidationServiceProvider extends ServiceProvider $rules = ['alert_email.*'=>'email']; $messages = [ - 'alert_email.*'=>trans('validation.email_array'), + 'alert_email.*' => trans('validation.custom.email_array'), ]; $validator = Validator::make($email_to_validate, $rules, $messages); diff --git a/app/Rules/AssetCannotBeCheckedOutToNondeployableStatus.php b/app/Rules/AssetCannotBeCheckedOutToNondeployableStatus.php new file mode 100644 index 000000000..c2c451b82 --- /dev/null +++ b/app/Rules/AssetCannotBeCheckedOutToNondeployableStatus.php @@ -0,0 +1,51 @@ + + */ + protected $data = []; + + + /** + * Set the data under validation. + * + * @param array $data + */ + public function setData(array $data): static + { + $this->data = $data; + return $this; + } + + /** + * Run the validation rule. + * + * @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail + */ + public function validate(string $attribute, mixed $value, Closure $fail): void + { + // Check to see if any of the assign-ish fields are set + if ((isset($this->data['assigned_to'])) || (isset($this->data['assigned_user'])) || (isset($this->data['assigned_location'])) || (isset($this->data['assigned_asset'])) || (isset($this->data['assigned_type']))) { + + if (($value) && ($label = Statuslabel::find($value)) && ($label->getStatuslabelType()!='deployable')) { + $fail(trans('admin/hardware/form.asset_not_deployable')); + } + + } + + + } +} diff --git a/app/Rules/UserCannotSwitchCompaniesIfItemsAssigned.php b/app/Rules/UserCannotSwitchCompaniesIfItemsAssigned.php new file mode 100644 index 000000000..a433ee9a2 --- /dev/null +++ b/app/Rules/UserCannotSwitchCompaniesIfItemsAssigned.php @@ -0,0 +1,29 @@ +route('user')->id); + + if (($value) && ($user->allAssignedCount() > 0) && (Setting::getSettings()->full_multiple_companies_support=='1')) { + + // Check for assets with a different company_id than the selected company_id + $user_assets = $user->assets()->where('assets.company_id', '!=', $value)->count(); + if ($user_assets > 0) { + $fail(trans('admin/users/message.error.multi_company_items_assigned')); + } + } + } +} diff --git a/app/Services/PredefinedKitCheckoutService.php b/app/Services/PredefinedKitCheckoutService.php index d68387539..2cf459368 100644 --- a/app/Services/PredefinedKitCheckoutService.php +++ b/app/Services/PredefinedKitCheckoutService.php @@ -157,7 +157,7 @@ class PredefinedKitCheckoutService } // licenses foreach ($license_seats_to_add as $licenseSeat) { - $licenseSeat->user_id = $admin->id; + $licenseSeat->created_by = $admin->id; $licenseSeat->assigned_to = $user->id; if ($licenseSeat->save()) { event(new CheckoutableCheckedOut($licenseSeat, $user, $admin, $note)); diff --git a/composer.json b/composer.json index a72d80839..865878280 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "intervention/image": "^2.5", "javiereguiluz/easyslugger": "^1.0", "laravel-notification-channels/google-chat": "^3.0", - "laravel-notification-channels/microsoft-teams": "^1.1", + "laravel-notification-channels/microsoft-teams": "^1.2", "laravel/framework": "^10.0", "laravel/helpers": "^1.4", "laravel/passport": "^11.0", @@ -55,6 +55,7 @@ "nunomaduro/collision": "^7.0", "okvpn/clock-lts": "^1.0", "onelogin/php-saml": "^3.4", + "osa-eg/laravel-teams-notification": "^2.1", "paragonie/constant_time_encoding": "^2.3", "paragonie/sodium_compat": "^1.19", "phpdocumentor/reflection-docblock": "^5.1", @@ -74,7 +75,6 @@ "ext-exif": "*" }, "require-dev": { - "brianium/paratest": "^7.0", "fakerphp/faker": "^1.16", "larastan/larastan": "^2.9", "mockery/mockery": "^1.4", @@ -120,7 +120,9 @@ ], "post-create-project-cmd": [ "php artisan key:generate" - ] + ], + "coverage:herd:clover": "herd coverage vendor/bin/phpunit --coverage-clover tests/coverage/clover.xml", + "coverage:herd:html": "herd coverage vendor/bin/phpunit --coverage-html tests/coverage/html" }, "config": { "preferred-install": "dist", diff --git a/composer.lock b/composer.lock index 715070df0..88bab2fa4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3819ab4ef72eb77fabe494c0e746b83b", + "content-hash": "0750e3a427347b2a56a05a8b9b533d48", "packages": [ { "name": "alek13/slack", @@ -137,16 +137,16 @@ }, { "name": "aws/aws-crt-php", - "version": "v1.2.5", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/awslabs/aws-crt-php.git", - "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b" + "reference": "a63485b65b6b3367039306496d49737cf1995408" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/0ea1f04ec5aa9f049f97e012d1ed63b76834a31b", - "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/a63485b65b6b3367039306496d49737cf1995408", + "reference": "a63485b65b6b3367039306496d49737cf1995408", "shasum": "" }, "require": { @@ -185,22 +185,22 @@ ], "support": { "issues": "https://github.com/awslabs/aws-crt-php/issues", - "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.5" + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.6" }, - "time": "2024-04-19T21:30:56+00:00" + "time": "2024-06-13T17:21:28+00:00" }, { "name": "aws/aws-sdk-php", - "version": "3.314.6", + "version": "3.323.4", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "d04da330b0201edab71edd33a03b8d5ad6e4a313" + "reference": "e66ee025b1d169fad3c784934f56648d3eec11ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d04da330b0201edab71edd33a03b8d5ad6e4a313", - "reference": "d04da330b0201edab71edd33a03b8d5ad6e4a313", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e66ee025b1d169fad3c784934f56648d3eec11ae", + "reference": "e66ee025b1d169fad3c784934f56648d3eec11ae", "shasum": "" }, "require": { @@ -253,7 +253,10 @@ ], "psr-4": { "Aws\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/data/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -280,9 +283,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.314.6" + "source": "https://github.com/aws/aws-sdk-php/tree/3.323.4" }, - "time": "2024-06-20T18:09:51+00:00" + "time": "2024-10-09T18:10:22+00:00" }, { "name": "bacon/bacon-qr-code", @@ -340,23 +343,23 @@ }, { "name": "barryvdh/laravel-debugbar", - "version": "v3.13.5", + "version": "v3.14.3", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07" + "reference": "c0bee7c08ae2429e4a9ed2bc75679b012db6e3bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/92d86be45ee54edff735e46856f64f14b6a8bb07", - "reference": "92d86be45ee54edff735e46856f64f14b6a8bb07", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/c0bee7c08ae2429e4a9ed2bc75679b012db6e3bd", + "reference": "c0bee7c08ae2429e4a9ed2bc75679b012db6e3bd", "shasum": "" }, "require": { "illuminate/routing": "^9|^10|^11", "illuminate/session": "^9|^10|^11", "illuminate/support": "^9|^10|^11", - "maximebf/debugbar": "~1.22.0", + "maximebf/debugbar": "~1.23.0", "php": "^8.0", "symfony/finder": "^6|^7" }, @@ -369,7 +372,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.13-dev" + "dev-master": "3.14-dev" }, "laravel": { "providers": [ @@ -408,7 +411,7 @@ ], "support": { "issues": "https://github.com/barryvdh/laravel-debugbar/issues", - "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.13.5" + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.14.3" }, "funding": [ { @@ -420,7 +423,7 @@ "type": "github" } ], - "time": "2024-04-12T11:20:37+00:00" + "time": "2024-10-02T09:17:49+00:00" }, { "name": "barryvdh/laravel-dompdf", @@ -630,23 +633,23 @@ }, { "name": "dasprid/enum", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/DASPRiD/Enum.git", - "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016" + "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/6faf451159fb8ba4126b925ed2d78acfce0dc016", - "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8dfd07c6d2cf31c8da90c53b83c026c7696dda90", + "reference": "8dfd07c6d2cf31c8da90c53b83c026c7696dda90", "shasum": "" }, "require": { "php": ">=7.1 <9.0" }, "require-dev": { - "phpunit/phpunit": "^7 | ^8 | ^9", + "phpunit/phpunit": "^7 || ^8 || ^9 || ^10 || ^11", "squizlabs/php_codesniffer": "*" }, "type": "library", @@ -674,9 +677,9 @@ ], "support": { "issues": "https://github.com/DASPRiD/Enum/issues", - "source": "https://github.com/DASPRiD/Enum/tree/1.0.5" + "source": "https://github.com/DASPRiD/Enum/tree/1.0.6" }, - "time": "2023-08-25T16:18:39+00:00" + "time": "2024-08-09T14:30:48+00:00" }, { "name": "defuse/php-encryption", @@ -747,16 +750,16 @@ }, { "name": "dflydev/dot-access-data", - "version": "v3.0.2", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "f41715465d65213d644d3141a6a93081be5d3549" + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/f41715465d65213d644d3141a6a93081be5d3549", - "reference": "f41715465d65213d644d3141a6a93081be5d3549", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", "shasum": "" }, "require": { @@ -816,9 +819,9 @@ ], "support": { "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", - "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.2" + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" }, - "time": "2022-10-27T11:44:00+00:00" + "time": "2024-07-08T12:26:09+00:00" }, { "name": "doctrine/cache", @@ -921,16 +924,16 @@ }, { "name": "doctrine/dbal", - "version": "3.8.6", + "version": "3.9.1", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "b7411825cf7efb7e51f9791dea19d86e43b399a1" + "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/b7411825cf7efb7e51f9791dea19d86e43b399a1", - "reference": "b7411825cf7efb7e51f9791dea19d86e43b399a1", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", + "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", "shasum": "" }, "require": { @@ -946,12 +949,12 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.11.5", + "phpstan/phpstan": "1.12.0", "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "9.6.19", + "phpunit/phpunit": "9.6.20", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.10.1", + "squizlabs/php_codesniffer": "3.10.2", "symfony/cache": "^5.4|^6.0|^7.0", "symfony/console": "^4.4|^5.4|^6.0|^7.0", "vimeo/psalm": "4.30.0" @@ -1014,7 +1017,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.6" + "source": "https://github.com/doctrine/dbal/tree/3.9.1" }, "funding": [ { @@ -1030,7 +1033,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T10:38:17+00:00" + "time": "2024-09-01T13:49:23+00:00" }, { "name": "doctrine/deprecations", @@ -1472,16 +1475,16 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v3.3.3", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "adfb1f505deb6384dc8b39804c5065dd3c8c8c0a" + "reference": "8c784d071debd117328803d86b2097615b457500" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/adfb1f505deb6384dc8b39804c5065dd3c8c8c0a", - "reference": "adfb1f505deb6384dc8b39804c5065dd3c8c8c0a", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/8c784d071debd117328803d86b2097615b457500", + "reference": "8c784d071debd117328803d86b2097615b457500", "shasum": "" }, "require": { @@ -1494,10 +1497,14 @@ "require-dev": { "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.0", - "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^7.0|^8.0|^9.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "autoload": { "psr-4": { "Cron\\": "src/Cron/" @@ -1521,7 +1528,7 @@ ], "support": { "issues": "https://github.com/dragonmantank/cron-expression/issues", - "source": "https://github.com/dragonmantank/cron-expression/tree/v3.3.3" + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.4.0" }, "funding": [ { @@ -1529,7 +1536,7 @@ "type": "github" } ], - "time": "2023-08-10T19:36:49+00:00" + "time": "2024-10-09T13:47:03+00:00" }, { "name": "eduardokum/laravel-mail-auto-embed", @@ -1765,26 +1772,26 @@ }, { "name": "filp/whoops", - "version": "2.15.4", + "version": "2.16.0", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546" + "reference": "befcdc0e5dce67252aa6322d82424be928214fa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546", - "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546", + "url": "https://api.github.com/repos/filp/whoops/zipball/befcdc0e5dce67252aa6322d82424be928214fa2", + "reference": "befcdc0e5dce67252aa6322d82424be928214fa2", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0 || ^8.0", + "php": "^7.1 || ^8.0", "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "require-dev": { - "mockery/mockery": "^0.9 || ^1.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", - "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3", + "symfony/var-dumper": "^4.0 || ^5.0" }, "suggest": { "symfony/var-dumper": "Pretty print complex values better with var-dumper available", @@ -1824,7 +1831,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.15.4" + "source": "https://github.com/filp/whoops/tree/2.16.0" }, "funding": [ { @@ -1832,7 +1839,7 @@ "type": "github" } ], - "time": "2023-11-03T12:00:00+00:00" + "time": "2024-09-25T12:00:00+00:00" }, { "name": "firebase/php-jwt", @@ -1970,24 +1977,24 @@ }, { "name": "graham-campbell/result-type", - "version": "v1.1.2", + "version": "v1.1.3", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2" + "phpoption/phpoption": "^1.9.3" }, "require-dev": { - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "autoload": { @@ -2016,7 +2023,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" }, "funding": [ { @@ -2028,26 +2035,26 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:16:48+00:00" + "time": "2024-07-20T21:45:45+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.8.1", + "version": "7.9.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.1", - "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -2058,9 +2065,9 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "guzzle/client-integration-tests": "3.0.2", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -2138,7 +2145,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" }, "funding": [ { @@ -2154,20 +2161,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:35:24+00:00" + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", "shasum": "" }, "require": { @@ -2175,7 +2182,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { @@ -2221,7 +2228,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.2" + "source": "https://github.com/guzzle/promises/tree/2.0.3" }, "funding": [ { @@ -2237,20 +2244,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:19:20+00:00" + "time": "2024-07-18T10:29:17+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { @@ -2265,8 +2272,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -2337,7 +2344,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.2" + "source": "https://github.com/guzzle/psr7/tree/2.7.0" }, "funding": [ { @@ -2353,7 +2360,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:05:35+00:00" + "time": "2024-07-18T11:15:46+00:00" }, { "name": "guzzlehttp/uri-template", @@ -2675,16 +2682,16 @@ }, { "name": "laravel/framework", - "version": "v10.48.14", + "version": "v10.48.22", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "27cb4736bb7e60a5311ec73160068dfbcf98336b" + "reference": "c4ea52bb044faef4a103d7dd81746c01b2ec860e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/27cb4736bb7e60a5311ec73160068dfbcf98336b", - "reference": "27cb4736bb7e60a5311ec73160068dfbcf98336b", + "url": "https://api.github.com/repos/laravel/framework/zipball/c4ea52bb044faef4a103d7dd81746c01b2ec860e", + "reference": "c4ea52bb044faef4a103d7dd81746c01b2ec860e", "shasum": "" }, "require": { @@ -2878,7 +2885,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-06-21T10:06:42+00:00" + "time": "2024-09-12T15:00:09+00:00" }, { "name": "laravel/helpers", @@ -3017,16 +3024,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.24", + "version": "v0.1.25", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "409b0b4305273472f3754826e68f4edbd0150149" + "reference": "7b4029a84c37cb2725fc7f011586e2997040bc95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", - "reference": "409b0b4305273472f3754826e68f4edbd0150149", + "url": "https://api.github.com/repos/laravel/prompts/zipball/7b4029a84c37cb2725fc7f011586e2997040bc95", + "reference": "7b4029a84c37cb2725fc7f011586e2997040bc95", "shasum": "" }, "require": { @@ -3069,32 +3076,33 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.24" + "source": "https://github.com/laravel/prompts/tree/v0.1.25" }, - "time": "2024-06-17T13:58:22+00:00" + "time": "2024-08-12T22:06:33+00:00" }, { "name": "laravel/serializable-closure", - "version": "v1.3.3", + "version": "v1.3.5", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "3dbf8a8e914634c48d389c1234552666b3d43754" + "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3dbf8a8e914634c48d389c1234552666b3d43754", - "reference": "3dbf8a8e914634c48d389c1234552666b3d43754", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", + "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", "shasum": "" }, "require": { "php": "^7.3|^8.0" }, "require-dev": { - "nesbot/carbon": "^2.61", + "illuminate/support": "^8.0|^9.0|^10.0|^11.0", + "nesbot/carbon": "^2.61|^3.0", "pestphp/pest": "^1.21.3", "phpstan/phpstan": "^1.8.2", - "symfony/var-dumper": "^5.4.11" + "symfony/var-dumper": "^5.4.11|^6.2.0|^7.0.0" }, "type": "library", "extra": { @@ -3131,7 +3139,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2023-11-08T14:08:06+00:00" + "time": "2024-09-23T13:33:08+00:00" }, { "name": "laravel/slack-notification-channel", @@ -3196,16 +3204,16 @@ }, { "name": "laravel/socialite", - "version": "v5.15.0", + "version": "v5.16.0", "source": { "type": "git", "url": "https://github.com/laravel/socialite.git", - "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446" + "reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/socialite/zipball/c8234bfb286a8210df8d62f94562c71bfda4a446", - "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446", + "url": "https://api.github.com/repos/laravel/socialite/zipball/40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf", + "reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf", "shasum": "" }, "require": { @@ -3264,20 +3272,20 @@ "issues": "https://github.com/laravel/socialite/issues", "source": "https://github.com/laravel/socialite" }, - "time": "2024-06-11T13:33:20+00:00" + "time": "2024-09-03T09:46:57+00:00" }, { "name": "laravel/tinker", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe" + "reference": "ba4d51eb56de7711b3a37d63aa0643e99a339ae5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/502e0fe3f0415d06d5db1f83a472f0f3b754bafe", - "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe", + "url": "https://api.github.com/repos/laravel/tinker/zipball/ba4d51eb56de7711b3a37d63aa0643e99a339ae5", + "reference": "ba4d51eb56de7711b3a37d63aa0643e99a339ae5", "shasum": "" }, "require": { @@ -3328,9 +3336,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.9.0" + "source": "https://github.com/laravel/tinker/tree/v2.10.0" }, - "time": "2024-01-04T16:10:04+00:00" + "time": "2024-09-23T13:32:56+00:00" }, { "name": "laravel/ui", @@ -3543,16 +3551,16 @@ }, { "name": "league/commonmark", - "version": "2.4.2", + "version": "2.5.3", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "91c24291965bd6d7c46c46a12ba7492f83b1cadf" + "reference": "b650144166dfa7703e62a22e493b853b58d874b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/91c24291965bd6d7c46c46a12ba7492f83b1cadf", - "reference": "91c24291965bd6d7c46c46a12ba7492f83b1cadf", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b650144166dfa7703e62a22e493b853b58d874b0", + "reference": "b650144166dfa7703e62a22e493b853b58d874b0", "shasum": "" }, "require": { @@ -3565,8 +3573,8 @@ }, "require-dev": { "cebe/markdown": "^1.0", - "commonmark/cmark": "0.30.3", - "commonmark/commonmark.js": "0.30.0", + "commonmark/cmark": "0.31.1", + "commonmark/commonmark.js": "0.31.1", "composer/package-versions-deprecated": "^1.8", "embed/embed": "^4.4", "erusev/parsedown": "^1.0", @@ -3588,7 +3596,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "2.6-dev" } }, "autoload": { @@ -3645,7 +3653,7 @@ "type": "tidelift" } ], - "time": "2024-02-02T11:59:32+00:00" + "time": "2024-08-16T11:46:16+00:00" }, { "name": "league/config", @@ -3731,16 +3739,16 @@ }, { "name": "league/csv", - "version": "9.16.0", + "version": "9.17.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440" + "reference": "8cab815fb11ec93aa2f7b8a57b3daa1f1a364011" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/998280c6c34bd67d8125fdc8b45bae28d761b440", - "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/8cab815fb11ec93aa2f7b8a57b3daa1f1a364011", + "reference": "8cab815fb11ec93aa2f7b8a57b3daa1f1a364011", "shasum": "" }, "require": { @@ -3748,17 +3756,16 @@ "php": "^8.1.2" }, "require-dev": { - "doctrine/collections": "^2.2.2", "ext-dom": "*", "ext-xdebug": "*", - "friendsofphp/php-cs-fixer": "^3.57.1", - "phpbench/phpbench": "^1.2.15", - "phpstan/phpstan": "^1.11.1", - "phpstan/phpstan-deprecation-rules": "^1.2.0", + "friendsofphp/php-cs-fixer": "^3.64.0", + "phpbench/phpbench": "^1.3.1", + "phpstan/phpstan": "^1.12.5", + "phpstan/phpstan-deprecation-rules": "^1.2.1", "phpstan/phpstan-phpunit": "^1.4.0", - "phpstan/phpstan-strict-rules": "^1.6.0", - "phpunit/phpunit": "^10.5.16 || ^11.1.3", - "symfony/var-dumper": "^6.4.6 || ^7.0.7" + "phpstan/phpstan-strict-rules": "^1.6.1", + "phpunit/phpunit": "^10.5.16 || ^11.4.0", + "symfony/var-dumper": "^6.4.8 || ^7.1.5" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", @@ -3776,7 +3783,7 @@ "src/functions_include.php" ], "psr-4": { - "League\\Csv\\": "src" + "League\\Csv\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3815,7 +3822,7 @@ "type": "github" } ], - "time": "2024-05-24T11:04:54+00:00" + "time": "2024-10-10T10:30:28+00:00" }, { "name": "league/event", @@ -3873,16 +3880,16 @@ }, { "name": "league/flysystem", - "version": "3.28.0", + "version": "3.29.1", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c" + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c", - "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/edc1bb7c86fab0776c3287dbd19b5fa278347319", + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319", "shasum": "" }, "require": { @@ -3950,22 +3957,22 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.28.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.29.1" }, - "time": "2024-05-22T10:09:12+00:00" + "time": "2024-10-08T08:58:34+00:00" }, { "name": "league/flysystem-aws-s3-v3", - "version": "3.28.0", + "version": "3.29.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "22071ef1604bc776f5ff2468ac27a752514665c8" + "reference": "c6ff6d4606e48249b63f269eba7fabdb584e76a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/22071ef1604bc776f5ff2468ac27a752514665c8", - "reference": "22071ef1604bc776f5ff2468ac27a752514665c8", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/c6ff6d4606e48249b63f269eba7fabdb584e76a9", + "reference": "c6ff6d4606e48249b63f269eba7fabdb584e76a9", "shasum": "" }, "require": { @@ -4005,22 +4012,22 @@ "storage" ], "support": { - "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.28.0" + "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.29.0" }, - "time": "2024-05-06T20:05:52+00:00" + "time": "2024-08-17T13:10:48+00:00" }, { "name": "league/flysystem-local", - "version": "3.28.0", + "version": "3.29.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-local.git", - "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40" + "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/13f22ea8be526ea58c2ddff9e158ef7c296e4f40", - "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e0e8d52ce4b2ed154148453d321e97c8e931bd27", + "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27", "shasum": "" }, "require": { @@ -4054,22 +4061,22 @@ "local" ], "support": { - "source": "https://github.com/thephpleague/flysystem-local/tree/3.28.0" + "source": "https://github.com/thephpleague/flysystem-local/tree/3.29.0" }, - "time": "2024-05-06T20:05:52+00:00" + "time": "2024-08-09T21:24:39+00:00" }, { "name": "league/mime-type-detection", - "version": "1.15.0", + "version": "1.16.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301" + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", - "reference": "ce0f4d1e8a6f4eb0ddff33f57c69c50fd09f4301", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9", "shasum": "" }, "require": { @@ -4100,7 +4107,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.15.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0" }, "funding": [ { @@ -4112,7 +4119,7 @@ "type": "tidelift" } ], - "time": "2024-01-28T23:22:08+00:00" + "time": "2024-09-21T08:32:55+00:00" }, { "name": "league/oauth1-client", @@ -4454,16 +4461,16 @@ }, { "name": "livewire/livewire", - "version": "v3.5.1", + "version": "v3.5.12", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "da044261bb5c5449397f18fda3409f14acf47c0a" + "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/da044261bb5c5449397f18fda3409f14acf47c0a", - "reference": "da044261bb5c5449397f18fda3409f14acf47c0a", + "url": "https://api.github.com/repos/livewire/livewire/zipball/3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d", + "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d", "shasum": "" }, "require": { @@ -4471,6 +4478,7 @@ "illuminate/routing": "^10.0|^11.0", "illuminate/support": "^10.0|^11.0", "illuminate/validation": "^10.0|^11.0", + "laravel/prompts": "^0.1.24|^0.2|^0.3", "league/mime-type-detection": "^1.9", "php": "^8.1", "symfony/console": "^6.0|^7.0", @@ -4479,7 +4487,6 @@ "require-dev": { "calebporzio/sushi": "^2.1", "laravel/framework": "^10.15.0|^11.0", - "laravel/prompts": "^0.1.6", "mockery/mockery": "^1.3.1", "orchestra/testbench": "^8.21.0|^9.0", "orchestra/testbench-dusk": "^8.24|^9.1", @@ -4518,7 +4525,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.5.1" + "source": "https://github.com/livewire/livewire/tree/v3.5.12" }, "funding": [ { @@ -4526,7 +4533,7 @@ "type": "github" } ], - "time": "2024-06-18T11:10:42+00:00" + "time": "2024-10-15T19:35:06+00:00" }, { "name": "masterminds/html5", @@ -4597,16 +4604,16 @@ }, { "name": "maximebf/debugbar", - "version": "v1.22.3", + "version": "v1.23.2", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96" + "reference": "689720d724c771ac4add859056744b7b3f2406da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", - "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/689720d724c771ac4add859056744b7b3f2406da", + "reference": "689720d724c771ac4add859056744b7b3f2406da", "shasum": "" }, "require": { @@ -4628,7 +4635,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.22-dev" + "dev-master": "1.23-dev" } }, "autoload": { @@ -4659,22 +4666,22 @@ ], "support": { "issues": "https://github.com/maximebf/php-debugbar/issues", - "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.3" + "source": "https://github.com/maximebf/php-debugbar/tree/v1.23.2" }, - "time": "2024-04-03T19:39:26+00:00" + "time": "2024-09-16T11:23:09+00:00" }, { "name": "monolog/monolog", - "version": "3.6.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654" + "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", - "reference": "4b18b21a5527a3d5ffdac2fd35d3ab25a9597654", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f4393b648b78a5408747de94fca38beb5f7e9ef8", + "reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8", "shasum": "" }, "require": { @@ -4750,7 +4757,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.6.0" + "source": "https://github.com/Seldaek/monolog/tree/3.7.0" }, "funding": [ { @@ -4762,20 +4769,20 @@ "type": "tidelift" } ], - "time": "2024-04-12T21:02:21+00:00" + "time": "2024-06-28T09:40:51+00:00" }, { "name": "mtdowling/jmespath.php", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b" + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/bbb69a935c2cbb0c03d7f481a238027430f6440b", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", "shasum": "" }, "require": { @@ -4792,7 +4799,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -4826,9 +4833,9 @@ ], "support": { "issues": "https://github.com/jmespath/jmespath.php/issues", - "source": "https://github.com/jmespath/jmespath.php/tree/2.7.0" + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" }, - "time": "2023-08-25T10:54:48+00:00" + "time": "2024-09-04T18:46:31+00:00" }, { "name": "neitanod/forceutf8", @@ -4980,24 +4987,24 @@ }, { "name": "nette/schema", - "version": "v1.3.0", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188" + "reference": "da801d52f0354f70a638673c4a0f04e16529431d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", + "url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d", + "reference": "da801d52f0354f70a638673c4a0f04e16529431d", "shasum": "" }, "require": { "nette/utils": "^4.0", - "php": "8.1 - 8.3" + "php": "8.1 - 8.4" }, "require-dev": { - "nette/tester": "^2.4", + "nette/tester": "^2.5.2", "phpstan/phpstan-nette": "^1.0", "tracy/tracy": "^2.8" }, @@ -5036,26 +5043,26 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.0" + "source": "https://github.com/nette/schema/tree/v1.3.2" }, - "time": "2023-12-11T11:54:22+00:00" + "time": "2024-10-06T23:10:23+00:00" }, { "name": "nette/utils", - "version": "v4.0.4", + "version": "v4.0.5", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "d3ad0aa3b9f934602cb3e3902ebccf10be34d218" + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/d3ad0aa3b9f934602cb3e3902ebccf10be34d218", - "reference": "d3ad0aa3b9f934602cb3e3902ebccf10be34d218", + "url": "https://api.github.com/repos/nette/utils/zipball/736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", + "reference": "736c567e257dbe0fcf6ce81b4d6dbe05c6899f96", "shasum": "" }, "require": { - "php": ">=8.0 <8.4" + "php": "8.0 - 8.4" }, "conflict": { "nette/finder": "<3", @@ -5122,22 +5129,22 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.0.4" + "source": "https://github.com/nette/utils/tree/v4.0.5" }, - "time": "2024-01-17T16:50:36+00:00" + "time": "2024-08-07T15:39:19+00:00" }, { "name": "nikic/php-parser", - "version": "v4.19.1", + "version": "v4.19.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" + "reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/715f4d25e225bc47b293a8b997fe6ce99bf987d2", + "reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2", "shasum": "" }, "require": { @@ -5146,7 +5153,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -5178,9 +5185,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.4" }, - "time": "2024-03-17T08:10:35+00:00" + "time": "2024-09-29T15:01:53+00:00" }, { "name": "nunomaduro/collision", @@ -5366,16 +5373,16 @@ }, { "name": "nyholm/psr7", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/Nyholm/psr7.git", - "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e" + "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nyholm/psr7/zipball/aa5fc277a4f5508013d571341ade0c3886d4d00e", - "reference": "aa5fc277a4f5508013d571341ade0c3886d4d00e", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3", + "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3", "shasum": "" }, "require": { @@ -5428,7 +5435,7 @@ ], "support": { "issues": "https://github.com/Nyholm/psr7/issues", - "source": "https://github.com/Nyholm/psr7/tree/1.8.1" + "source": "https://github.com/Nyholm/psr7/tree/1.8.2" }, "funding": [ { @@ -5440,7 +5447,7 @@ "type": "github" } ], - "time": "2023-11-13T09:31:12+00:00" + "time": "2024-09-09T07:06:30+00:00" }, { "name": "okvpn/clock-lts", @@ -5565,6 +5572,71 @@ ], "time": "2024-05-30T15:14:26+00:00" }, + { + "name": "osa-eg/laravel-teams-notification", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/osa-eg/laravel-teams-notification.git", + "reference": "76173689930aca92b5174a3b102e705279192c0f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/osa-eg/laravel-teams-notification/zipball/76173689930aca92b5174a3b102e705279192c0f", + "reference": "76173689930aca92b5174a3b102e705279192c0f", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": ">=6.5", + "illuminate/support": "^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0", + "monolog/monolog": ">=1.0", + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Osama\\LaravelTeamsNotification\\LaravelTeamsNotificationServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Osama\\LaravelTeamsNotification\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Osama Saad", + "email": "osaad96eg@gmail.com" + } + ], + "description": "A Laravel package to send notifications to Microsoft Teams", + "keywords": [ + "Teams", + "adaptive-card", + "laravel", + "logging", + "microsoft-teams-workflow", + "notification", + "teams-connector", + "teams-webhock", + "teams-workflow", + "teams_logging" + ], + "support": { + "issues": "https://github.com/osa-eg/laravel-teams-notification/issues", + "source": "https://github.com/osa-eg/laravel-teams-notification/tree/v2.1.2" + }, + "time": "2024-09-23T05:24:48+00:00" + }, { "name": "paragonie/constant_time_encoding", "version": "v2.7.0", @@ -6035,16 +6107,16 @@ }, { "name": "phpoption/phpoption", - "version": "1.9.2", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", "shasum": "" }, "require": { @@ -6052,13 +6124,13 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "1.9-dev" @@ -6094,7 +6166,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" }, "funding": [ { @@ -6106,20 +6178,20 @@ "type": "tidelift" } ], - "time": "2023-11-12T21:59:55+00:00" + "time": "2024-07-20T21:41:07+00:00" }, { "name": "phpseclib/phpseclib", - "version": "3.0.38", + "version": "3.0.42", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "b18b8788e51156c4dd97b7f220a31149a0052067" + "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b18b8788e51156c4dd97b7f220a31149a0052067", - "reference": "b18b8788e51156c4dd97b7f220a31149a0052067", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db92f1b1987b12b13f248fe76c3a52cadb67bb98", + "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98", "shasum": "" }, "require": { @@ -6200,7 +6272,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.38" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.42" }, "funding": [ { @@ -6216,7 +6288,7 @@ "type": "tidelift" } ], - "time": "2024-06-17T10:11:32+00:00" + "time": "2024-09-16T03:06:04+00:00" }, { "name": "phpspec/prophecy", @@ -6289,16 +6361,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.1", + "version": "1.32.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" + "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", - "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6ca22b154efdd9e3c68c56f5d94670920a1c19a4", + "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4", "shasum": "" }, "require": { @@ -6330,30 +6402,30 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.32.0" }, - "time": "2024-05-31T08:52:43+00:00" + "time": "2024-09-26T07:23:32+00:00" }, { "name": "pragmarx/google2fa", - "version": "v8.0.1", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/antonioribeiro/google2fa.git", - "reference": "80c3d801b31fe165f8fe99ea085e0a37834e1be3" + "reference": "6f8d87ebd5afbf7790bde1ffc7579c7c705e0fad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antonioribeiro/google2fa/zipball/80c3d801b31fe165f8fe99ea085e0a37834e1be3", - "reference": "80c3d801b31fe165f8fe99ea085e0a37834e1be3", + "url": "https://api.github.com/repos/antonioribeiro/google2fa/zipball/6f8d87ebd5afbf7790bde1ffc7579c7c705e0fad", + "reference": "6f8d87ebd5afbf7790bde1ffc7579c7c705e0fad", "shasum": "" }, "require": { - "paragonie/constant_time_encoding": "^1.0|^2.0", + "paragonie/constant_time_encoding": "^1.0|^2.0|^3.0", "php": "^7.1|^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.18", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^7.5.15|^8.5|^9.0" }, "type": "library", @@ -6382,9 +6454,9 @@ ], "support": { "issues": "https://github.com/antonioribeiro/google2fa/issues", - "source": "https://github.com/antonioribeiro/google2fa/tree/v8.0.1" + "source": "https://github.com/antonioribeiro/google2fa/tree/v8.0.3" }, - "time": "2022-06-13T21:57:56+00:00" + "time": "2024-09-05T11:56:40+00:00" }, { "name": "pragmarx/google2fa-laravel", @@ -6885,16 +6957,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -6929,9 +7001,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "psr/simple-cache", @@ -7467,16 +7539,16 @@ }, { "name": "sabberworm/php-css-parser", - "version": "v8.5.1", + "version": "v8.6.0", "source": { "type": "git", "url": "https://github.com/MyIntervals/PHP-CSS-Parser.git", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152" + "reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/4a3d572b0f8b28bb6fd016ae8bbfc445facef152", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152", + "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/d2fb94a9641be84d79c7548c6d39bbebba6e9a70", + "reference": "d2fb94a9641be84d79c7548c6d39bbebba6e9a70", "shasum": "" }, "require": { @@ -7526,22 +7598,22 @@ ], "support": { "issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues", - "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.5.1" + "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.6.0" }, - "time": "2024-02-15T16:41:13+00:00" + "time": "2024-07-01T07:33:21+00:00" }, { "name": "sebastian/comparator", - "version": "5.0.1", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", "shasum": "" }, "require": { @@ -7552,7 +7624,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.3" + "phpunit/phpunit": "^10.4" }, "type": "library", "extra": { @@ -7597,7 +7669,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.2" }, "funding": [ { @@ -7605,7 +7677,7 @@ "type": "github" } ], - "time": "2023-08-14T13:18:12+00:00" + "time": "2024-08-12T06:03:08+00:00" }, { "name": "sebastian/diff", @@ -7817,16 +7889,16 @@ }, { "name": "spatie/backtrace", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/spatie/backtrace.git", - "reference": "8373b9d51638292e3bfd736a9c19a654111b4a23" + "reference": "1a9a145b044677ae3424693f7b06479fc8c137a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/backtrace/zipball/8373b9d51638292e3bfd736a9c19a654111b4a23", - "reference": "8373b9d51638292e3bfd736a9c19a654111b4a23", + "url": "https://api.github.com/repos/spatie/backtrace/zipball/1a9a145b044677ae3424693f7b06479fc8c137a9", + "reference": "1a9a145b044677ae3424693f7b06479fc8c137a9", "shasum": "" }, "require": { @@ -7864,7 +7936,7 @@ "spatie" ], "support": { - "source": "https://github.com/spatie/backtrace/tree/1.6.1" + "source": "https://github.com/spatie/backtrace/tree/1.6.2" }, "funding": [ { @@ -7876,20 +7948,20 @@ "type": "other" } ], - "time": "2024-04-24T13:22:11+00:00" + "time": "2024-07-22T08:21:24+00:00" }, { "name": "spatie/db-dumper", - "version": "3.6.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/spatie/db-dumper.git", - "reference": "faca5056830bccea04eadf07e8074669cb9e905e" + "reference": "22553ab8c34a9bb70645cb9bc2d9f236f3135705" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/db-dumper/zipball/faca5056830bccea04eadf07e8074669cb9e905e", - "reference": "faca5056830bccea04eadf07e8074669cb9e905e", + "url": "https://api.github.com/repos/spatie/db-dumper/zipball/22553ab8c34a9bb70645cb9bc2d9f236f3135705", + "reference": "22553ab8c34a9bb70645cb9bc2d9f236f3135705", "shasum": "" }, "require": { @@ -7927,7 +7999,7 @@ "spatie" ], "support": { - "source": "https://github.com/spatie/db-dumper/tree/3.6.0" + "source": "https://github.com/spatie/db-dumper/tree/3.7.0" }, "funding": [ { @@ -7939,20 +8011,20 @@ "type": "github" } ], - "time": "2024-04-24T14:54:13+00:00" + "time": "2024-09-23T08:58:35+00:00" }, { "name": "spatie/error-solutions", - "version": "1.0.1", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/spatie/error-solutions.git", - "reference": "d60d4d2ef4b7701c86134ded959667cac6215233" + "reference": "ae7393122eda72eed7cc4f176d1e96ea444f2d67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/error-solutions/zipball/d60d4d2ef4b7701c86134ded959667cac6215233", - "reference": "d60d4d2ef4b7701c86134ded959667cac6215233", + "url": "https://api.github.com/repos/spatie/error-solutions/zipball/ae7393122eda72eed7cc4f176d1e96ea444f2d67", + "reference": "ae7393122eda72eed7cc4f176d1e96ea444f2d67", "shasum": "" }, "require": { @@ -8005,7 +8077,7 @@ ], "support": { "issues": "https://github.com/spatie/error-solutions/issues", - "source": "https://github.com/spatie/error-solutions/tree/1.0.1" + "source": "https://github.com/spatie/error-solutions/tree/1.1.1" }, "funding": [ { @@ -8013,20 +8085,20 @@ "type": "github" } ], - "time": "2024-06-21T10:09:00+00:00" + "time": "2024-07-25T11:06:04+00:00" }, { "name": "spatie/flare-client-php", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/spatie/flare-client-php.git", - "reference": "097040ff51e660e0f6fc863684ac4b02c93fa234" + "reference": "180f8ca4c0d0d6fc51477bd8c53ce37ab5a96122" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/097040ff51e660e0f6fc863684ac4b02c93fa234", - "reference": "097040ff51e660e0f6fc863684ac4b02c93fa234", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/180f8ca4c0d0d6fc51477bd8c53ce37ab5a96122", + "reference": "180f8ca4c0d0d6fc51477bd8c53ce37ab5a96122", "shasum": "" }, "require": { @@ -8044,7 +8116,7 @@ "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "spatie/phpunit-snapshot-assertions": "^4.0|^5.0" + "spatie/pest-plugin-snapshots": "^1.0|^2.0" }, "type": "library", "extra": { @@ -8074,7 +8146,7 @@ ], "support": { "issues": "https://github.com/spatie/flare-client-php/issues", - "source": "https://github.com/spatie/flare-client-php/tree/1.7.0" + "source": "https://github.com/spatie/flare-client-php/tree/1.8.0" }, "funding": [ { @@ -8082,7 +8154,7 @@ "type": "github" } ], - "time": "2024-06-12T14:39:14+00:00" + "time": "2024-08-01T08:27:26+00:00" }, { "name": "spatie/ignition", @@ -8169,16 +8241,16 @@ }, { "name": "spatie/laravel-backup", - "version": "8.8.1", + "version": "8.8.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-backup.git", - "reference": "a9c2d2f726f4c60c2dc5d7c0c8380f72492638c2" + "reference": "5b672713283703a74c629ccd67b1d77eb57e24b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/a9c2d2f726f4c60c2dc5d7c0c8380f72492638c2", - "reference": "a9c2d2f726f4c60c2dc5d7c0c8380f72492638c2", + "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/5b672713283703a74c629ccd67b1d77eb57e24b9", + "reference": "5b672713283703a74c629ccd67b1d77eb57e24b9", "shasum": "" }, "require": { @@ -8252,7 +8324,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-backup/issues", - "source": "https://github.com/spatie/laravel-backup/tree/8.8.1" + "source": "https://github.com/spatie/laravel-backup/tree/8.8.2" }, "funding": [ { @@ -8264,7 +8336,7 @@ "type": "other" } ], - "time": "2024-06-04T11:31:33+00:00" + "time": "2024-08-07T11:07:52+00:00" }, { "name": "spatie/laravel-ignition", @@ -8359,16 +8431,16 @@ }, { "name": "spatie/laravel-package-tools", - "version": "1.16.4", + "version": "1.16.5", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "ddf678e78d7f8b17e5cdd99c0c3413a4a6592e53" + "reference": "c7413972cf22ffdff97b68499c22baa04eddb6a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/ddf678e78d7f8b17e5cdd99c0c3413a4a6592e53", - "reference": "ddf678e78d7f8b17e5cdd99c0c3413a4a6592e53", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/c7413972cf22ffdff97b68499c22baa04eddb6a2", + "reference": "c7413972cf22ffdff97b68499c22baa04eddb6a2", "shasum": "" }, "require": { @@ -8407,7 +8479,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.16.4" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.16.5" }, "funding": [ { @@ -8415,7 +8487,7 @@ "type": "github" } ], - "time": "2024-03-20T07:29:11+00:00" + "time": "2024-08-27T18:56:10+00:00" }, { "name": "spatie/laravel-signal-aware-command", @@ -8554,16 +8626,16 @@ }, { "name": "symfony/console", - "version": "v6.4.10", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc" + "reference": "72d080eb9edf80e36c19be61f72c98ed8273b765" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/504974cbe43d05f83b201d6498c206f16fc0cdbc", - "reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc", + "url": "https://api.github.com/repos/symfony/console/zipball/72d080eb9edf80e36c19be61f72c98ed8273b765", + "reference": "72d080eb9edf80e36c19be61f72c98ed8273b765", "shasum": "" }, "require": { @@ -8628,7 +8700,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.10" + "source": "https://github.com/symfony/console/tree/v6.4.12" }, "funding": [ { @@ -8644,7 +8716,7 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:30:32+00:00" + "time": "2024-09-20T08:15:52+00:00" }, { "name": "symfony/css-selector", @@ -8781,16 +8853,16 @@ }, { "name": "symfony/error-handler", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc" + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc", - "reference": "ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/231f1b2ee80f72daa1972f7340297d67439224f0", + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0", "shasum": "" }, "require": { @@ -8836,7 +8908,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.8" + "source": "https://github.com/symfony/error-handler/tree/v6.4.10" }, "funding": [ { @@ -8852,7 +8924,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/event-dispatcher", @@ -9012,16 +9084,16 @@ }, { "name": "symfony/finder", - "version": "v6.4.8", + "version": "v6.4.11", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3ef977a43883215d560a2cecb82ec8e62131471c" + "reference": "d7eb6daf8cd7e9ac4976e9576b32042ef7253453" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3ef977a43883215d560a2cecb82ec8e62131471c", - "reference": "3ef977a43883215d560a2cecb82ec8e62131471c", + "url": "https://api.github.com/repos/symfony/finder/zipball/d7eb6daf8cd7e9ac4976e9576b32042ef7253453", + "reference": "d7eb6daf8cd7e9ac4976e9576b32042ef7253453", "shasum": "" }, "require": { @@ -9056,7 +9128,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.8" + "source": "https://github.com/symfony/finder/tree/v6.4.11" }, "funding": [ { @@ -9072,20 +9144,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-08-13T14:27:37+00:00" }, { "name": "symfony/http-foundation", - "version": "v6.4.8", + "version": "v6.4.14", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "27de8cc95e11db7a50b027e71caaab9024545947" + "reference": "ba020a321a95519303a3f09ec2824d34d601c388" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/27de8cc95e11db7a50b027e71caaab9024545947", - "reference": "27de8cc95e11db7a50b027e71caaab9024545947", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ba020a321a95519303a3f09ec2824d34d601c388", + "reference": "ba020a321a95519303a3f09ec2824d34d601c388", "shasum": "" }, "require": { @@ -9133,7 +9205,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.8" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.14" }, "funding": [ { @@ -9149,20 +9221,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-11-05T16:39:55+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1" + "reference": "96df83d51b5f78804f70c093b97310794fd6257b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1", - "reference": "6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/96df83d51b5f78804f70c093b97310794fd6257b", + "reference": "96df83d51b5f78804f70c093b97310794fd6257b", "shasum": "" }, "require": { @@ -9247,7 +9319,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.8" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.12" }, "funding": [ { @@ -9263,20 +9335,20 @@ "type": "tidelift" } ], - "time": "2024-06-02T16:06:25+00:00" + "time": "2024-09-21T06:02:57+00:00" }, { "name": "symfony/mailer", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "76326421d44c07f7824b19487cfbf87870b37efc" + "reference": "b6a25408c569ae2366b3f663a4edad19420a9c26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/76326421d44c07f7824b19487cfbf87870b37efc", - "reference": "76326421d44c07f7824b19487cfbf87870b37efc", + "url": "https://api.github.com/repos/symfony/mailer/zipball/b6a25408c569ae2366b3f663a4edad19420a9c26", + "reference": "b6a25408c569ae2366b3f663a4edad19420a9c26", "shasum": "" }, "require": { @@ -9327,7 +9399,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.8" + "source": "https://github.com/symfony/mailer/tree/v6.4.12" }, "funding": [ { @@ -9343,20 +9415,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-08T12:30:05+00:00" }, { "name": "symfony/mime", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "618597ab8b78ac86d1c75a9d0b35540cda074f33" + "reference": "abe16ee7790b16aa525877419deb0f113953f0e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/618597ab8b78ac86d1c75a9d0b35540cda074f33", - "reference": "618597ab8b78ac86d1c75a9d0b35540cda074f33", + "url": "https://api.github.com/repos/symfony/mime/zipball/abe16ee7790b16aa525877419deb0f113953f0e1", + "reference": "abe16ee7790b16aa525877419deb0f113953f0e1", "shasum": "" }, "require": { @@ -9370,7 +9442,7 @@ "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", "symfony/mailer": "<5.4", - "symfony/serializer": "<6.3.2" + "symfony/serializer": "<6.4.3|>7.0,<7.0.3" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1|^4", @@ -9380,7 +9452,7 @@ "symfony/process": "^5.4|^6.4|^7.0", "symfony/property-access": "^5.4|^6.0|^7.0", "symfony/property-info": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.3.2|^7.0" + "symfony/serializer": "^6.4.3|^7.0.3" }, "type": "library", "autoload": { @@ -9412,7 +9484,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.4.8" + "source": "https://github.com/symfony/mime/tree/v6.4.12" }, "funding": [ { @@ -9428,24 +9500,24 @@ "type": "tidelift" } ], - "time": "2024-06-01T07:50:16+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -9491,7 +9563,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -9507,24 +9579,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", - "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -9569,7 +9641,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" }, "funding": [ { @@ -9585,26 +9657,25 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c" + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", - "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773", + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" }, "suggest": { "ext-intl": "For best performance" @@ -9653,7 +9724,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0" }, "funding": [ { @@ -9669,24 +9740,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", - "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -9734,7 +9805,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" }, "funding": [ { @@ -9750,24 +9821,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -9814,7 +9885,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -9830,97 +9901,24 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.30.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "10112722600777e02d2745716b70c5db4ca70442" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", - "reference": "10112722600777e02d2745716b70c5db4ca70442", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -9967,7 +9965,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -9983,24 +9981,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9" + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", - "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491", + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -10043,7 +10041,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0" }, "funding": [ { @@ -10059,24 +10057,24 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:35:24+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-uuid", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9" + "reference": "21533be36c24be3f4b1669c4725c7d1d2bab4ae2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9", - "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/21533be36c24be3f4b1669c4725c7d1d2bab4ae2", + "reference": "21533be36c24be3f4b1669c4725c7d1d2bab4ae2", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-uuid": "*" @@ -10122,7 +10120,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.31.0" }, "funding": [ { @@ -10138,20 +10136,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/process", - "version": "v6.4.8", + "version": "v6.4.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5" + "reference": "25214adbb0996d18112548de20c281be9f27279f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8d92dd79149f29e89ee0f480254db595f6a6a2c5", - "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5", + "url": "https://api.github.com/repos/symfony/process/zipball/25214adbb0996d18112548de20c281be9f27279f", + "reference": "25214adbb0996d18112548de20c281be9f27279f", "shasum": "" }, "require": { @@ -10183,7 +10181,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.8" + "source": "https://github.com/symfony/process/tree/v6.4.14" }, "funding": [ { @@ -10199,7 +10197,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-11-06T09:25:01+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -10292,16 +10290,16 @@ }, { "name": "symfony/routing", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58" + "reference": "a7c8036bd159486228dc9be3e846a00a0dda9f9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58", - "reference": "8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58", + "url": "https://api.github.com/repos/symfony/routing/zipball/a7c8036bd159486228dc9be3e846a00a0dda9f9f", + "reference": "a7c8036bd159486228dc9be3e846a00a0dda9f9f", "shasum": "" }, "require": { @@ -10355,7 +10353,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.4.8" + "source": "https://github.com/symfony/routing/tree/v6.4.12" }, "funding": [ { @@ -10371,7 +10369,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-20T08:32:26+00:00" }, { "name": "symfony/service-contracts", @@ -10458,16 +10456,16 @@ }, { "name": "symfony/string", - "version": "v6.4.10", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ccf9b30251719567bfd46494138327522b9a9446" + "reference": "f8a1ccebd0997e16112dfecfd74220b78e5b284b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ccf9b30251719567bfd46494138327522b9a9446", - "reference": "ccf9b30251719567bfd46494138327522b9a9446", + "url": "https://api.github.com/repos/symfony/string/zipball/f8a1ccebd0997e16112dfecfd74220b78e5b284b", + "reference": "f8a1ccebd0997e16112dfecfd74220b78e5b284b", "shasum": "" }, "require": { @@ -10524,7 +10522,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.10" + "source": "https://github.com/symfony/string/tree/v6.4.12" }, "funding": [ { @@ -10540,20 +10538,20 @@ "type": "tidelift" } ], - "time": "2024-07-22T10:21:14+00:00" + "time": "2024-09-20T08:15:52+00:00" }, { "name": "symfony/translation", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "a002933b13989fc4bd0b58e04bf7eec5210e438a" + "reference": "cf8360b8352b086be620fae8342c4d96e391a489" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/a002933b13989fc4bd0b58e04bf7eec5210e438a", - "reference": "a002933b13989fc4bd0b58e04bf7eec5210e438a", + "url": "https://api.github.com/repos/symfony/translation/zipball/cf8360b8352b086be620fae8342c4d96e391a489", + "reference": "cf8360b8352b086be620fae8342c4d96e391a489", "shasum": "" }, "require": { @@ -10619,7 +10617,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.8" + "source": "https://github.com/symfony/translation/tree/v6.4.12" }, "funding": [ { @@ -10635,7 +10633,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-16T06:02:54+00:00" }, { "name": "symfony/translation-contracts", @@ -10717,16 +10715,16 @@ }, { "name": "symfony/uid", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "35904eca37a84bb764c560cbfcac9f0ac2bcdbdf" + "reference": "2f16054e0a9b194b8ca581d4a64eee3f7d4a9d4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/35904eca37a84bb764c560cbfcac9f0ac2bcdbdf", - "reference": "35904eca37a84bb764c560cbfcac9f0ac2bcdbdf", + "url": "https://api.github.com/repos/symfony/uid/zipball/2f16054e0a9b194b8ca581d4a64eee3f7d4a9d4d", + "reference": "2f16054e0a9b194b8ca581d4a64eee3f7d4a9d4d", "shasum": "" }, "require": { @@ -10771,7 +10769,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v6.4.8" + "source": "https://github.com/symfony/uid/tree/v6.4.12" }, "funding": [ { @@ -10787,20 +10785,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-20T08:32:26+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.8", + "version": "v6.4.11", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "ad23ca4312395f0a8a8633c831ef4c4ee542ed25" + "reference": "ee14c8254a480913268b1e3b1cba8045ed122694" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ad23ca4312395f0a8a8633c831ef4c4ee542ed25", - "reference": "ad23ca4312395f0a8a8633c831ef4c4ee542ed25", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ee14c8254a480913268b1e3b1cba8045ed122694", + "reference": "ee14c8254a480913268b1e3b1cba8045ed122694", "shasum": "" }, "require": { @@ -10856,7 +10854,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.8" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.11" }, "funding": [ { @@ -10872,7 +10870,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-08-30T16:03:21+00:00" }, { "name": "tecnickcom/tc-lib-barcode", @@ -11045,16 +11043,16 @@ }, { "name": "tecnickcom/tcpdf", - "version": "6.7.5", + "version": "6.7.6", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36" + "reference": "4cf1ab192e87e6916d20f93077b2bdfa96a2f848" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", - "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/4cf1ab192e87e6916d20f93077b2bdfa96a2f848", + "reference": "4cf1ab192e87e6916d20f93077b2bdfa96a2f848", "shasum": "" }, "require": { @@ -11105,7 +11103,7 @@ ], "support": { "issues": "https://github.com/tecnickcom/TCPDF/issues", - "source": "https://github.com/tecnickcom/TCPDF/tree/6.7.5" + "source": "https://github.com/tecnickcom/TCPDF/tree/6.7.6" }, "funding": [ { @@ -11113,7 +11111,7 @@ "type": "custom" } ], - "time": "2024-04-20T17:25:10+00:00" + "time": "2024-10-06T10:54:28+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -11427,23 +11425,23 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.6.0", + "version": "v5.6.1", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", "shasum": "" }, "require": { "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.2", + "graham-campbell/result-type": "^1.1.3", "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2", + "phpoption/phpoption": "^1.9.3", "symfony/polyfill-ctype": "^1.24", "symfony/polyfill-mbstring": "^1.24", "symfony/polyfill-php80": "^1.24" @@ -11460,7 +11458,7 @@ "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "5.6-dev" @@ -11495,7 +11493,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" }, "funding": [ { @@ -11507,7 +11505,7 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:43:29+00:00" + "time": "2024-07-20T21:52:34+00:00" }, { "name": "voku/portable-ascii", @@ -11857,101 +11855,6 @@ ], "time": "2024-04-13T18:00:56+00:00" }, - { - "name": "brianium/paratest", - "version": "v7.3.1", - "source": { - "type": "git", - "url": "https://github.com/paratestphp/paratest.git", - "reference": "551f46f52a93177d873f3be08a1649ae886b4a30" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/551f46f52a93177d873f3be08a1649ae886b4a30", - "reference": "551f46f52a93177d873f3be08a1649ae886b4a30", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-simplexml": "*", - "fidry/cpu-core-counter": "^0.5.1 || ^1.0.0", - "jean85/pretty-package-versions": "^2.0.5", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "phpunit/php-code-coverage": "^10.1.7", - "phpunit/php-file-iterator": "^4.1.0", - "phpunit/php-timer": "^6.0", - "phpunit/phpunit": "^10.4.2", - "sebastian/environment": "^6.0.1", - "symfony/console": "^6.3.4 || ^7.0.0", - "symfony/process": "^6.3.4 || ^7.0.0" - }, - "require-dev": { - "doctrine/coding-standard": "^12.0.0", - "ext-pcov": "*", - "ext-posix": "*", - "infection/infection": "^0.27.6", - "phpstan/phpstan": "^1.10.40", - "phpstan/phpstan-deprecation-rules": "^1.1.4", - "phpstan/phpstan-phpunit": "^1.3.15", - "phpstan/phpstan-strict-rules": "^1.5.2", - "squizlabs/php_codesniffer": "^3.7.2", - "symfony/filesystem": "^6.3.1 || ^7.0.0" - }, - "bin": [ - "bin/paratest", - "bin/paratest.bat", - "bin/paratest_for_phpstorm" - ], - "type": "library", - "autoload": { - "psr-4": { - "ParaTest\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Scaturro", - "email": "scaturrob@gmail.com", - "role": "Developer" - }, - { - "name": "Filippo Tessarotto", - "email": "zoeslam@gmail.com", - "role": "Developer" - } - ], - "description": "Parallel testing for PHP", - "homepage": "https://github.com/paratestphp/paratest", - "keywords": [ - "concurrent", - "parallel", - "phpunit", - "testing" - ], - "support": { - "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v7.3.1" - }, - "funding": [ - { - "url": "https://github.com/sponsors/Slamdunk", - "type": "github" - }, - { - "url": "https://paypal.me/filippotessarotto", - "type": "paypal" - } - ], - "time": "2023-10-31T09:24:17+00:00" - }, { "name": "clue/ndjson-react", "version": "v1.3.0", @@ -12083,30 +11986,38 @@ }, { "name": "composer/pcre", - "version": "3.1.4", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "04229f163664973f68f38f6f73d917799168ef24" + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", - "reference": "04229f163664973f68f38f6f73d917799168ef24", + "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, "require-dev": { - "phpstan/phpstan": "^1.3", + "phpstan/phpstan": "^1.11.10", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -12134,7 +12045,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.4" + "source": "https://github.com/composer/pcre/tree/3.3.1" }, "funding": [ { @@ -12150,28 +12061,28 @@ "type": "tidelift" } ], - "time": "2024-05-27T13:40:54+00:00" + "time": "2024-08-27T18:44:43+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.4.3", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -12215,7 +12126,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.0" + "source": "https://github.com/composer/semver/tree/3.4.3" }, "funding": [ { @@ -12231,7 +12142,7 @@ "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2024-09-19T14:15:21+00:00" }, { "name": "composer/xdebug-handler", @@ -12571,16 +12482,16 @@ }, { "name": "felixfbecker/language-server-protocol", - "version": "v1.5.2", + "version": "v1.5.3", "source": { "type": "git", "url": "https://github.com/felixfbecker/php-language-server-protocol.git", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842" + "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/6e82196ffd7c62f7794d778ca52b69feec9f2842", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/a9e113dbc7d849e35b8776da39edaf4313b7b6c9", + "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9", "shasum": "" }, "require": { @@ -12621,22 +12532,22 @@ ], "support": { "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", - "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.2" + "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.3" }, - "time": "2022-03-02T22:36:06+00:00" + "time": "2024-04-30T00:40:11+00:00" }, { "name": "fidry/cpu-core-counter", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" + "reference": "8520451a140d3f46ac33042715115e290cf5785f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", "shasum": "" }, "require": { @@ -12676,7 +12587,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" }, "funding": [ { @@ -12684,20 +12595,20 @@ "type": "github" } ], - "time": "2024-02-07T09:43:46+00:00" + "time": "2024-08-06T10:04:20+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.59.3", + "version": "v3.64.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" + "reference": "58dd9c931c785a79739310aef5178928305ffa67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/58dd9c931c785a79739310aef5178928305ffa67", + "reference": "58dd9c931c785a79739310aef5178928305ffa67", "shasum": "" }, "require": { @@ -12779,7 +12690,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.64.0" }, "funding": [ { @@ -12787,7 +12698,7 @@ "type": "github" } ], - "time": "2024-06-16T14:17:03+00:00" + "time": "2024-08-30T23:09:38+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -12840,81 +12751,22 @@ }, "time": "2020-07-09T08:09:16+00:00" }, - { - "name": "jean85/pretty-package-versions", - "version": "2.0.6", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/f9fdd29ad8e6d024f52678b570e5593759b550b4", - "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4", - "shasum": "" - }, - "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.1|^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.2", - "jean85/composer-provided-replaced-stub-package": "^1.0", - "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^7.5|^8.5|^9.4", - "vimeo/psalm": "^4.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A library to get pretty versions strings of installed dependencies", - "keywords": [ - "composer", - "package", - "release", - "versions" - ], - "support": { - "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.6" - }, - "time": "2024-03-08T09:58:59+00:00" - }, { "name": "justinrainbow/json-schema", - "version": "v5.2.13", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/jsonrainbow/json-schema.git", - "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" + "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", - "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", + "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", @@ -12925,11 +12777,6 @@ "bin/validate-json" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, "autoload": { "psr-4": { "JsonSchema\\": "src/JsonSchema/" @@ -12965,22 +12812,22 @@ ], "support": { "issues": "https://github.com/jsonrainbow/json-schema/issues", - "source": "https://github.com/jsonrainbow/json-schema/tree/v5.2.13" + "source": "https://github.com/jsonrainbow/json-schema/tree/5.3.0" }, - "time": "2023-09-26T02:20:38+00:00" + "time": "2024-07-06T21:00:26+00:00" }, { "name": "larastan/larastan", - "version": "v2.9.7", + "version": "v2.9.8", "source": { "type": "git", "url": "https://github.com/larastan/larastan.git", - "reference": "5c805f636095cc2e0b659e3954775cf8f1dad1bb" + "reference": "340badd89b0eb5bddbc503a4829c08cf9a2819d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/larastan/larastan/zipball/5c805f636095cc2e0b659e3954775cf8f1dad1bb", - "reference": "5c805f636095cc2e0b659e3954775cf8f1dad1bb", + "url": "https://api.github.com/repos/larastan/larastan/zipball/340badd89b0eb5bddbc503a4829c08cf9a2819d7", + "reference": "340badd89b0eb5bddbc503a4829c08cf9a2819d7", "shasum": "" }, "require": { @@ -12994,7 +12841,7 @@ "illuminate/support": "^9.52.16 || ^10.28.0 || ^11.0", "php": "^8.0.2", "phpmyadmin/sql-parser": "^5.9.0", - "phpstan/phpstan": "^1.11.1" + "phpstan/phpstan": "^1.11.2" }, "require-dev": { "doctrine/coding-standard": "^12.0", @@ -13049,7 +12896,7 @@ ], "support": { "issues": "https://github.com/larastan/larastan/issues", - "source": "https://github.com/larastan/larastan/tree/v2.9.7" + "source": "https://github.com/larastan/larastan/tree/v2.9.8" }, "funding": [ { @@ -13069,7 +12916,7 @@ "type": "patreon" } ], - "time": "2024-05-27T18:33:26+00:00" + "time": "2024-07-06T17:46:02+00:00" }, { "name": "league/container", @@ -13298,16 +13145,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v4.4.1", + "version": "v4.5.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0" + "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/132c75c7dd83e45353ebb9c6c9f591952995bbf0", - "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8e76efb98ee8b6afc54687045e1b8dba55ac76e5", + "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5", "shasum": "" }, "require": { @@ -13343,9 +13190,9 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.4.1" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.5.0" }, - "time": "2024-01-31T06:18:54+00:00" + "time": "2024-09-08T10:13:13+00:00" }, { "name": "nunomaduro/phpinsights", @@ -13841,16 +13688,16 @@ }, { "name": "phpmyadmin/sql-parser", - "version": "5.9.0", + "version": "5.10.0", "source": { "type": "git", "url": "https://github.com/phpmyadmin/sql-parser.git", - "reference": "011fa18a4e55591fac6545a821921dd1d61c6984" + "reference": "91d980ab76c3f152481e367f62b921adc38af451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/011fa18a4e55591fac6545a821921dd1d61c6984", - "reference": "011fa18a4e55591fac6545a821921dd1d61c6984", + "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/91d980ab76c3f152481e367f62b921adc38af451", + "reference": "91d980ab76c3f152481e367f62b921adc38af451", "shasum": "" }, "require": { @@ -13868,8 +13715,7 @@ "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.9.12", "phpstan/phpstan-phpunit": "^1.3.3", - "phpunit/php-code-coverage": "*", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "phpunit/phpunit": "^8.5 || ^9.6", "psalm/plugin-phpunit": "^0.16.1", "vimeo/psalm": "^4.11", "zumba/json-serializer": "~3.0.2" @@ -13925,20 +13771,20 @@ "type": "other" } ], - "time": "2024-01-20T20:34:02+00:00" + "time": "2024-08-29T20:56:34+00:00" }, { "name": "phpstan/phpstan", - "version": "1.11.5", + "version": "1.12.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443" + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", "shasum": "" }, "require": { @@ -13983,36 +13829,36 @@ "type": "github" } ], - "time": "2024-06-17T15:10:54+00:00" + "time": "2024-10-06T15:03:59+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.15", + "version": "10.1.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae" + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", - "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=8.1", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-text-template": "^3.0", - "sebastian/code-unit-reverse-lookup": "^3.0", - "sebastian/complexity": "^3.0", - "sebastian/environment": "^6.0", - "sebastian/lines-of-code": "^2.0", - "sebastian/version": "^4.0", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { "phpunit/phpunit": "^10.1" @@ -14024,7 +13870,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.1-dev" + "dev-main": "10.1.x-dev" } }, "autoload": { @@ -14053,7 +13899,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" }, "funding": [ { @@ -14061,7 +13907,7 @@ "type": "github" } ], - "time": "2024-06-29T08:25:15+00:00" + "time": "2024-08-22T04:31:57+00:00" }, { "name": "phpunit/php-file-iterator", @@ -14308,16 +14154,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.29", + "version": "10.5.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8e9e80872b4e8064401788ee8a32d40b4455318f" + "reference": "aa0a8ce701ea7ee314b0dfaa8970dc94f3f8c870" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e9e80872b4e8064401788ee8a32d40b4455318f", - "reference": "8e9e80872b4e8064401788ee8a32d40b4455318f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/aa0a8ce701ea7ee314b0dfaa8970dc94f3f8c870", + "reference": "aa0a8ce701ea7ee314b0dfaa8970dc94f3f8c870", "shasum": "" }, "require": { @@ -14331,14 +14177,14 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.15", + "phpunit/php-code-coverage": "^10.1.16", "phpunit/php-file-iterator": "^4.1.0", "phpunit/php-invoker": "^4.0.0", "phpunit/php-text-template": "^3.0.1", "phpunit/php-timer": "^6.0.0", "sebastian/cli-parser": "^2.0.1", "sebastian/code-unit": "^2.0.0", - "sebastian/comparator": "^5.0.1", + "sebastian/comparator": "^5.0.2", "sebastian/diff": "^5.1.1", "sebastian/environment": "^6.1.0", "sebastian/exporter": "^5.1.2", @@ -14389,7 +14235,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.29" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.36" }, "funding": [ { @@ -14405,7 +14251,7 @@ "type": "tidelift" } ], - "time": "2024-07-30T11:08:00+00:00" + "time": "2024-10-08T15:36:51+00:00" }, { "name": "react/cache", @@ -14781,31 +14627,31 @@ }, { "name": "react/socket", - "version": "v1.15.0", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/reactphp/socket.git", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.0", - "react/dns": "^1.11", + "react/dns": "^1.13", "react/event-loop": "^1.2", - "react/promise": "^3 || ^2.6 || ^1.2.1", - "react/stream": "^1.2" + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" }, "require-dev": { "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4 || ^3 || ^2", + "react/async": "^4.3 || ^3.3 || ^2", "react/promise-stream": "^1.4", - "react/promise-timer": "^1.10" + "react/promise-timer": "^1.11" }, "type": "library", "autoload": { @@ -14849,7 +14695,7 @@ ], "support": { "issues": "https://github.com/reactphp/socket/issues", - "source": "https://github.com/reactphp/socket/tree/v1.15.0" + "source": "https://github.com/reactphp/socket/tree/v1.16.0" }, "funding": [ { @@ -14857,7 +14703,7 @@ "type": "open_collective" } ], - "time": "2023-12-15T11:02:10+00:00" + "time": "2024-07-26T10:38:09+00:00" }, { "name": "react/stream", @@ -15703,16 +15549,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.1", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { @@ -15779,20 +15625,20 @@ "type": "open_collective" } ], - "time": "2024-05-22T21:24:41+00:00" + "time": "2024-09-18T10:38:58+00:00" }, { "name": "symfony/cache", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "287142df5579ce223c485b3872df3efae8390984" + "reference": "a463451b7f6ac4a47b98dbfc78ec2d3560c759d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/287142df5579ce223c485b3872df3efae8390984", - "reference": "287142df5579ce223c485b3872df3efae8390984", + "url": "https://api.github.com/repos/symfony/cache/zipball/a463451b7f6ac4a47b98dbfc78ec2d3560c759d8", + "reference": "a463451b7f6ac4a47b98dbfc78ec2d3560c759d8", "shasum": "" }, "require": { @@ -15859,7 +15705,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.8" + "source": "https://github.com/symfony/cache/tree/v6.4.12" }, "funding": [ { @@ -15875,7 +15721,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-16T16:01:33+00:00" }, { "name": "symfony/cache-contracts", @@ -16029,16 +15875,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3" + "reference": "f810e3cbdf7fdc35983968523d09f349fa9ada12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/4d37529150e7081c51b3c5d5718c55a04a9503f3", - "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/f810e3cbdf7fdc35983968523d09f349fa9ada12", + "reference": "f810e3cbdf7fdc35983968523d09f349fa9ada12", "shasum": "" }, "require": { @@ -16075,7 +15921,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.8" + "source": "https://github.com/symfony/filesystem/tree/v6.4.12" }, "funding": [ { @@ -16091,20 +15937,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-16T16:01:33+00:00" }, { "name": "symfony/http-client", - "version": "v6.4.8", + "version": "v6.4.14", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05" + "reference": "05d88cbd816ad6e0202edd9a9963cb9d615b8826" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05", - "reference": "61faba993e620fc22d4f0ab3b6bcf8fbb0d44b05", + "url": "https://api.github.com/repos/symfony/http-client/zipball/05d88cbd816ad6e0202edd9a9963cb9d615b8826", + "reference": "05d88cbd816ad6e0202edd9a9963cb9d615b8826", "shasum": "" }, "require": { @@ -16168,7 +16014,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.8" + "source": "https://github.com/symfony/http-client/tree/v6.4.14" }, "funding": [ { @@ -16184,7 +16030,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-11-05T16:39:55+00:00" }, { "name": "symfony/http-client-contracts", @@ -16333,20 +16179,20 @@ }, { "name": "symfony/polyfill-php81", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -16389,7 +16235,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -16405,7 +16251,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/stopwatch", @@ -16471,16 +16317,16 @@ }, { "name": "symfony/var-exporter", - "version": "v6.4.8", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "792ca836f99b340f2e9ca9497c7953948c49a504" + "reference": "f9a060622e0d93777b7f8687ec4860191e16802e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/792ca836f99b340f2e9ca9497c7953948c49a504", - "reference": "792ca836f99b340f2e9ca9497c7953948c49a504", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/f9a060622e0d93777b7f8687ec4860191e16802e", + "reference": "f9a060622e0d93777b7f8687ec4860191e16802e", "shasum": "" }, "require": { @@ -16528,7 +16374,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.4.8" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.9" }, "funding": [ { @@ -16544,7 +16390,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-06-24T15:53:56+00:00" }, { "name": "theseer/tokenizer", @@ -16598,16 +16444,16 @@ }, { "name": "vimeo/psalm", - "version": "5.25.0", + "version": "5.26.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "01a8eb06b9e9cc6cfb6a320bf9fb14331919d505" + "reference": "d747f6500b38ac4f7dfc5edbcae6e4b637d7add0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/01a8eb06b9e9cc6cfb6a320bf9fb14331919d505", - "reference": "01a8eb06b9e9cc6cfb6a320bf9fb14331919d505", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/d747f6500b38ac4f7dfc5edbcae6e4b637d7add0", + "reference": "d747f6500b38ac4f7dfc5edbcae6e4b637d7add0", "shasum": "" }, "require": { @@ -16628,7 +16474,7 @@ "felixfbecker/language-server-protocol": "^1.5.2", "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.16", + "nikic/php-parser": "^4.17", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "sebastian/diff": "^4.0 || ^5.0 || ^6.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", @@ -16704,7 +16550,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-06-16T15:08:35+00:00" + "time": "2024-09-08T18:53:08+00:00" } ], "aliases": [], @@ -16723,5 +16569,5 @@ "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/config/app.php b/config/app.php index 060d82d52..39898ff43 100755 --- a/config/app.php +++ b/config/app.php @@ -280,7 +280,6 @@ return [ Illuminate\Redis\RedisServiceProvider::class, Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, Illuminate\Session\SessionServiceProvider::class, -// Illuminate\Translation\TranslationServiceProvider::class, //replaced on next line App\Providers\SnipeTranslationServiceProvider::class, //we REPLACE the default Laravel translator with our own Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, @@ -372,7 +371,9 @@ return [ 'Google2FA' => PragmaRX\Google2FALaravel\Facade::class, 'Image' => Intervention\Image\ImageServiceProvider::class, 'Carbon' => Carbon\Carbon::class, - 'Helper' => App\Helpers\Helper::class, // makes it much easier to use 'Helper::blah' in blades (which is where we usually use this) + 'Helper' => App\Helpers\Helper::class, + 'StorageHelper' => App\Helpers\StorageHelper::class, + 'Icon' => App\Helpers\IconHelper::class, 'Socialite' => Laravel\Socialite\Facades\Socialite::class, diff --git a/config/backup.php b/config/backup.php index 3571329b2..089087733 100644 --- a/config/backup.php +++ b/config/backup.php @@ -237,4 +237,6 @@ return [ ], ], + 'sanitize_by_default' => env('DB_SANITIZE_BY_DEFAULT', false), + ]; diff --git a/config/version.php b/config/version.php index e00f58b0b..2249e8dbd 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v7.0.11', - 'full_app_version' => 'v7.0.11 - build 14904-g6c0cf9447', - 'build_version' => '14904', + 'app_version' => 'v7.0.13', + 'full_app_version' => 'v7.0.13 - build 15666-g03b01689b', + 'build_version' => '15666', 'prerelease_version' => '', - 'hash_version' => 'g6c0cf9447', - 'full_hash' => 'v7.0.11-218-g6c0cf9447', + 'hash_version' => 'g03b01689b', + 'full_hash' => 'v7.0.13-144-g03b01689b', 'branch' => 'develop', ); \ No newline at end of file diff --git a/database/factories/AccessoryFactory.php b/database/factories/AccessoryFactory.php index 356b367ec..6442472d5 100644 --- a/database/factories/AccessoryFactory.php +++ b/database/factories/AccessoryFactory.php @@ -3,7 +3,6 @@ namespace Database\Factories; use App\Models\Accessory; -use App\Models\AccessoryCheckout; use App\Models\Category; use App\Models\Location; use App\Models\Manufacturer; @@ -34,7 +33,7 @@ class AccessoryFactory extends Factory $this->faker->randomElement(['Bluetooth', 'Wired']), $this->faker->randomElement(['Keyboard', 'Wired']) ), - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'category_id' => Category::factory()->forAccessories(), 'model_number' => $this->faker->numberBetween(1000000, 50000000), 'location_id' => Location::factory(), @@ -129,7 +128,7 @@ class AccessoryFactory extends Factory $accessory->checkouts()->create([ 'accessory_id' => $accessory->id, 'created_at' => Carbon::now(), - 'user_id' => $user->id, + 'created_by' => $user->id, 'assigned_to' => $user->id, 'assigned_type' => User::class, 'note' => '', @@ -150,10 +149,25 @@ class AccessoryFactory extends Factory $accessory->checkouts()->create([ 'accessory_id' => $accessory->id, 'created_at' => Carbon::now(), - 'user_id' => 1, + 'created_by' => 1, 'assigned_to' => $user->id ?? User::factory()->create()->id, 'assigned_type' => User::class, ]); }); } + + public function checkedOutToUsers(array $users) + { + return $this->afterCreating(function (Accessory $accessory) use ($users) { + foreach ($users as $user) { + $accessory->checkouts()->create([ + 'accessory_id' => $accessory->id, + 'created_at' => Carbon::now(), + 'user_id' => 1, + 'assigned_to' => $user->id, + 'assigned_type' => User::class, + ]); + } + }); + } } diff --git a/database/factories/ActionlogFactory.php b/database/factories/ActionlogFactory.php index a88166d14..ad07f7082 100644 --- a/database/factories/ActionlogFactory.php +++ b/database/factories/ActionlogFactory.php @@ -29,7 +29,7 @@ class ActionlogFactory extends Factory return [ 'item_id' => Asset::factory(), 'item_type' => Asset::class, - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'action_type' => 'uploaded', ]; } @@ -92,7 +92,7 @@ class ActionlogFactory extends Factory $licenseSeat->update([ 'assigned_to' => $target->id, - 'user_id' => 1, // not ideal but works + 'created_by' => 1, // not ideal but works ]); return [ diff --git a/database/factories/AssetFactory.php b/database/factories/AssetFactory.php index b1255baee..4d6d20651 100644 --- a/database/factories/AssetFactory.php +++ b/database/factories/AssetFactory.php @@ -36,7 +36,7 @@ class AssetFactory extends Factory 'status_id' => function () { return Statuslabel::where('name', 'Ready to Deploy')->first() ?? Statuslabel::factory()->rtd()->create(['name' => 'Ready to Deploy']); }, - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'asset_tag' => $this->faker->unixTime('now'), 'notes' => 'Created by DB seeder', 'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'), diff --git a/database/factories/AssetModelFactory.php b/database/factories/AssetModelFactory.php index 679089756..8acecd55d 100644 --- a/database/factories/AssetModelFactory.php +++ b/database/factories/AssetModelFactory.php @@ -28,7 +28,7 @@ class AssetModelFactory extends Factory public function definition() { return [ - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'name' => $this->faker->catchPhrase(), 'category_id' => Category::factory(), 'model_number' => $this->faker->creditCardNumber(), diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php index 2a89c1289..540dcb308 100644 --- a/database/factories/CategoryFactory.php +++ b/database/factories/CategoryFactory.php @@ -29,7 +29,7 @@ class CategoryFactory extends Factory 'eula_text' => $this->faker->paragraph(), 'require_acceptance' => false, 'use_default_eula' => $this->faker->boolean(), - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), ]; } diff --git a/database/factories/CompanyFactory.php b/database/factories/CompanyFactory.php index 607822fef..5f1ac0c98 100644 --- a/database/factories/CompanyFactory.php +++ b/database/factories/CompanyFactory.php @@ -23,6 +23,7 @@ class CompanyFactory extends Factory { return [ 'name' => $this->faker->unique()->company(), + 'created_by' => 1, ]; } } diff --git a/database/factories/ComponentFactory.php b/database/factories/ComponentFactory.php index 2557f29c7..786e78089 100644 --- a/database/factories/ComponentFactory.php +++ b/database/factories/ComponentFactory.php @@ -7,6 +7,7 @@ use App\Models\Asset; use App\Models\Category; use App\Models\Company; use App\Models\Component; +use App\Models\Manufacturer; use App\Models\Consumable; use App\Models\Location; use App\Models\User; @@ -30,6 +31,7 @@ class ComponentFactory extends Factory */ public function definition() { + return [ 'name' => $this->faker->text(20), 'category_id' => Category::factory(), @@ -42,12 +44,14 @@ class ComponentFactory extends Factory 'min_amt' => $this->faker->numberBetween($min = 1, $max = 2), 'company_id' => Company::factory(), 'supplier_id' => Supplier::factory(), + 'model_number' => $this->faker->numberBetween(1000000, 50000000), ]; } public function ramCrucial4() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial 4GB DDR3L-1600 SODIMM', 'category_id' => function () { @@ -55,6 +59,7 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, 'location_id' => Location::factory(), ]; }); @@ -62,7 +67,8 @@ class ComponentFactory extends Factory public function ramCrucial8() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial 8GB DDR3L-1600 SODIMM Memory for Mac', 'category_id' => function () { @@ -70,13 +76,15 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, ]; }); } public function ssdCrucial120() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial BX300 120GB SATA Internal SSD', 'category_id' => function () { @@ -84,13 +92,15 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, ]; }); } public function ssdCrucial240() { - return $this->state(function () { + $manufacturer = Manufacturer::where('name', 'Crucial')->first() ?? Manufacturer::factory()->create(['name' => 'Crucial']); + return $this->state(function () use ($manufacturer) { return [ 'name' => 'Crucial BX300 240GB SATA Internal SSD', 'category_id' => function () { @@ -98,6 +108,7 @@ class ComponentFactory extends Factory }, 'qty' => 10, 'min_amt' => 2, + 'manufacturer_id' => $manufacturer->id, ]; }); } @@ -108,7 +119,7 @@ class ComponentFactory extends Factory $component->assets()->attach($component->id, [ 'component_id' => $component->id, 'created_at' => Carbon::now(), - 'user_id' => 1, + 'created_by' => 1, 'asset_id' => $asset->id ?? Asset::factory()->create()->id, ]); }); diff --git a/database/factories/ConsumableFactory.php b/database/factories/ConsumableFactory.php index ca3a2faf9..4a4b3ef87 100644 --- a/database/factories/ConsumableFactory.php +++ b/database/factories/ConsumableFactory.php @@ -30,7 +30,7 @@ class ConsumableFactory extends Factory return [ 'name' => $this->faker->words(3, true), 'category_id' => Category::factory(), - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'item_no' => $this->faker->numberBetween(1000000, 50000000), 'order_number' => $this->faker->numberBetween(1000000, 50000000), 'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'), @@ -104,7 +104,7 @@ class ConsumableFactory extends Factory $consumable->users()->attach($consumable->id, [ 'consumable_id' => $consumable->id, - 'user_id' => $user->id, + 'created_by' => $user->id, 'assigned_to' => $user->id, 'note' => '', ]); @@ -124,7 +124,7 @@ class ConsumableFactory extends Factory $consumable->users()->attach($consumable->id, [ 'consumable_id' => $consumable->id, 'created_at' => Carbon::now(), - 'user_id' => User::factory()->create()->id, + 'created_by' => User::factory()->create()->id, 'assigned_to' => $user->id ?? User::factory()->create()->id, ]); }); diff --git a/database/factories/DepartmentFactory.php b/database/factories/DepartmentFactory.php index afcc9cbd3..011a63266 100644 --- a/database/factories/DepartmentFactory.php +++ b/database/factories/DepartmentFactory.php @@ -25,7 +25,7 @@ class DepartmentFactory extends Factory { return [ 'name' => $this->faker->unique()->word() . ' Department', - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'location_id' => Location::factory(), ]; } diff --git a/database/factories/DepreciationFactory.php b/database/factories/DepreciationFactory.php index 6359e2326..52258e784 100644 --- a/database/factories/DepreciationFactory.php +++ b/database/factories/DepreciationFactory.php @@ -24,7 +24,7 @@ class DepreciationFactory extends Factory { return [ 'name' => $this->faker->unique()->catchPhrase(), - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'months' => 36, ]; } diff --git a/database/factories/ImportFactory.php b/database/factories/ImportFactory.php new file mode 100644 index 000000000..0b0f79aa4 --- /dev/null +++ b/database/factories/ImportFactory.php @@ -0,0 +1,146 @@ + + */ +class ImportFactory extends Factory +{ + /** + * @inheritdoc + */ + protected $model = Import::class; + + /** + * @inheritdoc + */ + public function definition() + { + return [ + 'name' => $this->faker->company, + 'file_path' => Str::random().'.csv', + 'filesize' => $this->faker->randomDigitNotNull(), + 'field_map' => null, + ]; + } + + /** + * Create an accessory import type. + * + * @return static + */ + public function accessory() + { + return $this->state(function (array $attributes) { + $fileBuilder = Importing\AccessoriesImportFileBuilder::new(); + + $attributes['name'] = "{$attributes['name']} Accessories"; + $attributes['import_type'] = 'accessory'; + $attributes['header_row'] = $fileBuilder->toCsv()[0]; + $attributes['first_row'] = $fileBuilder->firstRow(); + + return $attributes; + }); + } + + /** + * Create an asset import type. + * + * @return static + */ + public function asset() + { + return $this->state(function (array $attributes) { + $fileBuilder = Importing\AssetsImportFileBuilder::new(); + + $attributes['name'] = "{$attributes['name']} Assets"; + $attributes['import_type'] = 'asset'; + $attributes['header_row'] = $fileBuilder->toCsv()[0]; + $attributes['first_row'] = $fileBuilder->firstRow(); + + return $attributes; + }); + } + + /** + * Create a component import type. + * + * @return static + */ + public function component() + { + return $this->state(function (array $attributes) { + $fileBuilder = Importing\ComponentsImportFileBuilder::new(); + + $attributes['name'] = "{$attributes['name']} Components"; + $attributes['import_type'] = 'component'; + $attributes['header_row'] = $fileBuilder->toCsv()[0]; + $attributes['first_row'] = $fileBuilder->firstRow(); + + return $attributes; + }); + } + + /** + * Create a consumable import type. + * + * @return static + */ + public function consumable() + { + return $this->state(function (array $attributes) { + $fileBuilder = Importing\ConsumablesImportFileBuilder::new(); + + $attributes['name'] = "{$attributes['name']} Consumables"; + $attributes['import_type'] = 'consumable'; + $attributes['header_row'] = $fileBuilder->toCsv()[0]; + $attributes['first_row'] = $fileBuilder->firstRow(); + + return $attributes; + }); + } + + /** + * Create a license import type. + * + * @return static + */ + public function license() + { + return $this->state(function (array $attributes) { + $fileBuilder = Importing\LicensesImportFileBuilder::new(); + + $attributes['name'] = "{$attributes['name']} Licenses"; + $attributes['import_type'] = 'license'; + $attributes['header_row'] = $fileBuilder->toCsv()[0]; + $attributes['first_row'] = $fileBuilder->firstRow(); + + return $attributes; + }); + } + + /** + * Create a users import type. + * + * @return static + */ + public function users() + { + return $this->state(function (array $attributes) { + $fileBuilder = Importing\UsersImportFileBuilder::new(); + + $attributes['name'] = "{$attributes['name']} Employees"; + $attributes['import_type'] = 'user'; + $attributes['header_row'] = $fileBuilder->toCsv()[0]; + $attributes['first_row'] = $fileBuilder->firstRow(); + + return $attributes; + }); + } +} diff --git a/database/factories/LicenseFactory.php b/database/factories/LicenseFactory.php index 6360735c5..1f5b105f4 100644 --- a/database/factories/LicenseFactory.php +++ b/database/factories/LicenseFactory.php @@ -25,7 +25,7 @@ class LicenseFactory extends Factory public function definition() { return [ - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'name' => $this->faker->name(), 'license_email' => $this->faker->safeEmail(), 'serial' => $this->faker->uuid(), diff --git a/database/factories/ManufacturerFactory.php b/database/factories/ManufacturerFactory.php index 7d6892426..47d4f672f 100644 --- a/database/factories/ManufacturerFactory.php +++ b/database/factories/ManufacturerFactory.php @@ -24,7 +24,7 @@ class ManufacturerFactory extends Factory { return [ 'name' => $this->faker->unique()->company(), - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'support_phone' => $this->faker->phoneNumber(), 'url' => $this->faker->url(), 'support_email' => $this->faker->safeEmail(), diff --git a/database/factories/PredefinedKitFactory.php b/database/factories/PredefinedKitFactory.php new file mode 100644 index 000000000..32e192655 --- /dev/null +++ b/database/factories/PredefinedKitFactory.php @@ -0,0 +1,23 @@ + + */ +class PredefinedKitFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + 'name' => $this->faker->words(3, true), + ]; + } +} diff --git a/database/factories/StatuslabelFactory.php b/database/factories/StatuslabelFactory.php index fa2e5d5e1..1f04f4564 100644 --- a/database/factories/StatuslabelFactory.php +++ b/database/factories/StatuslabelFactory.php @@ -26,7 +26,7 @@ class StatuslabelFactory extends Factory 'name' => $this->faker->sentence(), 'created_at' => $this->faker->dateTime(), 'updated_at' => $this->faker->dateTime(), - 'user_id' => User::factory()->superuser(), + 'created_by' => User::factory()->superuser(), 'deleted_at' => null, 'deployable' => 0, 'pending' => 0, diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 656fc8672..4b752b736 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -7,6 +7,9 @@ use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use \Auth; +/** + * @extends Factory + */ class UserFactory extends Factory { /** @@ -35,6 +38,7 @@ class UserFactory extends Factory 'state' => $this->faker->stateAbbr(), 'username' => $this->faker->unique()->username(), 'zip' => $this->faker->postcode(), + 'created_by' => 1, ]; } @@ -141,6 +145,11 @@ class UserFactory extends Factory return $this->appendPermission(['assets.view.requestable' => '1']); } + public function deleteAssetModels() + { + return $this->appendPermission(['models.delete' => '1']); + } + public function viewAccessories() { return $this->appendPermission(['accessories.view' => '1']); @@ -201,6 +210,11 @@ class UserFactory extends Factory return $this->appendPermission(['consumables.checkout' => '1']); } + public function deleteDepartments() + { + return $this->appendPermission(['departments.delete' => '1']); + } + public function viewDepartments() { return $this->appendPermission(['departments.view' => '1']); @@ -266,6 +280,16 @@ class UserFactory extends Factory return $this->appendPermission(['components.checkout' => '1']); } + public function createCompanies() + { + return $this->appendPermission(['companies.create' => '1']); + } + + public function deleteCompanies() + { + return $this->appendPermission(['companies.delete' => '1']); + } + public function viewUsers() { return $this->appendPermission(['users.view' => '1']); @@ -286,6 +310,16 @@ class UserFactory extends Factory return $this->appendPermission(['users.delete' => '1']); } + public function deleteCategories() + { + return $this->appendPermission(['categories.delete' => '1']); + } + + public function deleteLocations() + { + return $this->appendPermission(['locations.delete' => '1']); + } + public function canEditOwnLocation() { return $this->appendPermission(['self.edit_location' => '1']); @@ -296,6 +330,46 @@ class UserFactory extends Factory return $this->appendPermission(['reports.view' => '1']); } + public function canImport() + { + return $this->appendPermission(['import' => '1']); + } + + public function deleteCustomFields() + { + return $this->appendPermission(['customfields.delete' => '1']); + } + + public function deleteCustomFieldsets() + { + return $this->appendPermission(['customfields.delete' => '1']); + } + + public function deleteDepreciations() + { + return $this->appendPermission(['depreciations.delete' => '1']); + } + + public function deleteManufacturers() + { + return $this->appendPermission(['manufacturers.delete' => '1']); + } + + public function deletePredefinedKits() + { + return $this->appendPermission(['kits.delete' => '1']); + } + + public function deleteStatusLabels() + { + return $this->appendPermission(['statuslabels.delete' => '1']); + } + + public function deleteSuppliers() + { + return $this->appendPermission(['suppliers.delete' => '1']); + } + private function appendPermission(array $permission) { return $this->state(function ($currentState) use ($permission) { diff --git a/database/migrations/2024_09_17_204302_change_user_id_to_created_by.php b/database/migrations/2024_09_17_204302_change_user_id_to_created_by.php new file mode 100644 index 000000000..a57406ce1 --- /dev/null +++ b/database/migrations/2024_09_17_204302_change_user_id_to_created_by.php @@ -0,0 +1,93 @@ +add_to_table_list() as $add_table) { + if (!Schema::hasColumn($add_table, 'created_by')) { + Schema::table($add_table, function (Blueprint $add_table) { + $add_table->unsignedBigInteger('created_by')->nullable()->before('created_at'); + }); + } + } + + foreach ($this->existing_table_list() as $table) { + if (Schema::hasColumn($table, 'user_id')) { + Schema::table($table, function (Blueprint $table) { + $table->renameColumn('user_id', 'created_by'); + }); + } + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + foreach ($this->add_to_table_list() as $add_table) { + if (Schema::hasColumn($add_table, 'created_by')) { + Schema::table($add_table, function (Blueprint $add_table) { + $add_table->dropColumn('created_by'); + }); + } + } + + foreach ($this->existing_table_list() as $table) { + if (Schema::hasColumn($table, 'user_id')) { + Schema::table($table, function (Blueprint $table) { + $table->renameColumn('created_by', 'user_id'); + }); + } + } + } + + public function existing_table_list() { + return [ + 'accessories', + 'accessories_checkout', + 'action_logs', + 'asset_maintenances', + 'assets', + 'categories', + 'components', + 'components_assets', + 'consumables', + 'consumables_users', + 'custom_fields', + 'custom_fieldsets', + 'departments', + 'depreciations', + 'license_seats', + 'licenses', + 'locations', + 'manufacturers', + 'models', + 'settings', + 'status_labels', + 'suppliers', + 'users', + ]; + } + + public function add_to_table_list() { + return [ + 'companies', + 'imports', + 'kits', + 'kits_accessories', + 'kits_consumables', + 'kits_licenses', + 'kits_models', + 'users_groups', + ]; + } +}; diff --git a/database/migrations/2024_10_23_162301_add_manufacturer_id_model_number_to_consumables.php b/database/migrations/2024_10_23_162301_add_manufacturer_id_model_number_to_consumables.php new file mode 100644 index 000000000..0180ac0ed --- /dev/null +++ b/database/migrations/2024_10_23_162301_add_manufacturer_id_model_number_to_consumables.php @@ -0,0 +1,30 @@ +integer('manufacturer_id')->after('purchase_cost')->nullable()->default(null); + $table->string('model_number')->after('purchase_cost')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('components', function (Blueprint $table) { + $table->dropColumn('manufacturer_id'); + $table->dropColumn('model_number'); + }); + } +}; diff --git a/database/migrations/2024_11_06_211457_add_manager_indexes_to_location_and_user.php b/database/migrations/2024_11_06_211457_add_manager_indexes_to_location_and_user.php new file mode 100644 index 000000000..d1a151c12 --- /dev/null +++ b/database/migrations/2024_11_06_211457_add_manager_indexes_to_location_and_user.php @@ -0,0 +1,34 @@ +index('manager_id'); + }); + Schema::table('users', function (Blueprint $table) { + $table->index('manager_id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('locations', function (Blueprint $table) { + $table->dropIndex(['manager_id']); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropIndex(['manager_id']); + }); + } +}; diff --git a/database/migrations/2024_11_07_113631_improve_manager_indexes_on_users_and_locations.php b/database/migrations/2024_11_07_113631_improve_manager_indexes_on_users_and_locations.php new file mode 100644 index 000000000..cc2963fec --- /dev/null +++ b/database/migrations/2024_11_07_113631_improve_manager_indexes_on_users_and_locations.php @@ -0,0 +1,39 @@ +dropIndex(['manager_id']); + $table->index(['manager_id','deleted_at']); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropIndex(['manager_id']); + $table->index(['manager_id','deleted_at']); + }); + + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('locations', function (Blueprint $table) { + $table->dropIndex(['manager_id','deleted_at']); + $table->index(['manager_id']); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropIndex(['manager_id','deleted_at']); + $table->index(['manager_id']); + }); + } +}; diff --git a/database/seeders/AccessorySeeder.php b/database/seeders/AccessorySeeder.php index 2330a9973..5f4cca8cf 100644 --- a/database/seeders/AccessorySeeder.php +++ b/database/seeders/AccessorySeeder.php @@ -35,25 +35,25 @@ class AccessorySeeder extends Seeder Accessory::factory()->appleUsbKeyboard()->create([ 'location_id' => $locationIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Accessory::factory()->appleBtKeyboard()->create([ 'location_id' => $locationIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Accessory::factory()->appleMouse()->create([ 'location_id' => $locationIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Accessory::factory()->microsoftMouse()->create([ 'location_id' => $locationIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); diff --git a/database/seeders/ActionlogSeeder.php b/database/seeders/ActionlogSeeder.php index 28191d53b..390398000 100644 --- a/database/seeders/ActionlogSeeder.php +++ b/database/seeders/ActionlogSeeder.php @@ -27,16 +27,16 @@ class ActionlogSeeder extends Seeder Actionlog::factory() ->count(300) ->assetCheckoutToUser() - ->create(['user_id' => $admin->id]); + ->create(['created_by' => $admin->id]); Actionlog::factory() ->count(100) ->assetCheckoutToLocation() - ->create(['user_id' => $admin->id]); + ->create(['created_by' => $admin->id]); Actionlog::factory() ->count(20) ->licenseCheckoutToUser() - ->create(['user_id' => $admin->id]); + ->create(['created_by' => $admin->id]); } } diff --git a/database/seeders/AssetModelSeeder.php b/database/seeders/AssetModelSeeder.php index 1fc0b28cd..f2902ffe7 100755 --- a/database/seeders/AssetModelSeeder.php +++ b/database/seeders/AssetModelSeeder.php @@ -17,34 +17,34 @@ class AssetModelSeeder extends Seeder $admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); // Laptops - AssetModel::factory()->count(1)->mbp13Model()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->mbpAirModel()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->surfaceModel()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->xps13Model()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->spectreModel()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->zenbookModel()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->yogaModel()->create(['user_id' => $admin->id]); + AssetModel::factory()->count(1)->mbp13Model()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->mbpAirModel()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->surfaceModel()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->xps13Model()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->spectreModel()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->zenbookModel()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->yogaModel()->create(['created_by' => $admin->id]); // Desktops - AssetModel::factory()->count(1)->macproModel()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->lenovoI5Model()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->optiplexModel()->create(['user_id' => $admin->id]); + AssetModel::factory()->count(1)->macproModel()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->lenovoI5Model()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->optiplexModel()->create(['created_by' => $admin->id]); // Conference Phones - AssetModel::factory()->count(1)->polycomModel()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->polycomcxModel()->create(['user_id' => $admin->id]); + AssetModel::factory()->count(1)->polycomModel()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->polycomcxModel()->create(['created_by' => $admin->id]); // Tablets - AssetModel::factory()->count(1)->ipadModel()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->tab3Model()->create(['user_id' => $admin->id]); + AssetModel::factory()->count(1)->ipadModel()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->tab3Model()->create(['created_by' => $admin->id]); // Phones - AssetModel::factory()->count(1)->iphone11Model()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->iphone12Model()->create(['user_id' => $admin->id]); + AssetModel::factory()->count(1)->iphone11Model()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->iphone12Model()->create(['created_by' => $admin->id]); // Displays - AssetModel::factory()->count(1)->ultrafine()->create(['user_id' => $admin->id]); - AssetModel::factory()->count(1)->ultrasharp()->create(['user_id' => $admin->id]); + AssetModel::factory()->count(1)->ultrafine()->create(['created_by' => $admin->id]); + AssetModel::factory()->count(1)->ultrasharp()->create(['created_by' => $admin->id]); $src = public_path('/img/demo/models/'); $dst = 'models'.'/'; diff --git a/database/seeders/AssetSeeder.php b/database/seeders/AssetSeeder.php index 5fdc09bdb..9d21e7f9f 100644 --- a/database/seeders/AssetSeeder.php +++ b/database/seeders/AssetSeeder.php @@ -25,7 +25,7 @@ class AssetSeeder extends Seeder $this->ensureLocationsSeeded(); $this->ensureSuppliersSeeded(); - $this->admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); + $this->adminuser = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); $this->locationIds = Location::all()->pluck('id'); $this->supplierIds = Supplier::all()->pluck('id'); @@ -82,7 +82,7 @@ class AssetSeeder extends Seeder return fn($sequence) => [ 'rtd_location_id' => $this->locationIds->random(), 'supplier_id' => $this->supplierIds->random(), - 'user_id' => $this->admin->id, + 'created_by' => $this->adminuser->id, ]; } } diff --git a/database/seeders/CategorySeeder.php b/database/seeders/CategorySeeder.php index da542cff9..137dea2ab 100755 --- a/database/seeders/CategorySeeder.php +++ b/database/seeders/CategorySeeder.php @@ -14,20 +14,20 @@ class CategorySeeder extends Seeder $admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); - Category::factory()->count(1)->assetLaptopCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->assetDesktopCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->assetTabletCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->assetMobileCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->assetDisplayCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->assetVoipCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->assetConferenceCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->accessoryKeyboardCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->accessoryMouseCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->consumablePaperCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->consumableInkCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->componentHddCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->componentRamCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->licenseGraphicsCategory()->create(['user_id' => $admin->id]); - Category::factory()->count(1)->licenseOfficeCategory()->create(['user_id' => $admin->id]); + Category::factory()->count(1)->assetLaptopCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->assetDesktopCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->assetTabletCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->assetMobileCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->assetDisplayCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->assetVoipCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->assetConferenceCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->accessoryKeyboardCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->accessoryMouseCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->consumablePaperCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->consumableInkCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->componentHddCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->componentRamCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->licenseGraphicsCategory()->create(['created_by' => $admin->id]); + Category::factory()->count(1)->licenseOfficeCategory()->create(['created_by' => $admin->id]); } } diff --git a/database/seeders/ConsumableSeeder.php b/database/seeders/ConsumableSeeder.php index 42527e1df..de20141c7 100644 --- a/database/seeders/ConsumableSeeder.php +++ b/database/seeders/ConsumableSeeder.php @@ -16,8 +16,8 @@ class ConsumableSeeder extends Seeder $admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); - Consumable::factory()->count(1)->cardstock()->create(['user_id' => $admin->id]); - Consumable::factory()->count(1)->paper()->create(['user_id' => $admin->id]); - Consumable::factory()->count(1)->ink()->create(['user_id' => $admin->id]); + Consumable::factory()->count(1)->cardstock()->create(['created_by' => $admin->id]); + Consumable::factory()->count(1)->paper()->create(['created_by' => $admin->id]); + Consumable::factory()->count(1)->ink()->create(['created_by' => $admin->id]); } } diff --git a/database/seeders/DepartmentSeeder.php b/database/seeders/DepartmentSeeder.php index 7406b97af..7f20ee8cb 100644 --- a/database/seeders/DepartmentSeeder.php +++ b/database/seeders/DepartmentSeeder.php @@ -23,32 +23,32 @@ class DepartmentSeeder extends Seeder Department::factory()->count(1)->hr()->create([ 'location_id' => $locationIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Department::factory()->count(1)->engineering()->create([ 'location_id' => $locationIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Department::factory()->count(1)->marketing()->create([ 'location_id' => $locationIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Department::factory()->count(1)->client()->create([ 'location_id' => $locationIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Department::factory()->count(1)->product()->create([ 'location_id' => $locationIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Department::factory()->count(1)->silly()->create([ 'location_id' => $locationIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); } } diff --git a/database/seeders/DepreciationSeeder.php b/database/seeders/DepreciationSeeder.php index 349d8aff5..ed78c0b11 100644 --- a/database/seeders/DepreciationSeeder.php +++ b/database/seeders/DepreciationSeeder.php @@ -14,8 +14,8 @@ class DepreciationSeeder extends Seeder $admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); - Depreciation::factory()->count(1)->computer()->create(['user_id' => $admin->id]); - Depreciation::factory()->count(1)->display()->create(['user_id' => $admin->id]); - Depreciation::factory()->count(1)->mobilePhones()->create(['user_id' => $admin->id]); + Depreciation::factory()->count(1)->computer()->create(['created_by' => $admin->id]); + Depreciation::factory()->count(1)->display()->create(['created_by' => $admin->id]); + Depreciation::factory()->count(1)->mobilePhones()->create(['created_by' => $admin->id]); } } diff --git a/database/seeders/LicenseSeeder.php b/database/seeders/LicenseSeeder.php index 4868dd41e..bc19727f7 100644 --- a/database/seeders/LicenseSeeder.php +++ b/database/seeders/LicenseSeeder.php @@ -33,25 +33,25 @@ class LicenseSeeder extends Seeder License::factory()->count(1)->photoshop()->create([ 'category_id' => $categoryIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); License::factory()->count(1)->acrobat()->create([ 'category_id' => $categoryIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); License::factory()->count(1)->indesign()->create([ 'category_id' => $categoryIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); License::factory()->count(1)->office()->create([ 'category_id' => $categoryIds->random(), 'supplier_id' => $supplierIds->random(), - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); } } diff --git a/database/seeders/ManufacturerSeeder.php b/database/seeders/ManufacturerSeeder.php index cbd70f4c3..adc13dc73 100644 --- a/database/seeders/ManufacturerSeeder.php +++ b/database/seeders/ManufacturerSeeder.php @@ -16,17 +16,17 @@ class ManufacturerSeeder extends Seeder $admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); - Manufacturer::factory()->count(1)->apple()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->microsoft()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->dell()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->asus()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->hp()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->lenovo()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->lg()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->polycom()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->adobe()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->avery()->create(['user_id' => $admin->id]); - Manufacturer::factory()->count(1)->crucial()->create(['user_id' => $admin->id]); + Manufacturer::factory()->count(1)->apple()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->microsoft()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->dell()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->asus()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->hp()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->lenovo()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->lg()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->polycom()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->adobe()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->avery()->create(['created_by' => $admin->id]); + Manufacturer::factory()->count(1)->crucial()->create(['created_by' => $admin->id]); $src = public_path('/img/demo/manufacturers/'); $dst = 'manufacturers'.'/'; diff --git a/database/seeders/StatuslabelSeeder.php b/database/seeders/StatuslabelSeeder.php index fbc6a9fb6..be36e7790 100755 --- a/database/seeders/StatuslabelSeeder.php +++ b/database/seeders/StatuslabelSeeder.php @@ -16,22 +16,22 @@ class StatuslabelSeeder extends Seeder Statuslabel::factory()->rtd()->create([ 'name' => 'Ready to Deploy', - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Statuslabel::factory()->pending()->create([ 'name' => 'Pending', - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); Statuslabel::factory()->archived()->create([ 'name' => 'Archived', - 'user_id' => $admin->id, + 'created_by' => $admin->id, ]); - Statuslabel::factory()->outForDiagnostics()->create(['user_id' => $admin->id]); - Statuslabel::factory()->outForRepair()->create(['user_id' => $admin->id]); - Statuslabel::factory()->broken()->create(['user_id' => $admin->id]); - Statuslabel::factory()->lost()->create(['user_id' => $admin->id]); + Statuslabel::factory()->outForDiagnostics()->create(['created_by' => $admin->id]); + Statuslabel::factory()->outForRepair()->create(['created_by' => $admin->id]); + Statuslabel::factory()->broken()->create(['created_by' => $admin->id]); + Statuslabel::factory()->lost()->create(['created_by' => $admin->id]); } } diff --git a/dev.docker-compose.yml b/dev.docker-compose.yml index 15272ce5c..6cf4a1e2f 100644 --- a/dev.docker-compose.yml +++ b/dev.docker-compose.yml @@ -1,3 +1,5 @@ +# Compose file to spin up a local Snipe-IT for development. + version: '3' services: @@ -7,44 +9,40 @@ services: dockerfile: Dockerfile.alpine container_name: snipeit ports: - - "8000:80" - volumes: - - ./storage/logs:/var/www/html/storage/logs + - "8000:80" depends_on: - - mariadb - - redis + redis: + # The default needs to be stated. + condition: service_started + mariadb: + condition: service_healthy + restart: true env_file: - - .env.docker - networks: - - snipeit-backend + - .env.dev.docker mariadb: - image: mariadb:10.6.4-focal + image: mariadb:11.5.2 volumes: - - db:/var/lib/mysql + - db:/var/lib/mysql env_file: - - .env.docker - networks: - - snipeit-backend + - .env.dev.docker ports: - "3306:3306" + healthcheck: + # https://mariadb.com/kb/en/using-healthcheck-sh/#compose-file-example + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + interval: 5s + timeout: 2s + retries: 5 redis: - image: redis:6.2.5-buster - networks: - - snipeit-backend + image: redis:7.4.0 mailhog: image: mailhog/mailhog:v1.0.1 ports: - # - 1025:1025 - - "8025:8025" - networks: - - snipeit-backend - + # - 1025:1025 + - "8025:8025" volumes: db: {} - -networks: - snipeit-backend: {} diff --git a/docker-compose.yml b/docker-compose.yml index c7c1983a4..d830a9436 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,13 @@ +# Compose file for production. + volumes: db_data: storage: services: app: - image: snipe/snipe-it:${APP_VERSION:-v6.4.1} - restart: always + image: snipe/snipe-it:${APP_VERSION:-v7.0.11} + restart: unless-stopped volumes: - storage:/var/lib/snipeit ports: @@ -18,8 +20,8 @@ services: - .env db: - image: mariadb:10.6.4-focal - restart: always + image: mariadb:11.5.2 + restart: unless-stopped volumes: - db_data:/var/lib/mysql environment: @@ -28,7 +30,8 @@ services: MYSQL_PASSWORD: ${DB_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} healthcheck: - test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD + # https://mariadb.com/kb/en/using-healthcheck-sh/#compose-file-example + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] interval: 5s timeout: 1s retries: 5 diff --git a/docker/entrypoint_alpine.sh b/docker/startup_alpine.sh similarity index 100% rename from docker/entrypoint_alpine.sh rename to docker/startup_alpine.sh diff --git a/docker/docker-entrypoint.sh b/docker/startup_alpine_fpm.sh similarity index 100% rename from docker/docker-entrypoint.sh rename to docker/startup_alpine_fpm.sh diff --git a/package-lock.json b/package-lock.json index d71c3f9fd..5e6fe1105 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "bootstrap-colorpicker": "^2.5.3", "bootstrap-datepicker": "^1.10.0", "bootstrap-less": "^3.3.8", - "bootstrap-table": "1.23.0", + "bootstrap-table": "1.23.5", "canvas-confetti": "^1.9.3", "chart.js": "^2.9.4", "clipboard": "^2.0.11", @@ -23,10 +23,10 @@ "ekko-lightbox": "^5.1.1", "imagemin": "^8.0.1", "jquery-slimscroll": "^1.3.8", - "jquery-ui": "^1.13.3", + "jquery-ui": "^1.14.0", "jquery-validation": "^1.21.0", "jquery.iframe-transport": "^1.0.0", - "jspdf-autotable": "^3.8.2", + "jspdf-autotable": "^3.8.4", "less": "^4.2.0", "less-loader": "^6.0", "list.js": "^1.5.0", @@ -37,7 +37,7 @@ "signature_pad": "^4.2.0", "tableexport.jquery.plugin": "1.30.0", "tether": "^1.4.0", - "webpack": "^5.92.0" + "webpack": "^5.95.0" }, "devDependencies": { "all-contributors-cli": "^6.26.1", @@ -2106,8 +2106,9 @@ } }, "node_modules/@types/eslint": { - "version": "8.56.10", - "license": "MIT", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -2115,15 +2116,17 @@ }, "node_modules/@types/eslint-scope": { "version": "3.7.7", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dependencies": { "@types/eslint": "*", "@types/estree": "*" } }, "node_modules/@types/estree": { - "version": "1.0.5", - "license": "MIT" + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" }, "node_modules/@types/express": { "version": "4.17.21", @@ -2482,9 +2485,9 @@ } }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "bin": { "acorn": "bin/acorn" }, @@ -2499,14 +2502,6 @@ "acorn": "^8" } }, - "node_modules/acorn-import-attributes": { - "version": "1.9.5", - "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", - "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", - "peerDependencies": { - "acorn": "^8" - } - }, "node_modules/acorn-node": { "version": "1.8.2", "license": "Apache-2.0", @@ -3693,9 +3688,9 @@ "license": "MIT" }, "node_modules/bootstrap-table": { - "version": "1.23.0", - "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.23.0.tgz", - "integrity": "sha512-fAIhu2CAqMsZWkzeFxXyh0yQA2DMBdB0tCdr1iF6bKr3c/Hf79cw5PykNt7NdtqLz/a0p192S8EKyT5lG4yrpw==", + "version": "1.23.5", + "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.23.5.tgz", + "integrity": "sha512-9WByoSpJvA73gi2YYIlX6IWR74oZtBmSixul/Th8FTBtBd/kZRpbKESGTjhA3BA3AYTnfyY8Iy1KeRWPlV2GWQ==", "peerDependencies": { "jquery": "3" } @@ -3955,7 +3950,9 @@ } }, "node_modules/browserslist": { - "version": "4.23.0", + "version": "4.24.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", "funding": [ { "type": "opencollective", @@ -3970,12 +3967,11 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001587", - "electron-to-chromium": "^1.4.668", - "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.13" + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" @@ -4082,7 +4078,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001616", + "version": "1.0.30001677", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz", + "integrity": "sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog==", "funding": [ { "type": "opencollective", @@ -4096,8 +4094,7 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ], - "license": "CC-BY-4.0" + ] }, "node_modules/canvas-confetti": { "version": "1.9.3", @@ -5269,8 +5266,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.756", - "license": "ISC" + "version": "1.5.52", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.52.tgz", + "integrity": "sha512-xtoijJTZ+qeucLBDNztDOuQBE1ksqjvNjvqFoST3nGC7fSpqJ+X6BdTBaY5BHG+IhWWmpc6b/KfpeuEDupEPOQ==" }, "node_modules/elliptic": { "version": "6.5.5", @@ -5310,9 +5308,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.0.tgz", - "integrity": "sha512-dwDPwZL0dmye8Txp2gzFmA6sxALaSvdRDjPH0viLcKrtlOL3tw62nWWweVD1SdILDTJrbrL6tdWVN58Wo6U3eA==", + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -5403,8 +5401,9 @@ "license": "MIT" }, "node_modules/escalade": { - "version": "3.1.2", - "license": "MIT", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "engines": { "node": ">=6" } @@ -7067,10 +7066,11 @@ "license": "BSD-2-Clause" }, "node_modules/jquery-ui": { - "version": "1.13.3", - "license": "MIT", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.14.0.tgz", + "integrity": "sha512-mPfYKBoRCf0MzaT2cyW5i3IuZ7PfTITaasO5OFLAQxrHuI+ZxruPa+4/K1OMNT8oElLWGtIxc9aRbyw20BKr8g==", "dependencies": { - "jquery": ">=1.8.0 <4.0.0" + "jquery": ">=1.12.0 <5.0.0" } }, "node_modules/jquery-validation": { @@ -7181,8 +7181,9 @@ } }, "node_modules/jspdf-autotable": { - "version": "3.8.2", - "license": "MIT", + "version": "3.8.4", + "resolved": "https://registry.npmjs.org/jspdf-autotable/-/jspdf-autotable-3.8.4.tgz", + "integrity": "sha512-rSffGoBsJYX83iTRv8Ft7FhqfgEL2nLpGAIiqruEQQ3e4r0qdLFbPUB7N9HAle0I3XgpisvyW751VHCqKUVOgQ==", "peerDependencies": { "jspdf": "^2.5.1" } @@ -8110,8 +8111,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.14", - "license": "MIT" + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -8562,8 +8564,9 @@ "optional": true }, "node_modules/picocolors": { - "version": "1.0.0", - "license": "ISC" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -10716,7 +10719,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.15", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", "funding": [ { "type": "opencollective", @@ -10731,10 +10736,9 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { - "escalade": "^3.1.2", - "picocolors": "^1.0.0" + "escalade": "^3.2.0", + "picocolors": "^1.1.0" }, "bin": { "update-browserslist-db": "cli.js" @@ -10879,20 +10883,19 @@ "license": "BSD-2-Clause" }, "node_modules/webpack": { - "version": "5.92.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.92.1.tgz", - "integrity": "sha512-JECQ7IwJb+7fgUFBlrJzbyu3GEuNBcdqr1LD7IbSzwkSmIevTm8PF+wej3Oxuz/JFBUZ6O1o43zsPkwm1C4TmA==", + "version": "5.96.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.96.1.tgz", + "integrity": "sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA==", "dependencies": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.5", + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.6", "@webassemblyjs/ast": "^1.12.1", "@webassemblyjs/wasm-edit": "^1.12.1", "@webassemblyjs/wasm-parser": "^1.12.1", - "acorn": "^8.7.1", - "acorn-import-attributes": "^1.9.5", - "browserslist": "^4.21.10", + "acorn": "^8.14.0", + "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.0", + "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", diff --git a/package.json b/package.json index 468c6c289..8ad15179a 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "bootstrap-colorpicker": "^2.5.3", "bootstrap-datepicker": "^1.10.0", "bootstrap-less": "^3.3.8", - "bootstrap-table": "1.23.0", + "bootstrap-table": "1.23.5", "canvas-confetti": "^1.9.3", "chart.js": "^2.9.4", "clipboard": "^2.0.11", @@ -43,10 +43,10 @@ "ekko-lightbox": "^5.1.1", "imagemin": "^8.0.1", "jquery-slimscroll": "^1.3.8", - "jquery-ui": "^1.13.3", + "jquery-ui": "^1.14.0", "jquery-validation": "^1.21.0", "jquery.iframe-transport": "^1.0.0", - "jspdf-autotable": "^3.8.2", + "jspdf-autotable": "^3.8.4", "less": "^4.2.0", "less-loader": "^6.0", "list.js": "^1.5.0", @@ -57,6 +57,6 @@ "signature_pad": "^4.2.0", "tableexport.jquery.plugin": "1.30.0", "tether": "^1.4.0", - "webpack": "^5.92.0" + "webpack": "^5.95.0" } } diff --git a/public/css/build/app.css b/public/css/build/app.css index f70346905..d35eebb0a 100644 --- a/public/css/build/app.css +++ b/public/css/build/app.css @@ -312,7 +312,8 @@ a.accordion-header { a.logo.no-hover a:hover { background-color: transparent; } -.required { +input:required, +select:required { border-right: 6px solid orange; } .sidebar-menu { @@ -686,8 +687,13 @@ a.link-danger:hover { a.logo.no-hover a:hover { background-color: transparent; } -.required { - border-right: 6px solid orange; +input:required, +select:required { + border-right: 5px solid orange; +} +select:required + .select2-container .select2-selection, +select:required + .select2-container .select2-selection .select2-selection--multiple { + border-right: 5px solid orange !important; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; @@ -697,6 +703,9 @@ body { font-size: 14px; white-space: normal; } +.modal-warning .modal-help { + color: #fff8af; +} .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { z-index: 0 !important; } @@ -828,19 +837,33 @@ body { } .select2-selection--multiple { border-color: #d2d6de !important; - height: 34px; + overflow-y: auto; } .select2-selection__choice { border-radius: 0px !important; } +.select2-search select2-search--inline { + height: 35px !important; + float: left; + margin: 0; +} +.select2-results__option { + padding: 5px; + -moz-user-select: none; + user-select: none; + -webkit-user-select: none; + margin: 0px; +} img.navbar-brand-img, .navbar-brand > img { float: left; padding: 5px 5px 5px 0; max-height: 50px; } -.input-daterange { - border-radius: 0px; +.input-daterange, +.input-daterange input:first-child, +.input-daterange input:last-child { + border-radius: 0px !important; } .btn.bg-maroon, .btn.bg-purple { @@ -919,20 +942,21 @@ h4 { background-color: #f9f9f9; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-striped .row:nth-of-type(even) div { background: #FFFFFF; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-new-striped { vertical-align: top; - line-height: 2.6; - padding: 0px; - margin-left: 20px; + padding: 3px; display: table; width: 100%; - padding-right: 20px; + word-wrap: break-word; + table-layout: fixed; } /** * NEW STRIPING @@ -942,20 +966,25 @@ h4 { .row-new-striped > .row:nth-of-type(even) { background: #FFFFFF; border-top: 1px solid #dddddd; + line-height: 1.9; display: table-row; } .row-new-striped > .row:nth-of-type(odd) { background-color: #F8F8F8; border-top: 1px solid #dddddd; display: table-row; + line-height: 1.9; + padding: 2px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div[class^="col"]:first-child { font-weight: bold; @@ -1006,6 +1035,7 @@ th.css-consumable > .th-inner, th.css-envelope > .th-inner, th.css-users > .th-inner, th.css-location > .th-inner, +th.css-component > .th-inner, th.css-accessory > .th-inner { font-size: 0px; line-height: 0.75 !important; @@ -1021,6 +1051,7 @@ th.css-consumable > .th-inner::before, th.css-envelope > .th-inner::before, th.css-users > .th-inner::before, th.css-location > .th-inner::before, +th.css-component > .th-inner::before, th.css-accessory > .th-inner::before { display: inline-block; font-size: 20px; @@ -1074,6 +1105,11 @@ th.css-location > .th-inner::before { font-size: 19px; margin-bottom: 0px; } +th.css-component > .th-inner::before { + content: "\f0a0"; + font-family: "Font Awesome 5 Free"; + font-weight: 500; +} .small-box .inner { padding-left: 15px; padding-right: 15px; @@ -1122,6 +1158,24 @@ th.css-location > .th-inner::before { margin-top: 50px; } } +@media screen and (max-width: 992px) { + .info-stack-container { + display: flex; + flex-direction: column; + } + .col-md-3.col-xs-12.col-sm-push-9.info-stack { + left: auto; + order: 1; + } + .col-md-9.col-xs-12.col-sm-pull-3.info-stack { + right: auto; + order: 2; + } + .info-stack-container > .col-md-9.col-xs-12.col-sm-pull-3.info-stack > .row-new-striped > .row > .col-sm-2 { + width: auto; + float: none; + } +} @media screen and (max-width: 1318px) and (min-width: 1200px) { .admin.box { height: 170px; diff --git a/public/css/build/overrides.css b/public/css/build/overrides.css index d8169245b..6e4825dc4 100644 --- a/public/css/build/overrides.css +++ b/public/css/build/overrides.css @@ -319,8 +319,13 @@ a.link-danger:hover { a.logo.no-hover a:hover { background-color: transparent; } -.required { - border-right: 6px solid orange; +input:required, +select:required { + border-right: 5px solid orange; +} +select:required + .select2-container .select2-selection, +select:required + .select2-container .select2-selection .select2-selection--multiple { + border-right: 5px solid orange !important; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; @@ -330,6 +335,9 @@ body { font-size: 14px; white-space: normal; } +.modal-warning .modal-help { + color: #fff8af; +} .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { z-index: 0 !important; } @@ -461,19 +469,33 @@ body { } .select2-selection--multiple { border-color: #d2d6de !important; - height: 34px; + overflow-y: auto; } .select2-selection__choice { border-radius: 0px !important; } +.select2-search select2-search--inline { + height: 35px !important; + float: left; + margin: 0; +} +.select2-results__option { + padding: 5px; + -moz-user-select: none; + user-select: none; + -webkit-user-select: none; + margin: 0px; +} img.navbar-brand-img, .navbar-brand > img { float: left; padding: 5px 5px 5px 0; max-height: 50px; } -.input-daterange { - border-radius: 0px; +.input-daterange, +.input-daterange input:first-child, +.input-daterange input:last-child { + border-radius: 0px !important; } .btn.bg-maroon, .btn.bg-purple { @@ -552,20 +574,21 @@ h4 { background-color: #f9f9f9; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-striped .row:nth-of-type(even) div { background: #FFFFFF; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-new-striped { vertical-align: top; - line-height: 2.6; - padding: 0px; - margin-left: 20px; + padding: 3px; display: table; width: 100%; - padding-right: 20px; + word-wrap: break-word; + table-layout: fixed; } /** * NEW STRIPING @@ -575,20 +598,25 @@ h4 { .row-new-striped > .row:nth-of-type(even) { background: #FFFFFF; border-top: 1px solid #dddddd; + line-height: 1.9; display: table-row; } .row-new-striped > .row:nth-of-type(odd) { background-color: #F8F8F8; border-top: 1px solid #dddddd; display: table-row; + line-height: 1.9; + padding: 2px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div[class^="col"]:first-child { font-weight: bold; @@ -639,6 +667,7 @@ th.css-consumable > .th-inner, th.css-envelope > .th-inner, th.css-users > .th-inner, th.css-location > .th-inner, +th.css-component > .th-inner, th.css-accessory > .th-inner { font-size: 0px; line-height: 0.75 !important; @@ -654,6 +683,7 @@ th.css-consumable > .th-inner::before, th.css-envelope > .th-inner::before, th.css-users > .th-inner::before, th.css-location > .th-inner::before, +th.css-component > .th-inner::before, th.css-accessory > .th-inner::before { display: inline-block; font-size: 20px; @@ -707,6 +737,11 @@ th.css-location > .th-inner::before { font-size: 19px; margin-bottom: 0px; } +th.css-component > .th-inner::before { + content: "\f0a0"; + font-family: "Font Awesome 5 Free"; + font-weight: 500; +} .small-box .inner { padding-left: 15px; padding-right: 15px; @@ -755,6 +790,24 @@ th.css-location > .th-inner::before { margin-top: 50px; } } +@media screen and (max-width: 992px) { + .info-stack-container { + display: flex; + flex-direction: column; + } + .col-md-3.col-xs-12.col-sm-push-9.info-stack { + left: auto; + order: 1; + } + .col-md-9.col-xs-12.col-sm-pull-3.info-stack { + right: auto; + order: 2; + } + .info-stack-container > .col-md-9.col-xs-12.col-sm-pull-3.info-stack > .row-new-striped > .row > .col-sm-2 { + width: auto; + float: none; + } +} @media screen and (max-width: 1318px) and (min-width: 1200px) { .admin.box { height: 170px; diff --git a/public/css/dist/all.css b/public/css/dist/all.css index 8957c0099..bd004f657 100644 --- a/public/css/dist/all.css +++ b/public/css/dist/all.css @@ -20968,7 +20968,333 @@ hr { .ekko-lightbox{display:-ms-flexbox!important;display:flex!important;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-right:0!important}.ekko-lightbox-container{position:relative}.ekko-lightbox-container>div.ekko-lightbox-item{position:absolute;top:0;left:0;bottom:0;right:0;width:100%}.ekko-lightbox iframe{width:100%;height:100%}.ekko-lightbox-nav-overlay{z-index:1;position:absolute;top:0;left:0;width:100%;height:100%;display:-ms-flexbox;display:flex}.ekko-lightbox-nav-overlay a{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0;transition:opacity .5s;color:#fff;font-size:30px;z-index:1}.ekko-lightbox-nav-overlay a>*{-ms-flex-positive:1;flex-grow:1}.ekko-lightbox-nav-overlay a>:focus{outline:none}.ekko-lightbox-nav-overlay a span{padding:0 30px}.ekko-lightbox-nav-overlay a:last-child span{text-align:right}.ekko-lightbox-nav-overlay a:hover{text-decoration:none}.ekko-lightbox-nav-overlay a:focus{outline:none}.ekko-lightbox-nav-overlay a.disabled{cursor:default;visibility:hidden}.ekko-lightbox a:hover{opacity:1;text-decoration:none}.ekko-lightbox .modal-dialog{display:none}.ekko-lightbox .modal-footer{text-align:left}.ekko-lightbox-loader{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.ekko-lightbox-loader>div{width:40px;height:40px;position:relative;text-align:center}.ekko-lightbox-loader>div>div{width:100%;height:100%;border-radius:50%;background-color:#fff;opacity:.6;position:absolute;top:0;left:0;animation:a 2s infinite ease-in-out}.ekko-lightbox-loader>div>div:last-child{animation-delay:-1s}.modal-dialog .ekko-lightbox-loader>div>div{background-color:#333}@keyframes a{0%,to{transform:scale(0);-webkit-transform:scale(0)}50%{transform:scale(1);-webkit-transform:scale(1)}} /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImVra28tbGlnaHRib3guY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQ0UsOEJBQXlCLEFBQXpCLHVCQUF5QixBQUN6QixzQkFBb0IsQUFBcEIsbUJBQW9CLEFBQ3BCLHFCQUF3QixBQUF4Qix1QkFBd0IsQUFDeEIseUJBQTZCLENBQzlCLEFBQ0QseUJBQ0UsaUJBQW1CLENBQ3BCLEFBQ0QsZ0RBQ0Usa0JBQW1CLEFBQ25CLE1BQU8sQUFDUCxPQUFRLEFBQ1IsU0FBVSxBQUNWLFFBQVMsQUFDVCxVQUFZLENBQ2IsQUFDRCxzQkFDRSxXQUFZLEFBQ1osV0FBYSxDQUNkLEFBQ0QsMkJBQ0UsVUFBYSxBQUNiLGtCQUFtQixBQUNuQixNQUFPLEFBQ1AsT0FBUSxBQUNSLFdBQVksQUFDWixZQUFhLEFBQ2Isb0JBQWMsQUFBZCxZQUFjLENBQ2YsQUFDRCw2QkFDRSxXQUFRLEFBQVIsT0FBUSxBQUNSLG9CQUFjLEFBQWQsYUFBYyxBQUNkLHNCQUFvQixBQUFwQixtQkFBb0IsQUFDcEIsVUFBVyxBQUNYLHVCQUF5QixBQUN6QixXQUFZLEFBQ1osZUFBZ0IsQUFDaEIsU0FBYSxDQUNkLEFBQ0QsK0JBQ0Usb0JBQWEsQUFBYixXQUFhLENBQ2QsQUFDRCxvQ0FDRSxZQUFjLENBQ2YsQUFDRCxrQ0FDRSxjQUFnQixDQUNqQixBQUNELDZDQUNFLGdCQUFrQixDQUNuQixBQUNELG1DQUNFLG9CQUFzQixDQUN2QixBQUNELG1DQUNFLFlBQWMsQ0FDZixBQUNELHNDQUNFLGVBQWdCLEFBQ2hCLGlCQUFtQixDQUNwQixBQUNELHVCQUNFLFVBQVcsQUFDWCxvQkFBc0IsQ0FDdkIsQUFDRCw2QkFDRSxZQUFjLENBQ2YsQUFDRCw2QkFDRSxlQUFpQixDQUNsQixBQUNELHNCQUNFLGtCQUFtQixBQUNuQixNQUFPLEFBQ1AsT0FBUSxBQUNSLFNBQVUsQUFDVixRQUFTLEFBQ1QsV0FBWSxBQUNaLG9CQUFjLEFBQWQsYUFBYyxBQUVkLDBCQUF1QixBQUF2QixzQkFBdUIsQUFFdkIscUJBQXdCLEFBQXhCLHVCQUF3QixBQUV4QixzQkFBb0IsQUFBcEIsa0JBQW9CLENBQ3JCLEFBQ0QsMEJBQ0UsV0FBWSxBQUNaLFlBQWEsQUFDYixrQkFBbUIsQUFDbkIsaUJBQW1CLENBQ3BCLEFBQ0QsOEJBQ0UsV0FBWSxBQUNaLFlBQWEsQUFDYixrQkFBbUIsQUFDbkIsc0JBQXVCLEFBQ3ZCLFdBQWEsQUFDYixrQkFBbUIsQUFDbkIsTUFBTyxBQUNQLE9BQVEsQUFDUixtQ0FBNkMsQ0FDOUMsQUFDRCx5Q0FDRSxtQkFBcUIsQ0FDdEIsQUFDRCw0Q0FDRSxxQkFBdUIsQ0FDeEIsQUFVRCxhQUNFLE1BRUUsbUJBQW9CLEFBQ3BCLDBCQUE0QixDQUM3QixBQUNELElBQ0UsbUJBQW9CLEFBQ3BCLDBCQUE0QixDQUM3QixDQUNGIiwiZmlsZSI6ImVra28tbGlnaHRib3guY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLmVra28tbGlnaHRib3gge1xuICBkaXNwbGF5OiBmbGV4ICFpbXBvcnRhbnQ7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBwYWRkaW5nLXJpZ2h0OiAwcHghaW1wb3J0YW50O1xufVxuLmVra28tbGlnaHRib3gtY29udGFpbmVyIHtcbiAgcG9zaXRpb246IHJlbGF0aXZlO1xufVxuLmVra28tbGlnaHRib3gtY29udGFpbmVyID4gZGl2LmVra28tbGlnaHRib3gtaXRlbSB7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgdG9wOiAwO1xuICBsZWZ0OiAwO1xuICBib3R0b206IDA7XG4gIHJpZ2h0OiAwO1xuICB3aWR0aDogMTAwJTtcbn1cbi5la2tvLWxpZ2h0Ym94IGlmcmFtZSB7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSB7XG4gIHotaW5kZXg6IDEwMDtcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICB0b3A6IDA7XG4gIGxlZnQ6IDA7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG4gIGRpc3BsYXk6IGZsZXg7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhIHtcbiAgZmxleDogMTtcbiAgZGlzcGxheTogZmxleDtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgb3BhY2l0eTogMDtcbiAgdHJhbnNpdGlvbjogb3BhY2l0eSAwLjVzO1xuICBjb2xvcjogI2ZmZjtcbiAgZm9udC1zaXplOiAzMHB4O1xuICB6LWluZGV4OiAxMDA7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhID4gKiB7XG4gIGZsZXgtZ3JvdzogMTtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGEgPiAqOmZvY3VzIHtcbiAgb3V0bGluZTogbm9uZTtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGEgc3BhbiB7XG4gIHBhZGRpbmc6IDAgMzBweDtcbn1cbi5la2tvLWxpZ2h0Ym94LW5hdi1vdmVybGF5IGE6bGFzdC1jaGlsZCBzcGFuIHtcbiAgdGV4dC1hbGlnbjogcmlnaHQ7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhOmhvdmVyIHtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xufVxuLmVra28tbGlnaHRib3gtbmF2LW92ZXJsYXkgYTpmb2N1cyB7XG4gIG91dGxpbmU6IG5vbmU7XG59XG4uZWtrby1saWdodGJveC1uYXYtb3ZlcmxheSBhLmRpc2FibGVkIHtcbiAgY3Vyc29yOiBkZWZhdWx0O1xuICB2aXNpYmlsaXR5OiBoaWRkZW47XG59XG4uZWtrby1saWdodGJveCBhOmhvdmVyIHtcbiAgb3BhY2l0eTogMTtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xufVxuLmVra28tbGlnaHRib3ggLm1vZGFsLWRpYWxvZyB7XG4gIGRpc3BsYXk6IG5vbmU7XG59XG4uZWtrby1saWdodGJveCAubW9kYWwtZm9vdGVyIHtcbiAgdGV4dC1hbGlnbjogbGVmdDtcbn1cbi5la2tvLWxpZ2h0Ym94LWxvYWRlciB7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgdG9wOiAwO1xuICBsZWZ0OiAwO1xuICBib3R0b206IDA7XG4gIHJpZ2h0OiAwO1xuICB3aWR0aDogMTAwJTtcbiAgZGlzcGxheTogZmxleDtcbiAgLyogZXN0YWJsaXNoIGZsZXggY29udGFpbmVyICovXG4gIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gIC8qIG1ha2UgbWFpbiBheGlzIHZlcnRpY2FsICovXG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICAvKiBjZW50ZXIgaXRlbXMgdmVydGljYWxseSwgaW4gdGhpcyBjYXNlICovXG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG59XG4uZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYge1xuICB3aWR0aDogNDBweDtcbiAgaGVpZ2h0OiA0MHB4O1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gIHRleHQtYWxpZ246IGNlbnRlcjtcbn1cbi5la2tvLWxpZ2h0Ym94LWxvYWRlciA+IGRpdiA+IGRpdiB7XG4gIHdpZHRoOiAxMDAlO1xuICBoZWlnaHQ6IDEwMCU7XG4gIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgYmFja2dyb3VuZC1jb2xvcjogI2ZmZjtcbiAgb3BhY2l0eTogMC42O1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIHRvcDogMDtcbiAgbGVmdDogMDtcbiAgYW5pbWF0aW9uOiBzay1ib3VuY2UgMnMgaW5maW5pdGUgZWFzZS1pbi1vdXQ7XG59XG4uZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYgPiBkaXY6bGFzdC1jaGlsZCB7XG4gIGFuaW1hdGlvbi1kZWxheTogLTFzO1xufVxuLm1vZGFsLWRpYWxvZyAuZWtrby1saWdodGJveC1sb2FkZXIgPiBkaXYgPiBkaXYge1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAjMzMzO1xufVxuQC13ZWJraXQta2V5ZnJhbWVzIHNrLWJvdW5jZSB7XG4gIDAlLFxuICAxMDAlIHtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMCk7XG4gIH1cbiAgNTAlIHtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMSk7XG4gIH1cbn1cbkBrZXlmcmFtZXMgc2stYm91bmNlIHtcbiAgMCUsXG4gIDEwMCUge1xuICAgIHRyYW5zZm9ybTogc2NhbGUoMCk7XG4gICAgLXdlYmtpdC10cmFuc2Zvcm06IHNjYWxlKDApO1xuICB9XG4gIDUwJSB7XG4gICAgdHJhbnNmb3JtOiBzY2FsZSgxKTtcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGUoMSk7XG4gIH1cbn1cbiJdfQ== */ -.bootstrap-table .fixed-table-toolbar::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-toolbar .bs-bars,.bootstrap-table .fixed-table-toolbar .search,.bootstrap-table .fixed-table-toolbar .columns{position:relative;margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group{display:inline-block;margin-left:-1px !important}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group>.btn{border-radius:0}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .dropdown-menu{text-align:left;max-height:300px;overflow:auto;-ms-overflow-style:scrollbar;z-index:1001}.bootstrap-table .fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.4286}.bootstrap-table .fixed-table-toolbar .columns-left{margin-right:5px}.bootstrap-table .fixed-table-toolbar .columns-right{margin-left:5px}.bootstrap-table .fixed-table-toolbar .pull-right .dropdown-menu{right:0;left:auto}.bootstrap-table .fixed-table-container{position:relative;clear:both}.bootstrap-table .fixed-table-container .table{width:100%;margin-bottom:0 !important}.bootstrap-table .fixed-table-container .table th,.bootstrap-table .fixed-table-container .table td{vertical-align:middle;box-sizing:border-box}.bootstrap-table .fixed-table-container .table thead th,.bootstrap-table .fixed-table-container .table tfoot th{vertical-align:bottom;padding:0;margin:0}.bootstrap-table .fixed-table-container .table thead th:focus,.bootstrap-table .fixed-table-container .table tfoot th:focus{outline:0 solid rgba(0,0,0,0)}.bootstrap-table .fixed-table-container .table thead th.detail,.bootstrap-table .fixed-table-container .table tfoot th.detail{width:30px}.bootstrap-table .fixed-table-container .table thead th .th-inner,.bootstrap-table .fixed-table-container .table tfoot th .th-inner{padding:.75rem;vertical-align:bottom;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bootstrap-table .fixed-table-container .table thead th .sortable,.bootstrap-table .fixed-table-container .table tfoot th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px !important}.bootstrap-table .fixed-table-container .table thead th .sortable.sortable-center,.bootstrap-table .fixed-table-container .table tfoot th .sortable.sortable-center{padding-left:20px !important;padding-right:20px !important}.bootstrap-table .fixed-table-container .table thead th .both,.bootstrap-table .fixed-table-container .table tfoot th .both{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC")}.bootstrap-table .fixed-table-container .table thead th .asc,.bootstrap-table .fixed-table-container .table tfoot th .asc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==")}.bootstrap-table .fixed-table-container .table thead th .desc,.bootstrap-table .fixed-table-container .table tfoot th .desc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ")}.bootstrap-table .fixed-table-container .table tbody tr.selected td{background-color:rgba(0,0,0,.075)}.bootstrap-table .fixed-table-container .table tbody tr.no-records-found td{text-align:center}.bootstrap-table .fixed-table-container .table tbody tr .card-view{display:flex}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title{font-weight:bold;display:inline-block;min-width:30%;width:auto !important;text-align:left !important}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-value{width:100% !important;text-align:left !important}.bootstrap-table .fixed-table-container .table .bs-checkbox{text-align:center}.bootstrap-table .fixed-table-container .table .bs-checkbox label{margin-bottom:0}.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=radio],.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=checkbox]{margin:0 auto !important}.bootstrap-table .fixed-table-container .table.table-sm .th-inner{padding:.25rem}.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer){border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height.has-card-view{border-top:1px solid #dee2e6;border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .fixed-table-border{border-left:1px solid #dee2e6;border-right:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table thead th{border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table-dark thead th{border-bottom:1px solid #32383e}.bootstrap-table .fixed-table-container .fixed-table-header{overflow:hidden}.bootstrap-table .fixed-table-container .fixed-table-body{overflow:auto auto;height:100%}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading{align-items:center;background:#fff;display:flex;justify-content:center;position:absolute;bottom:0;width:100%;max-width:100%;z-index:1000;transition:visibility 0s,opacity .15s ease-in-out;opacity:0;visibility:hidden}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open{visibility:visible;opacity:1}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap{align-items:baseline;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text{margin-right:6px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap{align-items:center;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::before{content:"";animation-duration:1.5s;animation-iteration-count:infinite;animation-name:loading;background:#212529;border-radius:50%;display:block;height:5px;margin:0 4px;opacity:0;width:5px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot{animation-delay:.3s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after{animation-delay:.6s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark{background:#212529}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::before{background:#fff}.bootstrap-table .fixed-table-container .fixed-table-footer{overflow:hidden}.bootstrap-table .fixed-table-pagination::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-pagination>.pagination-detail,.bootstrap-table .fixed-table-pagination>.pagination{margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-pagination>.pagination-detail .pagination-info{line-height:34px;margin-right:5px}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list{display:inline-block}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group{position:relative;display:inline-block;vertical-align:middle}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group .dropdown-menu{margin-bottom:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination{margin:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a{color:#c8c8c8}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::before{content:"⬅"}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::after{content:"➡"}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.disabled a{pointer-events:none;cursor:default}.bootstrap-table.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100% !important;background:#fff;height:100vh;overflow-y:scroll}.bootstrap-table.bootstrap4 .pagination-lg .page-link,.bootstrap-table.bootstrap5 .pagination-lg .page-link{padding:.5rem 1rem}.bootstrap-table.bootstrap5 .float-left{float:left}.bootstrap-table.bootstrap5 .float-right{float:right}div.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}@keyframes loading{0%{opacity:0}50%{opacity:1}100%{opacity:0}} +@charset "UTF-8"; +/** + * @author zhixin wen + * version: 1.23.5 + * https://github.com/wenzhixin/bootstrap-table/ + */ +/* stylelint-disable annotation-no-unknown, max-line-length */ +/* stylelint-enable annotation-no-unknown, max-line-length */ +.bootstrap-table .fixed-table-toolbar::after { + content: ""; + display: block; + clear: both; +} +.bootstrap-table .fixed-table-toolbar .bs-bars, +.bootstrap-table .fixed-table-toolbar .search, +.bootstrap-table .fixed-table-toolbar .columns { + position: relative; + margin-top: 10px; + margin-bottom: 10px; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group { + display: inline-block; + margin-left: -1px !important; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group > .btn { + border-radius: 0; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group:first-child > .btn { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group:last-child > .btn { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +.bootstrap-table .fixed-table-toolbar .columns .dropdown-menu { + text-align: left; + max-height: 300px; + overflow: auto; + -ms-overflow-style: scrollbar; + z-index: 1001; +} +.bootstrap-table .fixed-table-toolbar .columns label { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.4286; +} +.bootstrap-table .fixed-table-toolbar .columns-left { + margin-right: 5px; +} +.bootstrap-table .fixed-table-toolbar .columns-right { + margin-left: 5px; +} +.bootstrap-table .fixed-table-toolbar .pull-right .dropdown-menu { + right: 0; + left: auto; +} +.bootstrap-table .fixed-table-container { + position: relative; + clear: both; +} +.bootstrap-table .fixed-table-container .table { + width: 100%; + margin-bottom: 0 !important; +} +.bootstrap-table .fixed-table-container .table th, +.bootstrap-table .fixed-table-container .table td { + vertical-align: middle; + box-sizing: border-box; +} +.bootstrap-table .fixed-table-container .table thead th, +.bootstrap-table .fixed-table-container .table tfoot th { + vertical-align: bottom; + padding: 0; + margin: 0; +} +.bootstrap-table .fixed-table-container .table thead th:focus, +.bootstrap-table .fixed-table-container .table tfoot th:focus { + outline: 0 solid transparent; +} +.bootstrap-table .fixed-table-container .table thead th.detail, +.bootstrap-table .fixed-table-container .table tfoot th.detail { + width: 30px; +} +.bootstrap-table .fixed-table-container .table thead th .th-inner, +.bootstrap-table .fixed-table-container .table tfoot th .th-inner { + padding: 0.75rem; + vertical-align: bottom; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.bootstrap-table .fixed-table-container .table thead th .sortable, +.bootstrap-table .fixed-table-container .table tfoot th .sortable { + cursor: pointer; + background-position: right; + background-repeat: no-repeat; + padding-right: 30px !important; +} +.bootstrap-table .fixed-table-container .table thead th .sortable.sortable-center, +.bootstrap-table .fixed-table-container .table tfoot th .sortable.sortable-center { + padding-left: 20px !important; + padding-right: 20px !important; +} +.bootstrap-table .fixed-table-container .table thead th .both, +.bootstrap-table .fixed-table-container .table tfoot th .both { + background-image: url('data:image/svg+xml;utf8,'); + background-size: 16px 16px; + background-position: center right 2px; +} +.bootstrap-table .fixed-table-container .table thead th .asc, +.bootstrap-table .fixed-table-container .table tfoot th .asc { + background-image: url('data:image/svg+xml;utf8,'); +} +.bootstrap-table .fixed-table-container .table thead th .desc, +.bootstrap-table .fixed-table-container .table tfoot th .desc { + background-image: url('data:image/svg+xml;utf8,'); +} +.bootstrap-table .fixed-table-container .table tbody tr.selected td { + background-color: rgba(0, 0, 0, 0.075); +} +.bootstrap-table .fixed-table-container .table tbody tr.no-records-found td { + text-align: center; +} +.bootstrap-table .fixed-table-container .table tbody tr .card-view { + display: flex; +} +.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title { + font-weight: bold; + display: inline-block; + min-width: 30%; + width: auto !important; + text-align: left !important; +} +.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-value { + width: 100% !important; + text-align: left !important; +} +.bootstrap-table .fixed-table-container .table .bs-checkbox { + text-align: center; +} +.bootstrap-table .fixed-table-container .table .bs-checkbox label { + margin-bottom: 0; +} +.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=radio], +.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=checkbox] { + margin: 0 auto !important; +} +.bootstrap-table .fixed-table-container .table.table-sm .th-inner { + padding: 0.25rem; +} +.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer) { + border-bottom: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height.has-card-view { + border-top: 1px solid #dee2e6; + border-bottom: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height .fixed-table-border { + border-left: 1px solid #dee2e6; + border-right: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height .table thead th { + border-bottom: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height .table-dark thead th { + border-bottom: 1px solid #32383e; +} +.bootstrap-table .fixed-table-container .fixed-table-header { + overflow: hidden; +} +.bootstrap-table .fixed-table-container .fixed-table-body { + overflow: auto; + height: 100%; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { + align-items: center; + background: #fff; + display: flex; + justify-content: center; + position: absolute; + bottom: 0; + width: 100%; + max-width: 100%; + z-index: 1000; + transition: visibility 0s, opacity 0.15s ease-in-out; + opacity: 0; + visibility: hidden; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open { + visibility: visible; + opacity: 1; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap { + align-items: baseline; + display: flex; + justify-content: center; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text { + margin-right: 6px; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap { + align-items: center; + display: flex; + justify-content: center; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::before { + content: ""; + animation-duration: 1.5s; + animation-iteration-count: infinite; + animation-name: loading; + background: #212529; + border-radius: 50%; + display: block; + height: 5px; + margin: 0 4px; + opacity: 0; + width: 5px; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot { + animation-delay: 0.3s; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after { + animation-delay: 0.6s; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark { + background: #212529; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-dot, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::after, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::before { + background: #fff; +} +.bootstrap-table .fixed-table-container .fixed-table-footer { + overflow: hidden; +} +.bootstrap-table .fixed-table-pagination::after { + content: ""; + display: block; + clear: both; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail, +.bootstrap-table .fixed-table-pagination > .pagination { + margin-top: 10px; + margin-bottom: 10px; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .pagination-info { + line-height: 34px; + margin-right: 5px; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .page-list { + display: inline-block; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .page-list .btn-group { + position: relative; + display: inline-block; + vertical-align: middle; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .page-list .btn-group .dropdown-menu { + margin-bottom: 0; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination { + margin: 0; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a { + color: #c8c8c8; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a::before { + content: "⬅"; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a::after { + content: "➡"; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.disabled a { + pointer-events: none; + cursor: default; +} +.bootstrap-table.fullscreen { + position: fixed; + top: 0; + left: 0; + z-index: 1050; + width: 100% !important; + background: #fff; + height: 100vh; + overflow-y: scroll; +} +.bootstrap-table.bootstrap4 .pagination-lg .page-link, .bootstrap-table.bootstrap5 .pagination-lg .page-link { + padding: 0.5rem 1rem; +} +.bootstrap-table.bootstrap5 .float-left { + float: left; +} +.bootstrap-table.bootstrap5 .float-right { + float: right; +} + +/* calculate scrollbar width */ +div.fixed-table-scroll-inner { + width: 100%; + height: 200px; +} + +div.fixed-table-scroll-outer { + top: 0; + left: 0; + visibility: hidden; + width: 200px; + height: 150px; + overflow: hidden; +} + +@keyframes loading { + 0% { + opacity: 0; + } + 50% { + opacity: 1; + } + 100% { + opacity: 0; + } +} body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; @@ -21284,7 +21610,8 @@ a.accordion-header { a.logo.no-hover a:hover { background-color: transparent; } -.required { +input:required, +select:required { border-right: 6px solid orange; } .sidebar-menu { @@ -21658,8 +21985,13 @@ a.link-danger:hover { a.logo.no-hover a:hover { background-color: transparent; } -.required { - border-right: 6px solid orange; +input:required, +select:required { + border-right: 5px solid orange; +} +select:required + .select2-container .select2-selection, +select:required + .select2-container .select2-selection .select2-selection--multiple { + border-right: 5px solid orange !important; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; @@ -21669,6 +22001,9 @@ body { font-size: 14px; white-space: normal; } +.modal-warning .modal-help { + color: #fff8af; +} .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { z-index: 0 !important; } @@ -21800,19 +22135,33 @@ body { } .select2-selection--multiple { border-color: #d2d6de !important; - height: 34px; + overflow-y: auto; } .select2-selection__choice { border-radius: 0px !important; } +.select2-search select2-search--inline { + height: 35px !important; + float: left; + margin: 0; +} +.select2-results__option { + padding: 5px; + -moz-user-select: none; + user-select: none; + -webkit-user-select: none; + margin: 0px; +} img.navbar-brand-img, .navbar-brand > img { float: left; padding: 5px 5px 5px 0; max-height: 50px; } -.input-daterange { - border-radius: 0px; +.input-daterange, +.input-daterange input:first-child, +.input-daterange input:last-child { + border-radius: 0px !important; } .btn.bg-maroon, .btn.bg-purple { @@ -21891,20 +22240,21 @@ h4 { background-color: #f9f9f9; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-striped .row:nth-of-type(even) div { background: #FFFFFF; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-new-striped { vertical-align: top; - line-height: 2.6; - padding: 0px; - margin-left: 20px; + padding: 3px; display: table; width: 100%; - padding-right: 20px; + word-wrap: break-word; + table-layout: fixed; } /** * NEW STRIPING @@ -21914,20 +22264,25 @@ h4 { .row-new-striped > .row:nth-of-type(even) { background: #FFFFFF; border-top: 1px solid #dddddd; + line-height: 1.9; display: table-row; } .row-new-striped > .row:nth-of-type(odd) { background-color: #F8F8F8; border-top: 1px solid #dddddd; display: table-row; + line-height: 1.9; + padding: 2px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div[class^="col"]:first-child { font-weight: bold; @@ -21978,6 +22333,7 @@ th.css-consumable > .th-inner, th.css-envelope > .th-inner, th.css-users > .th-inner, th.css-location > .th-inner, +th.css-component > .th-inner, th.css-accessory > .th-inner { font-size: 0px; line-height: 0.75 !important; @@ -21993,6 +22349,7 @@ th.css-consumable > .th-inner::before, th.css-envelope > .th-inner::before, th.css-users > .th-inner::before, th.css-location > .th-inner::before, +th.css-component > .th-inner::before, th.css-accessory > .th-inner::before { display: inline-block; font-size: 20px; @@ -22046,6 +22403,11 @@ th.css-location > .th-inner::before { font-size: 19px; margin-bottom: 0px; } +th.css-component > .th-inner::before { + content: "\f0a0"; + font-family: "Font Awesome 5 Free"; + font-weight: 500; +} .small-box .inner { padding-left: 15px; padding-right: 15px; @@ -22094,6 +22456,24 @@ th.css-location > .th-inner::before { margin-top: 50px; } } +@media screen and (max-width: 992px) { + .info-stack-container { + display: flex; + flex-direction: column; + } + .col-md-3.col-xs-12.col-sm-push-9.info-stack { + left: auto; + order: 1; + } + .col-md-9.col-xs-12.col-sm-pull-3.info-stack { + right: auto; + order: 2; + } + .info-stack-container > .col-md-9.col-xs-12.col-sm-pull-3.info-stack > .row-new-striped > .row > .col-sm-2 { + width: auto; + float: none; + } +} @media screen and (max-width: 1318px) and (min-width: 1200px) { .admin.box { height: 170px; @@ -23086,8 +23466,13 @@ a.link-danger:hover { a.logo.no-hover a:hover { background-color: transparent; } -.required { - border-right: 6px solid orange; +input:required, +select:required { + border-right: 5px solid orange; +} +select:required + .select2-container .select2-selection, +select:required + .select2-container .select2-selection .select2-selection--multiple { + border-right: 5px solid orange !important; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; @@ -23097,6 +23482,9 @@ body { font-size: 14px; white-space: normal; } +.modal-warning .modal-help { + color: #fff8af; +} .bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { z-index: 0 !important; } @@ -23228,19 +23616,33 @@ body { } .select2-selection--multiple { border-color: #d2d6de !important; - height: 34px; + overflow-y: auto; } .select2-selection__choice { border-radius: 0px !important; } +.select2-search select2-search--inline { + height: 35px !important; + float: left; + margin: 0; +} +.select2-results__option { + padding: 5px; + -moz-user-select: none; + user-select: none; + -webkit-user-select: none; + margin: 0px; +} img.navbar-brand-img, .navbar-brand > img { float: left; padding: 5px 5px 5px 0; max-height: 50px; } -.input-daterange { - border-radius: 0px; +.input-daterange, +.input-daterange input:first-child, +.input-daterange input:last-child { + border-radius: 0px !important; } .btn.bg-maroon, .btn.bg-purple { @@ -23319,20 +23721,21 @@ h4 { background-color: #f9f9f9; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-striped .row:nth-of-type(even) div { background: #FFFFFF; border-top: 1px solid #dddddd; display: table-cell; + word-wrap: break-word; } .row-new-striped { vertical-align: top; - line-height: 2.6; - padding: 0px; - margin-left: 20px; + padding: 3px; display: table; width: 100%; - padding-right: 20px; + word-wrap: break-word; + table-layout: fixed; } /** * NEW STRIPING @@ -23342,20 +23745,25 @@ h4 { .row-new-striped > .row:nth-of-type(even) { background: #FFFFFF; border-top: 1px solid #dddddd; + line-height: 1.9; display: table-row; } .row-new-striped > .row:nth-of-type(odd) { background-color: #F8F8F8; border-top: 1px solid #dddddd; display: table-row; + line-height: 1.9; + padding: 2px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div { display: table-cell; border-top: 1px solid #dddddd; + padding: 6px; } .row-new-striped div[class^="col"]:first-child { font-weight: bold; @@ -23406,6 +23814,7 @@ th.css-consumable > .th-inner, th.css-envelope > .th-inner, th.css-users > .th-inner, th.css-location > .th-inner, +th.css-component > .th-inner, th.css-accessory > .th-inner { font-size: 0px; line-height: 0.75 !important; @@ -23421,6 +23830,7 @@ th.css-consumable > .th-inner::before, th.css-envelope > .th-inner::before, th.css-users > .th-inner::before, th.css-location > .th-inner::before, +th.css-component > .th-inner::before, th.css-accessory > .th-inner::before { display: inline-block; font-size: 20px; @@ -23474,6 +23884,11 @@ th.css-location > .th-inner::before { font-size: 19px; margin-bottom: 0px; } +th.css-component > .th-inner::before { + content: "\f0a0"; + font-family: "Font Awesome 5 Free"; + font-weight: 500; +} .small-box .inner { padding-left: 15px; padding-right: 15px; @@ -23522,6 +23937,24 @@ th.css-location > .th-inner::before { margin-top: 50px; } } +@media screen and (max-width: 992px) { + .info-stack-container { + display: flex; + flex-direction: column; + } + .col-md-3.col-xs-12.col-sm-push-9.info-stack { + left: auto; + order: 1; + } + .col-md-9.col-xs-12.col-sm-pull-3.info-stack { + right: auto; + order: 2; + } + .info-stack-container > .col-md-9.col-xs-12.col-sm-pull-3.info-stack > .row-new-striped > .row > .col-sm-2 { + width: auto; + float: none; + } +} @media screen and (max-width: 1318px) and (min-width: 1200px) { .admin.box { height: 170px; diff --git a/public/css/dist/bootstrap-table.css b/public/css/dist/bootstrap-table.css index 29f63a096..8eb04d28a 100644 --- a/public/css/dist/bootstrap-table.css +++ b/public/css/dist/bootstrap-table.css @@ -1,6 +1,352 @@ -.bootstrap-table .fixed-table-toolbar::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-toolbar .bs-bars,.bootstrap-table .fixed-table-toolbar .search,.bootstrap-table .fixed-table-toolbar .columns{position:relative;margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group{display:inline-block;margin-left:-1px !important}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group>.btn{border-radius:0}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .dropdown-menu{text-align:left;max-height:300px;overflow:auto;-ms-overflow-style:scrollbar;z-index:1001}.bootstrap-table .fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.4286}.bootstrap-table .fixed-table-toolbar .columns-left{margin-right:5px}.bootstrap-table .fixed-table-toolbar .columns-right{margin-left:5px}.bootstrap-table .fixed-table-toolbar .pull-right .dropdown-menu{right:0;left:auto}.bootstrap-table .fixed-table-container{position:relative;clear:both}.bootstrap-table .fixed-table-container .table{width:100%;margin-bottom:0 !important}.bootstrap-table .fixed-table-container .table th,.bootstrap-table .fixed-table-container .table td{vertical-align:middle;box-sizing:border-box}.bootstrap-table .fixed-table-container .table thead th,.bootstrap-table .fixed-table-container .table tfoot th{vertical-align:bottom;padding:0;margin:0}.bootstrap-table .fixed-table-container .table thead th:focus,.bootstrap-table .fixed-table-container .table tfoot th:focus{outline:0 solid rgba(0,0,0,0)}.bootstrap-table .fixed-table-container .table thead th.detail,.bootstrap-table .fixed-table-container .table tfoot th.detail{width:30px}.bootstrap-table .fixed-table-container .table thead th .th-inner,.bootstrap-table .fixed-table-container .table tfoot th .th-inner{padding:.75rem;vertical-align:bottom;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bootstrap-table .fixed-table-container .table thead th .sortable,.bootstrap-table .fixed-table-container .table tfoot th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px !important}.bootstrap-table .fixed-table-container .table thead th .sortable.sortable-center,.bootstrap-table .fixed-table-container .table tfoot th .sortable.sortable-center{padding-left:20px !important;padding-right:20px !important}.bootstrap-table .fixed-table-container .table thead th .both,.bootstrap-table .fixed-table-container .table tfoot th .both{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC")}.bootstrap-table .fixed-table-container .table thead th .asc,.bootstrap-table .fixed-table-container .table tfoot th .asc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==")}.bootstrap-table .fixed-table-container .table thead th .desc,.bootstrap-table .fixed-table-container .table tfoot th .desc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ")}.bootstrap-table .fixed-table-container .table tbody tr.selected td{background-color:rgba(0,0,0,.075)}.bootstrap-table .fixed-table-container .table tbody tr.no-records-found td{text-align:center}.bootstrap-table .fixed-table-container .table tbody tr .card-view{display:flex}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title{font-weight:bold;display:inline-block;min-width:30%;width:auto !important;text-align:left !important}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-value{width:100% !important;text-align:left !important}.bootstrap-table .fixed-table-container .table .bs-checkbox{text-align:center}.bootstrap-table .fixed-table-container .table .bs-checkbox label{margin-bottom:0}.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=radio],.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=checkbox]{margin:0 auto !important}.bootstrap-table .fixed-table-container .table.table-sm .th-inner{padding:.25rem}.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer){border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height.has-card-view{border-top:1px solid #dee2e6;border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .fixed-table-border{border-left:1px solid #dee2e6;border-right:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table thead th{border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table-dark thead th{border-bottom:1px solid #32383e}.bootstrap-table .fixed-table-container .fixed-table-header{overflow:hidden}.bootstrap-table .fixed-table-container .fixed-table-body{overflow:auto auto;height:100%}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading{align-items:center;background:#fff;display:flex;justify-content:center;position:absolute;bottom:0;width:100%;max-width:100%;z-index:1000;transition:visibility 0s,opacity .15s ease-in-out;opacity:0;visibility:hidden}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open{visibility:visible;opacity:1}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap{align-items:baseline;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text{margin-right:6px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap{align-items:center;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::before{content:"";animation-duration:1.5s;animation-iteration-count:infinite;animation-name:loading;background:#212529;border-radius:50%;display:block;height:5px;margin:0 4px;opacity:0;width:5px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot{animation-delay:.3s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after{animation-delay:.6s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark{background:#212529}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::before{background:#fff}.bootstrap-table .fixed-table-container .fixed-table-footer{overflow:hidden}.bootstrap-table .fixed-table-pagination::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-pagination>.pagination-detail,.bootstrap-table .fixed-table-pagination>.pagination{margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-pagination>.pagination-detail .pagination-info{line-height:34px;margin-right:5px}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list{display:inline-block}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group{position:relative;display:inline-block;vertical-align:middle}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group .dropdown-menu{margin-bottom:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination{margin:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a{color:#c8c8c8}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::before{content:"⬅"}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::after{content:"➡"}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.disabled a{pointer-events:none;cursor:default}.bootstrap-table.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100% !important;background:#fff;height:100vh;overflow-y:scroll}.bootstrap-table.bootstrap4 .pagination-lg .page-link,.bootstrap-table.bootstrap5 .pagination-lg .page-link{padding:.5rem 1rem}.bootstrap-table.bootstrap5 .float-left{float:left}.bootstrap-table.bootstrap5 .float-right{float:right}div.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}@keyframes loading{0%{opacity:0}50%{opacity:1}100%{opacity:0}} +@charset "UTF-8"; +/** + * @author zhixin wen + * version: 1.23.5 + * https://github.com/wenzhixin/bootstrap-table/ + */ +/* stylelint-disable annotation-no-unknown, max-line-length */ +/* stylelint-enable annotation-no-unknown, max-line-length */ +.bootstrap-table .fixed-table-toolbar::after { + content: ""; + display: block; + clear: both; +} +.bootstrap-table .fixed-table-toolbar .bs-bars, +.bootstrap-table .fixed-table-toolbar .search, +.bootstrap-table .fixed-table-toolbar .columns { + position: relative; + margin-top: 10px; + margin-bottom: 10px; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group { + display: inline-block; + margin-left: -1px !important; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group > .btn { + border-radius: 0; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group:first-child > .btn { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.bootstrap-table .fixed-table-toolbar .columns .btn-group > .btn-group:last-child > .btn { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +.bootstrap-table .fixed-table-toolbar .columns .dropdown-menu { + text-align: left; + max-height: 300px; + overflow: auto; + -ms-overflow-style: scrollbar; + z-index: 1001; +} +.bootstrap-table .fixed-table-toolbar .columns label { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.4286; +} +.bootstrap-table .fixed-table-toolbar .columns-left { + margin-right: 5px; +} +.bootstrap-table .fixed-table-toolbar .columns-right { + margin-left: 5px; +} +.bootstrap-table .fixed-table-toolbar .pull-right .dropdown-menu { + right: 0; + left: auto; +} +.bootstrap-table .fixed-table-container { + position: relative; + clear: both; +} +.bootstrap-table .fixed-table-container .table { + width: 100%; + margin-bottom: 0 !important; +} +.bootstrap-table .fixed-table-container .table th, +.bootstrap-table .fixed-table-container .table td { + vertical-align: middle; + box-sizing: border-box; +} +.bootstrap-table .fixed-table-container .table thead th, +.bootstrap-table .fixed-table-container .table tfoot th { + vertical-align: bottom; + padding: 0; + margin: 0; +} +.bootstrap-table .fixed-table-container .table thead th:focus, +.bootstrap-table .fixed-table-container .table tfoot th:focus { + outline: 0 solid transparent; +} +.bootstrap-table .fixed-table-container .table thead th.detail, +.bootstrap-table .fixed-table-container .table tfoot th.detail { + width: 30px; +} +.bootstrap-table .fixed-table-container .table thead th .th-inner, +.bootstrap-table .fixed-table-container .table tfoot th .th-inner { + padding: 0.75rem; + vertical-align: bottom; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.bootstrap-table .fixed-table-container .table thead th .sortable, +.bootstrap-table .fixed-table-container .table tfoot th .sortable { + cursor: pointer; + background-position: right; + background-repeat: no-repeat; + padding-right: 30px !important; +} +.bootstrap-table .fixed-table-container .table thead th .sortable.sortable-center, +.bootstrap-table .fixed-table-container .table tfoot th .sortable.sortable-center { + padding-left: 20px !important; + padding-right: 20px !important; +} +.bootstrap-table .fixed-table-container .table thead th .both, +.bootstrap-table .fixed-table-container .table tfoot th .both { + background-image: url('data:image/svg+xml;utf8,'); + background-size: 16px 16px; + background-position: center right 2px; +} +.bootstrap-table .fixed-table-container .table thead th .asc, +.bootstrap-table .fixed-table-container .table tfoot th .asc { + background-image: url('data:image/svg+xml;utf8,'); +} +.bootstrap-table .fixed-table-container .table thead th .desc, +.bootstrap-table .fixed-table-container .table tfoot th .desc { + background-image: url('data:image/svg+xml;utf8,'); +} +.bootstrap-table .fixed-table-container .table tbody tr.selected td { + background-color: rgba(0, 0, 0, 0.075); +} +.bootstrap-table .fixed-table-container .table tbody tr.no-records-found td { + text-align: center; +} +.bootstrap-table .fixed-table-container .table tbody tr .card-view { + display: flex; +} +.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title { + font-weight: bold; + display: inline-block; + min-width: 30%; + width: auto !important; + text-align: left !important; +} +.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-value { + width: 100% !important; + text-align: left !important; +} +.bootstrap-table .fixed-table-container .table .bs-checkbox { + text-align: center; +} +.bootstrap-table .fixed-table-container .table .bs-checkbox label { + margin-bottom: 0; +} +.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=radio], +.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=checkbox] { + margin: 0 auto !important; +} +.bootstrap-table .fixed-table-container .table.table-sm .th-inner { + padding: 0.25rem; +} +.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer) { + border-bottom: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height.has-card-view { + border-top: 1px solid #dee2e6; + border-bottom: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height .fixed-table-border { + border-left: 1px solid #dee2e6; + border-right: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height .table thead th { + border-bottom: 1px solid #dee2e6; +} +.bootstrap-table .fixed-table-container.fixed-height .table-dark thead th { + border-bottom: 1px solid #32383e; +} +.bootstrap-table .fixed-table-container .fixed-table-header { + overflow: hidden; +} +.bootstrap-table .fixed-table-container .fixed-table-body { + overflow: auto; + height: 100%; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading { + align-items: center; + background: #fff; + display: flex; + justify-content: center; + position: absolute; + bottom: 0; + width: 100%; + max-width: 100%; + z-index: 1000; + transition: visibility 0s, opacity 0.15s ease-in-out; + opacity: 0; + visibility: hidden; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open { + visibility: visible; + opacity: 1; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap { + align-items: baseline; + display: flex; + justify-content: center; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text { + margin-right: 6px; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap { + align-items: center; + display: flex; + justify-content: center; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::before { + content: ""; + animation-duration: 1.5s; + animation-iteration-count: infinite; + animation-name: loading; + background: #212529; + border-radius: 50%; + display: block; + height: 5px; + margin: 0 4px; + opacity: 0; + width: 5px; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot { + animation-delay: 0.3s; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after { + animation-delay: 0.6s; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark { + background: #212529; +} +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-dot, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::after, +.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::before { + background: #fff; +} +.bootstrap-table .fixed-table-container .fixed-table-footer { + overflow: hidden; +} +.bootstrap-table .fixed-table-pagination::after { + content: ""; + display: block; + clear: both; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail, +.bootstrap-table .fixed-table-pagination > .pagination { + margin-top: 10px; + margin-bottom: 10px; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .pagination-info { + line-height: 34px; + margin-right: 5px; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .page-list { + display: inline-block; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .page-list .btn-group { + position: relative; + display: inline-block; + vertical-align: middle; +} +.bootstrap-table .fixed-table-pagination > .pagination-detail .page-list .btn-group .dropdown-menu { + margin-bottom: 0; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination { + margin: 0; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a { + color: #c8c8c8; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a::before { + content: "⬅"; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.page-intermediate a::after { + content: "➡"; +} +.bootstrap-table .fixed-table-pagination > .pagination ul.pagination li.disabled a { + pointer-events: none; + cursor: default; +} +.bootstrap-table.fullscreen { + position: fixed; + top: 0; + left: 0; + z-index: 1050; + width: 100% !important; + background: #fff; + height: 100vh; + overflow-y: scroll; +} +.bootstrap-table.bootstrap4 .pagination-lg .page-link, .bootstrap-table.bootstrap5 .pagination-lg .page-link { + padding: 0.5rem 1rem; +} +.bootstrap-table.bootstrap5 .float-left { + float: left; +} +.bootstrap-table.bootstrap5 .float-right { + float: right; +} -.fix-sticky{position:fixed !important;overflow:hidden;z-index:100}.fix-sticky table thead{background:#fff}.fix-sticky table thead.thead-light{background:#e9ecef}.fix-sticky table thead.thead-dark{background:#212529} +/* calculate scrollbar width */ +div.fixed-table-scroll-inner { + width: 100%; + height: 200px; +} + +div.fixed-table-scroll-outer { + top: 0; + left: 0; + visibility: hidden; + width: 200px; + height: 150px; + overflow: hidden; +} + +@keyframes loading { + 0% { + opacity: 0; + } + 50% { + opacity: 1; + } + 100% { + opacity: 0; + } +} + +/** + * @author vincent loh + * @update zhixin wen + */ +.fix-sticky { + position: fixed !important; + overflow: hidden; + z-index: 100; +} + +.fix-sticky table thead { + background: #fff; +} + +.fix-sticky table thead.thead-light { + background: #e9ecef; +} + +.fix-sticky table thead.thead-dark { + background: #212529; +} /* * dragtable diff --git a/public/js/build/app.js b/public/js/build/app.js index c5c6a5cd6..3c8051012 100644 --- a/public/js/build/app.js +++ b/public/js/build/app.js @@ -130,74 +130,43 @@ pieOptions = { //----------------- var baseUrl = $('meta[name="baseUrl"]').attr('content'); -(function ($, settings) { - var Components = {}; - Components.modals = {}; +$(function () { + var $el = $('table'); // confirm restore modal - Components.modals.confirmRestore = function () { - var $el = $('table'); - var events = { - 'click': function click(evnt) { - var $context = $(this); - var $restoreConfirmModal = $('#restoreConfirmModal'); - var href = $context.attr('href'); - var message = $context.attr('data-content'); - var title = $context.attr('data-title'); - $('#restoreConfirmModalLabel').text(title); - $restoreConfirmModal.find('.modal-body').text(message); - $('#restoreForm').attr('action', href); - $restoreConfirmModal.modal({ - show: true - }); - return false; - } - }; - var render = function render() { - $el.on('click', '.restore-asset', events['click']); - }; - return { - render: render - }; - }; + + $el.on('click', '.restore-asset', function (evnt) { + var $context = $(this); + var $restoreConfirmModal = $('#restoreConfirmModal'); + var href = $context.attr('href'); + var message = $context.attr('data-content'); + var title = $context.attr('data-title'); + $('#confirmModalLabel').text(title); + $restoreConfirmModal.find('.modal-body').text(message); + $('#restoreForm').attr('action', href); + $restoreConfirmModal.modal({ + show: true + }); + return false; + }); // confirm delete modal - Components.modals.confirmDelete = function () { - var $el = $('table'); - var events = { - 'click': function click(evnt) { - var $context = $(this); - var $dataConfirmModal = $('#dataConfirmModal'); - var href = $context.attr('href'); - var message = $context.attr('data-content'); - var title = $context.attr('data-title'); - $('#myModalLabel').text(title); - $dataConfirmModal.find('.modal-body').text(message); - $('#deleteForm').attr('action', href); - $dataConfirmModal.modal({ - show: true - }); - return false; - } - }; - var render = function render() { - $el.on('click', '.delete-asset', events['click']); - }; - return { - render: render - }; - }; - /** - * Application start point - * Component definition stays out of load event, execution only happens. - */ - $(function () { - new Components.modals.confirmRestore().render(); - new Components.modals.confirmDelete().render(); + $el.on('click', '.delete-asset', function (evnt) { + var $context = $(this); + var $dataConfirmModal = $('#dataConfirmModal'); + var href = $context.attr('href'); + var message = $context.attr('data-content'); + var title = $context.attr('data-title'); + $('#myModalLabel').text(title); + $dataConfirmModal.find('.modal-body').text(message); + $('#deleteForm').attr('action', href); + $dataConfirmModal.modal({ + show: true + }); + return false; }); -})(jQuery, window.snipeit.settings); -$(document).ready(function () { + /* * Slideout help menu */ @@ -4078,7 +4047,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ $.ui = $.ui || {}; -return $.ui.version = "1.13.3"; +return $.ui.version = "1.14.0"; } ); @@ -4092,7 +4061,7 @@ return $.ui.version = "1.13.3"; /***/ ((module, exports, __webpack_require__) => { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * jQuery UI Widget 1.13.3 + * jQuery UI Widget 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors diff --git a/public/js/build/app.js.LICENSE.txt b/public/js/build/app.js.LICENSE.txt index cb3342c83..931b6a988 100644 --- a/public/js/build/app.js.LICENSE.txt +++ b/public/js/build/app.js.LICENSE.txt @@ -30,7 +30,7 @@ */ /*! - * jQuery UI Widget 1.13.3 + * jQuery UI Widget 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors diff --git a/public/js/build/vendor.js b/public/js/build/vendor.js index 102713f1f..6f934b73d 100644 --- a/public/js/build/vendor.js +++ b/public/js/build/vendor.js @@ -12707,14 +12707,14 @@ return Tether; })); -/*! jQuery UI - v1.13.3 - 2024-04-26 +/*! jQuery UI - v1.14.0 - 2024-08-05 * https://jqueryui.com * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js * Copyright OpenJS Foundation and other contributors; Licensed MIT */ ( function( factory ) { "use strict"; - + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -12729,11 +12729,11 @@ return Tether; $.ui = $.ui || {}; -var version = $.ui.version = "1.13.3"; +var version = $.ui.version = "1.14.0"; /*! - * jQuery UI Widget 1.13.3 + * jQuery UI Widget 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -13475,7 +13475,7 @@ var widget = $.widget; /*! - * jQuery UI Position 1.13.3 + * jQuery UI Position 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -13972,7 +13972,7 @@ var position = $.ui.position; /*! - * jQuery UI :data 1.13.3 + * jQuery UI :data 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -13987,21 +13987,15 @@ var position = $.ui.position; var data = $.extend( $.expr.pseudos, { - data: $.expr.createPseudo ? - $.expr.createPseudo( function( dataName ) { - return function( elem ) { - return !!$.data( elem, dataName ); - }; - } ) : - - // Support: jQuery <1.8 - function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - } + data: $.expr.createPseudo( function( dataName ) { + return function( elem ) { + return !!$.data( elem, dataName ); + }; + } ) } ); /*! - * jQuery UI Disable Selection 1.13.3 + * jQuery UI Disable Selection 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -14044,18 +14038,17 @@ var jQuery = $; /*! - * jQuery Color Animations v2.2.0 + * jQuery Color Animations v3.0.0 * https://github.com/jquery/jquery-color * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license * - * Date: Sun May 10 09:02:36 2020 +0200 + * Date: Wed May 15 16:49:44 2024 +0200 */ - var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", @@ -14180,10 +14173,6 @@ var jQuery = $; floor: true } }, - support = color.support = {}, - - // element for support tests - supportElem = jQuery( "

" )[ 0 ], // colors = jQuery.Color.names colors, @@ -14191,10 +14180,6 @@ var jQuery = $; // local aliases of functions called often each = jQuery.each; -// determine rgba support immediately -supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; -support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; - // define cache name and alpha properties // for rgba and hsla spaces each( spaces, function( spaceName, space ) { @@ -14232,12 +14217,6 @@ function clamp( value, prop, allowEmpty ) { // ~~ is an short way of doing floor for positive numbers value = type.floor ? ~~value : parseFloat( value ); - // IE will pass in empty strings as value for alpha, - // which will hit this case - if ( isNaN( value ) ) { - return prop.def; - } - if ( type.mod ) { // we add mod before modding to make sure that negatives values @@ -14350,7 +14329,10 @@ color.fn = jQuery.extend( color.prototype, { } ); // everything defined but alpha? - if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { + if ( inst[ cache ] && jQuery.inArray( + null, + inst[ cache ].slice( 0, 3 ) + ) < 0 ) { // use the default of 1 if ( inst[ cache ][ 3 ] == null ) { @@ -14462,7 +14444,7 @@ color.fn = jQuery.extend( color.prototype, { prefix = "rgb("; } - return prefix + rgba.join() + ")"; + return prefix + rgba.join( ", " ) + ")"; }, toHslaString: function() { var prefix = "hsla(", @@ -14482,7 +14464,7 @@ color.fn = jQuery.extend( color.prototype, { hsla.pop(); prefix = "hsl("; } - return prefix + hsla.join() + ")"; + return prefix + hsla.join( ", " ) + ")"; }, toHexString: function( includeAlpha ) { var rgba = this._rgba.slice(), @@ -14495,12 +14477,11 @@ color.fn = jQuery.extend( color.prototype, { return "#" + jQuery.map( rgba, function( v ) { // default to 0 when nulls exist - v = ( v || 0 ).toString( 16 ); - return v.length === 1 ? "0" + v : v; + return ( "0" + ( v || 0 ).toString( 16 ) ).substr( -2 ); } ).join( "" ); }, toString: function() { - return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); + return this.toRgbaString(); } } ); color.fn.parse.prototype = color.fn; @@ -14667,37 +14648,15 @@ color.hook = function( hook ) { each( hooks, function( _i, hook ) { jQuery.cssHooks[ hook ] = { set: function( elem, value ) { - var parsed, curElem, - backgroundColor = ""; + var parsed; - if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { + if ( value !== "transparent" && + ( getType( value ) !== "string" || + ( parsed = stringParse( value ) ) ) ) { value = color( parsed || value ); - if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { - curElem = hook === "backgroundColor" ? elem.parentNode : elem; - while ( - ( backgroundColor === "" || backgroundColor === "transparent" ) && - curElem && curElem.style - ) { - try { - backgroundColor = jQuery.css( curElem, "backgroundColor" ); - curElem = curElem.parentNode; - } catch ( e ) { - } - } - - value = value.blend( backgroundColor && backgroundColor !== "transparent" ? - backgroundColor : - "_default" ); - } - value = value.toRgbaString(); } - try { - elem.style[ hook ] = value; - } catch ( e ) { - - // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' - } + elem.style[ hook ] = value; } }; jQuery.fx.step[ hook ] = function( fx ) { @@ -14756,7 +14715,7 @@ colors = jQuery.Color.names = { /*! - * jQuery UI Effects 1.13.3 + * jQuery UI Effects 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -14819,26 +14778,14 @@ function camelCase( string ) { function getElementStyles( elem ) { var key, len, - style = elem.ownerDocument.defaultView ? - elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : - elem.currentStyle, + style = elem.ownerDocument.defaultView.getComputedStyle( elem ), styles = {}; - if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { - len = style.length; - while ( len-- ) { - key = style[ len ]; - if ( typeof style[ key ] === "string" ) { - styles[ camelCase( key ) ] = style[ key ]; - } - } - - // Support: Opera, IE <9 - } else { - for ( key in style ) { - if ( typeof style[ key ] === "string" ) { - styles[ key ] = style[ key ]; - } + len = style.length; + while ( len-- ) { + key = style[ len ]; + if ( typeof style[ key ] === "string" ) { + styles[ camelCase( key ) ] = style[ key ]; } } @@ -14863,15 +14810,6 @@ function styleDifference( oldStyle, newStyle ) { return diff; } -// Support: jQuery <1.8 -if ( !$.fn.addBack ) { - $.fn.addBack = function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - }; -} - $.effects.animateClass = function( value, duration, easing, callback ) { var o = $.speed( duration, easing, callback ); @@ -15011,7 +14949,7 @@ if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { } )( $.expr.pseudos.animated ); } -if ( $.uiBackCompat !== false ) { +if ( $.uiBackCompat === true ) { $.extend( $.effects, { // Saves a set of properties in a data storage @@ -15140,7 +15078,7 @@ if ( $.uiBackCompat !== false ) { } $.extend( $.effects, { - version: "1.13.3", + version: "1.14.0", define: function( name, mode, effect ) { if ( !effect ) { @@ -15497,7 +15435,7 @@ $.fn.extend( { // as toggle can be either show or hide depending on element state args.mode = modes.shift(); - if ( $.uiBackCompat !== false && !defaultMode ) { + if ( $.uiBackCompat === true && !defaultMode ) { if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { // Call the core method to track "olddisplay" properly @@ -15708,7 +15646,7 @@ var effect = $.effects; /*! - * jQuery UI Effects Blind 1.13.3 + * jQuery UI Effects Blind 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -15763,7 +15701,7 @@ var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, d /*! - * jQuery UI Effects Bounce 1.13.3 + * jQuery UI Effects Bounce 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -15858,7 +15796,7 @@ var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) /*! - * jQuery UI Effects Clip 1.13.3 + * jQuery UI Effects Clip 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -15908,7 +15846,7 @@ var effectsEffectClip = $.effects.define( "clip", "hide", function( options, don /*! - * jQuery UI Effects Drop 1.13.3 + * jQuery UI Effects Drop 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -15962,7 +15900,7 @@ var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, don /*! - * jQuery UI Effects Explode 1.13.3 + * jQuery UI Effects Explode 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16058,7 +15996,7 @@ var effectsEffectExplode = $.effects.define( "explode", "hide", function( option /*! - * jQuery UI Effects Fade 1.13.3 + * jQuery UI Effects Fade 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16090,7 +16028,7 @@ var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, d /*! - * jQuery UI Effects Fold 1.13.3 + * jQuery UI Effects Fold 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16164,7 +16102,7 @@ var effectsEffectFold = $.effects.define( "fold", "hide", function( options, don /*! - * jQuery UI Effects Highlight 1.13.3 + * jQuery UI Effects Highlight 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16206,7 +16144,7 @@ var effectsEffectHighlight = $.effects.define( "highlight", "show", function( op /*! - * jQuery UI Effects Size 1.13.3 + * jQuery UI Effects Size 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16384,7 +16322,7 @@ var effectsEffectSize = $.effects.define( "size", function( options, done ) { /*! - * jQuery UI Effects Scale 1.13.3 + * jQuery UI Effects Scale 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16424,7 +16362,7 @@ var effectsEffectScale = $.effects.define( "scale", function( options, done ) { /*! - * jQuery UI Effects Puff 1.13.3 + * jQuery UI Effects Puff 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16450,7 +16388,7 @@ var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, don /*! - * jQuery UI Effects Pulsate 1.13.3 + * jQuery UI Effects Pulsate 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16499,7 +16437,7 @@ var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( option /*! - * jQuery UI Effects Shake 1.13.3 + * jQuery UI Effects Shake 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16558,7 +16496,7 @@ var effectsEffectShake = $.effects.define( "shake", function( options, done ) { /*! - * jQuery UI Effects Slide 1.13.3 + * jQuery UI Effects Slide 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16619,7 +16557,7 @@ var effectsEffectSlide = $.effects.define( "slide", "show", function( options, d /*! - * jQuery UI Effects Transfer 1.13.3 + * jQuery UI Effects Transfer 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16635,7 +16573,7 @@ var effectsEffectSlide = $.effects.define( "slide", "show", function( options, d var effect; -if ( $.uiBackCompat !== false ) { +if ( $.uiBackCompat === true ) { effect = $.effects.define( "transfer", function( options, done ) { $( this ).transfer( options, done ); } ); @@ -16644,7 +16582,7 @@ var effectsEffectTransfer = effect; /*! - * jQuery UI Focusable 1.13.3 + * jQuery UI Focusable 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16693,20 +16631,10 @@ $.ui.focusable = function( element, hasTabindex ) { focusableIfVisible = hasTabindex; } - return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) ); + return focusableIfVisible && $( element ).is( ":visible" ) && + $( element ).css( "visibility" ) === "visible"; }; -// Support: IE 8 only -// IE 8 doesn't resolve inherit to visible/hidden for computed values -function visible( element ) { - var visibility = element.css( "visibility" ); - while ( visibility === "inherit" ) { - element = element.parent(); - visibility = element.css( "visibility" ); - } - return visibility === "visible"; -} - $.extend( $.expr.pseudos, { focusable: function( element ) { return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); @@ -16716,17 +16644,8 @@ $.extend( $.expr.pseudos, { var focusable = $.ui.focusable; - -// Support: IE8 Only -// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop -// with a string, so we need to find the proper form. -var form = $.fn._form = function() { - return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); -}; - - /*! - * jQuery UI Form Reset Mixin 1.13.3 + * jQuery UI Form Reset Mixin 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16754,7 +16673,7 @@ var formResetMixin = $.ui.formResetMixin = { }, _bindFormResetHandler: function() { - this.form = this.element._form(); + this.form = $( this.element.prop( "form" ) ); if ( !this.form.length ) { return; } @@ -16788,7 +16707,7 @@ var formResetMixin = $.ui.formResetMixin = { /*! - * jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 + * jQuery UI Legacy jQuery Core patches 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16797,50 +16716,17 @@ var formResetMixin = $.ui.formResetMixin = { * */ -//>>label: jQuery 1.8+ Support +//>>label: Legacy jQuery Core patches //>>group: Core -//>>description: Support version 1.8.x and newer of jQuery core +//>>description: Backport `.even()`, `.odd()` and `$.escapeSelector` to older jQuery Core versions (deprecated) -// Support: jQuery 1.9.x or older -// $.expr[ ":" ] is deprecated. -if ( !$.expr.pseudos ) { - $.expr.pseudos = $.expr[ ":" ]; -} - -// Support: jQuery 1.11.x or older -// $.unique has been renamed to $.uniqueSort -if ( !$.uniqueSort ) { - $.uniqueSort = $.unique; -} - // Support: jQuery 2.2.x or older. // This method has been defined in jQuery 3.0.0. // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js if ( !$.escapeSelector ) { - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; - - var fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }; - - $.escapeSelector = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); + $.escapeSelector = function( id ) { + return CSS.escape( id + "" ); }; } @@ -16863,7 +16749,7 @@ if ( !$.fn.even || !$.fn.odd ) { ; /*! - * jQuery UI Keycode 1.13.3 + * jQuery UI Keycode 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16898,7 +16784,7 @@ var keycode = $.ui.keyCode = { /*! - * jQuery UI Labels 1.13.3 + * jQuery UI Labels 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16924,9 +16810,8 @@ var labels = $.fn.labels = function() { return this.pushStack( this[ 0 ].labels ); } - // Support: IE <= 11, FF <= 37, Android <= 2.3 only - // Above browsers do not support control.labels. Everything below is to support them - // as well as document fragments. control.labels does not work on document fragments + // If `control.labels` is empty - e.g. inside of document fragments - find + // the labels manually labels = this.eq( 0 ).parents( "label" ); // Look for the label based on the id @@ -16941,7 +16826,7 @@ var labels = $.fn.labels = function() { ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); // Create a selector for the label based on the id - selector = "label[for='" + $.escapeSelector( id ) + "']"; + selector = "label[for='" + CSS.escape( id ) + "']"; labels = labels.add( ancestors.find( selector ).addBack( selector ) ); @@ -16953,7 +16838,7 @@ var labels = $.fn.labels = function() { /*! - * jQuery UI Scroll Parent 1.13.3 + * jQuery UI Scroll Parent 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -16987,7 +16872,7 @@ var scrollParent = $.fn.scrollParent = function( includeHidden ) { /*! - * jQuery UI Tabbable 1.13.3 + * jQuery UI Tabbable 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -17011,7 +16896,7 @@ var tabbable = $.extend( $.expr.pseudos, { /*! - * jQuery UI Unique ID 1.13.3 + * jQuery UI Unique ID 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -17049,7 +16934,7 @@ var uniqueId = $.fn.extend( { /*! - * jQuery UI Accordion 1.13.3 + * jQuery UI Accordion 1.14.0 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors @@ -17070,7 +16955,7 @@ var uniqueId = $.fn.extend( { var widgetsAccordion = $.widget( "ui.accordion", { - version: "1.13.3", + version: "1.14.0", options: { active: 0, animate: {}, @@ -17082,7 +16967,17 @@ var widgetsAccordion = $.widget( "ui.accordion", { collapsible: false, event: "click", header: function( elem ) { - return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() ); + return elem + .find( "> li > :first-child" ) + .add( + elem.find( "> :not(li)" ) + + // Support: jQuery <3.5 only + // We could use `.even()` but that's unavailable in older jQuery. + .filter( function( i ) { + return i % 2 === 0; + } ) + ); }, heightStyle: "auto", icons: { @@ -17217,13 +17112,7 @@ var widgetsAccordion = $.widget( "ui.accordion", { this._super( value ); this.element.attr( "aria-disabled", value ); - - // Support: IE8 Only - // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE - // so we need to add the disabled class to the headers and panels this._toggleClass( null, "ui-state-disabled", !!value ); - this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled", - !!value ); }, _keydown: function( event ) { @@ -17641,47 +17530,13 @@ var widgetsAccordion = $.widget( "ui.accordion", { this._removeClass( prev, "ui-accordion-header-active" ) ._addClass( prev, "ui-accordion-header-collapsed" ); - // Work around for rendering bug in IE (#5421) - if ( toHide.length ) { - toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; - } this._trigger( "activate", null, data ); } } ); - -var safeActiveElement = $.ui.safeActiveElement = function( document ) { - var activeElement; - - // Support: IE 9 only - // IE9 throws an "Unspecified error" accessing document.activeElement from an