Merge branch 'master' into discounts

This commit is contained in:
Andrew Malsbury 2023-10-19 17:19:32 -05:00 committed by GitHub
commit a382092dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 429 additions and 46 deletions

View File

@ -103,7 +103,8 @@ ITFlow is self-hosted. There is a full installation guide in the [docs](https://
- Login as root
- Download & run install script
```
wget -O - https://github.com/itflow-org/itflow-install-script/raw/main/itflow_install.sh | bash
wget -O itflow_install.sh https://github.com/itflow-org/itflow-install-script/raw/main/itflow_install.sh
bash itflow_install.sh
```
- Follow Instructions & navigate to setup URL shown
- Leave us feedback in the [forum](https://forum.itflow.org/d/11-road-map)

View File

@ -2,12 +2,15 @@
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-user-plus mr-2"></i>Create client</h5>
<h5 class="modal-title"><i class="fa fa-fw fa-user-plus mr-2"></i>Create <?php if (isset($lead)){ echo "Lead";} else { echo "Client";}?></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_lead" value="<?php
if (isset($lead)){ echo "1";} else { echo "0";}
?>">
<div class="modal-body bg-white">
<ul class="nav nav-pills nav-justified mb-3">
@ -224,7 +227,9 @@
<div class="tab-pane fade" id="pills-additional">
<?php if ($config_module_enable_accounting) { ?>
<?php if ($config_module_enable_accounting) {
if (!isset($lead)) {
?>
<div class="form-group">
<label>Hourly Rate</label>
@ -278,7 +283,7 @@
<?php } else { ?>
<input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>">
<input type="hidden" name="net_terms" value="0">
<?php } ?>
<?php } }?>
<div class="form-group">
<label>Notes</label>

View File

@ -2,7 +2,9 @@
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-user-edit mr-2"></i>Editing: <strong><?php echo $client_name; ?></strong></h5>
<h5 class="modal-title"><i class="fa fa-fw fa-user-edit mr-2"></i>Editing: <strong>
<?php echo $client_name; ?>
</strong></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
@ -13,13 +15,22 @@
<ul class="nav nav-pills nav-justified mb-3">
<li class="nav-item">
<a class="nav-link active" data-toggle="pill" href="#pills-client-details<?php echo $client_id; ?>">Details</a>
<a class="nav-link active" data-toggle="pill"
href="#pills-client-details<?php echo $client_id; ?>">Details</a>
</li>
<?php if (!isset($lead)) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill"
href="#pills-client-billing<?php echo $client_id; ?>">Billing</a>
</li>
<?php } ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill"
href="#pills-client-notes<?php echo $client_id; ?>">Notes</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-client-notes<?php echo $client_id; ?>">Notes</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-client-tag<?php echo $client_id; ?>">Tag</a>
<a class="nav-link" data-toggle="pill"
href="#pills-client-tag<?php echo $client_id; ?>">Tag</a>
</li>
</ul>
@ -35,7 +46,8 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<input type="text" class="form-control" name="name" placeholder="Name or Company" value="<?php echo $client_name; ?>" required>
<input type="text" class="form-control" name="name" placeholder="Name or Company"
value="<?php echo $client_name; ?>" required>
</div>
</div>
@ -45,7 +57,8 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-briefcase"></i></span>
</div>
<input type="text" class="form-control" name="type" placeholder="Industry" value="<?php echo $client_type; ?>">
<input type="text" class="form-control" name="type" placeholder="Industry"
value="<?php echo $client_type; ?>">
</div>
</div>
@ -63,14 +76,20 @@
while ($row = mysqli_fetch_array($referral_sql)) {
$referral = nullable_htmlentities($row['category_name']);
?>
<option <?php if ($client_referral == $referral) { echo "selected"; } ?> > <?php echo $referral; ?></option>
<option <?php if ($client_referral == $referral) {
echo "selected";
} ?>>
<?php echo $referral; ?>
</option>
<?php
}
?>
</select>
<div class="input-group-append">
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#addQuickReferralModal"><i class="fas fa-fw fa-plus"></i></button>
<button type="button" class="btn btn-secondary" data-toggle="modal"
data-target="#addQuickReferralModal"><i
class="fas fa-fw fa-plus"></i></button>
</div>
</div>
</div>
@ -81,10 +100,26 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
</div>
<input type="text" class="form-control" name="website" placeholder="ex. google.com" value="<?php echo $client_website; ?>">
<input type="text" class="form-control" name="website" placeholder="ex. google.com"
value="<?php echo $client_website; ?>">
</div>
</div>
<div class="form-group">
<label>Is Lead <strong class="text-danger">*</strong></label>
<div class="input-group">
<div class="input-group-prepend">
<input type="checkbox" name="lead" value="1"<?php if ($client_is_lead == 1) {
echo "checked";
} ?>>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-client-billing<?php echo $client_id; ?>">
<?php if ($config_module_enable_accounting) { ?>
<div class="form-group">
@ -93,7 +128,9 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
</div>
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00" value="<?php echo $client_rate; ?>">
<input type="text" class="form-control" inputmode="numeric"
pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00"
value="<?php echo $client_rate; ?>">
</div>
</div>
@ -105,8 +142,12 @@
</div>
<select class="form-control select2" name="currency_code" required>
<option value="">- Currency -</option>
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
<option <?php if ($client_currency_code == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<?php foreach ($currencies_array as $currency_code => $currency_name) { ?>
<option <?php if ($client_currency_code == $currency_code) {
echo "selected";
} ?> value="<?php echo $currency_code; ?>">
<?php echo "$currency_code - $currency_name"; ?>
</option>
<?php } ?>
</select>
</div>
@ -120,8 +161,12 @@
</div>
<select class="form-control select2" name="net_terms">
<option value="">- Net Terms -</option>
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
<option <?php if ($net_term_value == $client_net_terms) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
<?php foreach ($net_terms_array as $net_term_value => $net_term_name) { ?>
<option <?php if ($net_term_value == $client_net_terms) {
echo "selected";
} ?> value="<?php echo $net_term_value; ?>">
<?php echo $net_term_name; ?>
</option>
<?php } ?>
</select>
</div>
@ -133,12 +178,17 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
</div>
<input type="text" class="form-control" name="tax_id_number" placeholder="Tax ID Number" value="<?php echo $client_tax_id_number; ?>">
<input type="text" class="form-control" name="tax_id_number"
placeholder="Tax ID Number" value="<?php echo $client_tax_id_number; ?>">
</div>
</div>
<?php } else { ?>
<input type="hidden" name="currency_code" value="<?php if(empty($currency_code)) { echo $session_company_currency; } else { echo $currency_code; } ?>">
<input type="hidden" name="currency_code" value="<?php if (empty($currency_code)) {
echo $session_company_currency;
} else {
echo $currency_code;
} ?>">
<input type="hidden" name="net_terms" value="<?php echo $net_term_value; ?>">
<?php } ?>
@ -147,7 +197,8 @@
<div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
<div class="form-group">
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $client_notes; ?></textarea>
<textarea class="form-control" rows="8" placeholder="Enter some notes"
name="notes"><?php echo $client_notes; ?></textarea>
</div>
</div>
@ -175,10 +226,16 @@
?>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>" name="tags[]" value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "checked"; } ?>>
<label for="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>" class="custom-control-label">
<input class="custom-control-input" type="checkbox"
id="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>" name="tags[]"
value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) {
echo "checked";
} ?>>
<label for="tagCheckbox<?php echo "$tag_id_select$client_id"; ?>"
class="custom-control-label">
<span class="badge bg-<?php echo $tag_color_select; ?>">
<?php echo "<i class='fa fw fa-$tag_icon_select mr-2'></i>"; ?><?php echo $tag_name_select; ?>
<?php echo "<i class='fa fw fa-$tag_icon_select mr-2'></i>"; ?>
<?php echo $tag_name_select; ?>
</span>
</label>
</div>
@ -188,7 +245,7 @@
</ul>
<?php if (mysqli_num_rows($sql_tags_select) == 0){ ?>
<?php if (mysqli_num_rows($sql_tags_select) == 0) { ?>
<div class='my-3 text-center'>
<i class='fa fa-fw fa-6x fa-tags text-secondary'></i>
@ -203,10 +260,12 @@
</div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="edit_client" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
<button type="submit" name="edit_client" class="btn btn-primary text-bold"><i
class="fa fa-check mr-2"></i>Save</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i
class="fa fa-times mr-2"></i>Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>

301
client_leads.php Normal file
View File

@ -0,0 +1,301 @@
<?php
// Default Column Sortby/Order Filter
$sort = "client_accessed_at";
$order = "DESC";
global $lead;
$lead = 1;
require_once("inc_all.php");
//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
$sql = mysqli_query(
$mysqli,
"
SELECT SQL_CALC_FOUND_ROWS clients.*, contacts.*, locations.*, GROUP_CONCAT(tags.tag_name) AS tag_names
FROM clients
LEFT JOIN contacts ON clients.client_id = contacts.contact_client_id AND contact_primary = 1
LEFT JOIN locations ON clients.client_id = locations.location_client_id AND location_primary = 1
LEFT JOIN client_tags ON client_tags.client_tag_client_id = clients.client_id
LEFT JOIN tags ON tags.tag_id = client_tags.client_tag_tag_id
WHERE (clients.client_name LIKE '%$q%' OR clients.client_type LIKE '%$q%' OR clients.client_referral LIKE '%$q%'
OR contacts.contact_email LIKE '%$q%' OR contacts.contact_name LIKE '%$q%' OR contacts.contact_phone LIKE '%$phone_query%'
OR contacts.contact_mobile LIKE '%$phone_query%' OR locations.location_address LIKE '%$q%'
OR locations.location_city LIKE '%$q%' OR locations.location_state LIKE '%$q%' OR locations.location_zip LIKE '%$q%'
OR tags.tag_name LIKE '%$q%' OR clients.client_tax_id_number LIKE '%$q%')
AND clients.client_archived_at IS NULL
AND clients.client_lead = 1
AND DATE(clients.client_created_at) BETWEEN '$dtf' AND '$dtt'
GROUP BY clients.client_id
ORDER BY $sort $order
LIMIT $record_from, $record_to
");
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-user-friends mr-2"></i>Lead Management</h3>
<div class="card-tools">
<?php if ($session_user_role == 3) { ?>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addClientModal"><i class="fas fa-plus mr-2"></i>New Lead</button>
<?php } ?>
</div>
</div>
<div class="card-body p-2 p-md-3">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="col-md-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search leads" autofocus>
<div class="input-group-append">
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
<div class="col-md-8">
<div class="float-right">
<button type="button" class="btn btn-outline-secondary" data-toggle="modal" data-target="#exportClientModal"><i class="fa fa-fw fa-download mr-2"></i>Export</button>
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (!empty($_GET['dtf']) || $_GET['canned_date'] !== "custom" ) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>Canned date</label>
<select class="form-control select2" name="canned_date">
<option <?php if ($_GET['canned_date'] == "custom") { echo "selected"; } ?> value="custom">Custom</option>
<option <?php if ($_GET['canned_date'] == "today") { echo "selected"; } ?> value="today">Today</option>
<option <?php if ($_GET['canned_date'] == "yesterday") { echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if ($_GET['canned_date'] == "thisweek") { echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if ($_GET['canned_date'] == "lastweek") { echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if ($_GET['canned_date'] == "thismonth") { echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if ($_GET['canned_date'] == "lastmonth") { echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if ($_GET['canned_date'] == "thisyear") { echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if ($_GET['canned_date'] == "lastyear") { echo "selected"; } ?> value="lastyear">Last Year</option>
</select>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>Date from</label>
<input type="date" class="form-control" name="dtf" max="2999-12-31" value="<?php echo nullable_htmlentities($dtf); ?>">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>Date to</label>
<input type="date" class="form-control" name="dtt" max="2999-12-31" value="<?php echo nullable_htmlentities($dtt); ?>">
</div>
</div>
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-hover table-borderless">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=location_city&order=<?php echo $disp; ?>">Primary address </a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Primary contact</a></th>
<?php if ($session_user_role == 3) { ?> <th class="text-center">Action</th> <?php } ?>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
$client_type = nullable_htmlentities($row['client_type']);
$location_id = intval($row['location_id']);
$location_country = nullable_htmlentities($row['location_country']);
$location_address = nullable_htmlentities($row['location_address']);
$location_city = nullable_htmlentities($row['location_city']);
$location_state = nullable_htmlentities($row['location_state']);
$location_zip = nullable_htmlentities($row['location_zip']);
if (empty($location_address) && empty($location_city) && empty($location_state) && empty($location_zip)) {
$location_address_display = "-";
} else {
$location_address_display = "$location_address<br>$location_city $location_state $location_zip";
}
$contact_id = intval($row['contact_id']);
$contact_name = nullable_htmlentities($row['contact_name']);
$contact_title = nullable_htmlentities($row['contact_title']);
$contact_phone = formatPhoneNumber($row['contact_phone']);
$contact_extension = nullable_htmlentities($row['contact_extension']);
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
$contact_email = nullable_htmlentities($row['contact_email']);
$client_website = nullable_htmlentities($row['client_website']);
$client_rate = floatval($row['client_rate']);
$client_currency_code = nullable_htmlentities($row['client_currency_code']);
$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_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']);
$client_archive_at = nullable_htmlentities($row['client_archived_at']);
$client_is_lead = intval($row['client_lead']);
// Client Tags
$client_tag_name_display_array = array();
$client_tag_id_array = array();
$sql_client_tags = mysqli_query($mysqli, "SELECT * FROM client_tags LEFT JOIN tags ON client_tags.client_tag_tag_id = tags.tag_id WHERE client_tags.client_tag_client_id = $client_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_client_tags)) {
$client_tag_id = intval($row['tag_id']);
$client_tag_name = nullable_htmlentities($row['tag_name']);
$client_tag_color = nullable_htmlentities($row['tag_color']);
if (empty($client_tag_color)) {
$client_tag_color = "dark";
}
$client_tag_icon = nullable_htmlentities($row['tag_icon']);
if (empty($client_tag_icon)) {
$client_tag_icon = "tag";
}
$client_tag_id_array[] = $client_tag_id;
$client_tag_name_display_array[] = "<a href='client_leads.php?q=$client_tag_name'><span class='badge bg-$client_tag_color'><i class='fa fa-fw fa-$client_tag_icon mr-2'></i>$client_tag_name</span></a> ";
}
$client_tags_display = implode('', $client_tag_name_display_array);
//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 NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' ");
$row = mysqli_fetch_array($sql_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");
$row = mysqli_fetch_array($sql_amount_paid);
$amount_paid = floatval($row['amount_paid']);
$balance = $invoice_amounts - $amount_paid;
//set Text color on balance
if ($balance > 0) {
$balance_text_color = "text-danger font-weight-bold";
} else {
$balance_text_color = "";
}
//Get Monthly Recurring Total
$sql_recurring_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_amount) AS recurring_monthly_total FROM recurring WHERE recurring_status = 1 AND recurring_frequency = 'month' AND recurring_client_id = $client_id");
$row = mysqli_fetch_array($sql_recurring_monthly_total);
$recurring_monthly_total = floatval($row['recurring_monthly_total']);
//Get Yearly Recurring Total
$sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_amount) AS recurring_yearly_total FROM recurring WHERE recurring_status = 1 AND recurring_frequency = 'year' AND recurring_client_id = $client_id");
$row = mysqli_fetch_array($sql_recurring_yearly_total);
$recurring_yearly_total = floatval($row['recurring_yearly_total']) / 12;
$recurring_monthly = $recurring_monthly_total + $recurring_yearly_total;
?>
<tr>
<td>
<a class="font-weight-bold" href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?> <i class="fas fa-fw fa-arrow-circle-right"></i></a>
<?php
if (!empty($client_type)) {
?>
<div class="text-secondary mt-1">
<?php echo $client_type; ?>
</div>
<?php } ?>
<?php
if (!empty($client_tags_display)) { ?>
<div class="mt-1">
<?php echo $client_tags_display; ?>
</div>
<?php } ?>
<div class="mt-1 text-secondary">
<small><strong>Created:</strong> <?php echo $client_created_at; ?></small>
</div>
</td>
<td><?php echo $location_address_display; ?></td>
<td>
<?php
if (empty($contact_name) && empty($contact_phone) && empty($contact_mobile) && empty($client_email)) {
echo "-";
}
if (!empty($contact_name)) { ?>
<div>
<i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i><?php echo $contact_name; ?>
</div>
<?php } else {
echo "-";
}
if (!empty($contact_phone)) { ?>
<div class="mt-1">
<i class="fa fa-fw fa-phone text-secondary mr-2 mb-2"></i><?php echo $contact_phone; ?> <?php if (!empty($contact_extension)) { echo "x$contact_extension"; } ?>
</div>
<?php }
if (!empty($contact_mobile)) { ?>
<div class="mt-1">
<i class="fa fa-fw fa-mobile-alt text-secondary mr-2"></i><?php echo $contact_mobile; ?>
</div>
<?php }
if (!empty($contact_email)) { ?>
<div class="mt-1">
<i class="fa fa-fw fa-envelope text-secondary mr-2"></i><a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a><button class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button>
</div>
<?php } ?>
</td>
<!-- Show actions for Admin role only -->
<?php if ($session_user_role == 3) { ?>
<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" href="#" data-toggle="modal" data-target="#editClientModal<?php echo $client_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_client=<?php echo $client_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive
</a>
</div>
</div>
</td>
<?php } ?>
</tr>
<?php
require("client_edit_modal.php");
} ?>
</tbody>
</table>
</div>
<?php require_once("pagination.php"); ?>
</div>
</div>
<?php
require_once("client_add_modal.php");
require_once("client_export_modal.php");
require_once("category_quick_add_modal.php");
require_once("footer.php");

View File

@ -25,6 +25,7 @@ $sql = mysqli_query(
OR tags.tag_name LIKE '%$q%' OR clients.client_tax_id_number LIKE '%$q%')
AND clients.client_archived_at IS NULL
AND DATE(clients.client_created_at) BETWEEN '$dtf' AND '$dtt'
AND clients.client_lead = 0
GROUP BY clients.client_id
ORDER BY $sort $order
LIMIT $record_from, $record_to

View File

@ -466,7 +466,6 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.1'");
}
if (CURRENT_DATABASE_VERSION == '0.3.1') {
// Assets
@ -1104,8 +1103,6 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.9'");
}
if (CURRENT_DATABASE_VERSION == '0.5.9') {
// Copy primary_location and primary_contact to their new vars in their own respecting tables
@ -1374,7 +1371,6 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.6'");
}
// Update DB to 0.8.7
if (CURRENT_DATABASE_VERSION == '0.8.6') {
// Insert queries here required to update to DB version 0.8.7
mysqli_query($mysqli, "ALTER TABLE `accounts` ADD `account_type` int(6) DEFAULT NULL AFTER `account_notes`");
@ -1384,7 +1380,6 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.7'");
}
// Update DB to 0.8.8
if (CURRENT_DATABASE_VERSION == '0.8.7') {
//Create Main Account Types
mysqli_query($mysqli,"INSERT INTO account_types SET account_type_name = 'Asset', account_type_id= '10', account_type_description = 'Assets are economic resources which are expected to benefit the business in the future.'");
@ -1401,10 +1396,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.8'");
}
// Be sure to change database_version.php to reflect the version you are updating to here
// Please add this same comment block to the bottom of this file, and update the version number.
// Uncomment Below Lines, to add additional database updates
//
if (CURRENT_DATABASE_VERSION == '0.8.8') {
// Insert queries here required to update to DB version 0.8.9
mysqli_query($mysqli, "ALTER TABLE `invoice_items` ADD `item_order` INT(11) NOT NULL DEFAULT 0 AFTER `item_total`");
@ -1430,10 +1422,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
}
//
// Be sure to change database_version.php to reflect the version you are updating to here
// Please add this same comment block to the bottom of this file, and update the version number.
// Uncomment Below Lines, to add additional database updates
//
if (CURRENT_DATABASE_VERSION == '0.8.9') {
// Insert queries here required to update to DB version 0.9.0
// Update existing quotes and recurrings so that item_order is set to item_id
@ -1483,6 +1472,24 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
}
// Be sure to change database_version.php to reflect the version you are updating to here
// Please add this same comment block to the bottom of this file, and update the version number.
// Uncomment Below Lines, to add additional database updates
//
if (CURRENT_DATABASE_VERSION == '0.9.0') {
//add leads column to clients table
mysqli_query($mysqli, "ALTER TABLE `clients` ADD `client_lead` TINYINT(1) NOT NULL DEFAULT 0 AFTER `client_id`");
// Then, update the database to the next sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.1'");
}
//if (CURRENT_DATABASE_VERSION == '0.9.1') {
// Insert queries here required to update to DB version 0.9.0
// Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.2'");
//}
} else {
// Up-to-date
}

View File

@ -6,3 +6,4 @@
*/
DEFINE("LATEST_DATABASE_VERSION", "0.9.2");

1
db.sql
View File

@ -275,6 +275,7 @@ DROP TABLE IF EXISTS `clients`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clients` (
`client_id` int(11) NOT NULL AUTO_INCREMENT,
`client_lead` tinyint(1) NOT NULL DEFAULT 0,
`client_name` varchar(200) NOT NULL,
`client_type` varchar(200) DEFAULT NULL,
`client_website` varchar(200) DEFAULT NULL,

View File

@ -25,7 +25,7 @@ if (isset($_POST['add_client'])) {
$extended_log_description = '';
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_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_notes = '$notes', client_accessed_at = NOW()");
$client_id = mysqli_insert_id($mysqli);
@ -113,7 +113,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_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_notes = '$notes' WHERE client_id = $client_id");
//Tags
//Delete existing tags

View File

@ -8,3 +8,4 @@ $currency_code = sanitizeInput($_POST['currency_code']);
$net_terms = intval($_POST['net_terms']);
$tax_id_number = sanitizeInput($_POST['tax_id_number']);
$notes = sanitizeInput($_POST['notes']);
$lead = intval($_POST['lead']);

View File

@ -16,7 +16,7 @@ if ($config_enable_setup == 0) {
exit;
}
include_once("settings_localization_arrays.php");
include_once("settings_localization_array.php");
// Get a list of all available timezones
$timezones = DateTimeZone::listIdentifiers();

View File

@ -68,6 +68,12 @@
if ($config_module_enable_accounting == 1) { ?>
<li class="nav-header mt-3">SALES</li>
<li class="nav-item">
<a href="client_leads.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_leads.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-bullhorn"></i>
<p>Leads</p>
</a>
</li>
<li class="nav-item">
<a href="quotes.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "quotes.php" || basename($_SERVER["PHP_SELF"]) == "quote.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-comment-dollar"></i>