mirror of
https://github.com/itflow-org/itflow
synced 2026-08-25 17:05:15 +00:00
Feature: Designate a client record as your organization currently only provdes a direct link when you click company name in top of the side nav
This commit is contained in:
17
admin/database_updates/2.7.1.php
Normal file
17
admin/database_updates/2.7.1.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* ITFlow - Database update to version 2.7.1 (from 2.7.0)
|
||||
* Included by admin/database_updates.php - do not access directly
|
||||
*/
|
||||
|
||||
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
||||
|
||||
// Which client record, if any, is the MSP's own company. Most installs create one to
|
||||
// hold their internal tickets, documentation, assets and credentials, but nothing in
|
||||
// the app knew that record was special. Admin > Settings > Company Details sets it.
|
||||
//
|
||||
// 0 means no client is designated, which is every existing install - nothing changes
|
||||
// until an administrator chooses one.
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings`
|
||||
ADD COLUMN `config_internal_client_id` int(11) NOT NULL DEFAULT 0");
|
||||
@@ -42,8 +42,18 @@ if (isset($_POST['edit_company'])) {
|
||||
}
|
||||
}
|
||||
|
||||
// The client record standing in for this company. Verified against the clients table
|
||||
// rather than trusted from the POST, so a stale or hand-made value cannot leave the
|
||||
// sidebar pointing at a client that no longer exists. 0 clears the designation.
|
||||
$internal_client_id = intval($_POST['internal_client_id'] ?? 0);
|
||||
if ($internal_client_id !== 0 && !mysqli_num_rows(mysqli_query($mysqli, "SELECT client_id FROM clients WHERE client_id = $internal_client_id LIMIT 1"))) {
|
||||
$internal_client_id = 0;
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone_country_code = '$phone_country_code', company_phone = '$phone', company_email = '$email', company_website = '$website', company_tax_id = '$tax_id' WHERE company_id = 1");
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_internal_client_id = $internal_client_id WHERE company_id = 1");
|
||||
|
||||
logAudit("Settings", "Edit", "$session_name edited company details");
|
||||
|
||||
flashAlert("Company <strong>$name</strong> edited");
|
||||
|
||||
@@ -141,6 +141,27 @@ $company_initials = escapeHtml(initials($company_name));
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="mb-3">
|
||||
<label>My Company's Client Record</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-house-user"></i></span>
|
||||
<select class="form-select select2" name="internal_client_id">
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
$sql_internal_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
|
||||
while ($row_internal_client = mysqli_fetch_assoc($sql_internal_clients)) {
|
||||
$internal_client_id_select = intval($row_internal_client['client_id']);
|
||||
$internal_client_name_select = escapeHtml($row_internal_client['client_name']);
|
||||
?>
|
||||
<option <?php if ($config_internal_client_id == $internal_client_id_select) { echo "selected"; } ?> value="<?= $internal_client_id_select ?>"><?= $internal_client_name_select ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<small class="text-muted">If you keep a client record for your own company - for internal tickets, documentation, assets and credentials - point it out here. Your company name in the sidebar then links straight to it.</small>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<button type="submit" name="edit_company" class="btn btn-primary text-bold"><i class="fas fa-check me-2"></i>Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user