mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
BREAKING CHANGES: Major Backend Code Changes Updated Foreign keys to prepend their table names ex invoice_client_id, switched most queries over to JOIN instead of = Combined contacts and location into client removed client email, phone etc fields, tons of small bug fixes, and other small UI changes all across the board
This commit is contained in:
@@ -7,12 +7,14 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
||||
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
|
||||
$quote_id = intval($_GET['quote_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes, clients, settings, companies
|
||||
WHERE quotes.client_id = clients.client_id
|
||||
AND settings.company_id = companies.company_id
|
||||
AND companies.company_id = quotes.company_id
|
||||
AND quotes.quote_id = $quote_id
|
||||
AND quotes.quote_url_key = '$url_key'"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
|
||||
LEFT JOIN clients ON quote_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
LEFT JOIN companies ON quotes.company_id = companies.company_id
|
||||
LEFT JOIN settings ON settings.company_id = companies.company_id
|
||||
WHERE quote_id = $quote_id
|
||||
AND quote_url_key = '$url_key'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($sql) == 1){
|
||||
@@ -29,19 +31,19 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
||||
$category_id = $row['category_id'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($contact_phone)>2){
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$client_extension = $row['client_extension'];
|
||||
$client_mobile = $row['client_mobile'];
|
||||
if(strlen($client_mobile)>2){
|
||||
$client_mobile = substr($row['client_mobile'],0,3)."-".substr($row['client_mobile'],3,3)."-".substr($row['client_mobile'],6,4);
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
$client_currency_code = $row['client_currency_code'];
|
||||
@@ -78,7 +80,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
||||
}
|
||||
|
||||
//Mark viewed in history
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$quote_status', history_description = 'Quote viewed - $ip - $os - $browser - $device', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$quote_status', history_description = 'Quote viewed - $ip - $os - $browser - $device', history_created_at = NOW(), history_quote_id = $quote_id, company_id = $company_id");
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Quote Viewed', alert_message = 'Quote $quote_number has been viewed by $client_name - $ip - $os - $browser - $device', alert_date = NOW(), company_id = $company_id");
|
||||
|
||||
@@ -129,11 +131,11 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
||||
|
||||
<ul class="list-unstyled text-right">
|
||||
<li><h4><strong><?php echo $client_name; ?></strong></h4></li>
|
||||
<li><?php echo $client_address; ?></li>
|
||||
<li><?php echo "$client_city $client_state $client_zip"; ?></li>
|
||||
<li><?php echo "$client_phone $client_extension"; ?></li>
|
||||
<li><?php echo $client_mobile; ?></li>
|
||||
<li><?php echo $client_email; ?></li>
|
||||
<li><?php echo $location_address; ?></li>
|
||||
<li><?php echo "$location_city $location_state $location_zip"; ?></li>
|
||||
<li><?php echo "$contact_phone $contact_extension"; ?></li>
|
||||
<li><?php echo $contact_mobile; ?></li>
|
||||
<li><?php echo $contact_email; ?></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -151,7 +153,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE quote_id = $quote_id ORDER BY item_id ASC"); ?>
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_id ASC"); ?>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
@@ -314,7 +316,7 @@ var docDefinition = {
|
||||
style: 'invoiceBillingAddress'
|
||||
},
|
||||
{
|
||||
text: <?php echo json_encode("$client_address \n $client_city $client_state $client_zip \n $client_email \n $client_phone"); ?>,
|
||||
text: <?php echo json_encode("$location_address \n $location_city $location_state $location_zip \n $contact_email \n $contact_phone"); ?>,
|
||||
style: 'invoiceBillingAddressClient'
|
||||
},
|
||||
]
|
||||
@@ -391,7 +393,7 @@ var docDefinition = {
|
||||
$total_tax = 0;
|
||||
$sub_total = 0;
|
||||
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE quote_id = $quote_id ORDER BY item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$item_name = $row['item_name'];
|
||||
@@ -401,7 +403,7 @@ var docDefinition = {
|
||||
$item_subtotal = $row['item_price'];
|
||||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user