mirror of
https://github.com/itflow-org/itflow
synced 2026-08-10 09:37:15 +00:00
More sweeps to replace select * with actual returned column names dramatically reduces php memory usage and speeds up processing dramatically especially in the crons since they run all the time
This commit is contained in:
@@ -239,7 +239,7 @@ if (isset($_GET['share_generate_link'])) {
|
||||
$url = "https://$config_base_url/guest/guest_view_item.php?id=$share_id&key=$item_key";
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * 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_assoc($sql);
|
||||
$company_name = escapeSql($row['company_name']);
|
||||
$company_phone = escapeSql(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||
@@ -837,7 +837,7 @@ if (isset($_GET['ai_reword'])) {
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$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 ai_model_name, ai_model_prompt, ai_provider_api_key, ai_provider_api_url 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_assoc($sql);
|
||||
$model_name = $row['ai_model_name'];
|
||||
@@ -908,7 +908,7 @@ if (isset($_GET['ai_create_document_template'])) {
|
||||
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
$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 ai_model_name, ai_provider_api_key, ai_provider_api_url 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_assoc($sql);
|
||||
$model_name = $row['ai_model_name'];
|
||||
@@ -966,7 +966,7 @@ if (isset($_GET['ai_ticket_summary'])) {
|
||||
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
$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 ai_model_name, ai_provider_api_key, ai_provider_api_url 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_assoc($sql);
|
||||
$model_name = $row['ai_model_name'];
|
||||
|
||||
@@ -14,7 +14,15 @@ if (isset($_GET['client_id'])) {
|
||||
if (isset($_GET['asset_id'])) {
|
||||
$asset_id = intval($_GET['asset_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_contact_id, asset_created_at, asset_description, asset_favorite, asset_id,
|
||||
asset_install_date, asset_location_id, asset_make, asset_model, asset_name, asset_notes,
|
||||
asset_os, asset_photo, asset_physical_location, asset_purchase_date,
|
||||
asset_purchase_reference, asset_serial, asset_status, asset_type, asset_uri, asset_uri_2,
|
||||
asset_uri_client, asset_vendor_id, asset_warranty_expire, client_id, client_name,
|
||||
contact_archived_at, contact_email, contact_extension, contact_mobile,
|
||||
contact_mobile_country_code, contact_name, contact_phone, contact_phone_country_code,
|
||||
interface_ip, interface_ipv6, interface_mac, interface_nat_ip, interface_network_id,
|
||||
location_archived_at, location_name FROM assets
|
||||
LEFT JOIN clients ON client_id = asset_client_id
|
||||
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||
LEFT JOIN locations ON asset_location_id = location_id
|
||||
@@ -125,7 +133,7 @@ if (isset($_GET['asset_id'])) {
|
||||
// Tags - many to many relationship
|
||||
$asset_tag_name_display_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 tag_color, tag_icon, tag_id, tag_name 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_assoc($sql_asset_tags)) {
|
||||
|
||||
$asset_tag_id = intval($row['tag_id']);
|
||||
@@ -186,7 +194,7 @@ if (isset($_GET['asset_id'])) {
|
||||
$interface_count = mysqli_num_rows($sql_related_interfaces);
|
||||
|
||||
// Related Files
|
||||
$sql_related_files = mysqli_query($mysqli, "SELECT * FROM asset_files
|
||||
$sql_related_files = mysqli_query($mysqli, "SELECT file_created_at, file_description, file_ext, files.file_id, file_name FROM asset_files
|
||||
LEFT JOIN files ON asset_files.file_id = files.file_id
|
||||
WHERE asset_files.asset_id = $asset_id
|
||||
AND file_archived_at IS NULL
|
||||
@@ -692,7 +700,7 @@ if (isset($_GET['asset_id'])) {
|
||||
// Tags
|
||||
$credential_tag_name_display_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 tag_color, tag_icon, credential_tags.tag_id, tag_name 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_assoc($sql_credential_tags)) {
|
||||
|
||||
$credential_tag_id = intval($row['tag_id']);
|
||||
|
||||
@@ -647,7 +647,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
// Tags
|
||||
$asset_tag_name_display_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 tag_color, tag_icon, tag_id, tag_name 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_assoc($sql_asset_tags)) {
|
||||
|
||||
$asset_tag_id = intval($row['tag_id']);
|
||||
|
||||
@@ -38,7 +38,7 @@ if (isset($_GET['calendar_id'])) {
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars");
|
||||
$sql = mysqli_query($mysqli, "SELECT calendar_color, calendar_feed_key, calendar_id, calendar_name FROM calendars");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$calendar_id = intval($row['calendar_id']);
|
||||
$calendar_name = escapeHtml($row['calendar_name']);
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once "includes/inc_all_client.php";
|
||||
|
||||
$sql_recent_activities = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM logs
|
||||
"SELECT log_created_at, log_description FROM logs
|
||||
WHERE log_client_id = $client_id
|
||||
ORDER BY log_created_at DESC
|
||||
LIMIT 5"
|
||||
@@ -63,7 +63,8 @@ $sql_recent_credentials = mysqli_query(
|
||||
|
||||
$sql_shared_items = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM shared_items
|
||||
"SELECT item_active, item_created_at, item_expire_at, item_id, item_key, item_note, item_recipient,
|
||||
item_related_id, item_type, item_view_limit, item_views FROM shared_items
|
||||
WHERE item_client_id = $client_id
|
||||
AND item_active = 1
|
||||
ORDER BY item_created_at ASC
|
||||
|
||||
@@ -369,7 +369,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
// 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.tag_id = tags.tag_id WHERE client_id = $client_id ORDER BY tag_name ASC");
|
||||
$sql_client_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, client_tags.tag_id, tag_name 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_assoc($sql_client_tags)) {
|
||||
$client_tag_id = intval($row['tag_id']);
|
||||
$client_tag_name = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -14,7 +14,11 @@ if (isset($_GET['client_id'])) {
|
||||
if (isset($_GET['contact_id'])) {
|
||||
$contact_id = intval($_GET['contact_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name, contact_billing, contact_client_id, contact_created_at,
|
||||
contact_department, contact_email, contact_extension, contact_important,
|
||||
contact_location_id, contact_mobile, contact_mobile_country_code, contact_name,
|
||||
contact_notes, contact_phone, contact_phone_country_code, contact_photo, contact_pin,
|
||||
contact_primary, contact_technical, contact_title, location_name, user_auth_method FROM contacts
|
||||
LEFT JOIN clients ON client_id = contact_client_id
|
||||
LEFT JOIN locations ON location_id = contact_location_id
|
||||
LEFT JOIN users ON user_id = contact_user_id
|
||||
@@ -126,7 +130,7 @@ if (isset($_GET['contact_id'])) {
|
||||
// Tags - many to many relationship
|
||||
$contact_tag_name_display_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 tag_color, tag_icon, contact_tags.tag_id, tag_name 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_assoc($sql_contact_tags)) {
|
||||
|
||||
$contact_tag_id = intval($row['tag_id']);
|
||||
@@ -182,7 +186,7 @@ if (isset($_GET['contact_id'])) {
|
||||
$linked_documents = array();
|
||||
|
||||
// Linked Files
|
||||
$sql_linked_files = mysqli_query($mysqli, "SELECT * FROM contact_files, files
|
||||
$sql_linked_files = mysqli_query($mysqli, "SELECT file_created_at, file_description, files.file_id, file_mime_type, file_name, file_size FROM contact_files, files
|
||||
WHERE contact_files.contact_id = $contact_id
|
||||
AND contact_files.file_id = files.file_id
|
||||
AND file_archived_at IS NULL
|
||||
@@ -429,7 +433,7 @@ if (isset($_GET['contact_id'])) {
|
||||
// Tags
|
||||
$asset_tag_name_display_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 tag_color, tag_icon, tag_id, tag_name 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_assoc($sql_asset_tags)) {
|
||||
|
||||
$asset_tag_id = intval($row['tag_id']);
|
||||
@@ -583,7 +587,7 @@ if (isset($_GET['contact_id'])) {
|
||||
// Tags
|
||||
$credential_tag_name_display_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 tag_color, tag_icon, credential_tags.tag_id, tag_name 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_assoc($sql_credential_tags)) {
|
||||
|
||||
$credential_tag_id = intval($row['tag_id']);
|
||||
|
||||
@@ -444,7 +444,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
// Tags
|
||||
$contact_tag_name_display_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 tag_color, tag_icon, contact_tags.tag_id, tag_name 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_assoc($sql_contact_tags)) {
|
||||
|
||||
$contact_tag_id = intval($row['tag_id']);
|
||||
|
||||
@@ -349,7 +349,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
// Tags
|
||||
$credential_tag_name_display_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 tag_color, tag_icon, credential_tags.tag_id, tag_name 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_assoc($sql_credential_tags)) {
|
||||
|
||||
$credential_tag_id = intval($row['tag_id']);
|
||||
@@ -389,7 +389,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
// Check if shared
|
||||
$sql_shared = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM shared_items
|
||||
"SELECT item_active, item_created_at, item_expire_at, item_id, item_key, item_note, item_recipient,
|
||||
item_related_id, item_type, item_view_limit, item_views FROM shared_items
|
||||
WHERE item_client_id = $client_id
|
||||
AND item_active = 1
|
||||
AND (COALESCE(item_view_limit, 0) = 0 OR item_views < item_view_limit)
|
||||
|
||||
@@ -16,7 +16,7 @@ if (isset($_GET['enable_technical'])) {
|
||||
}
|
||||
|
||||
// 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 user_config_dashboard_financial_enable, user_config_dashboard_technical_enable FROM user_settings WHERE user_id = $session_user_id");
|
||||
$row = mysqli_fetch_assoc($sql_user_dashboard_settings);
|
||||
$user_config_dashboard_financial_enable = intval($row['user_config_dashboard_financial_enable']);
|
||||
$user_config_dashboard_technical_enable = intval($row['user_config_dashboard_technical_enable']);
|
||||
|
||||
@@ -17,7 +17,9 @@ if (isset($_GET['document_id'])) {
|
||||
|
||||
$folder_location = 0;
|
||||
|
||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM documents
|
||||
$sql_document = mysqli_query($mysqli, "SELECT document_archived_at, document_client_visible, document_content, document_created_at,
|
||||
document_created_by, document_description, document_folder_id, document_name,
|
||||
document_updated_at, folder_name, user_name FROM documents
|
||||
LEFT JOIN folders ON document_folder_id = folder_id
|
||||
LEFT JOIN users ON document_created_by = user_id
|
||||
WHERE document_client_id = $client_id AND document_id = $document_id
|
||||
@@ -209,7 +211,7 @@ $page_title = $row['document_name'];
|
||||
</button>
|
||||
</h6>
|
||||
<?php
|
||||
$sql_files = mysqli_query($mysqli, "SELECT * FROM files, document_files
|
||||
$sql_files = mysqli_query($mysqli, "SELECT file_folder_id, files.file_id, file_name FROM files, document_files
|
||||
WHERE document_files.file_id = files.file_id
|
||||
AND document_files.document_id = $document_id
|
||||
ORDER BY file_name ASC"
|
||||
|
||||
@@ -99,7 +99,7 @@ function displayFolders($parent_folder_id, $client_id, $indent = 0, $render_root
|
||||
|
||||
$sql_folders = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM folders
|
||||
"SELECT folder_id, folder_name FROM folders
|
||||
WHERE parent_folder = $parent_folder_id
|
||||
AND folder_client_id = $client_id
|
||||
ORDER BY folder_name ASC"
|
||||
@@ -731,7 +731,7 @@ $num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num'])
|
||||
// Shared?
|
||||
$sql_shared = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM shared_items
|
||||
"SELECT item_expire_at, item_recipient FROM shared_items
|
||||
WHERE item_client_id = $client_id
|
||||
AND item_active = 1
|
||||
AND (COALESCE(item_view_limit, 0) = 0 OR item_views < item_view_limit)
|
||||
@@ -843,7 +843,7 @@ $num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num'])
|
||||
|
||||
$sql_shared = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM shared_items
|
||||
"SELECT item_expire_at, item_recipient FROM shared_items
|
||||
WHERE item_client_id = $client_id
|
||||
AND item_active = 1
|
||||
AND (COALESCE(item_view_limit, 0) = 0 OR item_views < item_view_limit)
|
||||
|
||||
@@ -18,7 +18,13 @@ if (isset($_GET['client_id'])) {
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM clients
|
||||
"SELECT client_abbreviation, client_archived_at, client_created_at, client_currency_code,
|
||||
client_lead, client_name, client_net_terms, client_notes, client_rate, client_referral,
|
||||
client_tax_id_number, client_type, client_website, contact_email, contact_extension,
|
||||
contact_id, contact_mobile, contact_mobile_country_code, contact_name, contact_phone,
|
||||
contact_phone_country_code, contact_primary, contact_title, location_address,
|
||||
location_city, location_country, location_id, location_name, location_phone,
|
||||
location_phone_country_code, location_primary, location_state, location_zip FROM clients
|
||||
LEFT JOIN locations ON client_id = location_client_id AND location_primary = 1
|
||||
LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1
|
||||
WHERE client_id = $client_id"
|
||||
@@ -75,7 +81,7 @@ if (isset($_GET['client_id'])) {
|
||||
|
||||
$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.tag_id = tags.tag_id WHERE client_id = $client_id ORDER BY tag_name ASC");
|
||||
$sql_client_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, client_tags.tag_id, tag_name 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_assoc($sql_client_tags)) {
|
||||
|
||||
$client_tag_id = intval($row['tag_id']);
|
||||
|
||||
@@ -16,7 +16,13 @@ if (isset($_GET['invoice_id'])) {
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM invoices
|
||||
"SELECT client_currency_code, client_id, client_name, client_net_terms, client_website,
|
||||
contact_email, contact_extension, contact_mobile, contact_mobile_country_code,
|
||||
contact_phone, contact_phone_country_code, invoice_amount, invoice_category_id,
|
||||
invoice_created_at, invoice_credit_amount, invoice_currency_code, invoice_date,
|
||||
invoice_discount_amount, invoice_due, invoice_id, invoice_note, invoice_number,
|
||||
invoice_prefix, invoice_scope, invoice_status, invoice_url_key, location_address,
|
||||
location_city, location_country, location_state, location_zip FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1
|
||||
LEFT JOIN locations ON client_id = location_client_id AND location_primary = 1
|
||||
@@ -77,7 +83,9 @@ if (isset($_GET['invoice_id'])) {
|
||||
$tab_title = $row['client_name'];
|
||||
$page_title = "{$row['invoice_prefix']}{$row['invoice_number']}";
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT company_address, company_city, company_country, company_email, company_id, company_logo,
|
||||
company_name, company_phone, company_phone_country_code, company_state, company_tax_id,
|
||||
company_website, company_zip FROM companies WHERE company_id = 1");
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$company_id = intval($row['company_id']);
|
||||
$company_name = escapeHtml($row['company_name']);
|
||||
@@ -98,7 +106,7 @@ if (isset($_GET['invoice_id'])) {
|
||||
}
|
||||
$company_logo = escapeHtml($row['company_logo']);
|
||||
|
||||
$sql_history = mysqli_query($mysqli, "SELECT * FROM history WHERE history_invoice_id = $invoice_id ORDER BY history_id DESC");
|
||||
$sql_history = mysqli_query($mysqli, "SELECT history_created_at, history_description, history_status FROM history WHERE history_invoice_id = $invoice_id ORDER BY history_id DESC");
|
||||
|
||||
$sql_payments = mysqli_query($mysqli, "SELECT account_name, payment_amount, payment_currency_code, payment_date, payment_id,
|
||||
payment_reference FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||
@@ -471,7 +479,7 @@ if (isset($_GET['invoice_id'])) {
|
||||
<select class="form-control select2" name="tax_id" id="tax" required>
|
||||
<option value="0">No Tax</option>
|
||||
<?php
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE tax_archived_at IS NULL ORDER BY tax_name ASC");
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT tax_id, tax_name, tax_percent FROM taxes WHERE tax_archived_at IS NULL ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($taxes_sql)) {
|
||||
$tax_id = intval($row['tax_id']);
|
||||
$tax_name = escapeHtml($row['tax_name']);
|
||||
|
||||
@@ -366,7 +366,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
// Saved Payment Methods
|
||||
$sql_saved_payment_methods = mysqli_query($mysqli, "
|
||||
SELECT * FROM client_saved_payment_methods
|
||||
SELECT 1 FROM client_saved_payment_methods
|
||||
LEFT JOIN payment_providers
|
||||
ON client_saved_payment_methods.saved_payment_provider_id = payment_providers.payment_provider_id
|
||||
WHERE saved_payment_client_id = $client_id
|
||||
|
||||
@@ -306,7 +306,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
$location_tag_name_display_array = array();
|
||||
$location_tag_id_array = array();
|
||||
$sql_location_tags = mysqli_query($mysqli, "SELECT * FROM location_tags LEFT JOIN tags ON location_tags.tag_id = tags.tag_id WHERE location_tags.location_id = $location_id ORDER BY tag_name ASC");
|
||||
$sql_location_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, location_tags.tag_id, tag_name FROM location_tags LEFT JOIN tags ON location_tags.tag_id = tags.tag_id WHERE location_tags.location_id = $location_id ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_location_tags)) {
|
||||
|
||||
$location_tag_id = intval($row['tag_id']);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_financial', 2);
|
||||
|
||||
$account_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_id = $account_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT account_name, account_notes FROM accounts WHERE account_id = $account_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$account_name = escapeHtml($row['account_name']);
|
||||
|
||||
@@ -6,7 +6,15 @@ enforceUserPermission('module_support');
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_contact_id, asset_created_at, asset_description, asset_favorite, asset_id,
|
||||
asset_install_date, asset_location_id, asset_make, asset_model, asset_name, asset_notes,
|
||||
asset_os, asset_photo, asset_physical_location, asset_purchase_date,
|
||||
asset_purchase_reference, asset_serial, asset_status, asset_type, asset_uri, asset_uri_2,
|
||||
asset_uri_client, asset_vendor_id, asset_warranty_expire, client_id, client_name,
|
||||
contact_archived_at, contact_email, contact_extension, contact_mobile,
|
||||
contact_mobile_country_code, contact_name, contact_phone, contact_phone_country_code,
|
||||
interface_ip, interface_ipv6, interface_mac, interface_nat_ip, interface_network_id,
|
||||
location_archived_at, location_name FROM assets
|
||||
LEFT JOIN clients ON client_id = asset_client_id
|
||||
LEFT JOIN contacts ON asset_contact_id = contact_id
|
||||
LEFT JOIN locations ON asset_location_id = location_id
|
||||
@@ -82,7 +90,7 @@ if ($location_archived_at) {
|
||||
// Tags - many to many relationship
|
||||
$asset_tag_name_display_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 tag_color, tag_icon, tag_id, tag_name 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_assoc($sql_asset_tags)) {
|
||||
|
||||
$asset_tag_id = intval($row['tag_id']);
|
||||
@@ -200,7 +208,7 @@ $sql_related_documents = mysqli_query($mysqli, "SELECT document_created_at, docu
|
||||
$document_count = mysqli_num_rows($sql_related_documents);
|
||||
|
||||
// Related Files
|
||||
$sql_related_files = mysqli_query($mysqli, "SELECT * FROM asset_files
|
||||
$sql_related_files = mysqli_query($mysqli, "SELECT file_created_at, file_description, file_ext, files.file_id, file_mime_type, file_name FROM asset_files
|
||||
LEFT JOIN files ON asset_files.file_id = files.file_id
|
||||
WHERE asset_files.asset_id = $asset_id
|
||||
AND file_archived_at IS NULL
|
||||
@@ -573,7 +581,7 @@ ob_start();
|
||||
// Tags
|
||||
$credential_tag_name_display_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 tag_color, tag_icon, credential_tags.tag_id, tag_name 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_assoc($sql_credential_tags)) {
|
||||
|
||||
$credential_tag_id = intval($row['tag_id']);
|
||||
|
||||
@@ -37,7 +37,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 5 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 5 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -6,7 +6,12 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_archived_at, asset_client_id, asset_contact_id, asset_created_at, asset_description,
|
||||
asset_id, asset_install_date, asset_location_id, asset_make, asset_model, asset_name,
|
||||
asset_notes, asset_os, asset_photo, asset_physical_location, asset_purchase_date,
|
||||
asset_purchase_reference, asset_serial, asset_status, asset_type, asset_uri, asset_uri_2,
|
||||
asset_vendor_id, asset_warranty_expire, interface_ip, interface_ipv6, interface_mac,
|
||||
interface_nat_ip, interface_network_id FROM assets
|
||||
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||
WHERE asset_id = $asset_id LIMIT 1"
|
||||
);
|
||||
|
||||
@@ -6,7 +6,12 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_archived_at, asset_client_id, asset_contact_id, asset_created_at, asset_description,
|
||||
asset_favorite, asset_id, asset_install_date, asset_location_id, asset_make, asset_model,
|
||||
asset_name, asset_notes, asset_os, asset_photo, asset_physical_location,
|
||||
asset_purchase_date, asset_purchase_reference, asset_serial, asset_status, asset_type,
|
||||
asset_uri, asset_uri_2, asset_uri_client, asset_vendor_id, asset_warranty_expire,
|
||||
interface_ip, interface_ipv6, interface_mac, interface_nat_ip, interface_network_id FROM assets
|
||||
LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1
|
||||
WHERE asset_id = $asset_id LIMIT 1"
|
||||
);
|
||||
@@ -47,7 +52,7 @@ $asset_network_id = intval($row['interface_network_id']);
|
||||
$device_icon = getAssetIcon($asset_type);
|
||||
|
||||
// Asset History Query
|
||||
$sql_asset_history = mysqli_query($mysqli, "SELECT * FROM asset_history
|
||||
$sql_asset_history = mysqli_query($mysqli, "SELECT asset_history_created_at, asset_history_description, asset_history_status FROM asset_history
|
||||
WHERE asset_history_asset_id = $asset_id
|
||||
ORDER BY asset_history_id
|
||||
DESC LIMIT 10"
|
||||
@@ -506,7 +511,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 5 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 5 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -4,7 +4,9 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$interface_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM asset_interfaces
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_client_id, asset_name, interface_asset_id, interface_description, interface_id,
|
||||
interface_ip, interface_ipv6, interface_mac, interface_name, interface_nat_ip,
|
||||
interface_network_id, interface_notes, interface_primary, interface_type FROM asset_interfaces
|
||||
LEFT JOIN assets ON asset_id = interface_asset_id
|
||||
WHERE interface_id = $interface_id LIMIT 1"
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_credential', 2);
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_client_id, asset_name FROM assets
|
||||
WHERE asset_id = $asset_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_client_id, asset_name FROM assets
|
||||
WHERE asset_id = $asset_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_credential', 2);
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_client_id, asset_name FROM assets
|
||||
WHERE asset_id = $asset_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_client_id, asset_name FROM assets
|
||||
WHERE asset_id = $asset_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$asset_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_client_id, asset_name FROM assets
|
||||
WHERE asset_id = $asset_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$calendar_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars WHERE calendar_id = $calendar_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT calendar_color, calendar_name FROM calendars WHERE calendar_id = $calendar_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$calendar_name = escapeHtml($row['calendar_name']);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<option value="">- Calendar -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars ORDER BY calendar_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT calendar_color, calendar_id, calendar_name FROM calendars ORDER BY calendar_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$calendar_id = intval($row['calendar_id']);
|
||||
$calendar_name = escapeHtml($row['calendar_name']);
|
||||
|
||||
@@ -4,7 +4,8 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$event_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE event_id = $event_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT calendar_color, calendar_id, calendar_name, event_all_day, event_client_id,
|
||||
event_description, event_end, event_location, event_repeat, event_start, event_title FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE event_id = $event_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$event_title = escapeHtml($row['event_title']);
|
||||
@@ -78,7 +79,7 @@ ob_start();
|
||||
<select class="form-control select2" name="calendar" required>
|
||||
<?php
|
||||
|
||||
$sql_calendars_select = mysqli_query($mysqli, "SELECT * FROM calendars ORDER BY calendar_name ASC");
|
||||
$sql_calendars_select = mysqli_query($mysqli, "SELECT calendar_color, calendar_id, calendar_name FROM calendars ORDER BY calendar_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_calendars_select)) {
|
||||
$calendar_id_select = intval($row['calendar_id']);
|
||||
$calendar_name_select = escapeHtml($row['calendar_name']);
|
||||
|
||||
@@ -4,7 +4,8 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$calendar_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars WHERE calendar_id = $calendar_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT calendar_color, calendar_feed_accessed_at, calendar_feed_busy_only,
|
||||
calendar_feed_created_at, calendar_feed_key, calendar_name FROM calendars WHERE calendar_id = $calendar_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$calendar_name = escapeHtml($row['calendar_name']);
|
||||
|
||||
@@ -6,7 +6,9 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$certificate_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_id = $certificate_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT certificate_client_id, certificate_created_at, certificate_description, certificate_domain,
|
||||
certificate_domain_id, certificate_expire, certificate_issued_by, certificate_name,
|
||||
certificate_notes, certificate_public_key FROM certificates WHERE certificate_id = $certificate_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$certificate_name = escapeHtml($row['certificate_name']);
|
||||
|
||||
@@ -6,9 +6,9 @@ require_once '../../../includes/modal_header.php';
|
||||
$leads_filter = intval($_GET['lead'] ?? 0);
|
||||
|
||||
// Selects
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT category_name FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||
|
||||
$net_terms_array = array (
|
||||
'0'=>'On Receipt',
|
||||
|
||||
@@ -38,7 +38,7 @@ ob_start();
|
||||
<select class="form-control select2" name="bulk_tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -31,7 +31,7 @@ ob_start();
|
||||
<select class="form-control select2" name="bulk_referral">
|
||||
<option value="">- Select a Referral -</option>
|
||||
<?php
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT category_name FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($referral_sql)) {
|
||||
$referral = escapeHtml($row['category_name']); ?>
|
||||
<option><?= $referral ?></option>
|
||||
|
||||
@@ -8,7 +8,9 @@ $client_id = intval($_GET['id']);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = $client_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT client_abbreviation, client_archived_at, client_created_at, client_lead, client_name,
|
||||
client_net_terms, client_notes, client_rate, client_referral, client_tax_id_number,
|
||||
client_type, client_website FROM clients WHERE client_id = $client_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_name = escapeHtml($row['client_name']);
|
||||
@@ -132,7 +134,7 @@ ob_start();
|
||||
<option value="">- Select Referral -</option>
|
||||
<?php
|
||||
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Referral' AND (category_archived_at > '$client_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT category_name FROM categories WHERE category_type = 'Referral' AND (category_archived_at > '$client_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($referral_sql)) {
|
||||
$referral = escapeHtml($row['category_name']);
|
||||
?>
|
||||
@@ -175,7 +177,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -6,7 +6,13 @@ enforceUserPermission('module_client');
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name, contact_billing, contact_client_id, contact_created_at,
|
||||
contact_department, contact_email, contact_extension, contact_important,
|
||||
contact_location_id, contact_mobile, contact_mobile_country_code, contact_name,
|
||||
contact_notes, contact_phone, contact_phone_country_code, contact_photo, contact_pin,
|
||||
contact_primary, contact_technical, contact_title, location_address, location_city,
|
||||
location_country, location_name, location_phone, location_phone_country_code,
|
||||
location_state, location_zip, user_auth_method FROM contacts
|
||||
LEFT JOIN clients ON client_id = contact_client_id
|
||||
LEFT JOIN locations ON location_id = contact_location_id
|
||||
LEFT JOIN users ON user_id = contact_user_id
|
||||
@@ -112,7 +118,7 @@ $recurring_ticket_count = mysqli_num_rows($sql_related_recurring_tickets);
|
||||
// Tags - many to many relationship
|
||||
$contact_tag_name_display_array = array();
|
||||
$contact_tag_id_array = array();
|
||||
$sql_contact_tags = mysqli_query($mysqli, "SELECT * FROM contact_tags
|
||||
$sql_contact_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, contact_tags.tag_id, tag_name FROM contact_tags
|
||||
LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id
|
||||
WHERE contact_id = $contact_id
|
||||
ORDER BY tag_name ASC
|
||||
@@ -173,7 +179,7 @@ $document_count = mysqli_num_rows($sql_linked_documents);
|
||||
$linked_documents = array();
|
||||
|
||||
// Linked Files
|
||||
$sql_linked_files = mysqli_query($mysqli, "SELECT * FROM contact_files, files
|
||||
$sql_linked_files = mysqli_query($mysqli, "SELECT file_created_at, file_description, files.file_id, file_mime_type, file_name, file_size FROM contact_files, files
|
||||
WHERE contact_files.contact_id = $contact_id
|
||||
AND contact_files.file_id = files.file_id
|
||||
AND file_archived_at IS NULL
|
||||
@@ -481,7 +487,7 @@ ob_start();
|
||||
|
||||
// Tags
|
||||
$asset_tag_name_display_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 tag_color, tag_icon, tag_id, tag_name 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 ($row2 = mysqli_fetch_assoc($sql_asset_tags)) {
|
||||
$asset_tag_id = intval($row2['tag_id']);
|
||||
$asset_tag_name = escapeHtml($row2['tag_name']);
|
||||
|
||||
@@ -37,7 +37,7 @@ ob_start();
|
||||
<select class="form-control select2" name="bulk_tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 3 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 3 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -6,7 +6,11 @@ enforceUserPermission('module_client', 2);
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_archived_at, contact_billing, contact_client_id, contact_created_at,
|
||||
contact_department, contact_email, contact_extension, contact_important,
|
||||
contact_location_id, contact_mobile, contact_mobile_country_code, contact_name,
|
||||
contact_notes, contact_phone, contact_phone_country_code, contact_photo, contact_pin,
|
||||
contact_primary, contact_technical, contact_title, contact_user_id, user_auth_method FROM contacts
|
||||
LEFT JOIN users ON user_id = contact_user_id
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1"
|
||||
@@ -318,7 +322,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 3 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 3 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -233,7 +233,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 4 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 4 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -36,7 +36,7 @@ ob_start();
|
||||
<select class="form-control select2" name="bulk_tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 4 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 4 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -6,7 +6,10 @@ enforceUserPermission('module_credential', 2);
|
||||
|
||||
$credential_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM credentials WHERE credential_id = $credential_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT credential_archived_at, credential_asset_id, credential_client_id, credential_contact_id,
|
||||
credential_created_at, credential_description, credential_favorite, credential_name,
|
||||
credential_note, credential_otp_secret, credential_password, credential_uri,
|
||||
credential_uri_2, credential_username FROM credentials WHERE credential_id = $credential_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_id = intval($row['credential_client_id']);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<select class="form-control select2" name="file_id">
|
||||
<option value="">- Select a File -</option>
|
||||
<?php
|
||||
$sql_files_select = mysqli_query($mysqli, "SELECT * FROM files
|
||||
$sql_files_select = mysqli_query($mysqli, "SELECT file_id, file_name, folder_name FROM files
|
||||
LEFT JOIN folders ON folder_id = file_folder_id
|
||||
WHERE file_client_id = $client_id ORDER BY folder_name ASC, file_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_files_select)) {
|
||||
|
||||
@@ -77,7 +77,7 @@ ob_start();
|
||||
<select class="form-control" name="folder">
|
||||
<option value="0">/</option>
|
||||
<?php
|
||||
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
$sql_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_folders)) {
|
||||
$folder_id = intval($row['folder_id']);
|
||||
$folder_name = escapeHtml($row['folder_name']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$document_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_client_visible, document_content, document_description,
|
||||
document_folder_id, document_name FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$document_name = escapeHtml($row['document_name']);
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$document_id = intval($_GET['document_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_client_visible, document_name FROM documents
|
||||
WHERE document_id = $document_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$document_id = intval($_GET['document_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_name FROM documents
|
||||
WHERE document_id = $document_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$document_id = intval($_GET['document_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_name FROM documents
|
||||
WHERE document_id = $document_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$document_id = intval($_GET['document_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_name FROM documents
|
||||
WHERE document_id = $document_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$document_id = intval($_GET['document_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_name FROM documents
|
||||
WHERE document_id = $document_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$document_id = intval($_GET['document_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_name FROM documents
|
||||
WHERE document_id = $document_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$document_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_folder_id, document_name FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_id = intval($row['document_client_id']);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$document_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_name FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_id = intval($row['document_client_id']);
|
||||
|
||||
@@ -14,7 +14,7 @@ $purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
$document_version_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM document_versions LEFT JOIN documents ON document_id = document_version_document_id WHERE document_version_id = $document_version_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_version_content, document_version_name FROM document_versions LEFT JOIN documents ON document_id = document_version_document_id WHERE document_version_id = $document_version_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$document_version_name = escapeHtml($row['document_version_name']);
|
||||
|
||||
@@ -14,7 +14,7 @@ $purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
$document_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT document_client_id, document_content, document_name FROM documents WHERE document_id = $document_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$document_name = escapeHtml($row['document_name']);
|
||||
|
||||
@@ -6,7 +6,10 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$domain_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_id = $domain_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT domain_archived_at, domain_client_id, domain_created_at, domain_description,
|
||||
domain_dnshost, domain_expire, domain_ip, domain_mail_servers, domain_mailhost,
|
||||
domain_name, domain_name_servers, domain_notes, domain_raw_whois, domain_registrar,
|
||||
domain_txt, domain_webhost FROM domains WHERE domain_id = $domain_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$domain_name = escapeHtml($row['domain_name']);
|
||||
|
||||
@@ -6,7 +6,9 @@ enforceUserPermission('module_financial', 2);
|
||||
|
||||
$expense_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = $expense_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT expense_account_id, expense_amount, expense_category_id, expense_client_id,
|
||||
expense_created_at, expense_currency_code, expense_date, expense_description,
|
||||
expense_receipt, expense_reference, expense_vendor_id FROM expenses WHERE expense_id = $expense_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$expense_date = escapeHtml($row['expense_date']);
|
||||
|
||||
@@ -6,7 +6,9 @@ enforceUserPermission('module_financial', 2);
|
||||
|
||||
$expense_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM expenses
|
||||
$sql = mysqli_query($mysqli, "SELECT category_name, expense_account_id, expense_amount, expense_category_id, expense_client_id,
|
||||
expense_created_at, expense_currency_code, expense_date, expense_description,
|
||||
expense_receipt, expense_reference, expense_vendor_id, vendor_name FROM expenses
|
||||
LEFT JOIN vendors ON expense_vendor_id = vendor_id
|
||||
LEFT JOIN categories ON expense_category_id = category_id
|
||||
WHERE expense_id = $expense_id LIMIT 1"
|
||||
|
||||
@@ -6,7 +6,9 @@ enforceUserPermission('module_financial', 2);
|
||||
|
||||
$expense_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = $expense_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT expense_account_id, expense_amount, expense_category_id, expense_client_id,
|
||||
expense_created_at, expense_currency_code, expense_date, expense_description,
|
||||
expense_receipt, expense_reference, expense_vendor_id FROM expenses WHERE expense_id = $expense_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$expense_date = escapeHtml($row['expense_date']);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$file_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = $file_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT file_client_id, file_ext, file_folder_id, file_name FROM files WHERE file_id = $file_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_id = intval($row['file_client_id']);
|
||||
|
||||
@@ -5,7 +5,7 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$file_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = $file_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT file_client_id, file_description, file_name FROM files WHERE file_id = $file_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_id = intval($row['file_client_id']);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$folder_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_id = $folder_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT folder_client_id, folder_name FROM folders WHERE folder_id = $folder_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$folder_name = escapeHtml($row['folder_name']);
|
||||
|
||||
@@ -68,7 +68,7 @@ ob_start();
|
||||
<option value="">- Category -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' 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 = escapeHtml($row['category_name']);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$invoice_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT client_name, invoice_client_id, invoice_number, invoice_prefix FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$invoice_prefix = escapeHtml($row['invoice_prefix']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$invoice_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name, invoice_category_id, invoice_created_at, invoice_date,
|
||||
invoice_discount_amount, invoice_due, invoice_number, invoice_prefix, invoice_scope FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$invoice_prefix = escapeHtml($row['invoice_prefix']);
|
||||
@@ -68,7 +69,7 @@ ob_start();
|
||||
<option value="">- Category -</option>
|
||||
<?php
|
||||
|
||||
$sql_income_category = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$invoice_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
$sql_income_category = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$invoice_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_income_category)) {
|
||||
$category_id_select = intval($row['category_id']);
|
||||
$category_name_select = escapeHtml($row['category_name']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$item_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoice_items LEFT JOIN invoices ON invoice_id = item_invoice_id WHERE item_id = $item_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT invoice_client_id, item_created_at, item_description, item_name, item_price,
|
||||
item_product_id, item_quantity, item_tax_id FROM invoice_items LEFT JOIN invoices ON invoice_id = item_invoice_id WHERE item_id = $item_id LIMIT 1");
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$item_name = escapeHtml($row['item_name']);
|
||||
$item_description = escapeHtml($row['item_description']);
|
||||
@@ -87,7 +88,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tax_id" required>
|
||||
<option value="0">No Tax</option>
|
||||
<?php
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT tax_id, tax_name, tax_percent FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($taxes_sql)) {
|
||||
$tax_id_select = intval($row['tax_id']);
|
||||
$tax_name = escapeHtml($row['tax_name']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales');
|
||||
|
||||
$invoice_id = intval($_GET['invoice_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT invoice_amount, invoice_client_id, invoice_currency_code, invoice_number, invoice_prefix,
|
||||
invoice_status FROM invoices WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$invoice_prefix = escapeHtml($row['invoice_prefix']);
|
||||
$invoice_number = escapeHtml($row['invoice_number']);
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$invoice_id = intval($_GET['invoice_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT invoice_client_id, invoice_number, invoice_prefix FROM invoices WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$invoice_prefix = escapeHtml($row['invoice_prefix']);
|
||||
|
||||
@@ -246,7 +246,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -36,7 +36,7 @@ ob_start();
|
||||
<select class="form-control select2" name="bulk_tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -34,7 +34,7 @@ enforceClientAccess();
|
||||
|
||||
// Tags
|
||||
$location_tag_id_array = array();
|
||||
$sql_location_tags = mysqli_query($mysqli, "SELECT * FROM location_tags WHERE location_id = $location_id");
|
||||
$sql_location_tags = mysqli_query($mysqli, "SELECT tag_id FROM location_tags WHERE location_id = $location_id");
|
||||
while ($row = mysqli_fetch_assoc($sql_location_tags)) {
|
||||
$location_tag_id = intval($row['tag_id']);
|
||||
$location_tag_id_array[] = $location_tag_id;
|
||||
@@ -267,7 +267,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT tag_id, tag_name FROM tags WHERE tag_type = 2 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = escapeHtml($row['tag_name']);
|
||||
|
||||
@@ -6,7 +6,9 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$network_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_id = $network_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT network, network_client_id, network_description, network_dhcp_range, network_gateway,
|
||||
network_location_id, network_name, network_notes, network_primary_dns,
|
||||
network_secondary_dns, network_vlan FROM networks WHERE network_id = $network_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$network_name = escapeHtml($row['network_name']);
|
||||
|
||||
@@ -6,7 +6,8 @@ $invoice_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM invoices
|
||||
"SELECT client_currency_code, client_id, client_name, contact_email, contact_name, invoice_amount,
|
||||
invoice_id, invoice_number, invoice_prefix FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1
|
||||
WHERE invoice_id = $invoice_id
|
||||
@@ -136,7 +137,7 @@ ob_start();
|
||||
<option value="">- Method of Payment -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM payment_methods ORDER BY payment_method_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT payment_method_name FROM payment_methods ORDER BY payment_method_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$payment_method_name = escapeHtml($row['payment_method_name']);
|
||||
?>
|
||||
|
||||
@@ -6,7 +6,7 @@ $client_id = intval($_GET['client_id']);
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM clients
|
||||
"SELECT client_currency_code, client_name, contact_email, contact_name FROM clients
|
||||
LEFT JOIN contacts ON clients.client_id = contacts.contact_client_id AND contact_primary = 1
|
||||
WHERE client_id = $client_id"
|
||||
);
|
||||
@@ -138,7 +138,7 @@ ob_start();
|
||||
<option value="">- Method of Payment -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM payment_methods ORDER BY payment_method_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT payment_method_name FROM payment_methods ORDER BY payment_method_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$payment_method_name = escapeHtml($row['payment_method_name']);
|
||||
?>
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$payment_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM payments LEFT JOIN invoices ON invoice_id = payment_invoice_id WHERE payment_id = $payment_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT invoice_client_id, payment_account_id, payment_amount, payment_date, payment_method,
|
||||
payment_reference FROM payments LEFT JOIN invoices ON invoice_id = payment_invoice_id WHERE payment_id = $payment_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$payment_date = escapeHtml($row['payment_date']);
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$invoice_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT invoice_amount, invoice_client_id, invoice_number, invoice_prefix FROM invoices WHERE invoice_id = $invoice_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$invoice_prefix = escapeHtml($row['invoice_prefix']);
|
||||
@@ -41,7 +41,7 @@ ob_start();
|
||||
<option value="">- Saved Payment Methods -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM client_saved_payment_methods WHERE saved_payment_client_id = $client_id ORDER BY saved_payment_description ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT saved_payment_description, saved_payment_id FROM client_saved_payment_methods WHERE saved_payment_client_id = $client_id ORDER BY saved_payment_description ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$saved_payment_id = intval($row['saved_payment_id']);
|
||||
$saved_payment_description = escapeHtml($row['saved_payment_description']);
|
||||
|
||||
@@ -67,7 +67,7 @@ ob_start();
|
||||
<option value="">- Select Category -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND category_archived_at IS NULL");
|
||||
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' AND category_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = escapeHtml($row['category_name']);
|
||||
@@ -111,7 +111,7 @@ ob_start();
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE tax_archived_at IS NULL ORDER BY tax_name ASC");
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT tax_id, tax_name, tax_percent FROM taxes WHERE tax_archived_at IS NULL ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($taxes_sql)) {
|
||||
$tax_id = intval($row['tax_id']);
|
||||
$tax_name = escapeHtml($row['tax_name']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$product_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM products WHERE product_id = $product_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT product_category_id, product_code, product_created_at, product_description,
|
||||
product_location, product_name, product_price, product_tax_id, product_type FROM products WHERE product_id = $product_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$product_name = escapeHtml($row['product_name']);
|
||||
@@ -53,7 +54,7 @@ ob_start();
|
||||
<select class="form-control select2" name="category" required>
|
||||
<?php
|
||||
|
||||
$sql_select = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$product_created_at' OR category_archived_at IS NULL)");
|
||||
$sql_select = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$product_created_at' OR category_archived_at IS NULL)");
|
||||
while ($row = mysqli_fetch_assoc($sql_select)) {
|
||||
$category_id_select = intval($row['category_id']);
|
||||
$category_name_select = escapeHtml($row['category_name']);
|
||||
@@ -96,7 +97,7 @@ ob_start();
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$product_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT tax_id, tax_name, tax_percent FROM taxes WHERE (tax_archived_at > '$product_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($taxes_sql)) {
|
||||
$tax_id_select = intval($row['tax_id']);
|
||||
$tax_name = escapeHtml($row['tax_name']);
|
||||
|
||||
@@ -6,7 +6,9 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$project_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT project_archived_at, project_client_id, project_completed_at, project_created_at,
|
||||
project_description, project_due, project_manager, project_name, project_number,
|
||||
project_prefix, project_updated_at FROM projects WHERE project_id = $project_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$project_prefix = escapeHtml($row['project_prefix']);
|
||||
|
||||
@@ -14,7 +14,7 @@ if ($client_id) {
|
||||
$client_ticket_select_query = '';
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT project_name FROM projects WHERE project_id = $project_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$project_name = escapeHtml($row['project_name']);
|
||||
|
||||
@@ -14,7 +14,7 @@ if ($client_id) {
|
||||
$client_ticket_select_query = '';
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT project_name FROM projects WHERE project_id = $project_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$project_name = escapeHtml($row['project_name']);
|
||||
|
||||
@@ -67,7 +67,7 @@ ob_start();
|
||||
<option value="">- Category -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' 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 = escapeHtml($row['category_name']);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$quote_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quotes LEFT JOIN clients ON quote_client_id = client_id WHERE quote_id = $quote_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name, quote_number, quote_prefix FROM quotes LEFT JOIN clients ON quote_client_id = client_id WHERE quote_id = $quote_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$quote_prefix = escapeHtml($row['quote_prefix']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$quote_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quotes LEFT JOIN clients ON quote_client_id = client_id WHERE quote_id = $quote_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT client_name, quote_category_id, quote_client_id, quote_created_at, quote_date,
|
||||
quote_discount_amount, quote_expire, quote_id, quote_number, quote_prefix, quote_scope FROM quotes LEFT JOIN clients ON quote_client_id = client_id WHERE quote_id = $quote_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$quote_id = intval($row['quote_id']);
|
||||
@@ -68,7 +69,7 @@ ob_start();
|
||||
<select class="form-control select2" name="category" required>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$quote_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$quote_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = escapeHtml($row['category_name']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$item_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quote_items LEFT JOIN quotes ON quote_id = item_quote_id WHERE item_id = $item_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT item_created_at, item_description, item_name, item_price, item_product_id, item_quantity,
|
||||
item_tax_id, quote_client_id FROM quote_items LEFT JOIN quotes ON quote_id = item_quote_id WHERE item_id = $item_id LIMIT 1");
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$item_name = escapeHtml($row['item_name']);
|
||||
$item_description = escapeHtml($row['item_description']);
|
||||
@@ -87,7 +88,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tax_id" required>
|
||||
<option value="0">No Tax</option>
|
||||
<?php
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT tax_id, tax_name, tax_percent FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($taxes_sql)) {
|
||||
$tax_id_select = intval($row['tax_id']);
|
||||
$tax_name = escapeHtml($row['tax_name']);
|
||||
|
||||
@@ -6,7 +6,7 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$quote_id = intval($_GET['quote_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_id = $quote_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT quote_client_id, quote_number, quote_prefix FROM quotes WHERE quote_id = $quote_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$quote_prefix = escapeHtml($row['quote_prefix']);
|
||||
|
||||
@@ -4,7 +4,7 @@ require_once '../../../includes/modal_header.php';
|
||||
|
||||
$rack_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT rack_client_id, rack_name FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$rack_name = escapeHtml($row['rack_name']);
|
||||
|
||||
@@ -6,7 +6,9 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$rack_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT rack_client_id, rack_created_at, rack_depth, rack_description, rack_location_id,
|
||||
rack_model, rack_name, rack_notes, rack_photo, rack_physical_location, rack_type,
|
||||
rack_units FROM racks WHERE rack_id = $rack_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$rack_name = escapeHtml($row['rack_name']);
|
||||
|
||||
@@ -6,7 +6,12 @@ enforceUserPermission('module_financial', 2);
|
||||
|
||||
$recurring_expense_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_expenses WHERE recurring_expense_id = $recurring_expense_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT recurring_expense_account_id, recurring_expense_amount, recurring_expense_category_id,
|
||||
recurring_expense_client_id, recurring_expense_created_at, recurring_expense_currency_code,
|
||||
recurring_expense_day, recurring_expense_description, recurring_expense_frequency,
|
||||
recurring_expense_last_sent, recurring_expense_month, recurring_expense_next_date,
|
||||
recurring_expense_payment_method, recurring_expense_reference, recurring_expense_status,
|
||||
recurring_expense_vendor_id FROM recurring_expenses WHERE recurring_expense_id = $recurring_expense_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$recurring_expense_frequency = intval($row['recurring_expense_frequency']);
|
||||
|
||||
@@ -92,7 +92,7 @@ ob_start();
|
||||
<option value="">- Category -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' 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 = escapeHtml($row['category_name']);
|
||||
|
||||
@@ -6,7 +6,10 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$recurring_invoice_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT recurring_invoice_category_id, recurring_invoice_client_id, recurring_invoice_created_at,
|
||||
recurring_invoice_discount_amount, recurring_invoice_frequency,
|
||||
recurring_invoice_next_date, recurring_invoice_number, recurring_invoice_prefix,
|
||||
recurring_invoice_scope, recurring_invoice_status FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$recurring_invoice_prefix = escapeHtml($row['recurring_invoice_prefix']);
|
||||
@@ -82,7 +85,7 @@ ob_start();
|
||||
<option value="">- Category -</option>
|
||||
<?php
|
||||
|
||||
$sql_income_category = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$recurring_invoice_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
$sql_income_category = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$recurring_invoice_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_income_category)) {
|
||||
$category_id_select = intval($row['category_id']);
|
||||
$category_name_select = escapeHtml($row['category_name']);
|
||||
|
||||
@@ -6,7 +6,8 @@ enforceUserPermission('module_sales', 2);
|
||||
|
||||
$item_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoice_items LEFT JOIN recurring_invoices ON recurring_invoice_id = item_recurring_invoice_id WHERE item_id = $item_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT item_created_at, item_description, item_name, item_price, item_product_id, item_quantity,
|
||||
item_tax_id, recurring_invoice_client_id FROM recurring_invoice_items LEFT JOIN recurring_invoices ON recurring_invoice_id = item_recurring_invoice_id WHERE item_id = $item_id LIMIT 1");
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$item_name = escapeHtml($row['item_name']);
|
||||
$item_description = escapeHtml($row['item_description']);
|
||||
@@ -87,7 +88,7 @@ ob_start();
|
||||
<select class="form-control select2" name="tax_id" required>
|
||||
<option value="0">No Tax</option>
|
||||
<?php
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT tax_id, tax_name, tax_percent FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($taxes_sql)) {
|
||||
$tax_id_select = intval($row['tax_id']);
|
||||
$tax_name = escapeHtml($row['tax_name']);
|
||||
|
||||
@@ -6,7 +6,10 @@ enforceUserPermission('module_support', 2);
|
||||
|
||||
$recurring_ticket_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id LIMIT 1");
|
||||
$sql = mysqli_query($mysqli, "SELECT recurring_ticket_asset_id, recurring_ticket_assigned_to, recurring_ticket_billable,
|
||||
recurring_ticket_category, recurring_ticket_client_id, recurring_ticket_contact_id,
|
||||
recurring_ticket_details, recurring_ticket_frequency, recurring_ticket_next_run,
|
||||
recurring_ticket_priority, recurring_ticket_subject, recurring_ticket_ticket_template_id FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$client_id = intval($row['recurring_ticket_client_id']);
|
||||
|
||||
@@ -92,7 +92,7 @@ ob_start();
|
||||
<option value="">- Category -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Income' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Income' 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 = escapeHtml($row['category_name']);
|
||||
@@ -131,7 +131,7 @@ ob_start();
|
||||
<option value="">- Method of Payment -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM payment_methods ORDER BY payment_method_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT payment_method_name FROM payment_methods ORDER BY payment_method_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$payment_method_name = escapeHtml($row['payment_method_name']);
|
||||
?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user