Added Definable Client Abbreviation

This commit is contained in:
johnnyq 2024-06-07 18:18:42 -04:00
parent b229349d8c
commit 24022eca55
10 changed files with 41 additions and 8 deletions

View File

@ -291,6 +291,16 @@
<div class="tab-pane fade" id="pills-more">
<div class="form-group">
<label>Abbreviation</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
</div>
<input type="text" class="form-control" name="abbreviation" placeholder="Abbreviated name for client" maxlength="5">
</div>
</div>
<div class="form-group">
<label>Notes</label>
<textarea class="form-control" rows="6" name="notes" placeholder="Enter some notes"></textarea>

View File

@ -184,6 +184,16 @@
<div class="tab-pane fade" id="pills-client-more<?php echo $client_id; ?>">
<div class="form-group">
<label>Abbreviation</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
</div>
<input type="text" class="form-control" name="abbreviation" placeholder="Abbreviated name for client" value="<?php echo $client_abbreviation; ?>" maxlength="5">
</div>
</div>
<div class="form-group">
<textarea class="form-control" rows="8" placeholder="Enter some notes"
name="notes"><?php echo $client_notes; ?></textarea>

View File

@ -2,7 +2,7 @@
<aside class="main-sidebar sidebar-dark-<?php echo nullable_htmlentities($config_theme); ?> d-print-none">
<a class="brand-link pb-1 mt-1" href="clients.php">
<p class="h5"><i class="nav-icon fas fa-arrow-left ml-3 mr-2"></i> Back | <strong><?php echo shortenClient($client_name); ?></strong></p>
<p class="h5"><i class="nav-icon fas fa-arrow-left ml-3 mr-2"></i> Back | <strong><?php if($client_abbreviation) { echo $client_abbreviation; } else { echo shortenClient($client_name); } ?></strong></p>
</a>
<!-- Sidebar -->

View File

@ -286,6 +286,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$client_net_terms = intval($row['client_net_terms']);
$client_tax_id_number = nullable_htmlentities($row['client_tax_id_number']);
$client_referral = nullable_htmlentities($row['client_referral']);
$client_abbreviation = nullable_htmlentities($row['client_abbreviation']);
$client_notes = nullable_htmlentities($row['client_notes']);
$client_created_at = date('Y-m-d', strtotime($row['client_created_at']));
$client_updated_at = nullable_htmlentities($row['client_updated_at']);

View File

@ -1942,12 +1942,21 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.6'");
}
// if (CURRENT_DATABASE_VERSION == '1.3.6') {
// // Insert queries here required to update to DB version 1.3.7
if (CURRENT_DATABASE_VERSION == '1.3.6') {
mysqli_query($mysqli, "ALTER TABLE `clients` ADD `client_abbreviation` VARCHAR(10) DEFAULT NULL AFTER `client_tax_id_number`");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.7'");
}
// if (CURRENT_DATABASE_VERSION == '1.3.7') {
// // Insert queries here required to update to DB version 1.3.8
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.7'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.8'");
// }
} else {
// Up-to-date
}

View File

@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/
DEFINE("LATEST_DATABASE_VERSION", "1.3.6");
DEFINE("LATEST_DATABASE_VERSION", "1.3.7");

3
db.sql
View File

@ -274,6 +274,7 @@ CREATE TABLE `clients` (
`client_currency_code` varchar(200) NOT NULL,
`client_net_terms` int(10) NOT NULL,
`client_tax_id_number` varchar(255) DEFAULT NULL,
`client_abbreviation` varchar(10) DEFAULT NULL,
`client_notes` text DEFAULT NULL,
`client_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`client_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
@ -1966,4 +1967,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-06-01 14:25:19
-- Dump completed on 2024-06-07 18:18:21

View File

@ -51,6 +51,7 @@ if (isset($_GET['client_id'])) {
$client_net_terms = $config_default_net_terms;
}
$client_tax_id_number = nullable_htmlentities($row['client_tax_id_number']);
$client_abbreviation = nullable_htmlentities($row['client_abbreviation']);
$client_rate = floatval($row['client_rate']);
$client_notes = nullable_htmlentities($row['client_notes']);
$client_created_at = nullable_htmlentities($row['client_created_at']);

View File

@ -27,7 +27,7 @@ if (isset($_POST['add_client'])) {
$extended_log_description = '';
// Create client
mysqli_query($mysqli, "INSERT INTO clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_tax_id_number = '$tax_id_number', client_lead = $lead, client_notes = '$notes', client_accessed_at = NOW()");
mysqli_query($mysqli, "INSERT INTO clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_tax_id_number = '$tax_id_number', client_lead = $lead, client_abbreviation = '$abbreviation', client_notes = '$notes', client_accessed_at = NOW()");
$client_id = mysqli_insert_id($mysqli);
@ -123,7 +123,7 @@ if (isset($_POST['edit_client'])) {
$client_id = intval($_POST['client_id']);
mysqli_query($mysqli, "UPDATE clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_tax_id_number = '$tax_id_number', client_lead = $lead, client_notes = '$notes' WHERE client_id = $client_id");
mysqli_query($mysqli, "UPDATE clients SET client_name = '$name', client_type = '$type', client_website = '$website', client_referral = '$referral', client_rate = $rate, client_currency_code = '$currency_code', client_net_terms = $net_terms, client_tax_id_number = '$tax_id_number', client_lead = $lead, client_abbreviation = '$abbreviation', client_notes = '$notes' WHERE client_id = $client_id");
// Create Referral if it doesn't exist
$sql = mysqli_query($mysqli, "SELECT category_name FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL AND category_name = '$referral'");

View File

@ -7,5 +7,6 @@ $rate = floatval($_POST['rate']);
$currency_code = sanitizeInput($_POST['currency_code']);
$net_terms = intval($_POST['net_terms']);
$tax_id_number = sanitizeInput($_POST['tax_id_number']);
$abbreviation = sanitizeInput($_POST['abbreviation']);
$notes = sanitizeInput($_POST['notes']);
$lead = intval($_POST['lead']);