mirror of
https://github.com/itflow-org/itflow
synced 2026-03-10 15:54:51 +00:00
Compare commits
174 Commits
duplicate-
...
v26.02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
376285ef62 | ||
|
|
d1eeba67fc | ||
|
|
2ca8112daf | ||
|
|
546f10bc82 | ||
|
|
ec7f1d561d | ||
|
|
8d54bc3a2f | ||
|
|
1d8f77f799 | ||
|
|
1c6795dd55 | ||
|
|
4d895a56e4 | ||
|
|
bdd56c91f7 | ||
|
|
be172b5bd9 | ||
|
|
d224d71f59 | ||
|
|
065630b975 | ||
|
|
decea604ab | ||
|
|
004b3b2bdc | ||
|
|
dca0cc34e9 | ||
|
|
9afb165fc4 | ||
|
|
6a6eb4a714 | ||
|
|
629f4e0c81 | ||
|
|
7cbe9bf7fc | ||
|
|
fc33312e79 | ||
|
|
563c0ea9c4 | ||
|
|
10d1a902d9 | ||
|
|
4079257739 | ||
|
|
91aba13c0d | ||
|
|
2cca4f2f0e | ||
|
|
d2e8dc1439 | ||
|
|
f3f9d0dd71 | ||
|
|
f6845a046f | ||
|
|
a50a4f274f | ||
|
|
6b6d847756 | ||
|
|
65d1f59e9b | ||
|
|
f39e6ccbc9 | ||
|
|
747b62d78c | ||
|
|
af0f3ac25f | ||
|
|
6aefe99c2f | ||
|
|
61c5595a68 | ||
|
|
3d11611699 | ||
|
|
38b4ed4b96 | ||
|
|
34308a5f9a | ||
|
|
118cc10804 | ||
|
|
ae3386f2d5 | ||
|
|
bf1ccc62f5 | ||
|
|
1ce4dd932e | ||
|
|
ff0bb49926 | ||
|
|
018642cbb8 | ||
|
|
bf1d0655c4 | ||
|
|
874b07f4d7 | ||
|
|
19fa210743 | ||
|
|
c8a6513d1c | ||
|
|
01288c8452 | ||
|
|
a60d3bb3a0 | ||
|
|
0470159c55 | ||
|
|
e1a93035fd | ||
|
|
c0b7a26905 | ||
|
|
704d770ec2 | ||
|
|
d42d2d99b1 | ||
|
|
ebfcc15927 | ||
|
|
4693aa3c93 | ||
|
|
07df657848 | ||
|
|
ef9436a1fb | ||
|
|
9318f42ce0 | ||
|
|
85c37d78a8 | ||
|
|
ff02ab0cea | ||
|
|
bd8bf026f0 | ||
|
|
644dc95380 | ||
|
|
f4935efed3 | ||
|
|
1712d34846 | ||
|
|
f0f1134be6 | ||
|
|
e0f7460e08 | ||
|
|
ae1d71dcd7 | ||
|
|
3cfe38c948 | ||
|
|
c1f0b63101 | ||
|
|
0a658d7cab | ||
|
|
3ed2582a9b | ||
|
|
2ea68776f6 | ||
|
|
c1ff22298f | ||
|
|
e94d2f93ea | ||
|
|
e7f6f8a4c7 | ||
|
|
4ffe75683b | ||
|
|
687920743d | ||
|
|
1a93149643 | ||
|
|
11d6654763 | ||
|
|
512d65c17a | ||
|
|
5a274061f3 | ||
|
|
a398ac7a8d | ||
|
|
41df4c4b9f | ||
|
|
7e7909cec1 | ||
|
|
7322bd66df | ||
|
|
39affa5528 | ||
|
|
374111c88d | ||
|
|
72fc0015bf | ||
|
|
7ab406b3f5 | ||
|
|
df280cd574 | ||
|
|
0a30300bde | ||
|
|
cb8b99d6ae | ||
|
|
1d3f29d385 | ||
|
|
c154113474 | ||
|
|
e02a6fc5e6 | ||
|
|
78040573d1 | ||
|
|
981f9ace04 | ||
|
|
208f7ac8f0 | ||
|
|
661f8db10b | ||
|
|
b48168ffec | ||
|
|
908ebb46d9 | ||
|
|
58bcb38617 | ||
|
|
1de023f9df | ||
|
|
5815ef2f75 | ||
|
|
e5dab8b1ca | ||
|
|
56c4b7fbe6 | ||
|
|
365b65e5b2 | ||
|
|
2193cd8d3e | ||
|
|
8b221bc055 | ||
|
|
77e4d2b566 | ||
|
|
88a29b7599 | ||
|
|
64525750b6 | ||
|
|
30499123f1 | ||
|
|
79703042ff | ||
|
|
ccd5605d97 | ||
|
|
908277065b | ||
|
|
f2d4eb0486 | ||
|
|
f784b659e8 | ||
|
|
e60a7a59f9 | ||
|
|
cab81ca170 | ||
|
|
a82e2c7ea1 | ||
|
|
a277380441 | ||
|
|
ad5710b1d8 | ||
|
|
3e3531a6ce | ||
|
|
a79ce23ae5 | ||
|
|
163aa3062e | ||
|
|
32f996d034 | ||
|
|
312eb4dffc | ||
|
|
1916456c84 | ||
|
|
9b8d37b577 | ||
|
|
05018e5f17 | ||
|
|
72ef918452 | ||
|
|
27fde82aff | ||
|
|
b27ffe6635 | ||
|
|
84cc4a094a | ||
|
|
e75600ee05 | ||
|
|
871ad2ea7e | ||
|
|
8b5f2e0f3f | ||
|
|
58d6ab7342 | ||
|
|
03570ecd04 | ||
|
|
ca5fb2e010 | ||
|
|
da561b296e | ||
|
|
523da0dea0 | ||
|
|
0e4cc76a84 | ||
|
|
7e39a7ed89 | ||
|
|
4a26ea7ed9 | ||
|
|
7c83ba15b9 | ||
|
|
10bfbed4bb | ||
|
|
81550bd7a8 | ||
|
|
a430bb917e | ||
|
|
e1a579387f | ||
|
|
fe8df66c67 | ||
|
|
5bb410f80c | ||
|
|
29b79b9d4e | ||
|
|
0f8a8d1464 | ||
|
|
cc92a4b7ee | ||
|
|
3ffef6df51 | ||
|
|
78e4787b99 | ||
|
|
540512a156 | ||
|
|
7737dbc65d | ||
|
|
faa94d888d | ||
|
|
99e2487d2b | ||
|
|
f09d8ffe05 | ||
|
|
c486e3fe62 | ||
|
|
ba2d6b6709 | ||
|
|
a388a279bc | ||
|
|
5a64b19a06 | ||
|
|
53178b8d20 | ||
|
|
c7ef3627ce | ||
|
|
d1dcc5fb7e |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -32,10 +32,6 @@ plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/URI/*
|
|||||||
plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/*
|
plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/*
|
||||||
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/.gitkeep
|
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/.gitkeep
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
xcustom/*
|
|
||||||
!xcustom/readme.php
|
|
||||||
post/xcustom
|
|
||||||
!post/xcustom/readme.php
|
|
||||||
admin/custom/*
|
admin/custom/*
|
||||||
!admin/custom/readme.php
|
!admin/custom/readme.php
|
||||||
agent/custom/*
|
agent/custom/*
|
||||||
@@ -53,5 +49,3 @@ setup/custom/*
|
|||||||
api/v1/custom/*
|
api/v1/custom/*
|
||||||
!api/v1/custom/readme.php
|
!api/v1/custom/readme.php
|
||||||
.zed
|
.zed
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
99
CHANGELOG.md
99
CHANGELOG.md
@@ -2,6 +2,103 @@
|
|||||||
|
|
||||||
This file documents all notable changes made to ITFlow.
|
This file documents all notable changes made to ITFlow.
|
||||||
|
|
||||||
|
## [26.02] Stable Release
|
||||||
|
### Bug Fixes
|
||||||
|
- Mail Parser - Do not automatically send new ticket notifications to noreply/donotreply addresses.
|
||||||
|
- Ticket: removed newline \n on Parsed emails.
|
||||||
|
- Show Trips for everyone if accounting module is enabled.
|
||||||
|
- Fix Invoice Exporting.
|
||||||
|
- Fix Billable Column not sorting correctly in tickets.
|
||||||
|
- Fix Login flow where user agent and client user exists and agent has MFA but will not let them continue.
|
||||||
|
- Fix passing missing user_id var in client portal.
|
||||||
|
- Fix Ticket Templates not auto filling when selected.
|
||||||
|
- Fix Invoices not being sent to all billings contacts when manaully sent.
|
||||||
|
- Fix Documents and Files not able to be bulk deleted.
|
||||||
|
- Fix Role Archiving, can be archived as long as no users are assigned to the role.
|
||||||
|
- Fix showing Powered By ITFlow visibility on the login screen when Whitelabel is enabled.
|
||||||
|
- Missing username in audit log on successful login due to missing passed user_id to logging.
|
||||||
|
- API: Fix updating all documents instead of the intended document.
|
||||||
|
- Documents: Fix Document created at not showing the correct creation date of the master document.
|
||||||
|
- Ticket: Fixed Using edit ticket modal agent was not able to be set.
|
||||||
|
- Always check if a user is archived and or disabled instead of just during login.
|
||||||
|
- Report: Fix Collected tax report not totalling all tax categories.
|
||||||
|
|
||||||
|
### New Features & Updates
|
||||||
|
- Task Approval System for ticket tasks: Once an approval is requested, the task cannot be marked as complete until approved. Internal Approvals Any other technician, or Specific technician, Client Approvals Anyone (usually the requestor) Tech contacts Billing contacts.
|
||||||
|
- Printable Invoice Packing Slips now available.
|
||||||
|
- Drastic Performance Bump: Up to 50% faster queries accross the board and reduced server memory usage by 40% by switching Database Query method from mysqli_fetch_array to mysqli_fetch_assoc.
|
||||||
|
- Added Connect to Microsoft 365 Button to mail settings.
|
||||||
|
- OAUTH2 support for Microsoft 365 and Google Workspaces is now considered stable and working.
|
||||||
|
- Favorites: Assets and Credentials now can be favorited singly or by Bulk action. Favorited items appear in the client overview now.
|
||||||
|
- Files/Documents: Collapsable folders feature, collapsed by default with a button to expand all.
|
||||||
|
- URL Keys and such are now set to a more manageable 32 Characters by default.
|
||||||
|
- Various UI/UX Updates throughout the app, with focus oin ticket details, contact details modal etc.
|
||||||
|
- Added Show Archived files and documents to the files section.
|
||||||
|
- Added Bulk Archive and restore options to files and documents.
|
||||||
|
- Rewrite of the Kanban Ticket view to match our procedural style of coding.
|
||||||
|
- All options are available in TinyMCE now in Mobile mode.
|
||||||
|
- Agent names appear now in Invoice History section.
|
||||||
|
- Mail Parser: Support flowed text.
|
||||||
|
- Assets: Keep Purchase reference when copying.
|
||||||
|
- Assets: Add basic tracking history: Archiving, restoring, name changes, transferimg to new clients.
|
||||||
|
- Mail Parser: NDR Parsing.
|
||||||
|
- Allow SVG files in mail attachments.
|
||||||
|
- Tickets: Use a more friendly time worked instead of 02:41:00 translates to 2h 41m.
|
||||||
|
- Update wording on ticket to invoice item details.
|
||||||
|
- Merge Tickets: Now wth a ticket merge dropdown list of tickets instead of a text field.
|
||||||
|
- Role Permissions can now be set during role creation, update Permission UI to use radio buttons instead of select boxes.
|
||||||
|
- Bump TinyMCE 8.2.2 to 8.3.2.
|
||||||
|
- Bump PHPMailer from 7.0.1 to 7.0.2.
|
||||||
|
- Bump Datatables from 2.3.4 to 2.3.7.
|
||||||
|
|
||||||
|
## [25.12.1] Maint Release
|
||||||
|
|
||||||
|
### Major Changes
|
||||||
|
- Unified the Client/Agent Login and process (Note only Client Users can Reset passwords from the login page, does not apply to agent users).
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
- Fix Payment Provider not adding an account.
|
||||||
|
- Fix New ticket button in contact details in the related tickets section.
|
||||||
|
|
||||||
|
### New Features & Updates
|
||||||
|
- You can now Set Payment Provider income/expense account, expense vendor and expense category upond creation or editing.
|
||||||
|
- Moved Saved Payment Provider Methods away from admin side nav to the count link within Payment Providers page.
|
||||||
|
- Moved AI Models from the admin side nav to the model count link within AI Providers.
|
||||||
|
- Add Favicon Reset.
|
||||||
|
|
||||||
|
## [25.12] Stable Release
|
||||||
|
|
||||||
|
### Breaking Changes ###
|
||||||
|
- For Existing installs: **php-xml** extension needs to be installed for document creation and editing, new install script does this for you as of Dec 6th 2025. To install php-xml: `sudo apt install php-xml`
|
||||||
|
|
||||||
|
### Major Changes
|
||||||
|
- Consolidated "Files" and "Documents" into a single section called **Files**.
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
- Resolved issue with updating asset notes in asset details.
|
||||||
|
- Fixed problem with bulk ticket merging.
|
||||||
|
- Corrected issue where decimal inputs (e.g., price, cost) weren’t displaying on iPhones in certain forms.
|
||||||
|
- Added CSV escaping to the sample export data in areas where a sample CSV template is provided.
|
||||||
|
- Fix a race condition where dupe tickets, invoices, recurring invoices, recurring tickets, quotes will be created using the same number if created in parallel espcecially when using the API.
|
||||||
|
|
||||||
|
### New Features & Updates
|
||||||
|
- Introduced automatic subject-based ticket merging/reply detection. Now, if an email comes from a known contact or domain and the subject matches 95% of a ticket opened in the last 7 days, it will be merged automatically.
|
||||||
|
- Added `cleanInput` function to sanitize data before inserting it into the database when using MySQLi prepared statements.
|
||||||
|
- Migrated client post functionality to use MySQLi prepared statements.
|
||||||
|
- Updated payment method post functionality to use MySQLi prepared statements.
|
||||||
|
- Implemented `saveBase64Images()` to convert base64-encoded `<img>` tags into actual image files stored under `/uploads/<module>/<id>/` with secure filenames. Added wrapper functions, and updated document creation to use processed image paths.
|
||||||
|
- For new documents and document templates, images are now stored in `/uploads/documents/$document_id` instead of being stored as base64 in the database, using the `saveBase64Images()` function.
|
||||||
|
- UI/UX improvements made to the document details page.
|
||||||
|
- Removed sidebar quick-add options.
|
||||||
|
- Created new folders in the uploads directory: `documents`, `document_templates`, and `recurring_tickets`.
|
||||||
|
- Reworked the bulk action function to pass the name arrays, instead of a generic `selected_ids` array. This allows multiple bulk name arrays to be passed at once, currently used for the new file-document merge.
|
||||||
|
- Big task: Converted the remaining modals to use the new `ajax-modal` system, enabling more flexible flow expansion going forward.
|
||||||
|
- Mail queue: Added a `--no-mx-validation` flag to bypass recipient domain MX validation.
|
||||||
|
- Bump PHPMailer from 7.0.0 to 7.0.1.
|
||||||
|
- Bump stripe-php from 18.1.0 to 19.0.0.
|
||||||
|
- Bump TCPDF from 6.10.0 to 6.10.1.
|
||||||
|
- Bump TinyMCE from 8.2.0 to 8.2.2.
|
||||||
|
|
||||||
## [25.11.1] Maint Release
|
## [25.11.1] Maint Release
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
@@ -286,7 +383,7 @@ We will provide example code with directory structure for each custom directory
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Several security vulnerabilities patched.
|
- Several security vulnerabilities patched (with thanks to www.helx.io).
|
||||||
- Ticket status is no longer updated when scheduling.
|
- Ticket status is no longer updated when scheduling.
|
||||||
- Client Portal: Tech contacts can no longer edit their own details.
|
- Client Portal: Tech contacts can no longer edit their own details.
|
||||||
- Fixed overlapping logo issue in Invoice/Quote PDF exports.
|
- Fixed overlapping logo issue in Invoice/Quote PDF exports.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<a href="https://demo.itflow.org"><strong>View demo</strong></a>
|
<a href="https://demo.itflow.org"><strong>View demo</strong></a>
|
||||||
<br />
|
<br />
|
||||||
Username: <b>demo@demo</b> | Password: <b>demo</b>
|
Username: <b>demo@demo.com</b> | Password: <b>demo</b>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<a href="https://itflow.org/#about">About</a>
|
<a href="https://itflow.org/#about">About</a>
|
||||||
@@ -93,6 +93,7 @@ If you want to improve ITFlow, feel free to fork the repo and create a pull requ
|
|||||||
We’re incredibly grateful to the organizations and individuals who support the project - a big thank you to:
|
We’re incredibly grateful to the organizations and individuals who support the project - a big thank you to:
|
||||||
- CompuMatter
|
- CompuMatter
|
||||||
- F1 for HELP
|
- F1 for HELP
|
||||||
|
- digiBandit
|
||||||
- JetBrains (PhpStorm)
|
- JetBrains (PhpStorm)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ We operate a rolling release model. Any bug fixes will be released into latest v
|
|||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
|---------| ------------------ |
|
|---------| ------------------ |
|
||||||
| 25.05 | :white_check_mark: |
|
| 25.12 | :white_check_mark: |
|
||||||
|
|
||||||
## Reporting a Vulnerability via GitHub Security Advisories
|
## Reporting a Vulnerability via GitHub Security Advisories
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<ol class="breadcrumb d-print-none">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="/admin">Admin</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="ai_provider.php">AI Providers</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active">AI Models</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-robot mr-2"></i>AI Models</h3>
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-robot mr-2"></i>AI Models</h3>
|
||||||
@@ -48,7 +58,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$provider_id = intval($row['ai_provider_id']);
|
$provider_id = intval($row['ai_provider_id']);
|
||||||
$provider_name = nullable_htmlentities($row['ai_provider_name']);
|
$provider_name = nullable_htmlentities($row['ai_provider_name']);
|
||||||
$model_id = intval($row['ai_model_id']);
|
$model_id = intval($row['ai_model_id']);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
Key <?php if ($sort == 'ai_provider_api_key') { echo $order_icon; } ?>
|
Key <?php if ($sort == 'ai_provider_api_key') { echo $order_icon; } ?>
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th class="text-center">
|
||||||
<a class="text-dark">Models</a>
|
<a class="text-dark">Models</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
@@ -48,7 +48,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$provider_id = intval($row['ai_provider_id']);
|
$provider_id = intval($row['ai_provider_id']);
|
||||||
$provider_name = nullable_htmlentities($row['ai_provider_name']);
|
$provider_name = nullable_htmlentities($row['ai_provider_name']);
|
||||||
$url = nullable_htmlentities($row['ai_provider_api_url']);
|
$url = nullable_htmlentities($row['ai_provider_api_url']);
|
||||||
@@ -67,7 +67,8 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
</td>
|
</td>
|
||||||
<td><?php echo $url; ?></td>
|
<td><?php echo $url; ?></td>
|
||||||
<td><?php echo $key; ?></td>
|
<td><?php echo $key; ?></td>
|
||||||
<td><?php echo $ai_model_count; ?></td>
|
<td class="text-center">
|
||||||
|
<a class="badge badge-dark badge-pill p-2" href="ai_model.php"><?= $ai_model_count ?></a>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<button class="dropdown-item text-danger text-bold"
|
<button class="dropdown-item text-danger text-bold"
|
||||||
type="submit" form="bulkActions" name="bulk_delete_api_keys">
|
type="submit" form="bulkActions" name="bulk_delete_api_keys">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Revoke
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,7 +105,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$api_key_id = intval($row['api_key_id']);
|
$api_key_id = intval($row['api_key_id']);
|
||||||
$api_key_name = nullable_htmlentities($row['api_key_name']);
|
$api_key_name = nullable_htmlentities($row['api_key_name']);
|
||||||
$api_key_secret = nullable_htmlentities("************" . substr($row['api_key_secret'], -4));
|
$api_key_secret = nullable_htmlentities("************" . substr($row['api_key_secret'], -4));
|
||||||
@@ -139,9 +139,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_api_key=<?php echo $api_key_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
<?php if ($api_key_expire > date("Y-m-d H:i:s")) { ?>
|
||||||
|
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?revoke_api_key=<?php echo $api_key_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
<i class="fas fa-fw fa-times mr-2"></i>Revoke
|
<i class="fas fa-fw fa-times mr-2"></i>Revoke
|
||||||
</a>
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if ($api_key_expire < date("Y-m-d H:i:s")) { ?>
|
||||||
|
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_api_key=<?php echo $api_key_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<i class="fas fa-fw fa-times mr-2"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -164,4 +171,3 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_types_filter = mysqli_query($mysqli, "SELECT DISTINCT app_log_type FROM app_logs ORDER BY app_log_type ASC");
|
$sql_types_filter = mysqli_query($mysqli, "SELECT DISTINCT app_log_type FROM app_logs ORDER BY app_log_type ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_types_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_types_filter)) {
|
||||||
$log_type = nullable_htmlentities($row['app_log_type']);
|
$log_type = nullable_htmlentities($row['app_log_type']);
|
||||||
?>
|
?>
|
||||||
<option <?php if ($type_filter == $log_type) { echo "selected"; } ?>><?php echo $log_type; ?></option>
|
<option <?php if ($type_filter == $log_type) { echo "selected"; } ?>><?php echo $log_type; ?></option>
|
||||||
@@ -85,7 +85,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_categories_filter = mysqli_query($mysqli, "SELECT DISTINCT app_log_category FROM app_logs ORDER BY app_log_category ASC");
|
$sql_categories_filter = mysqli_query($mysqli, "SELECT DISTINCT app_log_category FROM app_logs ORDER BY app_log_category ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_categories_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_categories_filter)) {
|
||||||
$log_category = nullable_htmlentities($row['app_log_category']);
|
$log_category = nullable_htmlentities($row['app_log_category']);
|
||||||
?>
|
?>
|
||||||
<option <?php if ($category_filter == $log_category) { echo "selected"; } ?>><?php echo $log_category; ?></option>
|
<option <?php if ($category_filter == $log_category) { echo "selected"; } ?>><?php echo $log_category; ?></option>
|
||||||
@@ -141,7 +141,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$log_id = intval($row['app_log_id']);
|
$log_id = intval($row['app_log_id']);
|
||||||
$log_type = nullable_htmlentities($row['app_log_type']);
|
$log_type = nullable_htmlentities($row['app_log_type']);
|
||||||
$log_category = nullable_htmlentities($row['app_log_category']);
|
$log_category = nullable_htmlentities($row['app_log_category']);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_clients_filter = mysqli_query($mysqli, "SELECT * FROM clients ORDER BY client_name ASC");
|
$sql_clients_filter = mysqli_query($mysqli, "SELECT * FROM clients ORDER BY client_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_clients_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_clients_filter)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
?>
|
?>
|
||||||
@@ -108,7 +108,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_users_filter = mysqli_query($mysqli, "SELECT * FROM users ORDER BY user_name ASC");
|
$sql_users_filter = mysqli_query($mysqli, "SELECT * FROM users ORDER BY user_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_users_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_users_filter)) {
|
||||||
$user_id = intval($row['user_id']);
|
$user_id = intval($row['user_id']);
|
||||||
$user_name = nullable_htmlentities($row['user_name']);
|
$user_name = nullable_htmlentities($row['user_name']);
|
||||||
?>
|
?>
|
||||||
@@ -128,7 +128,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_types_filter = mysqli_query($mysqli, "SELECT DISTINCT log_type FROM logs ORDER BY log_type ASC");
|
$sql_types_filter = mysqli_query($mysqli, "SELECT DISTINCT log_type FROM logs ORDER BY log_type ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_types_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_types_filter)) {
|
||||||
$log_type = nullable_htmlentities($row['log_type']);
|
$log_type = nullable_htmlentities($row['log_type']);
|
||||||
?>
|
?>
|
||||||
<option <?php if ($type_filter == $log_type) { echo "selected"; } ?>><?php echo $log_type; ?></option>
|
<option <?php if ($type_filter == $log_type) { echo "selected"; } ?>><?php echo $log_type; ?></option>
|
||||||
@@ -147,7 +147,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_actions_filter = mysqli_query($mysqli, "SELECT DISTINCT log_action FROM logs ORDER BY log_action ASC");
|
$sql_actions_filter = mysqli_query($mysqli, "SELECT DISTINCT log_action FROM logs ORDER BY log_action ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_actions_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_actions_filter)) {
|
||||||
$log_action = nullable_htmlentities($row['log_action']);
|
$log_action = nullable_htmlentities($row['log_action']);
|
||||||
?>
|
?>
|
||||||
<option <?php if ($action_filter == $log_action) { echo "selected"; } ?>><?php echo $log_action; ?></option>
|
<option <?php if ($action_filter == $log_action) { echo "selected"; } ?>><?php echo $log_action; ?></option>
|
||||||
@@ -225,7 +225,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$log_id = intval($row['log_id']);
|
$log_id = intval($row['log_id']);
|
||||||
$log_type = nullable_htmlentities($row['log_type']);
|
$log_type = nullable_htmlentities($row['log_type']);
|
||||||
$log_action = nullable_htmlentities($row['log_action']);
|
$log_action = nullable_htmlentities($row['log_action']);
|
||||||
@@ -280,4 +280,3 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$category_id = intval($row['category_id']);
|
$category_id = intval($row['category_id']);
|
||||||
$category_name = nullable_htmlentities($row['category_name']);
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
$category_color = nullable_htmlentities($row['category_color']);
|
$category_color = nullable_htmlentities($row['category_color']);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$id = intval($row['contract_template_id']);
|
$id = intval($row['contract_template_id']);
|
||||||
$name = nullable_htmlentities($row['contract_template_name']);
|
$name = nullable_htmlentities($row['contract_template_name']);
|
||||||
$type = nullable_htmlentities($row['contract_template_type']);
|
$type = nullable_htmlentities($row['contract_template_type']);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$custom_link_id = intval($row['custom_link_id']);
|
$custom_link_id = intval($row['custom_link_id']);
|
||||||
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
||||||
$custom_link_uri = nullable_htmlentities($row['custom_link_uri']);
|
$custom_link_uri = nullable_htmlentities($row['custom_link_uri']);
|
||||||
|
|||||||
@@ -791,7 +791,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
|
|
||||||
// Copy primary_location and primary_contact to their new vars in their own respecting tables
|
// Copy primary_location and primary_contact to their new vars in their own respecting tables
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients");
|
||||||
while($row = mysqli_fetch_array($sql)) {
|
while($row = mysqli_fetch_assoc($sql)) {
|
||||||
$primary_contact = $row['primary_contact'];
|
$primary_contact = $row['primary_contact'];
|
||||||
$primary_location = $row['primary_location'];
|
$primary_location = $row['primary_location'];
|
||||||
|
|
||||||
@@ -1666,7 +1666,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
if (CURRENT_DATABASE_VERSION == '1.3.9') {
|
if (CURRENT_DATABASE_VERSION == '1.3.9') {
|
||||||
// Migrate all Network Info from Assets to Interface Table and make it primary interface
|
// Migrate all Network Info from Assets to Interface Table and make it primary interface
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets");
|
$sql = mysqli_query($mysqli, "SELECT * FROM assets");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
$mac = sanitizeInput($row['asset_mac']);
|
$mac = sanitizeInput($row['asset_mac']);
|
||||||
$ip = sanitizeInput($row['asset_ip']);
|
$ip = sanitizeInput($row['asset_ip']);
|
||||||
@@ -1945,7 +1945,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
if (CURRENT_DATABASE_VERSION == '1.5.7') {
|
if (CURRENT_DATABASE_VERSION == '1.5.7') {
|
||||||
// Create Users for contacts that have logins enabled and that are not archived
|
// Create Users for contacts that have logins enabled and that are not archived
|
||||||
$contacts_sql = mysqli_query($mysqli, "SELECT * FROM `contacts` WHERE contact_archived_at IS NULL AND (contact_auth_method = 'local' OR contact_auth_method = 'azure')");
|
$contacts_sql = mysqli_query($mysqli, "SELECT * FROM `contacts` WHERE contact_archived_at IS NULL AND (contact_auth_method = 'local' OR contact_auth_method = 'azure')");
|
||||||
while($row = mysqli_fetch_array($contacts_sql)) {
|
while($row = mysqli_fetch_assoc($contacts_sql)) {
|
||||||
$contact_id = intval($row['contact_id']);
|
$contact_id = intval($row['contact_id']);
|
||||||
$contact_name = mysqli_real_escape_string($mysqli, $row['contact_name']);
|
$contact_name = mysqli_real_escape_string($mysqli, $row['contact_name']);
|
||||||
$contact_email = mysqli_real_escape_string($mysqli, $row['contact_email']);
|
$contact_email = mysqli_real_escape_string($mysqli, $row['contact_email']);
|
||||||
@@ -3853,7 +3853,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
|
|
||||||
// Get Current Stripe Settings
|
// Get Current Stripe Settings
|
||||||
$sql_stripe_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
|
$sql_stripe_settings = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql_stripe_settings);
|
$row = mysqli_fetch_assoc($sql_stripe_settings);
|
||||||
$config_stripe_enable = intval($row['config_stripe_enable']);
|
$config_stripe_enable = intval($row['config_stripe_enable']);
|
||||||
if ($config_stripe_enable === 1) {
|
if ($config_stripe_enable === 1) {
|
||||||
$config_stripe_publishable = mysqli_real_escape_string($mysqli, $row['config_stripe_publishable']);
|
$config_stripe_publishable = mysqli_real_escape_string($mysqli, $row['config_stripe_publishable']);
|
||||||
@@ -3879,7 +3879,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
|
|
||||||
// Migrate Clients and Payment Method over
|
// Migrate Clients and Payment Method over
|
||||||
$sql_stripe_clients = mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE stripe_pm IS NOT NULL AND stripe_pm != ''");
|
$sql_stripe_clients = mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE stripe_pm IS NOT NULL AND stripe_pm != ''");
|
||||||
while ($row = mysqli_fetch_array($sql_stripe_clients)) {
|
while ($row = mysqli_fetch_assoc($sql_stripe_clients)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$stripe_id = mysqli_real_escape_string($mysqli, $row['stripe_id']);
|
$stripe_id = mysqli_real_escape_string($mysqli, $row['stripe_id']);
|
||||||
$stripe_pm = mysqli_real_escape_string($mysqli, $row['stripe_pm']);
|
$stripe_pm = mysqli_real_escape_string($mysqli, $row['stripe_pm']);
|
||||||
@@ -3932,7 +3932,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
// Migrate Payment Methods from Categories Table to new payment_methods table
|
// Migrate Payment Methods from Categories Table to new payment_methods table
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' AND category_name != 'Stripe' AND category_archived_at IS NULL");
|
$sql_categories = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' AND category_name != 'Stripe' AND category_archived_at IS NULL");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$category_name = sanitizeInput($row['category_name']);
|
$category_name = sanitizeInput($row['category_name']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO payment_methods SET payment_method_name = '$category_name'");
|
mysqli_query($mysqli,"INSERT INTO payment_methods SET payment_method_name = '$category_name'");
|
||||||
@@ -4134,10 +4134,69 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.8'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.8'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (CURRENT_DATABASE_VERSION == '2.3.8') {
|
if (CURRENT_DATABASE_VERSION == '2.3.8') {
|
||||||
// // Insert queries here required to update to DB version 2.3.9
|
|
||||||
|
mysqli_query($mysqli, "
|
||||||
|
CREATE TABLE `task_approvals` (
|
||||||
|
`approval_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`approval_scope` enum('client','internal') NOT NULL,
|
||||||
|
`approval_type` enum('any','technical','billing','specific') NOT NULL,
|
||||||
|
`approval_required_user_id` int(11) DEFAULT NULL,
|
||||||
|
`approval_status` enum('pending','approved','declined') NOT NULL,
|
||||||
|
`approval_created_by` int(11) NOT NULL,
|
||||||
|
`approval_approved_by` varchar(255) DEFAULT NULL,
|
||||||
|
`approval_url_key` varchar(200) NOT NULL,
|
||||||
|
`approval_task_id` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`approval_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.9'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CURRENT_DATABASE_VERSION == '2.3.9') {
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `clients` ADD `client_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `client_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `locations` ADD `location_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `location_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `vendors` ADD `vendor_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `vendor_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `software` ADD `software_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `software_notes`");
|
||||||
|
|
||||||
|
mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"ALTER TABLE `credentials`
|
||||||
|
CHANGE `credential_important` `credential_favorite`
|
||||||
|
TINYINT(1) NOT NULL DEFAULT 0
|
||||||
|
AFTER `credential_note`"
|
||||||
|
);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `assets` DROP `asset_important`");
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `assets` ADD `asset_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `asset_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `documents` DROP `document_important`");
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `documents` ADD `document_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `document_client_visible`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `racks` ADD `rack_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `rack_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `files` DROP `file_important`");
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `files` ADD `file_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `file_mime_type`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `networks` ADD `network_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `network_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `domains` ADD `domain_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `domain_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `certificates` ADD `certificate_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `certificate_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `services` ADD `service_favorite` TINYINT(1) NOT NULL DEFAULT '0' AFTER `service_notes`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.0'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CURRENT_DATABASE_VERSION == '2.4.0') {
|
||||||
|
// // Insert queries here required to update to DB version 2.4.1
|
||||||
// // Then, update the database to the next sequential version
|
// // Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.3.9'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.1'");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ $extensions = [
|
|||||||
'php-mbstring' => 'mbstring',
|
'php-mbstring' => 'mbstring',
|
||||||
'php-gd' => 'gd',
|
'php-gd' => 'gd',
|
||||||
'php-zip' => 'zip',
|
'php-zip' => 'zip',
|
||||||
|
'php-xml' => 'xml',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($extensions as $name => $ext) {
|
foreach ($extensions as $name => $ext) {
|
||||||
@@ -765,4 +766,3 @@ $mysqli->close();
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$document_template_id = intval($row['document_template_id']);
|
$document_template_id = intval($row['document_template_id']);
|
||||||
$document_template_name = nullable_htmlentities($row['document_template_name']);
|
$document_template_name = nullable_htmlentities($row['document_template_name']);
|
||||||
$document_template_description = nullable_htmlentities($row['document_template_description']);
|
$document_template_description = nullable_htmlentities($row['document_template_description']);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if (mysqli_num_rows($sql_document) == 0) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_document);
|
$row = mysqli_fetch_assoc($sql_document);
|
||||||
|
|
||||||
$document_template_name = nullable_htmlentities($row['document_template_name']);
|
$document_template_name = nullable_htmlentities($row['document_template_name']);
|
||||||
$document_template_description = nullable_htmlentities($row['document_template_description']);
|
$document_template_description = nullable_htmlentities($row['document_template_description']);
|
||||||
|
|||||||
@@ -27,12 +27,14 @@
|
|||||||
<p>Roles</p>
|
<p>Roles</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<!-- 2025-12-05 JQ - Hide Permission Modules currently just shows modules
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/modules.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "modules.php") {echo "active";} ?>">
|
<a href="/admin/modules.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "modules.php") {echo "active";} ?>">
|
||||||
<i class="nav-icon fas fa-puzzle-piece"></i>
|
<i class="nav-icon fas fa-puzzle-piece"></i>
|
||||||
<p>Modules</p>
|
<p>Modules</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
-->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/api_keys.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "api_keys.php") {echo "active";} ?>">
|
<a href="/admin/api_keys.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "api_keys.php") {echo "active";} ?>">
|
||||||
<i class="nav-icon fas fa-key"></i>
|
<i class="nav-icon fas fa-key"></i>
|
||||||
@@ -67,30 +69,20 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/payment_provider.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'payment_provider.php' ? 'active' : ''); ?>">
|
<a href="/admin/payment_provider.php"
|
||||||
|
class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['payment_provider.php', 'saved_payment_method.php']) ? 'active' : ''); ?>">
|
||||||
<i class="nav-icon far fa-credit-card"></i>
|
<i class="nav-icon far fa-credit-card"></i>
|
||||||
<p>Payment Providers</p>
|
<p>Payment Providers</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/admin/saved_payment_method.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'saved_payment_method.php' ? 'active' : ''); ?>">
|
|
||||||
<i class="nav-icon far fa-credit-card"></i>
|
|
||||||
<p>Saved Payments</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="/admin/ai_provider.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'ai_provider.php' ? 'active' : ''); ?>">
|
<a href="/admin/ai_provider.php"
|
||||||
|
class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['ai_provider.php', 'ai_model.php']) ? 'active' : ''); ?>">
|
||||||
<i class="nav-icon fas fa-robot"></i>
|
<i class="nav-icon fas fa-robot"></i>
|
||||||
<p>AI Providers</p>
|
<p>AI Providers</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/admin/ai_model.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'ai_model.php' ? 'active' : ''); ?>">
|
|
||||||
<i class="nav-icon fas fa-robot"></i>
|
|
||||||
<p>AI Models</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php if ($config_module_enable_ticketing) { ?>
|
<?php if ($config_module_enable_ticketing) { ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -301,7 +293,7 @@
|
|||||||
ORDER BY custom_link_order ASC, custom_link_name ASC"
|
ORDER BY custom_link_order ASC, custom_link_name ASC"
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_custom_links)) {
|
while ($row = mysqli_fetch_assoc($sql_custom_links)) {
|
||||||
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
||||||
$custom_link_uri = sanitize_url($row['custom_link_uri']);
|
$custom_link_uri = sanitize_url($row['custom_link_uri']);
|
||||||
$custom_link_icon = nullable_htmlentities($row['custom_link_icon']);
|
$custom_link_icon = nullable_htmlentities($row['custom_link_icon']);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$email_id = intval($row['email_id']);
|
$email_id = intval($row['email_id']);
|
||||||
$email_from = nullable_htmlentities($row['email_from']);
|
$email_from = nullable_htmlentities($row['email_from']);
|
||||||
$email_from_name = nullable_htmlentities($row['email_from_name']);
|
$email_from_name = nullable_htmlentities($row['email_from_name']);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ ob_start();
|
|||||||
<option value="">- Select an AI Provider -</option>
|
<option value="">- Select an AI Provider -</option>
|
||||||
<?php
|
<?php
|
||||||
$sql_ai_providers = mysqli_query($mysqli, "SELECT * FROM ai_providers");
|
$sql_ai_providers = mysqli_query($mysqli, "SELECT * FROM ai_providers");
|
||||||
while ($row = mysqli_fetch_array($sql_ai_providers)) {
|
while ($row = mysqli_fetch_assoc($sql_ai_providers)) {
|
||||||
$ai_provider_id = intval($row['ai_provider_id']);
|
$ai_provider_id = intval($row['ai_provider_id']);
|
||||||
$ai_provider_name = nullable_htmlentities($row['ai_provider_name']);
|
$ai_provider_name = nullable_htmlentities($row['ai_provider_name']);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $model_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models WHERE ai_model_id = $model_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models WHERE ai_model_id = $model_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$ai_model_ai_provider_id = intval($row['ai_model_ai_provider_id']);
|
$ai_model_ai_provider_id = intval($row['ai_model_ai_provider_id']);
|
||||||
$model_id = intval($row['ai_model_id']);
|
$model_id = intval($row['ai_model_id']);
|
||||||
$model_name = nullable_htmlentities($row['ai_model_name']);
|
$model_name = nullable_htmlentities($row['ai_model_name']);
|
||||||
@@ -39,7 +39,7 @@ ob_start();
|
|||||||
<option value="">- Select an AI Provider -</option>
|
<option value="">- Select an AI Provider -</option>
|
||||||
<?php
|
<?php
|
||||||
$sql_ai_providers = mysqli_query($mysqli, "SELECT * FROM ai_providers");
|
$sql_ai_providers = mysqli_query($mysqli, "SELECT * FROM ai_providers");
|
||||||
while ($row = mysqli_fetch_array($sql_ai_providers)) {
|
while ($row = mysqli_fetch_assoc($sql_ai_providers)) {
|
||||||
$ai_provider_id = intval($row['ai_provider_id']);
|
$ai_provider_id = intval($row['ai_provider_id']);
|
||||||
$ai_provider_name = nullable_htmlentities($row['ai_provider_name']);
|
$ai_provider_name = nullable_htmlentities($row['ai_provider_name']);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $provider_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM ai_providers WHERE ai_provider_id = $provider_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_providers WHERE ai_provider_id = $provider_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$provider_name = nullable_htmlentities($row['ai_provider_name']);
|
$provider_name = nullable_htmlentities($row['ai_provider_name']);
|
||||||
$url = nullable_htmlentities($row['ai_provider_api_url']);
|
$url = nullable_htmlentities($row['ai_provider_api_url']);
|
||||||
$key = nullable_htmlentities($row['ai_provider_api_key']);
|
$key = nullable_htmlentities($row['ai_provider_api_key']);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
$key = randomString(156);
|
$key = randomString(32);
|
||||||
$decryptPW = randomString(160);
|
$decryptPW = randomString(32);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
@@ -64,7 +64,7 @@ ob_start();
|
|||||||
<option value="0"> ALL CLIENTS </option>
|
<option value="0"> ALL CLIENTS </option>
|
||||||
<?php
|
<?php
|
||||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']); ?>
|
$client_name = nullable_htmlentities($row['client_name']); ?>
|
||||||
<option value="<?php echo $client_id; ?>"><?php echo "$client_name (Client ID: $client_id)"; ?></option>
|
<option value="<?php echo $client_id; ?>"><?php echo "$client_name (Client ID: $client_id)"; ?></option>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $category_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_id = $category_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_id = $category_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$category_name = nullable_htmlentities($row['category_name']);
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
$category_color = nullable_htmlentities($row['category_color']);
|
$category_color = nullable_htmlentities($row['category_color']);
|
||||||
$category_type = nullable_htmlentities($row['category_type']);
|
$category_type = nullable_htmlentities($row['category_type']);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ $update_frequency_array = ['Manual', 'Annually', '2 Year', '3 Year', '5 Year', '
|
|||||||
|
|
||||||
// Fetch existing template
|
// Fetch existing template
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM contract_templates WHERE contract_template_id = $contract_template_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM contract_templates WHERE contract_template_id = $contract_template_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
|
|
||||||
// Assign locals
|
// Assign locals
|
||||||
$name = nullable_htmlentities($row['contract_template_name']);
|
$name = nullable_htmlentities($row['contract_template_name']);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php';
|
|||||||
$custom_link_id = intval($_GET['id']);
|
$custom_link_id = intval($_GET['id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM custom_links WHERE custom_link_id = $custom_link_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM custom_links WHERE custom_link_id = $custom_link_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
||||||
$custom_link_uri = nullable_htmlentities($row['custom_link_uri']);
|
$custom_link_uri = nullable_htmlentities($row['custom_link_uri']);
|
||||||
$custom_link_icon = nullable_htmlentities($row['custom_link_icon']);
|
$custom_link_icon = nullable_htmlentities($row['custom_link_icon']);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php';
|
|||||||
$document_template_id = intval($_GET['id']);
|
$document_template_id = intval($_GET['id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM document_templates WHERE document_template_id = $document_template_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM document_templates WHERE document_template_id = $document_template_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$document_template_name = nullable_htmlentities($row['document_template_name']);
|
$document_template_name = nullable_htmlentities($row['document_template_name']);
|
||||||
$document_template_description = nullable_htmlentities($row['document_template_description']);
|
$document_template_description = nullable_htmlentities($row['document_template_description']);
|
||||||
$document_template_content = nullable_htmlentities($row['document_template_content']);
|
$document_template_content = nullable_htmlentities($row['document_template_content']);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ $purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'htt
|
|||||||
$purifier = new HTMLPurifier($purifier_config);
|
$purifier = new HTMLPurifier($purifier_config);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
|
|
||||||
$email_from = nullable_htmlentities($row['email_from']);
|
$email_from = nullable_htmlentities($row['email_from']);
|
||||||
$email_from_name = nullable_htmlentities($row['email_from_name']);
|
$email_from_name = nullable_htmlentities($row['email_from_name']);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $payment_method_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM payment_methods WHERE payment_method_id = $payment_method_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM payment_methods WHERE payment_method_id = $payment_method_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$payment_method_id = intval($row['payment_method_id']);
|
$payment_method_id = intval($row['payment_method_id']);
|
||||||
$payment_method_name = nullable_htmlentities($row['payment_method_name']);
|
$payment_method_name = nullable_htmlentities($row['payment_method_name']);
|
||||||
$payment_method_description = nullable_htmlentities($row['payment_method_description']);
|
$payment_method_description = nullable_htmlentities($row['payment_method_description']);
|
||||||
|
|||||||
@@ -16,11 +16,26 @@ ob_start();
|
|||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info text-center">
|
||||||
An income account named after the provider will always be created and used for income of paid invoices.<br>
|
<h6>Before Adding a Payment Provider!</h6>
|
||||||
If "Enable Expense" option is enabled, a matching vendor will also be automatically created for expense tracking. Additionally, an expense category named "Payment Processing" will be created.
|
We recommend you add an <strong>Account</strong> and <strong>Vendor</strong> based off the Provider name before continuing eg <strong>Stripe</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-expense">Expense</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Provider <strong class="text-danger">*</strong></label>
|
<label>Provider <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -53,6 +68,30 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Income / Expense Account <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account" required>
|
||||||
|
<option value="">- Select an Account -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT account_id, account_name FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$account_id = intval($row['account_id']);
|
||||||
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($account_name === 'Stripe') { echo "selected"; } ?> value="<?= $account_id ?>"><?= $account_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Threshold</label>
|
<label>Threshold</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -64,7 +103,9 @@ ob_start();
|
|||||||
<small class="form-text text-muted">Will not show as an option at Checkout if invoice amount is above this number, 0 disables the threshold check.</small>
|
<small class="form-text text-muted">Will not show as an option at Checkout if invoice amount is above this number, 0 disables the threshold check.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-expense">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
@@ -73,6 +114,60 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Payment Provider Vendor <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="expense_vendor" required>
|
||||||
|
<option value="0">Expense Disabled</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$vendor_id = intval($row['vendor_id']);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($vendor_name === 'Stripe') { echo "selected"; } ?> value="<?= $vendor_id ?>"><?= $vendor_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Expense Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="expense_category" required>
|
||||||
|
<option value="">- Select a Category -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$category_id = intval($row['category_id']);
|
||||||
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($category_name === 'Processing Fee') { echo "selected"; } ?> value="<?= $category_id ?>"><?= $category_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary ajax-modal" type="button"
|
||||||
|
data-modal-url="../admin/modals/category/category_add.php?category=Expense">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Percentage Fee to expense</label>
|
<label>Percentage Fee to expense</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -96,6 +191,8 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Add</button>
|
<button type="submit" name="add_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Add</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ $provider_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM payment_providers WHERE payment_provider_id = $provider_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM payment_providers WHERE payment_provider_id = $provider_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$provider_name = nullable_htmlentities($row['payment_provider_name']);
|
$provider_name = nullable_htmlentities($row['payment_provider_name']);
|
||||||
$public_key = nullable_htmlentities($row['payment_provider_public_key']);
|
$public_key = nullable_htmlentities($row['payment_provider_public_key']);
|
||||||
$private_key = nullable_htmlentities($row['payment_provider_private_key']);
|
$private_key = nullable_htmlentities($row['payment_provider_private_key']);
|
||||||
$account_id = nullable_htmlentities($row['payment_provider_account']);
|
$account_id = intval($row['payment_provider_account']);
|
||||||
$threshold = floatval($row['payment_provider_threshold']);
|
$threshold = floatval($row['payment_provider_threshold']);
|
||||||
$vendor_id = nullable_htmlentities($row['payment_provider_expense_vendor']);
|
$vendor_id = intval($row['payment_provider_expense_vendor']);
|
||||||
$category_id = nullable_htmlentities($row['payment_provider_expense_category']);
|
$category_id = intval($row['payment_provider_expense_category']);
|
||||||
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
||||||
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
||||||
|
|
||||||
@@ -21,24 +21,39 @@ $flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
|||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Editing: <strong><?php echo $provider_name; ?></strong></h5>
|
<h5 class="modal-title"><i class="fa fa-fw fa-credit-card mr-2"></i>Editing: <strong><?= $provider_name ?></strong></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<input type="hidden" name="provider_id" value="<?php echo $provider_id; ?>">
|
<input type="hidden" name="provider_id" value="<?= $provider_id ?>">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-expense">Expense</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="tab-pane fade show active" id="pills-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Publishable key <strong class="text-danger">*</strong></label>
|
<label>Publishable key <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="public_key" placeholder="Publishable API Key (pk_...)" value="<?php echo $public_key; ?>">
|
<input type="text" class="form-control" name="public_key" placeholder="Publishable API Key (pk_...)" value="<?= $public_key ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -48,7 +63,31 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="private_key" placeholder="Secret API Key (sk_...)" value="<?php echo $private_key; ?>">
|
<input type="text" class="form-control" name="private_key" placeholder="Secret API Key (sk_...)" value="<?= $private_key ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Income / Expense Account <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="account" required>
|
||||||
|
<option value="">- Select an Account -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT account_id, account_name FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$account_id_select = intval($row['account_id']);
|
||||||
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($account_id === $account_id_select) { echo "selected"; } ?> value="<?= $account_id_select ?>"><?= $account_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -63,14 +102,64 @@ ob_start();
|
|||||||
<small class="form-text text-muted">Will not show as an option at Checkout if above this number</small>
|
<small class="form-text text-muted">Will not show as an option at Checkout if above this number</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-expense">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-switch">
|
<label>Payment Provider Vendor <strong class="text-danger">*</strong></label>
|
||||||
<input type="checkbox" class="custom-control-input" name="enable_expense" <?php if ($vendor_id) { echo "checked"; } ?> value="1" id="enableEditExpenseSwitch">
|
<div class="input-group">
|
||||||
<label class="custom-control-label" for="enableEditExpenseSwitch">Enable Expense</label>
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="expense_vendor" required>
|
||||||
|
<option value="0">Expense Disabled</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = 0 AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$vendor_id_select = intval($row['vendor_id']);
|
||||||
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($vendor_id === $vendor_id_select) { echo "selected"; } ?>
|
||||||
|
value="<?= $vendor_id_select ?>"><?= $vendor_name ?>
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Expense Category <strong class="text-danger">*</strong></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="expense_category" required>
|
||||||
|
<option value="">- Select a Category -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql_category = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Expense' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_category)) {
|
||||||
|
$category_id_select = intval($row['category_id']);
|
||||||
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($category_id === $category_id_select) { echo "selected"; } ?> value="<?= $category_id_select ?>"><?= $category_name ?></option>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-secondary ajax-modal" type="button"
|
||||||
|
data-modal-url="../admin/modals/category/category_add.php?category=Expense">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<small>(Category: Payment Processing -- Vendor: <?php echo $provider_name; ?></small>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -94,7 +183,8 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
<small class="form-text text-muted">See <a href="https://stripe.com/pricing" target="_blank">here <i class="fas fa-fw fa-external-link-alt"></i></a> for the latest Stripe Fees.</small>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="edit_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_payment_provider" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php';
|
|||||||
$project_template_id = intval($_GET['project_template_id']);
|
$project_template_id = intval($_GET['project_template_id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_id = $project_template_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_id = $project_template_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$project_template_name = nullable_htmlentities($row['project_template_name']);
|
$project_template_name = nullable_htmlentities($row['project_template_name']);
|
||||||
$project_template_description = nullable_htmlentities($row['project_template_description']);
|
$project_template_description = nullable_htmlentities($row['project_template_description']);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ ob_start();
|
|||||||
AND ticket_template_archived_at IS NULL
|
AND ticket_template_archived_at IS NULL
|
||||||
ORDER BY ticket_template_name ASC"
|
ORDER BY ticket_template_name ASC"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql_ticket_templates_select)) {
|
while ($row = mysqli_fetch_assoc($sql_ticket_templates_select)) {
|
||||||
$ticket_template_id_select = intval($row['ticket_template_id']);
|
$ticket_template_id_select = intval($row['ticket_template_id']);
|
||||||
$ticket_template_name_select = nullable_htmlentities($row['ticket_template_name']);
|
$ticket_template_name_select = nullable_htmlentities($row['ticket_template_name']);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -11,11 +11,28 @@ ob_start();
|
|||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="pill" href="#pills-role-details">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-role-permissions">Permissions</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<!-- DETAILS TAB -->
|
||||||
|
<div class="tab-pane fade show active" id="pills-role-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Name <strong class="text-danger">*</strong></label>
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -38,25 +55,159 @@ ob_start();
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Admin Access <strong class="text-danger">*</strong></label>
|
<label>Admin Access <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
<div class="custom-control custom-radio mb-2">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tools"></i></span>
|
<input type="radio" class="custom-control-input" id="admin_no" name="role_is_admin" value="0" checked required>
|
||||||
</div>
|
<label class="custom-control-label" for="admin_no">
|
||||||
<select class="form-control select2" name="role_is_admin" required>
|
No - use permissions on the next tab
|
||||||
<option value="0">No - edit after creation to set permissions</option>
|
</label>
|
||||||
<option value="1">Yes - this role should have full admin access</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="custom-control custom-radio">
|
||||||
|
<input type="radio" class="custom-control-input" id="admin_yes" name="role_is_admin" value="1" required>
|
||||||
|
<label class="custom-control-label" for="admin_yes">
|
||||||
|
Yes - this role should have full admin access
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- PERMISSIONS TAB -->
|
||||||
|
<div class="tab-pane fade" id="pills-role-permissions">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Enumerate modules
|
||||||
|
$sql_modules = mysqli_query($mysqli, "SELECT * FROM modules");
|
||||||
|
while ($row_modules = mysqli_fetch_assoc($sql_modules)) {
|
||||||
|
|
||||||
|
$module_id = intval($row_modules['module_id']);
|
||||||
|
|
||||||
|
// raw for name, escaped for display
|
||||||
|
$module_name_raw = $row_modules['module_name'];
|
||||||
|
$module_name_display = ucfirst(str_replace("module_", "", $module_name_raw));
|
||||||
|
|
||||||
|
$module_name_display_safe = nullable_htmlentities($module_name_display);
|
||||||
|
$module_description = nullable_htmlentities($row_modules['module_description']);
|
||||||
|
|
||||||
|
// default for new role
|
||||||
|
$module_permission = 0;
|
||||||
|
|
||||||
|
$field_name = $module_id . "##" . $module_name_raw;
|
||||||
|
$group_id = "perm_group_$module_id";
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label><?= $module_name_display_safe ?> <strong class="text-danger">*</strong></label>
|
||||||
|
|
||||||
|
<div class="btn-group btn-group-toggle btn-block" data-toggle="buttons" role="group"
|
||||||
|
aria-label="Permissions for <?= $module_name_display_safe ?>">
|
||||||
|
|
||||||
|
<label class="btn btn-outline-secondary btn-sm active" title="No Access">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_0"
|
||||||
|
value="0"
|
||||||
|
autocomplete="off"
|
||||||
|
checked
|
||||||
|
required
|
||||||
|
>
|
||||||
|
None
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-outline-primary btn-sm" title="Viewing Only">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_1"
|
||||||
|
value="1"
|
||||||
|
autocomplete="off"
|
||||||
|
>
|
||||||
|
<i class="fas fa-fw fa-eye mr-1"></i>Read
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-outline-warning btn-sm" title="Read, Edit, Archive">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_2"
|
||||||
|
value="2"
|
||||||
|
autocomplete="off"
|
||||||
|
>
|
||||||
|
<i class="fas fa-fw fa-edit mr-1"></i>Modify
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-outline-danger btn-sm" title="Read, Edit, Archive, Delete">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_3"
|
||||||
|
value="3"
|
||||||
|
autocomplete="off"
|
||||||
|
>
|
||||||
|
<i class="fas fa-fw fa-trash mr-1"></i>Full
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<small class="form-text text-muted mt-2"><?= $module_description ?></small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } // end while ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_role" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
<button type="submit" name="add_role" class="btn btn-primary text-bold">
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<i class="fas fa-check mr-2"></i>Create
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||||
|
<i class="fas fa-times mr-2"></i>Cancel
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Optional: when Admin Yes is selected, disable permission radios + switch to Details tab
|
||||||
|
(function () {
|
||||||
|
function setPermissionsEnabled(enabled) {
|
||||||
|
const permsTab = document.getElementById('pills-role-permissions');
|
||||||
|
if (!permsTab) return;
|
||||||
|
|
||||||
|
permsTab.querySelectorAll('input[type="radio"]').forEach(function (el) {
|
||||||
|
el.disabled = !enabled;
|
||||||
|
});
|
||||||
|
|
||||||
|
// also visually dim the tab content
|
||||||
|
permsTab.style.opacity = enabled ? '1' : '0.5';
|
||||||
|
}
|
||||||
|
|
||||||
|
const adminYes = document.getElementById('admin_yes');
|
||||||
|
const adminNo = document.getElementById('admin_no');
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
const isAdmin = adminYes && adminYes.checked;
|
||||||
|
setPermissionsEnabled(!isAdmin);
|
||||||
|
|
||||||
|
if (isAdmin) {
|
||||||
|
// move user back to Details tab (avoids confusion)
|
||||||
|
const detailsTab = document.querySelector('a[href="#pills-role-details"]');
|
||||||
|
if (detailsTab) detailsTab.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adminYes && adminNo) {
|
||||||
|
adminYes.addEventListener('change', refresh);
|
||||||
|
adminNo.addEventListener('change', refresh);
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once '../../../includes/modal_footer.php';
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $role_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_id = $role_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_id = $role_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$role_name = nullable_htmlentities($row['role_name']);
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
$role_description = nullable_htmlentities($row['role_description']);
|
$role_description = nullable_htmlentities($row['role_description']);
|
||||||
$role_admin = intval($row['role_is_admin']);
|
$role_admin = intval($row['role_is_admin']);
|
||||||
@@ -31,36 +31,36 @@ if (empty($user_names_string)) {
|
|||||||
$user_names_string = "-";
|
$user_names_string = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Generate the HTML form content using output buffering.
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-user-shield mr-2"></i>Editing role:
|
<h5 class="modal-title"><i class="fas fa-fw fa-user-shield mr-2"></i>Editing role:
|
||||||
<strong><?php echo $role_name; ?></strong></h5>
|
<strong><?= $role_name ?></strong></h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
<input type="hidden" name="role_id" value="<?php echo $role_id; ?>">
|
<input type="hidden" name="role_id" value="<?= $role_id ?>">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-role-details<?php echo $role_id; ?>">Details</a>
|
<a class="nav-link active" data-toggle="pill" href="#pills-role-details">Details</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php if (!$role_admin) { ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-role-access<?php echo $role_id; ?>">Access</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-role-permissions">Permissions</a>
|
||||||
</li>
|
</li>
|
||||||
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="pills-role-details<?php echo $role_id; ?>">
|
<div class="tab-pane fade show active" id="pills-role-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Name <strong class="text-danger">*</strong></label>
|
<label>Name <strong class="text-danger">*</strong></label>
|
||||||
@@ -68,7 +68,7 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user-shield"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-user-shield"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="role_name" placeholder="Role Name" maxlength="200" value="<?php echo $role_name; ?>" required>
|
<input type="text" class="form-control" name="role_name" placeholder="Role Name" maxlength="200" value="<?= $role_name ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -78,27 +78,33 @@ ob_start();
|
|||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-chevron-right"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-chevron-right"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" name="role_description" placeholder="Role Description" maxlength="200" value="<?php echo $role_description; ?>" required>
|
<input type="text" class="form-control" name="role_description" placeholder="Role Description" maxlength="200" value="<?= $role_description ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Admin Access <strong class="text-danger">*</strong></label>
|
<label>Admin Access <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="custom-control custom-radio mb-2">
|
||||||
<div class="input-group-prepend">
|
<input type="radio" class="custom-control-input" id="admin_yes" name="role_is_admin" value="1"
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tools"></i></span>
|
<?php if ($role_admin) { echo 'checked'; } ?> required>
|
||||||
|
<label class="custom-control-label" for="admin_yes">
|
||||||
|
Yes - this role should have full admin access
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="role_is_admin" required>
|
|
||||||
<option value="1" <?php if ($role_admin) { echo 'selected'; } ?> >Yes - this role should have full admin access</option>
|
<div class="custom-control custom-radio">
|
||||||
<option value="0" <?php if (!$role_admin) { echo 'selected'; } ?>>No - use permissions on the next tab</option>
|
<input type="radio" class="custom-control-input" id="admin_no" name="role_is_admin" value="0"
|
||||||
</select>
|
<?php if (!$role_admin) { echo 'checked'; } ?> required>
|
||||||
|
<label class="custom-control-label" for="admin_no">
|
||||||
|
No - use permissions on the next tab
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (!$role_admin) { ?>
|
||||||
<div class="tab-pane fade" id="pills-role-access<?php echo $role_id; ?>">
|
<div class="tab-pane fade" id="pills-role-permissions">
|
||||||
|
|
||||||
<?php if ($role_admin) { ?>
|
<?php if ($role_admin) { ?>
|
||||||
<div class="alert alert-warning"><strong>Module permissions do not apply to Admins.</strong></div>
|
<div class="alert alert-warning"><strong>Module permissions do not apply to Admins.</strong></div>
|
||||||
@@ -108,14 +114,14 @@ ob_start();
|
|||||||
|
|
||||||
// Enumerate modules
|
// Enumerate modules
|
||||||
$sql_modules = mysqli_query($mysqli, "SELECT * FROM modules");
|
$sql_modules = mysqli_query($mysqli, "SELECT * FROM modules");
|
||||||
while ($row_modules = mysqli_fetch_array($sql_modules)) {
|
while ($row_modules = mysqli_fetch_assoc($sql_modules)) {
|
||||||
$module_id = intval($row_modules['module_id']);
|
$module_id = intval($row_modules['module_id']);
|
||||||
$module_name = nullable_htmlentities($row_modules['module_name']);
|
$module_name = nullable_htmlentities($row_modules['module_name']);
|
||||||
$module_name_display = ucfirst(str_replace("module_","",$module_name));
|
$module_name_display = ucfirst(str_replace("module_","",$module_name));
|
||||||
$module_description = nullable_htmlentities($row_modules['module_description']);
|
$module_description = nullable_htmlentities($row_modules['module_description']);
|
||||||
|
|
||||||
// Get permission level for module
|
// Get permission level for module
|
||||||
$module_permission_row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_role_permission_level FROM user_role_permissions WHERE module_id = $module_id AND user_role_id = $role_id LIMIT 1"));
|
$module_permission_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT user_role_permission_level FROM user_role_permissions WHERE module_id = $module_id AND user_role_id = $role_id LIMIT 1"));
|
||||||
$module_permission = 0;
|
$module_permission = 0;
|
||||||
if ($module_permission_row) {
|
if ($module_permission_row) {
|
||||||
$module_permission = $module_permission_row['user_role_permission_level'];
|
$module_permission = $module_permission_row['user_role_permission_level'];
|
||||||
@@ -123,22 +129,73 @@ ob_start();
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label> <?php echo $module_name_display ?> <strong class="text-danger">*</strong></label>
|
<label> <?= $module_name_display ?> <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<?php
|
||||||
<select class="form-control select2" name="<?php echo "$module_id##$module_name" ?>" required>
|
$field_name = "$module_id##$module_name";
|
||||||
<option value="0" <?php if ($module_permission == 0) { echo 'selected'; } ?> >None</option>
|
$group_id = "perm_group_$module_id";
|
||||||
<option value="1" <?php if ($module_permission == 1) { echo 'selected'; } ?> >Read</option>
|
?>
|
||||||
<option value="2" <?php if ($module_permission == 2) { echo 'selected'; } ?>>Modify (Read, Edit, Archive)</option>
|
|
||||||
<option value="3" <?php if ($module_permission == 3) { echo 'selected'; } ?>>Full (Read, Edit, Archive, Delete)</option>
|
<div class="btn-group btn-group-toggle btn-block" data-toggle="buttons" role="group" aria-label="Permissions for <?= $module_name_display ?>">
|
||||||
</select>
|
|
||||||
|
<label class="btn btn-outline-secondary btn-sm <?php if ($module_permission == 0) { echo 'active'; } ?>" title="No Access">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_0"
|
||||||
|
value="0"
|
||||||
|
autocomplete="off"
|
||||||
|
<?php if ($module_permission == 0) { echo 'checked'; } ?>
|
||||||
|
required
|
||||||
|
>
|
||||||
|
None
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-outline-primary btn-sm <?php if ($module_permission == 1) { echo 'active'; } ?>" title="Viewing Only">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_1"
|
||||||
|
value="1"
|
||||||
|
autocomplete="off"
|
||||||
|
<?php if ($module_permission == 1) { echo 'checked'; } ?>
|
||||||
|
>
|
||||||
|
<i class="fas fa-fw fa-eye mr-1"></i>Read
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-outline-warning btn-sm <?php if ($module_permission == 2) { echo 'active'; } ?>" title="Read, Edit, Archive">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_2"
|
||||||
|
value="2"
|
||||||
|
autocomplete="off"
|
||||||
|
<?php if ($module_permission == 2) { echo 'checked'; } ?>
|
||||||
|
>
|
||||||
|
<i class="fas fa-fw fa-edit mr-1"></i>Modify
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="btn btn-outline-danger btn-sm <?php if ($module_permission == 3) { echo 'active'; } ?>" title="Read, Edit, Archive, Delete">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="<?= $field_name ?>"
|
||||||
|
id="<?= $group_id ?>_3"
|
||||||
|
value="3"
|
||||||
|
autocomplete="off"
|
||||||
|
<?php if ($module_permission == 3) { echo 'checked'; } ?>
|
||||||
|
>
|
||||||
|
<i class="fas fa-fw fa-trash mr-1"></i>Full
|
||||||
|
</label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<small class="form-text text-muted"><?php echo $module_description ?></small>
|
|
||||||
|
<small class="form-text text-muted mt-2"><?= $module_description ?></small>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } // End while ?>
|
<?php } // End while ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php';
|
|||||||
$software_template_id = intval($_GET['id']);
|
$software_template_id = intval($_GET['id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM software_templates WHERE software_template_id = $software_template_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM software_templates WHERE software_template_id = $software_template_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$software_name = nullable_htmlentities($row['software_template_name']);
|
$software_name = nullable_htmlentities($row['software_template_name']);
|
||||||
$software_version = nullable_htmlentities($row['software_template_version']);
|
$software_version = nullable_htmlentities($row['software_template_version']);
|
||||||
$software_description = nullable_htmlentities($row['software_template_description']);
|
$software_description = nullable_htmlentities($row['software_template_description']);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $tag_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_id = $tag_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_id = $tag_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$tag_name = nullable_htmlentities($row['tag_name']);
|
$tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
$tag_type = intval($row['tag_type']);
|
$tag_type = intval($row['tag_type']);
|
||||||
$tag_color = nullable_htmlentities($row['tag_color']);
|
$tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php';
|
|||||||
$tax_id = intval($_GET['id']);
|
$tax_id = intval($_GET['id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE tax_id = $tax_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE tax_id = $tax_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$tax_name = nullable_htmlentities($row['tax_name']);
|
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||||
$tax_percent = floatval($row['tax_percent']);
|
$tax_percent = floatval($row['tax_percent']);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php';
|
|||||||
$ticket_status_id = intval($_GET['id']);
|
$ticket_status_id = intval($_GET['id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_statuses WHERE ticket_status_id = $ticket_status_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_statuses WHERE ticket_status_id = $ticket_status_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||||
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||||
$ticket_status_order = intval($row['ticket_status_order']);
|
$ticket_status_order = intval($row['ticket_status_order']);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ ob_start();
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql_project_templates = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_archived_at IS NULL ORDER BY project_template_name ASC");
|
$sql_project_templates = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_archived_at IS NULL ORDER BY project_template_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_project_templates)) {
|
while ($row = mysqli_fetch_assoc($sql_project_templates)) {
|
||||||
$project_template_id_select = intval($row['project_template_id']);
|
$project_template_id_select = intval($row['project_template_id']);
|
||||||
$project_template_name_select = nullable_htmlentities($row['project_template_name']); ?>
|
$project_template_name_select = nullable_htmlentities($row['project_template_name']); ?>
|
||||||
<option value="<?php echo $project_template_id_select; ?>"><?php echo $project_template_name_select; ?></option>
|
<option value="<?php echo $project_template_id_select; ?>"><?php echo $project_template_name_select; ?></option>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $task_template_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_id = $task_template_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_id = $task_template_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$task_template_name = nullable_htmlentities($row['task_template_name']);
|
$task_template_name = nullable_htmlentities($row['task_template_name']);
|
||||||
$task_template_order = intval($row['task_template_order']);
|
$task_template_order = intval($row['task_template_order']);
|
||||||
$task_template_completion_estimate = intval($row['task_template_completion_estimate']);
|
$task_template_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ ob_start();
|
|||||||
<option value="">- Role -</option>
|
<option value="">- Role -</option>
|
||||||
<?php
|
<?php
|
||||||
$sql_user_roles = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_archived_at IS NULL");
|
$sql_user_roles = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_archived_at IS NULL");
|
||||||
while ($row = mysqli_fetch_array($sql_user_roles)) {
|
while ($row = mysqli_fetch_assoc($sql_user_roles)) {
|
||||||
$role_id = intval($row['role_id']);
|
$role_id = intval($row['role_id']);
|
||||||
$role_name = nullable_htmlentities($row['role_name']);
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ ob_start();
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql_client_select = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
$sql_client_select = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_client_select)) {
|
while ($row = mysqli_fetch_assoc($sql_client_select)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $user_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE users.user_id = $user_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE users.user_id = $user_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$user_name = nullable_htmlentities($row['user_name']);
|
$user_name = nullable_htmlentities($row['user_name']);
|
||||||
$user_email = nullable_htmlentities($row['user_email']);
|
$user_email = nullable_htmlentities($row['user_email']);
|
||||||
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
||||||
@@ -60,7 +60,7 @@ ob_start();
|
|||||||
<option value="0">No one</option>
|
<option value="0">No one</option>
|
||||||
<?php
|
<?php
|
||||||
$sql_users = mysqli_query($mysqli, "SELECT * FROM users WHERE user_type = 1 AND user_archived_at IS NULL");
|
$sql_users = mysqli_query($mysqli, "SELECT * FROM users WHERE user_type = 1 AND user_archived_at IS NULL");
|
||||||
while ($row = mysqli_fetch_array($sql_users)) {
|
while ($row = mysqli_fetch_assoc($sql_users)) {
|
||||||
$user_id_select = intval($row['user_id']);
|
$user_id_select = intval($row['user_id']);
|
||||||
$user_name_select = nullable_htmlentities($row['user_name']);
|
$user_name_select = nullable_htmlentities($row['user_name']);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM users
|
|||||||
WHERE users.user_id = $user_id LIMIT 1"
|
WHERE users.user_id = $user_id LIMIT 1"
|
||||||
);
|
);
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$user_name = nullable_htmlentities($row['user_name']);
|
$user_name = nullable_htmlentities($row['user_name']);
|
||||||
$user_email = nullable_htmlentities($row['user_email']);
|
$user_email = nullable_htmlentities($row['user_email']);
|
||||||
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
$user_avatar = nullable_htmlentities($row['user_avatar']);
|
||||||
@@ -114,7 +114,7 @@ ob_start();
|
|||||||
<select class="form-control select2" name="role" required>
|
<select class="form-control select2" name="role" required>
|
||||||
<?php
|
<?php
|
||||||
$sql_user_roles = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_archived_at IS NULL");
|
$sql_user_roles = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_archived_at IS NULL");
|
||||||
while ($row = mysqli_fetch_array($sql_user_roles)) {
|
while ($row = mysqli_fetch_assoc($sql_user_roles)) {
|
||||||
$role_id = intval($row['role_id']);
|
$role_id = intval($row['role_id']);
|
||||||
$role_name = nullable_htmlentities($row['role_name']);
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ ob_start();
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql_client_select = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
$sql_client_select = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_client_select)) {
|
while ($row = mysqli_fetch_assoc($sql_client_select)) {
|
||||||
$client_id_select = intval($row['client_id']);
|
$client_id_select = intval($row['client_id']);
|
||||||
$client_name_select = nullable_htmlentities($row['client_name']);
|
$client_name_select = nullable_htmlentities($row['client_name']);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<div class="modal" id="exportUserModal" tabindex="-1">
|
<?php
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
require_once '../../../includes/modal_header.php';
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-download mr-2"></i>Export Users to CSV</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-download mr-2"></i>Export Users to CSV</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
@@ -16,6 +21,6 @@
|
|||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
<?php
|
||||||
</div>
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $user_id = intval($_GET['id']);
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE user_id = $user_id AND user_archived_at IS NOT NULL LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE user_id = $user_id AND user_archived_at IS NOT NULL LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$user_name = str_replace(" (archived)", "", $row['user_name']); //Removed (archived) from user_name
|
$user_name = str_replace(" (archived)", "", $row['user_name']); //Removed (archived) from user_name
|
||||||
$user_name = nullable_htmlentities($user_name);
|
$user_name = nullable_htmlentities($user_name);
|
||||||
$user_email = nullable_htmlentities($row['user_email']);
|
$user_email = nullable_htmlentities($row['user_email']);
|
||||||
@@ -64,7 +64,7 @@ ob_start();
|
|||||||
<select class="form-control select2" name="role" required>
|
<select class="form-control select2" name="role" required>
|
||||||
<?php
|
<?php
|
||||||
$sql_user_roles = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_archived_at IS NULL");
|
$sql_user_roles = mysqli_query($mysqli, "SELECT * FROM user_roles WHERE role_archived_at IS NULL");
|
||||||
while ($row = mysqli_fetch_array($sql_user_roles)) {
|
while ($row = mysqli_fetch_assoc($sql_user_roles)) {
|
||||||
$role_id = intval($row['role_id']);
|
$role_id = intval($row['role_id']);
|
||||||
$role_name = nullable_htmlentities($row['role_name']);
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php';
|
|||||||
$vendor_template_id = intval($_GET['id']);
|
$vendor_template_id = intval($_GET['id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendor_templates WHERE vendor_template_id = $vendor_template_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM vendor_templates WHERE vendor_template_id = $vendor_template_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$vendor_name = nullable_htmlentities($row['vendor_template_name']);
|
$vendor_name = nullable_htmlentities($row['vendor_template_name']);
|
||||||
$vendor_description = nullable_htmlentities($row['vendor_template_description']);
|
$vendor_description = nullable_htmlentities($row['vendor_template_description']);
|
||||||
$vendor_account_number = nullable_htmlentities($row['vendor_template_account_number']);
|
$vendor_account_number = nullable_htmlentities($row['vendor_template_account_number']);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$module_id = intval($row['module_id']);
|
$module_id = intval($row['module_id']);
|
||||||
$module_name = nullable_htmlentities($row['module_name']);
|
$module_name = nullable_htmlentities($row['module_name']);
|
||||||
$module_description = nullable_htmlentities($row['module_description']);
|
$module_description = nullable_htmlentities($row['module_description']);
|
||||||
|
|||||||
103
admin/oauth_microsoft_mail_callback.php
Normal file
103
admin/oauth_microsoft_mail_callback.php
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once "../config.php";
|
||||||
|
require_once "../functions.php";
|
||||||
|
require_once "../includes/check_login.php";
|
||||||
|
|
||||||
|
$settings_mail_path = '/admin/settings_mail.php';
|
||||||
|
|
||||||
|
if (!isset($session_is_admin) || !$session_is_admin) {
|
||||||
|
flash_alert("Admin access required.", 'error');
|
||||||
|
redirect($settings_mail_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$state = sanitizeInput($_GET['state'] ?? '');
|
||||||
|
$code = $_GET['code'] ?? '';
|
||||||
|
$error = sanitizeInput($_GET['error'] ?? '');
|
||||||
|
$error_description = sanitizeInput($_GET['error_description'] ?? '');
|
||||||
|
|
||||||
|
$session_state = $_SESSION['mail_oauth_state'] ?? '';
|
||||||
|
$session_state_expires = intval($_SESSION['mail_oauth_state_expires_at'] ?? 0);
|
||||||
|
|
||||||
|
unset($_SESSION['mail_oauth_state'], $_SESSION['mail_oauth_state_expires_at']);
|
||||||
|
|
||||||
|
if (!empty($error)) {
|
||||||
|
$msg = "Microsoft OAuth authorization failed: $error";
|
||||||
|
if (!empty($error_description)) {
|
||||||
|
$msg .= " ($error_description)";
|
||||||
|
}
|
||||||
|
|
||||||
|
flash_alert($msg, 'error');
|
||||||
|
redirect($settings_mail_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($state) || empty($code) || empty($session_state) || !hash_equals($session_state, $state) || time() > $session_state_expires) {
|
||||||
|
flash_alert("Microsoft OAuth callback validation failed. Please try connecting again.", 'error');
|
||||||
|
redirect($settings_mail_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_tenant_id)) {
|
||||||
|
flash_alert("Microsoft OAuth settings are incomplete. Please fill Client ID, Client Secret, and Tenant ID.", 'error');
|
||||||
|
redirect($settings_mail_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('BASE_URL') && !empty(BASE_URL)) {
|
||||||
|
$base_url = rtrim((string) BASE_URL, '/');
|
||||||
|
} else {
|
||||||
|
$base_url = 'https://' . rtrim((string) $config_base_url, '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
$redirect_uri = $base_url . '/admin/oauth_microsoft_mail_callback.php';
|
||||||
|
$token_url = 'https://login.microsoftonline.com/' . rawurlencode($config_mail_oauth_tenant_id) . '/oauth2/v2.0/token';
|
||||||
|
$scope = 'offline_access openid profile https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send';
|
||||||
|
|
||||||
|
$ch = curl_init($token_url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
|
||||||
|
'client_id' => $config_mail_oauth_client_id,
|
||||||
|
'client_secret' => $config_mail_oauth_client_secret,
|
||||||
|
'grant_type' => 'authorization_code',
|
||||||
|
'code' => $code,
|
||||||
|
'redirect_uri' => $redirect_uri,
|
||||||
|
'scope' => $scope,
|
||||||
|
], '', '&'));
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
|
||||||
|
|
||||||
|
$raw_body = curl_exec($ch);
|
||||||
|
$curl_err = curl_error($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($raw_body === false || $http_code < 200 || $http_code >= 300) {
|
||||||
|
$reason = !empty($curl_err) ? $curl_err : "HTTP $http_code";
|
||||||
|
flash_alert("Microsoft OAuth token exchange failed: $reason", 'error');
|
||||||
|
redirect($settings_mail_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = json_decode($raw_body, true);
|
||||||
|
if (!is_array($json) || empty($json['refresh_token']) || empty($json['access_token'])) {
|
||||||
|
flash_alert("Microsoft OAuth token exchange failed: refresh token or access token missing.", 'error');
|
||||||
|
redirect($settings_mail_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$refresh_token = (string) $json['refresh_token'];
|
||||||
|
$access_token = (string) $json['access_token'];
|
||||||
|
$expires_at = date('Y-m-d H:i:s', time() + (int)($json['expires_in'] ?? 3600));
|
||||||
|
|
||||||
|
$refresh_token_esc = mysqli_real_escape_string($mysqli, $refresh_token);
|
||||||
|
$access_token_esc = mysqli_real_escape_string($mysqli, $access_token);
|
||||||
|
$expires_at_esc = mysqli_real_escape_string($mysqli, $expires_at);
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE settings SET
|
||||||
|
config_imap_provider = 'microsoft_oauth',
|
||||||
|
config_smtp_provider = 'microsoft_oauth',
|
||||||
|
config_mail_oauth_refresh_token = '$refresh_token_esc',
|
||||||
|
config_mail_oauth_access_token = '$access_token_esc',
|
||||||
|
config_mail_oauth_access_token_expires_at = '$expires_at_esc'
|
||||||
|
WHERE company_id = 1
|
||||||
|
");
|
||||||
|
|
||||||
|
logAction("Settings", "Edit", "$session_name completed Microsoft OAuth connect flow for mail settings");
|
||||||
|
flash_alert("Microsoft OAuth connected successfully. Token expires at $expires_at.");
|
||||||
|
redirect($settings_mail_path);
|
||||||
@@ -45,7 +45,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$payment_method_id = intval($row['payment_method_id']);
|
$payment_method_id = intval($row['payment_method_id']);
|
||||||
$payment_method_name = nullable_htmlentities($row['payment_method_name']);
|
$payment_method_name = nullable_htmlentities($row['payment_method_name']);
|
||||||
$payment_method_description = nullable_htmlentities($row['payment_method_description']);
|
$payment_method_description = nullable_htmlentities($row['payment_method_description']);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<th>
|
<th>
|
||||||
<a class="text-dark">Expensed Fee</a>
|
<a class="text-dark">Expensed Fee</a>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th class="text-center">
|
||||||
<a class="text-dark">Saved Payment Methods</a>
|
<a class="text-dark">Saved Payment Methods</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
@@ -66,13 +66,13 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$provider_id = intval($row['payment_provider_id']);
|
$provider_id = intval($row['payment_provider_id']);
|
||||||
$provider_name = nullable_htmlentities($row['payment_provider_name']);
|
$provider_name = nullable_htmlentities($row['payment_provider_name']);
|
||||||
$provider_description = nullable_htmlentities($row['payment_provider_description']);
|
$provider_description = nullable_htmlentities($row['payment_provider_description']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']);
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
$threshold = floatval($row['payment_provider_threshold']);
|
$threshold = floatval($row['payment_provider_threshold']);
|
||||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
$vendor_name = nullable_htmlentities($row['vendor_name'] ?? "Expense Disabled");
|
||||||
$category = nullable_htmlentities($row['category_name']);
|
$category = nullable_htmlentities($row['category_name']);
|
||||||
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
$percent_fee = floatval($row['payment_provider_expense_percentage_fee']) * 100;
|
||||||
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
$flat_fee = floatval($row['payment_provider_expense_flat_fee']);
|
||||||
@@ -94,7 +94,9 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<td><?php echo $vendor_name; ?></td>
|
<td><?php echo $vendor_name; ?></td>
|
||||||
<td><?php echo $category; ?></td>
|
<td><?php echo $category; ?></td>
|
||||||
<td><?php echo $percent_fee; ?>% + <?php echo numfmt_format_currency($currency_format, $flat_fee, $session_company_currency); ?></td>
|
<td><?php echo $percent_fee; ?>% + <?php echo numfmt_format_currency($currency_format, $flat_fee, $session_company_currency); ?></td>
|
||||||
<td><?php echo $saved_payment_count; ?></td>
|
<td class="text-center">
|
||||||
|
<a class="badge badge-dark badge-pill p-2" href="saved_payment_method.php"><?= $saved_payment_count ?></a>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
|
|||||||
@@ -31,6 +31,27 @@ if (isset($_POST['add_api_key'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['revoke_api_key'])) {
|
||||||
|
|
||||||
|
validateCSRFToken($_GET['csrf_token']);
|
||||||
|
|
||||||
|
$api_key_id = intval($_GET['revoke_api_key']);
|
||||||
|
|
||||||
|
// Get API Key Name
|
||||||
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT api_key_name, api_key_client_id FROM api_keys WHERE api_key_id = $api_key_id"));
|
||||||
|
$api_key_name = sanitizeInput($row['api_key_name']);
|
||||||
|
$client_id = intval($row['api_key_client_id']);
|
||||||
|
|
||||||
|
mysqli_query($mysqli,"UPDATE api_keys SET api_key_expire = NOW() WHERE api_key_id = $api_key_id");
|
||||||
|
|
||||||
|
logAction("API Key", "Revoke", "$session_name revoked API key $name", $client_id);
|
||||||
|
|
||||||
|
flash_alert("API Key <strong>$name</strong> revoked", 'error');
|
||||||
|
|
||||||
|
redirect();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['delete_api_key'])) {
|
if (isset($_GET['delete_api_key'])) {
|
||||||
|
|
||||||
validateCSRFToken($_GET['csrf_token']);
|
validateCSRFToken($_GET['csrf_token']);
|
||||||
@@ -38,7 +59,7 @@ if (isset($_GET['delete_api_key'])) {
|
|||||||
$api_key_id = intval($_GET['delete_api_key']);
|
$api_key_id = intval($_GET['delete_api_key']);
|
||||||
|
|
||||||
// Get API Key Name
|
// Get API Key Name
|
||||||
$row = mysqli_fetch_array(mysqli_query($mysqli,"SELECT api_key_name, api_key_client_id FROM api_keys WHERE api_key_id = $api_key_id"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT api_key_name, api_key_client_id FROM api_keys WHERE api_key_id = $api_key_id"));
|
||||||
$api_key_name = sanitizeInput($row['api_key_name']);
|
$api_key_name = sanitizeInput($row['api_key_name']);
|
||||||
$client_id = intval($row['api_key_client_id']);
|
$client_id = intval($row['api_key_client_id']);
|
||||||
|
|
||||||
@@ -66,7 +87,7 @@ if (isset($_POST['bulk_delete_api_keys'])) {
|
|||||||
$api_key_id = intval($api_key_id);
|
$api_key_id = intval($api_key_id);
|
||||||
|
|
||||||
// Get API Key Name
|
// Get API Key Name
|
||||||
$row = mysqli_fetch_array(mysqli_query($mysqli,"SELECT api_key_name, api_key_client_id FROM api_keys WHERE api_key_id = $api_key_id"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT api_key_name, api_key_client_id FROM api_keys WHERE api_key_id = $api_key_id"));
|
||||||
$api_key_name = sanitizeInput($row['api_key_name']);
|
$api_key_name = sanitizeInput($row['api_key_name']);
|
||||||
$client_id = intval($row['api_key_client_id']);
|
$client_id = intval($row['api_key_client_id']);
|
||||||
|
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ if (isset($_POST['backup_master_key'])) {
|
|||||||
$password = $_POST['password'];
|
$password = $_POST['password'];
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE user_id = $session_user_id");
|
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE user_id = $session_user_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
|
|
||||||
if (password_verify($password, $row['user_password'])) {
|
if (password_verify($password, $row['user_password'])) {
|
||||||
$site_encryption_master_key = decryptUserSpecificKey($row['user_specific_encryption_ciphertext'], $password);
|
$site_encryption_master_key = decryptUserSpecificKey($row['user_specific_encryption_ciphertext'], $password);
|
||||||
@@ -329,4 +329,3 @@ if (isset($_POST['backup_master_key'])) {
|
|||||||
redirect();
|
redirect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ if (isset($_GET['archive_category'])) {
|
|||||||
|
|
||||||
// Get Category Name and Type for logging
|
// Get Category Name and Type for logging
|
||||||
$sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id");
|
$sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$category_name = sanitizeInput($row['category_name']);
|
$category_name = sanitizeInput($row['category_name']);
|
||||||
$category_type = sanitizeInput($row['category_type']);
|
$category_type = sanitizeInput($row['category_type']);
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ if (isset($_GET['unarchive_category'])) {
|
|||||||
|
|
||||||
// Get Category Name and Type for logging
|
// Get Category Name and Type for logging
|
||||||
$sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id");
|
$sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$category_name = sanitizeInput($row['category_name']);
|
$category_name = sanitizeInput($row['category_name']);
|
||||||
$category_type = sanitizeInput($row['category_type']);
|
$category_type = sanitizeInput($row['category_type']);
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ if (isset($_GET['delete_category'])) {
|
|||||||
|
|
||||||
// Get Category Name and Type for logging
|
// Get Category Name and Type for logging
|
||||||
$sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id");
|
$sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$category_name = sanitizeInput($row['category_name']);
|
$category_name = sanitizeInput($row['category_name']);
|
||||||
$category_type = sanitizeInput($row['category_type']);
|
$category_type = sanitizeInput($row['category_type']);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ if (isset($_GET['delete_custom_link'])) {
|
|||||||
|
|
||||||
// Get Custom Link name and uri for logging
|
// Get Custom Link name and uri for logging
|
||||||
$sql = mysqli_query($mysqli,"SELECT custom_link_name, custom_link_uri FROM custom_links WHERE custom_link_id = $custom_link_id");
|
$sql = mysqli_query($mysqli,"SELECT custom_link_name, custom_link_uri FROM custom_links WHERE custom_link_id = $custom_link_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$custom_link_name = sanitizeInput($row['custom_link_name']);
|
$custom_link_name = sanitizeInput($row['custom_link_name']);
|
||||||
$custom_link_uri = sanitizeInput($row['custom_link_uri']);
|
$custom_link_uri = sanitizeInput($row['custom_link_uri']);
|
||||||
|
|
||||||
|
|||||||
@@ -14,53 +14,20 @@ if (isset($_POST['add_payment_provider'])) {
|
|||||||
$public_key = sanitizeInput($_POST['public_key']);
|
$public_key = sanitizeInput($_POST['public_key']);
|
||||||
$private_key = sanitizeInput($_POST['private_key']);
|
$private_key = sanitizeInput($_POST['private_key']);
|
||||||
$threshold = floatval($_POST['threshold']);
|
$threshold = floatval($_POST['threshold']);
|
||||||
$enable_expense = intval($_POST['enable_expense'] ?? 0);
|
$account = intval($_POST['account']);
|
||||||
|
$expense_vendor = intval($_POST['expense_vendor']) ?? 0;
|
||||||
|
$expense_category = intval($_POST['expense_category']) ?? 0;
|
||||||
$percentage_fee = floatval($_POST['percentage_fee']) / 100 ?? 0;
|
$percentage_fee = floatval($_POST['percentage_fee']) / 100 ?? 0;
|
||||||
$flat_fee = floatval($_POST['flat_fee']) ?? 0;
|
$flat_fee = floatval($_POST['flat_fee']) ?? 0;
|
||||||
|
|
||||||
// Check to ensure provider isn't added twice
|
// Check to ensure provider isn't added twice
|
||||||
$sql = "SELECT 1 FROM payment_providers WHERE payment_provider_name = '$provider' LIMIT 1";
|
$sql = mysqli_query($mysqli, "SELECT 1 FROM payment_providers WHERE payment_provider_name = '$provider' LIMIT 1");
|
||||||
$result = mysqli_query($mysqli, $sql);
|
if (mysqli_num_rows($sql) > 0) {
|
||||||
if (mysqli_num_rows($result) > 0) {
|
|
||||||
flash_alert("Payment Provider <strong>$provider</strong> already exists", 'error');
|
flash_alert("Payment Provider <strong>$provider</strong> already exists", 'error');
|
||||||
redirect();
|
redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for Stripe Account, if not create it
|
mysqli_query($mysqli,"INSERT INTO payment_providers SET payment_provider_name = '$provider', payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_account = $account, payment_provider_expense_vendor = $expense_vendor, payment_provider_expense_category = $expense_category, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee");
|
||||||
$sql_account = mysqli_query($mysqli,"SELECT account_id FROM accounts WHERE account_name = '$provider' AND account_archived_at IS NULL LIMIT 1");
|
|
||||||
if (mysqli_num_rows($sql_account) == 0) {
|
|
||||||
$account_id = mysqli_insert_id($mysqli);
|
|
||||||
} else {
|
|
||||||
$row = mysqli_fetch_array($sql_account);
|
|
||||||
$account_id = intval($row['account_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expense defaults
|
|
||||||
$category_id = 0;
|
|
||||||
$vendor_id = 0;
|
|
||||||
|
|
||||||
if ($enable_expense) {
|
|
||||||
// Category
|
|
||||||
$sql_category = mysqli_query($mysqli,"SELECT category_id FROM categories WHERE category_name = 'Payment Processing' AND category_type = 'Expense' AND category_archived_at IS NULL LIMIT 1");
|
|
||||||
if (mysqli_num_rows($sql_category) == 0) {
|
|
||||||
mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Processing Fee', category_type = 'Payment Processing', category_color = 'gray'");
|
|
||||||
$category_id = mysqli_insert_id($mysqli);
|
|
||||||
} else {
|
|
||||||
$row = mysqli_fetch_array($sql_category);
|
|
||||||
$category_id = intval($row['category_id']);
|
|
||||||
}
|
|
||||||
// Vendor
|
|
||||||
$sql_vendor = mysqli_query($mysqli,"SELECT vendor_id FROM vendors WHERE vendor_name = '$provider' AND vendor_client_id = 0 AND vendor_archived_at IS NULL LIMIT 1");
|
|
||||||
if (mysqli_num_rows($sql_vendor) == 0) {
|
|
||||||
mysqli_query($mysqli,"INSERT INTO vendors SET vendor_name = '$provider', vendor_description = 'Payment Processor Provider', vendor_client_id = 0");
|
|
||||||
$vendor_id = mysqli_insert_id($mysqli);
|
|
||||||
} else {
|
|
||||||
$row = mysqli_fetch_array($sql_vendor);
|
|
||||||
$vendor_id = intval($row['vendor_id']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO payment_providers SET payment_provider_name = '$provider', payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_account = $account_id, payment_provider_expense_vendor = $vendor_id, payment_provider_expense_category = $category_id, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee");
|
|
||||||
|
|
||||||
$provider_id = mysqli_insert_id($mysqli);
|
$provider_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -81,11 +48,13 @@ if (isset($_POST['edit_payment_provider'])) {
|
|||||||
$public_key = sanitizeInput($_POST['public_key']);
|
$public_key = sanitizeInput($_POST['public_key']);
|
||||||
$private_key = sanitizeInput($_POST['private_key']);
|
$private_key = sanitizeInput($_POST['private_key']);
|
||||||
$threshold = floatval($_POST['threshold']);
|
$threshold = floatval($_POST['threshold']);
|
||||||
$enable_expense = intval($_POST['enable_expense'] ?? 0);
|
$account = intval($_POST['account']);
|
||||||
|
$expense_vendor = intval($_POST['expense_vendor']) ?? 0;
|
||||||
|
$expense_category = intval($_POST['expense_category']) ?? 0;
|
||||||
$percentage_fee = floatval($_POST['percentage_fee']) / 100;
|
$percentage_fee = floatval($_POST['percentage_fee']) / 100;
|
||||||
$flat_fee = floatval($_POST['flat_fee']);
|
$flat_fee = floatval($_POST['flat_fee']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE payment_providers SET payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee WHERE payment_provider_id = $provider_id");
|
mysqli_query($mysqli,"UPDATE payment_providers SET payment_provider_public_key = '$public_key', payment_provider_private_key = '$private_key', payment_provider_threshold = $threshold, payment_provider_account = $account, payment_provider_expense_vendor = $expense_vendor, payment_provider_expense_category = $expense_category, payment_provider_expense_percentage_fee = $percentage_fee, payment_provider_expense_flat_fee = $flat_fee WHERE payment_provider_id = $provider_id");
|
||||||
|
|
||||||
logAction("Payment Provider", "Edit", "$session_name edited Payment Provider $provider");
|
logAction("Payment Provider", "Edit", "$session_name edited Payment Provider $provider");
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,23 @@ if (isset($_POST['add_role'])) {
|
|||||||
|
|
||||||
$role_id = mysqli_insert_id($mysqli);
|
$role_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
|
// Insert role permissions (only if not admin)
|
||||||
|
if ($admin == 0) {
|
||||||
|
foreach ($_POST as $key => $value) {
|
||||||
|
if (str_contains($key, '##module_')) {
|
||||||
|
$module_id = intval(explode('##', $key)[0]);
|
||||||
|
$access_level = intval($value);
|
||||||
|
|
||||||
|
if ($access_level > 0) {
|
||||||
|
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = $role_id, module_id = $module_id, user_role_permission_level = $access_level");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logAction("User Role", "Create", "$session_name created user role $name", 0, $role_id);
|
logAction("User Role", "Create", "$session_name created user role $name", 0, $role_id);
|
||||||
|
|
||||||
flash_alert("User Role <strong$name</strong> created");
|
flash_alert("User Role <strong>$name</strong> created");
|
||||||
|
|
||||||
redirect();
|
redirect();
|
||||||
|
|
||||||
@@ -76,7 +90,7 @@ if (isset($_GET['archive_role'])) {
|
|||||||
|
|
||||||
mysqli_query($mysqli, "UPDATE user_roles SET role_archived_at = NOW() WHERE role_id = $role_id");
|
mysqli_query($mysqli, "UPDATE user_roles SET role_archived_at = NOW() WHERE role_id = $role_id");
|
||||||
|
|
||||||
$role_name = sanitizeInput(getFieldById('roles', $role_id, 'role_name'));
|
$role_name = sanitizeInput(getFieldById('user_roles', $role_id, 'role_name'));
|
||||||
|
|
||||||
logAction("User Role", "Archive", "$session_name archived user role $role_name", 0, $role_id);
|
logAction("User Role", "Archive", "$session_name archived user role $role_name", 0, $role_id);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ if (isset($_GET['delete_saved_payment'])) {
|
|||||||
WHERE client_saved_payment_methods.saved_payment_id = $saved_payment_id"
|
WHERE client_saved_payment_methods.saved_payment_id = $saved_payment_id"
|
||||||
);
|
);
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$client_id = intval($row['saved_payment_client_id']);
|
$client_id = intval($row['saved_payment_client_id']);
|
||||||
$provider_id = intval($row['saved_payment_provider_id']);
|
$provider_id = intval($row['saved_payment_provider_id']);
|
||||||
$payment_provider_name = nullable_htmlentities($row['payment_provider_name']);
|
$payment_provider_name = nullable_htmlentities($row['payment_provider_name']);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if (isset($_POST['edit_company'])) {
|
|||||||
$tax_id = sanitizeInput($_POST['tax_id']);
|
$tax_id = sanitizeInput($_POST['tax_id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT company_logo FROM companies WHERE company_id = 1");
|
$sql = mysqli_query($mysqli,"SELECT company_logo FROM companies WHERE company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$existing_file_name = sanitizeInput($row['company_logo']);
|
$existing_file_name = sanitizeInput($row['company_logo']);
|
||||||
|
|
||||||
// Company logo
|
// Company logo
|
||||||
@@ -55,7 +55,7 @@ if (isset($_POST['edit_company'])) {
|
|||||||
if (isset($_GET['remove_company_logo'])) {
|
if (isset($_GET['remove_company_logo'])) {
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT company_logo FROM companies");
|
$sql = mysqli_query($mysqli,"SELECT company_logo FROM companies");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$company_logo = $row['company_logo']; // FileSystem Operation Logo is already sanitized
|
$company_logo = $row['company_logo']; // FileSystem Operation Logo is already sanitized
|
||||||
|
|
||||||
unlink("../uploads/settings/$company_logo");
|
unlink("../uploads/settings/$company_logo");
|
||||||
|
|||||||
@@ -2,6 +2,79 @@
|
|||||||
|
|
||||||
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||||
|
|
||||||
|
if (!defined('MICROSOFT_OAUTH_BASE_URL')) {
|
||||||
|
define('MICROSOFT_OAUTH_BASE_URL', 'https://login.microsoftonline.com/');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['oauth_connect_microsoft_mail'])) {
|
||||||
|
|
||||||
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
|
|
||||||
|
// Save current IMAP/OAuth form values first so auth flow always uses latest inputs.
|
||||||
|
$config_imap_provider = sanitizeInput($_POST['config_imap_provider'] ?? '');
|
||||||
|
$config_imap_username = sanitizeInput($_POST['config_imap_username'] ?? '');
|
||||||
|
$config_mail_oauth_client_id = sanitizeInput($_POST['config_mail_oauth_client_id'] ?? '');
|
||||||
|
$config_mail_oauth_client_secret = sanitizeInput($_POST['config_mail_oauth_client_secret'] ?? '');
|
||||||
|
$config_mail_oauth_tenant_id = sanitizeInput($_POST['config_mail_oauth_tenant_id'] ?? '');
|
||||||
|
$config_mail_oauth_refresh_token = sanitizeInput($_POST['config_mail_oauth_refresh_token'] ?? '');
|
||||||
|
$config_mail_oauth_access_token = sanitizeInput($_POST['config_mail_oauth_access_token'] ?? '');
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE settings SET
|
||||||
|
config_imap_provider = '$config_imap_provider',
|
||||||
|
config_imap_username = '$config_imap_username',
|
||||||
|
config_mail_oauth_client_id = '$config_mail_oauth_client_id',
|
||||||
|
config_mail_oauth_client_secret = '$config_mail_oauth_client_secret',
|
||||||
|
config_mail_oauth_tenant_id = '$config_mail_oauth_tenant_id',
|
||||||
|
config_mail_oauth_refresh_token = '$config_mail_oauth_refresh_token',
|
||||||
|
config_mail_oauth_access_token = '$config_mail_oauth_access_token'
|
||||||
|
WHERE company_id = 1
|
||||||
|
");
|
||||||
|
|
||||||
|
if ($config_imap_provider !== 'microsoft_oauth') {
|
||||||
|
flash_alert("Please set IMAP Provider to Microsoft 365 (OAuth) before connecting.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_tenant_id)) {
|
||||||
|
flash_alert("Missing Microsoft OAuth settings. Please provide Client ID, Client Secret, and Tenant ID first.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('BASE_URL') && !empty(BASE_URL)) {
|
||||||
|
$base_url = rtrim((string) BASE_URL, '/');
|
||||||
|
} else {
|
||||||
|
$base_url = 'https://' . rtrim((string) $config_base_url, '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
$redirect_uri = $base_url . '/admin/oauth_microsoft_mail_callback.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$state = bin2hex(random_bytes(32));
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
$state = sha1(uniqid((string) mt_rand(), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['mail_oauth_state'] = $state;
|
||||||
|
$_SESSION['mail_oauth_state_expires_at'] = time() + 600;
|
||||||
|
|
||||||
|
$scope = 'offline_access openid profile https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send';
|
||||||
|
|
||||||
|
$authorize_url = MICROSOFT_OAUTH_BASE_URL . rawurlencode($config_mail_oauth_tenant_id) . '/oauth2/v2.0/authorize?'
|
||||||
|
. http_build_query([
|
||||||
|
'client_id' => $config_mail_oauth_client_id,
|
||||||
|
'response_type' => 'code',
|
||||||
|
'redirect_uri' => $redirect_uri,
|
||||||
|
'response_mode' => 'query',
|
||||||
|
'scope' => $scope,
|
||||||
|
'state' => $state,
|
||||||
|
'prompt' => 'consent',
|
||||||
|
], '', '&', PHP_QUERY_RFC3986);
|
||||||
|
|
||||||
|
logAction("Settings", "Edit", "$session_name started Microsoft OAuth connect flow for mail settings");
|
||||||
|
|
||||||
|
redirect($authorize_url);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_POST['edit_mail_smtp_settings'])) {
|
if (isset($_POST['edit_mail_smtp_settings'])) {
|
||||||
|
|
||||||
validateCSRFToken($_POST['csrf_token']);
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
@@ -163,12 +236,145 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
|
|
||||||
validateCSRFToken($_POST['csrf_token']);
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
|
|
||||||
|
$provider = sanitizeInput($config_imap_provider ?? '');
|
||||||
|
|
||||||
$host = $config_imap_host;
|
$host = $config_imap_host;
|
||||||
$port = (int) $config_imap_port;
|
$port = (int) $config_imap_port;
|
||||||
$encryption = strtolower(trim($config_imap_encryption)); // e.g. "ssl", "tls", "none"
|
$encryption = strtolower(trim($config_imap_encryption)); // e.g. "ssl", "tls", "none"
|
||||||
$username = $config_imap_username;
|
$username = $config_imap_username;
|
||||||
$password = $config_imap_password;
|
$password = $config_imap_password;
|
||||||
|
|
||||||
|
// Shared OAuth fields
|
||||||
|
$config_mail_oauth_client_id = $config_mail_oauth_client_id ?? '';
|
||||||
|
$config_mail_oauth_client_secret = $config_mail_oauth_client_secret ?? '';
|
||||||
|
$config_mail_oauth_tenant_id = $config_mail_oauth_tenant_id ?? '';
|
||||||
|
$config_mail_oauth_refresh_token = $config_mail_oauth_refresh_token ?? '';
|
||||||
|
$config_mail_oauth_access_token = $config_mail_oauth_access_token ?? '';
|
||||||
|
$config_mail_oauth_access_token_expires_at = $config_mail_oauth_access_token_expires_at ?? '';
|
||||||
|
|
||||||
|
$is_oauth = ($provider === 'google_oauth' || $provider === 'microsoft_oauth');
|
||||||
|
|
||||||
|
if ($provider === 'google_oauth') {
|
||||||
|
if (empty($host)) {
|
||||||
|
$host = 'imap.gmail.com';
|
||||||
|
}
|
||||||
|
if (empty($port)) {
|
||||||
|
$port = 993;
|
||||||
|
}
|
||||||
|
if (empty($encryption)) {
|
||||||
|
$encryption = 'ssl';
|
||||||
|
}
|
||||||
|
} elseif ($provider === 'microsoft_oauth') {
|
||||||
|
if (empty($host)) {
|
||||||
|
$host = 'outlook.office365.com';
|
||||||
|
}
|
||||||
|
if (empty($port)) {
|
||||||
|
$port = 993;
|
||||||
|
}
|
||||||
|
if (empty($encryption)) {
|
||||||
|
$encryption = 'ssl';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($host) || empty($port) || empty($username)) {
|
||||||
|
flash_alert("<strong>IMAP connection failed:</strong> Missing host, port, or username.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_is_expired = function (?string $expires_at): bool {
|
||||||
|
if (empty($expires_at)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ts = strtotime($expires_at);
|
||||||
|
|
||||||
|
if ($ts === false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($ts - 60) <= time();
|
||||||
|
};
|
||||||
|
|
||||||
|
$http_form_post = function (string $url, array $fields): array {
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields, '', '&'));
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
|
||||||
|
|
||||||
|
$raw = curl_exec($ch);
|
||||||
|
$err = curl_error($ch);
|
||||||
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ok' => ($raw !== false && $code >= 200 && $code < 300),
|
||||||
|
'body' => $raw,
|
||||||
|
'code' => $code,
|
||||||
|
'err' => $err,
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
if ($is_oauth) {
|
||||||
|
if (!empty($config_mail_oauth_access_token) && !$token_is_expired($config_mail_oauth_access_token_expires_at)) {
|
||||||
|
$password = $config_mail_oauth_access_token;
|
||||||
|
} else {
|
||||||
|
if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_refresh_token)) {
|
||||||
|
flash_alert("<strong>IMAP OAuth failed:</strong> Missing OAuth client credentials or refresh token.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($provider === 'google_oauth') {
|
||||||
|
$response = $http_form_post('https://oauth2.googleapis.com/token', [
|
||||||
|
'client_id' => $config_mail_oauth_client_id,
|
||||||
|
'client_secret' => $config_mail_oauth_client_secret,
|
||||||
|
'refresh_token' => $config_mail_oauth_refresh_token,
|
||||||
|
'grant_type' => 'refresh_token',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
if (empty($config_mail_oauth_tenant_id)) {
|
||||||
|
flash_alert("<strong>IMAP OAuth failed:</strong> Microsoft tenant ID is required.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_url = MICROSOFT_OAUTH_BASE_URL . rawurlencode($config_mail_oauth_tenant_id) . "/oauth2/v2.0/token";
|
||||||
|
$response = $http_form_post($token_url, [
|
||||||
|
'client_id' => $config_mail_oauth_client_id,
|
||||||
|
'client_secret' => $config_mail_oauth_client_secret,
|
||||||
|
'refresh_token' => $config_mail_oauth_refresh_token,
|
||||||
|
'grant_type' => 'refresh_token',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$response['ok']) {
|
||||||
|
flash_alert("<strong>IMAP OAuth failed:</strong> Could not refresh access token.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = json_decode($response['body'], true);
|
||||||
|
if (!is_array($json) || empty($json['access_token'])) {
|
||||||
|
flash_alert("<strong>IMAP OAuth failed:</strong> Token response did not include an access token.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$password = $json['access_token'];
|
||||||
|
$expires_at = date('Y-m-d H:i:s', time() + (int)($json['expires_in'] ?? 3600));
|
||||||
|
$refresh_token_to_save = $json['refresh_token'] ?? null;
|
||||||
|
|
||||||
|
$token_esc = mysqli_real_escape_string($mysqli, $password);
|
||||||
|
$expires_at_esc = mysqli_real_escape_string($mysqli, $expires_at);
|
||||||
|
|
||||||
|
$refresh_sql = '';
|
||||||
|
if (!empty($refresh_token_to_save)) {
|
||||||
|
$refresh_token_esc = mysqli_real_escape_string($mysqli, $refresh_token_to_save);
|
||||||
|
$refresh_sql = ", config_mail_oauth_refresh_token = '{$refresh_token_esc}'";
|
||||||
|
}
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE settings SET config_mail_oauth_access_token = '{$token_esc}', config_mail_oauth_access_token_expires_at = '{$expires_at_esc}'{$refresh_sql} WHERE company_id = 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Build remote socket (implicit SSL vs plain TCP)
|
// Build remote socket (implicit SSL vs plain TCP)
|
||||||
$transport = 'tcp';
|
$transport = 'tcp';
|
||||||
if ($encryption === 'ssl') {
|
if ($encryption === 'ssl') {
|
||||||
@@ -178,16 +384,16 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
$remote_socket = $transport . '://' . $host . ':' . $port;
|
$remote_socket = $transport . '://' . $host . ':' . $port;
|
||||||
|
|
||||||
// Stream context (you can tighten these if you want strict validation)
|
// Stream context (you can tighten these if you want strict validation)
|
||||||
$contextOptions = [];
|
$context_options = [];
|
||||||
if (in_array($encryption, ['ssl', 'tls'], true)) {
|
if (in_array($encryption, ['ssl', 'tls'], true)) {
|
||||||
$contextOptions['ssl'] = [
|
$context_options['ssl'] = [
|
||||||
'verify_peer' => false,
|
'verify_peer' => false,
|
||||||
'verify_peer_name' => false,
|
'verify_peer_name' => false,
|
||||||
'allow_self_signed' => true,
|
'allow_self_signed' => true,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$context = stream_context_create($contextOptions);
|
$context = stream_context_create($context_options);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$errno = 0;
|
$errno = 0;
|
||||||
@@ -215,10 +421,8 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
throw new Exception("Invalid IMAP greeting: " . trim((string) $greeting));
|
throw new Exception("Invalid IMAP greeting: " . trim((string) $greeting));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you really want STARTTLS for "tls" (port 143), you can do it here
|
// If you really want STARTTLS for "tls" (port 143), you can do it here
|
||||||
if ($encryption === 'tls' && stripos($greeting, 'STARTTLS') !== false) {
|
if ($encryption === 'tls' && stripos($greeting, 'STARTTLS') !== false) {
|
||||||
// Request STARTTLS
|
|
||||||
fwrite($fp, "A0001 STARTTLS\r\n");
|
fwrite($fp, "A0001 STARTTLS\r\n");
|
||||||
$line = fgets($fp, 1024);
|
$line = fgets($fp, 1024);
|
||||||
if ($line === false || stripos($line, 'A0001 OK') !== 0) {
|
if ($line === false || stripos($line, 'A0001 OK') !== 0) {
|
||||||
@@ -226,28 +430,31 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
throw new Exception("STARTTLS failed: " . trim((string) $line));
|
throw new Exception("STARTTLS failed: " . trim((string) $line));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable crypto on the stream
|
|
||||||
if (!stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
|
if (!stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
throw new Exception("Unable to enable TLS encryption on IMAP connection.");
|
throw new Exception("Unable to enable TLS encryption on IMAP connection.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Do LOGIN command ---
|
|
||||||
$tag = 'A0002';
|
$tag = 'A0002';
|
||||||
|
|
||||||
// Simple quoting; this may fail with some special chars in username/password.
|
if ($is_oauth) {
|
||||||
$loginCmd = sprintf(
|
$oauth_b64 = base64_encode("user={$username}\x01auth=Bearer {$password}\x01\x01");
|
||||||
|
$auth_cmd = sprintf("%s AUTHENTICATE XOAUTH2 %s\r\n", $tag, $oauth_b64);
|
||||||
|
fwrite($fp, $auth_cmd);
|
||||||
|
} else {
|
||||||
|
$login_cmd = sprintf(
|
||||||
"%s LOGIN \"%s\" \"%s\"\r\n",
|
"%s LOGIN \"%s\" \"%s\"\r\n",
|
||||||
$tag,
|
$tag,
|
||||||
addcslashes($username, "\\\""),
|
addcslashes($username, "\\\""),
|
||||||
addcslashes($password, "\\\"")
|
addcslashes($password, "\\\"")
|
||||||
);
|
);
|
||||||
|
|
||||||
fwrite($fp, $loginCmd);
|
fwrite($fp, $login_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
$success = false;
|
$success = false;
|
||||||
$errorLine = '';
|
$error_line = '';
|
||||||
|
|
||||||
while (!feof($fp)) {
|
while (!feof($fp)) {
|
||||||
$line = fgets($fp, 2048);
|
$line = fgets($fp, 2048);
|
||||||
@@ -255,12 +462,11 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for tagged response for our LOGIN
|
|
||||||
if (strpos($line, $tag . ' ') === 0) {
|
if (strpos($line, $tag . ' ') === 0) {
|
||||||
if (stripos($line, $tag . ' OK') === 0) {
|
if (stripos($line, $tag . ' OK') === 0) {
|
||||||
$success = true;
|
$success = true;
|
||||||
} else {
|
} else {
|
||||||
$errorLine = trim($line);
|
$error_line = trim($line);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -271,12 +477,16 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
flash_alert("Connected successfully");
|
if ($is_oauth) {
|
||||||
|
flash_alert("Connected successfully using OAuth");
|
||||||
} else {
|
} else {
|
||||||
if (!$errorLine) {
|
flash_alert("Connected successfully");
|
||||||
$errorLine = 'Unknown IMAP authentication error';
|
|
||||||
}
|
}
|
||||||
throw new Exception($errorLine);
|
} else {
|
||||||
|
if (!$error_line) {
|
||||||
|
$error_line = 'Unknown IMAP authentication error';
|
||||||
|
}
|
||||||
|
throw new Exception($error_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -285,3 +495,88 @@ if (isset($_POST['test_email_imap'])) {
|
|||||||
|
|
||||||
redirect();
|
redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($_POST['test_oauth_token_refresh'])) {
|
||||||
|
|
||||||
|
validateCSRFToken($_POST['csrf_token']);
|
||||||
|
|
||||||
|
$provider = sanitizeInput($_POST['oauth_provider'] ?? '');
|
||||||
|
|
||||||
|
if ($provider !== 'google_oauth' && $provider !== 'microsoft_oauth') {
|
||||||
|
flash_alert("OAuth token test failed: unsupported provider.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$oauth_client_id = sanitizeInput($config_mail_oauth_client_id ?? '');
|
||||||
|
$oauth_client_secret = sanitizeInput($config_mail_oauth_client_secret ?? '');
|
||||||
|
$oauth_tenant_id = sanitizeInput($config_mail_oauth_tenant_id ?? '');
|
||||||
|
$oauth_refresh_token = sanitizeInput($config_mail_oauth_refresh_token ?? '');
|
||||||
|
|
||||||
|
if (empty($oauth_client_id) || empty($oauth_client_secret) || empty($oauth_refresh_token)) {
|
||||||
|
flash_alert("OAuth token test failed: missing client ID, client secret, or refresh token.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($provider === 'microsoft_oauth' && empty($oauth_tenant_id)) {
|
||||||
|
flash_alert("OAuth token test failed: Microsoft tenant ID is required.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_url = 'https://oauth2.googleapis.com/token';
|
||||||
|
if ($provider === 'microsoft_oauth') {
|
||||||
|
$token_url = MICROSOFT_OAUTH_BASE_URL . rawurlencode($oauth_tenant_id) . "/oauth2/v2.0/token";
|
||||||
|
}
|
||||||
|
|
||||||
|
$post_fields = http_build_query([
|
||||||
|
'client_id' => $oauth_client_id,
|
||||||
|
'client_secret' => $oauth_client_secret,
|
||||||
|
'refresh_token' => $oauth_refresh_token,
|
||||||
|
'grant_type' => 'refresh_token',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$ch = curl_init($token_url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
|
||||||
|
|
||||||
|
$raw_body = curl_exec($ch);
|
||||||
|
$curl_err = curl_error($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($raw_body === false || $http_code < 200 || $http_code >= 300) {
|
||||||
|
$err_msg = !empty($curl_err) ? $curl_err : "HTTP $http_code";
|
||||||
|
flash_alert("OAuth token test failed: $err_msg", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$json = json_decode($raw_body, true);
|
||||||
|
|
||||||
|
if (!is_array($json) || empty($json['access_token'])) {
|
||||||
|
flash_alert("OAuth token test failed: access token missing in provider response.", 'error');
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_access_token = sanitizeInput($json['access_token']);
|
||||||
|
$new_expires_at = date('Y-m-d H:i:s', time() + (int)($json['expires_in'] ?? 3600));
|
||||||
|
$new_refresh_token = !empty($json['refresh_token']) ? sanitizeInput($json['refresh_token']) : '';
|
||||||
|
|
||||||
|
$new_access_token_esc = mysqli_real_escape_string($mysqli, $new_access_token);
|
||||||
|
$new_expires_at_esc = mysqli_real_escape_string($mysqli, $new_expires_at);
|
||||||
|
|
||||||
|
$refresh_sql = '';
|
||||||
|
if (!empty($new_refresh_token)) {
|
||||||
|
$new_refresh_token_esc = mysqli_real_escape_string($mysqli, $new_refresh_token);
|
||||||
|
$refresh_sql = ", config_mail_oauth_refresh_token = '$new_refresh_token_esc'";
|
||||||
|
}
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE settings SET config_mail_oauth_access_token = '$new_access_token_esc', config_mail_oauth_access_token_expires_at = '$new_expires_at_esc'$refresh_sql WHERE company_id = 1");
|
||||||
|
|
||||||
|
$provider_label = $provider === 'microsoft_oauth' ? 'Microsoft 365' : 'Google Workspace';
|
||||||
|
logAction("Settings", "Edit", "$session_name tested OAuth token refresh for $provider_label mail settings");
|
||||||
|
|
||||||
|
flash_alert("OAuth token refresh successful for $provider_label. Access token expires at $new_expires_at.");
|
||||||
|
redirect();
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if (isset($_GET['stripe_remove_pm'])) {
|
|||||||
// Remove Auto Pay on recurring invoices that are stripe
|
// Remove Auto Pay on recurring invoices that are stripe
|
||||||
$sql_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id FROM recurring_invoices WHERE recurring_invoice_client_id = $client_id");
|
$sql_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id FROM recurring_invoices WHERE recurring_invoice_client_id = $client_id");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_recurring_invoices)) {
|
while ($row = mysqli_fetch_assoc($sql_recurring_invoices)) {
|
||||||
$recurring_invoice_id = intval($row['recurring_invoice_id']);
|
$recurring_invoice_id = intval($row['recurring_invoice_id']);
|
||||||
mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_method = 'Stripe' AND recurring_payment_recurring_invoice_id = $recurring_invoice_id");
|
mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_method = 'Stripe' AND recurring_payment_recurring_invoice_id = $recurring_invoice_id");
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ if (isset($_GET['stripe_reset_customer'])) {
|
|||||||
// Remove Auto Pay on recurring invoices that are stripe
|
// Remove Auto Pay on recurring invoices that are stripe
|
||||||
$sql_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id FROM recurring_invoices WHERE recurring_invoice_client_id = $client_id");
|
$sql_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id FROM recurring_invoices WHERE recurring_invoice_client_id = $client_id");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_recurring_invoices)) {
|
while ($row = mysqli_fetch_assoc($sql_recurring_invoices)) {
|
||||||
$recurring_invoice_id = intval($row['recurring_invoice_id']);
|
$recurring_invoice_id = intval($row['recurring_invoice_id']);
|
||||||
mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_method = 'Stripe' AND recurring_payment_recurring_invoice_id = $recurring_invoice_id");
|
mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_method = 'Stripe' AND recurring_payment_recurring_invoice_id = $recurring_invoice_id");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,3 +49,17 @@ if (isset($_POST['edit_favicon_settings'])) {
|
|||||||
redirect();
|
redirect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['reset_favicon'])) {
|
||||||
|
|
||||||
|
if (file_exists("../uploads/favicon.ico")) {
|
||||||
|
unlink("../uploads/favicon.ico");
|
||||||
|
}
|
||||||
|
|
||||||
|
logAction("Settings", "Edit", "$session_name reset Favicon");
|
||||||
|
|
||||||
|
flash_alert("Favicon reset", 'error');
|
||||||
|
|
||||||
|
redirect();
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ if (isset($_GET['delete_software_template'])) {
|
|||||||
|
|
||||||
// Get Software Template Name for logging and alert message
|
// Get Software Template Name for logging and alert message
|
||||||
$sql = mysqli_query($mysqli,"SELECT software_template_name FROM software_templates WHERE software_template_id = $software_template_id");
|
$sql = mysqli_query($mysqli,"SELECT software_template_name FROM software_templates WHERE software_template_id = $software_template_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$software_template_name = sanitizeInput($row['software_template_name']);
|
$software_template_name = sanitizeInput($row['software_template_name']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"DELETE FROM software_templates WHERE software_template_id = $software_template_id");
|
mysqli_query($mysqli,"DELETE FROM software_templates WHERE software_template_id = $software_template_id");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ if (isset($_GET['update'])) {
|
|||||||
if ($config_telemetry > 0 OR $config_telemetry = 2) {
|
if ($config_telemetry > 0 OR $config_telemetry = 2) {
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
|
|
||||||
$company_name = sanitizeInput($row['company_name']);
|
$company_name = sanitizeInput($row['company_name']);
|
||||||
$website = sanitizeInput($row['company_website']);
|
$website = sanitizeInput($row['company_website']);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ if (isset($_POST['add_user'])) {
|
|||||||
mysqli_query($mysqli, "INSERT INTO user_settings SET user_id = $user_id, user_config_force_mfa = $force_mfa");
|
mysqli_query($mysqli, "INSERT INTO user_settings SET user_id = $user_id, user_config_force_mfa = $force_mfa");
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$company_name = sanitizeInput($row['company_name']);
|
$company_name = sanitizeInput($row['company_name']);
|
||||||
|
|
||||||
// Sanitize Config vars from load_global_settings.php
|
// Sanitize Config vars from load_global_settings.php
|
||||||
@@ -118,7 +118,7 @@ if (isset($_POST['edit_user'])) {
|
|||||||
|
|
||||||
// Get current Avatar
|
// Get current Avatar
|
||||||
$sql = mysqli_query($mysqli, "SELECT user_avatar FROM users WHERE user_id = $user_id");
|
$sql = mysqli_query($mysqli, "SELECT user_avatar FROM users WHERE user_id = $user_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$existing_file_name = sanitizeInput($row['user_avatar']);
|
$existing_file_name = sanitizeInput($row['user_avatar']);
|
||||||
|
|
||||||
$extended_log_description = '';
|
$extended_log_description = '';
|
||||||
@@ -353,7 +353,7 @@ if (isset($_POST['ir_reset_user_password'])) {
|
|||||||
// Confirm logged-in user password, for security
|
// Confirm logged-in user password, for security
|
||||||
$admin_password = $_POST['admin_password'];
|
$admin_password = $_POST['admin_password'];
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE user_id = $session_user_id");
|
$sql = mysqli_query($mysqli, "SELECT * FROM users WHERE user_id = $session_user_id");
|
||||||
$userRow = mysqli_fetch_array($sql);
|
$userRow = mysqli_fetch_assoc($sql);
|
||||||
|
|
||||||
if (!password_verify($admin_password, $userRow['user_password'])) {
|
if (!password_verify($admin_password, $userRow['user_password'])) {
|
||||||
flash_alert("Incorrect password.", 'error');
|
flash_alert("Incorrect password.", 'error');
|
||||||
@@ -364,7 +364,7 @@ if (isset($_POST['ir_reset_user_password'])) {
|
|||||||
$sql_users = mysqli_query($mysqli, "SELECT * FROM users WHERE (user_archived_at IS NULL AND user_id != $session_user_id)");
|
$sql_users = mysqli_query($mysqli, "SELECT * FROM users WHERE (user_archived_at IS NULL AND user_id != $session_user_id)");
|
||||||
|
|
||||||
// Reset passwords
|
// Reset passwords
|
||||||
while ($row = mysqli_fetch_array($sql_users)) {
|
while ($row = mysqli_fetch_assoc($sql_users)) {
|
||||||
$user_id = intval($row['user_id']);
|
$user_id = intval($row['user_id']);
|
||||||
$user_email = sanitizeInput($row['user_email']);
|
$user_email = sanitizeInput($row['user_email']);
|
||||||
$new_password = randomString();
|
$new_password = randomString();
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while($row = mysqli_fetch_array($sql)){
|
while($row = mysqli_fetch_assoc($sql)){
|
||||||
$project_template_id = intval($row['project_template_id']);
|
$project_template_id = intval($row['project_template_id']);
|
||||||
$project_template_name = nullable_htmlentities($row['project_template_name']);
|
$project_template_name = nullable_htmlentities($row['project_template_name']);
|
||||||
$project_template_description = nullable_htmlentities($row['project_template_description']);
|
$project_template_description = nullable_htmlentities($row['project_template_description']);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if (isset($_GET['project_template_id'])) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_project_templates);
|
$row = mysqli_fetch_assoc($sql_project_templates);
|
||||||
|
|
||||||
$project_template_name = nullable_htmlentities($row['project_template_name']);
|
$project_template_name = nullable_htmlentities($row['project_template_name']);
|
||||||
$project_template_description = nullable_htmlentities($row['project_template_description']);
|
$project_template_description = nullable_htmlentities($row['project_template_description']);
|
||||||
@@ -143,7 +143,7 @@ if (isset($_GET['project_template_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_ticket_templates)) {
|
while ($row = mysqli_fetch_assoc($sql_ticket_templates)) {
|
||||||
$ticket_template_id = intval($row['ticket_template_id']);
|
$ticket_template_id = intval($row['ticket_template_id']);
|
||||||
$ticket_template_order = intval($row['ticket_template_order']);
|
$ticket_template_order = intval($row['ticket_template_order']);
|
||||||
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
||||||
@@ -199,7 +199,7 @@ if (isset($_GET['project_template_id'])) {
|
|||||||
<h5 class="text-secondary"><i class="fas fa-fw fa-tasks mr-2"></i>Project Task Templates</h5>
|
<h5 class="text-secondary"><i class="fas fa-fw fa-tasks mr-2"></i>Project Task Templates</h5>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<?php
|
<?php
|
||||||
while($row = mysqli_fetch_array($sql_task_templates)){
|
while($row = mysqli_fetch_assoc($sql_task_templates)){
|
||||||
$task_template_id = intval($row['task_template_id']);
|
$task_template_id = intval($row['task_template_id']);
|
||||||
$task_template_name = nullable_htmlentities($row['task_template_name']);
|
$task_template_name = nullable_htmlentities($row['task_template_name']);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$role_id = intval($row['role_id']);
|
$role_id = intval($row['role_id']);
|
||||||
$role_name = nullable_htmlentities($row['role_name']);
|
$role_name = nullable_htmlentities($row['role_name']);
|
||||||
$role_description = nullable_htmlentities($row['role_description']);
|
$role_description = nullable_htmlentities($row['role_description']);
|
||||||
|
|||||||
@@ -33,6 +33,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<ol class="breadcrumb d-print-none">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="/admin">Admin</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="payment_provider.php">Payment Providers</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active">Saved Payment Methods (Stripe)</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><i class="fas fa-fw fa-credit-card mr-2"></i>Saved Payment Methods</h3>
|
<h3 class="card-title"><i class="fas fa-fw fa-credit-card mr-2"></i>Saved Payment Methods</h3>
|
||||||
@@ -94,7 +104,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$saved_payment_id = intval($row['saved_payment_id']);
|
$saved_payment_id = intval($row['saved_payment_id']);
|
||||||
$client_id = intval($row['saved_payment_client_id']);
|
$client_id = intval($row['saved_payment_client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
@@ -107,8 +117,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $client_name; ?> (<?php echo $client_id; ?>)</td>
|
<td>
|
||||||
<td><?php echo $provider_name; ?> (<?php echo $provider_id; ?>)</td>
|
<?= $client_name ?>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary">ID: <?= $client_id ?></small>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $provider_name ?>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary">ID: <?= $provider_id ?></small>
|
||||||
|
</td>
|
||||||
<td><?php echo $saved_payment_description; ?></td>
|
<td><?php echo $saved_payment_description; ?></td>
|
||||||
<td><?php echo $provider_client; ?></td>
|
<td><?php echo $provider_client; ?></td>
|
||||||
<td><?php echo $provider_payment_method; ?></td>
|
<td><?php echo $provider_payment_method; ?></td>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
|
$sql = mysqli_query($mysqli,"SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$company_id = intval($row['company_id']);
|
$company_id = intval($row['company_id']);
|
||||||
$company_name = nullable_htmlentities($row['company_name']);
|
$company_name = nullable_htmlentities($row['company_name']);
|
||||||
$company_country = nullable_htmlentities($row['company_country']);
|
$company_country = nullable_htmlentities($row['company_country']);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$custom_field_id = intval($row['custom_field_id']);
|
$custom_field_id = intval($row['custom_field_id']);
|
||||||
$custom_field_label = nullable_htmlentities($row['custom_field_label']);
|
$custom_field_label = nullable_htmlentities($row['custom_field_label']);
|
||||||
$custom_field_type = nullable_htmlentities($row['custom_field_type']);
|
$custom_field_type = nullable_htmlentities($row['custom_field_type']);
|
||||||
@@ -118,4 +118,3 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
require_once "custom_field_create_modal.php";
|
require_once "custom_field_create_modal.php";
|
||||||
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars ORDER BY calendar_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendars ORDER BY calendar_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$calendar_id = intval($row['calendar_id']);
|
$calendar_id = intval($row['calendar_id']);
|
||||||
$calendar_name = nullable_htmlentities($row['calendar_name']); ?>
|
$calendar_name = nullable_htmlentities($row['calendar_name']); ?>
|
||||||
<option <?php if ($config_default_calendar == $calendar_id) {
|
<option <?php if ($config_default_calendar == $calendar_id) {
|
||||||
@@ -65,7 +65,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$account_id = intval($row['account_id']);
|
$account_id = intval($row['account_id']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']); ?>
|
$account_name = nullable_htmlentities($row['account_name']); ?>
|
||||||
<option <?php if ($config_default_transfer_from_account == $account_id) {
|
<option <?php if ($config_default_transfer_from_account == $account_id) {
|
||||||
@@ -88,7 +88,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$account_id = intval($row['account_id']);
|
$account_id = intval($row['account_id']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']); ?>
|
$account_name = nullable_htmlentities($row['account_name']); ?>
|
||||||
<option <?php if ($config_default_transfer_to_account == $account_id) {
|
<option <?php if ($config_default_transfer_to_account == $account_id) {
|
||||||
@@ -111,7 +111,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$account_id = intval($row['account_id']);
|
$account_id = intval($row['account_id']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']); ?>
|
$account_name = nullable_htmlentities($row['account_name']); ?>
|
||||||
<option <?php if ($config_default_payment_account == $account_id) {
|
<option <?php if ($config_default_payment_account == $account_id) {
|
||||||
@@ -136,7 +136,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$account_id = intval($row['account_id']);
|
$account_id = intval($row['account_id']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']); ?>
|
$account_name = nullable_htmlentities($row['account_name']); ?>
|
||||||
<option <?php if ($config_default_expense_account == $account_id) {
|
<option <?php if ($config_default_expense_account == $account_id) {
|
||||||
@@ -159,7 +159,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' ORDER BY category_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' ORDER BY category_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$payment_method = nullable_htmlentities($row['category_name']); ?>
|
$payment_method = nullable_htmlentities($row['category_name']); ?>
|
||||||
<option <?php if ($config_default_payment_method == $payment_method) {
|
<option <?php if ($config_default_payment_method == $payment_method) {
|
||||||
echo "selected";
|
echo "selected";
|
||||||
@@ -181,7 +181,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' ORDER BY category_name ASC");
|
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Payment Method' ORDER BY category_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$payment_method = nullable_htmlentities($row['category_name']); ?>
|
$payment_method = nullable_htmlentities($row['category_name']); ?>
|
||||||
<option <?php if ($config_default_expense_payment_method == $payment_method) {
|
<option <?php if ($config_default_expense_payment_method == $payment_method) {
|
||||||
echo "selected";
|
echo "selected";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
|
$sql = mysqli_query($mysqli,"SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$company_locale = nullable_htmlentities($row['company_locale']);
|
$company_locale = nullable_htmlentities($row['company_locale']);
|
||||||
$company_currency = nullable_htmlentities($row['company_currency']);
|
$company_currency = nullable_htmlentities($row['company_currency']);
|
||||||
|
|
||||||
@@ -76,4 +76,3 @@ $timezones = DateTimeZone::listIdentifiers();
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -243,6 +243,32 @@ require_once "includes/inc_all_admin.php";
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (defined('BASE_URL') && !empty(BASE_URL)) {
|
||||||
|
$mail_oauth_callback_uri = rtrim((string) BASE_URL, '/') . '/admin/oauth_microsoft_mail_callback.php';
|
||||||
|
} else {
|
||||||
|
$mail_oauth_callback_uri = 'https://' . rtrim((string) $config_base_url, '/') . '/admin/oauth_microsoft_mail_callback.php';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Microsoft OAuth Connect (Web)</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-link"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" readonly value="<?php echo htmlspecialchars($mail_oauth_callback_uri); ?>">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button type="submit" name="oauth_connect_microsoft_mail" class="btn btn-outline-primary">
|
||||||
|
<i class="fas fa-fw fa-sign-in-alt mr-2"></i>Connect Microsoft 365
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<small class="text-secondary">
|
||||||
|
Add this callback URI in Entra App Registration, then click Connect to authorize and store refresh token automatically.
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button type="submit" name="edit_mail_imap_settings" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_mail_imap_settings" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||||
@@ -359,7 +385,22 @@ require_once "includes/inc_all_admin.php";
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (!empty($config_smtp_host) && !empty($config_smtp_port) && !empty($config_mail_from_email) && !empty($config_mail_from_name)) { ?>
|
<?php
|
||||||
|
$smtp_standard_ready = !empty($config_smtp_host)
|
||||||
|
&& !empty($config_smtp_port)
|
||||||
|
&& !empty($config_mail_from_email)
|
||||||
|
&& !empty($config_mail_from_name);
|
||||||
|
|
||||||
|
$smtp_oauth_ready = ($config_smtp_provider === 'google_oauth' || $config_smtp_provider === 'microsoft_oauth')
|
||||||
|
&& !empty($config_mail_from_email)
|
||||||
|
&& !empty($config_mail_from_name)
|
||||||
|
&& !empty($config_mail_oauth_client_id)
|
||||||
|
&& !empty($config_mail_oauth_client_secret)
|
||||||
|
&& !empty($config_mail_oauth_refresh_token)
|
||||||
|
&& ($config_smtp_provider !== 'microsoft_oauth' || !empty($config_mail_oauth_tenant_id));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ($smtp_standard_ready || $smtp_oauth_ready) { ?>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-3">
|
<div class="card-header py-3">
|
||||||
@@ -409,7 +450,21 @@ require_once "includes/inc_all_admin.php";
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (!empty($config_imap_username) && !empty($config_imap_password) && !empty($config_imap_host) && !empty($config_imap_port)) { ?>
|
<?php
|
||||||
|
$imap_standard_ready = !empty($config_imap_username)
|
||||||
|
&& !empty($config_imap_password)
|
||||||
|
&& !empty($config_imap_host)
|
||||||
|
&& !empty($config_imap_port);
|
||||||
|
|
||||||
|
$imap_oauth_ready = ($config_imap_provider === 'google_oauth' || $config_imap_provider === 'microsoft_oauth')
|
||||||
|
&& !empty($config_imap_username)
|
||||||
|
&& !empty($config_mail_oauth_client_id)
|
||||||
|
&& !empty($config_mail_oauth_client_secret)
|
||||||
|
&& !empty($config_mail_oauth_refresh_token)
|
||||||
|
&& ($config_imap_provider !== 'microsoft_oauth' || !empty($config_mail_oauth_tenant_id));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ($imap_standard_ready || $imap_oauth_ready) { ?>
|
||||||
|
|
||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header py-3">
|
<div class="card-header py-3">
|
||||||
@@ -428,6 +483,46 @@ require_once "includes/inc_all_admin.php";
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$oauth_provider_for_test = '';
|
||||||
|
if ($config_imap_provider === 'google_oauth' || $config_imap_provider === 'microsoft_oauth') {
|
||||||
|
$oauth_provider_for_test = $config_imap_provider;
|
||||||
|
} elseif ($config_smtp_provider === 'google_oauth' || $config_smtp_provider === 'microsoft_oauth') {
|
||||||
|
$oauth_provider_for_test = $config_smtp_provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oauth_has_required_fields = !empty($oauth_provider_for_test)
|
||||||
|
&& !empty($config_mail_oauth_client_id)
|
||||||
|
&& !empty($config_mail_oauth_client_secret)
|
||||||
|
&& !empty($config_mail_oauth_refresh_token)
|
||||||
|
&& ($oauth_provider_for_test !== 'microsoft_oauth' || !empty($config_mail_oauth_tenant_id));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if ($oauth_has_required_fields) { ?>
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-header py-3">
|
||||||
|
<h3 class="card-title"><i class="fas fa-fw fa-key mr-2"></i>Test OAuth Token Refresh</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
|
<input type="hidden" name="oauth_provider" value="<?php echo htmlspecialchars($oauth_provider_for_test); ?>">
|
||||||
|
|
||||||
|
<p class="text-secondary mb-3">
|
||||||
|
This validates your refresh token and stores a new access token for
|
||||||
|
<?php echo $oauth_provider_for_test === 'microsoft_oauth' ? 'Microsoft 365' : 'Google Workspace'; ?>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<button type="submit" name="test_oauth_token_refresh" class="btn btn-success">
|
||||||
|
<i class="fas fa-fw fa-sync-alt mr-2"></i>Test OAuth Token Refresh
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function(){
|
(function(){
|
||||||
function setDisabled(container, disabled){
|
function setDisabled(container, disabled){
|
||||||
|
|||||||
@@ -57,11 +57,12 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<button type="submit" name="edit_favicon_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Upload Icon</button>
|
<button type="submit" name="edit_favicon_settings" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Upload Icon</button>
|
||||||
|
<?php if(file_exists("../uploads/favicon.ico")) { ?>
|
||||||
|
<a href="post.php?reset_favicon" class="btn btn-outline-danger"><i class="fas fa-redo-alt mr-2"></i>Reset Favicon</a>
|
||||||
|
<?php } ?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ require_once "includes/inc_all_admin.php";
|
|||||||
<label>Kanban Settings</label>
|
<label>Kanban Settings</label>
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input type="checkbox" class="custom-control-input" name="config_ticket_ordering" <?php if ($config_ticket_ordering == 1) { echo "checked"; } ?> value="1" id="ticketOrderingSwitch">
|
<input type="checkbox" class="custom-control-input" name="config_ticket_ordering" <?php if ($config_ticket_ordering == 1) { echo "checked"; } ?> value="1" id="ticketOrderingSwitch">
|
||||||
<label class="custom-control-label" for="ticketOrderingSwitch">Allow ticket ordering within its column<small class="text-secondary">(uncheked will result in ordering it by priority and id)</small></label>
|
<label class="custom-control-label" for="ticketOrderingSwitch">Allow ticket ordering within its column<small class="text-secondary"> (unchecked = order by priority and id)</small></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input type="checkbox" class="custom-control-input" name="config_ticket_moving_columns" <?php if ($config_ticket_moving_columns == 1) { echo "checked"; } ?> value="1" id="ticketMovingColumnsSwitch">
|
<input type="checkbox" class="custom-control-input" name="config_ticket_moving_columns" <?php if ($config_ticket_moving_columns == 1) { echo "checked"; } ?> value="1" id="ticketMovingColumnsSwitch">
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while($row = mysqli_fetch_array($sql)){
|
while($row = mysqli_fetch_assoc($sql)){
|
||||||
$software_template_id = intval($row['software_template_id']);
|
$software_template_id = intval($row['software_template_id']);
|
||||||
$software_template_name = nullable_htmlentities($row['software_template_name']);
|
$software_template_name = nullable_htmlentities($row['software_template_name']);
|
||||||
$software_template_version = nullable_htmlentities($row['software_template_version']);
|
$software_template_version = nullable_htmlentities($row['software_template_version']);
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$tag_id = intval($row['tag_id']);
|
$tag_id = intval($row['tag_id']);
|
||||||
$tag_name = nullable_htmlentities($row['tag_name']);
|
$tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
$tag_color = nullable_htmlentities($row['tag_color']);
|
$tag_color = nullable_htmlentities($row['tag_color']);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ $num_rows = mysqli_num_rows($sql);
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$tax_id = intval($row['tax_id']);
|
$tax_id = intval($row['tax_id']);
|
||||||
$tax_name = nullable_htmlentities($row['tax_name']);
|
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||||
$tax_percent = floatval($row['tax_percent']);
|
$tax_percent = floatval($row['tax_percent']);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$ticket_status_id = intval($row['ticket_status_id']);
|
$ticket_status_id = intval($row['ticket_status_id']);
|
||||||
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
$ticket_status_name = nullable_htmlentities($row['ticket_status_name']);
|
||||||
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
$ticket_status_color = nullable_htmlentities($row['ticket_status_color']);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while($row = mysqli_fetch_array($sql)){
|
while($row = mysqli_fetch_assoc($sql)){
|
||||||
$ticket_template_id = intval($row['ticket_template_id']);
|
$ticket_template_id = intval($row['ticket_template_id']);
|
||||||
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
||||||
$ticket_template_description = nullable_htmlentities($row['ticket_template_description']);
|
$ticket_template_description = nullable_htmlentities($row['ticket_template_description']);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if (mysqli_num_rows($sql_ticket_template) == 0) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_ticket_template);
|
$row = mysqli_fetch_assoc($sql_ticket_template);
|
||||||
|
|
||||||
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
|
||||||
$ticket_template_description = nullable_htmlentities($row['ticket_template_description']);
|
$ticket_template_description = nullable_htmlentities($row['ticket_template_description']);
|
||||||
@@ -98,7 +98,7 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||||||
</form>
|
</form>
|
||||||
<table class="table table-sm" id="tasks">
|
<table class="table table-sm" id="tasks">
|
||||||
<?php
|
<?php
|
||||||
while($row = mysqli_fetch_array($sql_task_templates)){
|
while($row = mysqli_fetch_assoc($sql_task_templates)){
|
||||||
$task_id = intval($row['task_template_id']);
|
$task_id = intval($row['task_template_id']);
|
||||||
$task_name = nullable_htmlentities($row['task_template_name']);
|
$task_name = nullable_htmlentities($row['task_template_name']);
|
||||||
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||||
|
|||||||
@@ -33,9 +33,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<!--<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/user/user_invite.php"><i class="fas fa-paper-plane mr-2"></i>Invite User</a>-->
|
<!--<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/user/user_invite.php"><i class="fas fa-paper-plane mr-2"></i>Invite User</a>-->
|
||||||
<?php if ($num_rows[0] > 1) { ?>
|
<?php if ($num_rows[0] > 1) { ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportUserModal"><i class="fa fa-fw fa-download mr-2"></i>Export</a>
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/user/user_export.php">
|
||||||
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger ajax-modal" href="#" data-modal-url="modals/user/user_all_reset_password.php" data-modal-size="lg"><i class="fas fa-skull-crossbones mr-2"></i>IR</a>
|
<a class="dropdown-item text-danger ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/user/user_all_reset_password.php"
|
||||||
|
data-modal-size="lg">
|
||||||
|
<i class="fas fa-skull-crossbones mr-2"></i>IR
|
||||||
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -97,7 +104,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$user_id = intval($row['user_id']);
|
$user_id = intval($row['user_id']);
|
||||||
$user_name = nullable_htmlentities($row['user_name']);
|
$user_name = nullable_htmlentities($row['user_name']);
|
||||||
$user_email = nullable_htmlentities($row['user_email']);
|
$user_email = nullable_htmlentities($row['user_email']);
|
||||||
@@ -132,7 +139,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
if (mysqli_num_rows($sql_last_login) == 0) {
|
if (mysqli_num_rows($sql_last_login) == 0) {
|
||||||
$last_login = "<span class='text-bold'>Never logged in</span>";
|
$last_login = "<span class='text-bold'>Never logged in</span>";
|
||||||
} else {
|
} else {
|
||||||
$row = mysqli_fetch_array($sql_last_login);
|
$row = mysqli_fetch_assoc($sql_last_login);
|
||||||
$log_created_at = nullable_htmlentities($row['log_created_at']);
|
$log_created_at = nullable_htmlentities($row['log_created_at']);
|
||||||
$log_ip = nullable_htmlentities($row['log_ip']);
|
$log_ip = nullable_htmlentities($row['log_ip']);
|
||||||
$log_user_agent = nullable_htmlentities($row['log_user_agent']);
|
$log_user_agent = nullable_htmlentities($row['log_user_agent']);
|
||||||
@@ -235,5 +242,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/user/user_export.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$vendor_template_id = intval($row['vendor_template_id']);
|
$vendor_template_id = intval($row['vendor_template_id']);
|
||||||
$vendor_template_name = nullable_htmlentities($row['vendor_template_name']);
|
$vendor_template_name = nullable_htmlentities($row['vendor_template_name']);
|
||||||
$vendor_template_description = nullable_htmlentities($row['vendor_template_description']);
|
$vendor_template_description = nullable_htmlentities($row['vendor_template_description']);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$account_id = intval($row['account_id']);
|
$account_id = intval($row['account_id']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']);
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
$opening_balance = floatval($row['opening_balance']);
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
@@ -67,15 +67,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$account_notes = nullable_htmlentities($row['account_notes']);
|
$account_notes = nullable_htmlentities($row['account_notes']);
|
||||||
|
|
||||||
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_assoc($sql_payments);
|
||||||
$total_payments = floatval($row['total_payments']);
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_assoc($sql_revenues);
|
||||||
$total_revenues = floatval($row['total_revenues']);
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_assoc($sql_expenses);
|
||||||
$total_expenses = floatval($row['total_expenses']);
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
|
|||||||
@@ -40,31 +40,6 @@ if (isset($_GET['certificate_fetch_parse_json_details'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Looks up info on the ticket number provided, used to populate the ticket merge modal
|
|
||||||
*/
|
|
||||||
if (isset($_GET['merge_ticket_get_json_details'])) {
|
|
||||||
enforceUserPermission('module_support');
|
|
||||||
|
|
||||||
$merge_into_ticket_number = intval($_GET['merge_into_ticket_number']);
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_number, ticket_prefix, ticket_subject, ticket_priority, ticket_status, ticket_status_name, client_name, contact_name FROM tickets
|
|
||||||
LEFT JOIN clients ON ticket_client_id = client_id
|
|
||||||
LEFT JOIN contacts ON ticket_contact_id = contact_id
|
|
||||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
|
||||||
WHERE ticket_number = $merge_into_ticket_number");
|
|
||||||
|
|
||||||
if (mysqli_num_rows($sql) == 0) {
|
|
||||||
//Do nothing.
|
|
||||||
echo "No ticket found!";
|
|
||||||
} else {
|
|
||||||
//Return ticket, client and contact details for the given ticket number
|
|
||||||
$response = mysqli_fetch_array($sql);
|
|
||||||
|
|
||||||
echo json_encode($response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST['client_set_notes'])) {
|
if (isset($_POST['client_set_notes'])) {
|
||||||
enforceUserPermission('module_client', 2);
|
enforceUserPermission('module_client', 2);
|
||||||
|
|
||||||
@@ -89,7 +64,7 @@ if (isset($_POST['contact_set_notes'])) {
|
|||||||
$sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id
|
$sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id
|
||||||
FROM contacts WHERE contact_id = $contact_id"
|
FROM contacts WHERE contact_id = $contact_id"
|
||||||
);
|
);
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$contact_name = sanitizeInput($row['contact_name']);
|
$contact_name = sanitizeInput($row['contact_name']);
|
||||||
$client_id = intval($row['contact_client_id']);
|
$client_id = intval($row['contact_client_id']);
|
||||||
|
|
||||||
@@ -111,7 +86,7 @@ if (isset($_POST['asset_set_notes'])) {
|
|||||||
$sql = mysqli_query($mysqli,"SELECT asset_name, asset_client_id
|
$sql = mysqli_query($mysqli,"SELECT asset_name, asset_client_id
|
||||||
FROM assets WHERE asset_id = $asset_id"
|
FROM assets WHERE asset_id = $asset_id"
|
||||||
);
|
);
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$asset_name = sanitizeInput($row['asset_name']);
|
$asset_name = sanitizeInput($row['asset_name']);
|
||||||
$client_id = intval($row['asset_client_id']);
|
$client_id = intval($row['asset_client_id']);
|
||||||
|
|
||||||
@@ -143,7 +118,7 @@ if (isset($_GET['ticket_query_views'])) {
|
|||||||
$ticket_id = intval($_GET['ticket_id']);
|
$ticket_id = intval($_GET['ticket_id']);
|
||||||
|
|
||||||
$query = mysqli_query($mysqli, "SELECT user_name FROM ticket_views LEFT JOIN users ON view_user_id = user_id WHERE view_ticket_id = $ticket_id AND view_user_id != $session_user_id AND view_timestamp > DATE_SUB(NOW(), INTERVAL 2 MINUTE)");
|
$query = mysqli_query($mysqli, "SELECT user_name FROM ticket_views LEFT JOIN users ON view_user_id = user_id WHERE view_ticket_id = $ticket_id AND view_user_id != $session_user_id AND view_timestamp > DATE_SUB(NOW(), INTERVAL 2 MINUTE)");
|
||||||
while ($row = mysqli_fetch_array($query)) {
|
while ($row = mysqli_fetch_assoc($query)) {
|
||||||
$users[] = $row['user_name'];
|
$users[] = $row['user_name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,21 +170,21 @@ if (isset($_GET['share_generate_link'])) {
|
|||||||
$item_expires_friendly = "1 month";
|
$item_expires_friendly = "1 month";
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_key = randomString(156);
|
$item_key = randomString(32);
|
||||||
|
|
||||||
if ($item_type == "Document") {
|
if ($item_type == "Document") {
|
||||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_id AND document_client_id = $client_id LIMIT 1"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_id AND document_client_id = $client_id LIMIT 1"));
|
||||||
$item_name = sanitizeInput($row['document_name']);
|
$item_name = sanitizeInput($row['document_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item_type == "File") {
|
if ($item_type == "File") {
|
||||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = $item_id AND file_client_id = $client_id LIMIT 1"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = $item_id AND file_client_id = $client_id LIMIT 1"));
|
||||||
$item_name = sanitizeInput($row['file_name']);
|
$item_name = sanitizeInput($row['file_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item_type == "Credential") {
|
if ($item_type == "Credential") {
|
||||||
$credential = mysqli_query($mysqli, "SELECT credential_name, credential_username, credential_password FROM credentials WHERE credential_id = $item_id AND credential_client_id = $client_id LIMIT 1");
|
$credential = mysqli_query($mysqli, "SELECT credential_name, credential_username, credential_password FROM credentials WHERE credential_id = $item_id AND credential_client_id = $client_id LIMIT 1");
|
||||||
$row = mysqli_fetch_array($credential);
|
$row = mysqli_fetch_assoc($credential);
|
||||||
|
|
||||||
$item_name = sanitizeInput($row['credential_name']);
|
$item_name = sanitizeInput($row['credential_name']);
|
||||||
|
|
||||||
@@ -240,7 +215,7 @@ if (isset($_GET['share_generate_link'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
$sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$company_name = sanitizeInput($row['company_name']);
|
$company_name = sanitizeInput($row['company_name']);
|
||||||
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||||
|
|
||||||
@@ -298,7 +273,7 @@ if (isset($_GET['get_active_clients'])) {
|
|||||||
ORDER BY client_accessed_at DESC"
|
ORDER BY client_accessed_at DESC"
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($client_sql)) {
|
while ($row = mysqli_fetch_assoc($client_sql)) {
|
||||||
$response['clients'][] = $row;
|
$response['clients'][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +297,7 @@ if (isset($_GET['get_client_contacts'])) {
|
|||||||
ORDER BY contact_primary DESC, contact_technical DESC, contact_important DESC, contact_name"
|
ORDER BY contact_primary DESC, contact_technical DESC, contact_important DESC, contact_name"
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($contact_sql)) {
|
while ($row = mysqli_fetch_assoc($contact_sql)) {
|
||||||
$response['contacts'][] = $row;
|
$response['contacts'][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +322,7 @@ if (isset($_GET['get_client_assets'])) {
|
|||||||
ORDER BY asset_important DESC, asset_name"
|
ORDER BY asset_important DESC, asset_name"
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($asset_sql)) {
|
while ($row = mysqli_fetch_assoc($asset_sql)) {
|
||||||
$response['assets'][] = $row;
|
$response['assets'][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +346,7 @@ if (isset($_GET['get_client_locations'])) {
|
|||||||
ORDER BY location_primary DESC, location_name ASC"
|
ORDER BY location_primary DESC, location_name ASC"
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($locations_sql)) {
|
while ($row = mysqli_fetch_assoc($locations_sql)) {
|
||||||
$response['locations'][] = $row;
|
$response['locations'][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +370,7 @@ if (isset($_GET['get_client_vendors'])) {
|
|||||||
ORDER BY vendor_name ASC"
|
ORDER BY vendor_name ASC"
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($vendors_sql)) {
|
while ($row = mysqli_fetch_assoc($vendors_sql)) {
|
||||||
$response['vendors'][] = $row;
|
$response['vendors'][] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,7 +477,7 @@ if (isset($_POST['update_kanban_ticket'])) {
|
|||||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||||
WHERE ticket_id = $ticket_id
|
WHERE ticket_id = $ticket_id
|
||||||
");
|
");
|
||||||
$row = mysqli_fetch_array($ticket_sql);
|
$row = mysqli_fetch_assoc($ticket_sql);
|
||||||
|
|
||||||
$contact_name = sanitizeInput($row['contact_name']);
|
$contact_name = sanitizeInput($row['contact_name']);
|
||||||
$contact_email = sanitizeInput($row['contact_email']);
|
$contact_email = sanitizeInput($row['contact_email']);
|
||||||
@@ -521,7 +496,7 @@ if (isset($_POST['update_kanban_ticket'])) {
|
|||||||
|
|
||||||
// Get Company Info
|
// Get Company Info
|
||||||
$sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1");
|
$sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$company_name = sanitizeInput($row['company_name']);
|
$company_name = sanitizeInput($row['company_name']);
|
||||||
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||||
|
|
||||||
@@ -550,7 +525,7 @@ if (isset($_POST['update_kanban_ticket'])) {
|
|||||||
// Also Email all the watchers
|
// Also Email all the watchers
|
||||||
$sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id");
|
$sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id");
|
||||||
$body .= "<br><br>----------------------------------------<br>YOU ARE A COLLABORATOR ON THIS TICKET";
|
$body .= "<br><br>----------------------------------------<br>YOU ARE A COLLABORATOR ON THIS TICKET";
|
||||||
while ($row = mysqli_fetch_array($sql_watchers)) {
|
while ($row = mysqli_fetch_assoc($sql_watchers)) {
|
||||||
$watcher_email = sanitizeInput($row['watcher_email']);
|
$watcher_email = sanitizeInput($row['watcher_email']);
|
||||||
|
|
||||||
// Queue Mail
|
// Queue Mail
|
||||||
@@ -691,7 +666,7 @@ if (isset($_GET['client_duplicate_check'])) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (mysqli_num_rows($sql_clients) > 0) {
|
if (mysqli_num_rows($sql_clients) > 0) {
|
||||||
while ($row = mysqli_fetch_array($sql_clients)) {
|
while ($row = mysqli_fetch_assoc($sql_clients)) {
|
||||||
$response['message'] = "<i class='fas fa-fw fa-copy mr-2'></i> Potential duplicate: <i>" . nullable_htmlentities($row['client_name']) . "</i> already exists.";
|
$response['message'] = "<i class='fas fa-fw fa-copy mr-2'></i> Potential duplicate: <i>" . nullable_htmlentities($row['client_name']) . "</i> already exists.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -713,7 +688,7 @@ if (isset($_GET['contact_email_check'])) {
|
|||||||
// 1. Duplicate check
|
// 1. Duplicate check
|
||||||
$sql_contacts = mysqli_query($mysqli, "SELECT contact_email FROM contacts WHERE contact_email = '$email' LIMIT 1");
|
$sql_contacts = mysqli_query($mysqli, "SELECT contact_email FROM contacts WHERE contact_email = '$email' LIMIT 1");
|
||||||
if (mysqli_num_rows($sql_contacts) > 0) {
|
if (mysqli_num_rows($sql_contacts) > 0) {
|
||||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
while ($row = mysqli_fetch_assoc($sql_contacts)) {
|
||||||
$response['message'] = "<i class='fas fa-fw fa-copy mr-2'></i> Potential duplicate: <i>" . nullable_htmlentities($row['contact_email']) . "</i> already exists.";
|
$response['message'] = "<i class='fas fa-fw fa-copy mr-2'></i> Potential duplicate: <i>" . nullable_htmlentities($row['contact_email']) . "</i> already exists.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -734,7 +709,7 @@ if (isset($_GET['ai_reword'])) {
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$model_name = $row['ai_model_name'];
|
$model_name = $row['ai_model_name'];
|
||||||
$promptText = $row['ai_model_prompt'];
|
$promptText = $row['ai_model_prompt'];
|
||||||
$url = $row['ai_provider_api_url'];
|
$url = $row['ai_provider_api_url'];
|
||||||
@@ -805,7 +780,7 @@ if (isset($_GET['ai_create_document_template'])) {
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$model_name = $row['ai_model_name'];
|
$model_name = $row['ai_model_name'];
|
||||||
$url = $row['ai_provider_api_url'];
|
$url = $row['ai_provider_api_url'];
|
||||||
$key = $row['ai_provider_api_key'];
|
$key = $row['ai_provider_api_key'];
|
||||||
@@ -861,7 +836,7 @@ if (isset($_GET['ai_ticket_summary'])) {
|
|||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$model_name = $row['ai_model_name'];
|
$model_name = $row['ai_model_name'];
|
||||||
$url = $row['ai_provider_api_url'];
|
$url = $row['ai_provider_api_url'];
|
||||||
$key = $row['ai_provider_api_key'];
|
$key = $row['ai_provider_api_key'];
|
||||||
@@ -992,3 +967,23 @@ if (isset($_GET['apex_domain_check'])) {
|
|||||||
|
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get internal users/techs
|
||||||
|
if (isset($_GET['get_internal_users'])) {
|
||||||
|
enforceUserPermission('module_support');
|
||||||
|
|
||||||
|
$sql = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT user_id, user_name
|
||||||
|
FROM users
|
||||||
|
WHERE user_type = 1 AND user_status = 1 AND user_archived_at IS NULL
|
||||||
|
ORDER BY user_name"
|
||||||
|
);
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$response['users'][] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
@@ -51,6 +51,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
||||||
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
||||||
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||||
|
$asset_favorite = intval($row['asset_favorite']);
|
||||||
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||||
$asset_vendor_id = intval($row['asset_vendor_id']);
|
$asset_vendor_id = intval($row['asset_vendor_id']);
|
||||||
$asset_location_id = intval($row['asset_location_id']);
|
$asset_location_id = intval($row['asset_location_id']);
|
||||||
@@ -66,8 +67,11 @@ if (isset($_GET['asset_id'])) {
|
|||||||
|
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||||
$contact_phone = nullable_htmlentities($row['contact_phone']);
|
$contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']);
|
||||||
$contact_mobile = nullable_htmlentities($row['contact_mobile']);
|
$contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
|
||||||
|
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||||
|
$contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']);
|
||||||
|
$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
|
||||||
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
$contact_archived_at = nullable_htmlentities($row['contact_archived_at']);
|
||||||
if ($contact_archived_at) {
|
if ($contact_archived_at) {
|
||||||
$contact_name_display = "<span class='text-danger' title='Archived'><s>$contact_name</s></span>";
|
$contact_name_display = "<span class='text-danger' title='Archived'><s>$contact_name</s></span>";
|
||||||
@@ -122,7 +126,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
$asset_tag_name_display_array = array();
|
$asset_tag_name_display_array = array();
|
||||||
$asset_tag_id_array = array();
|
$asset_tag_id_array = array();
|
||||||
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_asset_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_asset_tags)) {
|
||||||
|
|
||||||
$asset_tag_id = intval($row['tag_id']);
|
$asset_tag_id = intval($row['tag_id']);
|
||||||
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -223,7 +227,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
credentials.credential_password,
|
credentials.credential_password,
|
||||||
credentials.credential_otp_secret,
|
credentials.credential_otp_secret,
|
||||||
credentials.credential_note,
|
credentials.credential_note,
|
||||||
credentials.credential_important,
|
credentials.credential_favorite,
|
||||||
credentials.credential_contact_id,
|
credentials.credential_contact_id,
|
||||||
credentials.credential_asset_id
|
credentials.credential_asset_id
|
||||||
FROM credentials
|
FROM credentials
|
||||||
@@ -270,7 +274,9 @@ if (isset($_GET['asset_id'])) {
|
|||||||
data-modal-url="modals/asset/asset_edit.php?id=<?= $asset_id ?>">
|
data-modal-url="modals/asset/asset_edit.php?id=<?= $asset_id ?>">
|
||||||
<i class="fas fa-fw fa-edit"></i>
|
<i class="fas fa-fw fa-edit"></i>
|
||||||
</button>
|
</button>
|
||||||
<h4 class="text-bold"><i class="fa fa-fw text-secondary fa-<?= $device_icon; ?> mr-3"></i><?= $asset_name; ?></h4>
|
<h4 class="text-bold"><i class="fa fa-fw text-secondary fa-<?= $device_icon; ?> mr-2"></i><?= $asset_name; ?>
|
||||||
|
<?php if ($asset_favorite) { ?><i class="fas fa-fw text-warning fa-star" title="Favorite"></i><?php } ?>
|
||||||
|
</h4>
|
||||||
<?php if ($asset_photo) { ?>
|
<?php if ($asset_photo) { ?>
|
||||||
<img class="img-fluid img-circle p-3" alt="asset_photo" src="<?= "../uploads/clients/$client_id/$asset_photo"; ?>">
|
<img class="img-fluid img-circle p-3" alt="asset_photo" src="<?= "../uploads/clients/$client_id/$asset_photo"; ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -285,25 +291,25 @@ if (isset($_GET['asset_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($asset_type) { ?>
|
<?php if ($asset_type) { ?>
|
||||||
<div class="mt-1"><i class="fa fa-fw fa-tag text-secondary mr-3"></i><?= $asset_type; ?></div>
|
<div class="mt-1"><i class="fa fa-fw fa-tag text-secondary mr-2"></i><?= $asset_type; ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($asset_make) { ?>
|
if ($asset_make) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-circle text-secondary mr-3"></i><?= "$asset_make $asset_model"; ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-circle text-secondary mr-2"></i><?= "$asset_make $asset_model"; ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($asset_os) { ?>
|
if ($asset_os) { ?>
|
||||||
<div class="mt-2"><i class="fab fa-fw fa-windows text-secondary mr-3"></i><?= "$asset_os"; ?></div>
|
<div class="mt-2"><i class="fab fa-fw fa-windows text-secondary mr-2"></i><?= "$asset_os"; ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($asset_serial) { ?>
|
if ($asset_serial) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-barcode text-secondary mr-3"></i><?= $asset_serial; ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-barcode text-secondary mr-2"></i><?= $asset_serial; ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($asset_purchase_date) { ?>
|
if ($asset_purchase_date) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-shopping-cart text-secondary mr-3"></i><?= date('Y-m-d', strtotime($asset_purchase_date)); ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-shopping-cart text-secondary mr-2"></i><?= date('Y-m-d', strtotime($asset_purchase_date)); ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($asset_install_date) { ?>
|
if ($asset_install_date) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-calendar-check text-secondary mr-3"></i><?= date('Y-m-d', strtotime($asset_install_date)); ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-calendar-check text-secondary mr-2"></i><?= date('Y-m-d', strtotime($asset_install_date)); ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($asset_warranty_expire) { ?>
|
if ($asset_warranty_expire) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-exclamation-triangle text-secondary mr-3"></i><?= date('Y-m-d', strtotime($asset_warranty_expire)); ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-exclamation-triangle text-secondary mr-2"></i><?= date('Y-m-d', strtotime($asset_warranty_expire)); ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -351,10 +357,13 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<div class="mt-2"><i class="fa fa-fw fa-envelope text-secondary mr-2"></i><a href='mailto:<?= $contact_email; ?>'><?= $contact_email; ?></a><button class='btn btn-sm clipboardjs' data-clipboard-text='<?= $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button></div>
|
<div class="mt-2"><i class="fa fa-fw fa-envelope text-secondary mr-2"></i><a href='mailto:<?= $contact_email; ?>'><?= $contact_email; ?></a><button class='btn btn-sm clipboardjs' data-clipboard-text='<?= $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($contact_phone) { ?>
|
if ($contact_phone) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-phone text-secondary mr-2"></i><?= formatPhoneNumber($contact_phone); echo " $contact_extension"; ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-phone text-secondary mr-2"></i><?= $contact_phone ?></div>
|
||||||
|
<?php }
|
||||||
|
if ($contact_extension) { ?>
|
||||||
|
<div class="mt-1"><i class="fa fa-fw text-secondary mr-2"></i><?= "ext. $contact_extension" ?></div>
|
||||||
<?php }
|
<?php }
|
||||||
if ($contact_mobile) { ?>
|
if ($contact_mobile) { ?>
|
||||||
<div class="mt-2"><i class="fa fa-fw fa-mobile-alt text-secondary mr-2"></i><?= formatPhoneNumber($contact_mobile); ?></div>
|
<div class="mt-2"><i class="fa fa-fw fa-mobile-alt text-secondary mr-2"></i><?= $contact_mobile ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -469,11 +478,15 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#bulkAssignNetworkModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_interface_bulk_edit_network.php?client_id=<?= $client_id ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-network-wired mr-2"></i>Assign Network
|
<i class="fas fa-fw fa-network-wired mr-2"></i>Assign Network
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#bulkSetInterfaceTypeModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_interface_bulk_edit_type.php?client_id=<?= $client_id ?>"
|
||||||
|
data-bulk="true">
|
||||||
<i class="fas fa-fw fa-ethernet mr-2"></i>Set Type
|
<i class="fas fa-fw fa-ethernet mr-2"></i>Set Type
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
@@ -513,7 +526,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php while ($row = mysqli_fetch_array($sql_related_interfaces)) { ?>
|
<?php while ($row = mysqli_fetch_assoc($sql_related_interfaces)) { ?>
|
||||||
<?php
|
<?php
|
||||||
$interface_id = intval($row['interface_id']);
|
$interface_id = intval($row['interface_id']);
|
||||||
$interface_name = nullable_htmlentities($row['interface_name']);
|
$interface_name = nullable_htmlentities($row['interface_name']);
|
||||||
@@ -597,8 +610,6 @@ if (isset($_GET['asset_id'])) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "modals/asset/asset_interface_bulk_edit_type.php"; ?>
|
|
||||||
<?php require_once "modals/asset/asset_interface_bulk_edit_network.php"; ?>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -624,7 +635,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_credentials)) {
|
while ($row = mysqli_fetch_assoc($sql_related_credentials)) {
|
||||||
$credential_id = intval($row['credential_id']);
|
$credential_id = intval($row['credential_id']);
|
||||||
$credential_name = nullable_htmlentities($row['credential_name']);
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
$credential_description = nullable_htmlentities($row['credential_description']);
|
$credential_description = nullable_htmlentities($row['credential_description']);
|
||||||
@@ -649,7 +660,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
||||||
}
|
}
|
||||||
$credential_note = nullable_htmlentities($row['credential_note']);
|
$credential_note = nullable_htmlentities($row['credential_note']);
|
||||||
$credential_important = intval($row['credential_important']);
|
$credential_favorite = intval($row['credential_favorite']);
|
||||||
$credential_contact_id = intval($row['credential_contact_id']);
|
$credential_contact_id = intval($row['credential_contact_id']);
|
||||||
$credential_asset_id = intval($row['credential_asset_id']);
|
$credential_asset_id = intval($row['credential_asset_id']);
|
||||||
|
|
||||||
@@ -657,7 +668,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
$credential_tag_name_display_array = array();
|
$credential_tag_name_display_array = array();
|
||||||
$credential_tag_id_array = array();
|
$credential_tag_id_array = array();
|
||||||
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_credential_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_credential_tags)) {
|
||||||
|
|
||||||
$credential_tag_id = intval($row['tag_id']);
|
$credential_tag_id = intval($row['tag_id']);
|
||||||
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -756,7 +767,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_software)) {
|
while ($row = mysqli_fetch_assoc($sql_related_software)) {
|
||||||
$software_id = intval($row['software_id']);
|
$software_id = intval($row['software_id']);
|
||||||
$software_name = nullable_htmlentities($row['software_name']);
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
$software_version = nullable_htmlentities($row['software_version']);
|
$software_version = nullable_htmlentities($row['software_version']);
|
||||||
@@ -773,7 +784,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
// Asset Licenses
|
// Asset Licenses
|
||||||
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
|
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
|
||||||
$asset_licenses_array = array();
|
$asset_licenses_array = array();
|
||||||
while ($row = mysqli_fetch_array($asset_licenses_sql)) {
|
while ($row = mysqli_fetch_assoc($asset_licenses_sql)) {
|
||||||
$asset_licenses_array[] = intval($row['asset_id']);
|
$asset_licenses_array[] = intval($row['asset_id']);
|
||||||
$seat_count = $seat_count + 1;
|
$seat_count = $seat_count + 1;
|
||||||
}
|
}
|
||||||
@@ -782,7 +793,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
// Contact Licenses
|
// Contact Licenses
|
||||||
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
|
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
|
||||||
$contact_licenses_array = array();
|
$contact_licenses_array = array();
|
||||||
while ($row = mysqli_fetch_array($contact_licenses_sql)) {
|
while ($row = mysqli_fetch_assoc($contact_licenses_sql)) {
|
||||||
$contact_licenses_array[] = intval($row['contact_id']);
|
$contact_licenses_array[] = intval($row['contact_id']);
|
||||||
$seat_count = $seat_count + 1;
|
$seat_count = $seat_count + 1;
|
||||||
}
|
}
|
||||||
@@ -842,7 +853,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_documents)) {
|
while ($row = mysqli_fetch_assoc($sql_related_documents)) {
|
||||||
$document_id = intval($row['document_id']);
|
$document_id = intval($row['document_id']);
|
||||||
$document_name = nullable_htmlentities($row['document_name']);
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
$document_description = nullable_htmlentities($row['document_description']);
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
@@ -921,7 +932,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_files)) {
|
while ($row = mysqli_fetch_assoc($sql_related_files)) {
|
||||||
$file_id = intval($row['file_id']);
|
$file_id = intval($row['file_id']);
|
||||||
$file_name = nullable_htmlentities($row['file_name']);
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
$file_description = nullable_htmlentities($row['file_description']);
|
$file_description = nullable_htmlentities($row['file_description']);
|
||||||
@@ -993,7 +1004,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_recurring_tickets)) {
|
while ($row = mysqli_fetch_assoc($sql_related_recurring_tickets)) {
|
||||||
$recurring_ticket_id = intval($row['recurring_ticket_id']);
|
$recurring_ticket_id = intval($row['recurring_ticket_id']);
|
||||||
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
|
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
|
||||||
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
|
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
|
||||||
@@ -1072,7 +1083,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_tickets)) {
|
while ($row = mysqli_fetch_assoc($sql_related_tickets)) {
|
||||||
$ticket_id = intval($row['ticket_id']);
|
$ticket_id = intval($row['ticket_id']);
|
||||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
$ticket_number = intval($row['ticket_number']);
|
$ticket_number = intval($row['ticket_number']);
|
||||||
@@ -1163,7 +1174,7 @@ if (isset($_GET['asset_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_linked_services)) {
|
while ($row = mysqli_fetch_assoc($sql_linked_services)) {
|
||||||
$service_id = intval($row['service_id']);
|
$service_id = intval($row['service_id']);
|
||||||
$service_name = nullable_htmlentities($row['service_name']);
|
$service_name = nullable_htmlentities($row['service_name']);
|
||||||
$service_description = nullable_htmlentities($row['service_description']);
|
$service_description = nullable_htmlentities($row['service_description']);
|
||||||
|
|||||||
@@ -200,14 +200,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importAssetModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_import.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
|
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportAssetModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/asset/asset_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -246,7 +248,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
AND ( EXISTS (SELECT 1 FROM assets WHERE asset_location_id = location_id AND $archive_query) OR location_id = $location_filter)
|
AND ( EXISTS (SELECT 1 FROM assets WHERE asset_location_id = location_id AND $archive_query) OR location_id = $location_filter)
|
||||||
ORDER BY location_name ASC
|
ORDER BY location_name ASC
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_locations_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_locations_filter)) {
|
||||||
$location_id = intval($row['location_id']);
|
$location_id = intval($row['location_id']);
|
||||||
$location_name = nullable_htmlentities($row['location_name']);
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
?>
|
?>
|
||||||
@@ -273,7 +275,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$access_permission_query
|
$access_permission_query
|
||||||
ORDER BY client_name ASC
|
ORDER BY client_name ASC
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_clients_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_clients_filter)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
?>
|
?>
|
||||||
@@ -301,7 +303,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
GROUP BY tag_id
|
GROUP BY tag_id
|
||||||
HAVING COUNT(asset_tag_asset_id) > 0 OR tag_id IN ($tag_filter)
|
HAVING COUNT(asset_tag_asset_id) > 0 OR tag_id IN ($tag_filter)
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_tags_filter)) {
|
||||||
$tag_id = intval($row['tag_id']);
|
$tag_id = intval($row['tag_id']);
|
||||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||||
|
|
||||||
@@ -343,6 +345,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount"></span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount"></span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
|
<button class="dropdown-item"
|
||||||
|
type="submit" form="bulkActions" name="bulk_favorite_assets">
|
||||||
|
<i class="fas fa-fw fa-star text-warning mr-2"></i>Favorite
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<button class="dropdown-item"
|
||||||
|
type="submit" form="bulkActions" name="bulk_unfavorite_assets">
|
||||||
|
<i class="far fa-fw fa-star mr-2"></i>Unfavorite
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
data-modal-url="modals/asset/asset_bulk_assign_contact.php?<?= $client_url ?>"
|
data-modal-url="modals/asset/asset_bulk_assign_contact.php?<?= $client_url ?>"
|
||||||
@@ -522,7 +534,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
@@ -588,6 +600,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$asset_physical_location_display = "";
|
$asset_physical_location_display = "";
|
||||||
}
|
}
|
||||||
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||||
|
$asset_favorite = intval($row['asset_favorite']);
|
||||||
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||||
$asset_archived_at = nullable_htmlentities($row['asset_archived_at']);
|
$asset_archived_at = nullable_htmlentities($row['asset_archived_at']);
|
||||||
$asset_vendor_id = intval($row['asset_vendor_id']);
|
$asset_vendor_id = intval($row['asset_vendor_id']);
|
||||||
@@ -628,7 +641,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$asset_tag_name_display_array = array();
|
$asset_tag_name_display_array = array();
|
||||||
$asset_tag_id_array = array();
|
$asset_tag_id_array = array();
|
||||||
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_asset_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_asset_tags)) {
|
||||||
|
|
||||||
$asset_tag_id = intval($row['tag_id']);
|
$asset_tag_id = intval($row['tag_id']);
|
||||||
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -658,7 +671,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="media">
|
<div class="media">
|
||||||
<i class="fa fa-fw fa-2x fa-<?= $device_icon ?> mr-3 mt-1"></i>
|
<i class="fa fa-fw fa-2x fa-<?= $device_icon ?> mr-3 mt-1"></i>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<div><?= $asset_name ?></div>
|
<div><?= $asset_name ?> <?php if ($asset_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?></div>
|
||||||
<div><small class="text-secondary"><?= $asset_description ?></small></div>
|
<div><small class="text-secondary"><?= $asset_description ?></small></div>
|
||||||
<?php
|
<?php
|
||||||
if ($asset_tags_display) { ?>
|
if ($asset_tags_display) { ?>
|
||||||
@@ -789,8 +802,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/asset/asset_export.php";
|
|
||||||
if ($client_url) {
|
|
||||||
require_once "modals/asset/asset_import.php";
|
|
||||||
}
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
<?php require_once "includes/inc_all.php"; ?>
|
|
||||||
|
|
||||||
<!-- Breadcrumbs-->
|
|
||||||
<ol class="breadcrumb">
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="index.html">Dashboard</a>
|
|
||||||
</li>
|
|
||||||
<li class="breadcrumb-item active">Blank Page</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<!-- Page Content -->
|
|
||||||
<h1>Blank Page</h1>
|
|
||||||
<hr>
|
|
||||||
<p>This is a great starting point for new custom pages.</p>
|
|
||||||
<h1><?php echo $session_user_role; ?></h1>
|
|
||||||
<?php validateAdminRole(); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$start_date = date('Y') . "-10-10";
|
|
||||||
|
|
||||||
echo "<H1>$start_date</H1>";
|
|
||||||
|
|
||||||
echo "<H2>User Agent</H2>";
|
|
||||||
echo getUserAgent();
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<input type="tel" name="phone" id="phone">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Minimal</label>
|
|
||||||
<select class="form-control select2 select2-hidden-accessible" style="width: 100%;" data-select2-id="1" tabindex="-1" aria-hidden="true">
|
|
||||||
<option selected="selected" data-select2-id="3">Alabama</option>
|
|
||||||
<option data-select2-id="35">Alaska</option>
|
|
||||||
<option data-select2-id="36">California</option>
|
|
||||||
<option data-select2-id="37">Delaware</option>
|
|
||||||
<option data-select2-id="38">Tennessee</option>
|
|
||||||
<option data-select2-id="39">Texas</option>
|
|
||||||
<option data-select2-id="40">Washington</option>
|
|
||||||
</select><span class="select2 select2-container select2-container--default select2-container--below" dir="ltr" data-select2-id="2" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-disabled="false" aria-labelledby="select2-nbex-container"><span class="select2-selection__rendered" id="select2-nbex-container" role="textbox" aria-readonly="true" title="Alabama">Alabama</span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt>Requester</dt>
|
|
||||||
<dd>Sam Adams</dd>
|
|
||||||
|
|
||||||
<dt>Created</dt>
|
|
||||||
<dd><time datetime="2024-04-11T17:52:30+00:00" title="2024-04-11 13:52" data-datetime="calendar">Today at 13:52</time></dd>
|
|
||||||
|
|
||||||
<dt>Last activity</dt>
|
|
||||||
<dd><time datetime="2024-04-11T18:08:55+00:00" title="2024-04-11 14:08" data-datetime="calendar">Today at 14:08</time></dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<?php echo randomString(100); ?>
|
|
||||||
<br>
|
|
||||||
<textarea class="tinymceTest"></textarea>
|
|
||||||
|
|
||||||
<textarea class="tinymce"></textarea>
|
|
||||||
|
|
||||||
<textarea class="tinymceTicket"></textarea>
|
|
||||||
<?php
|
|
||||||
// show the current Date and Time
|
|
||||||
$date_time = date('Y-m-d H:i:s');
|
|
||||||
echo "Current Date and Time: <strong>$date_time</strong>";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script>toastr.success('Have Fun Wozz!!')</script>
|
|
||||||
|
|
||||||
<?php require_once "../includes/footer.php";
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ if (isset($_GET['calendar_id'])) {
|
|||||||
<form>
|
<form>
|
||||||
<?php
|
<?php
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendars");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$calendar_id = intval($row['calendar_id']);
|
$calendar_id = intval($row['calendar_id']);
|
||||||
$calendar_name = nullable_htmlentities($row['calendar_name']);
|
$calendar_name = nullable_htmlentities($row['calendar_name']);
|
||||||
$calendar_color = nullable_htmlentities($row['calendar_color']);
|
$calendar_color = nullable_htmlentities($row['calendar_color']);
|
||||||
@@ -85,7 +85,7 @@ require_once "modals/calendar/calendar_event_add.php";
|
|||||||
|
|
||||||
//loop through IDs and create a modal for each
|
//loop through IDs and create a modal for each
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['event_id']);
|
$event_id = intval($row['event_id']);
|
||||||
$event_title = nullable_htmlentities($row['event_title']);
|
$event_title = nullable_htmlentities($row['event_title']);
|
||||||
$event_description = nullable_htmlentities($row['event_description']);
|
$event_description = nullable_htmlentities($row['event_description']);
|
||||||
@@ -166,7 +166,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
events: [
|
events: [
|
||||||
<?php
|
<?php
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['event_id']);
|
$event_id = intval($row['event_id']);
|
||||||
$event_title = json_encode($row['event_title']);
|
$event_title = json_encode($row['event_title']);
|
||||||
$event_start = json_encode($row['event_start']);
|
$event_start = json_encode($row['event_start']);
|
||||||
@@ -180,7 +180,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
|
|
||||||
//Invoices Created
|
//Invoices Created
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id $client_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id $client_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['invoice_id']);
|
$event_id = intval($row['invoice_id']);
|
||||||
$scope = strval($row['invoice_scope']);
|
$scope = strval($row['invoice_scope']);
|
||||||
if (empty($scope)) {
|
if (empty($scope)) {
|
||||||
@@ -195,7 +195,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
|
|
||||||
//Quotes Created
|
//Quotes Created
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id $client_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id $client_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['quote_id']);
|
$event_id = intval($row['quote_id']);
|
||||||
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
|
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
|
||||||
$event_start = json_encode($row['quote_date']);
|
$event_start = json_encode($row['quote_date']);
|
||||||
@@ -210,7 +210,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||||
$client_query"
|
$client_query"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['ticket_id']);
|
$event_id = intval($row['ticket_id']);
|
||||||
$ticket_status = intval($row['ticket_status']);
|
$ticket_status = intval($row['ticket_status']);
|
||||||
$ticket_status_name = strval($row['ticket_status_name']);
|
$ticket_status_name = strval($row['ticket_status_name']);
|
||||||
@@ -244,7 +244,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
LEFT JOIN users ON recurring_ticket_assigned_to = user_id
|
LEFT JOIN users ON recurring_ticket_assigned_to = user_id
|
||||||
$client_query"
|
$client_query"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['recurring_ticket_id']);
|
$event_id = intval($row['recurring_ticket_id']);
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$username = $row['user_name'];
|
$username = $row['user_name'];
|
||||||
@@ -269,7 +269,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||||
$client_query AND ticket_schedule IS NOT NULL"
|
$client_query AND ticket_schedule IS NOT NULL"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['ticket_id']);
|
$event_id = intval($row['ticket_id']);
|
||||||
$username = $row['user_name'];
|
$username = $row['user_name'];
|
||||||
if (empty($username)) {
|
if (empty($username)) {
|
||||||
@@ -299,7 +299,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
|
|
||||||
//Vendors Added Created
|
//Vendors Added Created
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id $client_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id $client_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['vendor_id']);
|
$event_id = intval($row['vendor_id']);
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$event_title = json_encode("Vendor : '" . $row['vendor_name'] . "' created");
|
$event_title = json_encode("Vendor : '" . $row['vendor_name'] . "' created");
|
||||||
@@ -311,7 +311,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
if (!isset($_GET['client_id'])) {
|
if (!isset($_GET['client_id'])) {
|
||||||
//Clients Added
|
//Clients Added
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$event_id = intval($row['client_id']);
|
$event_id = intval($row['client_id']);
|
||||||
$event_title = json_encode("Client: '" . $row['client_name'] . "' created");
|
$event_title = json_encode("Client: '" . $row['client_name'] . "' created");
|
||||||
$event_start = json_encode($row['client_created_at']);
|
$event_start = json_encode($row['client_created_at']);
|
||||||
@@ -326,7 +326,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
<?php
|
<?php
|
||||||
// User preference for Calendar start day (Sunday/Monday)
|
// User preference for Calendar start day (Sunday/Monday)
|
||||||
// Fetch User Dashboard Settings
|
// Fetch User Dashboard Settings
|
||||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_config_calendar_first_day FROM user_settings WHERE user_id = $session_user_id"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT user_config_calendar_first_day FROM user_settings WHERE user_id = $session_user_id"));
|
||||||
$user_config_calendar_first_day = intval($row['user_config_calendar_first_day']);
|
$user_config_calendar_first_day = intval($row['user_config_calendar_first_day']);
|
||||||
?>
|
?>
|
||||||
firstDay: <?php echo $user_config_calendar_first_day ?>,
|
firstDay: <?php echo $user_config_calendar_first_day ?>,
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportCertificateModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"\
|
||||||
|
data-modal-url="modals/certificate/certificate_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -110,7 +111,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$access_permission_query
|
$access_permission_query
|
||||||
ORDER BY client_name ASC
|
ORDER BY client_name ASC
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_clients_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_clients_filter)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
?>
|
?>
|
||||||
@@ -193,7 +194,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$certificate_id = intval($row['certificate_id']);
|
$certificate_id = intval($row['certificate_id']);
|
||||||
@@ -299,15 +300,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "modals/certificate/certificate_export.php";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php require_once "../includes/footer.php";
|
<?php require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ enforceUserPermission('module_sales');
|
|||||||
require_once 'plugins/stripe-php/init.php';
|
require_once 'plugins/stripe-php/init.php';
|
||||||
|
|
||||||
// Get Stripe vars
|
// Get Stripe vars
|
||||||
$stripe_vars = mysqli_fetch_array(mysqli_query($mysqli, "SELECT config_stripe_enable, config_stripe_publishable, config_stripe_secret FROM settings WHERE company_id = 1"));
|
$stripe_vars = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_stripe_enable, config_stripe_publishable, config_stripe_secret FROM settings WHERE company_id = 1"));
|
||||||
$config_stripe_enable = intval($stripe_vars['config_stripe_enable']);
|
$config_stripe_enable = intval($stripe_vars['config_stripe_enable']);
|
||||||
$config_stripe_publishable = nullable_htmlentities($stripe_vars['config_stripe_publishable']);
|
$config_stripe_publishable = nullable_htmlentities($stripe_vars['config_stripe_publishable']);
|
||||||
$config_stripe_secret = nullable_htmlentities($stripe_vars['config_stripe_secret']);
|
$config_stripe_secret = nullable_htmlentities($stripe_vars['config_stripe_secret']);
|
||||||
|
|
||||||
// Get client's StripeID from database
|
// Get client's StripeID from database
|
||||||
$stripe_client_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE client_id = $client_id LIMIT 1"));
|
$stripe_client_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE client_id = $client_id LIMIT 1"));
|
||||||
if ($stripe_client_details) {
|
if ($stripe_client_details) {
|
||||||
$stripe_id = sanitizeInput($stripe_client_details['stripe_id']);
|
$stripe_id = sanitizeInput($stripe_client_details['stripe_id']);
|
||||||
$stripe_pm = sanitizeInput($stripe_client_details['stripe_pm']);
|
$stripe_pm = sanitizeInput($stripe_client_details['stripe_pm']);
|
||||||
|
|||||||
@@ -23,6 +23,24 @@ $sql_important_contacts = mysqli_query(
|
|||||||
ORDER BY contact_primary DESC, contact_name DESC LIMIT 5"
|
ORDER BY contact_primary DESC, contact_name DESC LIMIT 5"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$sql_favorite_assets = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM assets
|
||||||
|
WHERE asset_client_id = $client_id
|
||||||
|
AND asset_favorite = 1
|
||||||
|
AND asset_archived_at IS NULL
|
||||||
|
ORDER BY asset_type ASC, asset_name ASC"
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql_favorite_credentials = mysqli_query(
|
||||||
|
$mysqli,
|
||||||
|
"SELECT * FROM credentials
|
||||||
|
WHERE credential_client_id = $client_id
|
||||||
|
AND credential_favorite = 1
|
||||||
|
AND credential_archived_at IS NULL
|
||||||
|
ORDER BY credential_name ASC"
|
||||||
|
);
|
||||||
|
|
||||||
$sql_recent_tickets = mysqli_query(
|
$sql_recent_tickets = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT * FROM tickets
|
"SELECT * FROM tickets
|
||||||
@@ -215,7 +233,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
<table class="table table-borderless table-sm">
|
<table class="table table-borderless table-sm">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_important_contacts)) {
|
while ($row = mysqli_fetch_assoc($sql_important_contacts)) {
|
||||||
$contact_id = intval($row['contact_id']);
|
$contact_id = intval($row['contact_id']);
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
$contact_title = nullable_htmlentities($row['contact_title']);
|
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||||
@@ -288,6 +306,111 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (mysqli_num_rows($sql_favorite_assets) > 0) { ?>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
|
||||||
|
<div class="card card-dark mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title"><i class="fas fa-fw fa-star mr-2"></i>Favorite Assets</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-2">
|
||||||
|
<table class="table table-borderless table-sm">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_favorite_assets)) {
|
||||||
|
$asset_id = intval($row['asset_id']);
|
||||||
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||||
|
$asset_icon = getAssetIcon($asset_type);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="#" class="ajax-modal"
|
||||||
|
data-modal-size="lg"
|
||||||
|
data-modal-url="modals/asset/asset_details.php?id=<?= $asset_id ?>">
|
||||||
|
<i class="fas fa-fw fa-<?= $asset_icon ?> text-muted mr-2"></i><?= $asset_name ?>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if (mysqli_num_rows($sql_favorite_credentials) > 0) { ?>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
|
||||||
|
<div class="card card-dark mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title"><i class="fas fa-fw fa-star mr-2"></i>Favorite Credentials</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-2">
|
||||||
|
<table class="table table-borderless table-sm">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_favorite_credentials)) {
|
||||||
|
$credential_id = intval($row['credential_id']);
|
||||||
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
|
$credential_description = nullable_htmlentities($row['credential_description']);
|
||||||
|
$credential_uri = sanitize_url($row['credential_uri']);
|
||||||
|
if (empty($credential_uri)) {
|
||||||
|
$credential_uri_display = "-";
|
||||||
|
} else {
|
||||||
|
$credential_uri_display = "<a href='$credential_uri'>" . truncate($credential_uri,40) . "</a><button class='btn btn-sm clipboardjs' type='button' title='$credential_uri' data-clipboard-text='$credential_uri'><i class='far fa-copy text-secondary'></i></button>";
|
||||||
|
}
|
||||||
|
$credential_uri_2 = sanitize_url($row['credential_uri_2']);
|
||||||
|
$credential_username = nullable_htmlentities(decryptCredentialEntry($row['credential_username']));
|
||||||
|
if (empty($credential_username)) {
|
||||||
|
$credential_username_display = "-";
|
||||||
|
} else {
|
||||||
|
$credential_username_display = "$credential_username<button class='btn btn-sm clipboardjs' type='button' data-clipboard-text='$credential_username'><i class='far fa-copy text-secondary'></i></button>";
|
||||||
|
}
|
||||||
|
$credential_password = nullable_htmlentities(decryptCredentialEntry($row['credential_password']));
|
||||||
|
$credential_otp_secret = nullable_htmlentities($row['credential_otp_secret']);
|
||||||
|
$credential_id_with_secret = '"' . $row['credential_id'] . '","' . $row['credential_otp_secret'] . '"';
|
||||||
|
if (empty($credential_otp_secret)) {
|
||||||
|
$otp_display = "-";
|
||||||
|
} else {
|
||||||
|
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="#" class="ajax-modal"
|
||||||
|
data-modal-url="modals/credential/credential_edit.php?id=<?= $credential_id ?>">
|
||||||
|
<i class="fas fa-fw fa-key text-muted mr-2"></i><?= $credential_name ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td><?= $credential_username_display ?></td>
|
||||||
|
<td class="text-nowrap">
|
||||||
|
<button class="btn p-0" type="button" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $credential_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button><button class="btn btn-sm clipboardjs" type="button" data-clipboard-text="<?php echo $credential_password; ?>"><i class="far fa-copy text-secondary"></i></button>
|
||||||
|
</td>
|
||||||
|
<td><?= $otp_display ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (mysqli_num_rows($sql_shared_items) > 0) { ?>
|
<?php if (mysqli_num_rows($sql_shared_items) > 0) { ?>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@@ -301,7 +424,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_shared_items)) {
|
while ($row = mysqli_fetch_assoc($sql_shared_items)) {
|
||||||
$item_id = intval($row['item_id']);
|
$item_id = intval($row['item_id']);
|
||||||
$item_active = nullable_htmlentities($row['item_active']);
|
$item_active = nullable_htmlentities($row['item_active']);
|
||||||
$item_key = nullable_htmlentities($row['item_key']);
|
$item_key = nullable_htmlentities($row['item_key']);
|
||||||
@@ -317,17 +440,17 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
if ($item_type == 'Credential') {
|
if ($item_type == 'Credential') {
|
||||||
$share_item_sql = mysqli_query($mysqli, "SELECT credential_name FROM credentials WHERE credential_id = $item_related_id AND credential_client_id = $client_id");
|
$share_item_sql = mysqli_query($mysqli, "SELECT credential_name FROM credentials WHERE credential_id = $item_related_id AND credential_client_id = $client_id");
|
||||||
$share_item = mysqli_fetch_array($share_item_sql);
|
$share_item = mysqli_fetch_assoc($share_item_sql);
|
||||||
$item_name = nullable_htmlentities($share_item['credential_name']);
|
$item_name = nullable_htmlentities($share_item['credential_name']);
|
||||||
$item_icon = "fas fa-key";
|
$item_icon = "fas fa-key";
|
||||||
} elseif ($item_type == 'Document') {
|
} elseif ($item_type == 'Document') {
|
||||||
$share_item_sql = mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_related_id AND document_client_id = $client_id");
|
$share_item_sql = mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_related_id AND document_client_id = $client_id");
|
||||||
$share_item = mysqli_fetch_array($share_item_sql);
|
$share_item = mysqli_fetch_assoc($share_item_sql);
|
||||||
$item_name = nullable_htmlentities($share_item['document_name']);
|
$item_name = nullable_htmlentities($share_item['document_name']);
|
||||||
$item_icon = "fas fa-folder";
|
$item_icon = "fas fa-folder";
|
||||||
} elseif ($item_type == 'File') {
|
} elseif ($item_type == 'File') {
|
||||||
$share_item_sql = mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = $item_related_id AND file_client_id = $client_id");
|
$share_item_sql = mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = $item_related_id AND file_client_id = $client_id");
|
||||||
$share_item = mysqli_fetch_array($share_item_sql);
|
$share_item = mysqli_fetch_assoc($share_item_sql);
|
||||||
$item_name = nullable_htmlentities($share_item['file_name']);
|
$item_name = nullable_htmlentities($share_item['file_name']);
|
||||||
$item_icon = "fas fa-paperclip";
|
$item_icon = "fas fa-paperclip";
|
||||||
}
|
}
|
||||||
@@ -377,7 +500,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_domains_expiring)) {
|
while ($row = mysqli_fetch_assoc($sql_domains_expiring)) {
|
||||||
$domain_id = intval($row['domain_id']);
|
$domain_id = intval($row['domain_id']);
|
||||||
$domain_name = nullable_htmlentities($row['domain_name']);
|
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||||
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
||||||
@@ -395,7 +518,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_certificates_expiring)) {
|
while ($row = mysqli_fetch_assoc($sql_certificates_expiring)) {
|
||||||
$certificate_id = intval($row['certificate_id']);
|
$certificate_id = intval($row['certificate_id']);
|
||||||
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
||||||
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
||||||
@@ -413,7 +536,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_asset_warranties_expiring)) {
|
while ($row = mysqli_fetch_assoc($sql_asset_warranties_expiring)) {
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||||
@@ -433,7 +556,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_asset_retire)) {
|
while ($row = mysqli_fetch_assoc($sql_asset_retire)) {
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||||
@@ -452,7 +575,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_licenses_expiring)) {
|
while ($row = mysqli_fetch_assoc($sql_licenses_expiring)) {
|
||||||
$software_id = intval($row['software_id']);
|
$software_id = intval($row['software_id']);
|
||||||
$software_name = nullable_htmlentities($row['software_name']);
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||||
@@ -495,7 +618,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_domains_expired)) {
|
while ($row = mysqli_fetch_assoc($sql_domains_expired)) {
|
||||||
$domain_id = intval($row['domain_id']);
|
$domain_id = intval($row['domain_id']);
|
||||||
$domain_name = nullable_htmlentities($row['domain_name']);
|
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||||
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
||||||
@@ -513,7 +636,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_certificates_expired)) {
|
while ($row = mysqli_fetch_assoc($sql_certificates_expired)) {
|
||||||
$certificate_id = intval($row['certificate_id']);
|
$certificate_id = intval($row['certificate_id']);
|
||||||
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
||||||
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
||||||
@@ -531,7 +654,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_asset_warranties_expired)) {
|
while ($row = mysqli_fetch_assoc($sql_asset_warranties_expired)) {
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||||
@@ -551,7 +674,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_asset_retired)) {
|
while ($row = mysqli_fetch_assoc($sql_asset_retired)) {
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||||
@@ -570,7 +693,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_licenses_expired)) {
|
while ($row = mysqli_fetch_assoc($sql_licenses_expired)) {
|
||||||
$software_id = intval($row['software_id']);
|
$software_id = intval($row['software_id']);
|
||||||
$software_name = nullable_htmlentities($row['software_name']);
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||||
@@ -609,7 +732,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_stale_tickets)) {
|
while ($row = mysqli_fetch_assoc($sql_stale_tickets)) {
|
||||||
$ticket_id = intval($row['ticket_id']);
|
$ticket_id = intval($row['ticket_id']);
|
||||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
$ticket_number = intval($row['ticket_number']);
|
$ticket_number = intval($row['ticket_number']);
|
||||||
@@ -652,7 +775,7 @@ $sql_asset_retired = mysqli_query(
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_recent_activities)) {
|
while ($row = mysqli_fetch_assoc($sql_recent_activities)) {
|
||||||
$log_created_at_time_ago = timeAgo($row['log_created_at']);
|
$log_created_at_time_ago = timeAgo($row['log_created_at']);
|
||||||
$log_description = nullable_htmlentities($row['log_description']);
|
$log_description = nullable_htmlentities($row['log_description']);
|
||||||
|
|
||||||
@@ -681,6 +804,9 @@ $sql_asset_retired = mysqli_query(
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Include script to get TOTP code via the login ID -->
|
||||||
|
<script src="js/credential_show_otp_via_id.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function updateClientNotes(client_id) {
|
function updateClientNotes(client_id) {
|
||||||
var notes = document.getElementById("clientNotes").value;
|
var notes = document.getElementById("clientNotes").value;
|
||||||
|
|||||||
@@ -92,11 +92,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importClientModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_import.php">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportClientModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/client/client_export.php">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -229,7 +231,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
GROUP BY tags.tag_id
|
GROUP BY tags.tag_id
|
||||||
HAVING COUNT(client_tags.client_id) > 0 OR tags.tag_id IN ($tag_filter)
|
HAVING COUNT(client_tags.client_id) > 0 OR tags.tag_id IN ($tag_filter)
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_tags_filter)) {
|
||||||
$tag_id = intval($row['tag_id']);
|
$tag_id = intval($row['tag_id']);
|
||||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||||
|
|
||||||
@@ -247,7 +249,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_industries_filter = mysqli_query($mysqli, "SELECT DISTINCT client_type FROM clients WHERE 1 = 1 AND client_$archive_query AND client_type != '' $leads_query ORDER BY client_type ASC");
|
$sql_industries_filter = mysqli_query($mysqli, "SELECT DISTINCT client_type FROM clients WHERE 1 = 1 AND client_$archive_query AND client_type != '' $leads_query ORDER BY client_type ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_industries_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_industries_filter)) {
|
||||||
$industry_name = nullable_htmlentities($row['client_type']);
|
$industry_name = nullable_htmlentities($row['client_type']);
|
||||||
?>
|
?>
|
||||||
<option <?php if ($industry_name == $industry_filter) { echo "selected"; } ?>><?php echo $industry_name; ?></option>
|
<option <?php if ($industry_name == $industry_filter) { echo "selected"; } ?>><?php echo $industry_name; ?></option>
|
||||||
@@ -266,7 +268,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_referrals_filter = mysqli_query($mysqli, "SELECT DISTINCT client_referral FROM clients WHERE 1 = 1 AND client_$archive_query AND client_referral != '' $leads_query ORDER BY client_referral ASC");
|
$sql_referrals_filter = mysqli_query($mysqli, "SELECT DISTINCT client_referral FROM clients WHERE 1 = 1 AND client_$archive_query AND client_referral != '' $leads_query ORDER BY client_referral ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_referrals_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_referrals_filter)) {
|
||||||
$referral_name = nullable_htmlentities($row['client_referral']);
|
$referral_name = nullable_htmlentities($row['client_referral']);
|
||||||
?>
|
?>
|
||||||
<option <?php if ($referral_name == $referral_filter) { echo "selected"; } ?>><?php echo $referral_name; ?></option>
|
<option <?php if ($referral_name == $referral_filter) { echo "selected"; } ?>><?php echo $referral_name; ?></option>
|
||||||
@@ -284,7 +286,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<form id="bulkActions" action="post.php" method="post">
|
<form id="bulkActions" action="post.php" method="post">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
<div class="table-responsive-sm">
|
<div class="table-responsive">
|
||||||
<table class="table table-hover mb-0 text-nowrap">
|
<table class="table table-hover mb-0 text-nowrap">
|
||||||
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?> bg-light">
|
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?> bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -321,7 +323,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$client_type = nullable_htmlentities($row['client_type']);
|
$client_type = nullable_htmlentities($row['client_type']);
|
||||||
@@ -424,7 +426,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$client_tag_name_display_array = array();
|
$client_tag_name_display_array = array();
|
||||||
$client_tag_id_array = array();
|
$client_tag_id_array = array();
|
||||||
$sql_client_tags = mysqli_query($mysqli, "SELECT * FROM client_tags LEFT JOIN tags ON client_tags.tag_id = tags.tag_id WHERE client_id = $client_id ORDER BY tag_name ASC");
|
$sql_client_tags = mysqli_query($mysqli, "SELECT * FROM client_tags LEFT JOIN tags ON client_tags.tag_id = tags.tag_id WHERE client_id = $client_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_client_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_client_tags)) {
|
||||||
|
|
||||||
$client_tag_id = intval($row['tag_id']);
|
$client_tag_id = intval($row['tag_id']);
|
||||||
$client_tag_name = nullable_htmlentities($row['tag_name']);
|
$client_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -444,12 +446,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||||
$sql_invoice_amounts = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $client_id AND invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable' ");
|
$sql_invoice_amounts = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $client_id AND invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable' ");
|
||||||
$row = mysqli_fetch_array($sql_invoice_amounts);
|
$row = mysqli_fetch_assoc($sql_invoice_amounts);
|
||||||
|
|
||||||
$invoice_amounts = floatval($row['invoice_amounts']);
|
$invoice_amounts = floatval($row['invoice_amounts']);
|
||||||
|
|
||||||
$sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $client_id");
|
$sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $client_id");
|
||||||
$row = mysqli_fetch_array($sql_amount_paid);
|
$row = mysqli_fetch_assoc($sql_amount_paid);
|
||||||
|
|
||||||
$amount_paid = floatval($row['amount_paid']);
|
$amount_paid = floatval($row['amount_paid']);
|
||||||
|
|
||||||
@@ -463,19 +465,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
// Get Credit Balance
|
// Get Credit Balance
|
||||||
$sql_credit_balance = mysqli_query($mysqli, "SELECT SUM(credit_amount) AS credit_balance FROM credits WHERE credit_client_id = $client_id");
|
$sql_credit_balance = mysqli_query($mysqli, "SELECT SUM(credit_amount) AS credit_balance FROM credits WHERE credit_client_id = $client_id");
|
||||||
$row = mysqli_fetch_array($sql_credit_balance);
|
$row = mysqli_fetch_assoc($sql_credit_balance);
|
||||||
|
|
||||||
$credit_balance = floatval($row['credit_balance']);
|
$credit_balance = floatval($row['credit_balance']);
|
||||||
|
|
||||||
//Get Monthly Recurring Total
|
//Get Monthly Recurring Total
|
||||||
$sql_recurring_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_monthly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'month' AND recurring_invoice_client_id = $client_id");
|
$sql_recurring_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_monthly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'month' AND recurring_invoice_client_id = $client_id");
|
||||||
$row = mysqli_fetch_array($sql_recurring_monthly_total);
|
$row = mysqli_fetch_assoc($sql_recurring_monthly_total);
|
||||||
|
|
||||||
$recurring_monthly_total = floatval($row['recurring_monthly_total']);
|
$recurring_monthly_total = floatval($row['recurring_monthly_total']);
|
||||||
|
|
||||||
//Get Yearly Recurring Total
|
//Get Yearly Recurring Total
|
||||||
$sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_yearly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'year' AND recurring_invoice_client_id = $client_id");
|
$sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_yearly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'year' AND recurring_invoice_client_id = $client_id");
|
||||||
$row = mysqli_fetch_array($sql_recurring_yearly_total);
|
$row = mysqli_fetch_assoc($sql_recurring_yearly_total);
|
||||||
|
|
||||||
$recurring_yearly_total = floatval($row['recurring_yearly_total']) / 12;
|
$recurring_yearly_total = floatval($row['recurring_yearly_total']) / 12;
|
||||||
|
|
||||||
@@ -623,6 +625,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/client/client_import.php";
|
|
||||||
require_once "modals/client/client_export.php";
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
@@ -120,7 +120,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
$contact_tag_name_display_array = array();
|
$contact_tag_name_display_array = array();
|
||||||
$contact_tag_id_array = array();
|
$contact_tag_id_array = array();
|
||||||
$sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC");
|
$sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_contact_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_contact_tags)) {
|
||||||
|
|
||||||
$contact_tag_id = intval($row['tag_id']);
|
$contact_tag_id = intval($row['tag_id']);
|
||||||
$contact_tag_name = nullable_htmlentities($row['tag_name']);
|
$contact_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -363,7 +363,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_assets)) {
|
while ($row = mysqli_fetch_assoc($sql_related_assets)) {
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
$asset_type = nullable_htmlentities($row['asset_type']);
|
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
@@ -371,10 +371,10 @@ if (isset($_GET['contact_id'])) {
|
|||||||
$asset_make = nullable_htmlentities($row['asset_make']);
|
$asset_make = nullable_htmlentities($row['asset_make']);
|
||||||
$asset_model = nullable_htmlentities($row['asset_model']);
|
$asset_model = nullable_htmlentities($row['asset_model']);
|
||||||
$asset_serial = nullable_htmlentities($row['asset_serial']);
|
$asset_serial = nullable_htmlentities($row['asset_serial']);
|
||||||
if (empty($asset_serial)) {
|
if ($asset_serial) {
|
||||||
$asset_serial_display = "-";
|
|
||||||
} else {
|
|
||||||
$asset_serial_display = $asset_serial;
|
$asset_serial_display = $asset_serial;
|
||||||
|
} else {
|
||||||
|
$asset_serial_display = "-";
|
||||||
}
|
}
|
||||||
$asset_os = nullable_htmlentities($row['asset_os']);
|
$asset_os = nullable_htmlentities($row['asset_os']);
|
||||||
if (empty($asset_os)) {
|
if (empty($asset_os)) {
|
||||||
@@ -405,6 +405,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
||||||
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
||||||
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||||
|
$asset_favorite = intval($row['asset_favorite']);
|
||||||
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||||
$device_icon = getAssetIcon($asset_type);
|
$device_icon = getAssetIcon($asset_type);
|
||||||
|
|
||||||
@@ -412,7 +413,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
$asset_tag_name_display_array = array();
|
$asset_tag_name_display_array = array();
|
||||||
$asset_tag_id_array = array();
|
$asset_tag_id_array = array();
|
||||||
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
$sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_asset_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_asset_tags)) {
|
||||||
|
|
||||||
$asset_tag_id = intval($row['tag_id']);
|
$asset_tag_id = intval($row['tag_id']);
|
||||||
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
$asset_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -433,14 +434,15 @@ if (isset($_GET['contact_id'])) {
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
<i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-2"></i>
|
<i class="fa fa-fw text-secondary fa-<?= $device_icon ?> mr-1"></i>
|
||||||
<a class="text-secondary ajax-modal" href="#"
|
<a class="text-secondary ajax-modal" href="#"
|
||||||
data-modal-size="lg"
|
data-modal-size="lg"
|
||||||
data-modal-url="modals/asset/asset_details.php?id=<?= $asset_id ?>">
|
data-modal-url="modals/asset/asset_details.php?id=<?= $asset_id ?>">
|
||||||
<?php echo $asset_name; ?>
|
<?= $asset_name ?>
|
||||||
|
<?php if ($asset_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?>
|
||||||
</a>
|
</a>
|
||||||
<div class="mt-0">
|
<div class="mt-0">
|
||||||
<small class="text-muted"><?php echo $asset_description; ?></small>
|
<small class="text-muted"><?= $asset_description ?></small>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if ($asset_tags_display) { ?>
|
if ($asset_tags_display) { ?>
|
||||||
@@ -449,17 +451,17 @@ if (isset($_GET['contact_id'])) {
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</th>
|
</th>
|
||||||
<td><?php echo $asset_type; ?></td>
|
<td><?= $asset_type ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $asset_make; ?>
|
<?= $asset_make ?>
|
||||||
<div class="mt-0">
|
<div class="mt-0">
|
||||||
<small class="text-muted"><?php echo $asset_model; ?></small>
|
<small class="text-muted"><?= $asset_model ?></small>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $asset_serial_display; ?></td>
|
<td><?= $asset_serial_display ?></td>
|
||||||
|
|
||||||
<td><?php echo $asset_install_date_display; ?></td>
|
<td><?= $asset_install_date_display ?></td>
|
||||||
<td><?php echo $asset_status; ?></td>
|
<td><?= $asset_status ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown"><i class="fas fa-ellipsis-h"></i></button>
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown"><i class="fas fa-ellipsis-h"></i></button>
|
||||||
@@ -474,16 +476,16 @@ if (isset($_GET['contact_id'])) {
|
|||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item"
|
<a class="dropdown-item"
|
||||||
href="post.php?unlink_asset_from_contact&contact_id=<?php echo $contact_id; ?>&asset_id=<?php echo $asset_id; ?>"
|
href="post.php?unlink_asset_from_contact&contact_id=<?= $contact_id ?>&asset_id=<?= $asset_id ?>"
|
||||||
class="btn btn-secondary btn-sm" title="Unlink">
|
class="btn btn-secondary btn-sm" title="Unlink">
|
||||||
<i class="fas fa-fw fa-unlink mr-2"></i>Unlink
|
<i class="fas fa-fw fa-unlink mr-2"></i>Unlink
|
||||||
</a>
|
</a>
|
||||||
<?php if ($session_user_role == 3) { ?>
|
<?php if ($session_user_role == 3) { ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?= $asset_id ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
<a class="dropdown-item text-danger text-bold" href="post.php?delete_asset=<?= $asset_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -531,7 +533,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_credentials)) {
|
while ($row = mysqli_fetch_assoc($sql_related_credentials)) {
|
||||||
$credential_id = intval($row['credentials_credential_id']);
|
$credential_id = intval($row['credentials_credential_id']);
|
||||||
$credential_name = nullable_htmlentities($row['credential_name']);
|
$credential_name = nullable_htmlentities($row['credential_name']);
|
||||||
$credential_description = nullable_htmlentities($row['credential_description']);
|
$credential_description = nullable_htmlentities($row['credential_description']);
|
||||||
@@ -557,7 +559,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
|
||||||
}
|
}
|
||||||
$credential_note = nullable_htmlentities($row['credential_note']);
|
$credential_note = nullable_htmlentities($row['credential_note']);
|
||||||
$credential_important = intval($row['credential_important']);
|
$credential_favorite = intval($row['credential_favorite']);
|
||||||
$credential_contact_id = intval($row['credential_contact_id']);
|
$credential_contact_id = intval($row['credential_contact_id']);
|
||||||
$credential_asset_id = intval($row['credential_asset_id']);
|
$credential_asset_id = intval($row['credential_asset_id']);
|
||||||
|
|
||||||
@@ -565,7 +567,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
$credential_tag_name_display_array = array();
|
$credential_tag_name_display_array = array();
|
||||||
$credential_tag_id_array = array();
|
$credential_tag_id_array = array();
|
||||||
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_credential_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_credential_tags)) {
|
||||||
|
|
||||||
$credential_tag_id = intval($row['tag_id']);
|
$credential_tag_id = intval($row['tag_id']);
|
||||||
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -666,7 +668,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_linked_software)) {
|
while ($row = mysqli_fetch_assoc($sql_linked_software)) {
|
||||||
$software_id = intval($row['software_id']);
|
$software_id = intval($row['software_id']);
|
||||||
$software_name = nullable_htmlentities($row['software_name']);
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
$software_version = nullable_htmlentities($row['software_version']);
|
$software_version = nullable_htmlentities($row['software_version']);
|
||||||
@@ -683,7 +685,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
// Asset Licenses
|
// Asset Licenses
|
||||||
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
|
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
|
||||||
$asset_licenses_array = array();
|
$asset_licenses_array = array();
|
||||||
while ($row = mysqli_fetch_array($asset_licenses_sql)) {
|
while ($row = mysqli_fetch_assoc($asset_licenses_sql)) {
|
||||||
$asset_licenses_array[] = intval($row['asset_id']);
|
$asset_licenses_array[] = intval($row['asset_id']);
|
||||||
$seat_count = $seat_count + 1;
|
$seat_count = $seat_count + 1;
|
||||||
}
|
}
|
||||||
@@ -692,7 +694,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
// Contact Licenses
|
// Contact Licenses
|
||||||
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
|
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
|
||||||
$contact_licenses_array = array();
|
$contact_licenses_array = array();
|
||||||
while ($row = mysqli_fetch_array($contact_licenses_sql)) {
|
while ($row = mysqli_fetch_assoc($contact_licenses_sql)) {
|
||||||
$contact_licenses_array[] = intval($row['contact_id']);
|
$contact_licenses_array[] = intval($row['contact_id']);
|
||||||
$seat_count = $seat_count + 1;
|
$seat_count = $seat_count + 1;
|
||||||
}
|
}
|
||||||
@@ -741,7 +743,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_recurring_tickets)) {
|
while ($row = mysqli_fetch_assoc($sql_related_recurring_tickets)) {
|
||||||
$recurring_ticket_id = intval($row['recurring_ticket_id']);
|
$recurring_ticket_id = intval($row['recurring_ticket_id']);
|
||||||
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
|
$recurring_ticket_subject = nullable_htmlentities($row['recurring_ticket_subject']);
|
||||||
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
|
$recurring_ticket_priority = nullable_htmlentities($row['recurring_ticket_priority']);
|
||||||
@@ -797,7 +799,9 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<div class="card-header py-2">
|
<div class="card-header py-2">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring mr-2"></i>Related Tickets</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring mr-2"></i>Related Tickets</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModal">
|
<button type="button" class="btn btn-primary ajax-modal"
|
||||||
|
data-modal-url="modals/ticket/ticket_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>"
|
||||||
|
data-modal-size="lg">
|
||||||
<i class="fas fa-plus mr-2"></i>New Ticket
|
<i class="fas fa-plus mr-2"></i>New Ticket
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -819,7 +823,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_tickets)) {
|
while ($row = mysqli_fetch_assoc($sql_related_tickets)) {
|
||||||
$ticket_id = intval($row['ticket_id']);
|
$ticket_id = intval($row['ticket_id']);
|
||||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
$ticket_number = intval($row['ticket_number']);
|
$ticket_number = intval($row['ticket_number']);
|
||||||
@@ -908,7 +912,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_linked_services)) {
|
while ($row = mysqli_fetch_assoc($sql_linked_services)) {
|
||||||
$service_id = intval($row['service_id']);
|
$service_id = intval($row['service_id']);
|
||||||
$service_name = nullable_htmlentities($row['service_name']);
|
$service_name = nullable_htmlentities($row['service_name']);
|
||||||
$service_description = nullable_htmlentities($row['service_description']);
|
$service_description = nullable_htmlentities($row['service_description']);
|
||||||
@@ -967,7 +971,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_linked_documents)) {
|
while ($row = mysqli_fetch_assoc($sql_linked_documents)) {
|
||||||
$document_id = intval($row['document_id']);
|
$document_id = intval($row['document_id']);
|
||||||
$document_name = nullable_htmlentities($row['document_name']);
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
$document_description = nullable_htmlentities($row['document_description']);
|
$document_description = nullable_htmlentities($row['document_description']);
|
||||||
@@ -1033,7 +1037,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_linked_files)) {
|
while ($row = mysqli_fetch_assoc($sql_linked_files)) {
|
||||||
$file_id = intval($row['file_id']);
|
$file_id = intval($row['file_id']);
|
||||||
$file_name = nullable_htmlentities($row['file_name']);
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
$file_description = nullable_htmlentities($row['file_description']);
|
$file_description = nullable_htmlentities($row['file_description']);
|
||||||
@@ -1097,7 +1101,7 @@ if (isset($_GET['contact_id'])) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_related_notes)) {
|
while ($row = mysqli_fetch_assoc($sql_related_notes)) {
|
||||||
$contact_note_id = intval($row['contact_note_id']);
|
$contact_note_id = intval($row['contact_note_id']);
|
||||||
$contact_note_type = nullable_htmlentities($row['contact_note_type']);
|
$contact_note_type = nullable_htmlentities($row['contact_note_type']);
|
||||||
$contact_note = nl2br(nullable_htmlentities($row['contact_note']));
|
$contact_note = nl2br(nullable_htmlentities($row['contact_note']));
|
||||||
|
|||||||
@@ -98,12 +98,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<!-- <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#contactInviteModal"><i class="fas fa-fw fa-paper-plane mr-2"></i>Invite</a>-->
|
<!-- <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#contactInviteModal"><i class="fas fa-fw fa-paper-plane mr-2"></i>Invite</a>-->
|
||||||
<!-- <div class="dropdown-divider"></div>-->
|
<!-- <div class="dropdown-divider"></div>-->
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importContactModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_import.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportContactModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/contact/contact_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -142,7 +144,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
GROUP BY tags.tag_id
|
GROUP BY tags.tag_id
|
||||||
HAVING COUNT(contact_tags.contact_id) > 0 OR tags.tag_id IN ($tag_filter)
|
HAVING COUNT(contact_tags.contact_id) > 0 OR tags.tag_id IN ($tag_filter)
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_tags_filter)) {
|
||||||
$tag_id = intval($row['tag_id']);
|
$tag_id = intval($row['tag_id']);
|
||||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||||
|
|
||||||
@@ -167,7 +169,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
AND ( EXISTS (SELECT 1 FROM contacts WHERE contact_location_id = location_id AND $archive_query) OR location_id = $location_filter)
|
AND ( EXISTS (SELECT 1 FROM contacts WHERE contact_location_id = location_id AND $archive_query) OR location_id = $location_filter)
|
||||||
ORDER BY location_name ASC
|
ORDER BY location_name ASC
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_locations_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_locations_filter)) {
|
||||||
$location_id = intval($row['location_id']);
|
$location_id = intval($row['location_id']);
|
||||||
$location_name = nullable_htmlentities($row['location_name']);
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
?>
|
?>
|
||||||
@@ -194,7 +196,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$access_permission_query
|
$access_permission_query
|
||||||
ORDER BY client_name ASC
|
ORDER BY client_name ASC
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_clients_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_clients_filter)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
?>
|
?>
|
||||||
@@ -325,7 +327,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$contact_id = intval($row['contact_id']);
|
$contact_id = intval($row['contact_id']);
|
||||||
@@ -443,7 +445,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$contact_tag_name_display_array = array();
|
$contact_tag_name_display_array = array();
|
||||||
$contact_tag_id_array = array();
|
$contact_tag_id_array = array();
|
||||||
$sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC");
|
$sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_contact_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_contact_tags)) {
|
||||||
|
|
||||||
$contact_tag_id = intval($row['tag_id']);
|
$contact_tag_id = intval($row['tag_id']);
|
||||||
$contact_tag_name = nullable_htmlentities($row['tag_name']);
|
$contact_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -566,10 +568,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/contact/contact_export.php";
|
|
||||||
if ($client_url) {
|
|
||||||
//require_once "modals/contact/contact_invite.php";
|
|
||||||
require_once "modals/contact/contact_import.php";
|
|
||||||
}
|
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ $sql = mysqli_query(
|
|||||||
$access_permission_query
|
$access_permission_query
|
||||||
$client_query
|
$client_query
|
||||||
GROUP BY c.credential_id
|
GROUP BY c.credential_id
|
||||||
ORDER BY c.credential_important DESC, $sort $order LIMIT $record_from, $record_to"
|
ORDER BY c.credential_favorite DESC, $sort $order LIMIT $record_from, $record_to"
|
||||||
);
|
);
|
||||||
|
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||||
@@ -112,13 +112,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if ($client_url) { ?>
|
<?php if ($client_url) { ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importCredentialModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/credential/credential_import.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportCredentialModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/credential/credential_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -159,7 +161,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
GROUP BY tags.tag_id
|
GROUP BY tags.tag_id
|
||||||
HAVING COUNT(credential_tags.credential_id) > 0 OR tags.tag_id IN ($tag_filter)
|
HAVING COUNT(credential_tags.credential_id) > 0 OR tags.tag_id IN ($tag_filter)
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_tags_filter)) {
|
||||||
$tag_id = intval($row['tag_id']);
|
$tag_id = intval($row['tag_id']);
|
||||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||||
|
|
||||||
@@ -178,7 +180,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
$sql_locations_filter = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
$sql_locations_filter = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_locations_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_locations_filter)) {
|
||||||
$location_id = intval($row['location_id']);
|
$location_id = intval($row['location_id']);
|
||||||
$location_name = nullable_htmlentities($row['location_name']);
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
?>
|
?>
|
||||||
@@ -205,7 +207,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$access_permission_query
|
$access_permission_query
|
||||||
ORDER BY client_name ASC
|
ORDER BY client_name ASC
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_clients_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_clients_filter)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
?>
|
?>
|
||||||
@@ -230,7 +232,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
|
<button class="dropdown-item"
|
||||||
|
type="submit" form="bulkActions" name="bulk_favorite_credentials">
|
||||||
|
<i class="fas fa-fw fa-star text-warning mr-2"></i>Favorite
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<button class="dropdown-item"
|
||||||
|
type="submit" form="bulkActions" name="bulk_unfavorite_credentials">
|
||||||
|
<i class="far fa-fw fa-star mr-2"></i>Unfavorite
|
||||||
|
</button>
|
||||||
<?php if ($archived) { ?>
|
<?php if ($archived) { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
<button class="dropdown-item text-info"
|
<button class="dropdown-item text-info"
|
||||||
type="submit" form="bulkActions" name="bulk_unarchive_credentials">
|
type="submit" form="bulkActions" name="bulk_unarchive_credentials">
|
||||||
<i class="fas fa-fw fa-redo mr-2"></i>Unarchive
|
<i class="fas fa-fw fa-redo mr-2"></i>Unarchive
|
||||||
@@ -241,6 +253,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||||
</button>
|
</button>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
<a class="dropdown-item ajax-modal" href="#"
|
||||||
data-modal-url="modals/credential/credential_bulk_assign_tags.php"
|
data-modal-url="modals/credential/credential_bulk_assign_tags.php"
|
||||||
data-bulk="true">
|
data-bulk="true">
|
||||||
@@ -299,7 +312,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
$credential_id = intval($row['c_credential_id']);
|
$credential_id = intval($row['c_credential_id']);
|
||||||
@@ -329,7 +342,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$credential_note = nullable_htmlentities($row['credential_note']);
|
$credential_note = nullable_htmlentities($row['credential_note']);
|
||||||
$credential_created_at = nullable_htmlentities($row['credential_created_at']);
|
$credential_created_at = nullable_htmlentities($row['credential_created_at']);
|
||||||
$credential_archived_at = nullable_htmlentities($row['credential_archived_at']);
|
$credential_archived_at = nullable_htmlentities($row['credential_archived_at']);
|
||||||
$credential_important = intval($row['credential_important']);
|
$credential_favorite = intval($row['credential_favorite']);
|
||||||
$credential_contact_id = intval($row['credential_contact_id']);
|
$credential_contact_id = intval($row['credential_contact_id']);
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
$credential_asset_id = intval($row['credential_asset_id']);
|
$credential_asset_id = intval($row['credential_asset_id']);
|
||||||
@@ -339,7 +352,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$credential_tag_name_display_array = array();
|
$credential_tag_name_display_array = array();
|
||||||
$credential_tag_id_array = array();
|
$credential_tag_id_array = array();
|
||||||
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
$sql_credential_tags = mysqli_query($mysqli, "SELECT * FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
|
||||||
while ($row = mysqli_fetch_array($sql_credential_tags)) {
|
while ($row = mysqli_fetch_assoc($sql_credential_tags)) {
|
||||||
|
|
||||||
$credential_tag_id = intval($row['tag_id']);
|
$credential_tag_id = intval($row['tag_id']);
|
||||||
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
$credential_tag_name = nullable_htmlentities($row['tag_name']);
|
||||||
@@ -388,7 +401,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
LIMIT 1"
|
LIMIT 1"
|
||||||
);
|
);
|
||||||
if (mysqli_num_rows($sql_shared) > 0) {
|
if (mysqli_num_rows($sql_shared) > 0) {
|
||||||
$row = mysqli_fetch_array($sql_shared);
|
$row = mysqli_fetch_assoc($sql_shared);
|
||||||
$item_id = intval($row['item_id']);
|
$item_id = intval($row['item_id']);
|
||||||
$item_active = nullable_htmlentities($row['item_active']);
|
$item_active = nullable_htmlentities($row['item_active']);
|
||||||
$item_key = nullable_htmlentities($row['item_key']);
|
$item_key = nullable_htmlentities($row['item_key']);
|
||||||
@@ -405,7 +418,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr class="<?php if (!empty($credential_important)) { echo "text-bold"; } ?>">
|
<tr class="<?php if ($credential_favorite) { echo "text-bold"; } ?>">
|
||||||
<td class="pr-0">
|
<td class="pr-0">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input bulk-select" type="checkbox" name="credential_ids[]" value="<?php echo $credential_id ?>">
|
<input class="form-check-input bulk-select" type="checkbox" name="credential_ids[]" value="<?php echo $credential_id ?>">
|
||||||
@@ -417,7 +430,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="media">
|
<div class="media">
|
||||||
<i class="fa fa-fw fa-2x fa-key mr-3"></i>
|
<i class="fa fa-fw fa-2x fa-key mr-3"></i>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
<div><?php echo $credential_name; ?></div>
|
<div><?php echo $credential_name; ?> <?php if ($credential_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?></div>
|
||||||
<div><small class="text-secondary"><?php echo $credential_description; ?></small></div>
|
<div><small class="text-secondary"><?php echo $credential_description; ?></small></div>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($credential_tags_display)) { ?>
|
if (!empty($credential_tags_display)) { ?>
|
||||||
@@ -528,15 +541,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<!-- Include script to get TOTP code via the login ID -->
|
<!-- Include script to get TOTP code via the login ID -->
|
||||||
<script src="js/credential_show_otp_via_id.js"></script>
|
<script src="js/credential_show_otp_via_id.js"></script>
|
||||||
<!-- Include script to generate readable passwords for login entries -->
|
|
||||||
<script src="js/generate_password.js"></script>
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/credential/credential_export.php";
|
|
||||||
if ($client_url) {
|
if ($client_url) {
|
||||||
require_once "modals/credential/credential_import.php";
|
|
||||||
require_once "modals/share_modal.php";
|
require_once "modals/share_modal.php";
|
||||||
}
|
}
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ if (isset($_GET['enable_technical'])) {
|
|||||||
|
|
||||||
// Fetch User Dashboard Settings
|
// Fetch User Dashboard Settings
|
||||||
$sql_user_dashboard_settings = mysqli_query($mysqli, "SELECT * FROM user_settings WHERE user_id = $session_user_id");
|
$sql_user_dashboard_settings = mysqli_query($mysqli, "SELECT * FROM user_settings WHERE user_id = $session_user_id");
|
||||||
$row = mysqli_fetch_array($sql_user_dashboard_settings);
|
$row = mysqli_fetch_assoc($sql_user_dashboard_settings);
|
||||||
$user_config_dashboard_financial_enable = intval($row['user_config_dashboard_financial_enable']);
|
$user_config_dashboard_financial_enable = intval($row['user_config_dashboard_financial_enable']);
|
||||||
$user_config_dashboard_technical_enable = intval($row['user_config_dashboard_technical_enable']);
|
$user_config_dashboard_technical_enable = intval($row['user_config_dashboard_technical_enable']);
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ $sql_years_select = mysqli_query($mysqli, "
|
|||||||
|
|
||||||
<label for="year" class="mr-sm-2">Select Year:</label>
|
<label for="year" class="mr-sm-2">Select Year:</label>
|
||||||
<select id="year" onchange="this.form.submit()" class="form-control mr-sm-3 col-sm-2 mb-3 mb-sm-0" name="year">
|
<select id="year" onchange="this.form.submit()" class="form-control mr-sm-3 col-sm-2 mb-3 mb-sm-0" name="year">
|
||||||
<?php while ($row = mysqli_fetch_array($sql_years_select)) {
|
<?php while ($row = mysqli_fetch_assoc($sql_years_select)) {
|
||||||
$year_select = $row['all_years'];
|
$year_select = $row['all_years'];
|
||||||
if (empty($year_select)) {
|
if (empty($year_select)) {
|
||||||
$year_select = date('Y');
|
$year_select = date('Y');
|
||||||
@@ -88,29 +88,29 @@ if ($user_config_dashboard_financial_enable == 1) {
|
|||||||
$largest_income_month = 0;
|
$largest_income_month = 0;
|
||||||
|
|
||||||
$sql_total_payments_to_invoices = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments_to_invoices FROM payments WHERE YEAR(payment_date) = $year");
|
$sql_total_payments_to_invoices = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments_to_invoices FROM payments WHERE YEAR(payment_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_total_payments_to_invoices);
|
$row = mysqli_fetch_assoc($sql_total_payments_to_invoices);
|
||||||
$total_payments_to_invoices = floatval($row['total_payments_to_invoices']);
|
$total_payments_to_invoices = floatval($row['total_payments_to_invoices']);
|
||||||
|
|
||||||
$sql_total_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE YEAR(revenue_date) = $year AND revenue_category_id > 0");
|
$sql_total_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE YEAR(revenue_date) = $year AND revenue_category_id > 0");
|
||||||
$row = mysqli_fetch_array($sql_total_revenues);
|
$row = mysqli_fetch_assoc($sql_total_revenues);
|
||||||
$total_revenues = floatval($row['total_revenues']);
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
$total_income = $total_payments_to_invoices + $total_revenues;
|
$total_income = $total_payments_to_invoices + $total_revenues;
|
||||||
|
|
||||||
$sql_total_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_vendor_id > 0 AND YEAR(expense_date) = $year");
|
$sql_total_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_vendor_id > 0 AND YEAR(expense_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_total_expenses);
|
$row = mysqli_fetch_assoc($sql_total_expenses);
|
||||||
$total_expenses = floatval($row['total_expenses']);
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
$sql_invoice_totals = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_totals FROM invoices WHERE invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable' AND YEAR(invoice_date) = $year");
|
$sql_invoice_totals = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_totals FROM invoices WHERE invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable' AND YEAR(invoice_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_invoice_totals);
|
$row = mysqli_fetch_assoc($sql_invoice_totals);
|
||||||
$invoice_totals = floatval($row['invoice_totals']);
|
$invoice_totals = floatval($row['invoice_totals']);
|
||||||
|
|
||||||
$sql_total_payments_to_invoices_all_years = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments_to_invoices_all_years FROM payments");
|
$sql_total_payments_to_invoices_all_years = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments_to_invoices_all_years FROM payments");
|
||||||
$row = mysqli_fetch_array($sql_total_payments_to_invoices_all_years);
|
$row = mysqli_fetch_assoc($sql_total_payments_to_invoices_all_years);
|
||||||
$total_payments_to_invoices_all_years = floatval($row['total_payments_to_invoices_all_years']);
|
$total_payments_to_invoices_all_years = floatval($row['total_payments_to_invoices_all_years']);
|
||||||
|
|
||||||
$sql_invoice_totals_all_years = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_totals_all_years FROM invoices WHERE invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable'");
|
$sql_invoice_totals_all_years = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_totals_all_years FROM invoices WHERE invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable'");
|
||||||
$row = mysqli_fetch_array($sql_invoice_totals_all_years);
|
$row = mysqli_fetch_assoc($sql_invoice_totals_all_years);
|
||||||
$invoice_totals_all_years = floatval($row['invoice_totals_all_years']);
|
$invoice_totals_all_years = floatval($row['invoice_totals_all_years']);
|
||||||
|
|
||||||
$receivables = $invoice_totals_all_years - $total_payments_to_invoices_all_years;
|
$receivables = $invoice_totals_all_years - $total_payments_to_invoices_all_years;
|
||||||
@@ -135,30 +135,30 @@ if ($user_config_dashboard_financial_enable == 1) {
|
|||||||
|
|
||||||
// Get recurring invoice totals
|
// Get recurring invoice totals
|
||||||
$sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_yearly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'year' AND YEAR(recurring_invoice_created_at) <= $year");
|
$sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_yearly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'year' AND YEAR(recurring_invoice_created_at) <= $year");
|
||||||
$row = mysqli_fetch_array($sql_recurring_yearly_total);
|
$row = mysqli_fetch_assoc($sql_recurring_yearly_total);
|
||||||
$recurring_yearly_total = floatval($row['recurring_yearly_total']);
|
$recurring_yearly_total = floatval($row['recurring_yearly_total']);
|
||||||
|
|
||||||
$sql_recurring_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_monthly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'month' AND YEAR(recurring_invoice_created_at) <= $year");
|
$sql_recurring_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_monthly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'month' AND YEAR(recurring_invoice_created_at) <= $year");
|
||||||
$row = mysqli_fetch_array($sql_recurring_monthly_total);
|
$row = mysqli_fetch_assoc($sql_recurring_monthly_total);
|
||||||
$recurring_monthly_total = floatval($row['recurring_monthly_total']) + ($recurring_yearly_total / 12);
|
$recurring_monthly_total = floatval($row['recurring_monthly_total']) + ($recurring_yearly_total / 12);
|
||||||
|
|
||||||
// Recurring expenses totals
|
// Recurring expenses totals
|
||||||
$sql_recurring_expense_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_yearly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 2 AND YEAR(recurring_expense_created_at) <= $year");
|
$sql_recurring_expense_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_yearly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 2 AND YEAR(recurring_expense_created_at) <= $year");
|
||||||
$row = mysqli_fetch_array($sql_recurring_expense_yearly_total);
|
$row = mysqli_fetch_assoc($sql_recurring_expense_yearly_total);
|
||||||
$recurring_expense_yearly_total = floatval($row['recurring_expense_yearly_total']);
|
$recurring_expense_yearly_total = floatval($row['recurring_expense_yearly_total']);
|
||||||
|
|
||||||
$sql_recurring_expense_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_monthly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 1 AND YEAR(recurring_expense_created_at) <= $year");
|
$sql_recurring_expense_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_expense_amount) AS recurring_expense_monthly_total FROM recurring_expenses WHERE recurring_expense_status = 1 AND recurring_expense_frequency = 1 AND YEAR(recurring_expense_created_at) <= $year");
|
||||||
$row = mysqli_fetch_array($sql_recurring_expense_monthly_total);
|
$row = mysqli_fetch_assoc($sql_recurring_expense_monthly_total);
|
||||||
$recurring_expense_monthly_total = floatval($row['recurring_expense_monthly_total']) + ($recurring_expense_yearly_total / 12);
|
$recurring_expense_monthly_total = floatval($row['recurring_expense_monthly_total']) + ($recurring_expense_yearly_total / 12);
|
||||||
|
|
||||||
// Get miles driven
|
// Get miles driven
|
||||||
$sql_miles_driven = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS total_miles FROM trips WHERE YEAR(trip_date) = $year");
|
$sql_miles_driven = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS total_miles FROM trips WHERE YEAR(trip_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_miles_driven);
|
$row = mysqli_fetch_assoc($sql_miles_driven);
|
||||||
$total_miles = floatval($row['total_miles']);
|
$total_miles = floatval($row['total_miles']);
|
||||||
|
|
||||||
if ($config_module_enable_ticketing && $config_module_enable_accounting) {
|
if ($config_module_enable_ticketing && $config_module_enable_accounting) {
|
||||||
$sql_unbilled_tickets = mysqli_query($mysqli, "SELECT COUNT(ticket_id) AS unbilled_tickets FROM tickets WHERE ticket_closed_at IS NOT NULL AND ticket_billable = 1 AND ticket_invoice_id = 0 AND YEAR(ticket_created_at) = $year");
|
$sql_unbilled_tickets = mysqli_query($mysqli, "SELECT COUNT(ticket_id) AS unbilled_tickets FROM tickets WHERE ticket_closed_at IS NOT NULL AND ticket_billable = 1 AND ticket_invoice_id = 0 AND YEAR(ticket_created_at) = $year");
|
||||||
$row = mysqli_fetch_array($sql_unbilled_tickets);
|
$row = mysqli_fetch_assoc($sql_unbilled_tickets);
|
||||||
$unbilled_tickets = intval($row['unbilled_tickets']);
|
$unbilled_tickets = intval($row['unbilled_tickets']);
|
||||||
} else {
|
} else {
|
||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(recurring_invoice_id) AS recurring_invoices_added FROM recurring_invoices WHERE YEAR(recurring_invoice_created_at) = $year"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(recurring_invoice_id) AS recurring_invoices_added FROM recurring_invoices WHERE YEAR(recurring_invoice_created_at) = $year"));
|
||||||
@@ -421,7 +421,7 @@ if ($user_config_dashboard_financial_enable == 1) {
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php while ($row = mysqli_fetch_array($sql_accounts)) {
|
<?php while ($row = mysqli_fetch_assoc($sql_accounts)) {
|
||||||
$account_id = intval($row['account_id']);
|
$account_id = intval($row['account_id']);
|
||||||
$account_name = nullable_htmlentities($row['account_name']);
|
$account_name = nullable_htmlentities($row['account_name']);
|
||||||
$opening_balance = floatval($row['opening_balance']);
|
$opening_balance = floatval($row['opening_balance']);
|
||||||
@@ -430,15 +430,15 @@ if ($user_config_dashboard_financial_enable == 1) {
|
|||||||
<td><?php echo $account_name; ?></td>
|
<td><?php echo $account_name; ?></td>
|
||||||
<?php
|
<?php
|
||||||
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_assoc($sql_payments);
|
||||||
$total_payments = floatval($row['total_payments']);
|
$total_payments = floatval($row['total_payments']);
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_assoc($sql_revenues);
|
||||||
$total_revenues = floatval($row['total_revenues']);
|
$total_revenues = floatval($row['total_revenues']);
|
||||||
|
|
||||||
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_assoc($sql_expenses);
|
||||||
$total_expenses = floatval($row['total_expenses']);
|
$total_expenses = floatval($row['total_expenses']);
|
||||||
|
|
||||||
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||||
@@ -477,7 +477,7 @@ if ($user_config_dashboard_financial_enable == 1) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php while ($row = mysqli_fetch_array($sql_latest_invoice_payments)) {
|
<?php while ($row = mysqli_fetch_assoc($sql_latest_invoice_payments)) {
|
||||||
$payment_date = nullable_htmlentities($row['payment_date']);
|
$payment_date = nullable_htmlentities($row['payment_date']);
|
||||||
$payment_amount = floatval($row['payment_amount']);
|
$payment_amount = floatval($row['payment_amount']);
|
||||||
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
|
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
|
||||||
@@ -518,7 +518,7 @@ if ($user_config_dashboard_financial_enable == 1) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php while ($row = mysqli_fetch_array($sql_latest_expenses)) {
|
<?php while ($row = mysqli_fetch_assoc($sql_latest_expenses)) {
|
||||||
$expense_date = nullable_htmlentities($row['expense_date']);
|
$expense_date = nullable_htmlentities($row['expense_date']);
|
||||||
$expense_amount = floatval($row['expense_amount']);
|
$expense_amount = floatval($row['expense_amount']);
|
||||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
@@ -709,7 +709,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php while ($row = mysqli_fetch_array($sql_your_tickets)) {
|
<?php while ($row = mysqli_fetch_assoc($sql_your_tickets)) {
|
||||||
$ticket_id = intval($row['ticket_id']);
|
$ticket_id = intval($row['ticket_id']);
|
||||||
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
$ticket_prefix = nullable_htmlentities($row['ticket_prefix']);
|
||||||
$ticket_number = intval($row['ticket_number']);
|
$ticket_number = intval($row['ticket_number']);
|
||||||
@@ -795,11 +795,11 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
<?php
|
<?php
|
||||||
for ($month = 1; $month <= 12; $month++) {
|
for ($month = 1; $month <= 12; $month++) {
|
||||||
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_assoc($sql_payments);
|
||||||
$payments_for_month = floatval($row['payment_amount_for_month']);
|
$payments_for_month = floatval($row['payment_amount_for_month']);
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_assoc($sql_revenues);
|
||||||
$revenues_for_month = floatval($row['revenue_amount_for_month']);
|
$revenues_for_month = floatval($row['revenue_amount_for_month']);
|
||||||
|
|
||||||
$income_for_month = $payments_for_month + $revenues_for_month;
|
$income_for_month = $payments_for_month + $revenues_for_month;
|
||||||
@@ -825,11 +825,11 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
<?php
|
<?php
|
||||||
for ($month = 1; $month <= 12; $month++) {
|
for ($month = 1; $month <= 12; $month++) {
|
||||||
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year-1 AND MONTH(payment_date) = $month");
|
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year-1 AND MONTH(payment_date) = $month");
|
||||||
$row = mysqli_fetch_array($sql_payments);
|
$row = mysqli_fetch_assoc($sql_payments);
|
||||||
$payments_for_month = floatval($row['payment_amount_for_month']);
|
$payments_for_month = floatval($row['payment_amount_for_month']);
|
||||||
|
|
||||||
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year-1 AND MONTH(revenue_date) = $month");
|
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year-1 AND MONTH(revenue_date) = $month");
|
||||||
$row = mysqli_fetch_array($sql_revenues);
|
$row = mysqli_fetch_assoc($sql_revenues);
|
||||||
$revenues_for_month = floatval($row['revenue_amount_for_month']);
|
$revenues_for_month = floatval($row['revenue_amount_for_month']);
|
||||||
|
|
||||||
$income_for_month = $payments_for_month + $revenues_for_month;
|
$income_for_month = $payments_for_month + $revenues_for_month;
|
||||||
@@ -856,7 +856,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
$largest_invoice_month = 0;
|
$largest_invoice_month = 0;
|
||||||
for ($month = 1; $month <= 12; $month++) {
|
for ($month = 1; $month <= 12; $month++) {
|
||||||
$sql_projected = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amount_for_month FROM invoices WHERE YEAR(invoice_due) = $year AND MONTH(invoice_due) = $month AND invoice_status != 'Cancelled' AND invoice_status != 'Draft' AND invoice_status != 'Non-Billable'");
|
$sql_projected = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amount_for_month FROM invoices WHERE YEAR(invoice_due) = $year AND MONTH(invoice_due) = $month AND invoice_status != 'Cancelled' AND invoice_status != 'Draft' AND invoice_status != 'Non-Billable'");
|
||||||
$row = mysqli_fetch_array($sql_projected);
|
$row = mysqli_fetch_assoc($sql_projected);
|
||||||
$invoice_for_month = floatval($row['invoice_amount_for_month']);
|
$invoice_for_month = floatval($row['invoice_amount_for_month']);
|
||||||
|
|
||||||
if ($invoice_for_month > 0 && $invoice_for_month > $largest_invoice_month) {
|
if ($invoice_for_month > 0 && $invoice_for_month > $largest_invoice_month) {
|
||||||
@@ -882,7 +882,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
$largest_expense_month = 0;
|
$largest_expense_month = 0;
|
||||||
for ($month = 1; $month <= 12; $month++) {
|
for ($month = 1; $month <= 12; $month++) {
|
||||||
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0");
|
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0");
|
||||||
$row = mysqli_fetch_array($sql_expenses);
|
$row = mysqli_fetch_assoc($sql_expenses);
|
||||||
$expenses_for_month = floatval($row['expense_amount_for_month']);
|
$expenses_for_month = floatval($row['expense_amount_for_month']);
|
||||||
|
|
||||||
if ($expenses_for_month > 0 && $expenses_for_month > $largest_expense_month) {
|
if ($expenses_for_month > 0 && $expenses_for_month > $largest_expense_month) {
|
||||||
@@ -944,7 +944,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
$largest_trip_miles_month = 0;
|
$largest_trip_miles_month = 0;
|
||||||
for ($month = 1; $month <= 12; $month++) {
|
for ($month = 1; $month <= 12; $month++) {
|
||||||
$sql_trips = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS trip_miles_for_month FROM trips WHERE YEAR(trip_date) = $year AND MONTH(trip_date) = $month");
|
$sql_trips = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS trip_miles_for_month FROM trips WHERE YEAR(trip_date) = $year AND MONTH(trip_date) = $month");
|
||||||
$row = mysqli_fetch_array($sql_trips);
|
$row = mysqli_fetch_assoc($sql_trips);
|
||||||
$trip_miles_for_month = floatval($row['trip_miles_for_month']);
|
$trip_miles_for_month = floatval($row['trip_miles_for_month']);
|
||||||
|
|
||||||
if ($trip_miles_for_month > 0 && $trip_miles_for_month > $largest_trip_miles_month) {
|
if ($trip_miles_for_month > 0 && $trip_miles_for_month > $largest_trip_miles_month) {
|
||||||
@@ -991,13 +991,13 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
<?php
|
<?php
|
||||||
mysqli_query($mysqli, "CREATE TEMPORARY TABLE TopCategories SELECT category_name, category_id, SUM(invoice_amount) AS total_income FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year GROUP BY category_name, category_id ORDER BY total_income DESC LIMIT 5");
|
mysqli_query($mysqli, "CREATE TEMPORARY TABLE TopCategories SELECT category_name, category_id, SUM(invoice_amount) AS total_income FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year GROUP BY category_name, category_id ORDER BY total_income DESC LIMIT 5");
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT category_name FROM TopCategories");
|
$sql_categories = mysqli_query($mysqli, "SELECT category_name FROM TopCategories");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$category_name = json_encode($row['category_name']);
|
$category_name = json_encode($row['category_name']);
|
||||||
echo "$category_name,";
|
echo "$category_name,";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_other_categories = mysqli_query($mysqli, "SELECT SUM(invoices.invoice_amount) AS other_income FROM categories LEFT JOIN TopCategories ON categories.category_id = TopCategories.category_id INNER JOIN invoices ON categories.category_id = invoices.invoice_category_id WHERE TopCategories.category_id IS NULL AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year");
|
$sql_other_categories = mysqli_query($mysqli, "SELECT SUM(invoices.invoice_amount) AS other_income FROM categories LEFT JOIN TopCategories ON categories.category_id = TopCategories.category_id INNER JOIN invoices ON categories.category_id = invoices.invoice_category_id WHERE TopCategories.category_id IS NULL AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_other_categories);
|
$row = mysqli_fetch_assoc($sql_other_categories);
|
||||||
$other_income = floatval($row['other_income']);
|
$other_income = floatval($row['other_income']);
|
||||||
if ($other_income > 0) {
|
if ($other_income > 0) {
|
||||||
echo "'Others',";
|
echo "'Others',";
|
||||||
@@ -1008,7 +1008,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT total_income FROM TopCategories");
|
$sql_categories = mysqli_query($mysqli, "SELECT total_income FROM TopCategories");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$total_income = floatval($row['total_income']);
|
$total_income = floatval($row['total_income']);
|
||||||
echo "$total_income,";
|
echo "$total_income,";
|
||||||
}
|
}
|
||||||
@@ -1020,7 +1020,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
backgroundColor: [
|
backgroundColor: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT category_color FROM TopCategories JOIN categories ON TopCategories.category_id = categories.category_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT category_color FROM TopCategories JOIN categories ON TopCategories.category_id = categories.category_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$category_color = json_encode($row['category_color']);
|
$category_color = json_encode($row['category_color']);
|
||||||
echo "$category_color,";
|
echo "$category_color,";
|
||||||
}
|
}
|
||||||
@@ -1056,13 +1056,13 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
<?php
|
<?php
|
||||||
mysqli_query($mysqli, "CREATE TEMPORARY TABLE TopExpenseCategories SELECT category_name, category_id, SUM(expense_amount) AS total_expense FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year GROUP BY category_name, category_id ORDER BY total_expense DESC LIMIT 5");
|
mysqli_query($mysqli, "CREATE TEMPORARY TABLE TopExpenseCategories SELECT category_name, category_id, SUM(expense_amount) AS total_expense FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year GROUP BY category_name, category_id ORDER BY total_expense DESC LIMIT 5");
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT category_name FROM TopExpenseCategories");
|
$sql_categories = mysqli_query($mysqli, "SELECT category_name FROM TopExpenseCategories");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$category_name = json_encode($row['category_name']);
|
$category_name = json_encode($row['category_name']);
|
||||||
echo "$category_name,";
|
echo "$category_name,";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_other_categories = mysqli_query($mysqli, "SELECT SUM(expenses.expense_amount) AS other_expense FROM categories LEFT JOIN TopExpenseCategories ON categories.category_id = TopExpenseCategories.category_id INNER JOIN expenses ON categories.category_id = expenses.expense_category_id WHERE TopExpenseCategories.category_id IS NULL AND expense_vendor_id > 0 AND YEAR(expense_date) = $year");
|
$sql_other_categories = mysqli_query($mysqli, "SELECT SUM(expenses.expense_amount) AS other_expense FROM categories LEFT JOIN TopExpenseCategories ON categories.category_id = TopExpenseCategories.category_id INNER JOIN expenses ON categories.category_id = expenses.expense_category_id WHERE TopExpenseCategories.category_id IS NULL AND expense_vendor_id > 0 AND YEAR(expense_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_other_categories);
|
$row = mysqli_fetch_assoc($sql_other_categories);
|
||||||
$other_expense = floatval($row['other_expense']);
|
$other_expense = floatval($row['other_expense']);
|
||||||
if ($other_expense > 0) {
|
if ($other_expense > 0) {
|
||||||
echo "'Others',";
|
echo "'Others',";
|
||||||
@@ -1073,7 +1073,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT total_expense FROM TopExpenseCategories");
|
$sql_categories = mysqli_query($mysqli, "SELECT total_expense FROM TopExpenseCategories");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$total_expense = floatval($row['total_expense']);
|
$total_expense = floatval($row['total_expense']);
|
||||||
echo "$total_expense,";
|
echo "$total_expense,";
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1085,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
backgroundColor: [
|
backgroundColor: [
|
||||||
<?php
|
<?php
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT category_color FROM TopExpenseCategories JOIN categories ON TopExpenseCategories.category_id = categories.category_id");
|
$sql_categories = mysqli_query($mysqli, "SELECT category_color FROM TopExpenseCategories JOIN categories ON TopExpenseCategories.category_id = categories.category_id");
|
||||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$category_color = json_encode($row['category_color']);
|
$category_color = json_encode($row['category_color']);
|
||||||
echo "$category_color,";
|
echo "$category_color,";
|
||||||
}
|
}
|
||||||
@@ -1121,13 +1121,13 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
<?php
|
<?php
|
||||||
mysqli_query($mysqli, "CREATE TEMPORARY TABLE TopVendors SELECT vendor_name, vendor_id, SUM(expense_amount) AS total_expense FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year GROUP BY vendor_name, vendor_id ORDER BY total_expense DESC LIMIT 5");
|
mysqli_query($mysqli, "CREATE TEMPORARY TABLE TopVendors SELECT vendor_name, vendor_id, SUM(expense_amount) AS total_expense FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year GROUP BY vendor_name, vendor_id ORDER BY total_expense DESC LIMIT 5");
|
||||||
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_name FROM TopVendors");
|
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_name FROM TopVendors");
|
||||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
while ($row = mysqli_fetch_assoc($sql_vendors)) {
|
||||||
$vendor_name = json_encode($row['vendor_name']);
|
$vendor_name = json_encode($row['vendor_name']);
|
||||||
echo "$vendor_name,";
|
echo "$vendor_name,";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_other_vendors = mysqli_query($mysqli, "SELECT SUM(expenses.expense_amount) AS other_expense FROM vendors LEFT JOIN TopVendors ON vendors.vendor_id = TopVendors.vendor_id INNER JOIN expenses ON vendors.vendor_id = expenses.expense_vendor_id WHERE TopVendors.vendor_id IS NULL AND YEAR(expense_date) = $year");
|
$sql_other_vendors = mysqli_query($mysqli, "SELECT SUM(expenses.expense_amount) AS other_expense FROM vendors LEFT JOIN TopVendors ON vendors.vendor_id = TopVendors.vendor_id INNER JOIN expenses ON vendors.vendor_id = expenses.expense_vendor_id WHERE TopVendors.vendor_id IS NULL AND YEAR(expense_date) = $year");
|
||||||
$row = mysqli_fetch_array($sql_other_vendors);
|
$row = mysqli_fetch_assoc($sql_other_vendors);
|
||||||
$other_expense = floatval($row['other_expense']);
|
$other_expense = floatval($row['other_expense']);
|
||||||
if ($other_expense > 0) {
|
if ($other_expense > 0) {
|
||||||
echo "'Others',";
|
echo "'Others',";
|
||||||
@@ -1138,7 +1138,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
data: [
|
data: [
|
||||||
<?php
|
<?php
|
||||||
$sql_vendors = mysqli_query($mysqli, "SELECT total_expense FROM TopVendors");
|
$sql_vendors = mysqli_query($mysqli, "SELECT total_expense FROM TopVendors");
|
||||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
while ($row = mysqli_fetch_assoc($sql_vendors)) {
|
||||||
$total_expense = floatval($row['total_expense']);
|
$total_expense = floatval($row['total_expense']);
|
||||||
echo "$total_expense,";
|
echo "$total_expense,";
|
||||||
}
|
}
|
||||||
@@ -1150,7 +1150,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
|||||||
backgroundColor: [
|
backgroundColor: [
|
||||||
<?php
|
<?php
|
||||||
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id FROM TopVendors");
|
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id FROM TopVendors");
|
||||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
while ($row = mysqli_fetch_assoc($sql_vendors)) {
|
||||||
// Generate random color for each vendor
|
// Generate random color for each vendor
|
||||||
echo "'#" . substr(md5(rand()), 0, 6) . "',";
|
echo "'#" . substr(md5(rand()), 0, 6) . "',";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ if (mysqli_num_rows($sql_document) == 0) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql_document);
|
$row = mysqli_fetch_assoc($sql_document);
|
||||||
|
|
||||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
$folder_name = nullable_htmlentities($row['folder_name']);
|
||||||
$document_name = nullable_htmlentities($row['document_name']);
|
$document_name = nullable_htmlentities($row['document_name']);
|
||||||
@@ -51,10 +51,10 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
<ol class="breadcrumb d-print-none">
|
<ol class="breadcrumb d-print-none">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
<a href="client_overview.php?client_id=<?= $client_id ?>"><?= $client_name ?></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
|
<a href="files.php?client_id=<?= $client_id ?>">Files</a>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
// Build the full folder path
|
// Build the full folder path
|
||||||
@@ -84,7 +84,7 @@ $page_title = $row['document_name'];
|
|||||||
$bread_crumb_folder_name = $folder['folder_name']; // Sanitized before put in array
|
$bread_crumb_folder_name = $folder['folder_name']; // Sanitized before put in array
|
||||||
?>
|
?>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="documents.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
<a href="files.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
||||||
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -115,7 +115,7 @@ $page_title = $row['document_name'];
|
|||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<div>
|
<div>
|
||||||
Date:
|
Date:
|
||||||
<strong><?= date('Y-m-d', strtotime($document_created_at)); ?></strong>
|
<strong><?= date('Y-m-d', strtotime($document_updated_at)); ?></strong>
|
||||||
</div>
|
</div>
|
||||||
<?php if($document_created_by_name) { ?>
|
<?php if($document_created_by_name) { ?>
|
||||||
<div>
|
<div>
|
||||||
@@ -150,7 +150,7 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
$document_version_count = 1; // Initialize the document version counter
|
$document_version_count = 1; // Initialize the document version counter
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_document_versions)) {
|
while ($row = mysqli_fetch_assoc($sql_document_versions)) {
|
||||||
$document_version_id = intval($row['document_version_id']);
|
$document_version_id = intval($row['document_version_id']);
|
||||||
$document_version_name = nullable_htmlentities($row['document_version_name']);
|
$document_version_name = nullable_htmlentities($row['document_version_name']);
|
||||||
$document_version_description = nullable_htmlentities($row['document_version_description']);
|
$document_version_description = nullable_htmlentities($row['document_version_description']);
|
||||||
@@ -202,7 +202,8 @@ $page_title = $row['document_name'];
|
|||||||
<h5 class="mb-3"><i class="fas fa-tags mr-2"></i>Related Items</h5>
|
<h5 class="mb-3"><i class="fas fa-tags mr-2"></i>Related Items</h5>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-paperclip text-secondary mr-2"></i>Files
|
<i class="fas fa-fw fa-paperclip text-secondary mr-2"></i>Files
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkFileToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_file.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -215,7 +216,7 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
$linked_files = array();
|
$linked_files = array();
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_files)) {
|
while ($row = mysqli_fetch_assoc($sql_files)) {
|
||||||
$file_id = intval($row['file_id']);
|
$file_id = intval($row['file_id']);
|
||||||
$folder_id = intval($row['file_folder_id']);
|
$folder_id = intval($row['file_folder_id']);
|
||||||
$file_name = nullable_htmlentities($row['file_name']);
|
$file_name = nullable_htmlentities($row['file_name']);
|
||||||
@@ -224,9 +225,9 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="ml-2">
|
<div class="ml-2">
|
||||||
<a href="files.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>&q=<?php echo $file_name; ?>" target="_blank"><?php echo $file_name; ?></a>
|
<a href="files.php?client_id=<?= $client_id ?>&folder_id=<?= $folder_id ?>&q=<?= $file_name ?>" target="_blank"><?= $file_name ?></a>
|
||||||
<a class="confirm-link" href="post.php?unlink_file_from_document&file_id=<?php echo $file_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link" href="post.php?unlink_file_from_document&file_id=<?= $file_id ?>&document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary float-right"></i>
|
<i class="fas fa-fw fa-unlink text-secondary float-right" title="Unlink File"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -234,7 +235,8 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-users text-secondary mt-3 mr-2"></i>Contacts
|
<i class="fas fa-fw fa-users text-secondary mt-3 mr-2"></i>Contacts
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkContactToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_contact.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -247,7 +249,7 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
$linked_contacts = array();
|
$linked_contacts = array();
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_contacts)) {
|
while ($row = mysqli_fetch_assoc($sql_contacts)) {
|
||||||
$contact_id = intval($row['contact_id']);
|
$contact_id = intval($row['contact_id']);
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
|
|
||||||
@@ -260,7 +262,7 @@ $page_title = $row['document_name'];
|
|||||||
data-modal-url="modals/contact/contact_details.php?id=<?= $contact_id ?>">
|
data-modal-url="modals/contact/contact_details.php?id=<?= $contact_id ?>">
|
||||||
<?php echo $contact_name; ?></a>
|
<?php echo $contact_name; ?></a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_contact_from_document&contact_id=<?php echo $contact_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_contact_from_document&contact_id=<?php echo $contact_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink Contact"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -268,7 +270,7 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-laptop text-secondary mr-2 mt-3"></i>Assets
|
<i class="fas fa-fw fa-laptop text-secondary mr-2 mt-3"></i>Assets
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkAssetToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal" data-modal-url="modals/document/document_link_asset.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -281,7 +283,7 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
$linked_assets = array();
|
$linked_assets = array();
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
while ($row = mysqli_fetch_assoc($sql_assets)) {
|
||||||
$asset_id = intval($row['asset_id']);
|
$asset_id = intval($row['asset_id']);
|
||||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||||
|
|
||||||
@@ -295,7 +297,7 @@ $page_title = $row['document_name'];
|
|||||||
<?php echo $asset_name; ?>
|
<?php echo $asset_name; ?>
|
||||||
</a>
|
</a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink Asset"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -303,7 +305,8 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-cube text-secondary mr-2 mt-3"></i>Licenses
|
<i class="fas fa-fw fa-cube text-secondary mr-2 mt-3"></i>Licenses
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkSoftwareToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_software.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -316,7 +319,7 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
$linked_software = array();
|
$linked_software = array();
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_software)) {
|
while ($row = mysqli_fetch_assoc($sql_software)) {
|
||||||
$software_id = intval($row['software_id']);
|
$software_id = intval($row['software_id']);
|
||||||
$software_name = nullable_htmlentities($row['software_name']);
|
$software_name = nullable_htmlentities($row['software_name']);
|
||||||
|
|
||||||
@@ -326,7 +329,7 @@ $page_title = $row['document_name'];
|
|||||||
<div class="ml-2">
|
<div class="ml-2">
|
||||||
<a href="software.php?client_id=<?php echo $client_id; ?>&q=<?php echo $software_name; ?>" target="_blank"><?php echo $software_name; ?></a>
|
<a href="software.php?client_id=<?php echo $client_id; ?>&q=<?php echo $software_name; ?>" target="_blank"><?php echo $software_name; ?></a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_software_from_document&software_id=<?php echo $software_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_software_from_document&software_id=<?php echo $software_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink License"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -334,7 +337,8 @@ $page_title = $row['document_name'];
|
|||||||
?>
|
?>
|
||||||
<h6>
|
<h6>
|
||||||
<i class="fas fa-fw fa-building text-secondary mr-2 mt-3"></i>Vendors
|
<i class="fas fa-fw fa-building text-secondary mr-2 mt-3"></i>Vendors
|
||||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#linkVendorToDocumentModal">
|
<button type="button" class="btn btn-link btn-sm ajax-modal"
|
||||||
|
data-modal-url="modals/document/document_link_vendor.php?document_id=<?= $document_id ?>">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</h6>
|
</h6>
|
||||||
@@ -347,7 +351,7 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
$associated_vendors = array();
|
$associated_vendors = array();
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_vendors)) {
|
while ($row = mysqli_fetch_assoc($sql_vendors)) {
|
||||||
$vendor_id = intval($row['vendor_id']);
|
$vendor_id = intval($row['vendor_id']);
|
||||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||||
|
|
||||||
@@ -359,7 +363,7 @@ $page_title = $row['document_name'];
|
|||||||
<?php echo $vendor_name; ?>
|
<?php echo $vendor_name; ?>
|
||||||
</a>
|
</a>
|
||||||
<a class="confirm-link float-right" href="post.php?unlink_vendor_from_document&vendor_id=<?php echo $vendor_id; ?>&document_id=<?php echo $document_id; ?>">
|
<a class="confirm-link float-right" href="post.php?unlink_vendor_from_document&vendor_id=<?php echo $vendor_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||||
<i class="fas fa-fw fa-trash-alt text-secondary"></i>
|
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink Vendor"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@@ -372,7 +376,8 @@ $page_title = $row['document_name'];
|
|||||||
<h6><i class="fas fa-handshake mr-2"></i>Portal Collaboration</h6>
|
<h6><i class="fas fa-handshake mr-2"></i>Portal Collaboration</h6>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
<i class="fa fa-fw fa-eye<?php if (!$document_client_visible) { echo '-slash'; } ?> text-secondary mr-2"></i>Document is
|
<i class="fa fa-fw fa-eye<?php if (!$document_client_visible) { echo '-slash'; } ?> text-secondary mr-2"></i>Document is
|
||||||
<a href="#" data-toggle="modal" data-target="#editDocumentClientVisibileModal">
|
<a class="ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/document/document_edit_visibility.php?document_id=<?= $document_id ?>">
|
||||||
<?php
|
<?php
|
||||||
if ($document_client_visible) {
|
if ($document_client_visible) {
|
||||||
echo "<span class='text-bold text-dark'>visible</span>";
|
echo "<span class='text-bold text-dark'>visible</span>";
|
||||||
@@ -395,7 +400,7 @@ $page_title = $row['document_name'];
|
|||||||
ORDER BY document_version_created_at DESC"
|
ORDER BY document_version_created_at DESC"
|
||||||
);
|
);
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql_document_versions)) {
|
while ($row = mysqli_fetch_assoc($sql_document_versions)) {
|
||||||
$document_version_id = intval($row['document_version_id']);
|
$document_version_id = intval($row['document_version_id']);
|
||||||
$document_version_name = nullable_htmlentities($row['document_version_name']);
|
$document_version_name = nullable_htmlentities($row['document_version_name']);
|
||||||
$document_version_description = nullable_htmlentities($row['document_version_description']);
|
$document_version_description = nullable_htmlentities($row['document_version_description']);
|
||||||
@@ -427,11 +432,5 @@ $page_title = $row['document_name'];
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/document/document_link_file.php";
|
|
||||||
require_once "modals/document/document_link_contact.php";
|
|
||||||
require_once "modals/document/document_link_asset.php";
|
|
||||||
require_once "modals/document/document_link_software.php";
|
|
||||||
require_once "modals/document/document_link_vendor.php";
|
|
||||||
require_once "modals/document/document_edit_visibility.php";
|
|
||||||
require_once "modals/share_modal.php";
|
require_once "modals/share_modal.php";
|
||||||
require_once "../includes/footer.php";
|
require_once "../includes/footer.php";
|
||||||
|
|||||||
@@ -1,479 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// Default Column Sortby Filter
|
|
||||||
$sort = "document_name";
|
|
||||||
$order = "ASC";
|
|
||||||
|
|
||||||
require_once "includes/inc_all_client.php";
|
|
||||||
|
|
||||||
// Perms
|
|
||||||
enforceUserPermission('module_support');
|
|
||||||
|
|
||||||
// Folder
|
|
||||||
if (!empty($_GET['folder_id'])) {
|
|
||||||
$folder = intval($_GET['folder_id']);
|
|
||||||
} else {
|
|
||||||
$folder = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search query SQL snippet
|
|
||||||
if (!empty($q)) {
|
|
||||||
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
|
|
||||||
} else {
|
|
||||||
$query_snippet = ""; // empty
|
|
||||||
}
|
|
||||||
|
|
||||||
// Folder ID
|
|
||||||
$get_folder_id = 0;
|
|
||||||
if (!empty($_GET['folder_id'])) {
|
|
||||||
$get_folder_id = intval($_GET['folder_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set Folder Location Var used when creating folders
|
|
||||||
$folder_location = 0;
|
|
||||||
|
|
||||||
if ($get_folder_id == 0 && isset($_GET["q"])) {
|
|
||||||
$sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
|
||||||
LEFT JOIN users ON document_created_by = user_id
|
|
||||||
WHERE document_client_id = $client_id
|
|
||||||
AND document_archived_at IS NULL
|
|
||||||
$query_snippet
|
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
|
||||||
);
|
|
||||||
}else{
|
|
||||||
$sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
|
||||||
LEFT JOIN users ON document_created_by = user_id
|
|
||||||
WHERE document_client_id = $client_id
|
|
||||||
AND document_folder_id = $folder
|
|
||||||
AND document_archived_at IS NULL
|
|
||||||
$query_snippet
|
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|
||||||
|
|
||||||
// Breadcrumbs
|
|
||||||
// Build the full folder path
|
|
||||||
$folder_id = $get_folder_id;
|
|
||||||
$folder_path = array();
|
|
||||||
|
|
||||||
while ($folder_id > 0) {
|
|
||||||
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $folder_id");
|
|
||||||
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
|
|
||||||
$folder_name = nullable_htmlentities($row_folder['folder_name']);
|
|
||||||
$parent_folder = intval($row_folder['parent_folder']);
|
|
||||||
|
|
||||||
// Prepend the folder to the beginning of the array
|
|
||||||
array_unshift($folder_path, array('folder_id' => $folder_id, 'folder_name' => $folder_name));
|
|
||||||
|
|
||||||
// Move up to the parent folder
|
|
||||||
$folder_id = $parent_folder;
|
|
||||||
} else {
|
|
||||||
// If the folder is not found, break the loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="card card-dark">
|
|
||||||
<div class="card-header py-2">
|
|
||||||
<h3 class="card-title mt-2">
|
|
||||||
<i class="fa fa-fw fa-folder mr-2"></i>Documents
|
|
||||||
</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/document/document_add.php?client_id=<?= $client_id ?>&folder_id=<?= $get_folder_id ?>" data-modal-size="lg">
|
|
||||||
<i class="fas fa-plus mr-2"></i>New Document
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item text-dark ajax-modal" href="#" data-modal-url="modals/folder/folder_add.php?client_id=<?= $client_id ?>&folder_location=0¤t_folder_id=<?= $get_folder_id ?>">
|
|
||||||
<i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentFromTemplateModal">From Template</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
<form autocomplete="off">
|
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
|
||||||
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="input-group mb-3 mb-md-0">
|
|
||||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search documents in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
|
|
||||||
<div class="input-group-append">
|
|
||||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="btn-group float-right">
|
|
||||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
|
||||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/document/document_bulk_move.php?client_id=<?= $client_id ?>"
|
|
||||||
data-bulk="true">
|
|
||||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<button class="dropdown-item text-danger text-bold"
|
|
||||||
type="submit" form="bulkActions" name="bulk_delete_documents">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 border-right mb-3">
|
|
||||||
<h4>Folders</h4>
|
|
||||||
<hr>
|
|
||||||
<ul class="nav nav-pills flex-column bg-light">
|
|
||||||
<li class="nav-item">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-10">
|
|
||||||
<?php
|
|
||||||
// Get a count of documents that have no folder
|
|
||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = 0 AND document_client_id = $client_id AND document_archived_at IS NULL"));
|
|
||||||
$num_documents = intval($row['num']);
|
|
||||||
?>
|
|
||||||
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
|
||||||
/ <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="col-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
// Function to check if a folder is an ancestor of the current folder
|
|
||||||
function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
|
|
||||||
global $mysqli;
|
|
||||||
|
|
||||||
// Base case: if current_folder_id is 0 or equal to folder_id
|
|
||||||
if ($current_folder_id == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ($current_folder_id == $folder_id) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the parent folder of the current folder
|
|
||||||
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
|
|
||||||
if ($row = mysqli_fetch_assoc($result)) {
|
|
||||||
$parent_folder_id = intval($row['parent_folder']);
|
|
||||||
// Recursive call to check the parent folder
|
|
||||||
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
|
|
||||||
} else {
|
|
||||||
// Folder not found
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recursive function to display folders and subfolders
|
|
||||||
function display_folders($parent_folder_id, $client_id, $indent = 0) {
|
|
||||||
global $mysqli, $get_folder_id, $session_user_role;
|
|
||||||
|
|
||||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
|
|
||||||
while ($row = mysqli_fetch_array($sql_folders)) {
|
|
||||||
$folder_id = intval($row['folder_id']);
|
|
||||||
$folder_name = nullable_htmlentities($row['folder_name']);
|
|
||||||
|
|
||||||
// Get the number of documents in the folder
|
|
||||||
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id AND document_archived_at IS NULL"));
|
|
||||||
$num_documents = intval($row2['num']);
|
|
||||||
|
|
||||||
// Get the number of subfolders
|
|
||||||
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
|
|
||||||
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
|
|
||||||
|
|
||||||
echo '<li class="nav-item">';
|
|
||||||
echo '<div class="row">';
|
|
||||||
echo '<div class="col-10">';
|
|
||||||
echo '<a class="nav-link ';
|
|
||||||
if ($get_folder_id == $folder_id) { echo "active"; }
|
|
||||||
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
|
|
||||||
|
|
||||||
// Indentation for subfolders
|
|
||||||
echo str_repeat(' ', $indent * 4);
|
|
||||||
|
|
||||||
// Determine if the folder is open
|
|
||||||
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
|
|
||||||
echo '<i class="fas fa-fw fa-folder-open"></i>';
|
|
||||||
} else {
|
|
||||||
echo '<i class="fas fa-fw fa-folder"></i>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo ' ' . $folder_name;
|
|
||||||
|
|
||||||
if ($num_documents > 0) {
|
|
||||||
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</a>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div class="col-2">';
|
|
||||||
?>
|
|
||||||
<div class="dropdown">
|
|
||||||
<button class="btn btn-sm" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-ellipsis-v"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/folder/folder_rename.php?id=<?= $folder_id ?>">
|
|
||||||
<i class="fas fa-fw fa-edit mr-2"></i>Rename
|
|
||||||
</a>
|
|
||||||
<?php
|
|
||||||
// Only show delete option if user is admin, folder has no documents, and no subfolders
|
|
||||||
if ($session_user_role == 3 && $num_documents == 0 && $subfolder_count == 0) { ?>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
if ($subfolder_count > 0) {
|
|
||||||
// Display subfolders
|
|
||||||
echo '<ul class="nav nav-pills flex-column bg-light">';
|
|
||||||
display_folders($folder_id, $client_id, $indent + 1);
|
|
||||||
echo '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start displaying folders from the root (parent_folder = 0)
|
|
||||||
display_folders(0, $client_id);
|
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-9">
|
|
||||||
|
|
||||||
<nav>
|
|
||||||
<ol class="breadcrumb">
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=0">
|
|
||||||
<i class="fas fa-fw fa-folder mr-2"></i>Root
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
// Output breadcrumb items for each folder in the path
|
|
||||||
foreach ($folder_path as $folder) {
|
|
||||||
$bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
|
|
||||||
$bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
|
|
||||||
|
|
||||||
?>
|
|
||||||
<li class="breadcrumb-item">
|
|
||||||
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<form id="bulkActions" action="post.php" method="post">
|
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
|
||||||
|
|
||||||
<div class="table-responsive-sm">
|
|
||||||
<table class="table table-border">
|
|
||||||
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
|
||||||
<tr>
|
|
||||||
<td class="bg-light pr-0">
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<th>
|
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">
|
|
||||||
Name <?php if ($sort == 'document_name') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">
|
|
||||||
Created <?php if ($sort == 'document_created_at') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">
|
|
||||||
Last Update <?php if ($sort == 'document_updated_at') { echo $order_icon; } ?>
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th></th>
|
|
||||||
<th class="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$document_id = intval($row['document_id']);
|
|
||||||
$document_name = nullable_htmlentities($row['document_name']);
|
|
||||||
$document_description = nullable_htmlentities($row['document_description']);
|
|
||||||
$document_content = nullable_htmlentities($row['document_content']);
|
|
||||||
$document_created_by_name = nullable_htmlentities($row['user_name']);
|
|
||||||
$document_created_at = date("m/d/Y",strtotime($row['document_created_at']));
|
|
||||||
if ($row['document_updated_at']) {
|
|
||||||
$document_updated_at_display = date("m/d/Y",strtotime($row['document_updated_at']));
|
|
||||||
} else {
|
|
||||||
$document_updated_at_display = "-";
|
|
||||||
}
|
|
||||||
$document_folder_id = intval($row['document_folder_id']);
|
|
||||||
|
|
||||||
// Check if shared
|
|
||||||
$sql_shared = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT * FROM shared_items
|
|
||||||
WHERE item_client_id = $client_id
|
|
||||||
AND item_active = 1
|
|
||||||
AND item_views != item_view_limit
|
|
||||||
AND item_expire_at > NOW()
|
|
||||||
AND item_type = 'Document'
|
|
||||||
AND item_related_id = $document_id
|
|
||||||
LIMIT 1"
|
|
||||||
);
|
|
||||||
$row = mysqli_fetch_array($sql_shared);
|
|
||||||
if($row) {
|
|
||||||
$item_id = intval($row['item_id']);
|
|
||||||
$item_active = nullable_htmlentities($row['item_active']);
|
|
||||||
$item_key = nullable_htmlentities($row['item_key']);
|
|
||||||
$item_type = nullable_htmlentities($row['item_type']);
|
|
||||||
$item_related_id = intval($row['item_related_id']);
|
|
||||||
$item_note = nullable_htmlentities($row['item_note']);
|
|
||||||
$item_recipient = nullable_htmlentities($row['item_recipient']);
|
|
||||||
$item_views = nullable_htmlentities($row['item_views']);
|
|
||||||
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
|
||||||
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
|
||||||
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
|
||||||
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="bg-light pr-0">
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input bulk-select" type="checkbox" name="document_ids[]" value="<?php echo $document_id ?>">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt"></i> <?php echo $document_name; ?></a>
|
|
||||||
<div class="text-secondary mt-1"><?php echo $document_description; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo $document_created_at; ?>
|
|
||||||
<div class="text-secondary mt-1"><?php echo $document_created_by_name; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $document_updated_at_display; ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
|
|
||||||
<div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
|
|
||||||
<i class="fas fa-link mr-2 mt-1"></i>
|
|
||||||
<div class="media-body">Shared
|
|
||||||
<br>
|
|
||||||
<small class="text-secondary"><?php echo $item_recipient; ?></small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown dropleft text-center">
|
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-ellipsis-h"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-size="lg"
|
|
||||||
data-modal-url="modals/document/document_view.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-eye mr-2"></i>Quick View
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-size="lg"
|
|
||||||
data-modal-url="modals/document/document_edit.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Edit
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">
|
|
||||||
<i class="fas fa-fw fa-share mr-2"></i>Share
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/document/document_rename.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-pencil-alt mr-2"></i>Rename
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item ajax-modal" href="#"
|
|
||||||
data-modal-url="modals/document/document_move.php?id=<?= $document_id ?>">
|
|
||||||
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
|
|
||||||
</a>
|
|
||||||
<?php if ($session_user_role == 3) { ?>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_document=<?php echo $document_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_document=<?php echo $document_id; ?>">
|
|
||||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php require_once "../includes/filter_footer.php"; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "modals/share_modal.php";
|
|
||||||
require_once "modals/document/document_add_from_template.php";
|
|
||||||
require_once "../includes/footer.php";
|
|
||||||
@@ -80,7 +80,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportDomainModal">
|
<a class="dropdown-item text-dark ajax-modal" href="#"
|
||||||
|
data-modal-url="modals/domain/domain_export.php?<?= $client_url ?>">
|
||||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -122,7 +123,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$access_permission_query
|
$access_permission_query
|
||||||
ORDER BY client_name ASC
|
ORDER BY client_name ASC
|
||||||
");
|
");
|
||||||
while ($row = mysqli_fetch_array($sql_clients_filter)) {
|
while ($row = mysqli_fetch_assoc($sql_clients_filter)) {
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
?>
|
?>
|
||||||
@@ -229,7 +230,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$domain_id = intval($row['domain_id']);
|
$domain_id = intval($row['domain_id']);
|
||||||
$domain_name = nullable_htmlentities($row['domain_name']);
|
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||||
$domain_description = nullable_htmlentities($row['domain_description']);
|
$domain_description = nullable_htmlentities($row['domain_description']);
|
||||||
@@ -357,16 +358,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "../includes/filter_footer.php";
|
<?php require_once "../includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "modals/domain/domain_export.php";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script src="../js/bulk_actions.js"></script>
|
<script src="../js/bulk_actions.js"></script>
|
||||||
|
|
||||||
<?php require_once "../includes/footer.php";
|
<?php require_once "../includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user